[Scummvm-cvs-logs] CVS: residual driver.h,1.13,1.14 driver_gl.cpp,1.56,1.57 driver_gl.h,1.26,1.27 driver_tinygl.cpp,1.27,1.28 driver_tinygl.h,1.14,1.15 engine.cpp,1.84,1.85 engine.h,1.32,1.33 lua.cpp,1.150,1.151

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Aug 13 04:34:11 CEST 2005


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13906

Modified Files:
	driver.h driver_gl.cpp driver_gl.h driver_tinygl.cpp 
	driver_tinygl.h engine.cpp engine.h lua.cpp 
Log Message:
get rid custom menu handler, and back original script handling, some changes in main loop(not finished)
still need finish few funcs for menu

Index: driver.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- driver.h	10 Aug 2005 08:33:45 -0000	1.13
+++ driver.h	13 Aug 2005 11:33:12 -0000	1.14
@@ -83,6 +83,8 @@
 	virtual void drawDepthBitmap(int x, int y, int w, int h, char *data) = 0;
 
 	virtual Bitmap *getScreenshot(int w, int h) = 0;
+	virtual void storeDisplay() = 0;
+	virtual void flushStoredDisplay() = 0;
 	virtual void enableDim(int x, int y, int w, int h) = 0;
 	virtual void disableDim(int x, int y, int w, int h) = 0;
 
@@ -102,6 +104,7 @@
 	int _screenWidth, _screenHeight, _screenBPP;
 	bool _isFullscreen;
 	bool _dim;
+	byte *_storedDisplay;
 
 	virtual void drawDim() = 0;
 };

Index: driver_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- driver_gl.cpp	10 Aug 2005 08:33:45 -0000	1.56
+++ driver_gl.cpp	13 Aug 2005 11:33:12 -0000	1.57
@@ -47,6 +47,7 @@
 	loadEmergFont();
 
 	_smushNumTex = 0;
+	_storedDisplay = NULL;
 }
 
 void DriverGL::toggleFullscreenMode() {

Index: driver_gl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_gl.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- driver_gl.h	10 Aug 2005 08:33:45 -0000	1.26
+++ driver_gl.h	13 Aug 2005 11:33:12 -0000	1.27
@@ -66,6 +66,8 @@
 	void drawBitmap();
 
 	Bitmap *getScreenshot(int w, int h);
+	void storeDisplay() {}
+	void flushStoredDisplay() {}
 	void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
 	void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
 

Index: driver_tinygl.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- driver_tinygl.cpp	12 Aug 2005 13:51:09 -0000	1.27
+++ driver_tinygl.cpp	13 Aug 2005 11:33:12 -0000	1.28
@@ -107,6 +107,8 @@
 
 	_zb = ZB_open(screenW, screenH, ZB_MODE_5R6G5B, 0, NULL, NULL, _screen->pixels);
 	tglInit(_zb);
+
+	_storedDisplay = NULL;
 }
 
 DriverTinyGL::~DriverTinyGL() {
@@ -286,13 +288,12 @@
 }
 
 void DriverTinyGL::createBitmap(Bitmap *bitmap) {
-	if (bitmap->_format == 1) {
-	} else {
+	if (bitmap->_format != 1) {
 		for (int pic = 0; pic < bitmap->_numImages; pic++) {
-			uint16 *zbufPtr = reinterpret_cast<uint16 *>(bitmap->_data[pic]);
+			uint16 *bufPtr = reinterpret_cast<uint16 *>(bitmap->_data[pic]);
 			for (int i = 0; i < (bitmap->_width * bitmap->_height); i++) {
 				uint16 val = READ_LE_UINT16(bitmap->_data[pic] + 2 * i);
-				zbufPtr[i] = ((uint32) val) * 0x10000 / 100 / (0x10000 - val);
+				bufPtr[i] = ((uint32) val) * 0x10000 / 100 / (0x10000 - val);
 			}
 		}
 	}
@@ -488,6 +489,17 @@
 	return screenshot;
 }
 
+void DriverTinyGL::storeDisplay() {
+	_storedDisplay = new byte[640 * 480 * 2];
+	assert(_storedDisplay);
+	memcpy(_storedDisplay, _zb->pbuf, 640 * 480 * 2);
+}
+
+void DriverTinyGL::flushStoredDisplay() {
+	delete []_storedDisplay;
+	_storedDisplay = NULL;
+}
+
 void DriverTinyGL::drawDim() {
 }
 

Index: driver_tinygl.h
===================================================================
RCS file: /cvsroot/scummvm/residual/driver_tinygl.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- driver_tinygl.h	10 Aug 2005 14:45:23 -0000	1.14
+++ driver_tinygl.h	13 Aug 2005 11:33:12 -0000	1.15
@@ -68,6 +68,8 @@
 	void drawBitmap();
 
 	Bitmap *getScreenshot(int w, int h);
+	void storeDisplay();
+	void flushStoredDisplay();
 	void enableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = true; }
 	void disableDim(int /*x*/, int /*y*/, int /*w*/, int /*h*/) { _dim = false; }
 

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- engine.cpp	13 Aug 2005 06:49:40 -0000	1.84
+++ engine.cpp	13 Aug 2005 11:33:12 -0000	1.85
@@ -96,23 +96,6 @@
 	// If we're not supposed to handle the key then don't
 	if (!_controlsEnabled[key])
 		return;
