mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-16 17:51:27 +00:00
Spinout type is now passed through K_SpinPlayer
This means we don't have to reset spinouttype's value immediately after using it, which means no more wipeout timer garbage.
This commit is contained in:
parent
ab64504213
commit
18b3d2d14c
7 changed files with 27 additions and 31 deletions
18
src/k_kart.c
18
src/k_kart.c
|
@ -1425,7 +1425,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
|
|||
return finalspeed;
|
||||
}
|
||||
|
||||
void K_SpinPlayer(player_t *player, mobj_t *source)
|
||||
void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type)
|
||||
{
|
||||
if (player->health <= 0)
|
||||
return;
|
||||
|
@ -1464,6 +1464,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source)
|
|||
|
||||
player->kartstuff[k_comebacktimer] = comebacktime;
|
||||
|
||||
player->kartstuff[k_spinouttype] = type;
|
||||
|
||||
if (player->kartstuff[k_spinouttype] <= 0)
|
||||
{
|
||||
player->kartstuff[k_spinouttimer] = 3*TICRATE/2; // Banana Spinout
|
||||
|
@ -1482,8 +1484,6 @@ void K_SpinPlayer(player_t *player, mobj_t *source)
|
|||
if (player->mo->state != &states[S_KART_SPIN])
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
|
||||
|
||||
player->kartstuff[k_spinouttype] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
|
|||
|
||||
player->kartstuff[k_comebacktimer] = comebacktime;
|
||||
|
||||
player->kartstuff[k_squishedtimer] = TICRATE;
|
||||
player->kartstuff[k_squishedtimer] = 2*TICRATE;
|
||||
|
||||
player->powers[pw_flashing] = K_GetKartFlashing();
|
||||
|
||||
|
@ -1584,8 +1584,6 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
|
|||
if (player->mo->state != &states[S_KART_SPIN])
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
|
||||
|
||||
player->kartstuff[k_spinouttype] = 0;
|
||||
|
||||
P_PlayRinglossSound(player->mo);
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
|
@ -2483,9 +2481,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->mo->colorized = false;
|
||||
}
|
||||
|
||||
if (player->kartstuff[k_spinouttimer]
|
||||
&& (P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype] == 1))
|
||||
if (player->kartstuff[k_spinouttimer])
|
||||
{
|
||||
if (P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype] == 1)
|
||||
player->kartstuff[k_spinouttimer]--;
|
||||
if (player->kartstuff[k_spinouttimer] == 0)
|
||||
player->kartstuff[k_spinouttype] = 0; // Reset type
|
||||
}
|
||||
else if (!comeback)
|
||||
player->kartstuff[k_comebacktimer] = comebacktime;
|
||||
else if (player->kartstuff[k_comebacktimer])
|
||||
|
|
|
@ -24,7 +24,7 @@ void K_RespawnChecker(player_t *player);
|
|||
void K_KartMoveAnimation(player_t *player);
|
||||
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
||||
void K_KartPlayerAfterThink(player_t *player);
|
||||
void K_SpinPlayer(player_t *player, mobj_t *source);
|
||||
void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type);
|
||||
void K_SquishPlayer(player_t *player, mobj_t *source);
|
||||
void K_ExplodePlayer(player_t *player, mobj_t *source);
|
||||
void K_StealBalloon(player_t *player, player_t *victim, boolean force);
|
||||
|
|
|
@ -2012,12 +2012,13 @@ static int lib_kSpinPlayer(lua_State *L)
|
|||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
INT32 type = (INT32)luaL_checkinteger(L, 3);
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
K_SpinPlayer(player, source);
|
||||
K_SpinPlayer(player, source, type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3189,16 +3189,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
// Don't flip out while super!
|
||||
if (!player->kartstuff[k_invincibilitytimer] && player->kartstuff[k_growshrinktimer] <= 0)
|
||||
{
|
||||
// Start slipping!
|
||||
K_SpinPlayer(player, source);
|
||||
|
||||
// Start shrinking!
|
||||
player->mo->scalespeed = FRACUNIT/TICRATE;
|
||||
player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
|
||||
|
||||
// Wipeout
|
||||
player->kartstuff[k_spinouttype] = 1;
|
||||
K_SpinPlayer(player, source);
|
||||
K_SpinPlayer(player, source, 1);
|
||||
damage = player->mo->health - 1;
|
||||
P_RingDamage(player, inflictor, source, damage);
|
||||
P_PlayerRingBurst(player, 5);
|
||||
|
@ -3268,8 +3264,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
|| inflictor->player))
|
||||
{
|
||||
player->kartstuff[k_sneakertimer] = 0;
|
||||
player->kartstuff[k_spinouttype] = 1;
|
||||
K_SpinPlayer(player, source);
|
||||
K_SpinPlayer(player, source, 1);
|
||||
damage = player->mo->health - 1;
|
||||
P_RingDamage(player, inflictor, source, damage);
|
||||
P_PlayerRingBurst(player, 5);
|
||||
|
@ -3282,8 +3277,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
}
|
||||
else
|
||||
{
|
||||
player->kartstuff[k_spinouttype] = -1;
|
||||
K_SpinPlayer(player, source);
|
||||
K_SpinPlayer(player, source, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
16
src/p_map.c
16
src/p_map.c
|
@ -844,7 +844,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (tmthing->state == &states[S_MINEEXPLOSION1])
|
||||
K_ExplodePlayer(thing->player, tmthing->target);
|
||||
else
|
||||
K_SpinPlayer(thing->player, tmthing->target);
|
||||
K_SpinPlayer(thing->player, tmthing->target, 0);
|
||||
}
|
||||
|
||||
return true; // This doesn't collide with anything, but we want it to effect the player anyway.
|
||||
|
@ -877,7 +877,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->type == MT_PLAYER)
|
||||
{
|
||||
// Player Damage
|
||||
K_SpinPlayer(thing->player, tmthing->target);
|
||||
K_SpinPlayer(thing->player, tmthing->target, 0);
|
||||
|
||||
// This Item Damage
|
||||
if (tmthing->eflags & MFE_VERTICALFLIP)
|
||||
|
@ -1140,7 +1140,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
return true;
|
||||
|
||||
// Player Damage
|
||||
K_SpinPlayer(tmthing->player, thing->target);
|
||||
K_SpinPlayer(tmthing->player, thing->target, 0);
|
||||
|
||||
// Other Item Damage
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
|
@ -1170,7 +1170,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->state == &states[S_MINEEXPLOSION1])
|
||||
K_ExplodePlayer(tmthing->player, thing->target);
|
||||
else
|
||||
K_SpinPlayer(tmthing->player, thing->target);
|
||||
K_SpinPlayer(tmthing->player, thing->target, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1648,7 +1648,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring])
|
||||
{
|
||||
K_StealBalloon(tmthing->player, thing->player, false);
|
||||
K_SpinPlayer(thing->player, tmthing);
|
||||
K_SpinPlayer(thing->player, tmthing, 0);
|
||||
}
|
||||
}
|
||||
else if (P_IsObjectOnGround(tmthing) && thing->momz < 0)
|
||||
|
@ -1657,7 +1657,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (G_BattleGametype() && thing->player->kartstuff[k_pogospring])
|
||||
{
|
||||
K_StealBalloon(thing->player, tmthing->player, false);
|
||||
K_SpinPlayer(tmthing->player, thing);
|
||||
K_SpinPlayer(tmthing->player, thing, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1668,12 +1668,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]))
|
||||
{
|
||||
K_StealBalloon(thing->player, tmthing->player, false);
|
||||
K_SpinPlayer(tmthing->player, thing);
|
||||
K_SpinPlayer(tmthing->player, thing, 0);
|
||||
}
|
||||
else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer]))
|
||||
{
|
||||
K_StealBalloon(tmthing->player, thing->player, false);
|
||||
K_SpinPlayer(thing->player, tmthing);
|
||||
K_SpinPlayer(thing->player, tmthing, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3983,8 +3983,7 @@ DoneSection2:
|
|||
case 7: // SRB2kart 190117 - Oil Slick
|
||||
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
|
||||
{
|
||||
player->kartstuff[k_spinouttype] = -1;
|
||||
K_SpinPlayer(player, NULL);
|
||||
K_SpinPlayer(player, NULL, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -7675,7 +7675,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
|
|||
continue;
|
||||
|
||||
if (mo->type == MT_PLAYER) // Players wipe out in Kart
|
||||
K_SpinPlayer(mo->player, source);
|
||||
K_SpinPlayer(mo->player, source, 0);
|
||||
//}
|
||||
else
|
||||
P_DamageMobj(mo, inflictor, source, 1000);
|
||||
|
|
Loading…
Reference in a new issue