From: Holger Schemel Date: Tue, 16 Apr 2002 22:13:19 +0000 (+0200) Subject: rnd-20020417-1-src X-Git-Tag: 2.1.0^2~58 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=69e8efac8d856859c55237e085ff8b514ae1aa3c;p=rocksndiamonds.git rnd-20020417-1-src --- diff --git a/src/events.c b/src/events.c index 879b5396..f67bc13e 100644 --- a/src/events.c +++ b/src/events.c @@ -176,6 +176,16 @@ void ClearEventQueue() } } +void ClearPlayerAction() +{ + int i; + + /* simulate key release events for still pressed keys */ + key_joystick_mapping = 0; + for (i=0; itype == EVENT_FOCUSOUT) { - int i; - KeyboardAutoRepeatOn(); old_joystick_status = joystick.status; joystick.status = JOYSTICK_NOT_AVAILABLE; - /* simulate key release events for still pressed keys */ - key_joystick_mapping = 0; - for (i=0; itype == EVENT_FOCUSIN) { @@ -771,11 +776,9 @@ static int HandleJoystickForAllPlayers() joy_action = Joystick(i); result |= joy_action; - if (!setup.input[i].use_joystick) continue; - stored_player[i].action = joy_action; } diff --git a/src/events.h b/src/events.h index e2c4e994..6cc08ef8 100644 --- a/src/events.h +++ b/src/events.h @@ -20,6 +20,7 @@ int FilterMouseMotionEvents(const Event *); void EventLoop(void); void HandleOtherEvents(Event *); void ClearEventQueue(void); +void ClearPlayerAction(void); void SleepWhileUnmapped(void); void HandleExposeEvent(ExposeEvent *); diff --git a/src/game.c b/src/game.c index f0bf7dd9..e2ae2436 100644 --- a/src/game.c +++ b/src/game.c @@ -432,6 +432,18 @@ static void InitField(int x, int y, boolean init_game) } } +void DrawGameDoorValues() +{ + DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, + int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, + int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_SCORE, DY + YY_SCORE, + int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_TIME, DY + YY_TIME, + int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); +} + void InitGame() { int i, j, x, y; @@ -792,6 +804,9 @@ void InitGame() DX + XX_LEVEL - 1, DY + YY_LEVEL + 1); } +#if 1 + DrawGameDoorValues(); +#else DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, @@ -800,6 +815,7 @@ void InitGame() int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); DrawText(DX + XX_TIME, DY + YY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); +#endif UnmapGameButtons(); UnmapTapeButtons(); diff --git a/src/game.h b/src/game.h index acd25c1b..081964f5 100644 --- a/src/game.h +++ b/src/game.h @@ -30,6 +30,7 @@ #define SC_ZEITBONUS 10 void GetPlayerConfig(void); +void DrawGameDoorValues(void); void InitGame(void); void InitMovDir(int, int); void InitAmoebaNr(int, int); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 29d5a981..a517bf67 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -1169,7 +1169,9 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) { struct SoundControl snd_ctrl = emptySoundControl; - if (!audio.sound_available || !audio.sound_enabled) + if (!audio.sound_available || + !audio.sound_enabled || + audio.sound_deactivated) return; if (volume gfx.dx) + { + if ((gfx.draw_deactivation_mask & REDRAW_DOOR_1) && + y < gfx.dy + gfx.dysize) + return TRUE; + else if ((gfx.draw_deactivation_mask & REDRAW_DOOR_2) && + y > gfx.vy) + return TRUE; + } } return FALSE; @@ -730,6 +740,8 @@ inline void OpenAudio(void) audio.mods_available = FALSE; audio.sound_enabled = FALSE; + audio.sound_deactivated = FALSE; + audio.soundserver_pipe[0] = audio.soundserver_pipe[1] = 0; audio.soundserver_pid = -1; audio.device_name = NULL; diff --git a/src/libgame/system.h b/src/libgame/system.h index f372306f..17411f8d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -229,6 +229,8 @@ struct AudioSystemInfo boolean mods_available; boolean sound_enabled; + boolean sound_deactivated; /* for temporarily disabling sound */ + int soundserver_pipe[2]; int soundserver_pid; char *device_name; diff --git a/src/screens.c b/src/screens.c index 4537893f..76ed7a1e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -137,6 +137,7 @@ void DrawMainMenu() KeyboardAutoRepeatOn(); ActivateJoystick(); SetDrawDeactivationMask(REDRAW_NONE); + audio.sound_deactivated = FALSE; /* needed if last screen was the playing screen, invoked from level editor */ if (level_editor_test_game) diff --git a/src/tape.c b/src/tape.c index db15dde9..8cbc41f6 100644 --- a/src/tape.c +++ b/src/tape.c @@ -320,6 +320,7 @@ void TapeStartRecording() MapTapeIndexButton(); SetDrawDeactivationMask(REDRAW_NONE); + audio.sound_deactivated = FALSE; } static void TapeStartGameRecording() @@ -363,6 +364,8 @@ void TapeHaltRecording() return; tape.counter++; + tape.pos[tape.counter].delay = 0; + tape.length = tape.counter; tape.length_seconds = GetTapeLength(); } @@ -437,18 +440,15 @@ void TapeTogglePause() DrawVideoDisplay(state, 0); - if (tape.index_search) - { - SetDrawDeactivationMask(REDRAW_NONE); - RedrawPlayfield(TRUE, 0,0,0,0); - } - if (tape.index_search) { tape.index_search = FALSE; SetDrawDeactivationMask(REDRAW_NONE); + audio.sound_deactivated = FALSE; + RedrawPlayfield(TRUE, 0,0,0,0); + DrawGameDoorValues(); if (tape.quick_resume) { @@ -486,6 +486,7 @@ void TapeStartPlaying() MapTapeIndexButton(); SetDrawDeactivationMask(REDRAW_NONE); + audio.sound_deactivated = FALSE; } static void TapeStartGamePlaying() @@ -594,7 +595,10 @@ void TapeIndexSearch() tape.index_search = TRUE; if (!tape.fast_forward || tape.pause_before_death) - SetDrawDeactivationMask(REDRAW_FIELD); + { + SetDrawDeactivationMask(REDRAW_FIELD | REDRAW_DOOR_1); + audio.sound_deactivated = TRUE; + } } void TapeQuickSave() diff --git a/src/timestamp.h b/src/timestamp.h index f99d17f4..5d730212 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-04-07 21:03]" +#define COMPILE_DATE_STRING "[2002-04-17 00:07]" diff --git a/src/tools.c b/src/tools.c index b0ffdcf7..bbe7c10f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1966,7 +1966,7 @@ boolean Request(char *text, unsigned int req_state) break; case EVENT_KEYRELEASE: - key_joystick_mapping = 0; + ClearPlayerAction(); break; default: