Ticket #1861: ft_alter.diff
File ft_alter.diff, 14.4 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 … … 1471 1475 } 1472 1476 if (_version == 8 || _heversion >= 60) 1473 1477 setTalkingActor(0); 1478 clearSubtitleQueue(); 1474 1479 if (_version == 8) 1475 1480 VAR(VAR_HAVE_MSG) = 0; 1476 1481 _keepText = false; -
scumm/intern.h
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v retrieving revision 2.538 diff -u -r2.538 intern.h
1363 1363 void playSpeech(const byte *ptr); 1364 1364 1365 1365 virtual void drawVerb(int verb, int mode); 1366 1367 virtual void CHARSET_1(); 1368 void processSubtitleQueue(); 1366 1369 }; 1367 1370 1368 1371 class ScummEngine_v8 : public ScummEngine_v7 { -
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)), … … 951 952 updateCursor(); 952 953 _system->warpMouse(_mouse.x, _mouse.y); 953 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 } 954 962 955 963 // 956 964 // Save/load actors … … 1189 1197 #ifndef DISABLE_SCUMM_7_8 1190 1198 void ScummEngine_v7::saveOrLoad(Serializer *s) { 1191 1199 ScummEngine::saveOrLoad(s); 1200 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 }; 1192 1210 1211 const SaveLoadEntry V7Entries[] = { 1212 MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)), 1213 MKEND() 1214 }; 1215 1193 1216 assert(_imuseDigital); 1194 1217 _imuseDigital->saveOrLoad(s); 1218 1219 s->saveLoadArrayOf(_subtitleQueue, ARRAYSIZE(_subtitleQueue), sizeof(_subtitleQueue[0]), subtitleQueueEntries); 1220 s->saveLoadEntries(this, V7Entries); 1195 1221 } 1196 1222 #endif 1197 1223 -
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.621 diff -u -r1.621 scumm.cpp
1124 1124 _palDirtyMin = 0; 1125 1125 _palDirtyMax = 0; 1126 1126 _haveMsg = 0; 1127 _haveActorSpeechMsg = false; 1127 1128 _useTalkAnims = false; 1128 1129 _defaultTalkDelay = 0; 1129 1130 _midiDriver = MD_NULL; … … 1137 1138 memset(_charsetData, 0, sizeof(_charsetData)); 1138 1139 _charsetBufPos = 0; 1139 1140 memset(_charsetBuffer, 0, sizeof(_charsetBuffer)); 1141 clearSubtitleQueue(); 1140 1142 _copyProtection = false; 1141 1143 _demoMode = false; 1142 1144 _confirmExit = false; … … 1935 1937 1936 1938 _charsetBufPos = 0; 1937 1939 _haveMsg = 0; 1940 _haveActorSpeechMsg = false; 1938 1941 1939 1942 _varwatch = -1; 1940 1943 _screenStartStrip = 0; … … 2292 2295 VAR(VAR_CAMERA_POS_X) = camera._cur.x; 2293 2296 } 2294 2297 if (_version <= 7) 2295 VAR(VAR_HAVE_MSG) = (_haveMsg == 0xFE) ? 0xFF :_haveMsg;2298 VAR(VAR_HAVE_MSG) = _haveMsg; 2296 2299 2297 2300 if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { 2298 2301 // 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; … … 1157 1158 1158 1159 bool _keepText; 1159 1160 1161 struct SubtitleText { 1162 byte text[256]; 1163 byte charset; 1164 byte color; 1165 int16 xpos, ypos; 1166 bool actorSpeechMsg; 1167 }; 1168 1169 int _subtitleQueuePos; 1170 SubtitleText _subtitleQueue[20]; 1171 1160 1172 virtual void initCharset(int charset); 1161 1173 1162 1174 void printString(int m, const byte *msg); 1163 1175 1164 void CHARSET_1(); 1176 virtual void CHARSET_1(); 1177 void addSubtitleToQueue(const byte *text, int x, int y, byte color, byte charset); 1178 void clearSubtitleQueue(); 1179 1165 1180 void drawString(int a, const byte *msg); 1166 1181 void debugMessage(const byte *msg); 1167 1182 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::addSubtitleToQueue(const byte *text, int x, int y, byte color, byte charset) { 99 if (text[0] && strcmp((const char *)text, " ") != 0) { 100 assert(_subtitleQueuePos < ARRAYSIZE(_subtitleQueue)); 101 SubtitleText *st = &_subtitleQueue[_subtitleQueuePos]; 102 int i = 0; 103 while (1) { 104 st->text[i] = text[i]; 105 if (!text[i]) 106 break; 107 ++i; 108 } 109 st->xpos = x; 110 st->ypos = y; 111 st->color = color; 112 st->charset = charset; 113 st->actorSpeechMsg = _haveActorSpeechMsg; 114 ++_subtitleQueuePos; 115 } 116 } 117 118 void ScummEngine::clearSubtitleQueue() { 119 memset(_subtitleQueue, 0, sizeof(_subtitleQueue)); 120 _subtitleQueuePos = 0; 121 } 122 123 #ifndef DISABLE_SCUMM_7_8 124 void ScummEngine_v7::processSubtitleQueue() { 125 for (int i = 0; i < _subtitleQueuePos; ++i) { 126 SubtitleText *st = &_subtitleQueue[i]; 127 if (!ConfMan.getBool("subtitles") || VAR(VAR_VOICE_MODE) == 0) 128 // subtitles are disabled, don't display the text 129 continue; 130 if (!ConfMan.getBool("subtitles") && (!st->actorSpeechMsg || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) 131 // no subtitles and there's a speech variant of the message, don't display the text 132 continue; 133 enqueueText(st->text, st->xpos, st->ypos, st->color, st->charset, false); 134 } 135 } 136 137 void ScummEngine_v7::CHARSET_1() { 138 processSubtitleQueue(); 139 ScummEngine::CHARSET_1(); 140 } 141 #endif 142 98 143 void ScummEngine::CHARSET_1() { 99 144 uint32 talk_sound_a = 0; 100 145 uint32 talk_sound_b = 0; … … 102 147 int frme; 103 148 Actor *a; 104 149 byte *buffer; 150 byte subtitleBuffer[200]; 151 byte *subtitleLine = subtitleBuffer; 152 Common::Point subtitlePos; 105 153 int code = (_heversion >= 80) ? 127 : 64; 106 154 char value[32]; 107 155 108 bool cmi_pos_hack = false;109 110 156 if (!_haveMsg) 111 157 return; 112 158 … … 166 212 _charset->setCurID(_string[0].charset); 167 213 168 214 if (_version >= 5) 169 for (i = 0; i < 4; i++) 170 _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; 215 memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4); 171 216 172 217 if (_talkDelay) 173 218 return; … … 184 229 } 185 230 186 231 // Always set to 60 187 if (_version <= 6) 188 _talkDelay = 60; 189 else 190 _talkDelay = VAR(VAR_DEFAULT_TALK_DELAY); 232 _talkDelay = (VAR_DEFAULT_TALK_DELAY != 0xFF) ? VAR(VAR_DEFAULT_TALK_DELAY) : 60; 191 233 192 234 if (!_keepText) { 193 _charset->restoreCharsetBg(); 235 if (_version >= 7) { 236 clearSubtitleQueue(); 237 _charset->_nextLeft = _string[0].xpos; 238 _charset->_nextTop = _string[0].ypos; 239 } else { 240 _charset->restoreCharsetBg(); 241 } 194 242 } 195 243 196 244 t = _charset->_right - _string[0].xpos - 1; … … 218 266 if (c == 0) { 219 267 // End of text reached, set _haveMsg to 1 so that the text will be 220 268 // removed next time CHARSET_1 is called. 221 _haveMsg = 1;269 _haveMsg = (_version >= 7) ? 2 : 1; 222 270 _keepText = false; 223 271 break; 224 272 } … … 233 281 if (c == 13) { 234 282 newLine:; 235 283 _charset->_nextLeft = _string[0].xpos; 284 if (_version >= 7 && subtitleLine != subtitleBuffer) { 285 addSubtitleToQueue(subtitleBuffer, subtitlePos.x, subtitlePos.y, _charsetColor, _charset->getCurID()); 286 subtitleLine = subtitleBuffer; 287 } 236 288 if (_charset->_center) { 237 289 _charset->_nextLeft -= _charset->getStringWidth(0, buffer) / 2; 238 290 } 291 239 292 if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { 240 293 break; 241 294 } else if (!(_platform == Common::kPlatformFMTowns) && _string[0].height) { … … 300 353 _sound->startHETalkSound(talk_sound_a); 301 354 break; 302 355 case 119: 303 if (_haveMsg != 0xFE) 304 _haveMsg = 0xFF; 356 _haveMsg = 0xFF; 305 357 _keepText = false; 306 358 break; 307 359 default: 308 360 error("CHARSET_1: invalid code %d", c); 309 361 } 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 } 362 } else if (c == 0xFF || (_version <= 6 && c == 0xFE)) { 315 363 c = *buffer++; 316 364 switch (c) { 317 365 case 1: … … 321 369 _keepText = true; 322 370 break; 323 371 case 3: 324 if (_haveMsg != 0xFE) 325 _haveMsg = 0xFF; 372 _haveMsg = 0xFF; 326 373 _keepText = false; 327 374 break; 328 375 case 8: … … 333 380 // sentences. 334 381 break; 335 382 case 9: 336 frme = *buffer++;337 frme |= *buffer++ << 8;383 frme = buffer[0] | (buffer[1] << 8); 384 buffer += 2; 338 385 if (a) 339 386 a->startAnimActor(frme); 340 387 break; … … 343 390 talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); 344 391 talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24); 345 392 buffer += 14; 346 347 393 if (_heversion >= 60) { 348 394 _sound->startHETalkSound(talk_sound_a); 349 395 } else { 350 396 _sound->talkSound(talk_sound_a, talk_sound_b, 2); 351 397 } 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; 398 _haveActorSpeechMsg = false; 363 399 break; 364 400 case 12: 365 401 int color; 366 color = *buffer++;367 color |= *buffer++ << 8;402 color = buffer[0] | (buffer[1] << 8); 403 buffer += 2; 368 404 if (color == 0xFF) 369 405 _charset->setColor(_charsetColor); 370 406 else … … 388 424 error("CHARSET_1: invalid code %d", c); 389 425 } 390 426 } else { 391 loc_avoid_ks_fe:392 427 _charset->_left = _charset->_nextLeft; 393 428 _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 } 429 if (_version >= 7) { 430 if (subtitleLine == subtitleBuffer) { 431 subtitlePos.x = _charset->_left; 432 subtitlePos.y = _charset->_top; 403 433 } 404 if (_version <= 3) {405 _charset->printChar(c);434 *subtitleLine++ = c; 435 *subtitleLine = '\0'; 406 436 } else { 407 437 if (_features & GF_HE_NOSUBTITLES) { 408 438 // 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 439 } else if (_heversion >= 60 && !ConfMan.getBool("subtitles") && _sound->isSoundRunning(1)) { 412 440 // Special case for HE games 413 441 } else if ((_gameId == GID_LOOM256) && !ConfMan.getBool("subtitles") && (_sound->pollCD())) { 414 442 // Special case for loomcd, since it only uses CD audio.for sound 415 } else if (!ConfMan.getBool("subtitles") && ( _haveMsg == 0xFE|| _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) {443 } else if (!ConfMan.getBool("subtitles") && (!_haveActorSpeechMsg || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) { 416 444 // Subtitles are turned off, and there is a voice version 417 445 // of this message -> don't print it. 418 446 } else { 419 447 _charset->printChar(c); 420 448 } 421 } 422 if (cmi_pos_hack) { 423 cmi_pos_hack = false; 424 _charset->_top -= 6; 449 _charset->_nextLeft = _charset->_left; 450 _charset->_nextTop = _charset->_top; 425 451 } 426 452 427 _charset->_nextLeft = _charset->_left;428 _charset->_nextTop = _charset->_top;429 453 if (_version <= 2) { 430 454 _talkDelay += _defaultTalkDelay; 431 455 VAR(VAR_CHARCOUNT)++; 432 } else 456 } else { 433 457 _talkDelay += (int)VAR(VAR_CHARINC); 434 458 } 435 459 // Handle line overflow for V3 436 460 if (_version == 3 && _charset->_nextLeft > _screenWidth) { 437 461 _charset->_nextLeft = _screenWidth; … … 445 469 446 470 _charsetBufPos = buffer - _charsetBuffer; 447 471 448 // TODO Verify this is correct spot449 if (_version == 8)450 VAR(VAR_HAVE_MSG) = (_string[0].no_talk_anim) ? 2 : 1;472 if (_version >= 7 && subtitleLine != subtitleBuffer) { 473 addSubtitleToQueue(subtitleBuffer, subtitlePos.x, subtitlePos.y, _charsetColor, _charset->getCurID()); 474 } 451 475 } 452 476 453 477 void ScummEngine::drawString(int a, const byte *msg) {