- fixed rendering on narrow screens with an aspect ratio less than 4:3 and removed some parts that are no longer needed.

This commit is contained in:
Christoph Oelckers 2020-08-14 21:01:27 +02:00
parent a5d9886aa9
commit 66cb7f61a4
22 changed files with 166 additions and 193 deletions

View file

@ -874,7 +874,7 @@ static void gameTicker()
static void drawBackground()
{
twod->ClearScreen();
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
if (gQuitRequest && !gQuitGame)
netBroadcastMyLogoff(gQuitRequest == 2);
}

View file

@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "qav.h"
#include "view.h"
#include "sound.h"
#include "v_video.h"
bool ShowOptionMenu();
@ -167,7 +168,9 @@ protected:
void PostDraw()
{
itemBloodQAV->Draw();
// For narrow screens this would be mispositioned so skip drawing it there.
double ratio = screen->GetWidth() / double(screen->GetHeight());
if (ratio > 1.32) itemBloodQAV->Draw();
}
};
@ -225,10 +228,10 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub
xpos -= width / 2;
}
DrawText(twod, gamefont, CR_UNDEFINED, xpos+1, ypos+1, text, DTA_Color, 0xff000000, //DTA_Alpha, 0.5,
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DrawText(twod, gamefont, CR_UNDEFINED, xpos, ypos, text, DTA_TranslationIndex, TRANSLATION(Translation_Remap, pal), DTA_Color, shadeToLight(shade),
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
}
@ -271,8 +274,8 @@ void DrawMenuCaption(const char* text)
int boxwidth = tileWidth(2038);
if (boxwidth - 10 < width) scalex = double(width) / (boxwidth - 10);
DrawTexture(twod, tileGetTexture(2038, true), 160, 20, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex, TAG_DONE);
DrawText(twod, BigFont, CR_UNDEFINED, 160 - width/2, 20 - tileHeight(4193) / 2, text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DrawTexture(twod, tileGetTexture(2038, true), 160, 20, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex, TAG_DONE);
DrawText(twod, BigFont, CR_UNDEFINED, 160 - width/2, 20 - tileHeight(4193) / 2, text, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
}
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
@ -292,7 +295,7 @@ void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* t
{
int width = SmallFont->StringWidth(l);
int x = 160 - width / 2;
DrawText(twod, SmallFont, CR_UNTRANSLATED, x, y, l, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DrawText(twod, SmallFont, CR_UNTRANSLATED, x, y, l, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
y += height;
}
}

View file

@ -64,7 +64,7 @@ static void drawTextScreenBackground(void)
{
if (yxaspect >= 65536)
{
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
}
else
{
@ -84,7 +84,7 @@ static void drawTextScreenBackground(void)
}
else
{
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
}
}

View file

@ -71,10 +71,12 @@ static struct {
static void drawElement(int x, int y, int tile, double scale = 1, int flipx = 0, int flipy = 0, int pin = 0, int basepal = 0, double alpha = 1)
{
DrawTexture(&twodpsp, tileGetTexture(tile), x, y, DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_TopLeft, true, DTA_FlipOffsets, true,
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ViewportX, gViewX0, DTA_ViewportY, gViewY0, DTA_Alpha, alpha,
DTA_ViewportWidth, gViewX1 - gViewX0 + 1, DTA_ViewportHeight, gViewY1 - gViewY0 + 1, DTA_Pin, pin, DTA_ScaleX, scale, DTA_ScaleY, scale,
DTA_TranslationIndex, TRANSLATION(Translation_Remap + basepal, 0), TAG_DONE);
int flags = RS_TOPLEFT;
if (flipx) flags |= RS_XFLIPHUD;
if (flipy) flags |= RS_YFLIPHUD;
if (pin == -1) flags |= RS_ALIGN_L;
else if (pin == 1) flags |= RS_ALIGN_R;
hud_drawsprite(x, y, int(scale*65536), 0, tile, 0, basepal, flags, alpha);
}
@ -103,7 +105,7 @@ void hudDraw(PLAYER *gView, int nSectnum, int defaultHoriz, double bobx, double
{
double crosshair_scale = cl_crosshairscale * .02;
DrawTexture(twod, tileGetTexture(kCrosshairTile), 160, defaultHoriz,
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, TAG_DONE);
}
double cX = 160;

View file

@ -160,7 +160,7 @@ void sub_2541C(int x, int y, int z, short a)
double x = xdim/2. + x1 / double(1<<12);
double y = ydim/2. + y1 / double(1<<12);
// This very likely needs fixing later
DrawTexture(twod, tileGetTexture(nTile, true), x, y, DTA_FullscreenScale, 3, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DrawTexture(twod, tileGetTexture(nTile, true), x, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DTA_ViewportWidth, windowxy2.x - windowxy1.x+1, DTA_ViewportHeight, windowxy2.y - windowxy1.y+1, DTA_Alpha, (pSprite->cstat&2? 0.5:1.), TAG_DONE);
}
}

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "qav.h"
#include "sound.h"
#include "v_draw.h"
#include "glbackend/glbackend.h"
BEGIN_BLD_NS
@ -50,31 +51,35 @@ void DrawFrame(F2DDrawer *twod, double x, double y, TILE_FRAME *pTile, int stat,
stat |= pTile->stat;
x += pTile->x;
y += pTile->y;
auto tex = tileGetTexture(pTile->picnum);
double scale = pTile->z/65536.;
double angle = pTile->angle * (360./2048);
int renderstyle = (stat & RS_NOMASK)? STYLE_Normal : STYLE_Translucent;
double alpha = (stat & RS_TRANS1)? glblend[0].def[!!(stat & RS_TRANS2)].alpha : 1.;
int pin = (stat & kQavOrientationLeft)? -1 : (stat & RS_ALIGN_R)? 1:0;
if (palnum <= 0) palnum = pTile->palnum;
auto translation = TRANSLATION(Translation_Remap + basepal, palnum);
bool topleft = !!(stat & RS_TOPLEFT);
bool xflip = !!(stat & 0x100); // repurposed flag
bool yflip = !!(stat & RS_YFLIP);
auto color = shadeToLight(pTile->shade + shade);
if (!to3dview)
{
auto tex = tileGetTexture(pTile->picnum);
double scale = pTile->z/65536.;
double angle = pTile->angle * (360./2048);
int renderstyle = (stat & RS_NOMASK)? STYLE_Normal : STYLE_Translucent;
double alpha = (stat & RS_TRANS1)? glblend[0].def[!!(stat & RS_TRANS2)].alpha : 1.;
int pin = (stat & kQavOrientationLeft)? -1 : (stat & RS_ALIGN_R)? 1:0;
if (palnum <= 0) palnum = pTile->palnum;
auto translation = TRANSLATION(Translation_Remap + basepal, palnum);
bool topleft = !!(stat & RS_TOPLEFT);
bool xflip = !!(stat & 0x100); // repurposed flag
bool yflip = !!(stat & RS_YFLIP);
auto color = shadeToLight(pTile->shade + shade);
DrawTexture(twod, tex, x, y, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Rotate, angle, DTA_LegacyRenderStyle, renderstyle, DTA_Alpha, alpha, DTA_Pin, pin, DTA_TranslationIndex, translation,
DTA_TopLeft, topleft, DTA_CenterOffsetRel, !topleft, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_FlipOffsets, true, DTA_Color, color,
DTA_TopLeft, topleft, DTA_CenterOffsetRel, !topleft, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_FlipOffsets, true, DTA_Color, color,
DTA_FlipX, xflip, DTA_FlipY, yflip, TAG_DONE);
}
else
{
DrawTexture(twod, tex, x, y, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Rotate, angle, DTA_LegacyRenderStyle, renderstyle, DTA_Alpha, alpha, DTA_Pin, pin, DTA_TranslationIndex, translation,
DTA_TopLeft, topleft, DTA_CenterOffsetRel, !topleft, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_FlipOffsets, true, DTA_Color, color,
DTA_FlipX, xflip, DTA_FlipY, yflip, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x+1, DTA_ViewportHeight, windowxy2.y - windowxy1.y+1, TAG_DONE);
if (stat & RS_YFLIP) stat |= RS_YFLIPHUD;
stat &= ~RS_YFLIP;
if (stat & 0x100) stat |= RS_XFLIPHUD;
if ((stat & kQavOrientationLeft)) stat |= RS_ALIGN_L;
hud_drawsprite(x, y, pTile->z, pTile->angle, pTile->picnum, shade, palnum, stat);
}
}

View file

@ -230,9 +230,9 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
if (shadow)
{
DrawText(twod, pFont, CR_UNDEFINED, x+1, y+1, pString, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff000000, DTA_Alpha, 0.5, TAG_DONE);
DrawText(twod, pFont, CR_UNDEFINED, x+1, y+1, pString, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff000000, DTA_Alpha, 0.5, TAG_DONE);
}
DrawText(twod, pFont, CR_UNDEFINED, x, y, pString, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, nPalette),
DrawText(twod, pFont, CR_UNDEFINED, x, y, pString, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, nPalette),
DTA_Color, shadeToLight(nShade), DTA_Alpha, alpha / 255., TAG_DONE);
}

View file

@ -156,6 +156,8 @@ enum {
RS_MODELSUBST= 4096,
// ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits
ROTATESPRITE_MAX = 8192,
RS_XFLIPHUD = RS_YFLIP,
RS_YFLIPHUD = 16384, // this is for hud_drawsprite which uses RS_YFLIP for x-flipping but needs both flags
RS_CENTER = (1<<29), // proper center align.
RS_CENTERORIGIN = (1<<30),
@ -1164,7 +1166,7 @@ class F2DDrawer;
extern F2DDrawer twodpsp;
extern F2DDrawer* twod;
// This is for safely substituting the 2D drawer for a block of code.
// This is for safely substituting the 2D drawer for a block of code. Won't be needed anymore after proper refactoring.
class PspTwoDSetter
{
F2DDrawer* old;
@ -1178,15 +1180,6 @@ public:
{
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 // build_h_

View file

@ -335,12 +335,13 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
}
static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcwidth, double srcheight, int autoaspect, DoubleRect &rect)
static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcwidth, double srcheight, int oautoaspect, DoubleRect &rect)
{
auto GetWidth = [=]() { return parms->viewport.width; };
auto GetHeight = [=]() {return parms->viewport.height; };
if (autoaspect == 4)
int autoaspect = oautoaspect;
if (autoaspect == FSMode_ScaleToScreen)
{
rect.left = rect.top = 0;
rect.width = GetWidth();
@ -354,23 +355,35 @@ static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcw
else aspect = srcwidth / srcheight;
rect.left = rect.top = 0;
auto screenratio = ActiveRatio(GetWidth(), GetHeight());
if (autoaspect == 3)
if (autoaspect == FSMode_ScaleToFit43 || autoaspect == FSMode_ScaleToFit43Top || autoaspect == FSMode_ScaleToFit43Bottom)
{
if (screenratio >= aspect || aspect < 1.4) autoaspect = 1; // screen is wider than the image -> pillarbox it. 4:3 images must also be pillarboxed if the screen is taller than the image
else if (screenratio > 1.32) autoaspect = 2; // on anything 4:3 and wider crop the sides of the image.
// screen is wider than the image -> pillarbox it. 4:3 images must also be pillarboxed if the screen is taller than the image
if (screenratio >= aspect || aspect < 1.4) autoaspect = FSMode_ScaleToFit;
else if (screenratio > 1.32) autoaspect = FSMode_ScaleToFill; // on anything 4:3 and wider crop the sides of the image.
else
{
// special case: Crop image to 4:3 and then letterbox this. This avoids too much cropping on narrow windows.
double width4_3 = srcheight * (4. / 3.);
rect.width = (double)GetWidth() * srcwidth / width4_3;
rect.height = GetHeight() * screenratio * (3. / 4.); // use 4:3 for the image
rect.top = (GetHeight() - rect.height) / 2;
rect.left = -(srcwidth - width4_3) / 2;
switch (oautoaspect)
{
default:
rect.top = (GetHeight() - rect.height) / 2;
break;
case FSMode_ScaleToFit43Top:
rect.top = 0;
break;
case FSMode_ScaleToFit43Bottom:
rect.top = (GetHeight() - rect.height);
break;
}
return;
}
}
if ((screenratio > aspect) ^ (autoaspect == 2))
if (autoaspect == FSMode_ScaleToHeight || (screenratio > aspect) ^ (autoaspect == FSMode_ScaleToFill))
{
// pillarboxed or vertically cropped (i.e. scale to height)
rect.height = GetHeight();
@ -382,7 +395,18 @@ static void CalcFullscreenScale(F2DDrawer* drawer, DrawParms *parms, double srcw
// letterboxed or horizontally cropped (i.e. scale to width)
rect.width = GetWidth();
rect.height = GetHeight() * screenratio / aspect;
rect.top = (GetHeight() - rect.height) / 2;
switch (oautoaspect)
{
default:
rect.top = (GetHeight() - rect.height) / 2;
break;
case FSMode_ScaleToFit43Top:
rect.top = 0;
break;
case FSMode_ScaleToFit43Bottom:
rect.top = (GetHeight() - rect.height);
break;
}
}
}
@ -447,7 +471,7 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do
break;
case DTA_Base:
if (parms->fsscalemode != -1)
if (parms->fsscalemode > 0)
{
// First calculate the destination rect for an image of the given size and then reposition this object in it.
DoubleRect rect;
@ -771,9 +795,9 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
case DTA_FullscreenScale:
intval = ListGetInt(tags);
if (intval >= 0 && intval <= 4)
if (intval >= FSMode_None && intval < FSMode_Max)
{
parms->fsscalemode = (uint8_t)intval;
parms->fsscalemode = (int8_t)intval;
}
break;

View file

@ -23,6 +23,21 @@ enum tags : uint32_t
TAG_USER = ((uint32_t)(1u << 30))
};
enum
{
FSMode_None = 0,
FSMode_ScaleToFit = 1,
FSMode_ScaleToFill = 2,
FSMode_ScaleToFit43 = 3,
FSMode_ScaleToScreen = 4,
FSMode_ScaleToFit43Top = 5,
FSMode_ScaleToFit43Bottom = 6,
FSMode_ScaleToHeight = 7,
FSMode_Max
};
enum
{
DTA_Base = TAG_USER + 5000,

View file

@ -63,7 +63,7 @@ void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* t
for (auto& line : lines)
{
double x = origin.X + 160 - line.Width * scale * 0.5;
DrawText(twod, SmallFont, CR_UNTRANSLATED, x, y, line.Text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
DrawText(twod, SmallFont, CR_UNTRANSLATED, x, y, line.Text, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
y += fheight;
}
}

View file

@ -76,7 +76,7 @@ int DImageScreen::Frame(uint64_t clock, bool skiprequest)
if (!tex) return 0;
int span = int(clock / 1'000'000);
twod->ClearScreen();
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
// Only end after having faded out.
return skiprequest ? -1 : span > waittime? 0 : 1;
}
@ -137,7 +137,7 @@ public:
if (totalclock < ototalclock - 1)
{
twod->ClearScreen();
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE);
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Masked, false, TAG_DONE);
if (skiprequest) soundEngine->StopAllChannels();
return skiprequest? -1 : 1;
}
@ -146,7 +146,7 @@ public:
frametime = totalclock;
twod->ClearScreen();
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE);
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Masked, false, TAG_DONE);
int delay = 20;
if (frameTicks)
@ -210,7 +210,7 @@ public:
if (failed) return -1;
bool playon = decoder.RunFrame(clock);
twod->ClearScreen();
DrawTexture(twod, decoder.animTex().GetFrame(), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, decoder.animTex().GetFrame(), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
return skiprequest ? -1 : playon ? 1 : 0;
}
@ -285,7 +285,7 @@ public:
}
if (fullscreenScale)
{
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
}
else
{

View file

@ -137,21 +137,21 @@ void InitFonts_d()
static void BigText(double x, double y, const char* text, double alpha = 1.)
{
auto width = BigFont->StringWidth(text);
DrawText(twod, BigFont, CR_UNTRANSLATED, x - width / 2, y - 12, text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Alpha, alpha, TAG_DONE);
DrawText(twod, BigFont, CR_UNTRANSLATED, x - width / 2, y - 12, text, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Alpha, alpha, TAG_DONE);
}
static void GameText(double x, double y, const char* t, int shade, int align = -1, int trans = 0)
{
if (align != -1)
x -= SmallFont->StringWidth(t) * (align == 0 ? 0.5 : 1);
DrawText(twod, SmallFont, CR_UNDEFINED, x, y + 2, t, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
DrawText(twod, SmallFont, CR_UNDEFINED, x, y + 2, t, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
}
static void MiniText(double x, double y, const char* t, int shade, int align = -1, int trans = 0)
{
if (align != -1)
x -= SmallFont2->StringWidth(t) * (align == 0 ? 0.5 : 1);
DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, t, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, t, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
}
//---------------------------------------------------------------------------
@ -172,7 +172,7 @@ public:
const int translation = TRANSLATION(Translation_BasePalettes, DREALMSPAL);
twod->ClearScreen();
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, translation, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
return skiprequest ? -1 : clock < duration ? 1 : 0;
}
};
@ -198,7 +198,7 @@ public:
auto translation = TRANSLATION(Translation_BasePalettes, TITLEPAL);
twod->ClearScreen();
DrawTexture(twod, tileGetTexture(BETASCREEN, true), 0, 0, DTA_FullscreenEx, 3, DTA_TranslationIndex, translation, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(BETASCREEN, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, translation, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
if (soundanm == 0 && clock >= 120 && clock < 120 + 60)
{
@ -223,19 +223,19 @@ public:
double scale = clamp(clock - 120, 0, 60) / 64.;
if (scale > 0.)
DrawTexture(twod, tileGetTexture(DUKENUKEM, true), 160, 104, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(DUKENUKEM, true), 160, 104, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, translation, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
scale = clamp(clock - 220, 0, 30) / 32.;
if (scale > 0.)
DrawTexture(twod, tileGetTexture(THREEDEE, true), 160, 129, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(THREEDEE, true), 160, 129, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, translation, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
if (PLUTOPAK)
{
scale = (410 - clamp(clock, 280, 395)) / 16.;
if (scale > 0. && clock > 280)
DrawTexture(twod, tileGetTexture(PLUTOPAKSPRITE+1, true), 160, 151, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(PLUTOPAKSPRITE+1, true), 160, 151, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, translation, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
}
@ -315,7 +315,7 @@ public:
uint64_t span = nsclock / 1'000'000;
twod->ClearScreen();
DrawTexture(twod, tileGetTexture(VICTORY1, true), 0, 50, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(VICTORY1, true), 0, 50, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_TranslationIndex, translation, DTA_LegacyRenderStyle, STYLE_Normal, DTA_TopLeft, true, TAG_DONE);
@ -329,7 +329,7 @@ public:
S_PlaySound(SQUISHED, CHAN_AUTO, CHANF_UI);
bonuscnt++;
}
DrawTexture(twod, tileGetTexture(bossmove[t + 2], true), bossmove[t + 3], bossmove[t + 4], DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(bossmove[t + 2], true), bossmove[t + 3], bossmove[t + 4], DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_TranslationIndex, translation, DTA_TopLeft, true, TAG_DONE);
}
@ -338,7 +338,7 @@ public:
{
if (totalclock >= 750)
{
DrawTexture(twod, tileGetTexture(VICTORY1 + 8, true), 86, 59, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(VICTORY1 + 8, true), 86, 59, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_TranslationIndex, translation, DTA_TopLeft, true, TAG_DONE);
if (totalclock >= 750 && bonuscnt == 2)
{
@ -354,7 +354,7 @@ public:
S_PlaySound(BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI);
bonuscnt++;
}
DrawTexture(twod, tileGetTexture(breathe[t + 2], true), breathe[t + 3], breathe[t + 4], DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(breathe[t + 2], true), breathe[t + 3], breathe[t + 4], DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_TranslationIndex, translation, DTA_TopLeft, true, TAG_DONE);
}
}
@ -674,10 +674,10 @@ public:
char tempbuf[32];
int totalclock = int(clock * 120 / 1'000'000'000);
twod->ClearScreen();
DrawTexture(twod, tileGetTexture(MENUSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(INGAMEDUKETHREEDEE, true), 160, 34, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(MENUSCREEN), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(INGAMEDUKETHREEDEE, true), 160, 34, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
if (PLUTOPAK)
DrawTexture(twod, tileGetTexture(PLUTOPAKSPRITE+2, true), 260, 36, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(PLUTOPAKSPRITE+2, true), 260, 36, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
GameText(160, 58 + 2, GStrings("Multiplayer Totals"), 0, 0);
GameText(160, 58 + 10, currentLevel->DisplayName(), 0, 0);
@ -877,7 +877,7 @@ public:
if (clock == 0) S_PlayBonusMusic();
twod->ClearScreen();
int totalclock = int(clock * 120 / 1'000'000'000);
DrawTexture(twod, tileGetTexture(gfx_offset, true), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
if (lastmapname) BigText(160, 20 - 6, lastmapname);
BigText(160, 36 - 6, GStrings("Completed"));
@ -911,11 +911,11 @@ public:
case 1:
case 4:
case 5:
DrawTexture(twod, tileGetTexture(gfx_offset + 3), 199, 31, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset + 3), 199, 31, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
break;
case 2:
case 3:
DrawTexture(twod, tileGetTexture(gfx_offset + 4), 199, 31, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset + 4), 199, 31, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
break;
}
}
@ -926,10 +926,10 @@ public:
{
case 1:
case 3:
DrawTexture(twod, tileGetTexture(gfx_offset + 1), 199, 31, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset + 1), 199, 31, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
break;
case 2:
DrawTexture(twod, tileGetTexture(gfx_offset + 2), 199, 31, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset + 2), 199, 31, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, TAG_DONE);
break;
}
}
@ -1050,7 +1050,7 @@ public:
int Frame(uint64_t clock, bool skiprequest)
{
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
BigText(160, 90, (rec->flags & MI_USERMAP)? GStrings("TXT_LOADUM") : GStrings("TXT_LOADING"));
BigText(160, 114, rec->DisplayName());

View file

@ -136,7 +136,7 @@ static void BigText(double x, double y, const char* text, int align, double alph
if (align != -1)
x -= BigFont->StringWidth(text) * (align == 0 ? 0.2 : 0.4);
auto width = BigFont->StringWidth(text);
DrawText(twod, BigFont, CR_UNTRANSLATED, x, y - 12, text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.4, DTA_ScaleY, 0.4, DTA_Alpha, alpha, TAG_DONE);
DrawText(twod, BigFont, CR_UNTRANSLATED, x, y - 12, text, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.4, DTA_ScaleY, 0.4, DTA_Alpha, alpha, TAG_DONE);
}
static void GameText(double x, double y, const char* t, int shade, int align = -1, int trans = 0)
@ -144,7 +144,7 @@ static void GameText(double x, double y, const char* t, int shade, int align = -
x *= 2; y *= 2;
if (align != -1)
x -= SmallFont->StringWidth(t) * (align == 0 ? 0.5 : 1);
DrawText(twod, SmallFont, CR_UNDEFINED, x, y + 2, t, DTA_FullscreenScale, 3, DTA_VirtualWidth, 640, DTA_VirtualHeight, 400, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
DrawText(twod, SmallFont, CR_UNDEFINED, x, y + 2, t, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 640, DTA_VirtualHeight, 400, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
}
static void MiniText(double x, double y, const char* t, int shade, int align = -1, int trans = 0)
@ -152,7 +152,7 @@ static void MiniText(double x, double y, const char* t, int shade, int align = -
x *= 2; y *= 2;
if (align != -1)
x -= SmallFont2->StringWidth(t) * (align == 0 ? 0.5 : 1);
DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, t, DTA_FullscreenScale, 3, DTA_VirtualWidth, 640, DTA_VirtualHeight, 400, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, t, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 640, DTA_VirtualHeight, 400, DTA_TranslationIndex, TRANSLATION(Translation_Remap, trans), DTA_Color, shadeToLight(shade), TAG_DONE);
}
//---------------------------------------------------------------------------
@ -265,9 +265,9 @@ public:
if (clock == 0) S_PlayBonusMusic();
char tempbuf[32];
twod->ClearScreen();
DrawTexture(twod, tileGetTexture(MENUSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(MENUSCREEN), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
double scale = 0.36;
DrawTexture(twod, tileGetTexture(INGAMEDUKETHREEDEE, true), 160, 34, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DrawTexture(twod, tileGetTexture(INGAMEDUKETHREEDEE, true), 160, 34, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, true, DTA_ScaleX, scale, DTA_ScaleY, 0.36, TAG_DONE);
GameText(160, 58, GStrings("Multiplayer Totals"), 0, 0);
@ -470,7 +470,7 @@ public:
if (clock == 0) S_PlayBonusMusic();
twod->ClearScreen();
int totalclock = int(clock * 120 / 1'000'000'000);
DrawTexture(twod, tileGetTexture(gfx_offset, true), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(gfx_offset, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
if (lastmapname) BigText(80, 16, lastmapname, -1);
BigText(15, 192, GStrings("PRESSKEY"), -1);
@ -534,7 +534,7 @@ public:
{
int totalclock = int(clock * 120 / 1'000'000'000);
auto tex = tileGetTexture(RRTILE8677 + ((totalclock >> 4) & 1));
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
if (!S_CheckSoundPlaying(-1, 35) && totalclock > 15*120) return 0; // make sure it stays, even if sound is off.
if (skiprequest)
{
@ -608,7 +608,7 @@ public:
int Frame(uint64_t clock, bool skiprequest)
{
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, 3, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
DrawTexture(twod, tileGetTexture(LOADSCREEN), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
int y = isRRRA()? 140 : 90;
BigText(160, y, (rec->flags & MI_USERMAP) ? GStrings("TXT_ENTRUM") : GStrings("TXT_ENTERIN"), 0);

View file

@ -53,7 +53,7 @@ BEGIN_DUKE_NS
static void Menu_DrawBackground(const DVector2 &origin)
{
DrawTexture(twod, tileGetTexture(TILE_MENUSCREEN), origin.X + 160, origin.Y + 100, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff808080, DTA_CenterOffset, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_MENUSCREEN), origin.X + 160, origin.Y + 100, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff808080, DTA_CenterOffset, true, TAG_DONE);
}
//----------------------------------------------------------------------------
@ -70,7 +70,7 @@ static void Menu_DrawCursor(double x, double y, double scale, bool right)
else picnum = TILE_SPINNINGNUKEICON + frames - 1 - ((frames - 1 + ((int)totalclock >> 3)) % frames);
int light = int(224 + 31 * sin((int)totalclock / 20.));
PalEntry pe(255, light, light, light);
DrawTexture(twod, tileGetTexture(picnum), x, y, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(picnum), x, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
}
//----------------------------------------------------------------------------
@ -141,20 +141,20 @@ class DukeMainMenu : public DukeListMenu
double x = origin.X + 160;
if (isRRRA())
{
DrawTexture(twod, tileGetTexture(TILE_THREEDEE), x-5, origin.Y+57, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.253, DTA_ScaleY, 0.253, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_THREEDEE), x-5, origin.Y+57, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.253, DTA_ScaleY, 0.253, DTA_CenterOffsetRel, true, TAG_DONE);
}
else if (isRR())
{
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x+5, origin.Y + 24, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.36, DTA_ScaleY, 0.36, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x+5, origin.Y + 24, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, 0.36, DTA_ScaleY, 0.36, DTA_CenterOffsetRel, true, TAG_DONE);
}
else
{
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_INGAMEDUKETHREEDEE), x, origin.Y + 29, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
if (PLUTOPAK)
{
int light = 224 + 31 * sin(int(totalclock) / 40.);
PalEntry pe(255, light, light, light);
DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_PLUTOPAKSPRITE + 2), x + 100, origin.Y + 36, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, pe, DTA_CenterOffsetRel, true, TAG_DONE);
}
}
@ -194,7 +194,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
pe = 0xffa0a0a0;
}
DrawText(twod, BigFont, CR_UNDEFINED, xpos, ypos, text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe,
DrawText(twod, BigFont, CR_UNDEFINED, xpos, ypos, text, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe,
DTA_TranslationIndex, trans, TAG_DONE);
if (state == NIT_SelectedState)
@ -321,7 +321,7 @@ FSavegameInfo GameInterface::GetSaveSig()
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
{
DrawTexture(twod, tileGetTexture(TILE_MENUBAR), origin.X + 160, origin.Y + 19, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff808080, DTA_CenterOffsetRel, 1, TAG_DONE);
DrawTexture(twod, tileGetTexture(TILE_MENUBAR), origin.X + 160, origin.Y + 19, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_Color, 0xff808080, DTA_CenterOffsetRel, 1, TAG_DONE);
FString t = text;
size_t newlen = t.Len();
@ -330,7 +330,7 @@ void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
t.Truncate(newlen);
double scale = isRR() ? 0.4 : 1.0;
double x = 160 + origin.X - BigFont->StringWidth(t) * scale * 0.5;
DrawText(twod, BigFont, CR_UNTRANSLATED, x, origin.Y + 12, t, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
DrawText(twod, BigFont, CR_UNTRANSLATED, x, origin.Y + 12, t, DTA_FullscreenScale, FSMode_ScaleToFit43Top, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
}
void GameInterface::DrawCenteredTextScreen(const DVector2 &origin, const char *text, int position, bool bg)

View file

@ -180,7 +180,7 @@ void drawbackground(void)
auto tex = tileGetTexture(TILE_MENUSCREEN);
PalEntry color = 0xff808080;
if (!hud_bgstretch)
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, 3, DTA_Color, color, TAG_DONE);
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, color, TAG_DONE);
else
DrawTexture(twod, tex, 0, 0, DTA_VirtualWidth, twod->GetWidth(), DTA_VirtualHeight, twod->GetHeight(), DTA_KeepRatio, true, DTA_Color, color, TAG_DONE);
}
@ -359,7 +359,7 @@ void displayrest(double smoothratio)
if (isRR()) crosshair_scale *= .5;
DrawTexture(twod, tileGetTexture(a), 160 - getHalfLookAng(screenpeek, cl_syncinput, smoothratio), 100,
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, TAG_DONE);
}
}
@ -658,9 +658,9 @@ void drawoverheadmap(int cposx, int cposy, int czoom, int cang)
int top = isRR() ? 0 : (hud_size < 11 ? 147 : 179);
if (!(currentLevel->flags & MI_USERMAP))
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top+6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]),
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, SmallFont2, CR_UNDEFINED, 5, top + 12, currentLevel->DisplayName(),
DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
}
}
@ -676,7 +676,7 @@ void cameratext(int i)
auto drawitem = [=](int tile, double x, double y, bool flipx, bool flipy)
{
DrawTexture(twod, tileGetTexture(tile), x, y, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_CenterOffsetRel, true,
DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
};
if (!hittype[i].temp_data[0])
{

View file

@ -71,7 +71,7 @@ void DDukeCommonStatusBar::displayfragbar(void)
auto tex = tileGetTexture(TILE_FRAGBAR);
for (int y = 0; y < 32; y += 8)
DrawTexture(twod, tex, 0, 0, DTA_FullscreenScale, 3, DTA_ViewportWidth, 320, DTA_ViewportHeight, 200, DTA_ScaleX, 1.001, DTA_ScaleY, 1.001, TAG_Done);
DrawTexture(twod, tex, 0, 0, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_ViewportWidth, 320, DTA_ViewportHeight, 200, DTA_ScaleX, 1.001, DTA_ScaleY, 1.001, TAG_Done);
for (i = connecthead; i >= 0; i = connectpoint2[i])
{

View file

@ -533,25 +533,27 @@ void precacheMarkedTiles()
}
}
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat)
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha)
{
double dz = z / 65536.;
int light = Scale(numshades - clamp(dashade, 0, numshades - 1), 255, numshades);
PalEntry pe(255, light, light, light);
alpha *= (dastat & RS_TRANS1)? glblend[0].def[!!(dastat & RS_TRANS2)].alpha : 1.;
DrawTexture(&twodpsp, tileGetTexture(picnum, true), sx, sy,
DTA_ScaleX, dz, DTA_ScaleY, dz,
DTA_Color, pe,
DTA_Color, shadeToLight(dashade),
DTA_TranslationIndex, TRANSLATION(Translation_Remap + curbasepal, dapalnum),
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1,
DTA_FullscreenScale, (dastat & RS_STRETCH)? 4: 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_FullscreenScale, (dastat & RS_STRETCH)? FSMode_ScaleToScreen: FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, !(dastat & (RS_TOPLEFT | RS_CENTER)),
DTA_TopLeft, !!(dastat & RS_TOPLEFT),
DTA_CenterOffset, !!(dastat & RS_CENTER),
DTA_FlipX, !!(dastat & RS_YFLIP), // the weapon drawer uses y-flip+180° rotation for x-flip but no other transformation.
DTA_FlipX, !!(dastat & RS_XFLIPHUD),
DTA_FlipY, !!(dastat & RS_YFLIPHUD),
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
DTA_Rotate, a * (-360./2048),
DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)),
DTA_Alpha, alpha,
TAG_DONE);
}

View file

@ -363,4 +363,4 @@ void renderBeginScene();
void renderFinishScene();
void DrawRateStuff();
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat);
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha = 1);

View file

@ -42,9 +42,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "weapon.h"
#include "menu.h"
#include "raze_sound.h"
#include "glbackend/glbackend.h"
BEGIN_SW_NS
int InitSwordAttack(PLAYERp pp);
PANEL_SPRITEp InitWeaponUziSecondaryReload(PANEL_SPRITEp);
PANEL_SPRITEp InitWeaponUzi2(PANEL_SPRITEp);
@ -58,19 +60,6 @@ int InitGrenade(PLAYERp pp);
int InitMine(PLAYERp pp);
int InitFistAttack(PLAYERp pp);
#pragma message("delete me")
enum
{
PANEL_BOX_Y = (174 - 6),
};
//#define UK_VERSION TRUE
#define PANF_UZI_XFLIP (BIT(21))
#define XDIM 320
@ -187,27 +176,6 @@ SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id)
// Used to sprites in the view at correct aspect ratio and x,y location.
PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp, short pic, short pri, int x, int y)
{
PANEL_SPRITEp nsp;
if ((nsp = pFindMatchingSprite(pp, x, y, pri)) == NULL)
{
nsp = pSpawnSprite(pp, NULL, pri, x, y);
}
nsp->numpages = numpages;
nsp->picndx = -1;
nsp->picnum = pic;
nsp->x1 = 0;
nsp->y1 = 0;
nsp->x2 = xdim - 1;
nsp->y2 = ydim - 1;
SET(nsp->flags, PANF_STATUS_AREA | PANF_SCREEN_CLIP);
return nsp;
}
void pSetSuicide(PANEL_SPRITEp psp)
{
//SET(psp->flags, PANF_SUICIDE);
@ -419,9 +387,6 @@ void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum)
void PlayerUpdateKills(PLAYERp pp, short value)
{
#define PANEL_KILLS_X 31
#define PANEL_KILLS_Y 164
if (Prediction)
return;
@ -6992,10 +6957,7 @@ pDisplaySprites(PLAYERp pp)
uint8_t pal = 0;
short ang;
int flags;
int x1,y1,x2,y2;
PspTwoDSetter set;
set.clear();
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
ang = psp->rotate_ang;
@ -7122,7 +7084,6 @@ 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)
@ -7165,7 +7126,6 @@ pDisplaySprites(PLAYERp pp)
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
pal = 0;
}
else set.clear();
SET(flags, ROTATE_SPRITE_VIEW_CLIP);
@ -7177,35 +7137,9 @@ pDisplaySprites(PLAYERp pp)
if (TEST(psp->flags, PANF_CORNER))
SET(flags, ROTATE_SPRITE_CORNER);
if (TEST(psp->flags, PANF_STATUS_AREA))
{
SET(flags,ROTATE_SPRITE_CORNER);
RESET(flags,ROTATE_SPRITE_VIEW_CLIP);
if (TEST(psp->flags, PANF_SCREEN_CLIP))
SET(flags, ROTATE_SPRITE_SCREEN_CLIP);
if (TEST(psp->flags, PANF_IGNORE_START_MOST))
SET(flags, ROTATE_SPRITE_IGNORE_START_MOST);
x1 = psp->x1;
y1 = psp->y1;
x2 = psp->x2;
y2 = psp->y2;
shade = psp->shade;
}
else
{
x1 = windowxy1.x;
y1 = windowxy1.y;
x2 = windowxy2.x;
y2 = windowxy2.y;
}
if ((psp->State && TEST(psp->State->flags, psf_Xflip)) || TEST(psp->flags, PANF_XFLIP))
{
// this is what you have to do to x-flip
ang = NORM_ANGLE(ang + 1024);
// Build has no xflip, so it uses yflip plus rotation. We don't need the rotation here.
SET(flags, ROTATE_SPRITE_YFLIP);
}
@ -7252,19 +7186,16 @@ pDisplaySprites(PLAYERp pp)
case BLOODYFIST3_SWING0:
case BLOODYFIST3_SWING1:
case BLOODYFIST3_SWING2:
if (TEST(flags, BIT(2)) && x > 160)
if (TEST(flags, ROTATE_SPRITE_YFLIP) && x > 160)
x = 65;
else if (!TEST(flags, BIT(2)) && x < 160)
else if (!TEST(flags, ROTATE_SPRITE_YFLIP) && x < 160)
x = 345;
break;
default:
break;
}
rotatesprite(x << 16, y << 16,
psp->scale, ang,
picnum, shade, pal,
flags, x1, y1, x2, y2);
hud_drawsprite(x, y, psp->scale, ang, picnum, shade, pal, flags);
// do overlays (if any)
for (i = 0; i < SIZ(psp->over); i++)
@ -7284,10 +7215,7 @@ pDisplaySprites(PLAYERp pp)
if (picnum)
{
rotatesprite((x + psp->over[i].xoff) << 16, (y + psp->over[i].yoff) << 16,
psp->scale, ang,
picnum, overlay_shade, pal,
flags, x1, y1, x2, y2);
hud_drawsprite((x + psp->over[i].xoff), (y + psp->over[i].yoff), psp->scale, ang, picnum, overlay_shade, pal, flags);
}
}
}

