mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 20:22:40 +00:00
Rumble the jart when stepping on staircases
- Sprite tilts back and forth 5.625 degrees, two tics each side, for 17 tics (half a second). - Turning is ignored--as if in the air--every other tic during those 17 tics.
This commit is contained in:
parent
a77ed63c5f
commit
2b173f1ec0
7 changed files with 66 additions and 13 deletions
|
|
@ -708,6 +708,8 @@ typedef struct player_s
|
|||
|
||||
UINT8 kickstartaccel;
|
||||
|
||||
UINT8 stairjank;
|
||||
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1761,11 +1761,6 @@ static void K_SpawnBrakeDriftSparks(player_t *player) // Be sure to update the m
|
|||
sparks->renderflags |= RF_DONTDRAW;
|
||||
}
|
||||
|
||||
static fixed_t K_RandomFlip(fixed_t f)
|
||||
{
|
||||
return ( ( leveltime & 1 ) ? f : -f );
|
||||
}
|
||||
|
||||
void K_SpawnDriftBoostClip(player_t *player)
|
||||
{
|
||||
mobj_t *clip;
|
||||
|
|
@ -1790,7 +1785,7 @@ void K_SpawnDriftBoostClip(player_t *player)
|
|||
clip->momz += player->mo->momz;
|
||||
|
||||
P_InstaThrust(clip, player->mo->angle +
|
||||
K_RandomFlip(P_RandomRange(FRACUNIT/2, FRACUNIT)),
|
||||
P_RandomFlip(P_RandomRange(FRACUNIT/2, FRACUNIT)),
|
||||
FixedMul(scale, player->speed));
|
||||
}
|
||||
|
||||
|
|
|
|||
21
src/p_map.c
21
src/p_map.c
|
|
@ -2419,6 +2419,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
fixed_t radius = thing->radius;
|
||||
fixed_t thingtop;
|
||||
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||
fixed_t stairjank = 0;
|
||||
fixed_t stairstep = 0;
|
||||
floatok = false;
|
||||
|
||||
// reset this to 0 at the start of each trymove call as it's only used here
|
||||
|
|
@ -2490,6 +2492,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
|
||||
if (maxstep > 0)
|
||||
{
|
||||
const fixed_t minstep = maxstep / 8;
|
||||
|
||||
thingtop = thing->z + thing->height;
|
||||
|
||||
// Step up
|
||||
|
|
@ -2497,6 +2501,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
{
|
||||
if (tmfloorstep <= maxstep)
|
||||
{
|
||||
stairjank = thing->floordrop;
|
||||
stairstep = minstep;
|
||||
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->floorrover = tmfloorrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
|
|
@ -2510,6 +2517,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
{
|
||||
if (tmceilingstep <= maxstep)
|
||||
{
|
||||
stairjank = thing->ceilingdrop;
|
||||
stairstep = minstep;
|
||||
|
||||
thing->z = ( thing->ceilingz = tmceilingz ) - thing->height;
|
||||
thing->ceilingrover = tmceilingrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
|
|
@ -2526,6 +2536,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
|
||||
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
||||
{
|
||||
stairjank = thing->ceilingdrop;
|
||||
stairstep = minstep;
|
||||
|
||||
thing->z = (thing->ceilingz = tmceilingz) - thing->height;
|
||||
thing->ceilingrover = tmceilingrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
|
|
@ -2533,6 +2546,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
}
|
||||
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
||||
{
|
||||
stairjank = thing->floordrop;
|
||||
stairstep = minstep;
|
||||
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->floorrover = tmfloorrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
|
|
@ -2619,6 +2635,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
else // don't set standingslope if you're not going to clip against it
|
||||
thing->standingslope = NULL;
|
||||
|
||||
if (stairjank > stairstep && thing->player)
|
||||
{
|
||||
thing->player->stairjank = 17;
|
||||
}
|
||||
|
||||
thing->x = x;
|
||||
thing->y = y;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@
|
|||
|
||||
tic_t leveltime;
|
||||
|
||||
INT32 P_AltFlip(INT32 n, tic_t tics)
|
||||
{
|
||||
return leveltime % (2 * tics) < tics ? n : -(n);
|
||||
}
|
||||
|
||||
//
|
||||
// THINKERS
|
||||
// All thinkers should be allocated by Z_Calloc
|
||||
|
|
|
|||
|
|
@ -30,4 +30,8 @@ void P_DoTeamscrambling(void);
|
|||
void P_RemoveThinkerDelayed(thinker_t *thinker); //killed
|
||||
mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
|
||||
|
||||
// Negate the value for tics
|
||||
INT32 P_AltFlip(INT32 value, tic_t tics);
|
||||
#define P_RandomFlip(value) P_AltFlip(value, 1)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1869,6 +1869,9 @@ static void P_3dMovement(player_t *player)
|
|||
movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
||||
else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle
|
||||
movepushangle = (angle_t)player->kartstuff[k_boostangle];
|
||||
else if (player->stairjank && leveltime & 1)
|
||||
movepushangle = R_PointToAngle2(0, 0,
|
||||
player->mo->momx, player->mo->momy);
|
||||
else
|
||||
movepushangle = player->mo->angle;
|
||||
|
||||
|
|
@ -4749,6 +4752,11 @@ void P_PlayerThink(player_t *player)
|
|||
player->typing_duration = 0;
|
||||
}
|
||||
|
||||
if (player->stairjank > 0)
|
||||
{
|
||||
player->stairjank--;
|
||||
}
|
||||
|
||||
player->pflags &= ~PF_SLIDING;
|
||||
|
||||
K_KartPlayerThink(player, cmd); // SRB2kart
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "r_main.h" // R_PointToAngle
|
||||
#include "k_kart.h" // K_Sliptiding
|
||||
#include "p_tick.h"
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
fixed_t rollcosang[ROTANGLES];
|
||||
|
|
@ -32,16 +33,14 @@ angle_t R_GetPitchRollAngle(mobj_t *mobj)
|
|||
return rollOrPitch;
|
||||
}
|
||||
|
||||
angle_t R_SpriteRotationAngle(mobj_t *mobj)
|
||||
static angle_t R_PlayerSpriteRotation(player_t *player)
|
||||
{
|
||||
angle_t viewingAngle = R_PointToAngle(mobj->x, mobj->y);
|
||||
angle_t angleDelta = (viewingAngle - mobj->angle);
|
||||
angle_t viewingAngle = R_PointToAngle(player->mo->x, player->mo->y);
|
||||
angle_t angleDelta = (viewingAngle - player->mo->angle);
|
||||
|
||||
angle_t sliptideLift = mobj->player
|
||||
? mobj->player->aizDriftTilt : 0;
|
||||
angle_t sliptideLift = player->aizDriftTilt;
|
||||
|
||||
angle_t rollOrPitch = R_GetPitchRollAngle(mobj);
|
||||
angle_t rollAngle = (rollOrPitch + mobj->rollangle);
|
||||
angle_t rollAngle = 0;
|
||||
|
||||
if (sliptideLift)
|
||||
{
|
||||
|
|
@ -52,6 +51,25 @@ angle_t R_SpriteRotationAngle(mobj_t *mobj)
|
|||
FixedMul(sliptideLift, FINECOSINE(angleDelta >> ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
if (player->stairjank)
|
||||
{
|
||||
rollAngle += P_AltFlip(ANGLE_11hh / 2 /
|
||||
(17 / player->stairjank), 2);
|
||||
}
|
||||
|
||||
return rollAngle;
|
||||
}
|
||||
|
||||
angle_t R_SpriteRotationAngle(mobj_t *mobj)
|
||||
{
|
||||
angle_t rollOrPitch = R_GetPitchRollAngle(mobj);
|
||||
angle_t rollAngle = (rollOrPitch + mobj->rollangle);
|
||||
|
||||
if (mobj->player)
|
||||
{
|
||||
rollAngle += R_PlayerSpriteRotation(mobj->player);
|
||||
}
|
||||
|
||||
return rollAngle;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue