mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 12:12:16 +00:00
const as const can!
svn-id: r8058
This commit is contained in:
parent
01ac371c6a
commit
1f70da0155
@ -1004,7 +1004,7 @@ void Actor::animateLimb(int limb, int f) {
|
||||
if (costume == 0)
|
||||
return;
|
||||
|
||||
byte *aksq, *akfo;
|
||||
const byte *aksq, *akfo;
|
||||
uint size;
|
||||
byte *akos = _vm->getResourceAddress(rtCostume, costume);
|
||||
assert(akos);
|
||||
@ -1016,7 +1016,7 @@ void Actor::animateLimb(int limb, int f) {
|
||||
|
||||
while (f--) {
|
||||
if (cost.active[limb] != 0)
|
||||
_vm->akos_increaseAnim(this, limb, aksq, (uint16 *)akfo, size);
|
||||
_vm->akos_increaseAnim(this, limb, aksq, (const uint16 *)akfo, size);
|
||||
}
|
||||
|
||||
// needRedraw = true;
|
||||
@ -1422,7 +1422,7 @@ byte *Actor::getActorName() {
|
||||
}
|
||||
|
||||
void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold) {
|
||||
byte *akos, *rgbs, *akpl;
|
||||
const byte *akos, *rgbs, *akpl;
|
||||
int akpl_size, i;
|
||||
int r, g, b;
|
||||
byte akpl_color;
|
||||
|
@ -101,12 +101,12 @@ enum AkosOpcodes {
|
||||
|
||||
bool Scumm::akos_hasManyDirections(Actor *a) {
|
||||
byte *akos;
|
||||
AkosHeader *akhd;
|
||||
const AkosHeader *akhd;
|
||||
|
||||
akos = getResourceAddress(rtCostume, a->costume);
|
||||
assert(akos);
|
||||
|
||||
akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
|
||||
akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos);
|
||||
return (akhd->flags & 2) != 0;
|
||||
}
|
||||
|
||||
@ -119,8 +119,8 @@ int Scumm::akos_frameToAnim(Actor *a, int frame) {
|
||||
|
||||
void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
|
||||
uint anim;
|
||||
byte *akos, *r;
|
||||
AkosHeader *akhd;
|
||||
const byte *akos, *r;
|
||||
const AkosHeader *akhd;
|
||||
uint offs;
|
||||
int i;
|
||||
byte code;
|
||||
@ -135,7 +135,7 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
|
||||
akos = getResourceAddress(rtCostume, a->costume);
|
||||
assert(akos);
|
||||
|
||||
akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
|
||||
akhd = (const AkosHeader *)findResourceData(MKID('AKHD'), akos);
|
||||
|
||||
if (anim >= READ_LE_UINT16(&akhd->num_anims))
|
||||
return;
|
||||
@ -193,7 +193,7 @@ void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) {
|
||||
}
|
||||
|
||||
void AkosRenderer::setPalette(byte *new_palette) {
|
||||
byte *the_akpl;
|
||||
const byte *the_akpl;
|
||||
uint size, i;
|
||||
|
||||
the_akpl = _vm->findResourceData(MKID('AKPL'), akos);
|
||||
@ -220,8 +220,8 @@ void AkosRenderer::setCostume(int costume) {
|
||||
akos = _vm->getResourceAddress(rtCostume, costume);
|
||||
assert(akos);
|
||||
|
||||
akhd = (AkosHeader *) _vm->findResourceData(MKID('AKHD'), akos);
|
||||
akof = (AkosOffset *) _vm->findResourceData(MKID('AKOF'), akos);
|
||||
akhd = (const AkosHeader *) _vm->findResourceData(MKID('AKHD'), akos);
|
||||
akof = (const AkosOffset *) _vm->findResourceData(MKID('AKOF'), akos);
|
||||
akci = _vm->findResourceData(MKID('AKCI'), akos);
|
||||
aksq = _vm->findResourceData(MKID('AKSQ'), akos);
|
||||
akcd = _vm->findResourceData(MKID('AKCD'), akos);
|
||||
@ -237,9 +237,9 @@ void AkosRenderer::setFacing(Actor *a) {
|
||||
|
||||
byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
|
||||
uint code;
|
||||
byte *p;
|
||||
AkosOffset *off;
|
||||
AkosCI *the_akci;
|
||||
const byte *p;
|
||||
const AkosOffset *off;
|
||||
const AkosCI *the_akci;
|
||||
uint i, extra;
|
||||
|
||||
if (!cost.active[limb] || cost.stopped & (1 << limb))
|
||||
@ -257,11 +257,11 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
|
||||
if (code != AKC_ComplexChan) {
|
||||
off = akof + (code & 0xFFF);
|
||||
|
||||
assert((code & 0xFFF) * 6 < READ_BE_UINT32_UNALIGNED((byte *)akof - 4) - 8);
|
||||
assert((code & 0xFFF) * 6 < READ_BE_UINT32_UNALIGNED((const byte *)akof - 4) - 8);
|
||||
assert((code & 0x7000) == 0);
|
||||
|
||||
srcptr = akcd + READ_LE_UINT32(&off->akcd);
|
||||
the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
the_akci = (const AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
|
||||
_xmoveCur = _xmove + (int16)READ_LE_UINT16(&the_akci->rel_x);
|
||||
_ymoveCur = _ymove + (int16)READ_LE_UINT16(&the_akci->rel_y);
|
||||
@ -294,7 +294,7 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
|
||||
off = akof + code;
|
||||
|
||||
srcptr = akcd + READ_LE_UINT32(&off->akcd);
|
||||
the_akci = (AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
the_akci = (const AkosCI *) (akci + READ_LE_UINT16(&off->akci));
|
||||
|
||||
_xmoveCur = _xmove + (int16)READ_LE_UINT16(p + 0);
|
||||
_ymoveCur = _ymove + (int16)READ_LE_UINT16(p + 2);
|
||||
@ -324,7 +324,8 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
|
||||
}
|
||||
|
||||
void AkosRenderer::codec1_genericDecode() {
|
||||
byte *src, *dst;
|
||||
const byte *src;
|
||||
byte *dst;
|
||||
byte len, maskbit;
|
||||
uint y, color, height;
|
||||
const byte *scaleytab, *mask;
|
||||
@ -386,7 +387,8 @@ void AkosRenderer::codec1_genericDecode() {
|
||||
}
|
||||
|
||||
void AkosRenderer::codec1_spec1() {
|
||||
byte *src, *dst;
|
||||
const byte *src;
|
||||
byte *dst;
|
||||
byte len, maskbit;
|
||||
uint y, color, height;
|
||||
byte pcolor;
|
||||
@ -456,7 +458,8 @@ void AkosRenderer::codec1_spec2() {
|
||||
}
|
||||
|
||||
void AkosRenderer::codec1_spec3() {
|
||||
byte *src, *dst;
|
||||
const byte *src;
|
||||
byte *dst;
|
||||
byte len, maskbit;
|
||||
uint y, color, height;
|
||||
uint pcolor;
|
||||
@ -876,7 +879,7 @@ void AkosRenderer::codec1_ignorePakCols(int num) {
|
||||
int n;
|
||||
byte repcolor;
|
||||
byte replen;
|
||||
byte *src;
|
||||
const byte *src;
|
||||
|
||||
n = _height;
|
||||
if (num > 1)
|
||||
@ -980,7 +983,7 @@ void AkosRenderer::codec5() {
|
||||
_vm->_bompActorPalletePtr = NULL;
|
||||
}
|
||||
|
||||
void AkosRenderer::akos16SetupBitReader(byte *src) {
|
||||
void AkosRenderer::akos16SetupBitReader(const byte *src) {
|
||||
akos16.unk5 = 0;
|
||||
akos16.numbits = 16;
|
||||
akos16.mask = (1 << *src) - 1;
|
||||
@ -990,7 +993,7 @@ void AkosRenderer::akos16SetupBitReader(byte *src) {
|
||||
akos16.dataptr = src + 4;
|
||||
}
|
||||
|
||||
void AkosRenderer::akos16PutOnScreen(byte *dest, byte *src, byte transparency, int32 count) {
|
||||
void AkosRenderer::akos16PutOnScreen(byte *dest, const byte *src, byte transparency, int32 count) {
|
||||
byte tmp_data;
|
||||
|
||||
if (count == 0)
|
||||
@ -1152,7 +1155,7 @@ void AkosRenderer::akos16ApplyMask(byte *dest, byte *maskptr, byte bits, int32 c
|
||||
}
|
||||
}
|
||||
|
||||
void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency) {
|
||||
void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency) {
|
||||
byte *tmp_buf = akos16.buffer;
|
||||
|
||||
if (dir < 0) {
|
||||
@ -1179,7 +1182,7 @@ void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, byte *src, int32 t_
|
||||
}
|
||||
}
|
||||
|
||||
void AkosRenderer::akos16DecompressMask(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte * maskptr, int32 bitpos_start) {
|
||||
void AkosRenderer::akos16DecompressMask(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte * maskptr, int32 bitpos_start) {
|
||||
byte *tmp_buf = akos16.buffer;
|
||||
int maskpitch;
|
||||
|
||||
@ -1334,8 +1337,8 @@ void AkosRenderer::codec16() {
|
||||
akos16DecompressMask(dest, pitch, srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8);
|
||||
}
|
||||
|
||||
bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
|
||||
byte *aksq, *akfo;
|
||||
bool Scumm::akos_increaseAnims(const byte *akos, Actor *a) {
|
||||
const byte *aksq, *akfo;
|
||||
int i;
|
||||
uint size;
|
||||
bool result;
|
||||
@ -1348,7 +1351,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
|
||||
result = false;
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (a->cost.active[i] != 0)
|
||||
result |= akos_increaseAnim(a, i, aksq, (uint16 *)akfo, size);
|
||||
result |= akos_increaseAnim(a, i, aksq, (const uint16 *)akfo, size);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -1357,7 +1360,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor *a) {
|
||||
#define GUW(o) READ_LE_UINT16(aksq+curpos+(o))
|
||||
#define GB(o) aksq[curpos+(o)]
|
||||
|
||||
bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int numakfo) {
|
||||
bool Scumm::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const uint16 *akfo, int numakfo) {
|
||||
byte active;
|
||||
uint old_curpos, curpos, end;
|
||||
uint code;
|
||||
|
22
scumm/akos.h
22
scumm/akos.h
@ -36,7 +36,7 @@ public:
|
||||
|
||||
protected:
|
||||
uint16 codec;
|
||||
byte *srcptr;
|
||||
const byte *srcptr;
|
||||
|
||||
// movement of cel to decode
|
||||
int _xmoveCur, _ymoveCur;
|
||||
@ -45,12 +45,12 @@ protected:
|
||||
byte palette[256];
|
||||
|
||||
// pointer to various parts of the costume resource
|
||||
byte *akos;
|
||||
AkosHeader *akhd;
|
||||
const byte *akos;
|
||||
const AkosHeader *akhd;
|
||||
|
||||
byte *akpl, *akci, *aksq;
|
||||
AkosOffset *akof;
|
||||
byte *akcd;
|
||||
const byte *akpl, *akci, *aksq;
|
||||
const AkosOffset *akof;
|
||||
const byte *akcd;
|
||||
|
||||
struct {
|
||||
/* codec stuff */
|
||||
@ -77,7 +77,7 @@ protected:
|
||||
byte shift;
|
||||
uint16 bits;
|
||||
byte numbits;
|
||||
byte *dataptr;
|
||||
const byte *dataptr;
|
||||
byte buffer[336];
|
||||
} akos16;
|
||||
|
||||
@ -111,13 +111,13 @@ protected:
|
||||
void codec5();
|
||||
|
||||
void codec16();
|
||||
void akos16SetupBitReader(byte *src);
|
||||
void akos16PutOnScreen(byte *dest, byte *src, byte transparency, int32 count);
|
||||
void akos16SetupBitReader(const byte *src);
|
||||
void akos16PutOnScreen(byte *dest, const byte *src, byte transparency, int32 count);
|
||||
void akos16SkipData(int32 numskip);
|
||||
void akos16DecodeLine(byte *buf, int32 numbytes, int32 dir);
|
||||
void akos16ApplyMask(byte *dest, byte *maskptr, byte bits, int32 count, byte fillwith);
|
||||
void akos16Decompress(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency);
|
||||
void akos16DecompressMask(byte *dest, int32 pitch, byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte *maskptr, int32 bitpos_start);
|
||||
void akos16Decompress(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency);
|
||||
void akos16DecompressMask(byte *dest, int32 pitch, const byte *src, int32 t_width, int32 t_height, int32 dir, int32 numskip_before, int32 numskip_after, byte transparency, byte *maskptr, int32 bitpos_start);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -586,7 +586,7 @@ void Scumm::drawBox(int x, int y, int x2, int y2, int color) {
|
||||
#pragma mark -
|
||||
|
||||
void Scumm::initBGBuffers(int height) {
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
int size, itemsize, i;
|
||||
byte *room;
|
||||
|
||||
@ -923,15 +923,17 @@ bool Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) {
|
||||
#pragma mark --- Image drawing ---
|
||||
#pragma mark -
|
||||
|
||||
void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
|
||||
void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
|
||||
int stripnr, int numstrip, byte flag) {
|
||||
assert(ptr);
|
||||
assert(height > 0);
|
||||
byte *backbuff_ptr, *bgbak_ptr, *smap_ptr;
|
||||
byte *backbuff_ptr, *bgbak_ptr;
|
||||
const byte *smap_ptr;
|
||||
const byte *z_plane_ptr;
|
||||
byte *mask_ptr;
|
||||
|
||||
int i;
|
||||
byte *zplane_list[9];
|
||||
const byte *zplane_list[9];
|
||||
|
||||
int bottom;
|
||||
int numzbuf;
|
||||
@ -976,7 +978,7 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, c
|
||||
}
|
||||
} else if (_vm->_features & GF_AFTER_V8) {
|
||||
// Find the OFFS chunk of the ZPLN chunk
|
||||
byte *zplnOffsChunkStart = smap_ptr + READ_BE_UINT32(smap_ptr + 12) + 24;
|
||||
const byte *zplnOffsChunkStart = smap_ptr + READ_BE_UINT32(smap_ptr + 12) + 24;
|
||||
|
||||
// Each ZPLN contains a WRAP chunk, which has (as always) an OFFS subchunk pointing
|
||||
// at ZSTR chunks. These once more contain a WRAP chunk which contains nothing but
|
||||
@ -1039,7 +1041,7 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, c
|
||||
const int left = (stripnr << 3);
|
||||
const int right = left + (numstrip << 3);
|
||||
byte *dst = bgbak_ptr;
|
||||
byte *src = smap_ptr;
|
||||
const byte *src = smap_ptr;
|
||||
byte color = 0, data = 0;
|
||||
int run = 1;
|
||||
bool dither = false;
|
||||
@ -1202,7 +1204,6 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, c
|
||||
// don't know what for. At the time of writing, these games
|
||||
// are still too unstable for me to investigate.
|
||||
|
||||
byte *z_plane_ptr;
|
||||
if (_vm->_features & GF_AFTER_V8)
|
||||
z_plane_ptr = zplane_list[1] + READ_LE_UINT32(zplane_list[1] + stripnr * 4 + 8);
|
||||
else
|
||||
@ -1235,7 +1236,7 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, c
|
||||
mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + y * _numStrips + x + _imgBufOffs[i];
|
||||
|
||||
if (offs) {
|
||||
byte *z_plane_ptr = zplane_list[i] + offs;
|
||||
z_plane_ptr = zplane_list[i] + offs;
|
||||
|
||||
if (useOrDecompress && (flag & dbAllowMaskOr)) {
|
||||
decompressMaskImgOr(mask_ptr, z_plane_ptr, height);
|
||||
@ -1339,10 +1340,10 @@ void Gdi::decodeStripEGA(byte *dst, const byte *src, int height) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProcess) {
|
||||
bool Gdi::decompressBitmap(byte *bgbak_ptr, const byte *src, int numLinesToProcess) {
|
||||
assert(numLinesToProcess);
|
||||
|
||||
byte code = *smap_ptr++;
|
||||
byte code = *src++;
|
||||
|
||||
if (_vm->_features & GF_AMIGA)
|
||||
_palette_mod = 16;
|
||||
@ -1355,23 +1356,23 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
|
||||
switch (code) {
|
||||
case 1:
|
||||
unkDecode7(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecode7(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
unkDecode8(bgbak_ptr, smap_ptr, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
unkDecode8(bgbak_ptr, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
break;
|
||||
|
||||
case 3:
|
||||
unkDecode9(bgbak_ptr, smap_ptr, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
unkDecode9(bgbak_ptr, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
break;
|
||||
|
||||
case 4:
|
||||
unkDecode10(bgbak_ptr, smap_ptr, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
unkDecode10(bgbak_ptr, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
break;
|
||||
|
||||
case 7:
|
||||
unkDecode11(bgbak_ptr, smap_ptr, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
unkDecode11(bgbak_ptr, src, numLinesToProcess); /* Ender - Zak256/Indy256 */
|
||||
break;
|
||||
|
||||
case 14:
|
||||
@ -1379,7 +1380,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
unkDecodeC(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeC(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
@ -1387,7 +1388,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
unkDecodeB(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeB(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 34:
|
||||
@ -1396,7 +1397,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 37:
|
||||
case 38:
|
||||
useOrDecompress = true;
|
||||
unkDecodeC_trans(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeC_trans(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 44:
|
||||
@ -1405,7 +1406,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 47:
|
||||
case 48:
|
||||
useOrDecompress = true;
|
||||
unkDecodeB_trans(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeB_trans(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 64:
|
||||
@ -1418,7 +1419,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 106:
|
||||
case 107:
|
||||
case 108:
|
||||
unkDecodeA(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeA(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
case 84:
|
||||
@ -1432,7 +1433,7 @@ bool Gdi::decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProces
|
||||
case 127:
|
||||
case 128:
|
||||
useOrDecompress = true;
|
||||
unkDecodeA_trans(bgbak_ptr, smap_ptr, numLinesToProcess);
|
||||
unkDecodeA_trans(bgbak_ptr, src, numLinesToProcess);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2791,7 +2792,7 @@ void Scumm::setDirtyColors(int min, int max) {
|
||||
_palDirtyMax = max;
|
||||
}
|
||||
|
||||
void Scumm::initCycl(byte *ptr) {
|
||||
void Scumm::initCycl(const byte *ptr) {
|
||||
int j;
|
||||
ColorCycle *cycl;
|
||||
|
||||
@ -3011,9 +3012,9 @@ void Scumm::setupShadowPalette(int slot, int redScale, int greenScale, int blueS
|
||||
}
|
||||
|
||||
void Scumm::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
|
||||
byte *basepal = getPalettePtr();
|
||||
byte *pal = basepal;
|
||||
byte *compareptr;
|
||||
const byte *basepal = getPalettePtr();
|
||||
const byte *pal = basepal;
|
||||
const byte *compareptr;
|
||||
byte *table = _shadowPalette;
|
||||
int i;
|
||||
|
||||
@ -3086,9 +3087,8 @@ void Scumm::setupShadowPalette(int redScale, int greenScale, int blueScale, int
|
||||
/* Yazoo: This function create the specialPalette used for semi-transparency in SamnMax */
|
||||
void Scumm::createSpecialPalette(int16 from, int16 to, int16 redScale, int16 greenScale, int16 blueScale,
|
||||
int16 startColor, int16 endColor) {
|
||||
byte *palPtr;
|
||||
byte *curPtr;
|
||||
byte *searchPtr;
|
||||
const byte *palPtr, *curPtr;
|
||||
const byte *searchPtr;
|
||||
|
||||
uint bestResult;
|
||||
uint currentResult;
|
||||
@ -3141,7 +3141,8 @@ void Scumm::darkenPalette(int redScale, int greenScale, int blueScale, int start
|
||||
return;
|
||||
|
||||
if (startColor <= endColor) {
|
||||
byte *cptr, *cur;
|
||||
const byte *cptr;
|
||||
byte *cur;
|
||||
int j;
|
||||
int color;
|
||||
|
||||
@ -3199,7 +3200,8 @@ void Scumm::desaturatePalette(int hueScale, int satScale, int lightScale, int st
|
||||
// FIXME: Rewrite using integer arithmetics only?
|
||||
|
||||
if (startColor <= endColor) {
|
||||
byte *cptr, *cur;
|
||||
const byte *cptr;
|
||||
byte *cur;
|
||||
int j;
|
||||
|
||||
cptr = getPalettePtr() + startColor * 3;
|
||||
@ -3380,15 +3382,15 @@ void Scumm::setPalColor(int idx, int r, int g, int b) {
|
||||
}
|
||||
|
||||
void Scumm::setPalette(int palindex) {
|
||||
byte *pals;
|
||||
const byte *pals;
|
||||
|
||||
_curPalIndex = palindex;
|
||||
pals = getPalettePtr();
|
||||
setPaletteFromPtr(pals);
|
||||
}
|
||||
|
||||
byte *Scumm::findPalInPals(byte *pal, int idx) {
|
||||
byte *offs;
|
||||
const byte *Scumm::findPalInPals(const byte *pal, int idx) {
|
||||
const byte *offs;
|
||||
uint32 size;
|
||||
|
||||
pal = findResource(MKID('WRAP'), pal);
|
||||
@ -3407,8 +3409,8 @@ byte *Scumm::findPalInPals(byte *pal, int idx) {
|
||||
return offs + READ_LE_UINT32(offs + idx * sizeof(uint32));
|
||||
}
|
||||
|
||||
byte *Scumm::getPalettePtr() {
|
||||
byte *cptr;
|
||||
const byte *Scumm::getPalettePtr() {
|
||||
const byte *cptr;
|
||||
|
||||
cptr = getResourceAddress(rtRoom, _roomResource);
|
||||
assert(cptr);
|
||||
@ -3459,9 +3461,10 @@ void Scumm::grabCursor(byte *ptr, int width, int height) {
|
||||
updateCursor();
|
||||
}
|
||||
|
||||
void Scumm::useIm01Cursor(byte *im, int w, int h) {
|
||||
void Scumm::useIm01Cursor(const byte *im, int w, int h) {
|
||||
VirtScreen *vs = &virtscr[0];
|
||||
byte *buf, *src, *dst;
|
||||
byte *buf, *dst;
|
||||
const byte *src;
|
||||
int i;
|
||||
|
||||
w <<= 3;
|
||||
@ -3529,7 +3532,7 @@ void Scumm::animateCursor() {
|
||||
}
|
||||
}
|
||||
|
||||
void Scumm::useBompCursor(byte *im, int width, int height) {
|
||||
void Scumm::useBompCursor(const byte *im, int width, int height) {
|
||||
uint size;
|
||||
|
||||
width <<= 3;
|
||||
@ -3830,7 +3833,7 @@ void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
|
||||
clip_bottom -= tmp_y - bd->outheight;
|
||||
}
|
||||
|
||||
byte *src = bd->dataptr;
|
||||
const byte *src = bd->dataptr;
|
||||
byte *dst = bd->out + bd->y * bd->outwidth + bd->x + clip_left;
|
||||
|
||||
mask_pitch = _screenWidth / 8;
|
||||
|
@ -104,7 +104,7 @@ struct BompDrawData { /* Bomp graphics data */
|
||||
int outwidth, outheight;
|
||||
int x, y;
|
||||
byte scale_x, scale_y;
|
||||
byte *dataptr;
|
||||
const byte *dataptr;
|
||||
int srcwidth, srcheight;
|
||||
uint16 shadowMode;
|
||||
};
|
||||
@ -133,7 +133,7 @@ protected:
|
||||
bool _zbufferDisabled;
|
||||
|
||||
/* Bitmap decompressors */
|
||||
bool decompressBitmap(byte *bgbak_ptr, byte *smap_ptr, int numLinesToProcess);
|
||||
bool decompressBitmap(byte *bgbak_ptr, const byte *src, int numLinesToProcess);
|
||||
void decodeStripEGA(byte *dst, const byte *src, int height);
|
||||
void decodeStripOldEGA(byte *dst, const byte *src, int height, int stripnr);
|
||||
void decompressMaskImgOld(byte *dst, const byte *src, int stripnr);
|
||||
@ -161,7 +161,7 @@ protected:
|
||||
void updateDirtyScreen(VirtScreen *vs);
|
||||
|
||||
public:
|
||||
void drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
|
||||
void drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
|
||||
int stripnr, int numstrip, byte flag);
|
||||
void clearUpperMask();
|
||||
|
||||
|
132
scumm/object.cpp
132
scumm/object.cpp
@ -190,8 +190,8 @@ int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
|
||||
void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) {
|
||||
ObjectData *od = &_objs[getObjectIndex(object)];
|
||||
int state;
|
||||
byte *ptr;
|
||||
ImageHeader *imhd;
|
||||
const byte *ptr;
|
||||
const ImageHeader *imhd;
|
||||
|
||||
if (_features & GF_AFTER_V6) {
|
||||
state = getState(object) - 1;
|
||||
@ -206,7 +206,7 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) {
|
||||
ptr += od->OBIMoffset;
|
||||
}
|
||||
assert(ptr);
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), ptr);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr);
|
||||
if (_features & GF_AFTER_V8) {
|
||||
x = od->x_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].x);
|
||||
y = od->y_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].y);
|
||||
@ -343,7 +343,7 @@ static const uint32 IMxx_tags[] = {
|
||||
void Scumm::drawObject(int obj, int arg) {
|
||||
ObjectData *od;
|
||||
int xpos, ypos, height, width;
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
int x, a, numstrip;
|
||||
int tmp;
|
||||
|
||||
@ -451,16 +451,16 @@ void Scumm::clearRoomObjects() {
|
||||
void Scumm::loadRoomObjects() {
|
||||
int i, j;
|
||||
ObjectData *od;
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
uint16 obim_id;
|
||||
byte *room, *searchptr, *rootptr;
|
||||
ImageHeader *imhd;
|
||||
RoomHeader *roomhdr;
|
||||
CodeHeader *cdhd;
|
||||
const byte *room, *searchptr, *rootptr;
|
||||
const ImageHeader *imhd;
|
||||
const RoomHeader *roomhdr;
|
||||
const CodeHeader *cdhd;
|
||||
|
||||
CHECK_HEAP
|
||||
room = getResourceAddress(rtRoom, _roomResource);
|
||||
roomhdr = (RoomHeader *)findResourceData(MKID('RMHD'), room);
|
||||
roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), room);
|
||||
|
||||
if (_features & GF_AFTER_V8)
|
||||
_numObjectsInRoom = (byte)READ_LE_UINT32(&(roomhdr->v8.numObjects));
|
||||
@ -490,7 +490,7 @@ void Scumm::loadRoomObjects() {
|
||||
error("Room %d missing object code block(s)", _roomResource);
|
||||
|
||||
od->OBCDoffset = ptr - rootptr;
|
||||
cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), ptr);
|
||||
cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), ptr);
|
||||
|
||||
if (_features & GF_AFTER_V7)
|
||||
od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id));
|
||||
@ -515,7 +515,7 @@ void Scumm::loadRoomObjects() {
|
||||
if (ptr == NULL)
|
||||
error("Room %d missing image blocks(s)", _roomResource);
|
||||
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), ptr);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr);
|
||||
if (_features & GF_AFTER_V8)
|
||||
// In V8, IMHD has no obj_id, but rather a name string. We map the name
|
||||
// back to an object id using a table derived from the DOBJ resource.
|
||||
@ -543,7 +543,7 @@ void Scumm::loadRoomObjects() {
|
||||
void Scumm::loadRoomObjectsOldBundle() {
|
||||
int i;
|
||||
ObjectData *od;
|
||||
byte *room, *ptr;
|
||||
const byte *room, *ptr;
|
||||
|
||||
CHECK_HEAP
|
||||
room = getResourceAddress(rtRoom, _roomResource);
|
||||
@ -583,14 +583,14 @@ void Scumm::loadRoomObjectsOldBundle() {
|
||||
void Scumm::loadRoomObjectsSmall() {
|
||||
int i, j;
|
||||
ObjectData *od;
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
uint16 obim_id;
|
||||
byte *room, *searchptr;
|
||||
RoomHeader *roomhdr;
|
||||
const byte *room, *searchptr;
|
||||
const RoomHeader *roomhdr;
|
||||
|
||||
CHECK_HEAP
|
||||
room = getResourceAddress(rtRoom, _roomResource);
|
||||
roomhdr = (RoomHeader *)findResourceData(MKID('RMHD'), room);
|
||||
roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), room);
|
||||
|
||||
_numObjectsInRoom = READ_LE_UINT16(&(roomhdr->old.numObjects));
|
||||
|
||||
@ -643,15 +643,15 @@ void Scumm::loadRoomObjectsSmall() {
|
||||
CHECK_HEAP
|
||||
}
|
||||
|
||||
void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
|
||||
CodeHeader *cdhd = NULL;
|
||||
ImageHeader *imhd = NULL;
|
||||
void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
|
||||
const CodeHeader *cdhd = NULL;
|
||||
const ImageHeader *imhd = NULL;
|
||||
|
||||
assert(room);
|
||||
|
||||
if (_features & GF_SMALL_HEADER) {
|
||||
|
||||
byte *ptr = room + od->OBCDoffset;
|
||||
const byte *ptr = room + od->OBCDoffset;
|
||||
|
||||
if (_features & GF_OLD_BUNDLE)
|
||||
ptr -= 2;
|
||||
@ -691,7 +691,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
|
||||
searchptr = room;
|
||||
}
|
||||
|
||||
cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), searchptr + od->OBCDoffset);
|
||||
cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), searchptr + od->OBCDoffset);
|
||||
if (cdhd == NULL)
|
||||
error("Room %d missing CDHD blocks(s)", _roomResource);
|
||||
|
||||
@ -701,7 +701,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
|
||||
od->parent = cdhd->v7.parent;
|
||||
od->parentstate = cdhd->v7.parentstate;
|
||||
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), room + od->OBIMoffset);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), room + od->OBIMoffset);
|
||||
od->x_pos = (int)READ_LE_UINT32(&imhd->v8.x_pos);
|
||||
od->y_pos = (int)READ_LE_UINT32(&imhd->v8.y_pos);
|
||||
od->width = (uint)READ_LE_UINT32(&imhd->v8.width);
|
||||
@ -715,7 +715,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr) {
|
||||
od->parent = cdhd->v7.parent;
|
||||
od->parentstate = cdhd->v7.parentstate;
|
||||
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), room + od->OBIMoffset);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), room + od->OBIMoffset);
|
||||
od->x_pos = READ_LE_UINT16(&imhd->v7.x_pos);
|
||||
od->y_pos = READ_LE_UINT16(&imhd->v7.y_pos);
|
||||
od->width = READ_LE_UINT16(&imhd->v7.width);
|
||||
@ -874,7 +874,7 @@ byte *Scumm::getObjOrActorName(int obj) {
|
||||
}
|
||||
|
||||
if (_features & GF_AFTER_V6) {
|
||||
for (i = 1; i < 50; i++) {
|
||||
for (i = 0; i < _numNewNames; i++) {
|
||||
if (_newNames[i] == obj) {
|
||||
debug(5, "Found new name for object %d at _newNames[i]", obj, i);
|
||||
return getResourceAddress(rtObjectName, i);
|
||||
@ -887,7 +887,50 @@ byte *Scumm::getObjOrActorName(int obj) {
|
||||
if (objptr == NULL)
|
||||
return NULL;
|
||||
|
||||
#if 0
|
||||
return findResourceData(MKID('OBNA'), objptr);
|
||||
#else
|
||||
// FIXME: we can't use findResourceData anymore, because it returns const
|
||||
// data, while this function *must* return a non-const pointer. That is so
|
||||
// because in o2_setObjectName / o5_setObjectName we directly modify this
|
||||
// data. Now, we could add a non-const version of findResourceData, too
|
||||
// (C++ makes that easy); but this here is really the *only* place in all
|
||||
// of ScummVM where it wold be needed! That seems kind of a waste...
|
||||
//
|
||||
// So for now, I duplicate some code from findResourceData / findResource
|
||||
// here. However, a much nicer solution might be (with stress on "might")
|
||||
// to use the same technique as in V6 games: that is, use a seperate
|
||||
// resource for changed names. That would be the cleanest solution, but
|
||||
// might proof to be infeasible, as it might lead to unforseen regressions.
|
||||
|
||||
uint32 tag = MKID('OBNA');
|
||||
byte *searchin = objptr;
|
||||
uint32 curpos, totalsize, size;
|
||||
|
||||
assert(searchin);
|
||||
|
||||
searchin += 4;
|
||||
totalsize = READ_BE_UINT32_UNALIGNED(searchin);
|
||||
curpos = 8;
|
||||
searchin += 4;
|
||||
|
||||
while (curpos < totalsize) {
|
||||
if (READ_UINT32_UNALIGNED(searchin) == tag)
|
||||
return searchin + _resourceHeaderSize;
|
||||
|
||||
size = READ_BE_UINT32_UNALIGNED(searchin + 4);
|
||||
if ((int32)size <= 0) {
|
||||
error("(%c%c%c%c) Not found in %d... illegal block len %d",
|
||||
tag & 0xFF, (tag >> 8) & 0xFF, (tag >> 16) & 0xFF, (tag >> 24) & 0xFF, 0, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
curpos += size;
|
||||
searchin += size;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32 Scumm::getOBCDOffs(int object) {
|
||||
@ -931,7 +974,8 @@ byte *Scumm::getOBCDFromObject(int obj) {
|
||||
void Scumm::addObjectToInventory(uint obj, uint room) {
|
||||
int i, slot;
|
||||
uint32 size;
|
||||
byte *ptr, *dst;
|
||||
const byte *ptr;
|
||||
byte *dst;
|
||||
FindObjectInRoom foir;
|
||||
|
||||
debug(1, "Adding object %d from room %d into inventory", obj, room);
|
||||
@ -963,10 +1007,10 @@ void Scumm::addObjectToInventory(uint obj, uint room) {
|
||||
|
||||
void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint room) {
|
||||
|
||||
CodeHeader *cdhd;
|
||||
const CodeHeader *cdhd;
|
||||
int i, numobj;
|
||||
byte *roomptr, *obcdptr, *obimptr, *searchptr;
|
||||
ImageHeader *imhd;
|
||||
const byte *roomptr, *obcdptr, *obimptr, *searchptr;
|
||||
const ImageHeader *imhd;
|
||||
int id2;
|
||||
int id3;
|
||||
|
||||
@ -978,10 +1022,10 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
|
||||
error("findObjectInRoom foCheckAlreadyLoaded NYI for GF_OLD_BUNDLE (id = %d, room = %d)", id, room);
|
||||
}
|
||||
fo->obcd = obcdptr = getOBCDFromObject(id);
|
||||
assert((byte *)obcdptr > (byte *)256);
|
||||
assert((const byte *)obcdptr > (byte *)256);
|
||||
fo->obim = obimptr = obcdptr + RES_SIZE(obcdptr);
|
||||
fo->cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
|
||||
fo->imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
|
||||
fo->cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
|
||||
fo->imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -992,7 +1036,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
|
||||
if (_features & GF_OLD_BUNDLE) {
|
||||
numobj = roomptr[20];
|
||||
} else {
|
||||
RoomHeader *roomhdr = (RoomHeader *)findResourceData(MKID('RMHD'), roomptr);
|
||||
const RoomHeader *roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr);
|
||||
|
||||
if (_features & GF_AFTER_V8)
|
||||
numobj = READ_LE_UINT32(&(roomhdr->v8.numObjects));
|
||||
@ -1021,7 +1065,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
|
||||
if (id2 == (uint16)id) {
|
||||
if (findWhat & foCodeHeader) {
|
||||
fo->obcd = obcdptr;
|
||||
fo->cdhd = (CodeHeader *)(obcdptr + 10); // TODO - FIXME
|
||||
fo->cdhd = (const CodeHeader *)(obcdptr + 10); // TODO - FIXME
|
||||
}
|
||||
if (findWhat & foImageHeader) {
|
||||
fo->obim = obimptr;
|
||||
@ -1047,7 +1091,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
|
||||
obcdptr = findResource(MKID('OBCD'), searchptr);
|
||||
if (obcdptr == NULL)
|
||||
error("findObjectInRoom: Not enough code blocks in room %d", room);
|
||||
cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
|
||||
cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
|
||||
|
||||
if (_features & GF_SMALL_HEADER)
|
||||
id2 = READ_LE_UINT16(obcdptr + 6);
|
||||
@ -1080,7 +1124,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
|
||||
obimptr = findResource(MKID('OBIM'), searchptr);
|
||||
if (obimptr == NULL)
|
||||
error("findObjectInRoom: Not enough image blocks in room %d", room);
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
|
||||
if (_features & GF_SMALL_HEADER)
|
||||
id3 = READ_LE_UINT16(obimptr + 6);
|
||||
else if (_features & GF_AFTER_V8)
|
||||
@ -1272,7 +1316,7 @@ int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e,
|
||||
|
||||
void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
|
||||
int w, h;
|
||||
byte *dataptr, *bomp;
|
||||
const byte *dataptr, *bomp;
|
||||
uint32 size;
|
||||
FindObjectInRoom foir;
|
||||
|
||||
@ -1395,7 +1439,7 @@ void Scumm::drawBlastObjects() {
|
||||
|
||||
void Scumm::drawBlastObject(BlastObject *eo) {
|
||||
VirtScreen *vs;
|
||||
byte *bomp, *ptr;
|
||||
const byte *bomp, *ptr;
|
||||
int idx, objnum;
|
||||
BompDrawData bdd;
|
||||
|
||||
@ -1432,7 +1476,7 @@ void Scumm::drawBlastObject(BlastObject *eo) {
|
||||
// Get the address of the specified BOMP (we really should verify it's a BOMP and not a SMAP
|
||||
bomp = ptr + READ_LE_UINT32(ptr + 4 + 4*eo->image) + 8;
|
||||
} else {
|
||||
byte *img = findResource(IMxx_tags[eo->image], ptr);
|
||||
const byte *img = findResource(IMxx_tags[eo->image], ptr);
|
||||
if (!img)
|
||||
img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects
|
||||
|
||||
@ -1448,11 +1492,11 @@ void Scumm::drawBlastObject(BlastObject *eo) {
|
||||
//hexdump(bomp,32);
|
||||
|
||||
if (_features & GF_AFTER_V8) {
|
||||
bdd.srcwidth = READ_LE_UINT32(&((BompHeader *)bomp)->v8.width);
|
||||
bdd.srcheight = READ_LE_UINT32(&((BompHeader *)bomp)->v8.height);
|
||||
bdd.srcwidth = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.width);
|
||||
bdd.srcheight = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.height);
|
||||
} else {
|
||||
bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->old.width);
|
||||
bdd.srcheight = READ_LE_UINT16(&((BompHeader *)bomp)->old.height);
|
||||
bdd.srcwidth = READ_LE_UINT16(&((const BompHeader *)bomp)->old.width);
|
||||
bdd.srcheight = READ_LE_UINT16(&((const BompHeader *)bomp)->old.height);
|
||||
}
|
||||
|
||||
bdd.out = vs->screenPtr + vs->xstart;
|
||||
@ -1746,7 +1790,7 @@ void Scumm::loadFlObject(uint object, uint room) {
|
||||
// Dump object script
|
||||
if (_dumpScripts) {
|
||||
char buf[32];
|
||||
byte *ptr = foir.obcd;
|
||||
const byte *ptr = foir.obcd;
|
||||
sprintf(buf, "roomobj-%d-", room);
|
||||
ptr = findResource(MKID('VERB'), ptr, 0);
|
||||
dumpResource(buf, object, ptr);
|
||||
|
@ -136,11 +136,11 @@ struct ImageHeader { /* file format */
|
||||
#endif
|
||||
|
||||
struct FindObjectInRoom {
|
||||
CodeHeader *cdhd;
|
||||
byte *obcd;
|
||||
ImageHeader *imhd;
|
||||
byte *obim;
|
||||
byte *roomptr;
|
||||
const CodeHeader *cdhd;
|
||||
const byte *obcd;
|
||||
const ImageHeader *imhd;
|
||||
const byte *obim;
|
||||
const byte *roomptr;
|
||||
};
|
||||
|
||||
enum FindObjectWhat {
|
||||
|
@ -1344,7 +1344,7 @@ void Scumm::nukeResource(int type, int idx) {
|
||||
}
|
||||
}
|
||||
|
||||
byte *Scumm::findResourceData(uint32 tag, byte *ptr) {
|
||||
const byte *Scumm::findResourceData(uint32 tag, const byte *ptr) {
|
||||
if (_features & GF_OLD_BUNDLE)
|
||||
error("findResourceData must not be used in GF_OLD_BUNDLE games");
|
||||
else if (_features & GF_SMALL_HEADER)
|
||||
@ -1371,11 +1371,11 @@ int Scumm::getResourceDataSize(const byte *ptr) const {
|
||||
|
||||
struct FindResourceState {
|
||||
uint32 size, pos;
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
};
|
||||
|
||||
/* just O(N) complexity when iterating with this function */
|
||||
byte *findResource(uint32 tag, byte *searchin) {
|
||||
const byte *findResource(uint32 tag, const byte *searchin) {
|
||||
uint32 size;
|
||||
static FindResourceState frs;
|
||||
FindResourceState *f = &frs; /* easier to make it thread safe like this */
|
||||
@ -1403,7 +1403,7 @@ byte *findResource(uint32 tag, byte *searchin) {
|
||||
return f->ptr;
|
||||
}
|
||||
|
||||
byte *findResourceSmall(uint32 tag, byte *searchin) {
|
||||
const byte *findResourceSmall(uint32 tag, const byte *searchin) {
|
||||
uint32 size;
|
||||
static FindResourceState frs;
|
||||
FindResourceState *f = &frs; /* easier to make it thread safe like this */
|
||||
@ -1434,7 +1434,7 @@ byte *findResourceSmall(uint32 tag, byte *searchin) {
|
||||
return f->ptr;
|
||||
}
|
||||
|
||||
byte *findResource(uint32 tag, byte *searchin, int idx) {
|
||||
const byte *findResource(uint32 tag, const byte *searchin, int idx) {
|
||||
uint32 curpos, totalsize, size;
|
||||
|
||||
assert(searchin);
|
||||
@ -1462,7 +1462,7 @@ byte *findResource(uint32 tag, byte *searchin, int idx) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
byte *findResourceSmall(uint32 tag, byte *searchin, int idx) {
|
||||
const byte *findResourceSmall(uint32 tag, const byte *searchin, int idx) {
|
||||
uint32 curpos, totalsize, size;
|
||||
uint16 smallTag;
|
||||
|
||||
|
@ -33,8 +33,8 @@ struct ResHdr {
|
||||
#pragma END_PACK_STRUCTS
|
||||
#endif
|
||||
|
||||
#define RES_DATA(x) (((byte*)x) + sizeof(ResHdr))
|
||||
#define RES_SIZE(x) (READ_BE_UINT32_UNALIGNED(&((ResHdr* )x)->size))
|
||||
#define RES_DATA(x) (((const byte*)x) + sizeof(ResHdr))
|
||||
#define RES_SIZE(x) (READ_BE_UINT32_UNALIGNED(&((const ResHdr* )x)->size))
|
||||
|
||||
enum {
|
||||
OF_OWNER_MASK = 0x0F,
|
||||
@ -50,9 +50,9 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
byte *findResource(uint32 tag, byte *searchin, int index);
|
||||
byte *findResourceSmall(uint32 tag, byte *searchin, int index);
|
||||
byte *findResource(uint32 tag, byte *searchin);
|
||||
byte *findResourceSmall(uint32 tag, byte *searchin);
|
||||
const byte *findResource(uint32 tag, const byte *searchin, int index);
|
||||
const byte *findResourceSmall(uint32 tag, const byte *searchin, int index);
|
||||
const byte *findResource(uint32 tag, const byte *searchin);
|
||||
const byte *findResourceSmall(uint32 tag, const byte *searchin);
|
||||
|
||||
#endif
|
||||
|
@ -128,7 +128,7 @@ void Scumm::initializeLocals(int slot, int *vars) {
|
||||
}
|
||||
|
||||
int Scumm::getVerbEntrypoint(int obj, int entry) {
|
||||
byte *objptr, *verbptr;
|
||||
const byte *objptr, *verbptr;
|
||||
int verboffs;
|
||||
|
||||
if (whereIsObject(obj) == WIO_NOT_FOUND)
|
||||
@ -154,7 +154,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry) {
|
||||
verbptr += _resourceHeaderSize;
|
||||
|
||||
if (_features & GF_AFTER_V8) {
|
||||
uint32 *ptr = (uint32 *)verbptr;
|
||||
const uint32 *ptr = (const uint32 *)verbptr;
|
||||
uint32 verb;
|
||||
do {
|
||||
verb = READ_LE_UINT32(ptr);
|
||||
@ -729,7 +729,7 @@ void Scumm::runExitScript() {
|
||||
// FIXME: Oddly, Indy3 seems to contain exit scripts with only a size
|
||||
// and a tag - not even a terminating NULL!
|
||||
byte *roomptr = getResourceAddress(rtRoom, _roomResource);
|
||||
byte *excd = findResourceData(MKID('EXCD'), roomptr) - _resourceHeaderSize;
|
||||
const byte *excd = findResourceData(MKID('EXCD'), roomptr) - _resourceHeaderSize;
|
||||
if (!excd || (getResourceDataSize(excd) < 1)) {
|
||||
debug(2, "Exit-%d is empty", _roomResource);
|
||||
return;
|
||||
|
@ -622,9 +622,9 @@ protected:
|
||||
|
||||
int _lastLoadedRoom;
|
||||
public:
|
||||
byte *findResourceData(uint32 tag, byte *ptr);
|
||||
const byte *findResourceData(uint32 tag, const byte *ptr);
|
||||
int getResourceDataSize(const byte *ptr) const;
|
||||
void dumpResource(const char *tag, int index, byte *ptr, int length = -1);
|
||||
void dumpResource(const char *tag, int index, const byte *ptr, int length = -1);
|
||||
|
||||
protected:
|
||||
int getArrayId();
|
||||
@ -651,7 +651,7 @@ protected:
|
||||
ObjectIDMap _objectIDMap;
|
||||
byte _numObjectsInRoom;
|
||||
|
||||
void setupRoomObject(ObjectData *od, byte *room, byte *searchptr = NULL);
|
||||
void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
|
||||
void removeObjectFromRoom(int obj);
|
||||
void loadFlObject(uint object, uint room);
|
||||
void nukeFlObjects(int min, int max);
|
||||
@ -755,8 +755,8 @@ public:
|
||||
int cost_frameToAnim(Actor *a, int frame);
|
||||
|
||||
// Akos Class
|
||||
bool akos_increaseAnims(byte *akos, Actor *a);
|
||||
bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo);
|
||||
bool akos_increaseAnims(const byte *akos, Actor *a);
|
||||
bool akos_increaseAnim(Actor *a, int i, const byte *aksq, const uint16 *akfo, int numakfo);
|
||||
void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
|
||||
bool akos_compare(int a, int b, byte cmd);
|
||||
void akos_decodeData(Actor *a, int frame, uint usemask);
|
||||
@ -804,7 +804,7 @@ protected:
|
||||
void initScreens(int a, int b, int w, int h);
|
||||
void initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs, bool scrollable);
|
||||
void initBGBuffers(int height);
|
||||
void initCycl(byte *ptr); // Color cycle
|
||||
void initCycl(const byte *ptr); // Color cycle
|
||||
|
||||
void createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, int16 colorMin, int16 colorMax);
|
||||
|
||||
@ -825,14 +825,14 @@ protected:
|
||||
void setCameraFollows(Actor *a);
|
||||
void clampCameraPos(ScummVM::Point *pt);
|
||||
|
||||
byte *getPalettePtr();
|
||||
const byte *getPalettePtr();
|
||||
void setupEGAPalette();
|
||||
void setPalette(int pal);
|
||||
void setPaletteFromPtr(const byte *ptr);
|
||||
void setPaletteFromRes();
|
||||
void setPalColor(int index, int r, int g, int b);
|
||||
void setDirtyColors(int min, int max);
|
||||
byte *findPalInPals(byte *pal, int index);
|
||||
const byte *findPalInPals(const byte *pal, int index);
|
||||
void swapPalColors(int a, int b);
|
||||
void copyPalColor(int dst, int src);
|
||||
void cyclePalette();
|
||||
@ -856,8 +856,8 @@ protected:
|
||||
void makeCursorColorTransparent(int a);
|
||||
void setupCursor() { _cursor.animate = 1; }
|
||||
void decompressDefaultCursor(int index);
|
||||
void useIm01Cursor(byte *im, int w, int h);
|
||||
void useBompCursor(byte *im, int w, int h);
|
||||
void useIm01Cursor(const byte *im, int w, int h);
|
||||
void useBompCursor(const byte *im, int w, int h);
|
||||
|
||||
|
||||
public:
|
||||
|
@ -1244,9 +1244,9 @@ void Scumm::startScene(int room, Actor * a, int objectNr) {
|
||||
|
||||
void Scumm::initRoomSubBlocks() {
|
||||
int i, offs;
|
||||
byte *ptr;
|
||||
const byte *ptr;
|
||||
byte *roomptr, *searchptr, *roomResPtr;
|
||||
RoomHeader *rmhd;
|
||||
const RoomHeader *rmhd;
|
||||
|
||||
_ENCD_offs = 0;
|
||||
_EXCD_offs = 0;
|
||||
@ -1274,9 +1274,9 @@ void Scumm::initRoomSubBlocks() {
|
||||
// Determine the room dimensions (width/height)
|
||||
//
|
||||
if (_features & GF_OLD_BUNDLE)
|
||||
rmhd = (RoomHeader *)(roomptr + 4);
|
||||
rmhd = (const RoomHeader *)(roomptr + 4);
|
||||
else
|
||||
rmhd = (RoomHeader *)findResourceData(MKID('RMHD'), roomptr);
|
||||
rmhd = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr);
|
||||
|
||||
if (_features & GF_AFTER_V8) {
|
||||
_roomWidth = READ_LE_UINT32(&(rmhd->v8.width));
|
||||
@ -1610,7 +1610,7 @@ void Scumm::setScaleSlot(int slot, int x1, int y1, int scale1, int x2, int y2, i
|
||||
_scaleSlots[slot-1].scale1 = scale1;
|
||||
}
|
||||
|
||||
void Scumm::dumpResource(const char *tag, int idx, byte *ptr, int length) {
|
||||
void Scumm::dumpResource(const char *tag, int idx, const byte *ptr, int length) {
|
||||
char buf[256];
|
||||
File out;
|
||||
|
||||
|
@ -287,12 +287,13 @@ void Scumm::restoreVerbBG(int verb) {
|
||||
void Scumm::drawVerbBitmap(int verb, int x, int y) {
|
||||
VirtScreen *vs;
|
||||
VerbSlot *vst;
|
||||
byte twobufs, *imptr = 0;
|
||||
byte twobufs;
|
||||
const byte *imptr = 0;
|
||||
int ydiff, xstrip;
|
||||
int imgw, imgh;
|
||||
int i, tmp;
|
||||
byte *obim;
|
||||
ImageHeader *imhd;
|
||||
const ImageHeader *imhd;
|
||||
uint32 size;
|
||||
|
||||
if ((vs = findVirtScreen(y)) == NULL)
|
||||
@ -319,7 +320,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) {
|
||||
imgh = (*(obim + size + 17)) >> 3;
|
||||
imptr = (obim + 8);
|
||||
} else {
|
||||
imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obim);
|
||||
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obim);
|
||||
if (_features & GF_AFTER_V7) {
|
||||
imgw = READ_LE_UINT16(&imhd->v7.width) >> 3;
|
||||
imgh = READ_LE_UINT16(&imhd->v7.height) >> 3;
|
||||
@ -393,8 +394,8 @@ void Scumm::killVerb(int slot) {
|
||||
}
|
||||
|
||||
void Scumm::setVerbObject(uint room, uint object, uint verb) {
|
||||
byte *obimptr;
|
||||
byte *obcdptr;
|
||||
const byte *obimptr;
|
||||
const byte *obcdptr;
|
||||
uint32 size, size2;
|
||||
FindObjectInRoom foir;
|
||||
int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user