[Scummvm-cvs-logs] SF.net SVN: scummvm:[54633] scummvm/trunk/engines/mohawk

bgk at users.sourceforge.net bgk at users.sourceforge.net
Mon Nov 29 22:00:06 CET 2010


Revision: 54633
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54633&view=rev
Author:   bgk
Date:     2010-11-29 21:00:05 +0000 (Mon, 29 Nov 2010)

Log Message:
-----------
MOHAWK: Persistent scripts cleanup
- Rename InitOpcodes / PersistentOpcodes to Persistent Scripts for consistency
- Get rid of the global var used to tell if the sound receiver script is running

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/console.cpp
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst_scripts.h
    scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp
    scummvm/trunk/engines/mohawk/myst_scripts_myst.h
    scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp
    scummvm/trunk/engines/mohawk/myst_scripts_selenitic.h

Modified: scummvm/trunk/engines/mohawk/console.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/console.cpp	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/console.cpp	2010-11-29 21:00:05 UTC (rev 54633)
@@ -267,7 +267,7 @@
 		return true;
 	}
 
-	_vm->_scriptParser->disableInitOpcodes();
+	_vm->_scriptParser->disablePersistentScripts();
 
 	return true;
 }

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2010-11-29 21:00:05 UTC (rev 54633)
@@ -285,7 +285,7 @@
 	while (!shouldQuit()) {
 		// Update any background videos
 		_needsUpdate = _video->updateBackgroundMovies();
-		_scriptParser->runPersistentOpcodes();
+		_scriptParser->runPersistentScripts();
 
 		// Run animations...
 		for (uint16 i = 0; i < _resources.size(); i++)
@@ -419,7 +419,7 @@
 void MohawkEngine_Myst::changeToCard(uint16 card, bool updateScreen) {
 	debug(2, "changeToCard(%d)", card);
 
-	_scriptParser->disableInitOpcodes();
+	_scriptParser->disablePersistentScripts();
 
 	_video->stopVideos();
 

Modified: scummvm/trunk/engines/mohawk/myst_scripts.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.h	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst_scripts.h	2010-11-29 21:00:05 UTC (rev 54633)
@@ -69,8 +69,8 @@
 	const char *getOpcodeDesc(uint16 op);
 	MystScript readScript(Common::SeekableReadStream *stream, MystScriptType type);
 
-	virtual void disableInitOpcodes() = 0;
-	virtual void runPersistentOpcodes() = 0;
+	virtual void disablePersistentScripts() = 0;
+	virtual void runPersistentScripts() = 0;
 
 	virtual uint16 getVar(uint16 var);
 	virtual void toggleVar(uint16 var);

Modified: scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp	2010-11-29 21:00:05 UTC (rev 54633)
@@ -204,7 +204,7 @@
 	_opcodeCount = ARRAYSIZE(myst_opcodes);
 }
 
-void MystScriptParser_Myst::disableInitOpcodes() {
+void MystScriptParser_Myst::disablePersistentScripts() {
 	opcode_200_disable();
 	opcode_201_disable();
 	opcode_202_disable();
@@ -218,7 +218,7 @@
 	opcode_212_disable();
 }
 
-void MystScriptParser_Myst::runPersistentOpcodes() {
+void MystScriptParser_Myst::runPersistentScripts() {
 	opcode_200_run();
 	opcode_201_run();
 	opcode_202_run();

Modified: scummvm/trunk/engines/mohawk/myst_scripts_myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_myst.h	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst_scripts_myst.h	2010-11-29 21:00:05 UTC (rev 54633)
@@ -42,8 +42,8 @@
 	MystScriptParser_Myst(MohawkEngine_Myst *vm);
 	~MystScriptParser_Myst();
 
-	void disableInitOpcodes();
-	void runPersistentOpcodes();
+	void disablePersistentScripts();
+	void runPersistentScripts();
 
 private:
 	void setupOpcodes();

Modified: scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp	2010-11-29 21:00:05 UTC (rev 54633)
@@ -138,12 +138,13 @@
 	_opcodeCount = ARRAYSIZE(myst_opcodes);
 }
 
-void MystScriptParser_Selenitic::disableInitOpcodes() {
-	o_203_soundReceiver_disable();
+void MystScriptParser_Selenitic::disablePersistentScripts() {
+	_sound_receiver_running = false;
 }
 
-void MystScriptParser_Selenitic::runPersistentOpcodes() {
-	o_203_soundReceiver_run();
+void MystScriptParser_Selenitic::runPersistentScripts() {
+	if (_sound_receiver_running)
+		o_203_soundReceiver_run();
 }
 
 uint16 MystScriptParser_Selenitic::getVar(uint16 var) {
@@ -815,33 +816,27 @@
 		unknown(op, var, argc, argv);
 }
 
-static struct {
-	bool enabled;
-} g_opcode203Parameters;
-
 void MystScriptParser_Selenitic::o_203_soundReceiver_run(void) {
-	if (g_opcode203Parameters.enabled) {
-		if (_sound_receiver_start_time) {
-			if (_sound_receiver_direction) {
-				uint32 current_time = _vm->_system->getMillis();
+	if (_sound_receiver_start_time) {
+		if (_sound_receiver_direction) {
+			uint32 current_time = _vm->_system->getMillis();
 
-				if (_sound_receiver_speed == 50) {
-					if (current_time > _sound_receiver_start_time + 500) {
-						sound_receiver_increase_speed();
-					}
-				} else {
-					if (current_time > _sound_receiver_start_time + 1000) {
-						sound_receiver_increase_speed();
-					}
+			if (_sound_receiver_speed == 50) {
+				if (current_time > _sound_receiver_start_time + 500) {
+					sound_receiver_increase_speed();
 				}
-
-				if (current_time > _sound_receiver_start_time + 100) {
-					sound_receiver_update();
+			} else {
+				if (current_time > _sound_receiver_start_time + 1000) {
+					sound_receiver_increase_speed();
 				}
+			}
 
-			} else if (!_sound_receiver_sigma_pressed) {
-				sound_receiver_update_sound();
+			if (current_time > _sound_receiver_start_time + 100) {
+				sound_receiver_update();
 			}
+
+		} else if (!_sound_receiver_sigma_pressed) {
+			sound_receiver_update_sound();
 		}
 	}
 }
@@ -943,16 +938,13 @@
 	}
 }
 
-void MystScriptParser_Selenitic::o_203_soundReceiver_disable(void) {
-	g_opcode203Parameters.enabled = false;
-}
-
 void MystScriptParser_Selenitic::o_203_soundReceiver_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	uint16 *selenitic_vars = _vm->_saveLoad->_v->selenitic_vars;
+
 	debugC(kDebugScript, "Opcode %d: Sound receiver init", op);
 
 	// Used for Card 1245 (Sound Receiver)
-	g_opcode203Parameters.enabled = true;
-	uint16 *selenitic_vars = _vm->_saveLoad->_v->selenitic_vars;
+	_sound_receiver_running = true;
 
 	_sound_receiver_right_button = static_cast<MystResourceType8 *>(_vm->_resources[0]);
 	_sound_receiver_left_button = static_cast<MystResourceType8 *>(_vm->_resources[1]);

Modified: scummvm/trunk/engines/mohawk/myst_scripts_selenitic.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_selenitic.h	2010-11-29 20:59:44 UTC (rev 54632)
+++ scummvm/trunk/engines/mohawk/myst_scripts_selenitic.h	2010-11-29 21:00:05 UTC (rev 54633)
@@ -43,8 +43,8 @@
 	MystScriptParser_Selenitic(MohawkEngine_Myst *vm);
 	~MystScriptParser_Selenitic();
 
-	void disableInitOpcodes();
-	void runPersistentOpcodes();
+	void disablePersistentScripts();
+	void runPersistentScripts();
 
 private:
 	void setupOpcodes();
@@ -52,9 +52,6 @@
 	void toggleVar(uint16 var);
 	bool setVarValue(uint16 var, uint16 value);
 
-	void o_203_soundReceiver_run();
-	void o_203_soundReceiver_disable();
-
 	DECLARE_OPCODE(opcode_100);
 	DECLARE_OPCODE(opcode_101);
 	DECLARE_OPCODE(o_102_soundReceiverSigma);
@@ -77,6 +74,9 @@
 	DECLARE_OPCODE(opcode_205);
 	DECLARE_OPCODE(opcode_206);
 
+	void o_203_soundReceiver_run();
+
+	bool _sound_receiver_running;
 	bool _sound_receiver_sigma_pressed; // 6
 	MystResourceType8 *_sound_receiver_sources[5]; // 92 -> 108
 	MystResourceType8 *_sound_receiver_current_source; // 112


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list