Keep track of the place SPB is following

This makes it so that if the SPB'd person is passed, then the person who's getting SPB'd won't get the increased item odds for the weird feedback loop.
This commit is contained in:
TehRealSalt 2018-11-24 20:41:17 -05:00
parent fccdfc1bfd
commit d467399480
9 changed files with 17 additions and 14 deletions

View file

@ -9773,8 +9773,8 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"thwompsactive")) {
lua_pushboolean(L, thwompsactive);
return 1;
} else if (fastcmp(word,"spbexists")) {
lua_pushboolean(L, spbexists);
} else if (fastcmp(word,"spbplace")) {
lua_pushinteger(L, spbplace);
return 1;
}

View file

@ -461,7 +461,7 @@ extern tic_t indirectitemcooldown;
extern tic_t mapreset;
extern UINT8 nospectategrief;
extern boolean thwompsactive;
extern boolean spbexists;
extern SINT8 spbplace;
extern boolean legitimateexit;
extern boolean comebackshowninfo;

View file

@ -267,7 +267,7 @@ tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any othe
tic_t mapreset; // Map reset delay when enough players have joined an empty game
UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing
boolean thwompsactive; // Thwomps activate on lap 2
boolean spbexists; // SPB exists, give 2nd place better items
SINT8 spbplace; // SPB exists, give the person behind better items
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
boolean legitimateexit; // Did this client actually finish the match?

View file

@ -583,8 +583,6 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
player->kartstuff[k_itemamount] = 2;
break;
case KITEM_SPB:
spbexists = true;
/* FALLTHRU */
case KITEM_SHRINK: // Indirect items
indirectitemcooldown = 30*TICRATE;
/* FALLTHRU */
@ -988,7 +986,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
spawnchance[i] = 0;
// Split into another function for a debug function below
useodds = K_FindUseodds(player, mashed, pingame, bestbumper, (player->kartstuff[k_position] == 2 && spbexists));
useodds = K_FindUseodds(player, mashed, pingame, bestbumper, (spbplace != -1 && player->kartstuff[k_position] == spbplace+1));
#define SETITEMRESULT(itemnum) \
for (chance = 0; chance < K_KartGetItemOdds(useodds, itemnum, mashed); chance++) \
@ -7944,7 +7942,7 @@ static void K_drawDistributionDebugger(void)
bestbumper = players[i].kartstuff[k_bumper];
}
useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper, (stplyr->kartstuff[k_position] == 2 && spbexists));
useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper, (spbplace != -1 && stplyr->kartstuff[k_position] == spbplace+1));
for (i = 1; i < NUMKARTRESULTS; i++)
{

View file

@ -8354,6 +8354,7 @@ void A_SPBChase(mobj_t *actor)
if (actor->threshold) // Just fired, go straight.
{
actor->lastlook = -1;
spbplace = -1;
P_InstaThrust(actor, actor->angle, wspeed);
return;
}
@ -8382,6 +8383,8 @@ void A_SPBChase(mobj_t *actor)
actor->extravalue2 = 7*TICRATE;
else if (actor->extravalue2-- <= 0)
actor->extravalue1 = 0; // back to SEEKING
spbplace = actor->tracer->player->kartstuff[k_position];
}
// Play the intimidating gurgle
@ -8466,6 +8469,8 @@ void A_SPBChase(mobj_t *actor)
else if (actor->extravalue1 == 2) // MODE: WAIT...
{
actor->momx = actor->momy = actor->momz = 0; // Stoooop
spbplace = -1;
if (actor->extravalue2-- <= 0)
{
if (actor->lastlook != -1 && playeringame[actor->lastlook] && players[actor->lastlook].mo)
@ -8482,6 +8487,7 @@ void A_SPBChase(mobj_t *actor)
else // MODE: SEEKING
{
actor->lastlook = -1; // Just make sure this is reset
spbplace = -1;
// Find the player with the best rank
for (i = 0; i < MAXPLAYERS; i++)

View file

@ -8167,7 +8167,6 @@ void P_MobjThinker(mobj_t *mobj)
break;
case MT_SPB:
indirectitemcooldown = 30*TICRATE;
spbexists = true;
/* FALLTHRU */
case MT_BALLHOG:
P_SpawnGhostMobj(mobj)->fuse = 3;
@ -10392,7 +10391,7 @@ void P_RemoveMobj(mobj_t *mobj)
P_RemoveShadow(mobj);
if (mobj->type == MT_SPB)
spbexists = false;
spbplace = -1;
mobj->health = 0; // Just because

View file

@ -3287,7 +3287,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, mapreset);
WRITEUINT8(save_p, nospectategrief);
WRITEUINT8(save_p, thwompsactive);
WRITEUINT8(save_p, spbexists);
WRITESINT8(save_p, spbplace);
// Is it paused?
if (paused)
@ -3394,7 +3394,7 @@ static inline boolean P_NetUnArchiveMisc(void)
mapreset = READUINT32(save_p);
nospectategrief = READUINT8(save_p);
thwompsactive = (boolean)READUINT8(save_p);
spbexists = (boolean)READUINT8(save_p);
spbplace = READSINT8(save_p);
// Is it paused?
if (READUINT8(save_p) == 0x2f)

View file

@ -3046,7 +3046,7 @@ boolean P_SetupLevel(boolean skipprecip)
mapreset = 0;
nospectategrief = 0;
thwompsactive = false;
spbexists = false;
spbplace = -1;
// clear special respawning que
iquehead = iquetail = 0;

View file

@ -7759,7 +7759,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
if (mo->type == MT_SPB) // If you destroy a SPB, you don't get the luxury of a cooldown.
{
spbexists = false;
spbplace = -1;
indirectitemcooldown = 0;
}