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