aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/control.cpp35
-rw-r--r--engines/zvision/control.h1
-rw-r--r--engines/zvision/scr_file_handling.cpp3
3 files changed, 38 insertions, 1 deletions
diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp
index fdb88c68e1..02d15fe9d0 100644
--- a/engines/zvision/control.cpp
+++ b/engines/zvision/control.cpp
@@ -102,4 +102,39 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre
renderTable->generateRenderTable();
}
+void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream) {
+ Common::Rect hotspot;
+ Common::String cursorName;
+
+ // Loop until we find the closing brace
+ Common::String line = stream.readLine();
+ trimCommentsAndWhiteSpace(&line);
+
+ while (!line.contains('}')) {
+ if (line.matchString("*_hotspot*", true)) {
+ uint x;
+ uint y;
+ uint width;
+ uint height;
+
+ sscanf(line.c_str(), "%*[^(](%u,%u,%u,%u)", &x, &y, &width, &height);
+
+ hotspot = Common::Rect(x, y, x + width, y + height);
+ } else if (line.matchString("cursor*", true)) {
+ char nameBuffer[25];
+
+ sscanf(line.c_str(), "%*[^(](%25[^)])", nameBuffer);
+
+ cursorName = Common::String(nameBuffer);
+ }
+
+ line = stream.readLine();
+ trimCommentsAndWhiteSpace(&line);
+ }
+
+ if (!hotspot.isEmpty() && !cursorName.empty()) {
+ engine->registerMouseEvent(MouseEvent(key, hotspot, cursorName));
+ }
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/control.h b/engines/zvision/control.h
index edc0fc2930..2d5426c0c4 100644
--- a/engines/zvision/control.h
+++ b/engines/zvision/control.h
@@ -46,6 +46,7 @@ public:
static void parseFlatControl(ZVision *engine);
static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream);
static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream);
+ static void parsePushToggleControl(uint32 key, ZVision *engine, Common::SeekableReadStream &stream);
};
} // End of namespace ZVision
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp
index cd4baa34f0..5b8af48047 100644
--- a/engines/zvision/scr_file_handling.cpp
+++ b/engines/zvision/scr_file_handling.cpp
@@ -309,7 +309,8 @@ bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea
Common::String controlType(controlTypeBuffer);
if (controlType.equalsIgnoreCase("push_toggle")) {
-
+ Control::parsePushToggleControl(key, _engine, stream);
+ return false;
} else if (controlType.equalsIgnoreCase("flat")) {
Control::parseFlatControl(_engine);
return false;