aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/events.cpp3
-rw-r--r--engines/zvision/zvision.cpp56
-rw-r--r--engines/zvision/zvision.h2
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();