mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Franticized items for 2nd place VS SPB'd 1st
This commit is contained in:
parent
1e29c9ce98
commit
9bec65ca03
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")) {
|
} else if (fastcmp(word,"thwompsactive")) {
|
||||||
lua_pushboolean(L, thwompsactive);
|
lua_pushboolean(L, thwompsactive);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (fastcmp(word,"spbexists")) {
|
||||||
|
lua_pushboolean(L, spbexists);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -461,6 +461,7 @@ extern tic_t indirectitemcooldown;
|
||||||
extern tic_t mapreset;
|
extern tic_t mapreset;
|
||||||
extern UINT8 nospectategrief;
|
extern UINT8 nospectategrief;
|
||||||
extern boolean thwompsactive;
|
extern boolean thwompsactive;
|
||||||
|
extern boolean spbexists;
|
||||||
|
|
||||||
extern boolean legitimateexit;
|
extern boolean legitimateexit;
|
||||||
extern boolean comebackshowninfo;
|
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
|
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
|
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 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)
|
// 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?
|
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_itemtype] = KITEM_JAWZ;
|
||||||
player->kartstuff[k_itemamount] = 2;
|
player->kartstuff[k_itemamount] = 2;
|
||||||
break;
|
break;
|
||||||
case KITEM_SPB: // Indirect items
|
case KITEM_SPB:
|
||||||
case KITEM_SHRINK:
|
spbexists = true;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case KITEM_SHRINK: // Indirect items
|
||||||
indirectitemcooldown = 30*TICRATE;
|
indirectitemcooldown = 30*TICRATE;
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
default:
|
default:
|
||||||
|
|
@ -599,7 +601,7 @@ static void K_KartGetItemResult(player_t *player, SINT8 getitem)
|
||||||
\return void
|
\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);
|
const INT32 distvar = (64*14);
|
||||||
INT32 newodds;
|
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.
|
// 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.
|
// 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)
|
// 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.
|
// 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!
|
// The last two are very fractional and complicated, very sorry!
|
||||||
#define POWERITEMODDS(odds) \
|
#define POWERITEMODDS(odds) \
|
||||||
if (franticitems) \
|
if (franticitems) \
|
||||||
odds *= 2; \
|
odds *= 2; \
|
||||||
|
if (spbexists && insecondplace) \
|
||||||
|
odds *= 2; \
|
||||||
if (pingame < 8 && !G_BattleGametype()) \
|
if (pingame < 8 && !G_BattleGametype()) \
|
||||||
odds = FixedMul(odds*FRACUNIT, FRACUNIT+min((8-pingame)*(FRACUNIT/25), FRACUNIT))/FRACUNIT; \
|
odds = FixedMul(odds*FRACUNIT, FRACUNIT+min((8-pingame)*(FRACUNIT/25), FRACUNIT))/FRACUNIT; \
|
||||||
if (mashed > 0) \
|
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++)
|
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;
|
available = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -974,7 +979,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
||||||
useodds = K_FindUseodds(player, mashed, pingame, bestbumper);
|
useodds = K_FindUseodds(player, mashed, pingame, bestbumper);
|
||||||
|
|
||||||
#define SETITEMRESULT(itemnum) \
|
#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
|
spawnchance[numchoices++] = itemnum
|
||||||
|
|
||||||
for (i = 1; i < NUMKARTRESULTS; i++)
|
for (i = 1; i < NUMKARTRESULTS; i++)
|
||||||
|
|
@ -7811,7 +7816,7 @@ static void K_drawDistributionDebugger(void)
|
||||||
|
|
||||||
for (i = 1; i < NUMKARTRESULTS; i++)
|
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)
|
if (itemodds <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8155,6 +8155,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||||
break;
|
break;
|
||||||
case MT_SPB:
|
case MT_SPB:
|
||||||
indirectitemcooldown = 30*TICRATE;
|
indirectitemcooldown = 30*TICRATE;
|
||||||
|
spbexists = true;
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case MT_BALLHOG:
|
case MT_BALLHOG:
|
||||||
P_SpawnGhostMobj(mobj)->fuse = 3;
|
P_SpawnGhostMobj(mobj)->fuse = 3;
|
||||||
|
|
@ -10378,6 +10379,9 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||||
if (mobj->type == MT_SHADOW)
|
if (mobj->type == MT_SHADOW)
|
||||||
P_RemoveShadow(mobj);
|
P_RemoveShadow(mobj);
|
||||||
|
|
||||||
|
if (mobj->type == MT_SPB)
|
||||||
|
spbexists = false;
|
||||||
|
|
||||||
mobj->health = 0; // Just because
|
mobj->health = 0; // Just because
|
||||||
|
|
||||||
// unlink from sector and block lists
|
// unlink from sector and block lists
|
||||||
|
|
|
||||||
|
|
@ -3287,6 +3287,7 @@ static void P_NetArchiveMisc(void)
|
||||||
WRITEUINT32(save_p, mapreset);
|
WRITEUINT32(save_p, mapreset);
|
||||||
WRITEUINT8(save_p, nospectategrief);
|
WRITEUINT8(save_p, nospectategrief);
|
||||||
WRITEUINT8(save_p, thwompsactive);
|
WRITEUINT8(save_p, thwompsactive);
|
||||||
|
WRITEUINT8(save_p, spbexists);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (paused)
|
if (paused)
|
||||||
|
|
@ -3393,6 +3394,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
||||||
mapreset = READUINT32(save_p);
|
mapreset = READUINT32(save_p);
|
||||||
nospectategrief = READUINT8(save_p);
|
nospectategrief = READUINT8(save_p);
|
||||||
thwompsactive = (boolean)READUINT8(save_p);
|
thwompsactive = (boolean)READUINT8(save_p);
|
||||||
|
spbexists = (boolean)READUINT8(save_p);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (READUINT8(save_p) == 0x2f)
|
if (READUINT8(save_p) == 0x2f)
|
||||||
|
|
|
||||||
|
|
@ -3046,6 +3046,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
mapreset = 0;
|
mapreset = 0;
|
||||||
nospectategrief = 0;
|
nospectategrief = 0;
|
||||||
thwompsactive = false;
|
thwompsactive = false;
|
||||||
|
spbexists = false;
|
||||||
|
|
||||||
// clear special respawning que
|
// clear special respawning que
|
||||||
iquehead = iquetail = 0;
|
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.
|
if (mo->type == MT_SPB) // If you destroy a SPB, you don't get the luxury of a cooldown.
|
||||||
|
{
|
||||||
|
spbexists = false;
|
||||||
indirectitemcooldown = 0;
|
indirectitemcooldown = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (mo == inflictor) // Don't nuke yourself, dummy!
|
if (mo == inflictor) // Don't nuke yourself, dummy!
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue