Make votescreen backgrounds resolution and dup independant

also some slight cleanup
currently this scales vertically to fill out the screen vertically
not sure if horizontally would be preferred, but thatd most likely cut off alot of parts from some votebgs
This commit is contained in:
Alug committed 2025-05-14 02:09:32 +02:00
1 parent 0695806ee9
commit 0f0195d35b
3 files changed
+22 -15

No files matched your search

+8
View File
@@ -1562,6 +1562,14 @@ void V_DrawPatchFill(patch_t *pat)
}
}
// Draws a patch and scales it to fill out the screen vertically while remaining centered
void V_DrawCenteredScaledFullScreenPatch(patch_t *patch)
{
fixed_t scale = FixedDiv(vid.height << FRACBITS, patch->height << FRACBITS);
fixed_t x = ((vid.width << FRACBITS) - FixedMul(patch->width << FRACBITS, scale)) / 2; // i fucking hate maths
V_DrawFixedPatch(x, 0, scale, V_NOSCALEPATCH, patch, NULL);
}
void V_DrawVhsEffect(boolean rewind)
{
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
+1
View File
@@ -282,6 +282,7 @@ typedef struct player_s player_t;
void V_DoPostProcessor(INT32 view, INT32 param);
void V_DrawPatchFill(patch_t *pat);
void V_DrawCenteredScaledFullScreenPatch(patch_t *patch);
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
size_t destrowbytes);
+13 -15
View File
@@ -912,35 +912,35 @@ static void Y_UnloadData(void)
//
static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
{
patch_t *votebg = NULL;
char tempAnimPrefix[7];
widePatch ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix);
const INT32 tempFoundAnimVoteFrames = widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames;
strcpy(tempAnimPrefix, (widePatch ? animWidePrefix : animPrefix));
const INT32 tempFoundAnimVoteFrames = (widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames) - 1;
// Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0
if (currentAnimFrame > tempFoundAnimVoteFrames - 1)
if (currentAnimFrame > tempFoundAnimVoteFrames)
currentAnimFrame = 0;
patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (background->width/2), // Keep the width/height adjustments, for screens that are less wide than 320(?)
(vid.height / vid.dupy) - background->height,
V_SNAPTOTOP|V_SNAPTOLEFT, background);
votebg = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
if (renderisnewtic && votetic % 2 == 0 && !paused)
currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames - 1) ? 0 : currentAnimFrame + 1;
V_DrawCenteredScaledFullScreenPatch(votebg);
if (renderisnewtic && (votetic % 2 == 0) && !paused)
currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames) ? 0 : (currentAnimFrame + 1);
}
static void Y_DrawVoteScreenPatch(void)
{
patch_t *votebg = NULL;
const boolean widescreen = (vid.width / vid.dupx > 320);
const boolean animvote = (foundAnimVoteWideFrames || foundAnimVoteFrames);
if (animvote)
if (foundAnimVoteWideFrames || foundAnimVoteFrames)
{
Y_DrawAnimatedVoteScreenPatch((foundAnimVoteWideFrames && widescreen));
return;
}
patch_t *votebg = bgpatch; // non widescreen patch
votebg = bgpatch; // non widescreen patch
UINT8 prefgametype = (votelevels[0][1] & ~0x80);
const boolean widebgreplaced = (prefgametype == GT_MATCH) ? widebattlereplaced : wideracereplaced;
@@ -952,9 +952,7 @@ static void Y_DrawVoteScreenPatch(void)
votebg = widebgpatch;
}
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (votebg->width/2),
(vid.height / vid.dupy) - votebg->height,
V_SNAPTOTOP|V_SNAPTOLEFT, votebg);
V_DrawCenteredScaledFullScreenPatch(votebg);
}
//