diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 4b29665c6..2765e845d 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -301,19 +301,23 @@ void Cell::readAttack(ActorList& actorList) if (dedicatedActors.count(mapIndex) > 0) { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Reading ActorAttack about %s", mapIndex.c_str()); + DedicatedActor *actor = dedicatedActors[mapIndex]; actor->attack = baseActor.attack; // Set the correct drawState here if we've somehow we've missed a previous // AnimFlags packet - if (actor->drawState != 1 && (actor->attack.type == mwmp::Attack::MELEE || actor->attack.type == mwmp::Attack::RANGED)) + if (actor->drawState != MWMechanics::DrawState_::DrawState_Weapon && + (actor->attack.type == mwmp::Attack::MELEE || actor->attack.type == mwmp::Attack::RANGED)) { - actor->drawState = 1; + actor->drawState = MWMechanics::DrawState_::DrawState_Weapon; actor->setAnimFlags(); } - else if (actor->drawState != 2 && (actor->attack.type == mwmp::Attack::MAGIC || actor->attack.type == mwmp::Attack::ITEM_MAGIC)) + else if (actor->drawState != MWMechanics::DrawState_::DrawState_Spell && + (actor->attack.type == mwmp::Attack::MAGIC || actor->attack.type == mwmp::Attack::ITEM_MAGIC)) { - actor->drawState = 2; + actor->drawState = MWMechanics::DrawState_::DrawState_Spell; actor->setAnimFlags(); } diff --git a/apps/openmw/mwmp/DedicatedActor.cpp b/apps/openmw/mwmp/DedicatedActor.cpp index fe26a4b84..a4d93fbc1 100644 --- a/apps/openmw/mwmp/DedicatedActor.cpp +++ b/apps/openmw/mwmp/DedicatedActor.cpp @@ -35,7 +35,7 @@ using namespace std; DedicatedActor::DedicatedActor() { - drawState = 0; + drawState = MWMechanics::DrawState_::DrawState_Nothing; movementFlags = 0; animation.groupname = ""; sound = ""; @@ -133,12 +133,7 @@ void DedicatedActor::setAnimFlags() MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); - if (drawState == 0) - ptrCreatureStats->setDrawState(DrawState_Nothing); - else if (drawState == 1) - ptrCreatureStats->setDrawState(DrawState_Weapon); - else if (drawState == 2) - ptrCreatureStats->setDrawState(DrawState_Spell); + ptrCreatureStats->setDrawState(static_cast(drawState)); ptrCreatureStats->setMovementFlag(CreatureStats::Flag_Run, (movementFlags & CreatureStats::Flag_Run) != 0); ptrCreatureStats->setMovementFlag(CreatureStats::Flag_Sneak, (movementFlags & CreatureStats::Flag_Sneak) != 0); diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 9abbdd0b5..0b6041eb2 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -258,14 +258,10 @@ void DedicatedPlayer::setAnimFlags() cast.cast("Levitate"); } - if (drawState == 0) - ptr.getClass().getCreatureStats(ptr).setDrawState(DrawState_Nothing); - else if (drawState == 1) - ptr.getClass().getCreatureStats(ptr).setDrawState(DrawState_Weapon); - else if (drawState == 2) - ptr.getClass().getCreatureStats(ptr).setDrawState(DrawState_Spell); - MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); + + ptrCreatureStats->setDrawState(static_cast(drawState)); + ptrCreatureStats->setMovementFlag(CreatureStats::Flag_Run, (movementFlags & CreatureStats::Flag_Run) != 0); ptrCreatureStats->setMovementFlag(CreatureStats::Flag_Sneak, (movementFlags & CreatureStats::Flag_Sneak) != 0); ptrCreatureStats->setMovementFlag(CreatureStats::Flag_ForceJump, (movementFlags & CreatureStats::Flag_ForceJump) != 0); diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index edceb6764..9ef04afcd 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -629,12 +629,12 @@ void LocalPlayer::updateAnimFlags(bool forceUpdate) static bool wasJumping = false; static bool wasFlying = false; - MWMechanics::DrawState_ currentDrawState = ptrPlayer.getClass().getNpcStats(ptrPlayer).getDrawState(); - static MWMechanics::DrawState_ lastDrawState = ptrPlayer.getClass().getNpcStats(ptrPlayer).getDrawState(); + drawState = ptrPlayer.getClass().getNpcStats(ptrPlayer).getDrawState(); + static char lastDrawState = ptrPlayer.getClass().getNpcStats(ptrPlayer).getDrawState(); if (wasRunning != isRunning || wasSneaking != isSneaking || wasForceJumping != isForceJumping || - wasForceMoveJumping != isForceMoveJumping || lastDrawState != currentDrawState || + wasForceMoveJumping != isForceMoveJumping || lastDrawState != drawState || wasJumping || isJumping || wasFlying != isFlying || forceUpdate) { @@ -642,7 +642,7 @@ void LocalPlayer::updateAnimFlags(bool forceUpdate) wasRunning = isRunning; wasForceJumping = isForceJumping; wasForceMoveJumping = isForceMoveJumping; - lastDrawState = currentDrawState; + lastDrawState = drawState; wasFlying = isFlying; wasJumping = isJumping; @@ -659,13 +659,6 @@ void LocalPlayer::updateAnimFlags(bool forceUpdate) #undef __SETFLAG - if (currentDrawState == MWMechanics::DrawState_Nothing) - drawState = 0; - else if (currentDrawState == MWMechanics::DrawState_Weapon) - drawState = 1; - else if (currentDrawState == MWMechanics::DrawState_Spell) - drawState = 2; - if (isJumping) updatePosition(true); // fix position after jump;