mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ZVISION: Implement push_toggle control handling
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user