From 7a1fda2cc257cc722bfd4a0e61133175762868de Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2020 23:27:37 +0200 Subject: [PATCH] - use the 2D drawer's coordinates in the console. --- source/core/console/c_console.cpp | 56 +++++++++++++++---------------- source/core/rendering/v_video.cpp | 4 +-- source/duke3d/src/sbar.cpp | 7 +--- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/source/core/console/c_console.cpp b/source/core/console/c_console.cpp index 89f9cf903..e37382076 100644 --- a/source/core/console/c_console.cpp +++ b/source/core/console/c_console.cpp @@ -217,14 +217,14 @@ public: else { DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', - DTA_VirtualWidth, screen->GetWidth() / scale, - DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_VirtualWidth, twod->GetWidth() / scale, + DTA_VirtualHeight, twod->GetHeight() / scale, DTA_KeepRatio, true, TAG_DONE); DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y, &Text[StartPos], - DTA_VirtualWidth, screen->GetWidth() / scale, - DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_VirtualWidth, twod->GetWidth() / scale, + DTA_VirtualHeight, twod->GetHeight() / scale, DTA_KeepRatio, true, TAG_DONE); if (cursor) @@ -232,8 +232,8 @@ public: DrawChar(twod, CurrentConsoleFont, CR_YELLOW, x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb), y, '\xb', - DTA_VirtualWidth, screen->GetWidth() / scale, - DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_VirtualWidth, twod->GetWidth() / scale, + DTA_VirtualHeight, twod->GetHeight() / scale, DTA_KeepRatio, true, TAG_DONE); } } @@ -977,13 +977,13 @@ void C_AdjustBottom () { /*if (gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ConBottom = screen->GetHeight(); - else*/ if (ConBottom > screen->GetHeight() / 2 || ConsoleState == c_down) - ConBottom = screen->GetHeight() / 2; + else*/ if (ConBottom > twod->GetHeight() / 2 || ConsoleState == c_down) + ConBottom = twod->GetHeight() / 2; } void C_NewModeAdjust () { - C_InitConsole (screen->GetWidth(), screen->GetHeight(), true); + C_InitConsole (twod->GetWidth(), twod->GetHeight(), true); C_FlushDisplay (); C_AdjustBottom (); } @@ -1011,17 +1011,17 @@ void C_Ticker() { if (ConsoleState == c_falling) { - ConBottom += (consoletic - lasttic) * (screen->GetHeight() * 2 / 25); - if (ConBottom >= screen->GetHeight() / 2) + ConBottom += (consoletic - lasttic) * (twod->GetHeight() * 2 / 25); + if (ConBottom >= twod->GetHeight() / 2) { GSnd->SetSfxPaused(true, PAUSESFX_CONSOLE); - ConBottom = screen->GetHeight() / 2; + ConBottom = twod->GetHeight() / 2; ConsoleState = c_down; } } else if (ConsoleState == c_rising) { - ConBottom -= (consoletic - lasttic) * (screen->GetHeight() * 2 / 25); + ConBottom -= (consoletic - lasttic) * (twod->GetHeight() * 2 / 25); if (ConBottom <= 0) { GSnd->SetSfxPaused(false, PAUSESFX_CONSOLE); @@ -1105,17 +1105,17 @@ void FNotifyBuffer::Draw() int scale = active_con_scaletext(twod, generic_ui); if (!center) - DrawText (twod, font, color, 0, line, notify.Text, - DTA_VirtualWidth, screen->GetWidth() / scale, - DTA_VirtualHeight, screen->GetHeight() / scale, + DrawText(twod, font, color, 0, line, notify.Text, + DTA_VirtualWidth, twod->GetWidth() / scale, + DTA_VirtualHeight, twod->GetHeight() / scale, DTA_KeepRatio, true, DTA_Alpha, alpha, TAG_DONE); else - DrawText (twod, font, color, (screen->GetWidth() - + DrawText(twod, font, color, (twod->GetWidth() - font->StringWidth (notify.Text) * scale) / 2 / scale, line, notify.Text, - DTA_VirtualWidth, screen->GetWidth() / scale, - DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_VirtualWidth, twod->GetWidth() / scale, + DTA_VirtualHeight, twod->GetHeight() / scale, DTA_KeepRatio, true, DTA_Alpha, alpha, TAG_DONE); line += lineadv; @@ -1187,17 +1187,17 @@ void C_DrawConsole () if (ConBottom >= 12) { if (textScale == 1) - DrawText (twod, CurrentConsoleFont, CR_ORANGE, screen->GetWidth() - 8 - + DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() - 8 - CurrentConsoleFont->StringWidth (GetVersionString()), ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4, GetVersionString(), TAG_DONE); else - DrawText(twod, CurrentConsoleFont, CR_ORANGE, screen->GetWidth() / textScale - 8 - + DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() / textScale - 8 - CurrentConsoleFont->StringWidth(GetVersionString()), ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4, GetVersionString(), - DTA_VirtualWidth, screen->GetWidth() / textScale, - DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_VirtualWidth, twod->GetWidth() / textScale, + DTA_VirtualHeight, twod->GetHeight() / textScale, DTA_KeepRatio, true, TAG_DONE); } @@ -1230,8 +1230,8 @@ void C_DrawConsole () else { DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, - DTA_VirtualWidth, screen->GetWidth() / textScale, - DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_VirtualWidth, twod->GetWidth() / textScale, + DTA_VirtualHeight, twod->GetHeight() / textScale, DTA_KeepRatio, true, TAG_DONE); } } @@ -1253,11 +1253,11 @@ void C_DrawConsole () // Indicate that the view has been scrolled up (10) // and if we can scroll no further (12) if (textScale == 1) - DrawChar (twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE); + DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE); else DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, - DTA_VirtualWidth, screen->GetWidth() / textScale, - DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_VirtualWidth, twod->GetWidth() / textScale, + DTA_VirtualHeight, twod->GetHeight() / textScale, DTA_KeepRatio, true, TAG_DONE); } } diff --git a/source/core/rendering/v_video.cpp b/source/core/rendering/v_video.cpp index 99afef84e..b8e4d22fa 100644 --- a/source/core/rendering/v_video.cpp +++ b/source/core/rendering/v_video.cpp @@ -37,6 +37,7 @@ #include "i_system.h" #include "c_cvars.h" +#include "x86.h" #include "i_video.h" #include "c_console.h" @@ -155,7 +156,6 @@ public: int DisplayWidth, DisplayHeight; - // [RH] The framebuffer is no longer a mere byte array. // There's also only one, not four. DFrameBuffer *screen; @@ -226,7 +226,6 @@ void DCanvas::Resize(int width, int height, bool optimizepitch) } else { -#if 0 // If we couldn't figure out the CPU's L1 cache line size, assume // it's 32 bytes wide. if (CPU.DataL1LineSize == 0) @@ -246,7 +245,6 @@ void DCanvas::Resize(int width, int height, bool optimizepitch) { Pitch = width + MAX(0, CPU.DataL1LineSize - 8); } -#endif } int bytes_per_pixel = Bgra ? 4 : 1; Pixels.Resize(Pitch * height * bytes_per_pixel); diff --git a/source/duke3d/src/sbar.cpp b/source/duke3d/src/sbar.cpp index 9883266bb..72bd8f122 100644 --- a/source/duke3d/src/sbar.cpp +++ b/source/duke3d/src/sbar.cpp @@ -524,13 +524,8 @@ static int32_t G_GetInvOn(const DukePlayer_t *p) static int32_t G_GetMorale(int32_t p_i, int32_t snum) { -#if !defined LUNATIC + // WW2GI return Gv_GetVarByLabel("PLR_MORALE", -1, p_i, snum); -#else - UNREFERENCED_PARAMETER(p_i); - UNREFERENCED_PARAMETER(snum); - return -1; -#endif } static inline void rotatesprite_althud(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, uint8_t dapalnum, int32_t dastat)