aboutsummaryrefslogtreecommitdiff
path: root/engines
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
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')
-rw-r--r--engines/parallaction/debug.cpp4
-rw-r--r--engines/parallaction/gfxbase.cpp86
-rw-r--r--engines/parallaction/graphics.cpp11
-rw-r--r--engines/parallaction/graphics.h12
4 files changed, 21 insertions, 92 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index 0ff38913f7..02ac4f5a38 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -191,8 +191,8 @@ bool Debugger::Cmd_GfxObjects(int argc, const char **argv) {
"| name | x | y | z | layer | f | type | visi |\n"
"+--------------------+-----+-----+-----+-------+-----+--------+--------+\n");
- GfxObjList::iterator b = _vm->_gfx->_gfxobjList.begin();
- GfxObjList::iterator e = _vm->_gfx->_gfxobjList.end();
+ GfxObjArray::iterator b = _vm->_gfx->_sceneObjects.begin();
+ GfxObjArray::iterator e = _vm->_gfx->_sceneObjects.end();
for ( ; b != e; b++) {
GfxObj *obj = *b;
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);
}
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 674fa9b93a..0985b5b129 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -378,8 +378,6 @@ void Gfx::beginFrame() {
_varDrawPathZones = 0;
warning("Path zones are supported only in Big Red Adventure");
}
-
- _varAnimRenderMode = getRenderMode("anim_render_mode");
}
int32 Gfx::getRenderMode(const char *type) {
@@ -491,11 +489,10 @@ void Gfx::updateScreen() {
unlockScreen();
}
- _varRenderMode = _varAnimRenderMode;
-
+ sortScene();
Graphics::Surface *surf = lockScreen();
- // draws animations frames and screen items
- drawGfxObjects(*surf);
+ // draws animations frames and other game items
+ drawList(*surf, _sceneObjects);
// special effects
applyHalfbriteEffect_NS(*surf);
@@ -803,8 +800,6 @@ Gfx::Gfx(Parallaction* vm) :
registerVar("background_mode", 1);
_varBackgroundMode = 1;
- registerVar("anim_render_mode", 1);
-
registerVar("draw_path_zones", 0);
if ((_gameType == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index c2fbb0dbea..22ec7455f9 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -399,8 +399,6 @@ public:
void release();
};
-typedef Common::List<GfxObj*> GfxObjList;
-
#define LAYER_FOREGROUND 3
/*
@@ -481,6 +479,9 @@ public:
typedef Common::HashMap<Common::String, int32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> VarMap;
+typedef Common::Array<GfxObj*> GfxObjArray;
+
+
class Gfx {
protected:
@@ -490,14 +491,13 @@ public:
Disk *_disk;
VarMap _vars;
- GfxObjList _gfxobjList;
+ GfxObjArray _sceneObjects;
GfxObj* loadAnim(const char *name);
GfxObj* loadGet(const char *name);
GfxObj* loadDoor(const char *name);
- void drawGfxObjects(Graphics::Surface &surf);
void showGfxObj(GfxObj* obj, bool visible);
void clearGfxObjects(uint filter);
- void sortAnimations();
+ void sortScene();
// labels
@@ -573,7 +573,6 @@ protected:
// frame data stored in programmable variables
int32 _varBackgroundMode; // 1 = normal, 2 = only mask
- int32 _varAnimRenderMode; // 1 = normal, 2 = flat
int32 _varRenderMode;
int32 _varDrawPathZones; // 0 = don't draw, 1 = draw
Graphics::Surface _bitmapMask;
@@ -600,7 +599,6 @@ public:
#define MAX_NUM_LABELS 20
#define NO_FLOATING_LABEL 1000
- typedef Common::Array<GfxObj*> GfxObjArray;
GfxObjArray _labels;
GfxObjArray _balloons;
GfxObjArray _items;