- place weapon sprites in a separate render list.

They need to be drawn in a different pass than the 2D overlay HUD so the backend must have them separately.
This commit is contained in:
Christoph Oelckers 2019-12-30 19:29:32 +01:00
parent 7ea053bd90
commit ad24a1ce31
24 changed files with 204 additions and 163 deletions

View file

@ -63,6 +63,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "zstring.h"
#include "menu/menu.h"
#include "gstrings.h"
#include "v_2ddrawer.h"
CVARD(Bool, hud_powerupduration, true, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disable displaying the remaining seconds for power-ups")
@ -3434,6 +3435,7 @@ RORHACK:
}
}
#endif
//PspTwoDSetter set;
if (gViewPos == 0)
{
if (cl_crosshair)

View file

@ -9446,8 +9446,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
return 0;
}
void DrawFullscreenBlends();
//
// nextpage
//
@ -9472,8 +9470,6 @@ void videoNextPage(void)
{
g_beforeSwapTime = timerGetHiTicks();
// Draw the console plus debug output on top of everything else.
DrawFullscreenBlends();
videoShowFrame(0);
}
@ -10732,8 +10728,6 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
{
int32_t i;
if ((unsigned)picnum >= MAXTILES)
return;
@ -10754,7 +10748,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
return;
}
// We must store all calls in the 2D drawer so that the backend can operate on a clean 3D view.
twod.rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2);
twod->rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2);
// RS_PERM code was removed because the current backend supports only one page that needs to be redrawn each frame in which case the perm list was skipped anyway.
}

View file

@ -3268,7 +3268,7 @@ void polymost_drawrooms()
// This is a global setting for the entire scene, so let's do it here, right at the start.
auto& hh = hictinting[MAXPALOOKUPS - 1];
// This sets a tinting color for global palettes, e.g. water or slime - only used for hires replacements (also an option for low-resource hardware where duplicating the textures may be problematic.)
GLInterface.SetBasepalTint(PalEntry(hh.sr, hh.sg, hh.sb));
GLInterface.SetBasepalTint(PalEntry(hh.r, hh.g, hh.b));
polymost_outputGLDebugMessage(3, "polymost_drawrooms()");

View file

@ -39,7 +39,9 @@
//#include "g_levellocals.h"
//#include "vm.h"
F2DDrawer twod;
F2DDrawer twodpsp;
F2DDrawer twodgen;
F2DDrawer *twod = &twodgen;
//==========================================================================
//

View file

@ -132,6 +132,33 @@ public:
bool mIsFirstPass = true;
};
extern F2DDrawer twod;
extern F2DDrawer twodgen;
extern F2DDrawer twodpsp;
extern F2DDrawer* twod;
// This is for safely substituting the 2D drawer for a block of code.
class PspTwoDSetter
{
F2DDrawer* old;
public:
PspTwoDSetter()
{
old = twod;
twod = &twodpsp;
}
~PspTwoDSetter()
{
twod = old;
}
// Shadow Warrior fucked this up and draws the weapons in the same pass as the hud, meaning we have to switch this on and off depending on context.
void set()
{
twod = &twodpsp;
}
void clear()
{
twod = old;
}
};
#endif

View file

@ -206,25 +206,25 @@ public:
{
if (scale == 1)
{
DrawChar(&twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', TAG_DONE);
DrawText(&twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->CharWidth(0x1c), y,
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', TAG_DONE);
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->CharWidth(0x1c), y,
&Text[StartPos], TAG_DONE);
if (cursor)
{
DrawChar(&twod, CurrentConsoleFont, CR_YELLOW,
DrawChar(twod, CurrentConsoleFont, CR_YELLOW,
x + CurrentConsoleFont->CharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->CharWidth(0xb),
y, '\xb', TAG_DONE);
}
}
else
{
DrawChar(&twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE);
DrawText(&twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->CharWidth(0x1c), y,
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->CharWidth(0x1c), y,
&Text[StartPos],
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
@ -232,7 +232,7 @@ public:
if (cursor)
{
DrawChar(&twod, CurrentConsoleFont, CR_YELLOW,
DrawChar(twod, CurrentConsoleFont, CR_YELLOW,
x + CurrentConsoleFont->CharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->CharWidth(0xb),
y, '\xb',
DTA_VirtualWidth, screen->GetWidth() / scale,
@ -1116,13 +1116,13 @@ void FNotifyBuffer::Draw()
int scale = active_con_scaletext(generic_ui);
if (!center)
DrawText (&twod, font, color, 0, line, notify.Text,
DrawText (twod, font, color, 0, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE);
else
DrawText (&twod, font, color, (screen->GetWidth() -
DrawText (twod, font, color, (screen->GetWidth() -
font->StringWidth (notify.Text) * scale) / 2 / scale,
line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale,
@ -1182,7 +1182,7 @@ void C_DrawConsole ()
if (conback)
{
DrawTexture (&twod, conback, 0, visheight - screen->GetHeight(),
DrawTexture (twod, conback, 0, visheight - screen->GetHeight(),
DTA_DestWidth, screen->GetWidth(),
DTA_DestHeight, screen->GetHeight(),
DTA_ColorOverlay, conshade,
@ -1193,22 +1193,22 @@ void C_DrawConsole ()
else
{
PalEntry pe((uint8_t)(con_alpha * 255), 0, 0, 0);
twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), visheight, pe);
twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), visheight, pe);
}
if (conline && visheight < screen->GetHeight())
{
twod.AddColorOnlyQuad(0, visheight, screen->GetWidth(), visheight+1, 0xff000000);
twod->AddColorOnlyQuad(0, visheight, screen->GetWidth(), visheight+1, 0xff000000);
}
if (ConBottom >= 12)
{
if (textScale == 1)
DrawText (&twod, CurrentConsoleFont, CR_ORANGE, screen->GetWidth() - 8 -
DrawText (twod, CurrentConsoleFont, CR_ORANGE, screen->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, screen->GetWidth() / textScale - 8 -
CurrentConsoleFont->StringWidth(GetVersionString()),
ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4,
GetVersionString(),
@ -1241,11 +1241,11 @@ void C_DrawConsole ()
{
if (textScale == 1)
{
DrawText(&twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, TAG_DONE);
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, TAG_DONE);
}
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_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
@ -1263,9 +1263,9 @@ 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,
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);

View file

@ -321,7 +321,7 @@ void FListMenuItem::DrawSelector(int xofs, int yofs, FTexture *tex)
{
if ((DMenu::MenuTime%8) < 6)
{
DrawText(&twod, ConFont, OptionSettings.mFontColorSelection,
DrawText(twod, ConFont, OptionSettings.mFontColorSelection,
(mXpos + xofs - 160) * CleanXfac + screen->GetWidth() / 2,
(mYpos + yofs - 100) * CleanYfac + screen->GetHeight() / 2,
"\xd",
@ -332,7 +332,7 @@ void FListMenuItem::DrawSelector(int xofs, int yofs, FTexture *tex)
}
else
{
DrawTexture (&twod, tex, mXpos + xofs, mYpos + yofs, DTA_Clean, true, TAG_DONE);
DrawTexture (twod, tex, mXpos + xofs, mYpos + yofs, DTA_Clean, true, TAG_DONE);
}
}
@ -417,13 +417,13 @@ void FListMenuItemStaticPatch::Drawer(DListMenu* menu, const DVector2& origin, b
if (mYpos >= 0)
{
if (mCentered) x -= tex->GetWidth()/2;
DrawTexture (&twod, tex, x, mYpos, DTA_Clean, true, TAG_DONE);
DrawTexture (twod, tex, x, mYpos, DTA_Clean, true, TAG_DONE);
}
else
{
int x = (mXpos - 160) * CleanXfac + (screen->GetWidth()>>1);
if (mCentered) x -= (tex->GetWidth()*CleanXfac)/2;
DrawTexture (&twod, tex, x, -mYpos*CleanYfac, DTA_CleanNoMove, true, TAG_DONE);
DrawTexture (twod, tex, x, -mYpos*CleanYfac, DTA_CleanNoMove, true, TAG_DONE);
}
}
@ -451,13 +451,13 @@ void FListMenuItemStaticText::Drawer(DListMenu* menu, const DVector2& origin, bo
{
int x = mXpos;
if (mCentered) x -= mFont->StringWidth(text)/2;
DrawText(&twod, mFont, mColor, x, mYpos, text, DTA_Clean, true, TAG_DONE);
DrawText(twod, mFont, mColor, x, mYpos, text, DTA_Clean, true, TAG_DONE);
}
else
{
int x = (mXpos - 160) * CleanXfac + (screen->GetWidth()>>1);
if (mCentered) x -= (mFont->StringWidth(text)*CleanXfac)/2;
DrawText (&twod, mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true, TAG_DONE);
DrawText (twod, mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true, TAG_DONE);
}
}
}
@ -573,7 +573,7 @@ void FListMenuItemText::Drawer(DListMenu* menu, const DVector2& origin, bool sel
const char *text = mText;
if (mText.Len())
{
DrawText(&twod, mFont, selected ? mColorSelected : mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
DrawText(twod, mFont, selected ? mColorSelected : mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
}
}
@ -639,7 +639,7 @@ FListMenuItemPatch::FListMenuItemPatch(int x, int y, int height, int hotkey, FTe
void FListMenuItemPatch::Drawer(DListMenu* menu, const DVector2& origin, bool selected)
{
DrawTexture (&twod, mTexture, mXpos, mYpos, DTA_Clean, true, TAG_DONE);
DrawTexture (twod, mTexture, mXpos, mYpos, DTA_Clean, true, TAG_DONE);
}
int FListMenuItemPatch::GetWidth()

View file

@ -158,10 +158,10 @@ protected:
PalEntry frameColor(255, 80, 80, 80); // todo: pick a proper color per game.
PalEntry fillColor(160, 0, 0, 0);
DrawFrame(&twod, frameColor, savepicLeft, savepicTop, savepicWidth, savepicHeight, -1);
DrawFrame(twod, frameColor, savepicLeft, savepicTop, savepicWidth, savepicHeight, -1);
if (!savegameManager.DrawSavePic(savepicLeft, savepicTop, savepicWidth, savepicHeight))
{
twod.AddColorOnlyQuad(savepicLeft, savepicTop, savepicWidth, savepicHeight, fillColor);
twod->AddColorOnlyQuad(savepicLeft, savepicTop, savepicWidth, savepicHeight, fillColor);
if (savegameManager.SavegameCount() > 0)
{
@ -169,33 +169,33 @@ protected:
FString text = (Selected == -1 || !savegameManager.GetSavegame(Selected)->bOldVersion) ? GStrings("MNU_NOPICTURE") : GStrings("MNU_DIFFVERSION");
int textlen = NewSmallFont->StringWidth(text) * CleanXfac;
DrawText(&twod, NewSmallFont, CR_GOLD, savepicLeft + (savepicWidth - textlen) / 2,
DrawText(twod, NewSmallFont, CR_GOLD, savepicLeft + (savepicWidth - textlen) / 2,
savepicTop + (savepicHeight - rowHeight) / 2, text, DTA_CleanNoMove, true, TAG_DONE);
}
}
// Draw comment area
DrawFrame(&twod, frameColor, commentLeft, commentTop, commentWidth, commentHeight, -1);
twod.AddColorOnlyQuad(commentLeft, commentTop, commentWidth, commentHeight, fillColor);
DrawFrame(twod, frameColor, commentLeft, commentTop, commentWidth, commentHeight, -1);
twod->AddColorOnlyQuad(commentLeft, commentTop, commentWidth, commentHeight, fillColor);
int numlinestoprint = std::min(commentRows, (int)BrokenSaveComment.Size());
for (int i = 0; i < numlinestoprint; i++)
{
DrawText(&twod, NewConsoleFont, CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment[i].Text,
DrawText(twod, NewConsoleFont, CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment[i].Text,
DTA_VirtualWidthF, screen->GetWidth() / FontScale, DTA_VirtualHeightF, screen->GetHeight() / FontScale, DTA_KeepRatio, true, TAG_DONE);
}
// Draw file area
DrawFrame(&twod, frameColor, listboxLeft, listboxTop, listboxWidth, listboxHeight, -1);
twod.AddColorOnlyQuad(listboxLeft, listboxTop, listboxWidth, listboxHeight, fillColor);
DrawFrame(twod, frameColor, listboxLeft, listboxTop, listboxWidth, listboxHeight, -1);
twod->AddColorOnlyQuad(listboxLeft, listboxTop, listboxWidth, listboxHeight, fillColor);
if (savegameManager.SavegameCount() == 0)
{
FString text = GStrings("MNU_NOFILES");
int textlen = int(NewConsoleFont->StringWidth(text) * FontScale);
DrawText(&twod, NewConsoleFont, CR_GOLD, (listboxLeft + (listboxWidth - textlen) / 2) / FontScale, (listboxTop + (listboxHeight - rowHeight) / 2) / FontScale, text,
DrawText(twod, NewConsoleFont, CR_GOLD, (listboxLeft + (listboxWidth - textlen) / 2) / FontScale, (listboxTop + (listboxHeight - rowHeight) / 2) / FontScale, text,
DTA_VirtualWidthF, screen->GetWidth() / FontScale, DTA_VirtualHeightF, screen->GetHeight() / FontScale, DTA_KeepRatio, true, TAG_DONE);
return;
}
@ -226,11 +226,11 @@ protected:
if ((int)j == Selected)
{
twod.AddColorOnlyQuad(listboxLeft, listboxTop + rowHeight * i, listboxWidth, rowHeight, mEntering ? PalEntry(255, 255, 0, 0) : PalEntry(255, 0, 0, 255));
twod->AddColorOnlyQuad(listboxLeft, listboxTop + rowHeight * i, listboxWidth, rowHeight, mEntering ? PalEntry(255, 255, 0, 0) : PalEntry(255, 0, 0, 255));
didSeeSelected = true;
if (!mEntering)
{
DrawText(&twod, NewConsoleFont, colr, (listboxLeft + 1) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, node.SaveTitle,
DrawText(twod, NewConsoleFont, colr, (listboxLeft + 1) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, node.SaveTitle,
DTA_VirtualWidthF, screen->GetWidth() / FontScale, DTA_VirtualHeightF, screen->GetHeight() / FontScale, DTA_KeepRatio, true, TAG_DONE);
}
else
@ -238,13 +238,13 @@ protected:
FStringf s("%s%c", mInput->GetText(), NewConsoleFont->GetCursor());
int length = int(NewConsoleFont->StringWidth(s) * FontScale);
int displacement = std::min(0, listboxWidth - 2 - length);
DrawText(&twod, NewConsoleFont, CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, s,
DrawText(twod, NewConsoleFont, CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, s,
DTA_VirtualWidthF, screen->GetWidth() / FontScale, DTA_VirtualHeightF, screen->GetHeight() / FontScale, DTA_KeepRatio, true, TAG_DONE);
}
}
else
{
DrawText(&twod, NewConsoleFont, colr, (listboxLeft + 1) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, node.SaveTitle,
DrawText(twod, NewConsoleFont, colr, (listboxLeft + 1) / FontScale, (listboxTop + rowHeight * i + FontScale) / FontScale, node.SaveTitle,
DTA_VirtualWidthF, screen->GetWidth() / FontScale, DTA_VirtualHeightF, screen->GetHeight() / FontScale, DTA_KeepRatio, true, TAG_DONE);
}
//screen->ClearClipRect();

View file

@ -328,11 +328,11 @@ void DMenu::Drawer ()
int y = (!(m_show_backbutton&2))? 0:screen->GetHeight() - h;
if (mBackbuttonSelected && (mMouseCapture || m_use_mouse == 1))
{
DrawTexture(&twod, tex, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, MAKEARGB(40, 255,255,255), TAG_DONE);
DrawTexture(twod, tex, x, y, DTA_CleanNoMove, true, DTA_ColorOverlay, MAKEARGB(40, 255,255,255), TAG_DONE);
}
else
{
DrawTexture(&twod, tex, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, TAG_DONE);
DrawTexture(twod, tex, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, TAG_DONE);
}
}
}
@ -879,7 +879,7 @@ void M_Drawer (void)
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
{
if (DMenu::CurrentMenu->DimAllowed() && fade && !DrawBackground) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
if (DMenu::CurrentMenu->DimAllowed() && fade && !DrawBackground) twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
bool going = false;
if (transition.previous)

View file

@ -307,7 +307,7 @@ void DTextEnterMenu::Drawer ()
// Darken the background behind the character grid.
// Unless we frame it with a border, I think it looks better to extend the
// background across the full width of the screen.
twod.AddColorOnlyQuad(0 /*screen->GetWidth()/2 - 13 * cell_width / 2*/,
twod->AddColorOnlyQuad(0 /*screen->GetWidth()/2 - 13 * cell_width / 2*/,
screen->GetHeight() - INPUTGRID_HEIGHT * cell_height,
screen->GetWidth() /*13 * cell_width*/,
INPUTGRID_HEIGHT * cell_height, 0xc8000000);
@ -315,7 +315,7 @@ void DTextEnterMenu::Drawer ()
if (InputGridX >= 0 && InputGridY >= 0)
{
// Highlight the background behind the selected character.
twod.AddColorOnlyQuad(
twod->AddColorOnlyQuad(
InputGridX * cell_width - INPUTGRID_WIDTH * cell_width / 2 + screen->GetWidth() / 2,
InputGridY * cell_height - INPUTGRID_HEIGHT * cell_height + screen->GetHeight(),
cell_width, cell_height, PalEntry(255, 255, 248, 220));
@ -340,7 +340,7 @@ void DTextEnterMenu::Drawer ()
if (pic != NULL)
{
// Draw a normal character.
DrawTexture(&twod, pic, xx + cell_width/2 - width*CleanXfac_1/2, yy + top_padding,
DrawTexture(twod, pic, xx + cell_width/2 - width*CleanXfac_1/2, yy + top_padding,
DTA_TranslationIndex, remap,
DTA_CleanNoMove_1, true,
TAG_DONE);
@ -353,16 +353,16 @@ void DTextEnterMenu::Drawer ()
const int y1 = yy + top_padding;
const int y2 = y1 + displayFont->GetHeight() * CleanYfac_1;
auto palcolor = PalEntry(255, 160, 160, 160);
twod.AddColorOnlyQuad(x1, y1, x2 - x1, CleanYfac_1, palcolor); // top
twod.AddColorOnlyQuad(x1, y2, x2 - x1, CleanYfac_1, palcolor); // bottom
twod.AddColorOnlyQuad(x1, y1+CleanYfac_1, CleanXfac_1, y2 - y1, palcolor); // left
twod.AddColorOnlyQuad(x2-CleanXfac_1, y1+CleanYfac_1, CleanXfac_1, CleanYfac_1, palcolor); // right
twod->AddColorOnlyQuad(x1, y1, x2 - x1, CleanYfac_1, palcolor); // top
twod->AddColorOnlyQuad(x1, y2, x2 - x1, CleanYfac_1, palcolor); // bottom
twod->AddColorOnlyQuad(x1, y1+CleanYfac_1, CleanXfac_1, y2 - y1, palcolor); // left
twod->AddColorOnlyQuad(x2-CleanXfac_1, y1+CleanYfac_1, CleanXfac_1, CleanYfac_1, palcolor); // right
}
else if (ch == '\b' || ch == 0)
{
// Draw the backspace and end "characters".
const char *const str = ch == '\b' ? "BS" : "ED";
DrawText(&twod, NewSmallFont, color,
DrawText(twod, NewSmallFont, color,
xx + cell_width/2 - displayFont->StringWidth(str)*CleanXfac_1/2,
yy + top_padding, str, DTA_CleanNoMove_1, true, TAG_DONE);
}

View file

@ -193,7 +193,7 @@ void DMessageBoxMenu::Drawer()
for (unsigned i = 0; i < mMessage.Size(); i++)
{
DrawText(&twod, SmallFont, CR_UNTRANSLATED, 160 - mMessage[i].Width / 2, y, mMessage[i].Text,
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - mMessage[i].Width / 2, y, mMessage[i].Text,
DTA_Clean, true, TAG_DONE);
y += fontheight;
}
@ -203,10 +203,10 @@ void DMessageBoxMenu::Drawer()
{
y += fontheight;
mMouseY = y;
DrawText(&twod, NewSmallFont,
DrawText(twod, NewSmallFont,
messageSelection == 0 ? OptionSettings.mFontColorSelection : OptionSettings.mFontColor,
160, y, GStrings["TXT_YES"], DTA_Clean, true, TAG_DONE);
DrawText(&twod, NewSmallFont,
DrawText(twod, NewSmallFont,
messageSelection == 1 ? OptionSettings.mFontColorSelection : OptionSettings.mFontColor,
160, y + fontheight + 1, GStrings["TXT_NO"], DTA_Clean, true, TAG_DONE);
@ -214,7 +214,7 @@ void DMessageBoxMenu::Drawer()
{
if (((DMenu::MenuTime >> 2) % 8) < 6)
{
DrawText(&twod, NewSmallFont, OptionSettings.mFontColorSelection,
DrawText(twod, NewSmallFont, OptionSettings.mFontColorSelection,
(150 - 160) * CleanXfac + screen->GetWidth() / 2,
(y + (fontheight + 1) * messageSelection - 100 + fontheight / 2 - 5) * CleanYfac + screen->GetHeight() / 2,
"\xd",
@ -227,7 +227,7 @@ void DMessageBoxMenu::Drawer()
}
else
{
twod.AddColorOnlyQuad(0, 0, xdim, ydim, 0xa0000000);
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xa0000000);
gi->DrawCenteredTextScreen(origin, mFullMessage, 100, false);
}
}

View file

@ -71,7 +71,7 @@ int OptionWidth(const char * s)
void DrawOptionText(int x, int y, int color, const char *text, bool grayed)
{
PalEntry overlay = grayed? PalEntry(96,48,0,0) : PalEntry(0,0,0);
DrawText (&twod, OptionFont(), color, x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay, TAG_END);
DrawText (twod, OptionFont(), color, x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay, TAG_END);
}
//=============================================================================

View file

@ -608,7 +608,7 @@ public:
void DrawSliderElement (int color, int x, int y, const char * str)
{
DrawText (&twod, ConFont, color, x, y, str, DTA_CellX, 16 * CleanXfac_1, DTA_CellY, 16 * CleanYfac_1, TAG_DONE);
DrawText (twod, ConFont, color, x, y, str, DTA_CellX, 16 * CleanXfac_1, DTA_CellY, 16 * CleanYfac_1, TAG_DONE);
}
void DrawSlider (int x, int y, double min, double max, double cur, int fracdigits, int indent)

View file

@ -460,7 +460,7 @@ void FSavegameManager::ClearSaveStuff()
bool FSavegameManager::DrawSavePic(int x, int y, int w, int h)
{
if (SavePic == nullptr) return false;
DrawTexture(&twod, SavePic, x, y, DTA_DestWidth, w, DTA_DestHeight, h, DTA_Masked, false, TAG_DONE);
DrawTexture(twod, SavePic, x, y, DTA_DestWidth, w, DTA_DestHeight, h, DTA_Masked, false, TAG_DONE);
return true;
}

View file

@ -64,6 +64,8 @@ void gl_PrintStartupLog();
extern bool vid_hdr_active;
void DrawFullscreenBlends();
namespace OpenGLRenderer
{
FGLRenderer *GLRenderer;
@ -405,7 +407,8 @@ void OpenGLFrameBuffer::Draw2D()
if (GLRenderer != nullptr)
{
GLRenderer->mBuffers->BindCurrentFB();
GLInterface.Draw2D(&twod);
::DrawFullscreenBlends();
GLInterface.Draw2D(&twodgen);
}
}
@ -416,3 +419,18 @@ void OpenGLFrameBuffer::PostProcessScene(int fixedcm, const std::function<void()
}
void videoShowFrame(int32_t w)
{
OpenGLRenderer::GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
screen->PostProcessScene(0, []() {
GLInterface.Draw2D(&twodpsp); // draws the weapon sprites
});
screen->Update();
// After finishing the frame, reset everything for the next frame. This needs to be done better.
screen->BeginFrame();
OpenGLRenderer::GLRenderer->mBuffers->BindSceneFB(false);
twodpsp.Clear();
twodgen.Clear();
}

View file

@ -137,8 +137,8 @@ void DFrameBuffer::DrawRateStuff ()
chars = snprintf (fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount);
rate_x = Width / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]);
twod.AddColorOnlyQuad(rate_x * textScale, 0, Width, NewConsoleFont->GetHeight() * textScale, 0);
DrawText (&twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0],
twod->AddColorOnlyQuad(rate_x * textScale, 0, Width, NewConsoleFont->GetHeight() * textScale, 0);
DrawText (twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0],
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);

View file

@ -116,7 +116,7 @@ void FStat::PrintStat ()
// Count number of linefeeds but ignore terminating ones.
if (stattext[i] == '\n') y -= fontheight;
}
DrawText(&twod, NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext,
DrawText(twod, NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecvars.h"
#include "menu/menu.h"
#include "mapinfo.h"
#include "v_2ddrawer.h"
BEGIN_DUKE_NS
@ -834,6 +835,7 @@ void G_DisplayRest(int32_t smoothratio)
G_DrawCameraText(pp->newowner);
else
{
PspTwoDSetter set;
P_DisplayWeapon();
#ifdef SPLITSCREEN_MOD_HACKS
if (pp2) // HACK

View file

@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "object.h"
#include <string.h>
#include <assert.h>
#include "v_2ddrawer.h"
BEGIN_PS_NS
@ -936,6 +937,7 @@ void DrawWeapons(int smooth)
if (nWeapon < -1) {
return;
}
PspTwoDSetter set;
short var_34 = PlayerList[nLocalPlayer].field_3A;

View file

@ -380,7 +380,7 @@ void DrawView(int smoothRatio)
bgpages--;
}
#else
FlushMessageLine();
//FlushMessageLine();
RefreshBackground();
#endif

View file

@ -170,18 +170,6 @@ void GLInstance::InitGLState(int fogmode, int multisample)
OpenGLRenderer::GLRenderer->mBuffers->BindSceneFB(false);
}
void videoShowFrame(int32_t w)
{
OpenGLRenderer::GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
screen->PostProcessScene(0, nullptr); // at the moment this won't work because there's no guarantee that this is a clean buffer what we get here.
screen->Update();
// After finishing the frame, reset everything for the next frame. This needs to be done better.
screen->BeginFrame();
OpenGLRenderer::GLRenderer->mBuffers->BindSceneFB(false);
}
void GLInstance::Deinit()
{
#if 0
@ -530,7 +518,7 @@ void GLInstance::DrawImGui(ImDrawData* data)
void GLInstance::ClearScreen(PalEntry color)
{
twod.Clear(); // Since we clear the entire screen, all previous draw operations become redundant, so delete them.
twod->Clear(); // Since we clear the entire screen, all previous draw operations become redundant, so delete them.
#if 1
SetViewport(0, 0, xdim, ydim);
@ -540,7 +528,7 @@ void GLInstance::ClearScreen(PalEntry color)
false);
#else
// This must be synchronized with the rest of the 2D operations.
twod.AddColorOnlyQuad(0, 0, xdim, ydim, );
twod->AddColorOnlyQuad(0, 0, xdim, ydim, );
#endif
}

View file

@ -218,7 +218,6 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
SetColor(1, 1, 1);
DisableScissor();
//drawer->mIsFirstPass = false;
twod.Clear();
EnableBlend(true);
EnableMultisampling(true);
}

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecvars.h"
#include "menu/menu.h"
#include "mapinfo.h"
#include "v_2ddrawer.h"
BEGIN_RR_NS
@ -854,6 +855,7 @@ void G_DisplayRest(int32_t smoothratio)
G_DrawCameraText(pp->newowner);
else
{
PspTwoDSetter set;
P_DisplayWeapon();
#ifdef SPLITSCREEN_MOD_HACKS
if (pp2) // HACK

View file

@ -41,6 +41,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "vis.h"
#include "text.h"
#include "player.h"
#include "v_2ddrawer.h"
#include "weapon.h"
#include "menu/menu.h"
@ -7334,7 +7335,9 @@ pDisplaySprites(PLAYERp pp)
short ang;
int flags;
int x1,y1,x2,y2;
PspTwoDSetter set;
set.clear();
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
ASSERT(ValidPtr(psp));
@ -7470,6 +7473,7 @@ pDisplaySprites(PLAYERp pp)
// if its a weapon sprite and the view is set to the outside don't draw the sprite
if (TEST(psp->flags, PANF_WEAPON_SPRITE))
{
set.set();
SECT_USERp sectu = nullptr;
int16_t floorshade = 0;
if (pp->cursectnum >= 0)
@ -7512,6 +7516,7 @@ pDisplaySprites(PLAYERp pp)
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
pal = 0;
}
else set.clear();
//PANF_STATUS_AREA | PANF_SCREEN_CLIP | PANF_KILL_AFTER_SHOW,