[Scummvm-cvs-logs] CVS: scummvm/queen display.cpp,1.13,1.14 display.h,1.8,1.9
David Eriksson
twogood at users.sourceforge.net
Tue Oct 28 06:24:10 CET 2003
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv22593
Modified Files:
display.cpp display.h
Log Message:
Safer use of dynalum.
Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- display.cpp 24 Oct 2003 08:55:13 -0000 1.13
+++ display.cpp 28 Oct 2003 14:19:11 -0000 1.14
@@ -146,11 +146,15 @@
// FIXME: are these tests really needed ?
if (roomNum < 90 || ((roomNum > 94) && (roomNum < 114))) {
char filename[20];
+
sprintf(filename, "%s.msk", roomName);
- if (resource->exists(filename))
+ _dynalum.haveMsk = resource->exists(filename);
+ if (_dynalum.haveMsk)
resource->loadFile(filename, 0, (uint8*)_dynalum.msk);
+
sprintf(filename, "%s.lum", roomName);
- if (resource->exists(filename))
+ _dynalum.haveLum = resource->exists(filename);
+ if (_dynalum.haveLum)
resource->loadFile(filename, 0, (uint8*)_dynalum.lum);
}
}
@@ -158,13 +162,23 @@
void Display::dynalumUpdate(int x, int y) {
+ if (!_dynalum.haveMsk)
+ return;
+
if (x >= _bdWidth) {
x = _bdWidth;
}
if (y >= ROOM_ZONE_HEIGHT - 1) {
y = ROOM_ZONE_HEIGHT - 1;
}
- uint8 colMask = _dynalum.msk[(y / 4) * 160 + (x / 4)];
+
+ unsigned offset = (y / 4) * 160 + (x / 4);
+ if (offset >= sizeof(_dynalum.msk)) {
+ debug(0, "Graphics::dynalumUpdate(%d, %d) - invalid offset: %08x", x, y, offset);
+ return;
+ }
+
+ uint8 colMask = _dynalum.msk[offset];
debug(9, "Graphics::dynalumUpdate(%d, %d) - colMask = %d", x, y, colMask);
if (colMask != _dynalum.prevColMask) {
Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- display.h 24 Oct 2003 08:55:13 -0000 1.8
+++ display.h 28 Oct 2003 14:19:11 -0000 1.9
@@ -43,6 +43,8 @@
struct Dynalum {
+ bool haveMsk;
+ bool haveLum;
uint8 msk[50 * 160];
int8 lum[8 * 3];
uint8 prevColMask;
More information about the Scummvm-git-logs
mailing list