From 57857a1d768fc9b226326efe2294f73e847c816e Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Sat, 12 Jul 2014 21:35:50 +0000 Subject: [PATCH] ZVISION: Controls now can return type of control. --- engines/zvision/scripting/control.h | 23 ++++++++++++++++++- .../scripting/controls/input_control.cpp | 2 +- .../scripting/controls/lever_control.cpp | 2 +- .../controls/push_toggle_control.cpp | 2 +- .../scripting/controls/slot_control.cpp | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/engines/zvision/scripting/control.h b/engines/zvision/scripting/control.h index 93ad5f5df18f..6ec47c6455e3 100644 --- a/engines/zvision/scripting/control.h +++ b/engines/zvision/scripting/control.h @@ -39,14 +39,33 @@ class ZVision; class Control { public: + + enum ControlType { + CONTROL_UNKNOW, + CONTROL_INPUT, + CONTROL_PUSHTGL, + CONTROL_SLOT, + CONTROL_LEVER, + CONTROL_SAVE, + CONTROL_SAFE, + CONTROL_FIST, + CONTROL_TITLER, + CONTROL_HOTMOV, + CONTROL_PAINT + }; + Control() : _engine(0), _key(0) {} - Control(ZVision *engine, uint32 key) : _engine(engine), _key(key) {} + Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type) {} virtual ~Control() {} uint32 getKey() { return _key; } + ControlType getType() { + return _type; + } + virtual void focus() {} virtual void unfocus() {} /** @@ -109,6 +128,8 @@ class Control { static void parseFlatControl(ZVision *engine); static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream); static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream); +private: + ControlType _type; }; // TODO: Implement InputControl diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index ba1b634d4213..0bca01bf47d0 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -38,7 +38,7 @@ namespace ZVision { InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key), + : Control(engine, key, CONTROL_INPUT), _nextTabstop(0), _focused(false), _textChanged(false), diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index 7e3ee775fb24..87fbb433dd34 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -42,7 +42,7 @@ namespace ZVision { LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key), + : Control(engine, key, CONTROL_LEVER), _frameInfo(0), _frameCount(0), _startFrame(0), diff --git a/engines/zvision/scripting/controls/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp index 16cd971ad584..2f4af0d84386 100644 --- a/engines/zvision/scripting/controls/push_toggle_control.cpp +++ b/engines/zvision/scripting/controls/push_toggle_control.cpp @@ -35,7 +35,7 @@ namespace ZVision { PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key), + : Control(engine, key, CONTROL_PUSHTGL), _countTo(2), _event(Common::EVENT_LBUTTONUP) { // Loop until we find the closing brace diff --git a/engines/zvision/scripting/controls/slot_control.cpp b/engines/zvision/scripting/controls/slot_control.cpp index c85b02b3cd5a..f78061ac139a 100644 --- a/engines/zvision/scripting/controls/slot_control.cpp +++ b/engines/zvision/scripting/controls/slot_control.cpp @@ -36,7 +36,7 @@ namespace ZVision { SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) - : Control(engine, key) { + : Control(engine, key, CONTROL_SLOT) { _rendered_item = 0; _bkg = NULL;