Ticket #8495: kyra-debugandtextfade_v1.patch
File kyra-debugandtextfade_v1.patch, 24.8 KB (added by , 19 years ago) |
---|
-
kyra/debugger.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/debugger.cpp scummvm/kyra/debugger.cpp
old new 1 /* ScummVM - Scumm Interpreter 2 * Copyright (C) 2003-2005 The ScummVM project 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #include "common/stdafx.h" 21 #include "common/config-manager.h" 22 #include "common/debugger.cpp" 23 #include "kyra/debugger.h" 24 #include "kyra/kyra.h" 25 #include "kyra/screen.h" 26 27 namespace Kyra { 28 29 Debugger::Debugger(KyraEngine *vm) 30 : Common::Debugger<Debugger>() { 31 _vm = vm; 32 33 DCmd_Register("continue", &Debugger::cmd_Exit); 34 DCmd_Register("exit", &Debugger::cmd_Exit); 35 DCmd_Register("help", &Debugger::cmd_Help); 36 DCmd_Register("quit", &Debugger::cmd_Exit); 37 DCmd_Register("enter", &Debugger::cmd_EnterRoom); 38 DCmd_Register("rooms", &Debugger::cmd_ListRooms); 39 DCmd_Register("flags", &Debugger::cmd_ListFlags); 40 DCmd_Register("toggleflag", &Debugger::cmd_ToggleFlag); 41 DCmd_Register("queryflag", &Debugger::cmd_QueryFlag); 42 DCmd_Register("timers", &Debugger::cmd_ListTimers); 43 DCmd_Register("settimercountdown", &Debugger::cmd_SetTimerCountdown); 44 } 45 46 void Debugger::preEnter() { 47 //_vm->midi.pause(1); 48 } 49 50 void Debugger::postEnter() { 51 //_vm->midi.pause(0); 52 } 53 54 bool Debugger::cmd_EnterRoom(int argc, const char **argv) { 55 if (argc > 1) { 56 uint room = atoi(argv[1]); 57 58 // Dirty way of hiding the debug console while the room entry scripts are running, 59 // otherwise the graphics didn't update. 60 _vm->_system->hideOverlay(); 61 _vm->enterNewScene(room, _vm->_currentCharacter->facing, 0, 0, 1); 62 _vm->_system->showOverlay(); 63 return false; 64 } 65 66 DebugPrintf("Syntax: room <roomnum>\n"); 67 return true; 68 } 69 70 bool Debugger::cmd_Exit(int argc, const char **argv) { 71 _detach_now = true; 72 return false; 73 } 74 75 bool Debugger::cmd_Help(int argc, const char **argv) { 76 // console normally has 39 line width 77 // wrap around nicely 78 int width = 0, size, i; 79 80 DebugPrintf("Commands are:\n"); 81 for (i = 0 ; i < _dcmd_count ; i++) { 82 size = strlen(_dcmds[i].name) + 1; 83 84 if ((width + size) >= 39) { 85 DebugPrintf("\n"); 86 width = size; 87 } else 88 width += size; 89 90 DebugPrintf("%s ", _dcmds[i].name); 91 } 92 DebugPrintf("\n"); 93 return true; 94 } 95 96 bool Debugger::cmd_ListRooms(int argc, const char **argv) { 97 for (int i = 0; i < _vm->_roomTableSize; i++) { 98 DebugPrintf("%-3i: %-10s", i, _vm->_roomFilenameTable[_vm->_roomTable[i].nameIndex]); 99 if (!(i % 8)) 100 DebugPrintf("\n"); 101 } 102 DebugPrintf("\n"); 103 DebugPrintf("Current room: %i\n", _vm->_currentRoom); 104 return true; 105 } 106 107 bool Debugger::cmd_ListFlags(int argc, const char **argv) { 108 for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) { 109 DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i)); 110 if (!(i % 10)) 111 DebugPrintf("\n"); 112 } 113 DebugPrintf("\n"); 114 return true; 115 } 116 117 bool Debugger::cmd_ToggleFlag(int argc, const char **argv) { 118 if (argc > 1) { 119 uint flag = atoi(argv[1]); 120 if (_vm->queryGameFlag(flag)) 121 _vm->resetGameFlag(flag); 122 else 123 _vm->setGameFlag(flag); 124 DebugPrintf("Flag %i is now %i\n", flag, _vm->queryGameFlag(flag)); 125 } else 126 DebugPrintf("Syntax: toggleflag <flag>\n"); 127 128 return true; 129 } 130 131 bool Debugger::cmd_QueryFlag(int argc, const char **argv) { 132 if (argc > 1) { 133 uint flag = atoi(argv[1]); 134 DebugPrintf("Flag %i is %i\n", flag, _vm->queryGameFlag(flag)); 135 } else 136 DebugPrintf("Syntax: queryflag <flag>\n"); 137 138 return true; 139 } 140 141 bool Debugger::cmd_ListTimers(int argc, const char **argv) { 142 for (int i = 0; i < ARRAYSIZE(_vm->_timers); i++) 143 DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i\n", i, _vm->_timers[i].active ? "Yes" : "No", _vm->_timers[i].countdown); 144 145 return true; 146 } 147 148 bool Debugger::cmd_SetTimerCountdown(int argc, const char **argv) { 149 if (argc > 2) { 150 uint timer = atoi(argv[1]); 151 uint countdown = atoi(argv[2]); 152 _vm->setTimerCountdown(timer, countdown); 153 DebugPrintf("Timer %i now has countdown %i\n", timer, _vm->_timers[timer].countdown); 154 } else 155 DebugPrintf("Syntax: settimercountdown <timer> <countdown>\n"); 156 157 return true; 158 } 159 160 } // End of namespace Kyra 161 -
kyra/debugger.h
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/debugger.h scummvm/kyra/debugger.h
old new 1 /* ScummVM - Scumm Interpreter 2 * Copyright (C) 2003-2005 The ScummVM project 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #ifndef KYRA_DEBUGGER_H 21 #define KYRA_DEBUGGER_H 22 23 #include "common/debugger.h" 24 25 namespace Kyra { 26 27 class KyraEngine; 28 29 class Debugger : public Common::Debugger<Debugger> { 30 public: 31 Debugger(KyraEngine *vm); 32 virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ 33 34 protected: 35 KyraEngine *_vm; 36 37 virtual void preEnter(); 38 virtual void postEnter(); 39 40 bool cmd_Exit(int argc, const char **argv); 41 bool cmd_Help(int argc, const char **argv); 42 bool cmd_EnterRoom(int argc, const char **argv); 43 bool cmd_ListRooms(int argc, const char **argv); 44 bool cmd_ListFlags(int argc, const char **argv); 45 bool cmd_ToggleFlag(int argc, const char **argv); 46 bool cmd_QueryFlag(int argc, const char **argv); 47 bool cmd_ListTimers(int argc, const char **argv); 48 bool cmd_SetTimerCountdown(int argc, const char **argv); 49 }; 50 51 } // End of namespace Kyra 52 53 #endif -
kyra/kyra.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/kyra.cpp scummvm/kyra/kyra.cpp
old new 15 15 * along with this program; if not, write to the Free Software 16 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 17 * 18 * $Header: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v 1.7 6 2005/12/08 17:19:17lordhoto Exp $18 * $Header: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v 1.75 2005/11/27 10:02:22 lordhoto Exp $ 19 19 * 20 20 */ 21 21 … … 44 44 #include "kyra/sound.h" 45 45 #include "kyra/sprites.h" 46 46 #include "kyra/wsamovie.h" 47 #include "kyra/debugger.h" 47 48 48 49 using namespace Kyra; 49 50 … … 308 309 assert(_scriptClick); 309 310 memset(_scriptClick, 0, sizeof(ScriptState)); 310 311 312 _debugger = new Debugger(this); 313 assert(_debugger); 311 314 memset(_shapes, 0, sizeof(_shapes)); 312 315 memset(_wsaObjects, 0, sizeof(_wsaObjects)); 313 316 … … 320 323 _talkMessageY = 0xC; 321 324 _talkMessageH = 0; 322 325 _talkMessagePrinted = false; 323 _ charSayUnk1= -1;326 _talkingCharNum = -1; 324 327 _charSayUnk3 = -1; 325 328 _mouseX = _mouseY = -1; 326 329 memset(_currSentenceColor, 0, 3); 330 _startSentencePalIndex = -1; 331 _fadeText = false; 332 327 333 _brandonPosX = _brandonPosY = -1; 328 334 _brandonDrawFrame = 113; 329 335 … … 353 359 } 354 360 355 361 KyraEngine::~KyraEngine() { 362 delete _debugger; 356 363 delete _sprites; 357 364 delete _screen; 358 365 delete _res; … … 501 508 case OSystem::EVENT_KEYDOWN: 502 509 if (event.kbd.keycode == 'q' || event.kbd.keycode == 27) { 503 510 _quitFlag = true; 511 } else if (event.kbd.keycode == 'd') { 512 _debugger->attach(); 504 513 } 505 514 break; 506 515 case OSystem::EVENT_MOUSEMOVE: … … 523 532 break; 524 533 } 525 534 } 535 536 if (_debugger->isAttached()) 537 _debugger->onFrame(); 538 526 539 _sprites->updateSceneAnims(); 527 540 updateAllObjectShapes(); 528 541 … … 541 554 542 555 while (!_quitFlag) { 543 556 int32 frameTime = (int32)_system->getMillis(); 544 545 557 updateMousePointer(); 546 558 updateGameTimers(); 547 559 _sprites->updateSceneAnims(); 548 560 updateAllObjectShapes(); 549 // XXX call processPalette561 updateTextFade(); 550 562 551 563 _handleInput = true; 552 564 delay((frameTime + _gameSpeed) - _system->getMillis()); … … 1186 1198 1187 1199 memset(_entranceMouseCursorTracks, 0xFFFF, sizeof(uint16)*4); 1188 1200 _currentCharacter->sceneId = sceneId; 1189 assert(sceneId < _roomFilenameTableSize);1190 1201 1191 1202 assert(sceneId < _roomTableSize); 1203 assert(_roomTable[sceneId].nameIndex < _roomFilenameTableSize); 1204 1192 1205 Room *currentRoom = &_roomTable[sceneId]; 1193 1206 1194 1207 if (_currentRoom != 0xFFFF && (_features & GF_TALKIE)) { … … 1203 1216 1204 1217 _currentRoom = sceneId; 1205 1218 1206 assert(_currentCharacter->sceneId < _roomTableSize);1207 1219 int tableId = _roomTable[_currentCharacter->sceneId].nameIndex; 1208 assert(tableId < _roomFilenameTableSize);1209 1220 char fileNameBuffer[32]; 1210 1221 strcpy(fileNameBuffer, _roomFilenameTable[tableId]); 1211 1222 strcat(fileNameBuffer, ".DAT"); … … 1245 1256 startSceneScript(brandonAlive); 1246 1257 setupSceneItems(); 1247 1258 initSceneData(facing, unk2, brandonAlive); 1248 1259 setTextFadeTimerCountdown(-1); 1260 1249 1261 _loopFlag2 = 0; 1250 1262 _screen->showMouse(); 1251 1263 if (!brandonAlive) { … … 1312 1324 _sprites->updateSceneAnims(); 1313 1325 updateGameTimers(); 1314 1326 updateAllObjectShapes(); 1315 // XXX processPalette 1327 updateTextFade(); 1328 1316 1329 if (_currentCharacter->sceneId == 210) { 1317 1330 // XXX game_updateKyragemFading 1318 1331 } … … 2185 2198 if (_system->getMillis() > timeToEnd && !hasUpdatedNPCs) { 2186 2199 hasUpdatedNPCs = true; 2187 2200 disableTimer(15); 2188 _c harSayUnk4= 4;2201 _currHeadShape = 4; 2189 2202 animRefreshNPC(0); 2190 animRefreshNPC(_ charSayUnk1);2203 animRefreshNPC(_talkingCharNum); 2191 2204 2192 2205 if (_charSayUnk2 != -1) { 2193 2206 _sprites->_animObjects[_charSayUnk2].active = 0; … … 2208 2221 _screen->_curPage = currPage; 2209 2222 2210 2223 copyChangedObjectsForward(0); 2211 //processPalette();2224 updateTextFade(); 2212 2225 2213 2226 if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1) 2214 2227 break; … … 2249 2262 } 2250 2263 2251 2264 if (convoInitialized != 0) { 2252 _ charSayUnk1= -1;2265 _talkingCharNum = -1; 2253 2266 _currentCharacter->currentAnimFrame = 7; 2254 2267 animRefreshNPC(0); 2255 2268 updateAllObjectShapes(); … … 2257 2270 } 2258 2271 2259 2272 void KyraEngine::restoreChatPartnerAnimFrame(int8 charNum) { 2260 _ charSayUnk1= -1;2273 _talkingCharNum = -1; 2261 2274 2262 2275 if (charNum > 0 && charNum < 5) { 2263 2276 _characterList[charNum].currentAnimFrame = _currentChatPartnerBackupFrame; … … 2270 2283 } 2271 2284 2272 2285 void KyraEngine::backupChatPartnerAnimFrame(int8 charNum) { 2273 _ charSayUnk1= 0;2286 _talkingCharNum = 0; 2274 2287 2275 2288 if (charNum < 5 && charNum > 0) 2276 2289 _currentChatPartnerBackupFrame = _characterList[charNum].currentAnimFrame; … … 2307 2320 } 2308 2321 2309 2322 int KyraEngine::initCharacterChat(int8 charNum) { 2310 if (_ charSayUnk1== -1) {2311 _ charSayUnk1= 0;2323 if (_talkingCharNum == -1) { 2324 _talkingCharNum = 0; 2312 2325 2313 2326 if (_scaleMode != 0) 2314 2327 _currentCharacter->currentAnimFrame = 7; … … 2375 2388 if (charNum < 5) { 2376 2389 _characterList[charNum].currentAnimFrame = startAnimFrames[charNum]; 2377 2390 _charSayUnk3 = charNum; 2378 _ charSayUnk1= charNum;2391 _talkingCharNum = charNum; 2379 2392 animRefreshNPC(charNum); 2380 2393 } 2381 2394 … … 2428 2441 endCharacterChat(charNum, convoInitialized); 2429 2442 } 2430 2443 2431 void KyraEngine::drawSentenceCommand(char *sentence, int unk1) { 2444 void KyraEngine::drawSentenceCommand(char *sentence, int color) { 2445 debug(9, "drawSentenceCommand(%s, %i)", sentence, color); 2432 2446 _screen->hideMouse(); 2433 2447 _screen->fillRect(8, 143, 311, 152, 12); 2434 // XXX: palette stuff 2448 2449 if (_startSentencePalIndex != color || _fadeText != false) { 2450 _currSentenceColor[0] = _screen->_currentPalette[765] = _screen->_currentPalette[color*3]; 2451 _currSentenceColor[1] = _screen->_currentPalette[766] = _screen->_currentPalette[color*3+1]; 2452 _currSentenceColor[2] = _screen->_currentPalette[767] = _screen->_currentPalette[color*3+2]; 2453 2454 _screen->setScreenPalette(_screen->_currentPalette); 2455 _startSentencePalIndex = 0; 2456 } 2435 2457 2436 2458 printText(sentence, 8, 143, 0xFF, 12, 0); 2437 2459 _screen->showMouse(); 2438 //setTextFadeTimerCountdown(_textFadeTimerCountdown); 2439 //_palScrollEnabled = 0; 2460 setTextFadeTimerCountdown(15); 2461 _fadeText = false; 2462 } 2463 2464 void KyraEngine::updateSentenceCommand(char *str1, char *str2, int color) { 2465 debug(9, "updateSentenceCommand(%s, %s, %i)", str1, str2, color); 2466 char sentenceCommand[500]; 2467 strncpy(sentenceCommand, str1, 500); 2468 if (str2) 2469 strncat(sentenceCommand, str2, 500 - strlen(sentenceCommand)); 2470 2471 drawSentenceCommand(sentenceCommand, color); 2440 2472 } 2441 2473 2474 void KyraEngine::updateTextFade() { 2475 debug(9, "updateTextFade()"); 2476 if (!_fadeText) 2477 return; 2478 2479 bool finished = false; 2480 for (int i = 0; i < 3; i++) 2481 if (_currSentenceColor[i] > 4) 2482 _currSentenceColor[i] -= 4; 2483 else 2484 if (_currSentenceColor[i]) { 2485 _currSentenceColor[i] = 0; 2486 finished = true; 2487 } 2488 2489 _screen->_currentPalette[765] = _currSentenceColor[0]; 2490 _screen->_currentPalette[766] = _currSentenceColor[1]; 2491 _screen->_currentPalette[767] = _currSentenceColor[2]; 2492 _screen->setScreenPalette(_screen->_currentPalette); 2493 2494 if (finished) { 2495 _fadeText = false; 2496 _startSentencePalIndex = -1; 2497 } 2498 2499 } 2500 2501 2442 2502 #pragma mark - 2443 2503 #pragma mark - Item handling 2444 2504 #pragma mark - … … 3131 3191 } 3132 3192 3133 3193 // talking head functionallity 3134 if (_ charSayUnk1!= -1) {3194 if (_talkingCharNum != -1) { 3135 3195 const int16 baseAnimFrameTable1[] = { 0x11, 0x35, 0x59, 0x00, 0x00, 0x00 }; 3136 3196 const int16 baseAnimFrameTable2[] = { 0x15, 0x39, 0x5D, 0x00, 0x00, 0x00 }; 3137 3197 const int8 xOffsetTable1[] = { 2, 4, 0, 5, 2, 0, 0, 0 }; … … 3141 3201 if (curObject->index == 0 || curObject->index <= 4) { 3142 3202 int shapesIndex = 0; 3143 3203 if (curObject->index == _charSayUnk3) { 3144 shapesIndex = _c harSayUnk4+ baseAnimFrameTable1[curObject->index];3204 shapesIndex = _currHeadShape + baseAnimFrameTable1[curObject->index]; 3145 3205 } else { 3146 3206 shapesIndex = baseAnimFrameTable2[curObject->index]; 3147 3207 int temp2 = 0; … … 4076 4136 updateMousePointer(); 4077 4137 updateGameTimers(); 4078 4138 updateAllObjectShapes(); 4079 // XXX processPalette4139 updateTextFade(); 4080 4140 if (_currentCharacter->sceneId == 210) { 4081 4141 // XXX updateKyragemFading 4082 4142 // XXX playEnd … … 4217 4277 #pragma mark - 4218 4278 4219 4279 void KyraEngine::setupTimers() { 4220 debug(9, " KyraEngine::setupTimers()");4280 debug(9, "setupTimers()"); 4221 4281 memset(_timers, 0, sizeof(_timers)); 4222 4282 4223 4283 for (int i = 0; i < 34; i++) … … 4226 4286 _timers[0].func = _timers[1].func = _timers[2].func = _timers[3].func = _timers[4].func = 0; //Unused. 4227 4287 _timers[5].func = _timers[6].func = _timers[7].func = _timers[8].func = _timers[9].func = 0; //_nullsub51; 4228 4288 _timers[10].func = _timers[11].func = _timers[12].func = _timers[13].func = 0; //_nullsub50; 4229 _timers[14].func = &KyraEngine::timerCheckAnimFlag2; ;//_nullsub52;4289 _timers[14].func = &KyraEngine::timerCheckAnimFlag2; //_nullsub52; 4230 4290 _timers[15].func = &KyraEngine::timerUpdateHeadAnims; //_nullsub48; 4231 4291 _timers[16].func = &KyraEngine::timerSetFlags1; //_nullsub47; 4232 4292 _timers[17].func = 0; //sub_15120; … … 4243 4303 _timers[28].func = 0; //offset _timerDummy6 4244 4304 _timers[29].func = 0; //offset _timerDummy7, 4245 4305 _timers[30].func = 0; //offset _timerDummy8, 4246 _timers[31].func = 0; //sub_151F8;4306 _timers[31].func = &KyraEngine::timerFadeText; //sub_151F8; 4247 4307 _timers[32].func = 0; //_nullsub61; 4248 4308 _timers[33].func = 0; //_nullsub62; 4249 4309 … … 4270 4330 _timers[33].countdown = 3; 4271 4331 } 4272 4332 4273 void KyraEngine::setTimer19() {4274 debug(9, "KyraEngine::setTimer19()");4275 if (_brandonStatusBit & 2) {4276 // XXX call sub_3F9C4277 setTimerCountdown(19, 300);4278 } else if (_brandonStatusBit & 0x20) {4279 // XXX call sub_41104280 setTimerCountdown(19, 300);4281 }4282 }4283 4284 4333 void KyraEngine::updateGameTimers() { 4285 debug(9, "KyraEngine::updateGameTimers()"); 4286 void (Kyra::KyraEngine::*callback)(int timerNum); 4334 debug(9, "updateGameTimers()"); 4287 4335 4288 4336 if (_system->getMillis() < _timerNextRun) 4289 4337 return; … … 4293 4341 for (int i = 0; i < 34; i++) { 4294 4342 if (_timers[i].active && _timers[i].countdown > -1) { 4295 4343 if (_timers[i].nextRun <=_system->getMillis()) { 4296 if (i < 5) 4297 callback = 0; 4298 else 4299 callback = _timers[i].func; 4300 4301 if (callback) 4302 (*this.*callback)(i); 4344 if (i > 4 && _timers[i].func) 4345 (*this.*_timers[i].func)(i); 4303 4346 4304 4347 _timers[i].nextRun = _system->getMillis() + _timers[i].countdown * _tickLength; 4305 4348 … … 4311 4354 } 4312 4355 4313 4356 void KyraEngine::clearNextEventTickCount() { 4314 debug(9, " KyraEngine::clearNextEventTickCount()");4357 debug(9, "clearNextEventTickCount()"); 4315 4358 _timerNextRun = 0; 4316 4359 } 4317 4360 4318 4361 int16 KyraEngine::getTimerDelay(uint8 timer) { 4362 debug(9, "getTimerDelay(%i)", timer); 4319 4363 return _timers[timer].countdown; 4320 4364 } 4321 4365 4322 void KyraEngine::setTimerCountdown(uint8 timer, int 16countdown) {4323 debug(9, " KyraEngine::setTimerCountdown(%i, %i)", timer, countdown);4366 void KyraEngine::setTimerCountdown(uint8 timer, int32 countdown) { 4367 debug(9, "setTimerCountdown(%i, %i)", timer, countdown); 4324 4368 _timers[timer].countdown = countdown; 4325 4369 4326 4370 uint32 nextRun = _system->getMillis() + countdown; … … 4329 4373 } 4330 4374 4331 4375 void KyraEngine::enableTimer(uint8 timer) { 4332 debug(9, " KyraEngine::enableTimer(%i)", timer);4376 debug(9, "enableTimer(%i)", timer); 4333 4377 _timers[timer].active = 1; 4334 4378 } 4335 4379 4336 4380 void KyraEngine::disableTimer(uint8 timer) { 4337 debug(9, " KyraEngine::disableTimer(%i)", timer);4381 debug(9, "disableTimer(%i)", timer); 4338 4382 _timers[timer].active = 0; 4339 4383 } 4340 4384 4341 4385 void KyraEngine::timerUpdateHeadAnims(int timerNum) { 4342 debug(9, " KyraEngine::timerUpdateHeadAnims(%i)", timerNum);4386 debug(9, "timerUpdateHeadAnims(%i)", timerNum); 4343 4387 static int8 currentFrame = 0; 4344 4388 static const int8 frameTable[] = {4, 5, 4, 5, 4, 5, 0, 1, 4, 5, 4345 4389 4, 4, 6, 4, 8, 1, 9, 4, -1}; 4346 4390 4347 if (_ charSayUnk1< 0)4391 if (_talkingCharNum < 0) 4348 4392 return; 4349 4393 4350 _c harSayUnk4= frameTable[currentFrame];4394 _currHeadShape = frameTable[currentFrame]; 4351 4395 currentFrame++; 4352 4396 4353 4397 if (frameTable[currentFrame] == -1) 4354 4398 currentFrame = 0; 4355 4399 4356 4400 animRefreshNPC(0); 4357 animRefreshNPC(_ charSayUnk1);4401 animRefreshNPC(_talkingCharNum); 4358 4402 } 4359 4403 4360 4404 void KyraEngine::timerSetFlags1(int timerNum) { 4361 debug(9, " KyraEngine::timerSetFlags(%i)", timerNum);4405 debug(9, "timerSetFlags(%i)", timerNum); 4362 4406 if (_currentCharacter->sceneId == 0x1C) 4363 4407 return; 4364 4408 … … 4376 4420 } 4377 4421 } 4378 4422 4423 void KyraEngine::timerFadeText(int timerNum) { 4424 debug(9, "timerFadeText(%i)", timerNum); 4425 _fadeText = true; 4426 } 4427 4428 void KyraEngine::setTextFadeTimerCountdown(int16 countdown) { 4429 debug(9, "setTextFadeTimerCountdown(%i)", countdown); 4430 //if (countdown == -1) 4431 //countdown = 32000; 4432 4433 setTimerCountdown(31, countdown*60); 4434 } 4435 4379 4436 void KyraEngine::timerSetFlags2(int timerNum) { 4437 debug(9, "timerSetFlags2(%i)", timerNum); 4380 4438 if (!((uint32*)(_flagsTable+0x2D))[timerNum]) 4381 4439 ((uint32*)(_flagsTable+0x2D))[timerNum] = 1; 4382 4440 } 4383 4441 4384 4442 void KyraEngine::timerCheckAnimFlag1(int timerNum) { 4385 debug(9, " KyraEngine::timerCheckAnimFlag1(%i)", timerNum);4443 debug(9, "timerCheckAnimFlag1(%i)", timerNum); 4386 4444 if (_brandonStatusBit & 0x20) { 4387 check SpecialAnimFlags();4445 checkAmuletAnimFlags(); 4388 4446 setTimerCountdown(18, -1); 4389 4447 } 4390 4448 } 4391 4449 4392 4450 void KyraEngine::timerCheckAnimFlag2(int timerNum) { 4393 debug(9, " KyraEngine::timerCheckAnimFlag1(%i)", timerNum);4451 debug(9, "timerCheckAnimFlag1(%i)", timerNum); 4394 4452 if (_brandonStatusBit & 0x2) { 4395 check SpecialAnimFlags();4453 checkAmuletAnimFlags(); 4396 4454 setTimerCountdown(14, -1); 4397 4455 } 4398 4456 } 4399 4457 4400 void KyraEngine::check SpecialAnimFlags() {4401 debug(9, " KyraEngine::checkSpecialAnimFlags()");4458 void KyraEngine::checkAmuletAnimFlags() { 4459 debug(9, "checkSpecialAnimFlags()"); 4402 4460 if (_brandonStatusBit & 2) { 4403 4461 warning("STUB: playSpecialAnim1"); 4404 4462 // XXX … … 4413 4471 } 4414 4472 4415 4473 void KyraEngine::timerRedrawAmulet(int timerNum) { 4474 debug(9, "timerRedrawAmulet(%i)", timerNum); 4416 4475 if (queryGameFlag(241)) { 4417 4476 drawAmulet(); 4418 setTimerCountdown( 0x13, -1);4477 setTimerCountdown(19, -1); 4419 4478 } 4420 4479 } 4421 4480 4422 4481 void KyraEngine::drawAmulet() { 4482 debug(9, "drawAmulet()"); 4423 4483 static const int16 amuletTable1[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x150, 0x155, 0x15A, 0x15F, 0x164, 0x145, -1}; 4424 4484 static const int16 amuletTable3[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x14F, 0x154, 0x159, 0x15E, 0x163, 0x144, -1}; 4425 4485 static const int16 amuletTable2[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x152, 0x157, 0x15C, 0x161, 0x166, 0x147, -1}; -
kyra/kyra.h
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/kyra.h scummvm/kyra/kyra.h
old new 142 142 struct ScriptState; 143 143 struct ScriptData; 144 144 class ScriptHelper; 145 class Debugger; 145 146 class KyraEngine; 146 147 147 148 struct Timer { 148 149 bool active; 149 int 16countdown;150 int32 countdown; 150 151 uint32 nextRun; 151 152 void (KyraEngine::*func)(int timerNum); 152 153 }; 153 154 154 155 class KyraEngine : public Engine { 155 156 friend class MusicPlayer; 157 friend class Debugger; 156 158 public: 157 159 158 160 enum { … … 202 204 void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage); 203 205 void restoreTalkTextMessageBkgd(int srcPage, int dstPage); 204 206 void drawSentenceCommand(char *sentence, int unk1); 207 void updateSentenceCommand(char *str1, char *str2, int unk1); 208 void updateTextFade(); 205 209 206 210 void updateGameTimers(); 207 211 void clearNextEventTickCount(); 208 void setTimerCountdown(uint8 timer, int 16countdown);212 void setTimerCountdown(uint8 timer, int32 countdown); 209 213 int16 getTimerDelay(uint8 timer); 210 214 void enableTimer(uint8 timer); 211 215 void disableTimer(uint8 timer); … … 532 536 void timerSetFlags2(int timerNum); 533 537 void timerCheckAnimFlag1(int timerNum); 534 538 void timerCheckAnimFlag2(int timerNum); 535 void check SpecialAnimFlags();539 void checkAmuletAnimFlags(); 536 540 void timerRedrawAmulet(int timerNum); 541 void timerFadeText(int timerNum); 537 542 void drawAmulet(); 538 543 void setTextFadeTimerCountdown(int16 countdown); 539 544 uint8 _game; 540 545 bool _fastMode; 541 546 bool _quitFlag; … … 605 610 int _lastFindWayRet; 606 611 int *_movFacingTable; 607 612 608 int8 _ charSayUnk1;613 int8 _talkingCharNum; 609 614 int8 _charSayUnk2; 610 615 int8 _charSayUnk3; 611 int8 _charSayUnk4; 616 int8 _currHeadShape; 617 uint8 _currSentenceColor[3]; 618 int8 _startSentencePalIndex; 619 bool _fadeText; 612 620 613 621 uint8 _configTalkspeed; 614 622 AnimObject *_objectQueue; … … 626 634 SeqPlayer *_seq; 627 635 Sprites *_sprites; 628 636 ScriptHelper *_scriptInterpreter; 637 Debugger *_debugger; 629 638 630 639 ScriptState *_scriptMain; 631 640 ScriptData *_npcScriptData; -
kyra/module.mk
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/module.mk scummvm/kyra/module.mk
old new 10 10 kyra/sound.o \ 11 11 kyra/staticres.o \ 12 12 kyra/sprites.o \ 13 kyra/wsamovie.o 13 kyra/wsamovie.o \ 14 kyra/debugger.o 14 15 15 16 MODULE_DIRS += \ 16 17 kyra -
kyra/script_v1.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/script_v1.cpp scummvm/kyra/script_v1.cpp
old new 573 573 574 574 int KyraEngine::cmd_pauseSeconds(ScriptState *script) { 575 575 debug(3, "cmd_pauseSeconds(0x%X) (%d)", script, stackPos(0)); 576 delay(stackPos(0)*1000); 576 if (stackPos(0) > 0) 577 delay(stackPos(0)*1000); 577 578 return 0; 578 579 } 579 580 … … 600 601 601 602 int KyraEngine::cmd_forceBrandonToNormal(ScriptState *script) { 602 603 debug(3, "cmd_forceBrandonToNormal(0x%X) ()", script); 603 setTimer19();604 checkAmuletAnimFlags(); 604 605 return 0; 605 606 } 606 607 … … 681 682 _screen->hideMouse(); 682 683 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); 683 684 // XXX 684 waitTicks(waitTime); 685 _sprites->updateSceneAnims(); 686 updateAllObjectShapes(); 685 delay(waitTime * _tickLength); 687 686 _screen->updateScreen(); 688 687 _screen->showMouse(); 689 688 return 0; … … 879 878 _screen->hideMouse(); 880 879 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 2); 881 880 // XXX 882 waitTicks(waitTime); 881 //waitTicks(waitTime); 882 delay(waitTime*_tickLength); 883 883 _sprites->updateSceneAnims(); 884 884 updateAllObjectShapes(); 885 885 _screen->showMouse(); … … 1128 1128 updateMousePointer(); 1129 1129 updateGameTimers(); 1130 1130 updateAllObjectShapes(); 1131 // XXX processPalette();1131 updateTextFade(); 1132 1132 if ((nextFrame - _system->getMillis()) >= 10) 1133 1133 delay(10); 1134 1134 }