X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=0b2d47fd4bb2f618fc1cb208d5e6aa98437e6b04;hb=f57f9be4c38d1a856ef5d152b498811879cd9dd9;hp=2be5985f4466cde783be13950cba59ce4a7c79b0;hpb=64f2d5695256ecfd51a6bc183bf806442d0f97ee;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 2be5985f..0b2d47fd 100644 --- a/src/game.c +++ b/src/game.c @@ -974,12 +974,13 @@ static struct GamePanelControlInfo game_panel_controls[] = #define GAME_CTRL_ID_UNDO 3 #define GAME_CTRL_ID_REDO 4 #define GAME_CTRL_ID_SAVE 5 -#define GAME_CTRL_ID_LOAD 6 -#define SOUND_CTRL_ID_MUSIC 7 -#define SOUND_CTRL_ID_LOOPS 8 -#define SOUND_CTRL_ID_SIMPLE 9 +#define GAME_CTRL_ID_PAUSE2 6 +#define GAME_CTRL_ID_LOAD 7 +#define SOUND_CTRL_ID_MUSIC 8 +#define SOUND_CTRL_ID_LOOPS 9 +#define SOUND_CTRL_ID_SIMPLE 10 -#define NUM_GAME_BUTTONS 10 +#define NUM_GAME_BUTTONS 11 /* forward declaration for internal use */ @@ -3082,6 +3083,7 @@ void InitGame() { int full_lev_fieldx = lev_fieldx + (BorderElement != EL_EMPTY ? 2 : 0); int full_lev_fieldy = lev_fieldy + (BorderElement != EL_EMPTY ? 2 : 0); + int fade_mask = REDRAW_FIELD; boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */ @@ -3096,15 +3098,20 @@ void InitGame() if (!game.restart_level) CloseDoor(DOOR_CLOSE_1); + /* needed if different viewport properties defined for playing */ + ChangeViewportPropertiesIfNeeded(); + if (level_editor_test_game) FadeSkipNextFadeIn(); else FadeSetEnterScreen(); - FadeOut(REDRAW_FIELD); + if (CheckIfGlobalBorderHasChanged()) + fade_mask = REDRAW_ALL; - /* needed if different viewport properties defined for playing */ - ChangeViewportPropertiesIfNeeded(); + FadeOut(fade_mask); + + ClearField(); DrawCompleteVideoDisplay(); @@ -3916,11 +3923,9 @@ void InitGame() /* blit playfield from scroll buffer to normal back buffer for fading in */ BlitScreenToBitmap(backbuffer); - - redraw_mask |= REDRAW_FROM_BACKBUFFER; /* !!! FIX THIS (END) !!! */ - FadeIn(REDRAW_FIELD); + FadeIn(fade_mask); #if 1 // full screen redraw is required at this point in the following cases: @@ -3949,9 +3954,14 @@ void InitGame() { UnmapGameButtons(); UnmapTapeButtons(); + + FreeGameButtons(); + CreateGameButtons(); + game_gadget[SOUND_CTRL_ID_MUSIC]->checked = setup.sound_music; game_gadget[SOUND_CTRL_ID_LOOPS]->checked = setup.sound_loops; game_gadget[SOUND_CTRL_ID_SIMPLE]->checked = setup.sound_simple; + MapGameButtons(); MapTapeButtons(); @@ -4406,7 +4416,7 @@ void GameEnd() { game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); return; } @@ -4417,7 +4427,7 @@ void GameEnd() game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); return; } @@ -4436,9 +4446,6 @@ void GameEnd() { game_status = GAME_MODE_SCORES; - /* needed if different viewport properties defined for scores */ - ChangeViewportPropertiesIfNeeded(); - DrawHallOfFame(hi_pos); if (raise_level) @@ -4459,7 +4466,7 @@ void GameEnd() TapeErase(); } - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); } } @@ -11058,9 +11065,18 @@ void GameActions() if (tape.playing && tape.warp_forward && !tape.pausing) game_frame_delay_value = 0; +#if 0 + /* ---------- main game synchronization point ---------- */ + + int skip = WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value); + + printf("::: skip == %d\n", skip); + +#else /* ---------- main game synchronization point ---------- */ WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value); +#endif if (network_playing && !network_player_action_received) { @@ -14462,13 +14478,13 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); } else { game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); } } } @@ -14868,6 +14884,10 @@ static struct IMG_GAME_BUTTON_GFX_SAVE, &game.button.save, GAME_CTRL_ID_SAVE, "save game" }, + { + IMG_GAME_BUTTON_GFX_PAUSE2, &game.button.pause2, + GAME_CTRL_ID_PAUSE2, "pause game" + }, { IMG_GAME_BUTTON_GFX_LOAD, &game.button.load, GAME_CTRL_ID_LOAD, "load game" @@ -14918,7 +14938,6 @@ void CreateGameButtons() } if (id == GAME_CTRL_ID_STOP || - id == GAME_CTRL_ID_PAUSE || id == GAME_CTRL_ID_PLAY || id == GAME_CTRL_ID_SAVE || id == GAME_CTRL_ID_LOAD) @@ -15003,22 +15022,18 @@ void MapUndoRedoButtons() { UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); - UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); MapGadget(game_gadget[GAME_CTRL_ID_UNDO]); MapGadget(game_gadget[GAME_CTRL_ID_REDO]); - MapGadget(game_gadget[GAME_CTRL_ID_PLAY]); } void UnmapUndoRedoButtons() { UnmapGadget(game_gadget[GAME_CTRL_ID_UNDO]); UnmapGadget(game_gadget[GAME_CTRL_ID_REDO]); - UnmapGadget(game_gadget[GAME_CTRL_ID_PLAY]); MapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); MapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); - MapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); } void MapGameButtons() @@ -15027,9 +15042,23 @@ void MapGameButtons() for (i = 0; i < NUM_GAME_BUTTONS; i++) if (i != GAME_CTRL_ID_UNDO && - i != GAME_CTRL_ID_REDO && - i != GAME_CTRL_ID_PLAY) + i != GAME_CTRL_ID_REDO) MapGadget(game_gadget[i]); + + if (setup.show_snapshot_buttons) + { + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_SAVE); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE2); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_LOAD); + } + else + { + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_STOP); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); + } + + RedrawGameButtons(); } void UnmapGameButtons() @@ -15113,6 +15142,7 @@ static void HandleGameButtonsExt(int id, int button) break; case GAME_CTRL_ID_PAUSE: + case GAME_CTRL_ID_PAUSE2: if (options.network && game_status == GAME_MODE_PLAYING) { #if defined(NETWORK_AVALIABLE)