aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2009-10-31 13:34:31 +0000
committerTorbjörn Andersson2009-10-31 13:34:31 +0000
commit2f7f5bb4f1e4635c33cf05aff3852ba967d99304 (patch)
tree20832bbe4214f3c04953e2725209fbcba819fe9c
parentf7fcec1ce283ab5536358334193244f6b4d9a3ee (diff)
downloadscummvm-rg350-2f7f5bb4f1e4635c33cf05aff3852ba967d99304.tar.gz
scummvm-rg350-2f7f5bb4f1e4635c33cf05aff3852ba967d99304.tar.bz2
scummvm-rg350-2f7f5bb4f1e4635c33cf05aff3852ba967d99304.zip
Fixed flashlight drawing in 16 bpp games. (Which probably means PC-Engine Loom
is the only game where it makes any difference.) svn-id: r45560
-rw-r--r--engines/scumm/gfx.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 78b718d4cf..d290d12444 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1374,17 +1374,24 @@ void ScummEngine_v5::drawFlashlight() {
// rounded corners.
static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 };
int minrow = 0;
- int maxcol = _flashlight.w - 1;
+ int maxcol = (_flashlight.w - 1) * _bytesPerPixel;
int maxrow = (_flashlight.h - 1) * vs->pitch;
for (i = 0; i < 8; i++, minrow += vs->pitch, maxrow -= vs->pitch) {
int d = corner_data[i];
for (j = 0; j < d; j++) {
- _flashlight.buffer[minrow + j] = 0;
- _flashlight.buffer[minrow + maxcol - j] = 0;
- _flashlight.buffer[maxrow + j] = 0;
- _flashlight.buffer[maxrow + maxcol - j] = 0;
+ if (_bytesPerPixel == 2) {
+ WRITE_UINT16(&_flashlight.buffer[minrow + 2 * j], 0);
+ WRITE_UINT16(&_flashlight.buffer[minrow + maxcol - 2 * j], 0);
+ WRITE_UINT16(&_flashlight.buffer[maxrow + 2 * j], 0);
+ WRITE_UINT16(&_flashlight.buffer[maxrow + maxcol - 2 * j], 0);
+ } else {
+ _flashlight.buffer[minrow + j] = 0;
+ _flashlight.buffer[minrow + maxcol - j] = 0;
+ _flashlight.buffer[maxrow + j] = 0;
+ _flashlight.buffer[maxrow + maxcol - j] = 0;
+ }
}
}