aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/gfxbase.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-12-13 17:52:37 +0000
committerNicola Mettifogo2008-12-13 17:52:37 +0000
commit5b3977518401331969fe05cfd5ab01f434505ee3 (patch)
treeafb5567d9ea1ec8543b2768b9997854dabeda2fd /engines/parallaction/gfxbase.cpp
parent800db6f142b93c07903ad6ef7c2a57bb563ff6dc (diff)
downloadscummvm-rg350-5b3977518401331969fe05cfd5ab01f434505ee3.tar.gz
scummvm-rg350-5b3977518401331969fe05cfd5ab01f434505ee3.tar.bz2
scummvm-rg350-5b3977518401331969fe05cfd5ab01f434505ee3.zip
Some more restructuring of rendering code.
svn-id: r35343
Diffstat (limited to 'engines/parallaction/gfxbase.cpp')
-rw-r--r--engines/parallaction/gfxbase.cpp86
1 files changed, 11 insertions, 75 deletions
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 0e1144c350..782e4df681 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -95,7 +95,7 @@ GfxObj* Gfx::loadAnim(const char *name) {
// animation Z is not set here, but controlled by game scripts and user interaction.
// it is always >=0 and <screen height
obj->transparentKey = 0;
- _gfxobjList.push_back(obj);
+ _sceneObjects.push_back(obj);
return obj;
}
@@ -107,7 +107,7 @@ GfxObj* Gfx::loadGet(const char *name) {
obj->z = kGfxObjGetZ; // this preset Z value ensures that get zones are drawn after doors but before animations
obj->type = kGfxObjTypeGet;
obj->transparentKey = 0;
- _gfxobjList.push_back(obj);
+ _sceneObjects.push_back(obj);
return obj;
}
@@ -120,20 +120,17 @@ GfxObj* Gfx::loadDoor(const char *name) {
obj->z = kGfxObjDoorZ; // this preset Z value ensures that doors are drawn first
obj->transparentKey = 0;
- _gfxobjList.push_back(obj);
+ _sceneObjects.push_back(obj);
return obj;
}
void Gfx::clearGfxObjects(uint filter) {
- GfxObjList::iterator b = _gfxobjList.begin();
- GfxObjList::iterator e = _gfxobjList.end();
-
- for ( ; b != e; ) {
- if (((*b)->_flags & filter) != 0) {
- b = _gfxobjList.erase(b);
+ for (uint i = 0; i < _sceneObjects.size() ; ) {
+ if ((_sceneObjects[i]->_flags & filter) != 0) {
+ _sceneObjects.remove_at(i);
} else {
- b++;
+ i++;
}
}
@@ -157,9 +154,9 @@ bool compareZ(const GfxObj* a1, const GfxObj* a2) {
return a1->z < a2->z;
}
-void Gfx::sortAnimations() {
- GfxObjList::iterator first = _gfxobjList.begin();
- GfxObjList::iterator last = _gfxobjList.end();
+void Gfx::sortScene() {
+ GfxObjArray::iterator first = _sceneObjects.begin();
+ GfxObjArray::iterator last = _sceneObjects.end();
Common::sort(first, last, compareZ);
}
@@ -191,21 +188,6 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
}
-void Gfx::drawGfxObjects(Graphics::Surface &surf) {
-
- sortAnimations();
- // TODO: some zones don't appear because of wrong masking (3 or 0?)
-
- GfxObjList::iterator b = _gfxobjList.begin();
- GfxObjList::iterator e = _gfxobjList.end();
-
- for (; b != e; b++) {
- drawGfxObject(*b, surf);
- }
-}
-
-
-
void Gfx::drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color) {
byte *dst = (byte*)surf->getBasePtr(x, y);
font->setColor(color);
@@ -410,53 +392,7 @@ void Gfx::bltNoMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface
void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) {
-
- Common::Point dp;
- Common::Rect q(r);
-
- Common::Rect clipper(surf->w, surf->h);
-
- q.clip(clipper);
- if (!q.isValidRect()) return;
-
- dp.x = q.left;
- dp.y = q.top;
-
- q.translate(-r.left, -r.top);
-
- byte *s = data + q.left + q.top * r.width();
- byte *d = (byte*)surf->getBasePtr(dp.x, dp.y);
-
- uint sPitch = r.width() - q.width();
- uint dPitch = surf->w - q.width();
-
-
- if (_varRenderMode == 2) {
-
- for (uint16 i = 0; i < q.height(); i++) {
-
- for (uint16 j = 0; j < q.width(); j++) {
- if (*s != transparentColor) {
- if (_backgroundInfo->mask.data && (z < LAYER_FOREGROUND)) {
- byte v = _backgroundInfo->mask.getValue(dp.x + j, dp.y + i);
- if (z >= v) *d = 5;
- } else {
- *d = 5;
- }
- }
-
- s++;
- d++;
- }
-
- s += sPitch;
- d += dPitch;
- }
-
- } else {
- bltMaskScale(r, data, surf, z, scale, transparentColor);
- }
-
+ bltMaskScale(r, data, surf, z, scale, transparentColor);
}