Merge branch 'bubble-pop' into 'master'

Shield fixups

See merge request KartKrew/Kart!2338
This commit is contained in:
Oni 2024-05-02 05:27:40 +00:00
commit 1c6d6be426
6 changed files with 49 additions and 4 deletions

View file

@ -747,6 +747,7 @@ struct player_t
UINT8 tripwireState; // see tripwirestate_t
UINT8 tripwirePass; // see tripwirepass_t
UINT16 tripwireLeniency; // When reaching a state that lets you go thru tripwire, you get an extra second leniency after it ends to still go through it.
UINT8 fakeBoost; // Some items need to grant tripwire pass briefly, even when their effect is thrust/instathrust. This is a fake boost type to control that.
itemroulette_t itemRoulette; // Item roulette data

View file

@ -72,7 +72,7 @@ void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage)
Return:-
N/A
--------------------------------------------------*/
static void K_SpawnSingleHitLagSpark(
void K_SpawnSingleHitLagSpark(
mobj_t *parent,
vector3_t *offset, fixed_t scale,
UINT8 tics, UINT8 pause,

View file

@ -60,6 +60,7 @@ void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage);
--------------------------------------------------*/
void K_SetHitLagForObjects(mobj_t *victim, mobj_t *inflictor, mobj_t *source, INT32 tics, boolean fromDamage);
void K_SpawnSingleHitLagSpark(mobj_t *parent, vector3_t *offset, fixed_t scale, UINT8 tics, UINT8 pause, skincolornum_t color);
#ifdef __cplusplus

View file

@ -3004,7 +3004,8 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player)
if (
player->flamedash ||
((player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0)
((player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0) ||
player->fakeBoost
)
return TRIPWIRE_BOOST;
@ -4882,6 +4883,8 @@ void K_ApplyTripWire(player_t *player, tripwirestate_t state)
{
S_StartSound(player->mo, sfx_kc40);
player->tripwireReboundDelay = 60;
if (player->curshield == KSHIELD_BUBBLE)
player->tripwireReboundDelay *= 2;
}
player->tripwireState = state;
@ -9118,6 +9121,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->hyudorotimer)
player->hyudorotimer--;
if (player->fakeBoost)
player->fakeBoost--;
if (player->bumperinflate && player->mo->hitlag == 0)
{
fixed_t thrustdelta = MAXCOMBOTHRUST - MINCOMBOTHRUST;
@ -12002,6 +12008,33 @@ boolean K_FastFallBounce(player_t *player)
player->ignoreAirtimeLeniency = max(player->ignoreAirtimeLeniency, TICRATE);
bounce += 3 * mapobjectscale;
UINT8 i;
UINT8 numplayers = 0;
if (gametyperules & GTR_CIRCUIT)
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && !players[i].spectator)
numplayers++;
}
}
else
{
numplayers = 1; // solo behavior
}
if (player->position == 1 && player->positiondelay <= 0 && numplayers != 1)
{
S_StartSound(player->mo, sfx_kc31);
K_StripItems(player);
K_AddHitLag(player->mo, 4, false);
vector3_t offset = { 0, 0, 0 };
K_SpawnSingleHitLagSpark(player->mo, &offset, player->mo->scale*2, 4, 0, player->skincolor);
}
if (player->tripwireReboundDelay)
bounce /= 2;
}
else
{
@ -13114,9 +13147,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->throwdir == -1)
{
P_InstaThrust(player->mo, player->mo->angle, player->speed + (80 * mapobjectscale));
player->wavedashboost += TICRATE; // Just for keeping speed briefly vs. tripwire etc.
player->wavedashboost += TICRATE;
player->wavedashpower = FRACUNIT;
// If this doesn't turn out to be reliable, I'll change it to directly set leniency or something.
player->fakeBoost = TICRATE/2;
}
K_PlayAttackTaunt(player->mo);
player->bubbleblowup = 0;
@ -13196,6 +13229,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo, player->mo->angle,
FixedMul((50*player->mo->scale), K_GetKartGameSpeedScalar(gamespeed))
);
player->wavedashboost += TICRATE;
player->wavedashpower = FRACUNIT;
player->fakeBoost = TICRATE/3;
S_StopSoundByID(player->mo, sfx_fshld1);
S_StopSoundByID(player->mo, sfx_fshld0);

View file

@ -344,6 +344,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->tripwireState);
else if (fastcmp(field,"tripwirepass"))
lua_pushinteger(L, plr->tripwirePass);
else if (fastcmp(field,"fakeboost"))
lua_pushinteger(L, plr->fakeBoost);
else if (fastcmp(field,"tripwireleniency"))
lua_pushinteger(L, plr->tripwireLeniency);
else if (fastcmp(field,"tripwirerebounddelay"))
@ -898,6 +900,8 @@ static int player_set(lua_State *L)
plr->tripwireState = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwirepass"))
plr->tripwirePass = luaL_checkinteger(L, 3);
else if (fastcmp(field,"fakeboost"))
plr->fakeBoost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireleniency"))
plr->tripwireLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwirerebounddelay"))

View file

@ -484,6 +484,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].tripwireState);
WRITEUINT8(save->p, players[i].tripwirePass);
WRITEUINT16(save->p, players[i].tripwireLeniency);
WRITEUINT8(save->p, players[i].fakeBoost);
WRITESINT8(save->p, players[i].itemtype);
WRITEUINT8(save->p, players[i].itemamount);
@ -1084,6 +1085,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].tripwireState = READUINT8(save->p);
players[i].tripwirePass = READUINT8(save->p);
players[i].tripwireLeniency = READUINT16(save->p);
players[i].fakeBoost = READUINT8(save->p);
players[i].itemtype = READSINT8(save->p);
players[i].itemamount = READUINT8(save->p);