Skip to content

Commit

Permalink
FULLPIPE: Add a new debug command, "scene"
Browse files Browse the repository at this point in the history
This can be used to view the current scene, or teleport to another one
  • Loading branch information
bluegr committed Dec 25, 2013
1 parent 962e2fd commit 6bbec02
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
21 changes: 19 additions & 2 deletions engines/fullpipe/console.cpp
Expand Up @@ -20,12 +20,29 @@
*
*/

#include "fullpipe/constants.h"
#include "fullpipe/fullpipe.h"
#include "fullpipe/gameloader.h"
#include "fullpipe/scene.h"

namespace Fullpipe {

Console::Console(FullpipeEngine *vm) : GUI::Debugger() {
_vm = vm;
Console::Console(FullpipeEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("scene", WRAP_METHOD(Console, Cmd_Scene));
}

bool Console::Cmd_Scene(int argc, const char **argv) {
if (argc != 2) {
int sceneTag = _vm->_currentScene->_sceneId;
DebugPrintf("Current scene: %d (scene tag: %d)\n", _vm->getSceneFromTag(sceneTag), sceneTag);
DebugPrintf("Use %s <scene> to change the current scene\n", argv[0]);
return true;
} else {
int scene = _vm->convertScene(atoi(argv[1]));
_vm->_gameLoader->loadScene(scene);
_vm->_gameLoader->gotoScene(scene, TrubaLeft);
return false;
}
}

} // End of namespace Fullpipe
2 changes: 2 additions & 0 deletions engines/fullpipe/console.h
Expand Up @@ -33,6 +33,8 @@ class Console : public GUI::Debugger {

private:
FullpipeEngine *_vm;

bool Cmd_Scene(int argc, const char **argv);
};

} // End of namespace Fullpipe
Expand Down
1 change: 1 addition & 0 deletions engines/fullpipe/fullpipe.h
Expand Up @@ -238,6 +238,7 @@ class FullpipeEngine : public ::Engine {
Scene *accessScene(int sceneId);
void setSceneMusicParameters(GameVar *var);
int convertScene(int scene);
int getSceneFromTag(int tag);

NGIArchive *_currArchive;

Expand Down
9 changes: 9 additions & 0 deletions engines/fullpipe/scenes.cpp
Expand Up @@ -214,6 +214,15 @@ int FullpipeEngine::convertScene(int scene) {
return scenes[scene - 1];
}

int FullpipeEngine::getSceneFromTag(int tag) {
for (int i = 0; i < ARRAYSIZE(scenes); i++) {
if (scenes[i] == tag)
return i + 1;
}

return 1;
}

bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
GameVar *sceneVar;
Common::Point sceneDim;
Expand Down

0 comments on commit 6bbec02

Please sign in to comment.