mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-23 16:32:36 +00:00
Add K_TimeAttackRules
Lets Time Attack capsules spawn in Free Play, and prevents Time Attack specific rules from happening in Special Stages
This commit is contained in:
parent
f51a913710
commit
36e9a56f29
6 changed files with 52 additions and 13 deletions
|
|
@ -547,7 +547,7 @@ void DRPC_UpdatePresence(void)
|
|||
if (gamestate == GS_LEVEL && Playing())
|
||||
{
|
||||
const time_t currentTime = time(NULL);
|
||||
const time_t mapTimeStart = currentTime - ((leveltime + (modeattacking ? starttime : 0)) / TICRATE);
|
||||
const time_t mapTimeStart = currentTime - ((leveltime + starttime) / TICRATE);
|
||||
|
||||
discordPresence.startTimestamp = mapTimeStart;
|
||||
|
||||
|
|
|
|||
39
src/k_kart.c
39
src/k_kart.c
|
|
@ -506,6 +506,43 @@ void K_RunItemCooldowns(void)
|
|||
}
|
||||
}
|
||||
|
||||
boolean K_TimeAttackRules(void)
|
||||
{
|
||||
UINT8 playing = 0;
|
||||
UINT8 i;
|
||||
|
||||
if (specialStage.active == true)
|
||||
{
|
||||
// Kind of a hack -- Special Stages
|
||||
// are expected to be 1-player, so
|
||||
// we won't use the Time Attack changes
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modeattacking != ATTACKING_NONE)
|
||||
{
|
||||
// Time Attack obviously uses Time Attack rules :p
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] == false || players[i].spectator == true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
playing++;
|
||||
if (playing > 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Use Time Attack gameplay rules with only 1P.
|
||||
return (playing <= 1);
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
//{ SRB2kart p_user.c Stuff
|
||||
|
|
@ -3208,7 +3245,7 @@ boolean K_PlayerShrinkCheat(player_t *player)
|
|||
return (
|
||||
(player->pflags & PF_SHRINKACTIVE)
|
||||
&& (player->bot == false)
|
||||
&& (modeattacking == false) // Anyone want to make another record attack category?
|
||||
&& (modeattacking == ATTACKING_NONE) // Anyone want to make another record attack category?
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ UINT8 K_ItemResultToAmount(SINT8 getitem);
|
|||
tic_t K_GetItemCooldown(SINT8 itemResult);
|
||||
void K_SetItemCooldown(SINT8 itemResult, tic_t time);
|
||||
void K_RunItemCooldowns(void);
|
||||
boolean K_ItemEnabled(SINT8 item);
|
||||
|
||||
boolean K_TimeAttackRules(void);
|
||||
|
||||
fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against);
|
||||
boolean K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2);
|
||||
boolean K_KartSolidBounce(mobj_t *bounceMobj, mobj_t *solidMobj);
|
||||
|
|
|
|||
|
|
@ -502,12 +502,12 @@ INT32 K_KartGetItemOdds(const player_t *player, itemroulette_t *const roulette,
|
|||
else if (specialStage.active == true)
|
||||
{
|
||||
I_Assert(pos < 4); // Ditto
|
||||
newodds = K_KartItemOddsSpecial[item-1][pos];
|
||||
newOdds = K_KartItemOddsSpecial[item-1][pos];
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Assert(pos < 8); // Ditto
|
||||
newodds = K_KartItemOddsRace[item-1][pos];
|
||||
newOdds = K_KartItemOddsRace[item-1][pos];
|
||||
}
|
||||
|
||||
newOdds <<= FRACBITS;
|
||||
|
|
@ -693,12 +693,12 @@ static UINT8 K_FindUseodds(const player_t *player, itemroulette_t *const roulett
|
|||
{
|
||||
UINT8 j;
|
||||
|
||||
if (specialStage.active == true && i > 3)
|
||||
if (gametype == GT_BATTLE && i > 1)
|
||||
{
|
||||
oddsvalid[i] = false;
|
||||
oddsValid[i] = false;
|
||||
continue;
|
||||
}
|
||||
else if (gametype == GT_BATTLE && i > 1)
|
||||
else if (specialStage.active == true && i > 3)
|
||||
{
|
||||
oddsValid[i] = false;
|
||||
continue;
|
||||
|
|
@ -1016,7 +1016,7 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette)
|
|||
fixed_t progress = 0;
|
||||
fixed_t total = 0;
|
||||
|
||||
if (modeattacking || roulette->playing <= 1)
|
||||
if (K_TimeAttackRules() == true)
|
||||
{
|
||||
// Time Attack rules; use a consistent speed.
|
||||
roulette->tics = roulette->speed = ROULETTE_SPEED_TIMEATTACK;
|
||||
|
|
@ -1099,7 +1099,7 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet
|
|||
|
||||
return;
|
||||
}
|
||||
else if (modeattacking || roulette->playing <= 1)
|
||||
else if (K_TimeAttackRules() == true)
|
||||
{
|
||||
switch (gametype)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1367,7 +1367,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
INT16 spacing = (target->radius >> 1) / target->scale;
|
||||
|
||||
// set respawn fuse
|
||||
if (modeattacking) // no respawns
|
||||
if (K_TimeAttackRules() == true) // no respawns
|
||||
;
|
||||
else if (target->threshold == KITEM_SUPERRING)
|
||||
target->fuse = 20*TICRATE;
|
||||
|
|
@ -2212,7 +2212,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
|
||||
K_PlayPainSound(target, source);
|
||||
|
||||
if ((hardhit == true) || (cv_kartdebughuddrop.value && !modeattacking))
|
||||
if ((hardhit == true) || cv_kartdebughuddrop.value)
|
||||
{
|
||||
K_DropItems(player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11974,7 +11974,7 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i)
|
|||
|
||||
// in record attack, only spawn ring capsules
|
||||
// (behavior can be inverted with the Extra flag, i.e. item capsule spawns and ring capsule does not)
|
||||
if (modeattacking
|
||||
if (K_TimeAttackRules() == true
|
||||
&& (!(mthing->args[2] & TMICF_INVERTTIMEATTACK) == !isRingCapsule))
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue