From 4dc6aa2d93a3e166891713549d73c4e40fe9f4f2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 8 Jan 2017 20:20:47 +0200 Subject: CHEWY: Add console command to change scenes --- engines/chewy/console.cpp | 15 +++++++++++++++ engines/chewy/console.h | 1 + engines/chewy/scene.cpp | 2 +- engines/chewy/scene.h | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/chewy/console.cpp b/engines/chewy/console.cpp index cb2d5e21c1..6fbd99278f 100644 --- a/engines/chewy/console.cpp +++ b/engines/chewy/console.cpp @@ -26,6 +26,7 @@ #include "chewy/console.h" #include "chewy/graphics.h" #include "chewy/resource.h" +#include "chewy/scene.h" #include "chewy/sound.h" #include "chewy/text.h" @@ -43,6 +44,7 @@ Console::Console(ChewyEngine *vm) : GUI::Debugger(), _vm(vm) { registerCmd("error_message", WRAP_METHOD(Console, Cmd_ErrorMessage)); registerCmd("dialog", WRAP_METHOD(Console, Cmd_Dialog)); registerCmd("text", WRAP_METHOD(Console, Cmd_Text)); + registerCmd("scene", WRAP_METHOD(Console, Cmd_Scene)); } Console::~Console() { @@ -235,4 +237,17 @@ bool Console::Cmd_Text(int argc, const char **argv) { return true; } +bool Console::Cmd_Scene(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("Current scene is: %d\n", _vm->_scene->getCurScene()); + debugPrintf("Use scene to change the scene\n"); + return true; + } + + int sceneNum = atoi(argv[1]); + _vm->_scene->change(sceneNum); + + return false; +} + } // End of namespace Chewy diff --git a/engines/chewy/console.h b/engines/chewy/console.h index 4953480644..ae2be15f30 100644 --- a/engines/chewy/console.h +++ b/engines/chewy/console.h @@ -48,6 +48,7 @@ private: bool Cmd_ErrorMessage(int argc, const char **argv); bool Cmd_Dialog(int argc, const char **argv); bool Cmd_Text(int argc, const char **argv); + bool Cmd_Scene(int argc, const char **argv); }; } // End of namespace Chewy diff --git a/engines/chewy/scene.cpp b/engines/chewy/scene.cpp index c6c12fc3ff..0f12219078 100644 --- a/engines/chewy/scene.cpp +++ b/engines/chewy/scene.cpp @@ -177,7 +177,7 @@ void Scene::loadSceneInfo() { for (int i = 0; i < MAX_HOTSPOTS; i++) { _sceneInfo->hotspotDescRes[i] = indexFile.readUint16LE(); - if (_sceneInfo->hotspotDescRes[i] < kATSTextMax) { + if (_sceneInfo->hotspotDescRes[i] < 12) { // TODO: Hotspot description IDs are off... investigate why _sceneInfo->hotspotDesc[i] = text->getText(_curScene + kADSTextMax, _sceneInfo->hotspotDescRes[i])->text; } else { diff --git a/engines/chewy/scene.h b/engines/chewy/scene.h index 24692c8486..c5b87ac7ae 100644 --- a/engines/chewy/scene.h +++ b/engines/chewy/scene.h @@ -37,6 +37,9 @@ public: void change(uint scene); void draw(); void updateMouse(Common::Point coords); + uint getCurScene() const { + return _curScene; + } private: void loadSceneInfo(); -- cgit v1.2.3