diff options
author | Max Horn | 2003-03-07 02:43:21 +0000 |
---|---|---|
committer | Max Horn | 2003-03-07 02:43:21 +0000 |
commit | 5944944f78f01757d1dc70ef189d569cceabd7bb (patch) | |
tree | bd30e9c4b6e0d2621e7b329717e3a7dd55f2ae4a | |
parent | 5537fc3df3b78f68e0b5923f9d4628350f9771c2 (diff) | |
download | scummvm-rg350-5944944f78f01757d1dc70ef189d569cceabd7bb.tar.gz scummvm-rg350-5944944f78f01757d1dc70ef189d569cceabd7bb.tar.bz2 scummvm-rg350-5944944f78f01757d1dc70ef189d569cceabd7bb.zip |
properly init Actor objects instead of one big evil hackish memset...
svn-id: r6733
-rw-r--r-- | scumm/actor.cpp | 19 | ||||
-rw-r--r-- | scumm/actor.h | 18 |
2 files changed, 22 insertions, 15 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 734b61111d..382edd37bf 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -53,14 +53,7 @@ void Actor::initActor(int mode) { talkPosY = 0; scaley = scalex = 0xFF; charset = 0; - sound[0] = 0; - sound[1] = 0; - sound[2] = 0; - sound[3] = 0; - sound[4] = 0; - sound[5] = 0; - sound[6] = 0; - sound[7] = 0; + memset(sound, 0, sizeof(sound)); newDirection = 0; stopActorMoving(); @@ -74,6 +67,7 @@ void Actor::initActor(int mode) { ignoreBoxes = 0; forceClip = 0; ignoreTurns = false; + initFrame = 1; walkFrame = 2; standFrame = 3; @@ -83,15 +77,14 @@ void Actor::initActor(int mode) { walk_script = 0; talk_script = 0; - if (_vm->_features & GF_AFTER_V7) { - _vm->_classData[number] = _vm->_classData[0]; - } else { - _vm->_classData[number] = 0; + if (_vm) { + _vm->_classData[number] = (_vm->_features & GF_AFTER_V7) ? _vm->_classData[0] : 0; } } void Actor::stopActorMoving() { - _vm->stopScriptNr(walk_script); + if (_vm) + _vm->stopScriptNr(walk_script); moving = 0; } diff --git a/scumm/actor.h b/scumm/actor.h index 2acda69dce..5691837518 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -109,8 +109,22 @@ public: // Constructor, sets all data to 0 Actor() { - memset(this, 0, sizeof(Actor)); - } void initActorClass(Scumm *scumm) { + top = bottom = 0; + number = 0; + needRedraw = needBgReset = costumeNeedsInit = visible = false; + flip = false; + frame = 0; + walkbox = 0; + animProgress = 0; + memset(animVariable, 0, sizeof(animVariable)); + memset(palette, 0, sizeof(palette)); + + walk_script = 0; + + initActor(1); + } + + void initActorClass(Scumm *scumm) { _vm = scumm; } //protected: |