-	
-	lua_beginblock();
-	lua_Object menu = getEventHandler("menuHandler");
-	if (menu != LUA_NOOBJECT && !lua_isnil(menu)) {
-		lua_Object system_table = lua_getglobal("system");
-		lua_pushobject(system_table);
-		lua_pushstring(const_cast<char *>("userPaintHandler"));
-		lua_pushobject(lua_gettable());
-		lua_pushnumber(key);
-		if (operation == SDL_KEYDOWN)
-			lua_pushnil();
-		else
-			lua_pushnumber(1);
-		lua_pushnil();
-		lua_callfunction(menu);
-	}
-	lua_endblock();
 
 	lua_beginblock();
 	lua_Object handler = getEventHandler("buttonHandler");
@@ -128,6 +111,82 @@
 	lua_endblock();
 }
 
+void Engine::updateScreen() {
+	g_driver->clearScreen();
+
+	// Update actor costumes & sets
+	for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
+		Actor *a = *i;
+
+		// Update the actor's costumes & chores
+		g_currentUpdatedActor = *i;
+		// Note that the actor need not be visible to update chores, for example:
+		// when Manny has just brought Meche back he is offscreen several times
+		// when he needs to perform certain chores
+		if (_currScene != NULL && a->inSet(_currScene->name()))
+			a->update();
+	}
+	g_currentUpdatedActor = NULL;
+
+	if (_currScene != NULL) {
+		_currScene->drawBackground();
+	}
+
+	// Draw underlying scene components
+	if (_currScene != NULL) {
+		// Background objects are drawn underneath everything except the background
+		// There are a bunch of these, especially in the tube-switcher room
+		_currScene->drawBitmaps(ObjectState::OBJSTATE_BACKGROUND);
+		// Underlay objects are just above the background
+		_currScene->drawBitmaps(ObjectState::OBJSTATE_UNDERLAY);
+		// State objects are drawn on top of other things, such as the flag
+		// on Manny's message tube
+		_currScene->drawBitmaps(ObjectState::OBJSTATE_STATE);
+	}
+
+	// Play SMUSH Animations
+	// This should occur on top of all underlying scene objects,
+	// a good example is the tube switcher room where some state objects
+	// need to render underneath the animation or you can't see what's going on
+	// This should not occur on top of everything though or Manny gets covered
+	// up when he's next to Glottis's service room
+	if (g_smush->isPlaying()) {
+		_movieTime = g_smush->getMovieTime();
+		if (g_smush->isUpdateNeeded()) {
+			g_driver->prepareSmushFrame(g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr());
+			g_smush->clearUpdateNeeded();
+		}
+		if (g_smush->getFrame() > 0)
+			g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY());
+	}
+
+	if (_currScene != NULL) {
+		_currScene->setupCamera();
+	}
+
+	g_driver->set3DMode();
+
+	if (_currScene != NULL) {
+		_currScene->setupLights();
+	}
+
+	// Draw actors
+	for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
+		Actor *a = *i;
+		if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
+			a->draw();
+		if (_currScene != NULL)
+			a->undraw(a->inSet(_currScene->name()) && a->visible());
+	}
+
+	// Draw overlying scene components
+	if (_currScene != NULL) {
+		// The overlay objects should be drawn on top of everything else,
+		// including 3D objects such as Manny and the message tube
+		_currScene->drawBitmaps(ObjectState::OBJSTATE_OVERLAY);
+	}
+}
+
 void Engine::mainLoop() {
 	_movieTime = 0;
 	_frameTime = 0;
@@ -200,19 +259,11 @@
 						g_driver->toggleFullscreenMode();
 				}
 				if (event.key.keysym.sym == SDLK_q) {
-					lua_Object menu = getEventHandler("menuHandler");
-					
-					// Can't handle the exit menu on top of the normal one
-					// at this time, so exit flat-out if we're in a menu
-					if (lua_isnil(menu)) {
-						printf("NOTICE: The left/right arrow keys do not update the quit screen at this time, use Y/N keys instead!\n");
-						lua_beginblock();
-						lua_Object handler = getEventHandler("exitHandler");
-						if (handler != LUA_NOOBJECT)
-							lua_callfunction(handler);
-						lua_endblock();
-					} else
-						return;
+					lua_beginblock();
+					lua_Object handler = getEventHandler("exitHandler");
+					if (handler != LUA_NOOBJECT)
+						lua_callfunction(handler);
+					lua_endblock();
 				}
 			}
 		}
@@ -224,13 +275,6 @@
 			savegameSave();
 		}
 
-		// It appears that the lua tasks should run before rendering,
-		// if you watch the game loading screen you'll see that it
-		// turns out better to run this beforehand
-		if (!_menuMode)
-			// Run asynchronous tasks
-			lua_runtasks();
-
 		bool doFlip = true;
 
 		if (_mode == ENGINE_MODE_SMUSH) {
@@ -243,7 +287,6 @@
 				int frame = g_smush->getFrame();
 				if (frame > 0) {
 					if (frame != prevSmushFrame) {
-						prevSmushFrame = g_smush->getFrame();
 						g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY());
 						if (SHOWFPS_GLOBAL)
 							g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255));
@@ -253,83 +296,13 @@
 			}
 		} else if (_mode == ENGINE_MODE_NORMAL) {
 			prevSmushFrame = 0;
-			g_driver->clearScreen();
-
-			// Update actor costumes & sets
-			for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
-				Actor *a = *i;
-				
-				// Update the actor's costumes & chores
-				g_currentUpdatedActor = *i;
-				// Note that the actor need not be visible to update chores, for example:
-				// when Manny has just brought Meche back he is offscreen several times
-				// when he needs to perform certain chores
-				if (_currScene != NULL && a->inSet(_currScene->name()))
-					a->update();
-			}
-			g_currentUpdatedActor = NULL;
-
-			if (_currScene != NULL) {
-				_currScene->drawBackground();
-			}
-
-			// Draw underlying scene components
-			if (_currScene != NULL) {
-				// Background objects are drawn underneath everything except the background
-				// There are a bunch of these, especially in the tube-switcher room
-				_currScene->drawBitmaps(ObjectState::OBJSTATE_BACKGROUND);
-				// Underlay objects are just above the background
-				_currScene->drawBitmaps(ObjectState::OBJSTATE_UNDERLAY);
-				// State objects are drawn on top of other things, such as the flag
-				// on Manny's message tube
-				_currScene->drawBitmaps(ObjectState::OBJSTATE_STATE);
-			}
-
-			// Play SMUSH Animations
-			// This should occur on top of all underlying scene objects,
-			// a good example is the tube switcher room where some state objects
-			// need to render underneath the animation or you can't see what's going on
-			// This should not occur on top of everything though or Manny gets covered
-			// up when he's next to Glottis's service room
-			if (g_smush->isPlaying()) {
-				_movieTime = g_smush->getMovieTime();
-				if (g_smush->isUpdateNeeded()) {
-					g_driver->prepareSmushFrame(g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr());
-					g_smush->clearUpdateNeeded();
-				}
-				if (g_smush->getFrame() > 0)
-					g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY());
-			}
-
-			if (SHOWFPS_GLOBAL)
-				g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255));
-
-			if (_currScene != NULL) {
-				_currScene->setupCamera();
-			}
-
-			g_driver->set3DMode();
-
-			if (_currScene != NULL) {
-				_currScene->setupLights();
-			}
-
-			// Draw actors
-			for (ActorListType::iterator i = _actors.begin(); i != _actors.end(); i++) {
-				Actor *a = *i;
-				if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
-					a->draw();
-				if (_currScene != NULL)
-					a->undraw(a->inSet(_currScene->name()) && a->visible());
-			}
-
-			// Draw overlying scene components
-			if (_currScene != NULL) {
-				// The overlay objects should be drawn on top of everything else,
-				// including 3D objects such as Manny and the message tube
-				_currScene->drawBitmaps(ObjectState::OBJSTATE_OVERLAY);
-			}
-
+			updateScreen();
+		} else if (_mode == ENGINE_MODE_DRAW) {
+			lua_beginblock();
+			lua_Object drawHandler = getEventHandler("userPaintHandler");
+			if (drawHandler != LUA_NOOBJECT)
+				lua_callfunction(drawHandler);
+			lua_endblock();
 		}
 
 		// Draw Primitives
@@ -347,8 +320,11 @@
 		g_imuse->flushTracks();
 		g_imuse->refreshScripts();
 
+		if (SHOWFPS_GLOBAL)
+			g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255));
+
 		if (doFlip)
-			g_driver->flipBuffer();
+				g_driver->flipBuffer();
 
 		// don't kill CPU
 		SDL_Delay(1);
@@ -372,6 +348,9 @@
 		setMovieTime(_movieTime);
 		lua_endblock();
 
+		// Run asynchronous tasks
+		lua_runtasks();
+
 		if (SHOWFPS_GLOBAL && doFlip) {
 			frameCounter++;
 			timeAccum += _frameTime;

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- engine.h	10 Aug 2005 05:30:58 -0000	1.32
+++ engine.h	13 Aug 2005 11:33:12 -0000	1.33
@@ -98,6 +98,8 @@
 	void setSpeechMode(int mode) { _speechMode = mode; }
 	int getSpeechMode() { return _speechMode; }
 
+	void updateScreen();
+
 	void mainLoop();
 	unsigned frameStart() const { return _frameStart; }
 	unsigned frameTime() const { return _frameTime; }

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- lua.cpp	12 Aug 2005 13:51:10 -0000	1.150
+++ lua.cpp	13 Aug 2005 11:33:12 -0000	1.151
@@ -2314,204 +2314,6 @@
 		error("Unable to push exit event!");
 }
 
