aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-06-29 09:56:44 +0000
committerNicola Mettifogo2008-06-29 09:56:44 +0000
commit206485ffc676c64134774b9873cd8d333deddfee (patch)
tree6ea7a51b7ea45c679d461ffabd7a106b095495a4
parentd8645297cd174fbbd7059a317975c45adefaa5e5 (diff)
downloadscummvm-rg350-206485ffc676c64134774b9873cd8d333deddfee.tar.gz
scummvm-rg350-206485ffc676c64134774b9873cd8d333deddfee.tar.bz2
scummvm-rg350-206485ffc676c64134774b9873cd8d333deddfee.zip
Merged the three render lists (for animations, doors and objects) into a single one.
svn-id: r32834
-rw-r--r--engines/parallaction/debug.cpp14
-rw-r--r--engines/parallaction/gfxbase.cpp47
-rw-r--r--engines/parallaction/graphics.h12
3 files changed, 39 insertions, 34 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index 3c90a76f61..6bd704a2f5 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -191,14 +191,12 @@ bool Debugger::Cmd_GfxObjects(int argc, const char **argv) {
"| name | x | y | z | f | type | flag |\n"
"+--------------------+-----+-----+-----+-----+--------+--------+\n");
- for (uint i = 0; i < 3; i++) {
- GfxObjList::iterator b = _vm->_gfx->_gfxobjList[i].begin();
- GfxObjList::iterator e = _vm->_gfx->_gfxobjList[i].end();
-
- for ( ; b != e; b++) {
- GfxObj *obj = *b;
- DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], 6 );
- }
+ GfxObjList::iterator b = _vm->_gfx->_gfxobjList.begin();
+ GfxObjList::iterator e = _vm->_gfx->_gfxobjList.end();
+
+ for ( ; b != e; b++) {
+ GfxObj *obj = *b;
+ DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], 6 );
}
DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n");
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index dc28d9d425..66b1ceecf7 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -89,6 +89,8 @@ GfxObj* Gfx::loadAnim(const char *name) {
GfxObj *obj = _disk->loadFrames(name);
assert(obj);
+ // animation Z is not set here, but controlled by game scripts and user interaction.
+ // it is always >=0 and <screen height
obj->type = kGfxObjTypeAnim;
return obj;
}
@@ -98,6 +100,7 @@ GfxObj* Gfx::loadGet(const char *name) {
GfxObj *obj = _disk->loadStatic(name);
assert(obj);
+ obj->z = kGfxObjGetZ; // this preset Z value ensures that get zones are drawn after doors but before animations
obj->type = kGfxObjTypeGet;
return obj;
}
@@ -106,14 +109,13 @@ GfxObj* Gfx::loadDoor(const char *name) {
GfxObj *obj = _disk->loadFrames(name);
assert(obj);
+ obj->z = kGfxObjDoorZ; // this preset Z value ensures that doors are drawn first
obj->type = kGfxObjTypeDoor;
return obj;
}
void Gfx::clearGfxObjects() {
- _gfxobjList[0].clear();
- _gfxobjList[1].clear();
- _gfxobjList[2].clear();
+ _gfxobjList.clear();
}
void Gfx::showGfxObj(GfxObj* obj, bool visible) {
@@ -123,25 +125,25 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) {
if (visible) {
obj->setFlags(kGfxObjVisible);
- _gfxobjList[obj->type].push_back(obj);
+ _gfxobjList.push_back(obj);
} else {
obj->clearFlags(kGfxObjVisible);
- _gfxobjList[obj->type].remove(obj);
+ _gfxobjList.remove(obj);
}
}
-bool compareAnimationZ(const GfxObj* a1, const GfxObj* a2) {
+bool compareZ(const GfxObj* a1, const GfxObj* a2) {
return a1->z < a2->z;
}
void Gfx::sortAnimations() {
- GfxObjList::iterator first = _gfxobjList[kGfxObjTypeAnim].begin();
- GfxObjList::iterator last = _gfxobjList[kGfxObjTypeAnim].end();
+ GfxObjList::iterator first = _gfxobjList.begin();
+ GfxObjList::iterator last = _gfxobjList.end();
- Common::sort(first, last, compareAnimationZ);
+ Common::sort(first, last, compareZ);
}
void Gfx::drawGfxObjects(Graphics::Surface &surf) {
@@ -154,22 +156,19 @@ void Gfx::drawGfxObjects(Graphics::Surface &surf) {
// TODO: Dr.Ki is not visible inside the club
- for (uint i = 0; i < 3; i++) {
+ GfxObjList::iterator b = _gfxobjList.begin();
+ GfxObjList::iterator e = _gfxobjList.end();
- GfxObjList::iterator b = _gfxobjList[i].begin();
- GfxObjList::iterator e = _gfxobjList[i].end();
-
- for (; b != e; b++) {
- GfxObj *obj = *b;
- if (obj->isVisible()) {
- obj->getRect(obj->frame, rect);
- rect.translate(obj->x - _varScrollX, obj->y);
- data = obj->getData(obj->frame);
- if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
- blt(rect, data, &surf, obj->layer, 0);
- } else {
- unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
- }
+ for (; b != e; b++) {
+ GfxObj *obj = *b;
+ if (obj->isVisible()) {
+ obj->getRect(obj->frame, rect);
+ rect.translate(obj->x - _varScrollX, obj->y);
+ data = obj->getData(obj->frame);
+ if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
+ blt(rect, data, &surf, obj->layer, 0);
+ } else {
+ unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
}
}
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index c4b0c7b321..6439941cc5 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -360,6 +360,11 @@ enum {
kGfxObjTypeAnim = 2
};
+enum {
+ kGfxObjDoorZ = -200,
+ kGfxObjGetZ = -100
+};
+
class GfxObj {
char *_name;
Frames *_frames;
@@ -369,7 +374,10 @@ class GfxObj {
public:
int16 x, y;
- uint16 z;
+
+ int32 z;
+
+
uint type;
uint frame;
uint layer;
@@ -461,7 +469,7 @@ public:
Disk *_disk;
VarMap _vars;
- GfxObjList _gfxobjList[3];
+ GfxObjList _gfxobjList;
GfxObj* loadAnim(const char *name);
GfxObj* loadGet(const char *name);
GfxObj* loadDoor(const char *name);