Add PushSound property and Slide state

First Commit, hip hip hooray!
This commit is contained in:
UnizoneDev 2022-11-11 14:23:58 -06:00 committed by Christoph Oelckers
parent 2a9e28d949
commit 9af664d117
7 changed files with 39 additions and 0 deletions

View file

@ -349,6 +349,7 @@ xx(GenericFreezeDeath)
xx(GenericCrush) xx(GenericCrush)
xx(DieFromSpawn) xx(DieFromSpawn)
xx(Slam) xx(Slam)
xx(Slide)
// Bounce state names // Bounce state names
xx(Bounce) xx(Bounce)

View file

@ -810,6 +810,9 @@ public:
// plays bouncing sound // plays bouncing sound
void PlayBounceSound(bool onfloor); void PlayBounceSound(bool onfloor);
// plays pushing sound
void PlayPushSound();
// Called when an actor with MF_MISSILE and MF2_FLOORBOUNCE hits the floor // Called when an actor with MF_MISSILE and MF2_FLOORBOUNCE hits the floor
bool FloorBounceMissile (secplane_t &plane); bool FloorBounceMissile (secplane_t &plane);
@ -1237,6 +1240,7 @@ public:
FSoundIDNoInit BounceSound; FSoundIDNoInit BounceSound;
FSoundIDNoInit WallBounceSound; FSoundIDNoInit WallBounceSound;
FSoundIDNoInit CrushPainSound; FSoundIDNoInit CrushPainSound;
FSoundIDNoInit PushSound; // [UZ] Sound to play when an actor is being pushed around.
double MaxDropOffHeight; double MaxDropOffHeight;
double MaxStepHeight; double MaxStepHeight;

View file

@ -4655,6 +4655,7 @@ enum
SOUND_WallBounce, SOUND_WallBounce,
SOUND_CrushPain, SOUND_CrushPain,
SOUND_Howl, SOUND_Howl,
SOUND_Push,
}; };
static FSoundID GetActorSound(AActor *actor, int soundtype) 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_WallBounce: return actor->WallBounceSound;
case SOUND_CrushPain: return actor->CrushPainSound; case SOUND_CrushPain: return actor->CrushPainSound;
case SOUND_Howl: return actor->SoundVar(NAME_HowlSound); case SOUND_Howl: return actor->SoundVar(NAME_HowlSound);
case SOUND_Push: return actor->PushSound;
default: return 0; default: return 0;
} }
} }

View file

@ -1686,6 +1686,17 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
{ {
thing->Vel += tm.thing->Vel.XY() * thing->pushfactor; thing->Vel += tm.thing->Vel.XY() * thing->pushfactor;
thing->lastpush = tm.PushTime; 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) && solid = (thing->flags & MF_SOLID) &&

View file

@ -280,6 +280,7 @@ void AActor::Serialize(FSerializer &arc)
A("bouncesound", BounceSound) A("bouncesound", BounceSound)
A("wallbouncesound", WallBounceSound) A("wallbouncesound", WallBounceSound)
A("crushpainsound", CrushPainSound) A("crushpainsound", CrushPainSound)
A("pushsound", PushSound)
A("speed", Speed) A("speed", Speed)
A("floatspeed", FloatSpeed) A("floatspeed", FloatSpeed)
A("mass", Mass) A("mass", Mass)
@ -3313,6 +3314,21 @@ DEFINE_ACTION_FUNCTION(AActor, PlayActiveSound)
return 0; 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) bool AActor::IsOkayToAttack (AActor *link)
{ {
// Standard things to eliminate: an actor shouldn't attack itself, // Standard things to eliminate: an actor shouldn't attack itself,

View file

@ -1992,6 +1992,7 @@ DEFINE_FIELD(AActor, UseSound)
DEFINE_FIELD(AActor, BounceSound) DEFINE_FIELD(AActor, BounceSound)
DEFINE_FIELD(AActor, WallBounceSound) DEFINE_FIELD(AActor, WallBounceSound)
DEFINE_FIELD(AActor, CrushPainSound) DEFINE_FIELD(AActor, CrushPainSound)
DEFINE_FIELD(AActor, PushSound)
DEFINE_FIELD(AActor, MaxDropOffHeight) DEFINE_FIELD(AActor, MaxDropOffHeight)
DEFINE_FIELD(AActor, MaxStepHeight) DEFINE_FIELD(AActor, MaxStepHeight)
DEFINE_FIELD(AActor, MaxSlopeSteepness) DEFINE_FIELD(AActor, MaxSlopeSteepness)

View file

@ -227,6 +227,7 @@ class Actor : Thinker native
native sound BounceSound; native sound BounceSound;
native sound WallBounceSound; native sound WallBounceSound;
native sound CrushPainSound; native sound CrushPainSound;
native sound PushSound;
native double MaxDropoffHeight; native double MaxDropoffHeight;
native double MaxStepHeight; native double MaxStepHeight;
native double MaxSlopeSteepness; native double MaxSlopeSteepness;
@ -323,6 +324,7 @@ class Actor : Thinker native
property DeathSound: DeathSound; property DeathSound: DeathSound;
property ActiveSound: ActiveSound; property ActiveSound: ActiveSound;
property CrushPainSound: CrushPainSound; property CrushPainSound: CrushPainSound;
property PushSound: PushSound;
property Alpha: Alpha; property Alpha: Alpha;
property MaxTargetRange: MaxTargetRange; property MaxTargetRange: MaxTargetRange;
property MeleeThreshold: MeleeThreshold; property MeleeThreshold: MeleeThreshold;
@ -468,6 +470,7 @@ class Actor : Thinker native
MarkSound(CrushPainSound); MarkSound(CrushPainSound);
MarkSound(HowlSound); MarkSound(HowlSound);
MarkSound(MeleeSound); MarkSound(MeleeSound);
MarkSound(PushSound);
} }
bool IsPointerEqual(int ptr_select1, int ptr_select2) bool IsPointerEqual(int ptr_select1, int ptr_select2)
@ -805,6 +808,7 @@ class Actor : Thinker native
native clearscope double GetCameraHeight() const; native clearscope double GetCameraHeight() const;
native clearscope double GetGravity() const; native clearscope double GetGravity() const;
native void DoMissileDamage(Actor target); native void DoMissileDamage(Actor target);
native void PlayPushSound();
//========================================================================== //==========================================================================
// //