Fix a small oversight from #6112. In the empty/placeholder indexed sound situation, although the sound should not be appended (since it indexed), it should still be treated as a new sound, in order for all the first-parse and first-initialize logic to run properly. Set the right value and add some comments to illuminate the logic.
Fix the inadvertent swapping of the two utility functions for parsing sounds. While we're at it, streamline a few lines, remove a few C-style casts, and remove an unused function prototype.
Follow-up to #6314. Fixes a crash encountered by Inferno on 24.2-RC1.
Per the comment earlier in this function, both -1 and -2 are expected values for sound indexes. Update the sound validity check accordingly. Fixes an assertion in `obj_snd_delete()` encountered by FotG when a sound index was -2.
* upgrade asteroid sexps to match new asteroid field features
* clang is a needy boy
* unify the sexp operators into one since there are minimal changes
* cleanup for readability
* address feedback
* keep from crashing
* Also, bash the number of waves if necessary
* Add Debug warning to modders
* address feedback
* formatting
---------
Co-authored-by: Goober5000 <[email protected]>
The BWO fix in PR #6317 was not quite the correct fix. The `sim_room_lines` array contains the maximum number of scrollable lines, not the maximum number of lines on the screen at one time. This partially reverts commit 20338ff28b and implements a new fix that allows the full `MAX_LINES` but also properly checks the list button limit. Additionally, this adds the list button limit check to other vulnerable code sections.
Fixes the tech room being limited to a single page of missions after #6317. Testing confirms that the BWO crash is still fixed with this update.
This is an error that existed all the way back in retail. Each line in the simulator room (i.e. each mission name in the list) is also a "button" in the sense that clicking on it will highlight the line and set some values. The maximum number of buttons is `LIST_BUTTONS_MAX`, but the maximum number of `sim_room_lines` was a different #define, `MAX_LINES`. This was set to 200, a far higher value than the `LIST_BUTTONS_MAX` value of 42. The code responsibly checked the limit, but the limit was incorrect.
(This had not been seen in previous mods because the number of lines was never high enough to reach 42. BWO happened to use a font that was small enough to fit that many lines in the mission simulator screen. This explains why removing fonts.tbl prevented the bug from occurring.)
Thus when the number of lines reached 42, the sim room started writing to out-of-bounds memory. This didn't cause a crash immediately, but did corrupt the `Static_lights` vector, which in turn caused a crash as soon as a model was lit in-mission or in the ship loadout screen. It's rather strange that this crash only occurred in optimized SSE2 builds though.
The fix is simply to use `LIST_BUTTONS_MAX` as the limit, rather than `MAX_LINES`. This also removes the unused `MAX_DESC_LINES` and `Num_desc_lines` at the same time.
Fixes#6313.
1. Make sure the legacy `timestamp_until()` and `timestamp_since()` functions check for any type of invalid timestamp
2. Add a useful `isFinite()` function
3. A timestamp delta on an immediate timestamp is more properly the actual delta, rather than another immediate timestamp
Add options to the Edit menu to lock and unlock objects. Locked objects cannot be selected or dragged. They can still be edited in the various editors (e.g. Ships, Objects) but not in the main viewing area.
Also add the Selection Lock option to the Edit menu. It was previously available in the toolbar but this provides another way to access it.
When the Show Waypoints option is toggled, the marking was not updated as it was for the other options (Show Ships, Show Starts, Show IFFs). Fix this by calling `correct_marking()`.
* Cleanup variable name in `weapon_do_area_effect` function
Per discussion in #6302, this PR renames `other_obj` to `impacted_obj` to minimize confusion
* update other functions with impacted_obj naming
* nullptr
* appease clang's strange rules
* fighting clang continues
* use !empty check instead of > 0
* remove un-needed no lint comment
Per #4294, this adds two new flag that, together, are equivalent to the legacy "immobile" flag but individually provide more fine-grained control. Since the physics for position and orientation have a bit of overlap, the new flag functionality simply reverts whatever position or orientation changes were done by the physics sim.
In the FRED and qtFRED ship flags dialogs, the "immobile" flag (aka "Does Not Move") is replaced by the two new flags, but in FSO the situation is more complicated. The old and new flags coexist and have overlapping functionality, so the mission designer must be careful to set and unset the appropriate flag (that is, it is possible for both "immobile" and "don't-change-position" to be set at the same time, in which case the ship cannot change position without both flags being unset). The `set-immobile` and `set-mobile` legacy SEXPs ensure that the new flags are removed so as not to conflict with the legacy flag, but the `alter-ship-flag` and `are-ship-flags-set` SEXPs and the `getFlag` and `setFlag` script functions use exactly what the FREDder/scripter specifies and nothing else.
(I attempted to completely replace "immobile" with the two newer flags, but it proved intractable to do this while maintaining reverse compatibility: retrofitting single-flag functions to apply dual flags for one particular situation made the functions harder to understand as well as introducing many edge cases and opportunities for bugs or "gotchas".)
Implements #4294.
* Fixes CTD with new Friendly Fire Feature
On current master I was hitting a CTD when firing a weapon with a shockwave at close range (ie player is within the shockwave zone). The minidump showed `other_obj` was null, so this PR adds some safety checks.
Tested and this fixes the crashes.
* fix obj usage
* one more obj cleanup
Prevent compiler warnings caused by the `value` parameter of the external serializers hiding the `value` member of `std::integral_constant`.
Follow-up to #6276.
* Adds particle effect offset.
* bugfixing
* Switches to a cleaner approach.
* Futureproofing for particle parenting.
* actually let's just bundle parenting into this one
* working on turrets
* grinding toward turret correctness
* still grinding toward correctness
* Gets turrets working correctly.
* Fixes merge artifact
* appeases clang-tidy
* Updates some comments.
* Updates some comments.
* Tiny bit of cleanup.
* Deduplicates comments.
The return value of `lua_tostring()` is NULL if (and only if) the string conversion failed. Many places in the code did not check for this situation, which led to the crash in #6290.
Fixes#6290.
* Adds curves for slash completion and rotation.
* Finalization.
* Fixes pointer comparison.
* Updates table parameter to better match behavior.
* Makes requested changes.
* Changes rotation amount to use raw curve.
* Sets curve-1.0 to be equal to full turn rotation.
As noted on Discord, there was previously no `is-species` operator. Now there is.
As a bonus, this also fixes a bug where the pre-existing `is-iff` operator did not work with wings that had not yet arrived.
This fixes an edge case in the Average and Multiple modes, where secondary lead indicator rendering was skipped by continue statements when the primary weapons were out of range. I also added some comments that help people actually understand what this function does as it is very confusing.
Although sound indexing is now done by name, mods which index by number (sc. a number that is treated as a name) expect the indexes to be in numeric order. When multiple levels of -snd.tbm files add mixed retail-style and new-style sounds, this assumption can be violated due to named sounds being placed into indexes that later files expect to be available.
This PR refines the parsing so that sounds which use a numeric index can pre-empt existing named sounds that have been assigned to that index. Since named sounds can go anywhere, they are just moved to the end of the list. This allows the ranges 192-199 and 202-249 to be available for numeric indexes as expected under the old style. MediaVPs named sounds which were previously parsed into those indexes are bumped to the next available index.
Additionally, this PR doubles the range of numbers that are treated as indexes, to more realistically accommodate additional numbered sounds. (The number/index distinction is rather arbitrary and is primarily used to avoid creating large sections of unused sounds if a mod were to specify a very large number, e.g. 10001, for a sound name.)
Finally, this changes parse warnings to use `error_display()` so that the warning displays the parsed file and line number.
Fix units are denominated in seconds, while timestamp units are denominated in milliseconds. This fixes the directive timing check which, after the timestamp upgrade, would time out after 5 and 7 milliseconds instead of 5 and 7 seconds.
Follow-up to #4633.
* Sets up linear interpolation for object particles.
* Makes interpolation time-based.
* Updates comments to match changes.
* appeases clang-tidy
* Adds interpolation for particle particles.
Model textures that are too long will cause a very unfriendly and hard-to-track down "ERANGE: String" error. The situation can be greatly improved by checking the string length ahead of time, printing a friendly Warning, and truncating the filename. This will alert the modder to the source of the problem while also allowing gameplay to continue.
This would crash because duplicate sounds were not being populated with the original entries. When snd_set_pos was called, the handle to the Sounds array would not be set, making our code think it was not loaded.
According to DahBlount:
> Most atan2 implementations for a long time had problems when the inputs were close to machine epsilon or when x was less than or equal to 0
And according to z64555:
> Modern versions of C++ should have an atan2() that works correctly when the inputs are at 0 or near epsilon of the floating point specification, meaning Volition's workaround shouldn't be needed anymore.
So this removes `atan2_safe` and changes all instances to `atan2`. Consequently, the angle range in FRED now shows as [-180, 180] as expected.
Fixes#3730.
The somewhat modern AI flag for `Require_exact_los` is extremely useful in multiple different situations, for example making large capital ship weapons not fire into friendly surrounding ships on accident. When the feature was added, the `check_los` function was provided with a default value of `10.0` meters for minimum radius detection. This PR exposes that value to modders so they can set it to a reasonable value depending on the ship sizes of their specific needs. And as a note, the los value just uses a simple numerical comparison check, so the los detection could be set to a negative value with no consequence (hence why error messages were not added, though if folks would like I can certainly add them).
In retail, the processing of certain keys during a popup, in the `popup_process_keys()` function, was dependent upon the `PF_ALLOW_DEAD_KEYS` flag. This flag was never used in retail, causing the if() block to be marked as dead code. In a4e623db23, the dead code warning was addressed by removing the dependency on `PF_ALLOW_DEAD_KEYS`, which is incorrect. The "dead keys" should only be processed during the "dead popup". Since the "dead popup" was moved to its own de[a]dicated "popupdead" section, the "dead keys" processing can be entirely removed from the "normal popup".
Fixes a bug noticed by @PremiumColt where certain keys, especially the time compression keys, were processed while the ESC popup was active.
This prevents Coverity from running on any forked repository, by default; both because the workflow will fail, and also because the workflow's results would be identical. (Any forked repository can, of course, change this within its own scope.)
In `strings.tbl` the graphics settings localization IDs are as follows:
1160, "Low"
1161, "Medium"
1162, "High"
1163, "Very High"
These values are used throughout the code, but in some cases with SCPUI upgrades, the IDs got off by 1. This PR fixes those incorrect IDs.
Supports newer SDL2 from the prebuilt package on win32/win64
Adds support for Windows ARM64
Adds option to use prebuilt SDL2/OpenAL/Freetype libs on Linux
* coverity - using `std::move` instead of copying, and change some parameters from value to reference
* coverity - fix or mark potential copy-paste mistakes
* coverity - various checking of parameter and return values
* coverity - miscellaneous fixes, and change some 'intentional' markers to 'false positive' markers
In current master, the debug log commonly shows `CSG => Warning: (0x0011) Short read, information may have been lost!`.
Thanks to Taylor for pointing the following issue out:
The function `pilotfile::csg_read_redalert()` returns if `ship_list_size` is zero, but it still needs to check the `wing_list_size` a bit below that. This has likely not caused data loss issues ATM, because it's reasonable to assume that if `ship_list_size` is zero then so is `wing_list_size`. But it's still a bug and should be fixed before it does cause some real data loss.
This PR moves the relevant read sections to within each respective if-block. That way the function is capable of checking both `ship_list_size` and `wing_list_size` on every load (even if `ship_list_size` is zero).
Per @notimaginative, change the `compiler` variable to uppercase to match its usage in the rest of the file. This should allow the coverity task to start running again.
I took a close look at the code involved in parsing particle tables. There is no smoking gun, but there are several ways to polish the code which I have implemented here. The most likely culprits for the slowdown, IMO, are the repeated conversions between SCP_string and C-string, especially in `ParticleManager::getEffectByName()`; followed by the omission of `std::move` in several places.
Adds an optional argument to the `lock-perspective` sexp to allow locking of the 'free look' or 'padlock' view. This prevents the player from looking around which might not be desired in certain forced perspective situations.
When loading a legacy mission that contains a debris field, FSO will try to index into an empty vector, causing an out-of-bounds exception. This can be seen by loading Derelict mission dl1-08, "The Horror in the Deep".
The `// Obsolete and only for backwards compatibility` code added in #6021 properly handles asteroid fields, but not debris fields; so the fix is simply to apply the logic to debris fields as well.
Patches the gamesnd system in several ways to properly fix the bug identified in #6196. Due to the way the new sound system was written, sounds with numeric IDs were not necessarily added in their indexed location, even though the code assumed (even prior to #6112) that this would be the case. The code now uses the proper index for both old *and* new style sounds. This is done by ensuring, in `gamesnd_parse_entry()`, that the vector contains an entry for the specified numeric ID before doing a search for that ID.
Due to the slightly modified population of the gamesnd vectors, the `Snds_iface_handle` vector is now populated after parsing the various sounds.tbl files rather than during parsing.
Separately, this makes consistent the handling of the `sound_entries` vector which could potentially be empty but also treated an empty state as an assertion failure.
#6187 fixed transparency for cockpits, but the positioning for deferred lighting alas fell through the cracks. This PR fixes that and allows deferred lighting in cockpits to once again work as intended.
Tested and fix works as expected.
When a new mission is loaded, clear the parse names vector, in lieu of the old `Num_parse_names = 0;` line. This fixes a bug where FRED will complain about nonexistent ships when loading a different mission. Follow-up to #5937.
* One more follow-up to #6021
Update assertion message and mission saving check since older builds are not going to be able to read fields created with newer builds
* update to use empty
The Unlimited Asteroid/Debris Field Types & Subtypes PR (#6021) updated to using vectors to allow for unlimited asteroid and debris types. That update removed the count field, `num_used_field _debris_types`, which counted both asteroids and debris pieces (even though the name only has debris in it). The counter variable was removed in favor of `.size()` but now both asteroid and debris field sizes needed to be checked, so this PR updates the code to account for that. Allows asteroid fields to properly pass the count check and properly again spawn in mission.
Tested on asteroid fields passive and active along with debris fields (both created from sexps and the asteroid mission editor) and everything now works as expected. Also tested on missions with no fields and those also still work as expected.
Break when you've found a match, instead of just mindlessly comparing the rest.
This is technically just an optimization and safety change, but potentially, before, if the loops had been switched, it would have caused unexpected behavior if two copies of the same flag were listed.
The header length from the tracker is 1 byte larger than the size calculated
by the client due to psnet removing that byte internally. The header length
is adjusted to compensate for this, but only *after* the deserialization
process, so we have to use the received packet size instead.
* Remove old interpolate angles quick
* Remove old interpolate functions
These are no longer used.
* Add linear interpolate vm function
More clearing functions
* Add physics snapshot struct to silo interpolation
Two of these two functions require an object pointer, so they cannot be in physics_state.cpp
With doxygen documentation
* Try to placate Linux
* Address Feedback
* And update declaration, of course
* Attempt to appease linter
* add API for glow point banks
Previously, a model API existed for glow points mounted on thrusters, but not glow points mounted on glow point banks. This adds glow point bank support. Also, this refactors and cleans up the implementation of the model API a bit.
* NULL -> nullptr
Should allow for most games, even those behind CG-NAT, to work without having
to set up port forwarding. This set of changes is only needed for game servers
to work with the new feature. No special handling is required for clients, so
any build from the last few years should work for them.
The new `ai-disable-ship-tactical` and `ai-disarm-ship-tactical` goals were inadvertently omitted from the ship type default table, causing these goals to not be available in the Event Editor drop-down menu or Ship Editor initial orders. Testing did not catch this because testing was done using the HUD squad message system which assigned the new goal (if the flag is enabled) without explicitly checking the validity.
Follow-up to #5512. Fixes#6189.
* make mission log dynamic
Change the mission log from a static array to a dynamic vector. This removes any chance of the mission log running into a limit (as regularly happened with the last mission of Shepherds before the limit bump) and also prevents strange mission bugs caused by culling obsolete entries.
This also unifies the API a bit by renaming the public `message_log_` function prefixes to `mission_log_`, removing the redundant `Num_log_lines` variable, and removing `Log_scrollback_vec` from the header.
Implements #5878.
* feedback
* refactor to reference rather than pointer
* base working version of unlimited debris types
* Proper FRED support
* make qtFRED handle asteroids properly
* fix qtFRED assertion
* further clean out MAX_RETAIL_DEBRIS_TYPES
* These should be sizes not POFs
* Move this to it's own method
* convert asteroid subtypes to a vector
* unlimit asteroid subtypes
* fix some global shadowing
* signed/unsigned mismatch
* Address feedback
Fixes a bug with new unified scanning PR (#6000) and adds a bit of cleanup, including consistent brackets, whitespace cleanup, and removing vestigial function from the original PR.
Tested and works as expected.
* disable popen
* Check file type when opening with io lib
* Compile on Windows
* Windows include
* Properly conserve function environment
* Correctly copy fenv
* Move these functions into OptionsManager for more global use
* Make sure player options are preferred even when using OptionsManager
* persist the newly loaded options to disk
* Actually let's persist these only if the load is successful and also handle the multi option
* Comment this out for now I guess
This refactors the object_h struct to store objects as indexes rather than pointers. This is a prerequisite for making the collection of objects dynamic in the future. See also #6100.
Follow-up to #5800 and #5829.
* Save/Load player options to a mod-specific ini file if possible
* use rfind instead of find to ensure it's the last dash character used for trimming
* cleanup + comments + nullptr
* A more robust way of getting the mod root using lambdas
* prevent infinite loop for non Knossos/Knet mods
* Notify the player if options may need updating and pull settings from fs2_open.ini if we can
* proper localization
* update xstr
Inspired by #6178, this moves the existing `count_items_with_name()` functions into utility.h and adds additional functions for finding specific items with a given `.name` or, more generally, a given field. The `Damage_types` search has been converted to illustrate how these functions can be used.
* Expose Impact Damage Type to Scripting
There's already a sexp that does this, but having the script version for ships is quite useful, too. For example, scripters can set impact damage types for just the player at various difficulties.
Tested and works as expected.
* always set damage type
* Exposes the New Flight Cursor Mode to Scripting
Thanks to #6136, FSO supports switching between two methods of flying. This PR exposes those settings and values to scripters. Tested and works as expected.
* fix aiming setting
* add reset position function
* cleanup setting pitch and heading
* one more cleanup
* update to enum support
* remove older version
* one more fix for setting flight mode
* Clean unneeded properties
* properly queue-ify keys
* Refactor key checking to use functions instead of globals
* Update hooks and cache checked-against key
* Documentation and Naming
* match tilde
* only remove control not debug
* Move replacement textures from ship to modelinstance
* Actually set pmi
* Fix texture replace in fred as well
* Fix bad indent
* incorporate feedback
When game sounds were changed to allow named entries, it became possible for named entries to unexpectedly replace numbered entries. This was noticed most obviously in the ballistic rearm sound effect, which started using explosions rather than the standard rearm sound effects. This occurred because MV_Tiny and MV_Small were added into indexes 200 and 201.
To restore the original behavior, the code now prevents sound effects added via TBM from being placed into reserved indexes. The reserved indexes are instead assigned placeholders, which can subsequently be updated or left alone as the modder prefers.
This also makes the code a bit more robust including patching some sound validity checks in `gamesnd_game_sound_try_load` and `snd_load`.
Considering that we have `ba.createRandomVector()`, we should have `ba.createRandomOrientation()` too. This is based on an algorithm devised by @Baezon.
When messages are distorted due to EMP effects, the voice volume should be controlled by the voice setting, not the effects setting. Fixes a bug noticed by @skdKitsune, a portion of which dates back to the original public source release.
Also, when volume is adjusted in `snd_set_volume`, make sure the correct voice volumes are used. Fixes a copy-paste bug from #5694.
The three functions `physics_apply_whack`, `physics_apply_shock`, and `physics_collide_whack` limited speed after the physics had been applied, but they limited absolute speed, not the speed due to the physics. This modifies the process to limit the change in speed. It also adds an AI profiles flag to disable the limit if desired.
This also tweaks the three functions (by editing comments and moving lines) to be more consistent, since all three are doing very similar calculations near the end.
* Expose Collision Rotation Factor to Players
Previously, there were hardcoded checks in place to make players have 0 rotational effects when colliding with another ship. This PR adds a new value, "+Player Multiplier for Rotation Factor:" that allows modders to have players experience rotational effects from collisions. Also performed some cleanup of the light and heavy collisional rotational calculations by removing older if-blocks following useful recommendation from Asteroth.
Tested and works as expected.
* make rot_fac_multiplier_ply_collisions into global value
* update name to better match with ships table
* restore repeated comments to help with separation
Follow-up to #6047. This method better accounts for matching the guardee ship orientation when using the new AI flag.
Tested and works as expected. Thanks @BMagnu!
1. Add the "Override #Command in event messages" checkbox to qtFRED
2. Add the "Preload Subspace Tunnel" checkbox to the proper button group in qtFRED
3. Reorder lines in fred.rc so the declarations match the order they appear in the dialog
4. Use the correct name when reporting fireball index errors for ship classes
This provides a command-line argument to restrict the time compression range to the classic 1x - 4x. Implements #6075.
I'm not entirely satisfied with `-orig_speedx_range` but it's the best I came up with that fit into the 19-character limit. I'd be open to other suggestions.
Rework `hud_support_find_closest()` slightly to do a quick out if the player is no longer a valid object. Fixes an assertion noticed by Darius that occurs if the player dies when a rearm is imminent.
Make the initialization sequence consistent so that FSO, FRED, and qtFRED call their initialization functions in the same order. Most of the changes involve bringing FRED and qtFRED into sync with FSO. This fixes fireball prerequisites for the ship types table, applies the script initialization fixes from #5946 to FRED, and generally removes the possibility of any surprises due to FRED differing from FSO.
Also remove the empty `brief_init_colors()` function.
1. fix a bug where blips expired immediately every frame; they now track their expiration by object
3. store object numbers rather than object pointers
3. clamp both the high bound and the low bound of alpha values
Convert `sweep_duration` from seconds to milliseconds to work correctly with the timestamp system. Also clarify use of `game_get_overall_frametime()`, especially with `ba.getFrametimeOverall()`; and add `ba.getSecondsOverall()` to do what `ba.getFrametimeOverall()` allegedly did.
Allow the resize mode to be specified to `gr_set_clip()` without changing the active graphics-wide resize mode. Along with `drawStringResized`, this provides a shorthand to allow text to be drawn at different sizes, with the appropriate clipping regions, without requiring access to the `CurrentResizeMode` virtvar.
As requested by Event Horizon, this removes the limit on fireball types. The fixed array has been replaced with a vector and the relevant code updated accordingly. There is also a new version of `stuff_int_list()` to parse ints into a vector.
This also adds bounds checking for explosion animations that are parsed for ship classes, ship types, and asteroids, since previously there was no guarantee that the indexes would be in range.
This is a follow-up to #2942. That PR solved most of the short-circuiting issues with nested conditionals under when-argument, but it was still possible for the code to incorrectly short-circuit on a nested conditional that had `<argument>` in an action operator but not a condition operator. The cleanest way to fix this is to not short-circuit on *any* nodes that are part of a when-argument tree.
First step in the process of working Windows ARM64 support. This adds the most
basic support needed, but by itself will not succesfully build. However these
changes should not interfere with builds for other architectures or platforms,
and should still allow for x86/x64 builds on ARM64 Windows.
Remarkable that we're still finding bugs in fighter beams after 20 years...
Since field-of-fire angles are specified in degrees, and `cosf` accepts radians, the angle needs to be converted (and then halved, per usage elsewhere). Although this is a bugfix, this should technically not affect fighter beam behavior because fighter beams always fire down their normals.
As a follow-up to #5523, some mods use callsigns for their ships but prefer not to display the callsigns in the escort list. In lieu of a more flexible way to configure escort lists, a simple flag is sufficient to implement the desired behavior.
To enforce type safety for arrival and departure locations, this converts them to enum classes. Various casts are added when appropriate to convert between the indexed and enum values.
Allows ships and wings to arrive behind a ship, to complement 'In front of ship'. In fact, the arrival code is nearly identical, with just a small tweak to distinguish ahead from behind.
Since the new arrival location represents a change in mission format, this also adds code to detect for its usage and set the mission format to 24.1. Most missions can continue to be saved as version 23.1.
* Improve Mainhall Button Responsiveness
Previously, there was a 175 millisecond delay when hovering over a mainhall animation before it triggered. This PR makes that value settable via the mainhall table.
Tested and works as expected. Now custom mainhalls have much more of a spring int their step.
* cleanup num res location
Indexes are a more robust way than pointers to manage model and submodel handles, and in the event that models are made dynamic in the future, indexes will be necessary anyway.
Set the bad node to the ship node, so that the FREDder can see which ship is receiving the invalid order. Without this change, the bad node would point to the last value parsed, which is typically the goal priority.
Fixes a misleading error dialog reported in Discord.
When attempting to add a chat message which is all whitespace the split_str()
function will produce no lines. The strcpy() that follows will then crash
due to an attempt to copy a nullptr.
Adds bcdec lib to convert compressed DDS textures to RGBA based on what the
system supports. BC7 if BPTC extension not supported, DXT? if S3TC extension
not supported.
Should support cubemaps and volume textures but those were not tested.
Addtional changes:
- remove indexed DDS support since it had bugs but didn't work anyway
(R8 should be used instead)
- fix issues with volume textures (nothing to test with)
- remove old compression support flags as they are now obsolete
Fixes#4920
Follow-up to #6034. This slightly changes the function signature of `AddElectricArc` but it should be fine since it hasn't appeared in a stable release yet.
* multi host settings ui initial setup
(cherry picked from commit bcb31c327653329e62e4430815fe1e981751f9dc)
* Finish the rest of the API
* include enums
* set these
* Close game needed
* Handle accepting the host setup
* Don't need to be master to set these and add ways to check master and self
* add client ui to this PR because
* Allow getting the player state string
* Multi sync api methods
* unused variables
* Fix state checking
(cherry picked from commit fcde973cdf)
* typo
* address feedback
(cherry picked from commit ecb33e7cc6)
The ai_profiles.tbl options can already be read in any order, so it is modder-friendly to extend this capability to game_settings.tbl as well. This also updates the "unrecognized parameter" log statement to indicate the filename.
Note that this commit should be viewed while ignoring whitespace changes.
Add a routine to the sexp syntax checker that also checks for potential issues. These are not definitive errors, but situations that might trip up mission designers. Currently there is one issue checked: the destruction of a wing that has multiple waves and arrives from a docking bay.
This does two things:
1. Fix a bug in `mission_bring_in_support_ship` that assigns an incorrect parse object index to the support ship's ship registry entry. Since `Arriving_support_ship` is not an item of `Parse_objects`, it should not have an index.
2. Adjust the in-game join checks at the bottom of `parse_create_object_sub` to more scrupulously account for index mismatches and bounds errors, with a specific exception for the arriving support ship.
Thanks to @notimaginative's detective work, nearly all of the FRED stalling when saving a mission can be avoided by simply not calling `model_free_all()`. By checking a flag in `clear_mission()`, multiple situations can avoid this slowdown, including reload-after-save and import-FSM.
The model was not updating its sending to front end list when getting new info from user input. It would save it in the model, but not where it was sending information back to the dialog (UI).
The logic to handle the `$Fixed Missile Detonation:` flag missed an important case: subsystems with concave hull geometry but without destroyable submodels. The original flag was tested on a bowl-shaped turret, which could be destroyed. However the bowl-shaped engine on the SSG Rahu was susceptible to the same detonation problem. By changing the check to always use the radius, whether obtained from a submodel or from the subsystem, the flag fixes the detonation in both cases.
With the `$Damage Impacted Subsystem First:` game_settings flag, weapons will damage submodels over subsystems, even if the subsystem is closer. Yet occasionally this is not the correct behavior (e.g. for the Rahu's engines). The new subsystem flag allows this behavior to be selectively overridden.
Fix a minor oversight from #6014; in the ship lab, there are sometimes no suns at all, so remove the assertion. The lighting check is only needed for supernovas anyway, so make that clear.
Additionally, add further clarification for the distinction between suns, lights, and variables used only for the supernova. Finally fix one more sun/light discrepancy that escaped notice from #6014.
Fixes an assertion in the ship lab. Follow-up to #6014.
* add cockpit fov to in-game options and use a define for the default fov value for both fov options
* Add a controlling toggle option
* constexpr
* localization
This adds the special SEXP return values (SEXP_KNOWN_TRUE, SEXP_NAN, and so forth) as enums, and adds code to intercept these enums if they are returned where the code would normally expect a boolean or number. If an enum is found, it is converted to its special return value equivalent.
With this change, a script can end a function with `return SEXP_KNOWN_TRUE` or similar. No other API changes are needed; in particular, no special `$Return Type:`s are needed.
Implements #5959.
In #5894, in the `add_dynamic_sexp` function in sexp_lookup.cpp, a call to `sexp->getHelpText()` was moved to the bottom of the function. Normally this would be fine, except that this occasion caused the `sexp` variable to be accessed after a `std::move`. The crash can be avoided by moving the last access of the `sexp` variable just a little bit earlier.
This allows the skybox orientation and alpha to be accessed and changed through Lua virtvars, and also adds a sexp to change the alpha.
Unfortunately, changing the alpha has no perceptible effect on the skybox. This will need the attention of a graphics coder to figure out what might need updating.
When waypoint start index and direction were added in #5698 / 42fc989 et seq., the `Fix_ai_path_order_bug` flag needed to be updated to account for those new options. This fixes that.
Fixes#6052.
Since the On Ship Collision hook can potentially be called twice, with the ships reversed, it is necessary for both parameters to have submodels specified. Otherwise +Override would not be able to handle both cases.
Followup to #6035.
* Add AI Flag to `align to target when guarding stationary ship`
When a ship is ordered to guard another ship that is stationary and not incredibly large, the AI will fly to a position then turn and face away from the targeted ship. This behavior is not ideal in various scenarios, including both blockade style formations and overall visuals.
The PR adds a flag that tells the AI to align to the target ship it is guarding once the AI has reached it's guarding position in this situation, which allows all the guarding ships to have the same orientation and look much better and work better for directional defenses.
Tested and works as expected. Also changed some `NULL` to `nullptr` in this function for cleanup.
* remove duplicate brackets
* convert multi team chat to use a struct/list setup
* use the correct array size define
* cleanup local vars & Asserts
* address feedback
* remove uncessary if
* multi pxo api
(cherry picked from commit 9af26da728a19b9d6c890968a314e8e56ecc1ddf)
* multi pxo help api
(cherry picked from commit f4df704576ddb648e9c486907b07ae172c859feb)
* minor fixes
* not extern
* break out chat message data into a table
* address some feedback
* return empty strings if not in multi
* use GetChannelByUser() instead
* once more with feeling
* correct documentation
Kind of surprised this SEXP operator hasn't been added before now. It complements the existing percent-X operators in the Objectives category.
Also, this fixes and clarifies the help documentation for the various percent-X operators.
Turn `Parse_names` into a vector and add SCP_string overloads of ship registry functions. Refactor calling code to use registry as appropriate. Remove an unused overload of `mission_parse_get_parse_object`.
* Add the submodel that was hit to the On Ship Collision scripting hook. (This will only be non-nil if the ship was the "heavy object".)
* Add a `getModel()` function to the scripted submodel object.
* Fix some incorrect documentation in `OnShipCollision`.
* Expose NoCollide and NoCollideThisOnly as virtual variables for submodels
* Allow submodels to be optionally specified in object:checkRayCollision
* Be sure to calculate ship-to-ship hit position before the override collision hook is called, in case the hook needs this value. (The other collision hooks already calculate the hit position before the override hook.)
- Set app name properly per Apple docs
- Use correct "FreeSpace Open" name
- Set version properly per Apple docs
- Add bundle identifier
- Update copyright date
- Remove localized strings since they are all English already
A design choice very early in FSO's scripting development established that invalid results return invalid objects. By using a game_settings.tbl flag, this allows invalid results to return nil instead.
* Fix CTD with HUD Preset Switching
After #5302 it was discoved that pressing the `Next` button in the HUD presets would cause a CTD.
Thanks for Lafiel for figuring this out
`If HC_current_file is HC_preset_filenames.size() - 1, then it'll oob on a vector access.`
Testing this PR fixes that crash.
* use static cast
* add extra ways to modify background elements in missions
This adds Lua API methods for getting suns and bitaps by index, as well as modifying their scale and position. This removes the need to completely add and remove a background element that only needs to be modified.
* big pruning of (int) casts
* Add control_info driver sources
* Properly deal with cockpits and their 'objnum's
* Add driven animation sets to weapons and cockpits
* enumify objnums
Several handle types in the scripting API used inheritance where composition would be more appropriate. This refactors those types, as well as removing the various handle types that were just aliases for `model_h`. These are just the C++-side types; all the Lua types remain as-is.
This also refactors `sound_h` to move the previous `isSoundValid` to `isValid` so that `ade_set_args` will work properly for sounds with the `Lua_API_returns_nil_instead_of_invalid_object` flag. The subclassing from `sound_entry_h` was removed and the "full validity check" was moved to `isValidWithEntry`. The Lua side remains unaffected, but additional documentation was added to clarify the usage.
Follow-up to #6009 and prerequisite to #6006 due to the `isValid` refactor for `sound_h`.
There was confusion in the lighting code between light indexes and sun indexes. These are usually the same, but not always. This makes several changes to fix light/sun handling.
1. Clarify the distinction between lights and suns and add a `sun_index` field
2. Add a flags field and assign the `dual_cone` boolean to it, as well as a new glare flag
3. Determine light glare by checking the light flag, not the sun (which never worked in the first place as the `stars_sun_has_glare` function checked bitmaps rather than suns)
* Create the ingame options game state
* Base working version of in-game options
* Cleanup + Optimization
* Localization pass
* more cleanup + documentation
* tooltips on option hover
* documentation and better inbounds check
* match case
* format strings instead of direct strings
* unused parameter
* address feedback
* localization id conflict with master
* Add this line back in
* pass the new option flags as well
* resolve xstr id conflict
There was an extra check during ship class parsing that prevented a ship class's type from being set if it had been set already. This dates back to commit 5f3a6ec7 and was added as a parsing safeguard rather than as part of any modular table checks. Since the parsing has changed, this extra check is no longer applicable. Removing the check allows a ship class with a different type to be created using an existing ship class as a template.
This rather insidious FRED bug was all down to an improper check for the current ship. It is possible for multiple objects of different types to be selected at the same time. If, for example, a waypoint and ship are selected, and the waypoint was selected first, the waypoint will be what `cur_object_index` refers to. Since the ship is the one and only ship selected, it will be what `single_ship` refers to. Therefore, to avoid flagging its own ship name as a duplicate, the loop should exclude the single ship, not the current object.
The bug can be reliably triggered by selecting a waypoint, then adding a ship to the selection, then switching the focus to another application and back to FRED. This finally squashes the bug.
This improves the ability of Lua to check for ship arrival status:
1. Deprecates the `isWarpingIn` function, which can be misleading, and replaces it with the equivalent `isWarpingStage1`
2. Adds an `isWarpingStage2` function to fill a gap in functionality
3. Adds an `isArrivingWarp` function (complementing the existing `isDepartingWarp` function) to cover both stage 1 and stage 2
In #2464, a somewhat hard-to-understand equation involving taking the modulo of a random number was replaced with a function that would do those calculations instead. The problem is that the function performed the *entire* formula, while the code it replaced was only operating on the *difference* between the two numbers. Fortunately, this is as easy to fix as changing a `+=` into just an `=`.
There were a few instances of `Random::next()` being called without ensuring its arguments couldn't trip an assertion. This should hopefully catch them all.
Before this commit, `IFF_COLOR_SELECTION`, `IFF_COLOR_MESSAGE`, and `IFF_COLOR_TAGGED` were hardcoded indices into the `Iff_colors` vector. This could cause problems if any of these three colors were set to the same RGB values (since `iff_init_color()` doesn't create a new entry if the color already exists in the vector), and if a modular table tried to change any of these colors nothing would happen (since it would just create a new entry in `Iff_colors` without doing anything to the hardcoded indices).
This commit instead changes the `#define`s into `extern int`s, and assigns the return value of `iff_init_color()` to those global variables upon parsing the special color values, meaning that any combination of the three can be set to the same color without causing issues, and modular tables can actually modify them.
Potential clutter from unused values in the `Iff_colors` vector is basically unchanged (technically slightly worse if a modular table overrides any of these special colors with a color that doesn't already exist in the vector), but should maybe be looked at in the future.
The general expectation is that model filenames can be specified as 'none' or '<none>' for no model, but as discovered by no tea, this was not consistent across the code base. For example, `$Model File: none` was handled as expected but `$External Model File: none` was not. This PR makes the handling consistent for all ship, weapon, and shockwave POF files, and also adds some extra checks when models are loaded.
1. Fix the item ID indexing on the popup submenus and make sure they correspond with the ship dropdown menu
2. Remove the "player start" popup menu option as it has very limited utility and was already removed in qtFRED
3. Reduce a bunch of casts by using more appropriate popup menu types
4. Actually place an object in the mission when one is chosen from the popup menu
Also:
1. Remove the `Default_player_model` variable as its use is redundant
2. Remove unused arguments of `create_player()`
The result of this special parsing should produce a mod string identical
to the string passed on the command line with the following exceptions:
directory name case, directory separators
Should address the following:
- no fundamental difference in modlist compared to Windows
- no errors or warnings that are not produced on Windows
- do not remove mods from list if missing
- verify mod directory is accessible and actually a directory
- do minimum amount of work to see if mod directory is valid
- fix bug with trainling slashes
Old Volition bug where the original directory is pushed onto a stack
before the chdir() call. If that call fails then the stack is left with
a used entry that won't be removed until restart and can cause the stack
to fill up. Now it's added only if the chdir() call succeeds.
Also take the opportunity to make Cfile_stack dynamic.
Change the casts used in the convenience #defines in floating.h. Since these #defines are used pretty widely, this should reduce the count of C-style casts in the codebase by quite a bit.
Also change the casts in floating.cpp while we're at it, and remove some obsolete or unused code.
Make sure all medal fields are properly assigned. In particular, if a modular -mdl.tbm is parsed, don't overwrite information from the base medals.tbl. Fixes a bug reported in Discord.
This fixes command briefing data apparently disappearing. The ui was not being properly initialized because model_changed was being called before the ui was initialized, leading to default values.
This also fixes a few other minor issues.
In #5649 / b6c0e8b, the ship registry was updated to take ship death rolls into account. There was one small wrinkle that it did not account for, however: SEXP operators that return numeric values had previously (i.e. before the introduction of the ship registry) checked the mission log for ship destruction, but after #5649 the EXITED status was not set until after the ship had completely exploded, resulting in certain SEXPs having their conditions slightly modified. The equivalent of checking the mission log for ship destruction is now checking the ship status for DEATH_ROLL, so it is necessary to make that change for the numeric SEXPs to behave as they did before.
The motivating result for all this is to fix SEXPs like `hits-left` firing after a ship has been destroyed but before it has finished exploding. This can be seen by loading the first non-training mission of FSPort and comparing the messages that are sent if you use cheats to kill Alpha 2.
SEXP helps should let the FREDder know whether a given ship argument
needs to be already in-mission for the SEXPression to operate. Update
the helps to include (ship needs to be in-mission) or (ship does not
need to be in-mission) or other relevant helpful information.
Check the filenames used to initialize HUD gauges and mark the gauge as hi-res if the filename starts with 2_. Also add a script method to return this value.
Additionally, make accessor methods `const`.
Since its creation, the `is-in-mission` sexp operator has only checked for ships. But mission designers might assume this also works for wings, leading to a situation where the sexp always returns false because no ship can have the same name as a wing. Fortunately wing functionality can be added to this sexp without affecting ship functionality.
This fixes a few items that were revealed in the course of Dark Visor's SEXP documentation PR. The EXITED status should return NAN_FOREVER, not just NAN. The CANT_EVAL value is never returned from the sexp on account of ship status, due to the preceding check, and is not an appropriate return value anyway; so that is removed. Finally, for a ship that can't move, the NAN return value is better than CANT_EVAL, since it represents the numeric situation more accurately and can also be checked by `is-nan`.
This adds a new field to particle effects so that particle rotation can be configured on a per-type basis, not just on a blanket basis. Implements #5941.
As reported by Trivial Psychic, if the number of subsystems exceeds the max as the result of a modular table, the error message was very misleading. This fixes the error message and also makes it report the correct number of parsed subsystems.
`ai_get_weapon` is not guaranteed to return a valid `wip`, so check for that here. This should now cover all uses of `ai_get_weapon` in the codebase.
Fixes an Event Horizon crash reported in Discord. Follow-up to #5842, commit 8dbe0e7.
Apple Silicon Macs require that all code is signed in order to run. Our builds
are partially signed due to the SDL framework already being signed, so it is
seen as broken. To fix that we need to codesign all the rest of the necessary
files with an ad-hoc signature in order to allow the builds to work properly.
This is a new method of ensuring that OPF_POSITIVE numbers are positive. It works for all numeric arguments, including variables and literals, and caches the status of the node to avoid lookups for every negative number on every frame. Tested on both operator and non-operator cases.
Follow-up to #5915.
Operators that specify OPF_POSITIVE should be guaranteed to get positive numbers. This code was previously disabled for performance reasons, but following the contract of the SEXP system is more important. A future PR will improve the performance of the functions used here.
Also, the `num-players` operator takes no arguments, so fix that.
In consultation with @BMagnu, code that validates data in the POF file itself should happen in `read_model_file_no_subsys`, as virtual POFs rely on their source files having correct data. I've added comments and slightly rearranged things to make this clearer, and also moved the new code from `read_and_process_model_file`. Additionally, I fixed two bugs by changing `parent > pm->n_models` to `parent >= pm->n_models` and adding a newline to the `nprintf`.
After getting the main state from the Lua registry, this function had
two Lua thread values on its Lua stack but we only removed one which
lead to a value being left on the stack.
Why did this not blow up before? Because undefined behavior.
The only place where this was called was when creating a Lua reference
value where luaL_ref is called in the same expression (see
UniqueLuaReference::create). The evaluation order of the parameters for
the make_shared call is not defined by the standard and for some reason
all major compilers (except clang) choose to execute the luaL_ref call
before the getMainThread call.
For those compilers, everything is fine. We have some extra values on
the Lua stack but that gets cleaned up after the API function finishes.
However, clang first evaluates the getMainThread which leaves an extra
Lua thread on the Lua stack. The luaL_ref call then references this
thread value instead of the intended value. In the concrete case, this
meant that LuaFunction saw that the reference points to a thread and
rightfully threw an exception.
This fixes#5904.
Use a single canonical `frametime` value for all HUD rendering, in both `hud_render_preprocess` and `hud_render_all`. Previously, certain functions called through `hud_render_preprocess` were using the full frametime, rather than the half frametime needed for VR when the HUD is rendered twice.
Fixes#5882.
Use a simpler, more robust, and more correct method of sharing the fire direction among beams: replicate the actual beam vector for all firing points. This further cleans up and simplifies the beam firing code and also clarifies some vector math.
1. make `check_ok_to_fire` return a boolean (like `check_los`)
2. make `check_ok_to_fire` and `check_los` both use a position argument since we don't need the whole turret
3. remove the redundant position prediction code from `ship_get_global_turret_gun_info` (since that needs to be a "pure" function) while making sure "share fire direction" still works
4. skip calculation of the vector in `ship_get_global_turret_gun_info` if we don't need it
5. move the position prediction code out of `aifft_rotate_turret` and into its own function
6. prune some gun position calculation calls since in most cases one will suffice
7. fix position "jitter" with weapon subsystem damage in missions that use gravity
8. `model_rotate_gun` now uses a nullptr position for a reset instead of an extra boolean argument
9. use a more efficient method to calculate gun barrel length
10. a couple variable name changes for clarity
1. Allow a `+` to appear in front of numbers, just as with `-`
2. Check for `.` and `,` within numbers to give a less misleading error message than "not a number"
3. The old number hack inadvertently skipped numeric literals, so specifically check for those
There are several SEXP argument types that themselves encompass multiple argument types: for example, ships and wings. This could be misleading when there is an error message displayed. So, this updates the error codes to explicitly cover all of the possibilities.
By using app image and switching to Checkout V1.
Also removes Vulkan SDK install, since it seems to be taken care of by the app image or is disabled. I can't figure it out from the app images.
This limit has not been bumped since the original public source release. The final mission in Shepherds has been experiencing mysterious bugs which were finally tracked down to the mission log overflowing its limit and discarding log entries. Ideally the mission log should be made dynamic and the pruning mechanisms removed, but for the 24.0 release, it suffices to bump the limit.
Volition used a bit of juggling when deleting the briefing editor pointer. Turns out this actually prevents a crash in certain situations, so let's put it back.
Follow-up to #5866.
This refactors the ship registry and the OSWPT struct to store data as indexes rather than pointers. This is a prerequisite for making these collections dynamic in the future. See also #5800.
* Reorganized opengl deferred light mesh drawing to submit all data before,
beginning to submit draws, and also to reduce total bind calls needed.
* Leftover unused variable cleanup
* CI didn't like my loops, maybe it'll like these.
* unused variable cleanup.
FRED has an autosave feature but it wasn't invoked in too many places. This adds autosaving whenever a major dialog is closed, unless it was closed by hitting Cancel. NB: Autosave is not yet implemented in qtFRED.
Also, `addvariabledlg` incorrectly referred to `OnOk` instead of `OnOK` and `CMessageEditorDlg` incorrectly referred to `OnOK` instead of `OnOk`, so this fixes those and distinguishes `OnOk` by renaming it `OnButtonOk` to be consistent with the event editor and other dialogs.
Calling `query_node_argument_type()` on a node with no parent is a valid use case, so return the proper argument type. Fixes a crash discovered by Applemush.
Ever since retail, the code has assumed that a soundtrack would always have arrival music. This removes that requirement. If arrival music is missing, it will just be skipped.
These variables are only ever used in the scope of `os_get_legacy_user_dir()`, so they can be scoped rather than global. This should fix a Coverity issue on the `DCF(low_mem` debug console function.
Adds a SEXP that specifically checks for whether a player has skipped a mission. This can be used to set tech room entries, allowed ships/weapons, and other campaign data that would otherwise break if a player skipped a mission.
This only applies to the the failed-five-times popup. For this to work with the `skipmemymissionyo` cheat, it would be necessary to load every intervening mission and check the events. That being said, `skipmemymissionyo` already automatically allows all ships and weapons, so there is much less, if any, need for this SEXP in that case.
An arm64 mac can run unittests on a x86_64 build, but not the other way
around. So if the target arch doesn't match the build host arch then
just skip the tests. Saves us from a far more complicated fix that would
only produce the same test results anyway.
Back in 2008 (in commit 2c45dbbb5f), some retail code incrementing `Player->failures_this_session` was removed, seemingly by accident. A month later, a bug related to this was fixed (in commit 28a408deee) in a different way. Since this fix is rendered redundant by the restoration of the original behavior, I've removed it and put back in the old behavior. This is only "mostly-retail" because the retail code didn't check `Game_mode & GM_CAMPAIGN_MODE`.
Qt has been added to the build image which eliminates the need to
dynamically install it which removed a possible point of failure.
At the moment this is only enabled for pull request builds and should
not affect nightly or release builds.
The previous version of the image accidentally removed the /tmp
directory which broke things in the GitHub actions.
Initially, an update for the upload/download actions was tried which had
no effect but keeping these updated is probably a good idea.
These new SEXP operators clear all status information from an event or goal, making it as if the event or goal had never been evaluated.
Implements feature discussed in #4184.
The requirement for delayed event status checks to be strictly greater than the event fired timestamp (see commit eed50619ca / PR #5267) means that `is-event-true-delay 0` will not work in debriefings if the event becomes true and the debriefing SEXPs are evaluated on the exact same timestamp. Normally this is not a problem, but one important exception is the `end-mission` operator which instantly sends the player to debriefing.
This timestamp behavior is working as designed and should be consistent as long as the `end-mission` operator has been around (I've verified it as far back as 3.7.4). But it does lead to inconvenient situations where the event that called `end-mission` cannot be evaluated by the debriefing. This makes it slightly more complicated to plan debriefing stages based on these events.
Therefore, it makes sense to add an exception to the event status function to ignore the delay if the evaluation is not in-mission. This is consistent with evaluating events that *never* fired and also satisfies the principle of least astonishment for mission designers.
This also adds relevant documentation to the event and goal status operators.
* SCPUI in-game language selector
* xstr support
* proper debug print format
* minor fixes
* Save the language as json data rather than an index into the languages array
* ext instead of id for clarity
* Do this more formally
* unused param
This advances the versions for Clang to 16 and GCC to 13 along with
fixing any warnings these new versions are detecting now.
The new image versions also include Vulkan so the additional workflow
step for installing that is not necessary anymore.
The overlapping checkboxes problem described in #5494 is the result of the checkbox list item height being slightly too small. A fix for this, which requires a subclass of `CCheckListBox`, is described in the following StackOverflow article:
https://stackoverflow.com/questions/3147958/mfc-cchecklistbox-items-overlap
It turns out there is already a subclass of `CCheckListBox` in the codebase: `ShipCheckListBox`, a class that was apparently left on the cutting room floor when DaveB refactored the team loadout dialog on 2/23/99. It allows an entire selected range of items to be toggled by pressing the spacebar. I've augmented it with the StackOverflow fix, and I've added it to the team loadout dialog as well as some other places that could benefit from it.
Fixes the other half of #5494.
We need to call `UpdateData()` in the `OnOK()` function and in several other places so that the member variables are populated with the most recent input from the UI. This prevents certain input (such as Player Entry Delay changes) from being lost by being overwritten with stale stored values.
This fixes a bug reported by Kitsune where the Player Entry Delay box did not work properly. It also fixes the random checkbox issue from #5494.
One of the features requested in #5378 (specifically the one requested in #5274), this adds a new "$Contrails use absolute speed:" option to game_settings.tbl, which makes the `ct_below_limit()` function check `objp->phys_info.speed` instead of `objp->phys_info.fspeed`. This allows contrails to appear when moving in a direction other than forwards.
This option was misleadingly named when originally introduced, so give it a more sensible name. The old name is still accepted for backwards compatibility.
* Allow Modders to Set Rotational Scaling Multiplier for Asteroids/Debris
Previously, there was no way to limit the velocity at which asteroids/debris randomly rotated. There was a way to set maximum speed, thus this PR follows that convention and adds a way to cap the rotational velocity scaling. This PR allows modders to set caps per type, including setting the value to 0 for no rotation.
A single scaling value was used b/c it was the most straightforward value to se via table and it was the employed the least code changes. Asteroids pick a random normalized vector for their rotation when spawning, and then that value is scaled by a random multiplier.
* use full multiplier instead
Convert additional timestamps to use the new timestamp system. This covers all timestamps referred to in freespace.cpp. For purposes of organization, the fade-in/fade-out timestamps have been moved to light.h|cpp and the training timestamps have been moved to missiontraining.h|cpp.
There are also several related code enhancements:
1. `FadeType` has been converted from `enum` to `enum class`
2. Initialization of the various training variables has been added to `training_mission_init` (previously they had never been reset between missions)
3. Validity checks have been added to the relevant locations for these timestamps
1. Use the `optional_string_fred`/`fout` pattern so the FRED comment parser can follow along with the mission file
2. Since the #Custom Data section is optional and requires a version bump, don't output the section header if the section is empty
* Add global to local for matrices
* Add lua integration
* Get Submodel from Submodel instance
* Add submodel functions
* Add model instance from submodel instance
* Fix index
* Fix copy paste error
Here's some low-hanging fruit for reducing the memory footprint of `ship_info`. This turns the maneuvering thrusters array into a vector, refactors the names a bit, fixes thruster activation when `-nosound` is active, reduces the number of calls to `ship_get_thruster_status`, adds some const-correctness, and converts the timestamps to the new system.
Previously (since 2012!) a waypoint would store its parent list as a pointer. However, this pointer can become invalidated if the waypoint list vector is resized. To prevent this, store the parent list as an index.
This also renames the waypoint's `objnum` field to `m_objnum` to match the naming of the other fields.
1. use `SIZE_T_ARG` instead of `"%lu"`; should fix format warning in #5780
2. since `HeapAllocator::checkRangesMerged()` has no effect unless running in debug, `#ifdef` out the function; should fix CI warning in #5778
Some patches for mission imports:
1. Check that the path isn't empty (the user didn't select "This PC") before continuing
2. Count successful imports
3. Avoid treating an import as a newly saved single mission unless the import was successful
In many calls to `ship_get_subsystem_strength`, the caller doesn't care about the actual number, just whether the subsystem type is destroyed. So this adds an optimization to check specifically for that. In the case of `SUBSYSTEM_ENGINE`, this avoids an iteration over every subsystem on the ship which, for a ship with many turrets, can be significant.
Some of the `frand_range` calls were used for integer calculations, so we can use `Random::next` now.
This also reduces the number of C-style casts in the codebase.
Add `const` to the `eval_enemy_obj_struct` struct so its values aren't inadvertently overwritten. Handle a bit of const-correctness propagation. Also add default member initialization to the struct.
One of the Voice Acting Manager dialog's strings is now too long for the .rc file and is truncated at 256 characters. Fortunately this can be worked around by setting it at runtime.
Add `const` to the `mc_info` struct so its values aren't inadvertently overwritten. Tweak some of the collision code to prevent overwrites.
Also remove the `flak_muzzle_flash` declaration since that function no longer exists.
1. Update soundtrack message to make it easier for modders to track down missing files
2. Update sexp help for ai-stay-near-ship to show the right argument count
In a few places where the game checks for the command sender, it should check for #Command as well, as long as the mission flag to override #Command is present.
Additionally, while the mission's command sender was originally intended to be a ship, it has been used to specify an alternative to #Command as well. But this caused problems when the "override #Command" mission flag was active, as it transformed a hashed source into a non-hashed source. So this commit adds a check to treat the source as hashed, if necessary, if a replacement has occurred.
Fixes#5749.
There is an implicit assumption in the code that the `MEF_DIRECTIVE_SPECIAL` flag could not be set on an event until after the `MEF_CURRENT` flag was also set. This change makes that assumption explicit, and also adds a check in `mission_process_event` to be sure the flag setting doesn't happen out of order. This situation is very rare, but can happen if the following conditions are true:
1. there is an event directive checking for the destruction of a wing
2. the wing has multiple waves
3. the directive uses the older `is-event-true-delay` technique to control when it is displayed
4. the directive becomes temporarily true before it can be displayed and while there are still waves remaining
This previously caused the "directive special" logic to occur before the "event current" logic occurred, skipping the proper setting of `born_on_date`.
Fixes Github #5725 and Mantis 930.
* Make sure we handle unknown location types
Avoids edge-case gargabe pointer 1522974
* Make sure local vectors are at least set to zero
For coverity 1522985
* Make sure from_table is initialized
When creating a replacement texture object, for coverity 1522989
* Change to Unreachable to help Linters
This was a false positive uninitialized scalar, Coverity 1523726. Hopefully, changing to UNREACHABLE() will help linters avoid this false positive in the future.
* Initialize xyw on this struct instantiation
For coverity 1523730
* Add early return for ade_set_args if error
For coverity 1523732
1. The player can target other object types besides ships, so when creating an `object_ship_wing_point_team`, make sure it is a ship
2. A few recent mission features require a version bump, but not all missions use these features; so do a "soft bump" where the mission version is updated only if necessary
3. Remove an unneeded #include by adding a `struct team_data` declaration (see #5599)
This is an actual edge case bug. If no countermeasure was set, and then one was set, there might be a garbage timestamp set that would give an incorrect countermeasure delay on next use.
For coverity 1093612, this function *should* never return zero, but it is no catastrophic if it does. Allowing it to return a negative value in some unknown edge case would allow it to clobber some other global data.
So now add a check for negative values and take no action if those negative values are reached. Assert on debug.
A mission in Mantle caused an invalid vector access when checking whether to vaporize a ship whose ship type was -1. Turns out having "no type" is actually allowed, so I audited all `class_type` accesses throughout the code for potential -1 accesses. Most were properly checked but a few were not. A few others needed to be tweaked.
(I suspect this is something that would be on the Coverity list if it isn't already.)
Yes. I know, I know, we're not going to use this code anymore. But just in case, I don't want this memory leak to have the possibility to exist in the future.
* Add Game Option to refresh selected weapon in loadout
This PR adds an option to always ensure the viewed weapon is one that can actually be on the selected ship when first clicking on the weapon loadout.
If you go to the loadout in the briefing and view the weapons on your ship, then go and change your ship class and go back to the weapon loadout screen, you will see that the weapon shown in the window on the right side is from your very first viewing before you changed your ship class. Displaying a weapon not allowed on a ship by default can be confusing to players, especially on mods like FotG where most ships have unique weapons.
The player can still of course click on a non-allowed weapon to view it, but with this PR the player will be initially shown a selected weapon that is allowed on the ship when opening the loadout editor.
Tested and works as expected.
* update order to be near weapon bools
The code has always checked a per-weapon-class value called `lock_fov` when comparing the dot product of a ship to its target to see if it can lock on to it, however the weapon table hasn't ever included a way to set this value; it's always the default value of 0.85. This just adds "+Lock FOV:" entries to aspect/javelin homing missile parsing after "+Seeker Strength:", which will set `lock_fov` as long as the supplied input is between 0 and 360 degrees.
These functions have not been called from what I can tell since the source code was released. But they did happen to trigger a clang warning, so it's time to get rid of them.
* Add stage notes feature for mission messages
* don't keep notes outside the mission editor
* use F_MULTITEXT and do lcl_replacements
* this should be multitext too
The fix in #5578 assumed that a previously playing soundtrack would properly set the timestamp, but if no soundtrack was previously played at all, this wouldn't happen. So if we deliberately don't play a soundtrack, be sure to set the timestamp as if `event_music_do_frame()` had been called.
Fixes#5705.
Occasionally, FRED can save a mission with a wing's ships out of order; this can happen if ships are deleted and FRED finds a free index in the middle of the ship list. This can cause benign but confusing mismatches in the ship registry, the hotkey list, and other places -- and it's also possible some mismatches may not be so benign, e.g. in multiplayer. Anyway, it's better for the ships to appear in the order the wing expects them, so this adds a routine to swap them around if necessary.
* nebula-fade-poofs
* Move this up because order of operations is important.
* Add some documentation
* Respect time compression
* Fix sexp description
* Make sure faded poofs do not flicker
* optimize
Fixes#3098. The `shipfx_eye_in_shadow` function did a collision check for cockpits, bit did not previously take into account of the viewpoint had a non-forward orientation (ie the player was using free look). This PR sets the collide check to take that into account with a 1 line fix. Tested with multiple FotG cockpits and fixes the issue.
* Add a divide by zero check
For coverity 1107324. Keeps framecount from dividing by zero in very rare circumstances.
* Add a clarifying comment
This marks isNaturalNumberFactor() so that we know it is the best way to get whether a number is a natural number.
Modulo division is slower and gives the same results.
* Spoiled by Rust
Before this change if the wrong endianness was used, the c style cast that was used here would lead to the argument being passed to getsockopt to lack the actual information.
Fixes coverity 1093482
(Directly cast to socklen_t)
Add "tactical" versions of disable and disarm goals which only perform the specific task without implying anything else. The target ship is not protected and attack goals are not cleared from other ships.
There is also a new AI profiles flag to make this the default hud squad message command instead of the classic disable/disarm.
The ai-fly-to-ship goal was added early in FSO's development but never worked right. Until recently it could crash; and even aside from the crash the AI would try to reach the target's exact position, causing repeated collisions. This folds ai-fly-to-ship into ai-stay-near-ship, since the behaviors are conceptually the same except for fly-to being satisfied as soon as the target is in range.
This also adds a new "escort" mode usable by both behaviors. The default Volition behavior is to swoop toward the target in a long, graceful arc; the new mode generates a goal point and flies directly to that point. These can be toggled via an optional sexp parameter.
There is also some minor cleanup and a new vec3d operator for convenience.
Needed for Scroll; depends on #5667.
If a ship is in the process of dying, it shouldn't be killed or self-destructed again. This fixes a bug noticed by RedMageJoe during the Derelict playthrough.
(This situation is distinct from a ship being hit while in the middle of its death roll. That shortens the death roll but does not try to kill the ship again.)
* Fixup HUD for slewing
* Fix Training Message box
* Lead indicator slew
* Fix HUD Message Head
* Correctly render messages
* Fix HUD offset handling
* HUD offset never makes any sense
* Cleanup offset code
* Remove unused parameter
* Fix Talking Head in RTT mode
Remove a whole bunch of ad-hoc code piled on top of the retail weapon cycling behavior, then replace it with a robust algorithm that takes all relevant attributes into account.
Fixes#5529.
Subsystem hitpoints are calculated as a percentage of the ship's hull strength as they are parsed. If a modular table modifies the ship's hull strength, the subsystems are not modified at the same time. This can lead to unreasonably large or small subsystem hitpoint values, as recently seen in the 1.3.0 version of Cardinal Spear.
This PR adds an option to defer hitpoint calculation until after parsing so that the subsystem is a percentage of the correct hull strength. Since this may affect the balance of existing mods, it is off by default unless the build targets 24.0 or later.
This also removes the long-unused `hull_percentage_of_hits` check and adds several log statements for significant options in game_settings.tbl.
Update the Lua enums to be consistent with the new ShipStatus enums.
Separately, add an extra ship registry check in the event a ship doesn't exist in the ship registry.
Use the same method for texture replacement in briefing popups that is already used in the tech room.
Also don't render shadows when the jump node is displayed, since it's not being lit anyway.
Normally the disabled/disarmed flags are only set if the destroyed subsystem is actually an engine or turret. This should be done for cheats as well, otherwise, for example, destroying any subsystem on a non-engined ship will cause it to become disabled.
There is a bit of code in missionparse that sets the parse object because in-game joining needs it. This is unrelated to ship status, so the status shouldn't be changed. This fixes the bug and adds a comment to clarify the situation, as well as some warnings to help track down incorrect joining states.
Fixes#5661. Follow-up to #5658 (where the regression was introduced) and #4836 (which fixed in-game joining).
The Star Fox barrel roll effect is achieved using a script which spawns a new ship. The script sets no-collide on this spawned ship, but it also tries to set the ship flag for all future ships -- and future ships require a parse object, which doesn't exist for a created ship. This patches the FALLTHROUGH in the sexp code to account for that possibility.
Separately, there are other ways a parse object pointer could become null through unusual code states, so this adds an INVALID status and several additional checks to defend against this crash in other circumstances.
The retail warp range multiplier can yield ridiculous results, like an Elysium warp being audible over 9000 meters away. So allow the multiplier to be set via ship type.
Adds a `DEATH_ROLL` status to specifically cover the state after ships have been destroyed but before they exit. I've also audited all code that interacts with the ship registry to use the correct state with this new state taken into consideration.
This fixes access to exploding ships that was broken when the ship registry framework was introduced. In particular, the `when destroyed X beam-lock-all X` QoL feature now works again.
CMake's copy_directory functions follow symlinks recursively as opposed to
preserving them. For mac frameworks, which make use of symlinks for versioning,
this causes the files to be duplicated multiple times in the copied framework.
Using rsync instead, just for frameworks, will properly duplicate the framework
while still avoiding the "file exists" error from cp.
Use GNU tar instead of the default bsdtar. This works around some weird
corruption bug triggered by the combination of the GitHub runner-VM, the llvm
linker, and bsdtar.
Adjust intermediate filenames such that they don't get uploaded to
indiegames by mistake.
Unpack builds as a single step instead of two.
If consecutive red-alert missions have different numbers of ships in a wing, then calculating the number of waves will not be correct. This necessitates the addition of wing status to the stored data for red-alert sequences.
Not only must wing data be stored in `Red_alert_wing_status`, but also in the CSG file. This necessitates a version bump. Fortunately, the current design of CSG files allows extra data to be added to a section without breaking old builds, since the CSG loader will just skip over the unrecognized data.
This also renames `red_alert_wingman_status` to `red_alert_ship_status` since it's not limited to wingmen, as well as fixing the omission of exited ships if they are in the player's wing but don't have the red-alert-carry flag.
Fixes#5637. Follow-up to #4457 and #5609.
Add some extra logic implied by the `Begun_detonation` flag. Missiles that are homing can have their targets, headings, speeds, and lifetimes changed for various reasons. If a missile has begun detonation, particularly if it is in "detonation limbo" because it is flying across a bowl-shaped turret, we don't want to change any of that. The "detonation limbo" weapon lifetime is only accurate if all of those values remain constant.
Follow up to #4006.
In #5477, I made the escort list respect hidden names by copying the behavior from `message_queue_process()`, which already checked those flags; however, this resulted in some dramatic behavioral changes for mods using callsigns for escort ships, and while making the behavior optional was a possibility, feedback suggested everyone would rather it just behaved like the target box and displayed both. So I replaced the code with similar logic from hudtargetbox.cpp, except with the "replace hidden name with ship class" code taking priority.
- handle double archiving of macOS builds so they'll work properly with Knossos
- fix issue where only a single configuration was included in the package
(Release or FastDebug, not both)
Statically link to libstdc++ for CI/CD builds in an attempt
to avoid compatibility issues without relying on a crippled
docker build image.
Should properly fix#5571
1. Allow setting the homing subsystem if the homing object has already been set
2. Use the `weapon_set_tracking_info` function if setting both object and subsystem, as it handles several important homing things
The `collides` and `no_collide` flags are equivalent, but opposite. So when sexps or scripts get or set those flags, allow each to be used as an anti-synonym (not exactly an antonym) for the other.
Two fixes for red alert missions:
1. Since any ship in the wing can be stored, not just the wing leader, the "prospective name" check should check for all possible names in each wave
2. If a wing wasn't actually stored, the red alert code should not reset the wing's wave number to 0
Follow-up to #4457.
Since `gr_string` can accept a length parameter, there's no need to copy each line before it is drawn.
Related to #5495 but not one of the two options mentioned.
The `Random::next(low, high)` function returns a value in [low, high]. This location should use the single-argument version, `Random::next(int modulus)`, which returns a value in [0, modulus-1].
As reported by Colt, there was a crash in the in-mission jump sequence in Shepherds where the mission previously worked. The proximate cause was a handwritten SEXP called via script that omitted whitespace before an opening parenthesis. This was incorrectly recognized by the upgraded SEXP parser as an invalid SEXP. Unfortunately, a separate bug in `get_line_num()` caused a crash when the parser tried to display a warning, because the function tried to calculate the line number of a SEXP that did not come from a parsed file.
This commit fixes the parser to recognize opening parentheses even when no whitespace precedes them, moves the output to the 'unexpected end of sexp' warnings will they will now be seen, and fixes `get_line_num()` to work when there is no parsed text.
Follow-up to #5520.
For certain calculations involving armor, the `GetDamage` function needs to know if the damage is being applied by a beam so it can apply the calculations with the proper frametime. The parameter was not provided in all cases, so this fixes that.
Follow-up to #1609.
1. Add a `vanish()` function for beam objects, to be consistent with other object types
2. Add a `BeamFree` virtvar, analogous to `TurretLocked`
3. Add timestamp variants of TurretLocked and BeamFree to be consistent with sexps
4. Add `BeamLife`, `BeamWarmup`, and `BeamWarmdown` virtvars so scripts can access table properties
5. Add "On Beam Death", "On Beam Warmup", and "On Beam Warmdown" hooks
6. Clarify some existing documentation and patch a couple things
The firing point gauge did not work as advertised; this fixes it. Unselected weapons are dimmed, selected weapons are normal, and firing weapons are bright.
This adds several fixes to make the event and menu music more robust:
1. The game will now run with zero soundtracks. All accesses into a potentially empty vector should now have checks.
2. Soundtracks and menu music are now checked for validity before being played (not just when importing a FSM mission).
3. The parsing validity checks and the in-game event music now check for skippable patterns using the same function.
4. Zero measures and zero samples-per-measure now cause the game to skip a pattern. Negative values now trigger a warning.
5. Omitting some or all of the `$Name:` lines for a soundtrack will not cause an assert.
Fixes#5576. Follow-up to #5572.
There is a built-in delay for the event music to start playing, but this delay gets stepped on if `change-soundtrack` is called when the mission first starts. So don't set the delay unless it has already elapsed at least once before.
When a non-looping persistent sound expires, `obj_snd_stop()` actually does need to be called. Even though the sound is no longer playing, the `Num_obj_sounds_playing` tally needs to be decremented, otherwise it will eventually exceed its limit and prevent any additional persistent sounds from playing. And it turns out `obj_snd_stop()` returns gracefully for sounds that aren't playing.
Follow-up to #3510. Fixes a bug that appears to have been around since retail.
The `mn.createWeapon()` function takes an optional group ID for weapons that share lighting, but the internal `weapon_create_group_id()` function was never exposed to the API. This adds that.
Since event music soundtracks use the exact file extension specified (see #5567), the validity check should also use the exact file extension specified.
Also, move the validity check to after parsing has completed because extensions may be overridden.
Currently, menu music will trim the extension and look for both OGG and WAV files, but event music will use the exact extension specified. This is intended but could lead to unexpected results in mods, so display a warning for the modder.
The crash in #5514 appears to be caused by some of the graphics code not being in the expected state for the synchronization. Looking at the code in `render_frame()`, a `gr_flip()` happens after one frame ends and before the next frame begins. That implies that this `gr_flip()` should not be here, as it is in the middle of a frame. For additional evidence, `gr_flip()` modifies the "uniform buffer manager" state, and that is part of the stack trace preceding the crash. Removing this `gr_flip()` fixes the crash.
The strange thing is that this code *doesn't run at all* while the campaign editor is active. I verified this by adding a MessageBox in place of `gr_flip()`; the MessageBox doesn't display until the campaign editor is exited. And yet, FRED crashes with `gr_flip()` present and doesn't crash with it removed. This calls for a new category of bug; I propose "spookybug", from spooky action-at-a-distance.
Fixes#5514.
The default movie subtitle font is font01.vf, but mods with custom font tables might not use this font. So this changes the handling slightly so that the movie player will use whatever the first available font is.
Follow-up to #1523. Fixes a sometimes spurious warning in mod initialization.
Supercaps use a physics flag on warpin that makes them slow down faster than they would under the normal physics code. This adds that flag as an option for custom warp parameters.
Since flags are not yet parsed when warp parameters are parsed, the code needs to skip ahead and peek at the flags in the same way as the weapon override.
1. Fall back to the FREDzone help docs if the local files cannot be found
2. Tweak url_launch error message and add a return value
This consequently removes the ReleaseWarning which wasn't the friendliest or clearest way to tell the user about a missing help file.
Since other functions in the scripting API remove extensions before loading the files, and since the internal functions expect them to be removed, the streaming anim API should handle that too.
As reported by Woutersmits, the GTT Nova did not dock with the GTD Hall in the first mission of Black Horizon. Attempting to run a debug build caused a CTD. Investigation showed that there was an invalid dockpoint triggering an Int3(). The dockpoint has been fixed, but to aid troubleshooting in the future, the Int3()'s in this function have been changed to more appropriate functions.
When weapon flags are parsed in a modular table and override the previous set of flags, certain flags must be kept to preserve the behavior of the weapon. The previous `preset_wi_flags` technique only worked if all such flags (homing, has-display-name, even whether the weapon turns) were set in the same modular table. If a modular table overrode the flags but didn't specify those lines over again, mysterious and subtle bugs would occur.
This modifies the flag parsing to explicitly preserve all appropriate flags from the existing weapon entry, which fixes the bug. It also allows all of the flags to be specified in one place, rather than scattering `preset_wi_flags` assignments throughout `parse_weapon`. And this also adds quite a few flags to the flag list that were not handled at all under the previous design.
Finally this fixes a few incorrect assignments of default values to fields that should only happen the first time a weapon entry is parsed.
Three fixes:
1. In commit fa0878b6b3 for PR #5338, the optional distance parameter was inadvertently changed to a bool. This fixes the parameter.
2. The distance parameter was previously parsed using `atoi` which works for number literals, so change to `eval_num` to allow sexp return values.
3. Make `eval_num` consistent with `eval_sexp` in the sense that evaluating an empty list is valid and returns false or 0.
Also takes advantage of the fact that `is_sexp_true` works for empty lists to streamline optional arguments in `ai_add_goal_sub_sexp`.
Copying a file with cp on top of another one is not allowed by default
so switching the command to use the CMake provided one will fix the
issue and will also unify the commands for all platforms.
The directory support is necessary for Mac where the SDL library is
actually a directory.
For mods which want primary weapons to 'detonate', setting the detonation range is not reliable because, due to rounding imprecision, either the range (which detonates) or the lifetime (which does not) may happen first. So this adds a flag to always detonate a weapon when its lifetime expires. Secondary weapons have this flag by default, but primary weapons can add this flag in the $Flags list. Additionally, if the detonation range and the predicted range due to lifetime are equal, the flag is added automatically.
Resolves#5521.
In #4702 this log line was changed to the 'Model' category, which made it hidden by default. This was missed in review but should be restored as it is a fairly important line.
Fixes#5507.
The hud-set-coords SEXP has always used exact pixels, without regard for the current screen resolution. This adds a similar scaling mechanism as is used for show-subtitle.
Fixes#5525.
When using the mission importer, missions were being corrupted for very subtle reasons: due to some code reordering in prior commits, `raw_ptr` would be initialized to `Parse_text_raw` before `Parse_text_raw` itself was initialized. This assignment was done in the `CFred_mission_save` constructor and the ordering dependency is not obvious. Since this is a highly fragile situation and has the potential to affect any use of `parse_comments()` in FRED, it's better to explicitly assign `raw_ptr` when it is needed, and just initialize it to nullptr in the constructor.
This also sets the version number to the legacy version (0.10) when the mission is saved in the retail format.
Modelread.cpp supports POF versions as low as 1900, but early model versions were not loaded properly because they relied on preprocessor directives rather than version checks. This changes the POF loading to correctly check version numbers and chunk IDs.
Fixes crashes when attempting to load a FS1 model.
1. When saving a campaign, the save directory should be the one that the campaign was just loaded from. If prompting the user, this should be the default save directory. This fixes a bug where campaigns were saved to %APPDATA% instead of where the FREDder might expect. This has been a bug ever since the migration of the game files from FreeSpace2 to %APPDATA%.
2. When saving a campaign, save only the external mission flags, not the working flags that are maintained during gameplay but have no meaning in the saved file.
* In fillValues(), Check the size values returned by SDL to assert they are non-negative. If they are negative, abort vector resize and mprintf the SDL Error.
Personae have a flag and a species bitfield. They're built up during parsing, but never explicitly zeroed out. This leads to ships occasionally getting an incorrect persona (especially common with support ships, which never have an explicit persona).
Additionally, this commit addresses an issue with the UES Aranyaka (and potentially other support ships belonging to species without a support persona). I'm honestly not sure why they were ever able to speak; however, with this change, they'll never be able to. As such, this commit introduces a "default support persona" to retain the desired behavior.
In f350e06851, two Int3()s were added to `message_translate_tokens()`, to check for possible out-of-bounds errors. However, in c70fdc3a52, just a couple months later, the code being protected by those bounds checks were put into `else` branches, meaning the `Int3()`s became redundant. This wouldn't actually cause any problems unless somebody passed a string with two `$`s at least 40 characters apart to `message_translate_tokens()`. Cue #4876, which started calling `message_translate_tokens()` on debriefing stages and recommendations, which can contain color tags. This still wouldn't cause problems as long as the color tags are in pairs within close proximity (`translate_key()` would say "that's not the name of a scan code" and leave the text between the two tags alone), but as soon as two color tags are far enough apart to trip the bounds check conditional, the `Int3()` would be hit. This is still fine on Release builds, which ignore `Int3()`s, but triggers a breakpoint on debug builds, which depending on the user's system, can result in a CTD. Since, as far as I can tell, the `Int3()`s haven't actually been meaningful since 2006, I've just removed them (and inverted the conditionals), and testing by the affected user confirms that it no longer CTDs.
When only one AI class performs autoscaling, the math formulas which use autoscaling will become meaningless (e.g. in `ai_maybe_launch_cmeasure()`) or will cause divide-by-zero errors (e.g. in `ai_manage_shield()`). And autoscaling is not very useful outside of the specific ways that Volition used it. So this adds some warnings and disables single-occurrence autoscaling.
Fixes#5474.
* fast version of setting position and orientation
* preliminary stale collide time
* add global collision cache stale flag instead
* clean up
* more clean up
* no periods >.>
* bring back single object version
* rename and bring back stale object list
* use a set
When fireballs were made dynamic in 609ed4ed94, the `MAX_FIREBALLS` #define lost any relationship to the fireball collection. This removes it and also correctly specifies the size of the fireball collection.
This fixes a CTD when accessing items in `mn.Fireballs` via script.
These #include lines are needed for the changes introduced in #5492. Not sure why they weren't picked up by CI, or why they work in some compilers but not others.
If you pause the game, say something into the microphone, then unpause, it can abruptly perform an action based on voice recognition; this is probably counter to player expectations. This adds a `gameseq_get_state() != GS_STATE_GAME_PAUSED` check to the existing conditional.
If the "Campaign Room only available in full version" popup is shown, it tries to reset `Active_campaign_index`, except that if a pilot is loaded with a missing campaign file, `Active_campaign_index` is -1. This causes an out-of-bounds array access, so let's present an alternate popup in this case (either one to select whatever the first campaign file found is, or the generic `popup_game_feature_not_in_demo()` if no campaign files are found).
Several related fixes:
1. Copy the actual ship name, not the display name, to `killer_parent_name` for two reasons:
1a. Since `killer_parent_name` is used to look up the ship, it must be the actual ship name, not the display name.
1b. Copying the display name can cause a buffer overflow because display names can be longer than 31 characters.
2. The display name functionality is moved to the more appropriate location in `player_generate_death_message()`.
3. Remove `player_get_killer_weapon_name()` which only served as a proxy check for whether the weapon index was used or not.
4. Use `ship_registry_get()` rather than `ship_name_lookup()`.
5. Add comments to clarify the use of `killer_parent_name`.
In at least two instances, `split_str_once()` can be called with width values derived from mod-supplied values that can be 0 or less (specifically, two hud gauges: if `+Messages:` has a `Max Width:` that's too small, or `+Directives:` has a `Max Line Width:` of 0 or less). Since user-supplied code shouldn't be tripping assertions, I looked into adding security around the calling sites when I realized that the assertion wasn't actually protecting against anything; the function would run just fine with a negative pixel width, it would just break with every whitespace. Since both calling sites that could trip the assertion already treat getting `src` back as output as an "I can't split this" error condition, it's perfectly fine (and skips iterating through the string) to just `return src` if the maximum pixel width is 0 or less, so let's just do that instead. Technically this is a behavior change in Release code, but the result of the old code would've been to spam the message log with every individual word in every message (if `Max Width:` was too small), and for directives to seemingly-randomly split only after the first word (if `Max Line Width:` was 0 or less). Not splitting at all is at least as correct, saves some pointless processing, and *should* still be obviously wrong if there was supposed to be a reasonable width value.
It appears that `(turret->turret_enemy_objnum < 0)` is an expected and allowed condition, so just assert that the objnum does not exceed MAX_OBJECTS.
Fixes#5470.
This is a bit tricky because both animated and non-animated PNGs use the same extension. So for PNGs we need to defer the filename length check until we know for sure that it is an animated image.
Fixes#5387.
PR adds extra validity check within `model_render_glowpoints` function. Other places in code that use `bank->submodel_parent` check for validity before looking up `pmi->submodel`, but this check was missing from this section (which caused a CTD in a mission restart due to `bank->submodel_parent` being -1).
See title. There were some cascade effects, but the changes are mostly contained to the model code. The calls to `gr_render_model` and `g3_render_primitives` use `const_cast` because constifying that API would require a whole other PR.
Issue #5459 notes that mission files that are too long will crash the FRED campaign editor, but this is an artificial restriction. The only need for a string buffer here is to enforce the correct mission extension, so use a SCP_string for this, and add checks for whether string manipulation is in fact necessary. (In most cases it isn't.)
Fixes#5459.
In certain cases, angles would be rounded to 360, where the expected range is 0-359. The range was guarded properly for skyboxes but not for bitmaps and suns. This fixes that. Additionally, since suns do not bank, the angle conversion now sets the bank to 0.
Fixes#5390.
Kitsune discovered that special characters, notably semicolons, were not properly handled in the Mission Specs editor. This adds appropriate handling of special characters for fields in that editor, similar fields in the campaign editor, and the corresponding places in qtFRED. This also makes error messages more descriptive for campaign load failures.
* validate chunk size to avoid align crash and add align skip flag
* change type from uint to int
* change mprintf output to a warning
* revert uint to int change and requested changes
* Init Particle shaders only if they're actually used
* set layout correctly
* Don't compile shadow shader if not needed
* Properly deal with capabilities
* Fix typo
* remove obsolete capability
1. Deprecate the old set-jumpnode-name sexp now that there is a set-jumpnode-display-name
2. Make the display name design consistent with ships and weapons; in particular add a `HasDisplayName()` function and automatically generate the display name for hash-truncated names
3. Keep the display name in sync when the name is changed in the FRED dialog
4. Fix the overriding of hash-truncated names with display names on the HUD
5. Fix the incorrect setting of the alphacolor flag when using FRED
6. Fix array out-of-bounds access when no object is selected
Follow-up to #5401.
1. Add const qualifier where appropriate to API methods
2. Change `TonemapperAlgorithm` from enum to enum class, for type safety and token scope
3. Update saving of lighting profile in FRED
4. Add saving of lighting profile in qtFRED
5. Add lighting profile (and asteroid) initialization to qtFRED
1. Add a function to retime *only* the collision pairs involving a specific object. This is useful when only one object has moved, since only collisions involving that object are affected.
2. Use this function when objects are moved for autopilot, via sexp, and via script.
Previously collision pairs were not retimed when objects were moved via script, leading to bugs. This fixes that.
* refactor how asteroid wrapping is done and setup for allowing or disallowing range check
* allow fred to toggle enhanced spawn checking
* field naming adjustment
* some minor tweaks
* Add sexp compatibility
* We don't need to save the boolean, just the string.
* full qtFRED support
There was a missing function call in qtFRED's initialization, which prevented custom HUD gauges from being loaded. This adds that. Additionally, this updates the deduplication code in `get_listing_opf_custom_hud_gauge` to match its counterpart in FRED.
Fixes#5422.
The `SCP_string_lcase_equal_to()()` and `SCP_string_lcase_less_than()()` functors are rather unwieldy to use in non-functor situations, so this adds conventional function equivalents.
Related to #5267, and again concerned with the original check for event delay:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
return SEXP_FALSE;
```
For events that were never evaluated at all, their timestamp remained 0. Thus the function did not return and the status of the event (which by definition was incomplete) was always checked.
After the timestamp refactoring, this comparison always returned SEXP_FALSE for these events. The correct behavior is to bypass invalid timestamps so that the status of the event is always checked.
This fixes the behavior of `is-event-false-delay` in debriefings.
The `stars_post_level_init()` change in #5403 exposed a bug where qtFRED would sometimes try to render the mission before all setup had been completed, causing a crash because `Show_iffs` was zero-length. This was due to the mission being created in the middle of initialization, instead of after initialization was complete. This fix moves `createNewMission()` to main.cpp, after initialization has finished, and in parallel with the command-line option to load a mission.
1. Skybox initialization (and perhaps other aspects of mission initialization) requires the existence of a timestamp snapshot, so make sure a snapshot has been taken before FRED creates a mission. Follow-up to #5343.
2. Move `stars_post_level_init()` to `Editor::createNewMission()` in qtFRED to be consistent with FRED's `create_new_mission()`.
Fixes a crash when the user tries to add a skybox when FRED first launches.
The `type_flags` on a model's dockpoints are determined by the dockpoint name. If the name changes, the flags should be updated accordingly.
This fixes a bug in Scroll where a dockpoint that was imported and renamed to start with the word "cargo" was not compatible with cargo docking as expected.
In retail, number parsing picked up immediately at the character after the number parsed, so parsing `0.50` as an int would yield 0, and then the next available characters would be `.50`. Even though parsing has been tightened up and made stricter, we can still "fail gracefully" by simulating the old behavior. And when failing gracefully, the message can be a warning.
Since `rand_sexp` also writes text into the sexp node for the seed value, its cache should be cleared too. And since this is a pretty common operation, wrap it in a `clear_cache` function.
Follow-up to #5381.
#5328 added a very useful culling for particles created by specific particle effects (ie weapons, now beams), though in an effort to simplify the culling process, that PR removed the necessary culling of default smoke on ships. This PR restores the culling of default smoke while also keeping the new culling of particle specific effects. Tested and works as expected, including fixing the slowdowns caused by the aforementioned removal of smoke effect culls.
The `rand` SEXP stores the result of its first call in the "low" node. Prior to PR #2402, this worked fine, but after that, the value is cached when first evaluated, meaning that subsequent calls to the `rand` SEXP will always return the lowest value in the range, not whatever number was rolled the first time.
This commit makes it so that writing the rolled value to the node's `text` attribute is immediately followed by deleting the no-longer cached value, so that the SEXP continues to work as intended.
When I made FSO not crash with demo data in PR #1156, I avoided calling `brief_maybe_blit_scene_cut()` if `Fade_anim` didn't load, when I should've made it do what the icculus port does in demo mode: pretend the animation finished immediately.
With this commit, the first mission of the demo correctly advances past the first briefing stage.
Per GCC optimisation guide, which applies equally well to clang:
* -funroll-loops should not be used unless directed by profiling. The compiler will already unroll loops when it's a good idea.
* clang and gcc now have -Og optimisation levels designed to enable debugging with good performance.
(second attempt at PR #4562)
* Fix max Z speed when using ETS and engine damage tracking
Follow up for #5137 and #5292. This engine strength check thus needs to be added to all instances where `max_vel.xyz.z` is updated, so a function was created and added in respective locations. Fixes#5367.
* cleanup and adding validity assertations
* cleanup outdated comments
* might as well make the cleanup look nice
* update to account for more edge cases
* cleanup
1. Disambiguate dialog IDs for the music player and the volumetric nebula dialogs
2. Fix compilation of qtFRED
3. Small refactor of Personas access to use STL functions where appropriate
1. When the "object" radio button is selected, the "point to" check box will also be selected
2. When an object is selected from the object list, the "object" radio button and "point to" check box will also be selected
Fixes#5356.
Take into account the collision flag and collision groups when spawning a ship. Should fix#5357.
Also clean up the code a bit, including setting a few `int`s to `bool`s and adding a missing axis case.
Because time compression adjusts the raw timestamp to be 0, it must use the exact value, not the snapshotted value, or the mission time will be slightly off. So this commit fixes that problem, as well as making sure that changes in time compression always occur at the start of a frame.
* initial API for hud config elements
* get rendering, highlighting, and selecting working
* Add a way to create color objects
* some cleanup and fixes
* go away we dont need you
* allow arbitrarily scaling the hud config draw
* last few config options and innitial preset handling
* vectorize hud presets and setup handling
* some last minute fixes
* iiiiiiiiiiiiiiiiiiiiiiint
* really
* documentation and address feedback
* completely revert this as well
* more documentation
* document all the things
* comment out unused parameter
* peach emoji retentive
* whatever
* return types
* color
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function. Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame. It is desirable to keep them all in sync.
This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame. This only affects simulation timestamps; real-time timestamps still use the live timer.
Follow-up to #5280:
1. Make the Rank virtvar actually return a rank object, to be consistent with other Lua API methods
2. Add a RankIndex virtvar to replicate the previous functionality
3. Make RankIndex return the expected 1-based index for Lua
This is a breaking change to the API, but since the original API is less than a month old, the impact should be small.
When parsing a list of numbers, such as in the $uvec or $fvec of models, a bug was reported where whitespace before the comma caused the number parsing to fail. This change checks for a comma after whitespace instead of checking for a comma as the very next character.
Extensible modular table handling for -ssm.tbm files was not very robust due to quite a few assumptions left over from straight .tbl parsing. Ostensibly optional fields were required, non-overridden fields were reset to defaults, etc. This improves XMT parsing and adds sensible defaults for SSM fields.
Here's a suggested followup to #5249. This converts the hotkey type to an enum for improved type safety. It also adds the corresponding Lua enums and adjusts the Type virtvar to return them.
Many of the recent scripting API enhancements are missing validity functions and validity checks, so this adds them. There are also some documentation fixes and a >= vs. > bugfix.
This allows warp parameters to be specified in species_defs.tbl, rather than requiring them to be specified for each ship in ships.tbl. Since this introduces a cyclic dependency between species_defs.tbl and sounds.tbl, the parsing of sounds.tbl is broken into two stages.
Implements request from #5283.
* read access to controls
* Early draft of checking keypresses in scpui
* detangle some code and prepare it for API usage
* API access to the core methods required
* move these checks into the UI methods
* comment
* fix bugs
* be smarter
* Need this stuff, too
* some more presets work
* unify func naming scheme
* cleanup and clarifications
* get detect keypress working
* allow searching and creating new presets based on current controls
* address feedback
* return nil if no preset is matched
* use the builtin methods which do the same thing, but slightly cleaner
* typo
* Fix intra-persona message borrowing logic
Closes#5299.
* Always assign personae for Support
Disabling the Auto_assign_personas flag had the side-effect of prohibiting support ships from ever speaking. Since a mod that wants this behavior (for whatever reason) can just not have a support persona, this commit makes an exception for them.
* Make Protect Target and Cover Me adaptive like Engage Enemy is
* Respect the allow subsitution flag
* Add "no-first-wave-message" wing flag
For when you want custom dialogue for the first wave, and automatic announcements for the rest.
* Fix FRED macro name
* Revert "synchronize simulation timestamps across the entire frame"
* try a proper fix instead of revert
* make sure nothing is reverted
* and back to full revert
* initial semi-working version
* better implementation of play and add stop and music.tbl viewer
* let the music window lose focus
* some cleanup
* add autoplay, next, previous
* use graphics
* Better dialog layout and allow ignoring files from the player list
* Make betterer
* a touch more cleanup
* revert this change
* missing bracket from merge conflict resolution
* address feedback
Historically, there's been a hardcoded 25% chance for Command to announce an enemy wing arrival. This is problematic for mods without Command, like BTA.
Originally the check for event delay was this:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
return SEXP_FALSE;
```
This returns false even when the mission time is equal to the timestamp. Therefore the timestamp check needs to use >, not >=.
Thanks to Durandal and ShivanSpS for helping to track this down.
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function. Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame. It is desirable to keep them all in sync.
This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame. This only affects simulation timestamps; real-time timestamps still use the live timer.
The logic used to select builtin messages was complex and hard to follow. This commit replaces it with logic that, while not identical, is both similar and more flexible. Additionally, the old logic had a major limitation when it came to downgrading messages: If a message type was defined for *any* persona, then it couldn't be downgraded for *any* persona. The new logic removes this limitation, and makes downgrade paths easier to define as well.
Some message types had hard-coded occurrence chances. These have been removed, and the default occurrence chance for the corresponding type modified to compensate.
* fixup error checking in regards to sexps using dynamic parameters
* anal retentive
* add more nonsense to make other nonsense work
* check these better
* dammit github
This reverts commit 542707c1c2.
* do this again but not in GitHub
* more nonsense to handle nonsense
* Revert "more nonsense to handle nonsense"
This reverts commit 6bc8b6e775.
* this is the song that never ends
This moves `LOG_SELF_DESTRUCTED` to the same place that `LOG_SHIP_DESTROYED` is recorded. This allows self-destruction to be correctly recorded when a ship is self-destructed via script, as well as when it is auto-repaired with a negative hull multiplier, or when ships are killed off in in-game joining.
* Add ability for a Lua sexp parameter to require a 'parent' parameter
* Add dockpoint as a return type
* variable conflicts
* var name
* qtfred
* address feedback
Chucked asteroids are always large. Therefore use their speed, not the
speed of the 1st parsed/small asteroid. Should not affect retail because
it uses the same speed for all three asteroids
Add XSTR entries for "or", "None", and "Nothing".
Note that there is already an XSTR entry for "none", but it does not have the right capitalization.
Note that "None" is localized in `textify_scancode` but not `textify_scancode_universal`.
This makes "Nothing" cargo use appropriate localization.
Fixes#5227.
Many values in `ai.tbl` can be inserted as overrides for their equivalent `Ai_profiles.tbl` values. (They are all optional and if not set for an AI class, the values in AI Profiles will be used.)
This is particularly useful for making very specific AI classes that still follow the main AI profiles table with easy to change values.
This PR adds `$firing requires exact los:` as an optional override to set in `ai.tbl`. This particular override is very useful, since it can be set to off by default in the `ai_profiles.tbl` for performance, but then set to on for some select AI classes within `ai.tbl`, and those AI classes can be easily changed on the fly in a mission.
I have not been able to keep up with code reviews for quite some time so
I should not be a default one.
Also fixed a copy issue which was missing an option to properly handle
already existing files.
1) follow-up to 5210: Avoid a memory leak caused by duplicating text, assigning it to a SCP_string, and then leaving the buffer in limbo
2) also keep the text as const char * since it's probably best to be consistent and keep the three types the same
3) be more scrupulous about checking for the existence of map entries, since the [] operator is create-if-not-found
This initializes `mc_info` to the correct values when it is constructed, removing the need for `mc_info_init`.
This PR also fixes a group of incorrectly inverted assignments in beam.cpp.
In PR #5202, a bunch of `Assert(child >= 0);` statements were replaced with `if (child < 0) return nullptr;`, except the first one kept the assertion's condition (inverting the logic). This fixes this accidental inversion.
Since older builds of FRED parse the mission version as a float, the version can contain a maximum of one decimal point. These changes allow FRED and FSO to disregard the build number when loading, saving, or comparing versions.
There is also a small fix to qtfred's saving of the author field.
* enhance handling of motion debris
* dunno what i was thinking here
* address feedback
* require all four bitmaps to be defined in new parsing method
* address feedback
`Roll_` and `Bank_` are synonyms, and the `Roll_` thruster flags should be `Yaw_` anyway, so rename them and rename their table strings. This still checks the old table strings for compatibility.
* Adds safety checks to scripting orders with waypoints
Turns out setting a waypoint order then trying to get to target of that order in the same frame triggers a crash in the scripting API for ship orders (`order.cpp` line 295). This was due to invalid lookups which lacked safety checks.
This PR adds those safety checks. Now, if this situation is encountered, it leaves `objnum` at -1 and thus returns an object for which `isValid` is false.
Fix is tested and works as expected. Also fixes#5172
* appease clang
* cleanup thanks to Goober
* clang again
* forgot to re-add the nullptr
* remove redundant checks
This finally enables the `$Version:` field in FreeSpace missions, which has been present ever since the beginning of FS1's development but has never been used for its intended purpose. This field now stores the version of FSO that is required to run the mission. If the version of the engine is not sufficient to run the version of the mission, then a) the mission is hidden from the mission listing, or b) a friendly notification is displayed if the mission is loaded anyway (for example, through a campaign). Furthermore, FRED will notify the user if the mission's version is migrated from any version other than the legacy 0.10.
It will be the responsibility of coders who modify the mission format to also update the `MISSION_VERSION` constant with the appropriate major/minor/build/revision of the format change.
1. Be consistent about the check for `Player` being null, as the `Player` variable may be used later in the function without a null check
2. Return early if there are no tips to show, so as to prevent a crash
3. Use `Random::next` rather than `frand_range`
4. Use `SCP_string` to avoid string overflow
Fixes a crash discovered in Star Fox: Event Horizon
This is another case of a bug introduced by a bugfix, in this case #3885. The original bug inadvertently made sun glare work in most cases where it was supposed to.
This commit removes the check for lightshafts when drawing the sun glare. Since sun glare can be drawn regardless of whether lightshafts are enabled, the only thing that matters is to check that the view is not shadowed.
* update the .mako file for release posts
1. Change the "previous release" thread to 22.2
2. Change http to https where possible
3. Link to the github Bug Triage page rather than the Mantis filter
PR #5058 made `count_incident_asteroids()` use `Asteroid_obj_list` instead of `obj_used_list`; a perfectly sensible change in and of itself. However, PR #4827 had previously made `asteroid_obj_list_init()` only be called if FRED wasn't running (presumably because of the iteration through `Asteroid_objs` to clear flags, which is wasted effort in FRED). The problem is that without `list_init()` being called on `Asteroid_obj_list`, its `prev` and `next` were `nullptr` instead of linking back to itself, which means the beginning of the list and the end of the list were no longer considered the same (the iterator's `begin()` calls `GET_FIRST(head)`, which is effectively `head->next`, while `end()` calls `END_OF_LIST(head)`, which is effectively just `head`). This meant that iterating over `list_range(Asteroid_obj_list)` was returning `nullptr` as the first element of the list, and trying to dereference that would cause a crash. This was still not a problem in and of itself, as long as nothing tried to iterate over `Asteroid_obj_list` while FRED was running, which theoretically shouldn't be necessary...
PR #3704 changed mission parsing so that when parsing a ship with a name that matches one of the `Asteroid_field.target_names`, it would call `asteroid_add_target()` to initialize the relevant data for the asteroid field to fling asteroids at that ship. `asteroid_add_target()` calls `count_incident_asteroids()`, which (since PR #5058) iterates over `Asteroid_obj_list`, causing a crash due to dereferencing a null pointer on any mission that defines `$Asteroid Targets:` (and then actually has such a target be parsed).
While this could be solved by unconditionally initializing `Asteroid_obj_list`, there's really no need to do anything with `Asteroid_obj_list` in FRED, so instead the `asteroid_add_target()` call has been gated behind a `!Fred_running` check, and `Assertion()`s have been added to make sure `Asteroid_obj_list` has been initialized at the beginning of any function that does anything with it (besides initialize it), to catch similar problems in the future.
Fixes#5092.
This was the bug found recently that was thought to be related to #2157. It turns out that ships will manage ETS even if they are playing dead, which caused a ship to accelerate during a ship-maneuver as it directed more power to engines. So this PR adds a "$ships playing dead don't manage ETS:" flag to control this behavior. Tested and works.
This also capitalizes two flags that did not have an initial capital letter.
To avoid changing behavior of existing mods, simulate the retail behavior unless the bugfix is explicitly activated. The buggy retail behavior is to evaluate a chained event, not skip it, if the event is repeating, regardless of whether the repeat timestamp has elapsed.
Follow-up to #5040. This extends the checks to most iterations over `obj_used_list` in FSO. There are a few exceptions such as `waypoint_add` and `waypoint_remove`, plus a few others. And none of the object iterations in FRED have the guard because FRED does not use the same object life cycle as FSO.
.vpc is identical to existing .vp except that it is allowed to
contain compressed files. This allows builds and tooling to know
that although the archive itself is retail compatible, it's content
may require special handling.
Simply rename your existing .vp to .vpc to indicate that it may
use compressed files. Existing tools can be updated to be able to
handle the compressed content within.
Although not recommended, the same archive can exist as both .vp
and .vpc for maximum compatibility. Both archives will be indexed
but the content of the .vpc will have priority.
Controls6 (PR #4133) changed `textify_scancode()` to be more l10n-aware, and added `textify_scancode_universal()` to continue serving the function of providing the values expected by scripts. Except there was one `textify_scancode()` call in the scripting system that wasn't changed, and it also wasn't used in FRED (for providing values for the `OPF_KEYPRESS` argument type, as used with `key-pressed`). This commit fixes both of these oversights, which *should* mean that all instances where a script or mission file needs to reference a keypress now use the same strings as before controls6.
When iterating through `Ship_obj_list`, check the `Should_be_dead` flag before using the object. This fixes#4990 and adds defense-in-depth checks to guard against similar errors elsewhere.
I considered moving the `Ship_obj_list` removal from `obj_delete` to `ship_cleanup`, but decided it would be prudent to avoid fundamental changes to lifecycle management.
When iterating through various object collections, check for the should-be-dead flag to avoid returning objects that are on the verge of being deleted.
Separately, this adds the `isExpiring` function to check for should-be-dead objects.
This PR also makes object iteration consistent across all object types, both to reduce code duplication and to ensure that the length and iteration are done using the same algorithm. Furthermore, if the number of should-be-dead objects is nonzero, the Lua array count for that frame will be different from the internal array count for that frame.
Fixes#5034.
- fix crash bug when path only contains dir separators
- fix error handling when no path is specified in write mode
- clarify function documentation
Fixes#5028
This modified the check as `text` has been changed in the Requests API. In order to make the code compatible with the JSON result, we check `resp.status_code` instead.
* Add imgui
* migrate render options
* remove wmcgui
* Add subsystem selection and highlighting
* Add a syntactic sugar extension for imgui
* don't rebuild the mission list every frame
* Add imgui_sugar extension
* Move helper functions out of lab_ui, add function to display consolidated table text for object
* add button to export cubemap
* fix entering and exiting the lab
* refactor some of this for greater cleanness
* use techroom lighting when no mission background is set
* minor things
* add imguizmo
* add imguizmo
* Add imgui
* migrate render options
* remove wmcgui
* Add subsystem selection and highlighting
* Add a syntactic sugar extension for imgui
* don't rebuild the mission list every frame
* Move helper functions out of lab_ui, add function to display consolidated table text for object
* add button to export cubemap
* fix entering and exiting the lab
* refactor some of this for greater cleanness
* minor things
* add imguizmo
* add imguizmo
* Add button to reset changes made in the render dialog
* refactoring
* unfuck rebase
* fix issue with loose mission files
* use with_CollapsingHeader for greater uniformity
* add weapon selection functionality
* make primaries and secondaries fire again
* implement animation triggers
* avoid crash when switching back and forth between ships with and without team colors
* add control to set team color setting to renderer texture dialog
* make sure the table text updates when the ship class changes
* let rotating subsystems rotate
* do not add imgui.h to pstypes
* code cleanup
* add subsys highlighter from fred
* Highlight non-modelled subsystems as well
* add cmdline flag to show the imgui demo dialogue
* fix compiler warnings reported by CI
* fix error when building the subsystem list
* refactor variable/method naming
* code cleanup
* remove vestigial code
* update to imgui 1.89.1
* add credits entry for imgui
* use the imgui namespace
* Separate the background dialog out into its own window
* make sure the subsystem highlights are placed correctly
Co-authored-by: Fabian Woltermann <[email protected]>
Several items here:
1. Patches several category and subcategory validation checks (comparisons to -1 rather than _NONE) that were missed in #4965.
2. Adds sanity checks to both built-in operators and scripted sexps to ensure categories and subcategories are consistent.
3. Deconflicts several built-in sexps that had inconsistent categories.
The inconsistent operators were:
* script-eval-string
* set-wing-formation
* get-ets-value
* turret-get-primary-ammo
* turret-get-secondary-ammo
* get-fov
Follow-up to #4965 and #4995.
Much like a previous instance (fixed in #3281, although the function in question was later removed), `std::isdigit()` without a locale argument prevents MSVC 2017 from compiling FSO.
* set-asteroid-field sexp
* errors
* scope
* set-debris-field sexp
* Clarify sexp documentation
* num_debris_sizes
* allow any order and activate display name feature
* unify naming scheme
* modular -ast.tbm
* styling
* decouple sexp parsing and asteroid field creation methods
* remove this
* fix merge oversights
* Remove this check
* reorder
* use scp_string instead
* spacing
* Only setup display name if it's empty
* Use define instead of magic numbers
* Ensure asteroid types get the correct spawn weight
* Warn if spawn weight is set for asteroid type
* typo
* Correctly handle asteroid split types
* iiiiiiiiiiiiiiiiiint
* address feedback
Use a vector for storing the message queue so it can be whatever size the mission needs.
As part of this, add `free` and `vm_free` deleters to be usable with `unique_ptr` and enhance `insertion_sort` to be usable with vectors.
Fixes#4959.
* Mod Table Settings for Arc Widths
There is currently a way to set the color of EMP and Damage Arcs in game_settings.tbl, but no way to change the width.
This PR adds options useful to modders to set the width and how it is calculated. Looking over the code and asking around, I developed these exposed options.
The options also allow modders to control the arc widths in multiple ways. For example, if you want to set a constant width for all ships you would set the `+Do Not Use Width Multiplier Over Radius:` to something huge, and if you wanted no arcs ever you would set the `+Width Default:` to 0.
They are tested and work as expected.
* clang
* fix copy paste error from #2053
* tab cleanup
* whitespace cleanup 2
* same for type ship and damage
* Fixes CTD with decals on dying ships
If a ship was getting shot with weapons that used decals, the decal code would hit an assertation, because the invalid decals were not being all removed.
This PR updates the decal cleanup loop, to ensure that no decals are missed and all invalid ones are removed. Tests confirm this fixes the issue.
Also cleaned up some comments and moved another assertation before setting of variables.
* Exposes modder useful options to decals
Now that decals are very stable, this PR exposes two options that are very useful for using decals, a random range for the radius along with the option to have a random rotation when the decal is created.
Tested and everything works as expected.
* add script ability to toggle decals
* properly use set arg not func
* fix two minor things in decal shader
* one more cleanup line
* fixes
Allow `mn.sendMessage` to send from a ship source, not only a string source, by allowing the ship object to be specified as the first argument. Also add `ship:sendMessage` which is a more streamlined version of the same thing.
Whether a ship is a support ship or its target, and whether it is destroyed or vanished, its repair/rearm mode should be cleaned up in a consistent way. This fixes a bug in Series Resurrecta where calling `ship-vanish` on a support ship put things into a broken state.
If a ship was getting shot with weapons that used decals, the decal code would hit an assertation, because the invalid decals were not being all removed.
This PR updates the decal cleanup loop, to ensure that no decals are missed and all invalid ones are removed. Tests confirm this fixes the issue.
Also cleaned up some comments and moved another assertation before setting of variables.
Two situations in the event timestamp life cycle, chain delays and event status delays, require accommodation for the timestamp-plus-interval case described in `mission_process_event()`. Commit 06fc8c73 applied the fix for chain delays; this applies the same fix to event status delays.
Follow-up to #4633. Fixes#4951.
* Add SpawnShipCheat and convert Bravos spawning to it
* Clean-up and add canUseCheat() check
* Move some stuff to parent CustomCheat class
* Add cheat-used SEXP and On Cheat scripting hook
* Add cheat tbls and tbms, fix custom cheat detection, move cheat hooks to global hooks
* Add a default virtual destructor to CustomCheats for its derived classes to use
* Initialize buffers with memset so clang will calm down, also move cheat check a bit to keep old cheats
* Attempt to appease MSVC
* Clean-up and formatting
* Ensure custom cheats fit in the cheat code buffer
* Fix a merge mistake
* Move pre-set cheat to embedded cheats table
* Use appropriate types for stuff_string
* Remove unnecessary copying of the cheat buffer
* Explicit nullchecking
* Avoid copying values for initializing CustomCheat
* move cheat checking function to cheats_table.h, fix a typo
* Clarify OP_USED_CHEAT sexp description
* Remove unnecessary casting
* Use list initalization for Ship Cheats
* Move a few method definitions from the .h to .cpp
* Change buffer to const char*
In the submodel reorganization in commit 575c050da4, subobject movement was moved out of the AI pipeline, which inadvertently removed the play-dead check that prevents subsystem movement. This broke a few missions such as Scroll's 'Thor's Hammer'. This PR restores the check.
Fixes#4933.
* better types and initialize objects with reasonable values
* modular -ltng.tbm
* fixes
* remove warning on no glow being defined
* do not error in FRED since the above code won't load the texture in FRED
FREDders expect events (and goals and campaign links) to land where you drag them. So when dragging items earlier in the list, insert them before the item they are dropped on.
* Add Option to allow weapons that hit player to place per-weapon sound
Weapons that lasers or missiles that hit the player also play a hard coded sound, which is not ideal when trying to give valuable audio feedback to player.
This PR allows modders to stop the behavior and have the weapon class impact sound specified in the weapons table play instead of the hard coded sounds.
Tested and works as expected.
* add per class shockwave and weapon sounds
* naming update
The new `no_fred` flag prevents weapons from being listed in the dropdown lists in the weapon dialog. Also this fixes `no_fred` ships to not appear either: previously they were hidden in the main window dropdown but still appeared in the ship editor.
In order to vastly simplify the dropdown list code, the weapon dialog was refactored to use arrays of variables rather than one hardcoded variable per bank.
Implements #3643.
PR #4516 did not cover all of the autoscaled AI class attributes, since a few of them were labeled differently. This adds checks to grab the correct autoscale index for the remaining cases:
```
$Afterburner Use Factor:
$Shockwave Evade Chances Per Second:
$Get Away Chance:
$Secondary Range Multiplier:
```
Fortunately, Sushi's investigation was pretty thorough. Between these remaining cases and @EatThePath's autoscaling review, this PR should cover the complete set of autoscaling situations.
Fixes#4922.
1. Since Discord is both a common noun and a proper noun, capitalize it here to clarify what it refers to.
2. Capitalize the first letter of the Hotkey internal variable to follow the global variable convention. And might as well clarify, while we're at it, that it hides hidden ships, not all ships.
Adds gravity! Applies on a per-mission basis, and weapons, ships, debris, and asteroids now have a configurable "gravity const" which multiplies the effect of gravity on them, by default everything except debris is 0 (meaning no effect even when the mission has gravity). AI and the lead indicator will also lead for ballistic trajectories as well, given a gravity-affected weapon. No FRED support or gravity direction control yet, to come in later PRs.
We shouldn't be checking that the `cci_h` is valid by seeing if it is greater than -1 because by that point it never will be. Instead, we should be checking that the incoming id is valid and setting to the invalid state if it is not.
* Fix crashes with sssi
We need to init in both places to avoid purging goals before ssi is set.
* Make sure we adjust for the wingp->special_ship--
Make sure we adjust sssi on ship death
If a variable can't be found, fail gracefully instead of Asserting. These changes will allow the mission to be saved and/or loaded, and will also allow the user to open the Event Editor and replace the nonexistent variable. This fixes the crash/assertion failure in #3849, as well as the case where the variable is edited in the mission file.
For all POFs that use animated textures, if no starting timestamp is specified, assume animation started at the beginning of the mission. This fixes a bug reported in Starfox: Event Horizon where weapon POF animated textures stopped animating after the texture timestamp upgrade.
Area_normalisation term in deferred shader was not getting set properly for cone lights, which caused things like ship headlights to not work properly.
Tested and fixes issue as expected. Thanks to Qaz and EatThePath for pointing out how to fix it!
Load campaigns using the full path provided by the user, not just from the configured mod paths.
Also tweaks initialization based on the campaign having already been cleared in `mission_campaign_clear()`.
* add subfolder support to cfile
* sort files in VP archives before indexing them
* fix indexing of sub-subfolders
* remove unused 8B22K & 16B11K sound path types
* add more items to skip subfolder scanning
* fix windows build issues
* fix unit tests by allowing 0-byte files to be indexed
* fix file indexing on windows
* add test for cfile subfolders
* remove specific 'markup' and 'css' interface subfolders
They aren't directly referenced anywhere by pathtype and the new
subfolder code will continue to index and load files from them
* add player binds to list of always-root locations
* remove file-based localization support
An alternative is left in place for old fonts, as that was the only place
it appeared to be used.
This method of file localization conflicts with subfolder support however
so if it's needed in the future then changes to the subfolder code will
be necessary.
* add subfolder support to cf_find_file_location_ext()
* add subfolder tests for cf_find_file_location*()
* add shlwapi to needed win32 libs
* small bit of cleanup
* add subfolder support to cf_get_file_list()
* add tests for cfile subfolder lists
* report files that might be shadowed
* fix issue with lists when a filter is used
Also fixes discrepancy in older cf_get_file_list() when a sub path
is specified (should be used in all cases, not just glob).
* address review suggestions
* Enable clients to move turrets
This allows clients to user server data to move turrets according to the timing and target data on the server. Uses a small packet to do so.
These fix up the in-game confirm packet and help sync client and server through a few timing fixes.
Co-Authored-By: Taylor Richards <[email protected]>
Adds `SEXP_CHECK_INVALID_SOUND_ENVIRONMENT` and `SEXP_CHECK_INVALID_SOUND_ENVIRONMENT_OPTION` to `sexp_recoverable_error()`. Neither causes a fatal problem, and the former can be spuriously triggered if EFX is disabled.
Parse objects have their path masks temporarily set to -1 during parsing, since at that point the mask represents an index, not a bitfield. In all other cases, the path mask defaults to 0.
Fixes#4873.
* Modular medals table
* Remove Num_medals completely
* Handle badges out of order and allow setting of masks to handle mask indecies out of order
* const const const
* qtFRED
* address feedback
Gather all the mission initialization code into a common function for clarity and ease of expansion. Previously, the various parsing routines contained initialization as well as parsing. As a bonus, quite a few redundant initializations are streamlined.
When the top-level operator of a SEXP is not found, flag the error instead of crashing. This is helpful for missions that contain unsupported scripted SEXPs.
Also be sure to set the bad node in the event of a NONOP_ARGS syntax error.
* Ripping out the gloss override code because it's vestigial
* Remove redundant teammask declaration.
* The NORMAL_ALPHA shader feature appears both useless and unusable.
Consequently, I'm removing it.
* implement modular nebula.tbl
* Address feedback and skip > 32 poofs
* read/write nebula poofs by name
* qtfred changes
* variable name
* log -> warning
* nullptr and make sure to only set bitmap_name when it's actually defined
This adds an AI profiles flag that filters autoscaling so that only the index and number of autoscaled classes are considered, not the index and number of all AI classes.
Fixes#4516.
Some refactoring with asteroid fields:
1. Moves asteroid throwing targets into the Asteroid_field struct, in anticipation of potentially multiple fields in the future
2. Moves some initialization code into `asteroid_level_init`
3. Calls `asteroid_level_init` when a mission is cleared
4. Loads asteroid targets as part of the asteroid field update/init logic. This fixes a FRED bug reported in Discord where asteroid targets stay in the dialog when a new mission is loaded
5. Remove `Default_asteroid_throwing_behavior` flag as it is equivalent to checking that the target list is empty
The `ade_odata_is_userdata_type` function didn't clean up its stack properly, as it left type information there for error reporting. But there are other reasons to check userdata types besides error reporting, so this adds a flag to clean up in most situations.
Fix courtesy of @BMagnu.
This is a new Lua API function that allows creation of arbitrary debris pieces, whether chunks of a ship's hull or shards of shrapnel. All of the parameters are optional, and a wide variety of situations are possible ranging from vaporized bits to static chunks to chunks propelled by an explosion.
* Add access to damage type, swarm, and corkscrew data
* Also return if the weapons have the appropriate flags
* Return nil for invalid handle and clarify documentation
* Add modular ability to add intel entries
* Allow for +nocreate in modular tables
* Allow intel.tbl as an alias of species.tbl
* Additional error checking and remove tests that are no longer required
* const
* Update `$POF file Techroom:` Usage
Currently `$POF file Techroom:` is only used in the weapons loadout screen (despite having techroom in the name). This PR expands the use of the `$POF file Techroom:` to shiploadout select and the actual techroom.
If it is desired I can put it behind a game settings flag, but IMO it would make the most sense for modders to have this just work as the actual name implies.
* clean up code with feedback
* typo fix in comment
Fix for recent updates to cockpit rendering check, which was false if the player was the only ship in a mission. `instance >0` was used but it is supposed to be `instance >= 0` (The object index is valid if larger or equal to 0, while the signature is only valid equal or larger to 1.) Tested and fix works as expected.
The script functions should make the ships/wings arrive even if they are reinforcement, so this PR fixes that. Also, this PR adds some additional verification of the `num_uses` of reinforcements, especially when the player calls for a wing that is already present but has more uses remaining.
* proof of concept
* Account for shadows
* Option to tie individual HUD gauges to the cockpit option
* Do this in a more user-friendly way
* Address feedback
Since the debug pause check needs to use UI timestamps, and since UI timestamps must keep track of time regardless of time compression, pausing, or mission status, move the updating and checking to `game_do_state_common`.
Also fix a type conversion warning.
* Add maximum self repair percentages for health and subsystems
Adds two new options to help with the automatic self repairs for hull and subsystems: `$Hull Self Repair Maximum:` and `$Subsystem Self Repair Maximum:`. These values allow mods to specify how much a ship's hull or subsystem can self repair to, which is very useful to have some auto repair but not enough to make the hull or subsystem 100%.
Also cleans up the `ship_auto_repair_frame` function with removing un-used define values, improving comments, and making formatting consistent. Also updates the parse sections of repair rate for hull and subsystems to print to the log if values are being clamped.
Probably easiest to review with hiding whitespace changes.
* update local names to be easier matches to surrounding code
* incorporate feedback
Add back in define, fix == 0 checks, and fix edge case logic bugs
There was code that could interpret any Lua type as an argument for printing, so I adapted it to be used in ba.print(), ba.warning(), and ba.error(). Also ba.println() seemed like a useful thing to add.
* Fix subsystem change handling code
Make sure that subsystem help actually gets updated.
* change from pointer to literal
I had decided to use `new` in the past when I was less experienced. So this changes it back to regular angle variables.
(And White space fix requested by Wookie)
* Add AI flag to support ai bay arrivals > 10 seconds
Currently, if an AI ship is emerging from a bay path, the AI will stop following that path after only 10 seconds (and some distance away from the starting point). This results in AI breaking off a path early if a bay arrival path is long and/or uses a slow bay arrive multipliers. For bays that require the ship to follow the exact path this results in AI that then run into the parent ship and each other.
This PR adds a flag which disables that 10 second timeout. Also, in my tests having a flag to disable works best, as opposed to setting a max time (which is hard to calculate with varying ship speeds and varying bay path lengths).
PR is tested and works as expected.
* fix spelling
* Fix Remove-Order not working for Play Dead Orders
Play-dead orders set a special case of the ai mode (AIM_PLAY_DEAD), which had special handling to return early in the AI frame function. Remove-order does not change the ai mode though, and thus even when a play-dead order was removed the `AIM_PLAY_DEAD' remained, which would continually trigger an early out in AI frame, which in turn would make turrets not fire on ships, even when the play-dead order was removed. No other orders had this early return, which is why remove order works for them.
This PR accounts for that special handling case. There also seemed to be an extra cleanup line for rearm and repair, so this was added right after that step.
Tested and works as expected.
* make fix flag enabled
* appease clang
* API access to weapons allowed on a ship class and/or in a specific bank
* Allow just checking the ship and not banks
* # This is a combination of 2 commits.
syntax fix
Add method to get number of primary and secondary banks
* We don't need these
* get default weapons for each bank
* # This is a combination of 2 commits.
documentation
return secondary not primary
* fix merge error
* Address feedback
* Prevent dangling threads from crashing FSO on close
* Fix warning
* Properly allow multiple parent threads for unittests
* Fix Test
* Redo it using the lua GC method
* tidyup
* Fix Warnings
* Fix double default
* get rid of explicitly defined copy constructor to allow implicit copy assign to exist
The ship record for player ships is not always accurate. So as to correct entries as valid packets are received.
Also, remove a case where null vectors were being passed to the physics engine.
Co-Authored-By: wookieejedi <[email protected]>
Co-authored-by: wookieejedi <[email protected]>
This requires splitting the `used` field into digital and analog components. The digital field stores the last-used timestamp, whereas the analog field stores the last value.
* API version of the briefing map
* Cleanup
* Further cleanup
* # This is a combination of 2 commits.
Fix resizing and cleanup remaining static anim calls
Revert changes completely
* Fix documentation
* implement initBriefing and rearrange map drawing methods to match.
* Documentation
* nullptr
1) Add the "no-thrusters" ship flag to the list of flag that can be used by alter-ship-flag or the ship's setFlag function
2) Add a `FireRateMultiplier` virtvar to control the firing rate of turrets (fulfills #4300)
3) Add a `setGlowPointBankActive` function to do the same thing as `activate-glow-point-bank`/`deactivate-glow-point-bank`
* Adds new default 'lua' filter category for all lua errors and output
Adds -luadev flag that currently only makes lua errors non-fatal.
* Correcting unreachable code.
* Missed a halting code path for luadevmode
* comment fix
* Fix VS Warning
If this is trivial and not needed feel free to dismiss, but this one-line PR simply fixes a warning that keeps showing up when building with VS.
* individually cast
* cleaner fix
Allow different types of cargo scans, including the -dualscanline behavior, to be specified in the HUD gauges table. Right now the options are "default" and "dualscanlines".
Two small fixes to follow up the lighting PRs
1) Change the mprintf to a Warning, both to be consistent with other deprecation warnings and to notify modders that they might need to accommodate the new lighting system
2) Parse any leftover data so that legacy tables don't cause FSO to choke on parsing
* Add deferred cockpit lighting
* Put deferred Cockpits behind a flag
* (hopefully) fix bad in-case initializer
* clear non base color buffer in subsequent deferred passes
* Proper deferred Cockpit rendering
* undo whitespace changes
Scripts that render models in the On Object Render hook were effectively doing immediate renders in the middle of queued renders. This caused some data, such as model orientation, to 'leak' between renders. It might also have something to do with why the bug in #4637 had the particular graphical side effects that it did.
Anyway, changing the immediate renders to queued renders fixes the leaky orientations, and is probably a good upgrade for other reasons as well.
Courtesy of Lafiel, this code fixes special flags such as those related to `spawn`. (Bug arose in #4620).
Tested and fixes the problem and works as expected.
Follow-up to #4602. Overall the PR was good, but there are a few extra small changes that should go in. In order of priority:
1) The `exitLoop`, `skipMission`, and `skipTraining` functions should check for campaign mode.
2) The `isVisible` virtvar should be changed to a function, because calling it may have side effects. In standard usage, the briefing formula is evaluated exactly once per stage on briefing initialization, so scripts should follow this convention.
3) The `hasGoalsSlide` function should be called `hasGoalsStage`, because "stage" is the common terminology in FSO.
4) Paging out mission messages is already done in `game_level_close` and should be removed from not only the scripting method but the method it was based on.
5) For consistency, unused parameters should use the `SCP_UNUSED` macro.
6) The `isTraining` flag check can be slightly streamlined using the double-not trick.
* Applying directional brightness profile value, disconnected spec flags and made specular light always equal to diffuse light
* Switched over to new command line arguments
* Wire lab up to new lighting controls, and provide backwards-compatible defaults for emissive.
* cleanup unused new function
* make static some functions that can be static
* revise command-line and emissive handling
* handled specular sun depreciation and general removal of specular value handling
* Removed specular light color as a separate value in the uniform buffers.
* cleanup of leftover/post-rebase specular references
* further post-rebase repair of light flags command line and leftover specular
* move techroom/selection/breifing 'room' lights to a common function and
augment lighting setup for current rendering
* fixed some mishandling of lighting modifiers.
* Addressed code clarity and comments from review
According to EatThePath's frame profiling, this one ship name lookup takes 2% of the frame time. It can be easily optimized by making use of the ship registry.
* Documentation (+6 squashed commit)
Squashed commit:
[ea8550b54] Resolve errors
[9ab0a576d] Add way to count number of elements in the arrays
[eb74146cc] Correct this boolean check
[60fbc6008] Missed one
[78e65a4b7] Avoid naming collision
[4ea5ddead] Clean unneeded log print and compare like variables
* Adding simulator room here seems like a pretty safe option
* Scpui API to access to build the tech room cutscene list and a few methods to help playing the cutscene and return to the menu accurately
* Scpui API access for credits related data
* # This is a combination of 7 commits.
Clean unneeded log print and compare like variables
Avoid naming collision
Missed one
Correct this boolean check
Add way to count number of elements in the arrays
Resolve errors
Documentation
* Address feedback
* Address feedback
* Add virtvar isCampaignMission
* API elements required for the Briefing
* Resolve errors
* Check if the mission is a Scramble mission
* Add one missed flag check
* Slight API naming adjustment
* Address feedback
* Address Feedback again
* Differentiate var names
When debugging, don't adjust the timestamp by the exact difference, since that would make the frametime 0 and cause div-0 errors. Instead pretend that the previous frame was a reasonable duration. Also, perform the timestamp check separately from the frametime check, since they are not always consistent.
* Auto Truncate default ship names
Previously, placing a ship that had a long class name might create a default name that was too long and thus trigger a buffer overflow assert.
Such behavior was confusing if someone was just placing things in FRED and not sure at all what happened or how to fix it.
This PR replaces the assert with code to auto truncate the ship class part of the name to ensure that the default name will fit into the designated size.
* change var name
Like #4559 before it for weapons, this fixes the script conditions for ships. The problem was the same: the script condition would evaluate to true if none of the objects under consideration were ships. The fix is the same as well. I checked all the other script condition categories, so no similar bugs should pop up in the future.
Fixes#4637.
It's not necessary here to assert on the correct variable type, as having the wrong type here won't cause the code to break. More importantly, the error will have been flagged before this point anyway, and this code is used for formatting the SEXP to be displayed in an error message. It's not helpful to pre-empt an error message with an assert.
add `getDirectiveLines` and `setPosition` script functions
properly error if trying to set a HUD gauge name
remove the unneeded `Directive_frames_loaded` variable
improve accuracy of SEXP help for HUD gauge operators
* Adds Lead Indicator Behavior option to game_settings.tbl
* Adds dont merge lead indicators flag to weapons, allowing homing secondaries to have their own lead indicators no matter what.
* Removed unused variable that was added just for testing
* add explicit int to float conversion to appease build checks
* Move some things around to avoid potentially undefined values
* Clean-up + address feedback
* Remove redundancy
For subtitles drawn using the `$Show-subtitle base resolution:` feature, text near the side of the screen would get clipped off mysteriously. The clipping corresponded precisely to the edge of a 4:3 boundary, which led me to discover that the clip boundary was still at the side of a 4:3 box, rather than a 16:10 box as was expected. Explicitly setting the clip boundary when setting the screen scale fixed the issue.
For any graphics coders in the know, is this actually the proper fix?
The null terminator was written past the end of the string buffer, which intruded on the next field in the struct. Fixing this fixes#4635. Also adjust the string concatenation a couple lines up because it could also write past the end of the buffer.
Supercaps have a special physics flag applied when they warp in so that they slow down quickly. However, if a supercap immediately warps out again - as in Deus Ex Machina and DEM: Interlude - this physics flag will interfere with the process so that the ship doesn't accelerate immediately even though the warpout portal is opening. This will cause the ship to miss the portal and clip off a section. The solution is to clear the flag once the warpout process starts.
* Add drop shadows to HUD text
* Add drop shadow to reticle
* Add control to toggle Drop Shadows
* Double render reticle shadows
* Use gauge_color instead of creating a temp var
* Add shadows to ETS gauges
* Set shadow default to false and adjust formatting
* Restore numbering for controlsconfig
* Allow mods to change Emp flash color, intensity, and string
EMP is the only text warning that does not use an entry in the strings table (and thus it's the only text warning gauge that mods cannot change and/or translate). This PR adds a string entry for it to allow mods to translate and change the string like all other HUD gauge text warnings.
Also, EMP flash has a hard coded color and strength factor for the flash, whereas generic pain and shield pain have a configurable flash strength factor (shield pain flash is based on shield color, while generic pain is based on damage dealt). This PR also allows modders to change the strength intensity and color following previously established methods.
This PR also fixes a case of "Launch" that fell through the cracks. The function is supplied the translated string, but within the function it does not check for the translation.
Everything is tested and works as expected.
* incorporate feedback
* convert to float during parse
* incorporate more feedback
* improve safety checks
A MOTD missing (422) message is non-fatal and should be handled the
same as a MOTD end (376) message to prevent the chat connection
process from hanging.
Written by Asteroth, derived from our ai code. I added a couple safety checks and changed the type to void to match our library.
Co-Authored-By: Asteroth <[email protected]>
The original implementation of `ai_good_time_to_rearm` did not revert to being a "bad" time to rearm when the time was up. This fixes that and adds an AI profiles flag to toggle it.
Also converts `ai_rearm_timestamp` to use the new TIMESTAMP type.
* Move colors up one level and generalize
* Initialize this first
* These are common to both all Briefings, so put them in the general Briefing category
Protects `Fiction_viewer_active_stage` if it reads a stage of -1 (it would have thrown a vector access error because the index is out of range). Also, given a lot of other scripting functions have additional built in error checks, I just added those to the fiction viewer functions.
* Allow `test_line_of_sight` to return intersecting object signature
The `test_line_of_sight` can currently provide the closest intersecting distance, but it would be very useful, especially for AI scripting, if this function could also return the signature of the intersecting object. This PR adds that functionality.
Tested and works as expected. Happy to discuss strategies for changing implementation, too. The extra, third return value for object signature was added to `getLineOfSightFirstIntersect` function because that function already returns 2 values. Thus, it will remain compatible with older scripts which only save the first 2 returned values.
* fix documentation
* fix typo
* return object instead of sig
* fix pointer
* use pointer pointer for full fix
* name clarification
Floating-point comparisons are tricky beasts. See this article for a good summary of the issues involved:
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
This PR improves support somewhat, although there are obviously situations in the code (such as comparisons to 0) that should still be addressed. This PR makes the following improvements:
1) Tightens the threshold on `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` from 1e-16 and 1e-36 to FLT_EPSILON
2) Tightens the threshold for parsing `turn_time` in POFs
3) Restores the previous implementation of `fl_equal`
4) Adds a dedicated `IS_MOI_VEC_NULL` for moment of inertia values
5) Improves documentation
Follow-up to #4535 and #4443.
Allow the variables controlling ship shudder to be independently set using scripting. Also add new flags to apply the shudder without decay and apply the shudder regardless of camera.
Also change the shudder timestamp to the new style.
* Make cutscenes.tbl extendable with -ccn.tbm
* Only let first cutscene of any parsed file be visible by default
* Implement +nocreate support and change modular ext from ccn to csn
* Remove commented out code
* Initialize char* as NULL
* Address feedback
* cleanup
Follow-up to #3743. A sound that was originally parsed as empty, but then re-parsed as non-empty, would still have the `GAME_SND_NOT_VALID` flag from the original attempt. This fixes that by clearing the flag each time the filename is read.
Splits the existing On Death hook into independent hooks for each relevant type. Adds On Ship Death, On Missile Death, etc. Also adds On Missile Death Started to complement On Ship Death Started.
`$Shadow Quality Default:` allows mods to specify what the default shadow quality should be, given that `-enable_shadows` flag is used. If a mod used this game settings option but the player did not use the `-enable_shadows` flag, then a parsing error would show up.
This PR fixes that bug by reordering two lines. Tested and fix works as expected.
* Make sure that players are updated the more often
Mitigates the increased latency from multiple clients getting each other's positions.
And Adjust update times:
Because LAN settings are now widely used even on non-LAN connections, shift High to a little bit less frequently in some situations, and adjust LAN settings so that it doesn't take quite as much bandwidth for updating ships that are `rear_medium` or `rear_far`.
Also update comments.
* Remove unused define
This was used in the previous version of the object update code and doesn't need to be here anymore.
As part of the cleanup in preparation for model translation, there was a bit of code review that was actually incorrect. The calculation of the current step needs to be rounded down, because the step isn't actually complete until it fully reaches the next number. Rounding the step causes the submodel to jump around in all sorts of weird ways.
Follow-up to #4443.
* Add Animation Instance Flags
* Add SEXP barebones
* Unify and simplify animation parsing
* Clean up animation calling and use new animationlist api
* Add missing break
* Add Lua access to a ship's Scan Time
* Disallow writing to the shipclass value
* Remove ship access in favor of shipclass access. Resolve read only issue.
* Cleanup and error if script attempts to set Scan Time
* Whoops. Still need to get the shipclass.
Change Interpolation function to bool
And calculate last position instead of just setting it
This should help FSO prevent some very odd collision issues when two ships collide
`Ai_flag_names[]`, `Object_flag_names[]`, and `Ship_flag_names[]` all had an associated `#define` containing their length that had to manually be incremented whenever new flag names were added to the list. This commit instead makes the number of flags in the list be computed by simple `sizeof` division, so now adding a new entry just requires adding the entry, rather than remembering to bump a `#define`. Tested in FRED to make sure populating `OPF_SHIP_FLAG` entries still works.
In #4443, `fl_near_zero` was set to use default epsilon values in the `IS_VEC_NULL` check. In this comparison, epsilon is the wrong threshold because it used to have a much smaller threshold. The fix restores the previous definitions of `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` by exposing the epsilon value as an optional parameter (similar to how `IS_NEAR_ZERO` used to work. This PR also restores `IS_VEC_NULL_SQ_SAFE` where it was replaced by `IS_VEC_NULL.`
Previosuly, the default object update speed setting for new players was `High`. Many mods, such as Fate of the Galaxy, do multiplayer tests where we have to ensure players are using the highest object update speed, which is LAN. This extra step is cumbersome and prone to players' forgetfulness.
This PR allows mods to set the default multiplayer object update speed for new pilots to mitigate this issue. Tested and works as expected.
* more cleanup in preparation for model translation
1) Clean up stepped rotation, fixing some logic, adding safeguards for invalid values, and allowing rotations to go in the opposite direction
2) Add more specific SEXP error checking for AWACS and rotating subsystems
3) Assorted refactoring and polishing
* address feedback, plus a bit of extra cleanup
Previously the persistent object sound management code would attenuate all script-assigned sounds by engine strength, and would not play them at all if the engine was off. This fixes the code to only apply that logic if the sound is in fact and engine sound.
This allows you to automatically append, for example, "-shock" to the damage type to make the shockwave damage type, so a weapon with "Heavy" damage type would automatically have its shockwave assigned the damage type "Heavy-shock".
This includes both separate defaults for dinky and non-dinky shockwaves, as well as automatic inheritance of the parent weapon's damage type (and if both are enabled simultaneously, the default is only used if there's nothing to inherit because the parent weapon doesn't set a damage type).
This assert catches any weapon's parent object type, which can include OBJ_GHOST, which is a dead player. OBJ_GHOST is being encountered in this function using BPC when the player dies via beam weapon and (likely) when the players weapon are hitting an enemy ship at the same time. Because the player ship can damage an enemy after it is dead, allow for that in this function.
FRED needs to work with any HUD gauge in the table, so don't prune any based on resolution. Fixes#4517.
This also improves checking for duplicate names in the FRED gauge list.
SEXP categories will not support more than 256 SEXPs; this is why the CHANGE2 category had to be created when CHANGE got full. Unfortunately, dynamic SEXPs will count toward this limit, so mysterious errors will occur for the ones whose category indexes roll over. The problem is not easily fixable, but at least the engine can detect the situation, warn about it, and refrain from adding any problematic SEXPs.
Since too many *total* SEXPs would cause a similar problem, this adds a warning for that case too.
When `mission_campaign_clear()` is called, all persistent SEXP nodes (those used by the campaign) are marked as non-persistent. When `sexp_shutdown()` was moved in #4503, this caused `Sexp_nodes` to be nullptr when the campaign was cleared, which caused a crash. This reorders the shutdown functions to prevent the crash.
PR #4500 added some checks, but accidentally compared `aip->target_objnum` to an object type (although the assertion message correctly retrieved the object type, leading to the bizarre assertion that `OBJ_SHIP`, i.e. 1, was an invalid target object type). This commit makes them all access the `Objects[]` array and retrieve the `.type`, just as the assertion message does (and the pre-#4500 conditional did).
Related to #4504, in that it's the source of the failed assertions, although I can't be sure it was the cause of the crashes without testing.
* Include more valid object types in this check
The previous version of the fix only included ships because it was believed to be the object that a ship used to be guarding. Now it's clear that this is an object that the ship is currently targeting *after* guarding something.
So remove the UNREACHABLE and manually check the valid object types with an assert. Then only continue with the function if it is the right target type.
* typo
When the code checks for the existence of an audio file, be sure to check all relevant extensions.
This fixes#4495. Tested with both ST:R personas as well as the Vasudan persona.
The movie player code was missing some important functionality, in particular:
1) There was only one timing method to get real-time elapsed time, which was not suitable for pausing or time compression
2) There was an improper cast for the FPS property, causing a script error
3) The `getSeconds` method lost precision during casting
This patches those deficiencies.
There's no need to keep all this infrastructure to run every frame for a barely used situation. This cleans it up a bit and does the position reset in the actual drawString function.
This range check is to ensure that the ship's hull is in a valid range, so it should therefore check that the hull is less than the max strength, not less than the current strength. This was inadvertently changed in 593be42e66 and a04e83ab01, but retail behavior is to set the exact hull from the previous mission.
Tested for both regular ships and delayed-arrival ships. Fixes#4472.
Due to rounding and conversion approximations, it was possible for FRED to think the position and/or angle was modified when no such modification had occurred. This could result in erroneous updates. In the case of angles this could result in a group of ships being assigned the wrong orientation.
Follow-up to #2614.
`os_ignore_events()` deferred events instead of ignoring them. The
player could accidentally skip a cutscene at the loading screen and
not see any indication there was a cutscene.
This only removes deferred skip-cutscene key events, except ESC, right
before the cutscene plays. This makes it less likely for a player to
accidentally skip the cutscene.
This also renames `buffered_events` to `deferred_events` and
`os_ignore_events()` to `os_defer_events_on_load_screen()`, which more
accurately describes the behavior.
Fixes#4419.
os_ignore_events() was buffering events instead of ignoring them. This
caused any skip-cutscene key to be buffered during the loading screen,
which would later be handled during the cutscene. From the player's
perspective, there was no cutscene.
This changes os_ignore_events() to ignore events.
Fixes#4419.
Sync the "mission save" and "error reporting" versions of the SEXP variable string. Also use `stuff_sexp_text_string` to print the "bad node" token rather than `Sexp_nodes[bad_node].text`, so that a human-readable token is displayed instead of a magic number like 26.
Related to #4226, as the generated error message is formatted differently enough to be confusing.
1) A comprehensive fix for the is_target_dying variable
2) Also do distance correctly for non-player target brackets by adding a check that we're dealing with the target before using the current target distance. Then also calc distance if it is not the player target.
3) Update comments and checks to be consistent
Many of these did not reflect how the variable was actually used, so update the comments.
* Fix AI Goal Display Strings
Okay so previously, if a target goal was not valid the code was
`strcpy(outbuf, XSTR("no orders", 495)); `
but then it was changed to
`outbuf += XSTR("no orders", 495);`
So it would instead append the "no orders" instead of properly replace the whole string. Looks just like a copy and paster oversight, since all the other text appends the name of the target with the order.
This PR correctly replaces, rather than appends that text. Fixes#4345
* appease clang
* use more simple =
Tests with standalone multiplayer builds revealed that the server would seg fault if a player tried to switch secondaries if the ship did not have secondaries. Tests with standalones showed this fixed the bug. Thanks to chief for the bug IDing and the fix code.
Another bug discovered by Durandal. The message sender was a variable containing an invalid value, and the game crashed. This handles it more gracefully.
Tested and verified.
This goal was missed in `ai_remove_goal_sexp_sub`, so add handling for it. Also make the error message clearer in case another goal is missed in the future.
The two `VIRTVAR`s for Orientation in subsystems and submodel instances do the same thing, but did not have the same code - in particular, the subsystem version did not update the subsystem angle and turret angle. This syncs them up.
Arrow, function, Ctrl, Alt ... and any other non-ascii keys
would previously add a blank space to the multi msg buffer.
This prevents that from happening, making sure that it's an
ascii character before appending it to the buffer.
(Retail bug??)
The previous way to clear a skybox was to set it to "default", and if the mission had no skybox then it would be cleared. The skybox code can correctly handle the lack of a skybox, but if you pass an empty string to the skybox preloader it fails with a file not found error. This fixes the preloader, and also adds "none" as an explicit no-skybox parameter.
Certain campaign-related functions would run even when the game was not in campaign mode (e.g. when playing in the tech room). Normally these would be benign, but with a new pilot or with a skipped mission, the current campaign mission would be -1 and a crash would occur.
Should fully fix#4412.
Fixed environment map rendering
shift fresnel term to match ordering of ComputeGGX, document shader code.
Envmaps: Use tangentMatrix to build local coordinate system
Fixed geometry self-shading calcs to improve shading of rough surfaces.
Cite paper correctly
optimsed env sampling
Put envmap face generation a loop to make it easier to read
Precalculate points on circle for even faster envmap sampling..
Guard against NaNs
Revert to simpler envmap calcs, significantly faster on slower GPUs.
typo
We don't need the sample points any more.
Diffuse IBL shading
Fix gamma issues in envmap rendering
AO term on envmaps.
fix lab crash with retail data
Always render envmaps - PBR shouldn't care if a shine/specmap exists.
Better approximation in geometry/visibility term
Fixed Fresnel/Schlick model to be dependent on view in line with learn openGL PBR theory
introduce energy conservation term for diffuse rendering
Just use specColor instead of trying to figure out metalness.
Pull out g1 function for reuse
UE4 based shaders
Better approximation in geometry/visibility term
Fixed Fresnel/Schlick model to be dependent on view in line with learn openGL PBR theory
introduce energy conservation term for diffuse rendering
Just use specColor instead of trying to figure out metalness.
Pull out g1 function for reuse
The first issue is that if a gauge isn't found it will fail to parse
any remaining gauges in the file. The second issue is that when saving
the preset the game uses translated strings for the gauge name but
when loading the preset it uses untranslated strings.
This should address both issues while keeping the original purpose
of the changes as well as not breaking existing presets or requiring
any mod changes.
Ref: http://scp.indiegames.us/mantis/view.php?id=3099
The default file path is always the primary mod user directory, however
some files are only ever created and read from the root user directory.
This allows for an override in such cases so that the location_flags
variable will match the intended root path.
Fixes#4384
There are three popups of decreasing priority that can appear in the main hall screen: campaign not found, pilot upgraded, and player tip. Only one of these should actually be displayed -- the first popup will take the player to a different screen, rendering subsequent popups useless; and the second popup is more important than the third popup. This PR prioritizes the popups accordingly.
Since "No subsystems found" and "Not all subsystems have a record in ships.tbl" are different warnings, they should have different flags. Follow-up to #4408.
The "skip training" button and the "exit loop" button should both check whether the campaign is actually over before attempting to load the next mission. The fix is simple - just use the same logic as in `mission_campaign_skip_to_next`.
Fixes#4412.
* Echo the event name to debug Auto trigger
* Add argparse library to changelog.py
* Allow user to authenticate with github creds (such as PAT's)
* Update ci/post/changelog.py
Use clearer notation for while loop
Co-authored-by: MageKing17 <[email protected]>
* Update ci/post/changelog.py
Co-authored-by: MageKing17 <[email protected]>
Co-authored-by: MageKing17 <[email protected]>
While it may seem counterintuitive, we have to keep the standalone bogus ship from being added to the ship list so that we don't have to exclude it from all the places it could cause crashes or mysterious AI behaviors. Both were being observed, and this should fix them.
1) Restore original behavior where function would exit after one error check (for consistency)
2) Exclude player ships from the check for ships in a wing sharing the same orders
The "default" tech database flags indicate whether entries are in the tech room by default, that is when the table is originally parsed and the campaign is started. Flags may be changed later, so that when the tech database is "reset to default" the flags can be returned to the known state as specified in the tables.
A bug was introduced back in commit c924e3997a (!) based on a misinterpretation of what "default" meant. This fixes the bug and clarifies the flags.
Fixes#4390.
Retail saved tracker stats to the local pilot file after read, however
the newer pilot file code doesn't work the same way. This adds the
ability to properly update the pilot file with multiplayer stats from
the tracker during login.
NOTE: This will always overwrite multi stats in the pilot file with
the stats from the tracker!
Before setting the `MQF_CONVERT_TO_COMMAND` flag, check to make sure the conversion will succeed.
This should ensure proper behavior for any case where command-conversion is needed. I've tested it with both a message that should not be converted and a message that should, and both behave as expected.
Follow-up to #4150 and #4078. Fixes#4356.
This takes a few of the existing hooks and converts them to the new style of hook definition which can include more extensive documentation and enumeration of supported hook variables.
This is an updated version of #3151 to work with the latest codebase.
NOTE: Before this can be integrated into the codebase, it needs an implementation for `bool script_state::IsActiveAction(int hookId)` which apparently only has support for old-style script hooks.
Locale Sensitive Controls and Textfield Input
+ Add Keyboard Layout sensitive InputBoxes
+ Remove obsolete helper function
* Fig [] usage and remove old keybinding names
+ Fix Compile Warnings
+ Fix Compile Warnings 2
+ Fix Clang Warnings
+ Fix faulty style + remove lambda
+ Change reverse-lookup map to iterating function
+ Added controlconfigdefault.tbl generator
+ Fixed gcc warning
+ Fixed msvc warning
+ make debug console keyboard layout independent
+ Expand DCF Functionality for saving control presets
+ Address Issues
* Controls/update tbl (#5)
Updates controlconfigdefaults.tbl to write Primary and Secondary bindings.
* Added Scripting Hooks for controlsconfigdefault.tbl (#6)
* Handle Asserted Switch cases
* Controls is a library and should be in the libs folder
* Add Lock & EnableScripting Functionality and expose it to scripting API
* Added scripting isLocked
* Move Key Hooks to register-able callback
* Add option to remove hook
* Repurpose CCI.used for Axes
* Morph bitfield into a singleton class
* Add encoding conversion helpers
+ Add keyname conversion if needed
+ Merge refactored encoding functions
+ Change keycode encoding call
+ remove bad type modifier
+ Move Conversion functions to util/unicode
+ Change Encoding Enum to Enum Class
+ Adapt KeyName call for encoding enum class
+ Fix Warning due to enum class
+ Change validation to own function
* Make mActionToVal Assertion more helpful
* Fix typo
* Fix style
* Use constant, not magic number
* Document Ignored_keys[]
* Doxy class controls_lua_override_cache a bit better
* Put NameToVal safeties back in
* Reorder the +Disable and $Disable: options, and be exclusive
* Reorder the +Locked and $Loacked options, and be exclusive
* Revert changes in ValToJoy
* Revert errant duplicates
* Refactor printJoyJSON() to use getJsonArray for consistency
* Remove unused FS2toSDL map
* Remove ADE_FUNC(AxisActionInverted)
* Address gcc-5 issues
* Remove unused param for textify_scancode
* Declare textify_scancode_universal() in controlsconfig.h for use
* Clean up textify_scancode() and *_universal() a smidge for clarity
* Address most clang-9 issues
* Modernize NULL to nullptr
* Expand logic and document in controlsconfig::check_control() for clarity.
* Fix typo
* Remove unecassary static_cast
* Use Assertion instead of Assert within control_config_common_read_section()
* mprintf()'s need new lines!
Co-authored-by: Birk Magnussen <[email protected]>
Co-authored-by: Birk Magnussen <[email protected]>
* add node subtype for container names
* clean up and port changes to qtFRED
* fix parsing when container is the last argument
* fix serializing container name nodes
* fix parsing again
* disallow spaces in container names
* check for spaces and & chars while parsing container names
* early WIP for trying to get list containers of strings working as argument options
* indicate which SEXPs will be supported for now
* clean up
* add FRED/qtFRED support
* remove [in]validate-argument from supported SEXPs
* support map containers with string keys
* update FRED and qtFRED
* clean up
* update FRED help text
* revert some unneeded changes
* fix style
* remove added assertion
* backport useful changes from PR #4263 and then some
* clean up backport
* move condition_node evaluation outside of argument loop
* fix does_blank_of_op_support_container_args()
* fix assertion
* add OPF_DATA_OR_STR_CONTAINER and use restore old behavior of OPF_ANYTHING
* revert some unnecessary changes
* fix CI
* detect attempts to modify container while it is being used as special argument (WIP)
* evaluate conditional for each loop
* update placeholder text for new SEXP arg type
* finish/clean up
* add subsystem indexer and ensure that ship_get_indexed_subsys and ship_get_first_subsys are independent
* also add reverse lookup from subsys to index
* update indexer to accommodate subsystem pointers being changed
* use clearer function names, and fix the type of subsys_list_indexer
* add assertions
* address latest feedbcak
* add some extra safeguards to gr.drawString
These will add insight if the errors reported by RedMadeJoe pop up again. The root cause is in the script, but this will prevent FSO from choking.
* Add static bool for warning
* Add support for drawing batched 3D lines of arbitrary color and thickness.
* Add draw3dLine lua function.
* Move line texture out of graphics.h into graphics.cpp, also rename it for proper code style.
* Move line texture generation to batching.cpp, create dedicated batching_add_line function and add support for a line with variable thickness at the start and end.
* Use references in the verts loop
* Add bound checks for line widths
* Warn if the Lua script uses invalid widths
In Training missions, the game will check if keys used in directives are bound or unbound, and if unbound will display a message to the player to bind the key.
This is limited to only Training missions though, so this PR adds a `game_settings` option to allow modders to use that check in singleplayer mission types too, which is very useful for mods that rely on key presses in non-training missions. Also fixes#4340.
Previously, debug builds would assert if a packet was not a psnet packet
type. Port scans and general traffic checks could trigger this for any
public server. So we should just log these events instead, taking into
account that some of this traffic could be malicious in nature.
In the FRED campaign editor, error checking for campaign branches did not correctly handle loop branches. This avoids performing inapplicable error checking for loop branches, adds a new applicable check, and excludes loop branches from the count of regular branches. Fixes error checking for the FS2 main campaign.
Adds the standard Lua extension library for bit operations in Lua 5.1.
http://bitop.luajit.org/
Note that this library is normally called "bit", but it is added here as "luabit" because there is already a FSO scripting library called "bit".
Due to both the AI code and the ship movement code calling warp departure logic, enabling `Framerate_independent_turning` caused ships with the no-departure-warp flag to depart twice. Removing the call to `shipfx_actually_warpout` fixes this.
More fundamentally, this untangles and organizes the arrival and departure logic as it pertains to effects. The actual arrival and departure code is moved to the `shipfx_actually_warpin` and `shipfx_actually_warpout functions`. This simplifies `WarpEffect::warpEnd()` and allows `WarpEffect` and its subclasses to only concern themselves with the visual effects.
This also fixes a logging statement that could never actually be printed due to `delta_ms` being the wrong sign in the if() check.
When parsing escort priority, FSO asserts that the escort flag is set,
but this assertion is only valid in missions output by FRED; it's fairly
trivial to use notepad to remove the flag without removing escort
priority, thereby triggering the assertion. Furthermore, there doesn't
actually seem to be a problem if a parse object has an escort priority
without the escort flag; the engine won't actually use the priority
until/unless the ship is manually added to the escort list, and then it
doesn't matter that one is set.
* Add callback for user specified availability status
* Add target restrict hook
* Fix Restrict hook and add not self restrict type
* Fix documentation
* Fix typo
* scope the ai achievability enum
* fix scoped achievabiliy
Instead of keeping the old variables around (except renamed to include "_deprecated") and manually checking them one at a time with a lot of duplicated code, use existing information to generate the messages automatically.
1) In `for-counter`, when `just_count` is true there is a memory leak, since the code never enters `test_argument_vector_for_condition`, but for the same reason, duplicating the string is not necessary in that case, so just add a blank string
2) Remove unnecessary `vm_strdup` calls from the other for-* operators
3) `const`ify argument management
A bit overkill for some of this but just covering the bases.
* fix issues with in-game join
* fix multi messaging and multi pause screen
* make sure maintenance stuff (pings, voice, file xfer, etc.) isn't
affected by pausing or time compression
- report when multi.cfg is missing
- add game version, multi version, cmdline, and PXO status
to multi.log
- use non-interactive mode by default on standalone and
enable it as soon as possible
* Replace "Always_show_goals" with "Toggle_showing_goals"
The "Always_show_goals" flag is a no-op on anything other than a
training mission. This replaces it with a new flag which toggles
whether the goals are shown instead, in keeping with the existing
"Toggle_debriefing" flag.
* Rename other occurrences of Always_show_goals
* Update stale comment
* Update stale member names
* Remove unused #define
1) Remove the extra branch in `check_ok_to_fire` that was added in SVN revision 10392, or commit 0d54630e83. If there was an actual Coverity error, this does not fix it at the proper location. More importantly, this breaks certain turret firing behavior.
2) Fix a couple of bounds checks.
3) Remove an incorrect stale comment.
This fixes the broken turret swarm weapons that were uncovered by the fixes in #2959.
Players are still affected by collisions locally, but other ships will literally pass through each other until updated by the server. A timestamp controls the frequency of collisions with the player ship.
Turns out PR #4243 actually introduced a bug that appeared to implement the feature. The previous implementation had the effect of intercepting all keypresses and routing them to the main window. This fixes that bug by using `CDialog` instead of `CWnd`. It also turns out that the `hWnd` window handle for some reason does not match the expected window, but fortunately, this implementation is only called in the correct window so the restriction is not needed.
Normally, when the player cycles through targets using (for example) the hostile targeting key, the targets will be shown in order of distance. In PR #4121, this was changed from bounding-box distance to center-distance, which has very little noticeable effect on the cycle except that it now agrees with the AI strategy for measuring distance.
However, when the player targets a hostile for the first time, or when the cycle resets after 1.5 seconds have passed, the first ship targeted will be the closest ship *or* the ship with the closest turret. And furthermore, when the target cycle continues, the next ship targeted will be the next ship farther away. There can be a dramatic difference between a turret, which may be very close, and the center of the ship, which may be very far away. The target cycle will continue with these far-away ships, and this has the effect of leapfrogging any ships that are closer that should be targeted first.
There isn't any easy way to tell that a ship has been targeted because of its turret, and not because of some other targeting key or because the cycle has restarted, but fortunately the bounding-box distance is a reasonable approximation because turrets tend to be on the bounding boxes. So this commit simply restores the distance functions to what they were before. The other fixes from #4121 are not related and remain in place.
When the `$Use host orientation for set-camera-facing` flag in game_settings.tbl is active, the camera will use the host's orientation as a basis for rotation. However if there is no host, the camera unintentionally inherited its old stale orientation. Instead the camera should base its new orientation on the identity matrix which is the expected behavior.
The new timestamps should use the timestamp ticker, which accounts for pauses and time compression, not the standard timer, which measures absolute elapsed time. This fixes the bug reported on Discord where the supernova timer did not pause when the game was paused.
Alt-names with hashes that were added by the `change-alt-name` sexp used to have their hashes truncated properly. This most likely broke when hash truncation was moved from the HUD code to the "display name" code. This PR truncates hashes in the same way as truncation elsewhere.
Override some MFC signal paths to prevent Enter and Escape from doing their default behavior. Also add a "save changes" prompt to the Cancel and Close buttons.
Fixes#4240.
These were first noticed by @TheForce172 in PR #4241. Instead manually editing the parse buffer, call the parsing functions to properly free the memory used by parsing the tables. Also remove redundant calls to `ship_init`.
1) In commit 770fce8de5, a flag was incorrectly ported from a bit to a flagset, which caused ships not in the tech db to not be removed.
2) Perhaps due to the pilot file upgrade, campaigns which had their tech databases reset would immediately load stale techroom data from the savefile. This change writes the savefile after the reset so that subsequent reloads will load the correct data.
Theoretically, the list actually had precedence when a table entry had fewer banks than the model, which would fill the extra banks with the first applicable weapon in the precedence list... except the engine `Error`s before that can happen, so it didn't actually do that. When a mission's loadout doesn't include one or more of the weapons the ship thinks it should have (i.e. it's left to its default loadout and one or more of those are missing), the missing weapons are replaced from the `Player_weapon_precedence` list. However, it didn't actually check precedence: it just went through every weapon type in order, and picked the first applicable one that also happened to be on the `Player_weapon_precedence` list.
This commit makes it so that instead of iterating through every weapon ID, we just iterate through the ones in the `Player_weapon_precedence` list (which is now a vector, thanks to #4201). Not only does this mean that higher entries in the list will be chosen first (meaning actual precedence), but since the vector will often be much shorter than `Weapon_info`, it should also take fewer iterations to find a valid weapon (or decide none of them are valid). This is technically a backwards-incompatible change, but since it only affects missions where a ship on the loadout screen lacks a weapon in its assigned loadout, it should be a relatively minor break.
* Add Subsystem Flag to Hide Turrets from Ship Loadout Stats
The statistics summary window in the ship loadout editor shows various aspects and stats of the selected ship. These can be toggled and customized through the ships table, but one line is actually autogenerated, `+Turrets`. This is unideal for certain ships, especially those which use turrets on ships in non-standard ways (for example having an AI controlled turret which shoots bombs). In these cases, the turrets are not actual turrets, and it is confusing for players seeing that there is a turret on the ship in the loadout editor. (I can give more detailed examples using FotG if needed).
This PR adds a subsystem flag which allows the modders to hide a turret subsystem so it is not counted in the auto generation of the `Turrets` summary line. (As a slight cleanup I also removed cleaned up the whitespace formatting on a nearby, but unrelated line).
* sync names
* fix renaming
1) Prevent the ship class from being changed if the icon image has a special closeup (like a jump node)
2) If the icon image is changed to a special closeup, automatically choose a ship class that doesn't have a custom icon
Fixes#3860
For script hooks which use conditions, be more consistent about evaluating both objects involved, as well as evaluating the different types of objects.
Fixes#3874.
* Avoid setting .rest for Locked_sexp_true/false with malformed SEXPs.
When FRED puts a `true` in the middle of a list of arguments, it wraps it in a nested list as `(true)`, because it's technically an operator; however, if someone writes a SEXP by hand, they could easily forget to do this, and in such cases, this causes `Locked_sexp_true` to be inserted into the middle of the list. If it's not the last element of the list, it will then have its `.rest` attribute set to the next node in the list. If this is a temporary SEXP (i.e. from Lua's `runSEXP()` function), this used to be a temporary problem, but PR #4088 changed the global search for any node with `.rest` set to the node being freed to require an explicit parent node. This means that `Locked_sexp_true.rest` remains set to a freed node, which can cause further issues. If such a malformed SEXP *isn't* temporary it can cause even more issues, even pre-#4088.
This commit changes `get_sexp()` so that if it detects `true` or `false` in the middle of a list (and not a single-element list), it will put it into a single-element sub-list, hopefully preventing any modification of `Locked_sexp_true` or `Locked_sexp_false`, as giving a `Warning`. This should cause it to behave as though `true` or `false` was actually `(true)` or `(false)`, respectively, and therefore run as expected.
* Add comment and remove unused variable declaration.
Thanks to @PhantomHoover for the wording on the comment.
Back in #104, I made an *attempt* at clearing the delayed SSM parsing data once it'd been validated; however, for some reason, I only cleared half of the variables, and I only used `.clear()` rather than `.clear()` followed by `.shrink_to_fit()` (which means the same amount of memory was still reserved for these variables that would never be used again). While making #4201 I happened to comes across the "swap with empty temporary" paradigm do to both at once, so I decided to apply it to this old thing, as well as clearing all four variables rather than just two. Additionally, since these mappings don't actually care about ordering, I made them `unordered_map`s while I was at it. It's probably not a significant memory savings, but since we'd never need to use that memory after parsing, I figured we might as well reclaim it anyway.
For some reason, ship flag parsing was still using a fixed-size array instead of a vector, limiting it to 20 flags parsed in a single entry. Since there wasn't really a reason to do that (it was basically parsing to a vector anyway, then resizing it down to the limit, then stuffing the C-strings into the array), I changed it to a vector.
* Fix RTT Cockpits Gauges with Change Ship Class
Previously, using the `change-ship-class` sexp or scripting function did not update RTT cockpit gauges. This PR adds the cockpit code update functions to fix the issue. Tested and works as expected.
* comment consistency
* beam_add_light_small() is only ever used in one place which always passes a point. Calculating the point inside is removed as redundant and obfuscating.
* Repeated beam light width calculation moved to function
* Repeated beam light state validation moved to function
* Repeated beam light noise generation moved to function
* cleanup superfluous parameter
`ship_set_default_weapons()` (which is called by `ship_create()`) was only setting `swp->primary_bank_capacity` for a bank if the default weapon for that bank was ballistic; if the ship was then equipped with an ammo-using primary and the `set-primary-ammo` SEXP was used on it, it would think the bank had a capacity of zero, resulting in 0 ammo.
This commit simply moves the assignment outside of the conditional, so that primary bank capacities are always recorded in the `ship_weapon` class.
* Fix Texture Replace with Ship Changes
Tabled `$Texture Replace` did not work on ships where the class is changed in the loadout or with the `change-ship-class` sexp. This was because the replacement textures only were loaded during mission parse, and the `change_ship_type` did not account for loading new textures from ship classes that were not in the initial mission parse. Part of the bug was also that the code that updates texture replacements was after the texture page-in section of `change_ship_type`.
This PR fixes that bug by properly loading the textures in when the ship class changes. It also moves the code to within the `ship_model_change` function (which is only used in the `change_ship_type` function) so that the texture loading happens correctly before texture page in.
* fix accidental whitespace changes
* fix comment
* also fix team colors
* comment spelling fix
* appease clang
* properly clear replace textures between ship changes
Followup to #4088. A few calls of `free_sexp` (especially in `free_sexp2`) did not supply the calling node, which left inconsistent SEXP tree structures and caused a crash in TranscendE1M6. This fixes the crash and fills in some of these places.
Removed useless light_ignore_objnum and affected_objnum lighting data, light_add_point_unique() subsequently removed as well, and cleaned up unused parameters.
* Add a flag to allow the firing fail sound to play with locked primaries
* Adds an equivalent flag for Secondaries
* Make the flags accessible to FRED
* Fix whitespace mistakes
* Yet another whitespace fix
* Move primary fail sound flag check up to avoid wasting processing with unused shots
* Move secondary locked check up to avoid doing unnecessary checks
The `stuff_int_list()` call converts the weapon names into the appropriate index into the `Weapon_info` array; however, in `weapon_do_post_parse()`, we call `weapon_sort_by_type()`, which reorders the array; this makes these indices potentially point to the wrong weapon. Additionally, there's no protection against someone `+remove`ing one of the weapons in the list in a later TBM.
This commit makes it so we instead store the names into a vector of strings, then convert them into indices after `weapon_sort_by_type()` has already been called. Additionally, `Player_weapon_precedence` is changed from a fixed-size array to a vector, since it's usually not as long as `MAX_WEAPON_TYPES`.
Fixes#4199.
PR #3750 made `check_sexp_syntax()` less permissive of node trees containing `<argument>`, which causes problems given that FRED saves `modify-variable`'s second argument as a `SEXP_ATOM_NUMBER`, as now `check_sexp_syntax()` complains that `<argument>` isn't a valid number. This commit both makes the `SEXP_ATOM_NUMBER` check skip the number validation logic if the `SNF_SPECIAL_ARG_IN_NODE` flag is set, as well as removing the `SEXP_ATOM_STRING` type check from the later `SNF_SPECIAL_ARG_IN_NODE` check (for making sure it's inside an `-argument` SEXP).
Turns out the `MAX_OBJECT_FLAG_NAMES` was not increased originally, so this PR increases it to match the new amount now that `ai-attackable-if-no-collide` flag was added.
My guess is that, in `ai_ship_destroy`, if the dead ship's goal object has already died in the same frame, the `goal_objnum` will be -1 when `ai_formation_object_recalculate_slotnums` is about to be called.
Adds the framework for loading and saving backgrounds with correct or incorrect angles. Backgrounds in FSO will all have fixed angles internally, and newly created backgrounds in FRED will have fixed angles, but existing mission files will have incorrect angles. The parser will determine whether the mission file contains fixed or unfixed angles and act accordingly. (Actually fixing the angles will be done in part 2.)
Helps us by also dumping the amount of data that has been processed from that packet so far.
Also, dump how much data we need to get through to finish the packet correctly.
1) Fix part of the lookup logic in `hud_get_default_gauge_index`
2) Add back part of the lookup that was removed in #4003
3) Use custom checks with the `default_hud_gauges` list
4) Add a clarification comment to `default_hud_gauges`
Fixes#4171
By specifying a base resolution in game_settings.tbl, subtitles can be scaled to the screen in the same way as HUD gauges. This can be used to prevent subtitles from appearing smaller at larger resolutions.
Depends on and is a follow-up to #4157.
* clean up documentation a bit
* use a more straightforward regex for slicing out page number
* use for loop instead of while loop
* Test workflow successes differently for release and nightly
* move tag_name definition up to before its used in validation block
* Add a hopefully more straightforward existance check for tag_name
What it says on the tin. This allows more precise positioning of subtitles, and a future PR will add the ability to scale them according to screen resolution.
This adds a type-safe TIMESTAMP, similar to UI_TIMESTAMP. Eventually all of the FSO codebase will be switched over to this new type. In the meantime, just the supernova code is switched over.
A bit of cleanup, refactoring, and bugfixing...
1) The supernova code now uses enums to represent states, and those state transitions now all happen in `supernova_process` instead of being scattered around.
2) Some state transition bugs were fixed - e.g. the HUD is now disabled when the camera cuts to the external view, instead of when the camera stops moving; and the particles start and the simulation stops when the comments say they do.
3) There is now a game_settings.tbl flag to make the HUD countdown timer reach zero when the supernova hits, instead of reaching 5s. This only affects the HUD display; actual timing is not changed.
4) Don't apply lightshafts if the supernova glare is in effect - partial fix for #4152.
The FS1 behavior for converting wingmen messages to Command messages specifically applies to in-mission messages with multiple files corresponding to the possible senders. There is no situation where a built-in message needs to be converted, and in fact built-in messages can't usually be substituted because most built-in messages are distinct. This commit adds an extra check for that case. It has the effect of "fixing" #4149 even though that isn't really a bug.
When the RGB values of the legacy `show-subtitle` were fixed (#2578) the `width` argument was inadvertently deleted, resulting in an off-by-one error for all subsequent arguments. This fixes that.
Same arrival warp when docked, same departure warp when docked, and associated changes to FRED, set-arrival-info, and set-departure-info.
Also fixes the nav-carry flag to properly save when a mission is saved. Previously that flag would always be cleared.
Implements feature from #4095.
* Implemented ship.checkVisibility for luaAPI, sharing logic with sexp isVisible. Made new function for the shared functionality
* Fixed a viewer-viewed mixup
The check to not show `-destroyed` submodels is within `model_replicate_submodel_instance`, and that was only called for moveable submodels in the lab. This PR runs it for all submodels now. Tested and fix works as expected.
Several careful tweaks to improve handling of distance as measured on the HUD.
1) Use `Player_ai->current_target_distance` for rendered HUD gauges which display the distance, because the distance is calculated in `hud_update_frame` (which is called from `game_simulation_frame`) and is used for a couple of these gauges already. This change makes it all consistent.
1b) Some gauges which depend on distance but do not actually display it (e.g. the lead indicator) still calculate their distance immediately before using it. I didn't change these because a) the calculation is still correct, even if redundant, and b) there is a small possibility of `hud_update_frame` changing the target after the distance is calculated, so these gauges are guaranteed to have the correct calculation.
2) On discovering that the `evaluate_ship_as_closest_target` specifically switched from bbox-distance to center-distance, I changed all "target closest X" functions to consistently evaluate center-distance. I believe Volition did this to prioritize small fighters when dogfighting next to large ships.
3) Moved `hud_target_change_check` below the computation of `Player_ai->current_target_distance` because it uses the computed distance to determine the acceleration trend. This way it will use the distance of the current frame, not the previous one.
4) Minor move of a `Target_static_looping` check into `hud_target_change_check` because it made sense.
Events with background colors had their highlighting behavior disabled, because since an event has to be selected to add a color, users thought the color adding didn't work. However it was pointed out in #4129 that users still would like to know which event is selected. So this PR attempts to solve the problem by drawing a border over a selected event if that event has a background color.
* 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
Two enhancements:
1) Allow the SEXP help description to take up multiple lines. Since the parser did not originally use `stuff_string` with `F_MULTITEXT`, this required some creative parsing.
2) Generate the text for minimum and maximum number of arguments.
Output a Campaign with ordered cmissions to a file,
like it is read.
This version does not depend on any FRED model/
implementation.
(cherry picked from commit c8aa141295de9f45813bc2bb762f3f2290ebad6d)
* 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.
This is useful because certain backgrounds (such as a nebula) will make it hard to see the default navpoint color. Also this means that different navpoints can now have different colors.
* 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
Since the campaign type determines the compatible
missions, changing it would require invalidating
the mission list. So I'm restricting it to being
set on campaign creation.
Unlike FRED, I'm using a checked list of all
missions, not a simple list of the unused ones.
I'm showing uneditable / packaged missions
in yellow, missing / unloadable missions in red.
Also keeping missions loaded.
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.
message(STATUS"Using ccache for C compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_C_COMPILER_LAUNCHER${CCACHE_PROGRAM})
endif()
if(NOTCMAKE_CXX_COMPILER_LAUNCHER)
message(STATUS"Using ccache for C++ compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_CXX_COMPILER_LAUNCHER${CCACHE_PROGRAM})
endif()
if(APPLE)
set(FSO_LANGUAGES${FSO_LANGUAGES}OBJCOBJCXX)
endif()
PROJECT(FS2_OpenLANGUAGES${FSO_LANGUAGES})
IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_EXE_DIR"IMPORT_EXE_DIR-NOTFOUND"CACHEFILEPATH"Required for a cross compiling build, point to binary directory of a cmake build for the real OS")
> Tired of having your Menus in FSO be at a resolution of potato? Use SCPUI to have them rendered from Fake-HTML to the actual screensize as opposed to a prebuilt graphics!
> Tired of being limited to whatever people in the SCP hardcoded in for buttons? Use SCPUI to define buttons and all other manner of shenanigans as Lua-code just as you like.
> Tired of needing to replace a bajillion interface graphics to reskin FSO? Use SCPUI, and especially Mjn's existing collection of Lua, CSS, Fake-HTML and images, and you only need to replace about 250 graphics.
> LuaAI allows scripters to add a new AI Goal (like ai-chase) that will run script instead of internal logic.
> Adding a Lua AI section in a -sexp.tbm and a few functions to a corresponding -sct.tbm to define the AI logic in certain conditions. More documentation on these functions is available in the LuaAISEXP-Object of the Scripting Docs.
</details>
<details><summary>AI:</summary>
-`$AI ignores aspect lock for leading:` Flag, which lets AI continue to lead their target while performing an Aspect Lock
</details>
<details><summary>Animation: </summary>
-`pause on reverse` Flag
</details>
<details><summary>Controls: </summary>
- Handle international keyboard layouts
- Re-Add `-joy-info` command line flag, for slightly quicker Joystick GUID retrieval
- Add `-controlconfig_tbl` command line flag to print out a template controlconfigdefaults.tbl
</details>
<details><summary>FRED: </summary>
- Support the full number of nebula poofs using a multi-select list
- Add the ability to edit nebula fog colors, since that previously was not part of the FRED UI
- Flags `same-arrival-warp-when-docked` and `same-departure-warp-when-docked` to allow docked ships to still use custom warp parameters
- Allow highlighting custom-colored events by drawing a border on them
- Can now rotate objects relative to other objects in the Object Editor
- Dialog to calculate relative distance and orientation between ships
- Flag "Point using uvec" to point ships while incorporating the ship's uvec
-`ai-attackable-if-no-collide` flag, which prevents turrets from ignoring a target with `no_collide`
</details>
<details><summary>QtFRED: </summary>
- Reinforcements Dialog
- Implemented Replace Data for Number and String
- Texture Replacement Dialog
- TBL Viewer in the Ship Editor
</details>
<details><summary>Graphics: </summary>
- Allow particles to use a random chance for spawning through the `+Chance` parameter
- Command-line parameter `-fov_cockpit` which allows setting an FoV for the cockpit model separately from the viewport FoV. This allows using custom FoVs without distorting the cockpit
- Allow user to export environment map to a PNG from the F3 Lab by pressing M
- Weapon lights: Configurable lighting data for weapons, both on a per-weapon basis and globally via lighting profiles
- Implemented debug sphere queuing and rendering
</details>
<details><summary>Localization: </summary>
- Make strings for Match Speed Indicator, Glide Indicator, and Afterburner Indicator translateable
</details>
<details><summary>Modding: </summary>
-`game_settings.tbl` setting `$Supernova hits at zero:`, which causes Supernovae to hit when the timer gets to 0, instead of the default of hitting 5 seconds before the time is up
-`game_settings.tbl` settings `$Show-subtitle uses pixels:` and `$Show-subtitle base resolution:`, which can be used in conjunction to scale subtitles
-`game_settings.tbl` setting `$Always warn player about unbound keys used in Directives Gauge:`, to show such warning to players when needed (without it these warnings only apply to Training Missions)
- Ship flags `fail-sound-locked-primary` and `fail-sound-locked-secondary` to allow the firing fail sound to play if the player tries to fire weapons that are locked
- Subsystem Flag "hide turret from loadout stats"
- Allow weapon to override turret name with `$Turret Name:`
</details>
<details><summary>Multiplayer: </summary>
- Save PXO stats to local pilot file
</details>
<details><summary>Performance: </summary>
- Preload subspace tunnel if the `mission-set-subspace` SEXP is used in the mission
</details>
<details><summary>SEXPs: </summary>
-`cancel-future-waves`, for stopping wings that still had waves queued from spawning
- Added optional flag to `show-subtitle-text` and `show-subtitle-image` to not change the subtitle aspect ratio
-`set-nav-color` and `set-nav-visited-color`, which allows setting custom colors to Navpoints in a mission
</details>
<details><summary>Scripting: </summary>
- Support for decals (see `decaldefinition` in the Scripting documentation)
- Missile list iterator: `mn.getMissileList()`
- Campaign Start hook: `On Campaign Begin`
- Player Loaded hook: `On Player Loaded`
- Added a few functions to get information on HUD gauges (check `HudGauge` in the Scripting documentation)
- Function `ship.checkVisibility` which checks if a ship can appear on the viewer's radar
- Function `hu.flashTargetBox` which causes the target box to flash
- Function `hu.getTargetDistance` to return the distance to target as reported by the HUD
- Function `mn.hasLineOfSight` which checks if one point has line of sight to the other
- Function `mn.getLineOfSightFirstIntersect` which checks for line of sight and returns the distance of the first interruption if not
- Variable `gr.CurrentResizeMode`, which can get or set the scaling mode to be used by the `gr.*` drawing methods
- Function `gr.draw3dLine`, which draws a line in space between two points
- Allow SCPUI to run `$On Briefing Stage:` hooks
- New bindings to allow proper hooking into control actions based on the control's enumeration name
- Allow scripted controls to override hardcoded functionality
- Fennel script support
- Lua BitOp 1.0.2 extension library, allowing the usage of bit operations
</details>
<details><summary>Technical: </summary>
- Class encapsulation for Volition's linked list
- Improve a debug console message to be more informative
- Type-safe `TIMESTAMP` class
- Add `timestamp_since()` function
- Add methods to compare timestamps, calculate deltas from an existing timestamp and a number of milliseconds, and to calculate deltas between timestamps
- Create a command line option for logging data packets
- Add more information to Multi-related debug logging
- Enable Doxygen for QTFred
- Set up Mac builds on CI, allowing builds to be published automatically for Mac
- Add some logging to `waitAsync`
</details>
### Changed
<details><summary>Game: </summary>
- Only display one popup when the player gets to the main hall
- Allow an unlimited number of ship flags to be parsed at once
</details>
<details><summary>AI: </summary>
- Improve Player Orders to allow for a nearly unlimited number of player orders, as opposed to the 32 before
- Update `ai_turn_towards_vector` to use a target velocity for banking
</details>
<details><summary>Audio: </summary>
- Allow unlimited soundtracks and spooled music (Previously limited to 30 and 50 respectively)
- Allow unlimited sound effects
- Dynamically set the maximum number of audio channels based on how many the user's system can support
</details>
<details><summary>FRED: </summary>
- CTRL+V is now add-paste (used to be CTRL+P)
- CTRL+SHIFT+V is now overwrite-paste (used to be CTRL+V)
- Replace `Always_show_goals` with `Toggle_showing_goals` which toggles whether the goals are shown, and works in any mission (instead of only Training Missions)
- No longer disable icon dropdowns for models that have their own icons
- No longer change the ship class when the icon type is a special popup
- Make the number of player orders FRED can handle dynamic
- Restore original Error Checking behavior where the function would exit after one check (for consistency)
- Exclude player ships from Error Checking for ships in a wing sharing the same orders
- Split "No subsystems found" and "Not all subsystems have a record in ships.tbl" warnings into two different warning flags
</details>
<details><summary>Graphics: </summary>
- Improved light attenuation to look more real
- Increase POF vertex limit, allowing up to `2^32 - 1` vertices to be used by a single subobject
</details>
<details><summary>Performance: </summary>
- Delay `ai_new_maybe_reposition_attack_subsys` to only run once a second. Before this change, it could take around 13% of runtime in crowded missions
- Cached subsystem indexing, speeding up subsystem lookups, which run for multiple ships, multiple times per frame
</details>
<details><summary>Scripting: </summary>
- Enhance help text for Lua SEXPs
- Converted the following Lua Hooks to the new format to add documentation: `On Death`, `On Game Init`, `On Ship Collision`
</details>
<details><summary>Technical: </summary>
- Turn `insertion_sort` into a templated function that uses assignment
- CMake: Update `PREBUILT_VERSION_NAME` to latest (mac libs)
- Optimized space used in the new POF version
- Cleanup model code
- Cleanup beam light functions by consolidating some duplicated code and removing unreachable logic
- Cleanup wing wave code
- Move special parsing functions into new `parsehi.cpp` and `parsehi.h` files
- Actually clear delayed SSM parsing data when it's no longer needed
- Allow C++ to interact more with LuaTables, allowing it to extract userdata like objects or ships from them
- Use `SCP_string` for constructing multi/event log lines
- Replace `+Orders Accepted:` Bitfield with flag list
- Handle deprecated command line flags programmatically, avoiding lots of code duplication
- Set up debug_filter.cfg to have default filters that can be turned off
</details>
### Removed
<details><summary>FRED: </summary>
- Remove the `Allow Daisy-Chained Docking` mission flag
- Remove "Delete Item" from the right-click menu in the Event Editor
</details>
<details><summary>Technical: </summary>
- Remove light filtering data which didn't work and increased code complexity
- Remove a pointless assert that checked if `SEXP_NODE_INCREMENT` (a define, set at 250) was greater than zero
</details>
### Fixed
<details><summary>Game: </summary>
- Missing whitespace in credits
- Stopped destroyed submodels from showing in Techroom
- Prevent a crash when an object dies in the same frame as their goal
- Always record primary bank ammo capacity during ship creation, preventing situations where a ballistic weapon would accidentally be set to zero ammo
- Properly remove ships from the Techroom when they're not in the Tech Database
- Load the correct Techroom data after a Tech Database Reset
- Don't tick Supernova timer while the game is paused
- Make `set-camera-facing` use default identity orientation when the `$Use host orientation` flag is active and no host is present
- When a hotkey text replacement string refers to an unbound control, use the name of the binding instead of "none"
- Fix usage of default tech database flags
- Prevent a crash in the loadout screen with a weapons-locked ship
- Fix two crashes in the F3 lab
- End the campaign properly when a mission is skipped, preventing crashing in some situations
- Prevent a crash when a message is sent from an invalid source
- Prevent a broken campaign state if the player quits the game from the options menu during the debriefing
- Add some checks before converting a message to Command
- Prevent accidentally skipping cutscenes caused by hitting the spacebar during a loading screen
- Fixed an issue where ships would start with the wrong hull values in Red Alert missions
</details>
<details><summary>AI: </summary>
- Fix turret swarm weapons by removing a few checks that are no longer valid
- Fix a timing bug that would sometimes prevent music from being initialized when re-playing a mission
- Check all possible extensions for audio files
</details>
<details><summary>Controls: </summary>
- Flush the mouse state after toggling between `Use_mouse_to_fly` states, preventing situations where a stale mouse state would be used
- Fix a conflict between Free Look View controls and directional thrust controls
</details>
<details><summary>FRED: </summary>
- Prevent Ship Select Dialog from crashing if there are too many IFFs
- Support saving nebula fog colors
- Properly save `nav-carry-status` flag
- Don't treat a bare `<argument>` as an error
- Prevent adding duplicated variables and display an error to the user when they try
- Clean up some parse problems
- Fix assignment of alt-name when using the hash
- Guard against off-by-one errors in `replace_one` and `replace_all`
- Improve error checking of campaign loop branches
- Improve error reporting for bad SEXP nodes
- Prevent a crash with paste/add-paste when the clipboard was empty
- Prevent rounding/conversion issues that caused FRED to think an angle or position was modified when it wasn't
- Skip absent ships or wings when running `clear-goals`, instead of stopping the whole operation
</details>
<details><summary>Graphics: </summary>
- Disable Lightshafts while the Supernova glare effect is active. This partial fix ensures the glare shows up with the correct brightness
- Update and correctly load environment maps in F3 Lab
- Correctly set textures and Team Colors with `change-ship-class`
- Fixes Team Colors not working with `show-ship`
- Correct positioning and angles for background bitmaps and suns
- Clean up ship arrival and departure effects
- Fix clearing a skybox model when it isn't the mission default
- Fix an assertion with Fireball LODs which would wrongly trigger if the number of LODs was the same as the maximum
</details>
<details><summary>HUD: </summary>
- Make HUD Target distance consistent
- Fix a crash with scripted HUDs
- Correctly update RTT Cockpit Gauges with `change-ship-class`
- Ignore HUD brackets with a size of zero or less (instead of just crashing)
- Squad menu wasn't scrolling properly with PageDown in some cases
- Fix issues with loading of hud config presets
- Fix parsing issues with HUD color presets
- Continue parsing remaining gauges if one isn't found
- Use translated strings both when saving and loading
- Fix an issue where a target's orders would be displayed wrongly in the target box
- Fix asteroid brackets disappearing or displaying wrong values
</details>
<details><summary>Modding: </summary>
- Delay processing `$Player Weapon Precedence:` until after parsing, avoiding ships starting with the wrong weapons in some situations
- Make the `$Player Weapon Precedence:` list actually give precedence
- Empty `+Orders Accepted List:` entries were causing the ship to accept the default orders, instead of no orders as would be correct
- Show a Warning if a turret submodel is not an immediate child of the base object and handle it as a single-part object to prevent a crash
</details>
<details><summary>Multiplayer: </summary>
- Limit client collisions to prevent bugs, such as flinging players with high pings who collided multiple times between packet updates
- Fix multiple timestamp issues
- Multi messaging and multi pause screen
- Make sure maintenance stuff (pings, voice, file xfer, etc.) isn't affected by pausing or time compression
- Sync issues caused by options menu and screenshots
- Prevent an error with long messages in PXO Chat by using proper buffer size
- Fix some issues with Multiplayer SEXPs
- Try to handle incompatible sexp packets better
- Fix operator name issue with debug messages
- Enable the new show-subtitle-text options
- Improve interpolation, fixing the jerkiness that used to occur when the interpolation code basically guessed the timing on when packets were coming in
- Fix rollback primary collisions, vastly improving accuracy on moving targets even at high pings
- Fix the standalone ship being added to ship list
- Stop non-printable keys adding text to multi message buffer
- Prevent the standalone from crashing if a player tried to switch secondaries in a ship that doesn't have secondaries
- Fix a standalone crash from disabled uniform buffer manager
- Prevent a crash related to Observer-type players
- Fix network issues on MacOS
</details>
<details><summary>Scripting: </summary>
- Make hook conditions consistent and handle combinations that didn't work properly before
- Fix `maybePlayCutscene` arguments
- Add `isActive` checks for new-style script hooks
- Sync the two `VIRTVAR`s for Orientation in subsystems and submodel instances, which behaved in different ways
- Fixed a few timing and framerate related issues for playing movies via script
- Ensure the Lua interpreter has enough space in its stack, and allow reserving more space if necessary
- Fixed an memory leak in the Lua interpreter caused by string-eval sexps, which never cleaned up the generated code
</details>
<details><summary>SEXPs: </summary>
- Avoid setting .rest for `Locked_sexp_true/false` with malformed SEXPs
- Fix some memory management problems in the `for-*` operators, avoiding a memory leak
- Fix crash when removing form-on-wing order with `remove-goal`
- Fix `show-subtitle` SEXP which was missing the `width` argument
- Reset volumes changed via `adjust-audio-volume` when the mission closes
- Prevent too many dynamic SEXPs from breaking the SEXP system
</details>
<details><summary>Technical: </summary>
- Check if index is valid before accessing `Weapon_info`, preventing CTDs under certain conditions
- When `weapon_create` was called while `MAX_WEAPONS` was reached, the previous algorithm didn't achieve desired results, and simply locked up the game. Instead, we now simply won't allow a new weapon to be created in such condition
- Refactored Supernova code and fixed some state transition issues in it
- Prevent crashes in the event of a subsystem mismatch during `change_ship_type`
- Change include order to fix compilation of unit tests on Mac
- Patch freeing of SEXP nodes, preventing a crash in certain conditions
- Fix a memory leak in model code
- Fix a crash in the Ship Creation code if a ship's name was exactly the maximum allowed length
- Removed vestigial bit-depth asserts for aabitmaps, preventing crashes with certain image types
- Prevent a crash when Escort Priority was parsed for a ship not present in the Escort List
- Fix a bunch of graphics functions to respect GR_STUB, preventing problems in standalone server
- Clean up line endings in several files (replaced CRLF with LF basically everywhere)
- Fixed a timestamp issue which helps lay the groundwork to add In-Game Joining to multiplayer
- Prevent pilot and campaign files from having invalid values, by clamping them within the expected ranges when saving and loading
- Also warn the player if such an invalid value was detected, telling them which setting had the wrong value and what it was reset to
- Try to avoid assertions by preventing invalid types from being handled by `obj_team()`
- Shut down the SEXP system before the Scripting system, otherwise a crash could happen if the SEXP system held references to Lua
- Full type information output for Lua documentation. Very useful for writing Lua scripts.
- A new -weaponspew command-line option for printing MediaVP-style statistics, plus a weapon comparison spreadsheet, to the debug log.
- Improved ship lookup behavior in SEXPs for improved performance.
- BPTC/BC7 texture compression support
- Refactoring and new features for the ship lab.
- Missile multi-lock. It's finally in an official build!
- Enhancements to the model code in preparation for cool features in 21.2.
- IPv6 support for multiplayer
- A lot of general fixes for multiplayer.
### Deprecated
- Dropped support for Windows XP
- Scripting:
-`ba.getFrametime()`: The parameter value was used incorrectly inside the implementation. To avoid breaking existing scripts and to improve readability this has been split into `ba.getMissionFrametime()` and `ba.getRealFrametime()`.
-`gr.drawMonochromeImage()`: `gr.drawImage()` got a new parameter for drawing monochrome images and is more flexible in general so the monochrome variant is no longer needed.
- With this release we decided to drop the "`3.Major_revision.Minor_revision`" versioning scheme in favor of a year based scheme since the Major and Minor versions did not have much meaning anymore. Instead the scheme will now be "`<year>.<number that is incremented every release>.0`". The last 0 is still there because some of our systems expect that. It will be gone at some point.
@@ -25,6 +637,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Refactored bitmap slot handling and removed the fixed upper limit on the number of bitmaps. No more bmpman corruption!
- Support for APNG animations: [APNG](https://en.wikipedia.org/wiki/APNG) is a variant of the established PNG format which allows to store animations instead of single frames in a PNG file. This change allows to use these animation files in FSO which significantly improves usability for modders since they no longer have to store all individual frames as separate images.
@@ -49,6 +662,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
"""! Retrieves the version string from version_override.cmake (and version.cmake)
@param[in] `date_version` Date this build is published for release
@param[in] `tag_name` Tag of this release, used to determine if release, rc, or nightly
@return If release: `FSO_VERSION_MAJOR.FSO_VERSION_MINOR.FSO_VERSION_BUILD`
@return If rc: `FSO_VERSION_MAJOR.FSO_VERSION_MINOR.FSO_VERSION_BUILD-FSO_VERSION_REVISION_STR`
@return If nightly: `FSO_VERSION_MAJOR.FSO_VERSION_MINOR.FSO_VERSION_BUILD-FSO_VERSION_REVISION_STR` (uses both version_override.cmake and version.cmake)
@note This is the version used to identify in Nebula and the forums. version_override.cmake is used for the builds
made by CI tools and version.cmake is used for builds made by devs.
print("ERROR: Couldn't find tag %s in repo (git show-ref)!"%tag_name)
sys.exit(1)
# Populate version and date
date=datetime.now()##!< current date
version=get_source_version(date.strftime(DATEFORMAT_VERSION),tag_name)##!< form full version string
# find the previous tag release (used by nightly)
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! (git for-each-ref)"%tag_name)
sys.exit(1)
if(sys.argv[1]=="nightly")and(notprevious_tag):
# couldn't find previous tag, bail
print("ERROR: Could not find a previous tag for %s!"%tag_name)
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. Any features listed under Deprecations 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://knossosnet.github.io/Knossos-Release-Page/]Knossos.NET[/url], an integrated solution for downloading and launching mods.
[hidden=Alternative Launchers]
Cross-platform: [url=https://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (legacy project for a unified launcher)
[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/builds/Launcher55g.zip]Launcher 5.5g[/url] ([url=https://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=https://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=https://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=https://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=https://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=https://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://knossosnet.github.io/Knossos-Release-Page/]Knossos.NET[/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=https://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.
These builds are not signed and so by default will fail to launch. To run them simply right-click on the app, click open, then click open again on the security confirmation dialog. You should only have to do this once for each app.
If running the game through Knossos or Knossos.NET this step should not be necessary.
[size=8pt][color=red][b]NOTE:[/b][/color] macOS builds currently have limited support and may exhibit issues not present on other platforms.[/size]
[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.
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
Loaded 100 of 2055 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.