SPB fixes

Shrink also plays its sound, and Shrink/Grow have slower scaling speeds
This commit is contained in:
TehRealSalt 2018-06-11 01:51:50 -04:00
parent a417b57bc7
commit e6b33ef65f
7 changed files with 35 additions and 37 deletions

View file

@ -445,7 +445,7 @@ extern boolean franticitems;
extern boolean mirrormode;
extern boolean comeback;
extern tic_t instaitemcooldown;
extern tic_t indirectitemcooldown;
extern tic_t spbincoming;
extern UINT8 spbplayer;

View file

@ -253,9 +253,9 @@ SINT8 votes[MAXPLAYERS]; // Each player's vote
SINT8 pickedvote; // What vote the host rolls
// Server-sided variables
tic_t instaitemcooldown; // Cooldown before any more lightning/blue shell is awarded
tic_t spbincoming; // Timer before blue shell hits, can switch targets at this point
UINT8 spbplayer; // Player num that used the last blue shell
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
tic_t spbincoming; // Timer before SPB hits, can switch targets at this point
UINT8 spbplayer; // Player num that used the last SPB
// Client-sided variables (NEVER use in anything that needs to be synced with other players)
boolean legitimateexit; // Did this client actually finish the match?

View file

@ -25,9 +25,9 @@
// franticitems is Frantic Mode items, bool
// mirrormode is Mirror Mode (duh), bool
// comeback is Battle Mode's karma comeback, also bool
// instaitemcooldown is timer before anyone's allowed another lightning/blue shell
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
// spbincoming is the timer before k_deathsentence is cast on the player in 1st
// spbplayer is the last player who fired one
// spbplayer is the last player who fired a SPB
//{ SRB2kart Color Code
@ -464,6 +464,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean mashed)
{
const INT32 distvar = (64*14);
INT32 newodds;
INT32 i;
UINT8 pingame = 0, pexiting = 0;
@ -507,7 +508,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean
switch (item)
{
case KITEM_SNEAKER:
if (!cv_sneaker.value && !modeattacking) newodds = 0;
if ((!cv_sneaker.value) && (!modeattacking)) newodds = 0;
break;
case KITEM_ROCKETSNEAKER:
if (franticitems) newodds *= 2;
@ -517,7 +518,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean
case KITEM_INVINCIBILITY:
if (franticitems) newodds *= 2;
if (mashed) newodds /= 2;
if (!cv_invincibility.value || player->kartstuff[k_poweritemtimer]) newodds = 0;
if ((!cv_invincibility.value)
|| (player->kartstuff[k_poweritemtimer])) newodds = 0;
break;
case KITEM_BANANA:
if (!cv_banana.value) newodds = 0;
@ -546,18 +548,23 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean
case KITEM_SPB:
if (franticitems) newodds *= 2;
if (mashed) newodds /= 2;
if (!cv_selfpropelledbomb.value || pexiting <= 0
|| (secondist <= (64*14)*4) || instaitemcooldown) newodds = 0;
if ((!cv_selfpropelledbomb.value)
|| (indirectitemcooldown > 0)
|| (pexiting > 0)
|| (secondist <= distvar*4)) newodds = 0;
break;
case KITEM_GROW:
if (franticitems) newodds *= 2;
if (mashed) newodds /= 2;
if (!cv_grow.value || player->kartstuff[k_poweritemtimer]) newodds = 0;
if ((!cv_grow.value)
|| (player->kartstuff[k_poweritemtimer])) newodds = 0;
break;
case KITEM_SHRINK:
if (franticitems) newodds *= 2;
if (mashed) newodds /= 2;
if (!cv_shrink.value || pingame-1 <= pexiting || instaitemcooldown) newodds = 0;
if ((!cv_shrink.value)
|| (indirectitemcooldown > 0)
|| (pingame-1 <= pexiting)) newodds = 0;
break;
case KITEM_LIGHTNINGSHIELD:
if (franticitems) newodds *= 2;
@ -2213,31 +2220,19 @@ void K_DoSneaker(player_t *player, boolean doPFlag)
static void K_DoShrink(player_t *player)
{
mobj_t *mo;
thinker_t *think;
//INT32 i;
INT32 i;
//S_StartSound(player->mo, sfx_bkpoof); // Sound the BANG!
player->pflags |= PF_ATTACKDOWN;
/*for (i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
P_FlashPal(&players[i], PAL_NUKE, 10);
}*/
/*if (playeringame[i])
P_FlashPal(&players[i], PAL_NUKE, 10);*/
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
mo = (mobj_t *)think;
if (mo->player && !mo->player->spectator
&& mo->player->kartstuff[k_position] < player->kartstuff[k_position])
P_DamageMobj(mo, player->mo, player->mo, 64);
else
continue;
if (playeringame[i] && players[i].mo && !player->spectator
&& players[i].kartstuff[k_position] < player->kartstuff[k_position])
P_DamageMobj(players[i].mo, player->mo, player->mo, 64);
}
K_PlayTauntSound(player->mo);
@ -3257,6 +3252,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (!cv_kartstarsfx.value && !P_IsLocalPlayer(player))
S_StartSound(player->mo, sfx_kgrow);
K_PlayTauntSound(player->mo);
player->mo->scalespeed = FRACUNIT/TICRATE;
player->mo->destscale = 3*(mapheaderinfo[gamemap-1]->mobj_scale)/2;
player->kartstuff[k_growshrinktimer] = itemtime;
S_StartSound(player->mo, sfx_kc5a);

View file

@ -3117,6 +3117,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
K_SpinPlayer(player, source);
// Start shrinking!
player->mo->scalespeed = FRACUNIT/TICRATE;
player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
player->kartstuff[k_growshrinktimer] -= (100+20*(16-(player->kartstuff[k_position])));
}
@ -3127,6 +3128,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
// Invincible or not, we still need this.
//P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_LIGHTNING);
S_StartSound(player->mo, sfx_kc59);
return true;
}
@ -3136,7 +3138,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (player == source->player)
return false;
// Just need to do this now! Being thrown upwards is done by the explosion.
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING);
//P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING);
blueexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
P_SetTarget(&blueexplode->target, source);
return true;

View file

@ -3255,7 +3255,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT8(save_p, franticitems);
WRITEUINT8(save_p, comeback);
WRITEUINT32(save_p, instaitemcooldown);
WRITEUINT32(save_p, indirectitemcooldown);
WRITEUINT32(save_p, spbincoming);
WRITEUINT8(save_p, spbplayer);
@ -3352,7 +3352,7 @@ static inline boolean P_NetUnArchiveMisc(void)
franticitems = (boolean)READUINT8(save_p);
comeback = (boolean)READUINT8(save_p);
instaitemcooldown = READUINT32(save_p);
indirectitemcooldown = READUINT32(save_p);
spbincoming = READUINT32(save_p);
spbplayer = READUINT8(save_p);

View file

@ -3003,7 +3003,7 @@ boolean P_SetupLevel(boolean skipprecip)
comeback = cv_kartcomeback.value;
}
instaitemcooldown = 0;
indirectitemcooldown = 0;
spbincoming = 0;
spbplayer = 0;

View file

@ -706,8 +706,8 @@ void P_Ticker(boolean run)
players[hurtthisguy].kartstuff[k_deathsentence] = TICRATE+1;
}
if (instaitemcooldown)
instaitemcooldown--;
if (indirectitemcooldown)
indirectitemcooldown--;
if (quake.time)
{