diff options
author | Andrew Kurushin | 2004-12-18 21:38:56 +0000 |
---|---|---|
committer | Andrew Kurushin | 2004-12-18 21:38:56 +0000 |
commit | 34dd84f339851e06ac8f389ba7a9621890a84bf1 (patch) | |
tree | c514b3a69f9d9e967412db71f8fe722d577517a4 /saga | |
parent | 62224e135b8e788564ef49676b790ca651b95fcd (diff) | |
download | scummvm-rg350-34dd84f339851e06ac8f389ba7a9621890a84bf1.tar.gz scummvm-rg350-34dd84f339851e06ac8f389ba7a9621890a84bf1.tar.bz2 scummvm-rg350-34dd84f339851e06ac8f389ba7a9621890a84bf1.zip |
now actors will not stuck in the middle of dialog
svn-id: r16123
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 35 | ||||
-rw-r--r-- | saga/actor.h | 24 |
2 files changed, 28 insertions, 31 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 36337c3d01..73df0cefd0 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -230,7 +230,7 @@ int Actor::direct(int msec) { case INTENT_SPEAK: // Actor wants to blab { - handleSpeakIntent(actor, &a_intent->speakIntent, &a_intent->a_idone, msec); + handleSpeakIntent(actor, a_intent, &a_intent->a_idone, msec); } break; @@ -328,8 +328,8 @@ int Actor::drawActors() { if (actorIntentIterator != actor->a_intentlist.end()) { a_intent = actorIntentIterator.operator->(); if (a_intent->a_itype == INTENT_SPEAK) { - actorDialogIterator = a_intent->speakIntent.si_diaglist.begin(); - if (actorDialogIterator != a_intent->speakIntent.si_diaglist.end()) { + actorDialogIterator = a_intent->si_diaglist.begin(); + if (actorDialogIterator != a_intent->si_diaglist.end()) { a_dialogue = actorDialogIterator.operator->(); diag_x = actor->s_pt.x; diag_y = actor->s_pt.y; @@ -368,13 +368,13 @@ int Actor::skipDialogue() { if (a_intent->a_itype == INTENT_SPEAK) { // Okay, found a speak intent. Remove one dialogue entry // from it, releasing any semaphore */ - actorDialogIterator = a_intent->speakIntent.si_diaglist.begin(); - if (actorDialogIterator != a_intent->speakIntent.si_diaglist.end()) { + actorDialogIterator = a_intent->si_diaglist.begin(); + if (actorDialogIterator != a_intent->si_diaglist.end()) { a_dialogue = actorDialogIterator.operator->(); if (a_dialogue->d_sem != NULL) { _vm->_script->SThreadReleaseSem(a_dialogue->d_sem); } - a_intent->speakIntent.si_diaglist.erase(actorDialogIterator); + a_intent->si_diaglist.erase(actorDialogIterator); // And stop any currently playing voices _vm->_sound->stopVoice(); } @@ -386,7 +386,6 @@ int Actor::skipDialogue() { } void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAPHORE *sem) { - ActorOrderList::iterator actorOrderIterator; ActorData *actor; ActorIntentList::iterator actorIntentIterator; ACTORINTENT *a_intent_p = NULL; @@ -417,15 +416,15 @@ void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAP if (use_existing_ai) { // Store the current dialogue off the existing actor intent - a_intent_p->speakIntent.si_diaglist.push_back(a_dialogue); + a_intent_p->si_diaglist.push_back(a_dialogue); } else { // Create a new actor intent a_intent.a_itype = INTENT_SPEAK; a_intent.a_idone = 0; a_intent.a_iflags = 0; - a_intent.speakIntent.si_last_action = actor->action; - a_intent.speakIntent.si_diaglist.push_back(a_dialogue); + a_intent.si_last_action = actor->action; + a_intent.si_diaglist.push_back(a_dialogue); actor->a_intentlist.push_back(a_intent); } @@ -435,7 +434,7 @@ void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAP } } -int Actor::handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec) { +int Actor::handleSpeakIntent(ActorData *actor, ACTORINTENT *a_aintent, int *complete_p, int msec) { ActorDialogList::iterator actorDialogIterator; ActorDialogList::iterator nextActorDialogIterator; ACTORDIALOGUE *a_dialogue; @@ -443,18 +442,18 @@ int Actor::handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *com long carry_time; int intent_complete = 0; - if (!a_speakint->si_init) { + if (!a_aintent->si_init) { // Initialize speak intent by setting up action actor->action = ACTION_SPEAK; actor->action_frame = 0; actor->action_time = 0; actor->action_flags = ACTION_LOOP; - a_speakint->si_init = 1; + a_aintent->si_init = 1; } // Process actor dialogue list - actorDialogIterator = a_speakint->si_diaglist.begin(); - if (actorDialogIterator != a_speakint->si_diaglist.end()) { + actorDialogIterator = a_aintent->si_diaglist.begin(); + if (actorDialogIterator != a_aintent->si_diaglist.end()) { a_dialogue = actorDialogIterator.operator->(); if (!a_dialogue->d_playing) { // Dialogue voice hasn't played yet - play it now @@ -478,7 +477,7 @@ int Actor::handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *com nextActorDialogIterator = actorDialogIterator; ++nextActorDialogIterator; - if (nextActorDialogIterator != a_speakint->si_diaglist.end()) { + if (nextActorDialogIterator != a_aintent->si_diaglist.end()) { a_dialogue2 = nextActorDialogIterator.operator->(); a_dialogue2->d_time -= carry_time; } @@ -486,8 +485,8 @@ int Actor::handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *com // Check if there are any dialogue nodes left. If not, // flag this speech intent as complete - actorDialogIterator = a_speakint->si_diaglist.erase(actorDialogIterator); - if (actorDialogIterator != a_speakint->si_diaglist.end()) { + actorDialogIterator = a_aintent->si_diaglist.erase(actorDialogIterator); + if (actorDialogIterator == a_aintent->si_diaglist.end()) { intent_complete = 1; } } diff --git a/saga/actor.h b/saga/actor.h index 3d48ff4b85..545a130a75 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -148,29 +148,27 @@ struct ACTORDIALOGUE { typedef Common::List<ACTORDIALOGUE> ActorDialogList; -struct SPEAKINTENT { - int si_init; - uint16 si_flags; - int si_last_action; - ActorDialogList si_diaglist; /* Actor dialogue list */ - SPEAKINTENT() { - si_init = 0; - si_flags = 0; - si_last_action = 0; - } -}; struct ACTORINTENT { int a_itype; uint16 a_iflags; int a_idone; - SPEAKINTENT speakIntent; + + int si_init; + uint16 si_flags; + int si_last_action; + ActorDialogList si_diaglist; /* Actor dialogue list */ + WALKINTENT walkIntent; ACTORINTENT() { a_itype = 0; a_iflags = 0; a_idone = 0; + + si_init = 0; + si_flags = 0; + si_last_action = 0; } }; @@ -295,7 +293,7 @@ public: private: int handleWalkIntent(ActorData *actor, WALKINTENT *a_walk_int, int *complete_p, int msec); - int handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec); + int handleSpeakIntent(ActorData *actor, ACTORINTENT *a_aintent, int *complete_p, int msec); int setPathNode(WALKINTENT *walk_int, Point *src_pt, Point *dst_pt, SEMAPHORE *sem); ActorData *getActor(uint16 actorId); |