From f3e970f5b7df962320390e3b92c493351f550715 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 10 Mar 2007 13:53:11 +0000 Subject: SCUMM: Renamed ActorOldWalk to Actor_v3, added new subclass Actor_v2 svn-id: r26057 --- engines/scumm/actor.cpp | 63 ++++++++++++++++++++++++++----------------------- engines/scumm/actor.h | 23 +++++++++++++----- engines/scumm/boxes.cpp | 2 +- engines/scumm/scumm.cpp | 7 +++--- 4 files changed, 55 insertions(+), 40 deletions(-) diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 177e219799..bb9b935be2 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -87,13 +87,8 @@ void Actor::initActor(int mode) { _costumeNeedsInit = false; _visible = false; _flip = false; - if (_vm->_game.version <= 2) { - _speedx = 1; - _speedy = 1; - } else { - _speedx = 8; - _speedy = 2; - } + _speedx = 8; + _speedy = 2; _frame = 0; _walkbox = 0; _animProgress = 0; @@ -133,10 +128,7 @@ void Actor::initActor(int mode) { stopActorMoving(); - if (_vm->_game.version <= 2) - setActorWalkSpeed(1, 1); - else - setActorWalkSpeed(8, 2); + setActorWalkSpeed(8, 2); _animSpeed = 0; if (_vm->_game.version >= 6) @@ -153,19 +145,11 @@ void Actor::initActor(int mode) { _talkPan = 64; _talkVolume = 127; - if (_vm->_game.version <= 2) { - _initFrame = 2; - _walkFrame = 0; - _standFrame = 1; - _talkStartFrame = 5; - _talkStopFrame = 4; - } else { - _initFrame = 1; - _walkFrame = 2; - _standFrame = 3; - _talkStartFrame = 4; - _talkStopFrame = 5; - } + _initFrame = 1; + _walkFrame = 2; + _standFrame = 3; + _talkStartFrame = 4; + _talkStopFrame = 5; _walkScript = 0; _talkScript = 0; @@ -177,12 +161,30 @@ void Actor::initActor(int mode) { _vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0; } +void Actor_v2::initActor(int mode) { + Actor::initActor(mode); + + if (mode == -1) { + _speedx = 1; + _speedy = 1; + } + + setActorWalkSpeed(1, 1); + + _initFrame = 2; + _walkFrame = 0; + _standFrame = 1; + _talkStartFrame = 5; + _talkStopFrame = 4; +} + + void Actor::setBox(int box) { _walkbox = box; setupActorScale(); } -void ActorOldWalk::setupActorScale() { +void Actor_v3::setupActorScale() { // TODO: The following could probably be removed _scalex = 0xFF; _scaley = 0xFF; @@ -574,7 +576,7 @@ void Actor::walkActor() { } */ -void ActorOldWalk::walkActor() { +void Actor_v3::walkActor() { Common::Point p2, p3; // Gate locations int new_dir, next_box; @@ -2117,10 +2119,11 @@ bool Actor::isInClass(int cls) { } bool Actor::isPlayer() { - if (_vm->_game.version <= 2) - return _vm->VAR(42) <= _number && _number <= _vm->VAR(43); - else - return isInClass(kObjectClassPlayer); + return isInClass(kObjectClassPlayer); +} + +bool Actor_v2::isPlayer() { + return _vm->VAR(42) <= _number && _number <= _vm->VAR(43); } void Actor::setHEFlag(int bit, int set) { diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index 9824146974..23b11cba99 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -327,14 +327,14 @@ public: protected: bool isInClass(int cls); - bool isPlayer(); + virtual bool isPlayer(); bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath); }; -class ActorOldWalk : public Actor { +class Actor_v3 : public Actor { public: - ActorOldWalk(int id) : Actor(id) {} + Actor_v3(int id) : Actor(id) {} virtual void walkActor(); @@ -343,15 +343,26 @@ protected: void findPathTowardsOld(byte box, byte box2, byte box3, Common::Point &p2, Common::Point &p3); }; -class ActorC64 : public ActorOldWalk { +class Actor_v2 : public Actor_v3 { +public: + Actor_v2(int id) : Actor_v3(id) {} + + virtual void initActor(int mode); + //virtual void walkActor(); + +protected: + virtual bool isPlayer(); +}; + +class ActorC64 : public Actor_v2 { public: // FIXME: This flag is never saved, which might lead to broken save states. byte _miscflags; public: - ActorC64(int id) : ActorOldWalk(id) {} + ActorC64(int id) : Actor_v2(id) {} virtual void initActor(int mode) { - ActorOldWalk::initActor(mode); + Actor_v2::initActor(mode); if (mode == -1) { _miscflags = 0; } diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 91752cfc34..cd20cd2fed 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -1134,7 +1134,7 @@ bool ScummEngine::areBoxesNeighbours(int box1nr, int box2nr) { return false; } -void ActorOldWalk::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::Point &p2, Common::Point &p3) { +void Actor_v3::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::Point &p2, Common::Point &p3) { Common::Point pt; Common::Point gateA[2]; Common::Point gateB[2]; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 3a25260263..b808ccb061 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1301,12 +1301,13 @@ void ScummEngine::resetScumm() { for (i = 0; i < _numActors; ++i) { if (_game.version == 0) _actors[i] = new ActorC64(i); - else if (_game.version <= 3) - _actors[i] = new ActorOldWalk(i); + else if (_game.version <= 2) + _actors[i] = new Actor_v2(i); + else if (_game.version == 3) + _actors[i] = new Actor_v3(i); else _actors[i] = new Actor(i); _actors[i]->initActor(-1); - _actors[i]->initActor(1); // this is from IDB if ((_game.version <= 1) || (_game.id == GID_MANIAC && (_game.features & GF_DEMO))) -- cgit v1.2.3