diff options
author | Torbjörn Andersson | 2005-01-13 07:47:04 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-01-13 07:47:04 +0000 |
commit | 8c708cce8e677a83b12a4360c97c668158401601 (patch) | |
tree | e228c938d837c60cddfaeebb3bcd1bbb6b0ff126 | |
parent | 1e499f47f2964836e09cc00e44c583ef2c11bcbb (diff) | |
download | scummvm-rg350-8c708cce8e677a83b12a4360c97c668158401601.tar.gz scummvm-rg350-8c708cce8e677a83b12a4360c97c668158401601.tar.bz2 scummvm-rg350-8c708cce8e677a83b12a4360c97c668158401601.zip |
A few subtitle-related changes:
* Added speechCoords to the SpeechData structure so that talking actors
don't drag their speech subtitles with them just because they're moving
and talking at the same time. (Could this also be useful for non-actor
speech?) If the actor has multiple strings, the coordinates are updated
for each new string.
* Made speechColor and outlineCoor arrays so that simultaneous speech (i.e.
where several actors are talking at the same time) multi-coloured. This
is completely untested, though.
* Used getBlack() to get the black colour for the text outline. The
original uses a constant, but we could always make getBlack() return
that constant, if we want to.
svn-id: r16550
-rw-r--r-- | saga/actor.cpp | 48 | ||||
-rw-r--r-- | saga/actor.h | 9 |
2 files changed, 33 insertions, 24 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 462c65ddd1..8ca4abe275 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -609,6 +609,15 @@ void Actor::handleSpeech(int msec) { _activeSpeech.strings[i - 1] = _activeSpeech.strings[i]; } _activeSpeech.stringsCount--; + if (_activeSpeech.stringsCount > 0 && _activeSpeech.actorIds[0] != 0) { + // Update actor speech position for the next string. + // Note that we only need to do this for the first + // actor since simultaneous speech is never more than + // one string at a time. + actor = getActor(_activeSpeech.actorIds[0]); + _activeSpeech.speechCoords[0] = actor->screenPosition; + _activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT; + } } if (!isSpeaking()) @@ -966,8 +975,7 @@ int Actor::drawActors() { // draw speeches if (isSpeaking() && !_vm->_script->_skipSpeeches) { int i; - int textDrawFlags, speechColor; - Point speechCoord; + int textDrawFlags; char oneChar[2]; oneChar[1] = 0; const char *outputString; @@ -987,16 +995,7 @@ int Actor::drawActors() { if (_activeSpeech.actorIds[0] != 0) { for (i = 0; i < _activeSpeech.actorsCount; i++){ - actor = getActor(_activeSpeech.actorIds[i]); - speechCoord.x = actor->screenPosition.x; - speechCoord.y = actor->screenPosition.y; - speechCoord.y -= ACTOR_DIALOGUE_HEIGHT; - if (_activeSpeech.actorsCount > 1) - speechColor = actor->speechColor; - else - speechColor = _activeSpeech.speechColor; - - _vm->textDraw(MEDIUM_FONT_ID, back_buf, outputString, speechCoord.x, speechCoord.y, speechColor, _activeSpeech.outlineColor, textDrawFlags); + _vm->textDraw(MEDIUM_FONT_ID, back_buf, outputString, _activeSpeech.speechCoords[i].x, _activeSpeech.speechCoords[i].y, _activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], textDrawFlags); } } else { // non actors speech @@ -1315,15 +1314,17 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, int i; actor = getActor(actorId); - for (i = 0; i < stringsCount; i++) { + for (i = 0; i < stringsCount; i++) { _activeSpeech.strings[i] = strings[i]; } _activeSpeech.stringsCount = stringsCount; _activeSpeech.speechFlags = speechFlags; _activeSpeech.actorsCount = 1; _activeSpeech.actorIds[0] = actorId; - _activeSpeech.speechColor = actor->speechColor; - _activeSpeech.outlineColor = 15; // fixme - BLACK + _activeSpeech.speechCoords[0] = actor->screenPosition; + _activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT; + _activeSpeech.speechColor[0] = actor->speechColor; + _activeSpeech.outlineColor[0] = _vm->_gfx->getBlack(); _activeSpeech.sampleResourceId = sampleResourceId; _activeSpeech.playing = false; _activeSpeech.slowModeCharIndex = 0; @@ -1341,8 +1342,10 @@ void Actor::nonActorSpeech(const char **strings, int stringsCount, int speechFla _activeSpeech.speechFlags = speechFlags; _activeSpeech.actorsCount = 1; _activeSpeech.actorIds[0] = 0; - //_activeSpeech.speechColor = ; - //_activeSpeech.outlineColor = ; + //_activeSpeech.speechColor[0] = ; + //_activeSpeech.outlineColor[0] = ; + //_activeSpeech.speechCoords[0].x = ; + //_activeSpeech.speechCoords[0].y = ; _activeSpeech.sampleResourceId = -1; _activeSpeech.playing = false; _activeSpeech.slowModeCharIndex = 0; @@ -1351,15 +1354,20 @@ void Actor::nonActorSpeech(const char **strings, int stringsCount, int speechFla void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags) { int i; - for (i = 0; i < actorIdsCount; i++) { + for (i = 0; i < actorIdsCount; i++) { + ActorData *actor; + + actor = getActor(actorIds[i]); _activeSpeech.actorIds[i] = actorIds[i]; + _activeSpeech.speechCoords[i] = actor->screenPosition; + _activeSpeech.speechCoords[i].y -= ACTOR_DIALOGUE_HEIGHT; + _activeSpeech.speechColor[i] = actor->speechColor; + _activeSpeech.outlineColor[i] = 0; // disable outline } _activeSpeech.actorsCount = actorIdsCount; _activeSpeech.strings[0] = string; _activeSpeech.stringsCount = 1; _activeSpeech.speechFlags = speechFlags; - //_activeSpeech.speechColor = ; // get's from every actor - _activeSpeech.outlineColor = 0; // disable outline _activeSpeech.sampleResourceId = -1; _activeSpeech.playing = false; _activeSpeech.slowModeCharIndex = 0; diff --git a/saga/actor.h b/saga/actor.h index 5c6b47b0cd..955e78b541 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -243,10 +243,11 @@ typedef ActorData *ActorDataPointer; typedef SortedList<ActorDataPointer> ActorOrderList; struct SpeechData { - int speechColor; - int outlineColor; + int speechColor[ACTOR_SPEECH_ACTORS_MAX]; + int outlineColor[ACTOR_SPEECH_ACTORS_MAX]; int speechFlags; const char *strings[ACTOR_SPEECH_STRING_MAX]; + Point speechCoords[ACTOR_SPEECH_ACTORS_MAX]; int stringsCount; int slowModeCharIndex; uint16 actorIds[ACTOR_SPEECH_ACTORS_MAX]; @@ -294,8 +295,8 @@ public: void nonActorSpeech(const char **strings, int stringsCount, int speechFlags); void simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags); void setSpeechColor(int speechColor, int outlineColor) { - _activeSpeech.speechColor = speechColor; - _activeSpeech.outlineColor = outlineColor; + _activeSpeech.speechColor[0] = speechColor; + _activeSpeech.outlineColor[0] = outlineColor; } void abortAllSpeeches(); void abortSpeech(); |