/** * \brief Logic for custom intro and processes controller input for skipping intro. */ void processIntro(void) { //cycles through our sine function to move the ghost smoothly wave_tick++; if(wave_tick > 127) wave_tick = 0; player_y = (u8)(100+pgm_read_byte(&(sine32[wave_tick]))); //set ghost height based on sine function player_x++; //move ghost left to right 1 pixel if(player_x == 104) //at correct moment, trigger sound effect TriggerFx(13,0x88,true); if(player_x > 224) //when ghost is off screen, end intro and move to main menu { ResumeSong(); SetTileTable(title_tiles); frame_tick = 8; current_frame = 0; game_state = MAIN_MENU; } //read in our player one joypad input joy=ReadJoypad(0); //if player 1 is currently pressing start if((joy&BTN_START) && (joy != lastbuttons)) { ResumeSong(); SetTileTable(title_tiles); frame_tick = 8; current_frame = 0; lastbuttons=joy; game_state = MAIN_MENU; } lastbuttons=joy; }
/** * \brief Handles input for gameplay. Reads player 1 joypad and processes input for the main game. */ void processControls(void){ //read current player 1 input, save in joy variable joy=ReadJoypad(0); if(joy) //if any button at is is being pressed { if(scrollingOn) //if we're scrolling the screen (player is alive) { if(lastbuttons!=joy) //if we're pressing a new button, not holding one { yspeed = -jumpspeed; //make player jump up TriggerFx(4,0x88,true);//play our bouncing sound effects TriggerFx(5,0x88,true); grav_tick=1; //reset gravity ticks. doing this ensures that no matter where the gravity timer was, we always get a consistent jump height } } else if(joy&BTN_START) //if player is dead and start was pressed { if(deathclock<105) game_state = HIGH_SCORES; //exit main game state, enter high score screen state (refer to main function) } if(joy&BTN_SELECT)//alive or note, if select was pressed... { if(lastbuttons!=joy) //if it was JUST pressed and not held { if(mute) //if volume is muted, unmute it { SetMasterVolume(0xff); mute=false; ResumeSong(); } else //if volume is normal, mute it { StopSong(); SetMasterVolume(0x00); mute=true; } } } } //save current input as lastbuttons so we can check if new buttons are pressed next time lastbuttons=joy; }
// // MidiRPC_ResumeSong // // Resume after pausing. // void MidiRPC_ResumeSong() { ResumeSong(); }