make votebg scaling behaviour changable
This commit is contained in:
1 parent
06124deab9
commit
efcd8dacfe
5 files changed
+64
-30
No files matched your search
@@ -65,6 +65,9 @@ consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL,
|
||||
consvar_t cv_vhseffect = {"vhspause", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittyscreen_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t votescale_cons_t[] = {{0, "Vanilla"}, {1, "Adaptive"}, {1, "VerticalFill"}, {1, "HorizontalFill"}, {0, NULL}};
|
||||
consvar_t cv_votebgscaling = {"votebgscaling", "Adaptive", CV_SAVE, votescale_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void Highreshudscale_OnChange(void);
|
||||
static CV_PossibleValue_t highreshudscale_cons_t[] = {{4*FRACUNIT/5, "MIN"}, {4*FRACUNIT/3, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_highreshudscale = {"highreshudscale", "1", CV_SAVE|CV_FLOAT|CV_CALL|CV_NOINIT|CV_NOSHOWHELP, highreshudscale_cons_t, Highreshudscale_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -216,6 +219,8 @@ void SCR_Startup(void)
|
||||
CV_RegisterVar(&cv_bsaturation);
|
||||
CV_RegisterVar(&cv_msaturation);
|
||||
|
||||
CV_RegisterVar(&cv_votebgscaling);
|
||||
|
||||
V_SetPalette(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,8 @@ extern consvar_t cv_timescale;
|
||||
|
||||
extern consvar_t cv_alwaysgrabmouse;
|
||||
|
||||
extern consvar_t cv_votebgscaling;
|
||||
|
||||
// quick fix for tall/short skies, depending on bytesperpixel
|
||||
extern void (*walldrawerfunc)(void);
|
||||
|
||||
|
||||
+29
-27
@@ -1562,38 +1562,13 @@ 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_DrawCenteredScaledFullScreenPatch(patch_t *patch)
|
||||
{
|
||||
fixed_t scale = FixedDiv(vid.width << FRACBITS, patch->width << FRACBITS);
|
||||
|
||||
fixed_t scaled_height = FixedMul(patch->height << FRACBITS, scale);
|
||||
|
||||
fixed_t y = (vid.height << FRACBITS) - scaled_height;
|
||||
|
||||
if (scaled_height < (vid.height << FRACBITS))
|
||||
{
|
||||
y /= 2;
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(0, y, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}*/
|
||||
|
||||
void V_DrawCenteredScaledFullScreenPatch(patch_t *patch)
|
||||
// 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 = FixedDiv(vid.width << FRACBITS, patch->width << FRACBITS); // fit the screen horizontally
|
||||
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
|
||||
@@ -1608,6 +1583,33 @@ void V_DrawCenteredScaledFullScreenPatch(patch_t *patch)
|
||||
V_DrawFixedPatch(x, y, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}
|
||||
|
||||
// Draws a patch and scales it to fill out the screen vertically while remaining centered
|
||||
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);
|
||||
}
|
||||
|
||||
// Draws a patch and scales it to fill out the screen horizontally
|
||||
// centers the patch when its too small to fit the screen vertically
|
||||
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
|
||||
if (scaled_height < (vid.height << FRACBITS))
|
||||
{
|
||||
y /= 2;
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(0, y, scale, V_NOSCALEPATCH, patch, NULL);
|
||||
}
|
||||
|
||||
void V_DrawVhsEffect(boolean rewind)
|
||||
{
|
||||
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
||||
|
||||
+4
-1
@@ -282,7 +282,10 @@ 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 V_DrawAdaptiveScaledFullScreenPatch(patch_t *patch);
|
||||
void V_DrawVerticallyScaledFullScreenPatch(patch_t *patch);
|
||||
void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch);
|
||||
|
||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes);
|
||||
|
||||
+24
-2
@@ -906,6 +906,28 @@ static void Y_UnloadData(void)
|
||||
|
||||
// SRB2Kart: Voting!
|
||||
|
||||
static void Y_DrawVoteBackground(patch_t *patch)
|
||||
{
|
||||
switch (cv_votebgscaling.value)
|
||||
{
|
||||
case 1: // adaptive
|
||||
V_DrawAdaptiveScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 2: // vertical-fill
|
||||
V_DrawVerticallyScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 3: // horizontal-fill
|
||||
V_DrawHorizontallyScaledFullScreenPatch(patch);
|
||||
break;
|
||||
case 0: // vanilla
|
||||
default:
|
||||
V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (patch->width/2),
|
||||
(vid.height / vid.dupy) - patch->height,
|
||||
V_SNAPTOTOP|V_SNAPTOLEFT, patch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Y_DrawAnimatedVoteScreenPatch
|
||||
//
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
@@ -923,7 +945,7 @@ static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
|
||||
|
||||
votebg = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_PATCH);
|
||||
|
||||
V_DrawCenteredScaledFullScreenPatch(votebg);
|
||||
Y_DrawVoteBackground(votebg);
|
||||
|
||||
if (renderisnewtic && (votetic % 2 == 0) && !paused)
|
||||
currentAnimFrame = (currentAnimFrame + 1 > tempFoundAnimVoteFrames) ? 0 : (currentAnimFrame + 1);
|
||||
@@ -952,7 +974,7 @@ static void Y_DrawVoteScreenPatch(void)
|
||||
votebg = widebgpatch;
|
||||
}
|
||||
|
||||
V_DrawCenteredScaledFullScreenPatch(votebg);
|
||||
Y_DrawVoteBackground(votebg);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user