X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=8273cb71fb796e803a5481e96001a59ce560b30d;hb=00b53c1316174dabc310c5967beee2edb4fa0842;hp=c02e590f5fb026eb3d4c59cf09a03725a804b265;hpb=7927e26b1ec2ef8b787a35d7867bdc40249cd2ee;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index c02e590f..8273cb71 100644 --- a/src/game.c +++ b/src/game.c @@ -3083,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 */ @@ -3097,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(); @@ -3919,7 +3925,7 @@ void InitGame() BlitScreenToBitmap(backbuffer); /* !!! FIX THIS (END) !!! */ - FadeIn(REDRAW_FIELD); + FadeIn(fade_mask); #if 1 // full screen redraw is required at this point in the following cases: @@ -3948,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(); @@ -4405,7 +4416,7 @@ void GameEnd() { game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); return; } @@ -4416,7 +4427,7 @@ void GameEnd() game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); return; } @@ -4435,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) @@ -4458,7 +4466,7 @@ void GameEnd() TapeErase(); } - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); } } @@ -10969,23 +10977,6 @@ void GameActions() byte tape_action[MAX_PLAYERS]; int i; - for (i = 0; i < MAX_PLAYERS; i++) - { - struct PlayerInfo *player = &stored_player[i]; - - // allow engine snapshot if movement attempt was stopped - if ((game.snapshot.last_action[i] & KEY_MOTION) != 0 && - (player->action & KEY_MOTION) == 0) - game.snapshot.changed_action = TRUE; - - // allow engine snapshot in case of snapping/dropping attempt - if ((game.snapshot.last_action[i] & KEY_BUTTON) == 0 && - (player->action & KEY_BUTTON) != 0) - game.snapshot.changed_action = TRUE; - - game.snapshot.last_action[i] = player->action; - } - /* detect endless loops, caused by custom element programming */ if (recursion_loop_detected && recursion_loop_depth == 0) { @@ -11057,9 +11048,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) { @@ -11183,6 +11183,21 @@ void GameActions() #endif #endif + for (i = 0; i < MAX_PLAYERS; i++) + { + // allow engine snapshot in case of changed movement attempt + if ((game.snapshot.last_action[i] & KEY_MOTION) != + (stored_player[i].effective_action & KEY_MOTION)) + game.snapshot.changed_action = TRUE; + + // allow engine snapshot in case of snapping/dropping attempt + if ((game.snapshot.last_action[i] & KEY_BUTTON) == 0 && + (stored_player[i].effective_action & KEY_BUTTON) != 0) + game.snapshot.changed_action = TRUE; + + game.snapshot.last_action[i] = stored_player[i].effective_action; + } + if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { GameActions_EM_Main(); @@ -14461,13 +14476,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(); } } }