aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengines/pegasus/timers.cpp19
-rwxr-xr-xengines/pegasus/timers.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp
index 8ca7de98bf..584ddfbfe4 100755
--- a/engines/pegasus/timers.cpp
+++ b/engines/pegasus/timers.cpp
@@ -230,16 +230,25 @@ void TimeBase::checkCallBacks() {
// Check if we've triggered any callbacks
for (TimeBaseCallBack *runner = _callBackList; runner != 0; runner = runner->_nextCallBack) {
+ if (runner->_hasBeenTriggered)
+ continue;
+
if (runner->_type == kCallBackAtTime && runner->_trigger == kTriggerTimeFwd) {
- if (getTime() >= (runner->_param2 * _preferredScale / runner->_param3) && getRate() > 0)
+ if (getTime() >= (runner->_param2 * _preferredScale / runner->_param3) && getRate() > 0) {
runner->callBack();
+ runner->_hasBeenTriggered = true;
+ }
} else if (runner->_type == kCallBackAtExtremes) {
if (runner->_trigger == kTriggerAtStop) {
- if (time == stopTime)
+ if (time == stopTime) {
runner->callBack();
+ runner->_hasBeenTriggered = true;
+ }
} else if (runner->_trigger == kTriggerAtStart) {
- if (time == startTime)
+ if (time == startTime) {
runner->callBack();
+ runner->_hasBeenTriggered = true;
+ }
}
}
}
@@ -292,6 +301,7 @@ TimeBaseCallBack::TimeBaseCallBack() {
_nextCallBack = 0;
_trigger = kTriggerNone;
_type = kCallBackNone;
+ _hasBeenTriggered = false;
}
TimeBaseCallBack::~TimeBaseCallBack() {
@@ -313,6 +323,7 @@ void TimeBaseCallBack::releaseCallBack() {
void TimeBaseCallBack::disposeCallBack() {
_timeBase = 0;
+ _hasBeenTriggered = false;
}
void TimeBaseCallBack::scheduleCallBack(CallBackTrigger trigger, uint32 param2, uint32 param3) {
@@ -320,10 +331,12 @@ void TimeBaseCallBack::scheduleCallBack(CallBackTrigger trigger, uint32 param2,
_trigger = trigger;
_param2 = param2;
_param3 = param3;
+ _hasBeenTriggered = false;
}
void TimeBaseCallBack::cancelCallBack() {
_trigger = kTriggerNone;
+ _hasBeenTriggered = false;
}
IdlerTimeBase::IdlerTimeBase() {
diff --git a/engines/pegasus/timers.h b/engines/pegasus/timers.h
index 65e7d21372..0b2f59d6c7 100755
--- a/engines/pegasus/timers.h
+++ b/engines/pegasus/timers.h
@@ -172,6 +172,7 @@ protected:
CallBackType _type;
CallBackTrigger _trigger;
uint32 _param2, _param3;
+ bool _hasBeenTriggered;
private:
void disposeCallBack();