[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.115,1.116 actor.h,1.62,1.63 interface.cpp,1.76,1.77
Andrew Kurushin
h00ligan at users.sourceforge.net
Tue Apr 19 04:09:12 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10482
Modified Files:
actor.cpp actor.h interface.cpp
Log Message:
fixed speech lock
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- actor.cpp 18 Apr 2005 20:03:08 -0000 1.115
+++ actor.cpp 19 Apr 2005 11:07:06 -0000 1.116
@@ -450,11 +450,11 @@
if (objectId != ID_NOTHING) {
if (validActorId(objectId)) {
actor = getActor(objectId);
- location.add(actor->location);
+ location.addXY(actor->location);
} else {
if (validObjId(objectId)) {
obj = getObj(objectId);
- location.add(obj->location);
+ location.addXY(obj->location);
}
}
@@ -694,92 +694,97 @@
int talkspeed;
ActorData *actor;
- if (!isSpeaking()) return;
-
- stringLength = strlen(_activeSpeech.strings[0]);
-
- if (stringLength == 0)
- error("Empty strings not allowed");
-
- if (_vm->_script->_skipSpeeches) {
- _activeSpeech.stringsCount = 0;
- _vm->_sound->stopVoice();
- _vm->_script->wakeUpThreads(kWaitTypeSpeech);
- return;
- }
-
- if (!_activeSpeech.playing) { // just added
- talkspeed = ConfMan.getInt("talkspeed");
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- if (_activeSpeech.slowModeCharIndex >= stringLength)
- error("Wrong string index");
-
- debug(0 , "Slow string!");
- _activeSpeech.playingTime = 10 * talkspeed;
- // 10 - fix it
-
- } else {
- sampleLength = _vm->_sndRes->getVoiceLength(_activeSpeech.sampleResourceId); //fixme - too fast
+ if (_activeSpeech.playing) {
+ _activeSpeech.playingTime -= msec;
+ stringLength = strlen(_activeSpeech.strings[0]);
- if (sampleLength < 0) {
- _activeSpeech.playingTime = stringLength * talkspeed;
+ removeFirst = false;
+ if (_activeSpeech.playingTime <= 0) {
+ if (_activeSpeech.speechFlags & kSpeakSlow) {
+ _activeSpeech.slowModeCharIndex++;
+ if (_activeSpeech.slowModeCharIndex >= stringLength)
+ removeFirst = true;
} else {
- _activeSpeech.playingTime = sampleLength;
+ removeFirst = true;
+ }
+ _activeSpeech.playing = false;
+ if (_activeSpeech.actorIds[0] != 0) {
+ actor = getActor(_activeSpeech.actorIds[0]);
+ if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) {
+ actor->currentAction = kActionWait;
+ }
}
}
- if (_activeSpeech.sampleResourceId != -1) {
- _vm->_sndRes->playVoice(_activeSpeech.sampleResourceId);
- _activeSpeech.sampleResourceId++;
+ if (removeFirst) {
+ for (i = 1; i < _activeSpeech.stringsCount; i++) {
+ _activeSpeech.strings[i - 1] = _activeSpeech.strings[i];
+ }
+ _activeSpeech.stringsCount--;
}
- if (_activeSpeech.actorIds[0] != 0) {
- actor = getActor(_activeSpeech.actorIds[0]);
- if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) {
- actor->currentAction = kActionSpeak;
- actor->actionCycle = _vm->_rnd.getRandomNumber(63);
- }
- for (i = 0; i < _activeSpeech.actorsCount; i++) {
- actor = getActor(_activeSpeech.actorIds[i]);
- _activeSpeech.speechCoords[i] = actor->screenPosition;
- _activeSpeech.speechCoords[i].y -= ACTOR_DIALOGUE_HEIGHT;
- _activeSpeech.speechCoords[i].y = MAX(_activeSpeech.speechCoords[i].y, (int16)10);
- }
+ if (_vm->_script->_skipSpeeches) {
+ _activeSpeech.stringsCount = 0;
+ _vm->_script->wakeUpThreads(kWaitTypeSpeech);
+ return;
}
- _activeSpeech.playing = true;
+
+ if (_activeSpeech.stringsCount == 0) {
+ _vm->_script->wakeUpThreadsDelayed(kWaitTypeSpeech, ticksToMSec(kScriptTimeTicksPerSecond / 3));
+ }
+
return;
}
+ if (_vm->_script->_skipSpeeches) {
+ _activeSpeech.stringsCount = 0;
+ _vm->_script->wakeUpThreads(kWaitTypeSpeech);
+ }
- _activeSpeech.playingTime -= msec;
+ if (_activeSpeech.stringsCount == 0) {
+ return;
+ }
- removeFirst = false;
- if (_activeSpeech.playingTime <= 0) {
- if (_activeSpeech.speechFlags & kSpeakSlow) {
- _activeSpeech.slowModeCharIndex++;
- if (_activeSpeech.slowModeCharIndex >= stringLength)
- removeFirst = true;
+ stringLength = strlen(_activeSpeech.strings[0]);
+
+ talkspeed = ConfMan.getInt("talkspeed");
+ if (_activeSpeech.speechFlags & kSpeakSlow) {
+ if (_activeSpeech.slowModeCharIndex >= stringLength)
+ error("Wrong string index");
+
+ debug(0 , "Slow string!");
+ _activeSpeech.playingTime = 10 * talkspeed;
+ // 10 - fix it
+
+ } else {
+ sampleLength = _vm->_sndRes->getVoiceLength(_activeSpeech.sampleResourceId); //fixme - too fast
+
+ if (sampleLength < 0) {
+ _activeSpeech.playingTime = stringLength * talkspeed;
} else {
- removeFirst = true;
- }
- _activeSpeech.playing = false;
- if (_activeSpeech.actorIds[0] != 0) {
- actor = getActor(_activeSpeech.actorIds[0]);
- if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) {
- actor->currentAction = kActionWait;
- }
+ _activeSpeech.playingTime = sampleLength;
}
}
- if (removeFirst) {
- for (i = 1; i < _activeSpeech.stringsCount; i++) {
- _activeSpeech.strings[i - 1] = _activeSpeech.strings[i];
- }
- _activeSpeech.stringsCount--;
+ if (_activeSpeech.sampleResourceId != -1) {
+ _vm->_sndRes->playVoice(_activeSpeech.sampleResourceId);
+ _activeSpeech.sampleResourceId++;
}
- if (!isSpeaking())
- _vm->_script->wakeUpThreadsDelayed(kWaitTypeSpeech, ticksToMSec(kScriptTimeTicksPerSecond / 3));
+ if (_activeSpeech.actorIds[0] != 0) {
+ actor = getActor(_activeSpeech.actorIds[0]);
+ if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) {
+ actor->currentAction = kActionSpeak;
+ actor->actionCycle = _vm->_rnd.getRandomNumber(63);
+ }
+ for (i = 0; i < _activeSpeech.actorsCount; i++) {
+ actor = getActor(_activeSpeech.actorIds[i]);
+ _activeSpeech.speechCoords[i] = actor->screenPosition;
+ _activeSpeech.speechCoords[i].y -= ACTOR_DIALOGUE_HEIGHT;
+ _activeSpeech.speechCoords[i].y = MAX(_activeSpeech.speechCoords[i].y, (int16)10);
+ }
+ }
+ _activeSpeech.playing = true;
}
void Actor::handleActions(int msec, bool setup) {
@@ -1760,6 +1765,8 @@
}
void Actor::abortAllSpeeches() {
+ abortSpeech();
+
if (_vm->_script->_abortEnabled)
_vm->_script->_skipSpeeches = true;
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- actor.h 18 Apr 2005 20:03:09 -0000 1.62
+++ actor.h 19 Apr 2005 11:07:06 -0000 1.63
@@ -160,6 +160,10 @@
result.y = y - location.y;
result.z = z - location.z;
}
+ void addXY(const Location &location) {
+ x += location.x;
+ y += location.y;
+ }
void add(const Location &location) {
x += location.x;
y += location.y;
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- interface.cpp 19 Apr 2005 07:44:01 -0000 1.76
+++ interface.cpp 19 Apr 2005 11:07:06 -0000 1.77
@@ -158,6 +158,7 @@
if (!_active) {
_active = true;
_vm->_script->_skipSpeeches = false;
+ _vm->_actor->_protagonist->targetObject = ID_NOTHING;
_vm->_gfx->showCursor(true);
unlockMode();
if (_panelMode == kPanelMain)
More information about the Scummvm-git-logs
mailing list