mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Actually, best of both:
Let Grow/Shrink revert itself when it changes to 0, as well as add a function for removing either. Means we don't have to modify every single > 0/< 0 check, and is overall cleaner.
This commit is contained in:
parent
9bafdaf492
commit
c599d84d6e
3 changed files with 30 additions and 23 deletions
|
@ -2431,7 +2431,10 @@ void G_PlayerReborn(INT32 player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep Shrink status, remove Grow status
|
// Keep Shrink status, remove Grow status
|
||||||
growshrinktimer = min(players[player].kartstuff[k_growshrinktimer], 0);
|
if (players[player].kartstuff[k_growshrinktimer] < 0)
|
||||||
|
growshrinktimer = players[player].kartstuff[k_growshrinktimer];
|
||||||
|
else
|
||||||
|
growshrinktimer = 0;
|
||||||
|
|
||||||
bumper = players[player].kartstuff[k_bumper];
|
bumper = players[player].kartstuff[k_bumper];
|
||||||
comebackpoints = players[player].kartstuff[k_comebackpoints];
|
comebackpoints = players[player].kartstuff[k_comebackpoints];
|
||||||
|
|
44
src/k_kart.c
44
src/k_kart.c
|
@ -1989,6 +1989,18 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void K_RemoveGrowShrink(player_t *player)
|
||||||
|
{
|
||||||
|
player->kartstuff[k_growshrinktimer] = 0;
|
||||||
|
if (player->kartstuff[k_invincibilitytimer] == 0)
|
||||||
|
player->mo->color = player->skincolor;
|
||||||
|
player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE;
|
||||||
|
player->mo->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
|
||||||
|
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
||||||
|
player->mo->destscale = 6*player->mo->destscale/8;
|
||||||
|
P_RestoreMusic(player);
|
||||||
|
}
|
||||||
|
|
||||||
void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||||
{
|
{
|
||||||
UINT8 scoremultiply = 1;
|
UINT8 scoremultiply = 1;
|
||||||
|
@ -2081,11 +2093,11 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||||
player->kartstuff[k_squishedtimer] = TICRATE;
|
player->kartstuff[k_squishedtimer] = TICRATE;
|
||||||
|
|
||||||
// Reduce Shrink timer
|
// Reduce Shrink timer
|
||||||
if (player->kartstuff[k_growshrinktimer] < -2)
|
if (player->kartstuff[k_growshrinktimer] < 0)
|
||||||
{
|
{
|
||||||
player->kartstuff[k_growshrinktimer] += TICRATE;
|
player->kartstuff[k_growshrinktimer] += TICRATE;
|
||||||
if (player->kartstuff[k_growshrinktimer] > -2)
|
if (player->kartstuff[k_growshrinktimer] >= 0)
|
||||||
player->kartstuff[k_growshrinktimer] = -2;
|
K_RemoveGrowShrink(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
||||||
|
@ -3277,8 +3289,8 @@ static void K_DoShrink(player_t *user)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grow should get taken away.
|
// Grow should get taken away.
|
||||||
if (players[i].kartstuff[k_growshrinktimer] > 2)
|
if (players[i].kartstuff[k_growshrinktimer] > 0)
|
||||||
players[i].kartstuff[k_growshrinktimer] = 2;
|
K_RemoveGrowShrink(&players[i]);
|
||||||
|
|
||||||
//P_FlashPal(&players[i], PAL_NUKE, 10);
|
//P_FlashPal(&players[i], PAL_NUKE, 10);
|
||||||
S_StartSound(players[i].mo, sfx_kc59);
|
S_StartSound(players[i].mo, sfx_kc59);
|
||||||
|
@ -4309,22 +4321,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
if (player->kartstuff[k_invincibilitytimer])
|
if (player->kartstuff[k_invincibilitytimer])
|
||||||
player->kartstuff[k_invincibilitytimer]--;
|
player->kartstuff[k_invincibilitytimer]--;
|
||||||
|
|
||||||
if (!player->kartstuff[k_respawn])
|
if (!player->kartstuff[k_respawn] && player->kartstuff[k_growshrinktimer] != 0)
|
||||||
{
|
{
|
||||||
if (player->kartstuff[k_growshrinktimer] > 0)
|
if (player->kartstuff[k_growshrinktimer] > 0)
|
||||||
player->kartstuff[k_growshrinktimer]--;
|
player->kartstuff[k_growshrinktimer]--;
|
||||||
if (player->kartstuff[k_growshrinktimer] < 0)
|
if (player->kartstuff[k_growshrinktimer] < 0)
|
||||||
player->kartstuff[k_growshrinktimer]++;
|
player->kartstuff[k_growshrinktimer]++;
|
||||||
}
|
|
||||||
|
|
||||||
if (player->kartstuff[k_growshrinktimer] == 1 || player->kartstuff[k_growshrinktimer] == -1)
|
// Back to normal
|
||||||
{
|
if (player->kartstuff[k_growshrinktimer] == 0)
|
||||||
if (player->kartstuff[k_invincibilitytimer] == 0)
|
K_RemoveGrowShrink(player);
|
||||||
player->mo->color = player->skincolor;
|
|
||||||
player->mo->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
|
|
||||||
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
|
||||||
player->mo->destscale = 6*player->mo->destscale/8;
|
|
||||||
P_RestoreMusic(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_stealingtimer] == 0 && player->kartstuff[k_stolentimer] == 0
|
if (player->kartstuff[k_stealingtimer] == 0 && player->kartstuff[k_stolentimer] == 0
|
||||||
|
@ -4879,10 +4885,7 @@ void K_StripOther(player_t *player)
|
||||||
player->kartstuff[k_roulettetype] = 0;
|
player->kartstuff[k_roulettetype] = 0;
|
||||||
|
|
||||||
player->kartstuff[k_invincibilitytimer] = 0;
|
player->kartstuff[k_invincibilitytimer] = 0;
|
||||||
if (player->kartstuff[k_growshrinktimer] > 0)
|
K_RemoveGrowShrink(player);
|
||||||
player->kartstuff[k_growshrinktimer] = 2;
|
|
||||||
else if (player->kartstuff[k_growshrinktimer] < 0)
|
|
||||||
player->kartstuff[k_growshrinktimer] = -2;
|
|
||||||
|
|
||||||
if (player->kartstuff[k_eggmanexplode])
|
if (player->kartstuff[k_eggmanexplode])
|
||||||
{
|
{
|
||||||
|
@ -5483,6 +5486,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
// Increase your size while charging your engine.
|
// Increase your size while charging your engine.
|
||||||
if (leveltime < starttime+10)
|
if (leveltime < starttime+10)
|
||||||
{
|
{
|
||||||
|
player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12;
|
||||||
player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale) + (player->kartstuff[k_boostcharge]*131);
|
player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale) + (player->kartstuff[k_boostcharge]*131);
|
||||||
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
||||||
player->mo->destscale = 6*player->mo->destscale/8;
|
player->mo->destscale = 6*player->mo->destscale/8;
|
||||||
|
@ -6433,7 +6437,7 @@ static void K_drawKartItem(void)
|
||||||
else
|
else
|
||||||
localpatch = kp_nodraw;
|
localpatch = kp_nodraw;
|
||||||
}
|
}
|
||||||
else if (stplyr->kartstuff[k_growshrinktimer] > 1)
|
else if (stplyr->kartstuff[k_growshrinktimer] > 0)
|
||||||
{
|
{
|
||||||
if (leveltime & 1)
|
if (leveltime & 1)
|
||||||
localpatch = kp_grow[offset];
|
localpatch = kp_grow[offset];
|
||||||
|
|
|
@ -131,8 +131,8 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Item-specific timer going off
|
// Item-specific timer going off
|
||||||
if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer]
|
if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer]
|
||||||
|| player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_rocketsneakertimer]
|
|| player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_rocketsneakertimer]
|
||||||
|| player->kartstuff[k_eggmanexplode])
|
|| player->kartstuff[k_eggmanexplode])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue