diff options
-rw-r--r-- | engines/dreamweb/stubs.h | 2 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index f99f0d6fbb..ede60259a4 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -25,7 +25,7 @@ void clearwork(); void multidump(); void multidump(uint16 x, uint16 y, uint8 width, uint8 height); - void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y); void frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); void frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index beb2d61f7e..ecc90f172a 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -286,11 +286,23 @@ void DreamGenContext::showpcx() { pcxFile.close(); } -void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { +void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) { // NB : These resilience checks were not in the original engine, but did they result in undefined behaviour // or was something broken during porting to C++? assert(pitch == 320); + if(x < 0) { + assert(width >= -x); + width -= -x; + src += -x; + x = 0; + } + if(y < 0) { + assert(height >= -y); + height -= -y; + src += (-y) * width; + y = 0; + } if(x >= 320) return; if(y >= 200) |