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.
This commit is contained in:
RichieSams 2014-12-30 01:10:36 -06:00
parent 6c3af3c2e7
commit 68d3ebd57b
29 changed files with 149 additions and 134 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -31,7 +31,7 @@
#include "graphics/surface.h"
#include "effect.h"
#include "graphics_effect.h"
class OSystem;
@ -61,7 +61,7 @@ private:
};
typedef Common::HashMap<uint16, OneSubtitle> SubtitleMap;
typedef Common::List<Effect *> EffectsList;
typedef Common::List<GraphicsEffect *> EffectsList;
private:
ZVision *_engine;
@ -302,7 +302,7 @@ public:
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);

View File

@ -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 \

View File

@ -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));

View File

@ -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:

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/animation_node.h"
#include "zvision/scripting/effects/animation_effect.h"
#include "zvision/zvision.h"
#include "zvision/graphics/render_manager.h"
@ -33,8 +33,8 @@
namespace ZVision {
AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse)
: SideFX(engine, controlKey, SIDEFX_ANIM),
AnimationEffect::AnimationEffect(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse)
: ScriptingEffect(engine, controlKey, SCRIPTING_EFFECT_ANIM),
_disposeAfterUse(disposeAfterUse),
_mask(mask),
_animation(NULL) {
@ -53,7 +53,7 @@ AnimationNode::AnimationNode(ZVision *engine, uint32 controlKey, const Common::S
}
}
AnimationNode::~AnimationNode() {
AnimationEffect::~AnimationEffect() {
if (_animation)
delete _animation;
@ -72,7 +72,7 @@ AnimationNode::~AnimationNode() {
_playList.clear();
}
bool AnimationNode::process(uint32 deltaTimeInMillis) {
bool AnimationEffect::process(uint32 deltaTimeInMillis) {
ScriptManager *scriptManager = _engine->getScriptManager();
RenderManager *renderManager = _engine->getRenderManager();
RenderTable::RenderState renderState = renderManager->getRenderTable()->getRenderState();
@ -181,7 +181,7 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
return false;
}
void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops) {
void AnimationEffect::addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops) {
playnode nod;
nod.loop = loops;
nod.pos = Common::Rect(x, y, x2 + 1, y2 + 1);
@ -194,7 +194,7 @@ void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int st
_playList.push_back(nod);
}
bool AnimationNode::stop() {
bool AnimationEffect::stop() {
PlayNodes::iterator it = _playList.begin();
if (it != _playList.end()) {
_engine->getScriptManager()->setStateValue((*it).slot, 2);

View File

@ -23,7 +23,7 @@
#ifndef ZVISION_ANIMATION_NODE_H
#define ZVISION_ANIMATION_NODE_H
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
#include "common/rect.h"
#include "common/list.h"
@ -39,10 +39,10 @@ namespace ZVision {
class ZVision;
class AnimationNode : public SideFX {
class AnimationEffect : public ScriptingEffect {
public:
AnimationNode(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse = true);
~AnimationNode();
AnimationEffect(ZVision *engine, uint32 controlKey, const Common::String &fileName, int32 mask, int32 frate, bool disposeAfterUse = true);
~AnimationEffect();
struct playnode {
Common::Rect pos;

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/distort_node.h"
#include "zvision/scripting/effects/distort_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -34,7 +34,7 @@
namespace ZVision {
DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale)
: SideFX(engine, key, SIDEFX_DISTORT) {
: ScriptingEffect(engine, key, SCRIPTING_EFFECT_DISTORT) {
_angle = _engine->getRenderManager()->getRenderTable()->getAngle();
_linScale = _engine->getRenderManager()->getRenderTable()->getLinscale();

View File

@ -23,13 +23,13 @@
#ifndef ZVISION_DISTORT_NODE_H
#define ZVISION_DISTORT_NODE_H
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
namespace ZVision {
class ZVision;
class DistortNode : public SideFX {
class DistortNode : public ScriptingEffect {
public:
DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale);
~DistortNode();

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/music_node.h"
#include "zvision/scripting/effects/music_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -37,7 +37,7 @@
namespace ZVision {
MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool loop, int8 volume)
: MusicNodeBASE(engine, key, SIDEFX_AUDIO) {
: MusicNodeBASE(engine, key, SCRIPTING_EFFECT_AUDIO) {
_loop = loop;
_volume = volume;
_crossfade = false;
@ -179,26 +179,26 @@ void MusicNode::setVolume(uint8 newVolume) {
}
PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos)
: SideFX(engine, key, SIDEFX_PANTRACK) {
: ScriptingEffect(engine, key, SCRIPTING_EFFECT_PANTRACK) {
_slot = slot;
SideFX *fx = _engine->getScriptManager()->getSideFX(slot);
if (fx && fx->getType() == SIDEFX_AUDIO) {
ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(slot);
if (fx && fx->getType() == SCRIPTING_EFFECT_AUDIO) {
MusicNodeBASE *mus = (MusicNodeBASE *)fx;
mus->setPanTrack(pos);
}
}
PanTrackNode::~PanTrackNode() {
SideFX *fx = _engine->getScriptManager()->getSideFX(_slot);
if (fx && fx->getType() == SIDEFX_AUDIO) {
ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_slot);
if (fx && fx->getType() == SCRIPTING_EFFECT_AUDIO) {
MusicNodeBASE *mus = (MusicNodeBASE *)fx;
mus->unsetPanTrack();
}
}
MusicMidiNode::MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume)
: MusicNodeBASE(engine, key, SIDEFX_AUDIO) {
: MusicNodeBASE(engine, key, SCRIPTING_EFFECT_AUDIO) {
_volume = volume;
_prog = program;
_noteNumber = note;

View File

@ -24,7 +24,7 @@
#define ZVISION_MUSIC_NODE_H
#include "audio/mixer.h"
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
#include "zvision/text/subtitles.h"
namespace Common {
@ -33,9 +33,9 @@ class String;
namespace ZVision {
class MusicNodeBASE : public SideFX {
class MusicNodeBASE : public ScriptingEffect {
public:
MusicNodeBASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {}
MusicNodeBASE(ZVision *engine, uint32 key, ScriptingEffectType type) : ScriptingEffect(engine, key, type) {}
~MusicNodeBASE() {}
/**
@ -121,7 +121,7 @@ private:
int8 _prog;
};
class PanTrackNode : public SideFX {
class PanTrackNode : public ScriptingEffect {
public:
PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos);
~PanTrackNode();

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/region_node.h"
#include "zvision/scripting/effects/region_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -30,8 +30,8 @@
namespace ZVision {
RegionNode::RegionNode(ZVision *engine, uint32 key, Effect *effect, uint32 delay)
: SideFX(engine, key, SIDEFX_REGION) {
RegionNode::RegionNode(ZVision *engine, uint32 key, GraphicsEffect *effect, uint32 delay)
: ScriptingEffect(engine, key, SCRIPTING_EFFECT_REGION) {
_effect = effect;
_delay = delay;
_timeLeft = 0;

View File

@ -25,16 +25,16 @@
#include "graphics/surface.h"
#include "zvision/scripting/sidefx.h"
#include "zvision/graphics/effect.h"
#include "zvision/scripting/scripting_effect.h"
#include "zvision/graphics/graphics_effect.h"
namespace ZVision {
class ZVision;
class RegionNode : public SideFX {
class RegionNode : public ScriptingEffect {
public:
RegionNode(ZVision *engine, uint32 key, Effect *effect, uint32 delay);
RegionNode(ZVision *engine, uint32 key, GraphicsEffect *effect, uint32 delay);
~RegionNode();
/**
@ -49,7 +49,7 @@ public:
private:
int32 _timeLeft;
uint32 _delay;
Effect *_effect;
GraphicsEffect *_effect;
};
} // End of namespace ZVision

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/syncsound_node.h"
#include "zvision/scripting/effects/syncsound_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -36,7 +36,7 @@
namespace ZVision {
SyncSoundNode::SyncSoundNode(ZVision *engine, uint32 key, Common::String &filename, int32 syncto)
: SideFX(engine, key, SIDEFX_AUDIO) {
: ScriptingEffect(engine, key, SCRIPTING_EFFECT_AUDIO) {
_syncto = syncto;
_sub = NULL;

View File

@ -24,7 +24,7 @@
#define ZVISION_SYNCSOUND_NODE_H
#include "audio/mixer.h"
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
#include "zvision/text/subtitles.h"
namespace Common {
@ -32,7 +32,7 @@ class String;
}
namespace ZVision {
class SyncSoundNode : public SideFX {
class SyncSoundNode : public ScriptingEffect {
public:
SyncSoundNode(ZVision *engine, uint32 key, Common::String &file, int32 syncto);
~SyncSoundNode();

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/timer_node.h"
#include "zvision/scripting/effects/timer_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -32,7 +32,7 @@
namespace ZVision {
TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
: SideFX(engine, key, SIDEFX_TIMER) {
: ScriptingEffect(engine, key, SCRIPTING_EFFECT_TIMER) {
_timeLeft = 0;
if (_engine->getGameId() == GID_NEMESIS)

View File

@ -23,13 +23,13 @@
#ifndef ZVISION_TIMER_NODE_H
#define ZVISION_TIMER_NODE_H
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
namespace ZVision {
class ZVision;
class TimerNode : public SideFX {
class TimerNode : public ScriptingEffect {
public:
TimerNode(ZVision *engine, uint32 key, uint timeInSeconds);
~TimerNode();

View File

@ -22,7 +22,7 @@
#include "common/scummsys.h"
#include "zvision/scripting/sidefx/ttytext_node.h"
#include "zvision/scripting/effects/ttytext_effect.h"
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
@ -35,7 +35,7 @@
namespace ZVision {
ttyTextNode::ttyTextNode(ZVision *engine, uint32 key, const Common::String &file, const Common::Rect &r, int32 delay) :
SideFX(engine, key, SIDEFX_TTYTXT),
ScriptingEffect(engine, key, SCRIPTING_EFFECT_TTYTXT),
_fnt(engine) {
_delay = delay;
_r = r;

View File

@ -26,7 +26,7 @@
#include "common/rect.h"
#include "graphics/surface.h"
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
#include "zvision/text/text.h"
#include "zvision/text/truetype_font.h"
@ -35,7 +35,7 @@ class String;
}
namespace ZVision {
class ttyTextNode : public SideFX {
class ttyTextNode : public ScriptingEffect {
public:
ttyTextNode(ZVision *engine, uint32 key, const Common::String &file, const Common::Rect &r, int32 delay);
~ttyTextNode();

View File

@ -30,7 +30,7 @@
#include "zvision/file/save_manager.h"
#include "zvision/scripting/actions.h"
#include "zvision/scripting/menu.h"
#include "zvision/scripting/sidefx/timer_node.h"
#include "zvision/scripting/effects/timer_effect.h"
#include "common/algorithm.h"
#include "common/hashmap.h"
@ -382,11 +382,11 @@ void ScriptManager::setFocusControlKey(uint32 key) {
_currentlyFocusedControl = key;
}
void ScriptManager::addSideFX(SideFX *fx) {
void ScriptManager::addSideFX(ScriptingEffect *fx) {
_activeSideFx.push_back(fx);
}
SideFX *ScriptManager::getSideFX(uint32 key) {
ScriptingEffect *ScriptManager::getSideFX(uint32 key) {
for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) {
if ((*iter)->getKey() == key) {
return (*iter);
@ -430,7 +430,7 @@ void ScriptManager::killSideFx(uint32 key) {
}
}
void ScriptManager::killSideFxType(SideFX::SideFXType type) {
void ScriptManager::killSideFxType(ScriptingEffect::ScriptingEffectType type) {
for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end();) {
if ((*iter)->getType() & type) {
(*iter)->kill();

View File

@ -25,7 +25,7 @@
#include "zvision/scripting/puzzle.h"
#include "zvision/scripting/control.h"
#include "zvision/scripting/sidefx.h"
#include "zvision/scripting/scripting_effect.h"
#include "common/hashmap.h"
#include "common/queue.h"
@ -116,7 +116,7 @@ typedef Common::List<Puzzle *> PuzzleList;
typedef Common::Queue<Puzzle *> PuzzleQueue;
typedef Common::List<Control *> ControlList;
typedef Common::HashMap<uint32, int32> StateMap;
typedef Common::List<SideFX *> SideFXList;
typedef Common::List<ScriptingEffect *> SideFXList;
typedef Common::List<Common::Event> EventList;
class ScriptManager {
@ -196,12 +196,12 @@ public:
// Only change focus control without call focus/unfocus.
void setFocusControlKey(uint32 key);
void addSideFX(SideFX *fx);
SideFX *getSideFX(uint32 key);
void addSideFX(ScriptingEffect *fx);
ScriptingEffect *getSideFX(uint32 key);
void deleteSideFx(uint32 key);
void stopSideFx(uint32 key);
void killSideFx(uint32 key);
void killSideFxType(SideFX::SideFXType type);
void killSideFxType(ScriptingEffect::ScriptingEffectType type);
void addEvent(Common::Event);
void flushEvent(Common::EventType type);

View File

@ -20,8 +20,8 @@
*
*/
#ifndef SIDEFX_H_INCLUDED
#define SIDEFX_H_INCLUDED
#ifndef SCRIPTING_EFFECT_H_INCLUDED
#define SCRIPTING_EFFECT_H_INCLUDED
namespace Common {
class SeekableReadStream;
@ -33,29 +33,39 @@ namespace ZVision {
class ZVision;
class SideFX {
/**
* The base class that represents effects created from Actions.
* This class is virtual.
*
* Detailed Description:
* A scene has Controls. By interacting with the controls, the user
* causes Actions to execute. Certain Actions create 'effects', for
* example, a sound or an animation. This is the base class for
* those effects.
*/
class ScriptingEffect {
public:
enum SideFXType {
SIDEFX_ANIM = 1,
SIDEFX_AUDIO = 2,
SIDEFX_DISTORT = 4,
SIDEFX_PANTRACK = 8,
SIDEFX_REGION = 16,
SIDEFX_TIMER = 32,
SIDEFX_TTYTXT = 64,
SIDEFX_UNK = 128,
SIDEFX_ALL = 255
enum ScriptingEffectType {
SCRIPTING_EFFECT_ANIM = 1,
SCRIPTING_EFFECT_AUDIO = 2,
SCRIPTING_EFFECT_DISTORT = 4,
SCRIPTING_EFFECT_PANTRACK = 8,
SCRIPTING_EFFECT_REGION = 16,
SCRIPTING_EFFECT_TIMER = 32,
SCRIPTING_EFFECT_TTYTXT = 64,
SCRIPTING_EFFECT_UNKNOWN = 128,
SCRIPTING_EFFECT_ALL = 255
};
SideFX() : _engine(0), _key(0), _type(SIDEFX_UNK) {}
SideFX(ZVision *engine, uint32 key, SideFXType type) : _engine(engine), _key(key), _type(type) {}
virtual ~SideFX() {}
ScriptingEffect() : _engine(0), _key(0), _type(SCRIPTING_EFFECT_UNKNOWN) {}
ScriptingEffect(ZVision *engine, uint32 key, ScriptingEffectType type) : _engine(engine), _key(key), _type(type) {}
virtual ~ScriptingEffect() {}
uint32 getKey() {
return _key;
}
SideFXType getType() {
ScriptingEffectType getType() {
return _type;
}
@ -103,7 +113,7 @@ public:
protected:
ZVision *_engine;
uint32 _key;
SideFXType _type;
ScriptingEffectType _type;
// Static member functions
public:
@ -111,4 +121,4 @@ public:
};
} // End of namespace ZVision
#endif // SIDEFX_H_INCLUDED
#endif // SCRIPTING_EFFECT_H_INCLUDED