Stair janking VFX

Little sparks spawn on one side of your jart while
stepping, plays for 4 frames on each side.
Loops if 10 tics of the janking animation remain.
This commit is contained in:
James R 2021-04-11 18:54:29 -07:00
parent 7badb5d925
commit 3f09cd4f2b
9 changed files with 83 additions and 4 deletions

View file

@ -4650,6 +4650,12 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_DEBTSPIKEC", "S_DEBTSPIKEC",
"S_DEBTSPIKED", "S_DEBTSPIKED",
"S_DEBTSPIKEE", "S_DEBTSPIKEE",
// Sparks when driving on stairs
"S_JANKSPARK1",
"S_JANKSPARK2",
"S_JANKSPARK3",
"S_JANKSPARK4",
}; };
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
@ -5451,6 +5457,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
"MT_DRIFTSPARK", "MT_DRIFTSPARK",
"MT_BRAKEDRIFT", "MT_BRAKEDRIFT",
"MT_DRIFTDUST", "MT_DRIFTDUST",
"MT_JANKSPARK",
"MT_ROCKETSNEAKER", // Rocket sneakers "MT_ROCKETSNEAKER", // Rocket sneakers

View file

@ -541,6 +541,7 @@ char sprnames[NUMSPRITES + 1][5] =
"DRIF", // Drift Sparks "DRIF", // Drift Sparks
"BDRF", // Brake drift sparks "BDRF", // Brake drift sparks
"DRWS", // Drift dust sparks "DRWS", // Drift dust sparks
"JANK", // Stair janking sparks
// Kart Items // Kart Items
"RSHE", // Rocket sneaker "RSHE", // Rocket sneaker
@ -5227,6 +5228,12 @@ state_t states[NUMSTATES] =
{SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKED}, // S_DEBTSPIKEC {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKED}, // S_DEBTSPIKEC
{SPR_DEBT, 6|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEE}, // S_DEBTSPIKED {SPR_DEBT, 6|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEE}, // S_DEBTSPIKED
{SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE1}, // S_DEBTSPIKEE {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE1}, // S_DEBTSPIKEE
// Sparks when driving on stairs
{SPR_JANK, 0, 1, {NULL}, 0, 0, S_JANKSPARK2}, // S_JANKSPARK1
{SPR_JANK, FF_PAPERSPRITE|FF_FULLBRIGHT|FF_ANIMATE, 4, {NULL}, 3, 1, S_JANKSPARK3}, // S_JANKSPARK2
{SPR_JANK, 0, 0, {A_SetCustomValue}, -1, 5, S_JANKSPARK4}, // S_JANKSPARK3
{SPR_JANK, 0, 0, {A_ChangeAngleRelative}, 180, 180, S_JANKSPARK2}, // S_JANKSPARK4
}; };
mobjinfo_t mobjinfo[NUMMOBJTYPES] = mobjinfo_t mobjinfo[NUMMOBJTYPES] =
@ -23473,6 +23480,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
{ // MT_JANKSPARK
-1, // doomednum
S_JANKSPARK1, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
8, // speed
8*FRACUNIT, // radius
8*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_FLOAT|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
{ // MT_ROCKETSNEAKER { // MT_ROCKETSNEAKER
-1, // doomednum -1, // doomednum
S_ROCKETSNEAKER_L, // spawnstate S_ROCKETSNEAKER_L, // spawnstate

View file

@ -1093,6 +1093,7 @@ typedef enum sprite
SPR_DRIF, // Drift Sparks SPR_DRIF, // Drift Sparks
SPR_BDRF, // Brake drift sparks SPR_BDRF, // Brake drift sparks
SPR_DRWS, // Drift dust sparks SPR_DRWS, // Drift dust sparks
SPR_JANK, // Stair janking sparks
// Kart Items // Kart Items
SPR_RSHE, // Rocket sneaker SPR_RSHE, // Rocket sneaker
@ -5642,6 +5643,11 @@ typedef enum state
S_DEBTSPIKED, S_DEBTSPIKED,
S_DEBTSPIKEE, S_DEBTSPIKEE,
S_JANKSPARK1,
S_JANKSPARK2,
S_JANKSPARK3,
S_JANKSPARK4,
S_FIRSTFREESLOT, S_FIRSTFREESLOT,
S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1,
NUMSTATES NUMSTATES
@ -6462,6 +6468,7 @@ typedef enum mobj_type
MT_DRIFTSPARK, MT_DRIFTSPARK,
MT_BRAKEDRIFT, MT_BRAKEDRIFT,
MT_DRIFTDUST, MT_DRIFTDUST,
MT_JANKSPARK,
MT_ROCKETSNEAKER, MT_ROCKETSNEAKER,

View file

@ -7679,6 +7679,11 @@ SINT8 K_Sliptiding(player_t *player)
return p[k_drift] ? 0 : p[k_aizdriftstrat]; return p[k_drift] ? 0 : p[k_aizdriftstrat];
} }
INT32 K_StairJankFlip(INT32 value)
{
return P_AltFlip(value, 2);
}
static void K_KartSpindashDust(mobj_t *parent) static void K_KartSpindashDust(mobj_t *parent)
{ {
fixed_t rad = FixedDiv(FixedHypot(parent->radius, parent->radius), parent->scale); fixed_t rad = FixedDiv(FixedHypot(parent->radius, parent->radius), parent->scale);

View file

@ -85,6 +85,7 @@ boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
void K_UpdateSteeringValue(player_t *player, INT16 destSteering); void K_UpdateSteeringValue(player_t *player, INT16 destSteering);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue); INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
INT32 K_GetKartDriftSparkValue(player_t *player); INT32 K_GetKartDriftSparkValue(player_t *player);
INT32 K_StairJankFlip(INT32 value);
void K_SpawnDriftBoostExplosion(player_t *player, int stage); void K_SpawnDriftBoostExplosion(player_t *player, int stage);
void K_KartUpdatePosition(player_t *player); void K_KartUpdatePosition(player_t *player);
mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount); mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount);

