X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=1c493508a290286f096830ed58ae3de7ec219057;hb=7530e229728f4d1ea54ab8e4393029f34a4a2618;hp=e906d2362d832236cd08b141d0f48dd7a06a8fbe;hpb=b0c3bb42e4a0baf41242190a2855c3623267899b;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index e906d236..1c493508 100644 --- a/src/game.c +++ b/src/game.c @@ -2681,15 +2681,25 @@ static void DisplayGameControlValues(void) if (type == TYPE_INTEGER) { if (nr == GAME_PANEL_LEVEL_NUMBER || + nr == GAME_PANEL_INVENTORY_COUNT || + nr == GAME_PANEL_SCORE || + nr == GAME_PANEL_HIGHSCORE || nr == GAME_PANEL_TIME) { boolean use_dynamic_size = (size == -1 ? TRUE : FALSE); if (use_dynamic_size) // use dynamic number of digits { - int value_change = (nr == GAME_PANEL_LEVEL_NUMBER ? 100 : 1000); - int size1 = (nr == GAME_PANEL_LEVEL_NUMBER ? 2 : 3); - int size2 = size1 + 1; + int value_change = (nr == GAME_PANEL_LEVEL_NUMBER ? 100 : + nr == GAME_PANEL_INVENTORY_COUNT || + nr == GAME_PANEL_TIME ? 1000 : 100000); + int size_add = (nr == GAME_PANEL_LEVEL_NUMBER || + nr == GAME_PANEL_INVENTORY_COUNT || + nr == GAME_PANEL_TIME ? 1 : 2); + int size1 = (nr == GAME_PANEL_LEVEL_NUMBER ? 2 : + nr == GAME_PANEL_INVENTORY_COUNT || + nr == GAME_PANEL_TIME ? 3 : 5); + int size2 = size1 + size_add; int font1 = pos->font; int font2 = pos->font_alt; @@ -3845,6 +3855,9 @@ void InitGame(void) game.envelope_active = FALSE; + // special case: set custom artwork setting to initial value + game.use_masked_elements = game.use_masked_elements_initial; + for (i = 0; i < NUM_BELTS; i++) { game.belt_dir[i] = MV_NONE; @@ -5091,7 +5104,14 @@ static int addScoreEntry(struct ScoreInfo *list, struct ScoreEntry *new_entry, // (special case: historic score entries have an empty tape basename entry) if (strEqual(new_entry->tape_basename, entry->tape_basename) && !strEqual(new_entry->tape_basename, UNDEFINED_FILENAME)) + { + // special case: use server score instead of local score value if higher + // (historic scores might have been truncated to 16-bit values locally) + if (score_is_better) + entry->score = new_entry->score; + return -1; + } if (is_better || entry_is_empty) { @@ -5990,6 +6010,10 @@ static void Explode(int ex, int ey, int phase, int mode) return; } + // this can happen if the player was just killed by an explosion + if (GfxElement[x][y] == EL_UNDEFINED) + GfxElement[x][y] = EL_EMPTY; + if (phase == last_phase) { int element; @@ -8420,6 +8444,9 @@ static void StartMoving(int x, int y) GfxDir[x][y] = diagonal_move_dir; ChangeDelay[x][y] = change_delay; + if (Store[x][y] == EL_EMPTY) + Store[x][y] = GfxElementEmpty[x][y]; + graphic = el_act_dir2img(GfxElement[x][y], GfxAction[x][y], GfxDir[x][y]); @@ -11593,6 +11620,35 @@ static void CheckLevelSolved(void) } } +static void CheckLevelTime_StepCounter(void) +{ + int i; + + TimePlayed++; + + if (TimeLeft > 0) + { + TimeLeft--; + + if (TimeLeft <= 10 && setup.time_limit && !game.LevelSolved) + PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); + + game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; + + DisplayGameControlValues(); + + if (!TimeLeft && setup.time_limit && !game.LevelSolved) + for (i = 0; i < MAX_PLAYERS; i++) + KillPlayer(&stored_player[i]); + } + else if (game.no_time_limit && !game.all_players_gone) + { + game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; + + DisplayGameControlValues(); + } +} + static void CheckLevelTime(void) { int i; @@ -11715,6 +11771,9 @@ void StartGameActions(boolean init_network_game, boolean record_tape, if (record_tape) TapeStartRecording(new_random_seed); + if (setup.auto_pause_on_start && !tape.pausing) + TapeTogglePause(TAPE_TOGGLE_MANUAL); + if (init_network_game) { SendToServer_LevelFile(); @@ -12291,6 +12350,25 @@ void GameActions_RND(void) CheckElementChangeByMouse(x, y, element, CE_PRESSED_BY_MOUSE, ch_button); CheckTriggeredElementChangeByMouse(x, y, element, CE_MOUSE_PRESSED_ON_X, ch_button); + + if (level.use_step_counter) + { + boolean counted_click = FALSE; + + // element clicked that can change when clicked/pressed + if (CAN_CHANGE_OR_HAS_ACTION(element) && + (HAS_ANY_CHANGE_EVENT(element, CE_CLICKED_BY_MOUSE) || + HAS_ANY_CHANGE_EVENT(element, CE_PRESSED_BY_MOUSE))) + counted_click = TRUE; + + // element clicked that can trigger change when clicked/pressed + if (trigger_events[element][CE_MOUSE_CLICKED_ON_X] || + trigger_events[element][CE_MOUSE_PRESSED_ON_X]) + counted_click = TRUE; + + if (new_button && counted_click) + CheckLevelTime_StepCounter(); + } } SCAN_PLAYFIELD(x, y) @@ -13249,33 +13327,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) } if (level.use_step_counter) - { - int i; - - TimePlayed++; - - if (TimeLeft > 0) - { - TimeLeft--; - - if (TimeLeft <= 10 && setup.time_limit && !game.LevelSolved) - PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); - - game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; - - DisplayGameControlValues(); - - if (!TimeLeft && setup.time_limit && !game.LevelSolved) - for (i = 0; i < MAX_PLAYERS; i++) - KillPlayer(&stored_player[i]); - } - else if (game.no_time_limit && !game.all_players_gone) - { - game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; - - DisplayGameControlValues(); - } - } + CheckLevelTime_StepCounter(); if (tape.single_step && tape.recording && !tape.pausing && !player->programmed_action)