mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
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
This commit is contained in:
parent
ac1eea6265
commit
16a6dc45c0
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user