mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
STARK: Add a console command allowing to change the current chapter
This commit is contained in:
parent
5c69f1e9e4
commit
a52dff53f2
@ -42,7 +42,10 @@ Console::Console() : GUI::Debugger() {
|
||||
registerCmd("dumpLevel", WRAP_METHOD(Console, Cmd_DumpLevel));
|
||||
registerCmd("dumpLocation", WRAP_METHOD(Console, Cmd_DumpLocation));
|
||||
registerCmd("listLocations", WRAP_METHOD(Console, Cmd_ListLocations));
|
||||
registerCmd("location", WRAP_METHOD(Console, Cmd_Location));
|
||||
registerCmd("chapter", WRAP_METHOD(Console, Cmd_Chapter));
|
||||
registerCmd("changeLocation", WRAP_METHOD(Console, Cmd_ChangeLocation));
|
||||
registerCmd("changeChapter", WRAP_METHOD(Console, Cmd_ChangeChapter));
|
||||
}
|
||||
|
||||
Console::~Console() {
|
||||
@ -173,4 +176,52 @@ bool Console::Cmd_ChangeLocation(int argc, const char **argv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Console::Cmd_ChangeChapter(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
debugPrintf("Change the current chapter.\n");
|
||||
debugPrintf("Usage :\n");
|
||||
debugPrintf("changeChapter [value]\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 value = atoi(argv[1]);
|
||||
|
||||
Global *global = StarkServices::instance().global;
|
||||
global->setCurrentChapter(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::Cmd_Location(int argc, const char **argv) {
|
||||
if (argc != 1) {
|
||||
debugPrintf("Display the current location.\n");
|
||||
debugPrintf("Usage :\n");
|
||||
debugPrintf("location\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
Global *global = StarkServices::instance().global;
|
||||
Current *current = global->getCurrent();
|
||||
|
||||
debugPrintf("location: %02x %02x\n", current->getLevel()->getIndex(), current->getLocation()->getIndex());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Console::Cmd_Chapter(int argc, const char **argv) {
|
||||
if (argc != 1) {
|
||||
debugPrintf("Display the current chapter.\n");
|
||||
debugPrintf("Usage :\n");
|
||||
debugPrintf("chapter\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
Global *global = StarkServices::instance().global;
|
||||
int32 value = global->getCurrentChapter();
|
||||
|
||||
debugPrintf("chapter: %d\n", value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
@ -42,7 +42,10 @@ private:
|
||||
bool Cmd_DumpLevel(int argc, const char **argv);
|
||||
bool Cmd_DumpLocation(int argc, const char **argv);
|
||||
bool Cmd_ListLocations(int argc, const char** argv);
|
||||
bool Cmd_Location(int argc, const char **argv);
|
||||
bool Cmd_Chapter(int argc, const char **argv);
|
||||
bool Cmd_ChangeLocation(int argc, const char **argv);
|
||||
bool Cmd_ChangeChapter(int argc, const char **argv);
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
@ -44,4 +44,10 @@ int32 Global::getCurrentChapter() {
|
||||
return chapter->getIntegerValue();
|
||||
}
|
||||
|
||||
void Global::setCurrentChapter(int32 value) {
|
||||
KnowledgeSet *globalState = _level->findChildWithSubtype<KnowledgeSet>(KnowledgeSet::kState);
|
||||
Knowledge *chapter = globalState->findChildWithIndex<Knowledge>(0);
|
||||
chapter->setIntegerValue(value);
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
|
||||
/** Retrieve the current chapter number from the global resource tree */
|
||||
int32 getCurrentChapter();
|
||||
|
||||
/** Change the current chapter */
|
||||
void setCurrentChapter(int32 value);
|
||||
private:
|
||||
uint _millisecondsPerGameloop;
|
||||
Root *_root;
|
||||
|
@ -115,6 +115,7 @@ Common::Error StarkEngine::run() {
|
||||
_resourceProvider->initGlobal();
|
||||
|
||||
// Start us up at the house of all worlds
|
||||
_global->setCurrentChapter(0);
|
||||
_resourceProvider->requestLocationChange(0x45, 0x00);
|
||||
|
||||
// Start running
|
||||
|
Loading…
x
Reference in New Issue
Block a user