Uncap hardcode HUD #120

Merged
GenericHeroGuy merged 13 commits from hud-uncap into Saturn-Next 2024-03-21 22:40:46 +01:00
10 changed files with 169 additions and 173 deletions

No files matched your search

+13 -12
View File
@@ -166,30 +166,31 @@ static void F_SkyScroll(INT32 scrollspeed)
pat = W_CachePatchName("TITLEBG1", PU_CACHE);
pat2 = W_CachePatchName("TITLEBG2", PU_CACHE);
w = vid.width / vid.dupx;
w = (vid.width / vid.dupx)<<FRACBITS;
animtimer = ((finalecount*scrollspeed)/16) % SHORT(pat->width);
anim2 = SHORT(pat2->width) - (((finalecount*scrollspeed)/16) % SHORT(pat2->width));
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
// SRB2Kart: F_DrawPatchCol is over-engineered; recoded to be less shitty and error-prone
if (rendermode != render_none)
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 120);
x = -((INT32)animtimer);
x = -animtimer;
y = 0;
while (x < w)
{
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL);
x += SHORT(pat->width);
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL);
x += SHORT(pat->width)<<FRACBITS;
}
x = -anim2;
y = BASEVIDHEIGHT - SHORT(pat2->height);
y = (BASEVIDHEIGHT - SHORT(pat2->height))<<FRACBITS;
while (x < w)
{
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL);
x += SHORT(pat2->width);
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL);
x += SHORT(pat2->width)<<FRACBITS;
}
}
@@ -992,7 +993,7 @@ void F_TitleScreenDrawer(void)
if (finalecount >= 20)
V_DrawSmallScaledPatch(84, 87, 0, ttkart);
else if (finalecount >= 10)
V_DrawSciencePatch((84<<FRACBITS) - FixedDiv(180<<FRACBITS, 10<<FRACBITS)*(20-finalecount), (87<<FRACBITS), 0, ttkart, FRACUNIT/2);
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetHudUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
}
else if (finalecount < 52)
{
@@ -1008,8 +1009,8 @@ void F_TitleScreenDrawer(void)
F_SkyScroll(titlescrollspeed);
V_DrawSciencePatch(0, 0 - FixedMul(40<<FRACBITS, FixedDiv(finalecount%70, 70)), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + FixedMul(40<<FRACBITS, FixedDiv(finalecount%70, 70)), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
if (transval)
V_DrawFadeScreen(120, 10 - transval);
+112 -133
View File
@@ -22,6 +22,7 @@
#include "r_local.h"
#include "r_state.h"
#include "r_things.h"
#include "r_fps.h"
#include "s_sound.h"
#include "screen.h"
#include "st_stuff.h"
@@ -7570,6 +7571,10 @@ static void K_initKartHUD(void)
hudtrans = ((((INT32)timeinmap) - 105)*cv_translucenthud.value)/(113-105);
else
hudtrans = 0;
// K_GetScreenCoords needs the right view* variables
R_SetViewContext(stplyrnum);
R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT, !cv_uncappedhud.value);
}
INT32 K_calcSplitFlags(INT32 snapflags)
@@ -8950,15 +8955,16 @@ static void K_drawKartBumpersOrKarma(void)
}
}
#define lerp(from, to) cv_uncappedhud.value ? from + FixedMul(rendertimefrac, to - from) : to
// converts mobj coordinates into screen coordinates
// NOTE: use with V_NOSCALESTART!
// Code updated in Lua by GenericHeroGuy for libSG
// Badly ported to C by NepDisk and acutally made to work and fixed by Indev!(Thanks so much!)
// Badly uncapped in C by GenericHeroGuy
// original code by Lat'
static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, mobj_t *target, fixed_t hofs, boolean dontclip)
static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *target, fixed_t hofs, boolean dontclip)
{
fixed_t camx, camy, camz;
angle_t camangle, camaiming;
fixed_t distfact;
fixed_t dist;
fixed_t xres;
@@ -8971,43 +8977,21 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
fixed_t y;
fixed_t x;
// In case of early return we can check if those are negative
vec->x = -1;
vec->y = -1;
// this should never happen but its also kart so ¯\_(ツ)_/¯
if (!player || !target || !came)
return;
if (player->awayviewtics) {
camx = player->awayviewmobj->x;
camy = player->awayviewmobj->y;
camz = player->awayviewmobj->z;
camangle = player->awayviewmobj->angle;
camaiming = player->awayviewaiming;
}
else if (came->chase) {
camx = came->x;
camy = came->y;
camz = came->z + (player->mo->eflags & MFE_VERTICALFLIP && came->height);
camangle = came->angle;
camaiming = came->aiming;
}
else {
camx = player->mo->x;
camy = player->mo->y;
camz = player->viewz;
camangle = player->mo->angle;
camaiming = player->aiming;
}
if (!player || !target)
return false;
xres = vid.width<<(FRACBITS-1);
yres = vid.height<<(FRACBITS-1);
fov = FixedDiv(xres, FINETANGENT(((FixedAngle(cv_fov.value/2)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095));
fixed_t targx = lerp(target->old_x, target->x);
fixed_t targy = lerp(target->old_y, target->y);
fixed_t targz = lerp(target->old_z, target->z);
// X coordinate
// get difference between camangle and angle towards target
x = (INT32)camangle - (INT32)R_PointToAngle2(camx, camy, target->x, target->y);
x = (INT32)viewangle - (INT32)R_PointToAngle(targx, targy);
distfact = FINECOSINE((x>>ANGLETOFINESHIFT) & FINEMASK);
if (!distfact) distfact = 1;
@@ -9015,7 +8999,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
if (encoremode)
x = -x;
if (x < (fixed_t)ANGLE_270 || x > (fixed_t)ANGLE_90)
return;
return false;
// flipping
targflip = target->eflags & MFE_VERTICALFLIP;
@@ -9024,12 +9008,12 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
// Y coordinate
// getting the angle difference here is a bit more involved...
// start by getting the height difference between the camera and target
y = camz - target->z - (targflip ? target->height/1.5 : 0); // for some reason needs to be divided by 1.5 idk
y = viewz - targz - (targflip ? target->height/1.5 : 0); // for some reason needs to be divided by 1.5 idk
if (hofs)
y = y - (targflip ? -hofs : hofs);
// then get the distance between camera and target
dist = R_PointToDist2(camx, camy, target->x, target->y);
dist = R_PointToDist(targx, targy);
#ifdef HWRENDER
// NOW we can get the angle differnce
@@ -9037,10 +9021,10 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
{
angle_t yang = R_PointToAngle2(0, 0, dist, y); // not perspective
x = FixedMul(x, FINECOSINE((yang>>ANGLETOFINESHIFT) & FINEMASK)); // perspective
y = -camaiming - FixedDiv(yang, distfact);
y = -aimingangle - FixedDiv(yang, distfact);
if (y < (fixed_t)ANGLE_270 || y > (fixed_t)ANGLE_90) // clip points behind the camera
return;
return false;
if (splitscreen == 1) // multiply by 1.25 for 2P splitscreen
y = y + (y/4) ;
if (srcflip) // flipcam
@@ -9060,7 +9044,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
y = FixedMul(FixedDiv(y, fovratio), xres) + yres;
//else print("NOPE!")
offset = FixedMul(FINETANGENT(((camaiming+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres);
offset = FixedMul(FINETANGENT(((aimingangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres);
// this isn't fovtan... what am i even doing anymore
if (splitscreen == 1)
offset = 17*offset/10;
@@ -9084,7 +9068,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
// now clip in screen-space
if (!dontclip && (x < 0 || x > xres*2 || y < 0 || y > yres*2))
return;
return false;
// get splitscreen index
int splitindex = stplyrnum;
@@ -9106,6 +9090,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came,
vec->y = y;
vec->x = x;
return true;
}
//Slighty fixed by Alug and further rewritten by NepDisk
@@ -9128,7 +9113,7 @@ static void K_drawNameTags(void)
INT32 hudtransflag = V_LocalTransFlag();
boolean flipcam;
if (!stplyr->mo || (stplyr->spectator && !cv_shownametagspectator.value) || splitscreen || (stplyr->exiting && !cv_shownametagfinish.value))
if (!stplyr->mo || (stplyr->spectator && !cv_shownametagspectator.value) || (stplyr->exiting && !cv_shownametagfinish.value))
return;
// True if currently viewed player is flipped and has flipcam on
@@ -9146,9 +9131,9 @@ static void K_drawNameTags(void)
continue;
if (!players[i].mo || P_MobjWasRemoved(players[i].mo) || players[i].spectator || !playeringame[i])
continue;
if (i == displayplayers[0] && !cv_showownnametag.value && !(leveltime < 130))
if (i == stplyrnum && !cv_showownnametag.value && !(leveltime < 130))
continue;
if (!(i == displayplayers[0]) && leveltime < starttime)
if (i != stplyrnum && leveltime < starttime)
continue;
if (players[i].kartstuff[k_hyudorotimer]) // player is invisible
continue;
@@ -9207,12 +9192,9 @@ static void K_drawNameTags(void)
//Saltyhop hehe
if (cv_saltyhop.value && cv_nametaghop.value)
z += players[i].mo->spriteyoffset;
z += lerp(players[i].mo->old_spriteyoffset, players[i].mo->spriteyoffset);
K_GetScreenCoords(&pos, stplyr, camera, players[i].mo, z, false);
//Check for negative screencoords
if (pos.x == -1 || pos.y == -1)
if (!K_GetScreenCoords(&pos, stplyr, players[i].mo, z, false))
continue;
tagsdisplayed += 1;
@@ -9348,7 +9330,7 @@ static void K_drawDriftGauge(void)
INT32 drifttrans = 0;
INT32 hudtransflag = V_LocalTransFlag();
int dup = vid.dupx;
int i,j;
int i;
UINT8 driftcolors[3][4] = {
{0, 0, 10, 16}, // no drift
@@ -9369,17 +9351,7 @@ static void K_drawDriftGauge(void)
if (!stplyr->mo || !stplyr->kartstuff[k_drift] || (!splitscreen && !camera->chase))
return;
if (!splitscreen)
K_GetScreenCoords(&pos, stplyr, camera, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false);
else
{
//Loop through each player camera for splitscreen.
for (j = 0; j <= stplyrnum; j++)
K_GetScreenCoords(&pos, stplyr, &camera[j], stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false);
}
//Check for negative screencoords
if (pos.x == -1 || pos.y == -1)
if (!K_GetScreenCoords(&pos, stplyr, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false))
return;
basex = pos.x>>FRACBITS;
@@ -9683,8 +9655,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
yscale = FixedDiv(AutomapPic->height, mapheight);
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
amnumxpos = (FixedMul(mo->x, zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(mo->y, zoom) - FixedMul(yoffset, zoom));
amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), zoom) - FixedMul(yoffset, zoom));
if (encoremode)
amnumxpos = -amnumxpos;
@@ -9724,6 +9696,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
}
}
#undef lerp
static void K_drawKartMinimap(void)
{
INT32 lumpnum;
@@ -9899,7 +9873,7 @@ static void K_drawKartFinish(void)
x = ((vid.width<<FRACBITS)/vid.dupx);
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
x = ((TICRATE - stplyr->kartstuff[k_cardanimation])*(xval > x ? xval : x))/TICRATE;
x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])<<FRACBITS) - R_GetHudUncap(), xval > x ? xval : x))/TICRATE;
if (splitscreen && stplyr == &players[displayplayers[1]])
x = -x;
@@ -9913,8 +9887,20 @@ static void K_drawKartFinish(void)
static void K_drawBattleFullscreen(void)
{
INT32 cardanim = stplyr->kartstuff[k_cardanimation] << FRACBITS;
// fill in the fractional bits
if (cardanim && cardanim != 164*FRACUNIT)
{
INT32 frac = R_GetHudUncap() * ((164 - stplyr->kartstuff[k_cardanimation])/8 + 1);
if (stplyr->exiting)
cardanim += frac;
else
cardanim += stplyr->kartstuff[k_comebacktimer] < 6*TICRATE ? -frac : frac;
}
INT32 x = BASEVIDWIDTH/2;
INT32 y = -64+(stplyr->kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen
INT32 y = (-64*FRACUNIT) + cardanim; // card animation goes from 0 to 164, 164 is the middle of the screen
INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead
fixed_t scale = FRACUNIT;
boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run.
@@ -9924,22 +9910,19 @@ static void K_drawBattleFullscreen(void)
if (splitscreen)
{
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))))
if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2))
{
y = 232-(stplyr->kartstuff[k_cardanimation]/2);
y = (232*FRACUNIT) - (cardanim/2);
splitflags = V_SNAPTOBOTTOM;
}
else
y = -32+(stplyr->kartstuff[k_cardanimation]/2);
y = (-32*FRACUNIT) + (cardanim/2);
if (splitscreen > 1)
{
scale /= 2;
if (stplyr == &players[displayplayers[1]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
if (stplyrnum & 1)
x = 3*BASEVIDWIDTH/4;
else
x = BASEVIDWIDTH/4;
@@ -9948,7 +9931,7 @@ static void K_drawBattleFullscreen(void)
{
if (stplyr->exiting)
{
if (stplyr == &players[displayplayers[1]])
if (stplyrnum == 1)
x = BASEVIDWIDTH-96;
else
x = 96;
@@ -9960,14 +9943,14 @@ static void K_drawBattleFullscreen(void)
if (stplyr->exiting)
{
if (stplyr == &players[displayplayers[0]])
if (stplyrnum == 0)
V_DrawFadeScreen(0xFF00, 16);
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{
if (stplyr->kartstuff[k_position] == 1)
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
V_DrawFixedPatch(x<<FRACBITS, y, scale, splitflags, kp_battlewin, NULL);
else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL);
V_DrawFixedPatch(x<<FRACBITS, y, scale, splitflags, (K_IsPlayerLosing(stplyr) ? kp_battlelose : kp_battlecool), NULL);
}
else
K_drawKartFinish();
@@ -9990,18 +9973,16 @@ static void K_drawBattleFullscreen(void)
{
if (splitscreen > 1)
ty = (BASEVIDHEIGHT/4)+33;
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2))
ty += (BASEVIDHEIGHT/2);
}
else
V_DrawFadeScreen(0xFF00, 16);
if (!comebackshowninfo)
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battleinfo, NULL);
V_DrawFixedPatch(x<<FRACBITS, y, scale, splitflags, kp_battleinfo, NULL);
else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewait, NULL);
V_DrawFixedPatch(x<<FRACBITS, y, scale, splitflags, kp_battlewait, NULL);
if (splitscreen > 1)
V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
@@ -10197,7 +10178,8 @@ static void K_drawInput(void)
static INT32 pn = 0;
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS);
INT32 x = BASEVIDWIDTH - 32 + cv_posi_xoffset.value, y = BASEVIDHEIGHT-24 + cv_posi_yoffset.value, offs, col;
INT32 x = (BASEVIDWIDTH - 32 + cv_posi_xoffset.value)*FRACUNIT, y = (BASEVIDHEIGHT - 24 + cv_posi_yoffset.value)*FRACUNIT;
INT32 offs, col;
const INT32 accent1 = splitflags|colortranslations[K_GetHudColor()][5];
const INT32 accent2 = splitflags|colortranslations[K_GetHudColor()][9];
ticcmd_t *cmd = &stplyr->cmd;
@@ -10208,10 +10190,12 @@ static void K_drawInput(void)
if (timeinmap < 113)
{
INT32 count = ((INT32)(timeinmap) - 105);
offs = 64;
INT32 frac = count > 0 && count < 6 ? R_GetHudUncap() << (FRACBITS - count - 11) : 0;
offs = 64*FRACUNIT;
while (count-- > 0)
offs >>= 1;
x += offs;
x += (offs < FRACUNIT ? 0 : offs) - frac;
}
#define BUTTW 8
@@ -10220,17 +10204,17 @@ static void K_drawInput(void)
#define drawbutt(xoffs, butt, symb)\
if (stplyr->cmd.buttons & butt)\
{\
offs = 2;\
offs = 2*FRACUNIT;\
col = accent1;\
}\
else\
{\
offs = 0;\
col = accent2;\
V_DrawFill(x+(xoffs), y+BUTTH, BUTTW-1, 2, splitflags|31);\
V_DrawFill((x + xoffs*FRACUNIT)>>FRACBITS, (y + BUTTH*FRACUNIT)>>FRACBITS, BUTTW-1, 2, splitflags|31);\
}\
V_DrawFill(x+(xoffs), y+offs, BUTTW-1, BUTTH, col);\
V_DrawFixedPatch((x+1+(xoffs))<<FRACBITS, (y+offs+1)<<FRACBITS, FRACUNIT, splitflags, tny_font[symb-HU_FONTSTART], NULL)
V_DrawFill((x + xoffs*FRACUNIT)>>FRACBITS, (y+offs)>>FRACBITS, BUTTW-1, BUTTH, col);\
V_DrawFixedPatch(x + FRACUNIT + xoffs*FRACUNIT, y + offs + FRACUNIT, FRACUNIT, splitflags, tny_font[symb-HU_FONTSTART], NULL)
drawbutt(-2*BUTTW, BT_ACCELERATE, 'A');
drawbutt( -BUTTW, BT_BRAKE, 'B');
@@ -10242,7 +10226,7 @@ static void K_drawInput(void)
#undef BUTTW
#undef BUTTH
y -= 1;
y -= FRACUNIT;
if (!cmd->driftturn) // no turn
target = 0;
@@ -10268,7 +10252,7 @@ static void K_drawInput(void)
if (pn < 0)
{
splitflags |= V_FLIP; // right turn
x--;
x -= FRACUNIT;
}
target = abs(pn);
@@ -10276,12 +10260,12 @@ static void K_drawInput(void)
target = 4;
if (!K_GetHudColor())
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, splitflags, kp_inputwheel[target], NULL);
V_DrawFixedPatch(x, y, FRACUNIT, splitflags, kp_inputwheel[target], NULL);
else
{
UINT8 *colormap;
colormap = R_GetTranslationColormap(0, K_GetHudColor(), GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, splitflags, kp_inputwheel[target], colormap);
V_DrawFixedPatch(x, y, FRACUNIT, splitflags, kp_inputwheel[target], colormap);
}
}
@@ -10306,57 +10290,50 @@ static void K_drawLapStartAnim(void)
// This is an EVEN MORE insanely complicated animation.
const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation];
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE);
INT32 vflags = V_SNAPTOTOP|V_HUDTRANS;
V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT,
(48 - (32*max(0, progress-76)))*FRACUNIT,
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
(modeattacking ? kp_lapanim_emblem[1] : kp_lapanim_emblem[0]), colormap);
fixed_t slideout = max(0, 32*(((progress - 76)*FRACUNIT) + R_GetHudUncap()));
fixed_t slidein = max(0, 32*(((stplyr->kartstuff[k_lapanimation] - 76)*FRACUNIT) - R_GetHudUncap()));
if (stplyr->kartstuff[k_laphand] >= 1 && stplyr->kartstuff[k_laphand] <= 3)
// First, draw the emblem and hand
INT32 emblemx = (BASEVIDWIDTH << (FRACBITS - 1)) + slidein;
INT32 y = 48*FRACUNIT - slideout;
V_DrawFixedPatch(emblemx, y, FRACUNIT, vflags, kp_lapanim_emblem[modeattacking ? 1 : 0], colormap);
INT32 hand = stplyr->kartstuff[k_laphand];
if (hand >= 1 && hand <= 3)
{
V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT,
(48 - (32*max(0, progress-76))
+ 4 - abs((signed)((leveltime % 8) - 4)))*FRACUNIT,
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_hand[stplyr->kartstuff[k_laphand]-1], NULL);
y += 4*FRACUNIT - abs((int)(leveltime % 8)*FRACUNIT + R_GetHudUncap() - 4*FRACUNIT);
V_DrawFixedPatch(emblemx, y, FRACUNIT, vflags, kp_lapanim_hand[hand - 1], NULL);
}
// Then the text
INT32 leftx = 82*FRACUNIT - slideout;
INT32 rightx = 188*FRACUNIT + slideout;
y = 30*FRACUNIT;
if (stplyr->laps == (UINT8)(cv_numlaps.value - 1))
{
V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27
30*FRACUNIT, // 24
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_final[min(progress/2, 10)], NULL);
// FINAL
V_DrawFixedPatch(leftx - 20*FRACUNIT, y, FRACUNIT, vflags, kp_lapanim_final[min(progress/2, 10)], NULL);
if (progress/2-12 >= 0)
{
V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194
30*FRACUNIT, // 24
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_lap[min(progress/2-12, 6)], NULL);
}
// LAP
if (progress/2 - 12 >= 0)
V_DrawFixedPatch(rightx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2 - 12, 6)], NULL);
}
else
{
V_DrawFixedPatch((82 - (32*max(0, progress-76)))*FRACUNIT, // 61
30*FRACUNIT, // 24
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_lap[min(progress/2, 6)], NULL);
// LAP
V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL);
if (progress/2-8 >= 0)
char *lapnum = va("%02d", stplyr->laps + 1);
for (int i = 0; i < (int)strlen(lapnum); i++)
{
V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194
30*FRACUNIT, // 24
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)], NULL);
if (progress/2-10 >= 0)
{
V_DrawFixedPatch((208 + (32*max(0, progress-76)))*FRACUNIT, // 221
30*FRACUNIT, // 24
FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)], NULL);
}
int digit = lapnum[i] - '0';
int frame = min(2, progress/2 - 8 - (i*2));
if (frame >= 0)
V_DrawFixedPatch(rightx + (i*20*FRACUNIT), y, FRACUNIT, vflags, kp_lapanim_number[digit][frame], NULL);
}
}
}
@@ -10594,7 +10571,7 @@ void K_drawKartHUD(void)
if (demo.title) // Draw title logo instead in demo.titles
{
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
INT32 x = (BASEVIDWIDTH - 32)*FRACUNIT, y = 128*FRACUNIT, offs;
if (splitscreen == 3)
{
@@ -10605,14 +10582,16 @@ void K_drawKartHUD(void)
if (timeinmap < 113)
{
INT32 count = ((INT32)(timeinmap) - 104);
offs = 256;
INT32 frac = count > 0 ? R_GetHudUncap() << max(0, FRACBITS - count - 9) : 0;
offs = 256*FRACUNIT;
while (count-- > 0)
offs >>= 1;
x += offs;
x += offs - frac;
}
V_DrawTinyScaledPatch(x-54, y, 0, W_CachePatchName("TTKBANNR", PU_CACHE));
V_DrawTinyScaledPatch(x-54, y+25, 0, W_CachePatchName("TTKART", PU_CACHE));
V_DrawSciencePatch(x - (54*FRACUNIT), y, 0, W_CachePatchName("TTKBANNR", PU_CACHE), FRACUNIT/4);
V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), 0, W_CachePatchName("TTKART", PU_CACHE), FRACUNIT/4);
}
else if (G_RaceGametype()) // Race-only elements
{
+4 -2
View File
@@ -2004,6 +2004,8 @@ static menuitem_t OP_SaturnMenu[] =
{IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 90},
{IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 95},
{IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 105},
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 115},
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125},
@@ -2031,7 +2033,7 @@ static const char* OP_SaturnTooltips[] =
"Show Localskin Menus.",
"Nametag Options.",
"Driftgauge Options.",
"Use your native Keyboard Layout.",
"Uncaps the HUD framerate, making it appear smoother.",
"Disables the flicker effect on Midnight Channel.",
"Options for sprite distortion effects.",
"Move position of HUD elements.",
@@ -2057,7 +2059,7 @@ enum
sm_showlocalskin,
sm_nametagmen,
sm_driftgaugemen,
sm_nativkey,
sm_uncappedhud,
sm_pisschannel,
sm_distortionmenu,
sm_hudoffsets,
+2 -2
View File
@@ -146,7 +146,7 @@ static void R_SetupFreelook(void)
#undef AIMINGTODY
void R_InterpolateView(fixed_t frac)
void R_InterpolateView(fixed_t frac, boolean forceinvalid)
{
viewvars_t* prevview = oldview;
UINT8 i;
@@ -165,7 +165,7 @@ void R_InterpolateView(fixed_t frac)
i = viewcontext - VIEWCONTEXT_PLAYER1;
}
if (oldview_invalid[i] != 0)
if (oldview_invalid[i] != 0 || forceinvalid)
{
// interpolate from newview to newview
prevview = newview;
+1 -1
View File
@@ -118,7 +118,7 @@ typedef struct levelinterpolator_s {
} levelinterpolator_t;
// Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext
void R_InterpolateView(fixed_t frac);
void R_InterpolateView(fixed_t frac, boolean forceinvalid);
// Buffer the current new views into the old views. Call once after each real tic.
void R_UpdateViewInterpolation(void);
// Reset the view states (e.g. after level load) so R_InterpolateView doesn't interpolate invalid data
+9 -2
View File
@@ -196,6 +196,7 @@ consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NUL
consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_uncappedhud = {"uncappedhud", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -512,6 +513,11 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y)
return R_PointToDist2(viewx, viewy, x, y);
}
INT32 R_GetHudUncap(void)
{
return cv_uncappedhud.value ? rendertimefrac & FRACMASK : 0;
}
//
// R_ScaleFromGlobalAngle
// Returns the texture mapping scale for the current line (horizontal span)
@@ -1340,7 +1346,7 @@ void R_SkyboxFrame(player_t *player)
// newview->sin = FINESINE(viewangle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT, false);
}
void R_SetupFrame(player_t *player, boolean skybox)
@@ -1489,7 +1495,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
// newview->sin = FINESINE(viewangle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT, false);
}
#define ANGLED_PORTALS
@@ -1862,6 +1868,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);
CV_RegisterVar(&cv_uncappedhud);
CV_RegisterVar(&cv_maxportals);
+4 -1
View File
@@ -106,7 +106,7 @@ extern ps_metric_t ps_numpolyobjects;
// REFRESH - the actual rendering functions.
//
extern consvar_t cv_showhud, cv_translucenthud;
extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
extern consvar_t cv_homremoval;
extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4;
extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4;
@@ -140,4 +140,7 @@ void R_RenderPlayerView(player_t *player);
// add commands related to engine, at game startup
void R_RegisterEngineStuff(void);
// return multiplier for HUD uncap
INT32 R_GetHudUncap(void);
#endif
+6 -1
View File
@@ -738,10 +738,15 @@ static void ST_drawLevelTitle(void)
if (timeinmap > 105)
{
INT32 count = (113 - (INT32)(timeinmap));
// uh... "fill in the bits" of sub, or something... no idea what I came up with
// VERY janky, but doesn't require m_easing
INT32 frac = (FixedMul(R_GetHudUncap(), FixedDiv(dupcalc, BASEVIDWIDTH)) >> (count + 4))/13; // these two magic numbers seem to do the trick
sub = dupcalc;
while (count-- > 0)
sub >>= 1;
sub = -sub;
sub = -sub - frac;
}
{
+15 -13
View File
@@ -18,6 +18,8 @@
#include "v_video.h"
#include "hu_stuff.h"
#include "r_draw.h"
#include "r_main.h"
#include "r_fps.h"
#include "console.h"
#include "i_video.h" // rendermode
@@ -1391,7 +1393,7 @@ void V_DrawPatchFill(patch_t *pat)
void V_DrawVhsEffect(boolean rewind)
{
static fixed_t upbary = 100, downbary = 150;
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
UINT8 *buf = screens[0], *tmp = screens[4];
UINT16 y;
@@ -1411,19 +1413,19 @@ void V_DrawVhsEffect(boolean rewind)
if (rewind)
V_DrawVhsEffect(false); // experimentation
if (renderisnewtic)
{
upbary -= (vid.dupy * (rewind ? 3 : 1.8f));
downbary += (vid.dupy * (rewind ? 2 : 1));
}
fixed_t frac = R_UsingFrameInterpolation() ? renderdeltatics : FRACUNIT;
upbary -= frac * (vid.dupy * (rewind ? 3 : 1.8f));
downbary += frac * (vid.dupy * (rewind ? 2 : 1));
if (upbary < -barsize) upbary = vid.height;
if (downbary > vid.height) downbary = -barsize;
if (upbary < -barsize*FRACUNIT) upbary = vid.height<<FRACBITS;
if (downbary > vid.height<<FRACBITS) downbary = -barsize*FRACUNIT;
fixed_t uby = upbary>>FRACBITS, dby = downbary>>FRACBITS;
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize);
return;
}
#endif
@@ -1433,15 +1435,15 @@ void V_DrawVhsEffect(boolean rewind)
thismapstart = normalmapstart;
offs = 0;
if (y >= upbary && y < upbary+barsize)
if (y >= uby && y < uby+barsize)
{
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs += updistort * 2.0f * min(y-upbary, upbary+barsize-y) / barsize;
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
}
if (y >= downbary && y < downbary+barsize)
if (y >= dby && y < dby+barsize)
{
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
offs -= downdistort * 2.0f * min(y-downbary, downbary+barsize-y) / barsize;
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
}
offs += M_RandomKey(vid.dupx<<1);
+3 -6
View File
@@ -429,16 +429,14 @@ void Y_IntermissionDrawer(void)
else
hilicol = ((intertype == int_race) ? V_SKYMAP : V_REDMAP);
if (sorttic != -1 && intertic > sorttic && !demo.playback)
if (sorttic != -1 && intertic >= sorttic && !demo.playback)
{
INT32 count = (intertic - sorttic);
if (count < 8)
x -= ((count * vid.width) / (8 * vid.dupx));
else if (count == 8)
goto dotimer;
x -= ((((count<<FRACBITS) + R_GetHudUncap()) * vid.width)>>FRACBITS) / (8 * vid.dupx);
else if (count < 16)
x += (((16 - count) * vid.width) / (8 * vid.dupx));
x += (((((16 - count)<<FRACBITS) - R_GetHudUncap()) * vid.width)>>FRACBITS) / (8 * vid.dupx);
}
// SRB2kart 290117 - compeltely replaced this block.
@@ -632,7 +630,6 @@ void Y_IntermissionDrawer(void)
}
}
dotimer:
if (timer)
{
char *string;