mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 04:49:39 -10:00
* only strip the legacy M/S suffix from the last pilot when needed player_select_get_last_pilot_info() chopped any trailing uppercase M or S from the LastPlayer value, a holdover from the pre-pilot-file era. Pilots whose callsigns end in M or S (e.g. BOSS) were never found as the last pilot. Now the suffix is only removed when the full callsign is not a pilot but the shortened one is. This also avoids indexing before the string when LastPlayer is empty. Co-Authored-By: Claude Opus 5.5 <[email protected]> * route all pilot selection through one commit function player_select_close() and player_finish_select() each had their own copy of the code that loads a pilot as the active Player, and the copies had drifted apart. Both now call player_select_commit_pilot(). This fixes two bugs: * -pilot did not work with the retail pilot select screen. player_finish_select() loaded the requested pilot, but then player_select_close() loaded the highlighted pilot (the most recent one) over it. The close handler now skips the load if a pilot has already been committed. * player_finish_select() ignored its is_multi parameter when setting player_was_multi, so scripted selection of a multiplayer pilot saved it as single-player. Scripted selection also now saves the pilot file, as the retail screen already did. The background bitmap handle starts out as -1 so that the close handler doesn't release bitmap 0 when the screen was never set up. Co-Authored-By: Claude Opus 5.5 <[email protected]> * select pilots automatically at game init, through the normal commit path -startgame, -connect and -almission (via Cmdline_use_last_pilot) used player_select_get_last_pilot(), which loaded the last pilot directly without most of the setup that a normal selection does. It skipped valid_pilot(), multi_options_init_globals() and saving the pilot file. Because it never entered the pilot select state, it also turned off the main hall's fallback for an unavailable campaign. Meanwhile -pilot and -benchmark_mode were handled on the pilot select screen itself, which scripted UIs replace entirely. All of these now go through player_select_try_auto_select() at GS_EVENT_GAME_INIT. It picks the -pilot callsign, else the last pilot if it still exists, else the most recently saved pilot. It shows the startup warning popups, validates the pilot, and commits it through player_select_commit_pilot(). The pilot is multiplayer if -startgame or -connect was given, and single-player otherwise. If there are no pilots, or validation fails, the pilot select screen is shown as usual. The main hall now allows the campaign fallback whenever a pilot has just been committed, not only when coming from the pilot select state. Co-Authored-By: Claude Opus 5.5 <[email protected]> * select a pilot automatically for -start_mission -start_mission skips the main hall, but it still waited on the pilot select screen. It now uses the same automatic pilot selection as the other quickstart options, so the screen only appears if there are no pilots. The pilot is committed as single-player, consistent with the main hall forcing single-player mode for -start_mission. Co-Authored-By: Claude Opus 5.5 <[email protected]> * skip the intro movie for quickstart options When the command line asks to skip pilot selection (-start_mission, -pilot, -startgame, -connect, -almission, -benchmark_mode), the intro movie now doesn't play either. It could take several minutes before the game even reached the pilot. The OnIntroAboutToPlay hook still runs, as it does when the mod table disables the intro. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
93 lines
3.1 KiB
C
93 lines
3.1 KiB
C
/*
|
|
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
|
*
|
|
* All source code herein is the property of Volition, Inc. You may not sell
|
|
* or otherwise commercially exploit the source or things you created based on the
|
|
* source.
|
|
*
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PLAYER_SELECT_MENU_HEADER_FILE
|
|
#define _PLAYER_SELECT_MENU_HEADER_FILE
|
|
|
|
#include "globalincs/pstypes.h"
|
|
|
|
// general defines
|
|
#define PLAYER_SELECT_UNINITED -1 // Used only on program start
|
|
#define PLAYER_SELECT_MODE_SINGLE 0 // looking through single player pilots
|
|
#define PLAYER_SELECT_MODE_MULTI 1 // looking through multi player pilots
|
|
|
|
// flag indicating if this is the absolute first pilot created and selected. Used to determine
|
|
// if the main hall should display the help overlay screen
|
|
extern int Player_select_very_first_pilot;
|
|
|
|
// functions for selecting single/multiplayer pilots at the very beginning of FreeSpace
|
|
void player_select_init();
|
|
void player_select_do();
|
|
|
|
/**
|
|
* Playermenu closing handler
|
|
*
|
|
* @details Called by game_leave_state when leaving GS_STATE_INITIAL_PLAYER_SELECT, finalizes player selection and
|
|
* prepares to enter the mainhall.
|
|
*/
|
|
void player_select_close();
|
|
|
|
// set when a pilot is loaded as the active Player; cleared when the main menu state is entered
|
|
extern bool Player_select_pilot_just_committed;
|
|
|
|
// whether the command line asks for a pilot to be selected without showing the pilot select screen
|
|
bool player_select_auto_select_requested();
|
|
|
|
// if requested by the command line, selects a pilot without the pilot select screen; returns true if a pilot was selected
|
|
bool player_select_try_auto_select();
|
|
|
|
// tooltips
|
|
extern int Player_tips_start_index;
|
|
void player_tips_init();
|
|
void player_tips_popup();
|
|
bool player_tips_controls();
|
|
|
|
// quick check to make sure we always load default campaign savefile values when loading from the pilot
|
|
// select screen but let us not overwrite current values with defaults when we aren't - taylor
|
|
extern int Player_select_screen_active;
|
|
|
|
/**
|
|
* @brief Validates the pilot with the given callsign
|
|
*
|
|
* @param[in] callsign The pilot's name/callsign
|
|
* @param[in] no_popup If true, supress any popups from being shown
|
|
*
|
|
* @return FALSE If pilot language is NOT the same as the current language,or
|
|
* @return FALSE If the player selected NO on any popup warnings, or
|
|
*
|
|
* @return TRUE otherwise
|
|
*
|
|
* @note This function calls blocking popup dialogs and should only be used within menus
|
|
*/
|
|
bool valid_pilot(const char *callsign, bool no_popup = false);
|
|
|
|
SCP_vector<SCP_string> player_select_enumerate_pilots();
|
|
|
|
SCP_string player_get_last_player();
|
|
|
|
void player_finish_select(const char* callsign, bool is_multi);
|
|
|
|
/**
|
|
* Creates a new pilot
|
|
*
|
|
* @param[in] callsign Name of the new pilot
|
|
* @param[in] is_multi True if this is a multiplayer pilot, False otherwise
|
|
* @param[in] copy_from_callsign If not null, copy the pilot with the given name
|
|
*
|
|
* @returns true if successful or
|
|
* @returns false otherwise
|
|
*
|
|
* @note Used by scripting
|
|
*/
|
|
bool player_create_new_pilot(const char* callsign, bool is_multi, const char* copy_from_callsign = nullptr);
|
|
|
|
#endif
|