Skip to content
Permalink
Browse files

ZVISION: Rename some scripting classes to better represent what the c…

…lasses 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.
  • Loading branch information
RichieSams committed Dec 30, 2014
1 parent 6c3af3c commit 68d3ebd57b0313e517032681a119b47956803e71
Showing with 149 additions and 134 deletions.
  1. +1 −1 engines/zvision/graphics/effects/fog.cpp
  2. +2 −2 engines/zvision/graphics/effects/fog.h
  3. +1 −1 engines/zvision/graphics/effects/light.cpp
  4. +2 −2 engines/zvision/graphics/effects/light.h
  5. +1 −1 engines/zvision/graphics/effects/wave.cpp
  6. +2 −2 engines/zvision/graphics/effects/wave.h
  7. +6 −6 engines/zvision/graphics/{effect.h → graphics_effect.h}
  8. +1 −1 engines/zvision/graphics/render_manager.cpp
  9. +3 −3 engines/zvision/graphics/render_manager.h
  10. +7 −7 engines/zvision/module.mk
  11. +33 −33 engines/zvision/scripting/actions.cpp
  12. +5 −0 engines/zvision/scripting/control.h
  13. +7 −7 engines/zvision/scripting/{sidefx/animation_node.cpp → effects/animation_effect.cpp}
  14. +4 −4 engines/zvision/scripting/{sidefx/animation_node.h → effects/animation_effect.h}
  15. +2 −2 engines/zvision/scripting/{sidefx/distort_node.cpp → effects/distort_effect.cpp}
  16. +2 −2 engines/zvision/scripting/{sidefx/distort_node.h → effects/distort_effect.h}
  17. +8 −8 engines/zvision/scripting/{sidefx/music_node.cpp → effects/music_effect.cpp}
  18. +4 −4 engines/zvision/scripting/{sidefx/music_node.h → effects/music_effect.h}
  19. +3 −3 engines/zvision/scripting/{sidefx/region_node.cpp → effects/region_effect.cpp}
  20. +5 −5 engines/zvision/scripting/{sidefx/region_node.h → effects/region_effect.h}
  21. +2 −2 engines/zvision/scripting/{sidefx/syncsound_node.cpp → effects/syncsound_effect.cpp}
  22. +2 −2 engines/zvision/scripting/{sidefx/syncsound_node.h → effects/syncsound_effect.h}
  23. +2 −2 engines/zvision/scripting/{sidefx/timer_node.cpp → effects/timer_effect.cpp}
  24. +2 −2 engines/zvision/scripting/{sidefx/timer_node.h → effects/timer_effect.h}
  25. +2 −2 engines/zvision/scripting/{sidefx/ttytext_node.cpp → effects/ttytext_effect.cpp}
  26. +2 −2 engines/zvision/scripting/{sidefx/ttytext_node.h → effects/ttytext_effect.h}
  27. +4 −4 engines/zvision/scripting/script_manager.cpp
  28. +5 −5 engines/zvision/scripting/script_manager.h
  29. +29 −19 engines/zvision/scripting/{sidefx.h → scripting_effect.h}
