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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 15 01:28:31 CEST 2007


Revision: 27404
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27404&view=rev
Author:   thebluegr
Date:     2007-06-14 16:28:30 -0700 (Thu, 14 Jun 2007)

Log Message:
-----------
Added several console commands for SAGA. Also, fixed a regression in the IHNM introduction caused by commit #27357. Finally, animation IDs are checked for validity now, so ScummVM won't try to play invalid animations

Modified Paths:
--------------
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/animation.h
    scummvm/trunk/engines/saga/console.cpp
    scummvm/trunk/engines/saga/console.h

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2007-06-14 18:40:27 UTC (rev 27403)
+++ scummvm/trunk/engines/saga/animation.cpp	2007-06-14 23:28:30 UTC (rev 27404)
@@ -66,6 +66,8 @@
 	for (int i = 0; i < _cutawayListLength; i++) {
 		_cutawayList[i].backgroundResourceId = cutawayS.readUint16LE();
 		_cutawayList[i].animResourceId = cutawayS.readUint16LE();
+		if (_cutawayList[i].animResourceId == 0)
+			warning("Anim::loadCutawayList: Animation %i has an animResourceId equal to 0", i);
 		_cutawayList[i].cycles = cutawayS.readSint16LE();
 		_cutawayList[i].frameRate = cutawayS.readSint16LE();
 	}
@@ -160,6 +162,13 @@
 		warning("Could not allocate cutaway animation slot");
 		return;
 	}
+	
+	// FIXME: Some animations in IHNM have animResourceId equal to 0, for no obvious reason
+	// We skip them, to avoid ScummVM crashing
+	if (_cutawayList[cut].animResourceId == 0) {
+		warning("Anim::playCutaway: Animation %i has animResourceId equal to 0, skipping", cut);
+		return;
+	}
 
 	_vm->_resource->loadResource(context, _cutawayList[cut].animResourceId, resourceData, resourceDataLength);
 
@@ -388,12 +397,8 @@
 
 		if (anim->currentFrame > anim->maxFrame) {
 
-			if (_vm->_interface->getMode() == kPanelVideo) {
-				// Videos never loop
-				_vm->_frameCount++;	
-				anim->currentFrame++;
-			} else		
-				anim->currentFrame = anim->loopFrame;
+			anim->currentFrame = anim->loopFrame;
+			_vm->_frameCount++;	
 
 			if (anim->state == ANIM_STOPPING || anim->currentFrame == -1) {
 				anim->state = ANIM_PAUSE;
@@ -789,4 +794,16 @@
 	}
 }
 
+void Anim::cutawayInfo() {
+	uint16 i;
+
+	_vm->_console->DebugPrintf("There are %d cutaways loaded:\n", _cutawayListLength);
+
+	for (i = 0; i < _cutawayListLength; i++) {
+		_vm->_console->DebugPrintf("%02d: Bg res: %u Anim res: %u Cycles: %u Framerate: %u\n", i,
+			_cutawayList[i].backgroundResourceId, _cutawayList[i].animResourceId,
+			_cutawayList[i].cycles, _cutawayList[i].frameRate);
+	}
+}
+
 } // End of namespace Saga

Modified: scummvm/trunk/engines/saga/animation.h
===================================================================
--- scummvm/trunk/engines/saga/animation.h	2007-06-14 18:40:27 UTC (rev 27403)
+++ scummvm/trunk/engines/saga/animation.h	2007-06-14 23:28:30 UTC (rev 27404)
@@ -133,6 +133,7 @@
 	void setFrameTime(uint16 animId, int time);
 	void reset(void);
 	void animInfo(void);
+	void cutawayInfo(void);
 	void setCycles(uint16 animId, int cycles);
 	void stop(uint16 animId);
 	void finish(uint16 animId);

Modified: scummvm/trunk/engines/saga/console.cpp
===================================================================
--- scummvm/trunk/engines/saga/console.cpp	2007-06-14 18:40:27 UTC (rev 27403)
+++ scummvm/trunk/engines/saga/console.cpp	2007-06-14 23:28:30 UTC (rev 27404)
@@ -48,6 +48,7 @@
 
 	// Animation commands
 	DCmd_Register("anim_info",        WRAP_METHOD(Console, Cmd_AnimInfo));
+	DCmd_Register("cutaway_info",     WRAP_METHOD(Console, Cmd_CutawayInfo));
 
 	// Game stuff
 
@@ -62,9 +63,17 @@
 #endif
 
 	// Scene commands
