simplified / unified code; fixed various masking bugs
svn-id: r7096
This commit is contained in:
parent
2ba6881a10
commit
a90dcc8b71
1 changed files with 57 additions and 71 deletions
|
@ -528,22 +528,17 @@ void Scumm::initBGBuffers(int height) {
|
|||
int off;
|
||||
ptr = findResourceData(MKID('SMAP'), room);
|
||||
gdi._numZBuffer = 0;
|
||||
if (_gameId == GID_MONKEY_EGA) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
||||
if (_gameId == GID_MONKEY_EGA)
|
||||
off = READ_LE_UINT16(ptr);
|
||||
if (off) {
|
||||
gdi._numZBuffer++;
|
||||
ptr += off;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
else
|
||||
off = READ_LE_UINT32(ptr);
|
||||
for (i = 0; off && (i < 4); i++) {
|
||||
|
||||
while (off && gdi._numZBuffer < 4) {
|
||||
gdi._numZBuffer++;
|
||||
ptr += off;
|
||||
off = READ_LE_UINT16(ptr);
|
||||
}
|
||||
}
|
||||
} else if (_features & GF_AFTER_V8) {
|
||||
// in V8 there is no RMIH and num z buffers is in RMHD
|
||||
ptr = findResource(MKID('RMHD'), room);
|
||||
|
@ -853,43 +848,31 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
|
|||
|
||||
assert(smap_ptr);
|
||||
|
||||
numzbuf = _disable_zbuffer ? 0 : _numZBuffer;
|
||||
if (_vm->_features & GF_OLD_BUNDLE) { // FIXME make masks decompress properly
|
||||
zplane_list[0] = smap_ptr;
|
||||
|
||||
if (_disable_zbuffer)
|
||||
numzbuf = 0;
|
||||
}
|
||||
else if (_numZBuffer <= 1)
|
||||
numzbuf = _numZBuffer;
|
||||
else {
|
||||
numzbuf = _numZBuffer;
|
||||
assert(numzbuf <= (int)ARRAYSIZE(zplane_list));
|
||||
|
||||
if (_vm->_features & GF_OLD_BUNDLE) {
|
||||
if (_vm->_features & GF_SMALL_HEADER) {
|
||||
if ((_vm->_features & GF_16COLOR) || (_vm->_features & GF_OLD256))
|
||||
zplane_list[1] = smap_ptr + READ_LE_UINT16(smap_ptr);
|
||||
} else if (_vm->_gameId == GID_MONKEY_EGA) {
|
||||
byte *ptr_z = smap_ptr;
|
||||
for (i = 0; i < numzbuf; i++) {
|
||||
int off = READ_LE_UINT16(ptr_z);
|
||||
if (off) {
|
||||
zplane_list[i] = ptr_z;
|
||||
ptr_z += off;
|
||||
}
|
||||
}
|
||||
} else if (_vm->_features & GF_SMALL_HEADER) {
|
||||
/* this is really ugly, FIXME */
|
||||
if ((ptr[-2] == 'B' && ptr[-1] == 'M' && READ_LE_UINT32(ptr - 6) > (READ_LE_UINT32(ptr) + 10)) ||
|
||||
(ptr[-4] == 'O' && ptr[-3] == 'I' && READ_LE_UINT32(ptr - 8) > READ_LE_UINT32(ptr) + 12)) {
|
||||
zplane_list[1] = smap_ptr + READ_LE_UINT32(ptr);
|
||||
// FIXME - how does GF_OLD256 encode the multiple zplanes?
|
||||
if (!(_vm->_features & GF_OLD256))
|
||||
else
|
||||
zplane_list[1] = smap_ptr + READ_LE_UINT32(smap_ptr);
|
||||
for (i = 2; i < numzbuf; i++) {
|
||||
zplane_list[i] = zplane_list[i-1] + READ_LE_UINT16(zplane_list[i-1]);
|
||||
}
|
||||
} else {
|
||||
zplane_list[1] = 0;
|
||||
}
|
||||
} 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;
|
||||
|
||||
// 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
|
||||
// and OFFS chunk. The content of this OFFS chunk contains the offsets to the
|
||||
// an OFFS chunk. The content of this OFFS chunk contains the offsets to the
|
||||
// Z-planes.
|
||||
// We do not directly make use of this, but rather hard code offsets (like we do
|
||||
// for all other Scumm-versions, too). Clearly this is a bit hackish, but works
|
||||
|
@ -915,6 +898,7 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
|
|||
zplane_list[i] = findResource(zplane_tags[i], ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bottom = y + h;
|
||||
if (bottom > vs->height) {
|
||||
|
@ -1011,7 +995,9 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int h,
|
|||
if (!zplane_list[i])
|
||||
continue;
|
||||
|
||||
if (_vm->_features & GF_OLD256)
|
||||
if (_vm->_features & GF_OLD_BUNDLE)
|
||||
offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2);
|
||||
else if (_vm->_features & GF_OLD256)
|
||||
offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4);
|
||||
else if (_vm->_features & GF_SMALL_HEADER)
|
||||
offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue