[Scummvm-cvs-logs] CVS: scummvm/sword2 build_display.cpp,1.61,1.62 controls.cpp,1.69,1.70 function.cpp,1.63,1.64 resman.cpp,1.94,1.95 sword2.h,1.63,1.64

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Jun 9 23:49:10 CEST 2004


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

Modified Files:
	build_display.cpp controls.cpp function.cpp resman.cpp 
	sword2.h 
Log Message:
If the 'time' parameter to displayMsg() is 0, wait until the user clicks
or presses a button. This is how displayMsg() was always used, so the only
difference is that the code to check for events is no longer outside the
function.

In the process, it turned out that removeMsg() was probably unnecessary so
I have removed it. May cause regressions, but we can deal with them later. 


Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/build_display.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- build_display.cpp	9 Jun 2004 06:33:27 -0000	1.61
+++ build_display.cpp	10 Jun 2004 06:48:50 -0000	1.62
@@ -115,7 +115,8 @@
 /**
  * Fades down and displays a message on the screen.
  * @param text The message
- * @param time The number of seconds to display the message
+ * @param time The number of seconds to display the message, or 0 to display it
+ *             until the user clicks the mouse or presses a key.
  */
 
 void Sword2Engine::displayMsg(byte *text, int time) {
@@ -171,27 +172,27 @@
 	free(text_spr);
 	_graphics->waitForFade();
 
-	uint32 targetTime = _system->get_msecs() + (time * 1000);
+	if (time > 0) {
+		uint32 targetTime = _system->get_msecs() + (time * 1000);
+		sleepUntil(targetTime);
+	} else {
+		while (!_quit) {
+			MouseEvent *me = mouseEvent();
+			if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN)))
+				break;
 
-	sleepUntil(targetTime);
-	_graphics->setPalette(0, 256, oldPal, RDPAL_FADE);
-	_graphics->fadeUp();
-}
+			if (keyboardEvent())
+				break;
 
-/**
- * Fades message down and removes it, fading up again afterwards
- */
+			_graphics->updateDisplay();
+			_system->delay_msecs(50);
+		}
+	}
 
-void Sword2Engine::removeMsg(void) {
 	_graphics->fadeDown();
 	_graphics->waitForFade();
-	_graphics->clearScene();
-
-	// _graphics->fadeUp();	
-	// removed by JEL (08oct97) to prevent "eye" smacker corruption when
-	// restarting game from CD2 and also to prevent palette flicker when
-	// restoring game to a different CD since the "insert CD" message uses
-	// this routine to clean up!
+	_graphics->setPalette(0, 256, oldPal, RDPAL_FADE);
+	_graphics->fadeUp();
 }
 
 void Sword2Engine::drawBackPar0Frames(void) {

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- controls.cpp	10 May 2004 07:11:40 -0000	1.69
+++ controls.cpp	10 Jun 2004 06:48:50 -0000	1.70
@@ -1164,8 +1164,6 @@
 	Button *_okButton;
 	Button *_cancelButton;
 
-	void saveLoadError(byte *text);
-
 public:
 	SaveLoadDialog(Gui *gui, int mode)
 		: Dialog(gui), _mode(mode), _selectedSlot(-1) {
@@ -1433,7 +1431,7 @@
 					break;
 				}
 
-				saveLoadError(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2);
+				_gui->_vm->displayMsg(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2, 0);
 				result = 0;
 			}
 		} else {
@@ -1454,7 +1452,7 @@
 					break;
 				}
 
-				saveLoadError(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2);
+				_gui->_vm->displayMsg(_gui->_vm->fetchTextLine(_gui->_vm->_resman->openResource(textId / SIZE), textId & 0xffff) + 2, 0);
 				result = 0;
 			} else {
 				// Prime system with a game cycle
@@ -1476,29 +1474,6 @@
 	}
 };
 
-void SaveLoadDialog::saveLoadError(byte* text) {
-	// Print a message on screen. Second parameter is duration.
-	_gui->_vm->displayMsg((byte *) text, 0);
-
-	// Wait for ESC or mouse click
-	while (1) {
-		_gui->_vm->_graphics->updateDisplay();
-
-		KeyboardEvent *ke = _gui->_vm->keyboardEvent();
-		if (ke && ke->keycode == 27)
-			break;
-
-		MouseEvent *me = _gui->_vm->mouseEvent();
-		if (me && (me->buttons & RD_LEFTBUTTONDOWN))
-			break;
-
-		_gui->_vm->_system->delay_msecs(20);
-	}
-
-	// Remove the message.
-	_gui->_vm->removeMsg();
-}
-
 Gui::Gui(Sword2Engine *vm) : _vm(vm), _baseSlot(0) {
 	int i;
 

Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/function.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- function.cpp	9 Jun 2004 06:33:27 -0000	1.63
+++ function.cpp	10 Jun 2004 06:48:50 -0000	1.64
@@ -304,7 +304,6 @@
 
 	_vm->displayMsg(_vm->fetchTextLine(_vm->_resman->openResource(text_res), local_text) + 2, 3);
 	_vm->_resman->closeResource(text_res);
-	_vm->removeMsg();
 
 	return IR_CONT;
 }

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- resman.cpp	9 May 2004 13:32:03 -0000	1.94
+++ resman.cpp	10 Jun 2004 06:48:50 -0000	1.95
@@ -858,20 +858,6 @@
 	//
 	// CD1: "RBSII1" (or "PCF76" for the PCF76 version, whatever that is)
 	// CD2: "RBSII2"
-
-	while (1) {
-		MouseEvent *me = _vm->mouseEvent();
-		if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN)))
-			break;
-
-		if (_vm->keyboardEvent())
-			break;
-
-		_vm->_graphics->updateDisplay();
-		_vm->_system->delay_msecs(50);
-	}
-
-	_vm->removeMsg();
 }
 
 } // End of namespace Sword2

Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- sword2.h	10 Jun 2004 06:41:08 -0000	1.63
+++ sword2.h	10 Jun 2004 06:48:50 -0000	1.64
@@ -210,7 +210,6 @@
 	void resetRenderLists(void);
 	void buildDisplay(void);
 	void displayMsg(byte *text, int time);
-	void removeMsg(void);
 	void setFullPalette(int32 palRes);
 
 	int32 registerFrame(int32 *params);





More information about the Scummvm-git-logs mailing list