From 82381d6a19038800f85e4a10d6ab232c48555baa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 Jan 2012 22:31:36 +1100 Subject: MORTEVIELLE: Fix for erasing alert dialogs when done --- engines/mortevielle/alert.cpp | 6 ++++++ engines/mortevielle/graphics.cpp | 17 +++++++++++++++++ engines/mortevielle/graphics.h | 1 + 3 files changed, 24 insertions(+) (limited to 'engines') diff --git a/engines/mortevielle/alert.cpp b/engines/mortevielle/alert.cpp index 3895bad7fd..36a51b07ed 100644 --- a/engines/mortevielle/alert.cpp +++ b/engines/mortevielle/alert.cpp @@ -143,6 +143,8 @@ int do_alert(Common::String str_, int n) { bool newaff, test, test1, test2, test3, dum; Common::String cas; + // Make a copy of the current screen surface for later restore + g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface); /*debug('** do_alert **');*/ memset(&limit[0][0], 0, sizeof(int) * 3 * 3); @@ -258,6 +260,10 @@ int do_alert(Common::String str_, int n) { } charecr(50, succ(int, nligne) << 4); show_mouse(); + + /* Restore the background area */ + g_vm->_screenSurface.copyFrom(g_vm->_backgroundSurface, 0, 0); + do_alert_result = quoi; return do_alert_result; } diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 3683afc57b..3450d41cf5 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -934,6 +934,23 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { } } +/** + * Copys a given surface to the given position + */ +void ScreenSurface::copyFrom(Graphics::Surface &src, int x, int y) { + Graphics::Surface destSurface = lockArea(Common::Rect(x, y, x + src.w, y + src.h)); + + // Loop through writing + for (int yp = 0; yp < src.h; ++yp) { + if (((y + yp) < 0) || ((y + yp) >= SCREEN_HEIGHT)) + continue; + + const byte *pSrc = (const byte *)src.getBasePtr(0, yp); + byte *pDest = (byte *)getBasePtr(0, yp); + Common::copy(pSrc, pSrc + src.w, pDest); + } +} + /** * Draws a character at the specified co-ordinates * @remarks Because the ScummVM surface is using a double height 640x400 surface to diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 376b9e5e85..0b265469df 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -82,6 +82,7 @@ public: Graphics::Surface lockArea(const Common::Rect &bounds); void updateScreen(); void drawPicture(GfxSurface &surface, int x, int y); + void copyFrom(Graphics::Surface &src, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); void drawBox(int x, int y, int dx, int dy, int col); void fillBox(int colour, const Common::Rect &bounds, int patt); -- cgit v1.2.3