From c14b7f58d3b6e668425d4bff5303012cd72cf73c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 24 Nov 2018 20:33:00 +0100 Subject: [PATCH] - scriptified some simple sound functions. --- src/p_enemy.cpp | 45 --------------------------------- wadsrc/static/zscript/actor.txt | 31 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 50 deletions(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 0e2968d9b..7f6f376a6 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3157,51 +3157,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) return 0; } -DEFINE_ACTION_FUNCTION(AActor, A_Scream) -{ - PARAM_SELF_PROLOGUE(AActor); - if (self->DeathSound) - { - // Check for bosses. - if (self->flags2 & MF2_BOSS) - { - // full volume - S_Sound (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NONE); - } - else - { - S_Sound (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NORM); - } - } - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_XScream) -{ - PARAM_SELF_PROLOGUE(AActor); - if (self->player) - S_Sound (self, CHAN_VOICE, "*gibbed", 1, ATTN_NORM); - else - S_Sound (self, CHAN_VOICE, "misc/gibbed", 1, ATTN_NORM); - return 0; -} - -//=========================================================================== -// -// A_ActiveSound -// -//=========================================================================== - -DEFINE_ACTION_FUNCTION(AActor, A_ActiveSound) -{ - PARAM_SELF_PROLOGUE(AActor); - if (self->ActiveSound) - { - S_Sound(self, CHAN_VOICE, self->ActiveSound, 1, ATTN_NORM); - } - return 0; -} - //--------------------------------------------------------------------------- // // Modifies the drop amount of this item according to the current skill's diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 3db5669f9..d4783db05 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -968,10 +968,8 @@ class Actor : Thinker native native void A_Pain(); native void A_NoBlocking(bool drop = true); void A_Fall() { A_NoBlocking(); } - native void A_XScream(); native void A_Look(); native void A_Chase(statelabel melee = null, statelabel missile = null, int flags = 0x40000000); - native void A_Scream(); native void A_VileChase(); native bool A_CheckForResurrection(); native void A_BossDeath(); @@ -980,9 +978,6 @@ class Actor : Thinker native return Level.ExecuteSpecial(special, self, null, false, arg1, arg2, arg3, arg4, arg5); } - - native void A_ActiveSound(); - native void A_FastChase(); native void A_PlayerScream(); native void A_SkullPop(class skulltype = "BloodySkull"); @@ -1151,6 +1146,32 @@ class Actor : Thinker native return ACS_ExecuteWithResult(-int(script), arg1, arg2, arg3, arg4); } + //=========================================================================== + // + // Sounds + // + //=========================================================================== + + void A_Scream() + { + if (DeathSound) + { + A_PlaySound(DeathSound, CHAN_VOICE, 1, false, bBoss? ATTN_NONE : ATTN_NORM); + } + } + + void A_XScream() + { + A_PlaySound(player? Sound("*gibbed") : Sound("misc/gibbed"), CHAN_VOICE); + } + + void A_ActiveSound() + { + if (ActiveSound) + { + A_PlaySound(ActiveSound, CHAN_VOICE); + } + } States(Actor, Overlay, Weapon, Item) {