From 4f28cec6ac7ef68df373f6c1139a852150789851 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Thu, 15 Jan 2015 00:37:39 -0600 Subject: ZVISION: Keep the hand cursor during lever movement We have to explicitly set the cursor each call otherwise the cursor will be reset to the idle cursor. Addresses part of bug #6761 --- engines/zvision/scripting/controls/lever_control.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index bef51f0e91..249c4c6f9b 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -236,6 +236,8 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common } } } + _engine->getCursorManager()->changeCursor(_cursor); + cursorWasChanged = true; } else if (_frameInfo[_currentFrame].hotspot.contains(backgroundImageSpacePos)) { _engine->getCursorManager()->changeCursor(_cursor); cursorWasChanged = true; -- cgit v1.2.3 From 89f233f4881589b925e871becbf3ec1b08db108e Mon Sep 17 00:00:00 2001 From: RichieSams Date: Thu, 15 Jan 2015 00:40:07 -0600 Subject: ZVISION: Set the state value for the lever position during user dragging Not just during the "returning" animation. Addresses part of bug #6761 --- engines/zvision/scripting/controls/lever_control.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp index 249c4c6f9b..0f105b424c 100644 --- a/engines/zvision/scripting/controls/lever_control.cpp +++ b/engines/zvision/scripting/controls/lever_control.cpp @@ -232,6 +232,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common if (angle >= (int)iter->angle - ANGLE_DELTA && angle <= (int)iter->angle + ANGLE_DELTA) { _currentFrame = iter->toFrame; renderFrame(_currentFrame); + _engine->getScriptManager()->setStateValue(_key, _currentFrame); break; } } -- cgit v1.2.3 From 1adcb23d71a1f1ef6c4bc3b98fb474959fd14462 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 3 Feb 2015 04:15:11 +0200 Subject: ZVISION: Fix bug #6784 (wrong scaling in the fist control) --- engines/zvision/scripting/controls/fist_control.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/fist_control.cpp b/engines/zvision/scripting/controls/fist_control.cpp index 4a8e8b1bbd..f79c82dc79 100644 --- a/engines/zvision/scripting/controls/fist_control.cpp +++ b/engines/zvision/scripting/controls/fist_control.cpp @@ -105,7 +105,12 @@ bool FistControl::process(uint32 deltaTimeInMillis) { if (_animation->needsUpdate()) { const Graphics::Surface *frameData = _animation->decodeNextFrame(); if (frameData) - _engine->getRenderManager()->blitSurfaceToBkgScaled(*frameData, _anmRect); + // WORKAROUND: Ignore the target frame dimensions for the finger animations. + // The target dimensions specify an area smaller than expected, thus if we + // scale the finger videos to fit these dimensions, they are not aligned + // correctly. Not scaling these videos yields a result identical to the + // original. Fixes bug #6784. + _engine->getRenderManager()->blitSurfaceToBkg(*frameData, _anmRect.left, _anmRect.top); } } -- cgit v1.2.3 From b7b4e9cc5899eff0810d97a848ace0fa2ede5548 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 8 Feb 2015 10:13:18 +0100 Subject: ZVISION: Draw transparent text in original save dialog Before this change, text was drawn in black boxes in Zork Nemesis, so while this does make it look better (and more like the original) this may actually make the text slightly harder to read. The original dialogs allowed only upper-case letters, but I think that it's better to leave that to the player. --- engines/zvision/scripting/controls/input_control.cpp | 12 +++++++++++- engines/zvision/scripting/controls/input_control.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index 47da27fa08..b25aa13543 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -39,6 +39,7 @@ namespace ZVision { InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream) : Control(engine, key, CONTROL_INPUT), + _background(0), _nextTabstop(0), _focused(false), _textChanged(false), @@ -111,6 +112,11 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre } } +InputControl::~InputControl() { + _background->free(); + delete _background; +} + bool InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; @@ -191,12 +197,16 @@ bool InputControl::process(uint32 deltaTimeInMillis) { if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED) return false; + if (!_background) { + _background = _engine->getRenderManager()->getBkgRect(_textRectangle); + } + // First see if we need to render the text if (_textChanged) { // Blit the text using the RenderManager Graphics::Surface txt; - txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_resourcePixelFormat); + txt.copyFrom(*_background); if (!_readOnly || !_focused) _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt); diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index 99f7f5287d..e23ba0b9de 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -38,8 +38,10 @@ namespace ZVision { class InputControl : public Control { public: InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream); + ~InputControl(); private: + Graphics::Surface *_background; Common::Rect _textRectangle; Common::Rect _headerRectangle; cTxtStyle _stringInit; -- cgit v1.2.3 From 8725f2cff2357049a3759f24e3fa530c25644e25 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 8 Feb 2015 13:56:01 +0100 Subject: ZVISION: Limit input text to the width of the input control This is to prevent the player from entering ridiculously long savegame descriptions. --- engines/zvision/scripting/controls/input_control.cpp | 14 +++++++++++++- engines/zvision/scripting/controls/input_control.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index b25aa13543..20c8e7ccbc 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -110,6 +110,10 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre _engine->getScriptManager()->trimCommentsAndWhiteSpace(&line); getParams(line, param, values); } + + _maxTxtWidth = _textRectangle.width(); + if (_animation) + _maxTxtWidth -= _animation->getWidth(); } InputControl::~InputControl() { @@ -208,12 +212,20 @@ bool InputControl::process(uint32 deltaTimeInMillis) { Graphics::Surface txt; txt.copyFrom(*_background); + int32 oldTxtWidth = _txtWidth; + if (!_readOnly || !_focused) _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt); else _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringChooserInit, txt); - _engine->getRenderManager()->blitSurfaceToBkg(txt, _textRectangle.left, _textRectangle.top); + if (_readOnly || _txtWidth <= _maxTxtWidth) + _engine->getRenderManager()->blitSurfaceToBkg(txt, _textRectangle.left, _textRectangle.top); + else { + // Assume the last character caused the overflow. + _currentInputText.deleteLastChar(); + _txtWidth = oldTxtWidth; + } txt.free(); } diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index e23ba0b9de..7f272e8d81 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -56,6 +56,7 @@ private: bool _readOnly; int16 _txtWidth; + int16 _maxTxtWidth; Video::VideoDecoder *_animation; int32 _frameDelay; int16 _frame; -- cgit v1.2.3 From cbbd1a92192ad118897f645f1aa6e968bff01466 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 8 Feb 2015 15:47:20 +0100 Subject: ZVISION: Set safe control state value after animation finishes If we set it before the animation starts, the final turn of the wheel won't be animated, because the puzzle will already be solved. --- engines/zvision/scripting/controls/safe_control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/safe_control.cpp b/engines/zvision/scripting/controls/safe_control.cpp index 6ba34106d0..4d2a91a1ad 100644 --- a/engines/zvision/scripting/controls/safe_control.cpp +++ b/engines/zvision/scripting/controls/safe_control.cpp @@ -123,6 +123,8 @@ bool SafeControl::process(uint32 deltaTimeInMillis) { _animation->seekToFrame(_animation->getCurFrame() - 1); const Graphics::Surface *frameData = _animation->decodeNextFrame(); + if (_animation->getCurFrame() == _targetFrame) + _engine->getScriptManager()->setStateValue(_key, _curState); if (frameData) _engine->getRenderManager()->blitSurfaceToBkg(*frameData, _rectangle.left, _rectangle.top); } @@ -169,8 +171,6 @@ bool SafeControl::onMouseUp(const Common::Point &screenSpacePos, const Common::P _curState = (_statesCount * 2 + tmp2) % _statesCount; _targetFrame = (_curState + _statesCount - _startPointer) % _statesCount; - - _engine->getScriptManager()->setStateValue(_key, _curState); return true; } } -- cgit v1.2.3 From a851fa8e1aef50334402fec65bf89ee8b582ea62 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Wed, 11 Feb 2015 14:57:05 -0600 Subject: ZVISION: Refactor text rendering code in order to fix word wrapping and clarify the logic. Fixes bug #6801 --- engines/zvision/scripting/controls/input_control.cpp | 8 ++++---- engines/zvision/scripting/controls/input_control.h | 4 ++-- engines/zvision/scripting/controls/titler_control.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index 20c8e7ccbc..df0c77ba96 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -79,13 +79,13 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre sscanf(values.c_str(), "%u", &fontFormatNumber); - _stringInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringInit.readAllStyles(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("chooser_init_string", true)) { uint fontFormatNumber; sscanf(values.c_str(), "%u", &fontFormatNumber); - _stringChooserInit.readAllStyle(_engine->getStringManager()->getTextLine(fontFormatNumber)); + _stringChooserInit.readAllStyles(_engine->getStringManager()->getTextLine(fontFormatNumber)); } else if (param.matchString("next_tabstop", true)) { sscanf(values.c_str(), "%u", &_nextTabstop); } else if (param.matchString("cursor_dimensions", true)) { @@ -215,9 +215,9 @@ bool InputControl::process(uint32 deltaTimeInMillis) { int32 oldTxtWidth = _txtWidth; if (!_readOnly || !_focused) - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt); + _txtWidth = _engine->getTextRenderer()->drawText(_currentInputText, _stringInit, txt); else - _txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringChooserInit, txt); + _txtWidth = _engine->getTextRenderer()->drawText(_currentInputText, _stringChooserInit, txt); if (_readOnly || _txtWidth <= _maxTxtWidth) _engine->getRenderManager()->blitSurfaceToBkg(txt, _textRectangle.left, _textRectangle.top); diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index 7f272e8d81..9b48514e16 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -44,8 +44,8 @@ private: Graphics::Surface *_background; Common::Rect _textRectangle; Common::Rect _headerRectangle; - cTxtStyle _stringInit; - cTxtStyle _stringChooserInit; + TextStyleState _stringInit; + TextStyleState _stringChooserInit; uint32 _nextTabstop; bool _focused; diff --git a/engines/zvision/scripting/controls/titler_control.cpp b/engines/zvision/scripting/controls/titler_control.cpp index 542e0a0b67..683d6660af 100644 --- a/engines/zvision/scripting/controls/titler_control.cpp +++ b/engines/zvision/scripting/controls/titler_control.cpp @@ -82,7 +82,7 @@ TitlerControl::~TitlerControl() { void TitlerControl::setString(int strLine) { if (strLine != _curString && strLine >= 0 && strLine < (int)_strings.size()) { _surface->fillRect(Common::Rect(_surface->w, _surface->h), 0); - _engine->getTextRenderer()->drawTxtInOneLine(_strings[strLine], *_surface); + _engine->getTextRenderer()->drawTextWithWordWrapping(_strings[strLine], *_surface); _engine->getRenderManager()->blitSurfaceToBkg(*_surface, _rectangle.left, _rectangle.top); _curString = strLine; } -- cgit v1.2.3 From 856475067a0f78449db213afb79390e8fb7c095d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 19 Jul 2015 17:09:43 +0200 Subject: MISC: Remove some unused private member variables --- engines/zvision/scripting/controls/input_control.cpp | 1 - engines/zvision/scripting/controls/input_control.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'engines/zvision/scripting/controls') diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index df0c77ba96..9525333ef0 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -43,7 +43,6 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre _nextTabstop(0), _focused(false), _textChanged(false), - _cursorOffset(0), _enterPressed(false), _readOnly(false), _txtWidth(0), diff --git a/engines/zvision/scripting/controls/input_control.h b/engines/zvision/scripting/controls/input_control.h index 9b48514e16..6abdb3c692 100644 --- a/engines/zvision/scripting/controls/input_control.h +++ b/engines/zvision/scripting/controls/input_control.h @@ -51,15 +51,12 @@ private: Common::String _currentInputText; bool _textChanged; - uint _cursorOffset; bool _enterPressed; bool _readOnly; int16 _txtWidth; int16 _maxTxtWidth; Video::VideoDecoder *_animation; - int32 _frameDelay; - int16 _frame; public: void focus() { -- cgit v1.2.3