fixed nasty signed/unsigned bug

svn-id: r3437
This commit is contained in:
Ludvig Strigeus 2001-10-17 07:12:37 +00:00
parent 5979ecfdd5
commit e3efa056d2
2 changed files with 16 additions and 8 deletions

19
gfx.cpp
View file

@ -17,6 +17,9 @@
* *
* Change Log: * Change Log:
* $Log$ * $Log$
* Revision 1.6 2001/10/17 07:12:37 strigeus
* fixed nasty signed/unsigned bug
*
* Revision 1.5 2001/10/16 20:31:27 strigeus * Revision 1.5 2001/10/16 20:31:27 strigeus
* misc fixes * misc fixes
* *
@ -93,11 +96,11 @@ void Scumm::initVirtScreen(int slot, int top, int height, bool twobufs, bool fou
vs->topline = top; vs->topline = top;
vs->height = height; vs->height = height;
vs->alloctwobuffers = twobufs; vs->alloctwobuffers = twobufs;
vs->fourlinesextra = fourextra; vs->scrollable = fourextra;
vs->xstart = 0; vs->xstart = 0;
size = vs->width * vs->height; size = vs->width * vs->height;
vs->size = size; vs->size = size;
if (vs->fourlinesextra) if (vs->scrollable)
size += 320*4; size += 320*4;
memset( memset(
@ -164,7 +167,7 @@ void Scumm::updateDirtyScreen(int slot) {
gdi.drawY = vs->topline; gdi.drawY = vs->topline;
gdi.drawHeight = vs->height; gdi.drawHeight = vs->height;
gdi.readOffs = 0; gdi.readOffs = 0;
if (vs->fourlinesextra) if (vs->scrollable)
gdi.readOffs = _screenStartStrip; gdi.readOffs = _screenStartStrip;
if (_videoMode==0xE) { if (_videoMode==0xE) {
@ -659,7 +662,7 @@ void Scumm::drawBmp(byte *ptr, int a, int b, int c, const char *str, int objnr)
dseg_4174 = vs->size; dseg_4174 = vs->size;
if (vs->fourlinesextra) if (vs->scrollable)
dseg_4174 += 5*256; dseg_4174 += 5*256;
gdi.vertStripNextInc = gdi.numLinesToProcess * 320 - 1; gdi.vertStripNextInc = gdi.numLinesToProcess * 320 - 1;
@ -668,12 +671,12 @@ void Scumm::drawBmp(byte *ptr, int a, int b, int c, const char *str, int objnr)
gdi.smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + a*4 + 8); gdi.smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + a*4 + 8);
x = _drawBmpX; x = _drawBmpX;
if (vs->fourlinesextra) if (vs->scrollable)
x -= _screenStartStrip; x -= _screenStartStrip;
CHECK_HEAP CHECK_HEAP
if (x >= 40) if ((uint)x >= 40)
return; return;
if (_drawBmpY < vs->tdirty[x]) if (_drawBmpY < vs->tdirty[x])
@ -934,13 +937,15 @@ void Scumm::decompressMaskImgOr() {
void Scumm::redrawBGStrip(int start, int num) { void Scumm::redrawBGStrip(int start, int num) {
int s = _screenStartStrip + start; int s = _screenStartStrip + start;
assert(s>=0 && s<sizeof(actorDrawBits)/sizeof(actorDrawBits[0]));
gdi.virtScreen = 0; gdi.virtScreen = 0;
actorDrawBits[s]|=0x8000; actorDrawBits[s]|=0x8000;
_drawBmpX = s; _drawBmpX = s;
_drawBmpY = 0; _drawBmpY = 0;
gdi.numLinesToProcess = virtscr[0].height; gdi.numLinesToProcess = virtscr[0].height;
if (gdi.numLinesToProcess > _scrHeight) { if (gdi.numLinesToProcess > _scrHeight) {
error("Screen Y size %d > Room height %d", error("Screen Y size %d < Room height %d",
gdi.numLinesToProcess, gdi.numLinesToProcess,
_scrHeight); _scrHeight);
} }

View file

@ -17,6 +17,9 @@
* *
* Change Log: * Change Log:
* $Log$ * $Log$
* Revision 1.10 2001/10/17 07:12:37 strigeus
* fixed nasty signed/unsigned bug
*
* Revision 1.9 2001/10/16 20:31:27 strigeus * Revision 1.9 2001/10/16 20:31:27 strigeus
* misc fixes * misc fixes
* *
@ -100,7 +103,7 @@ struct VirtScreen {
uint16 width,height; uint16 width,height;
uint16 size; uint16 size;
byte alloctwobuffers; byte alloctwobuffers;
byte fourlinesextra; byte scrollable;
uint16 xstart; uint16 xstart;
byte tdirty[40]; byte tdirty[40];
byte bdirty[40]; byte bdirty[40];