mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-17 23:21:05 +00:00
Franticized items for 2nd place VS SPB'd 1st
This commit is contained in:
parent
c4335a5524
commit
3f35ffd7c6
8 changed files with 27 additions and 7 deletions
|
@ -9770,6 +9770,9 @@ 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);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -461,6 +461,7 @@ extern tic_t indirectitemcooldown;
|
|||
extern tic_t mapreset;
|
||||
extern UINT8 nospectategrief;
|
||||
extern boolean thwompsactive;
|
||||
extern boolean spbexists;
|
||||
|
||||
extern boolean legitimateexit;
|
||||
extern boolean comebackshowninfo;
|
||||
|
|
|
@ -267,6 +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
|
||||
|
||||
// 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?
|
||||
|
|
19
src/k_kart.c
19
src/k_kart.c
|
@ -574,8 +574,10 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
|
|||
player->kartstuff[k_itemtype] = KITEM_JAWZ;
|
||||
player->kartstuff[k_itemamount] = 2;
|
||||
break;
|
||||
case KITEM_SPB: // Indirect items
|
||||
case KITEM_SHRINK:
|
||||
case KITEM_SPB:
|
||||
spbexists = true;
|
||||
/* FALLTHRU */
|
||||
case KITEM_SHRINK: // Indirect items
|
||||
indirectitemcooldown = 30*TICRATE;
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
|
@ -599,7 +601,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
|
|||
\return void
|
||||
*/
|
||||
|
||||
static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
|
||||
static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean insecondplace)
|
||||
{
|
||||
const INT32 distvar = (64*14);
|
||||
INT32 newodds;
|
||||
|
@ -648,13 +650,16 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
|
|||
|
||||
// POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items.
|
||||
// First, it multiplies it by 2 if franticitems is true; easy-peasy.
|
||||
// Then, it multiplies it further if there's less than 5 players in game.
|
||||
// Next, it multiplies it again if it's in SPB mode and 2nd needs to apply pressure to 1st.
|
||||
// Then, it multiplies it further if there's less than 8 players in game.
|
||||
// This is done to make low player count races more fair & interesting. (1v1s are basically the same as franticitems false in a normal race)
|
||||
// Lastly, it *divides* it by your mashed value, which was determined in K_KartItemRoulette, to punish those who are impatient.
|
||||
// The last two are very fractional and complicated, very sorry!
|
||||
#define POWERITEMODDS(odds) \
|
||||
if (franticitems) \
|
||||
odds *= 2; \
|
||||
if (spbexists && insecondplace) \
|
||||
odds *= 2; \
|
||||
if (pingame < 8 && !G_BattleGametype()) \
|
||||
odds = FixedMul(odds*FRACUNIT, FRACUNIT+min((8-pingame)*(FRACUNIT/25), FRACUNIT))/FRACUNIT; \
|
||||
if (mashed > 0) \
|
||||
|
@ -782,7 +787,7 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3
|
|||
|
||||
for (j = 0; j < NUMKARTRESULTS; j++)
|
||||
{
|
||||
if (K_KartGetItemOdds(i, j, mashed) > 0)
|
||||
if (K_KartGetItemOdds(i, j, mashed, (player->kartstuff[k_position] == 2)) > 0)
|
||||
{
|
||||
available = true;
|
||||
break;
|
||||
|
@ -974,7 +979,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
|||
useodds = K_FindUseodds(player, mashed, pingame, bestbumper);
|
||||
|
||||
#define SETITEMRESULT(itemnum) \
|
||||
for (chance = 0; chance < K_KartGetItemOdds(useodds, itemnum, mashed); chance++) \
|
||||
for (chance = 0; chance < K_KartGetItemOdds(useodds, itemnum, mashed, (player->kartstuff[k_position] == 2)); chance++) \
|
||||
spawnchance[numchoices++] = itemnum
|
||||
|
||||
for (i = 1; i < NUMKARTRESULTS; i++)
|
||||
|
@ -7811,7 +7816,7 @@ static void K_drawDistributionDebugger(void)
|
|||
|
||||
for (i = 1; i < NUMKARTRESULTS; i++)
|
||||
{
|
||||
const INT32 itemodds = K_KartGetItemOdds(useodds, i, 0);
|
||||
const INT32 itemodds = K_KartGetItemOdds(useodds, i, 0, (stplyr->kartstuff[k_position] == 2));
|
||||
if (itemodds <= 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -8155,6 +8155,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
break;
|
||||
case MT_SPB:
|
||||
indirectitemcooldown = 30*TICRATE;
|
||||
spbexists = true;
|
||||
/* FALLTHRU */
|
||||
case MT_BALLHOG:
|
||||
P_SpawnGhostMobj(mobj)->fuse = 3;
|
||||
|
@ -10378,6 +10379,9 @@ void P_RemoveMobj(mobj_t *mobj)
|
|||
if (mobj->type == MT_SHADOW)
|
||||
P_RemoveShadow(mobj);
|
||||
|
||||
if (mobj->type == MT_SPB)
|
||||
spbexists = false;
|
||||
|
||||
mobj->health = 0; // Just because
|
||||
|
||||
// unlink from sector and block lists
|
||||
|
|
|
@ -3287,6 +3287,7 @@ static void P_NetArchiveMisc(void)
|
|||
WRITEUINT32(save_p, mapreset);
|
||||
WRITEUINT8(save_p, nospectategrief);
|
||||
WRITEUINT8(save_p, thwompsactive);
|
||||
WRITEUINT8(save_p, spbexists);
|
||||
|
||||
// Is it paused?
|
||||
if (paused)
|
||||
|
@ -3393,6 +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);
|
||||
|
||||
// Is it paused?
|
||||
if (READUINT8(save_p) == 0x2f)
|
||||
|
|
|
@ -3046,6 +3046,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
mapreset = 0;
|
||||
nospectategrief = 0;
|
||||
thwompsactive = false;
|
||||
spbexists = false;
|
||||
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
|
|
@ -7758,7 +7758,10 @@ 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;
|
||||
indirectitemcooldown = 0;
|
||||
}
|
||||
|
||||
if (mo == inflictor) // Don't nuke yourself, dummy!
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue