Skip to content

Commit

Permalink
- Add bool lock to PlayerHorizon::settarget() when setting target…
Browse files Browse the repository at this point in the history
… from the ticker without having to call setters and resetters.
  • Loading branch information
mjr4077au committed May 30, 2022
1 parent 5a55061 commit 18541d1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions source/core/gameinput.h
Expand Up @@ -57,8 +57,6 @@ struct PlayerHorizon
bool targetset() { return target.asq16(); }

// Input locking helpers.
void lockinput() { inputdisabled = true; }
void unlockinput() { inputdisabled = false; }
bool movementlocked() { return targetset() || inputdisabled; }

// Draw code helpers.
Expand Down Expand Up @@ -92,9 +90,10 @@ struct PlayerHorizon
}
}

void settarget(fixedhoriz value)
void settarget(fixedhoriz value, bool const lock = false)
{
value = q16horiz(clamp(value.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
inputdisabled = lock;

if (!SyncInput())
{
Expand Down
3 changes: 1 addition & 2 deletions source/games/blood/src/nnexts.cpp
Expand Up @@ -2234,8 +2234,7 @@ void trPlayerCtrlSetLookAngle(int value, PLAYER* pPlayer)
adjustment = 0;
}

pPlayer->horizon.settarget(buildfhoriz(100. * tan(adjustment * pi::pi() / 1024.)));
pPlayer->horizon.lockinput();
pPlayer->horizon.settarget(buildfhoriz(100. * tan(adjustment * pi::pi() / 1024.)), true);
}

//---------------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions source/games/blood/src/player.cpp
Expand Up @@ -1781,9 +1781,6 @@ void ProcessInput(PLAYER* pPlayer)
doslopetilting(pPlayer);
}

pPlayer->angle.unlockinput();
pPlayer->horizon.unlockinput();

pPlayer->slope = -pPlayer->horizon.horiz.asq16() >> 9;
if (pInput->actions & SB_INVPREV)
{
Expand Down

0 comments on commit 18541d1

Please sign in to comment.