Ticket #8793: hofCDCreditsAndDemo.patch
File hofCDCreditsAndDemo.patch, 29.2 KB (added by , 16 years ago) |
---|
-
kyra_v2.cpp
52 52 _seqWsa = 0; 53 53 _sequences = 0; 54 54 _nSequences = 0; 55 _demoShapeDefs = 0; 55 56 56 57 57 _gamePlayBuffer = 0; 58 58 _cCodeBuffer = _optionsBuffer = _chapterBuffer = 0; 59 59 … … 129 129 _text = new TextDisplayer_v2(this, _screen); 130 130 assert(_text); 131 131 132 _screen->loadFont(_screen->FID_6_FNT, "6.FNT"); 133 _screen->loadFont(_screen->FID_8_FNT, "8FAT.FNT"); 132 if (_flags.isDemo && !_flags.isTalkie) { 133 _screen->loadFont(_screen->FID_8_FNT, "FONT9P.FNT"); 134 } else { 135 _screen->loadFont(_screen->FID_6_FNT, "6.FNT"); 136 _screen->loadFont(_screen->FID_8_FNT, "8FAT.FNT"); 137 _screen->loadFont(_screen->FID_BOOKFONT_FNT, "BOOKFONT.FNT"); 138 } 134 139 _screen->loadFont(_screen->FID_GOLDFONT_FNT, "GOLDFONT.FNT"); 135 _screen->loadFont(_screen->FID_BOOKFONT_FNT, "BOOKFONT.FNT"); 140 136 141 _screen->setAnimBlockPtr(3504); 137 142 _screen->setScreenDim(0); 138 143 … … 141 146 142 147 _abortIntroFlag = false; 143 148 144 for (int i = 0; i < 33; i++) 145 _sequenceStringsDuration[i] = (int) strlen(_sequenceStrings[i]) * 8; 149 if (_sequenceStrings) { 150 for (int i = 0; i < 33; i++) 151 _sequenceStringsDuration[i] = (int) strlen(_sequenceStrings[i]) * 8; 152 } 146 153 147 154 // No mouse display in demo 148 155 if (_flags.isDemo) … … 164 171 if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) 165 172 seq_showStarcraftLogo(); 166 173 167 seq_playSequences(kSequenceVirgin, kSequenceZanfaun); 168 //seq_playSequences(kSequenceFunters, kSequenceFrash); 174 if (_flags.isDemo && !_flags.isTalkie) { 175 seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); 176 _menuChoice = 4; 177 } else { 178 seq_playSequences(kSequenceVirgin, kSequenceZanfaun); 179 //seq_playSequences(kSequenceFunters, kSequenceFrash); 180 } 169 181 170 182 _res->unloadAllPakFiles(); 171 183 … … 178 190 _res->loadFileList(_ingamePakList, _ingamePakListSize); 179 191 } 180 192 181 if (_menuChoice == 1) { 193 //_menuDirectlyToLoad = (_menuChoice == 3) ? true : false; 194 195 if (_menuChoice & 1) { 182 196 startup(); 183 197 runLoop(); 184 198 cleanup(); 185 } else if (_menuChoice == 3) {186 // TODO: Load Game187 188 199 } 189 200 190 201 return 0; -
kyra_v2.h
78 78 kSequenceDemoVirgin = 0, 79 79 kSequenceDemoWestwood, 80 80 kSequenceDemoTitle, 81 kSequenceDemoTitle2,82 81 kSequenceDemoHill, 83 82 kSequenceDemoOuthome, 84 83 kSequenceDemoWharf, … … 223 222 int seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm); 224 223 int seq_finaleFrash(WSAMovieV2 *wsaObj, int x, int y, int frm); 225 224 226 void seq_finaleActorScreen();227 225 int seq_finaleFiggle(WSAMovieV2 *wsaObj, int x, int y, int frm); 228 226 227 int seq_demoVirgin(WSAMovieV2 *wsaObj, int x, int y, int frm); 228 int seq_demoWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm); 229 int seq_demoTitle(WSAMovieV2 *wsaObj, int x, int y, int frm); 230 int seq_demoHill(WSAMovieV2 *wsaObj, int x, int y, int frm); 231 int seq_demoOuthome(WSAMovieV2 *wsaObj, int x, int y, int frm); 232 int seq_demoWharf(WSAMovieV2 *wsaObj, int x, int y, int frm); 233 int seq_demoDinob(WSAMovieV2 *wsaObj, int x, int y, int frm); 234 int seq_demoFisher(WSAMovieV2 *wsaObj, int x, int y, int frm); 235 236 int seq_demoWharf2(WSAMovieV2 *wsaObj, int x, int y, int frm); 237 int seq_demoDinob2(WSAMovieV2 *wsaObj, int x, int y, int frm); 238 int seq_demoWater(WSAMovieV2 *wsaObj, int x, int y, int frm); 239 int seq_demoBail(WSAMovieV2 *wsaObj, int x, int y, int frm); 240 int seq_demoDig(WSAMovieV2 *wsaObj, int x, int y, int frm); 241 229 242 void seq_sequenceCommand(int command); 230 243 void seq_loadNestedSequence(int wsaNum, int seqNum); 231 244 void seq_nestedSequenceFrame(int command, int wsaNum); … … 236 249 void seq_unloadWSA(int wsaNum); 237 250 void seq_processWSAs(); 238 251 void seq_cmpFadeFrame(const char *cmpFile); 239 240 252 void seq_playTalkText(uint8 chatNum); 241 253 void seq_resetAllTextEntries(); 242 254 uint32 seq_activeTextsTimeLeft(); … … 247 259 void seq_printCreditsString(uint16 strIndex, int x, int y, uint8 * colorMap, uint8 textcolor); 248 260 void seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, 249 261 WSAMovieV2 * wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos); 262 void seq_finaleActorScreen(); 263 void seq_displayScrollText(uint8 * data, const ScreenDim *d, int tempPage1, int tempPage2, int speed, int step, Screen::FontId fid1, Screen::FontId fid2, const uint8 *shapeData = 0, const char *const *specialData = 0); 264 void seq_scrollPage(); 250 265 void seq_showStarcraftLogo(); 251 266 252 267 void seq_init(); … … 617 632 byte _messagePal[3]; 618 633 int _msgUnk1; 619 634 635 uint8 _configTextspeed; 636 620 637 // chat 621 638 int _vocHigh; 622 639 … … 881 898 int _ingameSoundIndexSize; 882 899 const char *const *_sequenceStrings; 883 900 int _sequenceStringsSize; 901 uint8 *_demoShapeDefs; 884 902 int _sequenceStringsDuration[33]; 885 903 886 904 static const uint8 _seqTextColorPresets[]; … … 891 909 int _menuChoice; 892 910 893 911 uint32 _seqFrameDelay; 912 uint32 _seqStartTime; 894 913 uint32 _seqEndTime; 895 914 int _seqFrameCounter; 915 int _seqScrollTextCounter; 896 916 int _seqWsaCurrentFrame; 897 917 bool _seqSpecialFlag; 898 918 bool _seqSubframePlaying; -
resource.h
226 226 227 227 k2SeqplayPakFiles, 228 228 k2SeqplayCredits, 229 k2SeqplayCreditsSpecial, 229 230 k2SeqplayStrings, 230 231 k2SeqplaySfxFiles, 231 232 k2SeqplayTlkFiles, … … 234 235 k2SeqplayFinaleTracks, 235 236 k2SeqplayIntroCDA, 236 237 k2SeqplayFinaleCDA, 238 k2SeqplayShapeDefs, 237 239 238 240 k2IngamePakFiles, 239 241 k2IngameSfxFiles, -
screen.cpp
43 43 for (int i = 0; i < SCREEN_OVLS_NUM; ++i) 44 44 delete [] _sjisOverlayPtrs[i]; 45 45 46 for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2) { 47 delete [] _pagePtrs[pageNum]; 48 _pagePtrs[pageNum] = _pagePtrs[pageNum + 1] = 0; 49 } 46 delete [] _pagePtrs[0]; 50 47 51 48 for (int f = 0; f < ARRAYSIZE(_fonts); ++f) { 52 49 delete[] _fonts[f].fontData; … … 98 95 setResolution(); 99 96 100 97 _curPage = 0; 101 for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2) { 102 uint8 *pagePtr = new uint8[SCREEN_PAGE_SIZE]; 103 assert(pagePtr); 104 memset(pagePtr, 0, SCREEN_PAGE_SIZE); 105 _pagePtrs[pageNum] = _pagePtrs[pageNum + 1] = pagePtr; 106 } 98 uint8 *pagePtr = new uint8[SCREEN_PAGE_SIZE * 8]; 99 for (int pageNum = 0; pageNum < SCREEN_PAGE_NUM; pageNum += 2) 100 _pagePtrs[pageNum] = _pagePtrs[pageNum + 1] = pagePtr + (pageNum >> 1) * SCREEN_PAGE_SIZE; 101 107 102 memset(_shapePages, 0, sizeof(_shapePages)); 108 103 109 104 memset(_palettes, 0, sizeof(_palettes)); -
screen_v2.cpp
226 226 } 227 227 } 228 228 229 void Screen_v2::copyPageMemory(int srcPage, int srcPos, int dstPage, int dstPos, int numBytes) { 230 uint8 * src = getPagePtr(srcPage) + srcPos; 231 uint8 * dst = getPagePtr(dstPage) + dstPos; 232 memcpy(dst, src, numBytes); 233 } 234 235 236 void Screen_v2::copyRegionEx(int srcPage, int srcW, int srcH, int dstPage, int dstX,int dstY, int dstW, int dstH, const ScreenDim * d, bool flag) { 237 int x0 = d->sx << 3; 238 int y0 = d->sy; 239 int w0 = d->w << 3; 240 int h0 = d->h; 241 242 int x1 = dstX; 243 int y1 = dstY; 244 int w1 = dstW; 245 int h1 = dstH; 246 247 int x2, y2, w2; 248 249 calcBounds(w0, h0, x1, y1, w1, h1, x2, y2, w2); 250 251 uint8 * src = getPagePtr(srcPage) + (320 * srcH) + srcW; 252 uint8 * dst = getPagePtr(dstPage) + 320 * (y0 + y1); 253 254 for (int y = 0; y < h1; y++) { 255 uint8 *s = src + x2; 256 uint8 *d = dst + x0 + x1; 257 258 if (flag) 259 d += (h1 >> 1); 260 261 for (int x = 0; x < w1; x++) { 262 if (*s) 263 *d = *s; 264 s++; 265 d++; 266 } 267 dst += 320; 268 src += 320; 269 } 270 } 271 229 272 bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, int &x2, int &y2, int &w2) { 230 273 x2 = 0; 231 274 y2 = 0; -
screen_v2.h
46 46 void applyGrayOverlay(int x, int y, int w, int h, int pageNum, const uint8 *grayOverlay); 47 47 int findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *palette, uint16 numColors); 48 48 bool calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, int &x2, int &y2, int &w2); 49 void wsaFrameAnimationStep(int x1, int y1, int x2, int y2, 50 int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim);51 void c mpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage,52 int dstW, int dstH, int dstX, int dstY, int cmpW, int cmpH, int cmpPage);49 void wsaFrameAnimationStep(int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim); 50 void cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int srcY, int dstPage, int dstW, int dstH, int dstX, int dstY, int cmpW, int cmpH, int cmpPage); 51 void copyPageMemory(int srcPage, int srcPos, int dstPage, int dstPos, int numBytes); 52 void copyRegionEx(int srcPage, int srcW, int srcH, int dstPage, int dstX,int dstY, int dstW, int dstH, const ScreenDim * d, bool flag = false); 53 53 54 54 // screen page handling 55 55 void copyWsaRect(int x, int y, int w, int h, int dimState, int plotFunc, const uint8 *src, -
sequences_v2.cpp
46 46 47 47 assert(startSeq >= 0 && endSeq < kSequenceArraySize && startSeq <= endSeq); 48 48 49 // TODO: verfiy this is also correct for the demo50 49 _sound->setSoundList(&_soundData[(startSeq > kSequenceZanfaun) ? kMusicFinale : kMusicIntro]); 51 50 _sound->loadSoundFile(0); 52 51 … … 80 79 _screen->clearPage(8); 81 80 memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); 82 81 _seqFrameCounter = 0; 82 _seqStartTime = _system->getMillis(); 83 83 84 84 allowSkip = (seqNum == 2) ? false : true; 85 85 86 86 if (_sequences[seqNum].flags & 2) { 87 87 _screen->loadBitmap(_sequences[seqNum].cpsFile, 2, 2, _screen->getPalette(0)); 88 _screen->setScreenPalette(_screen->getPalette(0)); 88 89 } else { 89 90 _screen->setCurPage(2); 90 91 _screen->clearPage(2); 91 92 _screen->loadPalette("goldfont.col", _screen->getPalette(0)); 92 93 } 93 94 94 if (_sequences[seqNum].callback )95 if (_sequences[seqNum].callback && !(_flags.isDemo && !_flags.isTalkie)) 95 96 (this->*_sequences[seqNum].callback)(0, 0, 0, -1); 96 97 97 98 if (_sequences[seqNum].flags & 1) { 98 99 _seqWsa->close(); 99 100 _seqWsa->open(_sequences[seqNum].wsaFile, 0, _screen->getPalette(0)); 101 _screen->setScreenPalette(_screen->getPalette(0)); 100 102 _seqWsa->setX(_sequences[seqNum].xPos); 101 103 _seqWsa->setY(_sequences[seqNum].yPos); 102 104 _seqWsa->setDrawPage(2); … … 123 125 _screen->copyPage(2, 10); 124 126 _screen->copyPage(12, 2); 125 127 126 _screen->copyPage(2, 6);127 128 128 seq_sequenceCommand(_sequences[seqNum].startupCommand); 129 129 130 130 if (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { … … 187 187 188 188 if ((_seqWsa || !_sequences[seqNum].callback) && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 189 189 _screen->copyPage(2, 0); 190 _screen->copyPage(2, 6);191 190 _screen->updateScreen(); 192 191 } 193 192 … … 197 196 seq_processText(); 198 197 if (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 199 198 _screen->copyPage(2, 0); 200 _screen->copyPage(2, 6);201 199 _screen->updateScreen(); 202 200 } 203 201 … … 236 234 237 235 seq_processText(); 238 236 239 _screen->copyPage(2, 6);240 237 _screen->copyPage(2, 0); 241 238 _screen->updateScreen(); 242 239 _screen->copyPage(12, 2); … … 252 249 } 253 250 } 254 251 255 if (_sequences[seqNum].callback )252 if (_sequences[seqNum].callback && !(_flags.isDemo && !_flags.isTalkie)) 256 253 (this->*_sequences[seqNum].callback)(0, 0, 0, -2); 257 254 258 255 uint32 ct = seq_activeTextsTimeLeft(); … … 265 262 uint32 starttime = _system->getMillis(); 266 263 seq_processWSAs(); 267 264 268 _screen->copyPage(2, 6);269 265 _screen->copyPage(2, 0); 270 266 _screen->updateScreen(); 271 267 _screen->copyPage(12, 2); … … 284 280 seq_sequenceCommand(_sequences[seqNum].finalCommand); 285 281 seq_resetAllTextEntries(); 286 282 287 if ((seqNum != kSequenceTitle && seqNum < kSequenceZanfaun && 283 if (_flags.isDemo && seqNum == kSequenceDemoFisher) { 284 _abortIntroFlag = _skipFlag = false; 285 seqNum = kSequenceDemoVirgin; 286 } else if ((seqNum != kSequenceTitle && seqNum < kSequenceZanfaun && 288 287 (_abortIntroFlag || _skipFlag)) || seqNum == kSequenceZanfaun) { 289 288 _abortIntroFlag = _skipFlag = false; 290 289 seqNum = kSequenceWestwood; … … 746 745 } 747 746 748 747 int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) { 749 if (frm == 11) {748 if (frm == 11) 750 749 seq_waitForTextsTimeout(); 751 } else if (frm == 12) { 752 //if (_flags.lang == Common::FR_FRA) 753 //XXX 750 else if (frm == 12) 754 751 seq_playTalkText(2); 755 } 752 756 753 return frm; 757 754 } 758 755 … … 1413 1410 break; 1414 1411 1415 1412 case -1: 1416 //if (_flags.isTalkie)1417 //seq_finaleActorScreen();1413 if (_flags.isTalkie) 1414 seq_finaleActorScreen(); 1418 1415 _seqSpecialFlag = _flags.isTalkie; 1419 1416 break; 1420 1417 … … 1493 1490 } 1494 1491 1495 1492 void KyraEngine_v2::seq_finaleActorScreen() { 1493 1494 static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 1495 static const ScreenDim d = { 0x00, 0x0C, 0x28, 0xB4, 0xFF, 0x00, 0x00, 0x00 }; 1496 1496 1497 _screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette); 1497 1498 _screen->setFont(Screen::FID_GOLDFONT_FNT); 1498 1499 1499 //int talkieCreditsSize; 1500 //const uint8 *talkieCredits = _staticres->loadRawData(k2SeqplayCredits, talkieCreditsSize); 1500 int talkieCreditsSize, talkieCreditsSpecialSize; 1501 const uint8 *talkieCredits = _staticres->loadRawData(k2SeqplayCredits, talkieCreditsSize); 1502 const char *const *talkieCreditsSpecial = _staticres->loadStrings(k2SeqplayCreditsSpecial, talkieCreditsSpecialSize); 1501 1503 1502 1504 _sound->setSoundList(&_soundData[kMusicIngame]); 1503 1505 _sound->loadSoundFile(3); 1504 1506 _sound->playTrack(3); 1505 1507 1506 static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};1507 1508 _screen->setTextColorMap(colormap); 1509 _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); 1510 _screen->updateScreen(); 1511 _screen->fadeFromBlack(); 1508 1512 1509 //XXX 1513 _screen->_charWidth = -2; 1514 uint8 * dataPtr = new uint8[0xafd]; 1515 memcpy(dataPtr, talkieCredits, talkieCreditsSize); 1516 _staticres->unloadId(k2SeqplayCredits); 1510 1517 1518 seq_displayScrollText(dataPtr, &d, 2, 6, 5, 1, Screen::FID_GOLDFONT_FNT, Screen::FID_GOLDFONT_FNT, 0, talkieCreditsSpecial); 1519 delay(120); 1520 1521 delete [] dataPtr; 1522 _staticres->unloadId(k2SeqplayCreditsSpecial); 1511 1523 _sound->setSoundList(&_soundData[kMusicFinale]); 1512 1524 _sound->loadSoundFile(0); 1513 1525 } … … 1522 1534 return frm; 1523 1535 } 1524 1536 1537 int KyraEngine_v2::seq_demoVirgin(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1538 if (!frm) 1539 delay(50 * _tickLength); 1540 return 0; 1541 } 1542 1543 int KyraEngine_v2::seq_demoWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1544 if (!frm) 1545 _sound->playTrack(2); 1546 return 0; 1547 } 1548 int KyraEngine_v2::seq_demoTitle(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1549 if (!frm) { 1550 _sound->playTrack(3); 1551 } else if (frm == 25) { 1552 delay(60 * _tickLength); 1553 _seqEndTime = 0; 1554 seq_sequenceCommand(0); 1555 } 1556 return 0; 1557 } 1558 1559 int KyraEngine_v2::seq_demoHill(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1560 if (!frm) { 1561 _sound->playTrack(4); 1562 } else if (frm == 25) { 1563 seq_loadNestedSequence(0, kSequenceDemoWater); 1564 _seqFrameDelay--; 1565 } else if (frm > 25 && frm < 50) { 1566 if (_seqFrameDelay > 3) 1567 _seqFrameDelay--; 1568 } else if (frm == 95) { 1569 _seqFrameDelay = 70; 1570 } else if (frm == 96) { 1571 _seqFrameDelay = 7; 1572 } else if (frm == 129) { 1573 seq_resetActiveWSA(0); 1574 } 1575 1576 return 0; 1577 } 1578 1579 int KyraEngine_v2::seq_demoOuthome(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1580 switch (frm) { 1581 case 12: 1582 seq_playTalkText(4); 1583 break; 1584 1585 case 32: 1586 seq_playTalkText(7); 1587 break; 1588 1589 case 36: 1590 seq_playTalkText(10); 1591 break; 1592 1593 case 57: 1594 seq_playTalkText(9); 1595 break; 1596 1597 case 80: 1598 case 96: 1599 case 149: 1600 _seqFrameDelay = 70; 1601 break; 1602 1603 case 81: 1604 case 97: 1605 _seqFrameDelay = 5; 1606 break; 1607 1608 case 110: 1609 seq_playTalkText(5); 1610 break; 1611 1612 case 137: 1613 seq_playTalkText(6); 1614 break; 1615 } 1616 1617 return 0; 1618 } 1619 1620 int KyraEngine_v2::seq_demoWharf(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1621 if (!_seqFrameCounter) 1622 seq_loadNestedSequence(0, kSequenceDemoWharf2); 1623 1624 switch (frm) { 1625 case 0: 1626 seq_playTalkText(11); 1627 break; 1628 1629 case 5: 1630 if ((_seqFrameCounter / 8) <= 2 || _activeWSA[0].flags != -1) 1631 _seqWsaCurrentFrame = 0; 1632 else 1633 seq_resetActiveWSA(0); 1634 break; 1635 1636 case 6: 1637 seq_resetActiveWSA(0); 1638 break; 1639 1640 case 8: 1641 case 10: 1642 seq_playTalkText(2); 1643 break; 1644 1645 case 13: 1646 seq_playTalkText(7); 1647 break; 1648 1649 case 16: 1650 seq_playTalkText(12); 1651 break; 1652 1653 default: 1654 break; 1655 } 1656 1657 _seqFrameCounter++; 1658 return 0; 1659 } 1660 1661 int KyraEngine_v2::seq_demoDinob(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1662 if (frm == 0) { 1663 if (!(_seqFrameCounter/8)) { 1664 seq_loadNestedSequence(0, kSequenceDemoDinob2); 1665 _seqWsaCurrentFrame = 0; 1666 } 1667 } else if (frm == 3) { 1668 if (_activeWSA[0].flags != -1) { 1669 _seqWsaCurrentFrame = 0; 1670 } else { 1671 seq_resetActiveWSA(0); 1672 _screen->copyPage(2, 12); 1673 } 1674 } else if (frm == 4) { 1675 seq_resetActiveWSA(0); 1676 } 1677 1678 _seqFrameCounter++; 1679 return 0; 1680 } 1681 1682 int KyraEngine_v2::seq_demoFisher(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1683 if (((_system->getMillis() - _seqStartTime) / (5 * _tickLength)) > 0) { 1684 _seqStartTime = _system->getMillis(); 1685 if (!_seqFrameCounter) { 1686 seq_loadNestedSequence(0, kSequenceDemoBail); 1687 seq_loadNestedSequence(1, kSequenceDemoDig); 1688 } 1689 1690 if (_seqScrollTextCounter >= 0x18f && !_seqFrameCounter) 1691 return 0; 1692 1693 if (!_seqFrameCounter) { 1694 _screen->loadBitmap("adtext.cps", 4, 4, 0); 1695 _screen->loadBitmap("adtext2.cps", 6, 6, 0); 1696 _screen->copyPageMemory(6, 0, 4, 64000, 1024); 1697 _screen->copyPageMemory(6, 1023, 6, 0, 64000); 1698 _seqScrollTextCounter = 0; 1699 } 1700 1701 seq_scrollPage();; 1702 _seqFrameCounter++; 1703 if (_seqFrameCounter < 0x256 || _seqFrameCounter > 0x31c) { 1704 if (_seqFrameCounter < 0x174 || _seqFrameCounter > 0x1d7) { 1705 if (_seqFrameCounter < 0x84 || _seqFrameCounter > 0xe7) { 1706 _seqScrollTextCounter++; 1707 } 1708 } 1709 } 1710 1711 if (_seqFrameCounter > 0x31e) { 1712 seq_resetActiveWSA(0); 1713 seq_resetActiveWSA(1); 1714 _seqEndTime = 0; 1715 _screen->copyPage(2, 12); 1716 } 1717 1718 } else { 1719 seq_scrollPage();; 1720 } 1721 return 0; 1722 } 1723 1724 int KyraEngine_v2::seq_demoWharf2(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1725 if (frm == 69) 1726 _seqWsaCurrentFrame = 8; 1727 1728 return frm; 1729 } 1730 1731 int KyraEngine_v2::seq_demoDinob2(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1732 switch (frm) { 1733 case 19: 1734 seq_playTalkText(13); 1735 break; 1736 1737 case 54: 1738 seq_playTalkText(15); 1739 break; 1740 1741 case 61: 1742 seq_playTalkText(16); 1743 break; 1744 1745 case 69: 1746 seq_playTalkText(14); 1747 break; 1748 1749 case 77: 1750 seq_playTalkText(13); 1751 break; 1752 1753 case 79: 1754 _seqWsaCurrentFrame = 4; 1755 break; 1756 } 1757 1758 return frm; 1759 } 1760 1761 int KyraEngine_v2::seq_demoWater(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1762 if (frm == 1) 1763 seq_playTalkText(11); 1764 return frm; 1765 } 1766 1767 int KyraEngine_v2::seq_demoBail(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1768 return frm; 1769 } 1770 1771 int KyraEngine_v2::seq_demoDig(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1772 return frm; 1773 } 1774 1525 1775 uint32 KyraEngine_v2::seq_activeTextsTimeLeft() { 1526 1776 uint32 res = 0; 1527 1777 … … 1715 1965 1716 1966 assert(chatNum < _sequenceSoundListSize); 1717 1967 1718 if (chatNum < 12 )1968 if (chatNum < 12 && !_flags.isDemo) 1719 1969 seq_setTextEntry(chatNum, 160, 168, _sequenceStringsDuration[chatNum], 160); 1720 1970 1721 1971 _sound->voicePlay(_sequenceSoundList[chatNum]); … … 2027 2277 seq_resetAllTextEntries(); 2028 2278 seq_setTextEntry(strIndex, x, y, 0x80, 0x78); 2029 2279 seq_processText(); 2030 _screen->copyPage(2, 6);2031 2280 _screen->copyPage(2, 0); 2032 2281 _screen->updateScreen(); 2033 2282 _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[textcolor * 3]; … … 2040 2289 seq_resetAllTextEntries(); 2041 2290 seq_setTextEntry(strIndex, x, y, 0x80, 0x78); 2042 2291 seq_processText(); 2043 _screen->copyPage(2, 6);2044 2292 _screen->copyPage(2, 0); 2045 2293 _screen->updateScreen(); 2046 2294 _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[0x2f9] = 0; … … 2087 2335 if (frameTimeout > tm && chatTimeout > tm) 2088 2336 delay(MIN(frameTimeout - tm, chatTimeout - tm)); 2089 2337 2090 _screen->copyPage(2, 6);2091 2338 _screen->copyPage(2, 0); 2092 2339 _screen->updateScreen(); 2093 2340 curframe++; … … 2105 2352 _seqWsaCurrentFrame = curframe; 2106 2353 } 2107 2354 2355 void KyraEngine_v2::seq_displayScrollText(uint8 * data, const ScreenDim *d, int tempPage1, int tempPage2, int speed, 2356 int step, Screen::FontId fid1, Screen::FontId fid2, const uint8 *shapeData, const char *const *specialData) { 2357 2358 if (!data) 2359 return; 2360 2361 static const char mark[] = { 5, 13, 0}; 2362 2363 /*uint _creditsNumChars = d->unkC / (_screen->getFontWidth() + _screen->_charWidth); 2364 uint _creditsMaxNumLines = (d->h - _screen->_charOffset) / (_screen->getFontHeight() + _screen->_charOffset); 2365 uint _creditsMaxNumChars = (d->w << 3) / (_screen->getFontWidth() + _screen->_charWidth); */ 2366 2367 _screen->clearPage(tempPage1); 2368 _screen->clearPage(tempPage2); 2369 _screen->copyRegion(d->sx << 3, d->sy, d->sx << 3, d->sy, d->w << 3, d->h, 0, tempPage1); 2370 2371 uint8 * tmp = new uint8[397]; 2372 memset(tmp, 0, 397); 2373 uint8 ** tmpStringTable = new uint8*[35]; 2374 uint8 * ptr = data; 2375 int strTblIndex = 0; 2376 2377 bool loop = true; 2378 int cnt = 0; 2379 2380 while (loop) { 2381 uint32 endTime = _system->getMillis() + speed * _tickLength; 2382 2383 while (cnt < 35 && *ptr) { 2384 int m = cnt * 11; 2385 uint16 cH = cnt ? READ_LE_UINT16(&tmp[m + 2]) + tmp[m + 9] + (tmp[m + 9] >> 3) : d->h; 2386 2387 char *str = (char*) ptr; 2388 2389 ptr = (uint8*) strpbrk((const char *) str, mark); 2390 if (!ptr) 2391 ptr = (uint8 *) strchr((const char *) str, 0); 2392 2393 tmp[m + 19] = *ptr; 2394 *ptr = 0; 2395 if (tmp[m + 19]) 2396 ptr++; 2397 2398 tmp[m + 21] = (*str == 3 || *str == 4) ? tmp[m + 21] = *str++ : 0; 2399 2400 _screen->setFont(fid1); 2401 2402 if (*str == 1) { 2403 _screen->setFont(fid2); 2404 str++; 2405 } else if (*str == 2) { 2406 2407 str++; 2408 } 2409 2410 tmp[m + 20] = _screen->getFontHeight(); 2411 2412 WRITE_LE_UINT16(&tmp[m + 11], (tmp[m + 21] == 3) ? 157 - _screen->getTextWidth(str) : 2413 ((tmp[m + 21] == 4) ? 161 : (((d->w << 3) - _screen->getTextWidth(str)) >> 1) + 1)); 2414 2415 if (tmp[m + 8] == 5) 2416 cH -= (tmp[m + 9] + (tmp[m + 9] >> 3)); 2417 2418 WRITE_LE_UINT16(&tmp[m + 13], cH); 2419 WRITE_LE_UINT32(&tmp[m + 15], strTblIndex); 2420 tmpStringTable[strTblIndex] = (uint8*) str; 2421 strTblIndex = ++strTblIndex % 35; 2422 cnt++; 2423 } 2424 2425 _screen->copyRegion(d->sx << 3, d->sy, d->sx << 3, d->sy, d->w << 3, d->h, tempPage1, tempPage2); 2426 2427 int cnt2 = 0; 2428 bool palCycle = 0; 2429 2430 while (cnt2 < cnt) { 2431 int m = cnt2 * 11; 2432 char *str = (char*) tmpStringTable[READ_LE_UINT32(&tmp[m + 15])]; 2433 char *str2 = str; 2434 uint16 cW = READ_LE_UINT16(&tmp[m + 11]) - 10; 2435 uint16 cH = READ_LE_UINT16(&tmp[m + 13]); 2436 int x = (d->sx << 3) + cW; 2437 int y = d->sy + cH; 2438 int col1 = 255; 2439 2440 if (cH < d->h) { 2441 _screen->setCurPage(tempPage2); 2442 _screen->setFont(fid1); 2443 if (tmp[m + 20] != _screen->getFontHeight()) 2444 _screen->setFont(fid2); 2445 2446 if (specialData) { 2447 if (!strcmp(str, specialData[0])) { 2448 col1 = 112; 2449 char cChar[2] = " "; 2450 while (*str2) { 2451 cChar[0] = *str2; 2452 _screen->printText(cChar, x, y, col1++, 0); 2453 x += _screen->getCharWidth(*str2++); 2454 } 2455 palCycle = true; 2456 } else if (!strcmp(str, specialData[1])) { 2457 col1 = 133; 2458 char cChar[2] = " "; 2459 while (*str2) { 2460 cChar[0] = *str2; 2461 _screen->printText(cChar, x, y, col1--, 0); 2462 x += _screen->getCharWidth(*str2++); 2463 } 2464 palCycle = true; 2465 } else { 2466 _screen->printText(str, x, y, col1, 0); 2467 } 2468 } else { 2469 _screen->printText(str, x, y, col1, 0); 2470 } 2471 _screen->setCurPage(0); 2472 } 2473 2474 WRITE_LE_UINT16(&tmp[m + 13], READ_LE_UINT16(&tmp[m + 13]) - step); 2475 cnt2++; 2476 } 2477 2478 _screen->copyRegion(d->sx << 3, d->sy, d->sx << 3, d->sy, d->w << 3, d->h, tempPage2, 0); 2479 _screen->updateScreen(); 2480 2481 if ((int16) READ_LE_UINT16(&tmp[13]) < -10) { 2482 tmpStringTable[tmp[15]] += strlen((char*) tmpStringTable[tmp[15]]); 2483 tmpStringTable[tmp[15]][0] = tmp[19]; 2484 cnt--; 2485 memcpy(&tmp[11], &tmp[22], cnt * 11); 2486 } 2487 2488 if (palCycle) { 2489 for (int col = 133; col > 112; col--) 2490 memcpy(_screen->_currentPalette + (col * 3), _screen->_currentPalette + ((col - 1) * 3), 3); 2491 memcpy(_screen->_currentPalette + 336, _screen->_currentPalette + 399, 3); 2492 _screen->setScreenPalette(_screen->_currentPalette); 2493 } 2494 2495 delayUntil(endTime); 2496 2497 if ((cnt < 36) && ((d->sy + d->h) > (READ_LE_UINT16(&tmp[cnt * 11 + 2]) + tmp[cnt * 11 + 9])) && !_skipFlag) { 2498 _skipFlag=_skipFlag; 2499 delay(_tickLength * 500); 2500 cnt = 0; 2501 } 2502 2503 if (!cnt || _skipFlag) 2504 loop = false; 2505 } 2506 2507 _sound->beginFadeOut(); 2508 _screen->fadeToBlack(); 2509 2510 delete [] tmp; 2511 delete [] tmpStringTable; 2512 } 2513 2514 void KyraEngine_v2::seq_scrollPage() { 2515 int dstY, dstH, srcH; 2516 2517 static const ScreenDim d = { 0x00, 0x00, 0x28, 0x320, 0xFF, 0xFE, 0x00, 0x00 }; 2518 2519 if (_seqScrollTextCounter - 143 < 0) { 2520 dstY = 144 - _seqScrollTextCounter;; 2521 dstH = _seqScrollTextCounter;; 2522 srcH = 0; 2523 } else { 2524 dstY = 0; 2525 srcH = _seqScrollTextCounter - 144; 2526 dstH = (400 - srcH <= 144) ? 400 - srcH : 144; 2527 } 2528 2529 if (dstH > 0) { 2530 for (int i = 0; i < 4; i++) { 2531 int p = _screen->setCurPage(4); 2532 uint8 *def = _demoShapeDefs + 46 * i; 2533 _screen->drawBox(12, READ_LE_UINT16(def + 2) - 8, 28, READ_LE_UINT16(def + 2) + 8, 0); 2534 _screen->setCurPage(p); 2535 _screen->drawShape(4, _defaultShapeTable[READ_LE_UINT16(def) + READ_LE_UINT16(def + 6 + (READ_LE_UINT16(def + 4) << 1))], 12, READ_LE_UINT16(def + 2) - 8, 0, 0); 2536 if(_seqFrameCounter % 2 == 0){ 2537 uint16 frame = READ_LE_UINT16(def + 4); 2538 WRITE_LE_UINT16(def + 4, ++frame % 20); 2539 } 2540 } 2541 _screen->copyRegionEx(4, 0, srcH, 2, 2, dstY + 24, 320, dstH, &d); 2542 } 2543 } 2544 2108 2545 void KyraEngine_v2::seq_showStarcraftLogo() { 2109 2546 WSAMovieV2 * ci = new WSAMovieV2(this); 2110 2547 assert(ci); … … 2155 2592 _res->unloadAllPakFiles(); 2156 2593 _res->loadPakFile(StaticResource::staticDataFilename()); 2157 2594 _res->loadFileList(_sequencePakList, _sequencePakListSize); 2595 2596 int numShp = -1; 2597 if (_flags.isDemo) { 2598 int size; 2599 const uint8 * tmp = _staticres->loadRawData(k2SeqplayShapeDefs, size); 2600 _demoShapeDefs = new uint8[size]; 2601 memcpy(_demoShapeDefs, tmp, size); 2602 _staticres->unloadId(k2SeqplayShapeDefs); 2603 2604 uint8 *shp = _res->fileData("icons.shp", 0); 2605 uint32 outsize = READ_LE_UINT16(shp + 4); 2606 _newShapeFiledata = new uint8[outsize]; 2607 Screen::decodeFrame4(shp + 10, _newShapeFiledata, outsize); 2608 delete [] shp; 2609 2610 do { 2611 numShp++; 2612 _defaultShapeTable[numShp] = _screen->getPtrToShape(_newShapeFiledata, numShp); 2613 } while (_defaultShapeTable[numShp]); 2614 } 2158 2615 } 2159 2616 2160 2617 void KyraEngine_v2::seq_uninit() { … … 2169 2626 2170 2627 delete _seqWsa; 2171 2628 _seqWsa = NULL; 2629 2630 if (_demoShapeDefs) { 2631 delete [] _demoShapeDefs; 2632 _demoShapeDefs = 0; 2633 } 2172 2634 } 2173 2635 2174 2636 #pragma mark - -
staticres.cpp
228 228 // Sequence Player 229 229 { k2SeqplayPakFiles, kStringList, "S_PAKFILES.TXT" }, 230 230 { k2SeqplayCredits, kRawData, "S_CREDITS.TXT" }, 231 { k2SeqplayCreditsSpecial, kStringList, "S_CREDITS2.TXT" }, 231 232 { k2SeqplayStrings, kLanguageList, "S_STRINGS." }, 232 233 { k2SeqplaySfxFiles, kStringList, "S_SFXFILES.TXT" }, 233 234 { k2SeqplayTlkFiles, kLanguageList, "S_TLKFILES." }, … … 236 237 { k2SeqplayFinaleTracks, kStringList, "S_FINALE.TRA" }, 237 238 { k2SeqplayIntroCDA, kRawData, "S_INTRO.CDA" }, 238 239 { k2SeqplayFinaleCDA, kRawData, "S_FINALE.CDA" }, 240 { k2SeqplayShapeDefs, kRawData, "S_DEMO.SHP" }, 239 241 240 242 // Ingame 241 243 { k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" }, … … 990 992 &KyraEngine_v2::seq_introHand2, &KyraEngine_v2::seq_introHand3, 0 991 993 }; 992 994 993 /*static const Seqproc hofDemoSequenceCallbacks[] = { 994 0 // XXX 995 static const Seqproc hofDemoSequenceCallbacks[] = { 996 &KyraEngine_v2::seq_demoVirgin, &KyraEngine_v2::seq_demoWestwood, 997 &KyraEngine_v2::seq_demoTitle, &KyraEngine_v2::seq_demoHill, 998 &KyraEngine_v2::seq_demoOuthome, &KyraEngine_v2::seq_demoWharf, 999 &KyraEngine_v2::seq_demoDinob, &KyraEngine_v2::seq_demoFisher, 0 995 1000 }; 996 1001 997 1002 static const Seqproc hofDemoNestedSequenceCallbacks[] = { 998 0 // XXX 999 };*/ 1003 &KyraEngine_v2::seq_demoWharf2, &KyraEngine_v2::seq_demoDinob2, 1004 &KyraEngine_v2::seq_demoWater, &KyraEngine_v2::seq_demoBail, 1005 &KyraEngine_v2::seq_demoDig, 0 1006 }; 1000 1007 1001 1008 const uint16 *hdr = (const uint16 *) seqData; 1002 1009 uint16 numSeq = READ_LE_UINT16(hdr++); 1003 1010 uint16 hdrSize = READ_LE_UINT16(hdr) - 1; 1004 1011 1005 const Seqproc *cb = hofSequenceCallbacks;1006 const Seqproc *ncb = hofNestedSequenceCallbacks;1012 const Seqproc *cb = (_flags.isDemo && !_flags.isTalkie) ? hofDemoSequenceCallbacks : hofSequenceCallbacks; 1013 const Seqproc *ncb = (_flags.isDemo && !_flags.isTalkie) ? hofDemoNestedSequenceCallbacks : hofNestedSequenceCallbacks; 1007 1014 1008 1015 _sequences = new Sequence[numSeq]; 1009 1016 for (int i = 0; i < numSeq; i++) {