diff options
author | richiesams | 2013-08-11 15:12:01 -0500 |
---|---|---|
committer | richiesams | 2013-08-11 15:12:01 -0500 |
commit | 00a17a66d0e8317001829fe36639ef9201d15798 (patch) | |
tree | 01d0564d998033cc39d059d823f6e758276baa06 | |
parent | 269bed7c7d279e0785056a4e5ba1622317402449 (diff) | |
download | scummvm-rg350-00a17a66d0e8317001829fe36639ef9201d15798.tar.gz scummvm-rg350-00a17a66d0e8317001829fe36639ef9201d15798.tar.bz2 scummvm-rg350-00a17a66d0e8317001829fe36639ef9201d15798.zip |
ZVISION: Implement push_toggle control handling
-rw-r--r-- | engines/zvision/control.cpp | 35 | ||||
-rw-r--r-- | engines/zvision/control.h | 1 | ||||
-rw-r--r-- | engines/zvision/scr_file_handling.cpp | 3 |
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; |