Skip to content

Commit

Permalink
MORTEVIELLE: Restore background area when a menu is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster authored and Strangerke committed Apr 6, 2012
1 parent d5326e6 commit 56ff300
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
18 changes: 18 additions & 0 deletions engines/mortevielle/menu.cpp
Expand Up @@ -30,6 +30,7 @@
#include "common/textconsole.h"
#include "mortevielle/level15.h"
#include "mortevielle/menu.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"
Expand Down Expand Up @@ -255,6 +256,11 @@ void menu_down(int ii) {
int xco, nb_lig;

/* debug('menu_down'); */

// Make a copy of the current screen surface for later restore
g_vm->_backgroundSurface.copyFrom(g_vm->_screenSurface);

// Draw the menu
xco = don[ii][1];
nb_lig = don[ii][4];
hide_mouse();
Expand Down Expand Up @@ -307,6 +313,18 @@ void menu_up(int xx) {
/* debug('menu_up'); */
if (test0) {
charecr(10, succ(byte, don[xx][2]) << 1);

/* Restore the background area */
assert(g_vm->_screenSurface.pitch == g_vm->_backgroundSurface.pitch);

// Get a pointer to the source and destination of the area to restore
const byte *pSrc = (const byte *)g_vm->_backgroundSurface.getBasePtr(0, 10);
Graphics::Surface destArea = g_vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT));
byte *pDest = (byte *)destArea.getBasePtr(0, 0);

// Copy the data
Common::copy(pSrc, pSrc + (400 - 10) * SCREEN_WIDTH, pDest);

test0 = false;
}
}
Expand Down
1 change: 1 addition & 0 deletions engines/mortevielle/mortevielle.h
Expand Up @@ -64,6 +64,7 @@ class MortevielleEngine : public Engine {
public:
ScreenSurface _screenSurface;
PaletteManager _paletteManager;
GfxSurface _backgroundSurface;
public:
MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc);
~MortevielleEngine();
Expand Down
15 changes: 9 additions & 6 deletions engines/mortevielle/var_mor.cpp
Expand Up @@ -319,20 +319,23 @@ char get_ch() {
return g_vm->getChar();
}

/**
* Restore a screen sectio
*/
void s_sauv(int Gd, int y, int dy) {
// Note: May no longer be necessary, since the backgorund restore code
// is being handled slightly differently now in the menu_up() method
}

void palette(int v1) {
warning("TODO: s_sauv");
warning("TODO: palette");
}

// (* external 'c:\mc\charecr.com'; *)
void s_char(int Gd, int y, int dy) {
warning("TODO: s_char");
}

// (* external 'c:\mc\sauvecr.com'; *)
void s_sauv(int Gd, int y, int dy) {
warning("TODO: s_sauv");
}

// (* external 'c:\mc\boite.com'; *)
void box(int c, int Gd, int xo, int yo, int xi, int yi, int patt) {
debugC(1, kMortevielleCore, "TODO: box deprecated in favour of GfxSurface::fillBox");
Expand Down

0 comments on commit 56ff300

Please sign in to comment.