From efd8c41d35a2807ea2026f6966c3efb83de4dc65 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 1 Sep 2011 01:39:12 +0200 Subject: DREAMWEB: 'frameoutv' know how to clip on the left and upper borders --- engines/dreamweb/stubs.h | 2 +- engines/dreamweb/vgagrafx.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'engines/dreamweb') 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) -- cgit v1.2.3