Merge branch 'sneaker-lift' into 'master'

Sneaker Lift

See merge request KartKrew/Kart!2437
This commit is contained in:
Oni 2024-08-25 23:50:10 +00:00
commit 08cf2de75a
12 changed files with 98 additions and 29 deletions

View file

@ -789,6 +789,8 @@ struct player_t
UINT16 sneakertimer; // Duration of a Sneaker Boost (from Sneakers or level boosters)
UINT8 numsneakers; // Number of stacked sneaker effects
UINT16 panelsneakertimer;
UINT8 numpanelsneakers;
UINT8 floorboost; // (0 to 3) - Prevents Sneaker sounds for a brief duration when triggered by a floor panel
INT16 growshrinktimer; // > 0 = Big, < 0 = small

View file

@ -951,6 +951,7 @@ boolean K_InstaWhipCollide(mobj_t *shield, mobj_t *victim)
attacker->renderflags &= ~RF_DONTDRAW;
attackerPlayer->spindashboost = 0;
attackerPlayer->sneakertimer = 0;
attackerPlayer->panelsneakertimer = 0;
attackerPlayer->instaWhipCharge = 0;
attackerPlayer->flashing = 0;
@ -1174,7 +1175,7 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
{
auto shouldSteal = [](mobj_t *t1, mobj_t *t2)
{
return ((t1->player->sneakertimer > 0)
return ((t1->player->sneakertimer > 0 || t1->player->panelsneakertimer > 0)
&& !P_PlayerInPain(t1->player)
&& (t1->player->flashing == 0));
};

View file

@ -2969,7 +2969,7 @@ void K_MomentumToFacing(player_t *player)
boolean K_ApplyOffroad(const player_t *player)
{
if (player->invincibilitytimer || player->hyudorotimer || player->sneakertimer)
if (player->invincibilitytimer || player->hyudorotimer || player->sneakertimer || player->panelsneakertimer)
return false;
if (K_IsRidingFloatingTop(player))
return false;
@ -2978,7 +2978,7 @@ boolean K_ApplyOffroad(const player_t *player)
boolean K_SlopeResistance(const player_t *player)
{
if (player->invincibilitytimer || player->sneakertimer || player->tiregrease || player->flamedash)
if (player->invincibilitytimer || player->sneakertimer || player->panelsneakertimer || player->tiregrease || player->flamedash)
return true;
if (player->curshield == KSHIELD_TOP)
return true;
@ -3013,7 +3013,8 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player)
{
if (
player->invincibilitytimer ||
player->sneakertimer
player->sneakertimer ||
player->panelsneakertimer
)
return TRIPWIRE_BLASTER;
@ -3103,6 +3104,7 @@ boolean K_WaterRun(mobj_t *mobj)
if (mobj->player->invincibilitytimer
|| mobj->player->sneakertimer
|| mobj->player->panelsneakertimer
|| mobj->player->tiregrease
|| mobj->player->flamedash
|| mobj->player->speed > minspeed)
@ -3471,6 +3473,15 @@ static void K_GetKartBoostPower(player_t *player)
{
UINT8 i;
for (i = 0; i < player->numsneakers; i++)
{
ADDBOOST(FRACUNIT*75/100, 8*FRACUNIT, SLIPTIDEHANDLING+SLIPTIDEHANDLING/3); // + 50% top speed, + 800% acceleration, +50% handling
}
}
if (player->panelsneakertimer) // Sneaker
{
UINT8 i;
for (i = 0; i < player->numpanelsneakers; i++)
{
ADDBOOST(FRACUNIT/2, 8*FRACUNIT, SLIPTIDEHANDLING); // + 50% top speed, + 800% acceleration, +50% handling
}
@ -3881,7 +3892,7 @@ SINT8 K_GetForwardMove(const player_t *player)
return 0;
}
if (player->sneakertimer || player->spindashboost
if (player->sneakertimer || player->panelsneakertimer || player->spindashboost
|| (((gametyperules & (GTR_ROLLINGSTART|GTR_CIRCUIT)) == (GTR_ROLLINGSTART|GTR_CIRCUIT)) && (leveltime < TICRATE/2)))
{
return MAXPLMOVE;
@ -4810,7 +4821,7 @@ static boolean K_IsLosingWavedash(player_t *player)
if (!K_Sliptiding(player) && player->wavedash < MIN_WAVEDASH_CHARGE)
return true;
if (!K_Sliptiding(player) && player->drift == 0
&& P_IsObjectOnGround(player->mo) && player->sneakertimer == 0
&& P_IsObjectOnGround(player->mo) && player->sneakertimer == 0 && player->panelsneakertimer == 0
&& player->driftboost == 0)
return true;
return false;
@ -6878,7 +6889,18 @@ static void K_FlameDashLeftoverSmoke(mobj_t *src)
void K_DoSneaker(player_t *player, INT32 type)
{
const fixed_t intendedboost = FRACUNIT/2;
fixed_t intendedboost = FRACUNIT/2;
switch (type)
{
case 0: // Panel sneaker
intendedboost = FRACUNIT/2;
break;
case 1: // Single item sneaker
case 2: // ROcket sneaker
intendedboost = FRACUNIT;
break;
}
if (player->roundconditions.touched_sneakerpanel == false
&& !(player->exiting || (player->pflags & PF_NOCONTEST))
@ -6894,7 +6916,7 @@ void K_DoSneaker(player_t *player, INT32 type)
const sfxenum_t smallsfx = sfx_cdfm40;
sfxenum_t sfx = normalsfx;
if (player->numsneakers)
if (player->numsneakers || player->numpanelsneakers)
{
// Use a less annoying sound when stacking sneakers.
sfx = smallsfx;
@ -6908,10 +6930,19 @@ void K_DoSneaker(player_t *player, INT32 type)
if (intendedboost > player->speedboost)
player->karthud[khud_destboostcam] = FixedMul(FRACUNIT, FixedDiv((intendedboost - player->speedboost), intendedboost));
player->numsneakers++;
switch (type)
{
case 0:
player->numpanelsneakers++;
break;
case 1:
case 2:
player->numsneakers++;
break;
}
}
if (player->sneakertimer == 0)
if (player->sneakertimer == 0 && player->panelsneakertimer == 0)
{
if (type == 2)
{
@ -6941,7 +6972,24 @@ void K_DoSneaker(player_t *player, INT32 type)
}
}
player->sneakertimer = sneakertime;
switch (type)
{
case 0:
player->panelsneakertimer = sneakertime;
player->overshield += 1; // TEMP prototype
break;
case 1:
player->sneakertimer = sneakertime;
player->overshield += TICRATE/2; // TEMP prototype
break;
case 2:
player->sneakertimer = sneakertime + TICRATE/2;
player->overshield += TICRATE/2; // TEMP prototype
break;
}
// set angle for spun out players:
player->boostangle = player->mo->angle;
@ -7074,7 +7122,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
}
}
if (mo->player->sneakertimer || mo->player->invincibilitytimer)
if (mo->player->sneakertimer || mo->player->panelsneakertimer || mo->player->invincibilitytimer)
{
thrust = FixedMul(thrust, (3*FRACUNIT)/2);
}
@ -8789,7 +8837,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->speed > 0)
{
// Speed lines
if (player->sneakertimer || player->ringboost
if (player->sneakertimer || player->panelsneakertimer || player->ringboost
|| player->driftboost || player->startboost
|| player->eggmanexplode || player->trickboost
|| player->gateBoost || player->wavedashboost)
@ -8974,7 +9022,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
{
if (((P_IsObjectOnGround(player->mo)
|| ( player->spinouttype & KSPIN_AIRTIMER ))
&& (!player->sneakertimer))
&& (!player->sneakertimer)
&& (!player->panelsneakertimer))
|| (player->respawn.state != RESPAWNST_NONE
&& player->spinouttimer > 1
&& (leveltime & 1)))
@ -9124,6 +9173,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
}
}
if (player->panelsneakertimer)
{
player->panelsneakertimer--;
if (player->panelsneakertimer <= 0)
{
player->numpanelsneakers = 0;
}
}
if (player->trickboost)
player->trickboost--;
@ -9140,7 +9199,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->counterdash)
player->counterdash--;
if (player->sneakertimer && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1)
if ((player->sneakertimer || player->panelsneakertimer) && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1)
player->wipeoutslow = wipeoutslowtime+1;
if (player->floorboost > 0)
@ -9378,6 +9437,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->strongdriftboost = 0;
player->tiregrease = 0;
player->sneakertimer = 0;
player->panelsneakertimer = 0;
player->spindashboost = 0;
player->flashing = TICRATE/2;
player->ringboost = 0;
@ -13047,7 +13107,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else
player->rocketsneakertimer -= 3*TICRATE;
player->botvars.itemconfirm = 2*TICRATE;
player->overshield += TICRATE/2; // TEMP prototype
}
}
else if (player->itemamount == 0)
@ -13063,8 +13122,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
K_DoSneaker(player, 1);
K_PlayBoostTaunt(player->mo);
player->overshield += TICRATE/2; // TEMP prototype
player->sneakertimer += TICRATE; // TEMP prototype
player->itemamount--;
player->botvars.itemconfirm = 0;
}

View file

@ -80,7 +80,7 @@
static UINT32 K_DynamicItemOddsRace[NUMKARTRESULTS-1][2] =
{
// distance, duplication tolerance
{22, 14}, // sneaker
{20, 10}, // sneaker
{63, 12}, // rocketsneaker
{60, 19}, // invincibility
{8, 4}, // banana
@ -103,8 +103,8 @@ static UINT32 K_DynamicItemOddsRace[NUMKARTRESULTS-1][2] =
{1, 3}, // droptarget
{43, 5}, // gardentop
{0, 0}, // gachabom
{30, 14}, // dualsneaker
{42, 14}, // triplesneaker
{45, 6}, // dualsneaker
{55, 8}, // triplesneaker
{25, 2}, // triplebanana
{25, 1}, // tripleorbinaut
{35, 2}, // quadorbinaut

View file

@ -110,7 +110,7 @@ struct Side : Graphic
struct Toucher : Mobj
{
bool boosting() const { return player && (player->sneakertimer || K_PlayerCanPunt(player)); }
bool boosting() const { return player && (player->sneakertimer || player->panelsneakertimer || K_PlayerCanPunt(player)); }
};
struct AnyBox : Graphic

View file

@ -96,7 +96,7 @@ private:
{
const player_t* p = toucher->player;
if (p->sneakertimer || p->invincibilitytimer || p->growshrinktimer > 0 || p->hyudorotimer)
if (p->sneakertimer || p->panelsneakertimer || p->invincibilitytimer || p->growshrinktimer > 0 || p->hyudorotimer)
{
return;
}

View file

@ -851,7 +851,7 @@ static UINT8 GetUFODamage(mobj_t *inflictor, UINT8 damageType)
{
// Players deal damage relative to how many sneakers they used.
targetdamaging = UFOD_BOOST;
ret = 15 * max(1, inflictor->player->numsneakers);
ret = 15 * max(1, inflictor->player->numsneakers + inflictor->player->numpanelsneakers);
break;
}
case MT_SPECIAL_UFO:
@ -1010,6 +1010,8 @@ void Obj_PlayerUFOCollide(mobj_t *ufo, mobj_t *other)
Obj_SpecialUFODamage(ufo, other, other, DMG_STEAL);
other->player->sneakertimer = 0;
other->player->numsneakers = 0;
other->player->panelsneakertimer = 0;
other->player->numpanelsneakers = 0;
// Copied from Obj_OrbinautThrown
const ffloor_t *rover = P_IsObjectFlipped(other) ? other->ceilingrover : other->floorrover;

View file

@ -3245,6 +3245,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
player->sneakertimer = player->numsneakers = 0;
player->panelsneakertimer = player->numpanelsneakers = 0;
player->driftboost = player->strongdriftboost = 0;
player->gateBoost = 0;
player->fastfall = 0;

View file

@ -7823,9 +7823,10 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if (p)
{
if (p->sneakertimer > mobj->movecount)
UINT16 timer = max(p->sneakertimer, p->panelsneakertimer);
if (timer > mobj->movecount)
P_SetMobjState(mobj, S_BOOSTFLAME);
mobj->movecount = p->sneakertimer;
mobj->movecount = timer;
}
}

View file

@ -522,6 +522,9 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT16(save->p, players[i].sneakertimer);
WRITEUINT8(save->p, players[i].numsneakers);
WRITEUINT16(save->p, players[i].panelsneakertimer);
WRITEUINT8(save->p, players[i].numpanelsneakers);
WRITEUINT8(save->p, players[i].floorboost);
WRITEINT16(save->p, players[i].growshrinktimer);
@ -1137,6 +1140,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].sneakertimer = READUINT16(save->p);
players[i].numsneakers = READUINT8(save->p);
players[i].panelsneakertimer = READUINT16(save->p);
players[i].numpanelsneakers = READUINT8(save->p);
players[i].floorboost = READUINT8(save->p);
players[i].growshrinktimer = READINT16(save->p);

View file

@ -741,9 +741,9 @@ static inline void P_DeviceRumbleTick(void)
{
low = high = 65536 / 2;
}
else if (player->sneakertimer > (sneakertime-(TICRATE/2)))
else if (player->sneakertimer > (sneakertime-(TICRATE/2)) || player->panelsneakertimer > (sneakertime-(TICRATE/2)))
{
low = high = 65536 / (3+player->numsneakers);
low = high = 65536 / (3+player->numsneakers+player->numpanelsneakers);
}
else if (((player->boostpower < FRACUNIT) || (player->stairjank > 8))
&& P_IsObjectOnGround(player->mo) && player->speed != 0)

View file

@ -2612,7 +2612,7 @@ void P_MovePlayer(player_t *player)
////////////////////////////
// SRB2kart - Drifting smoke and fire
if ((player->sneakertimer || player->flamedash)
if ((player->sneakertimer || player->panelsneakertimer || player->flamedash)
&& onground && (leveltime & 1))
K_SpawnBoostTrail(player);