[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.352,1.353 simon.h,1.104,1.105

Travis Howell kirben at users.sourceforge.net
Tue Dec 9 16:56:01 CET 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv30046/simon

Modified Files:
	simon.cpp simon.h 
Log Message:

Add puase option for simon games.


Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -d -r1.352 -r1.353
--- simon.cpp	9 Dec 2003 10:19:27 -0000	1.352
+++ simon.cpp	10 Dec 2003 00:54:52 -0000	1.353
@@ -313,6 +313,7 @@
 	_debugMode = 0;
 	_debugLevel = 0;
 	_language = 0;
+	_pause = 0;
 	_start_mainscript = 0;
 	_continous_mainscript = 0;
 	_continous_vgascript = 0;
@@ -3447,6 +3448,9 @@
 		if (_game & GF_SIMON2)
 			_exit_cutscene = true;
 		break;
+	case 'p':
+		pause();
+		break;
 	case 't':
 		if ((_game & GF_SIMON2 && _game & GF_TALKIE) || ( _game & GF_TALKIE && _language > 1))
 			if (_speech)
@@ -3495,6 +3499,18 @@
 	_key_pressed = 0;
 }
 
+void SimonEngine::pause() {
+	_key_pressed = 0;
+	_pause = 1;
+	for (;;) {
+		delay(1);
+		if (_key_pressed == 'p')
+			goto get_out;
+	}
+get_out:;
+	_pause = 0;
+}
+
 #ifdef __PALM_OS__
 static const byte *_simon1_cursor;
 #else
@@ -4741,7 +4757,7 @@
 
 	uint32 start = _system->get_msecs();
 	uint32 cur = start;
-	uint vga_period;
+	uint this_delay, vga_period;
 
 	if (_fast_mode)
 	 	vga_period = 10;
@@ -4753,7 +4769,7 @@
 	_rnd.getRandomNumber(2);
 
 	do {
-		while (!_in_callback && cur >= _last_vga_tick + vga_period) {
+		while (!_in_callback && cur >= _last_vga_tick + vga_period && !_pause) {
 			_last_vga_tick += vga_period;
 
 			// don't get too many frames behind
@@ -4808,7 +4824,7 @@
 			break;
 
 		{
-			uint this_delay = _fast_mode ? 1 : 20;
+			this_delay = _fast_mode ? 1 : 20;
 			if (this_delay > amount)
 				this_delay = amount;
 			_system->delay_msecs(this_delay);

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- simon.h	2 Dec 2003 08:28:54 -0000	1.104
+++ simon.h	10 Dec 2003 00:54:53 -0000	1.105
@@ -192,6 +192,7 @@
 
 	uint16 _debugMode;
 	uint16 _language;
+	bool _pause;
 	bool _start_mainscript;
 	bool _continous_mainscript;
 	bool _continous_vgascript;
@@ -778,6 +779,7 @@
 	void loadMusic(uint music);
 	void checkTimerCallback();
 	void delay(uint delay);
+	void pause();
 
 	void o_83_helper();
 	void o_190_helper(uint i);





More information about the Scummvm-git-logs mailing list