MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DrawTacticalDisplay

Method DrawTacticalDisplay

engine/Poseidon/UI/InGame/InGameUIDraw.cpp:830–2188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830void InGameUI::DrawTacticalDisplay(const Camera& camera, AIUnit* unit, const TargetList& list)
831{
832 Texture* textureDef = GLOB_SCENE->Preloaded(TextureWhite);
833 MipInfo mip;
834 const int w = GLOB_ENGINE->Width2D();
835 const int h = GLOB_ENGINE->Height2D();
836 AICenter* center = unit->GetGroup()->GetCenter();
837 PoseidonAssert(center);
838
839 Texture* corner = GLOB_SCENE->Preloaded(Corner);
840 DrawFrame(corner, bgColor, Rect2DPixel(tdX * w, tdY * h, tdW * w, tdH * h));
841
842 Vector3 dir = Vector3(0, 0, 1);
843 float xAngle = atan2(dir.X(), dir.Z());
844 float yAngle = atan2(dir.Y(), dir.SizeXZ());
845 float leftAngle = atan(camera.Left());
846 float topAngle = atan(camera.Top());
847 float xMin = xAngle - leftAngle;
848 float xMax = xAngle + leftAngle;
849 float yMin = yAngle - topAngle;
850 float yMax = yAngle + topAngle;
851 if (xMax >= MIN_X && xMin <= MAX_X && yMax >= MIN_Y && yMin <= MAX_Y)
852 {
853 if (yMin < MIN_Y)
854 {
855 yMin = MIN_Y;
856 }
857 if (yMax > MAX_Y)
858 {
859 yMax = MAX_Y;
860 }
861 mip = GLOB_ENGINE->TextBank()->UseMipmap(textureDef, 0, 0);
862 if (xMin < MIN_X)
863 {
864 xMin += TOT_W;
865 GLOB_ENGINE->Draw2D(mip, cameraColor,
866 Rect2DPixel((tdX + 0.5 * tdW + xMin * tdW * INV_W) * w,
867 (tdY + 0.5 * tdH - yMax * tdH * INV_H) * h,
868 ((MAX_X - xMin) * tdW * INV_W) * w, ((yMax - yMin) * tdH * INV_H) * h));
869 GLOB_ENGINE->Draw2D(mip, cameraColor,
870 Rect2DPixel((tdX + 0.5 * tdW + MIN_X * tdW * INV_W) * w,
871 (tdY + 0.5 * tdH - yMax * tdH * INV_H) * h,
872 ((xMax - MIN_X) * tdW * INV_W) * w, ((yMax - yMin) * tdH * INV_H) * h));
873 }
874 else if (xMax > MAX_X)
875 {
876 xMax -= TOT_W;
877 GLOB_ENGINE->Draw2D(mip, cameraColor,
878 Rect2DPixel((tdX + 0.5 * tdW + xMin * tdW * INV_W) * w,
879 (tdY + 0.5 * tdH - yMax * tdH * INV_H) * h,
880 ((MAX_X - xMin) * tdW * INV_W) * w, ((yMax - yMin) * tdH * INV_H) * h));
881 GLOB_ENGINE->Draw2D(mip, cameraColor,
882 Rect2DPixel((tdX + 0.5 * tdW + MIN_X * tdW * INV_W) * w,
883 (tdY + 0.5 * tdH - yMax * tdH * INV_H) * h,
884 ((xMax - MIN_X) * tdW * INV_W) * w, ((yMax - yMin) * tdH * INV_H) * h));
885 }
886 else
887 {

Callers

nothing calls this directly

Calls 15

DrawFrameFunction · 0.85
saturateMinFunction · 0.85
LeftMethod · 0.80
TopMethod · 0.80
CalcVisibilityMethod · 0.80
GetLaserScannerMethod · 0.80
IsKnownByMethod · 0.80
LandAimingPositionMethod · 0.80
FadingSpotabilityMethod · 0.80
IsKindOfMethod · 0.80
FadingAccuracyMethod · 0.80
GetAccuracyMethod · 0.80

Tested by

no test coverage detected