aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/actor_walk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/actor_walk.cpp')
-rw-r--r--engines/saga/actor_walk.cpp42
1 files changed, 16 insertions, 26 deletions
diff --git a/engines/saga/actor_walk.cpp b/engines/saga/actor_walk.cpp
index 21643ac1de..5a8ea0c856 100644
--- a/engines/saga/actor_walk.cpp
+++ b/engines/saga/actor_walk.cpp
@@ -179,9 +179,8 @@ void Actor::actorFaceTowardsPoint(uint16 actorId, const Location &toLocation) {
}
void Actor::updateActorsScene(int actorsEntrance) {
- int i, j;
+ int j;
int followerDirection;
- ActorData *actor;
Location tempLocation;
Location possibleLocation;
Point delta;
@@ -196,14 +195,13 @@ void Actor::updateActorsScene(int actorsEntrance) {
_activeSpeech.playing = false;
_protagonist = NULL;
- for (i = 0; i < _actorsCount; i++) {
- actor = _actors[i];
+ for (ActorDataArray::iterator actor = _actors.begin(); actor != _actors.end(); ++actor) {
actor->_inScene = false;
- actor->_spriteList.freeMem();
+ actor->_spriteList.clear();
if (actor->_disabled) {
continue;
}
- if ((actor->_flags & (kProtagonist | kFollower)) || (i == 0)) {
+ if ((actor->_flags & (kProtagonist | kFollower)) || (actor->_index == 0)) {
if (actor->_flags & kProtagonist) {
actor->_finalTarget = actor->_location;
_centerActor = _protagonist = actor;
@@ -227,12 +225,12 @@ void Actor::updateActorsScene(int actorsEntrance) {
if (_protagonist == NULL)
return;
- if ((actorsEntrance >= 0) && (_vm->_scene->_entryList.entryListCount > 0)) {
- if (_vm->_scene->_entryList.entryListCount <= actorsEntrance) {
+ if ((actorsEntrance >= 0) && (!_vm->_scene->_entryList.empty())) {
+ if (_vm->_scene->_entryList.size() <= uint(actorsEntrance)) {
actorsEntrance = 0; //OCEAN bug
}
- sceneEntry = _vm->_scene->_entryList.getEntry(actorsEntrance);
+ sceneEntry = &_vm->_scene->_entryList[actorsEntrance];
if (_vm->_scene->getFlags() & kSceneFlagISO) {
_protagonist->_location = sceneEntry->location;
} else {
@@ -266,8 +264,7 @@ void Actor::updateActorsScene(int actorsEntrance) {
followerDirection = _protagonist->_facingDirection + 3;
calcScreenPosition(_protagonist);
- for (i = 0; i < _actorsCount; i++) {
- actor = _actors[i];
+ for (ActorDataArray::iterator actor = _actors.begin(); actor != _actors.end(); ++actor) {
if (actor->_flags & (kFollower)) {
actor->_facingDirection = actor->_actionDirection = _protagonist->_facingDirection;
actor->_currentAction = kActionWait;
@@ -323,8 +320,6 @@ void Actor::updateActorsScene(int actorsEntrance) {
}
void Actor::handleActions(int msec, bool setup) {
- int i;
- ActorData *actor;
ActorFrameRange *frameRange;
int state;
int speed;
@@ -336,12 +331,11 @@ void Actor::handleActions(int msec, bool setup) {
Point hitPoint;
Location pickLocation;
- for (i = 0; i < _actorsCount; i++) {
- actor = _actors[i];
+ for (ActorDataArray::iterator actor = _actors.begin(); actor != _actors.end(); ++actor) {
if (!actor->_inScene)
continue;
- if ((_vm->getGameId() == GID_ITE) && (i == ACTOR_DRAGON_INDEX)) {
+ if ((_vm->getGameId() == GID_ITE) && (actor->_index == ACTOR_DRAGON_INDEX)) {
moveDragon(actor);
continue;
}
@@ -722,7 +716,7 @@ void Actor::handleActions(int msec, bool setup) {
void Actor::direct(int msec) {
- if (_vm->_scene->_entryList.entryListCount == 0) {
+ if (_vm->_scene->_entryList.empty()) {
return;
}
@@ -866,8 +860,6 @@ bool Actor::followProtagonist(ActorData *actor) {
bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
ActorData *actor;
- ActorData *anotherActor;
- int i;
Rect testBox;
Rect testBox2;
@@ -943,7 +935,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
int max = _vm->getGameId() == GID_ITE ? 8 : 4;
- for (i = 1; i < max; i++) {
+ for (int i = 1; i < max; i++) {
pointAdd = pointFrom;
pointAdd.y += i;
if (_vm->_scene->canWalk(pointAdd)) {
@@ -978,9 +970,7 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
collision.x = ACTOR_COLLISION_WIDTH * actor->_screenScale / (256 * 2);
collision.y = ACTOR_COLLISION_HEIGHT * actor->_screenScale / (256 * 2);
-
- for (i = 0; (i < _actorsCount) && (_barrierCount < ACTOR_BARRIERS_MAX); i++) {
- anotherActor = _actors[i];
+ for (ActorDataArray::iterator anotherActor = _actors.begin(); (anotherActor != _actors.end()) && (_barrierCount < ACTOR_BARRIERS_MAX); ++anotherActor) {
if (!anotherActor->_inScene)
continue;
if (anotherActor == actor)
@@ -1067,8 +1057,8 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) {
return false;
} else {
if (actor->_flags & kProtagonist) {
- _actors[1]->_actorFlags &= ~kActorNoFollow; // TODO: mark all actors with kFollower flag, not only 1 and 2
- _actors[2]->_actorFlags &= ~kActorNoFollow;
+ _actors[1]._actorFlags &= ~kActorNoFollow; // TODO: mark all actors with kFollower flag, not only 1 and 2
+ _actors[2]._actorFlags &= ~kActorNoFollow;
}
actor->_currentAction = (actor->_walkStepsCount >= ACTOR_MAX_STEPS_COUNT) ? kActionWalkToLink : kActionWalkToPoint;
actor->_walkFrameSequence = getFrameType(kFrameWalk);
@@ -1153,7 +1143,7 @@ void Actor::moveDragon(ActorData *actor) {
event.param4 = -1; // Object
event.param5 = -1; // With Object
event.param6 = -1; // Actor
- _vm->_events->queue(&event);
+ _vm->_events->queue(event);
_dragonHunt = false;
}