diff --git a/src/info.c b/src/info.c index e8750b76b..b6429ee79 100644 --- a/src/info.c +++ b/src/info.c @@ -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 diff --git a/src/k_kart.c b/src/k_kart.c index 19bf552e3..9ec27955f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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) { diff --git a/src/k_objects.h b/src/k_objects.h index c84ac5151..c88bf3320 100644 --- a/src/k_objects.h +++ b/src/k_objects.h @@ -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); diff --git a/src/objects/instawhip.c b/src/objects/instawhip.c index 70e9ee05f..e98c12cf2 100644 --- a/src/objects/instawhip.c +++ b/src/objects/instawhip.c @@ -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); +} diff --git a/src/p_mobj.c b/src/p_mobj.c index 12fe75e93..09ec9f4f7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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); diff --git a/src/sounds.c b/src/sounds.c index 08ee77df7..722f8416c 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -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"}, diff --git a/src/sounds.h b/src/sounds.h index edda75ead..a3329cf90 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1261,6 +1261,9 @@ typedef enum sfx_clawk1, sfx_clawk2, + sfx_wchrg1, + sfx_wchrg2, + sfx_horn00, sfx_monch, sfx_etexpl,