[Scummvm-cvs-logs] SF.net SVN: scummvm: [26229] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Mar 18 21:35:13 CET 2007
Revision: 26229
http://scummvm.svn.sourceforge.net/scummvm/?rev=26229&view=rev
Author: peres001
Date: 2007-03-18 13:35:12 -0700 (Sun, 18 Mar 2007)
Log Message:
-----------
changed Animation::_cnv to be a pointer, in view of changes to Disk::loadFrames()
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/animation.cpp
scummvm/trunk/engines/parallaction/defs.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/zone.h
Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp 2007-03-18 20:18:19 UTC (rev 26228)
+++ scummvm/trunk/engines/parallaction/animation.cpp 2007-03-18 20:35:12 UTC (rev 26229)
@@ -126,7 +126,8 @@
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 @@
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;
Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h 2007-03-18 20:18:19 UTC (rev 26228)
+++ scummvm/trunk/engines/parallaction/defs.h 2007-03-18 20:35:12 UTC (rev 26229)
@@ -97,7 +97,7 @@
byte* getFramePtr(uint16 index) {
if (index >= _count)
- error("frame %i does not exist", index);
+ return NULL;
return _array[index];
}
};
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2007-03-18 20:18:19 UTC (rev 26228)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2007-03-18 20:35:12 UTC (rev 26229)
@@ -779,6 +779,12 @@
}
}
+// 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 @@
}
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);
Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h 2007-03-18 20:18:19 UTC (rev 26228)
+++ scummvm/trunk/engines/parallaction/zone.h 2007-03-18 20:35:12 UTC (rev 26229)
@@ -298,7 +298,7 @@
struct Animation {
Zone _zone;
Program *_program;
- Cnv _cnv;
+ Cnv *_cnv;
int16 _frame;
uint16 field_50; // unused
int16 _z;
@@ -328,19 +328,23 @@
}
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);
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list