From 71063aab85a1100af037ce854f0dab997f5c27a3 Mon Sep 17 00:00:00 2001 From: sphere Date: Tue, 14 Apr 2020 13:49:26 +0200 Subject: [PATCH] Further cleanup of gas jet actions. --- src/dehacked.c | 5 +++-- src/info.c | 18 ++++++++++-------- src/info.h | 5 +++-- src/p_enemy.c | 44 +++++++------------------------------------- 4 files changed, 23 insertions(+), 49 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 20d23d680..8471b2ba8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2805,8 +2805,7 @@ static actionpointer_t actionpointers[] = {{A_DropMine}, "A_DROPMINE"}, {{A_FishJump}, "A_FISHJUMP"}, {{A_ThrownRing}, "A_THROWNRING"}, - {{A_SetSolidSteam}, "A_SETSOLIDSTEAM"}, - {{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"}, + {{A_PlaySteamSound}, "A_PLAYSTEAMSOUND"}, {{A_SignSpin}, "S_SIGNSPIN"}, {{A_SignPlayer}, "A_SIGNPLAYER"}, {{A_OverlayThink}, "A_OVERLAYTHINK"}, @@ -7238,6 +7237,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_STEAM6", "S_STEAM7", "S_STEAM8", + "S_STEAMACTIVE", + "S_STEAMSOUND", // Bumpers "S_BUMPER", diff --git a/src/info.c b/src/info.c index 50117f5c3..59f523e5b 100644 --- a/src/info.c +++ b/src/info.c @@ -3107,14 +3107,16 @@ state_t states[NUMSTATES] = {SPR_FANS, 4, 1, {A_FanBubbleSpawn}, 512, 0, S_FAN}, // S_FAN5 // Steam jet - {SPR_STEM, 0, 2, {A_SetSolidSteam}, 0, 0, S_STEAM2}, // S_STEAM1 - {SPR_STEM, 1, 2, {NULL}, 0, 0, S_STEAM3}, // S_STEAM2 - {SPR_STEM, 2, 2, {NULL}, 0, 0, S_STEAM4}, // S_STEAM3 - {SPR_STEM, 3, 2, {A_UnsetSolidSteam}, 0, 0, S_STEAM5}, // S_STEAM4 - {SPR_STEM, 4, 2, {NULL}, 0, 0, S_STEAM6}, // S_STEAM5 - {SPR_STEM, 5, 2, {NULL}, 0, 0, S_STEAM7}, // S_STEAM6 - {SPR_STEM, 6, 2, {NULL}, 0, 0, S_STEAM8}, // S_STEAM7 - {SPR_NULL, 0, 18, {NULL}, 0, 0, S_STEAM1}, // S_STEAM8 + {SPR_STEM, 0, 2, {A_DualAction}, S_STEAMACTIVE, S_STEAMSOUND, S_STEAM2}, // S_STEAM1 + {SPR_STEM, 1, 2, {NULL}, 0, 0, S_STEAM3}, // S_STEAM2 + {SPR_STEM, 2, 2, {NULL}, 0, 0, S_STEAM4}, // S_STEAM3 + {SPR_STEM, 3, 2, {A_SetObjectFlags}, MF_SPRING, 1, S_STEAM5}, // S_STEAM4 + {SPR_STEM, 4, 2, {NULL}, 0, 0, S_STEAM6}, // S_STEAM5 + {SPR_STEM, 5, 2, {NULL}, 0, 0, S_STEAM7}, // S_STEAM6 + {SPR_STEM, 6, 2, {NULL}, 0, 0, S_STEAM8}, // S_STEAM7 + {SPR_NULL, 0, 18, {NULL}, 0, 0, S_STEAM1}, // S_STEAM8 + {SPR_NULL, 0, 0, {A_SetObjectFlags}, MF_SPRING, 2, S_NULL}, // S_STEAMACTIVE + {SPR_NULL, 0, 0, {A_PlaySteamSound}, 0, 0, S_NULL}, // S_STEAMSOUND // Bumpers {SPR_BUMP, FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 3, 4, S_NULL}, // S_BUMPER diff --git a/src/info.h b/src/info.h index b6246347f..c4d997ca0 100644 --- a/src/info.h +++ b/src/info.h @@ -61,8 +61,7 @@ void A_AttractChase(); // Ring Chase void A_DropMine(); // Drop Mine from Skim or Jetty-Syn Bomber void A_FishJump(); // Fish Jump void A_ThrownRing(); // Sparkle trail for red ring -void A_SetSolidSteam(); -void A_UnsetSolidSteam(); +void A_PlaySteamSound(); void A_SignSpin(); void A_SignPlayer(); void A_OverlayThink(); @@ -3256,6 +3255,8 @@ typedef enum state S_STEAM6, S_STEAM7, S_STEAM8, + S_STEAMACTIVE, + S_STEAMSOUND, // Bumpers S_BUMPER, diff --git a/src/p_enemy.c b/src/p_enemy.c index ce59a02e7..7142db56f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -125,8 +125,7 @@ void A_AttractChase(mobj_t *actor); void A_DropMine(mobj_t *actor); void A_FishJump(mobj_t *actor); void A_ThrownRing(mobj_t *actor); -void A_SetSolidSteam(mobj_t *actor); -void A_UnsetSolidSteam(mobj_t *actor); +void A_PlaySteamSound(mobj_t *actor); void A_SignSpin(mobj_t *actor); void A_SignPlayer(mobj_t *actor); void A_OverlayThink(mobj_t *actor); @@ -4919,50 +4918,21 @@ void A_ThrownRing(mobj_t *actor) return; } -// Function: A_SetSolidSteam +// Function: A_PlaySteamSound // -// Description: Applies the spring flag to steam jets, and randomly plays one of two sounds. +// Description: Plays either the deathsound (7/8) or the painsound (1/8) of an object. Used by steam jets. +// Can also be muted if the object has the Ambush flag checked. // // var1 = unused // var2 = unused // -void A_SetSolidSteam(mobj_t *actor) +void A_PlaySteamSound(mobj_t *actor) { - if (LUA_CallAction("A_SetSolidSteam", actor)) + if (LUA_CallAction("A_PlaySteamSound", actor)) return; - actor->flags |= MF_SPRING; - if (!(actor->flags2 & MF2_AMBUSH)) - { - if (P_RandomChance(FRACUNIT/8)) - { - if (actor->info->deathsound) - S_StartSound(actor, actor->info->deathsound); // Hiss! - } - else - { - if (actor->info->painsound) - S_StartSound(actor, actor->info->painsound); - } - } - - P_SetObjectMomZ (actor, 1, true); -} - -// Function: A_UnsetSolidSteam -// -// Description: Removes the spring flag from an object. Used by steam jets. -// -// var1 = unused -// var2 = unused -// -void A_UnsetSolidSteam(mobj_t *actor) -{ - if (LUA_CallAction("A_UnsetSolidSteam", actor)) - return; - - actor->flags &= ~MF_SPRING; + P_RandomChance(FRACUNIT/8) ? A_Scream(actor) : A_Pain(actor); } // Function: A_SignSpin