void SoundTownsPC98_v2::playTrack(uint8 track) { if (track == _lastTrack && _musicEnabled) return; int trackNum = -1; if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { for (uint i = 0; i < res()->cdaTableSize; i++) { if (track == (uint8)READ_LE_UINT16(&res()->cdaTable[i * 2])) { trackNum = (int)READ_LE_UINT16(&res()->cdaTable[i * 2 + 1]) - 1; break; } } } beginFadeOut(); Common::String musicFile = res()->pattern ? Common::String::format(res()->pattern, track) : (res()->fileList ? res()->fileList[track] : 0); if (musicFile.empty()) return; delete[] _musicTrackData; _musicTrackData = _vm->resource()->fileData(musicFile.c_str(), 0); _driver->loadMusicData(_musicTrackData, true); if (_musicEnabled == 2 && trackNum != -1) { g_system->getAudioCDManager()->play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0); g_system->getAudioCDManager()->update(); } else if (_musicEnabled) { _driver->cont(); } _lastTrack = track; }
void SoundTowns::playTrack(uint8 track) { if (track < 2) return; track -= 2; uint tTableIndex = 3 * track; assert(tTableIndex + 2 < res()->cdaTableSize); int trackNum = (int)READ_LE_UINT32(&res()->cdaTable[tTableIndex + 2]); int32 loop = (int32)READ_LE_UINT32(&res()->cdaTable[tTableIndex + 1]); if (track == _lastTrack && _musicEnabled) return; beginFadeOut(); if (_musicEnabled == 2 && trackNum != -1) { _player->driver()->setOutputVolume(1, 118, 118); g_system->getAudioCDManager()->play(trackNum + 1, loop ? -1 : 1, 0, 0); g_system->getAudioCDManager()->update(); _cdaPlaying = true; } else if (_musicEnabled) { playEuphonyTrack(READ_LE_UINT32(&res()->cdaTable[tTableIndex]), loop); _cdaPlaying = false; } _lastTrack = track; }
void MissionSelectionScreen::end() { if (bMovie) { bMovie->stop(); delete bMovie; bMovie = nullptr; } beginFadeOut(0); }
int PilotReviewScreen::handleMessage( unsigned long message, unsigned long who) { if ( who == aMSG_DONE && entryAnim.isDone() ) { bDone = true; exitAnim.begin(); beginFadeOut( 1.0 ); soundSystem->stopBettySample(); // don't want to carry droning on to next screen return 1; } return 0; }
void SoundPC98::playTrack(uint8 track) { track -= 1; if (track == _lastTrack && _musicEnabled) return; beginFadeOut(); Common::String musicFile = Common::String::format(resPattern(), track); delete[] _musicTrackData; _musicTrackData = _vm->resource()->fileData(musicFile.c_str(), 0); if (_musicEnabled) _driver->loadMusicData(_musicTrackData); _lastTrack = track; }
void SoundPC98::playTrack(uint8 track) { track += extraOffset(); if (track == _lastTrack && _musicEnabled) return; beginFadeOut(); Common::String musicFile = fileListLen() == 1 ? Common::String::format(fileListEntry(0), track) : fileListEntry(track); delete[] _musicTrackData; _musicTrackData = _vm->resource()->fileData(musicFile.c_str(), 0); if (_musicEnabled) _driver->loadMusicData(_musicTrackData); _lastTrack = track; }
void SoundTowns_Darkmoon::playTrack(uint8 track) { if (track >= 120 || !_sfxEnabled) return; uint8 *pcm = 0; switch (_soundTable[track].type) { case -1: if (track == 0) haltTrack(); else if (track == 2) beginFadeOut(); break; case 0: if (_soundTable[track].para1 == -1 || (uint32)_soundTable[track].para1 > _pcmDataSize) return; pcm = _pcmData + _soundTable[track].para1; WRITE_LE_UINT16(&pcm[24], _soundTable[track].para2 * 98 / 1000); _intf->callback(39, 0x47); _intf->callback(37, 0x47, 60, track == 11 ? 127 : _pcmVol, pcm); break; case 2: resetTrigger(); g_system->getAudioCDManager()->play(_soundTable[track].para1 - 1, 1, 0, 0); break; case 3: _lastSfxChan ^= 3; _intf->callback(39, _lastSfxChan); _intf->callback(4, _lastSfxChan, _soundTable[track].para1); _intf->callback(1, _lastSfxChan, _soundTable[track].para2, 127); break; default: break; } }
void SoundTownsPC98_v2::playTrack(uint8 track) { track += extraOffset(); if (track == _lastTrack && _musicEnabled) return; const uint16 *const cdaTracks = (const uint16 *)cdaData(); int trackNum = -1; if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { for (int i = 0; i < cdaTrackNum(); i++) { if (track == (uint8) READ_LE_UINT16(&cdaTracks[i * 2])) { trackNum = (int) READ_LE_UINT16(&cdaTracks[i * 2 + 1]) - 1; break; } } } beginFadeOut(); Common::String musicFile = fileListLen() == 1 ? Common::String::format(fileListEntry(0), track) : fileListEntry(track); if (musicFile.empty()) return; delete[] _musicTrackData; _musicTrackData = _vm->resource()->fileData(musicFile.c_str(), 0); _driver->loadMusicData(_musicTrackData, true); if (_musicEnabled == 2 && trackNum != -1) { g_system->getAudioCDManager()->play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0); g_system->getAudioCDManager()->updateCD(); } else if (_musicEnabled) { _driver->cont(); } _lastTrack = track; }
int MainMenu::handleMessage( unsigned long what, unsigned long who ) { switch ( who ) { case MM_MSG_NEW_CAMPAIGN: if ( MPlayer ) { LogisticsOKDialog::instance()->setText( IDS_PROMPT_TO_DISCONNECT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); endResult = MM_MSG_NEW_CAMPAIGN; promptToDisconnect = true; } else { endAnim.begin(); beginAnim.end(); bLoadCampaign = true; LogisticsSaveDialog::instance()->beginCampaign(); if ( LogisticsSaveDialog::instance()->isDone() ) { LogisticsData::instance->startNewCampaign( LogisticsSaveDialog::instance()->getFileName()); status = RESTART; } } break; case MM_MSG_SAVE: if ( MPlayer ) { LogisticsOKDialog::instance()->setText( IDS_PROMPT_TO_DISCONNECT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); endResult = who; promptToDisconnect = true; } else { // need to pop dialog here LogisticsSaveDialog::instance()->begin(); endAnim.begin(); beginAnim.end(); bSave = true; } break; case MM_MSG_LOAD: if ( MPlayer ) { LogisticsOKDialog::instance()->setText( IDS_PROMPT_TO_DISCONNECT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); endResult = who; promptToDisconnect = true; } else { // need to pop dialog here LogisticsSaveDialog::instance()->beginLoad(); endAnim.begin(); beginAnim.end(); bLoad = true; } break; case MM_MSG_MULTIPLAYER: if ( MPlayer ) { LogisticsOKDialog::instance()->setText( IDS_PROMPT_TO_DISCONNECT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); endResult = who; promptToDisconnect = true; } else { endAnim.begin(); beginAnim.end(); endResult = MULTIPLAYERRESTART; LogisticsData::instance->startMultiPlayer(); } break; case MM_MSG_RETURN_TO_GAME: { if ( !bDrawBackground ) { endAnim.begin(); beginAnim.end(); endResult = NEXT; soundSystem->playDigitalSample( LOG_MAINMENUBUTTON ); soundSystem->playDigitalMusic(LogisticsData::instance->getCurrentMissionTune()); } } break; case MM_MSG_OPTIONS: // need to throw up the options screen here... if (!optionsScreenWrapper) { optionsScreenWrapper = new OptionsScreenWrapper; optionsScreenWrapper->init(); } optionsScreenWrapper->begin(); bOptions = true; break; case MM_MSG_ENCYCLOPEDIA: bDrawMechlopedia = true; beginFadeOut(1.0); if ( !mechlopedia ) { mechlopedia = new Mechlopedia; mechlopedia->init(); } mechlopedia->begin(); break; case MM_MSG_EXIT: promptToQuit = 1; // may need to set the text here LogisticsOKDialog::instance()->setText( IDS_DIALOG_QUIT_PROMPT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); getButton( who )->press( 0 ); break; case MM_MSG_SINGLE_MISSION: if ( MPlayer ) { LogisticsOKDialog::instance()->setText( IDS_PROMPT_TO_DISCONNECT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->begin(); endResult = who; promptToDisconnect = true; } else { bLoadSingle = true; endAnim.begin(); beginAnim.end(); singleLoadDlg.beginSingleMission(); getButton( who )->press( 0 ); } break; case MM_MSG_LEGAL: { bLegal = 1; // may need to set the text here if ( !LogisticsLegalDialog::instance() ) { FullPathFileName path; path.init( artPath, "mcl_dialoglegal", ".fit" ); FitIniFile file; file.open( path ); LogisticsLegalDialog::init( file ); } LogisticsLegalDialog::instance()->setText( IDS_DIALOG_OK, IDS_DIALOG_OK, IDS_DIALOG_OK ); //Needs to be this long for LOC! // -fs char realText[2048]; cLoadString(IDS_LAWYER_BABBLE, realText, 2047 ); char lawyerBabble[2048]; unsigned long pIDLen = 64; char pID[64]; sprintf( pID, "INVALID ID" ); gos_LoadDataFromRegistry("PID", pID, &pIDLen); sprintf( lawyerBabble, realText, pID ); LogisticsLegalDialog::instance()->setText( lawyerBabble ); LogisticsLegalDialog::instance()->begin(); LogisticsLegalDialog::instance()->setFont( IDS_LAWYER_BABBLE_FONT ); getButton( who )->press( 0 ); } break; default: break; } return 0; }
int LogisticsSaveDialog::handleMessage( unsigned long what, unsigned long who ) { if ( YES == who ) { EString str; edits[0].getEntry(str); bool bFound = 0; // look and see if you are overwriting anything here... for ( int i= 0; i < gameListBox.GetItemCount(); i++ ) { if ( str.Compare( ((aLocalizedListItem*)gameListBox.GetItem( i ))->getText(), 0 ) == 0 ) { // do prompt here selectedName = ((aLocalizedListItem*)gameListBox.GetItem( i ))->getHiddenText(); char str[256]; cLoadString( IDS_DIALOG_OVERWRITE_PROMPT, str, 255 ); char promptString[256]; sprintf( promptString, str, (const char*)selectedName ); LogisticsOKDialog::instance()->setText( IDS_DIALOG_QUIT_PROMPT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->setText( promptString ); LogisticsOKDialog::instance()->begin(); bPromptOverwrite = true; bFound = 1; break; } } if ( (!bFound || bLoad) ) { status = YES; bPromptOverwrite = 0; if ( bLoad ) beginFadeOut( 1.0 ); //Selected Name is coming back in SAVE with the default savegame. // NOT with what I typed in the box. Maybe this will fix? -fs if ( !bCampaign ) selectedName = str; end(); } } if ( NO == who ) { selectedName = ""; status = NO; end(); } if ( DELETE_BUTTON == who ) { if (gameListBox.GetItemCount()) { EString tmpName; edits[0].getEntry(tmpName); for ( int i = 0; i < gameListBox.GetItemCount(); i++ ) { const char* pFileName = ((aLocalizedListItem*)gameListBox.GetItem(i))->getHiddenText(); if ( tmpName.Compare( pFileName, 0 ) == 0 ) { selectedName = pFileName; break; } } char str[256]; cLoadString( IDS_DIALOG_DELETE_PROMPT, str, 255 ); char promptString[256]; sprintf( promptString, str, (const char*)tmpName ); LogisticsOKDialog::instance()->setText( IDS_DIALOG_QUIT_PROMPT, IDS_DIALOG_NO, IDS_DIALOG_YES ); LogisticsOKDialog::instance()->setText( promptString ); LogisticsOKDialog::instance()->begin(); bDeletePrompt = true; } } return 0; }
void SoundAmiga::playTrack(uint8 track) { debugC(5, kDebugLevelSound, "SoundAmiga::playTrack(%d)", track); static const byte tempoIntro[] = { 0x46, 0x55, 0x3C, 0x41 }; static const byte tempoFinal[] = { 0x78, 0x50 }; static const byte tempoIngame[] = { 0x64, 0x64, 0x64, 0x64, 0x64, 0x73, 0x4B, 0x64, 0x64, 0x64, 0x55, 0x9C, 0x6E, 0x91, 0x78, 0x84, 0x32, 0x64, 0x64, 0x6E, 0x3C, 0xD8, 0xAF }; static const byte loopIngame[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00 }; int score = -1; bool loop = false; byte volume = 0x40; byte tempo = 0; switch (_fileLoaded) { case kFileIntro: if (track >= 2 && track < ARRAYSIZE(tempoIntro) + 2) { score = track - 2; tempo = tempoIntro[score]; } break; case kFileGame: if (track >= 11 && track < ARRAYSIZE(tempoIngame) + 11) { score = track - 11; loop = loopIngame[score] != 0; tempo = tempoIngame[score]; } break; case kFileFinal: // score 0 gets started immediately after loading the music-files with different tempo. // we need to define a track-value for the fake call of this function if (track >= 2 && track < ARRAYSIZE(tempoFinal) + 2) { score = track - 2; loop = true; tempo = tempoFinal[score]; } break; default: return; } if (score >= 0) { if (_musicEnabled && _driver->playSong(score, loop)) { _driver->setVolume(volume); _driver->setTempo(tempo << 4); if (!_mixer->isSoundHandleActive(_musicHandle)) _mixer->playStream(Audio::Mixer::kPlainSoundType, &_musicHandle, _driver, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); } } else if (track == 0) _driver->stopMusic(); else if (track == 1) beginFadeOut(); }