diff options
author | Filippos Karapetis | 2007-06-14 23:28:30 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-06-14 23:28:30 +0000 |
commit | 16a6dc45c0831b12a292c55d81fa013a432a03ae (patch) | |
tree | 08c3369c67a22f4f5305f9a1ea947999d8fb66e0 /engines | |
parent | ac1eea6265167c7356904054ffb5e5c322653317 (diff) | |
download | scummvm-rg350-16a6dc45c0831b12a292c55d81fa013a432a03ae.tar.gz scummvm-rg350-16a6dc45c0831b12a292c55d81fa013a432a03ae.tar.bz2 scummvm-rg350-16a6dc45c0831b12a292c55d81fa013a432a03ae.zip |
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
svn-id: r27404
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/animation.cpp | 29 | ||||
-rw-r--r-- | engines/saga/animation.h | 1 | ||||
-rw-r--r-- | engines/saga/console.cpp | 54 | ||||
-rw-r--r-- | engines/saga/console.h | 7 |
4 files changed, 82 insertions, 9 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index b3a711f560..11712a65f8 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -66,6 +66,8 @@ void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) { 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 @@ void Anim::playCutaway(int cut, bool fade) { 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 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) { 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::animInfo() { } } +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 diff --git a/engines/saga/animation.h b/engines/saga/animation.h index 687ef55bcb..8f23ae28a5 100644 --- a/engines/saga/animation.h +++ b/engines/saga/animation.h @@ -133,6 +133,7 @@ public: 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); diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp index 69e73d771b..1ba959f7d8 100644 --- a/engines/saga/console.cpp +++ b/engines/saga/console.cpp @@ -48,6 +48,7 @@ Console::Console(SagaEngine *vm) : GUI::Debugger() { // 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 @@ Console::Console(SagaEngine *vm) : GUI::Debugger() { #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 @@ bool Console::Cmd_AnimInfo(int argc, const char **argv) { 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 @@ bool Console::cmdSceneChange(int argc, const char **argv) { 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 @@ bool Console::cmdObjectMapInfo(int argc, const char **argv) { 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 diff --git a/engines/saga/console.h b/engines/saga/console.h index 3a730e0815..7bc210bdbc 100644 --- a/engines/saga/console.h +++ b/engines/saga/console.h @@ -41,11 +41,18 @@ private: 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; |