[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.80,1.81 script_v8.cpp,2.143,2.144 scumm.h,1.159,1.160 scummvm.cpp,2.61,2.62

Pawel Kolodziejski aquadran at users.sourceforge.net
Mon Mar 17 04:34:36 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv8824

Modified Files:
	script_v6.cpp script_v8.cpp scumm.h scummvm.cpp 
Log Message:
split waitForTimer func, update for smush,
btw, switching scalers while playing smush movies doesn't work or at least SDL backend,
it hang on SDL_SetVideo func

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- script_v6.cpp	9 Mar 2003 15:35:19 -0000	1.80
+++ script_v6.cpp	17 Mar 2003 12:32:45 -0000	1.81
@@ -30,8 +30,7 @@
 #include "sound.h"
 #include "verbs.h"
 #include <time.h>
-#include "smush/player.h"
-#include "smush/scumm_renderer.h"
+#include "smush/smush_player.h"
 
 #include "sound/mididrv.h"
 
@@ -2337,11 +2336,8 @@
 
 				debug(1, "INSANE Arg: %d", args[1]);
 
-				ScummRenderer *sr = new ScummRenderer(this, speed);
-				SmushPlayer *sp = new SmushPlayer(sr);
-				
-				if (_noSubtitles)
-					sp->hide("subtitles");
+				SmushPlayer *sp = new SmushPlayer(this, speed, !_noSubtitles);
+
 				// INSANE mode 0: SMUSH movie playback
 				if (args[1] == 0) {
 					sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
@@ -2378,7 +2374,7 @@
 									putState(235, 1);	   // Cheat and activate Ramp
 									writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan)
 								}
-//								sp->play("minefite.san", getGameDataPath());
+//								smush->play("minefite.san", getGameDataPath());
 							break;
 						}
 						case 4:
@@ -2403,7 +2399,6 @@
 					sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
 				}
 				delete sp;
-				delete sr;
 			}
 			break;
 		case 7:

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.143
retrieving revision 2.144
diff -u -d -r2.143 -r2.144
--- script_v8.cpp	15 Mar 2003 21:28:22 -0000	2.143
+++ script_v8.cpp	17 Mar 2003 12:32:45 -0000	2.144
@@ -27,8 +27,7 @@
 #include "sound.h"
 #include "verbs.h"
 
-#include "smush/player.h"
-#include "smush/scumm_renderer.h"
+#include "smush/smush_player.h"
 
 #include <time.h>
 
@@ -1334,16 +1333,9 @@
 	
 	warning("o8_startVideo(%s/%s)", getGameDataPath(), (char*)_scriptPointer);
 	
-	ScummRenderer * sr = new ScummRenderer(this, 83333);
-	SmushPlayer * sp = new SmushPlayer(sr);
-
-	if (_noSubtitles)
-		sp->hide("subtitles");
-	
+	SmushPlayer *sp = new SmushPlayer(this, 83333, !_noSubtitles);
 	sp->play((char*)_scriptPointer, getGameDataPath());
-	
 	delete sp;
