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(DieFromSpawn)
xx(Slam)
xx(Slide)
// Bounce state names
xx(Bounce)

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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) &&

View File

@ -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,

View File

@ -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)

View File

@ -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();
//==========================================================================
//