aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-12-31 03:26:02 +0000
committerMax Horn2002-12-31 03:26:02 +0000
commit5d4f06cf1f5b75b0ee719b41cf69443f2fd1b9a8 (patch)
treebd5f794d8bb0102b6a015afa40c876bb2435b25e
parent166ea5bcee36aaab30ea6b7764bdc9872fc2dcf2 (diff)
downloadscummvm-rg350-5d4f06cf1f5b75b0ee719b41cf69443f2fd1b9a8.tar.gz
scummvm-rg350-5d4f06cf1f5b75b0ee719b41cf69443f2fd1b9a8.tar.bz2
scummvm-rg350-5d4f06cf1f5b75b0ee719b41cf69443f2fd1b9a8.zip
implemented object drawing (still somewhat broken, we get a 'green screen' effetc :-). Oh yes, this probably breaks save game compatibility for COMI. Oh yeah. As if I would care <g>
svn-id: r6285
-rw-r--r--scumm/gfx.cpp18
-rw-r--r--scumm/object.cpp35
-rw-r--r--scumm/scummvm.cpp14
3 files changed, 43 insertions, 24 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 018e3ff725..dfdbaa2f69 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -62,14 +62,6 @@ static const int8 shake_positions[NUM_SHAKE_POSITIONS] = {
0, 1 * 2, 2 * 2, 1 * 2, 0 * 2, 2 * 2, 3 * 2, 1 * 2
};
-static const uint32 zplane_tags[] = {
- MKID('ZP00'),
- MKID('ZP01'),
- MKID('ZP02'),
- MKID('ZP03'),
- MKID('ZP04')
-};
-
static const int8 screen_eff7_table1[4][16] = {
{ 1, 1, -1, 1, -1, 1, -1, -1,
1, -1, -1, -1, 1, 1, 1, -1},
@@ -805,6 +797,8 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
CHECK_HEAP;
if (_vm->_features & GF_SMALL_HEADER)
smap_ptr = ptr;
+ else if (_vm->_features & GF_AFTER_V8)
+ smap_ptr = ptr;
else
smap_ptr = findResource(MKID('SMAP'), ptr);
@@ -845,6 +839,14 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
// A small hack to skip to the BSTR->WRAP->OFFS chunk
smap_ptr += 24;
} else {
+ const uint32 zplane_tags[] = {
+ MKID('ZP00'),
+ MKID('ZP01'),
+ MKID('ZP02'),
+ MKID('ZP03'),
+ MKID('ZP04')
+ };
+
for (i = 1; i < numzbuf; i++) {
zplane_list[i] = findResource(zplane_tags[i], ptr);
}
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 43c28b0576..394a66b678 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -359,7 +359,18 @@ void Scumm::drawObject(int obj, int arg)
if (_features & GF_SMALL_HEADER)
ptr += 8;
- else
+ else if (_features & GF_AFTER_V8) {
+ ptr = findResource(MKID('IMAG'), ptr);
+ if (!ptr)
+ return;
+
+ ptr = findResource(MKID('WRAP'), ptr);
+ assert(ptr);
+ ptr = findResource(MKID('OFFS'), ptr);
+ assert(ptr);
+ // Get the address of the specified SMAP (corresponding to IMxx)
+ ptr += READ_LE_UINT32(ptr + 4 + 4*getState(od->obj_nr));
+ } else
ptr = findResource(IMxx_tags[getState(od->obj_nr)], ptr);
if (!ptr)
return;
@@ -1273,7 +1284,7 @@ void Scumm::drawBlastObjects()
void Scumm::drawBlastObject(BlastObject *eo)
{
VirtScreen *vs;
- byte *bomp, *ptr, *img;
+ byte *bomp, *ptr;
int idx;
BompDrawData bdd;
@@ -1299,18 +1310,16 @@ void Scumm::drawBlastObject(BlastObject *eo)
// an OFFS chunk and multiple BOMP chunks. To find the right BOMP, we can
// either use the offsets in the OFFS chunk, or iterate over all BOMPs we find.
// Here we use the first method.
- img = findResource(MKID('IMAG'), ptr);
- assert(img);
-
- img = findResource(MKID('WRAP'), img);
- assert(img);
-
- img = findResource(MKID('OFFS'), img);
- assert(img);
-
- bomp = img + READ_LE_UINT32(img + 4 + 4*eo->image) + 8;
+ ptr = findResource(MKID('IMAG'), ptr);
+ assert(ptr);
+ ptr = findResource(MKID('WRAP'), ptr);
+ assert(ptr);
+ ptr = findResource(MKID('OFFS'), ptr);
+ assert(ptr);
+ // 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 {
- img = findResource(IMxx_tags[eo->image], ptr);
+ byte *img = findResource(IMxx_tags[eo->image], ptr);
if (!img)
img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index bf94018b06..5c964c64be 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -745,9 +745,17 @@ void Scumm::initRoomSubBlocks()
if (_features & GF_SMALL_HEADER)
_IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
- else if (_features & GF_AFTER_V8)
- _IM00_offs = findResourceData(MKID('IMAG'), roomptr) - roomptr;
- else
+ else if (_features & GF_AFTER_V8) {
+ ptr = findResource(MKID('IMAG'), roomptr);
+ assert(ptr);
+ ptr = findResource(MKID('WRAP'), ptr);
+ assert(ptr);
+ ptr = findResource(MKID('OFFS'), ptr);
+ assert(ptr);
+ // Get the first SMAP resource (corresponds to IM00)
+ ptr += READ_LE_UINT32(ptr + 8);
+ _IM00_offs = ptr - roomptr;
+ } else
_IM00_offs =
findResource(MKID('IM00'),
findResource(MKID('RMIM'), roomptr)) - roomptr;