-	delete sr;
 
 	_scriptPointer += len + 1;
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- scumm.h	13 Mar 2003 02:23:55 -0000	1.159
+++ scumm.h	17 Mar 2003 12:32:46 -0000	1.160
@@ -257,7 +257,7 @@
 
 class Scumm : public Engine {
 	friend class ScummDebugger;
-	friend class ScummRenderer;	// FIXME - this is mostly for the destructor
+	friend class SmushPlayer;
 	void errorString(const char *buf_input, char *buf_output);
 public:
 	/* Put often used variables at the top.
@@ -321,6 +321,7 @@
 	int scummLoop(int delta);
 
 	// Event handling
+	void parseEvents();
 	void waitForTimer(int msec_delay);
 	void processKbd();
 	int checkKeyHit();
@@ -341,6 +342,7 @@
 	int _smushFrameRate;
 	bool _insaneState;
 	bool _videoFinished;
+	bool _smushPlay;
 	
 	void pauseGame(bool user);
 	void shutDown(int i);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.61
retrieving revision 2.62
diff -u -d -r2.61 -r2.62
--- scummvm.cpp	9 Mar 2003 02:41:35 -0000	2.61
+++ scummvm.cpp	17 Mar 2003 12:32:46 -0000	2.62
@@ -1147,12 +1147,18 @@
 	bool old_soundsPaused = _sound->_soundsPaused;
 	_sound->pauseSounds(true);
 
+	// Pause playing smush movie
+	_smushPlay = false;
+
 	// Open & run the dialog
 	int result = dialog->runModal();
 
 	// Restore old cursor
 	updateCursor();
 
+	// Restore playing smush movie
+	_smushPlay = true;
+
 	// Resume sound output
 	_sound->pauseSounds(old_soundsPaused);
 	
@@ -1496,89 +1502,95 @@
 }
 
 void Scumm::waitForTimer(int msec_delay) {
-	OSystem::Event event;
 	uint32 start_time;
 
-	if (_fastMode&2)
+	if (_fastMode & 2)
 		msec_delay = 0;
-	else if (_fastMode&1)
+	else if (_fastMode & 1)
 		msec_delay = 10;
 
 	start_time = _system->get_msecs();
 
-	for(;;) {
-		while (_system->poll_event(&event)) {
+	for (;;) {
+		parseEvents();
 
-			switch(event.event_code) {
-			case OSystem::EVENT_KEYDOWN:
-				if (event.kbd.keycode >= '0' && event.kbd.keycode<='9'
-					&& (event.kbd.flags == OSystem::KBD_ALT ||
-						event.kbd.flags == OSystem::KBD_CTRL)) {
-					_saveLoadSlot = event.kbd.keycode - '0';
+		_sound->updateCD(); // Loop CD Audio if needed
+		if (_system->get_msecs() >= start_time + msec_delay)
+			break;
+		_system->delay_msecs(10);
+	}
+}
 
-					//  don't overwrite autosave (slot 0)
-					if (_saveLoadSlot == 0)
-						_saveLoadSlot = 10;
+void Scumm::parseEvents() {
+	OSystem::Event event;
 
-					sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
-					_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
-					_saveLoadCompatible = false;
-				} else if (event.kbd.flags==OSystem::KBD_CTRL) {
-					if (event.kbd.keycode=='f')
-						_fastMode ^= 1;
-					else if (event.kbd.keycode=='g')
-						_fastMode ^= 2;
-					else if ((event.kbd.keycode=='d') && (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)))
-						g_debugger.attach(this);
-					else if (event.kbd.keycode=='s')
-						resourceStats();
-					else
-						_keyPressed = event.kbd.ascii;	// Normal key press, pass on to the game.
-				} else if (event.kbd.flags & OSystem::KBD_ALT) {
-					// The result must be 273 for Alt-W
-					// because that's what MI2 looks for in
-					// its "instant win" cheat.
-					_keyPressed = event.kbd.keycode + 154;
-				} else 
+	while (_system->poll_event(&event)) {
+
+		switch(event.event_code) {
+		case OSystem::EVENT_KEYDOWN:
+			if (event.kbd.keycode >= '0' && event.kbd.keycode<='9'
+				&& (event.kbd.flags == OSystem::KBD_ALT ||
+					event.kbd.flags == OSystem::KBD_CTRL)) {
+				_saveLoadSlot = event.kbd.keycode - '0';
+
+				//  don't overwrite autosave (slot 0)
+				if (_saveLoadSlot == 0)
+					_saveLoadSlot = 10;
+
+				sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
+				_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
+				_saveLoadCompatible = false;
+			} else if (event.kbd.flags==OSystem::KBD_CTRL) {
+				if (event.kbd.keycode == 'f')
+					_fastMode ^= 1;
+				else if (event.kbd.keycode == 'g')
+					_fastMode ^= 2;
+				else if ((event.kbd.keycode == 'd') && (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)))
+					g_debugger.attach(this);
+				else if (event.kbd.keycode == 's')
+					resourceStats();
+				else
 					_keyPressed = event.kbd.ascii;	// Normal key press, pass on to the game.
-				break;
+			} else if (event.kbd.flags & OSystem::KBD_ALT) {
+				// The result must be 273 for Alt-W
+				// because that's what MI2 looks for in
+				// its "instant win" cheat.
+				_keyPressed = event.kbd.keycode + 154;
+			} else 
+				_keyPressed = event.kbd.ascii;	// Normal key press, pass on to the game.
+			break;
 
-			case OSystem::EVENT_MOUSEMOVE:
-				mouse.x = event.mouse.x;
-				mouse.y = event.mouse.y;
-				_system->set_mouse_pos(event.mouse.x, event.mouse.y);
-				_system->update_screen();
-				break;
+		case OSystem::EVENT_MOUSEMOVE:
+			mouse.x = event.mouse.x;
+			mouse.y = event.mouse.y;
+			_system->set_mouse_pos(event.mouse.x, event.mouse.y);
+			_system->update_screen();
+			break;
 
-			case OSystem::EVENT_LBUTTONDOWN:
-				_leftBtnPressed |= msClicked|msDown;
+		case OSystem::EVENT_LBUTTONDOWN:
+			_leftBtnPressed |= msClicked|msDown;
 #ifdef _WIN32_WCE
-				mouse.x = event.mouse.x;
-				mouse.y = event.mouse.y;
+			mouse.x = event.mouse.x;
+			mouse.y = event.mouse.y;
 #endif
-				break;
+			break;
 
-			case OSystem::EVENT_RBUTTONDOWN:
-				_rightBtnPressed |= msClicked|msDown;
+		case OSystem::EVENT_RBUTTONDOWN:
+			_rightBtnPressed |= msClicked|msDown;
 #ifdef _WIN32_WCE
-				mouse.x = event.mouse.x;
-				mouse.y = event.mouse.y;
+			mouse.x = event.mouse.x;
+			mouse.y = event.mouse.y;
 #endif
-				break;
+			break;
 
-			case OSystem::EVENT_LBUTTONUP:
-				_leftBtnPressed &= ~msDown;
-				break;
+		case OSystem::EVENT_LBUTTONUP:
+			_leftBtnPressed &= ~msDown;
+			break;
 
-			case OSystem::EVENT_RBUTTONUP:
-				_rightBtnPressed &= ~msDown;
-				break;
-			}
-		}
-		_sound->updateCD(); // Loop CD Audio if needed
-		if (_system->get_msecs() >= start_time + msec_delay)
+		case OSystem::EVENT_RBUTTONUP:
+			_rightBtnPressed &= ~msDown;
 			break;
-		_system->delay_msecs(10);
+		}
 	}
 }
 





More information about the Scummvm-git-logs mailing list