aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-18 21:08:28 +0000
committerNicola Mettifogo2007-03-18 21:08:28 +0000
commit992f5357243a8ff80316ca2efbfa2e7dab31b7b0 (patch)
treedb3ecc57a125e3149e176557829d19a0f7e15aa0
parent4966b755f01eb21285ee341742ac413a5625f0b1 (diff)
downloadscummvm-rg350-992f5357243a8ff80316ca2efbfa2e7dab31b7b0.tar.gz
scummvm-rg350-992f5357243a8ff80316ca2efbfa2e7dab31b7b0.tar.bz2
scummvm-rg350-992f5357243a8ff80316ca2efbfa2e7dab31b7b0.zip
Made loadFrames return a new Cnv instead of accepting a parameter.
svn-id: r26231
-rw-r--r--engines/parallaction/animation.cpp5
-rw-r--r--engines/parallaction/disk.cpp7
-rw-r--r--engines/parallaction/disk.h2
-rw-r--r--engines/parallaction/parallaction.cpp15
-rw-r--r--engines/parallaction/parallaction.h7
-rw-r--r--engines/parallaction/zone.cpp5
6 files changed, 20 insertions, 21 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index 031aa66bbd..dc52066b71 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -126,10 +126,7 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name)
strcat(vC8, "tras");
}
}
- vD0->_cnv = new Cnv;
- _disk->loadFrames(vC8, vD0->_cnv);
-// int16 _ax = _vm->_gfx->loadCnv(vC8, &vD0->_cnv);
-// if (_ax == -1) exit(-1);
+ vD0->_cnv = _disk->loadFrames(vC8);
}
if (!scumm_stricmp(_tokens[0], "position")) {
vD0->_zone._left = atoi(_tokens[1]);
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 26da5f6967..752590bf0a 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -369,11 +369,10 @@ void Disk::loadStatic(const char* name, StaticCnv* cnv) {
return;
}
-void Disk::loadFrames(const char* name, Cnv* cnv) {
-
+Cnv* Disk::loadFrames(const char* name) {
+ Cnv* cnv = new Cnv;
loadCnv(name, cnv);
-
- return;
+ return cnv;
}
//
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index d9163f92e4..43b68317dc 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -111,7 +111,7 @@ public:
StaticCnv* loadHead(const char* name);
Cnv* loadFont(const char* name);
void loadStatic(const char* name, StaticCnv* cnv);
- void loadFrames(const char* name, Cnv* cnv);
+ Cnv* loadFrames(const char* name);
void loadSlide(const char *filename);
void loadScenery(const char* background, const char* mask);
};
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 9b8dc01b8f..58d0f0a99c 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -717,10 +717,13 @@ void Parallaction::changeCursor(int32 index) {
void freeCharacter() {
- _vm->_gfx->freeCnv(&_vm->_char._normalFrames);
+ _vm->_gfx->freeCnv(_vm->_char._normalFrames);
+ if (_vm->_char._normalFrames) delete _vm->_char._normalFrames;
if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
- _vm->_gfx->freeCnv(&_vm->_char._miniFrames);
+ _vm->_gfx->freeCnv(_vm->_char._miniFrames);
+ if (_vm->_char._miniFrames) delete _vm->_char._miniFrames;
+
_vm->freeTable(_objectsNames);
_vm->_gfx->freeCnv(_vm->_char._talk);
@@ -810,7 +813,7 @@ void Parallaction::changeCharacter(const char *name) {
char path[PATH_LEN];
strcpy(path, v32);
- _disk->loadFrames(path, &_vm->_char._normalFrames);
+ _vm->_char._normalFrames = _disk->loadFrames(path);
if (!IS_DUMMY_CHARACTER(name)) {
_vm->_char._head = _disk->loadHead(path);
@@ -818,7 +821,7 @@ void Parallaction::changeCharacter(const char *name) {
_vm->_char._objs = _disk->loadObjects(name);
sprintf(path, "mini%s", v32);
- _disk->loadFrames(path, &_vm->_char._miniFrames);
+ _vm->_char._miniFrames = _disk->loadFrames(path);
sprintf(path, "%s.tab", name);
initTable(path, _objectsNames);
@@ -831,9 +834,9 @@ void Parallaction::changeCharacter(const char *name) {
}
if (miniCharacter)
- _vm->_char._ani._cnv = &_vm->_char._miniFrames;
+ _vm->_char._ani._cnv = _vm->_char._miniFrames;
else
- _vm->_char._ani._cnv = &_vm->_char._normalFrames;
+ _vm->_char._ani._cnv = _vm->_char._normalFrames;
strcpy(_characterName1, v32);
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index fec7d90c61..5d260673f9 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -237,8 +237,8 @@ struct Character {
Animation _ani;
StaticCnv *_head;
Cnv *_talk;
- Cnv _normalFrames;
- Cnv _miniFrames;
+ Cnv *_normalFrames;
+ Cnv *_miniFrames;
Cnv *_objs;
Character() {
@@ -267,6 +267,9 @@ struct Character {
_ani._zone._type = kZoneYou;
_ani._zone._label._cnv._data0 = NULL;
_ani._zone._label._text = strdup("yourself");
+
+ _normalFrames = NULL;
+ _miniFrames = NULL;
}
};
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index abdc22dfe6..78182360cd 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -267,13 +267,10 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
if (!scumm_stricmp(_tokens[0], "file")) {
// printf("file: '%s'", _tokens[0]);
- u->door->_cnv = new Cnv;
strcpy(vC8, _tokens[1]);
StaticCnv vE0;
- _disk->loadFrames(vC8, u->door->_cnv);
-
-// printf("door width: %i, height: %i", doorcnv->_width, doorcnv->_height );
+ u->door->_cnv = _disk->loadFrames(vC8);
vE0._width = u->door->_cnv->_width;
vE0._height = u->door->_cnv->_height;