Ticket #8495: kyra-debugandtextfade_v3.patch
File kyra-debugandtextfade_v3.patch, 28.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 uint direction = 0; 56 if (argc > 1) { 57 uint room = atoi(argv[1]); 58 59 if (argc > 2) 60 direction = atoi(argv[2]); 61 else { 62 if (_vm->_roomTable[room].northExit != 0xff) 63 direction = 3; 64 else if (_vm->_roomTable[room].eastExit != 0xff) 65 direction = 4; 66 else if (_vm->_roomTable[room].southExit != 0xff) 67 direction = 1; 68 else if (_vm->_roomTable[room].westExit != 0xff) 69 direction = 2; 70 } 71 72 // Dirty way of hiding the debug console while the room entry scripts are running, 73 // otherwise the graphics didn't update. 74 _vm->_system->hideOverlay(); 75 _vm->_currentCharacter->facing = direction; 76 77 _vm->enterNewScene(room, _vm->_currentCharacter->facing, 0, 0, 1); 78 _vm->_system->showOverlay(); 79 _detach_now = true; 80 return false; 81 } 82 83 DebugPrintf("Syntax: room <roomnum> <direction>\n"); 84 return true; 85 } 86 87 bool Debugger::cmd_exit(int argc, const char **argv) { 88 _detach_now = true; 89 return false; 90 } 91 92 bool Debugger::cmd_help(int argc, const char **argv) { 93 // console normally has 39 line width 94 // wrap around nicely 95 int width = 0, size, i; 96 97 DebugPrintf("Commands are:\n"); 98 for (i = 0 ; i < _dcmd_count ; i++) { 99 size = strlen(_dcmds[i].name) + 1; 100 101 if ((width + size) >= 39) { 102 DebugPrintf("\n"); 103 width = size; 104 } else 105 width += size; 106 107 DebugPrintf("%s ", _dcmds[i].name); 108 } 109 DebugPrintf("\n"); 110 return true; 111 } 112 113 bool Debugger::cmd_listRooms(int argc, const char **argv) { 114 for (int i = 0; i < _vm->_roomTableSize; i++) { 115 DebugPrintf("%-3i: %-10s", i, _vm->_roomFilenameTable[_vm->_roomTable[i].nameIndex]); 116 if (!(i % 8)) 117 DebugPrintf("\n"); 118 } 119 DebugPrintf("\n"); 120 DebugPrintf("Current room: %i\n", _vm->_currentRoom); 121 return true; 122 } 123 124 bool Debugger::cmd_listFlags(int argc, const char **argv) { 125 for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) { 126 DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i)); 127 if (!(i % 10)) 128 DebugPrintf("\n"); 129 } 130 DebugPrintf("\n"); 131 return true; 132 } 133 134 bool Debugger::cmd_toggleFlag(int argc, const char **argv) { 135 if (argc > 1) { 136 uint flag = atoi(argv[1]); 137 if (_vm->queryGameFlag(flag)) 138 _vm->resetGameFlag(flag); 139 else 140 _vm->setGameFlag(flag); 141 DebugPrintf("Flag %i is now %i\n", flag, _vm->queryGameFlag(flag)); 142 } else 143 DebugPrintf("Syntax: toggleflag <flag>\n"); 144 145 return true; 146 } 147 148 bool Debugger::cmd_queryFlag(int argc, const char **argv) { 149 if (argc > 1) { 150 uint flag = atoi(argv[1]); 151 DebugPrintf("Flag %i is %i\n", flag, _vm->queryGameFlag(flag)); 152 } else 153 DebugPrintf("Syntax: queryflag <flag>\n"); 154 155 return true; 156 } 157 158 bool Debugger::cmd_listTimers(int argc, const char **argv) { 159 for (int i = 0; i < ARRAYSIZE(_vm->_timers); i++) 160 DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i\n", i, _vm->_timers[i].active ? "Yes" : "No", _vm->_timers[i].countdown); 161 162 return true; 163 } 164 165 bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) { 166 if (argc > 2) { 167 uint timer = atoi(argv[1]); 168 uint countdown = atoi(argv[2]); 169 _vm->setTimerCountdown(timer, countdown); 170 DebugPrintf("Timer %i now has countdown %i\n", timer, _vm->_timers[timer].countdown); 171 } else 172 DebugPrintf("Syntax: settimercountdown <timer> <countdown>\n"); 173 174 return true; 175 } 176 177 } // End of namespace Kyra 178 -
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 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' && !_debugger->isAttached()) { 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"); … … 1241 1252 if (!brandonAlive) { 1242 1253 // XXX 1243 1254 } 1244 1255 1245 1256 startSceneScript(brandonAlive); 1246 1257 setupSceneItems(); 1258 1247 1259 initSceneData(facing, unk2, brandonAlive); 1248 1260 1249 1261 _loopFlag2 = 0; … … 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 } … … 1953 1966 while (_scriptInterpreter->validScript(_scriptClick)) 1954 1967 _scriptInterpreter->runScript(_scriptClick); 1955 1968 1969 setTextFadeTimerCountdown(-1); 1956 1970 if (_currentCharacter->sceneId == 0xD2) { 1957 1971 // XXX 1958 1972 } … … 2185 2199 if (_system->getMillis() > timeToEnd && !hasUpdatedNPCs) { 2186 2200 hasUpdatedNPCs = true; 2187 2201 disableTimer(15); 2188 _c harSayUnk4= 4;2202 _currHeadShape = 4; 2189 2203 animRefreshNPC(0); 2190 animRefreshNPC(_ charSayUnk1);2204 animRefreshNPC(_talkingCharNum); 2191 2205 2192 2206 if (_charSayUnk2 != -1) { 2193 2207 _sprites->_animObjects[_charSayUnk2].active = 0; … … 2208 2222 _screen->_curPage = currPage; 2209 2223 2210 2224 copyChangedObjectsForward(0); 2211 //processPalette();2225 updateTextFade(); 2212 2226 2213 2227 if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1) 2214 2228 break; … … 2249 2263 } 2250 2264 2251 2265 if (convoInitialized != 0) { 2252 _ charSayUnk1= -1;2266 _talkingCharNum = -1; 2253 2267 _currentCharacter->currentAnimFrame = 7; 2254 2268 animRefreshNPC(0); 2255 2269 updateAllObjectShapes(); … … 2257 2271 } 2258 2272 2259 2273 void KyraEngine::restoreChatPartnerAnimFrame(int8 charNum) { 2260 _ charSayUnk1= -1;2274 _talkingCharNum = -1; 2261 2275 2262 2276 if (charNum > 0 && charNum < 5) { 2263 2277 _characterList[charNum].currentAnimFrame = _currentChatPartnerBackupFrame; … … 2270 2284 } 2271 2285 2272 2286 void KyraEngine::backupChatPartnerAnimFrame(int8 charNum) { 2273 _ charSayUnk1= 0;2287 _talkingCharNum = 0; 2274 2288 2275 2289 if (charNum < 5 && charNum > 0) 2276 2290 _currentChatPartnerBackupFrame = _characterList[charNum].currentAnimFrame; … … 2307 2321 } 2308 2322 2309 2323 int KyraEngine::initCharacterChat(int8 charNum) { 2310 if (_ charSayUnk1== -1) {2311 _ charSayUnk1= 0;2324 if (_talkingCharNum == -1) { 2325 _talkingCharNum = 0; 2312 2326 2313 2327 if (_scaleMode != 0) 2314 2328 _currentCharacter->currentAnimFrame = 7; … … 2375 2389 if (charNum < 5) { 2376 2390 _characterList[charNum].currentAnimFrame = startAnimFrames[charNum]; 2377 2391 _charSayUnk3 = charNum; 2378 _ charSayUnk1= charNum;2392 _talkingCharNum = charNum; 2379 2393 animRefreshNPC(charNum); 2380 2394 } 2381 2395 … … 2428 2442 endCharacterChat(charNum, convoInitialized); 2429 2443 } 2430 2444 2431 void KyraEngine::drawSentenceCommand(char *sentence, int unk1) { 2445 void KyraEngine::drawSentenceCommand(char *sentence, int color) { 2446 debug(9, "drawSentenceCommand('%s', %i)", sentence, color); 2432 2447 _screen->hideMouse(); 2433 2448 _screen->fillRect(8, 143, 311, 152, 12); 2434 // XXX: palette stuff 2449 2450 if (_startSentencePalIndex != color || _fadeText != false) { 2451 _currSentenceColor[0] = _screen->_currentPalette[765] = _screen->_currentPalette[color*3]; 2452 _currSentenceColor[1] = _screen->_currentPalette[766] = _screen->_currentPalette[color*3+1]; 2453 _currSentenceColor[2] = _screen->_currentPalette[767] = _screen->_currentPalette[color*3+2]; 2454 2455 _screen->setScreenPalette(_screen->_currentPalette); 2456 _startSentencePalIndex = 0; 2457 } 2435 2458 2436 2459 printText(sentence, 8, 143, 0xFF, 12, 0); 2437 2460 _screen->showMouse(); 2438 //setTextFadeTimerCountdown(_textFadeTimerCountdown); 2439 //_palScrollEnabled = 0; 2461 setTextFadeTimerCountdown(15); 2462 _fadeText = false; 2463 } 2464 2465 void KyraEngine::updateSentenceCommand(char *str1, char *str2, int color) { 2466 debug(9, "updateSentenceCommand('%s', '%s', %i)", str1, str2, color); 2467 char sentenceCommand[500]; 2468 strncpy(sentenceCommand, str1, 500); 2469 if (str2) 2470 strncat(sentenceCommand, str2, 500 - strlen(sentenceCommand)); 2471 2472 drawSentenceCommand(sentenceCommand, color); 2473 } 2474 2475 void KyraEngine::updateTextFade() { 2476 debug(9, "updateTextFade()"); 2477 if (!_fadeText) 2478 return; 2479 2480 bool finished = false; 2481 for (int i = 0; i < 3; i++) 2482 if (_currSentenceColor[i] > 4) 2483 _currSentenceColor[i] -= 4; 2484 else 2485 if (_currSentenceColor[i]) { 2486 _currSentenceColor[i] = 0; 2487 finished = true; 2488 } 2489 2490 _screen->_currentPalette[765] = _currSentenceColor[0]; 2491 _screen->_currentPalette[766] = _currSentenceColor[1]; 2492 _screen->_currentPalette[767] = _currSentenceColor[2]; 2493 _screen->setScreenPalette(_screen->_currentPalette); 2494 2495 if (finished) { 2496 _fadeText = false; 2497 _startSentencePalIndex = -1; 2498 } 2499 2440 2500 } 2441 2501 2502 2442 2503 #pragma mark - 2443 2504 #pragma mark - Item handling 2444 2505 #pragma mark - … … 3131 3192 } 3132 3193 3133 3194 // talking head functionallity 3134 if (_ charSayUnk1!= -1) {3195 if (_talkingCharNum != -1) { 3135 3196 const int16 baseAnimFrameTable1[] = { 0x11, 0x35, 0x59, 0x00, 0x00, 0x00 }; 3136 3197 const int16 baseAnimFrameTable2[] = { 0x15, 0x39, 0x5D, 0x00, 0x00, 0x00 }; 3137 3198 const int8 xOffsetTable1[] = { 2, 4, 0, 5, 2, 0, 0, 0 }; … … 3141 3202 if (curObject->index == 0 || curObject->index <= 4) { 3142 3203 int shapesIndex = 0; 3143 3204 if (curObject->index == _charSayUnk3) { 3144 shapesIndex = _c harSayUnk4+ baseAnimFrameTable1[curObject->index];3205 shapesIndex = _currHeadShape + baseAnimFrameTable1[curObject->index]; 3145 3206 } else { 3146 3207 shapesIndex = baseAnimFrameTable2[curObject->index]; 3147 3208 int temp2 = 0; … … 4076 4137 updateMousePointer(); 4077 4138 updateGameTimers(); 4078 4139 updateAllObjectShapes(); 4079 // XXX processPalette4140 updateTextFade(); 4080 4141 if (_currentCharacter->sceneId == 210) { 4081 4142 // XXX updateKyragemFading 4082 4143 // XXX playEnd … … 4217 4278 #pragma mark - 4218 4279 4219 4280 void KyraEngine::setupTimers() { 4220 debug(9, " KyraEngine::setupTimers()");4281 debug(9, "setupTimers()"); 4221 4282 memset(_timers, 0, sizeof(_timers)); 4222 4283 4223 4284 for (int i = 0; i < 34; i++) … … 4226 4287 _timers[0].func = _timers[1].func = _timers[2].func = _timers[3].func = _timers[4].func = 0; //Unused. 4227 4288 _timers[5].func = _timers[6].func = _timers[7].func = _timers[8].func = _timers[9].func = 0; //_nullsub51; 4228 4289 _timers[10].func = _timers[11].func = _timers[12].func = _timers[13].func = 0; //_nullsub50; 4229 _timers[14].func = &KyraEngine::timerCheckAnimFlag2; ;//_nullsub52;4290 _timers[14].func = &KyraEngine::timerCheckAnimFlag2; //_nullsub52; 4230 4291 _timers[15].func = &KyraEngine::timerUpdateHeadAnims; //_nullsub48; 4231 4292 _timers[16].func = &KyraEngine::timerSetFlags1; //_nullsub47; 4232 4293 _timers[17].func = 0; //sub_15120; … … 4243 4304 _timers[28].func = 0; //offset _timerDummy6 4244 4305 _timers[29].func = 0; //offset _timerDummy7, 4245 4306 _timers[30].func = 0; //offset _timerDummy8, 4246 _timers[31].func = 0; //sub_151F8;4307 _timers[31].func = &KyraEngine::timerFadeText; //sub_151F8; 4247 4308 _timers[32].func = 0; //_nullsub61; 4248 4309 _timers[33].func = 0; //_nullsub62; 4249 4310 … … 4270 4331 _timers[33].countdown = 3; 4271 4332 } 4272 4333 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 4334 void KyraEngine::updateGameTimers() { 4285 debug(9, "KyraEngine::updateGameTimers()"); 4286 void (Kyra::KyraEngine::*callback)(int timerNum); 4335 debug(9, "updateGameTimers()"); 4287 4336 4288 4337 if (_system->getMillis() < _timerNextRun) 4289 4338 return; … … 4293 4342 for (int i = 0; i < 34; i++) { 4294 4343 if (_timers[i].active && _timers[i].countdown > -1) { 4295 4344 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); 4345 if (i > 4 && _timers[i].func) 4346 (*this.*_timers[i].func)(i); 4303 4347 4304 4348 _timers[i].nextRun = _system->getMillis() + _timers[i].countdown * _tickLength; 4305 4349 … … 4311 4355 } 4312 4356 4313 4357 void KyraEngine::clearNextEventTickCount() { 4314 debug(9, " KyraEngine::clearNextEventTickCount()");4358 debug(9, "clearNextEventTickCount()"); 4315 4359 _timerNextRun = 0; 4316 4360 } 4317 4361 4318 4362 int16 KyraEngine::getTimerDelay(uint8 timer) { 4363 debug(9, "getTimerDelay(%i)", timer); 4319 4364 return _timers[timer].countdown; 4320 4365 } 4321 4366 4322 void KyraEngine::setTimerCountdown(uint8 timer, int 16countdown) {4323 debug(9, " KyraEngine::setTimerCountdown(%i, %i)", timer, countdown);4367 void KyraEngine::setTimerCountdown(uint8 timer, int32 countdown) { 4368 debug(9, "setTimerCountdown(%i, %i)", timer, countdown); 4324 4369 _timers[timer].countdown = countdown; 4325 4370 4326 4371 uint32 nextRun = _system->getMillis() + countdown; … … 4329 4374 } 4330 4375 4331 4376 void KyraEngine::enableTimer(uint8 timer) { 4332 debug(9, " KyraEngine::enableTimer(%i)", timer);4377 debug(9, "enableTimer(%i)", timer); 4333 4378 _timers[timer].active = 1; 4334 4379 } 4335 4380 4336 4381 void KyraEngine::disableTimer(uint8 timer) { 4337 debug(9, " KyraEngine::disableTimer(%i)", timer);4382 debug(9, "disableTimer(%i)", timer); 4338 4383 _timers[timer].active = 0; 4339 4384 } 4340 4385 4341 4386 void KyraEngine::timerUpdateHeadAnims(int timerNum) { 4342 debug(9, " KyraEngine::timerUpdateHeadAnims(%i)", timerNum);4387 debug(9, "timerUpdateHeadAnims(%i)", timerNum); 4343 4388 static int8 currentFrame = 0; 4344 4389 static const int8 frameTable[] = {4, 5, 4, 5, 4, 5, 0, 1, 4, 5, 4345 4390 4, 4, 6, 4, 8, 1, 9, 4, -1}; 4346 4391 4347 if (_ charSayUnk1< 0)4392 if (_talkingCharNum < 0) 4348 4393 return; 4349 4394 4350 _c harSayUnk4= frameTable[currentFrame];4395 _currHeadShape = frameTable[currentFrame]; 4351 4396 currentFrame++; 4352 4397 4353 4398 if (frameTable[currentFrame] == -1) 4354 4399 currentFrame = 0; 4355 4400 4356 4401 animRefreshNPC(0); 4357 animRefreshNPC(_ charSayUnk1);4402 animRefreshNPC(_talkingCharNum); 4358 4403 } 4359 4404 4360 4405 void KyraEngine::timerSetFlags1(int timerNum) { 4361 debug(9, " KyraEngine::timerSetFlags(%i)", timerNum);4406 debug(9, "timerSetFlags(%i)", timerNum); 4362 4407 if (_currentCharacter->sceneId == 0x1C) 4363 4408 return; 4364 4409 … … 4376 4421 } 4377 4422 } 4378 4423 4424 void KyraEngine::timerFadeText(int timerNum) { 4425 debug(9, "timerFadeText(%i)", timerNum); 4426 _fadeText = true; 4427 } 4428 4429 void KyraEngine::setTextFadeTimerCountdown(int16 countdown) { 4430 debug(9, "setTextFadeTimerCountdown(%i)", countdown); 4431 //if (countdown == -1) 4432 //countdown = 32000; 4433 4434 setTimerCountdown(31, countdown*60); 4435 } 4436 4379 4437 void KyraEngine::timerSetFlags2(int timerNum) { 4438 debug(9, "timerSetFlags2(%i)", timerNum); 4380 4439 if (!((uint32*)(_flagsTable+0x2D))[timerNum]) 4381 4440 ((uint32*)(_flagsTable+0x2D))[timerNum] = 1; 4382 4441 } 4383 4442 4384 4443 void KyraEngine::timerCheckAnimFlag1(int timerNum) { 4385 debug(9, " KyraEngine::timerCheckAnimFlag1(%i)", timerNum);4444 debug(9, "timerCheckAnimFlag1(%i)", timerNum); 4386 4445 if (_brandonStatusBit & 0x20) { 4387 check SpecialAnimFlags();4446 checkAmuletAnimFlags(); 4388 4447 setTimerCountdown(18, -1); 4389 4448 } 4390 4449 } 4391 4450 4392 4451 void KyraEngine::timerCheckAnimFlag2(int timerNum) { 4393 debug(9, " KyraEngine::timerCheckAnimFlag1(%i)", timerNum);4452 debug(9, "timerCheckAnimFlag1(%i)", timerNum); 4394 4453 if (_brandonStatusBit & 0x2) { 4395 check SpecialAnimFlags();4454 checkAmuletAnimFlags(); 4396 4455 setTimerCountdown(14, -1); 4397 4456 } 4398 4457 } 4399 4458 4400 void KyraEngine::check SpecialAnimFlags() {4401 debug(9, " KyraEngine::checkSpecialAnimFlags()");4459 void KyraEngine::checkAmuletAnimFlags() { 4460 debug(9, "checkSpecialAnimFlags()"); 4402 4461 if (_brandonStatusBit & 2) { 4403 4462 warning("STUB: playSpecialAnim1"); 4404 4463 // XXX … … 4413 4472 } 4414 4473 4415 4474 void KyraEngine::timerRedrawAmulet(int timerNum) { 4475 debug(9, "timerRedrawAmulet(%i)", timerNum); 4416 4476 if (queryGameFlag(241)) { 4417 4477 drawAmulet(); 4418 setTimerCountdown( 0x13, -1);4478 setTimerCountdown(19, -1); 4419 4479 } 4420 4480 } 4421 4481 4422 4482 void KyraEngine::drawAmulet() { 4483 debug(9, "drawAmulet()"); 4423 4484 static const int16 amuletTable1[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x150, 0x155, 0x15A, 0x15F, 0x164, 0x145, -1}; 4424 4485 static const int16 amuletTable3[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x14F, 0x154, 0x159, 0x15E, 0x163, 0x144, -1}; 4425 4486 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); … … 336 340 int cmd_shakeScreen(ScriptState *script); 337 341 int cmd_createAmuletJewel(ScriptState *script); 338 342 int cmd_setSceneAnimCurrXY(ScriptState *script); 339 int cmd_ Poison_Brandon_And_Remaps(ScriptState *script);343 int cmd_poisonBrandonAndRemaps(ScriptState *script); 340 344 int cmd_fillFlaskWithWater(ScriptState *script); 341 345 int cmd_getCharactersMovementDelay(ScriptState *script); 342 346 int cmd_getBirthstoneGem(ScriptState *script); … … 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
Binary files ./scummvmcvs/kyra/libkyra.a and scummvm/kyra/libkyra.a differ 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 … … 657 658 if (wsaFrame >= wsa_getNumFrames(_wsaObjects[wsaIndex])) 658 659 running = false; 659 660 660 // XXX 661 waitTicks(waitTime); 661 delay(waitTime * _tickLength); 662 662 if (worldUpdate) { 663 663 _sprites->updateSceneAnims(); 664 664 updateAllObjectShapes(); … … 680 680 int wsaIndex = stackPos(4); 681 681 _screen->hideMouse(); 682 682 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); 683 // XXX 684 waitTicks(waitTime); 685 _sprites->updateSceneAnims(); 686 updateAllObjectShapes(); 683 delay(waitTime * _tickLength); 687 684 _screen->updateScreen(); 688 685 _screen->showMouse(); 689 686 return 0; … … 878 875 879 876 _screen->hideMouse(); 880 877 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 2); 881 // XXX 882 waitTicks(waitTime); 878 delay(waitTime*_tickLength); 883 879 _sprites->updateSceneAnims(); 884 880 updateAllObjectShapes(); 885 881 _screen->showMouse(); … … 906 902 int frame = startFrame; 907 903 while (endFrame >= frame) { 908 904 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); 909 // XXX 910 waitTicks(waitTime); 911 _sprites->updateSceneAnims(); 912 updateAllObjectShapes(); 905 delay(waitTime * _tickLength); 906 _screen->updateScreen(); 913 907 ++frame; 914 908 } 915 909 } else { 916 910 int frame = endFrame; 917 911 while (startFrame <= frame) { 918 912 wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); 919 // XXX 920 waitTicks(waitTime); 921 _sprites->updateSceneAnims(); 922 updateAllObjectShapes(); 913 delay(waitTime * _tickLength); 914 _screen->updateScreen(); 923 915 --frame; 924 916 } 925 917 } … … 1128 1120 updateMousePointer(); 1129 1121 updateGameTimers(); 1130 1122 updateAllObjectShapes(); 1131 // XXX processPalette();1123 updateTextFade(); 1132 1124 if ((nextFrame - _system->getMillis()) >= 10) 1133 1125 delay(10); 1134 1126 } … … 1157 1149 } 1158 1150 1159 1151 int KyraEngine::cmd_preserveAllObjectBackgrounds(ScriptState *script) { 1160 warning("STUB: cmd_preserveAllObjectBackgrounds"); 1152 debug(3, "cmd_preserveAllObjectBackgrounds(0x%X) ()", script); 1153 preserveAllBackgrounds(); 1161 1154 return 0; 1162 1155 } 1163 1156 … … 1283 1276 return 0; 1284 1277 } 1285 1278 1286 int KyraEngine::cmd_ Poison_Brandon_And_Remaps(ScriptState *script) {1287 warning("STUB: cmd _Poison_Brandon_And_Remaps");1279 int KyraEngine::cmd_poisonBrandonAndRemaps(ScriptState *script) { 1280 warning("STUB: cmdPoisonBrandonAndRemaps"); 1288 1281 return 0; 1289 1282 } 1290 1283 … … 1497 1490 } 1498 1491 1499 1492 int KyraEngine::cmd_protectCommandLine(ScriptState *script) { 1500 warning("STUB: cmd_protectCommandLine");1501 return 0;1493 debug(3, "cmd_protectCommandLine(0x%X) (%d)", script, stackPos(0)); 1494 return stackPos(0); 1502 1495 } 1503 1496 1504 1497 int KyraEngine::cmd_pauseMusicSeconds(ScriptState *script) { -
kyra/sprites.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/sprites.cpp scummvm/kyra/sprites.cpp
old new 344 344 data += 2; 345 345 debug(5, "func: Play sound"); 346 346 debug(5, "Sound index %i", READ_LE_UINT16(data)); 347 _engine->snd_playSoundEffect(READ_LE_UINT16(data));347 //_engine->snd_playSoundEffect(READ_LE_UINT16(data)); 348 348 data += 2; 349 349 break; 350 350 case 0xFFB1: … … 363 363 data += 2; 364 364 debug(5, "Percentage %i", READ_LE_UINT16(data)); 365 365 rndNr = _rnd.getRandomNumber(100); 366 if (rndNr <= READ_LE_UINT16(data))367 _engine->snd_playSoundEffect(sound);366 //if (rndNr <= READ_LE_UINT16(data)) 367 //_engine->snd_playSoundEffect(sound); 368 368 data += 2; 369 369 break; 370 370 case 0xFFA7: -
kyra/staticres.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/staticres.cpp scummvm/kyra/staticres.cpp
old new 497 497 // 0x6c 498 498 Opcode(cmd_createAmuletJewel), 499 499 Opcode(cmd_setSceneAnimCurrXY), 500 Opcode(cmd_ Poison_Brandon_And_Remaps),500 Opcode(cmd_poisonBrandonAndRemaps), 501 501 Opcode(cmd_fillFlaskWithWater), 502 502 // 0x70 503 503 Opcode(cmd_getCharactersMovementDelay),