- use the 2D drawer's coordinates in the console.

This commit is contained in:
Christoph Oelckers 2020-04-11 23:27:37 +02:00
parent 55a3c62b59
commit 7a1fda2cc2
3 changed files with 30 additions and 37 deletions

View file

@ -217,14 +217,14 @@ public:
else else
{ {
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale, DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y, DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
&Text[StartPos], &Text[StartPos],
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale, DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
if (cursor) if (cursor)
@ -232,8 +232,8 @@ public:
DrawChar(twod, CurrentConsoleFont, CR_YELLOW, DrawChar(twod, CurrentConsoleFont, CR_YELLOW,
x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb), x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb),
y, '\xb', y, '\xb',
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale, DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
} }
} }
@ -977,13 +977,13 @@ void C_AdjustBottom ()
{ {
/*if (gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) /*if (gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP)
ConBottom = screen->GetHeight(); ConBottom = screen->GetHeight();
else*/ if (ConBottom > screen->GetHeight() / 2 || ConsoleState == c_down) else*/ if (ConBottom > twod->GetHeight() / 2 || ConsoleState == c_down)
ConBottom = screen->GetHeight() / 2; ConBottom = twod->GetHeight() / 2;
} }
void C_NewModeAdjust () void C_NewModeAdjust ()
{ {
C_InitConsole (screen->GetWidth(), screen->GetHeight(), true); C_InitConsole (twod->GetWidth(), twod->GetHeight(), true);
C_FlushDisplay (); C_FlushDisplay ();
C_AdjustBottom (); C_AdjustBottom ();
} }
@ -1011,17 +1011,17 @@ void C_Ticker()
{ {
if (ConsoleState == c_falling) if (ConsoleState == c_falling)
{ {
ConBottom += (consoletic - lasttic) * (screen->GetHeight() * 2 / 25); ConBottom += (consoletic - lasttic) * (twod->GetHeight() * 2 / 25);
if (ConBottom >= screen->GetHeight() / 2) if (ConBottom >= twod->GetHeight() / 2)
{ {
GSnd->SetSfxPaused(true, PAUSESFX_CONSOLE); GSnd->SetSfxPaused(true, PAUSESFX_CONSOLE);
ConBottom = screen->GetHeight() / 2; ConBottom = twod->GetHeight() / 2;
ConsoleState = c_down; ConsoleState = c_down;
} }
} }
else if (ConsoleState == c_rising) else if (ConsoleState == c_rising)
{ {
ConBottom -= (consoletic - lasttic) * (screen->GetHeight() * 2 / 25); ConBottom -= (consoletic - lasttic) * (twod->GetHeight() * 2 / 25);
if (ConBottom <= 0) if (ConBottom <= 0)
{ {
GSnd->SetSfxPaused(false, PAUSESFX_CONSOLE); GSnd->SetSfxPaused(false, PAUSESFX_CONSOLE);
@ -1105,17 +1105,17 @@ void FNotifyBuffer::Draw()
int scale = active_con_scaletext(twod, generic_ui); int scale = active_con_scaletext(twod, generic_ui);
if (!center) if (!center)
DrawText (twod, font, color, 0, line, notify.Text, DrawText(twod, font, color, 0, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale, DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE); DTA_Alpha, alpha, TAG_DONE);
else else
DrawText (twod, font, color, (screen->GetWidth() - DrawText(twod, font, color, (twod->GetWidth() -
font->StringWidth (notify.Text) * scale) / 2 / scale, font->StringWidth (notify.Text) * scale) / 2 / scale,
line, notify.Text, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale, DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale, DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE); DTA_Alpha, alpha, TAG_DONE);
line += lineadv; line += lineadv;
@ -1187,17 +1187,17 @@ void C_DrawConsole ()
if (ConBottom >= 12) if (ConBottom >= 12)
{ {
if (textScale == 1) if (textScale == 1)
DrawText (twod, CurrentConsoleFont, CR_ORANGE, screen->GetWidth() - 8 - DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() - 8 -
CurrentConsoleFont->StringWidth (GetVersionString()), CurrentConsoleFont->StringWidth (GetVersionString()),
ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4, ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4,
GetVersionString(), TAG_DONE); GetVersionString(), TAG_DONE);
else else
DrawText(twod, CurrentConsoleFont, CR_ORANGE, screen->GetWidth() / textScale - 8 - DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() / textScale - 8 -
CurrentConsoleFont->StringWidth(GetVersionString()), CurrentConsoleFont->StringWidth(GetVersionString()),
ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4, ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4,
GetVersionString(), GetVersionString(),
DTA_VirtualWidth, screen->GetWidth() / textScale, DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale, DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
} }
@ -1230,8 +1230,8 @@ void C_DrawConsole ()
else else
{ {
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text,
DTA_VirtualWidth, screen->GetWidth() / textScale, DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale, DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
} }
} }
@ -1253,11 +1253,11 @@ void C_DrawConsole ()
// Indicate that the view has been scrolled up (10) // Indicate that the view has been scrolled up (10)
// and if we can scroll no further (12) // and if we can scroll no further (12)
if (textScale == 1) 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 else
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
DTA_VirtualWidth, screen->GetWidth() / textScale, DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale, DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE); DTA_KeepRatio, true, TAG_DONE);
} }
} }

View file

@ -37,6 +37,7 @@
#include "i_system.h" #include "i_system.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "x86.h"
#include "i_video.h" #include "i_video.h"
#include "c_console.h" #include "c_console.h"
@ -155,7 +156,6 @@ public:
int DisplayWidth, DisplayHeight; int DisplayWidth, DisplayHeight;
// [RH] The framebuffer is no longer a mere byte array. // [RH] The framebuffer is no longer a mere byte array.
// There's also only one, not four. // There's also only one, not four.
DFrameBuffer *screen; DFrameBuffer *screen;
@ -226,7 +226,6 @@ void DCanvas::Resize(int width, int height, bool optimizepitch)
} }
else else
{ {
#if 0
// If we couldn't figure out the CPU's L1 cache line size, assume // If we couldn't figure out the CPU's L1 cache line size, assume
// it's 32 bytes wide. // it's 32 bytes wide.
if (CPU.DataL1LineSize == 0) if (CPU.DataL1LineSize == 0)
@ -246,7 +245,6 @@ void DCanvas::Resize(int width, int height, bool optimizepitch)
{ {
Pitch = width + MAX(0, CPU.DataL1LineSize - 8); Pitch = width + MAX(0, CPU.DataL1LineSize - 8);
} }
#endif
} }
int bytes_per_pixel = Bgra ? 4 : 1; int bytes_per_pixel = Bgra ? 4 : 1;
Pixels.Resize(Pitch * height * bytes_per_pixel); Pixels.Resize(Pitch * height * bytes_per_pixel);

View file

@ -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) 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); 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) 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)