Browse Source

Introduce PlayerStruct.IsWalking()

pull/2004/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
4de25cd2ea
  1. 13
      Source/player.cpp
  2. 5
      Source/player.h
  3. 2
      Source/track.cpp

13
Source/player.cpp

@ -355,6 +355,19 @@ void PlayerStruct::Stop()
destAction = ACTION_NONE;
}
bool PlayerStruct::IsWalking() const
{
switch (_pmode)
{
case PM_WALK:
case PM_WALK2:
case PM_WALK3:
return true;
default:
return false;
}
}
void SetPlayerGPtrs(byte *pData, byte **pAnim)
{
int i;

5
Source/player.h

@ -390,6 +390,11 @@ struct PlayerStruct {
* opening a chest, picking an item up, etc) this action will also be cancelled.
*/
void Stop();
/**
* @brief Is the player currently walking?
*/
bool IsWalking() const;
};
extern int myplr;

2
Source/track.cpp

@ -26,7 +26,7 @@ void track_process()
if (cursmx < 0 || cursmx >= MAXDUNX - 1 || cursmy < 0 || cursmy >= MAXDUNY - 1)
return;
if (plr[myplr].AnimInfo.GetFrameToUseForRendering() <= 6 || (plr[myplr]._pmode != PM_WALK && plr[myplr]._pmode != PM_WALK2 && plr[myplr]._pmode != PM_WALK3 && plr[myplr]._pmode != PM_STAND))
if (plr[myplr].AnimInfo.GetFrameToUseForRendering() <= 6 || (!plr[myplr].IsWalking() && plr[myplr]._pmode != PM_STAND))
return;
const Point target = plr[myplr].GetTargetPosition();

Loading…
Cancel
Save