Skip to content

Commit b326980

Browse files
authored
Merge pull request #4420 from Goober5000/main_hall_popup_priority
only display one popup when the player gets to the main hall
2 parents 581fec1 + b8231a4 commit b326980

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

code/menuui/mainhallmenu.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ void main_hall_do(float frametime)
10591059

10601060
// see if we have a missing campaign and force the player to select a new campaign if so
10611061
extern bool Campaign_room_no_campaigns;
1062+
bool popup_shown = false;
10621063
if ( !(Player->flags & PLAYER_FLAGS_IS_MULTI) && Campaign_file_missing && !Campaign_room_no_campaigns ) {
10631064
int rc = popup(0, 3, XSTR("Go to Campaign Room", 1607), XSTR("Select another pilot", 1608), XSTR("Exit Game", 1609), XSTR("The currently active campaign cannot be found. Please select another...", 1600));
10641065

@@ -1079,13 +1080,20 @@ void main_hall_do(float frametime)
10791080
gameseq_post_event(GS_EVENT_CAMPAIGN_ROOM);
10801081
break;
10811082
}
1083+
1084+
// since all paths in this code block will take us to a different state, don't display any more popups
1085+
popup_shown = true;
10821086
}
10831087

10841088
// Display a popup if playermenu loaded a player file with a different version than expected
1085-
player_tips_controls();
1089+
if (!popup_shown) {
1090+
popup_shown = player_tips_controls();
1091+
}
10861092

10871093
// maybe run the player tips popup
1088-
player_tips_popup();
1094+
if (!popup_shown) {
1095+
player_tips_popup();
1096+
}
10891097

10901098
// if we were supposed to skip a frame, then stop doing it after 1 frame
10911099
if (Main_hall_frame_skip) {

code/menuui/playermenu.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,10 @@ void player_tips_popup()
14591459
} while(ret > 0);
14601460
}
14611461

1462-
void player_tips_controls() {
1462+
/**
1463+
* Displays a popup notification if the pilot was converted from pre-22.0 which might disrupt control settings. Returns true if the popup was shown.
1464+
*/
1465+
bool player_tips_controls() {
14631466
if (Player->save_flags & PLAYER_FLAGS_PLR_VER_PRE_CONTROLS5) {
14641467
// Special case. Since the Controls5 PR is significantly different from retail, users must be informed
14651468
// of changes regarding their bindings
@@ -1476,7 +1479,11 @@ void player_tips_controls() {
14761479
Pilot.save_player(Player);
14771480
Pilot.save_savefile();
14781481
}
1482+
1483+
return true;
14791484
}
1485+
1486+
return false;
14801487
}
14811488

14821489
SCP_vector<SCP_string> player_select_enumerate_pilots() {

code/menuui/playermenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int player_select_get_last_pilot();
4141
void player_tips_init();
4242
void player_tips_close();
4343
void player_tips_popup();
44-
void player_tips_controls();
44+
bool player_tips_controls();
4545

4646
// quick check to make sure we always load default campaign savefile values when loading from the pilot
4747
// select screen but let us not overwrite current values with defaults when we aren't - taylor

0 commit comments

Comments
 (0)