View file

@ -2638,9 +2638,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (stairjank > stairstep && thing->player) if (stairjank > stairstep && thing->player)
{ {
/* use a shorter sound if not two tics have passed /* use a shorter sound if not two tics have passed
* since the last step */ * since the last step */
S_StartSound(thing, thing->player->stairjank S_StartSound(thing, thing->player->stairjank
>= 16 ? sfx_s23b : sfx_s268); >= 16 ? sfx_s23b : sfx_s268);
if (!thing->player->stairjank)
{
mobj_t * spark = P_SpawnMobjFromMobj(thing,
0, 0, 0, MT_JANKSPARK);
spark->fuse = 9;
spark->cusval = K_StairJankFlip(ANGLE_90);
P_SetTarget(&spark->target, thing);
}
thing->player->stairjank = 17; thing->player->stairjank = 17;
} }

View file

@ -6887,6 +6887,21 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->renderflags |= RF_DONTDRAW; mobj->renderflags |= RF_DONTDRAW;
} }
break; break;
case MT_JANKSPARK:
if (!mobj->target)
{
P_RemoveMobj(mobj);
return false;
}
if (mobj->fuse == 1 && mobj->target->player &&
mobj->target->player->stairjank >= 8)
{
mobj->fuse = 9;
}
P_TeleportMove(mobj, mobj->target->x,
mobj->target->y, mobj->target->z);
mobj->angle = mobj->target->angle + mobj->cusval;
break;
case MT_PLAYERRETICULE: case MT_PLAYERRETICULE:
if (!mobj->target || !mobj->target->health) if (!mobj->target || !mobj->target->health)
{ {

View file

@ -53,8 +53,8 @@ static angle_t R_PlayerSpriteRotation(player_t *player)
if (player->stairjank) if (player->stairjank)
{ {
rollAngle += P_AltFlip(ANGLE_11hh / 2 / rollAngle += K_StairJankFlip(ANGLE_11hh / 2 /
(17 / player->stairjank), 2); (17 / player->stairjank));
} }
return rollAngle; return rollAngle;