Skip to content

Commit

Permalink
Scriptified the view squatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
nashmuhandes authored and RicardoLuis0 committed May 27, 2024
1 parent ab20b75 commit ae28eea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2811,15 +2811,18 @@ static void PlayerLandedMakeGruntSound(AActor* self, AActor *onmobj)
}
}

static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
static void PlayerSquatView(AActor *self, AActor *onmobj)
{
if (!mo->player)
return;

if (mo->player->mo == mo)
IFVIRTUALPTR(self, AActor, PlayerSquatView)
{
mo->player->deltaviewheight = mo->Vel.Z / 8.;
VMValue params[2] = { self, onmobj };
VMCall(func, params, 2, nullptr, 0);
}
}

static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
{
PlayerSquatView(mo, onmobj);

if (mo->player->cheats & CF_PREDICTING)
return;
Expand Down
11 changes: 11 additions & 0 deletions wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ae28eea

Please sign in to comment.