[Scummvm-cvs-logs] SF.net SVN: scummvm: [28707] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Aug 24 14:05:05 CEST 2007


Revision: 28707
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28707&view=rev
Author:   thebluegr
Date:     2007-08-24 05:05:05 -0700 (Fri, 24 Aug 2007)

Log Message:
-----------
Code cleanup for the IHNM demo

Modified Paths:
--------------
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/gfx.cpp
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/scene.cpp
    scummvm/trunk/engines/saga/scene.h

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2007-08-24 11:44:18 UTC (rev 28706)
+++ scummvm/trunk/engines/saga/animation.cpp	2007-08-24 12:05:05 UTC (rev 28707)
@@ -312,12 +312,13 @@
 		_vm->_interface->restoreMode();
 		
 		if (_vm->getGameId() != GID_IHNM_DEMO) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) {
+			_vm->_gfx->showCursor(true);
+		} else {
+			if (_vm->_scene->isNonInteractiveIHNMDemoPart()) {
 				// Don't show the mouse cursor in the non-interactive part of the IHNM demo
 			} else {
 				_vm->_gfx->showCursor(true);
 			}
-		} else {
 			// Enable the save reminder state after each cutaway for the IHNM demo
 			_vm->_interface->setSaveReminderState(true);
 		}

Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp	2007-08-24 11:44:18 UTC (rev 28706)
+++ scummvm/trunk/engines/saga/gfx.cpp	2007-08-24 12:05:05 UTC (rev 28707)
@@ -462,6 +462,10 @@
 }
 
 void Gfx::showCursor(bool state) {
+	// Don't show the mouse cursor in the non-interactive part of the IHNM demo
+	if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+		state = false;
+
 	CursorMan.showMouse(state);
 }
 

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2007-08-24 11:44:18 UTC (rev 28706)
+++ scummvm/trunk/engines/saga/interface.cpp	2007-08-24 12:05:05 UTC (rev 28707)
@@ -351,15 +351,6 @@
 		draw();
 	}
 
-	if (_vm->getGameId() != GID_IHNM_DEMO) {
-		_vm->_gfx->showCursor(true);
-	} else {		
-		if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) {
-			// Don't show the mouse cursor in the non-interactive part of the IHNM demo
-		} else {
-			_vm->_gfx->showCursor(true);
-		}
-	}
 	return SUCCESS;
 }
 
@@ -406,9 +397,6 @@
 		if (_vm->getGameId() == GID_IHNM_DEMO) {
 			_inMainMode = true;
 			_saveReminderState = 1;
-			if ((_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) ||
-				_vm->_scene->currentSceneNumber() == 0 || _vm->_scene->currentSceneNumber() == -1)
-				_vm->_gfx->showCursor(false);
 		}
 	} else if (mode == kPanelOption) {
 		// Show the cursor in the IHNM demo
@@ -512,10 +500,8 @@
 			return true;
 		}
 
-		if (_vm->getGameId() == GID_IHNM_DEMO) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-				_vm->_scene->showIHNMDemoSpecialScreen();
-		}
+		if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+			_vm->_scene->showIHNMDemoSpecialScreen();
 		break;
 	case kPanelCutaway:
 		if (ascii == 27) { // Esc
@@ -525,10 +511,8 @@
 			return true;
 		}
 
-		if (_vm->getGameId() == GID_IHNM_DEMO) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-				_vm->_scene->showIHNMDemoSpecialScreen();
-		}
+		if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+			_vm->_scene->showIHNMDemoSpecialScreen();
 		break;
 	case kPanelVideo:
 		if (ascii == 27) { // Esc
@@ -542,10 +526,8 @@
 			return true;
 		}
 
-		if (_vm->getGameId() == GID_IHNM_DEMO) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-				_vm->_scene->showIHNMDemoSpecialScreen();
-		}
+		if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+			_vm->_scene->showIHNMDemoSpecialScreen();
 		break;
 	case kPanelOption:
 		// TODO: check input dialog keys
@@ -1553,11 +1535,8 @@
 		} else {
 			if (_vm->_scene->currentChapterNumber() == 8) {
 				setMode(kPanelChapterSelection);
-			} else if (_vm->getGameId() == GID_IHNM_DEMO) {
-				if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-					setMode(kPanelNull);
-				else
-					setMode(kPanelMain);
+			} else if (_vm->_scene->isNonInteractiveIHNMDemoPart()) {
+				setMode(kPanelNull);
 			} else {
 				setMode(kPanelMain);
 			}
@@ -1577,11 +1556,9 @@
 		}
 		break;
 	case kTextSave:
-		// Disallow saving in the non-interactive part of the IHNM demo
-		if (_vm->getGameId() == GID_IHNM_DEMO) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-				return;
-		}
+		// Disallow saving in the non-interactive part of the IHNM demo (original demo didn't support saving at all)
+		if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+			return;
 
 		if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0)) {
 			_textInputString[0] = 0;
@@ -1800,10 +1777,8 @@
 		break;
 
 	case kPanelNull:
-		if (_vm->getGameId() == GID_IHNM_DEMO && (updateFlag & UPDATE_MOUSECLICK)) {
-			if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
-				_vm->_scene->showIHNMDemoSpecialScreen();
-		}
+		if (_vm->_scene->isNonInteractiveIHNMDemoPart() && (updateFlag & UPDATE_MOUSECLICK))
+			_vm->_scene->showIHNMDemoSpecialScreen();
 		break;
 	}
 

Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp	2007-08-24 11:44:18 UTC (rev 28706)
+++ scummvm/trunk/engines/saga/scene.cpp	2007-08-24 12:05:05 UTC (rev 28707)
@@ -655,7 +655,7 @@
 
 	debug(3, "Loading scene number %d:", _sceneNumber);
 
-	if (_vm->getGameId() == GID_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149)) {
+	if (isNonInteractiveIHNMDemoPart()) {
 		// WORKAROUND for the non-interactive part of the IHNM demo: When restarting the 
 		// non-interactive demo, opcode sfMainMode is incorrectly called. Therefore, if any
 		// of the scenes of the non-interactive demo are loaded (scenes 144-149), set panel 

Modified: scummvm/trunk/engines/saga/scene.h
===================================================================
--- scummvm/trunk/engines/saga/scene.h	2007-08-24 11:44:18 UTC (rev 28706)
+++ scummvm/trunk/engines/saga/scene.h	2007-08-24 12:05:05 UTC (rev 28707)
@@ -345,6 +345,10 @@
 	void clearPsychicProfile();
 	void showIHNMDemoSpecialScreen();
 
+	bool isNonInteractiveIHNMDemoPart() {
+		return _vm->getGameId() == GID_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149);
+	}
+
  private:
 	void loadScene(LoadSceneParams *loadSceneParams);
 	void loadSceneDescriptor(uint32 resourceId);


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