diff options
author | Max Horn | 2006-12-25 15:37:20 +0000 |
---|---|---|
committer | Max Horn | 2006-12-25 15:37:20 +0000 |
commit | ba991e3b3ac520dad1d2eeed05c890bfe058c506 (patch) | |
tree | d0f00c2ed593c266cd3b1b08dc1ff2e2add201e1 | |
parent | 4ce7b7408584bd12989e4d309f9280bf4222c44f (diff) | |
download | scummvm-rg350-ba991e3b3ac520dad1d2eeed05c890bfe058c506.tar.gz scummvm-rg350-ba991e3b3ac520dad1d2eeed05c890bfe058c506.tar.bz2 scummvm-rg350-ba991e3b3ac520dad1d2eeed05c890bfe058c506.zip |
SCUMM: Added ActorC64 subclass of Actor, and added a note stating that _miscflags isn't currently stored (possibly breaking C64 save states). Also reordered some HE specific code
svn-id: r24923
-rw-r--r-- | engines/scumm/actor.cpp | 51 | ||||
-rw-r--r-- | engines/scumm/actor.h | 26 | ||||
-rw-r--r-- | engines/scumm/script_c64.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 6 |
4 files changed, 58 insertions, 29 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 63b0a8d7fc..1d3d92eece 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -51,25 +51,49 @@ void Actor::initActorClass(ScummEngine *scumm) { } } -Actor::Actor() { +Actor::Actor(int id) { assert(_vm != 0); - _number = 0; + _number = id; initActor(-1); } void Actor::initActor(int mode) { + // begin HE specific + if (mode == -1) { + _heSkipLimbs = false; + memset(_heTalkQueue, 0, sizeof(_heTalkQueue)); + } + + if (mode == 1 || mode == -1) { + _heCondMask = 1; + _heNoTalkAnimation = 0; + _heSkipLimbs = false; + } else if (mode == 2) { + _heCondMask = 1; + _heSkipLimbs = false; + } + + _heXmapNum = 0; + _hePaletteNum = 0; + _heFlags = 0; + _heTalking = false; + // end HE specific + + if (mode == -1) { _offsX = _offsY = 0; _top = _bottom = 0; - _needRedraw = _needBgReset = _costumeNeedsInit = _visible = false; + _needRedraw = false; + _needBgReset = false; + _costumeNeedsInit = false; + _visible = false; _flip = false; _speedx = 8; _speedy = 2; _frame = 0; _walkbox = 0; _animProgress = 0; - _heSkipLimbs = false; _drawToBackBuf = false; memset(_animVariable, 0, sizeof(_animVariable)); memset(_palette, 0, sizeof(_palette)); @@ -78,27 +102,18 @@ void Actor::initActor(int mode) { memset(&_walkdata, 0, sizeof(ActorWalkData)); _walkdata.point3.x = 32000; _walkScript = 0; - memset(_heTalkQueue, 0, sizeof(_heTalkQueue)); - _miscflags = 0; - - mode = 1; } - if (mode == 1) { + if (mode == 1 || mode == -1) { _costume = 0; _room = 0; _pos.x = 0; _pos.y = 0; _facing = 180; - _heCondMask = 1; - _heNoTalkAnimation = 0; if (_vm->_game.version >= 7) _visible = false; - _heSkipLimbs = false; } else if (mode == 2) { _facing = 180; - _heCondMask = 1; - _heSkipLimbs = false; } _elevation = 0; _width = 24; @@ -110,12 +125,11 @@ void Actor::initActor(int mode) { memset(_sound, 0, sizeof(_sound)); _targetFacing = _facing; - stopActorMoving(); - - _heXmapNum = 0; _shadowMode = 0; _layer = 0; + stopActorMoving(); + setActorWalkSpeed(8, 2); _animSpeed = 0; if (_vm->_game.version >= 6) @@ -146,15 +160,12 @@ void Actor::initActor(int mode) { _talkStopFrame = 5; } - _heTalking = false; _walkScript = 0; _talkScript = 0; _clipOverride = _vm->_actorClipOverride; _auxBlock.reset(); - _hePaletteNum = 0; - _heFlags = 0; _vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0; } diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h index 632a819467..7576b9aa95 100644 --- a/engines/scumm/actor.h +++ b/engines/scumm/actor.h @@ -127,9 +127,6 @@ public: uint16 _sound[32]; CostumeData _cost; - /* C64 maniac specific */ - byte _miscflags; - /* HE specific */ bool _heNoTalkAnimation; bool _heSkipLimbs; @@ -179,13 +176,14 @@ protected: public: - Actor(); + Actor(int id); + virtual ~Actor() {} //protected: void hideActor(); void showActor(); - void initActor(int mode); + virtual void initActor(int mode); void putActor() { putActor(_pos.x, _pos.y, _room); @@ -320,6 +318,24 @@ protected: void findPathTowardsOld(byte box, byte box2, byte box3, Common::Point &p2, Common::Point &p3); }; +class ActorC64 : public Actor { +public: + // FIXME: This flag is never saved, which might lead to broken save states. + byte _miscflags; + +public: + ActorC64(int id) : Actor(id) {} + virtual void initActor(int mode) { + if (mode == -1) { + _miscflags = 0; + } + } + +protected: + +}; + + } // End of namespace Scumm #endif diff --git a/engines/scumm/script_c64.cpp b/engines/scumm/script_c64.cpp index ee39414060..d47f264b1e 100644 --- a/engines/scumm/script_c64.cpp +++ b/engines/scumm/script_c64.cpp @@ -791,7 +791,7 @@ void ScummEngine_c64::o_setActorBitVar() { byte mask = getVarOrDirectByte(PARAM_2); byte mod = getVarOrDirectByte(PARAM_3); - Actor *a = derefActor(act, "o_setActorBitVar"); + ActorC64 *a = (ActorC64 *)derefActor(act, "o_setActorBitVar"); if (mod) a->_miscflags |= mask; else @@ -805,7 +805,7 @@ void ScummEngine_c64::o_getActorBitVar() { byte act = getVarOrDirectByte(PARAM_1); byte mask = getVarOrDirectByte(PARAM_2); - Actor *a = derefActor(act, "o_getActorBitVar"); + ActorC64 *a = (ActorC64 *)derefActor(act, "o_getActorBitVar"); setResult((a->_miscflags & mask) ? 1 : 0); debug(0, "o_getActorBitVar(%d, %d, %d)", act, mask, (a->_miscflags & mask)); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index c71e78d509..672438b344 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1246,8 +1246,10 @@ void ScummEngine::resetScumm() { _actors = new Actor * [_numActors]; _sortedActors = new Actor * [_numActors]; for (i = 0; i < _numActors; ++i) { - _actors[i] = new Actor(); - _actors[i]->_number = i; + if (_game.version == 0) + _actors[i] = new ActorC64(i); + else + _actors[i] = new Actor(i); _actors[i]->initActor(1); // this is from IDB |