[Scummvm-cvs-logs] SF.net SVN: scummvm: [24163] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Oct 7 13:55:00 CEST 2006


Revision: 24163
          http://svn.sourceforge.net/scummvm/?rev=24163&view=rev
Author:   fingolfin
Date:     2006-10-07 04:54:50 -0700 (Sat, 07 Oct 2006)

Log Message:
-----------
some HE related cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/intern_he.h
    scummvm/trunk/engines/scumm/input.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h

Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h	2006-10-07 08:38:31 UTC (rev 24162)
+++ scummvm/trunk/engines/scumm/he/intern_he.h	2006-10-07 11:54:50 UTC (rev 24163)
@@ -444,27 +444,32 @@
 	int32 _curSpriteId;
 	int32 _curSpriteGroupId;
 
+	LogicHE *_logicHE;
+	MoviePlayer *_moviePlay;
+	Sprite *_sprite;
+
 public:
 	ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
 	~ScummEngine_v90he();
 
-	virtual void resetScumm();
-
-	LogicHE *_logicHE;
-	MoviePlayer *_moviePlay;
-	Sprite *_sprite;
-
 protected:
 	virtual void allocateArrays();
 	virtual void setupOpcodes();
 	virtual void executeOpcode(byte i);
 	virtual const char *getOpcodeDesc(byte i);
 
-	virtual void scummLoop_handleDrawing();
+	virtual void resetScumm();
 
 	virtual void setupScummVars();
 	virtual void resetScummVars();
 
+	virtual int scummLoop(int delta);
+	virtual void scummLoop_handleDrawing();
+	virtual void runBootscript();
+
+	virtual void processKbd(bool smushMode);
+	virtual void clearClickedStatus();
+
 	virtual void saveOrLoad(Serializer *s);
 
 	virtual void readMAXS(int blockSize);

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2006-10-07 08:38:31 UTC (rev 24162)
+++ scummvm/trunk/engines/scumm/input.cpp	2006-10-07 11:54:50 UTC (rev 24163)
@@ -194,14 +194,25 @@
 	}
 }
 
