aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/scripting/sidefx
diff options
context:
space:
mode:
authorMarisa-Chan2014-11-20 14:48:24 +0600
committerMarisa-Chan2014-11-20 14:48:24 +0600
commit5b352da304931bafcfcddbe08461488335c7ad57 (patch)
tree6d96693d9efdb59a16050d57c6003593d95a22a1 /engines/zvision/scripting/sidefx
parentd5f7a1dc03f2a38774ad1c8dd6741bb9c6fb9848 (diff)
downloadscummvm-rg350-5b352da304931bafcfcddbe08461488335c7ad57.tar.gz
scummvm-rg350-5b352da304931bafcfcddbe08461488335c7ad57.tar.bz2
scummvm-rg350-5b352da304931bafcfcddbe08461488335c7ad57.zip
ZVISION: More CamelCase and a bit of comments cleanup
Diffstat (limited to 'engines/zvision/scripting/sidefx')
-rw-r--r--engines/zvision/scripting/sidefx/animation_node.cpp22
-rw-r--r--engines/zvision/scripting/sidefx/animation_node.h4
-rw-r--r--engines/zvision/scripting/sidefx/distort_node.cpp16
-rw-r--r--engines/zvision/scripting/sidefx/distort_node.h14
-rw-r--r--engines/zvision/scripting/sidefx/music_node.cpp60
-rw-r--r--engines/zvision/scripting/sidefx/music_node.h16
-rw-r--r--engines/zvision/scripting/sidefx/ttytext_node.h9
7 files changed, 69 insertions, 72 deletions
diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp
index bd9c543d52..98ac4e3b37 100644
--- a/engines/zvision/scripting/sidefx/animation_node.cpp
+++ b/engines/zvision/scripting/sidefx/animation_node.cpp
@@ -75,19 +75,19 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
const Graphics::Surface *frame = NULL;
- if (nod->_cur_frm == -1) { // Start of new playlist node
- nod->_cur_frm = nod->start;
+ if (nod->_curFrame == -1) { // Start of new playlist node
+ nod->_curFrame = nod->start;
- _animation->seekToFrame(nod->_cur_frm);
+ _animation->seekToFrame(nod->_curFrame);
frame = _animation->decodeNextFrame();
nod->_delay = _frmDelay;
if (nod->slot)
_engine->getScriptManager()->setStateValue(nod->slot, 1);
} else {
- nod->_cur_frm++;
+ nod->_curFrame++;
- if (nod->_cur_frm > nod->stop) {
+ if (nod->_curFrame > nod->stop) {
nod->loop--;
if (nod->loop == 0) {
@@ -99,8 +99,8 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
return _DisposeAfterUse;
}
- nod->_cur_frm = nod->start;
- _animation->seekToFrame(nod->_cur_frm);
+ nod->_curFrame = nod->start;
+ _animation->seekToFrame(nod->_curFrame);
}
frame = _animation->decodeNextFrame();
@@ -156,18 +156,18 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
-void AnimationNode::addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops) {
+void AnimationNode::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);
- nod.start = start_frame;
- nod.stop = end_frame;
+ nod.start = startFrame;
+ nod.stop = endFrame;
if (nod.stop >= (int)_animation->frameCount())
nod.stop = _animation->frameCount() - 1;
nod.slot = slot;
- nod._cur_frm = -1;
+ nod._curFrame = -1;
nod._delay = 0;
nod._scaled = NULL;
_playList.push_back(nod);
diff --git a/engines/zvision/scripting/sidefx/animation_node.h b/engines/zvision/scripting/sidefx/animation_node.h
index 4d1c74bccf..dab3d88d80 100644
--- a/engines/zvision/scripting/sidefx/animation_node.h
+++ b/engines/zvision/scripting/sidefx/animation_node.h
@@ -52,7 +52,7 @@ public:
int32 start;
int32 stop;
int32 loop;
- int32 _cur_frm;
+ int32 _curFrame;
int32 _delay;
Graphics::Surface *_scaled;
};
@@ -71,7 +71,7 @@ private:
public:
bool process(uint32 deltaTimeInMillis);
- void addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops = 1);
+ void addPlayNode(int32 slot, int x, int y, int x2, int y2, int startFrame, int endFrame, int loops = 1);
bool stop();
diff --git a/engines/zvision/scripting/sidefx/distort_node.cpp b/engines/zvision/scripting/sidefx/distort_node.cpp
index 576a1f8592..9be6b29413 100644
--- a/engines/zvision/scripting/sidefx/distort_node.cpp
+++ b/engines/zvision/scripting/sidefx/distort_node.cpp
@@ -34,7 +34,7 @@
namespace ZVision {
-DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin)
+DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale)
: SideFX(engine, key, SIDEFX_DISTORT) {
_angle = _engine->getRenderManager()->getRenderTable()->getAngle();
@@ -42,15 +42,15 @@ DistortNode::DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl
_speed = speed;
_incr = true;
- _st_angl = st_angl;
- _en_angl = en_angl;
- _st_lin = st_lin;
- _en_lin = en_lin;
+ _startAngle = startAngle;
+ _endAngle = endAngle;
+ _startLineScale = startLineScale;
+ _endLineScale = endLineScale;
_curFrame = 1.0;
- _diff_angl = en_angl - st_angl;
- _diff_lin = en_lin - st_lin;
+ _diffAngle = endAngle - startAngle;
+ _diffLinScale = endLineScale - startLineScale;
_frmSpeed = (float)speed / 15.0;
_frames = ceil((5.0 - _frmSpeed * 2.0) / _frmSpeed);
@@ -85,7 +85,7 @@ bool DistortNode::process(uint32 deltaTimeInMillis) {
float diff = (1.0 / (5.0 - (_curFrame * _frmSpeed))) / (5.0 - _frmSpeed);
- setParams(_st_angl + diff * _diff_angl, _st_lin + diff * _diff_lin);
+ setParams(_startAngle + diff * _diffAngle, _startLineScale + diff * _diffLinScale);
return false;
}
diff --git a/engines/zvision/scripting/sidefx/distort_node.h b/engines/zvision/scripting/sidefx/distort_node.h
index cba9c5eff2..787a69bdde 100644
--- a/engines/zvision/scripting/sidefx/distort_node.h
+++ b/engines/zvision/scripting/sidefx/distort_node.h
@@ -31,21 +31,21 @@ class ZVision;
class DistortNode : public SideFX {
public:
- DistortNode(ZVision *engine, uint32 key, int16 speed, float st_angl, float en_angl, float st_lin, float en_lin);
+ DistortNode(ZVision *engine, uint32 key, int16 speed, float startAngle, float endAngle, float startLineScale, float endLineScale);
~DistortNode();
bool process(uint32 deltaTimeInMillis);
private:
int16 _speed;
- float _st_angl;
- float _en_angl;
- float _st_lin;
- float _en_lin;
+ float _startAngle;
+ float _endAngle;
+ float _startLineScale;
+ float _endLineScale;
float _frmSpeed;
- float _diff_angl;
- float _diff_lin;
+ float _diffAngle;
+ float _diffLinScale;
bool _incr;
int16 _frames;
diff --git a/engines/zvision/scripting/sidefx/music_node.cpp b/engines/zvision/scripting/sidefx/music_node.cpp
index 4420da3e96..e9baadb011 100644
--- a/engines/zvision/scripting/sidefx/music_node.cpp
+++ b/engines/zvision/scripting/sidefx/music_node.cpp
@@ -38,15 +38,15 @@
namespace ZVision {
MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool loop, int8 volume)
- : MusicNode_BASE(engine, key, SIDEFX_AUDIO) {
+ : MusicNodeBASE(engine, key, SIDEFX_AUDIO) {
_loop = loop;
_volume = volume;
_crossfade = false;
- _crossfade_target = 0;
- _crossfade_time = 0;
+ _crossfadeTarget = 0;
+ _crossfadeTime = 0;
_attenuate = 0;
_pantrack = false;
- _pantrack_X = 0;
+ _pantrackPosition = 0;
_sub = NULL;
Audio::RewindableAudioStream *audioStream;
@@ -93,7 +93,7 @@ MusicNode::~MusicNode() {
void MusicNode::setPanTrack(int16 pos) {
if (!_stereo) {
_pantrack = true;
- _pantrack_X = pos;
+ _pantrackPosition = pos;
setVolume(_volume);
}
}
@@ -104,8 +104,8 @@ void MusicNode::unsetPanTrack() {
}
void MusicNode::setFade(int32 time, uint8 target) {
- _crossfade_target = target;
- _crossfade_time = time;
+ _crossfadeTarget = target;
+ _crossfadeTime = time;
_crossfade = true;
}
@@ -116,14 +116,14 @@ bool MusicNode::process(uint32 deltaTimeInMillis) {
uint8 _newvol = _volume;
if (_crossfade) {
- if (_crossfade_time > 0) {
- if ((int32)deltaTimeInMillis > _crossfade_time)
- deltaTimeInMillis = _crossfade_time;
- _newvol += floor(((float)(_crossfade_target - _newvol) / (float)_crossfade_time)) * (float)deltaTimeInMillis;
- _crossfade_time -= deltaTimeInMillis;
+ if (_crossfadeTime > 0) {
+ if ((int32)deltaTimeInMillis > _crossfadeTime)
+ deltaTimeInMillis = _crossfadeTime;
+ _newvol += floor(((float)(_crossfadeTarget - _newvol) / (float)_crossfadeTime)) * (float)deltaTimeInMillis;
+ _crossfadeTime -= deltaTimeInMillis;
} else {
_crossfade = false;
- _newvol = _crossfade_target;
+ _newvol = _crossfadeTarget;
}
}
@@ -136,17 +136,17 @@ bool MusicNode::process(uint32 deltaTimeInMillis) {
return false;
}
-void MusicNode::setVolume(uint8 new_volume) {
+void MusicNode::setVolume(uint8 newVolume) {
if (_pantrack) {
- int cur_x = _engine->getScriptManager()->getStateValue(StateKey_ViewPos);
- cur_x -= _pantrack_X;
+ int curX = _engine->getScriptManager()->getStateValue(StateKey_ViewPos);
+ curX -= _pantrackPosition;
int32 _width = _engine->getRenderManager()->getBkgSize().x;
- if (cur_x < (-_width) / 2)
- cur_x += _width;
- else if (cur_x >= _width / 2)
- cur_x -= _width;
+ if (curX < (-_width) / 2)
+ curX += _width;
+ else if (curX >= _width / 2)
+ curX -= _width;
- float norm = (float)cur_x / ((float)_width / 2.0);
+ float norm = (float)curX / ((float)_width / 2.0);
float lvl = fabs(norm);
if (lvl > 0.5)
lvl = (lvl - 0.5) * 1.7;
@@ -157,16 +157,16 @@ void MusicNode::setVolume(uint8 new_volume) {
if (_engine->_mixer->isSoundHandleActive(_handle)) {
_engine->_mixer->setChannelBalance(_handle, bal);
- _engine->_mixer->setChannelVolume(_handle, new_volume * lvl);
+ _engine->_mixer->setChannelVolume(_handle, newVolume * lvl);
}
} else {
if (_engine->_mixer->isSoundHandleActive(_handle)) {
_engine->_mixer->setChannelBalance(_handle, 0);
- _engine->_mixer->setChannelVolume(_handle, new_volume);
+ _engine->_mixer->setChannelVolume(_handle, newVolume);
}
}
- _volume = new_volume;
+ _volume = newVolume;
}
PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos)
@@ -175,7 +175,7 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos)
SideFX *fx = _engine->getScriptManager()->getSideFX(slot);
if (fx && fx->getType() == SIDEFX_AUDIO) {
- MusicNode_BASE *mus = (MusicNode_BASE *)fx;
+ MusicNodeBASE *mus = (MusicNodeBASE *)fx;
mus->setPanTrack(pos);
}
}
@@ -183,14 +183,14 @@ PanTrackNode::PanTrackNode(ZVision *engine, uint32 key, uint32 slot, int16 pos)
PanTrackNode::~PanTrackNode() {
SideFX *fx = _engine->getScriptManager()->getSideFX(_slot);
if (fx && fx->getType() == SIDEFX_AUDIO) {
- MusicNode_BASE *mus = (MusicNode_BASE *)fx;
+ MusicNodeBASE *mus = (MusicNodeBASE *)fx;
mus->unsetPanTrack();
}
}
MusicMidiNode::MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume)
- : MusicNode_BASE(engine, key, SIDEFX_AUDIO) {
+ : MusicNodeBASE(engine, key, SIDEFX_AUDIO) {
_volume = volume;
_prog = program;
_noteNumber = note;
@@ -230,11 +230,11 @@ bool MusicMidiNode::process(uint32 deltaTimeInMillis) {
return false;
}
-void MusicMidiNode::setVolume(uint8 new_volume) {
+void MusicMidiNode::setVolume(uint8 newVolume) {
if (_chan >= 0) {
- _engine->getMidiManager()->setVolume(_chan, new_volume);
+ _engine->getMidiManager()->setVolume(_chan, newVolume);
}
- _volume = new_volume;
+ _volume = newVolume;
}
} // End of namespace ZVision
diff --git a/engines/zvision/scripting/sidefx/music_node.h b/engines/zvision/scripting/sidefx/music_node.h
index 262b13085e..954e2f474e 100644
--- a/engines/zvision/scripting/sidefx/music_node.h
+++ b/engines/zvision/scripting/sidefx/music_node.h
@@ -33,10 +33,10 @@ class String;
namespace ZVision {
-class MusicNode_BASE : public SideFX {
+class MusicNodeBASE : public SideFX {
public:
- MusicNode_BASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {}
- ~MusicNode_BASE() {}
+ MusicNodeBASE(ZVision *engine, uint32 key, SideFXType type) : SideFX(engine, key, type) {}
+ ~MusicNodeBASE() {}
/**
* Decrement the timer by the delta time. If the timer is finished, set the status
@@ -55,7 +55,7 @@ public:
virtual void setFade(int32 time, uint8 target) = 0;
};
-class MusicNode : public MusicNode_BASE {
+class MusicNode : public MusicNodeBASE {
public:
MusicNode(ZVision *engine, uint32 key, Common::String &file, bool loop, int8 volume);
~MusicNode();
@@ -79,19 +79,19 @@ public:
private:
int32 _timeLeft;
bool _pantrack;
- int32 _pantrack_X;
+ int32 _pantrackPosition;
int32 _attenuate;
uint8 _volume;
bool _loop;
bool _crossfade;
- uint8 _crossfade_target;
- int32 _crossfade_time;
+ uint8 _crossfadeTarget;
+ int32 _crossfadeTime;
bool _stereo;
Audio::SoundHandle _handle;
Subtitle *_sub;
};
-class MusicMidiNode : public MusicNode_BASE {
+class MusicMidiNode : public MusicNodeBASE {
public:
MusicMidiNode(ZVision *engine, uint32 key, int8 program, int8 note, int8 volume);
~MusicMidiNode();
diff --git a/engines/zvision/scripting/sidefx/ttytext_node.h b/engines/zvision/scripting/sidefx/ttytext_node.h
index a6326c733b..a229129b9d 100644
--- a/engines/zvision/scripting/sidefx/ttytext_node.h
+++ b/engines/zvision/scripting/sidefx/ttytext_node.h
@@ -50,15 +50,12 @@ public:
bool process(uint32 deltaTimeInMillis);
private:
Common::Rect _r;
- //int16 x;
- //int16 y;
- //uint16 w;
- //uint16 h;
+
cTxtStyle _style;
- sTTFont _fnt;
+ StyledTTFont _fnt;
Common::String _txtbuf;
uint32 _txtpos;
- //int32 txtsize;
+
int32 _delay;
int32 _nexttime;
Graphics::Surface _img;