diff --git a/saga/actor.cpp b/saga/actor.cpp index c7fd31ada08..0e7b5eb16bb 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -739,6 +739,12 @@ void Actor::handleSpeech(int msec) { 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; return; @@ -770,15 +776,6 @@ 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()) @@ -1280,7 +1277,7 @@ int Actor::drawActors() { } // draw speeches - if (isSpeaking() && !_vm->_script->_skipSpeeches) { + if (isSpeaking() && _activeSpeech.playing && !_vm->_script->_skipSpeeches) { int i; int textDrawFlags; char oneChar[2]; @@ -1699,12 +1696,11 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, 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.speechCoords[0] = actor->screenPosition; - _activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT; _activeSpeech.speechColor[0] = actor->speechColor; _activeSpeech.outlineColor[0] = kITEColorBlack; _activeSpeech.sampleResourceId = sampleResourceId; @@ -1746,8 +1742,6 @@ void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, 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 } diff --git a/saga/script.h b/saga/script.h index 24577db51e6..ccb81ab1a45 100644 --- a/saga/script.h +++ b/saga/script.h @@ -512,7 +512,7 @@ private: void sfResumeBgdAnim(SCRIPTFUNC_PARAMS); void SF_throwActor(SCRIPTFUNC_PARAMS); void sfWaitWalk(SCRIPTFUNC_PARAMS); - void SF_sceneID(SCRIPTFUNC_PARAMS); + void sfScriptSceneID(SCRIPTFUNC_PARAMS); void SF_changeActorScene(SCRIPTFUNC_PARAMS); void SF_climb(SCRIPTFUNC_PARAMS); void sfSetDoorState(SCRIPTFUNC_PARAMS); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 82efff070fd..68b21b082d3 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -104,7 +104,7 @@ void Script::setupScriptFuncList(void) { OPCODE(sfResumeBgdAnim), OPCODE(SF_throwActor), OPCODE(sfWaitWalk), - OPCODE(SF_sceneID), + OPCODE(sfScriptSceneID), OPCODE(SF_changeActorScene), OPCODE(SF_climb), OPCODE(sfSetDoorState), @@ -1346,7 +1346,7 @@ void Script::sfWaitWalk(SCRIPTFUNC_PARAMS) { } // Script function #54 (0x36) -void Script::SF_sceneID(SCRIPTFUNC_PARAMS) { +void Script::sfScriptSceneID(SCRIPTFUNC_PARAMS) { thread->_returnValue = _vm->_scene->currentSceneNumber(); } diff --git a/saga/sprite.cpp b/saga/sprite.cpp index 23f6a8e66ca..46a55d73d7a 100644 --- a/saga/sprite.cpp +++ b/saga/sprite.cpp @@ -241,8 +241,6 @@ bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &scre const byte *spriteBuffer; int i, j; const byte *srcRowPointer; - int clipWidth; - int clipHeight; int width; int height; int xAlign; @@ -255,27 +253,10 @@ bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &scre spritePointer.x = screenCoord.x + xAlign; spritePointer.y = screenCoord.y + yAlign; - if (spritePointer.x < 0) { + if ((testPoint.y < spritePointer.y) || (testPoint.y >= spritePointer.y + height)) { return false; } - if (spritePointer.y < 0) { - return false; - } - - clipWidth = width; - if (width > (_vm->getDisplayWidth() - spritePointer.x)) { - clipWidth = (_vm->getDisplayWidth() - spritePointer.x); - } - - clipHeight = height; - if (height > (_vm->getDisplayHeight() - spritePointer.y)) { - clipHeight = (_vm->getDisplayHeight() - spritePointer.y); - } - - if ((testPoint.y < spritePointer.y) || (testPoint.y >= spritePointer.y + clipHeight)) { - return false; - } - if ((testPoint.x < spritePointer.x) || (testPoint.x >= spritePointer.x + clipWidth)) { + if ((testPoint.x < spritePointer.x) || (testPoint.x >= spritePointer.x + width)) { return false; } i = testPoint.y - spritePointer.y;