diff options
author | Oliver Kiehl | 2003-04-07 20:44:52 +0000 |
---|---|---|
committer | Oliver Kiehl | 2003-04-07 20:44:52 +0000 |
commit | 17f53e4c1c73b193345bad68255dbe7e0a2e5ce8 (patch) | |
tree | b696c63bdfbc0fa6ff48a92dc61ddc2b808ef8cb /sky | |
parent | 6fc83fa9057a8f4cbb537662433c5b6039c99b67 (diff) | |
download | scummvm-rg350-17f53e4c1c73b193345bad68255dbe7e0a2e5ce8.tar.gz scummvm-rg350-17f53e4c1c73b193345bad68255dbe7e0a2e5ce8.tar.bz2 scummvm-rg350-17f53e4c1c73b193345bad68255dbe7e0a2e5ce8.zip |
restructure
svn-id: r6934
Diffstat (limited to 'sky')
-rw-r--r-- | sky/cd_intro.cpp | 168 | ||||
-rw-r--r-- | sky/intro.cpp | 16 | ||||
-rw-r--r-- | sky/sky.cpp | 67 | ||||
-rw-r--r-- | sky/sky.h | 50 |
4 files changed, 163 insertions, 138 deletions
diff --git a/sky/cd_intro.cpp b/sky/cd_intro.cpp index 52d64f15c0..b4561b9456 100644 --- a/sky/cd_intro.cpp +++ b/sky/cd_intro.cpp @@ -192,8 +192,8 @@ #define START_VOICE ( delay(200), _sound->playVoice(vocBuffer, loadedVocSize) ) #define START_BG ( _sound->playBgSound(bgVocBuffer, bgVocSize) ) -#define LOAD_NEW_VOICE(num) ( free (vocBuffer), vocBuffer = loadFile(num, NULL), loadedVocSize = _lastLoadedFileSize ) -#define LOAD_NEW_BG(num) ( free (bgVocBuffer), bgVocBuffer = loadFile(num, NULL), bgVocSize = _lastLoadedFileSize ) +#define LOAD_NEW_VOICE(num) ( free (vocBuffer), vocBuffer = _skyDisk->loadFile(num, NULL), loadedVocSize = _skyDisk->_lastLoadedFileSize ) +#define LOAD_NEW_BG(num) ( free (bgVocBuffer), bgVocBuffer = _skyDisk->loadFile(num, NULL), bgVocSize = _skyDisk->_lastLoadedFileSize ) #define WAIT_VOICE while (_sound->_voiceHandle != 0) { delay(50); } #define WAIT_SEQUENCE while (_tseqFrames != 0) { delay(50); } #define WAIT_RELATIVE(x) ( delay(20 * (x)) ) @@ -204,17 +204,17 @@ void SkyState::doCDIntro() { uint32 loadedVocSize, bgVocSize; byte *vocBuffer, *bgVocBuffer, *cd2_seq_data_1, *cd2_seq_data_2; - assert(_isCDVersion); + assert(isCDVersion(_gameVersion)); - vocBuffer = loadFile(cdv_00, NULL); - loadedVocSize = _lastLoadedFileSize; + vocBuffer = _skyDisk->loadFile(cdv_00, NULL); + loadedVocSize = _skyDisk->_lastLoadedFileSize; - _tempPal = loadFile(cd_pal, NULL); - _workScreen = loadFile(cd_1_log, NULL); + _tempPal = _skyDisk->loadFile(cd_pal, NULL); + _workScreen = _skyDisk->loadFile(cd_1_log, NULL); - cd2_seq_data_1 = loadFile(cd_1, NULL); - bgVocBuffer = loadFile(59499, NULL); - bgVocSize = _lastLoadedFileSize; + cd2_seq_data_1 = _skyDisk->loadFile(cd_1, NULL); + bgVocBuffer = _skyDisk->loadFile(59499, NULL); + bgVocSize = _skyDisk->_lastLoadedFileSize; delay(2000); //keep gibbons screen up for 2 seconds fnFadeDown(0); //and fade out @@ -223,8 +223,8 @@ void SkyState::doCDIntro() { START_BG; free (vocBuffer); - vocBuffer = loadFile(cdv_01, NULL); - loadedVocSize = _lastLoadedFileSize; + vocBuffer = _skyDisk->loadFile(cdv_01, NULL); + loadedVocSize = _skyDisk->_lastLoadedFileSize; WAIT_VOICE; //wait for the voice to finish START_VOICE; @@ -236,7 +236,7 @@ void SkyState::doCDIntro() { WAIT_VOICE; START_VOICE; START_BG; - cd2_seq_data_2 = loadFile(cd_2, NULL); //load seq 2 while 1 is playing + cd2_seq_data_2 = _skyDisk->loadFile(cd_2, NULL); //load seq 2 while 1 is playing LOAD_NEW_VOICE(cdv_03); //WAIT_SEQUENCE; WAIT_VOICE; @@ -251,7 +251,7 @@ void SkyState::doCDIntro() { START_BG; free(cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_3, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_3, NULL); LOAD_NEW_VOICE(cdv_05); WAIT_SEQUENCE; //2 @@ -269,7 +269,7 @@ void SkyState::doCDIntro() { START_BG; free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_5, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_5, NULL); LOAD_NEW_VOICE(cdv_07); WAIT_SEQUENCE; //3 @@ -289,7 +289,7 @@ void SkyState::doCDIntro() { START_BG; free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_7, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_7, NULL); LOAD_NEW_VOICE(cdv_10); WAIT_SEQUENCE; //5 @@ -299,10 +299,10 @@ void SkyState::doCDIntro() { startTimerSequence(cd2_seq_data_1); //7 START_BG; - loadFile(cd_11_pal, _tempPal); - byte *workScreen2 = loadFile(cd_11_log, NULL); //need an extra screen or else the sequence will get messed up + _skyDisk->loadFile(cd_11_pal, _tempPal); + byte *workScreen2 = _skyDisk->loadFile(cd_11_log, NULL); //need an extra screen or else the sequence will get messed up free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_11, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_11, NULL); LOAD_NEW_VOICE(cdv_11); WAIT_VOICE; //10 @@ -329,7 +329,7 @@ void SkyState::doCDIntro() { START_BG; free(cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_13, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_13, NULL); LOAD_NEW_VOICE(cdv_14); LOAD_NEW_BG(59498); @@ -342,8 +342,8 @@ void SkyState::doCDIntro() { START_BG; LOAD_NEW_VOICE(cdv_15); - loadFile(cd_15_pal, _tempPal); - loadFile(cd_15_log, workScreen2); + _skyDisk->loadFile(cd_15_pal, _tempPal); + _skyDisk->loadFile(cd_15_log, workScreen2); WAIT_SEQUENCE; //13 WAIT_VOICE; //14 @@ -360,9 +360,9 @@ void SkyState::doCDIntro() { START_VOICE; //16 START_BG; - loadFile(cd_17_log, workScreen2); + _skyDisk->loadFile(cd_17_log, workScreen2); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_17, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_17, NULL); LOAD_NEW_VOICE(cdv_17); WAIT_VOICE; //16 @@ -381,8 +381,8 @@ void SkyState::doCDIntro() { START_BG; LOAD_NEW_VOICE(cdv_19); - loadFile(cd_19_pal, _tempPal); - loadFile(cd_19_log, workScreen2); + _skyDisk->loadFile(cd_19_pal, _tempPal); + _skyDisk->loadFile(cd_19_log, workScreen2); START_BG; LOAD_NEW_BG(59496); //loud heli to quiet @@ -397,7 +397,7 @@ void SkyState::doCDIntro() { START_VOICE; //19 START_BG; LOAD_NEW_VOICE(cdv_20); - loadFile(cd_20_log, workScreen2); + _skyDisk->loadFile(cd_20_log, workScreen2); LOAD_NEW_BG(59496); //quiet heli WAIT_VOICE; //19 @@ -410,7 +410,7 @@ void SkyState::doCDIntro() { paletteFadeUp(_tempPal); LOAD_NEW_VOICE(cdv_21); - loadFile(cd_21_log, workScreen2); + _skyDisk->loadFile(cd_21_log, workScreen2); START_BG; WAIT_SEQUENCE; //19 @@ -435,8 +435,8 @@ void SkyState::doCDIntro() { START_VOICE; //23 fnFadeDown(0); - loadFile(cd_23_pal, _tempPal); - loadFile(cd_24_log, workScreen2); + _skyDisk->loadFile(cd_23_pal, _tempPal); + _skyDisk->loadFile(cd_24_log, workScreen2); LOAD_NEW_VOICE(cdv_24); WAIT_VOICE; //23 @@ -453,10 +453,10 @@ void SkyState::doCDIntro() { START_VOICE; //26 free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_27, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_27, NULL); LOAD_NEW_VOICE(cdv_27); - loadFile(cd_27_pal, _tempPal); - loadFile(cd_27_log, workScreen2); + _skyDisk->loadFile(cd_27_pal, _tempPal); + _skyDisk->loadFile(cd_27_log, workScreen2); WAIT_VOICE; //26 fnFadeDown(0); COPY_SCREEN; @@ -488,10 +488,10 @@ void SkyState::doCDIntro() { START_VOICE; //35 free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_35, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_35, NULL); LOAD_NEW_VOICE(cdv_36); - loadFile(cd_35_pal, _tempPal); - loadFile(cd_35_log, workScreen2); + _skyDisk->loadFile(cd_35_pal, _tempPal); + _skyDisk->loadFile(cd_35_log, workScreen2); WAIT_VOICE; //35 START_VOICE; //36 fnFadeDown(0); @@ -505,7 +505,7 @@ void SkyState::doCDIntro() { START_VOICE; //37 free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_37, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_37, NULL); LOAD_NEW_VOICE(cdv_38); WAIT_SEQUENCE; //35 @@ -518,8 +518,8 @@ void SkyState::doCDIntro() { START_VOICE; //39 LOAD_NEW_VOICE(cdv_40); - loadFile(cd_40_pal, _tempPal); - loadFile(cd_40_log, workScreen2); + _skyDisk->loadFile(cd_40_pal, _tempPal); + _skyDisk->loadFile(cd_40_log, workScreen2); WAIT_VOICE; //39 fnFadeDown(0); COPY_SCREEN; @@ -535,8 +535,8 @@ void SkyState::doCDIntro() { START_VOICE; //42 LOAD_NEW_VOICE(cdv_43); - loadFile(cd_43_pal, _tempPal); - loadFile(cd_43_log, workScreen2); + _skyDisk->loadFile(cd_43_pal, _tempPal); + _skyDisk->loadFile(cd_43_log, workScreen2); WAIT_VOICE; //42 fnFadeDown(0); @@ -546,12 +546,12 @@ void SkyState::doCDIntro() { START_VOICE; //43 free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_43, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_43, NULL); WAIT_VOICE; //43 startTimerSequence(cd2_seq_data_2); LOAD_NEW_VOICE(cdv_45); - loadFile(cd_45_pal, _tempPal); - loadFile(cd_45_log, workScreen2); + _skyDisk->loadFile(cd_45_pal, _tempPal); + _skyDisk->loadFile(cd_45_log, workScreen2); WAIT_SEQUENCE; //43 START_VOICE; //45 fnFadeDown(0); @@ -559,15 +559,15 @@ void SkyState::doCDIntro() { showScreen(); paletteFadeUp(_tempPal); free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_45, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_45, NULL); LOAD_NEW_VOICE(cdv_46); WAIT_VOICE; //45 startTimerSequence(cd2_seq_data_1); START_VOICE; //46 LOAD_NEW_VOICE(cdv_47); - loadFile(cd_47_pal, _tempPal); - loadFile(cd_47_log, workScreen2); + _skyDisk->loadFile(cd_47_pal, _tempPal); + _skyDisk->loadFile(cd_47_log, workScreen2); WAIT_SEQUENCE; //45 WAIT_VOICE; //46 @@ -578,8 +578,8 @@ void SkyState::doCDIntro() { paletteFadeUp(_tempPal); START_VOICE; //47 LOAD_NEW_VOICE(cdv_48); - loadFile(cd_48_pal, _tempPal); - loadFile(cd_48_log, workScreen2); + _skyDisk->loadFile(cd_48_pal, _tempPal); + _skyDisk->loadFile(cd_48_log, workScreen2); WAIT_VOICE; //47 START_VOICE; //48 fnFadeDown(0); @@ -588,7 +588,7 @@ void SkyState::doCDIntro() { paletteFadeUp(_tempPal); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_48, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_48, NULL); LOAD_NEW_VOICE(cdv_49); WAIT_VOICE; //48 startTimerSequence(cd2_seq_data_2); @@ -597,7 +597,7 @@ void SkyState::doCDIntro() { WAIT_VOICE; //49 START_VOICE; //50 free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_49, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_49, NULL); LOAD_NEW_VOICE(cdv_51); WAIT_SEQUENCE; //48 WAIT_VOICE; //50 @@ -611,7 +611,7 @@ void SkyState::doCDIntro() { START_VOICE; //53 LOAD_NEW_VOICE(cdv_54); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_50, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_50, NULL); WAIT_VOICE; //53 WAIT_SEQUENCE; //49 @@ -622,8 +622,8 @@ void SkyState::doCDIntro() { WAIT_VOICE; //54 START_VOICE; //55 - loadFile(cd_55_pal, _tempPal); - loadFile(cd_55_log, workScreen2); + _skyDisk->loadFile(cd_55_pal, _tempPal); + _skyDisk->loadFile(cd_55_log, workScreen2); LOAD_NEW_VOICE(cdv_56); WAIT_VOICE; //55 START_VOICE; //56 @@ -638,8 +638,8 @@ void SkyState::doCDIntro() { START_VOICE; //57 LOAD_NEW_VOICE(cdv_58); - loadFile(cd_58_pal, _tempPal); - loadFile(cd_58_log, workScreen2); + _skyDisk->loadFile(cd_58_pal, _tempPal); + _skyDisk->loadFile(cd_58_log, workScreen2); WAIT_VOICE; //57 fnFadeDown(0); @@ -651,7 +651,7 @@ void SkyState::doCDIntro() { WAIT_VOICE; //48 START_VOICE; //59 free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_58, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_58, NULL); WAIT_VOICE; //59 LOAD_NEW_VOICE(cdv_60); START_VOICE; //60 @@ -674,8 +674,8 @@ void SkyState::doCDIntro() { START_VOICE; //65 fnFadeDown(0); LOAD_NEW_VOICE(cdv_66); - loadFile(cd_66_pal, _tempPal); - loadFile(cd_66_log, _workScreen); + _skyDisk->loadFile(cd_66_pal, _tempPal); + _skyDisk->loadFile(cd_66_log, _workScreen); WAIT_VOICE; //65 showScreen(); paletteFadeUp(_tempPal); @@ -683,8 +683,8 @@ void SkyState::doCDIntro() { LOAD_NEW_VOICE(cdv_67); WAIT_VOICE; //66 START_VOICE; //67 - loadFile(cd_67_pal, _tempPal); - loadFile(cd_67_log, workScreen2); + _skyDisk->loadFile(cd_67_pal, _tempPal); + _skyDisk->loadFile(cd_67_log, workScreen2); fnFadeDown(0); COPY_SCREEN; showScreen(); @@ -693,10 +693,10 @@ void SkyState::doCDIntro() { WAIT_VOICE; //67 START_VOICE; //68 free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_69, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_69, NULL); LOAD_NEW_VOICE(cdv_69); - loadFile(cd_69_pal, _tempPal); - loadFile(cd_69_log, workScreen2); + _skyDisk->loadFile(cd_69_pal, _tempPal); + _skyDisk->loadFile(cd_69_log, workScreen2); WAIT_VOICE; //68 START_VOICE; //69 fnFadeDown(0); @@ -711,16 +711,16 @@ void SkyState::doCDIntro() { WAIT_VOICE; //70 fnFadeDown(0); START_VOICE; //71 - loadFile(cd_72_pal, _tempPal); - loadFile(cd_72_log, _workScreen); + _skyDisk->loadFile(cd_72_pal, _tempPal); + _skyDisk->loadFile(cd_72_log, _workScreen); WAIT_VOICE; //71 showScreen(); paletteFadeUp(_tempPal); LOAD_NEW_VOICE(cdv_72); START_VOICE; //72 - loadFile(cd_73_pal, _tempPal); - loadFile(cd_73_log, _workScreen); + _skyDisk->loadFile(cd_73_pal, _tempPal); + _skyDisk->loadFile(cd_73_log, _workScreen); LOAD_NEW_VOICE(cdv_73); WAIT_VOICE; //72 fnFadeDown(0); @@ -733,9 +733,9 @@ void SkyState::doCDIntro() { LOAD_NEW_VOICE(cdv_75); WAIT_VOICE; //74 START_VOICE; //75 - loadFile(cd_76_pal, _tempPal); + _skyDisk->loadFile(cd_76_pal, _tempPal); free (workScreen2); - workScreen2 = loadFile(cd_76_log, NULL); + workScreen2 = _skyDisk->loadFile(cd_76_log, NULL); fnFadeDown(0); COPY_SCREEN; showScreen(); @@ -749,10 +749,10 @@ void SkyState::doCDIntro() { START_VOICE; //77 free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_100, NULL); - loadFile(cd_78_pal, _tempPal); + cd2_seq_data_1 = _skyDisk->loadFile(cd_100, NULL); + _skyDisk->loadFile(cd_78_pal, _tempPal); free (workScreen2); - workScreen2 = loadFile(cd_78_log, NULL); + workScreen2 = _skyDisk->loadFile(cd_78_log, NULL); LOAD_NEW_VOICE(cdv_78); WAIT_VOICE; //77 fnFadeDown(0); @@ -775,9 +775,9 @@ void SkyState::doCDIntro() { START_VOICE; //82 LOAD_NEW_VOICE(cdv_83); WAIT_VOICE; //82 - loadFile(cd_101_log, workScreen2); + _skyDisk->loadFile(cd_101_log, workScreen2); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_101, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_101, NULL); WAIT_SEQUENCE; //100 COPY_SCREEN; showScreen(); @@ -793,20 +793,20 @@ void SkyState::doCDIntro() { WAIT_VOICE; //85 free (workScreen2); - workScreen2 = loadFile(cd_102_log, NULL); + workScreen2 = _skyDisk->loadFile(cd_102_log, NULL); free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_102, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_102, NULL); WAIT_SEQUENCE; //101 COPY_SCREEN; showScreen(); startTimerSequence(cd2_seq_data_1); START_VOICE; //86 LOAD_NEW_VOICE(cdv_87); - loadFile(cd_103_pal, _tempPal); + _skyDisk->loadFile(cd_103_pal, _tempPal); free (workScreen2); - workScreen2 = loadFile(cd_103_log, NULL); + workScreen2 = _skyDisk->loadFile(cd_103_log, NULL); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_103, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_103, NULL); WAIT_SEQUENCE; //102 fnFadeDown(0); COPY_SCREEN; @@ -815,11 +815,11 @@ void SkyState::doCDIntro() { startTimerSequence(cd2_seq_data_2); WAIT_VOICE; //86 START_VOICE; //87 - loadFile(cd_104_pal, _tempPal); + _skyDisk->loadFile(cd_104_pal, _tempPal); free (workScreen2); - workScreen2 = loadFile(cd_104_log, NULL); + workScreen2 = _skyDisk->loadFile(cd_104_log, NULL); free (cd2_seq_data_1); - cd2_seq_data_1 = loadFile(cd_104, NULL); + cd2_seq_data_1 = _skyDisk->loadFile(cd_104, NULL); WAIT_SEQUENCE; //103 //fn_start_music(2); @@ -829,7 +829,7 @@ void SkyState::doCDIntro() { paletteFadeUp(_tempPal); startTimerSequence(cd2_seq_data_1); free (cd2_seq_data_2); - cd2_seq_data_2 = loadFile(cd_105, NULL); + cd2_seq_data_2 = _skyDisk->loadFile(cd_105, NULL); WAIT_SEQUENCE; //104 startTimerSequence(cd2_seq_data_2); WAIT_SEQUENCE; //105 diff --git a/sky/intro.cpp b/sky/intro.cpp index 3fe2c19811..fc24158410 100644 --- a/sky/intro.cpp +++ b/sky/intro.cpp @@ -218,11 +218,11 @@ uint32 *command_pointer = (uint32 *)zero_commands; void SkyState::initVirgin() { - _tempPal = loadFile(60111, NULL); + _tempPal = _skyDisk->loadFile(60111, NULL); if (_tempPal != NULL) setPalette(_tempPal); - _workScreen = loadFile(60110, NULL); + _workScreen = _skyDisk->loadFile(60110, NULL); if (_workScreen != NULL) showScreen(); @@ -234,14 +234,14 @@ void SkyState::initVirgin() { void SkyState::intro(void) { - _workScreen = loadFile(60112, NULL); //while virgin screen is up, load rev screen - _tempPal = loadFile(60113, NULL); + _workScreen = _skyDisk->loadFile(60112, NULL); //while virgin screen is up, load rev screen + _tempPal = _skyDisk->loadFile(60113, NULL); //loadSectionMusic(0); delay(3000); //keep virgin screen up for 3 seconds - //if (!_isCDVersion) + //if (!isCDVersion(_gameVersion)) // fn_start_music(); delay(3000); //and another 3 seconds. @@ -252,8 +252,8 @@ void SkyState::intro(void) { free (_workScreen); //while rev is up, load gibbons screen - _workScreen = loadFile(60114, NULL); - _tempPal = loadFile(60115, NULL); + _workScreen = _skyDisk->loadFile(60114, NULL); + _tempPal = _skyDisk->loadFile(60115, NULL); intro_text_space = (uint8 *)malloc(10000); intro_text_save = (uint8 *)malloc(10000); @@ -269,7 +269,7 @@ void SkyState::intro(void) { free (_tempPal); free (_workScreen); - if (_isCDVersion) + if (isCDVersion(_gameVersion)) doCDIntro(); diff --git a/sky/sky.cpp b/sky/sky.cpp index 3c12425995..a7eabc49fc 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -83,7 +83,7 @@ void SkyState::go() { _dump_file = stdout; initialise(); - if (!_isDemo || _isCDVersion) + if (!isDemo(_gameVersion) || isCDVersion(_gameVersion)) intro(); while (1) { @@ -99,8 +99,9 @@ void SkyState::initialise(void) { _sound = new SkySound(_mixer); - initialiseDisk(); - setupVersionSpecifics(_gameVersion); //_gameVersion is initialised in initialiseDisk(); + _skyDisk = new SkyDisk(_gameDataPath); + _gameVersion = _skyDisk->determineGameVersion(); + initialiseScreen(); initVirgin(); //initMouse(); @@ -108,7 +109,7 @@ void SkyState::initialise(void) { //initScript(); initialiseGrids(); //initialiseRouter(); - initialiseText(); + _skyText = getSkyText(); } void SkyState::initItemList() { @@ -123,7 +124,7 @@ void SkyState::initItemList() { _itemList[119] = (void*)data_0; // Compacts - Section 0 _itemList[120] = (void*)data_1; // Compacts - Section 1 - if (_isDemo) { + if (isDemo(_gameVersion)) { _itemList[121] = _itemList[122] = _itemList[123] = _itemList[124] = _itemList[125] = (void*)data_0; } else { _itemList[121] = (void*)data_2; // Compacts - Section 2 @@ -188,3 +189,59 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp } while (cur < start + amount); } +SkyText *SkyState::getSkyText() { + + switch (_gameVersion) { + case 267: + //floppy demo + return new SkyText_v00267(_skyDisk, _gameVersion); + case 288: + //floppy - old version + return new SkyText_v00288(_skyDisk, _gameVersion); + //case 331: + //floppy - new version + //return new SkyText_v00331(_skyDisk, _gameVersion); + case 365: + //cd demo, uses a slightly modified version of v00368 + case 368: + //cd version + return new SkyText_v00368(_skyDisk, _gameVersion); + default: + error("Unknown game version!"); + } +} + +bool SkyState::isDemo(uint32 version) { + switch (version) { + case 267: + return true; + case 288: + return false; + case 331: + return false; + case 365: + return true; + case 368: + return false; + default: + error("Unknown game version!"); + } +} + +bool SkyState::isCDVersion(uint32 version) { + switch (version) { + case 267: + return false; + case 288: + return false; + case 331: + return false; + case 365: + return true; + case 368: + return true; + default: + error("Unknown game version!"); + } +} + @@ -28,14 +28,14 @@ #include "common/timer.h" #include "sound/mixer.h" #include "sky/sound.h" +#include "sky/text.h" +#include "sky/disk.h" class SkyState : public Engine { void errorString(const char *buf_input, char *buf_output); protected: byte _game; uint32 _gameVersion; - bool _isCDVersion; - bool _isDemo; byte _key_pressed; uint32 _tseqFrames; @@ -43,29 +43,7 @@ protected: uint32 _tseqCounter; void *_itemList[300]; - uint8 _textBuffer[1024]; - uint32 _dtLineWidth; //width of line in pixels - uint32 _dtLines; //no of lines to do - uint32 _dtLineSize; //size of one line in bytes - uint8 *_dtData; //address of textdata - uint32 _dtLetters; //no of chars in message - uint8 *_dtText; //pointer to text - uint32 _dtCharSpacing; //character seperation adjustment - uint32 _dtWidth; //width of chars in last line (for editing (?)) - uint32 _dtCentre; //set for centre text - uint8 *_mouseTextData; //space for the mouse text - - struct charSet { - uint8 *addr; - uint32 charHeight; - uint32 thirdVal; - } _mainCharacterSet, _linkCharacterSet, _controlCharacterSet; - - uint32 _curCharSet; - uint32 _characterSet; - uint32 _charHeight; - uint8 *_preAfterTableArea; - + uint16 _debugMode; uint16 _debugLevel; uint16 _language; @@ -78,8 +56,6 @@ protected: int _numScreenUpdates; - uint32 _lastLoadedFileSize; - Timer *_timer; //int _timer_id; @@ -90,6 +66,7 @@ protected: int _sdl_mouse_x, _sdl_mouse_y; SkySound *_sound; + SkyDisk *_skyDisk; byte *_workScreen; byte *_backScreen; @@ -105,36 +82,26 @@ public: SkyState(GameDetector *detector, OSystem *syst); virtual ~SkyState(); + static bool isDemo(uint32 version); + static bool isCDVersion(uint32 version); + protected: void delay(uint amount); void pollMouseXY(); void go(); void convertPalette(uint8 *inpal, uint8* outpal); - void determineGameVersion(uint32 dnrEntries); - void setupVersionSpecifics(uint32 version); + SkyText *getSkyText(); void initialise(); void initTimer(); - void initialiseDisk(); void initialiseScreen(); void initialiseGrids(); void initItemList(); - void initialiseText(); - void fnSetFont(uint32 fontNr); - void getText(uint32 textNr); - char (SkyState::*getTextChar)(uint8 *, uint8 *, uint8 *&); - char getTextChar_v00267(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream); - char getTextChar_v00288(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream); - char getTextChar_v00368(uint8 *inputValue, uint8 *shiftBits, uint8 *&inputStream); - bool getTBit(uint8 *inputValue, uint8 *shiftBits, byte *&inputStream); void setPalette(uint8 *pal); void fnFadeDown(uint8 action); void palette_fadedown_helper(uint32 *pal, uint num); void paletteFadeUp(uint8 *pal); void palette_fadeup_helper(uint32 *realPal, uint32 *desiredPal, int num); - uint8 *loadFile(uint16 fileNr, uint8 *dest); - uint8 *getFileInfo(uint16 fileNr); - void dumpFile(uint16 fileNr); void initVirgin(); void intro(); void doCDIntro(); @@ -148,6 +115,7 @@ protected: void shutdown(); RandomSource _rnd; + SkyText *_skyText; }; #endif |