mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
cleanup
svn-id: r8145
This commit is contained in:
parent
6eca1c98c7
commit
3d28cfaf82
@ -781,8 +781,10 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
|
||||
bdd.scale_y = 255;
|
||||
bdd.shadowMode = _shadow_mode;
|
||||
|
||||
_vm->_bompScallingXPtr = NULL;
|
||||
_vm->_bompScallingYPtr = NULL;
|
||||
bdd.scalingXPtr = NULL;
|
||||
bdd.scalingYPtr = NULL;
|
||||
bdd.scaleRight = 0;
|
||||
bdd.scaleBottom = 0;
|
||||
|
||||
int decode_mode;
|
||||
|
||||
@ -797,10 +799,10 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
|
||||
bdd.y = _actorY + ymoveCur;
|
||||
|
||||
if (_zbuf != 0) {
|
||||
_vm->_bompMaskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
|
||||
_vm->drawBomp(&bdd, decode_mode, 1);
|
||||
bdd.maskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
|
||||
_vm->drawBomp(bdd, decode_mode, 1);
|
||||
} else {
|
||||
_vm->drawBomp(&bdd, decode_mode, 0);
|
||||
_vm->drawBomp(bdd, decode_mode, 0);
|
||||
}
|
||||
|
||||
_vm->_bompActorPalettePtr = NULL;
|
||||
|
@ -3245,9 +3245,7 @@ int32 Scumm::bompDecodeLineMode0(const byte *src, byte *line_buffer, int32 size)
|
||||
if (size <= 0)
|
||||
return size;
|
||||
|
||||
for (int32 l = 0; l < size; l++) {
|
||||
*(line_buffer++) = *(src++);
|
||||
}
|
||||
memcpy(line_buffer, src, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -3376,11 +3374,11 @@ void Scumm::bompApplyActorPalette(byte *line_buffer, int32 size) {
|
||||
}
|
||||
}
|
||||
|
||||
void Scumm::bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, int32 size) {
|
||||
void Scumm::bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size) {
|
||||
byte * line_ptr1 = line_buffer;
|
||||
byte * line_ptr2 = line_buffer;
|
||||
|
||||
byte tmp = *(scalling_x_ptr++);
|
||||
byte tmp = *(scaling_x_ptr++);
|
||||
|
||||
while (size--) {
|
||||
if ((skip & tmp) == 0) {
|
||||
@ -3390,7 +3388,7 @@ void Scumm::bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, i
|
||||
skip >>= 1;
|
||||
if (skip == 0) {
|
||||
skip = 128;
|
||||
tmp = *(scalling_x_ptr++);
|
||||
tmp = *(scaling_x_ptr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3427,7 +3425,7 @@ void Scumm::decompressBomp(byte *dst, const byte *src, int w, int h) {
|
||||
} while (--h);
|
||||
}
|
||||
|
||||
void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
void Scumm::drawBomp(const BompDrawData &bd, int decode_mode, int mask) {
|
||||
byte skip_y = 128;
|
||||
byte skip_y_new = 0;
|
||||
byte bits;
|
||||
@ -3435,55 +3433,56 @@ void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
byte *charset_mask;
|
||||
byte tmp;
|
||||
int32 clip_left, clip_right, clip_top, clip_bottom, tmp_x, tmp_y, mask_offset, mask_pitch;
|
||||
byte *scalingYPtr = bd.scalingYPtr;
|
||||
|
||||
if (bd->x < 0) {
|
||||
clip_left = -bd->x;
|
||||
if (bd.x < 0) {
|
||||
clip_left = -bd.x;
|
||||
} else {
|
||||
clip_left = 0;
|
||||
}
|
||||
|
||||
if (bd->y < 0) {
|
||||
clip_top = -bd->y;
|
||||
if (bd.y < 0) {
|
||||
clip_top = -bd.y;
|
||||
} else {
|
||||
clip_top = 0;
|
||||
}
|
||||
|
||||
clip_right = bd->srcwidth - clip_left;
|
||||
tmp_x = bd->x + bd->srcwidth;
|
||||
if (tmp_x > bd->outwidth) {
|
||||
clip_right -= tmp_x - bd->outwidth;
|
||||
clip_right = bd.srcwidth - clip_left;
|
||||
tmp_x = bd.x + bd.srcwidth;
|
||||
if (tmp_x > bd.outwidth) {
|
||||
clip_right -= tmp_x - bd.outwidth;
|
||||
}
|
||||
|
||||
clip_bottom = bd->srcheight;
|
||||
tmp_y = bd->y + bd->srcheight;
|
||||
if (tmp_y > bd->outheight) {
|
||||
clip_bottom -= tmp_y - bd->outheight;
|
||||
clip_bottom = bd.srcheight;
|
||||
tmp_y = bd.y + bd.srcheight;
|
||||
if (tmp_y > bd.outheight) {
|
||||
clip_bottom -= tmp_y - bd.outheight;
|
||||
}
|
||||
|
||||
const byte *src = bd->dataptr;
|
||||
byte *dst = bd->out + bd->y * bd->outwidth + bd->x + clip_left;
|
||||
const byte *src = bd.dataptr;
|
||||
byte *dst = bd.out + bd.y * bd.outwidth + bd.x + clip_left;
|
||||
|
||||
mask_pitch = _screenWidth / 8;
|
||||
mask_offset = _screenStartStrip + (bd->y * mask_pitch) + ((bd->x + clip_left) >> 3);
|
||||
mask_offset = _screenStartStrip + (bd.y * mask_pitch) + ((bd.x + clip_left) >> 3);
|
||||
|
||||
charset_mask = getResourceAddress(rtBuffer, 9) + mask_offset;
|
||||
bits = 128 >> ((bd->x + clip_left) & 7);
|
||||
bits = 128 >> ((bd.x + clip_left) & 7);
|
||||
|
||||
if (mask == 1) {
|
||||
mask_out = _bompMaskPtr + mask_offset;
|
||||
mask_out = bd.maskPtr + mask_offset;
|
||||
}
|
||||
|
||||
if (mask == 3) {
|
||||
if (_bompScallingYPtr != NULL) {
|
||||
skip_y_new = *(_bompScallingYPtr++);
|
||||
if (scalingYPtr != NULL) {
|
||||
skip_y_new = *(scalingYPtr++);
|
||||
}
|
||||
|
||||
if ((clip_right + clip_left) > _bompScaleRight) {
|
||||
clip_right = _bompScaleRight - clip_left;
|
||||
if ((clip_right + clip_left) > bd.scaleRight) {
|
||||
clip_right = bd.scaleRight - clip_left;
|
||||
}
|
||||
|
||||
if (clip_bottom > _bompScaleBottom) {
|
||||
clip_bottom = _bompScaleBottom;
|
||||
if (clip_bottom > bd.scaleBottom) {
|
||||
clip_bottom = bd.scaleBottom;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3499,33 +3498,33 @@ void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
while(1) {
|
||||
switch(decode_mode) {
|
||||
case 0:
|
||||
src += bompDecodeLineMode0(src, line_buffer, bd->srcwidth);
|
||||
src += bompDecodeLineMode0(src, line_buffer, bd.srcwidth);
|
||||
break;
|
||||
case 1:
|
||||
src += bompDecodeLineMode1(src, line_buffer, bd->srcwidth);
|
||||
src += bompDecodeLineMode1(src, line_buffer, bd.srcwidth);
|
||||
break;
|
||||
case 3:
|
||||
src += bompDecodeLineMode3(src, line_buffer, bd->srcwidth);
|
||||
src += bompDecodeLineMode3(src, line_buffer, bd.srcwidth);
|
||||
break;
|
||||
default:
|
||||
error("Unknown bomp decode_mode %d", decode_mode);
|
||||
}
|
||||
|
||||
if (mask == 3) {
|
||||
if (bd->scale_y != 255) {
|
||||
if (bd.scale_y != 255) {
|
||||
tmp = skip_y_new & skip_y;
|
||||
skip_y >>= 1;
|
||||
if (skip_y == 0) {
|
||||
skip_y = 128;
|
||||
skip_y_new = *(_bompScallingYPtr++);
|
||||
skip_y_new = *(scalingYPtr++);
|
||||
}
|
||||
|
||||
if (tmp != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bd->scale_x != 255) {
|
||||
bompScaleFuncX(line_buffer, _bompScallingXPtr, 128, bd->srcwidth);
|
||||
if (bd.scale_x != 255) {
|
||||
bompScaleFuncX(line_buffer, bd.scalingXPtr, 128, bd.srcwidth);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3540,7 +3539,7 @@ void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
bompApplyMask(line_ptr, charset_mask, bits, clip_right);
|
||||
bompApplyActorPalette(line_ptr, clip_right);
|
||||
|
||||
switch(bd->shadowMode) {
|
||||
switch(bd.shadowMode) {
|
||||
case 0:
|
||||
bompApplyShadow0(line_ptr, dst, clip_right);
|
||||
break;
|
||||
@ -3551,14 +3550,14 @@ void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
bompApplyShadow3(line_ptr, dst, clip_right);
|
||||
break;
|
||||
default:
|
||||
error("Unknown bomp shadowMode %d", bd->shadowMode);
|
||||
error("Unknown bomp shadowMode %d", bd.shadowMode);
|
||||
}
|
||||
}
|
||||
|
||||
mask_out += mask_pitch;
|
||||
charset_mask += mask_pitch;
|
||||
pos_y++;
|
||||
dst += bd->outwidth;
|
||||
dst += bd.outwidth;
|
||||
if (pos_y >= clip_bottom)
|
||||
break;
|
||||
}
|
||||
|
33
scumm/gfx.h
33
scumm/gfx.h
@ -55,12 +55,6 @@ struct VirtScreen { /* Virtual screen areas */
|
||||
byte *backBuf;
|
||||
};
|
||||
|
||||
struct MouseCursor { /* Mouse cursor */
|
||||
int8 hotspot_x, hotspot_y;
|
||||
byte colors[4];
|
||||
byte data[32];
|
||||
};
|
||||
|
||||
struct ColorCycle { /* Palette cycles */
|
||||
uint16 delay;
|
||||
uint16 counter;
|
||||
@ -78,27 +72,6 @@ struct BlastObject { /* BlastObjects to draw */
|
||||
uint16 mode;
|
||||
};
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma START_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
struct BompHeader { /* Bomp header */
|
||||
union {
|
||||
struct {
|
||||
uint16 unk;
|
||||
uint16 width, height;
|
||||
} GCC_PACK old;
|
||||
|
||||
struct {
|
||||
uint32 width, height;
|
||||
} GCC_PACK v8;
|
||||
} GCC_PACK;
|
||||
} GCC_PACK;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma END_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
struct BompDrawData { /* Bomp graphics data */
|
||||
byte *out;
|
||||
int outwidth, outheight;
|
||||
@ -107,6 +80,12 @@ struct BompDrawData { /* Bomp graphics data */
|
||||
const byte *dataptr;
|
||||
int srcwidth, srcheight;
|
||||
uint16 shadowMode;
|
||||
|
||||
int32 scaleRight, scaleBottom;
|
||||
byte *scalingXPtr, *scalingYPtr;
|
||||
byte *maskPtr;
|
||||
|
||||
BompDrawData() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
class Gdi {
|
||||
|
@ -27,6 +27,28 @@
|
||||
#include "resource.h"
|
||||
#include "usage_bits.h"
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma START_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
struct BompHeader { /* Bomp header */
|
||||
union {
|
||||
struct {
|
||||
uint16 unk;
|
||||
uint16 width, height;
|
||||
} GCC_PACK old;
|
||||
|
||||
struct {
|
||||
uint32 width, height;
|
||||
} GCC_PACK v8;
|
||||
} GCC_PACK;
|
||||
} GCC_PACK;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma END_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
|
||||
bool Scumm::getClass(int obj, int cls)
|
||||
{
|
||||
checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass");
|
||||
@ -1518,25 +1540,20 @@ void Scumm::drawBlastObject(BlastObject *eo) {
|
||||
bdd.scale_x = (byte)eo->scaleX;
|
||||
bdd.scale_y = (byte)eo->scaleY;
|
||||
|
||||
byte bomp_scalling_x[64], bomp_scalling_y[64];
|
||||
|
||||
if ((bdd.scale_x != 255) || (bdd.scale_y != 255)) {
|
||||
_bompScallingXPtr = bomp_scalling_x;
|
||||
_bompScallingYPtr = bomp_scalling_y;
|
||||
_bompScaleRight = setupBompScale(_bompScallingXPtr, bdd.srcwidth, bdd.scale_x);
|
||||
_bompScaleBottom = setupBompScale(_bompScallingYPtr, bdd.srcheight, bdd.scale_y);
|
||||
byte bomp_scaling_x[64], bomp_scaling_y[64];
|
||||
bdd.scalingXPtr = bomp_scaling_x;
|
||||
bdd.scalingYPtr = bomp_scaling_y;
|
||||
bdd.scaleRight = setupBompScale(bomp_scaling_x, bdd.srcwidth, bdd.scale_x);
|
||||
bdd.scaleBottom = setupBompScale(bomp_scaling_y, bdd.srcheight, bdd.scale_y);
|
||||
bdd.shadowMode = 0;
|
||||
drawBomp(&bdd, 1, 3);
|
||||
} else {
|
||||
drawBomp(bdd, 1, 3);
|
||||
} else {
|
||||
bdd.shadowMode = eo->mode;
|
||||
drawBomp(&bdd, 1, 0);
|
||||
drawBomp(bdd, 1, 0);
|
||||
}
|
||||
|
||||
_bompScallingXPtr = NULL;
|
||||
_bompScallingYPtr = NULL;
|
||||
_bompScaleRight = 0;
|
||||
_bompScaleBottom = 0;
|
||||
|
||||
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
|
||||
}
|
||||
|
||||
@ -1627,12 +1644,12 @@ static byte _bompBitsTable[] = {
|
||||
4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
|
||||
};
|
||||
|
||||
int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) {
|
||||
int32 Scumm::setupBompScale(byte * scaling, int32 size, byte scale) {
|
||||
uint32 tmp = (256 - (size >> 1));
|
||||
int32 count = (size + 7) >> 3;
|
||||
assert(tmp < sizeof(_bompScaleTable));
|
||||
byte * tmp_ptr = _bompScaleTable + tmp;
|
||||
byte * tmp_scalling = scalling;
|
||||
byte * tmp_scaling = scaling;
|
||||
byte a = 0;
|
||||
|
||||
while((count--) != 0) {
|
||||
@ -1680,16 +1697,16 @@ int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) {
|
||||
}
|
||||
tmp_ptr += 4;
|
||||
|
||||
*(tmp_scalling++) = a;
|
||||
*(tmp_scaling++) = a;
|
||||
}
|
||||
if ((size & 7) != 0) {
|
||||
*(tmp_scalling - 1) |= revBitMask[size & 7];
|
||||
*(tmp_scaling - 1) |= revBitMask[size & 7];
|
||||
}
|
||||
|
||||
count = (size + 7) >> 3;
|
||||
byte ret_value = 0;
|
||||
while(count--) {
|
||||
tmp = *scalling++;
|
||||
tmp = *scaling++;
|
||||
assert(tmp < sizeof(_bompBitsTable));
|
||||
ret_value += _bompBitsTable[tmp];
|
||||
}
|
||||
|
@ -897,18 +897,14 @@ protected:
|
||||
void blit(byte *dst, const byte *src, int w, int h);
|
||||
|
||||
// bomp
|
||||
protected:
|
||||
int32 _bompScaleRight, _bompScaleBottom;
|
||||
public:
|
||||
byte *_bompScallingXPtr, *_bompScallingYPtr;
|
||||
byte *_bompMaskPtr;
|
||||
byte *_bompActorPalettePtr;
|
||||
|
||||
void drawBomp(BompDrawData *bd, int decode_mode, int mask);
|
||||
void drawBomp(const BompDrawData &bd, int decode_mode, int mask);
|
||||
protected:
|
||||
void decompressBomp(byte *dst, const byte *src, int w, int h);
|
||||
int32 setupBompScale(byte *scalling, int32 size, byte scale);
|
||||
void bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, int32 size);
|
||||
int32 setupBompScale(byte *scaling, int32 size, byte scale);
|
||||
void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size);
|
||||
int32 bompDecodeLineMode0(const byte *src, byte *line_buffer, int32 size);
|
||||
int32 bompDecodeLineMode1(const byte *src, byte *line_buffer, int32 size);
|
||||
int32 bompDecodeLineMode3(const byte *src, byte *line_buffer, int32 size);
|
||||
|
@ -334,11 +334,6 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
|
||||
_switchRoomEffect = 0;
|
||||
_doEffect = false;
|
||||
memset(&_flashlight,0,sizeof(_flashlight));
|
||||
_bompScaleRight = 0;
|
||||
_bompScaleBottom = 0;
|
||||
_bompScallingXPtr = NULL;
|
||||
_bompScallingYPtr = NULL;
|
||||
_bompMaskPtr = NULL;
|
||||
_bompActorPalettePtr = NULL;
|
||||
_shakeEnabled= false;
|
||||
_shakeFrame = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user