* 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]>
* Allow modders to always show first game tip at start
This PR adds a simple boolean that allows mods the ability to always show the game tips in the same order, starting with the first entry. This is particularly useful if the mod is introducing something to new players.
The current behavior is to pick a random starting location, so this PR just always starts at tip index 0.
Tested and works as expected.
* add comment clarification
* make into integer instead of bool
* better tips index setting method
* spelling and static cast
* one more static cast
* make actual warning
* clang and consistent order
```
code/menuui/barracks.cpp:188:8: error: type ‘struct barracks_buttons’ violates the C++ One Definition Rule [-Werror=odr]
188 | struct barracks_buttons {
| ^
code/menuui/playermenu.cpp:82:8: note: a different type is defined in another translation unit
82 | struct barracks_buttons {
| ^
code/osapi/osregistry.cpp:478: error: type ‘struct Section’ violates the C++ One Definition Rule [-Werror=odr]
478 | typedef struct Section
code/pilotfile/FileHandler.h:18: note: a different type is defined in another translation unit
18 | enum class Section {
```
* Save/Load player options to a mod-specific ini file if possible
* use rfind instead of find to ensure it's the last dash character used for trimming
* cleanup + comments + nullptr
* A more robust way of getting the mod root using lambdas
* prevent infinite loop for non Knossos/Knet mods
* Notify the player if options may need updating and pull settings from fs2_open.ini if we can
* proper localization
* update xstr
1. Be consistent about the check for `Player` being null, as the `Player` variable may be used later in the function without a null check
2. Return early if there are no tips to show, so as to prevent a crash
3. Use `Random::next` rather than `frand_range`
4. Use `SCP_string` to avoid string overflow
Fixes a crash discovered in Star Fox: Event Horizon
There are three popups of decreasing priority that can appear in the main hall screen: campaign not found, pilot upgraded, and player tip. Only one of these should actually be displayed -- the first popup will take the player to a different screen, rendering subsequent popups useless; and the second popup is more important than the third popup. This PR prioritizes the popups accordingly.
Tweak the help for the 'bastion' command and change 'dcf_fov' to 'fov'. Also add a new 'mainhall' command that can be used in the main hall, not just the player select screen.
* rename pilotfile::version to pilotfile::plr_ver
* Fix typo in warning message
* set plr_ver and csg_ver to PLR_VERSION_INVALID on init and close
* add PLAYER_FLAGS_PLR_VER_LOWER and *_CONTROLS flags to player defines
* Add popup to intercept the player before going into the mainhall with an old pilot
* Move the Constrols5 info popup into the mainhall
* Modifiy pilotfile::verify() to allow player flags to be passed on to callers
* Rename valid_pilot_lang() to valid_pilot()
* valid_pilot() checks plr_version of the pilot and prompts the user if they want to continue loading or not
* add no_popup param to valid_pilot() to allow scripting to use it
* Correctly clear the PLR_VER_CONTROLS player flag
* operator== is not operator+=
* don't clear player flags when closing a pilot file
* player tips popup comes after any warnings
* save committed pilot on playermenu close
* doxy playermenu::player_creat_new_pilot() and magagepilot::init_new_pilot()
* * add validation/safety catch in the barracks to prompt user if they want to select/convert a pilot with version mismatch
* PLAYER_FLAGS_PLR_VER_CONTROLS is a savable flag, cleared in the mainhall after the popup is dismiessed
* Move version flag sets in plr::load_player() and plr::verify() after calls to player_read_flags()
* Drop hints to players they should use a clone of the pilot in version prompt.
* Went ahead and added a VERSION_HIGHER flag and conditional in valid_pilot()
* Move Controsl5 notice popup into playermenu, next to the player_tips_pop(). Also allows player to "Don't show this again"
* Ignore plr version flags during unit tests since .plr -> .json conversion is never a pure clone
* Address CI issues:
* clang-tidy: use nullptr (modernize-use-nullptr)
* Add XSTR support to valid_pilot() and player_tips_constrols() popups.
* * Rename new PLAYER_FLAGS to something more descriptive
* Edit Popup text to be a bit more concise
* Add missing punctuation to language popup
* Cmdline parsing for `-pilot "<name>"`
Add cmdline parameter `-pilot` with required
argument name and export name as global var
`Cmdline_pilot`.
* Expose to scripting `isAutoselect`
Setting `-pilot` flag sets `ui.isAutoselect()` true
(as does `-benchmark_mode`).
* Skip pilot selection
and call `player_finish_select` with the given
player instead.
* More useful error message on pilot load error
Also display callsign
* Add pilot name as scripting variable
* Don't expose pilot flag to launchers
* make stored flag param `const`
This is a minor follow-up to PR #2390. There are a few minor differences between untranslated strings and the internal strings in strings.tbl; this PR fixes them.
This commit adds new id for existing strings, so that they are translateable through the strings.tbl.
The following is translateable now:
- The 'or' seperator in the Keypress Directive gauge, if one function is bound to two keys.
- The Supernova warning.
- The error message that is displayed prior the pilot selection screen, if something is wrong with the loaded modification.
This changes the pilot reading code to always use JSON files for storing
the pilot data. Old pilots are converted to the new format when FSO
starts and after that point only JSON pilots will be used.
This adds a new class which allows to create type safe resource handle
types. At the moment, the engine uses ints pretty much everywhere for
providing handles to resources created by the specific subsystems. Since
all ints are the same to the C/C++ typesystem it is perfectly legal to
pass a sound handle to the graphics API as a buffer handle which will
obviously cause issues.
This adds a new type called "ID" which is a wrapper class for a generic
handle but with added type safety. An instance of this class cannot be
passed to a function expecting another type of handle which provided
compile-time type safety for these APIs.
As an initial test I converted the game sound handles to this new type.
I already found a bug in the mainhall system thanks to this new type.
The mainhall used the game sound handles as sound instance handles which
probably meant that that specific code never really worked right. I
removed the code since there was no better alternative for fixing it.
This adds proper Unicode support by allowing the parse system to read
UTF-8 encoded files. The new mode is controlled by a mod option which
allows older mods to continue using the legacy text encoding.
That option changes the behavior of several systems in FSO. It disallows
the usage of Volition fonts since they don't support Unicode encoding
and changes a few usages of special characters to their unicode
counterparts of generic rendering solutions.
This fixes#1415.
This allows to use standard TrueType Fonts for text rendering in FSO. It uses the NanoVG library which provides the ability of drawing 2D shapes. This library is used for most 2D operations now and can also be used directly by using the PathRenderer class.
Make hitting the "delete" key in the pilot-selection menu do the same thing as clicking on the "remove" button.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11202 387891d4-d844-0410-90c0-e4c51a9137d3
Set Lcl_special_chars when changing fonts
Change some copyright chars to use Lcl_special_chars
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11016 387891d4-d844-0410-90c0-e4c51a9137d3