- GameActions(player_action);
-
- BackToFront();
-}
-
-void HandleVideoButtons(int mx, int my, int button)
-{
- if (game_status != MAINMENU && game_status != PLAYING)
- return;
-
- switch(CheckVideoButtons(mx,my,button))
- {
- case BUTTON_VIDEO_EJECT:
- TapeStop();
- if (TAPE_IS_EMPTY(tape))
- {
- LoadLevelTape(level_nr);
- if (TAPE_IS_EMPTY(tape))
- Request("No tape for this level !",REQ_CONFIRM);
- }
- else
- {
- if (tape.changed)
- SaveLevelTape(tape.level_nr);
- TapeErase();
- }
- DrawCompleteVideoDisplay();
- break;
-
- case BUTTON_VIDEO_STOP:
- TapeStop();
- break;
-
- case BUTTON_VIDEO_PAUSE:
- TapeTogglePause();
- break;
-
- case BUTTON_VIDEO_REC:
- if (TAPE_IS_STOPPED(tape))
- {
- TapeStartRecording();
-
- if (options.network)
- SendToServer_StartPlaying();
- else
- {
- game_status = PLAYING;
- InitGame();
- }
- }
- else if (tape.pausing)
- {
- if (tape.playing) /* PLAYING -> PAUSING -> RECORDING */
- {
- tape.pos[tape.counter].delay = tape.delay_played;
- tape.playing = FALSE;
- tape.recording = TRUE;
- tape.changed = TRUE;
-
- DrawVideoDisplay(VIDEO_STATE_PLAY_OFF | VIDEO_STATE_REC_ON,0);
- }
- else
- TapeTogglePause();
- }
- break;
-
- case BUTTON_VIDEO_PLAY:
- if (TAPE_IS_EMPTY(tape))
- break;
-
- if (TAPE_IS_STOPPED(tape))
- {
- TapeStartPlaying();
-
- game_status = PLAYING;
- InitGame();
- }
- else if (tape.playing)
- {
- if (tape.pausing) /* PAUSE -> PLAY */
- TapeTogglePause();
- else if (!tape.fast_forward) /* PLAY -> FAST FORWARD PLAY */
- {
- tape.fast_forward = TRUE;
- DrawVideoDisplay(VIDEO_STATE_FFWD_ON, 0);
- }
- else if (!tape.pause_before_death) /* FFWD PLAY -> + AUTO PAUSE */
- {
- tape.pause_before_death = TRUE;
- DrawVideoDisplay(VIDEO_STATE_PAUSE_ON, VIDEO_DISPLAY_LABEL_ONLY);
- }
- else /* -> NORMAL PLAY */
- {
- tape.fast_forward = FALSE;
- tape.pause_before_death = FALSE;
- DrawVideoDisplay(VIDEO_STATE_FFWD_OFF | VIDEO_STATE_PAUSE_OFF, 0);
- }
- }
- break;
-
- default:
- break;
- }
-
- BackToFront();
-}
-
-void HandleSoundButtons(int mx, int my, int button)
-{
- if (game_status != PLAYING)
- return;
-
- switch(CheckSoundButtons(mx,my,button))
- {
- case BUTTON_SOUND_MUSIC:
- if (setup.sound_music_on)
- {
- setup.sound_music_on = FALSE;
- local_player->setup &= ~SETUP_SOUND_MUSIC;
- FadeSound(background_loop[level_nr % num_bg_loops]);
- DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
- }
- else if (sound_loops_allowed)
- {
- setup.sound_on = setup.sound_music_on = TRUE;
- local_player->setup |= (SETUP_SOUND | SETUP_SOUND_MUSIC);
- PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
- DrawSoundDisplay(BUTTON_SOUND_MUSIC_ON);
- }
- else
- DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
- break;
-
- case BUTTON_SOUND_LOOPS:
- if (setup.sound_loops_on)
- {
- setup.sound_loops_on = FALSE;
- local_player->setup &= ~SETUP_SOUND_LOOPS;
- DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
- }
- else if (sound_loops_allowed)
- {
- setup.sound_on = setup.sound_loops_on = TRUE;
- local_player->setup |= (SETUP_SOUND | SETUP_SOUND_LOOPS);
- DrawSoundDisplay(BUTTON_SOUND_LOOPS_ON);
- }
- else
- DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
- break;
-
- case BUTTON_SOUND_SIMPLE:
- if (setup.sound_simple_on)
- {
- setup.sound_simple_on = FALSE;
- local_player->setup &= ~SETUP_SOUND;
- DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
- }
- else if (sound_status==SOUND_AVAILABLE)
- {
- setup.sound_on = setup.sound_simple_on = TRUE;
- local_player->setup |= SETUP_SOUND;
- DrawSoundDisplay(BUTTON_SOUND_SIMPLE_ON);
- }
- else
- DrawSoundDisplay(BUTTON_SOUND_SIMPLE_OFF);
- break;
-
- default:
- break;
- }
-
- BackToFront();
-}
-
-void HandleGameButtons(int mx, int my, int button)
-{
- if (game_status != PLAYING)
- return;
-
- switch(CheckGameButtons(mx,my,button))
- {
- case BUTTON_GAME_STOP:
- if (AllPlayersGone)
- {
- CloseDoor(DOOR_CLOSE_1);
- game_status = MAINMENU;
- DrawMainMenu();
- break;
- }
-
- if (Request("Do you really want to quit the game ?",
- REQ_ASK | REQ_STAY_CLOSED))
- {
- if (options.network)
- SendToServer_StopPlaying();
- else
- {
- game_status = MAINMENU;
- DrawMainMenu();
- }
- }
- else
- OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
- break;
-
- case BUTTON_GAME_PAUSE:
- if (options.network)
- {
- if (tape.pausing)
- SendToServer_ContinuePlaying();
- else
- SendToServer_PausePlaying();
- }
- else
- TapeTogglePause();
-
- /*
- if (tape.pausing)
- {
- if (options.network)
- SendToServer_ContinuePlaying();
- else
- {
- tape.pausing = FALSE;
- DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
- }
- }
- else
- {
- if (options.network)
- SendToServer_PausePlaying();
- else
- {
- tape.pausing = TRUE;
- DrawVideoDisplay(VIDEO_STATE_PAUSE_ON,0);
- }
- }
- */
-
- break;
-
- case BUTTON_GAME_PLAY:
- if (tape.pausing)
- {
- if (options.network)
- SendToServer_ContinuePlaying();
- else
- {
- tape.pausing = FALSE;
- DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
- }
- }
- break;
-
- default:
- break;
- }