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

Method DrawHUD

engine/Poseidon/UI/InGame/InGameUIDrawCursor.cpp:1044–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1042}
1043
1044void InGameUI::DrawHUD(const Camera& camera, EntityAI* vehicle, CameraType cam)
1045{
1046 // draw overlay - called before FinishDraw
1047 // draw global information
1048 Texture* texture;
1049 PackedColor color;
1050
1051 // draw unit related information
1052 AIUnit* unit = GWorld->FocusOn();
1053 if (!unit)
1054 {
1055 return;
1056 }
1057 AISubgroup* subgroup = unit->GetSubgroup();
1058 if (!subgroup)
1059 {
1060 return;
1061 }
1062 // No subgroup->Leader() guard here (the original engine has none): after the
1063 // player dies in a vehicle the HUD must keep drawing so the action menu shows
1064 // "No action available". Leader() stays non-null anyway via its dead-leader
1065 // fallback (AIGroup.hpp), and nothing below dereferences it.
1066 AIGroup* group = subgroup->GetGroup();
1067 if (!group)
1068 {
1069 return;
1070 }
1071 vehicle = unit->GetVehicle();
1072 if (!vehicle)
1073 {
1074 return;
1075 }
1076
1077 bool isMap = GWorld->HasMap();
1078 AIUnit* commanderUnit = vehicle->CommanderUnit();
1079 if (!commanderUnit)
1080 {
1081 commanderUnit = unit;
1082 }
1083
1084 if (_showGroupInfo && unit->IsGroupLeader() && group->NUnits() > 1)
1085 {
1086 DrawGroupInfo(vehicle);
1087 }
1088
1089 if (_showMenu)
1090 {
1091 DrawMenu();
1092 }
1093
1094 _hintTop = piY;
1095 if (_showUnitInfo && !isMap)
1096 {
1097 DrawUnitInfo(vehicle);
1098 }
1099
1100 DrawHint();
1101

Callers 2

DrawUnitInfoMethod · 0.45
DrawHintMethod · 0.45

Calls 15

sprintfFunction · 0.85
LocalizeStringFunction · 0.85
GlobalShowMessageFunction · 0.85
GetSelectedUnitFunction · 0.85
LocalizeFunction · 0.85
ColorClass · 0.85
saturateFunction · 0.85
Line2DPixelClass · 0.85
FocusOnMethod · 0.80
HasMapMethod · 0.80
IsGroupLeaderMethod · 0.80
GetPlayerSuspendedMethod · 0.80

Tested by

no test coverage detected