mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add TRICKSTATE_ constants
Replaces the magic numpers <-- typo I have left in for posterity
This commit is contained in:
parent
6f22c5261e
commit
239388a1fa
8 changed files with 51 additions and 37 deletions
|
|
@ -261,6 +261,16 @@ typedef enum
|
|||
TRIPWIRE_BLASTER,
|
||||
} tripwirepass_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TRICKSTATE_NONE = 0,
|
||||
TRICKSTATE_READY,
|
||||
TRICKSTATE_FORWARD,
|
||||
TRICKSTATE_RIGHT,
|
||||
TRICKSTATE_LEFT,
|
||||
TRICKSTATE_BACK,
|
||||
} trickstate_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Unsynced, HUD or clientsided effects
|
||||
|
|
@ -740,7 +750,7 @@ struct player_t
|
|||
UINT8 confirmVictim; // Player ID that you dealt damage to
|
||||
UINT8 confirmVictimDelay; // Delay before playing the sound
|
||||
|
||||
UINT8 trickpanel; // Trick panel state
|
||||
UINT8 trickpanel; // Trick panel state - see trickstate_t
|
||||
UINT8 tricktime; // Increases while you're tricking. You can't input any trick until it's reached a certain threshold
|
||||
fixed_t trickboostpower; // Save the rough speed multiplier. Used for upwards tricks.
|
||||
UINT8 trickboostdecay; // used to know how long you've waited
|
||||
|
|
|
|||
|
|
@ -1109,7 +1109,7 @@ static void K_BotTrick(player_t *player, ticcmd_t *cmd, const botcontroller_t *b
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->trickpanel == 1)
|
||||
if (player->trickpanel == TRICKSTATE_READY)
|
||||
{
|
||||
switch (botController->trick)
|
||||
{
|
||||
|
|
@ -1521,7 +1521,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
// Actual gameplay behaviors below this block!
|
||||
const botcontroller_t *botController = K_GetBotController(player->mo);
|
||||
if (player->trickpanel != 0)
|
||||
if (player->trickpanel != TRICKSTATE_NONE)
|
||||
{
|
||||
K_BotTrick(player, cmd, botController);
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ private:
|
|||
|
||||
bool can_change() const
|
||||
{
|
||||
if (viewplayer()->trickpanel > 0)
|
||||
if (viewplayer()->trickpanel != TRICKSTATE_NONE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
43
src/k_kart.c
43
src/k_kart.c
|
|
@ -4379,7 +4379,7 @@ void K_UpdateTrickIndicator(player_t *player)
|
|||
player->mo->z + (player->mo->height / 2));
|
||||
mobj->angle = player->mo->angle + ANGLE_90;
|
||||
|
||||
if (player->trickpanel == 0
|
||||
if (player->trickpanel == TRICKSTATE_NONE
|
||||
&& test != S_INVISIBLE)
|
||||
{
|
||||
K_TrickCatholocismBlast(mobj, 1, ANGLE_22h);
|
||||
|
|
@ -6366,7 +6366,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
|
|||
{
|
||||
if (!P_PlayerInPain(mo->player))
|
||||
{
|
||||
mo->player->trickpanel = 1;
|
||||
mo->player->trickpanel = TRICKSTATE_READY;
|
||||
mo->player->pflags |= PF_TRICKDELAY;
|
||||
|
||||
if (P_MobjWasRemoved(mo->player->trickIndicator) == false)
|
||||
|
|
@ -8674,11 +8674,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
K_FlameDashLeftoverSmoke(player->mo);
|
||||
}
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) && player->trickpanel != 0)
|
||||
if (P_IsObjectOnGround(player->mo) && player->trickpanel != TRICKSTATE_NONE)
|
||||
{
|
||||
if (P_MobjFlip(player->mo) * player->mo->momz <= 0)
|
||||
{
|
||||
player->trickpanel = 0;
|
||||
player->trickpanel = TRICKSTATE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9589,7 +9589,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (player->trickpanel == 1 || player->trickpanel == 5)
|
||||
if (player->trickpanel == TRICKSTATE_READY || player->trickpanel == TRICKSTATE_FORWARD)
|
||||
{
|
||||
// Forward trick or rising from trickpanel
|
||||
return 0;
|
||||
|
|
@ -9688,7 +9688,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||
turnfixed = FixedMul(turnfixed, weightadjust);
|
||||
|
||||
// Side trick
|
||||
if (player->trickpanel == 2 || player->trickpanel == 3)
|
||||
if (player->trickpanel == TRICKSTATE_LEFT || player->trickpanel == TRICKSTATE_RIGHT)
|
||||
{
|
||||
turnfixed /= 2;
|
||||
}
|
||||
|
|
@ -11140,7 +11140,7 @@ static void K_trickPanelTimingVisual(player_t *player, fixed_t momz)
|
|||
flame->sprite = SPR_TRCK;
|
||||
flame->frame = i|FF_FULLBRIGHT;
|
||||
|
||||
if (player->trickpanel <= 1 && !player->tumbleBounces)
|
||||
if (player->trickpanel <= TRICKSTATE_READY && !player->tumbleBounces)
|
||||
{
|
||||
flame->tics = 2;
|
||||
flame->momx = player->mo->momx;
|
||||
|
|
@ -11151,7 +11151,7 @@ static void K_trickPanelTimingVisual(player_t *player, fixed_t momz)
|
|||
{
|
||||
flame->tics = TICRATE;
|
||||
|
||||
if (player->trickpanel > 1) // we tricked
|
||||
if (player->trickpanel > TRICKSTATE_READY) // we tricked
|
||||
{
|
||||
// Send the thing outwards via ghetto maths which involves redoing the whole 3d sphere again, witht the "vertical" angle shifted by 90 degrees.
|
||||
// There's probably a simplier way to do this the way I want to but this works.
|
||||
|
|
@ -12015,7 +12015,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
}
|
||||
break;
|
||||
case KITEM_POGOSPRING:
|
||||
if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO && player->trickpanel == 0)
|
||||
if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO && player->trickpanel == TRICKSTATE_NONE)
|
||||
{
|
||||
K_PlayBoostTaunt(player->mo);
|
||||
//K_DoPogoSpring(player->mo, 32<<FRACBITS, 2);
|
||||
|
|
@ -12126,7 +12126,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->mo->renderflags &= ~RF_BLENDMASK;
|
||||
}
|
||||
|
||||
if (player->trickpanel == 1)
|
||||
if (player->trickpanel == TRICKSTATE_READY)
|
||||
{
|
||||
const angle_t lr = ANGLE_45;
|
||||
fixed_t momz = FixedDiv(player->mo->momz, mapobjectscale); // bring momz back to scale...
|
||||
|
|
@ -12194,7 +12194,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->tumbleBounces = 1;
|
||||
player->pflags &= ~PF_TUMBLESOUND;
|
||||
player->tumbleHeight = 30; // Base tumble bounce height
|
||||
player->trickpanel = 0;
|
||||
player->trickpanel = TRICKSTATE_NONE;
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
||||
if (player->pflags & (PF_ITEMOUT|PF_EGGMANOUT))
|
||||
{
|
||||
|
|
@ -12222,7 +12222,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
if (cmd->turning > 0)
|
||||
{
|
||||
P_InstaThrust(player->mo, player->mo->angle + lr, max(basespeed, speed*5/2));
|
||||
player->trickpanel = 2;
|
||||
player->trickpanel = TRICKSTATE_RIGHT;
|
||||
|
||||
if (P_MobjWasRemoved(player->trickIndicator) == false)
|
||||
{
|
||||
|
|
@ -12235,7 +12235,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
else
|
||||
{
|
||||
P_InstaThrust(player->mo, player->mo->angle - lr, max(basespeed, speed*5/2));
|
||||
player->trickpanel = 3;
|
||||
player->trickpanel = TRICKSTATE_LEFT;
|
||||
|
||||
if (P_MobjWasRemoved(player->trickIndicator) == false)
|
||||
{
|
||||
|
|
@ -12261,7 +12261,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
}
|
||||
|
||||
P_InstaThrust(player->mo, player->mo->angle, max(basespeed, speed*3));
|
||||
player->trickpanel = 5;
|
||||
player->trickpanel = TRICKSTATE_FORWARD;
|
||||
|
||||
if (P_MobjWasRemoved(player->trickIndicator) == false)
|
||||
{
|
||||
|
|
@ -12287,7 +12287,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
//CONS_Printf("decay: %d\n", player->trickboostdecay);
|
||||
|
||||
player->mo->momz += P_MobjFlip(player->mo)*48*mapobjectscale;
|
||||
player->trickpanel = 4;
|
||||
player->trickpanel = TRICKSTATE_BACK;
|
||||
|
||||
if (P_MobjWasRemoved(player->trickIndicator) == false)
|
||||
{
|
||||
|
|
@ -12303,7 +12303,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
#undef TRICKTHRESHOLD
|
||||
|
||||
// Finalise everything.
|
||||
if (player->trickpanel != 1) // just changed from 1?
|
||||
if (player->trickpanel != TRICKSTATE_READY) // just changed from 1?
|
||||
{
|
||||
player->mo->hitlag = TRICKLAG;
|
||||
player->mo->eflags &= ~MFE_DAMAGEHITLAG;
|
||||
|
|
@ -12315,13 +12315,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|
||||
INT32 j;
|
||||
|
||||
if (player->trickpanel == 5)
|
||||
if (player->trickpanel == TRICKSTATE_FORWARD)
|
||||
; // Not yet sprited
|
||||
else for (j = 0; j < 8; j++, baseangle += angledelta)
|
||||
{
|
||||
mobj_t *swipe = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_SIDETRICK);
|
||||
|
||||
if (player->trickpanel == 4)
|
||||
if (player->trickpanel == TRICKSTATE_BACK)
|
||||
P_SetMobjState(swipe, S_BACKTRICK);
|
||||
|
||||
P_SetTarget(&swipe->target, player->mo);
|
||||
|
|
@ -12364,7 +12364,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|
||||
K_trickPanelTimingVisual(player, momz);
|
||||
}
|
||||
else if (player->trickpanel && P_IsObjectOnGround(player->mo)) // Landed from trick
|
||||
else if ((player->trickpanel != TRICKSTATE_NONE) && P_IsObjectOnGround(player->mo)) // Landed from trick
|
||||
{
|
||||
if (player->fastfall)
|
||||
{
|
||||
|
|
@ -12375,7 +12375,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->fastfall = 0; // intentionally skip bounce
|
||||
}
|
||||
|
||||
if (player->trickpanel == 4) // upward trick
|
||||
if (player->trickpanel == TRICKSTATE_BACK) // upward trick
|
||||
{
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
K_SpawnDashDustRelease(player);
|
||||
|
|
@ -12385,7 +12385,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->sliptideZip += 300;
|
||||
player->sliptideZipDelay = 0;
|
||||
|
||||
player->trickpanel = player->trickboostdecay = 0;
|
||||
player->trickpanel = TRICKSTATE_NONE;
|
||||
player->trickboostdecay = 0;
|
||||
}
|
||||
|
||||
// Wait until we let go off the control stick to remove the delay
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ void K_ProcessTerrainEffect(mobj_t *mo)
|
|||
P_InstaThrust(player->mo, thrustAngle, max(thrustSpeed, 2*playerSpeed));
|
||||
|
||||
player->dashpadcooldown = TICRATE/3;
|
||||
player->trickpanel = 0;
|
||||
player->trickpanel = TRICKSTATE_NONE;
|
||||
player->floorboost = 2;
|
||||
|
||||
S_StartSound(player->mo, sfx_cdfm62);
|
||||
|
|
|
|||
|
|
@ -1692,7 +1692,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
target->player->roundscore = 0;
|
||||
}
|
||||
|
||||
target->player->trickpanel = 0;
|
||||
target->player->trickpanel = TRICKSTATE_NONE;
|
||||
|
||||
ACS_RunPlayerDeathScript(target->player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1147,7 +1147,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
|
|||
P_PlayerFlip(mo);
|
||||
}
|
||||
|
||||
if (mo->player->trickpanel >= 2)
|
||||
if (mo->player->trickpanel > TRICKSTATE_READY)
|
||||
{
|
||||
gravityadd = (5*gravityadd)/2;
|
||||
}
|
||||
|
|
@ -8454,7 +8454,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
if (!mobj->target
|
||||
|| !mobj->target->health
|
||||
|| !mobj->target->player
|
||||
|| mobj->target->player->trickpanel <= 1)
|
||||
|| mobj->target->player->trickpanel <= TRICKSTATE_FORWARD)
|
||||
{
|
||||
P_RemoveMobj(mobj);
|
||||
return false;
|
||||
|
|
@ -8477,7 +8477,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
fixed_t scale = mobj->target->scale;
|
||||
|
||||
// sweeping effect
|
||||
if (mobj->target->player->trickpanel == 4)
|
||||
if (mobj->target->player->trickpanel == TRICKSTATE_BACK)
|
||||
{
|
||||
const fixed_t saferange = (20*FRACUNIT)/21;
|
||||
if (mobj->threshold < -saferange)
|
||||
|
|
|
|||
17
src/p_user.c
17
src/p_user.c
|
|
@ -478,7 +478,7 @@ void P_ResetPlayer(player_t *player)
|
|||
player->onconveyor = 0;
|
||||
|
||||
//player->drift = player->driftcharge = 0;
|
||||
player->trickpanel = 0;
|
||||
player->trickpanel = TRICKSTATE_NONE;
|
||||
player->glanceDir = 0;
|
||||
player->fastfall = 0;
|
||||
|
||||
|
|
@ -2467,13 +2467,16 @@ void P_MovePlayer(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (player->trickpanel == 2 || player->trickpanel == 5) // right/forward
|
||||
if (player->trickpanel > TRICKSTATE_READY)
|
||||
{
|
||||
player->drawangle += ANGLE_22h;
|
||||
}
|
||||
else if (player->trickpanel == 3 || player->trickpanel == 4) // left/back
|
||||
{
|
||||
player->drawangle -= ANGLE_22h;
|
||||
if (player->trickpanel <= TRICKSTATE_RIGHT) // right/forward
|
||||
{
|
||||
player->drawangle += ANGLE_22h;
|
||||
}
|
||||
else //if (player->trickpanel >= TRICKSTATE_LEFT) // left/back
|
||||
{
|
||||
player->drawangle -= ANGLE_22h;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue