| 814 | void KyraEngine::s1_wsaOpen() { |
| 815 | uint8 wsaObj = *_seqData++; |
| 816 | assert(wsaObj < 12); |
| 817 | uint8 offscreenDecode = *_seqData++; |
| 818 | _seqWsaCurDecodePage = _seqMovies[wsaObj].page = (offscreenDecode == 0) ? 0 : 3; |
| 819 | if (_game == KYRA1DEMO) { |
| 820 | _seqMovies[wsaObj].wsa = wsa_open(_seq_demo_WSATable[wsaObj], offscreenDecode, 0); |
| 821 | } else { |
| 822 | _seqMovies[wsaObj].wsa = wsa_open(_seq_WSATable[wsaObj], offscreenDecode, 0); |
| 823 | } |
| 824 | _seqMovies[wsaObj].frame = 0; |
| 825 | _seqMovies[wsaObj].numFrames = wsa_getNumFrames(_seqMovies[wsaObj].wsa) - 1; |
| 826 | } |
| 827 | |
| 828 | void KyraEngine::s1_wsaClose() { |
| 829 | uint8 wsaObj = *_seqData++; |
| 830 | assert(wsaObj < 12); |
| 831 | if (_seqMovies[wsaObj].wsa) { |
| 832 | wsa_close(_seqMovies[wsaObj].wsa); |
| 833 | _seqMovies[wsaObj].wsa = 0; |
| 834 | } |
| 835 | } |
| 836 | |
| 837 | void KyraEngine::s1_wsaPlayFrame() { |
| 838 | uint8 wsaObj = *_seqData++; |
| 839 | assert(wsaObj < 12); |
| 840 | int16 frame = (int8)*_seqData++; |
| 841 | _seqMovies[wsaObj].pos.x = READ_LE_UINT16(_seqData); _seqData += 2; |
| 842 | _seqMovies[wsaObj].pos.y = *_seqData++; |
| 843 | wsa_play(_seqMovies[wsaObj].wsa, frame, _seqMovies[wsaObj].pos.x, _seqMovies[wsaObj].pos.y, _seqMovies[wsaObj].page); |
| 844 | _seqMovies[wsaObj].frame = frame; |
| 845 | } |
| 846 | |
| 847 | void KyraEngine::s1_wsaPlayNextFrame() { |
| 848 | uint8 wsaObj = *_seqData++; |
| 849 | assert(wsaObj < 12); |
| 850 | int16 frame = ++_seqMovies[wsaObj].frame; |
| 851 | if (frame > _seqMovies[wsaObj].numFrames) { |
| 852 | frame = 0; |
| 853 | _seqMovies[wsaObj].frame = 0; |
| 854 | } |
| 855 | wsa_play(_seqMovies[wsaObj].wsa, frame, _seqMovies[wsaObj].pos.x, _seqMovies[wsaObj].pos.y, _seqMovies[wsaObj].page); |
| 856 | } |
| 857 | |
| 858 | void KyraEngine::s1_wsaPlayPrevFrame() { |
| 859 | uint8 wsaObj = *_seqData++; |
| 860 | assert(wsaObj < 12); |
| 861 | int16 frame = --_seqMovies[wsaObj].frame; |
| 862 | if (frame < 0) { |
| 863 | frame = _seqMovies[wsaObj].numFrames; |
| 864 | _seqMovies[wsaObj].frame = frame; |
| 865 | } else { |
| 866 | wsa_play(_seqMovies[wsaObj].wsa, frame, _seqMovies[wsaObj].pos.x, _seqMovies[wsaObj].pos.y, _seqMovies[wsaObj].page); |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | void KyraEngine::s1_drawShape() { |
| 871 | uint8 shapeNum = *_seqData++; |
| 872 | int x = READ_LE_UINT16(_seqData); _seqData += 2; |
| 873 | int y = *_seqData++; |
| 874 | _screen->drawShape(2, _seq_handShapes[shapeNum], x, y, 0, 0, 0); |
| 875 | } |
| 876 | |
| 877 | void KyraEngine::s1_maybeWaitTicks() { |
| 878 | uint16 a = READ_LE_UINT16(_seqData); _seqData += 2; |
| 879 | warning("STUB: s1_maybeWaitTicks(%d)\n", a); |
| 880 | } |
| 881 | |
| 882 | void KyraEngine::s1_waitTicks() { |
| 883 | uint16 ticks = READ_LE_UINT16(_seqData); _seqData += 2; |
| 884 | waitTicks(ticks); |
| 885 | } |
| 886 | |
| 887 | void KyraEngine::s1_copyWaitTicks() { |
| 888 | seq_copyView(); |
| 889 | s1_waitTicks(); |
| 890 | } |
| 891 | |
| 892 | void KyraEngine::s1_shuffleScreen() { |
| 893 | _screen->shuffleScreen(0, 16, 320, 128, 2, 0, 0, false); |
| 894 | _screen->_curPage = 2; |
| 895 | } |
| 896 | |
| 897 | void KyraEngine::s1_copyView() { |
| 898 | seq_copyView(); |
| 899 | } |
| 900 | |
| 901 | void KyraEngine::s1_loopInit() { |
| 902 | uint8 seqLoop = *_seqData++; |
| 903 | if (seqLoop < 20) { |
| 904 | _seqLoopTable[seqLoop].ptr = _seqData; |
| 905 | } else { |
| 906 | _seqQuitFlag = true; |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | void KyraEngine::s1_maybeLoopInc() { |
| 911 | uint8 a = *_seqData++; |
| 912 | int16 b = (int16)READ_LE_UINT16(_seqData); _seqData += 2; |
| 913 | warning("STUB: s1_maybeLoopInc(%d, %d)\n", a, b); |
| 914 | } |
| 915 | |
| 916 | void KyraEngine::s1_loopInc() { |
| 917 | uint8 seqLoop = *_seqData++; |
| 918 | uint16 seqLoopCount = READ_LE_UINT16(_seqData); _seqData += 2; |
| 919 | if (_seqLoopTable[seqLoop].count == 0xFFFF) { |
| 920 | _seqLoopTable[seqLoop].count = seqLoopCount - 1; |
| 921 | _seqData = _seqLoopTable[seqLoop].ptr; |
| 922 | } else if (_seqLoopTable[seqLoop].count == 0) { |
| 923 | _seqLoopTable[seqLoop].count = 0xFFFF; |
| 924 | _seqLoopTable[seqLoop].ptr = 0; |
| 925 | } else { |
| 926 | --_seqLoopTable[seqLoop].count; |
| 927 | _seqData = _seqLoopTable[seqLoop].ptr; |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | void KyraEngine::s1_skip() { |
| 932 | uint8 a = *_seqData++; |
| 933 | warning("STUB: s1_skip(%d)\n", a); |
| 934 | } |
| 935 | |
| 936 | void KyraEngine::s1_loadPalette() { |
| 937 | uint8 colNum = *_seqData++; |
| 938 | uint32 fileSize; |
| 939 | uint8 *srcData; |
| 940 | if (_game == KYRA1DEMO) { |
| 941 | srcData = _res->fileData(_seq_demo_COLTable[colNum], &fileSize); |
| 942 | } else { |
| 943 | srcData = _res->fileData(_seq_COLTable[colNum], &fileSize); |
| 944 | } |
| 945 | memcpy(_screen->_currentPalette, srcData, fileSize); |
| 946 | delete[] srcData; |
| 947 | } |
| 948 | |
| 949 | void KyraEngine::s1_loadBitmap() { |
| 950 | uint8 cpsNum = *_seqData++; |
| 951 | loadBitmap(_seq_CPSTable[cpsNum], 3, 3, 0); |
| 952 | } |
| 953 | |
| 954 | void KyraEngine::s1_fadeToBlack() { |
| 955 | _screen->fadeToBlack(); |
| 956 | } |
| 957 | |
| 958 | void KyraEngine::s1_printText() { |
| 959 | static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 }; |
| 960 | uint8 txt = *_seqData++; |
| 961 | _screen->fillRect(0, 180, 319, 195, 12); |
| 962 | _screen->setTextColorMap(colorMap); |
| 963 | if (!_seqDisplayTextFlag) { |
| 964 | const char *str = _seq_textsTableEN[txt]; |
| 965 | int x = (Screen::SCREEN_W - _screen->getTextWidth(str)) / 2; |
| 966 | _screen->printText(str, x, 180, 0xF, 0xC); |
| 967 | } else { |
| 968 | _seqDisplayedTextTimer = _system->getMillis() + 1000 / 60; |
| 969 | _seqDisplayedText = txt; |
| 970 | _seqDisplayedChar = 0; |
| 971 | const char *str = _seq_textsTableEN[_seqDisplayedText]; |
| 972 | _seqDisplayedTextX = (Screen::SCREEN_W - _screen->getTextWidth(str)) / 2; |
| 973 | } |
| 974 | } |
| 975 | |
| 976 | void KyraEngine::s1_printTalkText() { |
| 977 | uint8 txt = *_seqData++; |
| 978 | int x = READ_LE_UINT16(_seqData); _seqData += 2; |
| 979 | int y = *_seqData++; |
| 980 | uint8 fillColor = *_seqData++; |
| 981 | int b; |
| 982 | if (_seqTalkTextPrinted && !_seqTalkTextRestored) { |
| 983 | if (_seqWsaCurDecodePage != 0) { |
| 984 | b = 2; |
| 985 | } else { |
| 986 | b = 0; |
| 987 | } |
| 988 | restoreTalkTextMessageBkgd(2, b); |
| 989 | } |
| 990 | _seqTalkTextPrinted = true; |
| 991 | _seqTalkTextRestored = false; |
| 992 | if (_seqWsaCurDecodePage != 0) { |
| 993 | b = 2; |
| 994 | } else { |
| 995 | b = 0; |
| 996 | } |
| 997 | printTalkTextMessage(_seq_textsTableEN[txt], x, y, fillColor, b, 2); |
| 998 | } |
| 999 | |
| 1000 | void KyraEngine::s1_restoreTalkText() { |
| 1001 | if (_seqTalkTextPrinted && !_seqTalkTextRestored) { |
| 1002 | int b; |
| 1003 | if (_seqWsaCurDecodePage != 0) { |
| 1004 | b = 2; |
| 1005 | } else { |
| 1006 | b = 0; |
| 1007 | } |
| 1008 | restoreTalkTextMessageBkgd(2, b); |
| 1009 | _seqTalkTextRestored = true; |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | void KyraEngine::s1_clearCurrentScreen() { |
| 1014 | _screen->fillRect(10, 180, 319, 196, 0xC); |
| 1015 | } |
| 1016 | |
| 1017 | void KyraEngine::s1_break() { |
| 1018 | // Do nothing |
| 1019 | } |
| 1020 | |
| 1021 | void KyraEngine::s1_fadeFromBlack() { |
| 1022 | _screen->fadeFromBlack(); |
| 1023 | } |
| 1024 | |
| 1025 | void KyraEngine::s1_copyRegion() { |
| 1026 | uint8 srcPage = *_seqData++; |
| 1027 | uint8 dstPage = *_seqData++; |
| 1028 | _screen->copyRegion(0, 0, 0, 0, 320, 200, srcPage, dstPage); |
| 1029 | } |
| 1030 | |
| 1031 | void KyraEngine::s1_copyRegionSpecial() { |
| 1032 | static const uint8 colorMap[] = { 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0 }; |
| 1033 | const char *copyStr = "Copyright (c) 1992 Westwood Studios"; |
| 1034 | const int x = (Screen::SCREEN_W - _screen->getTextWidth(copyStr)) / 2; |
| 1035 | const int y = 179; |
| 1036 | |
| 1037 | uint8 so = *_seqData++; |
| 1038 | switch (so) { |
| 1039 | case 0: |
| 1040 | _screen->copyRegion(0, 0, 0, 47, 320, 77, 2, 0); |
| 1041 | break; |
| 1042 | case 1: |
| 1043 | _screen->copyRegion(0, 0, 0, 47, 320, 56, 2, 0); |
| 1044 | break; |
| 1045 | case 2: |
| 1046 | _screen->copyRegion(107, 72, 107, 72, 43, 87, 2, 0); |
| 1047 | _screen->copyRegion(130, 159, 130, 159, 35, 17, 2, 0); |
| 1048 | _screen->copyRegion(165, 105, 165, 105, 32, 9, 2, 0); |
| 1049 | _screen->copyRegion(206, 83, 206, 83, 94, 93, 2, 0); |
| 1050 | break; |
| 1051 | case 3: |
| 1052 | _screen->copyRegion(152, 56, 152, 56, 48, 48, 2, 0); |
| 1053 | break; |
| 1054 | case 4: |
| 1055 | _screen->_charWidth = -2; |
| 1056 | _screen->setTextColorMap(colorMap); |
| 1057 | _screen->printText(copyStr, x + 1, y + 1, 0xB, 0xC); |
| 1058 | _screen->printText(copyStr, x, y, 0xF, 0xC); |
| 1059 | break; |
| 1060 | case 5: |
| 1061 | _screen->_curPage = 2; |
| 1062 | break; |
| 1063 | default: |
| 1064 | error("Invalid subopcode %d for s1_copyRegionSpecial", so); |
| 1065 | break; |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | void KyraEngine::s1_fillRect() { |
| 1070 | int x1 = READ_LE_UINT16(_seqData); _seqData += 2; |
| 1071 | int y1 = *_seqData++; |
| 1072 | int x2 = READ_LE_UINT16(_seqData); _seqData += 2; |
| 1073 | int y2 = *_seqData++; |
| 1074 | uint8 color = *_seqData++; |
| 1075 | uint8 page = *_seqData++; |
| 1076 | _screen->fillRect(x1, y1, x2, y2, color, page); |
| 1077 | } |
| 1078 | |
| 1079 | void KyraEngine::s1_soundUnk1() { |
| 1080 | uint8 param = *_seqData++; |
| 1081 | waitTicks(3); |
| 1082 | snd_playSoundEffect(param); |
| 1083 | } |
| 1084 | |
| 1085 | void KyraEngine::s1_soundUnk2() { |
| 1086 | uint8 param = *_seqData++; |
| 1087 | snd_seqMessage(param); |
| 1088 | } |
| 1089 | |
| 1090 | void KyraEngine::s1_allocTempBuffer() { |
| 1091 | if (_game == KYRA1DEMO) { |
| 1092 | _seqQuitFlag = true; |
| 1093 | } else { |
| 1094 | // allocate offscreen buffer, not needed |
| 1095 | } |
| 1096 | } |
| 1097 | |
| 1098 | void KyraEngine::s1_textDisplayEnable() { |
| 1099 | _seqDisplayTextFlag = true; |
| 1100 | } |
| 1101 | |
| 1102 | void KyraEngine::s1_textDisplayDisable() { |
| 1103 | _seqDisplayTextFlag = false; |
| 1104 | } |
| 1105 | |
| 1106 | void KyraEngine::s1_endOfScript() { |
| 1107 | _seqQuitFlag = true; |
| 1108 | } |
| 1109 | |
| 1110 | void KyraEngine::s1_miscUnk1() { |
| 1111 | warning("STUB: s1_miscUnk1\n"); |
| 1112 | } |
| 1113 | |
| 1114 | void KyraEngine::s1_miscUnk2() { |
| 1115 | uint8 a = *_seqData++; |
| 1116 | warning("STUB: s1_miscUnk2(%d)\n", a); |
| 1117 | } |
| 1118 | |
| 1119 | void KyraEngine::s1_miscUnk3() { |
| 1120 | warning("STUB: s1_miscUnk3\n"); |
| 1121 | } |
| 1122 | |
| 1123 | void KyraEngine::s1_miscUnk4() { |
| 1124 | uint8 a = *_seqData++; |
| 1125 | warning("STUB: s1_miscUnk4(%d)\n", a); |
| 1126 | } |
| 1127 | |
| 1129 | static SeqEntry floppySeqProcs[] = { |
| 1130 | // 0x00 |
| 1131 | SEQOP(3, s1_wsaOpen), |
| 1132 | SEQOP(2, s1_wsaClose), |
| 1133 | SEQOP(6, s1_wsaPlayFrame), |
| 1134 | SEQOP(2, s1_wsaPlayNextFrame), |
| 1135 | // 0x04 |
| 1136 | SEQOP(2, s1_wsaPlayPrevFrame), |
| 1137 | SEQOP(5, s1_drawShape), |
| 1138 | SEQOP(3, s1_waitTicks), |
| 1139 | SEQOP(3, s1_copyWaitTicks), |
| 1140 | // 0x08 |
| 1141 | SEQOP(1, s1_shuffleScreen), |
| 1142 | SEQOP(1, s1_copyView), |
| 1143 | SEQOP(2, s1_loopInit), |
| 1144 | SEQOP(4, s1_loopInc), |
| 1145 | // 0x0C |
| 1146 | SEQOP(2, s1_loadPalette), |
| 1147 | SEQOP(2, s1_loadBitmap), |
| 1148 | SEQOP(1, s1_fadeToBlack), |
| 1149 | SEQOP(2, s1_printText), |
| 1150 | // 0x10 |
| 1151 | SEQOP(6, s1_printTalkText), |
| 1152 | SEQOP(1, s1_restoreTalkText), |
| 1153 | SEQOP(1, s1_clearCurrentScreen), |
| 1154 | SEQOP(1, s1_break), |
| 1155 | // 0x14 |
| 1156 | SEQOP(1, s1_fadeFromBlack), |
| 1157 | SEQOP(3, s1_copyRegion), |
| 1158 | SEQOP(2, s1_copyRegionSpecial), |
| 1159 | SEQOP(9, s1_fillRect), |
| 1160 | // 0x18 |
| 1161 | SEQOP(2, s1_soundUnk1), |
| 1162 | SEQOP(2, s1_soundUnk2), |
| 1163 | SEQOP(1, s1_allocTempBuffer), |
| 1164 | SEQOP(1, s1_textDisplayEnable), |
| 1165 | // 0x1C |
| 1166 | SEQOP(1, s1_textDisplayDisable), |
| 1167 | SEQOP(1, s1_endOfScript) |
| 1168 | }; |
| 1169 | |
| 1170 | #if 0 |
| 1171 | static SeqEntry cdromSeqProcs[] = { |
| 1172 | // 0x00 |
| 1173 | SEQOP(3, s1_wsaOpen), |
| 1174 | SEQOP(2, s1_wsaClose), |
| 1175 | SEQOP(6, s1_wsaPlayFrame), |
| 1176 | SEQOP(2, s1_wsaPlayNextFrame), |
| 1177 | // 0x04 |
| 1178 | SEQOP(2, s1_wsaPlayPrevFrame), |
| 1179 | SEQOP(5, s1_drawShape), |
| 1180 | SEQOP(3, s1_maybeWaitTicks), |
| 1181 | SEQOP(3, s1_waitTicks), |
| 1182 | // 0x08 |
| 1183 | SEQOP(3, s1_copyWaitTicks), |
| 1184 | SEQOP(1, s1_shuffleScreen), |
| 1185 | SEQOP(1, s1_copyView), |
| 1186 | SEQOP(2, s1_loopInit), |
| 1187 | // 0x0C |
| 1188 | SEQOP(4, s1_maybeLoopInc), |
| 1189 | SEQOP(4, s1_maybeLoopInc), // Again? |
| 1190 | SEQOP(2, s1_skip), |
| 1191 | SEQOP(2, s1_loadPalette), |
| 1192 | // 0x10 |
| 1193 | SEQOP(2, s1_loadBitmap), |
| 1194 | SEQOP(1, s1_fadeToBlack), |
| 1195 | SEQOP(2, s1_printText), |
| 1196 | SEQOP(6, s1_printTalkText), |
| 1197 | // 0x14 |
| 1198 | SEQOP(1, s1_restoreTalkText), |
| 1199 | SEQOP(1, s1_clearCurrentScreen), |
| 1200 | SEQOP(1, s1_break), |
| 1201 | SEQOP(1, s1_fadeFromBlack), |
| 1202 | // 0x18 |
| 1203 | SEQOP(3, s1_copyRegion), |
| 1204 | SEQOP(2, s1_copyRegionSpecial), |
| 1205 | SEQOP(9, s1_fillRect), |
| 1206 | SEQOP(2, s1_soundUnk1), |
| 1207 | // 0x1C |
| 1208 | SEQOP(2, s1_soundUnk2), |
| 1209 | SEQOP(1, s1_allocTempBuffer), |
| 1210 | SEQOP(1, s1_textDisplayEnable), |
| 1211 | SEQOP(1, s1_textDisplayDisable), |
| 1212 | // 0x20 |
| 1213 | SEQOP(1, s1_endOfScript), |
| 1214 | SEQOP(1, s1_miscUnk1), |
| 1215 | SEQOP(2, s1_miscUnk2), |
| 1216 | SEQOP(1, s1_miscUnk3), |
| 1217 | // 0x24 |
| 1218 | SEQOP(2, s1_miscUnk4) |
| 1219 | }; |
| 1220 | #endif |
| 1221 | |
| 1222 | const SeqEntry* commands; |
| 1223 | int numCommands; |
| 1224 | |
867 | | uint8 seqCode = *seqData++; |
868 | | debug(5, "seqCode = %d", seqCode); |
869 | | switch (seqCode) { |
870 | | case 0: { |
871 | | uint8 wsaObj = *seqData++; |
872 | | assert(wsaObj < 12); |
873 | | uint8 offscreenDecode = *seqData++; |
874 | | wsaCurDecodePage = wsaDecodePage[wsaObj] = (offscreenDecode == 0) ? 0 : 3; |
875 | | if (_game == KYRA1DEMO) { |
876 | | wsaMovieTable[wsaObj] = wsa_open(_seq_demo_WSATable[wsaObj], offscreenDecode, 0); |
877 | | } else { |
878 | | wsaMovieTable[wsaObj] = wsa_open(_seq_WSATable[wsaObj], offscreenDecode, 0); |
879 | | } |
880 | | wsaCurFramesTable[wsaObj] = 0; |
881 | | wsaNumFramesTable[wsaObj] = wsa_getNumFrames(wsaMovieTable[wsaObj]) - 1; |
882 | | } |
883 | | break; |
884 | | case 1: { |
885 | | uint8 wsaObj = *seqData++; |
886 | | assert(wsaObj < 12); |
887 | | if (wsaMovieTable[wsaObj]) { |
888 | | wsa_close(wsaMovieTable[wsaObj]); |
889 | | wsaMovieTable[wsaObj] = 0; |
890 | | } |
891 | | } |
892 | | break; |
893 | | case 2: { |
894 | | uint8 wsaObj = *seqData++; |
895 | | assert(wsaObj < 12); |
896 | | int16 frame = (int8)*seqData++; |
897 | | wsaXPosTable[wsaObj] = READ_LE_UINT16(seqData); seqData += 2; |
898 | | wsaYPosTable[wsaObj] = *seqData++; |
899 | | wsa_play(wsaMovieTable[wsaObj], frame, wsaXPosTable[wsaObj], wsaYPosTable[wsaObj], wsaDecodePage[wsaObj]); |
900 | | wsaCurFramesTable[wsaObj] = frame; |
901 | | } |
902 | | break; |
903 | | case 3: { |
904 | | uint8 wsaObj = *seqData++; |
905 | | assert(wsaObj < 12); |
906 | | ++wsaCurFramesTable[wsaObj]; |
907 | | int16 frame = wsaCurFramesTable[wsaObj]; |
908 | | if (frame > wsaNumFramesTable[wsaObj]) { |
909 | | frame = 0; |
910 | | wsaCurFramesTable[wsaObj] = 0; |
911 | | } |
912 | | wsa_play(wsaMovieTable[wsaObj], frame, wsaXPosTable[wsaObj], wsaYPosTable[wsaObj], wsaDecodePage[wsaObj]); |
913 | | } |
914 | | break; |
915 | | case 4: { |
916 | | uint8 wsaObj = *seqData++; |
917 | | assert(wsaObj < 12); |
918 | | --wsaCurFramesTable[wsaObj]; |
919 | | int16 frame = wsaCurFramesTable[wsaObj]; |
920 | | if (wsaCurFramesTable[wsaObj] < 0) { |
921 | | frame = wsaNumFramesTable[wsaObj]; |
922 | | wsaCurFramesTable[wsaObj] = wsaNumFramesTable[wsaObj]; |
923 | | } else { |
924 | | wsa_play(wsaMovieTable[wsaObj], frame, wsaXPosTable[wsaObj], wsaYPosTable[wsaObj], wsaDecodePage[wsaObj]); |
925 | | } |
926 | | } |
927 | | break; |
928 | | case 5: { |
929 | | uint8 shapeNum = *seqData++; |
930 | | int x = READ_LE_UINT16(seqData); seqData += 2; |
931 | | int y = *seqData++; |
932 | | _screen->drawShape(2, _seq_handShapes[shapeNum], x, y, 0, 0, 0); |
933 | | } |
934 | | break; |
935 | | case 6: |
936 | | case 7: { |
937 | | if (seqCode == 7) { |
938 | | seq_copyView(); |
939 | | } |
940 | | uint16 ticks = READ_LE_UINT16(seqData); seqData += 2; |
941 | | waitTicks(ticks); |
942 | | } |
943 | | break; |
944 | | case 8: |
945 | | _screen->shuffleScreen(0, 16, 320, 128, 2, 0, 0, false); |
946 | | _screen->_curPage = 2; |
947 | | break; |
948 | | case 9: |
949 | | seq_copyView(); |
950 | | break; |
951 | | case 10: { |
952 | | uint8 seqLoop = *seqData++; |
953 | | if (seqLoop < 20) { |
954 | | seqLoopTable[seqLoop].ptr = seqData; |
955 | | } else { |
956 | | quitFlag = true; |
957 | | } |
958 | | } |
959 | | break; |
960 | | case 11: { |
961 | | uint8 seqLoop = *seqData++; |
962 | | uint16 seqLoopCount = READ_LE_UINT16(seqData); seqData += 2; |
963 | | if (seqLoopTable[seqLoop].count == 0xFFFF) { |
964 | | seqLoopTable[seqLoop].count = seqLoopCount - 1; |
965 | | seqData = seqLoopTable[seqLoop].ptr; |
966 | | } else if (seqLoopTable[seqLoop].count == 0) { |
967 | | seqLoopTable[seqLoop].count = 0xFFFF; |
968 | | seqLoopTable[seqLoop].ptr = 0; |
969 | | } else { |
970 | | --seqLoopTable[seqLoop].count; |
971 | | seqData = seqLoopTable[seqLoop].ptr; |
972 | | } |
973 | | } |
974 | | break; |
975 | | case 12: { |
976 | | uint8 colNum = *seqData++; |
977 | | uint32 fileSize; |
978 | | uint8 *srcData; |
979 | | if (_game == KYRA1DEMO) { |
980 | | srcData = _res->fileData(_seq_demo_COLTable[colNum], &fileSize); |
981 | | } else { |
982 | | srcData = _res->fileData(_seq_COLTable[colNum], &fileSize); |
983 | | } |
984 | | memcpy(_screen->_currentPalette, srcData, fileSize); |
985 | | delete[] srcData; |
986 | | } |
987 | | break; |
988 | | case 13: { |
989 | | uint8 cpsNum = *seqData++; |
990 | | loadBitmap(_seq_CPSTable[cpsNum], 3, 3, 0); |
991 | | } |
992 | | break; |
993 | | case 14: |
994 | | _screen->fadeToBlack(); |
995 | | break; |
996 | | case 15: { |
997 | | static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 }; |
998 | | uint8 txt = *seqData++; |
999 | | _screen->fillRect(0, 180, 319, 195, 12); |
1000 | | _screen->setTextColorMap(colorMap); |
1001 | | if (!displayTextFlag) { |
1002 | | const char *str = _seq_textsTableEN[txt]; |
1003 | | int x = (Screen::SCREEN_W - _screen->getTextWidth(str)) / 2; |
1004 | | _screen->printText(str, x, 180, 0xF, 0xC); |
1005 | | } else { |
1006 | | displayedTextTimer = _system->getMillis() + 1000 / 60; |
1007 | | displayedText = txt; |
1008 | | displayedChar = 0; |
1009 | | const char *str = _seq_textsTableEN[displayedText]; |
1010 | | displayedTextX = (Screen::SCREEN_W - _screen->getTextWidth(str)) / 2; |
1011 | | } |
1012 | | } |
1013 | | break; |
1014 | | case 16: { |
1015 | | uint8 txt = *seqData++; |
1016 | | int x = READ_LE_UINT16(seqData); seqData += 2; |
1017 | | int y = *seqData++; |
1018 | | uint8 fillColor = *seqData++; |
1019 | | int b; |
1020 | | if (talkTextPrinted && !talkTextRestored) { |
1021 | | if (wsaCurDecodePage != 0) { |
1022 | | b = 2; |
1023 | | } else { |
1024 | | b = 0; |
1025 | | } |
1026 | | restoreTalkTextMessageBkgd(2, b); |
1027 | | } |
1028 | | talkTextPrinted = true; |
1029 | | talkTextRestored = false; |
1030 | | if (wsaCurDecodePage != 0) { |
1031 | | b = 2; |
1032 | | } else { |
1033 | | b = 0; |
1034 | | } |
1035 | | printTalkTextMessage(_seq_textsTableEN[txt], x, y, fillColor, b, 2); |
1036 | | } |
1037 | | break; |
1038 | | case 17: |
1039 | | if (talkTextPrinted && !talkTextRestored) { |
1040 | | int b; |
1041 | | if (wsaCurDecodePage != 0) { |
1042 | | b = 2; |
1043 | | } else { |
1044 | | b = 0; |
1045 | | } |
1046 | | restoreTalkTextMessageBkgd(2, b); |
1047 | | talkTextRestored = true; |
1048 | | } |
1049 | | break; |
1050 | | case 18: |
1051 | | _screen->fillRect(10, 180, 319, 196, 0xC); |
1052 | | break; |
1053 | | case 19: |
1054 | | break; |
1055 | | case 20: |
1056 | | _screen->fadeFromBlack(); |
1057 | | break; |
1058 | | case 21: { |
1059 | | uint8 srcPage = *seqData++; |
1060 | | uint8 dstPage = *seqData++; |
1061 | | _screen->copyRegion(0, 0, 0, 0, 320, 200, srcPage, dstPage); |
1062 | | } |
1063 | | break; |
1064 | | case 22: { |
1065 | | uint8 so = *seqData++; |
1066 | | switch (so) { |
1067 | | case 0: |
1068 | | _screen->copyRegion(0, 0, 0, 47, 320, 77, 2, 0); |
1069 | | break; |
1070 | | case 1: |
1071 | | _screen->copyRegion(0, 0, 0, 47, 320, 56, 2, 0); |
1072 | | break; |
1073 | | case 2: |
1074 | | _screen->copyRegion(107, 72, 107, 72, 43, 87, 2, 0); |
1075 | | _screen->copyRegion(130, 159, 130, 159, 35, 17, 2, 0); |
1076 | | _screen->copyRegion(165, 105, 165, 105, 32, 9, 2, 0); |
1077 | | _screen->copyRegion(206, 83, 206, 83, 94, 93, 2, 0); |
1078 | | break; |
1079 | | case 3: |
1080 | | _screen->copyRegion(152, 56, 152, 56, 48, 48, 2, 0); |
1081 | | break; |
1082 | | case 4: { |
1083 | | static const uint8 colorMap[] = { 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0 }; |
1084 | | _screen->_charWidth = -2; |
1085 | | const char *copyStr = "Copyright (c) 1992 Westwood Studios"; |
1086 | | _screen->setTextColorMap(colorMap); |
1087 | | const int x = (Screen::SCREEN_W - _screen->getTextWidth(copyStr)) / 2; |
1088 | | const int y = 179; |
1089 | | _screen->printText(copyStr, x + 1, y + 1, 0xB, 0xC); |
1090 | | _screen->printText(copyStr, x, y, 0xF, 0xC); |
1091 | | } |
1092 | | break; |
1093 | | case 5: |
1094 | | _screen->_curPage = 2; |
1095 | | break; |
1096 | | default: |
1097 | | error("Invalid subopcode %d for sequence opcode 22", so); |
1098 | | break; |
1099 | | } |
1100 | | } |
1101 | | break; |
1102 | | case 23: { |
1103 | | int x1 = READ_LE_UINT16(seqData); seqData += 2; |
1104 | | int y1 = *seqData++; |
1105 | | int x2 = READ_LE_UINT16(seqData); seqData += 2; |
1106 | | int y2 = *seqData++; |
1107 | | uint8 color = *seqData++; |
1108 | | uint8 page = *seqData++; |
1109 | | _screen->fillRect(x1, y1, x2, y2, color, page); |
1110 | | } |
1111 | | break; |
1112 | | case 24: { // sound related |
1113 | | uint8 param = *seqData++; |
1114 | | waitTicks(3); |
1115 | | snd_playSoundEffect(param); |
1116 | | } |
1117 | | break; |
1118 | | case 25: { // sound related |
1119 | | uint8 param = *seqData++; |
1120 | | snd_seqMessage(param); |
1121 | | } |
1122 | | break; |
1123 | | case 26: |
1124 | | if (_game == KYRA1DEMO) { |
1125 | | quitFlag = true; |
1126 | | } else { |
1127 | | // allocate offscreen buffer, not needed |
1128 | | } |
1129 | | break; |
1130 | | case 27: |
1131 | | displayTextFlag = true; |
1132 | | break; |
1133 | | case 28: |
1134 | | displayTextFlag = false; |
1135 | | break; |
1136 | | case 29: |
1137 | | quitFlag = true; |
1138 | | break; |
1139 | | default: |
| 1281 | |
| 1282 | uint8 seqCode = *_seqData++; |
| 1283 | if (seqCode < numCommands) { |
| 1284 | SeqProc currentProc = commands[seqCode].proc; |
| 1285 | debug(5, "seqCode = %d (%s)", seqCode, commands[seqCode].desc); |
| 1286 | (this->*currentProc)(); |
| 1287 | } else { |