aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/parallaction.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2009-02-27 08:56:19 +0000
committerNicola Mettifogo2009-02-27 08:56:19 +0000
commit44906f574fa46f1f02d8e9f9d5113ab1b35cf759 (patch)
tree36458f56be6242c027662f9b0664cbf6455e9ea3 /engines/parallaction/parallaction.cpp
parente17a14001997552dd51c99275b623f5fa6b1b9ca (diff)
downloadscummvm-rg350-44906f574fa46f1f02d8e9f9d5113ab1b35cf759.tar.gz
scummvm-rg350-44906f574fa46f1f02d8e9f9d5113ab1b35cf759.tar.bz2
scummvm-rg350-44906f574fa46f1f02d8e9f9d5113ab1b35cf759.zip
The engine has now to build the drawing list for the graphic department, instead of setting visibility flags; the new field _prog has been added to GfxObj to help sorting the list.
The outcome is that cleaning up unused resources on location switches is now easier to manage, and less error prone. svn-id: r38928
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r--engines/parallaction/parallaction.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index abd8249d02..38d8b8002e 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -338,6 +338,8 @@ void Parallaction::runGameFrame(int event) {
_input->setArrowCursor();
}
+ _gfx->beginFrame();
+
runPendingZones();
if (shouldQuit())
@@ -494,6 +496,29 @@ void Parallaction::drawAnimation(AnimationPtr anim) {
obj->z = anim->getZ();
obj->layer = layer;
obj->scale = scale;
+ _gfx->addObjectToScene(obj);
+}
+
+void Parallaction::drawZone(ZonePtr zone) {
+ if (!zone) {
+ return;
+ }
+
+ GfxObj *obj = 0;
+ if (ACTIONTYPE(zone) == kZoneGet) {
+ obj = zone->u.get->gfxobj;
+ } else
+ if (ACTIONTYPE(zone) == kZoneDoor) {
+ obj = zone->u.door->gfxobj;
+ }
+
+ if (!obj) {
+ return;
+ }
+
+ obj->x = zone->getX();
+ obj->y = zone->getY();
+ _gfx->addObjectToScene(obj);
}
void Parallaction::updateZones() {
@@ -512,16 +537,10 @@ void Parallaction::updateZones() {
}
}
- // examine the list of get zones to update
- for (ZoneList::iterator zit = _zonesToUpdate.begin(); zit != _zonesToUpdate.end(); ++zit) {
- ZonePtr z = *zit;
- if (ACTIONTYPE(z) == kZoneGet) {
- GfxObj *obj = z->u.get->gfxobj;
- obj->x = z->getX();
- obj->y = z->getY();
- }
+ // go through all zones and mark/unmark each of them for display
+ for (ZoneList::iterator zit = _location._zones.begin(); zit != _location._zones.end(); ++zit) {
+ drawZone(*zit);
}
- _zonesToUpdate.clear();
debugC(9, kDebugExec, "Parallaction::updateZones done()\n");
}