aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2
diff options
context:
space:
mode:
authorMax Horn2009-10-20 19:51:32 +0000
committerMax Horn2009-10-20 19:51:32 +0000
commit6d9cb7ab14ef5fedc0393aa5f7442a6a5970b797 (patch)
tree3c00f6f19de3c1244704b08bf68adb5385707abf /engines/sword2
parent91ba886e012da48ec1e676ed4aa859fab87068a8 (diff)
downloadscummvm-rg350-6d9cb7ab14ef5fedc0393aa5f7442a6a5970b797.tar.gz
scummvm-rg350-6d9cb7ab14ef5fedc0393aa5f7442a6a5970b797.tar.bz2
scummvm-rg350-6d9cb7ab14ef5fedc0393aa5f7442a6a5970b797.zip
SWORD2: Turned static vars in Logic::fnISpeak into member vars of class Logic
svn-id: r45284
Diffstat (limited to 'engines/sword2')
-rw-r--r--engines/sword2/function.cpp25
-rw-r--r--engines/sword2/logic.cpp3
-rw-r--r--engines/sword2/logic.h4
3 files changed, 18 insertions, 14 deletions
diff --git a/engines/sword2/function.cpp b/engines/sword2/function.cpp
index 7a0da04925..dc8c42c16a 100644
--- a/engines/sword2/function.cpp
+++ b/engines/sword2/function.cpp
@@ -778,9 +778,6 @@ int32 Logic::fnISpeak(int32 *params) {
// 8 animation mode 0 lip synced,
// 1 just straight animation
- static bool cycle_skip = false;
- static bool speechRunning;
-
// Set up the pointers which we know we'll always need
ObjectLogic obLogic(decodePtr(params[S_OB_LOGIC]));
@@ -806,12 +803,12 @@ int32 Logic::fnISpeak(int32 *params) {
// Drop out for 1st cycle to allow walks/anims to end and
// display last frame before system locks while speech loaded
- if (!cycle_skip) {
- cycle_skip = true;
+ if (!_cycleSkip) {
+ _cycleSkip = true;
return IR_REPEAT;
}
- cycle_skip = false;
+ _cycleSkip = false;
_vm->_debugger->_textNumber = params[S_TEXT];
@@ -934,7 +931,7 @@ int32 Logic::fnISpeak(int32 *params) {
// Is it to be speech or subtitles or both?
// Assume not running until know otherwise
- speechRunning = false;
+ _speechRunning = false;
// New fudge for 'fx' subtitles: If speech is selected, and
// this line is allowed speech (not if it's an fx subtitle!)
@@ -962,14 +959,14 @@ int32 Logic::fnISpeak(int32 *params) {
// playing now. (We might want to do this the
// next cycle, don't know yet.)
- speechRunning = true;
+ _speechRunning = true;
_vm->_sound->unpauseSpeech();
} else {
debug(5, "ERROR: PlayCompSpeech(wav=%d (res=%d pos=%d)) returned %.8x", params[S_WAV], text_res, local_text, rv);
}
}
- if (_vm->getSubtitles() || !speechRunning) {
+ if (_vm->getSubtitles() || !_speechRunning) {
// We want subtitles, or the speech failed to load.
// Either way, we're going to show the text so create
// the text sprite.
@@ -995,7 +992,7 @@ int32 Logic::fnISpeak(int32 *params) {
if (obGraph.getAnimPc() == (int32)anim_head.noAnimFrames) {
// End of animation - restart from frame 0
obGraph.setAnimPc(0);
- } else if (speechRunning && _vm->_sound->amISpeaking() == RDSE_QUIET) {
+ } else if (_speechRunning && _vm->_sound->amISpeaking() == RDSE_QUIET) {
// The speech is running, but we're at a quiet
// bit. Restart from frame 0 (closed mouth).
obGraph.setAnimPc(0);
@@ -1024,11 +1021,11 @@ int32 Logic::fnISpeak(int32 *params) {
// If playing a sample
- if (speechRunning) {
+ if (_speechRunning) {
// Has it finished?
if (_vm->_sound->getSpeechStatus() == RDSE_SAMPLEFINISHED)
speechFinished = true;
- } else if (!speechRunning && _speechTime) {
+ } else if (!_speechRunning && _speechTime) {
// Counting down text time because there is no sample - this
// ends the speech
@@ -1075,7 +1072,7 @@ int32 Logic::fnISpeak(int32 *params) {
speechFinished = true;
// if speech sample playing, halt it prematurely
- if (speechRunning)
+ if (_speechRunning)
_vm->_sound->stopSpeech();
}
}
@@ -1100,7 +1097,7 @@ int32 Logic::fnISpeak(int32 *params) {
obGraph.setAnimPc(0);
}
- speechRunning = false;
+ _speechRunning = false;
// no longer in a script function loop
obLogic.setLooping(0);
diff --git a/engines/sword2/logic.cpp b/engines/sword2/logic.cpp
index c790c69acf..394bf7ddc8 100644
--- a/engines/sword2/logic.cpp
+++ b/engines/sword2/logic.cpp
@@ -48,6 +48,9 @@ Logic::Logic(Sword2Engine *vm) :
memset(_syncList, 0, sizeof(_syncList));
_router = new Router(_vm);
+ _cycleSkip = false;
+ _speechRunning = false;
+
setupOpcodes();
}
diff --git a/engines/sword2/logic.h b/engines/sword2/logic.h
index d9e733c3dc..8c49225df2 100644
--- a/engines/sword2/logic.h
+++ b/engines/sword2/logic.h
@@ -113,6 +113,10 @@ private:
// Set by fnPassMega()
byte _engineMega[56];
+
+ bool _cycleSkip;
+ bool _speechRunning;
+
public:
Logic(Sword2Engine *vm);
~Logic();