From 3f36cc94e45d32dc4784c16ec91b6fc44dbf0ff7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 23 Dec 2014 00:02:30 +0200 Subject: ZVISION: Limit the default engine delay for all animations This fixes the lag between frames for all in-game animations with a default frame delay --- engines/zvision/scripting/actions.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 0422a2c028..0ada2edf81 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -577,7 +577,7 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c char fileName[25]; - // The two %*u are always 0 and dont seem to have a use + // The two %*u are usually 0 and dont seem to have a use sscanf(line.c_str(), "%25s %*u %*u %d %d", fileName, &_mask, &_framerate); if (_mask > 0) { @@ -1030,9 +1030,8 @@ bool ActionSyncSound::execute() { if (!(fx->getType() & SideFX::SIDEFX_ANIM)) return true; - AnimationNode *animnode = (AnimationNode *)fx; - if (animnode->getFrameDelay() > 200) // Hack for fix incorrect framedelay in some animpreload - animnode->setNewFrameDelay(66); // ~15fps + if (((AnimationNode *)fx)->getFrameDelay() > 200) + warning("ActionSyncSound: animation frame delay is higher than 200"); _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); return true; -- cgit v1.2.3 From 9bc0686e6076bbe5ca481c6696f0f7d3c86cd570 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 23 Dec 2014 00:09:18 +0200 Subject: ZVISION: Remove leftover warning --- engines/zvision/scripting/actions.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 0ada2edf81..2a5046f146 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -1030,9 +1030,6 @@ bool ActionSyncSound::execute() { if (!(fx->getType() & SideFX::SIDEFX_ANIM)) return true; - if (((AnimationNode *)fx)->getFrameDelay() > 200) - warning("ActionSyncSound: animation frame delay is higher than 200"); - _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); return true; } -- cgit v1.2.3 From 99073f9b57580570b5ecec4cb00f020867f02672 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 23 Dec 2014 02:20:17 +0200 Subject: ZVISION: Fix some buffer overruns with the usage of sscanf() --- engines/zvision/scripting/actions.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 2a5046f146..5af847c61a 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -363,7 +363,7 @@ ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::S _key = 0; char buf[25]; - sscanf(line.c_str(), "%25s %d", buf, &_key); + sscanf(line.c_str(), "%24s %d", buf, &_key); if (strcmp(buf, "add") == 0) { _type = 0; @@ -414,7 +414,7 @@ ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &lin _key = 0; _type = 0; char keytype[25]; - sscanf(line.c_str(), "%25s", keytype); + sscanf(line.c_str(), "%24s", keytype); if (keytype[0] == '"') { if (!scumm_stricmp(keytype, "\"ANIM\"")) _type = SideFX::SIDEFX_ANIM; @@ -475,7 +475,7 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l uint loop = 0; uint volume = 255; - sscanf(line.c_str(), "%u %25s %u %u", &type, fileNameBuffer, &loop, &volume); + sscanf(line.c_str(), "%u %24s %u %u", &type, fileNameBuffer, &loop, &volume); // type 4 are midi sound effect files if (type == 4) { @@ -578,7 +578,7 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c char fileName[25]; // The two %*u are usually 0 and dont seem to have a use - sscanf(line.c_str(), "%25s %*u %*u %d %d", fileName, &_mask, &_framerate); + sscanf(line.c_str(), "%24s %*u %*u %d %d", fileName, &_mask, &_framerate); if (_mask > 0) { byte r, g, b; @@ -645,7 +645,7 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C // The two %*u are always 0 and dont seem to have a use sscanf(line.c_str(), - "%25s %u %u %u %u %u %u %d %*u %*u %d %d", + "%24s %u %u %u %u %u %u %d %*u %*u %d %d", fileName, &_x, &_y, &_x2, &_y2, &_start, &_end, &_loopCount, &_mask, &_framerate); if (_mask > 0) { @@ -863,7 +863,7 @@ ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotkey, c char fileName[25]; int color; - sscanf(line.c_str(), "%u %u %25s %*u %d", &_x, &_y, fileName, &color); + sscanf(line.c_str(), "%u %u %24s %*u %d", &_x, &_y, fileName, &color); _fileName = Common::String(fileName); @@ -907,7 +907,7 @@ bool ActionSetPartialScreen::execute() { ActionSetScreen::ActionSetScreen(ZVision *engine, int32 slotkey, const Common::String &line) : ResultAction(engine, slotkey) { char fileName[25]; - sscanf(line.c_str(), "%25s", fileName); + sscanf(line.c_str(), "%24s", fileName); _fileName = Common::String(fileName); } @@ -966,7 +966,7 @@ ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotkey, const Commo char fileName[25]; uint skipline = 0; //skipline - render video with skip every second line, not skippable. - sscanf(line.c_str(), "%25s %u %u %u %u %u %u", fileName, &_x1, &_y1, &_x2, &_y2, &_flags, &skipline); + sscanf(line.c_str(), "%24s %u %u %u %u %u %u", fileName, &_x1, &_y1, &_x2, &_y2, &_flags, &skipline); _fileName = Common::String(fileName); _skippable = true; @@ -1017,7 +1017,7 @@ ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::S char fileName[25]; int notUsed = 0; - sscanf(line.c_str(), "%d %d %25s", &_syncto, ¬Used, fileName); + sscanf(line.c_str(), "%d %d %24s", &_syncto, ¬Used, fileName); _fileName = Common::String(fileName); } -- cgit v1.2.3 From e8e21fabe4dbe4effdfb3df05fd3fae75940f1c5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 24 Dec 2014 22:40:54 +0200 Subject: ZVISION: Set all the internal graphics operations to use RGB555 (1/2) This is the first part of the changes to make the engine use RGB555 internally again. This is done to simplify the rendering pipeline - the engine will use RGB555 internally, but will output to RGB565. The overall changes have been broken into two commits, thus this first commit will break all the game colors --- engines/zvision/scripting/actions.cpp | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 5af847c61a..1b6e1e2fdc 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -580,12 +580,6 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c // The two %*u are usually 0 and dont seem to have a use sscanf(line.c_str(), "%24s %*u %*u %d %d", fileName, &_mask, &_framerate); - if (_mask > 0) { - byte r, g, b; - Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(_mask, r, g, b); - _mask = _engine->_pixelFormat.RGBToColor(r, g, b); - } - _fileName = Common::String(fileName); } @@ -648,12 +642,6 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C "%24s %u %u %u %u %u %u %d %*u %*u %d %d", fileName, &_x, &_y, &_x2, &_y2, &_start, &_end, &_loopCount, &_mask, &_framerate); - if (_mask > 0) { - byte r, g, b; - Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(_mask, r, g, b); - _mask = _engine->_pixelFormat.RGBToColor(r, g, b); - } - _fileName = Common::String(fileName); } @@ -861,21 +849,12 @@ ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotkey, c _y = 0; char fileName[25]; - int color; - sscanf(line.c_str(), "%u %u %24s %*u %d", &_x, &_y, fileName, &color); + sscanf(line.c_str(), "%u %u %24s %*u %d", &_x, &_y, fileName, &_backgroundColor); _fileName = Common::String(fileName); - if (color >= 0) { - byte r, g, b; - Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0).colorToRGB(color, r, g, b); - _backgroundColor = _engine->_pixelFormat.RGBToColor(r, g, b); - } else { - _backgroundColor = color; - } - - if (color > 65535) { + if (_backgroundColor > 65535) { warning("Background color for ActionSetPartialScreen is bigger than a uint16"); } } -- cgit v1.2.3 From 319323c668003b284d51b84ec95a64ba7c072450 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 25 Dec 2014 15:00:49 +0200 Subject: ZVISION: Document some of the ActionRegion effects --- engines/zvision/scripting/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 1b6e1e2fdc..89b311e81c 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -704,7 +704,7 @@ bool ActionQuit::execute() { } ////////////////////////////////////////////////////////////////////////////// -// ActionRegion +// ActionRegion - only used by Zork: Nemesis ////////////////////////////////////////////////////////////////////////////// ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String &line) : -- cgit v1.2.3 From 6c451c9cf481dcaa6261c34773b79689386ded42 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 25 Dec 2014 21:48:59 +0200 Subject: ZVISION: Document where MIDI commands are used --- engines/zvision/scripting/actions.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 89b311e81c..be2079736e 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -477,7 +477,9 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l sscanf(line.c_str(), "%u %24s %u %u", &type, fileNameBuffer, &loop, &volume); - // type 4 are midi sound effect files + // Type 4 actions are MIDI commands, not files. These are only used by + // Zork: Nemesis, for the flute and piano puzzles (tj4e and ve6f, as well + // as vr) if (type == 4) { _midi = true; int note; -- cgit v1.2.3 From 4d0ebfaa2285e2741a134db36fb4f5bd0317784d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 26 Dec 2014 04:03:20 +0200 Subject: ZVISION: Move the save manager together with the other file classes --- engines/zvision/scripting/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index be2079736e..ebbd09c8b9 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -29,6 +29,7 @@ #include "zvision/graphics/render_manager.h" #include "zvision/sound/zork_raw.h" #include "zvision/video/zork_avi_decoder.h" +#include "zvision/file/save_manager.h" #include "zvision/scripting/sidefx/timer_node.h" #include "zvision/scripting/sidefx/music_node.h" #include "zvision/scripting/sidefx/syncsound_node.h" @@ -42,7 +43,6 @@ #include "zvision/graphics/effects/fog.h" #include "zvision/graphics/effects/light.h" #include "zvision/graphics/effects/wave.h" -#include "zvision/core/save_manager.h" #include "zvision/graphics/cursors/cursor_manager.h" #include "common/file.h" -- cgit v1.2.3 From 2350eca546396775c6e9ac9875ebd59bcc17663f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 26 Dec 2014 12:04:21 +0200 Subject: ZVISION: Remove some unused actions. Cleanup --- engines/zvision/scripting/actions.cpp | 53 ++++++----------------------------- 1 file changed, 9 insertions(+), 44 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index ebbd09c8b9..c26a93f529 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -242,23 +242,6 @@ bool ActionDisableControl::execute() { return true; } -////////////////////////////////////////////////////////////////////////////// -// ActionDisableVenus -////////////////////////////////////////////////////////////////////////////// - -ActionDisableVenus::ActionDisableVenus(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { - _key = 0; - - sscanf(line.c_str(), "%d", &_key); -} - -bool ActionDisableVenus::execute() { - _engine->getScriptManager()->setStateValue(_key, 0); - - return true; -} - ////////////////////////////////////////////////////////////////////////////// // ActionDisplayMessage ////////////////////////////////////////////////////////////////////////////// @@ -295,7 +278,7 @@ bool ActionDissolve::execute() { } ////////////////////////////////////////////////////////////////////////////// -// ActionDistort +// ActionDistort - only used by Zork: Nemesis for the "treatment" puzzle in the Sanitarium (aj30) ////////////////////////////////////////////////////////////////////////////// ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line) : @@ -406,7 +389,7 @@ bool ActionInventory::execute() { } ////////////////////////////////////////////////////////////////////////////// -// ActionKill +// ActionKill - only used by ZGI ////////////////////////////////////////////////////////////////////////////// ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &line) : @@ -735,13 +718,13 @@ bool ActionRegion::execute() { if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - Effect *effct = NULL; + Effect *effect = NULL; switch (_type) { case 0: { uint16 centerX, centerY, frames; double amplitude, waveln, speed; sscanf(_custom.c_str(), "%hu,%hu,%hu,%lf,%lf,%lf,", ¢erX, ¢erY, &frames, &litude, &waveln, &speed); - effct = new WaveFx(_engine, _slotKey, _rect, _unk1, frames, centerX, centerY, amplitude, waveln, speed); + effect = new WaveFx(_engine, _slotKey, _rect, _unk1, frames, centerX, centerY, amplitude, waveln, speed); } break; case 1: { @@ -753,7 +736,7 @@ bool ActionRegion::execute() { int8 minD; int8 maxD; EffectMap *_map = _engine->getRenderManager()->makeEffectMap(Common::Point(aX, aY), aD, _rect, &minD, &maxD); - effct = new LightFx(_engine, _slotKey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); + effect = new LightFx(_engine, _slotKey, _rect, _unk1, _map, atoi(_custom.c_str()), minD, maxD); } break; case 9: { @@ -769,16 +752,16 @@ bool ActionRegion::execute() { _rect.setHeight(tempMask.h); EffectMap *_map = _engine->getRenderManager()->makeEffectMap(tempMask, 0); - effct = new FogFx(_engine, _slotKey, _rect, _unk1, _map, Common::String(buf)); + effect = new FogFx(_engine, _slotKey, _rect, _unk1, _map, Common::String(buf)); } break; default: break; } - if (effct) { - _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effct, _delay)); - _engine->getRenderManager()->addEffect(effct); + if (effect) { + _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effect, _delay)); + _engine->getRenderManager()->addEffect(effect); } return true; @@ -899,24 +882,6 @@ bool ActionSetScreen::execute() { return true; } -////////////////////////////////////////////////////////////////////////////// -// ActionSetVenus -////////////////////////////////////////////////////////////////////////////// - -ActionSetVenus::ActionSetVenus(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { - _key = 0; - - sscanf(line.c_str(), "%d", &_key); -} - -bool ActionSetVenus::execute() { - if (_engine->getScriptManager()->getStateValue(_key)) - _engine->getScriptManager()->setStateValue(StateKey_Venus, _key); - - return true; -} - ////////////////////////////////////////////////////////////////////////////// // ActionStop ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From eea1ee445fcac7ecc53e31d258aac697d6b242f1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 26 Dec 2014 13:14:24 +0200 Subject: ZVISION: Move more graphics code out of the main engine code --- engines/zvision/scripting/actions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index c26a93f529..7c3463b6d0 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -30,6 +30,7 @@ #include "zvision/sound/zork_raw.h" #include "zvision/video/zork_avi_decoder.h" #include "zvision/file/save_manager.h" +#include "zvision/scripting/menu.h" #include "zvision/scripting/sidefx/timer_node.h" #include "zvision/scripting/sidefx/music_node.h" #include "zvision/scripting/sidefx/syncsound_node.h" @@ -439,7 +440,7 @@ ActionMenuBarEnable::ActionMenuBarEnable(ZVision *engine, int32 slotkey, const C } bool ActionMenuBarEnable::execute() { - _engine->menuBarEnable(_menus); + _engine->getMenuHandler()->setEnable(_menus); return true; } @@ -819,7 +820,7 @@ ActionRotateTo::ActionRotateTo(ZVision *engine, int32 slotkey, const Common::Str } bool ActionRotateTo::execute() { - _engine->rotateTo(_toPos, _time); + _engine->getRenderManager()->rotateTo(_toPos, _time); return true; } -- cgit v1.2.3 From db37cfb1b04fb6d1fb21ef3bd3c0b90128bf4d89 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 26 Dec 2014 22:30:32 +0200 Subject: ZVISION: Remove duplicate blitting code for images and animations --- engines/zvision/scripting/actions.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 7c3463b6d0..a91476760d 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -566,6 +566,12 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c // The two %*u are usually 0 and dont seem to have a use sscanf(line.c_str(), "%24s %*u %*u %d %d", fileName, &_mask, &_framerate); + // Mask 0 means "no transparency" in this case. Since we use a common blitting + // code for images and animations, we set it to -1 to avoid confusion with + // color 0, which is used as a mask in some images + if (_mask == 0) + _mask = -1; + _fileName = Common::String(fileName); } @@ -628,6 +634,12 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C "%24s %u %u %u %u %u %u %d %*u %*u %d %d", fileName, &_x, &_y, &_x2, &_y2, &_start, &_end, &_loopCount, &_mask, &_framerate); + // Mask 0 means "no transparency" in this case. Since we use a common blitting + // code for images and animations, we set it to -1 to avoid confusion with + // color 0, which is used as a mask in some images + if (_mask == 0) + _mask = -1; + _fileName = Common::String(fileName); } -- cgit v1.2.3 From 68d3ebd57b0313e517032681a119b47956803e71 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Tue, 30 Dec 2014 01:10:36 -0600 Subject: ZVISION: Rename some scripting classes to better represent what the classes are Also, rename the graphics 'Effect' class in order to avoid naming clashes (and/or coder confusion) with the newly named ScriptingEffect class. Lastly, add some documentation for the classes for further clarity. --- engines/zvision/scripting/actions.cpp | 66 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index a91476760d..a61fa26223 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -31,16 +31,16 @@ #include "zvision/video/zork_avi_decoder.h" #include "zvision/file/save_manager.h" #include "zvision/scripting/menu.h" -#include "zvision/scripting/sidefx/timer_node.h" -#include "zvision/scripting/sidefx/music_node.h" -#include "zvision/scripting/sidefx/syncsound_node.h" -#include "zvision/scripting/sidefx/animation_node.h" -#include "zvision/scripting/sidefx/distort_node.h" -#include "zvision/scripting/sidefx/ttytext_node.h" -#include "zvision/scripting/sidefx/region_node.h" +#include "zvision/scripting/effects/timer_effect.h" +#include "zvision/scripting/effects/music_effect.h" +#include "zvision/scripting/effects/syncsound_effect.h" +#include "zvision/scripting/effects/animation_effect.h" +#include "zvision/scripting/effects/distort_effect.h" +#include "zvision/scripting/effects/ttytext_effect.h" +#include "zvision/scripting/effects/region_effect.h" #include "zvision/scripting/controls/titler_control.h" #include "zvision/graphics/render_table.h" -#include "zvision/graphics/effect.h" +#include "zvision/graphics/graphics_effect.h" #include "zvision/graphics/effects/fog.h" #include "zvision/graphics/effects/light.h" #include "zvision/graphics/effects/wave.h" @@ -106,8 +106,8 @@ ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::S } bool ActionAttenuate::execute() { - SideFX *fx = _engine->getScriptManager()->getSideFX(_key); - if (fx && fx->getType() == SideFX::SIDEFX_AUDIO) { + ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key); + if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNode *mus = (MusicNode *)fx; mus->setVolume(255 - (abs(_attenuation) >> 7)); } @@ -157,8 +157,8 @@ ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotkey, const Common::S bool ActionCrossfade::execute() { if (_keyOne) { - SideFX *fx = _engine->getScriptManager()->getSideFX(_keyOne); - if (fx && fx->getType() == SideFX::SIDEFX_AUDIO) { + ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyOne); + if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNode *mus = (MusicNode *)fx; if (_oneStartVolume >= 0) mus->setVolume((_oneStartVolume * 255) / 100); @@ -168,8 +168,8 @@ bool ActionCrossfade::execute() { } if (_keyTwo) { - SideFX *fx = _engine->getScriptManager()->getSideFX(_keyTwo); - if (fx && fx->getType() == SideFX::SIDEFX_AUDIO) { + ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyTwo); + if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNode *mus = (MusicNode *)fx; if (_twoStartVolume >= 0) mus->setVolume((_twoStartVolume * 255) / 100); @@ -401,28 +401,28 @@ ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &lin sscanf(line.c_str(), "%24s", keytype); if (keytype[0] == '"') { if (!scumm_stricmp(keytype, "\"ANIM\"")) - _type = SideFX::SIDEFX_ANIM; + _type = ScriptingEffect::SCRIPTING_EFFECT_ANIM; else if (!scumm_stricmp(keytype, "\"AUDIO\"")) - _type = SideFX::SIDEFX_AUDIO; + _type = ScriptingEffect::SCRIPTING_EFFECT_AUDIO; else if (!scumm_stricmp(keytype, "\"DISTORT\"")) - _type = SideFX::SIDEFX_DISTORT; + _type = ScriptingEffect::SCRIPTING_EFFECT_DISTORT; else if (!scumm_stricmp(keytype, "\"PANTRACK\"")) - _type = SideFX::SIDEFX_PANTRACK; + _type = ScriptingEffect::SCRIPTING_EFFECT_PANTRACK; else if (!scumm_stricmp(keytype, "\"REGION\"")) - _type = SideFX::SIDEFX_REGION; + _type = ScriptingEffect::SCRIPTING_EFFECT_REGION; else if (!scumm_stricmp(keytype, "\"TIMER\"")) - _type = SideFX::SIDEFX_TIMER; + _type = ScriptingEffect::SCRIPTING_EFFECT_TIMER; else if (!scumm_stricmp(keytype, "\"TTYTEXT\"")) - _type = SideFX::SIDEFX_TTYTXT; + _type = ScriptingEffect::SCRIPTING_EFFECT_TTYTXT; else if (!scumm_stricmp(keytype, "\"ALL\"")) - _type = SideFX::SIDEFX_ALL; + _type = ScriptingEffect::SCRIPTING_EFFECT_ALL; } else _key = atoi(keytype); } bool ActionKill::execute() { if (_type) - _engine->getScriptManager()->killSideFxType((SideFX::SideFXType)_type); + _engine->getScriptManager()->killSideFxType((ScriptingEffect::ScriptingEffectType)_type); else _engine->getScriptManager()->killSideFx(_key); return true; @@ -580,10 +580,10 @@ ActionPreloadAnimation::~ActionPreloadAnimation() { } bool ActionPreloadAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); + AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate, false); + nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate, false); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); @@ -603,9 +603,9 @@ ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotkey, con } bool ActionUnloadAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_key); + AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_key); - if (nod && nod->getType() == SideFX::SIDEFX_ANIM) + if (nod && nod->getType() == ScriptingEffect::SCRIPTING_EFFECT_ANIM) _engine->getScriptManager()->deleteSideFx(_key); return true; @@ -648,10 +648,10 @@ ActionPlayAnimation::~ActionPlayAnimation() { } bool ActionPlayAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_slotKey); + AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey); if (!nod) { - nod = new AnimationNode(_engine, _slotKey, _fileName, _mask, _framerate); + nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate); _engine->getScriptManager()->addSideFX(nod); } else nod->stop(); @@ -683,7 +683,7 @@ ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 sl } bool ActionPlayPreloadAnimation::execute() { - AnimationNode *nod = (AnimationNode *)_engine->getScriptManager()->getSideFX(_controlKey); + AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_controlKey); if (nod) nod->addPlayNode(_slotKey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); @@ -731,7 +731,7 @@ bool ActionRegion::execute() { if (_engine->getScriptManager()->getSideFX(_slotKey)) return true; - Effect *effect = NULL; + GraphicsEffect *effect = NULL; switch (_type) { case 0: { uint16 centerX, centerY, frames; @@ -982,11 +982,11 @@ ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::S } bool ActionSyncSound::execute() { - SideFX *fx = _engine->getScriptManager()->getSideFX(_syncto); + ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_syncto); if (!fx) return true; - if (!(fx->getType() & SideFX::SIDEFX_ANIM)) + if (!(fx->getType() & ScriptingEffect::SCRIPTING_EFFECT_ANIM)) return true; _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); -- cgit v1.2.3 From 9f642074ba8e17aa23b01bcee82b2293fe84f8f1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 2 Jan 2015 04:52:53 +0200 Subject: ZVISION: Remove ActionRestoreGame and loading of r.svr (restart slot) This is handled internally now, so r.svr isn't needed anymore --- engines/zvision/scripting/actions.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index a61fa26223..e41ac90c20 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -22,14 +22,13 @@ #include "common/scummsys.h" -#include "zvision/scripting/actions.h" - #include "zvision/zvision.h" #include "zvision/scripting/script_manager.h" #include "zvision/graphics/render_manager.h" #include "zvision/sound/zork_raw.h" #include "zvision/video/zork_avi_decoder.h" #include "zvision/file/save_manager.h" +#include "zvision/scripting/actions.h" #include "zvision/scripting/menu.h" #include "zvision/scripting/effects/timer_effect.h" #include "zvision/scripting/effects/music_effect.h" @@ -803,22 +802,6 @@ bool ActionRandom::execute() { return true; } -////////////////////////////////////////////////////////////////////////////// -// ActionRestoreGame -////////////////////////////////////////////////////////////////////////////// - -ActionRestoreGame::ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { - char buf[128]; - sscanf(line.c_str(), "%s", buf); - _fileName = Common::String(buf); -} - -bool ActionRestoreGame::execute() { - _engine->getSaveManager()->loadGame(_fileName); - return false; -} - ////////////////////////////////////////////////////////////////////////////// // ActionRotateTo ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From cdbc06d0f74453584eac0611fcbe01785c6619c4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 Jan 2015 11:29:28 +0200 Subject: ZVISION: Use a common function for loading game animations --- engines/zvision/scripting/actions.cpp | 45 +++++++++++++++-------------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index e41ac90c20..4474a8801a 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -21,12 +21,11 @@ */ #include "common/scummsys.h" +#include "video/video_decoder.h" #include "zvision/zvision.h" #include "zvision/scripting/script_manager.h" #include "zvision/graphics/render_manager.h" -#include "zvision/sound/zork_raw.h" -#include "zvision/video/zork_avi_decoder.h" #include "zvision/file/save_manager.h" #include "zvision/scripting/actions.h" #include "zvision/scripting/menu.h" @@ -45,10 +44,6 @@ #include "zvision/graphics/effects/wave.h" #include "zvision/graphics/cursors/cursor_manager.h" -#include "common/file.h" - -#include "audio/decoders/wave.h" - namespace ZVision { ////////////////////////////////////////////////////////////////////////////// @@ -915,35 +910,33 @@ ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotkey, const Commo } bool ActionStreamVideo::execute() { - ZorkAVIDecoder decoder; - Common::File *_file = _engine->getSearchManager()->openFile(_fileName); + Video::VideoDecoder *decoder; + Common::Rect destRect = Common::Rect(_x1, _y1, _x2 + 1, _y2 + 1); - if (_file) { - if (!decoder.loadStream(_file)) { - return true; - } + Common::String subname = _fileName; + subname.setChar('s', subname.size() - 3); + subname.setChar('u', subname.size() - 2); + subname.setChar('b', subname.size() - 1); - _engine->getCursorManager()->showMouse(false); + if (!_engine->getSearchManager()->hasFile(_fileName)) + return true; - Common::Rect destRect = Common::Rect(_x1, _y1, _x2 + 1, _y2 + 1); + decoder = _engine->loadAnimation(_fileName); - Common::String subname = _fileName; - subname.setChar('s', subname.size() - 3); - subname.setChar('u', subname.size() - 2); - subname.setChar('b', subname.size() - 1); + _engine->getCursorManager()->showMouse(false); - Subtitle *sub = NULL; + Subtitle *sub = NULL; - if (_engine->getSearchManager()->hasFile(subname)) - sub = new Subtitle(_engine, subname); + if (_engine->getSearchManager()->hasFile(subname)) + sub = new Subtitle(_engine, subname); - _engine->playVideo(decoder, destRect, _skippable, sub); + _engine->playVideo(*decoder, destRect, _skippable, sub); + delete decoder; - _engine->getCursorManager()->showMouse(true); + _engine->getCursorManager()->showMouse(true); - if (sub) - delete sub; - } + if (sub) + delete sub; return true; } -- cgit v1.2.3 From 4ffaf4df376e6d93c1b5c4c820c975fdee64ec8f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 Jan 2015 11:39:02 +0200 Subject: ZVISION: Add stubs for the hires VOB MPEG2 videos of ZGI DVD VOB file handling is based on clone2727's work. The lowres videos are played for now, until AC3 sound handling is implemented --- engines/zvision/scripting/actions.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 4474a8801a..f60fdbb973 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -913,6 +913,19 @@ bool ActionStreamVideo::execute() { Video::VideoDecoder *decoder; Common::Rect destRect = Common::Rect(_x1, _y1, _x2 + 1, _y2 + 1); +#ifdef USE_MPEG2 + Common::String hiresFileName = _fileName; + hiresFileName.setChar('d', hiresFileName.size() - 8); + hiresFileName.setChar('v', hiresFileName.size() - 3); + hiresFileName.setChar('o', hiresFileName.size() - 2); + hiresFileName.setChar('b', hiresFileName.size() - 1); + + if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) + // TODO: Enable once VOB + AC3 support is implemented + //_fileName = hiresFileName; + warning("The hires videos of the DVD version of ZGI aren't supported yet, using lowres"); +#endif + Common::String subname = _fileName; subname.setChar('s', subname.size() - 3); subname.setChar('u', subname.size() - 2); -- cgit v1.2.3 From 899cf4813c7e009e1dbee56be8ad10d20650cf10 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 10 Jan 2015 21:32:15 +0200 Subject: ZVISION: Change screen resolution for the hires DVD videos to 800x600 Also, this hooks up the MPEG-PS decoder, but only if libmpeg2 is compiled in. The DVD videos are still disabled until AC3 audio support is implemented. The hires DVD videos are encoded a 720x480 resolution, with double the frame rate of the lowres ones (29.97FPS up from 15FPS) --- engines/zvision/scripting/actions.cpp | 50 +++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index f60fdbb973..e3fc6fa549 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -912,7 +912,15 @@ ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotkey, const Commo bool ActionStreamVideo::execute() { Video::VideoDecoder *decoder; Common::Rect destRect = Common::Rect(_x1, _y1, _x2 + 1, _y2 + 1); + Common::String subname = _fileName; + subname.setChar('s', subname.size() - 3); + subname.setChar('u', subname.size() - 2); + subname.setChar('b', subname.size() - 1); + bool subtitleExists = _engine->getSearchManager()->hasFile(subname); + bool switchToHires = false; +// NOTE: We only show the hires MPEG2 videos when libmpeg2 is compiled in, +// otherwise we fall back to the lowres ones #ifdef USE_MPEG2 Common::String hiresFileName = _fileName; hiresFileName.setChar('d', hiresFileName.size() - 8); @@ -920,36 +928,44 @@ bool ActionStreamVideo::execute() { hiresFileName.setChar('o', hiresFileName.size() - 2); hiresFileName.setChar('b', hiresFileName.size() - 1); - if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) - // TODO: Enable once VOB + AC3 support is implemented - //_fileName = hiresFileName; + if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) { + // TODO: Enable once AC3 support is implemented + if (!_engine->getSearchManager()->hasFile(_fileName)) // Check for the regular video + return true; warning("The hires videos of the DVD version of ZGI aren't supported yet, using lowres"); -#endif - - Common::String subname = _fileName; - subname.setChar('s', subname.size() - 3); - subname.setChar('u', subname.size() - 2); - subname.setChar('b', subname.size() - 1); - + //_fileName = hiresFileName; + //switchToHires = true; + } else if (!_engine->getSearchManager()->hasFile(_fileName)) + return true; +#else if (!_engine->getSearchManager()->hasFile(_fileName)) return true; +#endif decoder = _engine->loadAnimation(_fileName); + Subtitle *sub = (subtitleExists) ? new Subtitle(_engine, subname, switchToHires) : NULL; _engine->getCursorManager()->showMouse(false); - Subtitle *sub = NULL; - - if (_engine->getSearchManager()->hasFile(subname)) - sub = new Subtitle(_engine, subname); + if (switchToHires) { + _engine->initHiresScreen(); + destRect = Common::Rect(40, -40, 760, 440); + Common::Rect workingWindow = _engine->_workingWindow; + workingWindow.translate(0, -40); + _engine->getRenderManager()->initSubArea(HIRES_WINDOW_WIDTH, HIRES_WINDOW_HEIGHT, workingWindow); + } _engine->playVideo(*decoder, destRect, _skippable, sub); - delete decoder; + + if (switchToHires) { + _engine->initScreen(); + _engine->getRenderManager()->initSubArea(WINDOW_WIDTH, WINDOW_HEIGHT, _engine->_workingWindow); + } _engine->getCursorManager()->showMouse(true); - if (sub) - delete sub; + delete decoder; + delete sub; return true; } -- cgit v1.2.3 From 21e9007d80ee60e519896c330324e5e3a95f772f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 10 Jan 2015 22:03:15 +0200 Subject: Revert "ZVISION: Remove ActionRestoreGame and loading of r.svr (restart slot)" This reverts commit 9f642074ba8e17aa23b01bcee82b2293fe84f8f1, as it broke the credits screen in ZGI. This has been rewritten to use the common save code --- engines/zvision/scripting/actions.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index e3fc6fa549..e989478dd1 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -23,11 +23,12 @@ #include "common/scummsys.h" #include "video/video_decoder.h" +#include "zvision/scripting/actions.h" + #include "zvision/zvision.h" #include "zvision/scripting/script_manager.h" #include "zvision/graphics/render_manager.h" #include "zvision/file/save_manager.h" -#include "zvision/scripting/actions.h" #include "zvision/scripting/menu.h" #include "zvision/scripting/effects/timer_effect.h" #include "zvision/scripting/effects/music_effect.h" @@ -797,6 +798,22 @@ bool ActionRandom::execute() { return true; } +////////////////////////////////////////////////////////////////////////////// +// ActionRestoreGame +////////////////////////////////////////////////////////////////////////////// + +ActionRestoreGame::ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line) : + ResultAction(engine, slotkey) { + char buf[128]; + sscanf(line.c_str(), "%s", buf); + _fileName = Common::String(buf); +} + +bool ActionRestoreGame::execute() { + _engine->getSaveManager()->loadGame(-1); + return false; +} + ////////////////////////////////////////////////////////////////////////////// // ActionRotateTo ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 28e27ea1d94f1df4c8e68216c086cb57c396ccd8 Mon Sep 17 00:00:00 2001 From: RichieSams Date: Thu, 15 Jan 2015 00:31:39 -0600 Subject: ZVISION: Allow multiple sound effects to play at the same time This is the original behavior. This was noted in bug #6761. Specifically, the knocker on the door plays a sound whenever it is a the top of the bottom of the swing. By only allowing one sound effect to play at the same time, the knocker would only play once, even though it bounces at the bottom. --- engines/zvision/scripting/actions.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index e989478dd1..3aab6d8830 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -486,9 +486,6 @@ ActionMusic::~ActionMusic() { } bool ActionMusic::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) - return true; - if (_midi) { _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); } else { -- cgit v1.2.3 From 9f00880aa40abb7584a007e10591ee5aa593ae7a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Jan 2015 14:08:15 +0200 Subject: ZVISION: Properly handle sounds reusing the same sound slot (bug #6761) This is based on Marisa-Chan's observations in commit 28e27ea1d9. Tested with both ZNEM and ZGI --- engines/zvision/scripting/actions.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 3aab6d8830..ce6bd31ee4 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -486,6 +486,11 @@ ActionMusic::~ActionMusic() { } bool ActionMusic::execute() { + if (_engine->getScriptManager()->getSideFX(_slotKey)) { + _engine->getScriptManager()->killSideFx(_slotKey); + _engine->getScriptManager()->setStateValue(_slotKey, 2); + } + if (_midi) { _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); } else { -- cgit v1.2.3 From 263c5924906b2fcb3303850ad919e158cb06e120 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Jan 2015 23:37:59 +0200 Subject: ZVISION: Fix bug #6769 (the "Alchemical debacle" video in ZGI) --- engines/zvision/scripting/actions.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index ce6bd31ee4..758158817e 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -638,6 +638,13 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C _mask = -1; _fileName = Common::String(fileName); + + // WORKAROUND for bug #6769, location me1g.scr (the "Alchemical debacle" + // video in ZGI). We only scale up by 2x, in AnimationEffect::process(), + // but the dimensions of the target frame are off by 2 pixels. We fix that + // here, so that the video can be scaled. + if (_fileName == "me1ga011.avi" && _y2 == 213) + _y2 = 215; } ActionPlayAnimation::~ActionPlayAnimation() { -- cgit v1.2.3 From 9b498d576ed9b922ef61175310a6b369e4d30e3f Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Fri, 23 Jan 2015 16:26:17 +0600 Subject: ZVISION: Correct value for attenuate --- engines/zvision/scripting/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 758158817e..b12ecf66ee 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -104,7 +104,7 @@ bool ActionAttenuate::execute() { ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNode *mus = (MusicNode *)fx; - mus->setVolume(255 - (abs(_attenuation) >> 7)); + mus->setVolume(255 * (10000 - abs(_attenuation)) / 10000 ); } return true; } -- cgit v1.2.3 From 568c13b11531fcfb10b53bbc84d723e6fd1d0e40 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Fri, 23 Jan 2015 16:31:10 +0600 Subject: ZVISION: Use correct virtual class type instead of MusicNode --- engines/zvision/scripting/actions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index b12ecf66ee..9a2f1d10ff 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -103,7 +103,7 @@ ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::S bool ActionAttenuate::execute() { ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { - MusicNode *mus = (MusicNode *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->setVolume(255 * (10000 - abs(_attenuation)) / 10000 ); } return true; @@ -154,7 +154,7 @@ bool ActionCrossfade::execute() { if (_keyOne) { ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyOne); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { - MusicNode *mus = (MusicNode *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; if (_oneStartVolume >= 0) mus->setVolume((_oneStartVolume * 255) / 100); @@ -165,7 +165,7 @@ bool ActionCrossfade::execute() { if (_keyTwo) { ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyTwo); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { - MusicNode *mus = (MusicNode *)fx; + MusicNodeBASE *mus = (MusicNodeBASE *)fx; if (_twoStartVolume >= 0) mus->setVolume((_twoStartVolume * 255) / 100); -- cgit v1.2.3 From 51e90b2422f0bf3b4b9b1a71c23ae12a359dead2 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 26 Jan 2015 19:34:21 +0100 Subject: ZVISION: Fix ActionMusic volume The volume can be either a constant or a state value. The latter is used by ZGI to simulate a sound being heard at different distances, e.g. the beehive in the Dungeon Master's hideout. --- engines/zvision/scripting/actions.cpp | 63 ++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 9a2f1d10ff..81d6655fa9 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -21,6 +21,7 @@ */ #include "common/scummsys.h" +#include "common/tokenizer.h" #include "video/video_decoder.h" #include "zvision/scripting/actions.h" @@ -449,33 +450,40 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l _note(0), _prog(0), _universe(global) { - uint type = 0; - char fileNameBuffer[25]; - uint loop = 0; - uint volume = 255; + Common::StringTokenizer tokenizer(line); - sscanf(line.c_str(), "%u %24s %u %u", &type, fileNameBuffer, &loop, &volume); + // Parse the type of action. Type 4 actions are MIDI commands, not + // files. These are only used by Zork: Nemesis, for the flute and piano + // puzzles (tj4e and ve6f, as well as vr) + uint type = atoi(tokenizer.nextToken().c_str()); - // Type 4 actions are MIDI commands, not files. These are only used by - // Zork: Nemesis, for the flute and piano puzzles (tj4e and ve6f, as well - // as vr) if (type == 4) { _midi = true; - int note; - int prog; - sscanf(line.c_str(), "%u %d %d %u", &type, &prog, ¬e, &volume); - _volume = volume; - _note = note; - _prog = prog; + _prog = atoi(tokenizer.nextToken().c_str()); + _note = atoi(tokenizer.nextToken().c_str()); + _volume = atoi(tokenizer.nextToken().c_str()); + _volumeIsAKey = false; } else { _midi = false; - _fileName = Common::String(fileNameBuffer); - _loop = loop == 1 ? true : false; - - // Volume is optional. If it doesn't appear, assume full volume - if (volume != 255) { - // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] - _volume = volume * 255 / 100; + _fileName = tokenizer.nextToken(); + _loop = atoi(tokenizer.nextToken().c_str()) == 1; + if (!tokenizer.empty()) { + Common::String token = tokenizer.nextToken(); + if (token.contains('[')) { + sscanf(token.c_str(), "[%u]", &_volume); + _volumeIsAKey = true; + } else { + _volume = atoi(token.c_str()); + if (_volume > 100) { + warning("ActionMusic: Adjusting volume for %s from %d to 100", _fileName.c_str(), _volume); + _volume = 100; + } + _volumeIsAKey = false; + } + } else { + // Volume is optional. If it doesn't appear, assume full volume + _volume = 100; + _volumeIsAKey = false; } } } @@ -491,13 +499,22 @@ bool ActionMusic::execute() { _engine->getScriptManager()->setStateValue(_slotKey, 2); } + uint volume; + if (_volumeIsAKey) { + volume = _engine->getScriptManager()->getStateValue(_volume); + } else { + volume = _volume; + } + if (_midi) { - _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); + _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume)); } else { if (!_engine->getSearchManager()->hasFile(_fileName)) return true; - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, _volume)); + // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] + + _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100)); } return true; -- cgit v1.2.3 From dd5cd42f2eff7ca320fe507916b65a06c3a0ee74 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 26 Jan 2015 22:07:47 +0100 Subject: ZVISION: Use ValueSlot for volume in ActionMusic As suggested by Marisa-Chan. I had based my earlier implementation on parseCritera(), and was unaware of this alternative. The good thing is that the diff from the old code is now much smaller, which should reduce the risk of regressions. (There is a lot I haven't tested here...) --- engines/zvision/scripting/actions.cpp | 64 +++++++++++++++-------------------- 1 file changed, 27 insertions(+), 37 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 81d6655fa9..d851a74dec 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -21,7 +21,6 @@ */ #include "common/scummsys.h" -#include "common/tokenizer.h" #include "video/video_decoder.h" #include "zvision/scripting/actions.h" @@ -446,51 +445,48 @@ bool ActionMenuBarEnable::execute() { ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &line, bool global) : ResultAction(engine, slotkey), - _volume(255), _note(0), _prog(0), _universe(global) { - Common::StringTokenizer tokenizer(line); + uint type = 0; + char fileNameBuffer[25]; + uint loop = 0; + char volumeBuffer[15]; - // Parse the type of action. Type 4 actions are MIDI commands, not - // files. These are only used by Zork: Nemesis, for the flute and piano - // puzzles (tj4e and ve6f, as well as vr) - uint type = atoi(tokenizer.nextToken().c_str()); + // Volume is optional. If it doesn't appear, assume full volume + strcpy(volumeBuffer, "100"); + sscanf(line.c_str(), "%u %24s %u %14s", &type, fileNameBuffer, &loop, volumeBuffer); + + // Type 4 actions are MIDI commands, not files. These are only used by + // Zork: Nemesis, for the flute and piano puzzles (tj4e and ve6f, as well + // as vr) if (type == 4) { _midi = true; - _prog = atoi(tokenizer.nextToken().c_str()); - _note = atoi(tokenizer.nextToken().c_str()); - _volume = atoi(tokenizer.nextToken().c_str()); - _volumeIsAKey = false; + int note; + int prog; + sscanf(line.c_str(), "%u %d %d %14s", &type, &prog, ¬e, volumeBuffer); + _volume = new ValueSlot(_engine->getScriptManager(), volumeBuffer); + _note = note; + _prog = prog; } else { _midi = false; - _fileName = tokenizer.nextToken(); - _loop = atoi(tokenizer.nextToken().c_str()) == 1; - if (!tokenizer.empty()) { - Common::String token = tokenizer.nextToken(); - if (token.contains('[')) { - sscanf(token.c_str(), "[%u]", &_volume); - _volumeIsAKey = true; - } else { - _volume = atoi(token.c_str()); - if (_volume > 100) { - warning("ActionMusic: Adjusting volume for %s from %d to 100", _fileName.c_str(), _volume); - _volume = 100; - } - _volumeIsAKey = false; - } - } else { - // Volume is optional. If it doesn't appear, assume full volume - _volume = 100; - _volumeIsAKey = false; + _fileName = Common::String(fileNameBuffer); + _loop = loop == 1 ? true : false; + if (volumeBuffer[0] != '[' && atoi(volumeBuffer) > 100) { + // I thought I saw a case like this in Zork Nemesis, so + // let's guard against it. + warning("ActionMusic: Adjusting volume for %s from %s to 100", _fileName.c_str(), volumeBuffer); + strcpy(volumeBuffer, "100"); } + _volume = new ValueSlot(engine->getScriptManager(), volumeBuffer); } } ActionMusic::~ActionMusic() { if (!_universe) _engine->getScriptManager()->killSideFx(_slotKey); + delete _volume; } bool ActionMusic::execute() { @@ -499,12 +495,7 @@ bool ActionMusic::execute() { _engine->getScriptManager()->setStateValue(_slotKey, 2); } - uint volume; - if (_volumeIsAKey) { - volume = _engine->getScriptManager()->getStateValue(_volume); - } else { - volume = _volume; - } + uint volume = _volume->getValue(); if (_midi) { _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume)); @@ -513,7 +504,6 @@ bool ActionMusic::execute() { return true; // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100)); } -- cgit v1.2.3 From 8c8261aa2a381c3e7f12c5dd0aaf33a69e1f7eb3 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 26 Jan 2015 22:14:26 +0100 Subject: ZVISION: Cleanup. We usually don't check a pointer before deleting it. --- engines/zvision/scripting/actions.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index d851a74dec..5238561149 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -79,8 +79,7 @@ ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String } ActionAssign::~ActionAssign() { - if (_value) - delete _value; + delete _value; } bool ActionAssign::execute() { @@ -804,8 +803,7 @@ ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String } ActionRandom::~ActionRandom() { - if (_max) - delete _max; + delete _max; } bool ActionRandom::execute() { @@ -1044,8 +1042,7 @@ ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &l } ActionTimer::~ActionTimer() { - if (_time) - delete _time; + delete _time; _engine->getScriptManager()->killSideFx(_slotKey); } -- cgit v1.2.3 From 60c06b84b68a5711db442d8fd296f3978d685da5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 14 Feb 2015 14:55:09 +0200 Subject: ZVISION: Fix script bug #6794 - "ZVISION: Yoruk's coffin instant death" Fixes an edge case where the player goes to the dark room with the grue without holding a torch, and then quickly runs away before the grue's sound effect finishes. Many thanks to eriktorbjorn for the original workaround --- engines/zvision/scripting/actions.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 5238561149..248ebaec49 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -480,6 +480,14 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l } _volume = new ValueSlot(engine->getScriptManager(), volumeBuffer); } + + // WORKAROUND for a script bug in Zork Nemesis, rooms mq70/mq80. + // Fixes an edge case where the player goes to the dark room with the grue + // without holding a torch, and then quickly runs away before the grue's + // sound effect finishes. Fixes script bug #6794. + if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && engine->getScriptManager()->getStateValue(_slotKey) == 2) + engine->getScriptManager()->setStateValue(_slotKey, 0); + } ActionMusic::~ActionMusic() { -- cgit v1.2.3 From 9ce285a11e1bfc981c518e89f2401b1896b4a367 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 14 Feb 2015 15:07:15 +0200 Subject: ZVISION: Also reference the script manager in ResultAction members --- engines/zvision/scripting/actions.cpp | 127 +++++++++++++++++----------------- 1 file changed, 65 insertions(+), 62 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 248ebaec49..90d32e47ce 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -47,6 +47,9 @@ namespace ZVision { +ResultAction::ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey), _scriptManager(engine->getScriptManager()) { +} + ////////////////////////////////////////////////////////////////////////////// // ActionAdd ////////////////////////////////////////////////////////////////////////////// @@ -60,7 +63,7 @@ ActionAdd::ActionAdd(ZVision *engine, int32 slotkey, const Common::String &line) } bool ActionAdd::execute() { - _engine->getScriptManager()->setStateValue(_key, _engine->getScriptManager()->getStateValue(_key) + _value); + _scriptManager->setStateValue(_key, _scriptManager->getStateValue(_key) + _value); return true; } @@ -75,7 +78,7 @@ ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String char buf[64]; memset(buf, 0, 64); sscanf(line.c_str(), "%u, %s", &_key, buf); - _value = new ValueSlot(_engine->getScriptManager(), buf); + _value = new ValueSlot(_scriptManager, buf); } ActionAssign::~ActionAssign() { @@ -83,7 +86,7 @@ ActionAssign::~ActionAssign() { } bool ActionAssign::execute() { - _engine->getScriptManager()->setStateValue(_key, _value->getValue()); + _scriptManager->setStateValue(_key, _value->getValue()); return true; } @@ -100,7 +103,7 @@ ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::S } bool ActionAttenuate::execute() { - ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key); + ScriptingEffect *fx = _scriptManager->getSideFX(_key); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNodeBASE *mus = (MusicNodeBASE *)fx; mus->setVolume(255 * (10000 - abs(_attenuation)) / 10000 ); @@ -125,7 +128,7 @@ ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotkey, const bool ActionChangeLocation::execute() { // We can't directly call ScriptManager::ChangeLocationIntern() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking - _engine->getScriptManager()->changeLocation(_world, _room, _node, _view, _offset); + _scriptManager->changeLocation(_world, _room, _node, _view, _offset); // Tell the puzzle system to stop checking any more puzzles return false; } @@ -151,7 +154,7 @@ ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotkey, const Common::S bool ActionCrossfade::execute() { if (_keyOne) { - ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyOne); + ScriptingEffect *fx = _scriptManager->getSideFX(_keyOne); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNodeBASE *mus = (MusicNodeBASE *)fx; if (_oneStartVolume >= 0) @@ -162,7 +165,7 @@ bool ActionCrossfade::execute() { } if (_keyTwo) { - ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyTwo); + ScriptingEffect *fx = _scriptManager->getSideFX(_keyTwo); if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) { MusicNodeBASE *mus = (MusicNodeBASE *)fx; if (_twoStartVolume >= 0) @@ -233,7 +236,7 @@ ActionDisableControl::ActionDisableControl(ZVision *engine, int32 slotkey, const } bool ActionDisableControl::execute() { - _engine->getScriptManager()->setStateFlag(_key, Puzzle::DISABLED); + _scriptManager->setStateFlag(_key, Puzzle::DISABLED); return true; } @@ -250,7 +253,7 @@ ActionDisplayMessage::ActionDisplayMessage(ZVision *engine, int32 slotkey, const } bool ActionDisplayMessage::execute() { - Control *ctrl = _engine->getScriptManager()->getControl(_control); + Control *ctrl = _scriptManager->getControl(_control); if (ctrl && ctrl->getType() == Control::CONTROL_TITLER) { TitlerControl *titler = (TitlerControl *)ctrl; titler->setString(_msgid); @@ -289,14 +292,14 @@ ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::Strin } ActionDistort::~ActionDistort() { - _engine->getScriptManager()->killSideFx(_distSlot); + _scriptManager->killSideFx(_distSlot); } bool ActionDistort::execute() { - if (_engine->getScriptManager()->getSideFX(_distSlot)) + if (_scriptManager->getSideFX(_distSlot)) return true; - _engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale)); + _scriptManager->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale)); return true; } @@ -313,7 +316,7 @@ ActionEnableControl::ActionEnableControl(ZVision *engine, int32 slotkey, const C } bool ActionEnableControl::execute() { - _engine->getScriptManager()->unsetStateFlag(_key, Puzzle::DISABLED); + _scriptManager->unsetStateFlag(_key, Puzzle::DISABLED); return true; } @@ -326,8 +329,8 @@ ActionFlushMouseEvents::ActionFlushMouseEvents(ZVision *engine, int32 slotkey) : } bool ActionFlushMouseEvents::execute() { - _engine->getScriptManager()->flushEvent(Common::EVENT_LBUTTONUP); - _engine->getScriptManager()->flushEvent(Common::EVENT_LBUTTONDOWN); + _scriptManager->flushEvent(Common::EVENT_LBUTTONUP); + _scriptManager->flushEvent(Common::EVENT_LBUTTONDOWN); return true; } @@ -360,22 +363,22 @@ ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::S bool ActionInventory::execute() { switch (_type) { case 0: // add - _engine->getScriptManager()->inventoryAdd(_key); + _scriptManager->inventoryAdd(_key); break; case 1: // addi - _engine->getScriptManager()->inventoryAdd(_engine->getScriptManager()->getStateValue(_key)); + _scriptManager->inventoryAdd(_scriptManager->getStateValue(_key)); break; case 2: // drop if (_key >= 0) - _engine->getScriptManager()->inventoryDrop(_key); + _scriptManager->inventoryDrop(_key); else - _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem)); + _scriptManager->inventoryDrop(_scriptManager->getStateValue(StateKey_InventoryItem)); break; case 3: // dropi - _engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(_key)); + _scriptManager->inventoryDrop(_scriptManager->getStateValue(_key)); break; case 4: // cycle - _engine->getScriptManager()->inventoryCycle(); + _scriptManager->inventoryCycle(); break; default: break; @@ -416,9 +419,9 @@ ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &lin bool ActionKill::execute() { if (_type) - _engine->getScriptManager()->killSideFxType((ScriptingEffect::ScriptingEffectType)_type); + _scriptManager->killSideFxType((ScriptingEffect::ScriptingEffectType)_type); else - _engine->getScriptManager()->killSideFx(_key); + _scriptManager->killSideFx(_key); return true; } @@ -465,7 +468,7 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l int note; int prog; sscanf(line.c_str(), "%u %d %d %14s", &type, &prog, ¬e, volumeBuffer); - _volume = new ValueSlot(_engine->getScriptManager(), volumeBuffer); + _volume = new ValueSlot(_scriptManager, volumeBuffer); _note = note; _prog = prog; } else { @@ -478,40 +481,40 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l warning("ActionMusic: Adjusting volume for %s from %s to 100", _fileName.c_str(), volumeBuffer); strcpy(volumeBuffer, "100"); } - _volume = new ValueSlot(engine->getScriptManager(), volumeBuffer); + _volume = new ValueSlot(_scriptManager, volumeBuffer); } // WORKAROUND for a script bug in Zork Nemesis, rooms mq70/mq80. // Fixes an edge case where the player goes to the dark room with the grue // without holding a torch, and then quickly runs away before the grue's // sound effect finishes. Fixes script bug #6794. - if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && engine->getScriptManager()->getStateValue(_slotKey) == 2) - engine->getScriptManager()->setStateValue(_slotKey, 0); + if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && _scriptManager->getStateValue(_slotKey) == 2) + _scriptManager->setStateValue(_slotKey, 0); } ActionMusic::~ActionMusic() { if (!_universe) - _engine->getScriptManager()->killSideFx(_slotKey); + _scriptManager->killSideFx(_slotKey); delete _volume; } bool ActionMusic::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) { - _engine->getScriptManager()->killSideFx(_slotKey); - _engine->getScriptManager()->setStateValue(_slotKey, 2); + if (_scriptManager->getSideFX(_slotKey)) { + _scriptManager->killSideFx(_slotKey); + _scriptManager->setStateValue(_slotKey, 2); } uint volume = _volume->getValue(); if (_midi) { - _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume)); + _scriptManager->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume)); } else { if (!_engine->getSearchManager()->hasFile(_fileName)) return true; // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100)); + _scriptManager->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100)); } return true; @@ -530,14 +533,14 @@ ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotkey, const Common::Str } ActionPanTrack::~ActionPanTrack() { - _engine->getScriptManager()->killSideFx(_slotKey); + _scriptManager->killSideFx(_slotKey); } bool ActionPanTrack::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) + if (_scriptManager->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos)); + _scriptManager->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos)); return true; } @@ -587,18 +590,18 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c } ActionPreloadAnimation::~ActionPreloadAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotKey); + _scriptManager->deleteSideFx(_slotKey); } bool ActionPreloadAnimation::execute() { - AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey); + AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_slotKey); if (!nod) { nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate, false); - _engine->getScriptManager()->addSideFX(nod); + _scriptManager->addSideFX(nod); } else nod->stop(); - _engine->getScriptManager()->setStateValue(_slotKey, 2); + _scriptManager->setStateValue(_slotKey, 2); return true; } @@ -614,10 +617,10 @@ ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotkey, con } bool ActionUnloadAnimation::execute() { - AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_key); + AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_key); if (nod && nod->getType() == ScriptingEffect::SCRIPTING_EFFECT_ANIM) - _engine->getScriptManager()->deleteSideFx(_key); + _scriptManager->deleteSideFx(_key); return true; } @@ -662,15 +665,15 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C } ActionPlayAnimation::~ActionPlayAnimation() { - _engine->getScriptManager()->deleteSideFx(_slotKey); + _scriptManager->deleteSideFx(_slotKey); } bool ActionPlayAnimation::execute() { - AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey); + AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_slotKey); if (!nod) { nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate); - _engine->getScriptManager()->addSideFX(nod); + _scriptManager->addSideFX(nod); } else nod->stop(); @@ -701,7 +704,7 @@ ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 sl } bool ActionPlayPreloadAnimation::execute() { - AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_controlKey); + AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_controlKey); if (nod) nod->addPlayNode(_slotKey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount); @@ -742,11 +745,11 @@ ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String } ActionRegion::~ActionRegion() { - _engine->getScriptManager()->killSideFx(_slotKey); + _scriptManager->killSideFx(_slotKey); } bool ActionRegion::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) + if (_scriptManager->getSideFX(_slotKey)) return true; GraphicsEffect *effect = NULL; @@ -791,7 +794,7 @@ bool ActionRegion::execute() { } if (effect) { - _engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effect, _delay)); + _scriptManager->addSideFX(new RegionNode(_engine, _slotKey, effect, _delay)); _engine->getRenderManager()->addEffect(effect); } @@ -807,7 +810,7 @@ ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String char maxBuffer[64]; memset(maxBuffer, 0, 64); sscanf(line.c_str(), "%s", maxBuffer); - _max = new ValueSlot(_engine->getScriptManager(), maxBuffer); + _max = new ValueSlot(_scriptManager, maxBuffer); } ActionRandom::~ActionRandom() { @@ -816,7 +819,7 @@ ActionRandom::~ActionRandom() { bool ActionRandom::execute() { uint randNumber = _engine->getRandomSource()->getRandomNumber(_max->getValue()); - _engine->getScriptManager()->setStateValue(_slotKey, randNumber); + _scriptManager->setStateValue(_slotKey, randNumber); return true; } @@ -923,7 +926,7 @@ ActionStop::ActionStop(ZVision *engine, int32 slotkey, const Common::String &lin } bool ActionStop::execute() { - _engine->getScriptManager()->stopSideFx(_key); + _scriptManager->stopSideFx(_key); return true; } @@ -967,7 +970,7 @@ bool ActionStreamVideo::execute() { hiresFileName.setChar('o', hiresFileName.size() - 2); hiresFileName.setChar('b', hiresFileName.size() - 1); - if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) { + if (_scriptManager->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) { // TODO: Enable once AC3 support is implemented if (!_engine->getSearchManager()->hasFile(_fileName)) // Check for the regular video return true; @@ -1026,14 +1029,14 @@ ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::S } bool ActionSyncSound::execute() { - ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_syncto); + ScriptingEffect *fx = _scriptManager->getSideFX(_syncto); if (!fx) return true; if (!(fx->getType() & ScriptingEffect::SCRIPTING_EFFECT_ANIM)) return true; - _engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); + _scriptManager->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto)); return true; } @@ -1046,18 +1049,18 @@ ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &l char timeBuffer[64]; memset(timeBuffer, 0, 64); sscanf(line.c_str(), "%s", timeBuffer); - _time = new ValueSlot(_engine->getScriptManager(), timeBuffer); + _time = new ValueSlot(_scriptManager, timeBuffer); } ActionTimer::~ActionTimer() { delete _time; - _engine->getScriptManager()->killSideFx(_slotKey); + _scriptManager->killSideFx(_slotKey); } bool ActionTimer::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) + if (_scriptManager->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue())); + _scriptManager->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue())); return true; } @@ -1077,13 +1080,13 @@ ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::Strin } ActionTtyText::~ActionTtyText() { - _engine->getScriptManager()->killSideFx(_slotKey); + _scriptManager->killSideFx(_slotKey); } bool ActionTtyText::execute() { - if (_engine->getScriptManager()->getSideFX(_slotKey)) + if (_scriptManager->getSideFX(_slotKey)) return true; - _engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay)); + _scriptManager->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay)); return true; } -- cgit v1.2.3 From 53a2c30cb014997887e29f5fd0db1348d05990f0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 14 Feb 2015 15:27:01 +0200 Subject: ZVISION: Fix script bug #6791 (max value of delay_render) This fixes the delay outside the Frobozz Electric building. In all other places, delay_render is called with a value ranging from 1 to 10, so the 100 here looks to be a script bug, and causes an unnecessary long pause in that scene. Thus, we're capping the frame delay value to 10. --- engines/zvision/scripting/actions.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 90d32e47ce..21c97e766b 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -217,6 +217,9 @@ ActionDelayRender::ActionDelayRender(ZVision *engine, int32 slotkey, const Commo ResultAction(engine, slotkey) { _framesToDelay = 0; sscanf(line.c_str(), "%u", &_framesToDelay); + // Limit to 10 frames maximum. This fixes the script bug in ZGI scene px10 + // (outside Frobozz Electric building), where this is set to 100 (bug #6791). + _framesToDelay = MIN(_framesToDelay, 10); } bool ActionDelayRender::execute() { -- cgit v1.2.3 From ec16861ec981eadbcef55454fb67b22502c6c65b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 22 Mar 2015 08:14:18 +0100 Subject: ZVISION: Silence Cppcheck warning --- engines/zvision/scripting/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 21c97e766b..9a8b734e0c 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -1077,7 +1077,7 @@ ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::Strin char filename[64]; int32 x1 = 0, y1 = 0, x2 = 0, y2 = 0; - sscanf(line.c_str(), "%d %d %d %d %64s %u", &x1, &y1, &x2, &y2, filename, &_delay); + sscanf(line.c_str(), "%d %d %d %d %63s %u", &x1, &y1, &x2, &y2, filename, &_delay); _r = Common::Rect(x1, y1, x2, y2); _filename = Common::String(filename); } -- cgit v1.2.3 From fdc4edfa9902322ee9792d513ae09f30aa03fbe1 Mon Sep 17 00:00:00 2001 From: David Russo Date: Wed, 10 Jun 2015 16:56:04 +0100 Subject: ZVISION: Correct code style --- engines/zvision/scripting/actions.cpp | 137 +++++++++++++++++----------------- 1 file changed, 70 insertions(+), 67 deletions(-) (limited to 'engines/zvision/scripting/actions.cpp') diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 9a8b734e0c..e1380b0eb2 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -47,15 +47,18 @@ namespace ZVision { -ResultAction::ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey), _scriptManager(engine->getScriptManager()) { +ResultAction::ResultAction(ZVision *engine, int32 slotKey) : + _engine(engine), + _slotKey(slotKey), + _scriptManager(engine->getScriptManager()) { } ////////////////////////////////////////////////////////////////////////////// // ActionAdd ////////////////////////////////////////////////////////////////////////////// -ActionAdd::ActionAdd(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionAdd::ActionAdd(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; _value = 0; @@ -71,8 +74,8 @@ bool ActionAdd::execute() { // ActionAssign ////////////////////////////////////////////////////////////////////////////// -ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionAssign::ActionAssign(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; char buf[64]; @@ -94,8 +97,8 @@ bool ActionAssign::execute() { // ActionAttenuate ////////////////////////////////////////////////////////////////////////////// -ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; _attenuation = 0; @@ -115,8 +118,8 @@ bool ActionAttenuate::execute() { // ActionChangeLocation ////////////////////////////////////////////////////////////////////////////// -ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _world = 'g'; _room = 'a'; _node = 'r'; @@ -137,8 +140,8 @@ bool ActionChangeLocation::execute() { // ActionCrossfade ////////////////////////////////////////////////////////////////////////////// -ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _keyOne = 0; _keyTwo = 0; _oneStartVolume = 0; @@ -181,8 +184,8 @@ bool ActionCrossfade::execute() { // ActionCursor ////////////////////////////////////////////////////////////////////////////// -ActionCursor::ActionCursor(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionCursor::ActionCursor(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { Common::String up = line; up.toUppercase(); _action = 0; @@ -213,8 +216,8 @@ bool ActionCursor::execute() { // ActionDelayRender ////////////////////////////////////////////////////////////////////////////// -ActionDelayRender::ActionDelayRender(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionDelayRender::ActionDelayRender(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _framesToDelay = 0; sscanf(line.c_str(), "%u", &_framesToDelay); // Limit to 10 frames maximum. This fixes the script bug in ZGI scene px10 @@ -231,8 +234,8 @@ bool ActionDelayRender::execute() { // ActionDisableControl ////////////////////////////////////////////////////////////////////////////// -ActionDisableControl::ActionDisableControl(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionDisableControl::ActionDisableControl(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; sscanf(line.c_str(), "%u", &_key); @@ -247,8 +250,8 @@ bool ActionDisableControl::execute() { // ActionDisplayMessage ////////////////////////////////////////////////////////////////////////////// -ActionDisplayMessage::ActionDisplayMessage(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionDisplayMessage::ActionDisplayMessage(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _control = 0; _msgid = 0; @@ -282,8 +285,8 @@ bool ActionDissolve::execute() { // ActionDistort - only used by Zork: Nemesis for the "treatment" puzzle in the Sanitarium (aj30) ////////////////////////////////////////////////////////////////////////////// -ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionDistort::ActionDistort(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _distSlot = 0; _speed = 0; _startAngle = 60.0; @@ -311,8 +314,8 @@ bool ActionDistort::execute() { // ActionEnableControl ////////////////////////////////////////////////////////////////////////////// -ActionEnableControl::ActionEnableControl(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionEnableControl::ActionEnableControl(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; sscanf(line.c_str(), "%u", &_key); @@ -327,8 +330,8 @@ bool ActionEnableControl::execute() { // ActionFlushMouseEvents ////////////////////////////////////////////////////////////////////////////// -ActionFlushMouseEvents::ActionFlushMouseEvents(ZVision *engine, int32 slotkey) : - ResultAction(engine, slotkey) { +ActionFlushMouseEvents::ActionFlushMouseEvents(ZVision *engine, int32 slotKey) : + ResultAction(engine, slotKey) { } bool ActionFlushMouseEvents::execute() { @@ -341,8 +344,8 @@ bool ActionFlushMouseEvents::execute() { // ActionInventory ////////////////////////////////////////////////////////////////////////////// -ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionInventory::ActionInventory(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _type = -1; _key = 0; @@ -393,8 +396,8 @@ bool ActionInventory::execute() { // ActionKill - only used by ZGI ////////////////////////////////////////////////////////////////////////////// -ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionKill::ActionKill(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; _type = 0; char keytype[25]; @@ -432,8 +435,8 @@ bool ActionKill::execute() { // ActionMenuBarEnable ////////////////////////////////////////////////////////////////////////////// -ActionMenuBarEnable::ActionMenuBarEnable(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionMenuBarEnable::ActionMenuBarEnable(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _menus = 0xFFFF; sscanf(line.c_str(), "%hu", &_menus); @@ -448,8 +451,8 @@ bool ActionMenuBarEnable::execute() { // ActionMusic ////////////////////////////////////////////////////////////////////////////// -ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &line, bool global) : - ResultAction(engine, slotkey), +ActionMusic::ActionMusic(ZVision *engine, int32 slotKey, const Common::String &line, bool global) : + ResultAction(engine, slotKey), _note(0), _prog(0), _universe(global) { @@ -527,8 +530,8 @@ bool ActionMusic::execute() { // ActionPanTrack ////////////////////////////////////////////////////////////////////////////// -ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey), +ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey), _pos(0), _musicSlot(0) { @@ -552,8 +555,8 @@ bool ActionPanTrack::execute() { // ActionPreferences ////////////////////////////////////////////////////////////////////////////// -ActionPreferences::ActionPreferences(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionPreferences::ActionPreferences(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { if (line.compareToIgnoreCase("save") == 0) _save = true; else @@ -573,8 +576,8 @@ bool ActionPreferences::execute() { // ActionPreloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _mask = 0; _framerate = 0; @@ -612,8 +615,8 @@ bool ActionPreloadAnimation::execute() { // ActionUnloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; sscanf(line.c_str(), "%u", &_key); @@ -632,8 +635,8 @@ bool ActionUnloadAnimation::execute() { // ActionPlayAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _x = 0; _y = 0; _x2 = 0; @@ -690,8 +693,8 @@ bool ActionPlayAnimation::execute() { // ActionPlayPreloadAnimation ////////////////////////////////////////////////////////////////////////////// -ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _controlKey = 0; _x1 = 0; _y1 = 0; @@ -729,8 +732,8 @@ bool ActionQuit::execute() { // ActionRegion - only used by Zork: Nemesis ////////////////////////////////////////////////////////////////////////////// -ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionRegion::ActionRegion(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _delay = 0; _type = 0; _unk1 = 0; @@ -808,8 +811,8 @@ bool ActionRegion::execute() { // ActionRandom ////////////////////////////////////////////////////////////////////////////// -ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionRandom::ActionRandom(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { char maxBuffer[64]; memset(maxBuffer, 0, 64); sscanf(line.c_str(), "%s", maxBuffer); @@ -830,8 +833,8 @@ bool ActionRandom::execute() { // ActionRestoreGame ////////////////////////////////////////////////////////////////////////////// -ActionRestoreGame::ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionRestoreGame::ActionRestoreGame(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { char buf[128]; sscanf(line.c_str(), "%s", buf); _fileName = Common::String(buf); @@ -846,8 +849,8 @@ bool ActionRestoreGame::execute() { // ActionRotateTo ////////////////////////////////////////////////////////////////////////////// -ActionRotateTo::ActionRotateTo(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionRotateTo::ActionRotateTo(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _time = 0; _toPos = 0; @@ -864,8 +867,8 @@ bool ActionRotateTo::execute() { // ActionSetPartialScreen ////////////////////////////////////////////////////////////////////////////// -ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _x = 0; _y = 0; @@ -904,8 +907,8 @@ bool ActionSetPartialScreen::execute() { // ActionSetScreen ////////////////////////////////////////////////////////////////////////////// -ActionSetScreen::ActionSetScreen(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionSetScreen::ActionSetScreen(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { char fileName[25]; sscanf(line.c_str(), "%24s", fileName); @@ -922,8 +925,8 @@ bool ActionSetScreen::execute() { // ActionStop ////////////////////////////////////////////////////////////////////////////// -ActionStop::ActionStop(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionStop::ActionStop(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _key = 0; sscanf(line.c_str(), "%u", &_key); } @@ -937,8 +940,8 @@ bool ActionStop::execute() { // ActionStreamVideo ////////////////////////////////////////////////////////////////////////////// -ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _x1 = 0; _x2 = 0; _y1 = 0; @@ -1019,8 +1022,8 @@ bool ActionStreamVideo::execute() { // ActionSyncSound ////////////////////////////////////////////////////////////////////////////// -ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _syncto = 0; char fileName[25]; @@ -1047,8 +1050,8 @@ bool ActionSyncSound::execute() { // ActionTimer ////////////////////////////////////////////////////////////////////////////// -ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionTimer::ActionTimer(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { char timeBuffer[64]; memset(timeBuffer, 0, 64); sscanf(line.c_str(), "%s", timeBuffer); @@ -1071,8 +1074,8 @@ bool ActionTimer::execute() { // ActionTtyText ////////////////////////////////////////////////////////////////////////////// -ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::String &line) : - ResultAction(engine, slotkey) { +ActionTtyText::ActionTtyText(ZVision *engine, int32 slotKey, const Common::String &line) : + ResultAction(engine, slotKey) { _delay = 0; char filename[64]; -- cgit v1.2.3