MCPcopy Create free account
hub / github.com/crossuo/crossuo / DrawGameWindow

Method DrawGameWindow

src/ScreenStages/GameScreen.cpp:1325–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1323}
1324
1325void CGameScreen::DrawGameWindow(bool render)
1326{
1327 const int playerZPlus5 = g_RenderBounds.PlayerZ + 5;
1328 if (render)
1329 {
1330#ifndef NEW_RENDERER_ENABLED
1331 glColor4f(g_DrawColor, g_DrawColor, g_DrawColor, 1.0f);
1332#else
1333 RenderAdd_SetColor(
1334 g_renderCmdList, SetColorCmd{ { g_DrawColor, g_DrawColor, g_DrawColor, 1.0f } });
1335#endif
1336 if (g_ConfigManager.UseCircleTrans)
1337 {
1338 if (g_CircleOfTransparency.Create(g_ConfigManager.CircleTransRadius))
1339 {
1340 int drawX = g_RenderBounds.GameWindowCenterX + g_Player->OffsetX;
1341 int drawY = g_RenderBounds.GameWindowCenterY + g_Player->OffsetY -
1342 (g_RenderBounds.PlayerZ * 4 + g_Player->OffsetZ);
1343 g_CircleOfTransparency.Draw(drawX, drawY);
1344 }
1345 }
1346
1347 m_HitsStack.clear();
1348 for (int i = 0; i < m_RenderListCount; i++)
1349 {
1350 RENDER_OBJECT_DATA &rod = m_RenderList[i];
1351 CRenderWorldObject *obj = rod.Object;
1352 if (obj != nullptr)
1353 {
1354 g_OutOfRangeColor = rod.GrayColor;
1355 g_UseCircleTrans =
1356 (g_ConfigManager.UseCircleTrans && obj->TranparentTest(playerZPlus5));
1357
1358 int x = obj->DrawX;
1359 int y = obj->DrawY;
1360 obj->Draw(x, y);
1361 if ((g_ConfigManager.GetDrawStatusState() != 0u) && obj->IsGameObject() &&
1362 ((CGameObject *)obj)->NPC && !((CGameCharacter *)obj)->IsDead())
1363 {
1364 CGameCharacter *gc = (CGameCharacter *)obj;
1365 if (g_ConfigManager.DrawStatusForHumanoids && !gc->IsHuman())
1366 {
1367 continue;
1368 }
1369
1370 uint16_t color = g_ConfigManager.GetColorByNotoriety(gc->Notoriety);
1371 uint16_t healthColor = 90;
1372 int width = gc->MaxHits;
1373 if (width > 0)
1374 {
1375 width = (gc->Hits * 100) / width;
1376 if (width > 100)
1377 {
1378 width = 100;
1379 }
1380
1381 if (width < 1)
1382 {

Callers

nothing calls this directly

Calls 15

RenderAdd_SetColorFunction · 0.85
RenderAdd_DisableDepthFunction · 0.85
GetDrawStatusStateMethod · 0.80
IsDeadMethod · 0.80
GetColorByNotorietyMethod · 0.80
IsMountedMethod · 0.80
IsCorpseMethod · 0.80
UpdateHitsTextureMethod · 0.80
IsPoisonedMethod · 0.80
YellowHitsMethod · 0.80

Tested by

no test coverage detected