diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/debugger.cpp | 57 | ||||
-rw-r--r-- | engines/voyeur/debugger.h | 18 | ||||
-rw-r--r-- | engines/voyeur/events.cpp | 23 | ||||
-rw-r--r-- | engines/voyeur/events.h | 5 |
4 files changed, 103 insertions, 0 deletions
diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp index 546691b3f0..8fdcf20823 100644 --- a/engines/voyeur/debugger.cpp +++ b/engines/voyeur/debugger.cpp @@ -32,9 +32,12 @@ Debugger::Debugger() : GUI::Debugger() { DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("time", WRAP_METHOD(Debugger, Cmd_Time)); + DCmd_Register("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots)); + DCmd_Register("mouse", WRAP_METHOD(Debugger, Cmd_Mouse)); // Set fields _isTimeActive = true; + _showMousePosition = false; } bool Debugger::Cmd_Time(int argc, const char **argv) { @@ -90,4 +93,58 @@ bool Debugger::Cmd_Time(int argc, const char **argv) { return true; } +bool Debugger::Cmd_Hotspots(int argc, const char **argv) { + BoltEntry &boltEntry = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1); + if (!boltEntry._rectResource) { + DebugPrintf("No hotspots available\n"); + } else { + Common::Array<RectEntry> &hotspots = boltEntry._rectResource->_entries; + + for (uint hotspotIdx = 0; hotspotIdx < hotspots.size(); ++hotspotIdx) { + Common::String pos = Common::String::format("(%d,%d->%d,%d)", + hotspots[hotspotIdx].left, hotspots[hotspotIdx].top, + hotspots[hotspotIdx].right, hotspots[hotspotIdx].bottom); + + for (int arrIndex = 0; arrIndex < 3; ++arrIndex) { + if (_vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx] != 9999) { + DebugPrintf("Hotspot %d %s Audio slot %d, time: %d to %d\n", + hotspotIdx, pos.c_str(), arrIndex, + _vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx], + _vm->_voy._audioHotspotTimes._max[arrIndex][hotspotIdx]); + } + + if (_vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx] != 9999) { + DebugPrintf("Hotspot %d %s Evidence slot %d, time: %d to %d\n", + hotspotIdx, pos.c_str(), arrIndex, + _vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx], + _vm->_voy._evidenceHotspotTimes._max[arrIndex][hotspotIdx]); + } + } + + for (int arrIndex = 0; arrIndex < 8; ++arrIndex) { + if (_vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx] != 9999) { + DebugPrintf("Hotspot %d %s Video slot %d, time: %d to %d\n", + hotspotIdx, pos.c_str(), arrIndex, + _vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx], + _vm->_voy._videoHotspotTimes._max[arrIndex][hotspotIdx]); + } + } + } + } + + DebugPrintf("\n"); + return true; +} + +bool Debugger::Cmd_Mouse(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("mouse [ on | off ]\n"); + } else { + _showMousePosition = !strcmp(argv[1], "on"); + DebugPrintf("Mouse position is now %s\n", _showMousePosition ? "on" : "off"); + } + + return true; +} + } // End of namespace Voyeur diff --git a/engines/voyeur/debugger.h b/engines/voyeur/debugger.h index 0391fadffd..43eaa5f474 100644 --- a/engines/voyeur/debugger.h +++ b/engines/voyeur/debugger.h @@ -39,9 +39,27 @@ public: * @default true */ bool _isTimeActive; + + /* + * Specifies whether to show the current mouse position on the screen + */ + bool _showMousePosition; protected: + /** + * Turn time on or off, set the current time period, or the camera delay + * within the current time period. + */ bool Cmd_Time(int argc, const char **argv); + /** + * List the active hotspots during the current time period + */ + bool Cmd_Hotspots(int argc, const char **argv); + + /** + * Toggle showing the mouse on the screen + */ + bool Cmd_Mouse(int argc, const char **argv); public: Debugger(); virtual ~Debugger() {} diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 4734b1efa3..ded81f7992 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -25,6 +25,8 @@ #include "voyeur/staticres.h" #include "common/events.h" #include "graphics/cursorman.h" +#include "graphics/font.h" +#include "graphics/fontman.h" #include "graphics/palette.h" namespace Voyeur { @@ -158,6 +160,10 @@ void EventsManager::checkForNextFrameCounter() { // Give time to the debugger _vm->_debugger.onFrame(); + // If mouse position display is on, display the position + if (_vm->_debugger._showMousePosition) + showMousePosition(); + // Display the frame g_system->copyRectToScreen((byte *)_vm->_graphicsManager._screenSurface.getPixels(), SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); @@ -168,6 +174,23 @@ void EventsManager::checkForNextFrameCounter() { } } +void EventsManager::showMousePosition() { + const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont)); + Common::String mousePos = Common::String::format("(%d,%d)", _mousePos.x, _mousePos.y); + if (_vm->_voyeurArea == AREA_INTERFACE) { + Common::Point pt = _mousePos + _vm->_mansionViewPos - Common::Point(40, 27); + if (pt.x < 0) pt.x = 0; + if (pt.y < 0) pt.y = 0; + + mousePos += Common::String::format(" - (%d,%d)", pt.x, pt.y); + } + + _vm->_graphicsManager._screenSurface.fillRect( + Common::Rect(0, 0, 110, font.getFontHeight()), 0); + font.drawString(&_vm->_graphicsManager._screenSurface, mousePos, + 0, 0, 110, 63); +} + void EventsManager::voyeurTimer() { _gameData.field22 += _gameData.field24; _gameData.field1A += _gameData.field1E; diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index 6e2d297851..ec9c12ec92 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -96,6 +96,11 @@ private: void vDoCycleInt(); void fadeIntFunc(); void deleteIntNode(IntNode *node); + + /** + * Debugger support method to show the mouse position + */ + void showMousePosition(); public: IntData _gameData; IntData &_intPtr; |