X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=dafe7cbfc56f3c67706a06989e63ba845da56c94;hb=5f7e42c2a1f31213f042dee3dfff1b4de179a9ec;hp=0d28b40b2961e8774cd2cdea2d4f47feb68aa263;hpb=1e606dd0963695c0b9ef24497c979f8b6bc1035b;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 0d28b40b..dafe7cbf 100644 --- a/src/game.c +++ b/src/game.c @@ -2325,6 +2325,43 @@ static void UpdateGameControlValues(void) stored_player[player_nr].num_white_keys; } + // try to display as many collected keys as possible in the default game panel + for (i = STD_NUM_KEYS; i < MAX_NUM_KEYS + 1; i++) // EMC keys + white key + { + int nr = GAME_PANEL_KEY_1 + i; + int emc_key = get_key_element_from_nr(i); + int element = (i < MAX_NUM_KEYS ? emc_key : EL_DC_KEY_WHITE); + struct GamePanelControlInfo *gpc = &game_panel_controls[nr]; + struct TextPosInfo *pos = gpc->pos; + + // check if panel position is undefined for a certain EMC key or white key + if (gpc->value != EL_EMPTY && pos->x == -1 && pos->y == -1) + { + int nr_new = GAME_PANEL_KEY_1 + i % STD_NUM_KEYS; + + // 1st try: display key at the same position as normal or EM keys + if (game_panel_controls[nr_new].value == EL_EMPTY) + { + game_panel_controls[nr_new].value = element; + } + else + { + // 2nd try: display key at the next free position in the key panel + for (k = 0; k < STD_NUM_KEYS; k++) + { + nr_new = GAME_PANEL_KEY_1 + k; + + if (game_panel_controls[nr_new].value == EL_EMPTY) + { + game_panel_controls[nr_new].value = element; + + break; + } + } + } + } + } + for (i = 0; i < NUM_PANEL_INVENTORY; i++) { game_panel_controls[GAME_PANEL_INVENTORY_FIRST_1 + i].value = @@ -2589,6 +2626,10 @@ static void DisplayGameControlValues(void) if (PANEL_DEACTIVATED(pos)) continue; + if (pos->class == get_hash_from_key("extra_panel_items") && + !setup.prefer_extra_panel_items) + continue; + gpc->last_value = value; gpc->last_frame = frame; @@ -11200,6 +11241,15 @@ static void CheckSaveEngineSnapshot(struct PlayerInfo *player) if (!player->is_dropping) player->was_dropping = FALSE; } + + static struct MouseActionInfo mouse_action_last = { 0 }; + struct MouseActionInfo mouse_action = player->effective_mouse_action; + boolean new_released = (!mouse_action.button && mouse_action_last.button); + + if (new_released) + CheckSaveEngineSnapshotToList(); + + mouse_action_last = mouse_action; } static void CheckSingleStepMode(struct PlayerInfo *player) @@ -11210,7 +11260,8 @@ static void CheckSingleStepMode(struct PlayerInfo *player) player stopped moving after one tile (or never starts moving at all) */ if (!player->is_moving && !player->is_pushing && - !player->is_dropping_pressed) + !player->is_dropping_pressed && + !player->effective_mouse_action.button) TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); } @@ -13987,6 +14038,10 @@ static int DigField(struct PlayerInfo *player, CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_DIGS_X, player->index_bit, dig_side); + // if digging triggered player relocation, finish digging tile + if (mode == DF_DIG && (player->jx != jx || player->jy != jy)) + setFieldForSnapping(x, y, element, move_direction); + if (mode == DF_SNAP) { if (level.block_snap_field) @@ -14108,9 +14163,15 @@ static int DigField(struct PlayerInfo *player, PlayLevelSoundElementAction(x, y, element, ACTION_COLLECTING); if (is_player) + { CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_COLLECTS_X, player->index_bit, dig_side); + // if collecting triggered player relocation, finish collecting tile + if (mode == DF_DIG && (player->jx != jx || player->jy != jy)) + setFieldForSnapping(x, y, element, move_direction); + } + if (mode == DF_SNAP) { if (level.block_snap_field) @@ -15232,6 +15293,9 @@ void RequestRestartGame(char *message) } else { + // needed in case of envelope request to close game panel + CloseDoor(DOOR_CLOSE_1); + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu();