aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-03-10 00:34:20 +0000
committerMax Horn2007-03-10 00:34:20 +0000
commitaba0cd04d667ed9aa177e485518f63ed4429c990 (patch)
treece8ba6559f72040c4a78263722b7b700458983c3 /engines/scumm
parent728d01cb1788a24383c0ffabba6428e35ba88148 (diff)
downloadscummvm-rg350-aba0cd04d667ed9aa177e485518f63ed4429c990.tar.gz
scummvm-rg350-aba0cd04d667ed9aa177e485518f63ed4429c990.tar.bz2
scummvm-rg350-aba0cd04d667ed9aa177e485518f63ed4429c990.zip
SCUMM: got rid of the _bompActorPalettePtr member var (which was only used as a hidden param to drawBomp); turned drawBomp into a regular function (used to be a ScummEngine member method)
svn-id: r26045
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/akos.cpp26
-rw-r--r--engines/scumm/akos.h2
-rw-r--r--engines/scumm/bomp.cpp16
-rw-r--r--engines/scumm/bomp.h25
-rw-r--r--engines/scumm/gfx.h15
-rw-r--r--engines/scumm/object.cpp30
-rw-r--r--engines/scumm/scumm.cpp1
-rw-r--r--engines/scumm/scumm.h5
8 files changed, 70 insertions, 50 deletions
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp
index f32c4467c3..994ef45b08 100644
--- a/engines/scumm/akos.cpp
+++ b/engines/scumm/akos.cpp
@@ -317,7 +317,7 @@ void AkosRenderer::setPalette(byte *new_palette) {
if (color == 255) {
palette[0] = color;
} else {
- _vm->_bompActorPalettePtr = palette;
+ useBompPalette = true;
}
}
}
@@ -1025,14 +1025,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
BompDrawData bdd;
- bdd.srcwidth = _width;
- bdd.srcheight = _height;
bdd.dst = _out;
- bdd.dataptr = _srcptr;
- bdd.scale_x = 255;
- bdd.scale_y = 255;
- bdd.shadowMode = _shadow_mode;
-
if (!_mirror) {
bdd.x = (_actorX - xmoveCur - _width) + 1;
} else {
@@ -1040,10 +1033,23 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
}
bdd.y = _actorY + ymoveCur;
+ bdd.src = _srcptr;
+ bdd.srcwidth = _width;
+ bdd.srcheight = _height;
+
+ bdd.scale_x = 255;
+ bdd.scale_y = 255;
+
bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
- _vm->drawBomp(bdd, !_mirror);
+ bdd.numStrips = _numStrips;
+
+ bdd.shadowMode = _shadow_mode;
+ bdd.shadowPalette = _vm->_shadowPalette;
+
+ bdd.actorPalette = useBompPalette ? palette : 0;
+ bdd.mirror = !_mirror;
- _vm->_bompActorPalettePtr = NULL;
+ drawBomp(bdd);
return 0;
}
diff --git a/engines/scumm/akos.h b/engines/scumm/akos.h
index c5a5fc1348..e0a56fd70e 100644
--- a/engines/scumm/akos.h
+++ b/engines/scumm/akos.h
@@ -59,6 +59,7 @@ protected:
// actor palette
byte palette[256];
+ bool useBompPalette;
// pointer to various parts of the costume resource
const byte *akos;
@@ -84,6 +85,7 @@ protected:
public:
AkosRenderer(ScummEngine *scumm) : BaseCostumeRenderer(scumm) {
+ useBompPalette = false;
akos = 0;
akhd = 0;
akpl = 0;
diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp
index bfe40add72..78808a79dc 100644
--- a/engines/scumm/bomp.cpp
+++ b/engines/scumm/bomp.cpp
@@ -197,7 +197,7 @@ void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 siz
}
}
-void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
+void drawBomp(const BompDrawData &bd) {
const byte *src;
byte *dst;
byte *mask = 0;
@@ -231,14 +231,14 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
clip.bottom = bd.dst.h - bd.y;
}
- src = bd.dataptr;
+ src = bd.src;
dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left);
const byte maskbit = revBitMask((bd.x + clip.left) & 7);
// Mask against any additionally imposed mask
if (bd.maskPtr) {
- mask = bd.maskPtr + (bd.y * _gdi->_numStrips) + ((bd.x + clip.left) / 8);
+ mask = bd.maskPtr + (bd.y * bd.numStrips) + ((bd.x + clip.left) / 8);
}
// Setup vertical scaling
@@ -276,7 +276,7 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
// Loop over all lines
while (pos_y < clip.bottom) {
// Decode a single (bomp encoded) line, reversed if we are in mirror mode
- if (mirror)
+ if (bd.mirror)
bompDecodeLineReverse(line_buffer, src + 2, bd.srcwidth);
else
bompDecodeLine(line_buffer, src + 2, bd.srcwidth);
@@ -313,17 +313,17 @@ void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
bompApplyMask(line_ptr, mask, maskbit, width, 255);
// Apply custom color map, if available
- if (_bompActorPalettePtr)
- bompApplyActorPalette(_bompActorPalettePtr, line_ptr, width);
+ if (bd.actorPalette)
+ bompApplyActorPalette(bd.actorPalette, line_ptr, width);
// Finally, draw the decoded, scaled, masked and recolored line onto
// the target surface, using the specified shadow mode
- bompApplyShadow(bd.shadowMode, _shadowPalette, line_ptr, dst, width, 255);
+ bompApplyShadow(bd.shadowMode, bd.shadowPalette, line_ptr, dst, width, 255);
}
// Advance to the next line
pos_y++;
- mask += _gdi->_numStrips;
+ mask += bd.numStrips;
dst += bd.dst.pitch;
}
}
diff --git a/engines/scumm/bomp.h b/engines/scumm/bomp.h
index 7a38f45b9c..cf22abe3de 100644
--- a/engines/scumm/bomp.h
+++ b/engines/scumm/bomp.h
@@ -24,6 +24,7 @@
#define SCUMM_BOMP_H
#include "common/scummsys.h"
+#include "graphics/surface.h"
namespace Scumm {
@@ -34,6 +35,30 @@ void decompressBomp(byte *dst, const byte *src, int w, int h);
void bompDecodeLine(byte *dst, const byte *src, int size);
void bompDecodeLineReverse(byte *dst, const byte *src, int size);
+
+/** Bomp graphics data */
+struct BompDrawData {
+ Graphics::Surface dst;
+ int x, y;
+
+ const byte *src;
+ int srcwidth, srcheight;
+
+ byte scale_x, scale_y;
+
+ byte *maskPtr;
+ int numStrips;
+
+ uint16 shadowMode;
+ byte *shadowPalette;
+
+ byte *actorPalette;
+
+ bool mirror;
+};
+
+void drawBomp(const BompDrawData &bd);
+
} // End of namespace Scumm
#endif
diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h
index a4683095a2..4df50a7053 100644
--- a/engines/scumm/gfx.h
+++ b/engines/scumm/gfx.h
@@ -170,21 +170,6 @@ struct ColorCycle {
byte end;
};
-/** Bomp graphics data, used as parameter to ScummEngine::drawBomp. */
-struct BompDrawData {
- Graphics::Surface dst;
-
- int x, y;
- byte scale_x, scale_y;
- const byte *dataptr;
- int srcwidth, srcheight;
- uint16 shadowMode;
-
- byte *maskPtr;
-
- BompDrawData() { memset(this, 0, sizeof(*this)); }
-};
-
struct StripTable;
#define CHARSET_MASK_TRANSPARENCY 253
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 3667bee35f..5cd1297034 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -1650,6 +1650,17 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) {
if (!bomp)
error("object %d is not a blast object", eo->number);
+ bdd.dst = *vs;
+ bdd.dst.pixels = vs->getPixels(0, 0);
+ bdd.x = eo->rect.left;
+ bdd.y = eo->rect.top;
+
+ // Skip the bomp header
+ if (_game.version == 8) {
+ bdd.src = bomp + 8;
+ } else {
+ bdd.src = bomp + 10;
+ }
if (_game.version == 8) {
bdd.srcwidth = READ_LE_UINT32(bomp);
bdd.srcheight = READ_LE_UINT32(bomp+4);
@@ -1658,26 +1669,23 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) {
bdd.srcheight = READ_LE_UINT16(bomp+4);
}
- bdd.dst = *vs;
- bdd.dst.pixels = vs->getPixels(0, 0);
- // Skip the bomp header
- if (_game.version == 8) {
- bdd.dataptr = bomp + 8;
- } else {
- bdd.dataptr = bomp + 10;
- }
- bdd.x = eo->rect.left;
- bdd.y = eo->rect.top;
bdd.scale_x = (byte)eo->scaleX;
bdd.scale_y = (byte)eo->scaleY;
+
bdd.maskPtr = NULL;
+ bdd.numStrips = _gdi->_numStrips;
if ((bdd.scale_x != 255) || (bdd.scale_y != 255)) {
bdd.shadowMode = 0;
} else {
bdd.shadowMode = eo->mode;
}
- drawBomp(bdd, false);
+ bdd.shadowPalette = _shadowPalette;
+
+ bdd.actorPalette = 0;
+ bdd.mirror = false;
+
+ drawBomp(bdd);
markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight);
}
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index ae18bf8673..3a25260263 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -250,7 +250,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_doEffect = false;
_currentLights = 0;
- _bompActorPalettePtr = NULL;
_shakeEnabled = false;
_shakeFrame = 0;
_screenStartStrip = 0;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 9b3429359a..5522814d39 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1040,11 +1040,6 @@ protected:
void dissolveEffect(int width, int height);
void scrollEffect(int dir);
- // bomp
-public:
- byte *_bompActorPalettePtr;
- void drawBomp(const BompDrawData &bd, bool mirror);
-
protected:
bool _shakeEnabled;
uint _shakeFrame;