Scriptified the view squatting.

This commit is contained in:
nashmuhandes 2024-05-14 21:26:12 +08:00 committed by Ricardo Luís Vaz Silva
parent ab20b75c14
commit ae28eeae94
2 changed files with 21 additions and 7 deletions

View file

@ -2811,15 +2811,18 @@ static void PlayerLandedMakeGruntSound(AActor* self, AActor *onmobj)
} }
} }
static void PlayerSquatView(AActor *self, AActor *onmobj)
{
IFVIRTUALPTR(self, AActor, PlayerSquatView)
{
VMValue params[2] = { self, onmobj };
VMCall(func, params, 2, nullptr, 0);
}
}
static void PlayerLandedOnThing (AActor *mo, AActor *onmobj) static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
{ {
if (!mo->player) PlayerSquatView(mo, onmobj);
return;
if (mo->player->mo == mo)
{
mo->player->deltaviewheight = mo->Vel.Z / 8.;
}
if (mo->player->cheats & CF_PREDICTING) if (mo->player->cheats & CF_PREDICTING)
return; return;

View file

@ -1439,6 +1439,17 @@ class Actor : Thinker native
} }
} }
virtual void PlayerSquatView(Actor onmobj)
{
if (!self.player)
return;
if (self.player.mo == self)
{
self.player.deltaviewheight = self.Vel.Z / 8.;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// //
// PROC A_CheckSkullDone // PROC A_CheckSkullDone