View file

@ -79,7 +79,6 @@ struct PANEL_STATEstruct
#define PANF_INVISIBLE (BIT(9)) // turn invisible
#define PANF_DEATH_HIDE (BIT(10)) // hide done when dead
#define PANF_SCREEN_CLIP (BIT(12)) // maintain aspect to the screen
#define PANF_STATUS_AREA (BIT(13)) // maintain aspect to the screen
#define PANF_IGNORE_START_MOST (BIT(14)) // maintain aspect to the screen
#define PANF_XFLIP (BIT(15)) // xflip
#define PANF_SUICIDE (BIT(16)) // kill myself
@ -184,7 +183,6 @@ enum BorderTypes
#define SHOTGUN_AUTO 2078
PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, int x, int y);
PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp,short pic,short pri,int x,int y);
void pSetSuicide(PANEL_SPRITEp psp);
SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id);
void PreUpdatePanel(void);

View file

@ -128,6 +128,8 @@ void PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seco
id = ID_TEXT;
}
// Temporarily disabled because this uses a feature of the panel system that needs to be removed before this can be refactored.
#if 0
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
ac = c - '!' + STARTALPHANUM;
@ -145,6 +147,7 @@ void PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seco
else if (c == asc_Space)
offset += 4; // Special case for space char
}
#endif
}
void KillString(PLAYERp pp, short y)