diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/animation.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/defs.h | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/zone.h | 18 |
4 files changed, 26 insertions, 12 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 701abc9065..031aa66bbd 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -126,7 +126,8 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name) strcat(vC8, "tras"); } } - _disk->loadFrames(vC8, &vD0->_cnv); + vD0->_cnv = new Cnv; + _disk->loadFrames(vC8, vD0->_cnv); // int16 _ax = _vm->_gfx->loadCnv(vC8, &vD0->_cnv); // if (_ax == -1) exit(-1); } @@ -169,8 +170,11 @@ void Parallaction::freeAnimations() { Animation *v4 = (Animation*)_animations._next; while (v4) { freeScript(v4->_program); - _vm->_gfx->freeCnv(&v4->_cnv); + _vm->_gfx->freeCnv(v4->_cnv); + if (v4->_cnv) delete v4->_cnv; v4 = (Animation*)v4->_zone._next; + + // TODO: delete Animation } return; diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h index d1b5730a40..6501a2c4b1 100644 --- a/engines/parallaction/defs.h +++ b/engines/parallaction/defs.h @@ -97,7 +97,7 @@ public: byte* getFramePtr(uint16 index) { if (index >= _count) - error("frame %i does not exist", index); + return NULL; return _array[index]; } }; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 5b8a6ff0e1..9b8dc01b8f 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -779,6 +779,12 @@ void Parallaction::pickMusic(const char *location) { } } +// FIXME: currently, changeCharacter does reload every chunk of +// information about the new character every time it is loaded. +// So, it is useless to load both mini and normal frames each +// since only one of them will actually be used before the +// following call to changeCharacter. +// void Parallaction::changeCharacter(const char *name) { bool miniCharacter = false; @@ -825,9 +831,9 @@ void Parallaction::changeCharacter(const char *name) { } if (miniCharacter) - memcpy(&_vm->_char._ani._cnv, &_vm->_char._miniFrames, sizeof(Cnv)); + _vm->_char._ani._cnv = &_vm->_char._miniFrames; else - memcpy(&_vm->_char._ani._cnv, &_vm->_char._normalFrames, sizeof(Cnv)); + _vm->_char._ani._cnv = &_vm->_char._normalFrames; strcpy(_characterName1, v32); diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h index 31ac168096..046403d7a0 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -298,7 +298,7 @@ struct Program : public Node { struct Animation { Zone _zone; Program *_program; - Cnv _cnv; + Cnv *_cnv; int16 _frame; uint16 field_50; // unused int16 _z; @@ -328,19 +328,23 @@ struct Animation { } uint16 width() const { - return _cnv._width; + if (!_cnv) return 0; + return _cnv->_width; } uint16 height() const { - return _cnv._height; + if (!_cnv) return 0; + return _cnv->_height; } - uint16 getFrameNum() { - return _cnv._count; + uint16 getFrameNum() const { + if (!_cnv) return 0; + return _cnv->_count; } - byte* getFrameData(uint32 index) { - return _cnv.getFramePtr(index); + byte* getFrameData(uint32 index) const { + if (!_cnv) return NULL; + return _cnv->getFramePtr(index); } }; |