diff options
author | richiesams | 2013-08-09 14:51:18 -0500 |
---|---|---|
committer | richiesams | 2013-08-09 14:51:18 -0500 |
commit | 06e6cb5d1f9b6cc7d632e3a7e31267363dad3503 (patch) | |
tree | 2ce70ff2022ed3cfee97276a6cde9ecdc134c94e /engines/zvision | |
parent | f31f35bf7bcd964b970eb4817135c966c9bad823 (diff) | |
download | scummvm-rg350-06e6cb5d1f9b6cc7d632e3a7e31267363dad3503.tar.gz scummvm-rg350-06e6cb5d1f9b6cc7d632e3a7e31267363dad3503.tar.bz2 scummvm-rg350-06e6cb5d1f9b6cc7d632e3a7e31267363dad3503.zip |
ZVISION: Create method for cycling through all the cursors so as to identify them more easily
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/events.cpp | 3 | ||||
-rw-r--r-- | engines/zvision/zvision.cpp | 56 | ||||
-rw-r--r-- | engines/zvision/zvision.h | 2 |
3 files changed, 61 insertions, 0 deletions
diff --git a/engines/zvision/events.cpp b/engines/zvision/events.cpp index 508d2610aa..3163563ad3 100644 --- a/engines/zvision/events.cpp +++ b/engines/zvision/events.cpp @@ -61,6 +61,9 @@ void ZVision::processEvents() { if (_event.kbd.hasFlags(Common::KBD_CTRL)) quitGame(); break; + case Common::KEYCODE_F1: + cycleThroughCursors(); + break; default: break; } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 338bbc5fbc..46b6c01781 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -40,6 +40,7 @@ #include "zvision/render_manager.h" #include "zvision/zfs_archive.h" #include "zvision/detection.h" +#include "zvision/cursor.h" #include "zvision/utility.h" @@ -169,4 +170,59 @@ ZVisionGameId ZVision::getGameId() const { return _gameDescription->gameId; } +void ZVision::cycleThroughCursors() { + Common::ArchiveMemberList list; + SearchMan.listMatchingMembers(list, "*.zcr"); + + Common::ArchiveMemberList::iterator iter = list.begin(); + ZorkCursor cursor; + bool cursorChanged = false; + + _system->showMouse(true); + + bool done = false; + while (!done && !shouldQuit()) { + _clock.update(); + uint32 currentTime = _clock.getLastMeasuredTime(); + + while (_eventMan->pollEvent(_event)) { + if (_event.type == Common::EVENT_KEYDOWN) { + switch (_event.kbd.keycode) { + case Common::KEYCODE_LEFT: + --iter; + cursorChanged = true; + break; + case Common::KEYCODE_RIGHT: + ++iter; + cursorChanged = true; + break; + case Common::KEYCODE_RETURN: + debug("%s", (*iter)->getName().c_str()); + break; + case Common::KEYCODE_ESCAPE: + done = true; + break; + default: + break; + } + } + } + + if (cursorChanged) { + cursor = ZorkCursor((*iter)->getName()); + + _system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), cursor.getHotspotX(), cursor.getHotspotY(), cursor.getHeight(), true, &_pixelFormat); + cursorChanged = false; + } + + _system->updateScreen(); + + // Calculate the frame delay based off a desired frame time + int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); + // Ensure non-negative + delay = delay < 0 ? 0 : delay; + _system->delayMillis(delay); + } +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 5bb3d7cb1d..29c1ddd651 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -96,6 +96,8 @@ public: void playVideo(Video::VideoDecoder &videoDecoder); + void cycleThroughCursors(); + private: void initialize(); |