[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.159,1.160
Robert Göffringmann
lavosspawn at users.sourceforge.net
Tue Dec 6 08:14:05 CET 2005
Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29313/sky
Modified Files:
logic.cpp
Log Message:
fixed bug.
Before, when a subtitle would get displayed because the corresponding speechfile wasn't found and the player escaped it by clicking with the mouse, it'd stay on screen forever.
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- logic.cpp 5 Dec 2005 05:02:43 -0000 1.159
+++ logic.cpp 6 Dec 2005 16:13:39 -0000 1.160
@@ -532,8 +532,7 @@
if (clickTable[i] == (uint16)_scriptVariables[CUR_ID]) {
if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_SPEECH) && (!_skySound->speechFinished()))
_skySound->stopSpeech();
- if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) &&
- (_compact->spTextId > 0) &&
+ if ((_compact->spTextId > 0) &&
(_compact->spTextId < 0xFFFF)) {
_skyCompact->fetchCpt(_compact->spTextId)->status = 0;
@@ -2502,71 +2501,67 @@
target->offset = *animPtr++;
target->getToFlag = *animPtr++;
target->grafixProgPos += 2;
- } else {
+ } else
target->grafixProgId = 0;
- }
- bool speechUsed = false;
- // startSpeech returns false if no speech file exists for that text
+ bool speechFileFound = false;
if (SkyEngine::isCDVersion())
- speechUsed = _skySound->startSpeech((uint16)textNum);
-
- // if sky is configured to speech-only return now - except if we're running another
- // language than english
- if (speechUsed && (!(SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT))) {
- target->spTime = 10;
- target->logic = L_TALK;
- return;
- }
+ speechFileFound = _skySound->startSpeech((uint16)textNum);
- //now form the text sprite
- struct lowTextManager_t textInfo;
- textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->spColour, true);
- Compact *textCompact = _skyCompact->fetchCpt(textInfo.compactNum);
- target->spTextId = textInfo.compactNum; //So we know what text to kill
- byte *textGfx = textInfo.textData;
+ if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) || !speechFileFound) {
+ // form the text sprite, if player wants subtitles or
+ // if we couldn't find the speech file
+ struct lowTextManager_t textInfo;
+ textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->spColour, true);
+ Compact *textCompact = _skyCompact->fetchCpt(textInfo.compactNum);
+ target->spTextId = textInfo.compactNum; //So we know what text to kill
+ byte *textGfx = textInfo.textData;
- //create the x coordinate for the speech text
- //we need the talkers sprite information
- textCompact->screen = target->screen; //put our screen in
+ textCompact->screen = target->screen; //put it on our screen
- if (_scriptVariables[SCREEN] == target->screen) { // Only use coordinates if we are on the current screen
- //talking on-screen
- byte *targetGfx = (byte *)SkyEngine::fetchItem(target->frame >> 6);
- uint16 xPos = target->xcood + ((struct dataFileHeader *)targetGfx)->s_offset_x;
- uint16 width = (((struct dataFileHeader *)targetGfx)->s_width >> 1);
+ if (_scriptVariables[SCREEN] == target->screen) { // Only use coordinates if we are on the current screen
+ //talking on-screen
+ //create the x coordinate for the speech text
+ //we need the talkers sprite information
+ byte *targetGfx = (byte *)SkyEngine::fetchItem(target->frame >> 6);
+ uint16 xPos = target->xcood + ((struct dataFileHeader *)targetGfx)->s_offset_x;
+ uint16 width = (((struct dataFileHeader *)targetGfx)->s_width >> 1);
- xPos += width - (FIXED_TEXT_WIDTH / 2); //middle of talker
+ xPos += width - (FIXED_TEXT_WIDTH / 2); //middle of talker
- if (xPos < TOP_LEFT_X)
- xPos = TOP_LEFT_X;
+ if (xPos < TOP_LEFT_X)
+ xPos = TOP_LEFT_X;
- width = xPos + FIXED_TEXT_WIDTH;
- if ((TOP_LEFT_X + FULL_SCREEN_WIDTH) <= width) {
- xPos = TOP_LEFT_X + FULL_SCREEN_WIDTH;
- xPos -= FIXED_TEXT_WIDTH;
- }
+ width = xPos + FIXED_TEXT_WIDTH;
+ if ((TOP_LEFT_X + FULL_SCREEN_WIDTH) <= width) {
+ xPos = TOP_LEFT_X + FULL_SCREEN_WIDTH;
+ xPos -= FIXED_TEXT_WIDTH;
+ }
- textCompact->xcood = xPos;
- uint16 yPos = target->ycood + ((struct dataFileHeader *)targetGfx)->s_offset_y - 6 - ((struct dataFileHeader *)textGfx)->s_height;
+ textCompact->xcood = xPos;
+ uint16 yPos = target->ycood + ((struct dataFileHeader *)targetGfx)->s_offset_y - 6 - ((struct dataFileHeader *)textGfx)->s_height;
- if (yPos < TOP_LEFT_Y)
- yPos = TOP_LEFT_Y;
+ if (yPos < TOP_LEFT_Y)
+ yPos = TOP_LEFT_Y;
- textCompact->ycood = yPos;
+ textCompact->ycood = yPos;
+ } else {
+ //talking off-screen
+ target->spTextId = 0; //don't kill any text 'cos none was made
+ textCompact->status = 0; //don't display text
+ }
+ // In CD version, we're doing the timing by checking when the VOC has stopped playing.
+ // Setting spTime to 10 thus means that we're doing a pause of 10 gamecycles between
+ // each sentence.
+ if (speechFileFound)
+ target->spTime = 10;
+ else
+ target->spTime = (uint16)_skyText->_numLetters + 5;
} else {
- //talking off-screen
- target->spTextId = 0; //don't kill any text 'cos none was made
- textCompact->status = 0; //don't display text
- }
- // In CD version, we're doing the timing by checking when the VOC has stopped playing.
- // Setting spTime to 10 thus means that we're doing a pause of 10 gamecycles between
- // each sentence.
- if (speechUsed)
target->spTime = 10;
- else
- target->spTime = (uint16)_skyText->_numLetters + 5;
+ target->spTextId = 0;
+ }
target->logic = L_TALK;
}
More information about the Scummvm-git-logs
mailing list