Ticket #8484: kyra_chat_plus_plus.patch
File kyra_chat_plus_plus.patch, 36.9 KB (added by , 19 years ago) |
---|
-
kyra/kyra.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/kyra.cpp scummvm/kyra/kyra.cpp
old new 283 283 _animStates = new AnimObject[31]; 284 284 assert(_animStates); 285 285 _charactersAnimState = &_animStates[0]; 286 _ animObjects = &_animStates[5];286 _sprites->_animObjects = &_animStates[5]; 287 287 _animItems = &_animStates[16]; 288 288 289 289 _scriptInterpreter = new ScriptHelper(this); … … 313 313 _talkMessageY = 0xC; 314 314 _talkMessageH = 0; 315 315 _talkMessagePrinted = false; 316 316 _charSayUnk1 = -1; 317 _charSayUnk3 = -1; 317 318 _mouseX = _mouseY = -1; 318 319 _needMouseUpdate = true; 319 320 … … 324 325 memset(_exitList, 0xFFFF, sizeof(_exitList)); 325 326 _exitListPtr = 0; 326 327 _pathfinderFlag = 0; 327 328 _lastFindWayRet = 0; 328 329 _movFacingTable = new int[150]; 329 330 assert(_movFacingTable); 330 331 _movFacingTable[0] = 8; 331 332 333 _configTalkspeed = 1; 334 332 335 return 0; 333 336 } 334 337 … … 441 444 // XXX 442 445 initAnimStateList(); 443 446 setCharactersInDefaultScene(); 447 448 _gameSpeed = 50; 449 memset(_flagsTable, 0, sizeof(_flagsTable)); 444 450 445 451 if (!_scriptInterpreter->loadScript("_STARTUP.EMC", _npcScriptData, _opcodeTable, _opcodeTableSize, 0)) { 446 452 error("Could not load \"_STARTUP.EMC\" script"); … … 461 467 snd_playTheme(1); 462 468 enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1); 463 469 464 _gameSpeed = 50;465 memset(_flagsTable, 0, sizeof(_flagsTable));466 470 } 467 471 468 472 void KyraEngine::delay(uint32 amount) { … … 501 505 void KyraEngine::mainLoop() { 502 506 debug(9, "KyraEngine::mainLoop()"); 503 507 508 enterNewScene(0, _currentCharacter->facing, 0, 0, 1); 509 504 510 while (!_quitFlag) { 505 511 int32 frameTime = (int32)_system->getMillis(); 506 512 … … 509 515 _screen->showMouse(); 510 516 _needMouseUpdate = false; 511 517 } 512 _screen->updateScreen(); 513 518 _sprites->updateSceneAnims(); 519 prepDrawAllObjects(); 520 copyChangedObjectsForward(0); 514 521 delay((frameTime + _gameSpeed) - _system->getMillis()); 515 522 } 516 523 } … … 736 743 _screen->setFont(curFont); 737 744 } 738 745 746 void KyraEngine::waitForChatToFinish(int16 chatDuration, char *chatStr, uint8 charNum) { 747 debug(9, "KyraEngine::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum); 748 bool hasUpdatedNPCs = false; 749 bool runLoop = true; 750 uint8 currPage; 751 OSystem::Event event; 752 uint8 tickLength = (uint8)(1000.0 / _gameSpeed); 753 754 //while( towns_isEscKeyPressed() ) 755 //towns_getKey(); 756 757 uint32 timeToEnd = strlen(chatStr) * 8 * tickLength + _system->getMillis(); 758 759 if (chatDuration != -1 ) { 760 switch ( _configTalkspeed) { 761 case 0: chatDuration *= 2; 762 break; 763 case 2: chatDuration /= 4; 764 break; 765 case 3: chatDuration = -1; 766 } 767 } 768 769 if (chatDuration != -1) 770 chatDuration *= tickLength; 771 772 //disableTimer(0x13); 773 //disableTimer(0x0E); 774 //disableTimer(0x12); 775 //towns_flushKeyb(); 776 777 uint32 timeAtStart = _system->getMillis(); 778 uint32 loopStart; 779 while (runLoop) { 780 loopStart = _system->getMillis(); 781 /* 782 if (_currentCharacter.sceneId == 0xD2) 783 if (seq_playEnd()) 784 break; 785 */ 786 787 if( _system->getMillis() < timeToEnd && !hasUpdatedNPCs) { 788 hasUpdatedNPCs = true; 789 //disableTimer(0x0F); 790 _charSayUnk4 = 4; 791 animRefreshNPC(0); 792 animRefreshNPC(_charSayUnk1); 793 794 if (_charSayUnk2 != -1) { 795 _sprites->_animObjects[_charSayUnk2].active = 0; 796 _sprites->_anims[_charSayUnk2].play = false; 797 _charSayUnk2 = -1; 798 } 799 } 800 801 //updateGameTimers(); 802 _sprites->updateSceneAnims(); 803 restoreAllObjectBackgrounds(); 804 preserveAnyChangedBackgrounds(); 805 prepDrawAllObjects(); 806 807 currPage = _screen->_curPage; 808 _screen->_curPage = 2; 809 printCharacterText(chatStr, charNum); 810 _screen->_curPage = currPage; 811 812 copyChangedObjectsForward(0); 813 //processPalette(); 814 815 if ((chatDuration < (int16)(_system->getMillis() - timeAtStart)) && chatDuration != -1) 816 break; 817 818 while (_system->pollEvent(event)) { 819 switch (event.type) { 820 case OSystem::EVENT_KEYDOWN: 821 if (event.kbd.keycode == 0x20 || event.kbd.keycode == 0xC6) 822 runLoop = false; 823 break; 824 case OSystem::EVENT_QUIT: 825 case OSystem::EVENT_LBUTTONDOWN: 826 runLoop = false; 827 break; 828 default: 829 break; 830 } 831 } 832 delay((loopStart + _gameSpeed) - _system->getMillis()); 833 } 834 835 /*enableTimer(0x13); 836 enableTimer(0x0E); 837 enableTimer(0x12); 838 enableTimer(0x0F); 839 clearKyrandiaButtonIO();*/ 840 } 841 842 void KyraEngine::endCharacterChat(int8 charNum, int16 convoInitialized) { 843 _charSayUnk3 = -1; 844 845 if (charNum > 4 && charNum < 11) { 846 //TODO: weird _game_inventory stuff here 847 } 848 849 if (convoInitialized != 0) { 850 _charSayUnk1 = -1; 851 _currentCharacter->currentAnimFrame = 7; 852 animRefreshNPC(0); 853 updateAllObjectShapes(); 854 } 855 } 856 857 void KyraEngine::restoreChatPartnerAnimFrame(int8 charNum) { 858 _charSayUnk1 = -1; 859 860 if (charNum > 0 && charNum < 5) { 861 _characterList[charNum].currentAnimFrame = _currentChatPartnerBackupFrame; 862 animRefreshNPC(charNum); 863 } 864 865 _currentCharacter->currentAnimFrame = 7; 866 animRefreshNPC(0); 867 updateAllObjectShapes(); 868 } 869 870 void KyraEngine::backupChatPartnerAnimFrame(int8 charNum) { 871 _charSayUnk1 = 0; 872 873 if (charNum < 5 && charNum > 0) 874 _currentChatPartnerBackupFrame = _characterList[charNum].currentAnimFrame; 875 876 if (_scaleMode != 0) 877 _currentCharacter->currentAnimFrame = 7; 878 else 879 _currentCharacter->currentAnimFrame = _currentCharAnimFrame; 880 881 animRefreshNPC(0); 882 updateAllObjectShapes(); 883 } 884 885 int8 KyraEngine::getChatPartnerNum() { 886 uint8 sceneTable[] = {0x2, 0x5, 0x2D, 0x7, 0x1B, 0x8, 0x22, 0x9, 0x30, 0x0A}; 887 int pos = 0; 888 int partner = -1; 889 890 for (int i = 1; i < 6; i++) { 891 if (_currentCharacter->sceneId == sceneTable[pos]) { 892 partner = sceneTable[pos+1]; 893 break; 894 } 895 pos += 2; 896 } 897 898 for (int i = 1; i < 5; i++) { 899 if (_characterList[i].sceneId == _currentCharacter->sceneId) { 900 partner = i; 901 break; 902 } 903 } 904 return partner; 905 } 906 907 int KyraEngine::initCharacterChat(int8 charNum) { 908 if (_charSayUnk1 == -1) { 909 _charSayUnk1 = 0; 910 911 if (_scaleMode != 0) 912 _currentCharacter->currentAnimFrame = 7; 913 else 914 _currentCharacter->currentAnimFrame = 16; 915 916 animRefreshNPC(0); 917 updateAllObjectShapes(); 918 } 919 920 _charSayUnk2 = -1; 921 flagAllObjectsForBkgdChange(); 922 restoreAllObjectBackgrounds(); 923 924 if( charNum > 4 && charNum < 11 ) { 925 // TODO: Fill in weird _game_inventory stuff here 926 } 927 928 flagAllObjectsForRefresh(); 929 flagAllObjectsForBkgdChange(); 930 preserveAnyChangedBackgrounds(); 931 _charSayUnk3 = charNum; 932 933 return 1; 934 } 935 936 void KyraEngine::printCharacterText(char *text, int8 charNum) { 937 uint8 colorTable[] = {0x0F, 0x9, 0x0C9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a}; 938 int top, left, x1, x2, w, x; 939 char *msg; 940 941 uint8 color = colorTable[charNum]; 942 text = preprocessString(text); 943 int lineCount = buildMessageSubstrings(text); 944 w = getWidestLineWidth(lineCount); 945 x = _characterList[charNum].x1; 946 calcWidestLineBounds(x1, x2, w, x); 947 948 for (int i = 0; i < lineCount; ++i) { 949 top = i * 10 + _talkMessageY; 950 msg = &_talkSubstrings[i * TALK_SUBSTRING_LEN]; 951 left = getCenterStringX(msg, x1, x2); 952 printText(msg, left, top, color, 0xC, 0); 953 } 954 } 955 956 void KyraEngine::characterSays(char *chatStr, int8 charNum, int8 chatDuration) { 957 debug(9, "KyraEngine:::characterSays('%s', %i, %d)", chatStr, charNum, chatDuration); 958 uint8 startAnimFrames[] = { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 }; 959 960 uint16 chatTicks; 961 int16 convoInitialized; 962 int8 chatPartnerNum; 963 964 if (_currentCharacter->sceneId == 0xD2) 965 return; 966 967 convoInitialized = initCharacterChat(charNum); 968 chatPartnerNum = getChatPartnerNum(); 969 970 if(chatPartnerNum != -1 && chatPartnerNum < 5) 971 backupChatPartnerAnimFrame(chatPartnerNum); 972 973 if (charNum < 5) { 974 _characterList[charNum].currentAnimFrame = startAnimFrames[charNum]; 975 _charSayUnk3 = charNum; 976 _charSayUnk1 = charNum; 977 animRefreshNPC(charNum); 978 } 979 980 char *processedString = preprocessString(chatStr); 981 int lineNum = buildMessageSubstrings(processedString); 982 983 int16 YPos = _characterList[charNum].y1; 984 YPos -= _scaleTable[charNum] * _characterList[charNum].height; 985 YPos -= 8; 986 YPos -= lineNum * 10; 987 988 if (YPos < 11) 989 YPos = 11; 990 991 if (YPos > 100 ) 992 YPos = 100; 993 994 _talkMessageY = YPos; 995 _talkMessageH = lineNum * 10; 996 restoreAllObjectBackgrounds(); 997 998 _screen->copyRegion(1, _talkMessageY, 1, 136, 319, _talkMessageH, 2, 2); 999 _screen->hideMouse(); 1000 1001 printCharacterText(processedString, charNum); 1002 _screen->showMouse(); 1003 1004 if (chatDuration == -2) 1005 chatTicks = strlen(processedString) * 9; 1006 else 1007 chatTicks = chatDuration; 1008 1009 waitForChatToFinish(chatTicks, chatStr, charNum); 1010 1011 restoreAllObjectBackgrounds(); 1012 1013 _screen->copyRegion(1, 136, 1, _talkMessageY, 319, _talkMessageH, 2, 2); 1014 preserveAllBackgrounds(); 1015 prepDrawAllObjects(); 1016 _screen->hideMouse(); 1017 1018 _screen->copyRegion(1, _talkMessageY, 1, _talkMessageY, 319, _talkMessageH, 2, 0); 1019 _screen->showMouse(); 1020 flagAllObjectsForRefresh(); 1021 copyChangedObjectsForward(0); 1022 1023 if (chatPartnerNum != -1 && chatPartnerNum < 5) 1024 restoreChatPartnerAnimFrame(chatPartnerNum); 1025 1026 endCharacterChat(charNum, convoInitialized); 1027 } 1028 739 1029 void KyraEngine::waitTicks(int ticks) { 740 1030 debug(9, "KyraEngine::waitTicks(%d)", ticks); 741 1031 const uint32 end = _system->getMillis() + ticks * 1000 / 60; … … 1326 1616 char datFileNameBuffer[32]; 1327 1617 strcpy(datFileNameBuffer, _roomFilenameTable[tableId]); 1328 1618 strcat(datFileNameBuffer, ".DAT"); 1329 _sprites->loadDAT(datFileNameBuffer );1330 1619 _sprites->loadDAT(datFileNameBuffer, _sceneExits); 1620 _sprites->setupSceneAnims(); 1331 1621 loadSceneMSC(); 1332 1622 1333 1623 _walkBlockNorth = currentRoom->northExit; … … 1931 2221 } 1932 2222 1933 2223 for (int i = 0; i < 11; ++i) { 1934 curAnimState = &_animObjects[i]; 1935 curAnimState->active = 0; 1936 curAnimState->refreshFlag = 0; 1937 curAnimState->bkgdChangeFlag = 0; 1938 // XXX this needs the dat loader 2224 curAnimState = &_sprites->_animObjects[i]; 2225 2226 if (_sprites->_anims[i].play) { 2227 curAnimState->active = 1; 2228 curAnimState->refreshFlag = 1; 2229 curAnimState->bkgdChangeFlag = 1; 2230 } 2231 else { 2232 curAnimState->active = 0; 2233 curAnimState->refreshFlag = 0; 2234 curAnimState->bkgdChangeFlag = 0; 2235 } 2236 curAnimState->height = _sprites->_anims[i].height; 2237 curAnimState->height2 = _sprites->_anims[i].height2; 2238 curAnimState->width = _sprites->_anims[i].width + 1; 2239 curAnimState->width2 = _sprites->_anims[i].width2; 2240 curAnimState->drawY = _sprites->_anims[i].drawY; 2241 curAnimState->x1 = curAnimState->x2 = _sprites->_anims[i].x; 2242 curAnimState->y1 = curAnimState->y2 = _sprites->_anims[i].y; 2243 curAnimState->background = _sprites->_anims[i].background; 2244 curAnimState->sceneAnimPtr = _sprites->_sceneShapes[_sprites->_anims[i].sprite]; 2245 2246 if(_sprites->_anims[i].unk2) 2247 curAnimState->flags = 0x800; 2248 else 2249 curAnimState->flags = 0; 2250 2251 if (_sprites->_anims[i].flipX) 2252 curAnimState->flags |= 0x1; 2253 2254 _objectQueue = objectQueue(_objectQueue, curAnimState); 2255 1939 2256 } 1940 2257 1941 2258 for (int i = 0; i < 12; ++i) { … … 2117 2434 #pragma mark - Animation specific code 2118 2435 #pragma mark - 2119 2436 2437 void KyraEngine::preserveAllBackgrounds() { 2438 uint8 currPage = _screen->_curPage; 2439 _screen->_curPage = 2; 2440 2441 AnimObject *curObject = _objectQueue; 2442 while (curObject) { 2443 if (!curObject->active && curObject->flags) { 2444 preserveOrRestoreBackground(curObject, false); 2445 curObject->bkgdChangeFlag = 0; 2446 } 2447 curObject = curObject->nextAnimObject; 2448 } 2449 _screen->_curPage = currPage; 2450 } 2451 2452 void KyraEngine::flagAllObjectsForBkgdChange() { 2453 AnimObject *curObject = _objectQueue; 2454 while (curObject) { 2455 curObject->bkgdChangeFlag = 1; 2456 curObject = curObject->nextAnimObject; 2457 } 2458 } 2459 2460 void KyraEngine::flagAllObjectsForRefresh() { 2461 AnimObject *curObject = _objectQueue; 2462 while (curObject) { 2463 curObject->refreshFlag = 1; 2464 curObject = curObject->nextAnimObject; 2465 } 2466 } 2467 2120 2468 void KyraEngine::restoreAllObjectBackgrounds() { 2121 2469 debug(9, "restoreAllObjectBackground()"); 2122 2470 AnimObject *curObject = _objectQueue; … … 2197 2545 flagUnk1 = 0x200; 2198 2546 if (_brandonStatusBit & 0x40) 2199 2547 flagUnk2 = 0x4000; 2200 2548 2201 2549 while (curObject) { 2202 2550 if (curObject->active) { 2203 2551 int xpos = curObject->x1; … … 2266 2614 void KyraEngine::copyChangedObjectsForward(int refreshFlag) { 2267 2615 debug(9, "copyChangedObjectsForward(%d)", refreshFlag); 2268 2616 AnimObject *curObject = _objectQueue; 2617 2269 2618 while (curObject) { 2270 2619 if (curObject->active) { 2271 2620 if (curObject->refreshFlag || refreshFlag) { … … 2281 2630 } 2282 2631 curObject = curObject->nextAnimObject; 2283 2632 } 2633 _screen->updateScreen(); 2284 2634 } 2285 2635 2286 2636 void KyraEngine::updateAllObjectShapes() { … … 2289 2639 preserveAnyChangedBackgrounds(); 2290 2640 prepDrawAllObjects(); 2291 2641 copyChangedObjectsForward(0); 2292 2293 _screen->updateScreen();2294 2642 } 2295 2643 2296 2644 void KyraEngine::animRefreshNPC(int character) { 2297 2645 debug(9, "animRefreshNPC(%d)", character); 2298 2646 AnimObject *animObj = &_charactersAnimState[character]; 2299 2647 Character *ch = &_characterList[character]; 2300 2648 2301 2649 animObj->refreshFlag = 1; 2302 2650 animObj->bkgdChangeFlag = 1; 2303 2651 int facing = ch->facing; … … 2342 2690 } 2343 2691 animObj->width2 = 4; 2344 2692 animObj->height2 = 3; 2345 2693 2346 2694 _objectQueue = objectRemoveQueue(_objectQueue, animObj); 2347 2695 if (_objectQueue) { 2348 2696 _objectQueue = objectQueue(_objectQueue, animObj); 2349 2697 } else { 2350 _objectQueue = objectAddHead( _objectQueue, animObj);2698 _objectQueue = objectAddHead(0, animObj); 2351 2699 } 2352 2700 } 2353 2701 … … 2358 2706 AnimObject *KyraEngine::objectRemoveQueue(AnimObject *queue, AnimObject *rem) { 2359 2707 AnimObject *cur = queue; 2360 2708 AnimObject *prev = queue; 2709 2361 2710 while (cur != rem && cur) { 2362 2711 AnimObject *temp = cur->nextAnimObject; 2363 2712 if (!temp) … … 2373 2722 } 2374 2723 2375 2724 if (!cur->nextAnimObject) { 2376 if (!prev) { 2377 return 0; 2378 } else { 2379 prev->nextAnimObject = 0; 2725 if (cur == rem) { 2726 if (!prev) { 2727 return 0; 2728 } else { 2729 prev->nextAnimObject = 0; 2730 } 2380 2731 } 2381 2732 } else { 2382 2733 if (cur == rem) { … … 2414 2765 cur->nextAnimObject = add; 2415 2766 add->nextAnimObject = 0; 2416 2767 } 2417 return 0;2768 return queue; 2418 2769 } 2419 2770 2420 2771 #pragma mark - -
kyra/kyra.h
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/kyra.h scummvm/kyra/kyra.h
old new 87 87 uint32 flags; 88 88 int16 drawY; 89 89 uint8 *sceneAnimPtr; 90 uint16 animFrameNumber;90 int16 animFrameNumber; 91 91 uint8 *background; 92 92 uint16 rectSize; 93 93 int16 x1, y1; … … 167 167 168 168 uint8 game() const { return _game; } 169 169 uint32 features() const { return _features; } 170 SceneExits sceneExits() const { return _sceneExits; }171 // ugly hack used by the dat loader172 SceneExits &sceneExits() { return _sceneExits; }173 170 174 171 Common::RandomSource _rnd; 175 172 int16 _northExitHeight; 176 173 174 Character *_currentCharacter; 175 177 176 typedef void (KyraEngine::*IntroProc)(); 178 177 typedef int (KyraEngine::*OpcodeProc)(ScriptState *script); 179 178 … … 190 189 void snd_playTrack(int track); 191 190 void snd_playVoiceFile(int id); 192 191 bool snd_voicePlaying(); 192 void snd_playSoundEffect(int track); 193 193 194 194 void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage); 195 195 void restoreTalkTextMessageBkgd(int srcPage, int dstPage); … … 200 200 void wsa_play(WSAMovieV1 *wsa, int frameNum, int x, int y, int pageNum); 201 201 202 202 void waitTicks(int ticks); 203 void updateAllObjectShapes(); 204 void flagAllObjectsForRefresh(); 205 void animRefreshNPC(int character); 206 int16 fetchAnimWidth(const uint8 *shape, int16 mult); 207 int8 fetchAnimHeight(const uint8 *shape, int8 mult); 203 208 204 209 int mouseX() { return _mouseX; } 205 210 int mouseY() { return _mouseY; } … … 377 382 int getWidestLineWidth(int linesCount); 378 383 void calcWidestLineBounds(int &x1, int &x2, int w, int cx); 379 384 void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2); 385 void characterSays(char *msg, int8 charNum, int8 chatDuration); 386 int initCharacterChat(int8 charNum); 387 int8 getChatPartnerNum(); 388 void backupChatPartnerAnimFrame(int8 charNum); 389 void restoreChatPartnerAnimFrame(int8 charNum); 390 void endCharacterChat(int8 charNum, int16 arg_4); 391 void waitForChatToFinish(int16 chatDuration, char *str, uint8 charNum); 392 void printCharacterText(char *text, int8 charNum); 393 380 394 void setCharacterDefaultFrame(int character); 381 395 void setCharactersPositions(int character); 382 396 void setCharactersHeight(); … … 401 415 byte findItemAtPos(int x, int y); 402 416 void placeItemInGenericMapScene(int item, int index); 403 417 void initSceneObjectList(int brandonAlive); 418 void preserveAllBackgrounds(); 419 void flagAllObjectsForBkgdChange(); 404 420 void restoreAllObjectBackgrounds(); 405 421 void preserveAnyChangedBackgrounds(); 406 422 void preserveOrRestoreBackground(AnimObject *obj, bool restore); 407 423 void prepDrawAllObjects(); 408 424 void copyChangedObjectsForward(int refreshFlag); 409 void updateAllObjectShapes();410 void animRefreshNPC(int character);411 425 int findDuplicateItemShape(int shape); 412 int16 fetchAnimWidth(const uint8 *shape, int16 mult);413 int8 fetchAnimHeight(const uint8 *shape, int8 mult);414 426 int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize); 415 427 int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end); 416 428 int getFacingFromPointToPoint(int x, int y, int toX, int toY); … … 421 433 AnimObject *objectRemoveQueue(AnimObject *queue, AnimObject *rem); 422 434 AnimObject *objectAddHead(AnimObject *queue, AnimObject *head); 423 435 AnimObject *objectQueue(AnimObject *queue, AnimObject *add); 424 436 AnimObject *_animStates; 425 437 void seq_demo(); 426 438 void seq_intro(); 427 439 void seq_introLogos(); … … 435 447 void snd_startTrack(); 436 448 void snd_haltTrack(); 437 449 void snd_setSoundEffectFile(int file); 438 void snd_playSoundEffect(int track); 450 439 451 440 452 static OpcodeProc _opcodeTable[]; 441 453 static const int _opcodeTableSize; … … 506 518 int16 _brandonScaleX; 507 519 int16 _brandonScaleY; 508 520 int _brandonDrawFrame; 521 522 uint16 _currentChatPartnerBackupFrame; 523 uint16 _currentCharAnimFrame; 509 524 510 525 int8 *_sceneAnimTable[50]; 511 526 … … 522 537 int _lastFindWayRet; 523 538 int *_movFacingTable; 524 539 540 int8 _charSayUnk1; // this is byte_2EE24 541 int8 _charSayUnk2; 542 int8 _charSayUnk3; // this is byte_2EE25 543 int8 _charSayUnk4; // this is byte_2EE26 544 545 uint8 _configTalkspeed; 525 546 AnimObject *_objectQueue; 526 AnimObject *_animStates;527 547 AnimObject *_charactersAnimState; 528 AnimObject *_animObjects;529 548 AnimObject *_animItems; 530 549 531 550 int _curMusicTheme; … … 547 566 ScriptData *_scriptClickData; 548 567 549 568 Character *_characterList; 550 Character *_currentCharacter;551 569 552 570 uint8 *_seq_Forest; 553 571 uint8 *_seq_KallakWriting; -
kyra/screen.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/screen.cpp scummvm/kyra/screen.cpp
old new 75 75 _pagePtrs[pageNum] = _pagePtrs[pageNum + 1] = 0; 76 76 } 77 77 for (int f = 0; f < ARRAYSIZE(_fonts); ++f) { 78 free(_fonts[f].fontData);78 delete[] _fonts[f].fontData; 79 79 _fonts[f].fontData = NULL; 80 80 } 81 81 free(_currentPalette); … … 305 305 306 306 void Screen::copyCurPageBlock(int x, int y, int h, int w, uint8 *dst) { 307 307 debug(9, "Screen::copyCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, dst); 308 assert(dst); 308 309 if (x < 0) { 309 310 x = 0; 310 311 } else if (x >= 40) { … … 389 390 debug(9, "Screen::setAnimBlockPtr(%d)", size); 390 391 free(_animBlockPtr); 391 392 _animBlockPtr = (uint8 *)malloc(size); 393 assert(_animBlockPtr); 394 memset(_animBlockPtr, 0, size); 392 395 _animBlockSize = size; 393 396 } 394 397 -
kyra/script_v1.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/script_v1.cpp scummvm/kyra/script_v1.cpp
old new 296 296 #pragma mark - 297 297 298 298 #define stackPos(x) script->stack[script->sp+x] 299 #define stackPosString(x) (char *)&script->dataPtr->text[READ_BE_UINT16( &((uint16 *)script->dataPtr->text)[stackPos(x)])] 299 300 300 301 int KyraEngine::cmd_magicInMouseItem(ScriptState *script) { 301 302 warning("STUB: cmd_magicInMouseItem"); … … 303 304 } 304 305 305 306 int KyraEngine::cmd_characterSays(ScriptState *script) { 306 warning("STUB: cmd_characterSays"); 307 debug(9, "cmd_characterSays(0x%X)", script); 308 const char *str1 = "âuâëâôââôüAé?é¢ùêé¢é+é®üH"; 309 const char *str2 = "âuâëâôâ\\âôüAé?é¢ùêé¢é+é®üH"; 310 311 if (strcmp(stackPosString(0), str1) == 0) 312 characterSays((char *)str2, stackPos(1), stackPos(2)); 313 else 314 characterSays(stackPosString(0), stackPos(1), stackPos(2)); 315 307 316 return 0; 308 317 } 309 318 … … 314 323 315 324 int KyraEngine::cmd_drawSceneAnimShape(ScriptState *script) { 316 325 debug(9, "cmd_drawSceneAnimShape(0x%X)", script); 317 _screen->drawShape( stackPos(4), _sprites-> getSceneShape(stackPos(0)), stackPos(1), stackPos(2), 0, stackPos(3) );326 _screen->drawShape( stackPos(4), _sprites->_sceneShapes[stackPos(0)], stackPos(1), stackPos(2), 0, stackPos(3) ); 318 327 return 0; 319 328 } 320 329 … … 410 419 411 420 int KyraEngine::cmd_sceneAnimOn(ScriptState *script) { 412 421 debug(9, "cmd_sceneAnimOn(0x%X)", script); 413 _sprites-> enableAnim(stackPos(0));422 _sprites->_anims[stackPos(0)].play = true; 414 423 return 0; 415 424 } 416 425 417 426 int KyraEngine::cmd_sceneAnimOff(ScriptState *script) { 418 427 debug(9, "cmd_sceneAnimOff(0x%X)", script); 419 _sprites-> disableAnim(stackPos(0));428 _sprites->_anims[stackPos(0)].play = false; 420 429 return 0; 421 430 } 422 431 -
kyra/sprites.cpp
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/sprites.cpp scummvm/kyra/sprites.cpp
old new 46 46 Sprites::~Sprites() { 47 47 delete[] _dat; 48 48 freeSceneShapes(); 49 for (int i = 0; i < MAX_NUM_ANIMS; i++) { 50 if (_anims[i].background) 51 free(_anims[i].background); 52 } 49 53 } 50 54 51 uint8 *Sprites::getSceneShape(uint8 sceneShapeID) { 52 assert( sceneShapeID < ARRAYSIZE(_sceneShapes)); 53 return _sceneShapes[sceneShapeID]; 54 } 55 56 void Sprites::drawSprites(uint8 srcPage, uint8 dstPage) { 57 int flags; 55 void Sprites::setupSceneAnims() { 56 debug(9, "Sprites::setupSceneAnims()"); 57 uint8 *data; 58 58 59 59 for (int i = 0; i < MAX_NUM_ANIMS; i++) { 60 if (_anims[i].script == 0 || !_anims[i].play) 61 break; 62 if (_anims[i].sprite >= 0) { 63 assert( _anims[i].sprite < ARRAYSIZE(_sceneShapes)); 64 uint8 *sprite = _sceneShapes[_anims[i].sprite]; 65 66 //debug(1, "Drawing from X %i, Y %i, to X %i, Y %i, width %i, height %i, srcPage %i, dstPage %i", 67 // sprite.x, sprite.y, _anims[i].x, _anims[i].y, sprite.width, sprite.height, srcPage, dstPage); 68 flags = Screen::CR_CLIPPED; 69 if (_anims[i].flipX) 70 flags |= Screen::CR_X_FLIPPED; 60 if (_anims[i].background) { 61 free(_anims[i].background); 62 _anims[i].background = 0; 63 } 64 65 if (_anims[i].script != 0) { 66 data = _anims[i].script; 67 68 assert( READ_LE_UINT16(data) == 0xFF86 ); 69 data += 4; 71 70 72 //_screen->copyRegion(sprite.x, sprite.y, _anims[i].x, _anims[i].y, sprite.width, sprite.height, srcPage, dstPage, flags); 73 _screen->drawShape(0, sprite, _anims[i].x, _anims[i].y, 0, 0, 0); 71 //sceneUnk16[i] = READ_LE_UINT16(data); 72 data += 4; 73 _anims[i].unk2 = READ_LE_UINT16(data); 74 data += 4; 75 76 if (_engine->_northExitHeight > READ_LE_UINT16(data)) 77 _anims[i].drawY = _engine->_northExitHeight; 78 else 79 _anims[i].drawY = READ_LE_UINT16(data); 80 data += 4; 81 82 //sceneUnk2[i] = READ_LE_UINT16(data); 83 data += 4; 84 85 _anims[i].x = READ_LE_UINT16(data);// * 8; 86 data += 4; 87 _anims[i].y = READ_LE_UINT16(data); 88 data += 4; 89 _anims[i].width = *(data);// * 8; 90 data += 4; 91 _anims[i].height = *(data); 92 data += 4; 93 _anims[i].sprite = READ_LE_UINT16(data); 94 data += 4; 95 _anims[i].flipX = READ_LE_UINT16(data); 96 data += 4; 97 _anims[i].width2 = *(data);// * 8; 98 data += 4; 99 _anims[i].height2 = *(data); 100 data += 4; 101 _anims[i].unk1 = READ_LE_UINT16(data); 102 data += 4; 103 _anims[i].play = READ_LE_UINT16(data); 104 data += 2; 105 106 _anims[i].script = data; 107 108 int bkgdWidth = _anims[i].width; 109 int bkgdHeight = _anims[i].height; 110 111 if (_anims[i].width2) 112 bkgdWidth += (_anims[i].width2 >> 3) + 1; 113 114 if (_anims[i].height2) 115 bkgdHeight += _anims[i].height2; 116 117 //_anims[i].background = (uint8 *)malloc(_screen->getRectSize(bkgdWidth + 1, bkgdHeight)); 118 //debug("Allocated background of size %i", _screen->getRectSize(bkgdWidth + 1, bkgdHeight)); 119 //_anims[i].background = (uint8 *)malloc((bkgdWidth + 1) * bkgdHeight); 120 _anims[i].background = (uint8 *)malloc(100*100); 121 122 assert(_anims[i].background); 74 123 } 75 124 } 76 125 } 77 126 78 void Sprites:: doAnims() {79 debug(9, "Sprites:: doAnims()");127 void Sprites::updateSceneAnims() { 128 debug(9, "Sprites::updateSceneAnims()"); 80 129 uint32 currTime = _system->getMillis(); 130 uint8 *data; 131 bool endLoop; 132 81 133 for (int i = 0; i < MAX_NUM_ANIMS; i++) { 82 134 if (_anims[i].script == 0 || !_anims[i].play || _anims[i].nextRun != 0 && _anims[i].nextRun > currTime) 83 135 continue; 84 136 85 uint8 *data;86 87 137 if (_anims[i].reentry == 0) { 88 138 data = _anims[i].script; 89 90 //debug(1, "---Start of anim script---");91 assert( READ_LE_UINT16(data) == 0xFF86 );92 data += 2;93 94 //debug(1, "Default X of sprite: %i", READ_LE_UINT16(data + 0x12) );95 _anims[i].x = READ_LE_UINT16(data + 0x12);96 //debug(1, "Default Y of sprite: %i", READ_LE_UINT16(data + 0x16) );97 _anims[i].y = READ_LE_UINT16(data + 0x16);98 99 //debug(1, "Anim %i flags: 22h: %i, 1ah: %i", i, READ_LE_UINT16(data + 0x22), READ_LE_UINT16(data + 0x1a));100 101 /*102 debug(1, "Anim %i data: 0h: %i, 2h: %i,4h: %i,6h: %i,8h: %i,ah: %i,ch: %i", i, READ_LE_UINT16(data + 0x0),103 READ_LE_UINT16(data + 0x2), READ_LE_UINT16(data + 0x4),READ_LE_UINT16(data + 0x6),READ_LE_UINT16(data + 0x8),104 READ_LE_UINT16(data + 0xa),READ_LE_UINT16(data + 0xc));105 106 debug(1, "Anim %i data: eh: %i, 10h: %i,12h: %i,14h: %i,16h: %i,18h: %i,1ah: %i", i, READ_LE_UINT16(data + 0xe),107 READ_LE_UINT16(data + 0x10), READ_LE_UINT16(data + 0x12),READ_LE_UINT16(data + 0x14),READ_LE_UINT16(data + 0x16),108 READ_LE_UINT16(data + 0x18),READ_LE_UINT16(data + 0x1a));109 110 debug(1, "Anim %i data: 1ch: %i, 1fh: %i,22h: %i,24h: %i,26h: %i,28h: %i,2ah: %i", i, READ_LE_UINT16(data + 0x1c),111 READ_LE_UINT16(data + 0x1f), READ_LE_UINT16(data + 0x22),READ_LE_UINT16(data + 0x24),READ_LE_UINT16(data + 0x26),112 READ_LE_UINT16(data + 0x28),READ_LE_UINT16(data + 0x2a));113 */114 115 116 // TODO: Find out what the rest of this data (next 38h bytes) does.117 data += 0x38;118 139 } else { 119 140 data = _anims[i].reentry; 120 141 _anims[i].reentry = 0; 121 142 } 122 143 123 bool endLoop = false; 124 144 endLoop = false; 125 145 while (READ_LE_UINT16(data) != 0xFF87 && !endLoop) { 126 146 uint16 rndNr; 127 147 uint16 anim; … … 142 162 _anims[i].y = READ_LE_UINT16(data); 143 163 data += 2; 144 164 _anims[i].flipX = false; 165 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 145 166 break; 146 167 case 0xFF8D: 147 168 data += 2; … … 158 179 _anims[i].y = READ_LE_UINT16(data); 159 180 data += 2; 160 181 _anims[i].flipX = true; 182 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 161 183 break; 162 184 case 0xFF8A: 163 185 data += 2; … … 174 196 data += 2; 175 197 debug(5, "Maximum time %i", READ_LE_UINT16(data)); 176 198 data += 2; 177 _anims[i].nextRun = _system->getMillis() + rndNr * _animDelay; 199 _anims[i].nextRun = _system->getMillis() + rndNr * _animDelay; 178 200 break; 179 201 case 0xFF8C: 180 202 data += 2; … … 185 207 break; 186 208 case 0xFF99: 187 209 data += 2; 188 debug(1, "TODO func: Set value of animation property 32h to 1"); 210 debug(1, "func: Set value of unknown animation property to 1"); 211 _anims[i].unk1 = 1; 189 212 break; 190 213 case 0xFF9A: 191 214 data += 2; 192 debug(1, "TODO func: Set value of animation property 32h to 0"); 215 debug(1, "func: Set value of unknown animation property to 0"); 216 _anims[i].unk1 = 0; 193 217 break; 194 218 case 0xFF97: 195 219 data += 2; … … 234 258 _anims[i].sprite = READ_LE_UINT16(data); 235 259 _anims[i].flipX = false; 236 260 data += 2; 261 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 237 262 break; 238 263 case 0xFF91: 239 264 data += 2; … … 242 267 _anims[i].sprite = READ_LE_UINT16(data); 243 268 _anims[i].flipX = true; 244 269 data += 2; 270 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 245 271 break; 246 272 case 0xFF92: 247 273 data += 2; … … 249 275 debug(5, "Increment %i", READ_LE_UINT16(data)); 250 276 _anims[i].x += READ_LE_UINT16(data); 251 277 data += 2; 278 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 252 279 break; 253 280 case 0xFF93: 254 281 data += 2; … … 256 283 debug(5, "Increment %i", READ_LE_UINT16(data)); 257 284 _anims[i].y += READ_LE_UINT16(data); 258 285 data += 2; 286 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 259 287 break; 260 288 case 0xFF94: 261 289 data += 2; … … 263 291 debug(5, "Decrement %i", READ_LE_UINT16(data)); 264 292 _anims[i].x -= READ_LE_UINT16(data); 265 293 data += 2; 294 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 266 295 break; 267 296 case 0xFF95: 268 297 data += 2; … … 270 299 debug(5, "Decrement %i", READ_LE_UINT16(data)); 271 300 _anims[i].y -= READ_LE_UINT16(data); 272 301 data += 2; 302 refreshSceneAnimObject(i, _anims[i].sprite, _anims[i].x, _anims[i].y, _anims[i].flipX, _anims[i].unk1); 273 303 break; 274 304 case 0xFF96: 275 305 data += 2; … … 279 309 data += 2; 280 310 _anims[anim].play = false; 281 311 _anims[anim].sprite = -1; 282 //debug(1, "Arg2 %i", READ_LE_UINT16(data));283 //data += 2;284 312 break; 285 313 /* case 0xFF97: 286 314 data += 2; … … 288 316 break;*/ 289 317 case 0xFFAD: 290 318 data += 2; 291 debug(1, "TODO func: Set Brandon's X coordinate"); 292 debug(1, "X %i", READ_LE_UINT16(data)); 319 debug(5, "func: Set Brandon's X coordinate"); 320 debug(5, "X %i", READ_LE_UINT16(data)); 321 _engine->_currentCharacter->x1 = READ_LE_UINT16(data); 293 322 data += 2; 294 323 break; 295 324 case 0xFFAE: 296 325 data += 2; 297 debug(1, "TODO func: Set Brandon's Y coordinate"); 298 debug(1, "Y %i", READ_LE_UINT16(data)); 326 debug(5, "func: Set Brandon's Y coordinate"); 327 debug(5, "Y %i", READ_LE_UINT16(data)); 328 _engine->_currentCharacter->y1 = READ_LE_UINT16(data); 299 329 data += 2; 300 330 break; 301 331 case 0xFFAF: 302 332 data += 2; 303 debug(1, "TODO func: Set Brandon's X sprite"); 304 debug(1, "Sprite %i", READ_LE_UINT16(data)); 333 debug(5, "func: Set Brandon's sprite"); 334 debug(5, "Sprite %i", READ_LE_UINT16(data)); 335 _engine->_currentCharacter->currentAnimFrame = READ_LE_UINT16(data); 305 336 data += 2; 306 337 break; 307 338 case 0xFFAA: … … 310 341 break; 311 342 case 0xFFAB: 312 343 data += 2; 313 debug(1, "TODO func: Update Brandon's sprite"); 344 debug(5, "func: Update Brandon's sprite"); 345 _engine->animRefreshNPC(0); 346 _engine->flagAllObjectsForRefresh(); 347 _engine->updateAllObjectShapes(); 314 348 break; 315 349 case 0xFFB0: 316 350 data += 2; 317 debug(1, "TODO func: Play sound"); 318 debug(1, "Sound index %i", READ_LE_UINT16(data)); 351 debug(5, "func: Play sound"); 352 debug(5, "Sound index %i", READ_LE_UINT16(data)); 353 _engine->snd_playSoundEffect(READ_LE_UINT16(data)); 319 354 data += 2; 320 355 break; 321 356 case 0xFFB1: 322 357 data += 2; 323 debug(1, "TODO func: Set unknown global bit");358 debug(1, "TODO func: Set animator beacon flag"); 324 359 break; 325 360 case 0xFFB2: 326 361 data += 2; 327 debug(1, "TODO func: Reset unknown global bit");362 debug(1, "TODO func: Reset animator beacon flag"); 328 363 break; 329 364 case 0xFFB4: 330 365 data += 2; 331 debug(1, "TODO func: Play (at random) a certain sound at a certain percentage of time"); 332 debug(1, "Sound index %i", READ_LE_UINT16(data)); 333 data += 2; 334 debug(1, "Percentage %i", READ_LE_UINT16(data)); 366 debug(5, "func: Play (at random) a certain sound at a certain percentage of time"); 367 debug(5, "Sound index %i", READ_LE_UINT16(data)); 368 int sound = READ_LE_UINT16(data); 369 data += 2; 370 debug(5, "Percentage %i", READ_LE_UINT16(data)); 371 rndNr = _rnd.getRandomNumber(100); 372 if (rndNr <= READ_LE_UINT16(data)) 373 _engine->snd_playSoundEffect(sound); 335 374 data += 2; 336 375 break; 337 376 case 0xFFA7: … … 341 380 data += 2; 342 381 break; 343 382 default: 344 debug(1, "Unsupported anim command %X ", READ_LE_UINT16(data));383 debug(1, "Unsupported anim command %X in script %i", READ_LE_UINT16(data), i); 345 384 //endLoop = true; 346 385 data += 1; 347 386 break; … … 350 389 351 390 if (READ_LE_UINT16(data) == 0xFF87) 352 391 _anims[i].play = false; 353 354 //debug(1, "---End of anim script---");355 392 } 356 393 } 357 394 358 void Sprites::loadDAT(const char *filename ) {395 void Sprites::loadDAT(const char *filename, SceneExits &exits) { 359 396 debug(9, "Sprites::loadDat('%s')", filename); 360 397 uint32 fileSize; 361 uint8 spritesLoaded = 0;362 398 363 399 delete[] _dat; 400 _spriteDefStart = 0; 364 401 365 402 _dat = _res->fileData(filename, &fileSize); 366 403 367 memset(_anims, 0, sizeof( Anim) * MAX_NUM_ANIMS);404 memset(_anims, 0, sizeof(_anims)); 368 405 uint8 nextAnim = 0; 369 406 370 407 assert(fileSize > 0x6D); … … 380 417 uint16 length = READ_LE_UINT16(data); 381 418 data += 2; 382 419 383 //debug(1, "DAT body length: %i, filesize %i, current spot %i", length, fileSize, data - _dat);384 385 420 if (length > 2) { 386 421 assert( length < fileSize); 387 422 uint8 *animstart; … … 440 475 data += 2; 441 476 } 442 477 443 debug(1, "Room DAT file loaded. Found %i sprite and %i animation scripts.", spritesLoaded, nextAnim);444 445 //debug(1, "Remainder after script: %i", fileSize - (data - _dat));446 478 assert(fileSize - (data - _dat) == 0xC); 447 479 448 //TODO: Read in character entry coords here449 SceneExits &exits = _engine->sceneExits();450 451 480 exits.NorthXPos = READ_LE_UINT16(data) & 0xFFFC; data += 2; 452 481 exits.NorthYPos = *data++ & 0xFFFE; 453 482 exits.EastXPos = READ_LE_UINT16(data) & 0xFFFC; data += 2; … … 459 488 } 460 489 461 490 void Sprites::freeSceneShapes() { 462 for (int i = 0; i < ARRAYSIZE(_sceneShapes); i++ ) 491 debug(9, "Sprites::freeSceneShapes()"); 492 for (int i = 0; i < ARRAYSIZE(_sceneShapes); i++ ) { 463 493 free(_sceneShapes[i]); 464 494 _sceneShapes[i] = 0; 495 } 465 496 } 466 497 467 498 void Sprites::loadSceneShapes() { … … 469 500 uint8 *data = _spriteDefStart; 470 501 int spriteNum, x, y, width, height; 471 502 472 assert(_spriteDefStart);473 474 503 freeSceneShapes(); 475 504 memset( _sceneShapes, 0, sizeof(_sceneShapes)); 476 505 506 if( _spriteDefStart == 0 ) 507 return; 508 509 int bakPage = _screen->_curPage; 510 _screen->_curPage = 3; 511 477 512 while (READ_LE_UINT16(data) != 0xFF85) { 478 513 spriteNum = READ_LE_UINT16(data); 479 514 assert(spriteNum < ARRAYSIZE(_sceneShapes)); 480 515 data += 2; 481 x = READ_LE_UINT16(data) * 8;516 x = READ_LE_UINT16(data);// * 8; 482 517 data += 2; 483 518 y = READ_LE_UINT16(data); 484 519 data += 2; 485 width = READ_LE_UINT16(data) * 8;520 width = READ_LE_UINT16(data);// * 8; 486 521 data += 2; 487 522 height = READ_LE_UINT16(data); 488 523 data += 2; 489 524 _sceneShapes[spriteNum] = _screen->encodeShape(x, y, width, height, 0); 525 debug("Sprite %i is at (%i, %i), width %i, height %i", spriteNum, x, y, width, height); 490 526 } 527 _screen->_curPage = bakPage; 528 } 529 530 void Sprites::refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipped, bool unkFlag) { 531 debug(9, "Sprites::refreshSceneAnimObject(%i, %i, %i, %i, %i, %i", animNum, shapeNum, x, y, flipped, unkFlag); 532 _animObjects[animNum].refreshFlag = 1; 533 _animObjects[animNum].bkgdChangeFlag = 1; 534 535 if (unkFlag) 536 _animObjects[animNum].flags |= 0x0200; 537 else 538 _animObjects[animNum].flags &= 0xFD00; 539 540 if (flipped) 541 _animObjects[animNum].flags |= 1; 542 else 543 _animObjects[animNum].flags &= 0xFE; 544 545 _animObjects[animNum].sceneAnimPtr = _sceneShapes[shapeNum]; 546 _animObjects[animNum].animFrameNumber = -1; 547 _animObjects[animNum].x1 = x; 548 _animObjects[animNum].y1 = y; 491 549 } 492 550 493 551 } // end of namespace Kyra -
kyra/sprites.h
diff --exclude=.cvsignore --exclude=.deps --exclude=CVS -Pur ./scummvmcvs/kyra/sprites.h scummvm/kyra/sprites.h
old new 45 45 uint8 *reentry; 46 46 uint32 nextRun; 47 47 bool play; 48 uint16 width; 49 uint16 height; 50 uint16 width2; 51 uint16 height2; 52 uint16 unk1; 53 uint16 drawY; 54 uint16 unk2; 55 uint8 *background; 48 56 }; 49 57 50 58 class Sprites { … … 53 61 Sprites(KyraEngine *engine, OSystem *system); 54 62 ~Sprites(); 55 63 56 void doAnims(); 57 void loadDAT(const char *filename); 58 uint8 *getSceneShape(uint8 sceneShapeID); 59 void drawSprites(uint8 srcPage, uint8 dstPage); 64 void updateSceneAnims(); 65 void setupSceneAnims(); 66 void loadDAT(const char *filename, SceneExits &exits); 60 67 void loadSceneShapes(); 61 68 62 void enableAnim(uint8 anim) { _anims[anim].play = true; } 63 void disableAnim(uint8 anim) { _anims[anim].play = false; } 69 Anim _anims[MAX_NUM_ANIMS]; 70 AnimObject *_animObjects; 71 uint8 *_sceneShapes[50]; 72 73 void refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipped, bool unkFlag); 64 74 65 75 protected: 66 76 void freeSceneShapes(); … … 69 79 Resource *_res; 70 80 OSystem *_system; 71 81 Screen *_screen; 72 uint8 *_sceneShapes[50];73 82 uint8 *_dat; 74 Anim _anims[MAX_NUM_ANIMS];75 83 Common::RandomSource _rnd; 76 84 uint8 _animDelay; 77 85 uint8 *_spriteDefStart;