X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=4ee8179d68dc4a564f6349415908df02d2f802a6;hb=055c4e48ddc47b9616c38cd5eeaf27f5b88c933b;hp=9906b6441289415c54f5fb38c6af82f5bbf2be32;hpb=5eb97ccbaffc671f05dd73bf0548c1666414017e;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 9906b644..4ee8179d 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1591,6 +1591,8 @@ void DrawMainMenu() init_last = init; /* switch to new busy animation */ + SetLevelSetInfo(leveldir_current->identifier, level_nr); + /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); @@ -1642,6 +1644,7 @@ void DrawMainMenu() DrawCursorAndText_Main(-1, FALSE, FALSE); DrawPreviewLevelInitial(); + DrawNetworkPlayers(); HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE); @@ -2073,7 +2076,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SetGameStatus(GAME_MODE_SCORES); - DrawHallOfFame(-1); + DrawHallOfFame(level_nr, -1); } else if (pos == MAIN_CONTROL_EDITOR) { @@ -4498,7 +4501,7 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button) HandleChooseTree(mx, my, dx, dy, button, &level_number_current); } -void DrawHallOfFame(int highlight_position) +void DrawHallOfFame(int level_nr, int highlight_position) { int fade_mask = REDRAW_FIELD; @@ -4531,14 +4534,15 @@ void DrawHallOfFame(int highlight_position) OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); + HandleHallOfFame(level_nr, highlight_position, 0, 0, MB_MENU_INITIALIZE); DrawMaskedBorder(fade_mask); FadeIn(fade_mask); } -static void drawHallOfFameList(int first_entry, int highlight_position) +static void drawHallOfFameList(int level_nr, int first_entry, + int highlight_position) { int i, j; @@ -4581,15 +4585,18 @@ static void drawHallOfFameList(int first_entry, int highlight_position) void HandleHallOfFame(int mx, int my, int dx, int dy, int button) { + static int level_nr = 0; static int first_entry = 0; static int highlight_position = 0; int step = (button == 1 ? 1 : button == 2 ? 5 : 10); if (button == MB_MENU_INITIALIZE) { + level_nr = mx; first_entry = 0; - highlight_position = mx; - drawHallOfFameList(first_entry, highlight_position); + highlight_position = my; + + drawHallOfFameList(level_nr, first_entry, highlight_position); return; } @@ -4605,7 +4612,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) if (first_entry < 0) first_entry = 0; - drawHallOfFameList(first_entry, highlight_position); + drawHallOfFameList(level_nr, first_entry, highlight_position); } } else if (dy > 0) @@ -4616,28 +4623,27 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES) first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN); - drawHallOfFameList(first_entry, highlight_position); + drawHallOfFameList(level_nr, first_entry, highlight_position); } } - else if (button == MB_MENU_LEAVE) + else if (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE) { PlaySound(SND_MENU_ITEM_SELECTING); FadeSound(SND_BACKGROUND_SCORES); - SetGameStatus(GAME_MODE_MAIN); - - DrawMainMenu(); - } - else if (button == MB_MENU_CHOICE) - { - PlaySound(SND_MENU_ITEM_SELECTING); - - FadeSound(SND_BACKGROUND_SCORES); - - SetGameStatus(GAME_MODE_MAIN); + if (game_status_last_screen == GAME_MODE_PLAYING && + setup.auto_play_next_level && setup.increment_levels && + !network_playing) + { + StartGameActions(network.enabled, setup.autorecord, level.random_seed); + } + else + { + SetGameStatus(GAME_MODE_MAIN); - DrawMainMenu(); + DrawMainMenu(); + } } if (game_status == GAME_MODE_SCORES) @@ -5888,6 +5894,8 @@ static struct TokenInfo setup_info_game[] = { TYPE_SWITCH, &setup.handicap, "Handicap:" }, { TYPE_SWITCH, &setup.skip_levels, "Skip Unsolved Levels:" }, { TYPE_SWITCH, &setup.increment_levels,"Increment Solved Levels:" }, + { TYPE_SWITCH, &setup.auto_play_next_level,"Auto-play Next Level:" }, + { TYPE_SWITCH, &setup.skip_scores_after_game,"Skip Scores After Game:" }, { TYPE_SWITCH, &setup.autorecord, "Auto-Record Tapes:" }, { TYPE_ENTER_LIST, execSetupChooseGameSpeed, "Game Speed:" }, { TYPE_STRING, &game_speed_text, "" }, @@ -6445,9 +6453,23 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx) ToggleFullscreenOrChangeWindowScalingIfNeeded(); if (si->value == &setup.network_mode && - setup.network_mode && - !network.enabled) - Request("Please restart game to enable network games!", REQ_CONFIRM); + setup.network_mode != network.enabled) + { + network.enabled = setup.network_mode; + + FadeOut(REDRAW_ALL); + + ClearField(); + + FadeIn(REDRAW_ALL); + + if (network.enabled) + InitNetworkServer(); + else + DisconnectFromNetworkServer(); + + DrawSetupScreen(); + } } static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)