diff options
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/anims.cpp | 12 | ||||
-rw-r--r-- | sword2/controls.cpp | 58 | ||||
-rw-r--r-- | sword2/driver/d_sound.cpp | 8 | ||||
-rw-r--r-- | sword2/function.cpp | 2 | ||||
-rw-r--r-- | sword2/mouse.cpp | 4 | ||||
-rw-r--r-- | sword2/resman.cpp | 16 | ||||
-rw-r--r-- | sword2/sound.cpp | 42 | ||||
-rw-r--r-- | sword2/speech.cpp | 16 | ||||
-rw-r--r-- | sword2/startup.cpp | 4 | ||||
-rw-r--r-- | sword2/sword2.cpp | 5 | ||||
-rw-r--r-- | sword2/sword2.h | 35 | ||||
-rw-r--r-- | sword2/tony_gsdk.cpp | 2 |
12 files changed, 105 insertions, 99 deletions
diff --git a/sword2/anims.cpp b/sword2/anims.cpp index 4eb1446966..69ca312e21 100644 --- a/sword2/anims.cpp +++ b/sword2/anims.cpp @@ -582,12 +582,12 @@ void CreateSequenceSpeech(_movieTextObject *sequenceText[]) // (James23may97) File fp; sprintf(speechFile, "speech%d.clu", res_man.WhichCd()); - if (fp.open(speechFile, g_sword2->getGameDataPath())) + if (fp.open(speechFile)) fp.close(); else strcpy(speechFile, "speech.clu"); - wavSize = g_sword2->_sound->GetCompSpeechSize(speechFile, wavId); // returns size of decompressed wav, or 0 if wav not found + wavSize = g_sound->GetCompSpeechSize(speechFile, wavId); // returns size of decompressed wav, or 0 if wav not found if (wavSize) // if we've got the wav { // allocate memory for speech buffer @@ -595,7 +595,7 @@ void CreateSequenceSpeech(_movieTextObject *sequenceText[]) // (James23may97) if (sequence_text_list[line].speech_mem) // if mem allocated ok (should be fine, but worth checking) { - if (g_sword2->_sound->PreFetchCompSpeech(speechFile, wavId, sequence_text_list[line].speech_mem->ad) == RD_OK) // Load speech & decompress to our buffer + if (g_sound->PreFetchCompSpeech(speechFile, wavId, sequence_text_list[line].speech_mem->ad) == RD_OK) // Load speech & decompress to our buffer { Float_mem (sequence_text_list[line].speech_mem); // now float this buffer so we can make space for the next text sprites and/or speech samples speechRunning=1; // ok, we've got speech! @@ -708,7 +708,7 @@ int32 FN_smacker_lead_in(int32 *params) // James(21july97) //----------------------------------------- leadIn += sizeof(_standardHeader); - rv = g_sword2->_sound->PlayFx( 0, leadIn, 0, 0, RDSE_FXLEADIN ); // wav data gets copied to sound memory + rv = g_sound->PlayFx( 0, leadIn, 0, 0, RDSE_FXLEADIN ); // wav data gets copied to sound memory //----------------------------------------- #ifdef _SWORD2_DEBUG @@ -826,7 +826,7 @@ int32 FN_play_sequence(int32 *params) // James(09apr97) // play the smacker FN_stop_music(NULL); // don't want to carry on streaming game music when smacker starts! - g_sword2->_sound->PauseFxForSequence(); // pause sfx during sequence, except the one used for lead-in music + g_sound->PauseFxForSequence(); // pause sfx during sequence, except the one used for lead-in music if (sequenceTextLines && g_sword2->_gameId == GID_SWORD2) // if we have some text to accompany this sequence rv = PlaySmacker(filename, sequenceSpeechArray, leadOut); @@ -842,7 +842,7 @@ int32 FN_play_sequence(int32 *params) // James(09apr97) } */ - g_sword2->_sound->UnpauseFx(); // unpause sound fx again, in case we're staying in same location + g_sound->UnpauseFx(); // unpause sound fx again, in case we're staying in same location //-------------------------------------- // close the lead-out music resource diff --git a/sword2/controls.cpp b/sword2/controls.cpp index b2bb1dfa34..a9f8abb139 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -794,12 +794,12 @@ public: _objectLabelsSwitch->setValue(pointerTextSelected != 0); _subtitlesSwitch->setValue(subtitles != 0); _reverseStereoSwitch->setValue(stereoReversed != 0); - _musicSwitch->setValue(g_sword2->_sound->IsMusicMute() == 0); - _speechSwitch->setValue(g_sword2->_sound->IsSpeechMute() == 0); - _fxSwitch->setValue(g_sword2->_sound->IsFxMute() == 0); - _musicSlider->setValue(g_sword2->_sound->GetMusicVolume()); - _speechSlider->setValue(g_sword2->_sound->GetSpeechVolume()); - _fxSlider->setValue(g_sword2->_sound->GetFxVolume()); + _musicSwitch->setValue(g_sound->IsMusicMute() == 0); + _speechSwitch->setValue(g_sound->IsSpeechMute() == 0); + _fxSwitch->setValue(g_sound->IsFxMute() == 0); + _musicSlider->setValue(g_sound->GetMusicVolume()); + _speechSlider->setValue(g_sound->GetSpeechVolume()); + _fxSlider->setValue(g_sound->GetFxVolume()); _gfxSlider->setValue(GetRenderType()); _gfxPreview->setState(GetRenderType()); } @@ -858,13 +858,13 @@ public: if (widget == _reverseStereoSwitch) { if (result != stereoReversed) - g_sword2->_sound->ReverseStereo(); + g_sound->ReverseStereo(); stereoReversed = result; } else if (widget == _musicSwitch) { - g_sword2->_sound->MuteMusic(result); + g_sound->MuteMusic(result); } else if (widget == _musicSlider) { - g_sword2->_sound->SetMusicVolume(result); - g_sword2->_sound->MuteMusic(result == 0); + g_sound->SetMusicVolume(result); + g_sound->MuteMusic(result == 0); _musicSwitch->setValue(result != 0); } else if (widget == _speechSlider) { _speechSwitch->setValue(result != 0); @@ -875,12 +875,12 @@ public: UpdateGraphicsLevel(result); } else if (widget == _okButton) { // Apply the changes - g_sword2->_sound->MuteMusic(_musicSwitch->getValue() == 0); - g_sword2->_sound->MuteSpeech(_speechSwitch->getValue() == 0); - g_sword2->_sound->MuteFx(_fxSwitch->getValue() == 0); - g_sword2->_sound->SetMusicVolume(_musicSlider->getValue()); - g_sword2->_sound->SetSpeechVolume(_speechSlider->getValue()); - g_sword2->_sound->SetFxVolume(_fxSlider->getValue()); + g_sound->MuteMusic(_musicSwitch->getValue() == 0); + g_sound->MuteSpeech(_speechSwitch->getValue() == 0); + g_sound->MuteFx(_fxSwitch->getValue() == 0); + g_sound->SetMusicVolume(_musicSlider->getValue()); + g_sound->SetSpeechVolume(_speechSlider->getValue()); + g_sound->SetFxVolume(_fxSlider->getValue()); UpdateGraphicsLevel(_gfxSlider->getValue()); @@ -1472,12 +1472,12 @@ int32 ReadOptionSettings(void) { //pete10Jun97 delete fp; delete mgr; - g_sword2->_sound->SetMusicVolume(buff[0]); - g_sword2->_sound->SetSpeechVolume(buff[1]); - g_sword2->_sound->SetFxVolume(buff[2]); - g_sword2->_sound->MuteMusic(buff[3]); - g_sword2->_sound->MuteSpeech(buff[4]); - g_sword2->_sound->MuteFx(buff[5]); + g_sound->SetMusicVolume(buff[0]); + g_sound->SetSpeechVolume(buff[1]); + g_sound->SetFxVolume(buff[2]); + g_sound->MuteMusic(buff[3]); + g_sound->MuteSpeech(buff[4]); + g_sound->MuteFx(buff[5]); UpdateGraphicsLevel(buff[6]); // (James13jun97) @@ -1486,7 +1486,7 @@ int32 ReadOptionSettings(void) { //pete10Jun97 pointerTextSelected = buff[8]; if (buff[9] != stereoReversed) - g_sword2->_sound->ReverseStereo(); + g_sound->ReverseStereo(); stereoReversed = buff[9]; return 0; @@ -1500,12 +1500,12 @@ int32 WriteOptionSettings(void) { //pete10Jun97 sprintf(filename, "%s-settings.dat", g_sword2->_game_name); - buff[0] = g_sword2->_sound->GetMusicVolume(); - buff[1] = g_sword2->_sound->GetSpeechVolume(); - buff[2] = g_sword2->_sound->GetFxVolume(); - buff[3] = g_sword2->_sound->IsMusicMute(); - buff[4] = g_sword2->_sound->IsSpeechMute(); - buff[5] = g_sword2->_sound->IsFxMute(); + buff[0] = g_sound->GetMusicVolume(); + buff[1] = g_sound->GetSpeechVolume(); + buff[2] = g_sound->GetFxVolume(); + buff[3] = g_sound->IsMusicMute(); + buff[4] = g_sound->IsSpeechMute(); + buff[5] = g_sound->IsFxMute(); buff[6] = GetRenderType(); buff[7] = subtitles; buff[8] = pointerTextSelected; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index ee0fd3abc0..06d353aabc 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -379,7 +379,7 @@ int32 Sword2Sound::GetCompSpeechSize(const char *filename, uint32 speechid) { File fp; // Open the speech cluster and find the data offset & size - fp.open(filename, g_engine->getGameDataPath()); + fp.open(filename); if (fp.isOpen() == false) return 0; @@ -412,7 +412,7 @@ int32 Sword2Sound::PreFetchCompSpeech(const char *filename, uint32 speechid, uin File fp; // Open the speech cluster and find the data offset & size - fp.open(filename, g_engine->getGameDataPath()); + fp.open(filename); if (fp.isOpen() == false) return RDERR_INVALIDFILENAME; @@ -499,7 +499,7 @@ int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 v return RDERR_SPEECHPLAYING; // Open the speech cluster and find the data offset & size - fp.open(filename, g_engine->getGameDataPath()); + fp.open(filename); if (fp.isOpen() == false) return RDERR_INVALIDFILENAME; @@ -1058,7 +1058,7 @@ int32 Sword2Sound::StreamCompMusicFromLock(const char *filename, uint32 musicId, // Always use fpMus[0] (all music in one cluster) // musFilePos[primaryStream] for different pieces of music. if (!fpMus.isOpen()) - fpMus.open(filename, g_engine->getGameDataPath()); + fpMus.open(filename); if (!fpMus.isOpen()) return RDERR_INVALIDFILENAME; diff --git a/sword2/function.cpp b/sword2/function.cpp index d6ec2a193e..306e7a825e 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -407,7 +407,7 @@ int32 FN_play_credits(int32 *params) { // And wait for it to die for (int i = 0; i<16; i++) { - g_sword2->_sound->UpdateCompSampleStreaming(); + g_sound->UpdateCompSampleStreaming(); } #endif diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp index 938017a6ca..18c589211b 100644 --- a/sword2/mouse.cpp +++ b/sword2/mouse.cpp @@ -235,7 +235,7 @@ void System_menu(void) //Tony19Mar97 } //------------------------ - rv = g_sword2->_sound->PauseFx(); + rv = g_sound->PauseFx(); if (rv != RD_OK) Zdebug("ERROR: PauseFx() returned %.8x in SystemMenu()", rv); //------------------------ @@ -307,7 +307,7 @@ void System_menu(void) //Tony19Mar97 this_screen.new_palette=1; //------------------------ - rv = g_sword2->_sound->UnpauseFx(); + rv = g_sound->UnpauseFx(); if (rv != RD_OK) Zdebug("ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv); //------------------------ diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 8c704a0ebe..6e031da08f 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -104,7 +104,7 @@ void resMan::InitResMan(void) { //Tony29May96 total_clusters = 0; - if (!file.open("resource.inf", g_sword2->getGameDataPath())) { + if (!file.open("resource.inf")) { Zdebug("InitResMan cannot *OPEN* resource.inf"); ExitWithReport("InitResMan cannot *OPEN* resource.inf [file=%s line=%u]", __FILE__, __LINE__); } @@ -148,7 +148,7 @@ void resMan::InitResMan(void) { //Tony29May96 } while (j != end); // using this method the Gode generated resource.inf must have #0d0a on the last entry // now load in the binary id to res conversion table - if (!file.open("resource.tab", g_sword2->getGameDataPath())) { + if (!file.open("resource.tab")) { Zdebug("InitResMan cannot *OPEN* resource.tab"); ExitWithReport("InitResMan cannot *OPEN* resource.tab [file=%s line=%u]", __FILE__, __LINE__); } @@ -172,7 +172,7 @@ void resMan::InitResMan(void) { //Tony29May96 file.close(); - if (!file.open("cd.inf", g_sword2->getGameDataPath())) { + if (!file.open("cd.inf")) { Zdebug("InitResMan cannot *OPEN* cd.inf"); ExitWithReport("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__); } @@ -228,7 +228,7 @@ void resMan::InitResMan(void) { //Tony29May96 // FIXME: Is this really needed? - if (!file.open("revcd1.id", g_sword2->getGameDataPath())) { + if (!file.open("revcd1.id")) { int index = 0; /* // Scan for CD drives. @@ -527,7 +527,7 @@ uint8 *resMan::Res_open(uint32 res) { //BHTony30May96 } // open the cluster file - if (!file.open(resource_files[parent_res_file], g_sword2->getGameDataPath())) + if (!file.open(resource_files[parent_res_file])) Con_fatal_error("Res_open cannot *OPEN* %s", resource_files[parent_res_file]); @@ -683,7 +683,7 @@ uint32 resMan::Res_fetch_len( uint32 res ) { //Tony27Jan96 // first we have to find the file via the res_conv_table // open the cluster file - if (!fh.open(resource_files[parent_res_file], g_sword2->getGameDataPath())) + if (!fh.open(resource_files[parent_res_file])) Con_fatal_error("Res_fetch_len cannot *OPEN* %s", resource_files[parent_res_file]); // 1st DWORD of a cluster is an offset to the look-up table @@ -1165,8 +1165,8 @@ void resMan::CacheNewCluster(uint32 newCluster) { File inFile, outFile; - inFile.open(buf, g_sword2->getGameDataPath()); - outFile.open(resource_files[newCluster], g_sword2->getGameDataPath(), File::kFileWriteMode); + inFile.open(buf); + outFile.open(resource_files[newCluster], NULL, File::kFileWriteMode); if (!inFile.isOpen() || !outFile.isOpen()) { Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]); diff --git a/sword2/sound.cpp b/sword2/sound.cpp index 59ff147e09..d8fb5ad89f 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -111,7 +111,7 @@ void Process_fx_queue(void) } else if (fxq[j].type == FX_SPOT2) { - if (g_sword2->_sound->IsFxOpen(j+1)) + if (g_sound->IsFxOpen(j+1)) fxq[j].resource = 0; // Once the Fx has finished remove it from the queue. } } @@ -131,7 +131,7 @@ void Trigger_fx(uint8 j) // called from Process_fx_queue only { data = res_man.Res_open(fxq[j].resource); // load in the sample data += sizeof(_standardHeader); - rv = g_sword2->_sound->PlayFx( id, data, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT ); // wav data gets copied to sound memory + rv = g_sound->PlayFx( id, data, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT ); // wav data gets copied to sound memory res_man.Res_close(fxq[j].resource); // release the sample // fxq[j].resource = 0; // clear spot fx from queue } @@ -139,9 +139,9 @@ void Trigger_fx(uint8 j) // called from Process_fx_queue only { // - to be referenced by 'j', so pass NULL data if (fxq[j].type == FX_RANDOM) - rv = g_sword2->_sound->PlayFx( id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT ); // not looped + rv = g_sound->PlayFx( id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXSPOT ); // not looped else // FX_LOOP - rv = g_sword2->_sound->PlayFx( id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXLOOP ); // looped + rv = g_sound->PlayFx( id, NULL, fxq[j].volume, fxq[j].pan, RDSE_FXLOOP ); // looped } #ifdef _SWORD2_DEBUG @@ -251,7 +251,7 @@ int32 FN_play_fx(int32 *params) // called from script only #endif data += sizeof(_standardHeader); - rv = g_sword2->_sound->OpenFx(id,data); // copy it to sound memory, using position in queue as 'id' + rv = g_sound->OpenFx(id,data); // copy it to sound memory, using position in queue as 'id' #ifdef _SWORD2_DEBUG if (rv) @@ -289,7 +289,7 @@ int32 FN_set_fx_vol_and_pan(int32 *params) // 2 new pan (-16..16) // SetFxVolumePan(int32 id, uint8 vol, uint8 pan); - g_sword2->_sound->SetFxVolumePan(1+params[0], params[1], params[2]); // driver fx_id is 1+<pos in queue> + g_sound->SetFxVolumePan(1+params[0], params[1], params[2]); // driver fx_id is 1+<pos in queue> // Zdebug("%d",params[2]); return (IR_CONT); @@ -302,7 +302,7 @@ int32 FN_set_fx_vol(int32 *params) // 1 new volume (0..16) // SetFxIdVolume(int32 id, uint8 vol); - g_sword2->_sound->SetFxIdVolume(1+params[0], params[1]); + g_sound->SetFxIdVolume(1+params[0], params[1]); return (IR_CONT); } @@ -321,7 +321,7 @@ int32 FN_stop_fx(int32 *params) // called from script only if ((fxq[j].type == FX_RANDOM) || (fxq[j].type == FX_LOOP)) { id = (uint32)j+1; // because 0 is not a valid id - rv = g_sword2->_sound->CloseFx(id); // stop fx & remove sample from sound memory + rv = g_sound->CloseFx(id); // stop fx & remove sample from sound memory #ifdef _SWORD2_DEBUG if (rv) @@ -350,7 +350,7 @@ int32 FN_stop_all_fx(int32 *params) // called from script only void Clear_fx_queue(void) { - g_sword2->_sound->ClearAllFx(); // stop all fx & remove the samples from sound memory + g_sound->ClearAllFx(); // stop all fx & remove the samples from sound memory Init_fx_queue(); // clean out the queue } @@ -419,13 +419,13 @@ int32 FN_play_music(int32 *params) // updated by James on 10apr97 File f; sprintf(filename, "music%d.clu", res_man.WhichCd()); - if (f.open(filename, g_sword2->getGameDataPath())) + if (f.open(filename)) f.close(); else strcpy(filename, "music.clu"); } - rv = g_sword2->_sound->StreamCompMusic(filename, params[0], loopFlag); + rv = g_sound->StreamCompMusic(filename, params[0], loopFlag); #ifdef _SWORD2_DEBUG if (rv) @@ -445,7 +445,7 @@ int32 FN_stop_music(int32 *params) // called from script only looping_music_id=0; // clear the 'looping' flag - g_sword2->_sound->StopMusic(); + g_sound->StopMusic(); if (params); @@ -458,11 +458,11 @@ void Kill_music(void) // James22aug97 uint8 count; looping_music_id=0; // clear the 'looping' flag - g_sword2->_sound->StopMusic(); + g_sound->StopMusic(); // THIS BIT CAUSES THE MUSIC TO STOP INSTANTLY! for(count=0; count<16; count++) - g_sword2->_sound->UpdateCompSampleStreaming(); + g_sound->UpdateCompSampleStreaming(); } //-------------------------------------------------------------------------------------- int32 FN_check_music_playing(int32 *params) // James (30july97) @@ -472,7 +472,7 @@ int32 FN_check_music_playing(int32 *params) // James (30july97) // sets result to no. of seconds of current tune remaining // or 0 if no music playing - RESULT = g_sword2->_sound->MusicTimeRemaining(); // in seconds, rounded up to the nearest second + RESULT = g_sound->MusicTimeRemaining(); // in seconds, rounded up to the nearest second return(IR_CONT); // continue script } @@ -481,15 +481,15 @@ void PauseAllSound(void) // James25july97 { uint32 rv; // for drivers return value - rv = g_sword2->_sound->PauseMusic(); + rv = g_sound->PauseMusic(); if (rv != RD_OK) Zdebug("ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv); - rv = g_sword2->_sound->PauseSpeech(); + rv = g_sound->PauseSpeech(); if (rv != RD_OK) Zdebug("ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv); - rv = g_sword2->_sound->PauseFx(); + rv = g_sound->PauseFx(); if (rv != RD_OK) Zdebug("ERROR: PauseFx() returned %.8x in PauseAllSound()", rv); } @@ -498,15 +498,15 @@ void UnpauseAllSound(void) // James25july97 { uint32 rv; // for drivers return value - rv = g_sword2->_sound->UnpauseMusic(); + rv = g_sound->UnpauseMusic(); if (rv != RD_OK) Zdebug("ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv); - rv = g_sword2->_sound->UnpauseSpeech(); + rv = g_sound->UnpauseSpeech(); if (rv != RD_OK) Zdebug("ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv); - rv = g_sword2->_sound->UnpauseFx(); + rv = g_sound->UnpauseFx(); if (rv != RD_OK) Zdebug("ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv); } diff --git a/sword2/speech.cpp b/sword2/speech.cpp index 6df23d61ec..afd082c755 100644 --- a/sword2/speech.cpp +++ b/sword2/speech.cpp @@ -1373,7 +1373,7 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) // New fudge to wait for smacker samples to finish (James31july97) // since they can over-run into the game - if (g_sword2->_sound->GetSpeechStatus()!=RDSE_SAMPLEFINISHED) // has it finished? + if (g_sound->GetSpeechStatus()!=RDSE_SAMPLEFINISHED) // has it finished? return (IR_REPEAT); //------------------------- @@ -1567,16 +1567,16 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) File fp; sprintf(speechFile, "speech%d.clu", res_man.WhichCd()); - if (fp.open(speechFile, g_sword2->getGameDataPath())) + if (fp.open(speechFile)) fp.close(); else strcpy(speechFile, "speech.clu"); - rv = g_sword2->_sound->PlayCompSpeech(speechFile, params[S_WAV], SPEECH_VOLUME, speech_pan); // Load speech but don't start playing yet + rv = g_sound->PlayCompSpeech(speechFile, params[S_WAV], SPEECH_VOLUME, speech_pan); // Load speech but don't start playing yet if (rv == RD_OK) { speechRunning=1; // ok, we've got something to play (2 means not playing yet - see below) - g_sword2->_sound->UnpauseSpeech(); // set it playing now (we might want to do this next cycle, don't know yet) + g_sound->UnpauseSpeech(); // set it playing now (we might want to do this next cycle, don't know yet) } #ifdef _SWORD2_DEBUG else @@ -1616,7 +1616,7 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) else if (speechRunning) // if playing a sample { if (!unpause_zone) - { if (g_sword2->_sound->AmISpeaking()==RDSE_QUIET) // if we're at a quiet bit + { if (g_sound->AmISpeaking()==RDSE_QUIET) // if we're at a quiet bit ob_graphic->anim_pc=0; // restart from frame 0 ('closed mouth' frame) } } @@ -1643,7 +1643,7 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) if (speechRunning==1) // if playing a sample (note that value of '2' means about to play!) { if (!unpause_zone) - { if (g_sword2->_sound->GetSpeechStatus()==RDSE_SAMPLEFINISHED) // has it finished? + { if (g_sound->GetSpeechStatus()==RDSE_SAMPLEFINISHED) // has it finished? speechFinished=1; // James25feb97 } else unpause_zone--; @@ -1692,7 +1692,7 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) if (speechRunning) // if speech sample playing { - g_sword2->_sound->StopSpeechSword2(); // halt the sample prematurely + g_sound->StopSpeechSword2(); // halt the sample prematurely } } } @@ -1904,7 +1904,7 @@ void GetCorrectCdForSpeech(int32 wavId) File fp; uint8 cd; // 1, 2 or 0 (if speech on both cd's, ie. no need to change) - if (fp.open("cd.bin",g_sword2->getGameDataPath()) == false) + if (fp.open("cd.bin") == false) Con_fatal_error("Need cd.bin file for testing speech!"); fp.seek(wavId, SEEK_SET); diff --git a/sword2/startup.cpp b/sword2/startup.cpp index 073955e286..6b262103db 100644 --- a/sword2/startup.cpp +++ b/sword2/startup.cpp @@ -279,8 +279,8 @@ uint32 Con_start(uint8 *input) //Tony15Oct96 FN_stop_music(NULL); // fade out any music that is currently playing //--------------------------------------------- - g_sword2->_sound->UnpauseSpeech(); - g_sword2->_sound->StopSpeechSword2(); // halt the sample prematurely + g_sound->UnpauseSpeech(); + g_sound->StopSpeechSword2(); // halt the sample prematurely //-------------------------------------------------------------- // clean out all resources & flags, ready for a total restart (James24mar97) diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index be35ccb59a..fe99a229c1 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -87,6 +87,7 @@ static const TargetSettings sword2_settings[] = { }; Sword2State *g_sword2 = NULL; +Sword2Sound *g_sound = NULL; const TargetSettings *Engine_SWORD2_targetList() { return sword2_settings; @@ -114,7 +115,9 @@ Sword2State::Sword2State(GameDetector *detector, OSystem *syst) _mixer->setVolume(kDefaultSFXVolume * kDefaultMasterVolume / 255); _mixer->setMusicVolume(kDefaultMusicVolume * kDefaultMasterVolume / 255); - _sound = new Sword2Sound(_mixer); + g_sound = _sound = new Sword2Sound(_mixer); + + File::setDefaultDirectory(_gameDataPath); } diff --git a/sword2/sword2.h b/sword2/sword2.h index cf3ab1946d..4c39b114b4 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -50,24 +50,27 @@ enum BSGameId { // TODO move stuff into class class Sword2State : public Engine { - void errorString(const char *buf_input, char *buf_output); - public: - Sword2State(GameDetector *detector, OSystem *syst); - void go(void); - void parseEvents(void); - void Start_game(void); - int32 InitialiseGame(void); - GameDetector *_detector; - uint32 _features; - byte _gameId; - char *_game_name; // target name for saves - Sword2Sound *_sound; - private: - bool _quit; - uint32 _bootParam; - int32 _saveSlot; +public: + Sword2State(GameDetector *detector, OSystem *syst); + void go(void); + void parseEvents(void); + void Start_game(void); + int32 InitialiseGame(void); + GameDetector *_detector; + uint32 _features; + byte _gameId; + char *_game_name; // target name for saves + Sword2Sound *_sound; +private: + bool _quit; + uint32 _bootParam; + int32 _saveSlot; + +public: + void errorString(const char *buf_input, char *buf_output); }; extern Sword2State *g_sword2; +extern Sword2Sound *g_sound; #endif diff --git a/sword2/tony_gsdk.cpp b/sword2/tony_gsdk.cpp index b401e7223e..e4eea6763e 100644 --- a/sword2/tony_gsdk.cpp +++ b/sword2/tony_gsdk.cpp @@ -36,7 +36,7 @@ uint32 Read_file(const char *name, mem **membloc, uint32 uid) { // Tony25Apr96 File fh; uint32 size; - if (!fh.open(name, g_sword2->getGameDataPath())) { + if (!fh.open(name)) { Zdebug("Read_file cannot open %s", name); return 0; } |