[Scummvm-git-logs] scummvm master -> bf073313a66e252f98fe4b5867124d67bf39c07c
sev-
noreply at scummvm.org
Fri Oct 28 23:07:47 UTC 2022
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
933f52cfd4 SAGA2: Rename enums in mission.h
34a20f5482 SAGA2: Rename enums in motion.h 1/2
bf073313a6 SAGA2: Rename enums in motion.h 2/2
Commit: 933f52cfd4d7824e655b69a3395e08d7700c828c
https://github.com/scummvm/scummvm/commit/933f52cfd4d7824e655b69a3395e08d7700c828c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-10-29T00:38:48+02:00
Commit Message:
SAGA2: Rename enums in mission.h
Changed paths:
engines/saga2/mission.cpp
engines/saga2/mission.h
diff --git a/engines/saga2/mission.cpp b/engines/saga2/mission.cpp
index 8ddb342935b..054b09f84ee 100644
--- a/engines/saga2/mission.cpp
+++ b/engines/saga2/mission.cpp
@@ -39,7 +39,7 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
ActiveMission *ms = nullptr;
for (i = 0; i < ARRAYSIZE(activeMissions); i++) {
- if (!(activeMissions[i]._data.missionFlags & inUse)) {
+ if (!(activeMissions[i]._data.missionFlags & kInUse)) {
ms = &activeMissions[i];
break;
}
@@ -50,7 +50,7 @@ ActiveMission *ActiveMission::newMission(ObjectID genID, uint16 script) {
ms->_data.missionID = i;
ms->_data.generatorID = genID;
ms->_data.missionScript = script;
- ms->_data.missionFlags |= inUse;
+ ms->_data.missionFlags |= kInUse;
ms->_data.numKnowledgeIDs = ms->_data.numObjectIDs = 0;
@@ -68,7 +68,7 @@ int ActiveMission::findMission(ObjectID genID) {
int i;
for (i = 0; i < ARRAYSIZE(activeMissions); i++) {
- if (activeMissions[i]._data.missionFlags & inUse
+ if (activeMissions[i]._data.missionFlags & kInUse
&& activeMissions[i]._data.generatorID == genID) {
return i;
}
@@ -255,7 +255,7 @@ void ActiveMission::cleanup() {
}
_data.numKnowledgeIDs = _data.numObjectIDs = 0;
- _data.missionFlags &= ~inUse;
+ _data.missionFlags &= ~kInUse;
}
//-----------------------------------------------------------------------
@@ -265,7 +265,7 @@ void initMissions() {
int i;
for (i = 0; i < ARRAYSIZE(activeMissions); i++)
- activeMissions[i]._data.missionFlags &= ~inUse;
+ activeMissions[i]._data.missionFlags &= ~kInUse;
}
void saveMissions(Common::OutSaveFile *outS) {
diff --git a/engines/saga2/mission.h b/engines/saga2/mission.h
index 966fd4c1b4a..ac29c386cac 100644
--- a/engines/saga2/mission.h
+++ b/engines/saga2/mission.h
@@ -44,7 +44,7 @@ class ActiveMission;
// Mission flags
enum missionFlags {
- inUse = (1 << 0) // this mission struct in use
+ kInUse = (1 << 0) // this mission struct in use
};
struct ActiveMissionData {
Commit: 34a20f5482a14e47e8e739f9d78e60ce4e495ab2
https://github.com/scummvm/scummvm/commit/34a20f5482a14e47e8e739f9d78e60ce4e495ab2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-10-29T01:02:24+02:00
Commit Message:
SAGA2: Rename enums in motion.h 1/2
Changed paths:
engines/saga2/motion.cpp
engines/saga2/motion.h
engines/saga2/path.cpp
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index e87a19c9fdf..d144051ec8b 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -490,7 +490,7 @@ void MotionTask::read(Common::InSaveFile *in) {
_finalTarget.load(in);
// If there is a tether restore it
- if (_flags & tethered) {
+ if (_flags & kMfTethered) {
_tetherMinU = in->readSint16LE();
_tetherMinV = in->readSint16LE();
_tetherMaxU = in->readSint16LE();
@@ -506,7 +506,7 @@ void MotionTask::read(Common::InSaveFile *in) {
_runCount = in->readSint16LE();
// Restore the action counter if needed
- if (_flags & agitated)
+ if (_flags & kMfAgitated)
actionCounter = in->readSint16LE();
// If there were valid path way points, restore those
@@ -726,7 +726,7 @@ int32 MotionTask::archiveSize() {
size += sizeof(_immediateLocation)
+ sizeof(_finalTarget);
- if (_flags & tethered) {
+ if (_flags & kMfTethered) {
size += sizeof(_tetherMinU)
+ sizeof(_tetherMinV)
+ sizeof(_tetherMaxU)
@@ -738,7 +738,7 @@ int32 MotionTask::archiveSize() {
+ sizeof(_pathCount)
+ sizeof(_runCount);
- if (_flags & agitated)
+ if (_flags & kMfAgitated)
size += sizeof(actionCounter);
if (_pathIndex >= 0 && _pathIndex < _pathCount)
@@ -859,7 +859,7 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
_finalTarget.write(out);
// If there is a tether store it
- if (_flags & tethered) {
+ if (_flags & kMfTethered) {
out->writeSint16LE(_tetherMinU);
out->writeSint16LE(_tetherMinV);
out->writeSint16LE(_tetherMaxU);
@@ -875,7 +875,7 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
out->writeSint16LE(_runCount);
// Store the action counter if needed
- if (_flags & agitated)
+ if (_flags & kMfAgitated)
out->writeSint16LE(actionCounter);
// If there are valid path way points, store them
@@ -1108,7 +1108,7 @@ TilePoint MotionTask::getImmediateTarget() {
// If the wandering then simply go in the direction the actor is
// facing, else if avoiding a block go in the previously selected
// random direction
- if (_flags & agitated)
+ if (_flags & kMfAgitated)
dir = _direction;
else
dir = ((Actor *)_object)->_currentFacing;
@@ -1159,7 +1159,7 @@ void MotionTask::turn(Actor &obj, Direction dir) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
mt->_direction = dir;
mt->_motionType = motionTypeTurn;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
@@ -1172,7 +1172,7 @@ void MotionTask::turnTowards(Actor &obj, const TilePoint &where) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
mt->_direction = (where - obj.getLocation()).quickDir();
mt->_motionType = motionTypeTurn;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
@@ -1186,7 +1186,7 @@ void MotionTask::give(Actor &actor, Actor &givee) {
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
mt->_targetObj = &givee;
mt->_motionType = motionTypeGive;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
@@ -1278,13 +1278,13 @@ void MotionTask::walkTo(
mt->_finalTarget = mt->_immediateLocation = target;
mt->_motionType = mt->_prevMotionType = motionTypeWalk;
mt->_pathCount = mt->_pathIndex = 0;
- mt->_flags = pathFind | reset;
+ mt->_flags = kMfPathFind | kMfReset;
mt->_runCount = 12; // # of frames until we can run
if (run && actor.isActionAvailable(kActionRun))
- mt->_flags |= requestRun;
+ mt->_flags |= kMfRequestRun;
if (canAgitate)
- mt->_flags |= agitatable;
+ mt->_flags |= kMfAgitatable;
RequestPath(mt, getPathFindIQ(&actor));
}
@@ -1311,13 +1311,13 @@ void MotionTask::walkToDirect(
mt->_motionType = mt->_prevMotionType = motionTypeWalk;
mt->_finalTarget = mt->_immediateLocation = target;
mt->_pathCount = mt->_pathIndex = 0;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_runCount = 12;
if (run && actor.isActionAvailable(kActionRun))
- mt->_flags |= requestRun;
+ mt->_flags |= kMfRequestRun;
if (canAgitate)
- mt->_flags |= agitatable;
+ mt->_flags |= kMfAgitatable;
}
}
}
@@ -1340,11 +1340,11 @@ void MotionTask::wander(
mt->_motionType = mt->_prevMotionType = motionTypeWalk;
mt->_immediateLocation = Nowhere;
mt->_pathCount = mt->_pathIndex = 0;
- mt->_flags = reset | wandering;
+ mt->_flags = kMfReset | kMfWandering;
mt->_runCount = 12;
if (run && actor.isActionAvailable(kActionRun))
- mt->_flags |= requestRun;
+ mt->_flags |= kMfRequestRun;
RequestWanderPath(mt, getPathFindIQ(&actor));
}
@@ -1374,11 +1374,11 @@ void MotionTask::tetheredWander(
mt->_tetherMaxU = tetherReg.max.u;
mt->_tetherMaxV = tetherReg.max.v;
mt->_pathCount = mt->_pathIndex = 0;
- mt->_flags = reset | wandering | tethered;
+ mt->_flags = kMfReset | kMfWandering | kMfTethered;
mt->_runCount = 12;
if (run && actor.isActionAvailable(kActionRun))
- mt->_flags |= requestRun;
+ mt->_flags |= kMfRequestRun;
RequestWanderPath(mt, getPathFindIQ(&actor));
}
@@ -1394,7 +1394,7 @@ void MotionTask::upLadder(Actor &actor) {
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
if (mt->_motionType != motionTypeClimbUp) {
mt->_motionType = motionTypeClimbUp;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1408,7 +1408,7 @@ void MotionTask::downLadder(Actor &actor) {
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
if (mt->_motionType != motionTypeClimbDown) {
mt->_motionType = motionTypeClimbDown;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1422,7 +1422,7 @@ void MotionTask::talk(Actor &actor) {
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
if (mt->_motionType != motionTypeTalk) {
mt->_motionType = motionTypeTalk;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1438,7 +1438,7 @@ void MotionTask::jump(Actor &actor) {
if (mt->_motionType != motionTypeThrown) {
mt->_velocity.z = 10;
mt->_motionType = motionTypeJump;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1453,7 +1453,7 @@ void MotionTask::wait(Actor &a) {
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
if (mt->_motionType != motionTypeWait) {
mt->_motionType = motionTypeWait;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1468,8 +1468,8 @@ void MotionTask::useObject(Actor &a, GameObject &dObj) {
if (mt->_motionType != motionTypeUseObject) {
mt->_motionType = motionTypeUseObject;
mt->_o.directObject = &dObj;
- mt->_flags = reset;
- if (isPlayerActor(&a)) mt->_flags |= privledged;
+ mt->_flags = kMfReset;
+ if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
}
}
}
@@ -1488,8 +1488,8 @@ void MotionTask::useObjectOnObject(
mt->_motionType = motionTypeUseObjectOnObject;
mt->_o.directObject = &dObj;
mt->_o.indirectObject = ⌖
- mt->_flags = reset;
- if (isPlayerActor(&a)) mt->_flags |= privledged;
+ mt->_flags = kMfReset;
+ if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
}
}
}
@@ -1508,7 +1508,7 @@ void MotionTask::useObjectOnTAI(
mt->_motionType = motionTypeUseObjectOnTAI;
mt->_o.directObject = &dObj;
mt->_o.TAI = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1527,7 +1527,7 @@ void MotionTask::useObjectOnLocation(
mt->_motionType = motionTypeUseObjectOnLocation;
mt->_o.directObject = &dObj;
mt->_targetLoc = target;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1542,7 +1542,7 @@ void MotionTask::useTAI(Actor &a, ActiveItem &dTAI) {
if (mt->_motionType != motionTypeUseTAI) {
mt->_motionType = motionTypeUseTAI;
mt->_o.TAI = &dTAI;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1561,7 +1561,7 @@ void MotionTask::dropObject(Actor &a,
mt->_motionType = motionTypeDropObject;
mt->_o.directObject = &dObj;
mt->_targetLoc = loc;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->moveCount = num;
}
}
@@ -1596,7 +1596,7 @@ void MotionTask::dropObjectOnObject(
mt->_motionType = motionTypeDropObjectOnObject;
mt->_o.directObject = &dObj;
mt->_o.indirectObject = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->moveCount = num;
}
}
@@ -1618,7 +1618,7 @@ void MotionTask::dropObjectOnTAI(
mt->_o.directObject = &dObj;
mt->_o.TAI = ⌖
mt->_targetLoc = loc;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1648,7 +1648,7 @@ void MotionTask::twoHandedSwing(Actor &a, GameObject &target) {
if (mt->_motionType != motionTypeTwoHandedSwing) {
mt->_motionType = motionTypeTwoHandedSwing;
mt->_targetObj = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1663,7 +1663,7 @@ void MotionTask::oneHandedSwing(Actor &a, GameObject &target) {
if (mt->_motionType != motionTypeOneHandedSwing) {
mt->_motionType = motionTypeOneHandedSwing;
mt->_targetObj = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1678,7 +1678,7 @@ void MotionTask::fireBow(Actor &a, GameObject &target) {
if (mt->_motionType != motionTypeFireBow) {
mt->_motionType = motionTypeFireBow;
mt->_targetObj = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1699,9 +1699,9 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, GameObject &target) {
mt->_motionType = type;
mt->_spellObj = &spell;
mt->_targetObj = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_direction = (mt->_targetObj->getLocation() - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->_flags |= privledged;
+ if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
}
}
}
@@ -1718,9 +1718,9 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, Location &target) {
mt->_motionType = type;
mt->_spellObj = &spell;
mt->_targetLoc = target; //target;
- mt->_flags = reset | LocTarg;
+ mt->_flags = kMfReset | kMfLocTarg;
mt->_direction = (target - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->_flags |= privledged;
+ if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
}
}
}
@@ -1745,9 +1745,9 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, ActiveItem &target) {
target._data.instance.h,
a.world()->thisID());
mt->_targetLoc = loc; //target;
- mt->_flags = reset | TAGTarg;
+ mt->_flags = kMfReset | kMfTAGTarg;
mt->_direction = (loc - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->_flags |= privledged;
+ if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
}
}
}
@@ -1762,7 +1762,7 @@ void MotionTask::useWand(Actor &a, GameObject &target) {
if (mt->_motionType != motionTypeUseWand) {
mt->_motionType = motionTypeUseWand;
mt->_targetObj = ⌖
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1784,7 +1784,7 @@ void MotionTask::twoHandedParry(
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &weapon;
}
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_d.defenseFlags = 0;
}
}
@@ -1804,7 +1804,7 @@ void MotionTask::oneHandedParry(
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &weapon;
}
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_d.defenseFlags = 0;
}
}
@@ -1824,7 +1824,7 @@ void MotionTask::shieldParry(
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &shield;
}
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_d.defenseFlags = 0;
}
}
@@ -1840,7 +1840,7 @@ void MotionTask::dodge(Actor &a, Actor &opponent) {
mt->_motionType = motionTypeDodge;
mt->_d.attacker = &opponent;
}
- mt->_flags = reset;
+ mt->_flags = kMfReset;
mt->_d.defenseFlags = 0;
}
}
@@ -1857,7 +1857,7 @@ void MotionTask::acceptHit(Actor &a, Actor &opponent) {
if (mt->_motionType != motionTypeAcceptHit) {
mt->_motionType = motionTypeAcceptHit;
mt->_d.attacker = &opponent;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1872,7 +1872,7 @@ void MotionTask::fallDown(Actor &a, Actor &opponent) {
if (mt->_motionType != motionTypeFallDown) {
mt->_motionType = motionTypeFallDown;
mt->_d.attacker = &opponent;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1886,7 +1886,7 @@ void MotionTask::die(Actor &a) {
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
if (mt->_motionType != motionTypeDie) {
mt->_motionType = motionTypeDie;
- mt->_flags = reset;
+ mt->_flags = kMfReset;
}
}
}
@@ -1932,7 +1932,7 @@ bool MotionTask::isWalk() {
TileRegion MotionTask::getTether() {
TileRegion reg;
- if (_flags & tethered) {
+ if (_flags & kMfTethered) {
reg.min = TilePoint(_tetherMinU, _tetherMinV, 0);
reg.max = TilePoint(_tetherMaxU, _tetherMaxV, 0);
} else {
@@ -1956,18 +1956,18 @@ void MotionTask::changeTarget(const TilePoint &newPos, bool run) {
_finalTarget = _immediateLocation = newPos;
_pathCount = _pathIndex = 0;
- _flags = pathFind | reset;
- if (oldFlags & agitatable)
- _flags |= agitatable;
+ _flags = kMfPathFind | kMfReset;
+ if (oldFlags & kMfAgitatable)
+ _flags |= kMfAgitatable;
// Set run flag if requested
if (run
// Check if actor capable of running...
&& ((Actor *)_object)->isActionAvailable(kActionRun))
- _flags |= requestRun;
+ _flags |= kMfRequestRun;
else
- _flags &= ~requestRun;
+ _flags &= ~kMfRequestRun;
RequestPath(this, getPathFindIQ(_object));
}
@@ -1984,17 +1984,17 @@ void MotionTask::changeDirectTarget(const TilePoint &newPos, bool run) {
_finalTarget = _immediateLocation = newPos;
// Reset motion task
- _flags |= reset;
- _flags &= ~pathFind;
+ _flags |= kMfReset;
+ _flags &= ~kMfPathFind;
// Set run flag if requested
if (run
// Check if actor capable of running...
&& ((Actor *)_object)->isActionAvailable(kActionRun))
- _flags |= requestRun;
+ _flags |= kMfRequestRun;
else
- _flags &= ~requestRun;
+ _flags &= ~kMfRequestRun;
}
}
@@ -2009,7 +2009,7 @@ void MotionTask::finishWalk() {
// Simply set actor's target _data.location to "here".
_finalTarget = _immediateLocation = _object->getLocation();
_pathList[0] = _finalTarget;
- flags = reset;
+ flags = kMfReset;
_pathCount = 0;
_pathIndex = 0;*/
}
@@ -2051,7 +2051,7 @@ void MotionTask::ballisticAction() {
// Add the force of gravity to the acceleration.
- if (!(_flags & inWater)) {
+ if (!(_flags & kMfInWater)) {
_velocity.z -= gravity;
} else {
_velocity.u = _velocity.v = 0;
@@ -2250,7 +2250,7 @@ void MotionTask::ballisticAction() {
_motionType = velocityMagnitude <= 16
? motionTypeLand
: motionTypeLandBadly;
- _flags |= reset;
+ _flags |= kMfReset;
setObjectSurface(obj, sti);
} else {
setObjectSurface(obj, sti);
@@ -2299,11 +2299,11 @@ void MotionTask::ballisticAction() {
bool MotionTask::nextWayPoint() {
// If the pathfinder hasn't managed to determine waypoints
// yet, then return failure.
-// if ( ( _flags & pathFind ) && _pathCount < 0 ) return false;
+// if ( ( _flags & kMfPathFind ) && _pathCount < 0 ) return false;
// If there are still waypoints in the path list, then
// retrieve the next waypoint.
- if ((_flags & (pathFind | wandering)) && _pathIndex < _pathCount) {
+ if ((_flags & (kMfPathFind | kMfWandering)) && _pathIndex < _pathCount) {
TilePoint wayPointVector(0, 0, 0);
if (_pathIndex > 0)
@@ -2315,11 +2315,11 @@ bool MotionTask::nextWayPoint() {
else
return false;
} else {
- if (_flags & wandering) {
+ if (_flags & kMfWandering) {
_immediateLocation = Nowhere;
if (_pathFindTask == nullptr)
RequestWanderPath(this, getPathFindIQ(_object));
- } else if (_flags & agitated) {
+ } else if (_flags & kMfAgitated) {
_immediateLocation = Nowhere;
} else {
// If we've gone off the end of the path list,
@@ -2329,8 +2329,8 @@ bool MotionTask::nextWayPoint() {
if ((_finalTarget - _object->_data.location).quickHDistance() > 0
|| ABS(_finalTarget.z - _object->_data.location.z) > kMaxStepHeight) {
// If no pathfind in progress
- if ((_flags & pathFind)
- && !(_flags & finalPath)
+ if ((_flags & kMfPathFind)
+ && !(_flags & kMfFinalPath)
&& _pathFindTask == nullptr)
RequestPath(this, getPathFindIQ(_object));
@@ -2411,9 +2411,9 @@ void MotionTask::walkAction() {
// Set the speed of movement based on whether we are walking
// or running. Running only occurs after we have accelerated.
- if (_flags & requestRun
+ if (_flags & kMfRequestRun
&& _runCount == 0
- && !(_flags & (inWater | onStairs))) {
+ && !(_flags & (kMfInWater | kMfOnStairs))) {
speed = runSpeed;
speedScale = 4;
walkType = walkRun;
@@ -2430,8 +2430,8 @@ void MotionTask::walkAction() {
// If for some reason we cannot run at this time, then
// set up for a walk instead.
if (walkType != walkRun) {
- if (!(_flags & onStairs)) {
- if (!(_flags & inWater)) {
+ if (!(_flags & kMfOnStairs)) {
+ if (!(_flags & kMfInWater)) {
speed = walkSpeed;
speedScale = 2;
walkType = walkNormal;
@@ -2461,16 +2461,16 @@ void MotionTask::walkAction() {
}
}
- if ((_flags & agitated)
+ if ((_flags & kMfAgitated)
&& --actionCounter <= 0) {
- _flags &= ~agitated;
- _flags |= pathFind | reset;
+ _flags &= ~kMfAgitated;
+ _flags |= kMfPathFind | kMfReset;
}
for (;;) {
// The "reset" flag indicates that the final target has
// changed since the last time this routine was called.
- if (!(_flags & reset)) {
+ if (!(_flags & kMfReset)) {
// Compute the vector and distance of the current
// position to the next "immediate" target.
targetVector = immediateTarget - _object->_data.location;
@@ -2490,7 +2490,7 @@ void MotionTask::walkAction() {
else moveTaskDone = true;
break;
} else {
- _flags &= ~reset;
+ _flags &= ~kMfReset;
immediateTarget = getImmediateTarget();
}
}
@@ -2580,7 +2580,7 @@ void MotionTask::walkAction() {
movementDirection = a->_currentFacing;
moveBlocked = true;
}
- /* if (!(_flags & pathFind) || nextWayPoint() == false)
+ /* if (!(_flags & kMfPathFind) || nextWayPoint() == false)
{
moveBlocked = true;
_flags |= blocked;
@@ -2705,7 +2705,7 @@ void MotionTask::walkAction() {
remove(motionCompleted);
} else if (moveBlocked) {
a->setAction(kActionStand, 0);
- if (_flags & agitatable) {
+ if (_flags & kMfAgitatable) {
if (freeFall(_object->_data.location, sti)) return;
// When he starts running again, then have him walk only.
@@ -2713,14 +2713,14 @@ void MotionTask::walkAction() {
// We're blocked so we're going to wander in a random
// direction for a random duration
- _flags |= agitated | reset;
+ _flags |= kMfAgitated | kMfReset;
_direction = g_vm->_rnd->getRandomNumber(7);
actionCounter = 8 + g_vm->_rnd->getRandomNumber(7);
// Discard the path
- if (_flags & pathFind) {
- _flags &= ~finalPath;
+ if (_flags & kMfPathFind) {
+ _flags &= ~kMfFinalPath;
_pathIndex = _pathCount = 0;
}
} else
@@ -2737,7 +2737,7 @@ void MotionTask::walkAction() {
int16 tHeight;
- _flags &= ~blocked;
+ _flags &= ~kMfBlocked;
tHeight = tileSlopeHeight(newPos, _object, &sti);
@@ -2776,18 +2776,18 @@ void MotionTask::walkAction() {
if (a->_currentFacing == stairsDir) {
// walk up stairs
newAction = kActionSpecial7;
- _flags |= onStairs;
+ _flags |= kMfOnStairs;
} else if (a->_currentFacing == ((stairsDir - 4) & 0x7)) {
// walk down stairs
newAction = kActionSpecial8;
- _flags |= onStairs;
+ _flags |= kMfOnStairs;
} else {
- _flags &= ~onStairs;
+ _flags &= ~kMfOnStairs;
if (walkType == walkStairs) walkType = walkNormal;
newAction = (walkType == walkRun) ? kActionRun : kActionWalk;
}
} else {
- _flags &= ~onStairs;
+ _flags &= ~kMfOnStairs;
if (walkType == walkStairs) walkType = walkNormal;
newAction = (walkType == walkRun) ? kActionRun : kActionWalk;
}
@@ -2804,9 +2804,9 @@ void MotionTask::walkAction() {
if (walkType != walkSlow)
a->nextAnimationFrame();
else {
- if (_flags & nextAnim)
+ if (_flags & kMfNextAnim)
a->nextAnimationFrame();
- _flags ^= nextAnim;
+ _flags ^= kMfNextAnim;
}
} else if (a->_currentAnimation == kActionWalk
|| a->_currentAnimation == kActionRun
@@ -2821,15 +2821,15 @@ void MotionTask::walkAction() {
if (walkType != walkSlow)
a->nextAnimationFrame();
else {
- if (_flags & nextAnim)
+ if (_flags & kMfNextAnim)
a->nextAnimationFrame();
- _flags ^= nextAnim;
+ _flags ^= kMfNextAnim;
}
} else {
// If we weren't walking or running before, then start
// walking/running and reset the sequence.
a->setAction(newAction, kAnimateRepeat);
- if (walkType == walkSlow) _flags |= nextAnim;
+ if (walkType == walkSlow) _flags |= kMfNextAnim;
}
if (_runCount > 0) _runCount--;
@@ -2844,9 +2844,9 @@ void MotionTask::walkAction() {
void MotionTask::upLadderAction() {
Actor *a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
a->setAction(kActionClimbLadder, kAnimateRepeat);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else {
TilePoint loc = a->getLocation();
uint8 crossSection = a->proto()->crossSection,
@@ -2971,9 +2971,9 @@ void MotionTask::upLadderAction() {
void MotionTask::downLadderAction() {
Actor *a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
a->setAction(kActionClimbLadder, kAnimateRepeat | kAnimateReverse);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else {
TilePoint loc = a->getLocation();
uint8 crossSection = a->proto()->crossSection;
@@ -3092,9 +3092,9 @@ void MotionTask::giveAction() {
Direction targetDir = (_targetObj->getLocation()
- a->getLocation()).quickDir();
- if (_flags & reset) {
+ if (_flags & kMfReset) {
a->setAction(kActionGiveItem, 0);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
if (a->_currentFacing != targetDir)
@@ -3108,9 +3108,9 @@ void MotionTask::giveAction() {
void MotionTask::genericAnimationAction(uint8 actionType) {
Actor *const a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
a->setAction(actionType, 0);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else if (a->nextAnimationFrame())
remove(motionCompleted);
}
@@ -3173,7 +3173,7 @@ const CombatMotionSet twoHandedLowSwingSet = {
void MotionTask::twoHandedSwingAction() {
// If the reset flag is set, initialize the motion
- if (_flags & reset) {
+ if (_flags & kMfReset) {
// Let the game engine know about this aggressive act
logAggressiveAct(_object->thisID(), _targetObj->thisID());
@@ -3232,19 +3232,19 @@ void MotionTask::twoHandedSwingAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
actionCounter = 2;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction) + 10);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else
// Call the generic offensive melee function
offensiveMeleeAction();
@@ -3287,7 +3287,7 @@ const CombatMotionSet oneHandedLowSwingSet = {
// Handle all one handed swing motions
void MotionTask::oneHandedSwingAction() {
- if (_flags & reset) {
+ if (_flags & kMfReset) {
// Let the game engine know about this aggressive act
logAggressiveAct(_object->thisID(), _targetObj->thisID());
@@ -3348,13 +3348,13 @@ void MotionTask::oneHandedSwingAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
actionCounter = 1;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
}
@@ -3364,7 +3364,7 @@ void MotionTask::oneHandedSwingAction() {
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction) + 10);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else
// Call the generic offensive melee function
offensiveMeleeAction();
@@ -3376,7 +3376,7 @@ void MotionTask::oneHandedSwingAction() {
uint16 MotionTask::framesUntilStrike() {
// If the melee action has not been initialized, return a safe value
- if (_flags & reset) return maxuint16;
+ if (_flags & kMfReset) return maxuint16;
uint16 turnFrames;
@@ -3392,7 +3392,7 @@ uint16 MotionTask::framesUntilStrike() {
GameObject *MotionTask::blockingObject(Actor *thisAttacker) {
return isDefense()
- && (_d.defenseFlags & blocking)
+ && (_d.defenseFlags & kDfBlocking)
&& thisAttacker == _d.attacker
? _d.defensiveObj
: nullptr;
@@ -3407,7 +3407,7 @@ void MotionTask::fireBowAction() {
assert(a->_leftHandObject != Nothing);
// Initialize the bow firing motion
- if (_flags & reset) {
+ if (_flags & kMfReset) {
// Let the game engine know about this aggressive act
logAggressiveAct(_object->thisID(), _targetObj->thisID());
@@ -3423,13 +3423,13 @@ void MotionTask::fireBowAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
actionCounter = 1;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
@@ -3438,14 +3438,14 @@ void MotionTask::fireBowAction() {
if (a->_currentFacing != _direction)
a->turn(_direction);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else if (a->_currentFacing != _direction)
a->turn(_direction);
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
// If the action counter has reached zero, get a projectile and
// fire it
@@ -3483,7 +3483,7 @@ void MotionTask::fireBowAction() {
}
}
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3508,7 +3508,7 @@ void MotionTask::castSpellAction() {
if (a->_currentFacing != _direction)
a->turn(_direction);
else {
- if (_flags & reset) {
+ if (_flags & kMfReset) {
if (a->_appearance != nullptr
&& a->isActionAvailable(kActionCastSpell)) {
// Calculate the number of frames in the animation before the
@@ -3518,29 +3518,29 @@ void MotionTask::castSpellAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
actionCounter = 3;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
if (actionCounter == 0) {
if (_spellObj) {
- if (_flags & TAGTarg) {
+ if (_flags & kMfTAGTarg) {
assert(_targetTAG->_data.itemType == activeTypeInstance);
_spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetTAG);
- } else if (_flags & LocTarg) {
+ } else if (_flags & kMfLocTarg) {
_spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetLoc);
} else if (_targetObj) {
_spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetObj->thisID());
@@ -3548,7 +3548,7 @@ void MotionTask::castSpellAction() {
}
}
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3568,7 +3568,7 @@ void MotionTask::castSpellAction() {
void MotionTask::useWandAction() {
// Initialize the wand using motion
- if (_flags & reset) {
+ if (_flags & kMfReset) {
// Let the game engine know about this aggressive act
logAggressiveAct(_object->thisID(), _targetObj->thisID());
@@ -3583,19 +3583,19 @@ void MotionTask::useWandAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
actionCounter = 3;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction) + 10);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
useMagicWeaponAction();
}
@@ -3605,7 +3605,7 @@ void MotionTask::useWandAction() {
// Handle two handed parrying motions
void MotionTask::twoHandedParryAction() {
- if (_flags & reset) {
+ if (_flags & kMfReset) {
Actor *a = (Actor *)_object;
int16 animationFrames;
@@ -3618,20 +3618,20 @@ void MotionTask::twoHandedParryAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 2;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
defensiveMeleeAction();
}
@@ -3640,7 +3640,7 @@ void MotionTask::twoHandedParryAction() {
// Handle one handed parrying motions
void MotionTask::oneHandedParryAction() {
- if (_flags & reset) {
+ if (_flags & kMfReset) {
Actor *a = (Actor *)_object;
int16 animationFrames;
@@ -3654,20 +3654,20 @@ void MotionTask::oneHandedParryAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 2;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
defensiveMeleeAction();
}
@@ -3676,7 +3676,7 @@ void MotionTask::oneHandedParryAction() {
// Handle shield parrying motions
void MotionTask::shieldParryAction() {
- if (_flags & reset) {
+ if (_flags & kMfReset) {
Actor *a = (Actor *)_object;
int16 animationFrames;
@@ -3689,20 +3689,20 @@ void MotionTask::shieldParryAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 1;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(
computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
defensiveMeleeAction();
}
@@ -3714,7 +3714,7 @@ void MotionTask::dodgeAction() {
Actor *a = (Actor *)_object;
MotionTask *attackerMotion = _d.attacker->_moveTask;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
// If the attacker is not attacking, we're done
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -3734,27 +3734,27 @@ void MotionTask::dodgeAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 3;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
actionCounter = animationFrames - 1;
a->setActionPoints(animationFrames + 1);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter > 0) actionCounter--;
@@ -3775,7 +3775,7 @@ void MotionTask::dodgeAction() {
void MotionTask::acceptHitAction() {
Actor *a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
TilePoint newLoc = a->getLocation();
StandingTileInfo sti;
int16 animationFrames;
@@ -3790,13 +3790,13 @@ void MotionTask::acceptHitAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 1;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(animationFrames + 1);
@@ -3813,14 +3813,14 @@ void MotionTask::acceptHitAction() {
}
}
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
if (a->nextAnimationFrame()) remove();
} else
remove();
@@ -3833,7 +3833,7 @@ void MotionTask::acceptHitAction() {
void MotionTask::fallDownAction() {
Actor *a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
TilePoint newLoc = a->getLocation();
StandingTileInfo sti;
int16 animationFrames;
@@ -3850,13 +3850,13 @@ void MotionTask::fallDownAction() {
// Set this flag to indicate that the animation is actually
// being played
- _flags |= nextAnim;
+ _flags |= kMfNextAnim;
} else {
animationFrames = 6;
// Clear this flag to indicate that the animation is not
// being played
- _flags &= ~nextAnim;
+ _flags &= ~kMfNextAnim;
}
a->setActionPoints(animationFrames + 1);
@@ -3873,14 +3873,14 @@ void MotionTask::fallDownAction() {
}
}
- _flags &= ~reset;
+ _flags &= ~kMfReset;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
if (a->nextAnimationFrame()) remove();
} else
remove();
@@ -3900,8 +3900,8 @@ void MotionTask::offensiveMeleeAction() {
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
// If the action counter has reached zero, use the weapon on
// the target
@@ -3912,7 +3912,7 @@ void MotionTask::offensiveMeleeAction() {
if (weapon) weapon->strike(a->thisID(), _targetObj->thisID());
}
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3939,8 +3939,8 @@ void MotionTask::useMagicWeaponAction() {
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
// If the action counter has reached zero, get a spell and
// use it
@@ -3966,7 +3966,7 @@ void MotionTask::useMagicWeaponAction() {
}
}
- if (_flags & nextAnim) {
+ if (_flags & kMfNextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3990,7 +3990,7 @@ void MotionTask::defensiveMeleeAction() {
MotionTask *attackerMotion = _d.attacker->_moveTask;
// Determine if the blocking action has been initiated
- if (!(_d.defenseFlags & blocking)) {
+ if (!(_d.defenseFlags & kDfBlocking)) {
// If the attacker is not attacking, we're done
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -4005,15 +4005,15 @@ void MotionTask::defensiveMeleeAction() {
// If the strike is about to land start the blocking motion
if (attackerMotion->framesUntilStrike() <= 1)
- _d.defenseFlags |= blocking;
+ _d.defenseFlags |= kDfBlocking;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((_flags & nextAnim) && a->_appearance == nullptr)
- _flags &= ~nextAnim;
+ if ((_flags & kMfNextAnim) && a->_appearance == nullptr)
+ _flags &= ~kMfNextAnim;
// Run through the animation frames
- if (!(_flags & nextAnim) || a->nextAnimationFrame()) {
+ if (!(_flags & kMfNextAnim) || a->nextAnimationFrame()) {
// Wait for the attacker's attack
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -4056,9 +4056,9 @@ void MotionTask::updatePositions() {
continue;
if (obj->_data.location.z < -(proto->height >> 2))
- mt->_flags |= inWater;
+ mt->_flags |= kMfInWater;
else
- mt->_flags &= ~inWater;
+ mt->_flags &= ~kMfInWater;
switch (mt->_motionType) {
case motionTypeThrown:
@@ -4080,20 +4080,20 @@ void MotionTask::updatePositions() {
case motionTypeTalk:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
a->setAction(kActionStand, 0);
a->_cycleCount = g_vm->_rnd->getRandomNumber(3);
- mt->_flags &= ~(reset | nextAnim);
+ mt->_flags &= ~(kMfReset | kMfNextAnim);
}
if (a->_cycleCount == 0) {
a->setAction(kActionTalk, 0);
- mt->_flags |= nextAnim;
+ mt->_flags |= kMfNextAnim;
a->_cycleCount = -1;
- } else if (mt->_flags & nextAnim) {
+ } else if (mt->_flags & kMfNextAnim) {
if (a->nextAnimationFrame()) {
a->setAction(kActionStand, 0);
a->_cycleCount = g_vm->_rnd->getRandomNumber(3);
- mt->_flags &= ~nextAnim;
+ mt->_flags &= ~kMfNextAnim;
}
} else
a->_cycleCount--;
@@ -4102,7 +4102,7 @@ void MotionTask::updatePositions() {
case motionTypeLand:
case motionTypeLandBadly:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
int16 newAction = mt->_motionType == motionTypeLand
? kActionJumpUp
: kActionFallBadly;
@@ -4110,33 +4110,33 @@ void MotionTask::updatePositions() {
if (!a->isActionAvailable(newAction)) {
if (mt->_prevMotionType == motionTypeWalk) {
mt->_motionType = mt->_prevMotionType;
- if (mt->_flags & pathFind) {
+ if (mt->_flags & kMfPathFind) {
mt->changeTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
} else {
mt->changeDirectTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
}
} else {
a->setAction(newAction, 0);
a->setInterruptablity(false);
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
- } else if (a->nextAnimationFrame() || (mt->_flags & inWater)) {
+ } else if (a->nextAnimationFrame() || (mt->_flags & kMfInWater)) {
if (mt->_prevMotionType == motionTypeWalk) {
mt->_motionType = mt->_prevMotionType;
- if (mt->_flags & pathFind) {
+ if (mt->_flags & kMfPathFind) {
mt->changeTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
} else {
mt->changeDirectTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
} else if (mt->freeFall(obj->_data.location, sti) == false)
@@ -4146,18 +4146,18 @@ void MotionTask::updatePositions() {
// landing sequence by aborting the landing animation
// after the first frame.
if (mt->_prevMotionType == motionTypeWalk
- && mt->_flags & requestRun
+ && mt->_flags & kMfRequestRun
&& mt->_runCount == 0
- && !(mt->_flags & inWater)) {
+ && !(mt->_flags & kMfInWater)) {
mt->_motionType = mt->_prevMotionType;
- if (mt->_flags & pathFind) {
+ if (mt->_flags & kMfPathFind) {
mt->changeTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
} else {
mt->changeDirectTarget(
mt->_finalTarget,
- (mt->_flags & requestRun) != 0);
+ (mt->_flags & kMfRequestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
}
@@ -4166,10 +4166,10 @@ void MotionTask::updatePositions() {
case motionTypeJump:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
a->setAction(kActionJumpUp, 0);
a->setInterruptablity(false);
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
} else if (a->nextAnimationFrame()) {
mt->_motionType = motionTypeThrown;
a->setAction(kActionFreeFall, 0);
@@ -4190,16 +4190,16 @@ void MotionTask::updatePositions() {
if (a->_data.location.z < mt->_immediateLocation.z) {
a->_data.location.z++;
- if (mt->_flags & nextAnim)
+ if (mt->_flags & kMfNextAnim)
a->nextAnimationFrame();
- mt->_flags ^= nextAnim;
+ mt->_flags ^= kMfNextAnim;
} else {
targetVector = mt->_finalTarget - obj->_data.location;
targetDist = targetVector.quickHDistance();
if (targetDist > kTileUVSize) {
mt->_motionType = mt->_prevMotionType;
- mt->_flags |= reset;
+ mt->_flags |= kMfReset;
g_vm->_mTaskList->_nextMT = it;
} else
moveTaskDone = true;
@@ -4208,9 +4208,9 @@ void MotionTask::updatePositions() {
case motionTypeWait:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
mt->actionCounter = 5;
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
} else if (--mt->actionCounter == 0)
moveTaskDone = true;
break;
@@ -4267,7 +4267,7 @@ void MotionTask::updatePositions() {
case motionTypeUseObjectOnTAI:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
TilePoint actorLoc = a->getLocation(),
TAILoc;
TileRegion TAIReg;
@@ -4289,7 +4289,7 @@ void MotionTask::updatePositions() {
// Compute the direction from the actor to the TAI
mt->_direction = (TAILoc - actorLoc).quickDir();
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
if (a->_currentFacing != mt->_direction)
@@ -4307,9 +4307,9 @@ void MotionTask::updatePositions() {
case motionTypeUseObjectOnLocation:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
if (a->_currentFacing != mt->_direction)
@@ -4327,7 +4327,7 @@ void MotionTask::updatePositions() {
case motionTypeUseTAI:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
TilePoint actorLoc = a->getLocation(),
TAILoc;
TileRegion TAIReg;
@@ -4349,7 +4349,7 @@ void MotionTask::updatePositions() {
// Compute the direction from the actor to the TAI
mt->_direction = (TAILoc - actorLoc).quickDir();
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
if (a->_currentFacing != mt->_direction)
@@ -4365,9 +4365,9 @@ void MotionTask::updatePositions() {
case motionTypeDropObject:
if (isWorld(mt->_targetLoc._context)) {
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
if (a->_currentFacing != mt->_direction)
@@ -4437,9 +4437,9 @@ void MotionTask::updatePositions() {
case motionTypeDropObjectOnTAI:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
}
if (a->_currentFacing != mt->_direction)
@@ -4503,11 +4503,11 @@ void MotionTask::updatePositions() {
break;
case motionTypeDie:
- if (mt->_flags & reset) {
+ if (mt->_flags & kMfReset) {
if (a->isActionAvailable(kActionDie)) {
a->setAction(kActionDie, 0);
a->setInterruptablity(false);
- mt->_flags &= ~reset;
+ mt->_flags &= ~kMfReset;
} else {
moveTaskDone = true;
a->setInterruptablity(true);
@@ -4564,7 +4564,7 @@ bool MotionTask::freeFall(TilePoint &newPos, StandingTileInfo &sti) {
supported:
if (_motionType != motionTypeWalk
|| tHeight <= newPos.z
- || !(_flags & inWater)) {
+ || !(_flags & kMfInWater)) {
if (tHeight > newPos.z + kMaxStepHeight) {
unstickObject(_object);
tHeight = tileSlopeHeight(newPos, _object, &sti);
diff --git a/engines/saga2/motion.h b/engines/saga2/motion.h
index 56524541ac8..b2a1b6320c5 100644
--- a/engines/saga2/motion.h
+++ b/engines/saga2/motion.h
@@ -116,22 +116,22 @@ class MotionTask {
uint16 _flags; // various flags
enum motionFlags {
- pathFind = (1 << 0), // walk is using path finding
- finalPath = (1 << 1), // current path is final
- inWater = (1 << 2), // handle motion as in water
- reset = (1 << 3), // target has been reset
- blocked = (1 << 4), // target was blocked
- requestRun = (1 << 5), // caller has requested running
- wandering = (1 << 6), // wander
- tethered = (1 << 7), // stay within tether
- nextAnim = (1 << 8), // update animation for this frame
- turnDelay = (1 << 9), // Delay While Turning
- TAGTarg = (1 << 10), // The target is not an object but a TAG
- LocTarg = (1 << 11), // The target is not an object but a TAG
- agitated = (1 << 12), // Walking around blockage
- agitatable = (1 << 13), // Will agitate when blocked
- onStairs = (1 << 14), // actor is climbing stairs
- privledged = (1 << 15) // don't let AI interrupt this
+ kMfPathFind = (1 << 0), // walk is using path finding
+ kMfFinalPath = (1 << 1), // current path is final
+ kMfInWater = (1 << 2), // handle motion as in water
+ kMfReset = (1 << 3), // target has been reset
+ kMfBlocked = (1 << 4), // target was blocked
+ kMfRequestRun = (1 << 5), // caller has requested running
+ kMfWandering = (1 << 6), // wander
+ kMfTethered = (1 << 7), // stay within tether
+ kMfNextAnim = (1 << 8), // update animation for this frame
+ kMfTurnDelay = (1 << 9), // Delay While Turning
+ kMfTAGTarg = (1 << 10), // The target is not an object but a TAG
+ kMfLocTarg = (1 << 11), // The target is not an object but a TAG
+ kMfAgitated = (1 << 12), // Walking around blockage
+ kMfAgitatable = (1 << 13), // Will agitate when blocked
+ kMfOnStairs = (1 << 14), // actor is climbing stairs
+ kMfPrivledged = (1 << 15) // don't let AI interrupt this
};
Direction _direction; // direction of movement
@@ -161,7 +161,7 @@ class MotionTask {
};
enum defenseMotionFlags {
- blocking = (1 << 0) // actor is blocking an attack
+ kDfBlocking = (1 << 0) // actor is blocking an attack
};
union {
@@ -274,9 +274,9 @@ private:
void turnAction() {
Actor *a = (Actor *)_object;
- if (_flags & reset) {
+ if (_flags & kMfReset) {
a->setAction(kActionStand, 0);
- _flags &= ~reset;
+ _flags &= ~kMfReset;
}
if (a->_currentFacing != _direction)
@@ -453,21 +453,21 @@ public:
// Determine if the motion task is walking to a destination
bool isWalkToDest() {
- return isWalk() && !(_flags & wandering);
+ return isWalk() && !(_flags & kMfWandering);
}
// Determine if the motion task is a wandering motion
bool isWander() {
- return isWalk() && (_flags & wandering);
+ return isWalk() && (_flags & kMfWandering);
}
// Determine if the motion task is tethered
bool isTethered() {
- return isWander() && (_flags & tethered);
+ return isWander() && (_flags & kMfTethered);
}
bool isRunning() {
- return (_flags & requestRun) && _runCount == 0;
+ return (_flags & kMfRequestRun) && _runCount == 0;
}
bool isTurn() {
@@ -529,7 +529,7 @@ public:
static void initMotionTasks();
bool isPrivledged() {
- return _flags & privledged;
+ return _flags & kMfPrivledged;
}
};
diff --git a/engines/saga2/path.cpp b/engines/saga2/path.cpp
index 45b49b4f7d6..5440759d58a 100644
--- a/engines/saga2/path.cpp
+++ b/engines/saga2/path.cpp
@@ -1382,7 +1382,7 @@ PathRequest::PathRequest(Actor *a, int16 howSmart) {
_actor = a;
_smartness = howSmart;
_mTask = _actor->_moveTask;
- _flags = _mTask->_flags & MotionTask::requestRun ? run : 0;
+ _flags = _mTask->_flags & MotionTask::kMfRequestRun ? run : 0;
if (_path == nullptr)
_path = new TilePoint[kPathSize]();
@@ -1658,8 +1658,8 @@ void PathRequest::finish() {
memcpy(_mTask->_pathList, _path, _pathLength * sizeof(_path[0]));
_mTask->_pathCount = _pathLength;
_mTask->_pathIndex = 0;
- _mTask->_flags |= MotionTask::reset;
- if (_flags & completed) _mTask->_flags |= MotionTask::finalPath;
+ _mTask->_flags |= MotionTask::kMfReset;
+ if (_flags & completed) _mTask->_flags |= MotionTask::kMfFinalPath;
_mTask->_pathFindTask = nullptr;
}
}
@@ -2175,7 +2175,7 @@ WanderPathRequest::WanderPathRequest(
Actor *a,
int16 howSmart) :
PathRequest(a, howSmart) {
- if (_mTask->_flags & MotionTask::tethered) {
+ if (_mTask->_flags & MotionTask::kMfTethered) {
_tethered = true;
_tetherMinU = _mTask->_tetherMinU;
_tetherMinV = _mTask->_tetherMinV;
Commit: bf073313a66e252f98fe4b5867124d67bf39c07c
https://github.com/scummvm/scummvm/commit/bf073313a66e252f98fe4b5867124d67bf39c07c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-10-29T01:07:20+02:00
Commit Message:
SAGA2: Rename enums in motion.h 2/2
Changed paths:
engines/saga2/actor.cpp
engines/saga2/motion.cpp
engines/saga2/motion.h
engines/saga2/sagafunc.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 1569f99c660..8f3d41423c2 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -2509,7 +2509,7 @@ void Actor::updateState() {
&& isDead()
&& isInterruptable()
&& (_moveTask == nullptr
- || _moveTask->_motionType != MotionTask::motionTypeDie)) {
+ || _moveTask->_motionType != MotionTask::kMotionTypeDie)) {
int16 deadState = isActionAvailable(kActionDead)
? kActionDead
: isActionAvailable(kActionDie)
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index d144051ec8b..da201b6fa05 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -420,7 +420,7 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
if ((*it)->_object == obj) {
mt = *it;
- wakeUpThread(mt->_thread, motionInterrupted);
+ wakeUpThread(mt->_thread, kMotionInterrupted);
mt->_thread = NoThread;
break;
@@ -431,7 +431,7 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
mt = new MotionTask;
mt->_object = obj;
- mt->_motionType = mt->_prevMotionType = MotionTask::motionTypeNone;
+ mt->_motionType = mt->_prevMotionType = MotionTask::kMotionTypeNone;
mt->_pathFindTask = nullptr;
mt->_pathCount = -1;
mt->_flags = 0;
@@ -483,8 +483,8 @@ void MotionTask::read(Common::InSaveFile *in) {
if (_object && isActor(_object))
((Actor *)_object)->_moveTask = this;
- if (_motionType == motionTypeWalk
- || _prevMotionType == motionTypeWalk) {
+ if (_motionType == kMotionTypeWalk
+ || _prevMotionType == kMotionTypeWalk) {
// Restore the target _data.locations
_immediateLocation.load(in);
_finalTarget.load(in);
@@ -525,7 +525,7 @@ void MotionTask::read(Common::InSaveFile *in) {
_pathFindTask = nullptr;
}
- if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeThrown || _motionType == kMotionTypeShot) {
// Restore the velocity
_velocity.load(in);
@@ -536,7 +536,7 @@ void MotionTask::read(Common::InSaveFile *in) {
_uErrorTerm = in->readSint16LE();
_vErrorTerm = in->readSint16LE();
- if (_motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeShot) {
ObjectID _targetObjID,
enactorID;
@@ -552,27 +552,27 @@ void MotionTask::read(Common::InSaveFile *in) {
? (Actor *)GameObject::objectAddress(enactorID)
: nullptr;
}
- } else if (_motionType == motionTypeClimbUp
- || _motionType == motionTypeClimbDown) {
+ } else if (_motionType == kMotionTypeClimbUp
+ || _motionType == kMotionTypeClimbDown) {
_immediateLocation.load(in);
- } else if (_motionType == motionTypeJump) {
+ } else if (_motionType == kMotionTypeJump) {
_velocity.load(in);
- } else if (_motionType == motionTypeTurn) {
+ } else if (_motionType == kMotionTypeTurn) {
_direction = in->readByte();
- } else if (_motionType == motionTypeGive) {
+ } else if (_motionType == kMotionTypeGive) {
ObjectID id = in->readUint16LE();
_targetObj = id != Nothing
? GameObject::objectAddress(id)
: nullptr;
- } else if (_motionType == motionTypeWait) {
+ } else if (_motionType == kMotionTypeWait) {
actionCounter = in->readSint16LE();
- } else if (_motionType == motionTypeUseObject
- || _motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ } else if (_motionType == kMotionTypeUseObject
+ || _motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
ObjectID directObjID = in->readUint16LE();
_o.directObject = directObjID != Nothing
? GameObject::objectAddress(directObjID)
@@ -580,39 +580,39 @@ void MotionTask::read(Common::InSaveFile *in) {
_direction = in->readByte();
- if (_motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeDropObjectOnObject) {
+ if (_motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnObject) {
ObjectID indirectObjID = in->readUint16LE();
_o.indirectObject = indirectObjID != Nothing
? GameObject::objectAddress(indirectObjID)
: nullptr;
} else {
- if (_motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeDropObjectOnTAI) {
ActiveItemID tai(in->readSint16LE());
_o.TAI = tai != NoActiveItem
? ActiveItem::activeItemAddress(tai)
: nullptr;
}
- if (_motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
_targetLoc.load(in);
}
}
- } else if (_motionType == motionTypeUseTAI) {
+ } else if (_motionType == kMotionTypeUseTAI) {
ActiveItemID tai(in->readSint16LE());
_o.TAI = tai != NoActiveItem
? ActiveItem::activeItemAddress(tai)
: nullptr;
_direction = in->readByte();
- } else if (_motionType == motionTypeTwoHandedSwing
- || _motionType == motionTypeOneHandedSwing
- || _motionType == motionTypeFireBow
- || _motionType == motionTypeCastSpell
- || _motionType == motionTypeUseWand) {
+ } else if (_motionType == kMotionTypeTwoHandedSwing
+ || _motionType == kMotionTypeOneHandedSwing
+ || _motionType == kMotionTypeFireBow
+ || _motionType == kMotionTypeCastSpell
+ || _motionType == kMotionTypeUseWand) {
ObjectID _targetObjID;
// Restore the direction
@@ -629,7 +629,7 @@ void MotionTask::read(Common::InSaveFile *in) {
? GameObject::objectAddress(_targetObjID)
: nullptr;
- if (_motionType == motionTypeCastSpell) {
+ if (_motionType == kMotionTypeCastSpell) {
SpellID sid ;
ObjectID toid ;
ActiveItemID ttaid;
@@ -659,9 +659,9 @@ void MotionTask::read(Common::InSaveFile *in) {
// Restore the action counter
actionCounter = in->readSint16LE();
- } else if (_motionType == motionTypeTwoHandedParry
- || _motionType == motionTypeOneHandedParry
- || _motionType == motionTypeShieldParry) {
+ } else if (_motionType == kMotionTypeTwoHandedParry
+ || _motionType == kMotionTypeOneHandedParry
+ || _motionType == kMotionTypeShieldParry) {
ObjectID attackerID,
defensiveObjID;
@@ -687,13 +687,13 @@ void MotionTask::read(Common::InSaveFile *in) {
// Restore the action counter
actionCounter = in->readSint16LE();
- if (_motionType == motionTypeOneHandedParry) {
+ if (_motionType == kMotionTypeOneHandedParry) {
// Restore the combat sub-motion type
_combatMotionType = in->readByte();
}
- } else if (_motionType == motionTypeDodge
- || _motionType == motionTypeAcceptHit
- || _motionType == motionTypeFallDown) {
+ } else if (_motionType == kMotionTypeDodge
+ || _motionType == kMotionTypeAcceptHit
+ || _motionType == kMotionTypeFallDown) {
ObjectID attackerID;
// Get the attacker's ID
@@ -721,8 +721,8 @@ int32 MotionTask::archiveSize() {
+ sizeof(_flags)
+ sizeof(ObjectID); // object
- if (_motionType == motionTypeWalk
- || _prevMotionType == motionTypeWalk) {
+ if (_motionType == kMotionTypeWalk
+ || _prevMotionType == kMotionTypeWalk) {
size += sizeof(_immediateLocation)
+ sizeof(_finalTarget);
@@ -745,7 +745,7 @@ int32 MotionTask::archiveSize() {
size += sizeof(TilePoint) * (_pathCount - _pathIndex);
}
- if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeThrown || _motionType == kMotionTypeShot) {
size += sizeof(_velocity)
+ sizeof(_steps)
+ sizeof(_uFrac)
@@ -753,57 +753,57 @@ int32 MotionTask::archiveSize() {
+ sizeof(_uErrorTerm)
+ sizeof(_vErrorTerm);
- if (_motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeShot) {
size += sizeof(ObjectID) // _targetObj ID
+ sizeof(ObjectID); // enactor ID
}
- } else if (_motionType == motionTypeClimbUp
- || _motionType == motionTypeClimbDown) {
+ } else if (_motionType == kMotionTypeClimbUp
+ || _motionType == kMotionTypeClimbDown) {
size += sizeof(_immediateLocation);
- } else if (_motionType == motionTypeJump) {
+ } else if (_motionType == kMotionTypeJump) {
size += sizeof(_velocity);
- } else if (_motionType == motionTypeTurn) {
+ } else if (_motionType == kMotionTypeTurn) {
size += sizeof(_direction);
- } else if (_motionType == motionTypeGive) {
+ } else if (_motionType == kMotionTypeGive) {
size += sizeof(ObjectID); // _targetObj ID
- } else if (_motionType == motionTypeUseObject
- || _motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ } else if (_motionType == kMotionTypeUseObject
+ || _motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
size += sizeof(ObjectID)
+ sizeof(_direction);
- if (_motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeDropObjectOnObject) {
+ if (_motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnObject) {
size += sizeof(ObjectID);
} else {
- if (_motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeDropObjectOnTAI) {
size += sizeof(ActiveItemID);
}
- if (_motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
size += sizeof(_targetLoc);
}
}
- } else if (_motionType == motionTypeUseTAI) {
+ } else if (_motionType == kMotionTypeUseTAI) {
size += sizeof(ActiveItemID)
+ sizeof(_direction);
- } else if (_motionType == motionTypeTwoHandedSwing
- || _motionType == motionTypeOneHandedSwing
- || _motionType == motionTypeFireBow
- || _motionType == motionTypeCastSpell
- || _motionType == motionTypeUseWand) {
+ } else if (_motionType == kMotionTypeTwoHandedSwing
+ || _motionType == kMotionTypeOneHandedSwing
+ || _motionType == kMotionTypeFireBow
+ || _motionType == kMotionTypeCastSpell
+ || _motionType == kMotionTypeUseWand) {
size += sizeof(_direction)
+ sizeof(_combatMotionType)
+ sizeof(ObjectID); // _targetObj
- if (_motionType == motionTypeCastSpell) {
+ if (_motionType == kMotionTypeCastSpell) {
size += sizeof(SpellID); // _spellObj
size += sizeof(ObjectID); // _targetObj
size += sizeof(ActiveItemID); // _targetTAG
@@ -812,20 +812,20 @@ int32 MotionTask::archiveSize() {
size += sizeof(actionCounter);
- } else if (_motionType == motionTypeTwoHandedParry
- || _motionType == motionTypeOneHandedParry
- || _motionType == motionTypeShieldParry) {
+ } else if (_motionType == kMotionTypeTwoHandedParry
+ || _motionType == kMotionTypeOneHandedParry
+ || _motionType == kMotionTypeShieldParry) {
size += sizeof(_direction)
+ sizeof(ObjectID) // attacker ID
+ sizeof(ObjectID) // defensiveObj ID
+ sizeof(_d.defenseFlags)
+ sizeof(actionCounter);
- if (_motionType == motionTypeOneHandedParry)
+ if (_motionType == kMotionTypeOneHandedParry)
size += sizeof(_combatMotionType);
- } else if (_motionType == motionTypeDodge
- || _motionType == motionTypeAcceptHit
- || _motionType == motionTypeFallDown) {
+ } else if (_motionType == kMotionTypeDodge
+ || _motionType == kMotionTypeAcceptHit
+ || _motionType == kMotionTypeFallDown) {
size += sizeof(ObjectID) // attacker ID
+ sizeof(actionCounter);
}
@@ -852,8 +852,8 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
// Store the object ID
out->writeUint16LE(objectID);
- if (_motionType == motionTypeWalk
- || _prevMotionType == motionTypeWalk) {
+ if (_motionType == kMotionTypeWalk
+ || _prevMotionType == kMotionTypeWalk) {
// Store the target _data.locations
_immediateLocation.write(out);
_finalTarget.write(out);
@@ -890,7 +890,7 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
}
}
- if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeThrown || _motionType == kMotionTypeShot) {
// Store the velocity
_velocity.write(out);
@@ -901,7 +901,7 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
out->writeSint16LE(_uErrorTerm);
out->writeSint16LE(_vErrorTerm);
- if (_motionType == motionTypeShot) {
+ if (_motionType == kMotionTypeShot) {
ObjectID _targetObjID,
enactorID;
@@ -917,25 +917,25 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
out->writeUint16LE(enactorID);
}
- } else if (_motionType == motionTypeClimbUp
- || _motionType == motionTypeClimbDown) {
+ } else if (_motionType == kMotionTypeClimbUp
+ || _motionType == kMotionTypeClimbDown) {
_immediateLocation.write(out);
- } else if (_motionType == motionTypeJump) {
+ } else if (_motionType == kMotionTypeJump) {
_velocity.write(out);
- } else if (_motionType == motionTypeTurn) {
+ } else if (_motionType == kMotionTypeTurn) {
out->writeByte(_direction);
- } else if (_motionType == motionTypeGive) {
+ } else if (_motionType == kMotionTypeGive) {
if (_targetObj != nullptr)
out->writeUint16LE(_targetObj->thisID());
else
out->writeUint16LE(Nothing);
- } else if (_motionType == motionTypeUseObject
- || _motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ } else if (_motionType == kMotionTypeUseObject
+ || _motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
if (_o.directObject != nullptr)
out->writeUint16LE(_o.directObject->thisID());
else
@@ -943,39 +943,39 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
out->writeByte(_direction);
- if (_motionType == motionTypeUseObjectOnObject
- || _motionType == motionTypeDropObjectOnObject) {
+ if (_motionType == kMotionTypeUseObjectOnObject
+ || _motionType == kMotionTypeDropObjectOnObject) {
if (_o.indirectObject != nullptr)
out->writeUint16LE(_o.indirectObject->thisID());
else
out->writeUint16LE(Nothing);
} else {
- if (_motionType == motionTypeUseObjectOnTAI
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnTAI
+ || _motionType == kMotionTypeDropObjectOnTAI) {
if (_o.TAI != nullptr)
out->writeSint16LE(_o.TAI->thisID());
else
out->writeSint16LE(NoActiveItem.val);
}
- if (_motionType == motionTypeUseObjectOnLocation
- || _motionType == motionTypeDropObject
- || _motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == kMotionTypeUseObjectOnLocation
+ || _motionType == kMotionTypeDropObject
+ || _motionType == kMotionTypeDropObjectOnTAI) {
_targetLoc.write(out);
}
}
- } else if (_motionType == motionTypeUseTAI) {
+ } else if (_motionType == kMotionTypeUseTAI) {
if (_o.TAI != nullptr)
out->writeSint16LE(_o.TAI->thisID());
else
out->writeSint16LE(NoActiveItem.val);
out->writeByte(_direction);
- } else if (_motionType == motionTypeTwoHandedSwing
- || _motionType == motionTypeOneHandedSwing
- || _motionType == motionTypeFireBow
- || _motionType == motionTypeCastSpell
- || _motionType == motionTypeUseWand) {
+ } else if (_motionType == kMotionTypeTwoHandedSwing
+ || _motionType == kMotionTypeOneHandedSwing
+ || _motionType == kMotionTypeFireBow
+ || _motionType == kMotionTypeCastSpell
+ || _motionType == kMotionTypeUseWand) {
ObjectID _targetObjID;
// Store the direction
@@ -990,7 +990,7 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
// Store the target object ID
out->writeUint16LE(_targetObjID);
- if (_motionType == motionTypeCastSpell) {
+ if (_motionType == kMotionTypeCastSpell) {
// Convert the spell object pointer to an ID
SpellID sid = _spellObj != nullptr
@@ -1022,9 +1022,9 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
// Store the action counter
out->writeSint16LE(actionCounter);
- } else if (_motionType == motionTypeTwoHandedParry
- || _motionType == motionTypeOneHandedParry
- || _motionType == motionTypeShieldParry) {
+ } else if (_motionType == kMotionTypeTwoHandedParry
+ || _motionType == kMotionTypeOneHandedParry
+ || _motionType == kMotionTypeShieldParry) {
ObjectID attackerID,
defensiveObjID;
@@ -1044,13 +1044,13 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
// Store the action counter
out->writeSint16LE(actionCounter);
- if (_motionType == motionTypeOneHandedParry) {
+ if (_motionType == kMotionTypeOneHandedParry) {
// Store the combat sub-motion type
out->writeByte(_combatMotionType);
}
- } else if (_motionType == motionTypeDodge
- || _motionType == motionTypeAcceptHit
- || _motionType == motionTypeFallDown) {
+ } else if (_motionType == kMotionTypeDodge
+ || _motionType == kMotionTypeAcceptHit
+ || _motionType == kMotionTypeFallDown) {
ObjectID attackerID;
attackerID = _d.attacker != nullptr ? _d.attacker->thisID() : Nothing;
@@ -1158,7 +1158,7 @@ void MotionTask::turn(Actor &obj, Direction dir) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
mt->_direction = dir;
- mt->_motionType = motionTypeTurn;
+ mt->_motionType = kMotionTypeTurn;
mt->_flags = kMfReset;
}
}
@@ -1171,7 +1171,7 @@ void MotionTask::turnTowards(Actor &obj, const TilePoint &where) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
mt->_direction = (where - obj.getLocation()).quickDir();
- mt->_motionType = motionTypeTurn;
+ mt->_motionType = kMotionTypeTurn;
mt->_flags = kMfReset;
}
}
@@ -1185,7 +1185,7 @@ void MotionTask::give(Actor &actor, Actor &givee) {
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
mt->_targetObj = &givee;
- mt->_motionType = motionTypeGive;
+ mt->_motionType = kMotionTypeGive;
mt->_flags = kMfReset;
}
}
@@ -1199,7 +1199,7 @@ void MotionTask::throwObject(GameObject &obj, const TilePoint &velocity) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
if (obj.isMissile()) obj._data.missileFacing = missileNoFacing;
mt->_velocity = velocity;
- mt->_motionType = motionTypeThrown;
+ mt->_motionType = kMotionTypeThrown;
}
}
@@ -1217,7 +1217,7 @@ void MotionTask::throwObjectTo(GameObject &obj, const TilePoint &where) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
if (obj.isMissile()) obj._data.missileFacing = missileNoFacing;
mt->calcVelocity(where - obj.getLocation(), turns);
- mt->_motionType = motionTypeThrown;
+ mt->_motionType = kMotionTypeThrown;
}
}
@@ -1246,7 +1246,7 @@ void MotionTask::shootObject(
if (targetActor->_moveTask != nullptr) {
MotionTask *targetMotion = targetActor->_moveTask;
- if (targetMotion->_motionType == motionTypeWalk)
+ if (targetMotion->_motionType == kMotionTypeWalk)
vector += targetMotion->_velocity * turns;
}
}
@@ -1256,7 +1256,7 @@ void MotionTask::shootObject(
if (obj.isMissile())
obj._data.missileFacing = missileDir(mt->_velocity);
- mt->_motionType = motionTypeShot;
+ mt->_motionType = kMotionTypeShot;
mt->_o.enactor = &doer;
mt->_targetObj = ⌖
}
@@ -1276,7 +1276,7 @@ void MotionTask::walkTo(
if (!mt->isReflex() && !actor.isImmobile()) {
unstickObject(&actor);
mt->_finalTarget = mt->_immediateLocation = target;
- mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_motionType = mt->_prevMotionType = kMotionTypeWalk;
mt->_pathCount = mt->_pathIndex = 0;
mt->_flags = kMfPathFind | kMfReset;
mt->_runCount = 12; // # of frames until we can run
@@ -1308,7 +1308,7 @@ void MotionTask::walkToDirect(
mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_motionType = mt->_prevMotionType = kMotionTypeWalk;
mt->_finalTarget = mt->_immediateLocation = target;
mt->_pathCount = mt->_pathIndex = 0;
mt->_flags = kMfReset;
@@ -1337,7 +1337,7 @@ void MotionTask::wander(
mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_motionType = mt->_prevMotionType = kMotionTypeWalk;
mt->_immediateLocation = Nowhere;
mt->_pathCount = mt->_pathIndex = 0;
mt->_flags = kMfReset | kMfWandering;
@@ -1367,7 +1367,7 @@ void MotionTask::tetheredWander(
mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_motionType = mt->_prevMotionType = kMotionTypeWalk;
mt->_immediateLocation = Nowhere;
mt->_tetherMinU = tetherReg.min.u;
mt->_tetherMinV = tetherReg.min.v;
@@ -1392,8 +1392,8 @@ void MotionTask::upLadder(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->_motionType != motionTypeClimbUp) {
- mt->_motionType = motionTypeClimbUp;
+ if (mt->_motionType != kMotionTypeClimbUp) {
+ mt->_motionType = kMotionTypeClimbUp;
mt->_flags = kMfReset;
}
}
@@ -1406,8 +1406,8 @@ void MotionTask::downLadder(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->_motionType != motionTypeClimbDown) {
- mt->_motionType = motionTypeClimbDown;
+ if (mt->_motionType != kMotionTypeClimbDown) {
+ mt->_motionType = kMotionTypeClimbDown;
mt->_flags = kMfReset;
}
}
@@ -1420,8 +1420,8 @@ void MotionTask::talk(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->_motionType != motionTypeTalk) {
- mt->_motionType = motionTypeTalk;
+ if (mt->_motionType != kMotionTypeTalk) {
+ mt->_motionType = kMotionTypeTalk;
mt->_flags = kMfReset;
}
}
@@ -1435,9 +1435,9 @@ void MotionTask::jump(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->_motionType != motionTypeThrown) {
+ if (mt->_motionType != kMotionTypeThrown) {
mt->_velocity.z = 10;
- mt->_motionType = motionTypeJump;
+ mt->_motionType = kMotionTypeJump;
mt->_flags = kMfReset;
}
}
@@ -1451,8 +1451,8 @@ void MotionTask::wait(Actor &a) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeWait) {
- mt->_motionType = motionTypeWait;
+ if (mt->_motionType != kMotionTypeWait) {
+ mt->_motionType = kMotionTypeWait;
mt->_flags = kMfReset;
}
}
@@ -1465,8 +1465,8 @@ void MotionTask::useObject(Actor &a, GameObject &dObj) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseObject) {
- mt->_motionType = motionTypeUseObject;
+ if (mt->_motionType != kMotionTypeUseObject) {
+ mt->_motionType = kMotionTypeUseObject;
mt->_o.directObject = &dObj;
mt->_flags = kMfReset;
if (isPlayerActor(&a)) mt->_flags |= kMfPrivledged;
@@ -1484,8 +1484,8 @@ void MotionTask::useObjectOnObject(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseObjectOnObject) {
- mt->_motionType = motionTypeUseObjectOnObject;
+ if (mt->_motionType != kMotionTypeUseObjectOnObject) {
+ mt->_motionType = kMotionTypeUseObjectOnObject;
mt->_o.directObject = &dObj;
mt->_o.indirectObject = ⌖
mt->_flags = kMfReset;
@@ -1504,8 +1504,8 @@ void MotionTask::useObjectOnTAI(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseObjectOnTAI) {
- mt->_motionType = motionTypeUseObjectOnTAI;
+ if (mt->_motionType != kMotionTypeUseObjectOnTAI) {
+ mt->_motionType = kMotionTypeUseObjectOnTAI;
mt->_o.directObject = &dObj;
mt->_o.TAI = ⌖
mt->_flags = kMfReset;
@@ -1523,8 +1523,8 @@ void MotionTask::useObjectOnLocation(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseObjectOnLocation) {
- mt->_motionType = motionTypeUseObjectOnLocation;
+ if (mt->_motionType != kMotionTypeUseObjectOnLocation) {
+ mt->_motionType = kMotionTypeUseObjectOnLocation;
mt->_o.directObject = &dObj;
mt->_targetLoc = target;
mt->_flags = kMfReset;
@@ -1539,8 +1539,8 @@ void MotionTask::useTAI(Actor &a, ActiveItem &dTAI) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseTAI) {
- mt->_motionType = motionTypeUseTAI;
+ if (mt->_motionType != kMotionTypeUseTAI) {
+ mt->_motionType = kMotionTypeUseTAI;
mt->_o.TAI = &dTAI;
mt->_flags = kMfReset;
}
@@ -1557,8 +1557,8 @@ void MotionTask::dropObject(Actor &a,
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeDropObject) {
- mt->_motionType = motionTypeDropObject;
+ if (mt->_motionType != kMotionTypeDropObject) {
+ mt->_motionType = kMotionTypeDropObject;
mt->_o.directObject = &dObj;
mt->_targetLoc = loc;
mt->_flags = kMfReset;
@@ -1592,8 +1592,8 @@ void MotionTask::dropObjectOnObject(
// Otherwise, drop it on the object
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeDropObjectOnObject) {
- mt->_motionType = motionTypeDropObjectOnObject;
+ if (mt->_motionType != kMotionTypeDropObjectOnObject) {
+ mt->_motionType = kMotionTypeDropObjectOnObject;
mt->_o.directObject = &dObj;
mt->_o.indirectObject = ⌖
mt->_flags = kMfReset;
@@ -1613,8 +1613,8 @@ void MotionTask::dropObjectOnTAI(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeDropObjectOnTAI) {
- mt->_motionType = motionTypeDropObjectOnTAI;
+ if (mt->_motionType != kMotionTypeDropObjectOnTAI) {
+ mt->_motionType = kMotionTypeDropObjectOnTAI;
mt->_o.directObject = &dObj;
mt->_o.TAI = ⌖
mt->_targetLoc = loc;
@@ -1628,12 +1628,12 @@ void MotionTask::dropObjectOnTAI(
// has no control )
bool MotionTask::isReflex() {
- return _motionType == motionTypeThrown
- || _motionType == motionTypeFall
- || _motionType == motionTypeLand
- || _motionType == motionTypeAcceptHit
- || _motionType == motionTypeFallDown
- || _motionType == motionTypeDie;
+ return _motionType == kMotionTypeThrown
+ || _motionType == kMotionTypeFall
+ || _motionType == kMotionTypeLand
+ || _motionType == kMotionTypeAcceptHit
+ || _motionType == kMotionTypeFallDown
+ || _motionType == kMotionTypeDie;
}
// Offensive combat actions
@@ -1645,8 +1645,8 @@ void MotionTask::twoHandedSwing(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeTwoHandedSwing) {
- mt->_motionType = motionTypeTwoHandedSwing;
+ if (mt->_motionType != kMotionTypeTwoHandedSwing) {
+ mt->_motionType = kMotionTypeTwoHandedSwing;
mt->_targetObj = ⌖
mt->_flags = kMfReset;
}
@@ -1660,8 +1660,8 @@ void MotionTask::oneHandedSwing(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeOneHandedSwing) {
- mt->_motionType = motionTypeOneHandedSwing;
+ if (mt->_motionType != kMotionTypeOneHandedSwing) {
+ mt->_motionType = kMotionTypeOneHandedSwing;
mt->_targetObj = ⌖
mt->_flags = kMfReset;
}
@@ -1675,8 +1675,8 @@ void MotionTask::fireBow(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeFireBow) {
- mt->_motionType = motionTypeFireBow;
+ if (mt->_motionType != kMotionTypeFireBow) {
+ mt->_motionType = kMotionTypeFireBow;
mt->_targetObj = ⌖
mt->_flags = kMfReset;
}
@@ -1690,8 +1690,8 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, GameObject &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
- motionTypeGive :
- motionTypeCastSpell;
+ kMotionTypeGive :
+ kMotionTypeCastSpell;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
@@ -1710,8 +1710,8 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, Location &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
- motionTypeGive :
- motionTypeCastSpell;
+ kMotionTypeGive :
+ kMotionTypeCastSpell;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
if (mt->_motionType != type) {
@@ -1729,8 +1729,8 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, ActiveItem &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
- motionTypeGive :
- motionTypeCastSpell;
+ kMotionTypeGive :
+ kMotionTypeCastSpell;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
if (mt->_motionType != type) {
@@ -1759,8 +1759,8 @@ void MotionTask::useWand(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeUseWand) {
- mt->_motionType = motionTypeUseWand;
+ if (mt->_motionType != kMotionTypeUseWand) {
+ mt->_motionType = kMotionTypeUseWand;
mt->_targetObj = ⌖
mt->_flags = kMfReset;
}
@@ -1779,8 +1779,8 @@ void MotionTask::twoHandedParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeTwoHandedParry) {
- mt->_motionType = motionTypeTwoHandedParry;
+ if (mt->_motionType != kMotionTypeTwoHandedParry) {
+ mt->_motionType = kMotionTypeTwoHandedParry;
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &weapon;
}
@@ -1799,8 +1799,8 @@ void MotionTask::oneHandedParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeOneHandedParry) {
- mt->_motionType = motionTypeOneHandedParry;
+ if (mt->_motionType != kMotionTypeOneHandedParry) {
+ mt->_motionType = kMotionTypeOneHandedParry;
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &weapon;
}
@@ -1819,8 +1819,8 @@ void MotionTask::shieldParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeShieldParry) {
- mt->_motionType = motionTypeShieldParry;
+ if (mt->_motionType != kMotionTypeShieldParry) {
+ mt->_motionType = kMotionTypeShieldParry;
mt->_d.attacker = &opponent;
mt->_d.defensiveObj = &shield;
}
@@ -1836,8 +1836,8 @@ void MotionTask::dodge(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeDodge) {
- mt->_motionType = motionTypeDodge;
+ if (mt->_motionType != kMotionTypeDodge) {
+ mt->_motionType = kMotionTypeDodge;
mt->_d.attacker = &opponent;
}
mt->_flags = kMfReset;
@@ -1854,8 +1854,8 @@ void MotionTask::acceptHit(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeAcceptHit) {
- mt->_motionType = motionTypeAcceptHit;
+ if (mt->_motionType != kMotionTypeAcceptHit) {
+ mt->_motionType = kMotionTypeAcceptHit;
mt->_d.attacker = &opponent;
mt->_flags = kMfReset;
}
@@ -1869,8 +1869,8 @@ void MotionTask::fallDown(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeFallDown) {
- mt->_motionType = motionTypeFallDown;
+ if (mt->_motionType != kMotionTypeFallDown) {
+ mt->_motionType = kMotionTypeFallDown;
mt->_d.attacker = &opponent;
mt->_flags = kMfReset;
}
@@ -1884,8 +1884,8 @@ void MotionTask::die(Actor &a) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->_motionType != motionTypeDie) {
- mt->_motionType = motionTypeDie;
+ if (mt->_motionType != kMotionTypeDie) {
+ mt->_motionType = kMotionTypeDie;
mt->_flags = kMfReset;
}
}
@@ -1895,10 +1895,10 @@ void MotionTask::die(Actor &a) {
// Determine if this MotionTask is a defensive motion
bool MotionTask::isDefense() {
- return _motionType == motionTypeOneHandedParry
- || _motionType == motionTypeTwoHandedParry
- || _motionType == motionTypeShieldParry
- || _motionType == motionTypeDodge;
+ return _motionType == kMotionTypeOneHandedParry
+ || _motionType == kMotionTypeTwoHandedParry
+ || _motionType == kMotionTypeShieldParry
+ || _motionType == kMotionTypeDodge;
}
//-----------------------------------------------------------------------
@@ -1906,24 +1906,24 @@ bool MotionTask::isDefense() {
bool MotionTask::isAttack() {
return isMeleeAttack()
- || _motionType == motionTypeFireBow
- || _motionType == motionTypeCastSpell
- || _motionType == motionTypeUseWand;
+ || _motionType == kMotionTypeFireBow
+ || _motionType == kMotionTypeCastSpell
+ || _motionType == kMotionTypeUseWand;
}
//-----------------------------------------------------------------------
// Determine if this MotionTask is an offensive melee motion
bool MotionTask::isMeleeAttack() {
- return _motionType == motionTypeOneHandedSwing
- || _motionType == motionTypeTwoHandedSwing;
+ return _motionType == kMotionTypeOneHandedSwing
+ || _motionType == kMotionTypeTwoHandedSwing;
}
//-----------------------------------------------------------------------
// Determine if this MotionTask is a walk motion
bool MotionTask::isWalk() {
- return _prevMotionType == motionTypeWalk;
+ return _prevMotionType == kMotionTypeWalk;
}
//-----------------------------------------------------------------------
@@ -1948,7 +1948,7 @@ TileRegion MotionTask::getTether() {
// then call this function.
void MotionTask::changeTarget(const TilePoint &newPos, bool run) {
- if (_prevMotionType == motionTypeWalk) {
+ if (_prevMotionType == kMotionTypeWalk) {
uint16 oldFlags = _flags;
abortPathFind(this);
@@ -1978,8 +1978,8 @@ void MotionTask::changeTarget(const TilePoint &newPos, bool run) {
// call this function.
void MotionTask::changeDirectTarget(const TilePoint &newPos, bool run) {
- if (_prevMotionType == motionTypeWalk) {
- _prevMotionType = motionTypeWalk;
+ if (_prevMotionType == kMotionTypeWalk) {
+ _prevMotionType = kMotionTypeWalk;
_finalTarget = _immediateLocation = newPos;
@@ -2001,7 +2001,7 @@ void MotionTask::changeDirectTarget(const TilePoint &newPos, bool run) {
// Cancel actor movement if walking...
void MotionTask::finishWalk() {
// If the actor is in a running state
- if (_motionType == motionTypeWalk) {
+ if (_motionType == kMotionTypeWalk) {
remove();
// If there is currently a path finding request, abort it.
/* abortPathFind( this );
@@ -2017,7 +2017,7 @@ void MotionTask::finishWalk() {
// Cancel actor movement if talking...
void MotionTask::finishTalking() {
- if (_motionType == motionTypeTalk) {
+ if (_motionType == kMotionTypeTalk) {
if (isActor(_object)) {
Actor *a = (Actor *)_object;
if (a->_currentAnimation != kActionStand)
@@ -2142,7 +2142,7 @@ void MotionTask::ballisticAction() {
} else {
TilePoint oldVelocity = _velocity;
- if (_motionType == motionTypeShot && collisionObject != nullptr) {
+ if (_motionType == kMotionTypeShot && collisionObject != nullptr) {
// If this motion is for a shot arrow and we did not
// collide with our target object just continue the
// motion as if there was no collision.
@@ -2231,7 +2231,7 @@ void MotionTask::ballisticAction() {
}
}
_uFrac = _vFrac = 0;
- if (_motionType == motionTypeShot && obj->isMissile())
+ if (_motionType == kMotionTypeShot && obj->isMissile())
obj->_data.missileFacing = missileDir(_velocity);
// If the ballistic object is an actor hitting the
@@ -2248,8 +2248,8 @@ void MotionTask::ballisticAction() {
obj->move(location);
if (!((Actor *)obj)->isDead()) {
_motionType = velocityMagnitude <= 16
- ? motionTypeLand
- : motionTypeLandBadly;
+ ? kMotionTypeLand
+ : kMotionTypeLandBadly;
_flags |= kMfReset;
setObjectSurface(obj, sti);
} else {
@@ -2402,7 +2402,7 @@ void MotionTask::walkAction() {
aa = a->_appearance;
if (a->isImmobile()) {
- remove(motionWalkBlocked);
+ remove(kMotionWalkBlocked);
return;
}
@@ -2702,7 +2702,7 @@ void MotionTask::walkAction() {
}
if (moveTaskDone) {
- remove(motionCompleted);
+ remove(kMotionCompleted);
} else if (moveBlocked) {
a->setAction(kActionStand, 0);
if (_flags & kMfAgitatable) {
@@ -2724,7 +2724,7 @@ void MotionTask::walkAction() {
_pathIndex = _pathCount = 0;
}
} else
- remove(motionWalkBlocked);
+ remove(kMotionWalkBlocked);
} else if (moveTaskWaiting
|| movementDirection != a->_currentFacing) {
// When he starts running again, then have him walk only.
@@ -3100,7 +3100,7 @@ void MotionTask::giveAction() {
if (a->_currentFacing != targetDir)
a->turn(targetDir);
else if (a->nextAnimationFrame())
- remove(motionCompleted);
+ remove(kMotionCompleted);
}
@@ -3112,7 +3112,7 @@ void MotionTask::genericAnimationAction(uint8 actionType) {
a->setAction(actionType, 0);
_flags &= ~kMfReset;
} else if (a->nextAnimationFrame())
- remove(motionCompleted);
+ remove(kMotionCompleted);
}
// This class is specifically designed to aid in the selection of
@@ -3131,12 +3131,12 @@ struct CombatMotionSet {
// Construct a set of all two handed swing types
const uint8 twoHandedSwingArray[] = {
- MotionTask::twoHandedSwingHigh,
- MotionTask::twoHandedSwingLow,
- MotionTask::twoHandedSwingLeftHigh,
- MotionTask::twoHandedSwingLeftLow,
- MotionTask::twoHandedSwingRightHigh,
- MotionTask::twoHandedSwingRightLow,
+ MotionTask::kTwoHandedSwingHigh,
+ MotionTask::kTwoHandedSwingLow,
+ MotionTask::kTwoHandedSwingLeftHigh,
+ MotionTask::kTwoHandedSwingLeftLow,
+ MotionTask::kTwoHandedSwingRightHigh,
+ MotionTask::kTwoHandedSwingRightLow,
};
const CombatMotionSet twoHandedSwingSet = {
@@ -3146,9 +3146,9 @@ const CombatMotionSet twoHandedSwingSet = {
// Construct a subset of all high two handed swing types
const uint8 twoHandedHighSwingArray[] = {
- MotionTask::twoHandedSwingHigh,
- MotionTask::twoHandedSwingLeftHigh,
- MotionTask::twoHandedSwingRightHigh,
+ MotionTask::kTwoHandedSwingHigh,
+ MotionTask::kTwoHandedSwingLeftHigh,
+ MotionTask::kTwoHandedSwingRightHigh,
};
const CombatMotionSet twoHandedHighSwingSet = {
@@ -3158,9 +3158,9 @@ const CombatMotionSet twoHandedHighSwingSet = {
// Construct a subset of all low two handed swing types
const uint8 twoHandedLowSwingArray[] = {
- MotionTask::twoHandedSwingLow,
- MotionTask::twoHandedSwingLeftLow,
- MotionTask::twoHandedSwingRightLow,
+ MotionTask::kTwoHandedSwingLow,
+ MotionTask::kTwoHandedSwingLeftLow,
+ MotionTask::kTwoHandedSwingRightLow,
};
const CombatMotionSet twoHandedLowSwingSet = {
@@ -3253,9 +3253,9 @@ void MotionTask::twoHandedSwingAction() {
// Construct a set of all one handed swing types
const uint8 oneHandedSwingArray[] = {
- MotionTask::oneHandedSwingHigh,
- MotionTask::oneHandedSwingLow,
-// MotionTask::oneHandedThrust,
+ MotionTask::kOneHandedSwingHigh,
+ MotionTask::kOneHandedSwingLow,
+// MotionTask::kOneHandedThrust,
};
const CombatMotionSet oneHandedSwingSet = {
@@ -3265,7 +3265,7 @@ const CombatMotionSet oneHandedSwingSet = {
// Construct a subset of all high one handed swing types
const uint8 oneHandedHighSwingArray[] = {
- MotionTask::oneHandedSwingHigh,
+ MotionTask::kOneHandedSwingHigh,
};
const CombatMotionSet oneHandedHighSwingSet = {
@@ -3275,7 +3275,7 @@ const CombatMotionSet oneHandedHighSwingSet = {
// Construct a subset of all low one handed swing types
const uint8 oneHandedLowSwingArray[] = {
- MotionTask::oneHandedSwingLow,
+ MotionTask::kOneHandedSwingLow,
};
const CombatMotionSet oneHandedLowSwingSet = {
@@ -3331,7 +3331,7 @@ void MotionTask::oneHandedSwingAction() {
// Randomly select a combat motion type from the available set
_combatMotionType = availableSet->selectRandom();
- /* if ( _combatMotionType == oneHandedThrust )
+ /* if ( _combatMotionType == kOneHandedThrust )
{
// Initialize the thrust motion
}
@@ -3646,7 +3646,7 @@ void MotionTask::oneHandedParryAction() {
_direction = (_d.attacker->getLocation() - a->getLocation()).quickDir();
- _combatMotionType = oneHandedParryHigh;
+ _combatMotionType = kOneHandedParryHigh;
if (a->_appearance != nullptr
&& a->isActionAvailable(kActionParryHigh)) {
a->setAction(kActionParryHigh, 0);
@@ -4061,24 +4061,24 @@ void MotionTask::updatePositions() {
mt->_flags &= ~kMfInWater;
switch (mt->_motionType) {
- case motionTypeThrown:
- case motionTypeShot:
+ case kMotionTypeThrown:
+ case kMotionTypeShot:
mt->ballisticAction();
break;
- case motionTypeWalk:
+ case kMotionTypeWalk:
mt->walkAction();
break;
- case motionTypeClimbUp:
+ case kMotionTypeClimbUp:
mt->upLadderAction();
break;
- case motionTypeClimbDown:
+ case kMotionTypeClimbDown:
mt->downLadderAction();
break;
- case motionTypeTalk:
+ case kMotionTypeTalk:
if (mt->_flags & kMfReset) {
a->setAction(kActionStand, 0);
@@ -4099,16 +4099,16 @@ void MotionTask::updatePositions() {
a->_cycleCount--;
break;
- case motionTypeLand:
- case motionTypeLandBadly:
+ case kMotionTypeLand:
+ case kMotionTypeLandBadly:
if (mt->_flags & kMfReset) {
- int16 newAction = mt->_motionType == motionTypeLand
+ int16 newAction = mt->_motionType == kMotionTypeLand
? kActionJumpUp
: kActionFallBadly;
if (!a->isActionAvailable(newAction)) {
- if (mt->_prevMotionType == motionTypeWalk) {
+ if (mt->_prevMotionType == kMotionTypeWalk) {
mt->_motionType = mt->_prevMotionType;
if (mt->_flags & kMfPathFind) {
mt->changeTarget(
@@ -4127,7 +4127,7 @@ void MotionTask::updatePositions() {
mt->_flags &= ~kMfReset;
}
} else if (a->nextAnimationFrame() || (mt->_flags & kMfInWater)) {
- if (mt->_prevMotionType == motionTypeWalk) {
+ if (mt->_prevMotionType == kMotionTypeWalk) {
mt->_motionType = mt->_prevMotionType;
if (mt->_flags & kMfPathFind) {
mt->changeTarget(
@@ -4145,7 +4145,7 @@ void MotionTask::updatePositions() {
// If actor was running, go through an abreviated
// landing sequence by aborting the landing animation
// after the first frame.
- if (mt->_prevMotionType == motionTypeWalk
+ if (mt->_prevMotionType == kMotionTypeWalk
&& mt->_flags & kMfRequestRun
&& mt->_runCount == 0
&& !(mt->_flags & kMfInWater)) {
@@ -4164,29 +4164,29 @@ void MotionTask::updatePositions() {
}
break;
- case motionTypeJump:
+ case kMotionTypeJump:
if (mt->_flags & kMfReset) {
a->setAction(kActionJumpUp, 0);
a->setInterruptablity(false);
mt->_flags &= ~kMfReset;
} else if (a->nextAnimationFrame()) {
- mt->_motionType = motionTypeThrown;
+ mt->_motionType = kMotionTypeThrown;
a->setAction(kActionFreeFall, 0);
}
break;
- case motionTypeTurn:
+ case kMotionTypeTurn:
mt->turnAction();
break;
- case motionTypeGive:
+ case kMotionTypeGive:
mt->giveAction();
break;
- case motionTypeRise:
+ case kMotionTypeRise:
if (a->_data.location.z < mt->_immediateLocation.z) {
a->_data.location.z++;
@@ -4206,7 +4206,7 @@ void MotionTask::updatePositions() {
}
break;
- case motionTypeWait:
+ case kMotionTypeWait:
if (mt->_flags & kMfReset) {
mt->actionCounter = 5;
@@ -4215,7 +4215,7 @@ void MotionTask::updatePositions() {
moveTaskDone = true;
break;
- case motionTypeUseObject:
+ case kMotionTypeUseObject:
// This will be uninterrutable for 2 frames
a->setActionPoints(2);
@@ -4224,7 +4224,7 @@ void MotionTask::updatePositions() {
moveTaskDone = true;
break;
- case motionTypeUseObjectOnObject:
+ case kMotionTypeUseObjectOnObject:
if (isWorld(mt->_o.indirectObject->IDParent())) {
if (
@@ -4245,7 +4245,7 @@ void MotionTask::updatePositions() {
mt->_o.directObject->useOn(
a->thisID(),
mt->_o.indirectObject->thisID());
- if (mt->_motionType == motionTypeUseObjectOnObject)
+ if (mt->_motionType == kMotionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4257,7 +4257,7 @@ void MotionTask::updatePositions() {
mt->_o.directObject->useOn(
a->thisID(),
mt->_o.indirectObject->thisID());
- if (mt->_motionType == motionTypeUseObjectOnObject)
+ if (mt->_motionType == kMotionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4265,7 +4265,7 @@ void MotionTask::updatePositions() {
break;
- case motionTypeUseObjectOnTAI:
+ case kMotionTypeUseObjectOnTAI:
if (mt->_flags & kMfReset) {
TilePoint actorLoc = a->getLocation(),
@@ -4298,14 +4298,14 @@ void MotionTask::updatePositions() {
// The actor will now be uniterruptable
a->setActionPoints(2);
mt->_o.directObject->useOn(a->thisID(), mt->_o.TAI);
- if (mt->_motionType == motionTypeUseObjectOnTAI)
+ if (mt->_motionType == kMotionTypeUseObjectOnTAI)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
}
break;
- case motionTypeUseObjectOnLocation:
+ case kMotionTypeUseObjectOnLocation:
if (mt->_flags & kMfReset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
@@ -4318,14 +4318,14 @@ void MotionTask::updatePositions() {
// The actor will now be uniterruptable
a->setActionPoints(2);
mt->_o.directObject->useOn(a->thisID(), mt->_targetLoc);
- if (mt->_motionType == motionTypeUseObjectOnLocation)
+ if (mt->_motionType == kMotionTypeUseObjectOnLocation)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
}
break;
- case motionTypeUseTAI:
+ case kMotionTypeUseTAI:
if (mt->_flags & kMfReset) {
TilePoint actorLoc = a->getLocation(),
@@ -4362,7 +4362,7 @@ void MotionTask::updatePositions() {
}
break;
- case motionTypeDropObject:
+ case kMotionTypeDropObject:
if (isWorld(mt->_targetLoc._context)) {
if (mt->_flags & kMfReset) {
@@ -4378,7 +4378,7 @@ void MotionTask::updatePositions() {
mt->_o.directObject->drop(a->thisID(),
mt->_targetLoc,
mt->moveCount);
- if (mt->_motionType == motionTypeDropObject)
+ if (mt->_motionType == kMotionTypeDropObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4389,7 +4389,7 @@ void MotionTask::updatePositions() {
mt->_o.directObject->drop(a->thisID(),
mt->_targetLoc,
mt->moveCount);
- if (mt->_motionType == motionTypeDropObject)
+ if (mt->_motionType == kMotionTypeDropObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4399,7 +4399,7 @@ void MotionTask::updatePositions() {
break;
- case motionTypeDropObjectOnObject:
+ case kMotionTypeDropObjectOnObject:
if (isWorld(mt->_o.indirectObject->IDParent())) {
mt->_direction = (mt->_o.indirectObject->getLocation()
@@ -4413,7 +4413,7 @@ void MotionTask::updatePositions() {
a->thisID(),
mt->_o.indirectObject->thisID(),
mt->moveCount);
- if (mt->_motionType == motionTypeDropObjectOnObject)
+ if (mt->_motionType == kMotionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4425,7 +4425,7 @@ void MotionTask::updatePositions() {
a->thisID(),
mt->_o.indirectObject->thisID(),
mt->moveCount);
- if (mt->_motionType == motionTypeDropObjectOnObject)
+ if (mt->_motionType == kMotionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4435,7 +4435,7 @@ void MotionTask::updatePositions() {
break;
- case motionTypeDropObjectOnTAI:
+ case kMotionTypeDropObjectOnTAI:
if (mt->_flags & kMfReset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
@@ -4451,58 +4451,58 @@ void MotionTask::updatePositions() {
a->thisID(),
mt->_o.TAI,
mt->_targetLoc);
- if (mt->_motionType == motionTypeDropObjectOnTAI)
+ if (mt->_motionType == kMotionTypeDropObjectOnTAI)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
}
break;
- case motionTypeTwoHandedSwing:
+ case kMotionTypeTwoHandedSwing:
mt->twoHandedSwingAction();
break;
- case motionTypeOneHandedSwing:
+ case kMotionTypeOneHandedSwing:
mt->oneHandedSwingAction();
break;
- case motionTypeFireBow:
+ case kMotionTypeFireBow:
mt->fireBowAction();
break;
- case motionTypeCastSpell:
+ case kMotionTypeCastSpell:
mt->castSpellAction();
break;
- case motionTypeUseWand:
+ case kMotionTypeUseWand:
mt->useWandAction();
break;
- case motionTypeTwoHandedParry:
+ case kMotionTypeTwoHandedParry:
mt->twoHandedParryAction();
break;
- case motionTypeOneHandedParry:
+ case kMotionTypeOneHandedParry:
mt->oneHandedParryAction();
break;
- case motionTypeShieldParry:
+ case kMotionTypeShieldParry:
mt->shieldParryAction();
break;
- case motionTypeDodge:
+ case kMotionTypeDodge:
mt->dodgeAction();
break;
- case motionTypeAcceptHit:
+ case kMotionTypeAcceptHit:
mt->acceptHitAction();
break;
- case motionTypeFallDown:
+ case kMotionTypeFallDown:
mt->fallDownAction();
break;
- case motionTypeDie:
+ case kMotionTypeDie:
if (mt->_flags & kMfReset) {
if (a->isActionAvailable(kActionDie)) {
a->setAction(kActionDie, 0);
@@ -4562,7 +4562,7 @@ bool MotionTask::freeFall(TilePoint &newPos, StandingTileInfo &sti) {
if (tHeight >= newPos.z - gravity * 4) {
supported:
- if (_motionType != motionTypeWalk
+ if (_motionType != kMotionTypeWalk
|| tHeight <= newPos.z
|| !(_flags & kMfInWater)) {
if (tHeight > newPos.z + kMaxStepHeight) {
@@ -4573,7 +4573,7 @@ supported:
// setObjectSurface( _object, sti );
return false;
} else {
- _motionType = motionTypeRise;
+ _motionType = kMotionTypeRise;
_immediateLocation.z = tHeight;
_object->move(newPos);
return true;
@@ -4590,10 +4590,10 @@ supported:
// See if we fell on something.
if (checkContact(_object, tPos) == blockageNone) {
falling:
- if (_motionType != motionTypeWalk
+ if (_motionType != kMotionTypeWalk
|| newPos.z > gravity * 4
|| tHeight >= 0) {
- _motionType = motionTypeThrown;
+ _motionType = kMotionTypeThrown;
// newPos = tPos;
_object->move(tPos);
diff --git a/engines/saga2/motion.h b/engines/saga2/motion.h
index b2a1b6320c5..49b8b96d38c 100644
--- a/engines/saga2/motion.h
+++ b/engines/saga2/motion.h
@@ -46,19 +46,19 @@ const int runSpeedDiag = 6;
const int angleThresh = 24;
enum MotionThreadReturnValues {
- motionInterrupted, // MotionTask has been rudely
+ kMotionInterrupted, // MotionTask has been rudely
// interrupted and recycled for a new
// motion.
- motionStarted, // The actor started moving.
- motionCompleted, // The actor motion completed
+ kMotionStarted, // The actor started moving.
+ kMotionCompleted, // The actor motion completed
// successfully.
- motionWalkBlocked // The walk motion failed.
+ kMotionWalkBlocked // The walk motion failed.
};
enum {
- moveWait = (1 << 0),
- moveRun = (1 << 1)
+ kMoveWait = (1 << 0),
+ kMoveRun = (1 << 1)
};
/* ===================================================================== *
@@ -186,74 +186,74 @@ class MotionTask {
public:
// Combat specific motion sub-types
enum TwoHandedSwingTypes {
- twoHandedSwingHigh,
- twoHandedSwingLow,
- twoHandedSwingLeftHigh,
- twoHandedSwingLeftLow,
- twoHandedSwingRightHigh,
- twoHandedSwingRightLow
+ kTwoHandedSwingHigh,
+ kTwoHandedSwingLow,
+ kTwoHandedSwingLeftHigh,
+ kTwoHandedSwingLeftLow,
+ kTwoHandedSwingRightHigh,
+ kTwoHandedSwingRightLow
};
enum OneHandedSwingTypes {
- oneHandedSwingHigh,
- oneHandedSwingLow,
- oneHandedThrust
+ kOneHandedSwingHigh,
+ kOneHandedSwingLow,
+ kOneHandedThrust
};
enum OneHandedParryTypes {
- oneHandedParryHigh,
- oneHandedParryLow
+ kOneHandedParryHigh,
+ kOneHandedParryLow
};
private:
enum motionTypes {
- motionTypeNone, // no motion
-
- motionTypeThrown, // thrown in an arc
- motionTypeShot, // shot in very shallow arc w/ cheat
- motionTypeFall, // fall from a height
- motionTypeWalk, // walk to a point
- motionTypeStagger, // stagger to a point
- motionTypeClimbUp, // climb up ladder to a point
- motionTypeClimbDown, // climb dowb ladder
- motionTypeTalk, // talk and gesture
- motionTypeLand, // land after falling
- motionTypeLandBadly, // land badly after falling
- motionTypeJump, // get ready for jump
- motionTypeTurn, // Turn Object
- motionTypeGive, // Extend arm to give object
- motionTypeRise, // Rise slowly in water
- motionTypeHit, // For simple animations
+ kMotionTypeNone, // no motion
+
+ kMotionTypeThrown, // thrown in an arc
+ kMotionTypeShot, // shot in very shallow arc w/ cheat
+ kMotionTypeFall, // fall from a height
+ kMotionTypeWalk, // walk to a point
+ kMotionTypeStagger, // stagger to a point
+ kMotionTypeClimbUp, // climb up ladder to a point
+ kMotionTypeClimbDown, // climb dowb ladder
+ kMotionTypeTalk, // talk and gesture
+ kMotionTypeLand, // land after falling
+ kMotionTypeLandBadly, // land badly after falling
+ kMotionTypeJump, // get ready for jump
+ kMotionTypeTurn, // Turn Object
+ kMotionTypeGive, // Extend arm to give object
+ kMotionTypeRise, // Rise slowly in water
+ kMotionTypeHit, // For simple animations
// Immobile motions
- motionTypeWait, // Don't move, simply eat some time
- motionTypeUseObject, // Use an object
- motionTypeUseObjectOnObject, // Use one object on another
- motionTypeUseObjectOnTAI, // Use an object on a TAI
- motionTypeUseObjectOnLocation, // Use an object on a TilePoint
- motionTypeUseTAI, // Use a TAI
- motionTypeDropObject, // Drop an object at a location
- motionTypeDropObjectOnObject, // Drop one object on another
- motionTypeDropObjectOnTAI, // Drop an object on a TAI
+ kMotionTypeWait, // Don't move, simply eat some time
+ kMotionTypeUseObject, // Use an object
+ kMotionTypeUseObjectOnObject, // Use one object on another
+ kMotionTypeUseObjectOnTAI, // Use an object on a TAI
+ kMotionTypeUseObjectOnLocation, // Use an object on a TilePoint
+ kMotionTypeUseTAI, // Use a TAI
+ kMotionTypeDropObject, // Drop an object at a location
+ kMotionTypeDropObjectOnObject, // Drop one object on another
+ kMotionTypeDropObjectOnTAI, // Drop an object on a TAI
// Offensive combat actions
- motionTypeTwoHandedSwing, // swing two-handed weapon
- motionTypeOneHandedSwing, // swing one-handed weapon
- motionTypeFireBow, // fire bow
- motionTypeCastSpell, // cast spell
- motionTypeUseWand, // cast spell with wand
+ kMotionTypeTwoHandedSwing, // swing two-handed weapon
+ kMotionTypeOneHandedSwing, // swing one-handed weapon
+ kMotionTypeFireBow, // fire bow
+ kMotionTypeCastSpell, // cast spell
+ kMotionTypeUseWand, // cast spell with wand
// Defensive combat actions
- motionTypeTwoHandedParry, // parry with two-handed weapon
- motionTypeOneHandedParry, // parry with one-handed weapon
- motionTypeShieldParry, // parry with shield
- motionTypeDodge, // dodge blow
+ kMotionTypeTwoHandedParry, // parry with two-handed weapon
+ kMotionTypeOneHandedParry, // parry with one-handed weapon
+ kMotionTypeShieldParry, // parry with shield
+ kMotionTypeDodge, // dodge blow
// Other combat actions
- motionTypeAcceptHit, // show effect of hit
- motionTypeFallDown, // be knocked off feet
- motionTypeDie // self-explanatory
+ kMotionTypeAcceptHit, // show effect of hit
+ kMotionTypeFallDown, // be knocked off feet
+ kMotionTypeDie // self-explanatory
};
@@ -265,7 +265,7 @@ private:
void write(Common::MemoryWriteStreamDynamic *out);
// motion task is finished.
- void remove(int16 returnVal = motionInterrupted);
+ void remove(int16 returnVal = kMotionInterrupted);
TilePoint getImmediateTarget(); // determine immediate target
// location
@@ -282,7 +282,7 @@ private:
if (a->_currentFacing != _direction)
a->turn(_direction);
else
- remove(motionCompleted);
+ remove(kMotionCompleted);
}
void ballisticAction();
@@ -471,7 +471,7 @@ public:
}
bool isTurn() {
- return _motionType == motionTypeTurn;
+ return _motionType == kMotionTypeTurn;
}
// Return the wandering tether region
@@ -523,7 +523,7 @@ public:
// Determine if this motion is a dodge motion
bool isDodging(Actor *thisAttacker) {
- return _motionType == motionTypeDodge && thisAttacker == _d.attacker;
+ return _motionType == kMotionTypeDodge && thisAttacker == _d.attacker;
}
static void initMotionTasks();
diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index 34ef206c0d0..226476f659c 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -1585,12 +1585,12 @@ int16 scriptActorTurn(int16 *args) {
uint16 flags = args[1];
- if (flags & moveWait) {
+ if (flags & kMoveWait) {
thisThread->waitForEvent(Thread::waitOther, nullptr);
MotionTask::turn(getThreadID(thisThread), *a, args[0] & 7);
} else {
MotionTask::turn(*a, args[0] & 7);
- return motionStarted;
+ return kMotionStarted;
}
}
@@ -1616,12 +1616,12 @@ int16 scriptActorTurnTowards(int16 *args) {
dir = (GameObject::objectAddress(args[0])->getLocation()
- a->getLocation()).quickDir();
- if (flags & moveWait) {
+ if (flags & kMoveWait) {
thisThread->waitForEvent(Thread::waitOther, nullptr);
MotionTask::turn(getThreadID(thisThread), *a, dir);
} else {
MotionTask::turn(*a, dir);
- return motionStarted;
+ return kMotionStarted;
}
}
@@ -1641,13 +1641,13 @@ int16 scriptActorWalk(int16 *args) {
TilePoint dest(args[0], args[1], args[2]);
uint16 flags = args[3];
- if (flags & moveWait) {
+ if (flags & kMoveWait) {
thisThread->waitForEvent(Thread::waitOther, nullptr);
MotionTask::walkToDirect(
- getThreadID(thisThread), *a, dest, flags & moveRun);
+ getThreadID(thisThread), *a, dest, flags & kMoveRun);
} else {
- MotionTask::walkToDirect(*a, dest, flags & moveRun);
- return motionStarted;
+ MotionTask::walkToDirect(*a, dest, flags & kMoveRun);
+ return kMotionStarted;
}
}
More information about the Scummvm-git-logs
mailing list