-void ScummEngine::clearClickedStatus() {
-	_keyPressed = 0;
-
 #ifndef DISABLE_HE
+void ScummEngine_v90he::clearClickedStatus() {
+	ScummEngine::clearClickedStatus();
 	if (_game.heversion >= 98) {
-		((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
+		_logicHE->processKeyStroke(_keyPressed);
 	}
+}
+
+void ScummEngine_v90he::processKbd(bool smushMode) {
+	if (_game.heversion >= 98) {
+		_logicHE->processKeyStroke(_keyPressed);
+	}
+	ScummEngine::processKbd(smushMode);
+}
 #endif
+
+void ScummEngine::clearClickedStatus() {
+	_keyPressed = 0;
+
 	_mouseAndKeyboardStat = 0;
 	_leftBtnPressed &= ~msClicked;
 	_rightBtnPressed &= ~msClicked;
@@ -210,12 +221,6 @@
 void ScummEngine::processKbd(bool smushMode) {
 	int saveloadkey;
 
-#ifndef DISABLE_HE
-	if (_game.heversion >= 98) {
-		((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed);
-	}
-#endif
-
 	_lastKeyHit = _keyPressed;
 	_keyPressed = 0;
 	if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) {

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-10-07 08:38:31 UTC (rev 24162)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-10-07 11:54:50 UTC (rev 24163)
@@ -1534,21 +1534,8 @@
 
 	// If requested, load a save game instead of running the boot script
 	if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveTemporaryState)) {
-		int args[16];
-		memset(args, 0, sizeof(args));
-		args[0] = _bootParam;
-
 		_saveLoadFlag = 0;
-#ifndef DISABLE_HE
-		if (_game.heversion >= 98) {
-			((ScummEngine_v90he *)this)->_logicHE->initOnce();
-			((ScummEngine_v90he *)this)->_logicHE->beforeBootScript();
-		}
-#endif
-		if (_game.id == GID_MANIAC && (_game.features & GF_DEMO))
-			runScript(9, 0, 0, args);
-		else
-			runScript(1, 0, 0, args);
+		runBootscript();
 	} else {
 		_saveLoadFlag = 0;
 	}
@@ -1558,6 +1545,13 @@
 
 	while (!_quit) {
 
+		if (_debugger->isAttached())
+			_debugger->onFrame();
+	
+		// Randomize the PRNG by calling it at regular intervals. This ensures
+		// that it will be in a different state each time you run the program.
+		_rnd.getRandomNumber(2);
+	
 		diff -= _system->getMillis();
 		waitForTimer(delta * 15 + diff);
 		diff = _system->getMillis();
@@ -1595,21 +1589,6 @@
 }
 
 int ScummEngine::scummLoop(int delta) {
-	if (_debugger->isAttached())
-		_debugger->onFrame();
-
-	// Randomize the PRNG by calling it at regular intervals. This ensures
-	// that it will be in a different state each time you run the program.
-	_rnd.getRandomNumber(2);
-
-#ifndef DISABLE_HE
-	if (_game.heversion >= 90) {
-		((ScummEngine_v90he *)this)->_moviePlay->handleNextFrame();
-	}
-	if (_game.heversion >= 98) {
-		((ScummEngine_v90he *)this)->_logicHE->startOfFrame();
-	}
-#endif
 	if (_game.version >= 3) {
 		VAR(VAR_TMR_1) += delta;
 		VAR(VAR_TMR_2) += delta;
@@ -1783,21 +1762,30 @@
 	/* show or hide mouse */
 	CursorMan.showMouse(_cursor.state > 0);
 
+	if (VAR_TIMER != 0xFF)
+		VAR(VAR_TIMER) = 0;
+	return (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
+
+}
+
 #ifndef DISABLE_HE
-	if (_game.heversion >= 90) {
-		((ScummEngine_v90he *)this)->_sprite->updateImages();
+int ScummEngine_v90he::scummLoop(int delta) {
+	_moviePlay->handleNextFrame();
+	if (_game.heversion >= 98) {
+		_logicHE->startOfFrame();
 	}
+
+	int ret = ScummEngine::scummLoop(delta);
+	
+	_sprite->updateImages();
 	if (_game.heversion >= 98) {
-		((ScummEngine_v90he *)this)->_logicHE->endOfFrame();
+		_logicHE->endOfFrame();
 	}
+	
+	return ret;
+}
 #endif
 
-	if (VAR_TIMER != 0xFF)
-		VAR(VAR_TIMER) = 0;
-	return (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
-
-}
-
 void ScummEngine::scummLoop_updateScummVars() {
 	if (_game.features & GF_NEW_CAMERA) {
 		VAR(VAR_CAMERA_POS_X) = camera._cur.x;
@@ -2031,6 +2019,10 @@
 		_sound->setupSound();
 
 	// Re-run bootscript
+	runBootscript();
+}
+
+void ScummEngine::runBootscript() {
 	int args[16];
 	memset(args, 0, sizeof(args));
 	args[0] = _bootParam;
@@ -2040,6 +2032,17 @@
 		runScript(1, 0, 0, args);
 }
 
+#ifndef DISABLE_HE
+void ScummEngine_v90he::runBootscript() {
+	if (_game.heversion >= 98) {
+		_logicHE->initOnce();
+		_logicHE->beforeBootScript();
+	}
+
+	ScummEngine::runBootscript();
+}
+#endif
+
 void ScummEngine::startManiac() {
 	debug(0, "stub startManiac()");
 	displayMessage(0, "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.");

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-10-07 08:38:31 UTC (rev 24162)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-10-07 11:54:50 UTC (rev 24163)
@@ -481,23 +481,24 @@
 	void setTalkspeed(int talkspeed);
 	int getTalkspeed();
 
-protected:
 	// Scumm main loop & helper functions.
-	int scummLoop(int delta);
+	virtual int scummLoop(int delta);
 	virtual void scummLoop_updateScummVars();
 	virtual void scummLoop_handleSaveLoad();
 	virtual void scummLoop_handleDrawing();
 	virtual void scummLoop_handleActors() = 0;
 	virtual void scummLoop_handleEffects();
 	virtual void scummLoop_handleSound();
+	
+	virtual void runBootscript();
 
 	// Event handling
 public:
 	void parseEvents();	// Used by IMuseDigital::startSound
 protected:
 	void waitForTimer(int msec_delay);
-	void processKbd(bool smushMode);
-	void clearClickedStatus();
+	virtual void processKbd(bool smushMode);
+	virtual void clearClickedStatus();
 
 	// Cursor/palette
 	void updateCursor();


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