@@ -31,7 +31,7 @@
namespace ZVision {

FogFx::FogFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, EffectMap *Map, const Common::String &clouds):
Effect(engine, key, region, ported) {
GraphicsEffect(engine, key, region, ported) {

_map = Map;

@@ -23,14 +23,14 @@
#ifndef ZVISION_FOG_H
#define ZVISION_FOG_H

#include "zvision/graphics/effect.h"
#include "zvision/graphics/graphics_effect.h"

namespace ZVision {

class ZVision;

// Used by Zork: Nemesis for the mixing chamber gas effect in the gas puzzle (location tt5e, when the blinds are down)
class FogFx : public Effect {
class FogFx : public GraphicsEffect {
public:

FogFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, EffectMap *Map, const Common::String &clouds);
@@ -30,7 +30,7 @@
namespace ZVision {

LightFx::LightFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, EffectMap *Map, int8 delta, int8 minD, int8 maxD):
Effect(engine, key, region, ported) {
GraphicsEffect(engine, key, region, ported) {
_map = Map;
_delta = delta;
_up = true;
@@ -23,13 +23,13 @@
#ifndef LIGHTFX_H_INCLUDED
#define LIGHTFX_H_INCLUDED

#include "zvision/graphics/effect.h"
#include "zvision/graphics/graphics_effect.h"

namespace ZVision {

class ZVision;

class LightFx : public Effect {
class LightFx : public GraphicsEffect {
public:

LightFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, EffectMap *Map, int8 delta, int8 minD = -127, int8 maxD = 127);
@@ -30,7 +30,7 @@
namespace ZVision {

WaveFx::WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd):
Effect(engine, key, region, ported) {
GraphicsEffect(engine, key, region, ported) {

_frame = 0;
_frameCount = frames;
@@ -24,13 +24,13 @@
#define WAVEFX_H_INCLUDED

#include "common/array.h"
#include "zvision/graphics/effect.h"
#include "zvision/graphics/graphics_effect.h"

namespace ZVision {

class ZVision;

class WaveFx : public Effect {
class WaveFx : public GraphicsEffect {
public:

WaveFx(ZVision *engine, uint32 key, Common::Rect region, bool ported, int16 frames, int16 centerX, int16 centerY, float ampl, float waveln, float spd);
@@ -20,8 +20,8 @@
*
*/

#ifndef EFFECT_H_INCLUDED
#define EFFECT_H_INCLUDED
#ifndef GRAPHICS_EFFECT_H_INCLUDED
#define GRAPHICS_EFFECT_H_INCLUDED

#include "common/rect.h"
#include "common/list.h"
@@ -33,13 +33,13 @@ namespace ZVision {

class ZVision;

class Effect {
class GraphicsEffect {
public:

Effect(ZVision *engine, uint32 key, Common::Rect region, bool ported) : _engine(engine), _key(key), _region(region), _ported(ported) {
GraphicsEffect(ZVision *engine, uint32 key, Common::Rect region, bool ported) : _engine(engine), _key(key), _region(region), _ported(ported) {
_surface.create(_region.width(), _region.height(), _engine->_resourcePixelFormat);
}
virtual ~Effect() {}
virtual ~GraphicsEffect() {}

uint32 getKey() {
return _key;
@@ -80,4 +80,4 @@ typedef Common::List<EffectMapUnit> EffectMap;

} // End of namespace ZVision

#endif // EFFECT_H_INCLUDED
#endif // GRAPHICS_EFFECT_H_INCLUDED
@@ -772,7 +772,7 @@ Common::Point RenderManager::getBkgSize() {
return Common::Point(_backgroundWidth, _backgroundHeight);
}

void RenderManager::addEffect(Effect *_effect) {
void RenderManager::addEffect(GraphicsEffect *_effect) {
_effects.push_back(_effect);
}

@@ -31,7 +31,7 @@

#include "graphics/surface.h"

#include "effect.h"
#include "graphics_effect.h"

class OSystem;

@@ -61,7 +61,7 @@ class RenderManager {
};

typedef Common::HashMap<uint16, OneSubtitle> SubtitleMap;
typedef Common::List<Effect *> EffectsList;
typedef Common::List<GraphicsEffect *> EffectsList;

private:
ZVision *_engine;
@@ -302,7 +302,7 @@ class RenderManager {
void readImageToSurface(const Common::String &fileName, Graphics::Surface &destination, bool transposed);

// Add visual effect to effects list
void addEffect(Effect *_effect);
void addEffect(GraphicsEffect *_effect);

// Delete effect(s) by ID (ID equal to slot of action:region that create this effect)
void deleteEffect(uint32 ID);
@@ -32,13 +32,13 @@ MODULE_OBJS := \
scripting/menu.o \
scripting/scr_file_handling.o \
scripting/script_manager.o \
scripting/sidefx/animation_node.o \
scripting/sidefx/distort_node.o \
scripting/sidefx/music_node.o \
scripting/sidefx/region_node.o \
scripting/sidefx/syncsound_node.o \
scripting/sidefx/timer_node.o \
scripting/sidefx/ttytext_node.o \
scripting/effects/animation_effect.o \
scripting/effects/distort_effect.o \
scripting/effects/music_effect.o \
scripting/effects/region_effect.o \
scripting/effects/syncsound_effect.o \
scripting/effects/timer_effect.o \
scripting/effects/ttytext_effect.o \
sound/midi.o \
sound/zork_raw.o \
text/string_manager.o \
@@ -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));
@@ -36,6 +36,11 @@ namespace ZVision {

class ZVision;

/**
* The base class for all Controls.
*
* Controls are the things that the user interacts with. Ex: A lever on the door
*/
class Control {
public:

0 comments on commit 68d3ebd

Please sign in to comment.
You can’t perform that action at this time.