Instawhip reject vfx first pass

This commit is contained in:
AJ Martinez 2023-10-13 17:09:25 -07:00
parent 85641036ea
commit f36e699398
7 changed files with 73 additions and 1 deletions

View file

@ -4076,7 +4076,7 @@ state_t states[NUMSTATES] =
{SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3ka0, 2, S_INSTAWHIP_RECHARGE3}, // S_INSTAWHIP_RECHARGE2
{SPR_WPRE, FF_FULLBRIGHT|FF_FLOORSPRITE|FF_ANIMATE|0, 36, {NULL}, 17, 2, S_INSTAWHIP_RECHARGE4}, // S_INSTAWHIP_RECHARGE3
{SPR_NULL, 0, 0, {A_PlaySound}, sfx_s3k7c, 2, S_NULL}, // S_INSTAWHIP_RECHARGE4
{SPR_WPRJ, FF_ANIMATE, 9, {NULL}, 8, 1, S_NULL}, // S_INSTAWHIP_REJECT
{SPR_WPRJ, FF_ANIMATE, 9, {NULL}, 8, 1, S_INSTAWHIP_REJECT}, // S_INSTAWHIP_REJECT
{SPR_GRNG, FF_FULLBRIGHT|FF_PAPERSPRITE|0, -1, {NULL}, 0, 0, S_NULL}, // S_BLOCKRING
{SPR_GBDY, FF_FULLBRIGHT|FF_ANIMATE|0, -1, {NULL}, 4, 2, S_NULL}, // S_BLOCKBODY

View file

@ -8275,6 +8275,26 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (!(player->cmd.buttons & BT_ATTACK)) // Deliberate Item button release, no need to protect you from lockout
player->instaWhipChargeLockout = 0;
if (player->instaWhipCharge && player->instaWhipCharge < INSTAWHIP_COOLDOWN)
{
if (!S_SoundPlaying(player->mo, sfx_wchrg1))
S_StartSound(player->mo, sfx_wchrg1);
}
else
{
S_StopSoundByID(player->mo, sfx_wchrg1);
}
if (player->instaWhipCharge >= INSTAWHIP_COOLDOWN)
{
if (!S_SoundPlaying(player->mo, sfx_wchrg2))
S_StartSound(player->mo, sfx_wchrg2);
}
else
{
S_StopSoundByID(player->mo, sfx_wchrg2);
}
if (P_PlayerInPain(player) || player->itemamount)
player->instaWhipCharge = 0;
@ -11031,6 +11051,17 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
Obj_SpawnInstaWhipRecharge(player, ANGLE_120);
Obj_SpawnInstaWhipRecharge(player, ANGLE_240);
}
if (player->instaWhipCharge == INSTAWHIP_COOLDOWN)
{
Obj_SpawnInstaWhipReject(player);
}
if (player->instaWhipCharge > INSTAWHIP_COOLDOWN)
{
if (leveltime%(TICRATE/2) == 0)
P_PlayerRingBurst(player, 1);
}
}
else if (releasedwhip)
{

View file

@ -118,6 +118,8 @@ boolean Obj_DropTargetMorphThink(mobj_t *morph);
void Obj_InstaWhipThink(mobj_t *whip);
void Obj_SpawnInstaWhipRecharge(player_t *player, angle_t angleOffset);
void Obj_InstaWhipRechargeThink(mobj_t *mobj);
void Obj_SpawnInstaWhipReject(player_t *player);
void Obj_InstaWhipRejectThink(mobj_t *mobj);
/* Block VFX */
void Obj_BlockRingThink(mobj_t *ring);

View file

@ -74,3 +74,25 @@ void Obj_InstaWhipRechargeThink(mobj_t *x)
// Flickers every other frame
x->renderflags ^= RF_DONTDRAW;
}
void Obj_SpawnInstaWhipReject(player_t *player)
{
mobj_t *x = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_INSTAWHIP_REJECT);
P_SetTarget(&recharge_target(x), player->mo);
}
void Obj_InstaWhipRejectThink(mobj_t *x)
{
mobj_t *target = x->target;
if (P_MobjWasRemoved(target) || !target->player->instaWhipCharge)
{
P_RemoveMobj(x);
return;
}
x->angle = x->target->angle;
P_MoveOrigin(x, target->x, target->y, target->z);
P_InstaScale(x, target->scale);
}

View file

@ -8462,6 +8462,16 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
Obj_InstaWhipThink(mobj);
break;
}
case MT_INSTAWHIP_REJECT:
{
Obj_InstaWhipRejectThink(mobj);
if (P_MobjWasRemoved(mobj))
{
return false;
}
break;
}
case MT_BLOCKRING:
{
Obj_BlockRingThink(mobj);

View file

@ -1191,6 +1191,10 @@ sfxinfo_t S_sfx[NUMSFX] =
{"clawk1", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
{"clawk2", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
// SRB2Kart - whip charge/hold
{"wchrg1", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
{"wchrg2", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
{"horn00", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR, "/"}, // HORNCODE
{"monch", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"etexpl", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Game crash"},

View file

@ -1261,6 +1261,9 @@ typedef enum
sfx_clawk1,
sfx_clawk2,
sfx_wchrg1,
sfx_wchrg2,
sfx_horn00,
sfx_monch,
sfx_etexpl,