* Fix LUA Steering Control Override
I've been using `LUA_FULL_CONTROLS` in the updated mouse-as-a-joystick script, and it works well, but there's one last small bug I'd like to fix. `LUA_FULL_CONTROLS` affects things that beyond just steering values, which has the unfortunate side-effect of also overriding non-steering controls such as cruise percent. It would be less intrusive to use the `LUA_STEERING_CONTROLS`. Unfortunately, `LUA_STEERING_CONTROLS` just sets everything to 0, which I think is a code issue bug that has been around since the lua controls were added in 2010 (https://github.com/scp-fs2open/fs2open.github.com/commit/2a69aaa23ba0def3dbfb9f566706e7130a33866f).
This PR fixes usage of `LUA_STEERING_CONTROLS`, and in testing everything works as expected (including fixing the cruise percent issue). Also, I do not think there are any scripts that use `LUA_STEERING_CONTROLS`, but if desired I can make a new version called `LUA_STEERING_CONTROLS_FIXED` or something to that effect.
* correct order of if-check
It's theoretically possible for `parent_type` to get out of sync with the parent's type, particularly if the parent is destroyed. Since the field is almost never used, it can be removed.
Should fix#4105.
1) Fixes the ship and wing dialog resizing for both sexp help and arrival/departure cues
2) Restores the sexp help in the Mission Goals dialog, which had been broken since the mini-help-box was added
* Coverity 1361855 Always free Vertices and Indices
* Coverity 1361844 - Same type of memory leak
Don't forget to do the same changes to sphere init
* nullptr, not NULL
1) If a ship has its regular name change, clear the display name
2) When placing ships in FRED, truncate the ship name, if necessary, before creating the default name
FS1 has a feature which will occasionally convert a wingman message to a Command message. This adds a few more checks to that feature:
1) Make the command-conversion code and the alive-check code mutually exclusive;
2) If the filename is not a FS1-style persona, don't change either a) the filename, or b) the talking head
Fixes#3759.
Bug #3672 was caused by the dead popup not being cleaned up properly when the player-dead state was left. Closer examination revealed some possible holes in the cleanup logic - e.g. the game assumed that the mission would proceed to the debriefing but neglected the possibility that it would exit to the main hall. This consolidates the two dead states and attempts to make the cleanup more robust.
Fixes#3672.
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.
PR #3342 meant that occasionally FRED would try to save a message that didn't exist. Make sure the old saved index doesn't point past the end of the valid message list.
Fixes#3996.
`gr_get_string_size` takes a length parameter, but `split_str_once` was calling it with the position instead. This led to incorrect results occasionally. If the incorrect pixel width had the bad luck to be exactly equal to the remaining space, this would cause an infinite loop. This fixes the bug and adds a bunch of safeguards to prevent a similar situation in the future.
* Clean out player t_plr before use
* Directly reference t_plr instead of player* p
* player* p Needs to be set in ::verify() for other pilotfile:: methods to work
* Document things
* Maybe use a format that doxygen can understand
* Use dict comprehension to clean up main.groups a bit
* More docstrings
* Move FileGroup into module its supposed to be in
* Remove nightly-trigger.yml
* Rename workflow files to better describe their actions
* Re-add post build capabilities
* Post-build may be triggered by build-release.yaml or manually
* minor doc update to file_list.get_ftp_files()
* Maybe fix yaml errors
* "You have a syntax error on L345" Gee, thanks github debugger. Could you tell me what exactly that error may be?
* More fixes
* More fixes
* fix typo
* fix typo
* Allow manual trigger to specify releaseTag
* Try omitting the default for string
* Use correct .inputs member
* try environment instead of env
* Try elevating scope of env
* Comment out stuff to directly test env passing
* See if echo is working correctly
* Test if top level env is in scope
* Try github.event instead of github.events
* Uncomment lines, use correct context signature
* Pass ref_name to post-build-release workflow
* Fix arguments to git
Stash linux package since it can fail, too
* str and repr cannot be compared
* Get repo metadata differently to allow tests on forks
* echo repository var
* config["templates"] does not have a member ["installer"] so... we'll use ["release"] instead
* debug render_installer_config. file groups malformed?
* Print out both keys of groups dict
* debug get_release_files. print binary_file list
* Revert file_list debug print
Try sorting binary_files by ReleaseFile.name
* Add checks before running mako to improve debugging QoL
* revert change to installer.py
* maybe fix call to render_nebula_release
* type the files argument to get IDE hints
* Revert typing.... :(
* missing parenthesis
* Disabled installer mako rendering
* Error check in ForumAPI to allow tests to continue
* debug print hlp forum key stuff
* Instead of none, check ""
1) Don't knock the player out of the warp if the sequence has already moved to stage two. It breaks the sequence and the game will still end the mission anyway.
2) Remove the Volition code for calculating player speed. It did not actually affect the speed, but it *did* affect the calculation of warp distance which often caused the player's ship to miss the portal.
The orientation was broken since the engine rendered the decal box in
the direction of the hit normal which meant that the viewer was looking
at a flipped version of the decal texture.
This fixes that by flipping the direction of the decal before passing it
to the GPU.
This also fixes the orientation for weapon decals which previously did
not take the orientation of the weapon that just impacted into account.
This was broken by the move to a single, global uniform buffer where we
started doing suballocation so offset 0 was reading bad data.
Also fixed a crash regarding an unknown locale name on Linux.
* Try using softprops/action-gh-release
* Try *_path instead of *_name
* Document action dependencies
* Use consistent versioning in some places
* Maybe continue windows_zip should an upload fail
* Skip building standalone image if not on source repo.
* Stash the windows zips to artifact ftp in case the publish steps fail.
* Combine publish steps into one step
There were two bugs that kept this from working until now:
1) The destination goal point was calculated to take the ship right through the center of danger. Flipping the vector now takes the ship away from danger as intended.
2) The original AI code did not turn the ship at all. The new code turns the ship toward its goal point.
The fixed behavior is tied to the new `$fix keep-safe-distance:` flag.
Allow scripts to reference submodels, submodel instances, and model instances. Currently just a few properties (like Orientation and Radius) can be accessed, but this can be easily expanded in the future.
Also add relevant functions to calculate real-world positions and orientations of rotated submodels.
Consolidated these functions and replaced the `find_submodel_point_*` functions with their closest `world_find_` counterparts. (One of those functions may not have actually worked correctly.) Also use the correct coordinate logic when returning normals from collision info in scripting.
Related to #3985 although not yet a fix for it.
When returning objects, be sure to use `ade_set_object_with_breed`, per the documentation on that function. This ensures that all relevant subclass information can be used.
Also fix the return value of streaminganim's isValid() function.
* Treat mouse axes as Joy0 axes if Use_mouse_to_fly is true.
* Treat mouse buttons as Joy0 buttons when Use_mouse_to_fly is true
* Don't spin out of control like a 3yo on pixie sticks when treating the mouse axes as Joy0 axes
* Address CI Issues 1
* Try FALLTHROUGH macro to appease the compiler gods.
* * Change the labels in the Options menu UI for the Mouse On/Off buttons
* Nudge the hardcoded postions for the labels for bothGR_640 and GR_1024 resolutions
* Adds the following XSTR indices
1665 "Mouse Input Mode"
1666 "Joy-0"
* Update player_tips_controls() to mention the changes to the Mouse Input Mode
* Nudge the hardcoded postions for the labels for bothGR_640 and GR_1024 resolutions
* Adds the following XSTR indices
1665 "Mouse Input Mode"
1666 "Joy-0"
* 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
1) Remove operator caching from `is-cargo-known-delay`, `cap-subsys-cargo-known-delay`, and `has-been-tagged-delay` so they can be used with `when-argument`
2) Note idiosyncrasies of `and-in-sequence` in SEXP help
3) Document logic for inverting known-true and known-false in `sexp_not`
Should fix#4013.
A couple quality-of-life improvements for event logging:
1) Indent the SEXP operators according to their depth in the node tree
2) Add newlines between variables and containers
As @Baezon figured out, when a host exists, `get_info` will return the orientation relative to the host. When there is no host, `get_info` returns the absolute orientation. In the latter case, `set_rotation_facing` does not need to do extra calculations to find the delta orientation.
Follow-up to #3989.
There is a bit of code that detonates a missile if it misses impacting on a subsystem. On Nyctaeus's Arachnas model, missiles could reach the center point of the main beam turret submodel without actually hitting any part of the submodel. The fail-safe code would set the missile to detonate in that case, but on low-FPS systems the weapon would be able to actually hit the turret before it detonated. On high-FPS systems, there is a clean miss.
This reworks the code to delay the missile detonation until it reaches the other side of the submodel, so it has time to hit some other part of it. It also reduces the detonation time from 1/100 of a second (which is more than one frame on 120 FPS systems) to 1/1000 of a second (which is always less than one frame).
* Fix limitations of GetColor script function
It is very valuable for custom HUD gauges to be able to show/use the IFF color of any given object. Previous scripting solutions were limited and did not account for traitor status, varying team combinations (i.e. TvT multiplayer), and other cases.
This PR allows scripters to get the IFF color of a given object properly, as it uses the same method that retail HUD gauges use.
Also, it turns out there was already a function `hud_get_iff_color` defined in `hud.h` It was never used though, as `hud_set_iff_color` both got the color then set it. I've added the color getting to the get function and the setting to the set function, that way the script function can easily just call the `hud_get_iff_color` function. If this is undesirable I can instead copy the entire logic of the function `hud_set_iff_color` into the script section.
Tested and works as expected.
* fix nil return
* clarify param comments
Previously, the damage display gauge only showed the integrity for subsystem types. This was fine if there were a 1:1 match, with each type only having 1 subsystem. If there were more then 1 subsystem of a given type though, it would not display accurate information to the player.
This PR sets the displayed subsystem integrity to that actual specific subsystem, not the aggregate. Tested and works as expected (screenshot attached) and fixes#3982.
Mostly renaming of fields and functions, and moving some modelread sections into functions. This reorganization will put the code on a better footing for the model translation feature. No model translation code is included yet, and there should be no change in functionality.
Treating both bindings together will fail when a player has one binding inverted but the other uninverted. This was complicated by the dual-binding method mysteriously delegating to the single-binding method in certain cases. This change removes the dual-binding methods altogether and explicitly handles the bindings individually. It also adds additional scripting VIRTVARs for all current use cases.
The new animation system sets submodel initial positions on ship creation, but FRED was also indirectly setting them by calling the techroom method. Initial positions will not work correctly if they are set twice.
The `fredhtl_render_subsystem_bounding_box` function only handled one level of submodel positioning, which worked for turrets but not more complicated submodel stacks like the Ma'at. This properly handles all submodels in the hierarchy.
Fixes#3971.
There are a few related improvements here:
1) Add a new function for iterating over the submodel hierarchy
2) Add a counterpart to the `subobj_num` field so that a submodel can refer to its ship_info subsystem
3) Update `ship_model_replicate_submodels` to replicate all movable submodels, even the ones that aren't associated with subsystems
Fixes#3967
* Add view show status for HUD gauges in scripting
Many FSO mods use scripted HUD gauges, but previously the scripted HUD gauges were always forced to be on for the player, unlike retail gauges that can be toggled in the HUD Config screen. This PR allows scripters to view the show status of a HUD gauge, which is very useful for adding a check in the script to only show the gauge if a certain gauge is active. This is similar behavior to the getColor function, which allowed scripters to get the HUD Config colors of a given default gauge.
Tested and works as expected.
* appease clang
* Make a Big ol' Wall of Text which, hopefully, somebody might actually read.
* Address issue 3902 in plr.cpp
* Handle case when axis is not bound
* Appease Linus-X
* Make wall of text less wall-y
A few assorted fixes for timestamps:
1) The pre-player delay should be fast-forwarded by 1/4 second per frame regardless of time compression
2) If time compression is very slow, there could be a 0-millisecond change in timestamps, so don't adjust this
3) Properly handle a change in soundtrack that occurs during a mission, not just when the mission is parsed
This really only applies to DNS lookups, setting the preference to either
be for IPv4 or IPv6 addresses. This makes for a far less error prone
troubleshooting method than disabling one of them outright.
* Merge all three comm_order arrays
Were Comm_orders, Sexp_comm_orders, and Player_orders. Now all Player_orders.
* Fix Warnings
* Fix erroneous order warning
* Update Int3 into a warning
* Fix missing location for warning
If a breakpoint is hit in the code, the SDL time will keep running even though FSO doesn't realize things are effectively, if not actually, paused. Detect this situation and adjust the timestamp offset to compensate.
This is required for truetype fonts, otherwise it crashes during font
loading. It still wastes a good bit of memory however and will need
to be addressed with a more permanent solution in the future.
A standalone server can reset itself, which triggers game_level_close(),
before game_level_init() has been called. trails_level_close() didn't account
for not being inited first and would crash.
The file used by bmp_load()/bm_load_animation() is a hardcoded
interface image on standalone servers. If the value of dir_type
isn't ALL or INTERFACE then it can't find the image. For ship
textures this can cause primary weapon hits to not register on
the server.
By anchoring a dockpoint to a submodel, the dockpoint will move when the submodel moves. Historically this has been done by inspecting the path associated with a dockpoint, but this method will not work if there is no path or no rotation mode specified. Here is an alternate method that allows the submodel to be specified explicitly through a dockpoint property.
For a long time, bay door animations would not trigger if the player was arriving from the bay as the the only ship in the wing. This was fixed by adding a check for the player. This check uses the `Player_obj` to check if the ship is as player, which does not work on standalones since the `Player_obj` is always the Standalone Ship.
This PR changes the check to check if the flag `Player_ship` is set, which is a common strategy used to make these kinds of checks work on standalones.
Tests show the old behavior still works as expected.
Previously, the game used a dead-reckoning system for measuring time, where several time counters were incremented as long as time was running. This unfortunately has no way to synchronize time in the long term, and therefore in-game time will tend to run faster or slower than real time by a few percent, depending on various factors.
This PR redesigns the timestamp system to use the SDL time counter which will always keep it in sync with real time. However this necessarily involves a bit of clever handling when the game is paused and unpaused. It also revealed several minor bugs in several places in the code where timestamps were handled.
This PR is currently in draft status until the design can be updated to handle time compression. In all other respects it should be working.
The timestamp fix/cleanup in #3878 revealed a longstanding bug with music timestamps--the timestamps were never set to something valid later.
This is a widespread issue in the code, fortunately Goober is modifying the timestamp code to accommodate invalid timestamps.
Tested and works as expected. Fixes#3930.
* Split glow current brightness calculation into a new function for reuse and clarity
* Readability cleanup pass on model_render_get_point_activation
* created a new code path to add the lights for the player's ships' glowpoints without rendering their sprites.
* cleaning up unused args from new glowpoint functions
* cleanup redundant externs
* Documentation and naming pass
* Allow AI flag for bay orientation to account for parent `uvec`
The previously added flag `Fighterbay_arrivals_use_carrier_orient` (#3698) incorporated the parent ship's `rvec`, which greatly helped align emerging ships from fighter bays. In parent some ships though, emerging ships still showed a `uvec` that did not match the parent ship (such as FotG's Star Destroyer). This PR allows the `Fighterbay_arrivals_use_carrier_orient` flag to take parent `uvec` into account.
Note, that departing the mission into a bay already has code to ensure a `wheels-down` landing.
PR is tested and works as expected/fixes `uvec` issue.
* only set uvec as lazy option
Previously, multiplayer missions with wings with waves would incorrectly set the `net_signature` of ships in the initial wave. The code is supposed to only set the `net_signature` if it was past the initial wave. This is because original ships in the wave have their `net signature` set at mission parse.
This PR fixes that and has been confirmed to work via multiplayer tests.
* Move dynamic XSTR stuff out of controlsconfig.cpp and move it into controlsconfigcommon.cpp.
- Needed because these strings are used in places other than the controls menu.
* Add AI to Fix Negative Turret Ammo
Previously, turrets with ammo would end up firing one extra shot, resulting in a -1 ammo.
This was because of the check `ammo[bank_to_fire] >= 0`, in `aiturret.cpp`. This PR adds an AI flag to have the turret only fire if the ammo is greater than 0 (`ammo[bank_to_fire] > 0`), as opposed to greater than or equal to 0.
Tested and the flag fix works as expected.
* feedback
* set to on for target 22
* Add C++11 std::any implementation
* Add basic moveable functionality
* Add rotation moveable
* Revise Segment Parsing Register
Because apparently, the linker and I disagree on which symbols should be discarded when linked into the final application...
* Fix small problems
* Address feedback
* Address feedback 2
Move the initialization of `used_weapons` to `weapon_init` since that's where it belongs. Also call `weapon_level_init` in the lab since investigation revealed a few other things that needed to be done there.
Multiplayer screens such as PXO lobby, chat boxes, and multi-game setup screens had hard coded values for the number of lines to display. These would only work correctly with the default .vf font01 from retail. If a mod or user used a TTF or other .vf font than text would spill over. This PR makes these values take into the account the font used.
Tested and works as expected with TTF fonts and the retail fonts. Marking as draft to see what others think.
It turns out the particle preloading fix revealed a long standing bug in the particle `pageIn()` function--it should be calling `bm_page_in_texture()` instead of `bm_page_in_aabitmap()`. It's been wrong the entire time and we didn't notice because of the frame bug, which was fixed in #3884. Without this fix, when it's preloaded it locks the image as 8-bit, when it force loads it's 24-bit. Tested and works as expected.
Fixes#3890.
Massive thanks to taylor for spotting this!
* Updates the AxisInverted hooks to use the new CC_bind. Currently assumes only Joy0, so this may need further tweaking or replacement
* * Add ability to claim up to 4 joysticks for player use, using the launcher (via registry or fs2_open.ini) or the new menu system
* Hack into existing control polling system to get the new primary/secondary binding schema to work. This should be reworked into a reverse-lookup system.
* Finally break the mouse loose from overlapping with Joystick binidngs
* Fix bug where joy button wouldn't register on search function
* Fix bug with mousewheel not always decaying as it should.
* Fix rebase conflict with selecting item during search mode
* Fix bug where mouse buttons were incorrectly labeled.
* Move some enums around
* Fix bug with joy axis labels being displayed as buttons.
* Fix possible bug where Other conflict axis wouldn't clear
* Updated default joystick axis text. A new strings.tbl will need to be supplied for localization support
* Deprecate nAxisInverted ADE functions and replace with AxisInverted(int, int, bool)
* Merge Axis mappings into Control_config
* More utility functions for CC_bind and CCB
* Adds another ADE function for inverting the axis action, instead of individual bindings
* Hacks to get plr file to compile. Currently slices out many of the new features like secondary axis and the mouse axis, and the additional joystick bindings (joy1, joy2, joy3)
* Fix bug with uncontrollable spin (slopily)
* Fix some warnings
* Add flags for Hats and Balls for future implementation
* Fix bug where inverting an axis would trigger an assert
* Fix bug where joy wasn't detected as present
* Most axis actions should be relative, instead of absolute
* Hopefully optimize joy_get_unscaled_reading
* Properly break out of double-for search function for search and bind modes in config menu
* Refactor control_get_axes_readings to provide more consistent behavior
* Use JOY_REL_THROTTLE instead of Action::REL_THROTTLE when indexing into Control_config
* Bank axis has a default binding, Throttle does not.
* Fix bug where conflicts weren't being detected.
Fix bug where default presets weren't being detectd
* Elegantly break out of double fors with goto.
Fix bug with bind mode not detecting axis
* Save new binding scheme to playerfile
* Add cid_assign() to standardize cid assignment with shorts
* Add write and read handlers for int8_t
* Remove saving controls to csg. This will be replaced by presets.
* Fix bug with reading pilotfile
* Use "Joy-n" instead of "joystick n" to match default identifiers in config menu
* Fix bug with CC_TYPE_TRIGGER controls always marked as used, if not bound with a key.
Fix bug with Joy-0 btn 1 triggering multiple controls that are not bound to it.
* Improve readibility of the joy info output to log
* Message when a joystick connects and using legacy system.
* Fix bug where system joystick 0 was mapped in pJoystick that should've been nullptr
* Fix bug where *not* having a joystick will cause bind mode in the config menu to immediately cancel.
* Add reverse lookup functions for actions. mActionToVal[] does string -> int, mValToAction() does int -> string
* Add the foundation for writing the presets files.
* Adds a bunch of reverse lookup functions to get the stringified version of various enums, etc.
* presets.h and presets.cpp are in something of a barebones at this point
* Add new subdir for preset files 'player/presets'
* add utility for finding the distance of a bitfield/bitmask. Used to translate mouse button masks into mouse button id's
* Write PresetFileHandler as standalone, instead of a subclass. Still mostly a copy of JSONFileHandler
* Make functions to map and reverse-map the bindings for use with the preset files and ultimately the ControlConfigDefaults.tbl as well
* Check presets from file to see if they are duplicate with an existing preset.
* Check for uniqueness of presets fron controlconfigdefaults.tbl before adding them, and warn the user if there are duplicates.
* Rename the test functions into proper load/save.
* save function has some standard checks
* load function is called on init
* make finding duplicates its own function outside of the preset label rendering function
* Initial draft of saving presets in-game
* Fix bug where all loaded presets were thought to be duplicate of defaults.
* Fix bug where preset cycling would get stuck on the first preset other than default
* Fix bug where saving a mouse button saves the wrong textified string.
* Prevent preset names from being too long.
* Crash still occurs if the name is too long, as if set outside of FSO
* Workaround text running off the popups in 640x480. Doesn't look as nice, sadly
* CSG's now track preset names instead of containing bindings
* remake control_config_reset_defaults() into control_config_use_preset()
* provide a function to get the currently selected preset.
* Do PLR backward compatibility, hopefully.
* PLR now tracks presets instead of saving the bindings.
* On Loading pre PLR3 or CSG6 data, create a new preset.
* Strip off file extension before saving preset files. Jason.json.json just looks dumb
* Add "-joy_info" commandline option. Will output SDL joystick info of all detected joysticks to stdout
* Fix non-standard behavior with registry_read_string().
* Returning NULL instead of the default value, or an empty string, will trigger an access violation with SCP_string and other string copy functions.
* Modify io::joystick::init() to take an optional param, no_register, to use with -joy_info
* Address CI complaints
* Address CI issues 2.
* Supress preset duplicate warning if in unit tests.
* Address scripting unittest failure due to incorrect argument type. (Ints don't technically exist in LUA)
* Use Mouse enums instead of Joy enums or magic numbers
* More signed/unsigned madness
* Address CI issues 3
* Address gcc-5 issues. (No auto in lambdas)
* Fix bug with bit_distance()
* Address gcc-5 issues 2
* Address clang issues
* Address clang-tidy issues
* Address clang-tidy issues in undosys. May need to be cherry picked to Controls2.
* Address clang-tidy issues
* Improve logic of preset name prompt.
* Fix bug with selected presets not being saved
* No, a cstr is not a std::string.
* Can't use i there because its already defined.
* Fix bug where CSG's wouldn't save selected preset
* Fix bug where presets wouldn't be loaded correctly from player files
* Fix bug where loaded preset files would not update the preset cycle position correctly
* Some QoL changes for the preset name prompt
* Address Appveyor issues.
* Add forward compatibility for player file. This is required because currently any "missing" data in the pilotfile will trigger an Error, and crash FSO.
* Fix bug where mouse X axis was unusable.
Apparently stating that MOUSE_Z_AXIS IS MOUSE_Z_AXIS doesn't get the point across.
* Address CI issues.
* Address CI issues.
* sel default assigned to -1
* static_cast enum to an int
* Assimilate -joy_info int -get_flags, replacing the existing method that launchers use to get joystick information.
* Add '\n' to PST log messages.
* Change logic of checking joystick .ini keys: Should the multi-joy key not be found, try legacy joy key.
* Add some more missing '\n' to mprintf messages.
* Notify the player when converting to the new multi-joy system. (Using ReleaseWarning for now...)
* Warn the player if a preset defined in their .PLR could not be found.
* Actually disable control items without a valid tab, instead of relying on the fact that they're disabled by default.
* Add CC_preset::is_duplicate_of() method to make checking for preset uniqueness less of a brain teaser.
* Doxy the first_override param of control_config_common_read_section
* Adds the os::dialogs::Information() method, which displays an information-only dialog in similar format to Warning and Error dialogs. Does not throw Warning nor Error exceptions
* load_player now uses os::dialogs::Information() instead of ::ReleaseWarning, thus not halting unit tests.
* Breaks retail localization support for Joystick and Mice labels - This is because the new multi-joy axis end up very confusing "Joy-0 Joystick/Mouse X Axis"
* Renames Joy_axis_text to Axis_text, intended to be used both by joysticks and the mouse.
* Moves mouse axis and button labels into an array to ease future XSTR support
* Adds asserts to ensure indices are within the array sizes of label arrays
* Adds XSTR indices for Axis labels, mouse buttons, and mouse wheels.
* Seperates conflict check comparisons from equality comparisons.
* Conflict checks can ignore certain combinations of CC_bind::flag's; i.e. an Axis bound to a different control but is inverted or relative will still cause a conflict with another control that has the same axis
* Equality comparisons is exact equality, allowing presets to check if binds have the same binding and flag configurations.
* More UI string changes and localization
* Tweaks positioning of top button labels in CC menu
* Adds the following XSTR's:
1659 "Preset: %s"
1660 "Preset: custom"
1661 "Next Preset"
* Fix bug where mouse axis turned into mouse button when inverting control by its control name.
* Fix bug with the new conflict checking subroutine not working with non-axis controls
* Address CI issues.
* Don't trigger modal popups while in unit tests.
* Address clang tidy issues
* use nullptr
* be consistent with conditional style
* use booleans to stuff debug states, methods with just Assertions in it will trigger a false positive on clang tidy
* use string::empty() instead of checking for "".
* Remove dead code of -joy_info. Functionality has been merged with -get_flags
* Address clang-tidy [readability-simplify-boolean-expr]
--z64 says "I don't like it!"
* fix axis check
* Implement revised axis action virtvars for scripting. Also protect against a control mismatch in the CSG file due to a script-inverted control
* Encapsulate CC_bind properly
* Add mouse and joystick cid's to AxisInverted description
* Update translate_key() and its user to correctly translate multijoy bindings for training messages.
* Prompt user trying to escape from config menu when they have changes.
* Remove dead function.
* Fix crash during training missions due to key translation that would overflow internal buffer.
* Went back with cstring as return value instead of SCP string, because caller would need a significant refactor
* Update doxy of the textify functions
* Unify textify_scancode() and textify_scancode_universal() to ensure common code path.
* Add "Multijoy" entry to json caps. (For Knossos)
* Make CI happy.
* Remove unused lambda captures.
* Instead of overwrite during plr2 => plr3 conversion, try to use the existing preset file.
* Fix conditional for checking if file exists within presets::save_preset_file()
* Revert Majority of PR#3739
* PLR and CSG versions are incremented past versions set by 3739
* Forward compatibility feature of #3739 (Only save sexp containers into the CSG if they are used) is removed
* Remove forward compatibilty of PLR file when going in between pre- and post-Controls5 FSO versions
* Add missing startSection() and endSection() for csg_write_controls()
* Fix clang-tidy error #1
* Fix clang-tidy error #2
* fix clandy tidy error #1 part 2/2
* Fix clang tidy error 3
Co-authored-by: Goober5000 <[email protected]>
Co-authored-by: Tyler Blount <[email protected]>
Co-authored-by: wookieejedi <[email protected]>
Co-authored-by: BMagnu <[email protected]>
In FS2, the HUD will automatically target the first turret on any BIG or HUGE ship. In FS1, this did not happen. This adds a flag to disable the new behavior.
The change is needed because the scan view cone is significantly constrained when any turrets or subsystems are targeted. This makes Playing Judas quite a bit more difficult than it was designed to be.
Modify bm_load() so that it will only search in intended paths,
improving performance of both fast and slow loading of image
files. Now matches behavior of the other bm_load_*() functions.
By default cf_find_file_location*() will always hit the filesystem
for certain paths. The flag for this was not reset between different
paths so it ended up always hitting the filesystem.
Previously the `bm_page_in_aabitmap` call in `ParticleProperties::pageIn()` used -1 as the number of frames. It seemed particles with more than 1 frame still worked correctly, but likely prevent preloading of particles. This PR fixes that to use the actual number of frames.
* Change animation turret canonicalization to now correctly calculate the closest natual turret positon
* Add angle error to vm function for convenience
* Div by Zero safety for non IEEE compliant systems
* Incorporate style changes
Some SEXP errors, although they indicate real problems, will not prevent the mission from running. Add these as exceptions. Implemented per requests from users of Blue Planet and Solaris.
The cfilesystem cleanup PR (3734) failed to take pathtype extension
filtering into account when indexing loose files. This adds back that
functionality to prevent extra/unknown files from being indexed.
Fixes#3863
Awacs team arrays only need to be initialized once but were
expanded by Iff_info.size() every second of a mission and never
cleared.
(Also includes cleanup)
* improve handling of PXO lobby banners:
- add custom banners support for mods
- remove broken banner randomization code (from retail)
- remove banner hover outline if it's not really clickable
- randomly choose a new banner over time if user is in lobby long enough
* Switch Multimsg to use netsig for animations
* Unique-ify animation ID's
* Clang Tidy
* Implement first suggestions
* Implement suggestions 2
* Add get model instance safeguard
One of my XSTR and localization fixes from last year did not account for the presence of custom languages. This PR uses the correct threshold and also adds a warning in case some mod really wants to define more than 6 additional languages.
1) Sync formatting of each place SEXP errors are reported
2) Add error location (event or goal) if possible when mission is loaded
Note that the two FRED error dialogs already indicate the event or goal.
Previous code allocated 4x bsp_data_size for alignment, whether it was
needed or not. Now it should allocate slightly more than 2x and only if
alignment is required.
By default, new pilots have `Model` and `Nebula` detail only set to 4/5 (all others are on 5/5). Furthermore, clicking `Very High` on the model presets options still does not increase the `Model` or `Nebula` detail, as they remain at 4/5. This occurs with making a new pilot in retail, along with making new pilots in mods with a game settings default detail level of `Ultra`.
Simply changing the default values in the code for `Model` and `Nebula` detail to match the other detail levels is the easiest and cleanest solution IMO. I would be happy to alter this though to use a game settings table flag instead, if that is preferred.
Tested and works as expected.
Fixes bug in the old dynamic cf_get_file_list() introduced by the
3734 PR. That PR used SDL_strlcpy() to copy the filename which
always null terminates the string, but was only given the length
of the string itself as the available space, so the last character
was removed.
The game setting table allows modders to set the default noise levels for new pilots, but the game did not actually use the values set in mod table. This PR fixes that and adds safety range checks, too. Tested and works as expected.
* New configuration table for HDR tonemapping and related data.
* lighting profiles conslidation and cleanup
* Appease CI
* Lighting profiles parser now parses all tonemapping options
* simplified light profile parsing logic further
* Refrences for tonemapping functions added
* cleaned unused function definition
* Extra documentation for lighting tables
* Fixed lighting profile value label error
* Converted current_piecewise_values to const reference
1) Changes the submodel flags to use a flagset instead of several booleans
2) Adds `rotate_accel` to allow submodel rotation acceleration to be specified
Submodel acceleration can now be instant; dumb-rotating submodels always instantly accelerate (and have always done so)
* version1 of 'head-on'lasers
* version 2 of head on lasers
* better handling of radius/length
* more adjustments and manual switchover angle
* add switchover rate and glow head on
* bugfix
* allow for instant switchover
* clean up and documentation for PRing
* misc fixes
* more fixes
* more fixes
a) add a new method gamesnd_game_sound_exists
b) add script support for this new method
c) use this method when checking for existence of ballistic rearming sounds
d) prevent "empty" and "none" sounds from triggering warnings
Some instances of the ship syntax checker will check other nodes in the sexp tree. In those cases, make sure to accommodate special-arg nodes.
This also merges syntax checking for goal/event names and docker/dockee points since they are highly similar.
Fixes#3758.
Improves syntax checking in two ways...
1) Properly checks each sibling of a special argument, rather than skipping the whole list even if just one is a special argument
2) Throws a syntax error if a special argument is found without an argument operator higher in the sexp tree, which fixes#3740
- simplify OS specific code
- make sure loose files are always sorted the same regardless of OS or filesystem
- reduce differing behavior in cf_get_file_list*() variants
- refactor case-sensitive directory handling to work everywhere it's needed
* Scale distant combat related effects so they stay visible
- Effects scaled so that they always maintain a minimum pixel size
- Supports lasers, beams, all trails, muzzle flashes, and thrusters
- Disabled by default, but can be configured through the game_settings.tbl
* Added comments clarifying when min pixel size scaling happens.
* Convert some NULLs to nullptr to make CLANG happy
1) When syntax checking for hud gauges, be sure to check all gauges available because the default ship may not be the ship chosen in the player loadout.
2) Add a warning to every hud gauge check if the gauge isn't found.
3) Don't report syntax errors for hud gauges in FSO, only FRED; because every place that use a gauge will fail gracefully.
The Rotators_locked flag was created specifically as a lab option that didn't affect animations or intrinsic rotations, so return it to that scope. Also rename it to clarify that it applies to subsystems and to be future-proof for submodel translation.
* Add custom data to ship tables
* add index check to shipclass.cpp
* fix hasCustomData name to use the proper casing
* Add custom data to weapon tables
* Add validity checks and remove superfluous empty check
* Attempt to appease clang-tidy
* Use F_RAW as recommended by @BMagnu
* Creates a function to parse maps and uses it in ship.cpp and weapons.cpp
* another attempt to appease clang-tidy
* Remove superfluous using
* Small style and grammar fixes
* Accidentally forgot this change. Rename 'delimiter' to 'end_marker'
This moves submodel rotation out of the AI pipeline and into object movement. With the exception of turret rotation (which remains in the AI code) this now allows all types of submodel rotation to happen in the same place. Many associated functions have also been cleaned up.
In addition to making the code cleaner and clearer, this will make it much easier for intrinsic rotations and new animations to be applied to non-ship objects, such as weapons.
* Add Per-Ship Class Wingmen Status Dot
This PR adds a ship info value `$Wingmen Gauge Dot Override:`, which allows modders to set wingmen status dots on a per-ship class basis. If no animation is specified then the default dot animation specified in the HUD table wingmen gauge is used.
Both EatThePath and Darius stated this feature would be useful, and it will also be useful for FotG.
Tested and works as expected, including on winged ships present at mission start and delayed winged ships.
* Adds the getColor() function to the Graphics lua library, allowing users to check what color is active for 2D drawing.
* Adds the getColor() function to the Graphics lua library, allowing users to check what color is active for 2D drawing.
* Add New Options to Wingmen Gauge
This PR adds two new options for modders to use in the HUD table for the wingmen gauge:
1) `Use Full Wing Names:` which draws the full wing name and does not alter the capitalization.
2) `Use Expanded Colors:` which use red, yellow, or green color to designate wingmen health (green 1.0 to > 2/3, yellow 2/3 to > 1/3, and red <= 1/3.
Also adds the bright red option to dead wingmen, which seems like it was missing before(?).
Tested and everything works as expected.
* correct string copy length
* fix out of scope case variable
* Basic per-render-model + per-ship tools
* Tidy up settable transparency for standalone use
* Force Alpha Premultiplied on external Alphamult
* Fix sexp description.
* Adds the angle parameter to gr.DrawRectangle, allowing scripters to draw arbitrarily rotated rectangles.
* Revert "Adds the angle parameter to gr.DrawRectangle, allowing scripters to draw arbitrarily rotated rectangles."
This reverts commit b1a0480f32.
* Adds the angle parameter to gr.DrawRectangle, allowing scripters to draw arbitrarily rotated rectangles.
* fix wrong vertex position for unfilled rotated rectangles
* Adds a @param entry to gr_rect explaining the angle parameter.
* Attempt to fix operations with int to float conversions.
* Fix parameters in documentation string
* Change NULL to nullptr to satisfy modern coding standards
* Trying to make code a bit cleaner
When a ship is killed via scripting, the killer should be credited for the kill in the mission log and the correct hull percentage should be used. Also, the script should work with either the ship or its weapon passed as the killer parameter.
* Deleted a line that blanked target_num on homing weapons but still let them home
* This whole block of code about missiles missing turns out to be a logical dead end anyway, ripped it out by the roots.
Explicitly check whether the mission has been saved, because the automatic check doesn't provide a way to detect that it has been cancelled.
Fixes#3654.
If a wing has a hash symbol, it needs to match the squadron status gauge for the equivalent name without the hash. This could happen for in-mission jumps or cases where a wing leaves and comes back.
Also remove an obsolete function.
The mission-set-nebula sexp never initialized the nebula range, which is usually done in the background editor. This PR allows the range to be specified, and sets it to 3000 (the same default as in the background editor) if not specified.
Fixes#3619.
The old XSTR parsing code was a bit of a mess and did not even properly enforce its format. These new routines enforce the actual XSTR format and warn when it is malformed, which is helpful for catching table errors as early as possible. This fixes#3627 and also catches mismatched quotes and other common XSTR errors. No more wondering why comments are being mysteriously parsed instead of ignored!
1) Make sure the `PM_FLAG_HAS_INTRINSIC_ROTATE` flag is only set after submodels pass validation and checking
2) Maintain compatibility with old models that used `$look_at` with the submodel number instead of name
1) Several AI profiles options were getting reset on every iteration through the loop. They should only be reset when the profile is initially created.
2) Keeping track of AI hits on the player ship was added by Sushi in 9246a2f74d and needs to be guarded by a flag. This flag has been enabled for mods that set the required FSO version.
Partial revert of Mantis #2053:
http://scp.indiegames.us/mantis/view.php?id=2053
The patch was speculative and there was never a confirmed bug. By contrast, there are plenty of existing missions that use Unknown as a ship, wing, or jump node name and work just fine.
Inspired by #3584, this properly saves and restores any number of nebula poofs handled by the game. FRED will only display checkboxes for the first six, since it still uses the static UI, but everything else is handled behind the scenes.
PR #3064 inadvertently caused all goals to display Time To: Unknown, even though time was only supplied for docking and waypoints. This restores the original behavior where the Time To: line simply wasn't displayed.
When an empty string is encountered in the weapon list, it's valid, but the -1 should actually be stored, not skipped.
This bug was preventing ship weapons from being explicitly set to None.
This function has to be called on game/FRED/qtFRED start, and does nothing once it is called. So there is no reason for it to be hear on mission close.
If the loop mission and the next mission are the same, then don't show the campaign loop screen. This prevents the campaign from getting into a campaign loop state if it shouldn't, and also allows campaign loops to be conditionally accessible.
* Remove Buggy Function and Let Debris end natrually
Removes this retail function that was actually perpetually postponing the death of debris at long distances instead of removing them. Debris lifetime is suitably short for the small, non-hull pieces (only a few seconds), while large pieces are supposed to be permanent. It also culls based on player position, which is not the correct approach, since the camera can be free from the player ship.
* Remove Vestigial Variables
These variables are no longer checked for anything now that we allow debris to go through its lifetime.
Certain characters (especially the semicolon) couldn't be used in SEXP help. By using the same character replacement as in briefings and messages, now they can.
* refactor hud escort list to be less crazy
- don't keep rebuilding list
- add and remove ships more efficiently
- better handling of player ships in multi (fixes#1674)
* fix sorting issues
- incomplete priority sort
- reversed alpha sort
* fix additional sorting issue
* improve safety check in list sort function
* add safety checks to hud_add_ship_to_escort()
this wasn't meant to be used outside of the module so
it was not really safe to use with sexps previously
* remove entries properly in hud_add_remove_ship_escort()
Checks whether the game is running in the specified language. Since the fiction viewer doesn't use XSTR-style localization, this SEXP can be used to display different stages for different languages.
* support opening of web urls on PXO screens
(copied out of icculus.org version)
* add delay before allowing more clicks on links
* fix clang-tidy issues
This adds two new enums to persistent sounds which can be utilized by scripts.
1. OS_PLAY_ON_PLAYER, which allows persistent sounds to play on the player's ship.
2. OS_LOOPING_DISABLED, which allows the scripter to set the sound to play once and not have to then call `removeSound` later. Very handy for playing an assigned sound once with one line.
Tested and everything works as expected.
This adds `EnumAND` and `EnumOR` which will return new enums based on the specified operations. These are handy for enums that correspond to bit fields, such as those used for object persistent sounds.
Bug #3471 occurs because the game only keeps a translation table for the current language. Since the mission list needs to compare untranslated strings against English strings, this adds a duplicate table for English. However, it only keeps strings that are NAME_LENGTH or less, because the comparison only needs to be run against mission names.ssss
Fixes#3471.
With several upcoming POF format enhancements (byte alignment, external weapon rotation, submodel translation) it makes sense to warn users if they happen to load an unsupported POF file.
The assumed location of a ship's "EngineSnd" is at its rearmost extent, which is fine for ships with engines, but not suitable for stationary objects such as space stations and comm nodes. If the ship doesn't have an "engine" subsystem, place the persistent sound in the center.
* wip
* basics are working
* turret case is handled
* better fighter beam handling
* missing commit?
* handle missile spawn
* clean up, commenting and ssb handling
* random in sphere and per burst rot counts for "share random" flag
* clean up, clarity and comments
* accidental whitespace changes
* bugfix
* NULL -> nullptr
* more efficiency/clarity
* review tweaks and bugfixes
Changes the `current_frame` checks in generic.cpp so that the last frame can actually be reached (allows the mainhall code to tell the misc animation has finished), and adds a `generic_anim_reset()` function that gets called instead of manually setting `current_frame` and `anim_time` to 0. This should fix#3399.
Here's a bug that's been around ever since version 3.6. If the subsystem names were not essentially the same, the function wouldn't do the expected string comparison.
If a weapon has "inherit parent target" but not "child", a Warning will be generated. However, there is no dependency between the two flags; the weapon will function as the modder presumably expects. The Warning even seems to indicate this, by saying "No changes in behavior will occur" (as opposed to other similar warnings, which generally indicate that a flag will be ignored). Since the situation being warned about does not actually cause any issues, the Warning is entirely superfluous. As such, I've removed it outright.
The script-eval SEXP evaluates all arguments as individual script commands, which is not ideal because most FREDders expect the arguments to be concatenated. Since the script-eval-block SEXP handles its arguments this way, it makes sense to hide the script-eval SEXP in FRED to prevent confusion.
Commit 6c2ebab01c (#3439) added a `max_line_length` argument to `split_str()`, but one call had the extra argument added in the wrong spot, and so a previously-pointless-but-harmless `ignored_char` of 0 became a `max_line_length` of 0, resulting (ultimately) in an exception in the unicode code when the iterator tried to decrement at the beginning of a ship's description. This gets rid of the argument entirely, rather than reordering them, because ignoring null characters doesn't really do anything anyway.
I've also added `Assertion`s to check `max_line_length` that should prevent this specific problem from occurring again in the future.
* Validate user-provided values passed to Random::next()
* return low value on invalid range
* call LuaError() instead of Warning() in rand32() script function
* Added a byte limit for line length in split function
* Fix call error
* Ádd missing limits import
* Change hardcoded values into defines
* Cleanup default argument
The shadows distances were tuned/added by swifty with the following logic:
`// these cascade distances are a result of some arbitrary tuning to give a good balance of quality and banding.`
Mods, especially TCs, may have very different sized ships compared to FS, and as such desire more precise control over shadow cascade distances.
This PR exposes those values with settings in the `game_settings.tbl`.
PR is tested and works as expected.
This properly handles variable additions by calling the replace-variable code on the new variable node immediately after the variable is added. It's a bolted-on hack but it's the simplest way to fix the issue. A better fix would be to completely redesign the way the sexp tree handles variables (and everything, really) but that would be a major undertaking.
Fixes#3298.
* add new popup type to handle mission/table validation
* fix error handling when popup gets canceled
* use bool and get rid of Int3()
* use proper Game_mode check to test for standalone
* Prevent Crashes from Weapons being deleted during the collision process
This puts in some safety checks to keep FSO from crashing while doing collision detection when close to the object limit.
* Remove Problematic Assertions and INT3's
Keeps FSO from crashing when low on Object slots from failed weapon and beam creations.
* Simplify Code with a good suggestion
Co-authored-by: Asteroth <[email protected]>
Co-authored-by: Asteroth <[email protected]>
which contain additional undisplayed data. For
example the initialShips/initialWeapons lists,
which refer to the internal indices of player
ships/weapons.
* fix variable replacement in briefings/debriefings
* remove unused local variables
* multi server-side cleanup
* add client-side text replacement in multi
If the `for-players` collection has no valid arguments, don't short-circuit, just to be on the safe side.
Don't short-circuit at all for the `for-ship-*` sexps, because ships can arrive and depart.
#3271 changed the logic of `stuff_token_list()` in such a way that the supplied index being used to access an array was no longer skipped if it was invalid; naturally, this means that this warning was now being inevitably followed up by an out-of-bounds array access. Adding a `!skip_this_entry` check should hopefully fix the problem while still allowing the loadout count parsing code below it to run, which was presumably the reason the `continue` statement was replaced with the `skip_this_entry` variable in the first place. Fixes#3405.
While there's code to avoid accessing the parent object of a parentless beam, there's no equivalent code to avoid accessing the parent object of a parentless weapon. This fixes this inconsistency.
To be more user-friendly, and to accommodate buggy retail missions, make the one-argument version of `is-ship-visible` default to the first player in multiplayer mode.. Also, change the warning to an mprintf.
Could be because of variable overflows or from `thistime` somehow being much smaller than `lasttime`.
Hard to find the root cause, but manually setting the memory to bad values will no longer cause the freezing with this patch.
If the client tries to respawn a player when the server is trying to end the game it will lead to a crash on the client side. This sets the client's game to the correct state when an end game packet is received and adds extra checks before respawning.
There were a few assertions in the SEXP code that would trip if an invalid variable name were specified in a SEXP, but nothing that actually stopped a Release build from performing an out-of-bounds array access if someone made a typo in notepad. Since, as far as I could tell, everything should go through `get_sexp_text_for_variable()` first, I changed its `Assert()` into an `Error()` that should hopefully ensure that we avoid ever doing anything with `Sexp_variables[-1]`.
- detect server connection error messages before blindly
moving to user login (crash fix)
- detect read errors and fail accordingly (crash fix)
- allow server disconnect to run even if we aren't connected (cleanup & reset)
* Allow Fred to Edit and Allow Command briefs in FRED
They are currently allowed in the game, but not being allowed in Fred was an oversight of mine.
* Allow Command brief saving in qtFRED
This moves the ## to # escape sequence logic from `mission_process_alt_types` to its own function where it can be used elsewhere (such as for ship class and weapon class display names that need to do the same thing). Also, this introduces a !! escape sequence for exclamation points that is needed for exclamation points to be used in scripts, as @naomimyselfandi pointed out.
So #3007 is a larger bug than just trying to access the player's target. The real problem is that the game state is not changed from `GS_STATE_GAME_PLAY` during the mission load when restarting the mission. So the script thinks it's in the mission, tries to access the target and then crashes. But this won't be the only bug. Any script that tries to access data on Frame will run into possible problems on mission restart.
Instead of saving based on the m_cur_msg index, which may have been reset to -1, save on the most recent positive index. This should keep track of modified text and dropdowns even when m_cur_msg is set to -1 when the message list loses focus.
Fixes#3308.
I don't know when this was introduced but the bug is extremely obvious once someone hit the crash. It should just be using the timestamp that the packet was received, not trying to put that timestamp into a vector whose index is server frame numbers.
Most guages in hud_guages.tbl will display a Warning if they can't be loaded, but the reticle is an exception - it only prints a log statement. This PR changes it to be consistent with the rest of the HUD gauges.
Fixes#3090.
The "No XSTR entry in strings.tbl for index %d" message was previously printed to the log every time the string was accessed, which for commonly-used strings will clutter up the log. This makes the message only appear once per missing index.
Previously `no impact debris` flag was only an option for use on subsystems. This PR adds that flag for the entire ship. It also turns off the impact spew of debris for all subsystems if enabled on the ship.
Previously, the velocity could be off by up to 1 m/s. This gives that packing function one more byte to work with, so that we have a lot more accuracy to work with.
* 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`
Follow-up to #3305. Some mods may want one or two missions to start in chase view without having every single mission default to chase view. So this adds a mission flag (with FRED and qtFRED support) that will enable this on a per-mission basis.
* Allow Text to show failure on Clients
Function was accidentally returning false before sending an update on failure.
* Play directive sounds for clients
This adds a short client version of the function that initiates the directive completion sound.
* forgot to remove a failed experiment
* Limit instances of Client Collisions to Avoid Instant Death
* Set timestamps correctly (take 2)
* Handle server check the same everywhere
* Clearer Logic Here
When various SEXP functions related to ammo were consolidated back in June (in commit 54409ec928), certain safety catches meant to avoid having too much ammo or the wrong ammo capacity after changing weapons were lost. This commit adds code that should be functionally equivalent.
LZ4 moved to lib folder and added cmakelists.
Added several position check to match cfilearchive ones for compressed files.
Changed header check to int.
Moved the compression functions to separated files, added dynamic blocksize support for LZ4 and a decoder buffer to make sure every block is only read from file and decoded only once.
I just dumped everything into cfilearchive to avoid a fight with the includes that i cant win for now.
It dosent work, DDS utils complains about DDS filecode.
Consolidate all the functions which parse lists of data. They're almost the same except for the data itself, so use templates.
As for the templated function which handles the list, boost the robustness by adding additional checking and error messages.
This correctly calculates the turret position from the center (zero position) of its submodel instead of using the offset from the main model.
This patches a few more parts of the code and also adds a missing locale argument.
While skimming the differencs in jg18's branch of PR #3253...
https://github.com/jg18/fs2open.github.com/tree/feature/sexp-containers-revised
...I noticed a TODO that is almost certainly a genuine bugfix. As such, it deserves its own PR. The line in question was last modified in 2012 by karajorma, and the bugfix should test for the special-arg in the entire actions tree rather than just the first action.
1) The ship-vanish SEXP (and script function) was already multiplayer-ready
2) The is-ship-visible SEXP was enhanced to add a second argument, which defaults to the player's ship in single-player mode
This works around a compiler bug present in most older versions of MSVC
where it absolutely wanted to use a deleted copy constructor even if a
move constructor was available.
This just moves the relevant code into the default constructor.
With modular tables, we might have modified an entry in the middle of the vector, in which case the next index would be an existing main hall. If the next modular table then created a brand new main hall, it would overwrite that entry. This makes sure the code always assumes the next main hall will come at the end of the list.
This introduces type parsing for all types used within the scripting
documentation. This improves the generated JSON output and also
validates new code via the unit test.
* Clean Up ai_attack_object()
There was an unused parameter, and no one has added subsystem targeting (at least to this function) in the past 20 years, so it's time to remove it and make it more readable. Probably better to adjust that behavior somewhere else anyway.
Also changes an Int3() into
* More Int3 cleaning
Refactor a few Int3()'s in the AI code
* Feedback on is_ignore_object_sub
* Feedback, remove duplicate check, add documentation to preserve why it was there
Looking throughthe code, it appears that
sound volumes are typically set when calling
the "play" function for in-engine uses of sounds.
No default values were, in fact, set explicitly at
creation, so they were initialized to 0.0f.
Scripting documentation, however, refers to
default volumes per type where no volume is
passed. New engine functionality should also
be able to rely on this.
I'm setting sane values found in other
parts of the sound system at stream creation,
to be used or overwritten later.
This is a parser for a very simple language to allow for execution of
dynamic expressions with return values for use as action parameters. The
only "dynamic" part this currently supports are random ranges but more
features are planned for the future.
This system adds the code necessary for letting content creators specify
complex events by specifying a simple, program-like sequence of
operations that will be executed by the engine when a certain event is
triggered.
For some reason the last update of the PR pipeline did not update the
other workflows as well so we had some minor inconsistencies.
This should hopefully fix the nightly build issues for real this time.
Docker Hub is going into a weird direction with their rate limits and
the GitHub Container Registry is better in that regard.
Old images will stay in Docker Hub for the time being though.
This is a follow-up to #2687. The final implementation of evaluateNumericSEXP different from the testing implementation in a small but crucial way that prevented it from actually working. Since it used `eval_num`, it didn't evaluate the specified SEXP node but rather the CAR (first element) of the node list. This fixes that by putting the node in a temporary SEXP list so that `eval_num` will look in the right place.
FFmpegContext can now also hold a cursor over a vector of bytes instead of a cfile to store sound data in it.
Appropriate creation, reading seeking functions included.
This refactors the tolower/toupper code to use standards-conformant logic, and also adds some helpful utility functions. Regular tolower/toupper must be supplied a value that can be represented as `unsigned char`, but the std:: functions are a bit more robust.
This changes FRED to properly initialize a model instance on ship creation and also use that instance when rendering the ship. This prevents destroyed submodels from appearing. Fixes#3212.
The defensive coding in #3191 against illegal cut/delete operations was a little too defensive. This properly allows deletion of events when necessary, and it still guards against a Cut operation being improperly called due to a shortcut key press.
Fixes#3216.
Restores the MFC functions that were taken out in #3073. These functions appeared redundant, but they were actually necessary to intercept the MFC handling of Enter and Escape. In addition to fixing that behavior, this PR also adds some clarifying comments and renames some functions to prevent confusion.
Implements send-message-chain as described in issue #3185. Also fixes the default argument for message priority, and mirrors the default argument fix to qtFRED.
This is a follow-up to #2390. Retail used a weird hybrid approach where internal strings were translated but external strings were not. This restores that behavior by adding another language, LCL_RETAIL_HYBRID, which is the default. The game can still be run in completely untranslated or completely translated mode.
All three modes have been tested and translate strings, or not, as expected. The `$Use tabled strings for the default language:` flag has also been tested and still works.
Multipart turrets that have no rotation specified in PCS don't have `movement_type` assigned properly within `modelread.cpp`, which eventually leads to a fatal crash. This two line fixe properly specifies the `movement_type` and fixes the crash. Tested and confirmed. Thanks to @Goober5000 for the assistance and troubleshooting.
This PR provides modders with additional options to alter countermeasure values. Previously, countermeasures had a fixed, hardcoded fire wait time of 333 milliseconds, regardless of what `$Fire Wait:` was specified. Also, the AI would wait a fixed delay between firing of failed countermeasure launches and successful countermeasure launches. For successful launches the AI would double the fire wait. Also, Friendly ships would only use a fixed constant value for countermeasure firing chance, and not the value based on their class specific AI profile.
This PR exposes those values with the following options:
• Add main AI table flag: `Friendly Ships Use AI Profile Countermeasures Firing Chance`. This will allow Friendly ships to use their AI class profile countermeasure firing chance instead of the default fixed value from main AI table.
• Add value in CM section of weapons table: Countermeasures use fire wait time `+Use Fire Wait`. This is a boolean that allows the countermeasure’s fire wait to actually use what is specified in the `$Fire Wait:` section of that weapon.
• Add value in CM section weapons table: `+Fail Delay Equals Fire Wait`. The delay between failed countermeasure launches is set to use the fire wait value.
• Add value in CM section weapons table: `+Successful Launch Delay Multiplier`. This allows modders to set the value that is multiplied to fire wait for successful countermeasure launches.
This flag is vestigal. It was likely used in the FS1 codebase and then was not removed by the rushed FS2 multi team. Whether or not an object uses physics_sim is determined earlier in `multi_oo_is_interp_object()`
As astuetly determined by @Baezon `the speed differential for retail cap ships is caused by 'ships with no shields can manage ETS', being part of the bugfixes with target version`. This PR adds two flags per Discord suggestion, one for all ships and one for only small ships.
This PR re-implements the look_at feature, which has been broken for many years. A look-at rotation is a type of intrinsic_rotation, just like dumb-rotations. The same code handles both; the only difference is whether submodel_rotate or submodel_look_at is called to apply the actual movement.
The previous look_at parsing code has been optimized by performing the name-to-submodel resolution when the model is actually parsed, instead of when the first look-at rotation is called. This avoids the need to store a name in the submodel struct and also avoids cluttering the look_at function.
This PR is essentially bookkeeping, except for the submodel_look_at method. This method takes advantage of the submodel rotation upgrade and calculates angles in almost the same way as the new turret rotation code. It's much more elegant, much less hackish, and works for all detail levels.
Controls 0, 1, and 2 - Vectorize Controls_config, Refactor Control Presets, and Use Undosys for undo/redo actions done in the Controls configuration menu.
* Remove errant Assert()
* Drop leading whitespace of preset $Name field
* Fix do_reset behavior due to incorrect default binding check. Fix is possibly a backport.
* When $Text is specified for a bind item, set the XStr index to 0.
Add FRED comments. These aren't the typical source-code style comments that are embedded in mission or table files; these are regular strings that are stored as mission data. You might think of them as annotations. Right-click on any node in the event tree and click on Edit Comment to add one. The tree node will then show a different icon and the comment will be visible as a tooltip when you mouse over the node text.
The tech room loop checked that all the lines could fit in the available screen real estate, but it didn't check to see that the number of lines was less than the array capacity. Normally this never happened, but certain mods which use smaller fonts will overflow the limit. This adds a proper bounds check and also increases the bounds so that more of the smaller lines can be used.
The tech room loop checked that all the lines could fit in the available screen real estate, but it didn't check to see that the number of lines was less than the array capacity. Normally this never happened, but certain mods which use smaller fonts will overflow the limit. This adds a proper bounds check and also increases the bounds so that more of the smaller lines can be used.
Follow-up to #3137. I missed two important details in the first implementation: the triggered animation needs to be an "initial position" type, and `model_update_instance` needs to be run on all subobjects, not just turrets.
This should really fix#3123. I still can't see the destroyed collector, but the Rahu no longer flickers when it spins around.
These two situations mostly relied on the obsolete model code which didn't include model instances. Data for submodel positions and for whether a submodel is blown off are now stored exclusively in model instances, not the model itself.
This fixes#3124.
Remove One Source of Client and Server having Different Timing
Multiplayer *must not* have its time affected by being in the background, because their clocks will come out of sync and movement from an out of focus multiplayer instance will appear to move in slow motion. This fixes the timing discrepancy by only doing os_sleep when unfocused when in single player.
The background validation checks are somewhat convoluted, and misleading with multiple backgrounds, so this PR disables the standard main-background check if FRED is running. It then adds a new FRED-specific background check that covers all backgrounds.
Additionally, this PR fixes a bug in an error message in `stars_get_first_valid_background`.
Fixes#3116.
One small detail that was overlooked in PR #3021... KeldorKatarn's old code used `strtod` while the new code used `stuff_float`. This wouldn't be a problem except that a couple MVP models use annoyingly formatted floats like 8.9e-08. So I decided to convert `stuff_float` to use `strtof` and do some more upgrades while I was at it.
As described in #3079, the old parsing of fvec and uvec used strtod and some POFs rely on this format. This is a quickfix that uses the new parsing method for only `get_user_vec3d_value`.
It appears that live debris is not supposed to have a parent submodel; see the retail NTF Boadicea. This removes the parent from any live debris that might have it.
This should fix#3078.
For compatibility purposes some mods want alt names to truncate at the hash symbol. But we can't actually do that at mission load,
since we have to save them again in FRED. So this commit processes the names just before the mission starts.
To further complicate things, some mods actually want the hash to be displayed. So this commit introduces the double-hash as an escape sequence for a single hash.
* Fix color highlighting of mouse-over lines
* Fix color highlighting of selected bindings
* Fix bug when trying to select an item while the selected line is an axis control
* Allow user to select an empty item
* Expand hitbox of items so players aren't required to click exactly on the text to select it.
* Refactor search mode in control_config_do_frame()
* Dismiss help overlay in search mode when joy button is pressed
* Fix possible bug where nav buttons were not reset in search mode
* Add convenience methods to CCB
* Convert CC_bind into a class and define convenience methods
* Set underlying type of enum CID to short
* controlconfigdefaults.tbl: Should the CCI be disabled by an override, clear its binding.
* Control config menu: Should the help overlay be active during bind mode, dismiss it, don't bind anything, and stay in bind mode (fixes inconstant behavior)
* Refactor bind mode handling in control_config_do_frame()
* Remove two uncessary Assets. operator new should throw an exception should it fail.
* Move template functions into .h. This resolves instancing problems when trying to define them in a .cpp
* Add Undo_system::empty() and ::empty_redo() for checking if an ::undo() or ::redo() is possible.
* This is a section that only configures the bindings for a preset. Allowing mod devs to add presets instead of just the overrides
* Added ability to resume parsing should a Binding not be found
* Revert Joy_axis_action_index changes. Feature to be added later
* Strip out most of the preset and undo capability. Only the backup ability survived.
* Hardcoded bindings are done at run-time instead of assignment
* Created a map that should retain backward compatibility with controlconfigdefaults.tbl and playerfiles, since a reorganization of the controls in the code is planned and would break compatibility.
Added smart pointers to bsp_in, bsp_out, sldc_tree and slc2_tree as requested.
I also changed the #error to #pragma message in a attempt to remove the false positive error.
Also did minor code indent fixes-
Changed SLDC system to SLC2, this replaced the char at the beginning of the node for an int in order for the tree to be aligned.
Added BSP_Defpoints data alignment and SLDC to SLC2 conversion for pof version < 2118.
# bail if this script is run from a workflow that doesn't identify as a release or nightly
ifsys.argv[1]notin("release","nightly"):
print("ERROR: Invalid release mode %s passed. Expected release or nightly!"%sys.argv[1])
sys.exit(1)
tag_name=os.environ["RELEASE_TAG"]##!< commit tag string
date=datetime.now()##!< current date
version=get_source_version(date.strftime(DATEFORMAT_VERSION),tag_name)##!< form full version string
success=os.environ["LINUX_RESULT"]=="success"andos.environ["WINDOWS_RESULT"]=="success"##!< true if both linux and windows builds successful
# check that tag_name is actually in the git repo and find the previous tag release
tags=check_output(("git","for-each-ref","--sort=-taggerdate","--format='%(tag)'","refs/tags"),text=True).splitlines()# retrieve all tags in the repo by using git on the shell
# NOTE: check_output returns canonical string representation. use repr() on strings its being compared to
previous_tag=None
found=False
fortagintags:
iffound:
# Look for the "previous" tag with the same configuration ('release_' or 'nightly_')
# Assumes older tags have a higher index than newer
iftag.startswith("\'"+sys.argv[1]+"_"):
previous_tag=tag
break
eliftag==repr(tag_name):
# Ok, found the tag
found=True
ifnotfound:
# couldn't find tag, bail
print("ERROR: Couldn't find tag %s in repo!"%tag_name)
sys.exit(1)
ifnotprevious_tag:
# couldn't find previous tag, bail
print("ERROR: Could not find a previous tag for %s!"%tag_name)
sys.exit(1)
ifsys.argv[1]=="release":
# Release specific action
ifnottag_name.startswith("release_"):
# Safety check tag is from a release
print("ERROR: Invalid tag name detected. Expected release_ prefix for release builds but found %s (full ref = %s)"%tag_name,os.environ["GITHUB_REF"])
Deprecations are a mechanism in FSO where a certain feature or aspect of the engine has changed or is no longer supported. Since this would normally break existing mods we have the mod table feature "[tt]$Target Version:[/tt]" with which a mod can specify what version of FSO it was developed with. The features listed above will be removed or changed when the target version of a mod is at least the version released in this post.
[b]All platforms: [/b] For every day use, we recommend [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url], an integrated solution for downloading and launching mods.
[hidden=Alternative Launchers]
Cross-platform: [url=http://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (ongoing project for a unified launcher, you should upgrade to the latest RC/test build if you have not yet)
[b]Important:[/b] For best compatibility with FSO 3.8 and later you should use at least wxLauncher 0.12.
Windows: [url=http://scp.fsmods.net/files/Launcher55g.zip]Launcher 5.5g[/url] ([url=http://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=http://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=http://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=http://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=http://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Graphics_Settings]by hand[/url] or whatever you can figure out.[/hidden]
[size=8pt]This one is based on the AVX Optimizations from the MSVC Compiler.[/size]
[b]What are those SSE, SSE2 and AVX builds I keep seeing everywhere?[/b]
[url=http://www.hard-light.net/forums/index.php?topic=65628.0]Your answer is in this topic.[/url]
Don't want to deal with that? Use [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url] and it will download the best build specifically for your PC!
[size=8pt]Compiled with Ubuntu 16.04 LTS 64-bit, GCC 5[/size]
${build(groups["Linux"].mainFile)}
These builds use a mechanism called [url=http://appimage.org/]AppImage[/url] which should allow these builds to run on most Linux distributions. However, we recommend that you compile your own builds which will result in less issues.
Alternatively, if there is a package in your software repository then you should use that. If you are the maintainer of such a package for a distribution then let us know and we will include that here.
[b][color=red]Not available[/color][/b] We recently lost access to our Mac CI environment which we usually used for compiling these builds so for the time being, there will be no builds for this OS.
[hidden=TrackIR Users]
[size=12pt]Important!![/size]
An external DLL is required for FSO to use TrackIR functions. The following DLL is simply unpacked in to your main FreeSpace2 root dir.
[li][url=https://github.com/scp-fs2open/fs2open.github.com/issues]Github issues[/url] and [url=https://github.com/scp-fs2open/fs2open.github.com/pulls]pending pull requests[/url][/li]
[li]See the list of [url=http://scp.indiegames.us/mantis/search.php?project_id=1&status_id%5B%5D=10&status_id%5B%5D=20&status_id%5B%5D=30&status_id%5B%5D=40&status_id%5B%5D=50&priority_id%5B%5D=40&priority_id%5B%5D=50&priority_id%5B%5D=60&sticky_issues=on&sortby=last_updated&dir=DESC&per_page=200&hide_status_id=-2]Fix for next release[/url] bugs - mark a bug as an elevated priority (high, urgent, immediate) to get it included in that filter.[/li]
mprintf(("Warning: \"$override radius for subsystem path points:\" should be >= %i (read %i). Value will not be used.",Minimum_subsystem_path_pt_dist,path_radii));
mprintf(("Warning: \"$override radius for subsystem path points:\" should be >= %i (read %i). Value will not be used.\n",Minimum_subsystem_path_pt_dist,path_radii));
}
}
set_flag(profile,"$use POF radius for subsystem path points:",AI::Profile_Flags::Use_subsystem_path_point_radii);
ss->turret_next_enemy_check_stamp=timestamp((int)(2000.0f*frand_range(0.9f,1.1f)));// Check every two seconds
ss->turret_next_enemy_check_stamp=timestamp((int)(The_mission.ai_profile->turret_target_recheck_time*frand_range(0.9f,1.1f)));// Check every two seconds
Assertion(goal_position>=cfile->lib_offset,"Invalid offset values detected while seeking! Goal was "SIZE_T_ARG", lib_offset is "SIZE_T_ARG".",goal_position,cfile->lib_offset);
ShivanSpS - Compressed files support for FSO. Many thanks to ngld, taylor and everyone elsewho helped me in getting this done.
-The file header is a version, this is used to tell FSO how to decompress that file, always use 4 chars to mantain alignment.
-The header ID can be used to add diferent revisions to LZ41 decompression system or to add other compression format supports whiout breaking compatibility.
-The system uses a offset list to record the position of every block in file, this list, along with the number of offsets, original filesize,
and block size, must be written by the compressor app.
-A decoder cache is used to store the last decoded block, this ensures each block is read and decoded only once in sequential reads. This cache
is a little bit bigger than the block size, a higher block size means less overhead added to the file, but it also means a little more ram will
be used during decompression.
-All this dynamic memory is assigned at cfopen() and it is cleared on cfclose().
{"-noshadercache","Disables the shader cache",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noshadercache",},
{"-prefer_ipv4","Prefer IPv4 DNS lookups",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv4",},
{"-prefer_ipv6","Prefer IPv6 DNS lookups",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv6",},
#ifdef WIN32
{"-fix_registry","Use a different registry path",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fix_registry",},
{"-no_unfocused_pause","Don't pause if the window isn't focused",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause",},
{"-benchmark_mode","Puts the game into benchmark mode",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode",},
{"-profile_write_file","Write profiling information to file",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file",},
{"-debug_window","Enable the debug window",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-debug_window",},
"Sets the joystick deadzone. Integer value from 0 to 100 as a percentage of the joystick's range (100% would make the stick do nothing).Disablesdeadzonesliderinthein-gameOptionsmenu.", AT_INT);//Cmdline_deadzone
* Checks if this CC_bind is equal to the given CC_bind
*
* @note EQUAL means EQUAL, this will return FALSE if the flags differ by a single bit
*/
booloperator==(constCC_bind&B)const;
/*!
* Checks if this CC_bind is not equal to the given CC_bind
*/
booloperator!=(constCC_bind&B)const;
/*!
* Checks if this CC_bind is equal to the given CC_bind, disregarding the inversion flag
*/
boolinvert_agnostic_equals(constCC_bind&B)const;
/*!
* Clears the binding and flags. Some flags are retained.
*/
voidclear();
/*!
* True if not bound
*/
boolempty()const;
/*!
* Returns a copy of ::btn
*/
shortget_btn()const;
/*!
* Returns a copy of ::cid
*/
CIDget_cid()const;
/*!
* Returns a copy of ::flags
*/
charget_flags()const;
/**
* Takes the given binding.
*/
voidtake(CID_cid,short_btn,char_flags=0);
/**
* Validates the binding, clearing it if necassary
*/
voidvalidate();
/*!
* Returns a human-readable string of this binding
*/
SCP_stringtextify()const;
/*!
* Sets the inversion state of this binding according to the passed bool. True = inverted, false = normal
*/
voidinvert(bool);
/*!
* Toggles the inversion state
*/
voidinvert_toggle();
/*!
* Is true if inverted, false otherwise
*/
boolis_inverted()const;
/*!
* Checks if this CC_bind conflicts with the given argument
*
* @note Similar to operator==, but ignores certain combinations of flags.
*/
boolconflicts_with(constCC_bind&)const;
private:
CIDcid=CID_NONE;//!< Which controller this belongs to
charflags=0;//!< mask to determine various additional attributes of btn
shortbtn=-1;//!< The button, key combo, or axis that's bound.
};
/*!
* A pair of bindings.
* @note Please don't set the bindings directly, use ::take() instead.
*/
classCCB{
public:
CC_bindfirst;// The primary binding
CC_bindsecond;// The secondary binding
public:
CCB()=default;
CCB(constCCB&A)=default;
/*!
* Returns true if nothing is bound
*/
boolempty()const;
/*!
* Takes a given binding
*
* @param[in] A The bind to take
* @param[in] order 0 is primary, 1 is secondary, -1 is overwrite existing bind (if any)
*
* @note Should there be a binding to the same controller as the given binding, it is cleared
*/
voidtake(CC_bindA,intorder);
/*!
* Clears both bindings
*/
voidclear();
/*!
* Gets the value of btn if either CC_bind has the given CID
*
* @returns the btn of the bound controller, or
* @returns -1 if that controller is not bound
*/
shortget_btn(CID)const;
/*!
* Assigns the contents of the given CCB to this CCB
*/
CCB&operator=(constCCB&)=default;
/*!
* Checks if the given CCB is exactly equal to this
*/
booloperator==(constCCB&);
/*!
* Checks if the given CCB differs from this
*/
booloperator!=(constCCB&);
/*!
* Returns True if this CCB's first isn't empty and the given CCB has a binding that can conflict with it
*/
boolhas_first_conflict(constCCB&)const;
/*!
* Returns True if this CCB's second isn't empty and the given CCB has a binding that can conflict with it
*/
boolhas_second_conflict(constCCB&)const;
/*!
* Returns a pointer to first, or second, whichever has a binding equal to the given CC_bind, or nullptr if neither
*/
CC_bind*find(constCC_bind&);
/*!
* Returns a pointer to first, or second, whichever has a CID equal to the given CID, or nullptr if neither
*/
CC_bind*find(CID);
/*!
* Returns a pointer to first, or second, whichever has *all* flags in the given mask
*/
CC_bind*find_flags(constchar);
};
/*!
* A preset, a collection of bindings for use in Control_config with an associated name
*/
classCC_preset{
public:
SCP_vector<CCB>bindings;
SCP_stringname;
public:
/*!
* Checks if the given preset is a duplicate of this one
*/
boolis_duplicate_of(CC_preset&);
};
/*!
* Control configuration item type.
* @detail Contains binding info, documentation, behavior, etc. for a single control
*/
classCCI:publicCCB{
public:
// Inherited from CCB
// CC_bind first;
// CC_bind second;
// Items Set in menu
chartab;//!< what tab (category) it belongs in
intindexXSTR;//!< what string index we should use to translate this with an XSTR 0 = None, 1= Use item index + CONTROL_CONFIG_XSTR, 2 <= use CCI::indexXSTR directly
SCP_stringtext;//!< describes the action in the config screen
CC_typetype;//!< manner control should be checked in
// Items used during gameplay
intused;//!< has control been used yet in mission? If so, this is the timestamp
booldisabled=true;//!< whether this action should be available at all
boolcontinuous_ongoing;//!< whether this action is a continuous one and is currently ongoing
public:
CCI()=default;
CCI(constCCI&A)=default;
/*!
* Assigns the contents of the given CCI to this CCI
*/
CCI&operator=(constCCI&);
/*!
* @brief Takes the bindings of the given CCB, but leaves all other members alone
*/
CCI&operator=(constCCB&);
/*!
* Returns true if this item is analogue or an axis
*/
boolis_axis();
};
/*!
* Builder predicate to populate a ControlConfig vector with hardcoded default bindings.
*/
classCCI_builder{
public:
/*!
* Initilizes the given ControlConfig vector
*/
CCI_builder(SCP_vector<CCI>&_ControlConfig);
/*!
* Start a chain of factory methods. If there are any pre-init work to be done, that's done here.
*/
CCI_builder&start();
/*!
* End a chain of factory methods. If there any post-init work to be done, that's done here.
*/
voidend();
/*!
* Assigns the hardcoded binding to the given action
*
* @note This differs from the original hardcode from :V: in the hopes of it being more intuitive to future IoAction additions
*
* param[in] action_id The IoActionId enum associated with the control
* param[in] primary The btn, key combo, or axis for the default primary binding
* param[in] secondary The btn, key combo, or axis for the default secondary binding
* param[in] tab Category tab this control should show up under on the config menu
* param[in] indexXSTR ID for the XSTR localization utility. 0 for no localization, 1 for automatic lookup, all other values are index for item in strings.tbl
* param[in] text Label text displayed in the config menu.
* param[in] type How the control should be treated. see doxy on CC_type for details
* param[in] disabled If true, this control will not be available in the game. Controlsconfigdefaults.tbl may override this. Don't use this to temporarily disable controls in mission.
*
* @details The CID for the default primary and secondary is determined by the type parameter.
* If the type is CC_TYPE_TRIGGER or CC_TYPE_CONTINOUS, the primary is assumed to be a key combo and secondary is assumed to be a joy button.
* If the type is CC_TYPE_AXIS_ABS, CC_TYPE_AXIS_REL, CC_TYPE_AXIS_BTN_POS, or CC_TYPE_AXIS_BTN_NEG, the primary is a Joy0 axis and the secondary is a Mouse axis
File diff suppressed because it is too large.
Load diff
Loaded 100 of 754 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.