Ticket #1861: ft_1092993-4.diff
File ft_1092993-4.diff, 21.7 KB (added by , 18 years ago) |
---|
-
scumm/actor.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v retrieving revision 1.389 diff -u -r1.389 actor.cpp
1360 1360 } 1361 1361 _charsetBufPos = 0; 1362 1362 _talkDelay = 0; 1363 _haveMsg = 0xFF;1363 _haveMsg = 1; 1364 1364 if (_version == 7) 1365 1365 VAR(VAR_HAVE_MSG) = 0xFF; 1366 _haveActorSpeechMsg = true; 1366 1367 CHARSET_1(); 1368 if (_version == 8) 1369 VAR(VAR_HAVE_MSG) = (_string[0].no_talk_anim) ? 2 : 1; 1367 1370 } 1368 1371 #endif 1369 1372 … … 1428 1431 VAR(VAR_HAVE_MSG) = 0xFF; 1429 1432 if (VAR_CHARCOUNT != 0xFF) 1430 1433 VAR(VAR_CHARCOUNT) = 0; 1434 _haveActorSpeechMsg = true; 1431 1435 CHARSET_1(); 1432 1436 } 1433 1437 … … 1474 1478 if (_version == 8) 1475 1479 VAR(VAR_HAVE_MSG) = 0; 1476 1480 _keepText = false; 1477 _charset->restoreCharsetBg(); 1481 if (_version >= 7) { 1482 #ifndef DISABLE_SCUMM_7_8 1483 ((ScummEngine_v7 *)this)->clearSubtitleQueue(); 1484 #endif 1485 } else { 1486 _charset->restoreCharsetBg(); 1487 } 1478 1488 } 1479 1489 1480 1490 void Actor::setActorCostume(int c) { -
scumm/intern.h
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v retrieving revision 2.538 diff -u -r2.538 intern.h
1003 1003 1004 1004 int findObject(int x, int y, int num, int *args); 1005 1005 int getSoundResourceSize(int id); 1006 1007 virtual bool handleNextCharsetCode(Actor *a, int *c); 1006 1008 1007 1009 /* HE version 72 script opcodes */ 1008 1010 void o72_pushDWord(); … … 1338 1340 int _languageIndexSize; 1339 1341 char _lastStringTag[12+1]; 1340 1342 1343 struct SubtitleText { 1344 byte text[256]; 1345 byte charset; 1346 byte color; 1347 int16 xpos, ypos; 1348 bool actorSpeechMsg; 1349 }; 1350 1351 int _subtitleQueuePos; 1352 SubtitleText _subtitleQueue[20]; 1353 1354 void processSubtitleQueue(); 1355 void addSubtitleToQueue(const byte *text, const Common::Point &pos, byte color, byte charset); 1356 void clearSubtitleQueue(); 1357 1341 1358 protected: 1342 1359 virtual void setupScummVars(); 1343 1360 virtual void initScummVars(); -
scumm/saveload.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v retrieving revision 1.253 diff -u -r1.253 saveload.cpp
730 730 MKLINE(ScummEngine, _charsetBufPos, sleInt16, VER(10)), 731 731 732 732 MKLINE(ScummEngine, _haveMsg, sleByte, VER(8)), 733 MKLINE(ScummEngine, _haveActorSpeechMsg, sleByte, VER(61)), 733 734 MKLINE(ScummEngine, _useTalkAnims, sleByte, VER(8)), 734 735 735 736 MKLINE(ScummEngine, _talkDelay, sleInt16, VER(8)), … … 952 953 _system->warpMouse(_mouse.x, _mouse.y); 953 954 } 954 955 956 // Before V61, we reused the _haveMsg flag to handle "alternative" speech sound 957 // files (see charset code 10). Behave like the original, rather. 958 if (s->isLoading() && s->getVersion() < VER(61)) { 959 _haveActorSpeechMsg = (_haveMsg != 0xFE); 960 _haveMsg = 0xFF; 961 } 962 955 963 // 956 964 // Save/load actors 957 965 // … … 1190 1198 void ScummEngine_v7::saveOrLoad(Serializer *s) { 1191 1199 ScummEngine::saveOrLoad(s); 1192 1200 1193 assert(_imuseDigital); 1201 const SaveLoadEntry subtitleQueueEntries[] = { 1202 MKARRAY(SubtitleText, text[0], sleByte, 256, VER(61)), 1203 MKLINE(SubtitleText, charset, sleByte, VER(61)), 1204 MKLINE(SubtitleText, color, sleByte, VER(61)), 1205 MKLINE(SubtitleText, xpos, sleInt16, VER(61)), 1206 MKLINE(SubtitleText, ypos, sleInt16, VER(61)), 1207 MKLINE(SubtitleText, actorSpeechMsg, sleByte, VER(61)), 1208 MKEND() 1209 }; 1210 1211 const SaveLoadEntry V7Entries[] = { 1212 MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)), 1213 MKEND() 1214 }; 1215 1194 1216 _imuseDigital->saveOrLoad(s); 1217 1218 s->saveLoadArrayOf(_subtitleQueue, ARRAYSIZE(_subtitleQueue), sizeof(_subtitleQueue[0]), subtitleQueueEntries); 1219 s->saveLoadEntries(this, V7Entries); 1195 1220 } 1196 1221 #endif 1197 1222 -
scumm/saveload.h
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v retrieving revision 1.71 diff -u -r1.71 saveload.h
45 45 * only saves/loads those which are valid for the version of the savegame 46 46 * which is being loaded/saved currently. 47 47 */ 48 #define CURRENT_VER 6 048 #define CURRENT_VER 61 49 49 50 50 /** 51 51 * An auxillary macro, used to specify savegame versions. We use this instead -
scumm/scumm.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v retrieving revision 1.622 diff -u -r1.622 scumm.cpp
1125 1125 _palDirtyMin = 0; 1126 1126 _palDirtyMax = 0; 1127 1127 _haveMsg = 0; 1128 _haveActorSpeechMsg = false; 1128 1129 _useTalkAnims = false; 1129 1130 _defaultTalkDelay = 0; 1130 1131 _midiDriver = MD_NULL; … … 1582 1583 _existLanguageFile = false; 1583 1584 _languageBuffer = NULL; 1584 1585 _languageIndex = NULL; 1586 clearSubtitleQueue(); 1585 1587 } 1586 1588 1587 1589 ScummEngine_v7::~ScummEngine_v7() { … … 1936 1938 1937 1939 _charsetBufPos = 0; 1938 1940 _haveMsg = 0; 1941 _haveActorSpeechMsg = false; 1939 1942 1940 1943 _varwatch = -1; 1941 1944 _screenStartStrip = 0; … … 2293 2296 VAR(VAR_CAMERA_POS_X) = camera._cur.x; 2294 2297 } 2295 2298 if (_version <= 7) 2296 VAR(VAR_HAVE_MSG) = (_haveMsg == 0xFE) ? 0xFF :_haveMsg;2299 VAR(VAR_HAVE_MSG) = _haveMsg; 2297 2300 2298 2301 if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { 2299 2302 // TODO -
scumm/scumm.h
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v retrieving revision 1.654 diff -u -r1.654 scumm.h
1093 1093 byte *_palManipIntermediatePal; 1094 1094 1095 1095 byte _haveMsg; 1096 bool _haveActorSpeechMsg; 1096 1097 bool _useTalkAnims; 1097 1098 uint16 _defaultTalkDelay; 1098 1099 int _tempMusic; … … 1161 1162 1162 1163 void printString(int m, const byte *msg); 1163 1164 1165 virtual bool handleNextCharsetCode(Actor *a, int *c); 1164 1166 void CHARSET_1(); 1167 1165 1168 void drawString(int a, const byte *msg); 1166 1169 void debugMessage(const byte *msg); 1167 1170 void showMessageDialog(const byte *msg); -
scumm/string.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v retrieving revision 1.306 diff -u -r1.306 string.cpp
95 95 VAR(VAR_KEYPRESS) = runDialog(dialog); 96 96 } 97 97 98 void ScummEngine::CHARSET_1() { 98 #ifndef DISABLE_SCUMM_7_8 99 void ScummEngine_v7::processSubtitleQueue() { 100 for (int i = 0; i < _subtitleQueuePos; ++i) { 101 SubtitleText *st = &_subtitleQueue[i]; 102 if (!ConfMan.getBool("subtitles") || VAR(VAR_VOICE_MODE) == 0) 103 // subtitles are disabled, don't display the text 104 continue; 105 if (!ConfMan.getBool("subtitles") && (!st->actorSpeechMsg || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) 106 // no subtitles and there's a speech variant of the message, don't display the text 107 continue; 108 enqueueText(st->text, st->xpos, st->ypos, st->color, st->charset, false); 109 } 110 } 111 112 void ScummEngine_v7::addSubtitleToQueue(const byte *text, const Common::Point &pos, byte color, byte charset) { 113 if (text[0] && strcmp((const char *)text, " ") != 0) { 114 assert(_subtitleQueuePos < ARRAYSIZE(_subtitleQueue)); 115 SubtitleText *st = &_subtitleQueue[_subtitleQueuePos]; 116 int i = 0; 117 while (1) { 118 st->text[i] = text[i]; 119 if (!text[i]) 120 break; 121 ++i; 122 } 123 st->xpos = pos.x; 124 st->ypos = pos.y; 125 st->color = color; 126 st->charset = charset; 127 st->actorSpeechMsg = _haveActorSpeechMsg; 128 ++_subtitleQueuePos; 129 } 130 } 131 132 void ScummEngine_v7::clearSubtitleQueue() { 133 memset(_subtitleQueue, 0, sizeof(_subtitleQueue)); 134 _subtitleQueuePos = 0; 135 } 136 #endif 137 138 bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { 99 139 uint32 talk_sound_a = 0; 100 140 uint32 talk_sound_b = 0; 101 int i, t, c; 102 int frme; 103 Actor *a; 104 byte *buffer; 105 int code = (_heversion >= 80) ? 127 : 64; 141 int i, color, frme, c, oldy; 142 bool endLoop = false; 143 byte *buffer = _charsetBuffer + _charsetBufPos; 144 while (!endLoop) { 145 c = *buffer++; 146 if (!(c == 0xFF || (_version <= 6 && c == 0xFE))) { 147 break; 148 } 149 c = *buffer++; 150 switch (c) { 151 case 1: 152 endLoop = true; 153 c = 13; // new line 154 break; 155 case 2: 156 _haveMsg = 0; 157 _keepText = true; 158 endLoop = true; 159 break; 160 case 3: 161 _haveMsg = (_version >= 7) ? 1 : 0xFF; 162 _keepText = false; 163 endLoop = true; 164 break; 165 case 8: 166 // Ignore this code here. Occurs e.g. in MI2 when you 167 // talk to the carpenter on scabb island. It works like 168 // code 1 (=newline) in verb texts, but is ignored in 169 // spoken text (i.e. here). Used for very long verb 170 // sentences. 171 break; 172 case 9: 173 frme = buffer[0] | (buffer[1] << 8); 174 buffer += 2; 175 if (a) 176 a->startAnimActor(frme); 177 break; 178 case 10: 179 // Note the similarity to the code in debugMessage() 180 talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); 181 talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24); 182 buffer += 14; 183 if (_heversion >= 60) { 184 _sound->startHETalkSound(talk_sound_a); 185 } else { 186 _sound->talkSound(talk_sound_a, talk_sound_b, 2); 187 } 188 _haveActorSpeechMsg = false; 189 break; 190 case 12: 191 color = buffer[0] | (buffer[1] << 8); 192 buffer += 2; 193 if (color == 0xFF) 194 _charset->setColor(_charsetColor); 195 else 196 _charset->setColor(color); 197 break; 198 case 13: 199 debug(0, "handleNextCharsetCode: Unknown opcode 13 %d", READ_LE_UINT16(buffer)); 200 buffer += 2; 201 break; 202 case 14: 203 oldy = _charset->getFontHeight(); 204 _charset->setCurID(*buffer++); 205 buffer += 2; 206 for (i = 0; i < 4; i++) 207 _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; 208 _charset->_nextTop -= _charset->getFontHeight() - oldy; 209 break; 210 default: 211 error("handleNextCharsetCode: invalid code %d", c); 212 } 213 } 214 _charsetBufPos = buffer - _charsetBuffer; 215 *code = c; 216 return (c != 2 && c != 3); 217 } 218 219 #ifndef DISABLE_HE 220 bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { 221 const int charsetCode = (_heversion >= 80) ? 127 : 64; 222 uint32 talk_sound_a = 0; 223 uint32 talk_sound_b = 0; 224 int i, c; 106 225 char value[32]; 226 byte *buffer = _charsetBuffer + _charsetBufPos; 227 do { 228 c = *buffer++; 229 if (c != charsetCode) { 230 break; 231 } 232 c = *buffer++; 233 switch (c) { 234 case 84: 235 i = 0; 236 memset(value, 0, 32); 237 c = *buffer++; 238 while (c != 44) { 239 value[i] = c; 240 c = *buffer++; 241 i++; 242 } 243 value[i] = 0; 244 talk_sound_a = atoi(value); 245 i = 0; 246 memset(value, 0, 32); 247 c = *buffer++; 248 while (c != charsetCode) { 249 value[i] = c; 250 c = *buffer++; 251 i++; 252 } 253 value[i] = 0; 254 talk_sound_b = atoi(value); 255 _sound->startHETalkSound(talk_sound_a); 256 break; 257 case 104: 258 _haveMsg = 0; 259 _keepText = true; 260 break; 261 case 110: 262 c = 13; // new line 263 break; 264 case 116: 265 i = 0; 266 memset(value, 0, 32); 267 c = *buffer++; 268 while (c != charsetCode) { 269 value[i] = c; 270 c = *buffer++; 271 i++; 272 } 273 value[i] = 0; 274 talk_sound_a = atoi(value); 275 talk_sound_b = 0; 276 _sound->startHETalkSound(talk_sound_a); 277 break; 278 case 119: 279 _haveMsg = 0xFF; 280 _keepText = false; 281 break; 282 default: 283 error("handleNextCharsetCode: invalid code %d", c); 284 } 285 } while (c != 13); 286 _charsetBufPos = buffer - _charsetBuffer; 287 *code = c; 288 return true; 289 } 290 #endif 107 291 108 bool cmi_pos_hack = false; 292 void ScummEngine::CHARSET_1() { 293 Actor *a; 294 int t, c = 0; 295 #ifndef DISABLE_SCUMM_7_8 296 byte subtitleBuffer[200]; 297 byte *subtitleLine = subtitleBuffer; 298 Common::Point subtitlePos; 299 300 if (_version >= 7) { 301 ((ScummEngine_v7 *)this)->processSubtitleQueue(); 302 } 303 #endif 109 304 110 305 if (!_haveMsg) 111 306 return; … … 166 361 _charset->setCurID(_string[0].charset); 167 362 168 363 if (_version >= 5) 169 for (i = 0; i < 4; i++) 170 _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; 364 memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4); 171 365 172 366 if (_talkDelay) 173 367 return; 174 368 175 if ((_version <= 7 && _haveMsg == 1) || (_version == 8 && VAR(VAR_HAVE_MSG))) {369 if ((_version <= 6 && _haveMsg == 1) || (_version == 7 && _haveMsg != 1) || (_version == 8 && VAR(VAR_HAVE_MSG))) { 176 370 if ((_sound->_sfxMode & 2) == 0) 177 371 stopTalk(); 178 372 return; … … 183 377 _useTalkAnims = true; 184 378 } 185 379 186 // Always set to 60 187 if (_version <= 6) 188 _talkDelay = 60; 189 else 190 _talkDelay = VAR(VAR_DEFAULT_TALK_DELAY); 380 _talkDelay = (VAR_DEFAULT_TALK_DELAY != 0xFF) ? VAR(VAR_DEFAULT_TALK_DELAY) : 60; 191 381 192 382 if (!_keepText) { 193 _charset->restoreCharsetBg(); 383 if (_version >= 7) { 384 #ifndef DISABLE_SCUMM_7_8 385 ((ScummEngine_v7 *)this)->clearSubtitleQueue(); 386 _charset->_nextLeft = _string[0].xpos; 387 _charset->_nextTop = _string[0].ypos; 388 #endif 389 } else { 390 _charset->restoreCharsetBg(); 391 } 194 392 } 195 393 196 394 t = _charset->_right - _string[0].xpos - 1; … … 200 398 t *= 2; 201 399 } 202 400 203 buffer = _charsetBuffer + _charsetBufPos;204 205 401 if (_version > 3) 206 _charset->addLinebreaks(0, buffer, 0, t);402 _charset->addLinebreaks(0, _charsetBuffer + _charsetBufPos, 0, t); 207 403 208 404 if (_charset->_center) { 209 _charset->_nextLeft -= _charset->getStringWidth(0, buffer) / 2;405 _charset->_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2; 210 406 if (_charset->_nextLeft < 0) 211 407 _charset->_nextLeft = 0; 212 408 } 213 409 214 410 _charset->_disableOffsX = _charset->_firstChar = !_keepText; 215 411 216 do { 217 c = *buffer++; 412 while (handleNextCharsetCode(a, &c)) { 218 413 if (c == 0) { 219 // End of text reached, set _haveMsg to 1 so that the text will be 220 // removed next time CHARSET_1 is called. 221 _haveMsg = 1; 414 // End of text reached, set _haveMsg accordingly 415 _haveMsg = (_version >= 7) ? 2 : 1; 222 416 _keepText = false; 223 417 break; 224 418 } … … 233 427 if (c == 13) { 234 428 newLine:; 235 429 _charset->_nextLeft = _string[0].xpos; 430 #ifndef DISABLE_SCUMM_7_8 431 if (_version >= 7 && subtitleLine != subtitleBuffer) { 432 ((ScummEngine_v7 *)this)->addSubtitleToQueue(subtitleBuffer, subtitlePos, _charsetColor, _charset->getCurID()); 433 subtitleLine = subtitleBuffer; 434 } 435 #endif 236 436 if (_charset->_center) { 237 _charset->_nextLeft -= _charset->getStringWidth(0, buffer) / 2;437 _charset->_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2; 238 438 } 439 239 440 if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { 240 441 break; 241 442 } else if (!(_platform == Common::kPlatformFMTowns) && _string[0].height) { … … 250 451 continue; 251 452 } 252 453 253 if (_heversion >= 72 && c == code) { 254 c = *buffer++; 255 switch (c) { 256 case 84: 257 i = 0; 258 memset(value, 0, 32); 259 c = *buffer++; 260 while (c != 44) { 261 value[i] = c; 262 c = *buffer++; 263 i++; 264 } 265 value[i] = 0; 266 talk_sound_a = atoi(value); 267 268 i = 0; 269 memset(value, 0, 32); 270 c = *buffer++; 271 while (c != code) { 272 value[i] = c; 273 c = *buffer++; 274 i++; 275 } 276 value[i] = 0; 277 talk_sound_b = atoi(value); 278 279 _sound->startHETalkSound(talk_sound_a); 280 break; 281 case 104: 282 _haveMsg = 0; 283 _keepText = true; 284 break; 285 case 110: 286 goto newLine; 287 case 116: 288 i = 0; 289 memset(value, 0, 32); 290 c = *buffer++; 291 while (c != code) { 292 value[i] = c; 293 c = *buffer++; 294 i++; 295 } 296 value[i] = 0; 297 talk_sound_a = atoi(value); 298 talk_sound_b = 0; 299 300 _sound->startHETalkSound(talk_sound_a); 301 break; 302 case 119: 303 if (_haveMsg != 0xFE) 304 _haveMsg = 0xFF; 305 _keepText = false; 306 break; 307 default: 308 error("CHARSET_1: invalid code %d", c); 309 } 310 } else if (c == 0xFE || c == 0xFF) { 311 // WORKAROUND to avoid korean code 0xfe treated as charset message code. 312 if (c == 0xFE && checkKSCode(*(buffer + 1), c) && _useCJKMode) { 313 goto loc_avoid_ks_fe; 314 } 315 c = *buffer++; 316 switch (c) { 317 case 1: 318 goto newLine; 319 case 2: 320 _haveMsg = 0; 321 _keepText = true; 322 break; 323 case 3: 324 if (_haveMsg != 0xFE) 325 _haveMsg = 0xFF; 326 _keepText = false; 327 break; 328 case 8: 329 // Ignore this code here. Occurs e.g. in MI2 when you 330 // talk to the carpenter on scabb island. It works like 331 // code 1 (=newline) in verb texts, but is ignored in 332 // spoken text (i.e. here). Used for very long verb 333 // sentences. 334 break; 335 case 9: 336 frme = *buffer++; 337 frme |= *buffer++ << 8; 338 if (a) 339 a->startAnimActor(frme); 340 break; 341 case 10: 342 // Note the similarity to the code in debugMessage() 343 talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); 344 talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24); 345 buffer += 14; 346 347 if (_heversion >= 60) { 348 _sound->startHETalkSound(talk_sound_a); 349 } else { 350 _sound->talkSound(talk_sound_a, talk_sound_b, 2); 351 } 352 353 // Set flag that speech variant exist of this msg. 354 // This is actually a hack added by ScummVM; the original did 355 // subtitle hiding in some other way. I am not sure exactly 356 // how, though. 357 // FIXME: This is actually a rather ugly hack, and we should consider 358 // replacing it with something better; problem is that _haveMsg is saved, 359 // so we need to cope with old save games if we ever change this. 360 // And BTW Fingolfin was responsible for this silly bad hack. Stupid me! :-). 361 if (_haveMsg == 0xFF) 362 _haveMsg = 0xFE; 363 break; 364 case 12: 365 int color; 366 color = *buffer++; 367 color |= *buffer++ << 8; 368 if (color == 0xFF) 369 _charset->setColor(_charsetColor); 370 else 371 _charset->setColor(color); 372 break; 373 case 13: 374 debug(0, "CHARSET_1: Unknown opcode 13 %d", READ_LE_UINT16(buffer)); 375 buffer += 2; 376 break; 377 case 14: { 378 int oldy = _charset->getFontHeight(); 379 380 _charset->setCurID(*buffer++); 381 buffer += 2; 382 for (i = 0; i < 4; i++) 383 _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; 384 _charset->_nextTop -= _charset->getFontHeight() - oldy; 385 break; 386 } 387 default: 388 error("CHARSET_1: invalid code %d", c); 454 _charset->_left = _charset->_nextLeft; 455 _charset->_top = _charset->_nextTop; 456 if (_version >= 7) { 457 #ifndef DISABLE_SCUMM_7_8 458 if (subtitleLine == subtitleBuffer) { 459 subtitlePos.x = _charset->_left; 460 subtitlePos.y = _charset->_top; 389 461 } 390 } else { 391 loc_avoid_ks_fe: 392 _charset->_left = _charset->_nextLeft; 393 _charset->_top = _charset->_nextTop; 394 if (c & 0x80 && _useCJKMode) 395 if (_language == Common::JA_JPN && !checkSJISCode(c)) { 396 c = 0x20; //not in S-JIS 397 } else { 398 c += *buffer++ * 256; //LE 399 if (_gameId == GID_CMI) { //HACK: This fixes korean text position in COMI (off by 6 pixel) 400 cmi_pos_hack = true; 401 _charset->_top += 6; 402 } 403 } 462 *subtitleLine++ = c; 463 *subtitleLine = '\0'; 464 #endif 465 } else { 404 466 if (_version <= 3) { 405 467 _charset->printChar(c); 406 468 } else { 407 469 if (_features & GF_HE_NOSUBTITLES) { 408 470 // HE games which use sprites for subtitles 409 } else if ((_imuseDigital && _sound->isSoundRunning(kTalkSoundID)) && (!ConfMan.getBool("subtitles") || VAR(VAR_VOICE_MODE) == 0)) {410 // Special case for games using imuse digital.for sound411 471 } else if (_heversion >= 60 && !ConfMan.getBool("subtitles") && _sound->isSoundRunning(1)) { 412 472 // Special case for HE games 413 473 } else if ((_gameId == GID_LOOM256) && !ConfMan.getBool("subtitles") && (_sound->pollCD())) { 414 474 // Special case for loomcd, since it only uses CD audio.for sound 415 } else if (!ConfMan.getBool("subtitles") && ( _haveMsg == 0xFE|| _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) {475 } else if (!ConfMan.getBool("subtitles") && (!_haveActorSpeechMsg || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) { 416 476 // Subtitles are turned off, and there is a voice version 417 477 // of this message -> don't print it. 418 478 } else { 419 479 _charset->printChar(c); 420 480 } 421 481 } 422 if (cmi_pos_hack) {423 cmi_pos_hack = false;424 _charset->_top -= 6;425 }426 427 482 _charset->_nextLeft = _charset->_left; 428 483 _charset->_nextTop = _charset->_top; 429 if (_version <= 2) {430 _talkDelay += _defaultTalkDelay;431 VAR(VAR_CHARCOUNT)++;432 } else433 _talkDelay += (int)VAR(VAR_CHARINC);434 435 // Handle line overflow for V3436 if (_version == 3 && _charset->_nextLeft > _screenWidth) {437 _charset->_nextLeft = _screenWidth;438 }439 // Handle line breaks for V1-V2440 if (_version <= 2 && _charset->_nextLeft > _screenWidth) {441 goto newLine;442 }443 484 } 444 } while (c != 2 && c != 3);445 485 446 _charsetBufPos = buffer - _charsetBuffer; 486 if (_version <= 2) { 487 _talkDelay += _defaultTalkDelay; 488 VAR(VAR_CHARCOUNT)++; 489 } else { 490 _talkDelay += (int)VAR(VAR_CHARINC); 491 } 492 // Handle line overflow for V3 493 if (_version == 3 && _charset->_nextLeft > _screenWidth) { 494 _charset->_nextLeft = _screenWidth; 495 } 496 // Handle line breaks for V1-V2 497 if (_version <= 2 && _charset->_nextLeft > _screenWidth) { 498 goto newLine; 499 } 500 } 447 501 448 // TODO Verify this is correct spot 449 if (_version == 8) 450 VAR(VAR_HAVE_MSG) = (_string[0].no_talk_anim) ? 2 : 1; 502 #ifndef DISABLE_SCUMM_7_8 503 if (_version >= 7 && subtitleLine != subtitleBuffer) { 504 ((ScummEngine_v7 *)this)->addSubtitleToQueue(subtitleBuffer, subtitlePos, _charsetColor, _charset->getCurID()); 505 } 506 #endif 451 507 } 452 508 453 509 void ScummEngine::drawString(int a, const byte *msg) { … … 859 915 } 860 916 861 917 #ifndef DISABLE_SCUMM_7_8 862 int indexCompare(const void *p1, const void *p2) {918 static int indexCompare(const void *p1, const void *p2) { 863 919 const ScummEngine_v7::LangIndexNode *i1 = (const ScummEngine_v7::LangIndexNode *) p1; 864 920 const ScummEngine_v7::LangIndexNode *i2 = (const ScummEngine_v7::LangIndexNode *) p2; 865 921