mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 01:36:44 +00:00
[Client] Use clearer var names in LocalPlayer::updateDrawStateAndFlags()
This commit is contained in:
parent
10ad5b2a99
commit
9c731990a9
1 changed files with 27 additions and 26 deletions
|
@ -583,15 +583,15 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
|
||||||
MWMechanics::NpcStats ptrNpcStats = player.getClass().getNpcStats(player);
|
MWMechanics::NpcStats ptrNpcStats = player.getClass().getNpcStats(player);
|
||||||
using namespace MWMechanics;
|
using namespace MWMechanics;
|
||||||
|
|
||||||
static bool oldRun = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Run);
|
static bool wasRunning = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Run);
|
||||||
static bool oldSneak = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Sneak);
|
static bool wasSneaking = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Sneak);
|
||||||
static bool oldForceJump = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceJump);
|
static bool wasForceJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceJump);
|
||||||
static bool oldForceMoveJump = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
|
static bool wasForceMoveJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
|
||||||
|
|
||||||
bool run = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Run);
|
bool isRunning = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Run);
|
||||||
bool sneak = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Sneak);
|
bool isSneaking = ptrNpcStats.getMovementFlag(CreatureStats::Flag_Sneak);
|
||||||
bool forceJump = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceJump);
|
bool isForceJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceJump);
|
||||||
bool forceMoveJump = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
|
bool isForceMoveJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
|
||||||
|
|
||||||
isFlying = world->isFlying(player);
|
isFlying = world->isFlying(player);
|
||||||
bool isJumping = !world->isOnGround(player) && !isFlying;
|
bool isJumping = !world->isOnGround(player) && !isFlying;
|
||||||
|
@ -601,44 +601,45 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
|
||||||
static bool wasJumping = false;
|
static bool wasJumping = false;
|
||||||
static bool wasFlying = false;
|
static bool wasFlying = false;
|
||||||
|
|
||||||
MWMechanics::DrawState_ state = player.getClass().getNpcStats(player).getDrawState();
|
MWMechanics::DrawState_ currentDrawState = player.getClass().getNpcStats(player).getDrawState();
|
||||||
static MWMechanics::DrawState_ oldState = player.getClass().getNpcStats(player).getDrawState();
|
static MWMechanics::DrawState_ lastDrawState = player.getClass().getNpcStats(player).getDrawState();
|
||||||
|
|
||||||
if (oldRun != run
|
if (wasRunning != isRunning
|
||||||
|| oldSneak != sneak || oldForceJump != forceJump
|
|| wasSneaking != isSneaking || wasForceJumping != isForceJumping
|
||||||
|| oldForceMoveJump != forceMoveJump || oldState != state
|
|| wasForceMoveJumping != isForceMoveJumping || lastDrawState != currentDrawState
|
||||||
|| wasJumping || isJumping || wasFlying || isFlying
|
|| wasJumping || isJumping || wasFlying || isFlying
|
||||||
|| forceUpdate)
|
|| forceUpdate)
|
||||||
{
|
{
|
||||||
oldSneak = sneak;
|
wasSneaking = isSneaking;
|
||||||
oldRun = run;
|
wasRunning = isRunning;
|
||||||
oldForceJump = forceJump;
|
wasForceJumping = isForceJumping;
|
||||||
oldForceMoveJump = forceMoveJump;
|
wasForceMoveJumping = isForceMoveJumping;
|
||||||
oldState = state;
|
lastDrawState = currentDrawState;
|
||||||
|
|
||||||
wasFlying = isFlying;
|
wasFlying = isFlying;
|
||||||
wasJumping = isJumping;
|
wasJumping = isJumping;
|
||||||
|
|
||||||
movementFlags = 0;
|
movementFlags = 0;
|
||||||
|
|
||||||
#define __SETFLAG(flag, value) (value) ? (movementFlags | flag) : (movementFlags & ~flag)
|
#define __SETFLAG(flag, value) (value) ? (movementFlags | flag) : (movementFlags & ~flag)
|
||||||
|
|
||||||
movementFlags = __SETFLAG(CreatureStats::Flag_Sneak, sneak);
|
movementFlags = __SETFLAG(CreatureStats::Flag_Sneak, isSneaking);
|
||||||
movementFlags = __SETFLAG(CreatureStats::Flag_Run, run);
|
movementFlags = __SETFLAG(CreatureStats::Flag_Run, isRunning);
|
||||||
movementFlags = __SETFLAG(CreatureStats::Flag_ForceJump, forceJump);
|
movementFlags = __SETFLAG(CreatureStats::Flag_ForceJump, isForceJumping);
|
||||||
movementFlags = __SETFLAG(CreatureStats::Flag_ForceJump, isJumping);
|
movementFlags = __SETFLAG(CreatureStats::Flag_ForceJump, isJumping);
|
||||||
movementFlags = __SETFLAG(CreatureStats::Flag_ForceMoveJump, forceMoveJump);
|
movementFlags = __SETFLAG(CreatureStats::Flag_ForceMoveJump, isForceMoveJumping);
|
||||||
|
|
||||||
#undef __SETFLAG
|
#undef __SETFLAG
|
||||||
|
|
||||||
if (state == MWMechanics::DrawState_Nothing)
|
if (currentDrawState == MWMechanics::DrawState_Nothing)
|
||||||
drawState = 0;
|
drawState = 0;
|
||||||
else if (state == MWMechanics::DrawState_Weapon)
|
else if (currentDrawState == MWMechanics::DrawState_Weapon)
|
||||||
drawState = 1;
|
drawState = 1;
|
||||||
else if (state == MWMechanics::DrawState_Spell)
|
else if (currentDrawState == MWMechanics::DrawState_Spell)
|
||||||
drawState = 2;
|
drawState = 2;
|
||||||
|
|
||||||
if (isJumping)
|
if (isJumping)
|
||||||
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump;
|
updatePosition(true); // fix position after jump;
|
||||||
|
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->setPlayer(this);
|
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->setPlayer(this);
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Send();
|
||||||
|
|
Loading…
Reference in a new issue