-	DCmd_Register("scene_change",     WRAP_METHOD(Console, cmdSceneChange));
-	DCmd_Register("action_map_info",  WRAP_METHOD(Console, cmdActionMapInfo));
-	DCmd_Register("object_map_info",  WRAP_METHOD(Console, cmdObjectMapInfo));
+	DCmd_Register("current_scene",		WRAP_METHOD(Console, cmdCurrentScene));
+	DCmd_Register("current_chapter",	WRAP_METHOD(Console, cmdCurrentChapter));
+	DCmd_Register("scene_change",		WRAP_METHOD(Console, cmdSceneChange));
+	DCmd_Register("chapter_change",		WRAP_METHOD(Console, cmdChapterChange));
+
+	DCmd_Register("action_map_info",	WRAP_METHOD(Console, cmdActionMapInfo));
+	DCmd_Register("object_map_info",	WRAP_METHOD(Console, cmdObjectMapInfo));
+
+	// Panel commands
+	DCmd_Register("current_panel_mode",	WRAP_METHOD(Console, cmdCurrentPanelMode));
+	DCmd_Register("set_panel_mode",		WRAP_METHOD(Console, cmdSetPanelMode));
 }
 
 Console::~Console() {
@@ -84,6 +93,22 @@
 	return true;
 }
 
+bool Console::Cmd_CutawayInfo(int argc, const char **argv) {
+	_vm->_anim->cutawayInfo();
+	return true;
+}
+
+bool Console::cmdCurrentScene(int argc, const char **argv) {
+	DebugPrintf("Current Scene is: %i, scene resource id: %i\n", 
+		_vm->_scene->currentSceneNumber(), _vm->_scene->currentSceneResourceId());
+	return true;
+}
+
+bool Console::cmdCurrentChapter(int argc, const char **argv) {
+	DebugPrintf("Current Chapter is: %i\n", _vm->_scene->currentChapterNumber());
+	return true;
+}
+
 bool Console::cmdSceneChange(int argc, const char **argv) {
 	if (argc != 2)
 		DebugPrintf("Usage: %s <Scene number>\n", argv[0]);
@@ -92,6 +117,16 @@
 	return true;
 }
 
+bool Console::cmdChapterChange(int argc, const char **argv) {
+	if (argc != 3)
+		DebugPrintf("Usage: %s <Chapter number> <Scene number>\n", argv[0]);
+	else {
+		_vm->_scene->setChapterNumber(atoi(argv[2]));
+		_vm->_scene->cmdSceneChange(argc, argv);
+	}
+	return true;
+}
+
 bool Console::cmdActionMapInfo(int argc, const char **argv) {
 	_vm->_scene->cmdActionMapInfo();
 	return true;
@@ -102,4 +137,17 @@
 	return true;
 }
 
+bool Console::cmdCurrentPanelMode(int argc, const char **argv) {
+	DebugPrintf("Current Panel Mode is: %i\n", _vm->_interface->getMode());
+	return true;
+}
+
+bool Console::cmdSetPanelMode(int argc, const char **argv) {
+	if (argc != 2)
+		DebugPrintf("Usage: %s <Panel mode number>\n", argv[0]);
+	else
+		_vm->_interface->setMode(atoi(argv[1]));
+	return true;
+}
+
 } // End of namespace Saga

Modified: scummvm/trunk/engines/saga/console.h
===================================================================
--- scummvm/trunk/engines/saga/console.h	2007-06-14 18:40:27 UTC (rev 27403)
+++ scummvm/trunk/engines/saga/console.h	2007-06-14 23:28:30 UTC (rev 27404)
@@ -41,11 +41,18 @@
 	bool cmdActorWalkTo(int argc, const char **argv);
 
 	bool Cmd_AnimInfo(int argc, const char **argv);
+	bool Cmd_CutawayInfo(int argc, const char **argv);
 
+	bool cmdCurrentScene(int argc, const char **argv);
+	bool cmdCurrentChapter(int argc, const char **argv);
 	bool cmdSceneChange(int argc, const char **argv);
+	bool cmdChapterChange(int argc, const char **argv);
+
 	bool cmdActionMapInfo(int argc, const char **argv);
 	bool cmdObjectMapInfo(int argc, const char **argv);
 
+	bool cmdCurrentPanelMode(int argc, const char **argv);
+	bool cmdSetPanelMode(int argc, const char **argv);
 
 private:
 	SagaEngine *_vm;


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