#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 */
CheckTriggeredElementChange(x, y, element, CE_CREATION_OF_X);
}
-static inline void InitField_WithBug1(int x, int y, boolean init_game)
+inline static void InitField_WithBug1(int x, int y, boolean init_game)
{
InitField(x, y, init_game);
InitMovDir(x, y);
}
-static inline void InitField_WithBug2(int x, int y, boolean init_game)
+inline static void InitField_WithBug2(int x, int y, boolean init_game)
{
int old_element = Feld[x][y];
{
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 */
int initial_move_dir = MV_DOWN;
int i, j, x, y;
- game_status = GAME_MODE_PLAYING;
+ // required here to update video display before fading (FIX THIS)
+ DrawMaskedBorder(REDRAW_DOOR_2);
- StopAnimation();
+ game_status = GAME_MODE_PLAYING;
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);
+
+ OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+ ClearField();
DrawCompleteVideoDisplay();
BlitScreenToBitmap(backbuffer);
/* !!! FIX THIS (END) !!! */
- FadeIn(REDRAW_FIELD);
+ DrawMaskedBorder(fade_mask);
+
+ FadeIn(fade_mask);
#if 1
// full screen redraw is required at this point in the following cases:
{
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();
{
game_status = GAME_MODE_MAIN;
- DrawAndFadeInMainMenu(REDRAW_FIELD);
+ DrawMainMenu();
return;
}
game_status = GAME_MODE_MAIN;
- DrawAndFadeInMainMenu(REDRAW_FIELD);
+ DrawMainMenu();
return;
}
{
game_status = GAME_MODE_SCORES;
- /* needed if different viewport properties defined for scores */
- ChangeViewportPropertiesIfNeeded();
-
DrawHallOfFame(hi_pos);
if (raise_level)
TapeErase();
}
- DrawAndFadeInMainMenu(REDRAW_FIELD);
+ DrawMainMenu();
}
}
}
}
- RedrawPlayfield(TRUE, 0,0,0,0);
+ RedrawPlayfield();
}
else
{
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)
{
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)
{
#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();
game_status = GAME_MODE_MAIN;
- DrawAndFadeInMainMenu(REDRAW_FIELD);
+ DrawMainMenu();
}
else
{
game_status = GAME_MODE_MAIN;
- DrawAndFadeInMainMenu(REDRAW_FIELD);
+ DrawMainMenu();
}
}
}
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"
}
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)
{
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()
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()
break;
case GAME_CTRL_ID_PAUSE:
+ case GAME_CTRL_ID_PAUSE2:
if (options.network && game_status == GAME_MODE_PLAYING)
{
#if defined(NETWORK_AVALIABLE)