From 10c96babbcba734ab6bd8273d1a6ebff58018dd3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Jul 2015 20:17:02 -0400 Subject: SHERLOCK: Debugger locations command to show all locations on the map --- engines/sherlock/debugger.cpp | 11 +++++++++++ engines/sherlock/debugger.h | 9 +++++++++ engines/sherlock/scalpel/scalpel_map.cpp | 13 +++++++++++++ engines/sherlock/tattoo/tattoo_map.cpp | 13 ++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) (limited to 'engines/sherlock') diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp index 7806cc8c1f..2813a7eb69 100644 --- a/engines/sherlock/debugger.cpp +++ b/engines/sherlock/debugger.cpp @@ -40,10 +40,13 @@ Debugger *Debugger::init(SherlockEngine *vm) { } Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) { + _showAllLocations = LOC_DISABLED; + registerCmd("continue", WRAP_METHOD(Debugger, cmdExit)); registerCmd("scene", WRAP_METHOD(Debugger, cmdScene)); registerCmd("song", WRAP_METHOD(Debugger, cmdSong)); registerCmd("dumpfile", WRAP_METHOD(Debugger, cmdDumpFile)); + registerCmd("locations", WRAP_METHOD(Debugger, cmdLocations)); } void Debugger::postEnter() { @@ -124,4 +127,12 @@ bool Debugger::cmdDumpFile(int argc, const char **argv) { return true; } +bool Debugger::cmdLocations(int argc, const char **argv) { + _showAllLocations = LOC_REFRESH; + + debugPrintf("Now showing all map locations\n"); + return false; +} + + } // End of namespace Sherlock diff --git a/engines/sherlock/debugger.h b/engines/sherlock/debugger.h index eec2579ca4..abc8ef012d 100644 --- a/engines/sherlock/debugger.h +++ b/engines/sherlock/debugger.h @@ -30,6 +30,8 @@ namespace Sherlock { class SherlockEngine; +enum AllLocations { LOC_REFRESH = -1, LOC_DISABLED = 0, LOC_ALL = 1 }; + class Debugger : public GUI::Debugger { private: /** @@ -51,9 +53,16 @@ private: * Dumps a file to disk */ bool cmdDumpFile(int argc, const char **argv); + + /** + * Show all locations on the map + */ + bool cmdLocations(int argc, const char **argv); protected: SherlockEngine *_vm; Common::String _3doPlayMovieFile; +public: + AllLocations _showAllLocations; public: Debugger(SherlockEngine *vm); virtual ~Debugger() {} diff --git a/engines/sherlock/scalpel/scalpel_map.cpp b/engines/sherlock/scalpel/scalpel_map.cpp index 6da52e687f..369822ba02 100644 --- a/engines/sherlock/scalpel/scalpel_map.cpp +++ b/engines/sherlock/scalpel/scalpel_map.cpp @@ -122,6 +122,7 @@ void ScalpelMap::loadData() { } int ScalpelMap::show() { + Debugger &debugger = *_vm->_debugger; Events &events = *_vm->_events; People &people = *_vm->_people; Screen &screen = *_vm->_screen; @@ -175,6 +176,11 @@ int ScalpelMap::show() { events.pollEventsAndWait(); events.setButtonState(); + if (debugger._showAllLocations == LOC_REFRESH) { + showPlaces(); + screen.slamArea(screen._currentScroll.x, screen._currentScroll.y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_WIDTH); + } + // Keyboard handling if (events.kbHit()) { Common::KeyState keyState = events.getKey(); @@ -342,12 +348,16 @@ void ScalpelMap::freeSprites() { } void ScalpelMap::showPlaces() { + Debugger &debugger = *_vm->_debugger; Screen &screen = *_vm->_screen; for (uint idx = 0; idx < _points.size(); ++idx) { const MapEntry &pt = _points[idx]; if (pt.x != 0 && pt.y != 0) { + if (debugger._showAllLocations != LOC_DISABLED) + _vm->setFlagsDirect(idx); + if (pt.x >= _bigPos.x && (pt.x - _bigPos.x) < SHERLOCK_SCREEN_WIDTH && pt.y >= _bigPos.y && (pt.y - _bigPos.y) < SHERLOCK_SCREEN_HEIGHT) { if (_vm->readFlags(idx)) { @@ -357,6 +367,9 @@ void ScalpelMap::showPlaces() { } } } + + if (debugger._showAllLocations == LOC_REFRESH) + debugger._showAllLocations = LOC_ALL; } void ScalpelMap::saveTopLine() { diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp index f7af0f47f3..b60ac3aa8b 100644 --- a/engines/sherlock/tattoo/tattoo_map.cpp +++ b/engines/sherlock/tattoo/tattoo_map.cpp @@ -49,6 +49,7 @@ TattooMap::TattooMap(SherlockEngine *vm) : Map(vm), _mapTooltip(vm) { } int TattooMap::show() { + Debugger &debugger = *_vm->_debugger; Events &events = *_vm->_events; Music &music = *_vm->_music; Resources &res = *_vm->_res; @@ -129,6 +130,11 @@ int TattooMap::show() { events.setButtonState(); Common::Point mousePos = events.screenMousePos(); + if (debugger._showAllLocations == LOC_REFRESH) { + drawMapIcons(); + screen.slamArea(screen._currentScroll.x, screen._currentScroll.y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_WIDTH); + } + checkMapNames(true); if (mousePos.x < (SHERLOCK_SCREEN_WIDTH / 6)) @@ -290,10 +296,12 @@ void TattooMap::loadData() { } void TattooMap::drawMapIcons() { + Debugger &debugger = *_vm->_debugger; Screen &screen = *_vm->_screen; for (uint idx = 0; idx < _data.size(); ++idx) { - _vm->setFlagsDirect(idx + 1); + if (debugger._showAllLocations != LOC_DISABLED) + _vm->setFlagsDirect(idx + 1); if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) { MapEntry &mapEntry = _data[idx]; @@ -302,6 +310,9 @@ void TattooMap::drawMapIcons() { mapEntry.y - img._height / 2)); } } + + if (debugger._showAllLocations == LOC_REFRESH) + debugger._showAllLocations = LOC_ALL; } void TattooMap::checkMapNames(bool slamIt) { -- cgit v1.2.3