Add fix for Zak256/Indy3 actor masks. Thanks jah! Excellent work.

Let's hope someone will fix Loom actor masks soon... :)

svn-id: r3976
This commit is contained in:
James Brown 2002-04-17 16:02:29 +00:00
parent 72663cdcf4
commit 1df77c2002
3 changed files with 65 additions and 22 deletions

75
gfx.cpp
View File

@ -338,9 +338,10 @@ void Scumm::initBGBuffers()
byte *room;
room = getResourceAddress(rtRoom, _roomResource);
if (_features & GF_SMALL_HEADER) {
gdi._numZBuffer = 1;
if (_features & GF_OLD256) {
gdi._numZBuffer = 2;
} else if (_features & GF_SMALL_HEADER) {
gdi._numZBuffer = 1; // ENDER
} else {
ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1;
@ -642,7 +643,8 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
int numzbuf;
int sx;
CHECK_HEAP if (_vm->_features & GF_SMALL_HEADER)
CHECK_HEAP;
if (_vm->_features & GF_SMALL_HEADER)
smap_ptr = _smap_ptr = ptr;
else
smap_ptr = findResource(MKID('SMAP'), ptr);
@ -651,8 +653,21 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
numzbuf = _disable_zbuffer ? 0 : _numZBuffer;
for (i = 1; i < numzbuf; i++) {
zplane_list[i] = findResource(zplane_tags[i], ptr);
if (_vm->_features & GF_OLD256) {
/* this is really ugly, FIXME */
if (ptr[-2] == 'B' && ptr[-1] == 'M' &&
READ_LE_UINT32(ptr - 6) > (READ_LE_UINT32(ptr) + 10)) {
zplane_list[1] = smap_ptr + READ_LE_UINT32(ptr);
} else if (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);
} else {
zplane_list[1] = 0;
}
} else {
for (i = 1; i < numzbuf; i++) {
zplane_list[i] = findResource(zplane_tags[i], ptr);
}
}
bottom = y + h;
@ -673,7 +688,8 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
else
_smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + stripnr * 4 + 8);
CHECK_HEAP sx = x;
CHECK_HEAP;
sx = x;
if (vs->scrollable)
sx -= vs->xstart >> 3;
@ -697,7 +713,8 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
where_draw_ptr = _bgbak_ptr;
decompressBitmap();
CHECK_HEAP if (twobufs) {
CHECK_HEAP;
if (twobufs) {
_bgbak_ptr = where_draw_ptr;
if (_vm->hasCharsetMask(sx << 3, y, (sx + 1) << 3, bottom)) {
@ -712,9 +729,9 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
blit(_backbuff_ptr, _bgbak_ptr, 8, h);
}
}
CHECK_HEAP if (flag & dbDrawMaskOnBoth) {
_z_plane_ptr =
zplane_list[1] + READ_LE_UINT16(zplane_list[1] + stripnr * 2 + 8);
CHECK_HEAP;
if (flag & dbDrawMaskOnBoth) {
_z_plane_ptr = zplane_list[1] + READ_LE_UINT16(zplane_list[1] + stripnr * 2 + 8);
_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * 40 + x;
if (_useOrDecompress && flag & dbAllowMaskOr)
decompressMaskImgOr();
@ -723,18 +740,36 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
}
for (i = 1; i < numzbuf; i++) {
uint16 offs;
if (!zplane_list[i])
continue;
_z_plane_ptr =
zplane_list[i] + READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8);
_mask_ptr_dest =
_vm->getResourceAddress(rtBuffer, 9) + y * 40 + x + _imgBufOffs[i];
if (_useOrDecompress && flag & dbAllowMaskOr)
decompressMaskImgOr();
continue;
if (_vm->_features & GF_SMALL_HEADER)
offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4);
else
decompressMaskImg();
offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8);
_mask_ptr_dest = _vm->getResourceAddress(rtBuffer, 9) + y * 40 + x + _imgBufOffs[i];
if (offs) {
_z_plane_ptr = zplane_list[i] + offs;
if (_useOrDecompress && flag & dbAllowMaskOr)
decompressMaskImgOr();
else
decompressMaskImg();
} else {
if (_useOrDecompress && flag & dbAllowMaskOr)
; /* nothing */
else
for (int h = 0; h < _numLinesToProcess; h++)
_mask_ptr_dest[h * 40] = 0;
/* needs better abstraction, FIXME */
}
}
CHECK_HEAP x++;
CHECK_HEAP;
x++;
stripnr++;
} while (--numstrip);
}

View File

@ -184,6 +184,9 @@ void Gui::drawWidget(const GuiWidget * w)
sprintf(text, "%s %d", string_map_table_custom[w->_string_number],
_gui_variables[w->_string_number]);
break;
case GUI_SCROLLTEXT:
sprintf(text, "%s", _gui_scroller);
break;
#ifdef _WIN32_WCE
case GUI_KEYTEXT:
strcpy(text,
@ -409,10 +412,10 @@ const GuiWidget keys_dialog[] = {
const GuiWidget about_dialog[] = {
{GUI_STAT, 0xFF, GWF_DEFAULT, 30, 20, 260, 120, 0, 0},
// {GUI_CUSTOMTEXT, 0x01, 0, 30 + 95, 20 + 10, 100, 15, 0, }, .. pocketscummvm
{GUI_CUSTOMTEXT, 0x01, 0, 30 + 68, 20 + 10 + 15 + 5, 160, 15, 0, 9}, // Build
{GUI_CUSTOMTEXT, 0x01, 0, 30 + 10, 20 + 10 + 15 + 5 + 15, 230, 15, 0, 10}, // ScummVM Url
{GUI_CUSTOMTEXT, 0x01, 0, 30 + 75, 20 + 10 + 15 + 5 + 15 + 15 + 15, 150, 15, 0, 11}, // Lucasarts
{GUI_SCROLLTEXT, 0x01, 0, 30 + 95, 20 + 10, 100, 15, 0},
{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 20 + 96, 54, 16, 40, 9},
{0, 0, 0, 0, 0, 0, 0, 0, 0}
};
@ -819,6 +822,8 @@ void Gui::init(Scumm *s)
_textcolorhi = 15;
_shadowcolor = 0;
_s = s;
strcpy(_gui_scroller, "Brought to you by:");
}
void Gui::loop()

5
gui.h
View File

@ -34,7 +34,8 @@ enum {
GUI_CUSTOMTEXT = 4,
GUI_VARTEXT = 5,
GUI_ACTIONTEXT = 6,
GUI_KEYTEXT = 7
GUI_KEYTEXT = 7,
GUI_SCROLLTEXT = 8
};
enum {
@ -114,6 +115,8 @@ public:
void queryMessage(const char *msg, const char *alts);
byte getDefaultColor(int color);
char _gui_scroller[255];
// Dialogs
void saveLoadDialog();
void pause();