mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 23:27:37 +00:00
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
This commit is contained in:
parent
728d01cb17
commit
aba0cd04d6
@ -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.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
|
||||
_vm->drawBomp(bdd, !_mirror);
|
||||
bdd.src = _srcptr;
|
||||
bdd.srcwidth = _width;
|
||||
bdd.srcheight = _height;
|
||||
|
||||
_vm->_bompActorPalettePtr = NULL;
|
||||
bdd.scale_x = 255;
|
||||
bdd.scale_y = 255;
|
||||
|
||||
bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
|
||||
bdd.numStrips = _numStrips;
|
||||
|
||||
bdd.shadowMode = _shadow_mode;
|
||||
bdd.shadowPalette = _vm->_shadowPalette;
|
||||
|
||||
bdd.actorPalette = useBompPalette ? palette : 0;
|
||||
bdd.mirror = !_mirror;
|
||||
|
||||
drawBomp(bdd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -250,7 +250,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
|
||||
|
||||
_doEffect = false;
|
||||
_currentLights = 0;
|
||||
_bompActorPalettePtr = NULL;
|
||||
_shakeEnabled = false;
|
||||
_shakeFrame = 0;
|
||||
_screenStartStrip = 0;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user