From d0cf9d65e780522b101ef9a796e6c7003d4d6681 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Feb 2021 12:33:47 +0100 Subject: [PATCH] - use 2D size in 2D code, not the engine's screen dimensions. --- source/games/blood/src/d_menu.cpp | 2 +- source/games/blood/src/endgame.cpp | 2 +- source/games/blood/src/sbar.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/games/blood/src/d_menu.cpp b/source/games/blood/src/d_menu.cpp index d0509818c..39c305268 100644 --- a/source/games/blood/src/d_menu.cpp +++ b/source/games/blood/src/d_menu.cpp @@ -99,7 +99,7 @@ void CGameMenuItemQAV::Draw(void) if (bWideScreen) { int xdim43 = scale(ydim, 4, 3); - int nCount = (xdim + xdim43 - 1) / xdim43; + int nCount = (twod->GetWidth() + xdim43 - 1) / xdim43; int backX = data->x; for (int i = 0; i < nCount; i++) { diff --git a/source/games/blood/src/endgame.cpp b/source/games/blood/src/endgame.cpp index 41b2cc422..497a7f55d 100644 --- a/source/games/blood/src/endgame.cpp +++ b/source/games/blood/src/endgame.cpp @@ -58,7 +58,7 @@ static void drawTextScreenBackground(void) } else { - int width = scale(xdim, 240, ydim); + int width = scale(twod->GetWidth(), 240, twod->GetHeight()); int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth; for (int i = 0; i < nCount; i++) { diff --git a/source/games/blood/src/sbar.cpp b/source/games/blood/src/sbar.cpp index 057c3e6bb..092db1136 100644 --- a/source/games/blood/src/sbar.cpp +++ b/source/games/blood/src/sbar.cpp @@ -631,7 +631,7 @@ private: } drawInventory(pPlayer, 166, 200 - tileHeight(2200)); // Depending on the scale we can lower the stats display. This needs some tweaking but this catches the important default case already. - PrintLevelStats(pPlayer, (hud_statscale <= 0.501f || hud_scalefactor < 0.7) && double(xdim)/ydim > 1.6? 28 : 56); + PrintLevelStats(pPlayer, (hud_statscale <= 0.501f || hud_scalefactor < 0.7) && double(twod->GetWidth())/twod->GetHeight() > 1.6? 28 : 56); } @@ -842,11 +842,13 @@ IMPLEMENT_CLASS(DBloodStatusBar, false, false) static void UpdateFrame(void) { auto tex = tileGetTexture(kBackTile); + int width = twod->GetWidth(); + int height = twod->GetHeight(); - twod->AddFlatFill(0, 0, xdim, windowxy1.y - 3, tex); - twod->AddFlatFill(0, windowxy2.y + 4, xdim, ydim, tex); + twod->AddFlatFill(0, 0, width, windowxy1.y - 3, tex); + twod->AddFlatFill(0, windowxy2.y + 4, width, height, tex); twod->AddFlatFill(0, windowxy1.y - 3, windowxy1.x - 3, windowxy2.y + 4, tex); - twod->AddFlatFill(windowxy2.x + 4, windowxy1.y - 3, xdim, windowxy2.y + 4, tex); + twod->AddFlatFill(windowxy2.x + 4, windowxy1.y - 3, width, windowxy2.y + 4, tex); twod->AddFlatFill(windowxy1.x - 3, windowxy1.y - 3, windowxy1.x, windowxy2.y + 1, tex, 0, 1, 0xff545454); twod->AddFlatFill(windowxy1.x, windowxy1.y - 3, windowxy2.x + 4, windowxy1.y, tex, 0, 1, 0xff545454);