properly init Actor objects instead of one big evil hackish memset...

svn-id: r6733
This commit is contained in:
Max Horn 2003-03-07 02:43:21 +00:00
parent 5537fc3df3
commit 5944944f78
2 changed files with 22 additions and 15 deletions

View File

@ -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;
}

View File

@ -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: