mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 12:13:16 +00:00
Seperate FINISH text from khud_cardanimation
- Fixes an issue where the card animation and the FINISH animation operating on two different timers, but using the same variable, would intefere with each other - Also makes khud_fault use the same drawer, so it can benefit from interpolation
This commit is contained in:
parent
c8471c7c27
commit
c2ef5a32e9
4 changed files with 85 additions and 87 deletions
|
|
@ -237,7 +237,8 @@ typedef enum
|
|||
khud_lapanimation, // Used to show the lap start wing logo animation
|
||||
khud_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down:
|
||||
|
||||
// Start
|
||||
// Big text
|
||||
khud_finish, // Set when completing a round
|
||||
khud_fault, // Set when faulting during the starting countdown
|
||||
|
||||
// Camera
|
||||
|
|
|
|||
14
src/g_game.c
14
src/g_game.c
|
|
@ -2223,6 +2223,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
|
||||
INT32 starpostnum;
|
||||
INT32 exiting;
|
||||
INT32 khudfinish;
|
||||
INT32 khudcardanimation;
|
||||
INT16 totalring;
|
||||
UINT8 laps;
|
||||
|
|
@ -2317,6 +2318,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
totalring = 0;
|
||||
roundscore = 0;
|
||||
exiting = 0;
|
||||
khudfinish = 0;
|
||||
khudcardanimation = 0;
|
||||
starpostnum = 0;
|
||||
xtralife = 0;
|
||||
|
|
@ -2360,7 +2362,16 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
roundscore = players[player].roundscore;
|
||||
|
||||
exiting = players[player].exiting;
|
||||
khudcardanimation = (exiting > 0) ? players[player].karthud[khud_cardanimation] : 0;
|
||||
if (exiting > 0)
|
||||
{
|
||||
khudfinish = players[player].karthud[khud_finish];
|
||||
khudcardanimation = players[player].karthud[khud_cardanimation];
|
||||
}
|
||||
else
|
||||
{
|
||||
khudfinish = 0;
|
||||
khudcardanimation = 0;
|
||||
}
|
||||
|
||||
starpostnum = players[player].starpostnum;
|
||||
|
||||
|
|
@ -2405,6 +2416,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
|
||||
p->starpostnum = starpostnum;
|
||||
p->exiting = exiting;
|
||||
p->karthud[khud_finish] = khudfinish;
|
||||
p->karthud[khud_cardanimation] = khudcardanimation;
|
||||
|
||||
p->laps = laps;
|
||||
|
|
|
|||
133
src/k_hud.c
133
src/k_hud.c
|
|
@ -3583,6 +3583,60 @@ static void K_drawKartMinimap(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void K_drawKartFinish(boolean finish)
|
||||
{
|
||||
INT32 timer, minsplitstationary, pnum = 0, splitflags = V_SPLITSCREEN;
|
||||
patch_t **kptodraw;
|
||||
|
||||
if (finish)
|
||||
{
|
||||
timer = stplyr->karthud[khud_finish];
|
||||
kptodraw = kp_racefinish;
|
||||
minsplitstationary = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
timer = stplyr->karthud[khud_fault];
|
||||
kptodraw = kp_racefault;
|
||||
minsplitstationary = 1;
|
||||
}
|
||||
|
||||
if (!timer || timer > 2*TICRATE)
|
||||
return;
|
||||
|
||||
if ((timer % (2*5)) / 5) // blink
|
||||
pnum = 1;
|
||||
|
||||
if (r_splitscreen > 0)
|
||||
pnum += (r_splitscreen > 1) ? 2 : 4;
|
||||
|
||||
if (r_splitscreen >= minsplitstationary) // 3/4p, stationary FIN
|
||||
{
|
||||
V_DrawScaledPatch(STCD_X - (SHORT(kptodraw[pnum]->width)/2), STCD_Y - (SHORT(kptodraw[pnum]->height)/2), splitflags, kptodraw[pnum]);
|
||||
return;
|
||||
}
|
||||
|
||||
//else -- 1/2p, scrolling FINISH
|
||||
{
|
||||
INT32 x, xval, ox, interpx;
|
||||
|
||||
x = ((vid.width<<FRACBITS)/vid.dupx);
|
||||
xval = (SHORT(kptodraw[pnum]->width)<<FRACBITS);
|
||||
x = ((TICRATE - timer)*(xval > x ? xval : x))/TICRATE;
|
||||
ox = ((TICRATE - (timer - 1))*(xval > x ? xval : x))/TICRATE;
|
||||
|
||||
interpx = R_InterpolateFixed(ox, x);
|
||||
|
||||
if (r_splitscreen && stplyr == &players[displayplayers[1]])
|
||||
interpx = -interpx;
|
||||
|
||||
V_DrawFixedPatch(interpx + (STCD_X<<FRACBITS) - (xval>>1),
|
||||
(STCD_Y<<FRACBITS) - (SHORT(kptodraw[pnum]->height)<<(FRACBITS-1)),
|
||||
FRACUNIT,
|
||||
splitflags, kptodraw[pnum], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void K_drawKartStartBulbs(void)
|
||||
{
|
||||
const UINT8 start_animation[14] = {
|
||||
|
|
@ -3747,35 +3801,7 @@ static void K_drawKartStartCountdown(void)
|
|||
|
||||
if (stplyr->karthud[khud_fault] != 0)
|
||||
{
|
||||
INT32 x, xval;
|
||||
|
||||
if (r_splitscreen > 1) // 3/4p, stationary FIN
|
||||
{
|
||||
pnum += 2;
|
||||
}
|
||||
else if (r_splitscreen == 1) // wide splitscreen
|
||||
{
|
||||
pnum += 4;
|
||||
}
|
||||
|
||||
if ((leveltime % (2*5)) / 5) // blink
|
||||
pnum += 1;
|
||||
|
||||
if (r_splitscreen == 0)
|
||||
{
|
||||
x = ((vid.width<<FRACBITS)/vid.dupx);
|
||||
xval = (SHORT(kp_racefault[pnum]->width)<<FRACBITS);
|
||||
x = ((TICRATE - stplyr->karthud[khud_fault])*(xval > x ? xval : x))/TICRATE;
|
||||
|
||||
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
|
||||
(STCD_Y<<FRACBITS) - (SHORT(kp_racefault[pnum]->height)<<(FRACBITS-1)),
|
||||
FRACUNIT,
|
||||
V_SPLITSCREEN, kp_racefault[pnum], NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), V_SPLITSCREEN, kp_racefault[pnum]);
|
||||
}
|
||||
K_drawKartFinish(false);
|
||||
}
|
||||
else if (leveltime >= introtime && leveltime < starttime-(3*TICRATE))
|
||||
{
|
||||
|
|
@ -3821,47 +3847,6 @@ static void K_drawKartStartCountdown(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void K_drawKartFinish(void)
|
||||
{
|
||||
INT32 pnum = 0, splitflags = V_SPLITSCREEN;
|
||||
|
||||
if (!stplyr->karthud[khud_cardanimation] || stplyr->karthud[khud_cardanimation] >= 2*TICRATE)
|
||||
return;
|
||||
|
||||
if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink
|
||||
pnum = 1;
|
||||
|
||||
if (r_splitscreen > 1) // 3/4p, stationary FIN
|
||||
{
|
||||
pnum += 2;
|
||||
V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]);
|
||||
return;
|
||||
}
|
||||
|
||||
//else -- 1/2p, scrolling FINISH
|
||||
{
|
||||
INT32 x, xval, ox, interpx;
|
||||
|
||||
if (r_splitscreen) // wide splitscreen
|
||||
pnum += 4;
|
||||
|
||||
x = ((vid.width<<FRACBITS)/vid.dupx);
|
||||
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
|
||||
x = ((TICRATE - stplyr->karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE;
|
||||
ox = ((TICRATE - (stplyr->karthud[khud_cardanimation] - 1))*(xval > x ? xval : x))/TICRATE;
|
||||
|
||||
interpx = R_InterpolateFixed(ox, x);
|
||||
|
||||
if (r_splitscreen && stplyr == &players[displayplayers[1]])
|
||||
interpx = -interpx;
|
||||
|
||||
V_DrawFixedPatch(interpx + (STCD_X<<FRACBITS) - (xval>>1),
|
||||
(STCD_Y<<FRACBITS) - (SHORT(kp_racefinish[pnum]->height)<<(FRACBITS-1)),
|
||||
FRACUNIT,
|
||||
splitflags, kp_racefinish[pnum], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void K_drawBattleFullscreen(void)
|
||||
{
|
||||
INT32 x = BASEVIDWIDTH/2;
|
||||
|
|
@ -3913,7 +3898,7 @@ static void K_drawBattleFullscreen(void)
|
|||
{
|
||||
if (stplyr == &players[displayplayers[0]])
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
|
||||
if (exitcountdown <= 6*TICRATE && !stplyr->spectator)
|
||||
{
|
||||
patch_t *p = kp_battlecool;
|
||||
|
||||
|
|
@ -3924,8 +3909,8 @@ static void K_drawBattleFullscreen(void)
|
|||
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, p, NULL);
|
||||
}
|
||||
else
|
||||
K_drawKartFinish();
|
||||
|
||||
K_drawKartFinish(true);
|
||||
}
|
||||
else if (stplyr->bumpers <= 0 && stplyr->karmadelay && !stplyr->spectator && drawcomebacktimer)
|
||||
{
|
||||
|
|
@ -4732,7 +4717,7 @@ void K_drawKartHUD(void)
|
|||
if (gametype == GT_RACE && !freecam)
|
||||
{
|
||||
if (stplyr->exiting)
|
||||
K_drawKartFinish();
|
||||
K_drawKartFinish(true);
|
||||
else if (stplyr->karthud[khud_lapanimation] && !r_splitscreen)
|
||||
K_drawLapStartAnim();
|
||||
}
|
||||
|
|
|
|||
22
src/k_kart.c
22
src/k_kart.c
|
|
@ -321,6 +321,7 @@ void K_RegisterKartStuff(void)
|
|||
CV_RegisterVar(&cv_kartdebugcolorize);
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_spbtest);
|
||||
CV_RegisterVar(&cv_gptest);
|
||||
}
|
||||
|
||||
//}
|
||||
|
|
@ -7801,7 +7802,7 @@ void K_KartPlayerHUDUpdate(player_t *player)
|
|||
|
||||
if (!(player->pflags & PF_FAULT))
|
||||
player->karthud[khud_fault] = 0;
|
||||
else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE)
|
||||
else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] <= 2*TICRATE)
|
||||
player->karthud[khud_fault]++;
|
||||
|
||||
if (player->karthud[khud_itemblink] && player->karthud[khud_itemblink]-- <= 0)
|
||||
|
|
@ -7863,16 +7864,20 @@ void K_KartPlayerHUDUpdate(player_t *player)
|
|||
player->karthud[khud_ringspblock] = (leveltime % 14); // reset to normal anim next time
|
||||
}
|
||||
|
||||
if (player->exiting)
|
||||
{
|
||||
if (player->karthud[khud_finish] <= 2*TICRATE)
|
||||
player->karthud[khud_finish]++;
|
||||
}
|
||||
else
|
||||
player->karthud[khud_finish] = 0;
|
||||
|
||||
if ((gametyperules & GTR_BUMPERS) && (player->exiting || player->karmadelay))
|
||||
{
|
||||
if (player->exiting)
|
||||
{
|
||||
if (player->exiting < 6*TICRATE)
|
||||
if (exitcountdown < 6*TICRATE)
|
||||
player->karthud[khud_cardanimation] += ((164-player->karthud[khud_cardanimation])/8)+1;
|
||||
else if (player->exiting == 6*TICRATE)
|
||||
player->karthud[khud_cardanimation] = 0;
|
||||
else if (player->karthud[khud_cardanimation] < 2*TICRATE)
|
||||
player->karthud[khud_cardanimation]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7887,11 +7892,6 @@ void K_KartPlayerHUDUpdate(player_t *player)
|
|||
if (player->karthud[khud_cardanimation] < 0)
|
||||
player->karthud[khud_cardanimation] = 0;
|
||||
}
|
||||
else if (gametype == GT_RACE && player->exiting)
|
||||
{
|
||||
if (player->karthud[khud_cardanimation] < 2*TICRATE)
|
||||
player->karthud[khud_cardanimation]++;
|
||||
}
|
||||
else
|
||||
player->karthud[khud_cardanimation] = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue