int64_t CoinsManager::EraseSong(int64_t Amount) { if (m_iErasesAvaiable <=0) return 0; int iCurrentPlaylist = g_playlistPlayer.GetCurrentPlaylist(); int iCurrentPlaylistSize = g_playlistPlayer.GetPlaylist(iCurrentPlaylist).size(); if (iCurrentPlaylistSize <= 0) return 0; if (m_iErasesAvaiable < Amount) Amount = m_iErasesAvaiable; int iRemoved =0; if (iCurrentPlaylistSize >= Amount) { for (int c = Amount; c > 0; c--) { if (InsertCoin() != -1) { g_playlistPlayer.Remove(iCurrentPlaylist, g_playlistPlayer.GetPlaylist(iCurrentPlaylist).size()-1); m_iErasesAvaiable--; iRemoved++; } } } return iRemoved; }
void CoinsManager::RemoveLastSong() { int iCurrentPlaylist = g_playlistPlayer.GetCurrentPlaylist(); if (g_playlistPlayer.GetPlaylist(iCurrentPlaylist).size() > 1) { if (InsertCoin() != -1) { g_playlistPlayer.Remove(iCurrentPlaylist, g_playlistPlayer.GetPlaylist(iCurrentPlaylist).size()-1); } } }
/* Returns true if the key has been handled and should be discarded, false if * the key should be sent on to screens. */ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput GameI, MenuInput MenuI, StyleInput StyleI ) { /* None of the globals keys act on types other than FIRST_PRESS */ if( type != IET_FIRST_PRESS ) return false; switch( MenuI.button ) { case MENU_BUTTON_OPERATOR: /* Global operator key, to get quick access to the options menu. Don't * do this if we're on a "system menu", which includes the editor * (to prevent quitting without storing changes). */ if( !GAMESTATE->m_bIsOnSystemMenu ) { SCREENMAN->SystemMessage( "OPERATOR" ); GAMESTATE->Reset(); SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); } return true; case MENU_BUTTON_COIN: /* Handle a coin insertion. */ if( GAMESTATE->m_bEditing ) // no coins while editing { LOG->Trace( "Ignored coin insertion (editing)" ); break; } InsertCoin(); return false; // Attract need to know because they go to TitleMenu on > 1 credit } if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F2)) { if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ) ) { // HACK: Also save bookkeeping and profile info for debugging // so we don't have to play through a whole song to get new output. BOOKKEEPER->WriteToDisk(); PROFILEMAN->SaveMachineProfile(); FOREACH_PlayerNumber( p ) if( PROFILEMAN->IsUsingProfile(p) ) PROFILEMAN->SaveProfile( p ); SCREENMAN->SystemMessage( "Stats saved" ); } else {
void InsertCredit() { InsertCoin( PREFSMAN->m_iCoinsPerCredit ); }