MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawDisplayPickup

Method DrawDisplayPickup

TombEngine/Renderer/RendererDrawMenu.cpp:785–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783 }
784
785 void Renderer::DrawDisplayPickup(const DisplayPickup& pickup)
786 {
787 constexpr auto COUNT_STRING_INF = "Inf";
788 constexpr auto COUNT_STRING_OFFSET = Vector2(DISPLAY_SPACE_RES.x / 40, 0.0f);
789
790 auto pos = Vector2::Lerp(pickup.PrevPosition, pickup.Position, GetInterpolationFactor());
791 auto orient = EulerAngles::Lerp(pickup.PrevOrientation, pickup.Orientation, GetInterpolationFactor());
792 float scale = Lerp(pickup.PrevScale, pickup.Scale, GetInterpolationFactor());
793 float opacity = Lerp(pickup.PrevOpacity, pickup.Opacity, GetInterpolationFactor());
794 int invObjectID = g_Gui.ConvertObjectToInventoryItem(pickup.ObjectID);
795
796 // Draw display pickup.
797 DrawObjectIn2DSpace(pickup.ObjectID, pos, orient, scale, opacity, InventoryObjectTable[invObjectID].MeshBits);
798
799 // Draw count string.
800 if (pickup.Count != 1)
801 {
802 auto countString = (pickup.Count != NO_VALUE) ? std::to_string(pickup.Count) : COUNT_STRING_INF;
803 auto countStringPos = pickup.Position + COUNT_STRING_OFFSET;
804 auto countStringPrevPos = pickup.PrevPosition + COUNT_STRING_OFFSET;
805
806 auto color = Color(g_GameFlow->GetSettings()->UI.PlainTextColor);
807 color.w = opacity;
808
809 AddString(countString, countStringPos, countStringPrevPos, Vector2::Zero, color, pickup.StringScale, SF());
810 }
811 }
812
813 // TODO: Handle opacity
814 void Renderer::DrawObjectIn2DSpace(int objectNumber, Vector2 pos2D, EulerAngles orient, float scale, float opacity, int meshBits)

Callers 1

DrawMethod · 0.80

Calls 6

LerpFunction · 0.85
to_stringFunction · 0.85
SFFunction · 0.85
GetSettingsMethod · 0.80
Vector2Function · 0.50

Tested by

no test coverage detected