diff --git a/src/namedef_custom.h b/src/namedef_custom.h index 16f6a022a7..77270b89b4 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -349,6 +349,7 @@ xx(GenericFreezeDeath) xx(GenericCrush) xx(DieFromSpawn) xx(Slam) +xx(Slide) // Bounce state names xx(Bounce) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 731c979425..b5105f0d4c 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -810,6 +810,9 @@ public: // plays bouncing sound void PlayBounceSound(bool onfloor); + // plays pushing sound + void PlayPushSound(); + // Called when an actor with MF_MISSILE and MF2_FLOORBOUNCE hits the floor bool FloorBounceMissile (secplane_t &plane); @@ -1237,6 +1240,7 @@ public: FSoundIDNoInit BounceSound; FSoundIDNoInit WallBounceSound; FSoundIDNoInit CrushPainSound; + FSoundIDNoInit PushSound; // [UZ] Sound to play when an actor is being pushed around. double MaxDropOffHeight; double MaxStepHeight; diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 983ad08baf..8564320a40 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -4655,6 +4655,7 @@ enum SOUND_WallBounce, SOUND_CrushPain, SOUND_Howl, + SOUND_Push, }; static FSoundID GetActorSound(AActor *actor, int soundtype) @@ -4671,6 +4672,7 @@ static FSoundID GetActorSound(AActor *actor, int soundtype) case SOUND_WallBounce: return actor->WallBounceSound; case SOUND_CrushPain: return actor->CrushPainSound; case SOUND_Howl: return actor->SoundVar(NAME_HowlSound); + case SOUND_Push: return actor->PushSound; default: return 0; } } diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index b0e9ed9f08..a4693461fa 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -1686,6 +1686,17 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch { thing->Vel += tm.thing->Vel.XY() * thing->pushfactor; thing->lastpush = tm.PushTime; + + FState* push = thing->FindState(NAME_Slide); + if (push != NULL) + { + thing->SetState(push); + thing->PlayPushSound(); + } + else + { + thing->SetIdle(); + } } } solid = (thing->flags & MF_SOLID) && diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index c731369b84..0329688083 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -280,6 +280,7 @@ void AActor::Serialize(FSerializer &arc) A("bouncesound", BounceSound) A("wallbouncesound", WallBounceSound) A("crushpainsound", CrushPainSound) + A("pushsound", PushSound) A("speed", Speed) A("floatspeed", FloatSpeed) A("mass", Mass) @@ -3313,6 +3314,21 @@ DEFINE_ACTION_FUNCTION(AActor, PlayActiveSound) return 0; } +void AActor::PlayPushSound() +{ + if (PushSound && !S_IsActorPlayingSomething(this, CHAN_VOICE, -1)) + { + S_Sound(this, CHAN_VOICE, 0, PushSound, 1, ATTN_IDLE); + } +} + +DEFINE_ACTION_FUNCTION(AActor, PlayPushSound) +{ + PARAM_SELF_PROLOGUE(AActor); + self->PlayPushSound(); + return 0; +} + bool AActor::IsOkayToAttack (AActor *link) { // Standard things to eliminate: an actor shouldn't attack itself, diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index 3bdcfe3ad0..25622b4ba9 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1992,6 +1992,7 @@ DEFINE_FIELD(AActor, UseSound) DEFINE_FIELD(AActor, BounceSound) DEFINE_FIELD(AActor, WallBounceSound) DEFINE_FIELD(AActor, CrushPainSound) +DEFINE_FIELD(AActor, PushSound) DEFINE_FIELD(AActor, MaxDropOffHeight) DEFINE_FIELD(AActor, MaxStepHeight) DEFINE_FIELD(AActor, MaxSlopeSteepness) diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index bf8b1e3c21..c7a753f69a 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -227,6 +227,7 @@ class Actor : Thinker native native sound BounceSound; native sound WallBounceSound; native sound CrushPainSound; + native sound PushSound; native double MaxDropoffHeight; native double MaxStepHeight; native double MaxSlopeSteepness; @@ -323,6 +324,7 @@ class Actor : Thinker native property DeathSound: DeathSound; property ActiveSound: ActiveSound; property CrushPainSound: CrushPainSound; + property PushSound: PushSound; property Alpha: Alpha; property MaxTargetRange: MaxTargetRange; property MeleeThreshold: MeleeThreshold; @@ -468,6 +470,7 @@ class Actor : Thinker native MarkSound(CrushPainSound); MarkSound(HowlSound); MarkSound(MeleeSound); + MarkSound(PushSound); } bool IsPointerEqual(int ptr_select1, int ptr_select2) @@ -805,6 +808,7 @@ class Actor : Thinker native native clearscope double GetCameraHeight() const; native clearscope double GetGravity() const; native void DoMissileDamage(Actor target); + native void PlayPushSound(); //========================================================================== //