-/* This function acts as a wrapper around the actual
- * cancel operation, which fails if the second parameter
- * passed to it is not 'nil'
- */
-static void cancelHandler() {
-	lua_Object menuTable, cancelFunction;
-	
-	stubWarning("cancelHandler");
-	menuTable = lua_getparam(1);
-	cancelFunction = getTableValue(menuTable, "cancel_orig");
-	lua_pushobject(menuTable);
-	lua_pushnil();
-	lua_callfunction(cancelFunction);
-}
-
-/* This function provides all of the menu
- * handling that has been observed
- */
-static void menuHandler() {
-	lua_Object menuTable, keycode, pushcode, itemTable/*, item*/;
-	int menuItem = 1, menuItems = 1, sliderValue = 0;
-	int key, operation;
-
-	DEBUG_FUNCTION();
-	menuTable = lua_getparam(1);
-	keycode = lua_getparam(2);
-	pushcode = lua_getparam(3);
-	
-	if (!lua_isnumber(keycode) || !lua_istable(menuTable))
-		return;
-	if (lua_isnil(pushcode))
-		operation = 0;
-	else
-		return;
-
-	// get the keycode
-	key = atoi(lua_getstring(keycode));
-
-	// handle hotkeys
-	if (key >= SDLK_a && key <= SDLK_z) {
-		char keychar[2];
-
-		lua_Object handler = getTableFunction(menuTable, "characterHandler");
-		lua_beginblock();
-		lua_pushobject(menuTable);
-		keychar[0] = key;
-		keychar[1] = '\0';
-		lua_pushstring(keychar);
-		lua_pushnil();
-		lua_callfunction(handler);
-		lua_endblock();
-		key = 0;
-		return; // stop processing (we don't need to handle normal keystrokes)
-	}
-	
-	// Handle the correct type of menu
-	if (!lua_isnil(getTableValue(menuTable, "menu"))) {
-		// Get the item list for most menus
-		itemTable = getTableValue(menuTable, "menu");
-	} else if (!lua_isnil(getTableValue(menuTable, "active_menu"))) {
-		// 3D Acceleration Menu
-		itemTable = getTableValue(menuTable, "active_menu");
-	} else if (!lua_isnil(getTableValue(menuTable, "num_choices"))) {
-		// Exit Menu
-		lua_Object currentChoice = getTableValue(menuTable, "current_choice");
-		int num_choices = atoi(lua_getstring(getTableValue(menuTable, "num_choices")));
-		int current_choice;
-		
-		if (lua_isnil(currentChoice))
-			return; // if the current choice is 'nil' then there are no choices
-		current_choice = atoi(lua_getstring(currentChoice));
-		
-		if (key == SDLK_RIGHT)
-			current_choice++;
-		else if (key == SDLK_LEFT)
-			current_choice--;
-		
-		if (current_choice < 0)
-			current_choice = 0;
-		else if (current_choice >= num_choices)
-			current_choice = num_choices-1;
-		
-		setTableValue(menuTable, "current_choice", current_choice);
-		// TODO: Need to figure out how to update the screen under this
-		// type of menu operation!
-		return;
-	} else if (lua_isfunction(getTableValue(menuTable, "next_page"))
-	 || lua_isfunction(getTableValue(menuTable, "prev_page"))) {
-		// Control Help menu
-		lua_Object nextPage = getTableValue(menuTable, "next_page");
-		lua_Object prevPage = getTableValue(menuTable, "prev_page");
-		
-		if (lua_isfunction(nextPage) && key == SDLK_RIGHT) {
-			lua_beginblock();
-			lua_pushobject(menuTable);
-			lua_callfunction(nextPage);
-			lua_endblock();
-		} else if (lua_isfunction(prevPage) && key == SDLK_LEFT) {
-			lua_beginblock();
-			lua_pushobject(menuTable);
-			lua_callfunction(prevPage);
-			lua_endblock();
-		}
-		return;
-	} else {
-		warning("Unhandled type of menu!");
-		return;
-	}
-	
-	if (lua_isnil(getTableValue(menuTable, "cancel_orig"))) {
-		lua_Object cancelFunction = getTableValue(menuTable, "cancel");
-		// Install Alternative Cancel Handler
-		lua_pushobject(menuTable);
-		lua_pushstring(const_cast<char *>("cancel"));
-		lua_pushcfunction(cancelHandler);
-		lua_settable();
-		// Store the old Cancel Handler
-		lua_pushobject(menuTable);
-		lua_pushstring(const_cast<char *>("cancel_orig"));
-		lua_pushobject(cancelFunction);
-		lua_settable();
-	}
-
-	// get the current item
-	menuItem = atoi(lua_getstring(getTableValue(itemTable, "cur_item")));
-	menuItems = atoi(lua_getstring(getTableValue(itemTable, "num_items")));
-
-	// hack the "&Return to Game" command so it actually works
-	if (key == SDLK_RETURN && strmatch(itemText(itemTable, menuItem), "/sytx247/"))
-		key = SDLK_ESCAPE;
-
-	/* if we're running the menu then we need to manually handle
-	 * a lot of the operations necessary to use the menu
-	 */
-	bool menuChanged = false;
-	switch (key) {
-		case SDLK_ESCAPE:
-		{
-			// only use ESC to exit the main menu 
-			if (lua_isnil(getTableFunction(menuTable, "return_to_game")))
-				return;
-
-			lua_Object close = getTableFunction(menuTable, "cancel");
-
-			lua_beginblock();
-			lua_pushobject(menuTable);
-			lua_pushnil();
-			lua_callfunction(close);
-			lua_endblock();
-			break;
-		}
-		case SDLK_DOWN:
-			do {
-				menuItem++;
-				if (menuItem > menuItems) {
-					menuItem = 1;
-					break;
-				}
-			} while (itemDisabled(itemTable, menuItem));
-			menuChanged = true;
-			break;
-		case SDLK_UP:
-			do {
-				menuItem--;
-				if (menuItem < 1) {
-					menuItem = menuItems;
-					break;
-				}
-			} while (itemDisabled(itemTable, menuItem));
-			menuChanged = true;
-			break;
-		case SDLK_LEFT:
-			sliderValue = -1;
-			break;
-		case SDLK_RIGHT:
-			sliderValue = 1;
-			break;
-		case SDLK_RETURN:
-			// Allow the return key to act as a "slide right" operation,
-			// this actually isn't supposed to do anything for normal
-			// sliders but handling more is better than less.
-			sliderValue = 1;
-			break;
-	}
-	if (menuChanged)
-		setTableValue(itemTable, "cur_item", menuItem);
-	if (sliderValue != 0) {
-		lua_Object change = getTableFunction(menuTable, "change_value");
-		lua_beginblock();
-		lua_pushobject(menuTable);
-		lua_pushnil();
-		lua_pushnumber(sliderValue);
-		lua_pushnil();
-		lua_callfunction(change);
-		lua_endblock();
-	}
-}
-
 /* Check for an existing object by a certain name
  * this function is used by several functions that look
  * for text objects to see if they need to be created/modified/destroyed.
@@ -3144,10 +2946,9 @@
 }
 
 static void RenderModeUser() {
-	// it enable/disable updating display
 	lua_Object param1;
 	bool mode;
-	
+
 	DEBUG_FUNCTION();
 	param1 = lua_getparam(1);
 	if (lua_isnumber(param1)) {
@@ -3157,51 +2958,31 @@
 	} else {
 		error("RenderModeUser() Unknown type of param");
 	}
-	g_engine->setMenuMode(mode);
-	if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
-	{
-		if (mode)
-			printf("RenderModeUser() Enable\n");
-		else
-			printf("RenderModeUser() Disable\n");
+	if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
+		if (mode) {
+			g_engine->setMode(ENGINE_MODE_DRAW);
+		} else {
+			g_engine->setMode(ENGINE_MODE_NORMAL);
+		}
 	}
 }
 
-/* For now this should just destroy any text
- * objects that have been created and unlink
- * the menu (this may be more appropriate under
- * RenderModeUser, determine later)
- */
 static void SetGamma() {
-	lua_Object system_table = lua_getglobal("system");
-	
-	// TODO: Make this un-dim the screen
+	DEBUG_FUNCTION();
+
 	stubWarning("SetGamma");
-	
-	CleanBuffer();
-	// Un-Install Menu Key Handler
-	lua_pushobject(system_table);
-	lua_pushstring(const_cast<char *>("menuHandler"));
-	lua_pushnil();
-	lua_settable();
 }
 
 static void Display() {
-	lua_Object system_table;
-	
 	DEBUG_FUNCTION();
-	system_table = lua_getglobal("system");
-	// Install Menu Key Handler
-	lua_pushobject(system_table);
-	lua_pushstring(const_cast<char *>("menuHandler"));
-	lua_pushcfunction(menuHandler);
-	lua_settable();
+
+	g_engine->updateScreen();
 }
 
 static void EngineDisplay() {
 	lua_Object param1;
 	bool mode;
-	
+
 	// it enable/disable updating display
 	DEBUG_FUNCTION();
 	param1 = lua_getparam(1);
@@ -3213,10 +2994,11 @@
 		error("EngineDisplay() Unknown type of param");
 	}
 	if (debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
-		if (mode)
+		if (mode) {
 			printf("EngineDisplay() Enable\n");
-		else
+		} else {
 			printf("EngineDisplay() Disable\n");
+		}
 	}
 }
 





More information about the Scummvm-git-logs mailing list