even more tiny cleanup votebg stuff

This commit is contained in:
Alug committed 2025-05-16 14:22:16 +02:00
1 parent 5b6e7abd91
commit db4d9a330a
2 files changed
+11 -9

No files matched your search

+3 -6
View File
@@ -1565,10 +1565,8 @@ void V_DrawPatchFill(patch_t *pat)
// Draws a patch and tries to always fill the screen with the patch
void V_DrawAdaptiveScaledFullScreenPatch(patch_t *patch)
{
fixed_t x = 0, y = 0, scale = FRACUNIT;
scale = ((vid.width * FRACUNIT) / patch->width); // fit the screen horizontally
fixed_t x = 0, y = 0;
fixed_t scale = ((vid.width * FRACUNIT) / patch->width); // fit the screen horizontally
fixed_t scaled_height = FixedMul(patch->height << FRACBITS, scale);
// however, if this means the patch doesent fill out the screen vertically then
@@ -1588,6 +1586,7 @@ void V_DrawVerticallyScaledFullScreenPatch(patch_t *patch)
{
fixed_t scale = ((vid.height * FRACUNIT) / patch->height);
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);
}
@@ -1596,9 +1595,7 @@ void V_DrawVerticallyScaledFullScreenPatch(patch_t *patch)
void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
{
fixed_t scale = ((vid.width * FRACUNIT) / patch->width);
fixed_t scaled_height = FixedMul(patch->height << FRACBITS, scale);
fixed_t y = (vid.height << FRACBITS) - scaled_height;
// center it if it does not fit the screen vertically
+8 -3
View File
@@ -934,21 +934,25 @@ static void Y_DrawVoteBackground(patch_t *patch)
//
static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
{
INT32 nextframe = 0;
patch_t *votebg = NULL;
char tempAnimPrefix[7];
const INT32 tempFoundAnimVoteFrames = ((widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames) - 1);
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)
currentAnimFrame = 0;
votebg = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
nextframe = (currentAnimFrame + 1);
votebg = W_CachePatchName(va("%s%d", (widePatch ? animWidePrefix : animPrefix), nextframe), PU_PATCH);
Y_DrawVoteBackground(votebg);
if (renderisnewtic && (votetic % 2 == 0) && !paused)
currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames) ? 0 : (currentAnimFrame + 1);
currentAnimFrame = (nextframe > tempFoundAnimVoteFrames) ? 0 : nextframe;
}
static void Y_DrawVoteScreenPatch(void)
@@ -1027,6 +1031,7 @@ void Y_VoteDrawer(void)
}
y = (200-height)/2;
for (i = 0; i < 4; i++)
{
const char *str;