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.
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.
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).
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.
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.
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
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)
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.
> 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
Deprecations are a mechanism in FSO where a certain feature or aspect of the engine has changed or is no longer supported. Since this would normally break existing mods we have the mod table feature "[tt]$Target Version:[/tt]" with which a mod can specify what version of FSO it was developed with. The features listed above will be removed or changed when the target version of a mod is at least the version released in this post.
[b]All platforms: [/b] For every day use, we recommend [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url], an integrated solution for downloading and launching mods.
[hidden=Alternative Launchers]
Cross-platform: [url=http://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (ongoing project for a unified launcher, you should upgrade to the latest RC/test build if you have not yet)
Cross-platform: [url=https://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (ongoing project for a unified launcher, you should upgrade to the latest RC/test build if you have not yet)
[b]Important:[/b] For best compatibility with FSO 3.8 and later you should use at least wxLauncher 0.12.
Windows: [url=http://scp.fsmods.net/files/Launcher55g.zip]Launcher 5.5g[/url] ([url=http://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=http://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=http://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=http://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=http://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Graphics_Settings]by hand[/url] or whatever you can figure out.[/hidden]
Windows: [url=http://scp.fsmods.net/builds/Launcher55g.zip]Launcher 5.5g[/url] ([url=http://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=http://www.hard-light.net/forums/index.php?topic=65628.0]Your answer is in this topic.[/url]
[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://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url] and it will download the best build specifically for your PC!
[/hidden]
@@ -48,7 +48,7 @@ Don't want to deal with that? Use [url=https://www.hard-light.net/forums/index.p
[size=8pt]Compiled with Ubuntu 16.04 LTS 64-bit, GCC 5[/size]
${build(groups["Linux"].mainFile)}
These builds use a mechanism called [url=http://appimage.org/]AppImage[/url] which should allow these builds to run on most Linux distributions. However, we recommend that you compile your own builds which will result in less issues.
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.
@@ -59,10 +59,10 @@ Alternatively, if there is a package in your software repository then you should
[size=12pt]Important!![/size]
An external DLL is required for FSO to use TrackIR functions. The following DLL is simply unpacked in to your main FreeSpace2 root dir.
[li][url=https://github.com/scp-fs2open/fs2open.github.com/issues]Github issues[/url] and [url=https://github.com/scp-fs2open/fs2open.github.com/pulls]pending pull requests[/url][/li]
[li]See the list of [url=http://scp.indiegames.us/mantis/search.php?project_id=1&status_id%5B%5D=10&status_id%5B%5D=20&status_id%5B%5D=30&status_id%5B%5D=40&status_id%5B%5D=50&priority_id%5B%5D=40&priority_id%5B%5D=50&priority_id%5B%5D=60&sticky_issues=on&sortby=last_updated&dir=DESC&per_page=200&hide_status_id=-2]Fix for next release[/url] bugs - mark a bug as an elevated priority (high, urgent, immediate) to get it included in that filter.[/li]
[li]See the list of [url=https://github.com/scp-fs2open/fs2open.github.com/projects/8]bugs ranked by priority[/url][/li]
if(!(En_objp->flags[Object::Object_Flags::Protected])||((aip->goals[0].ai_mode&(AI_GOAL_DISABLE_SHIP|AI_GOAL_DISARM_SHIP))&&swip->wi_flags[Weapon::Info_Flags::Puncture])){//override lockdown on protected ships when using anti subsystem weapons - Valathil
@@ -137,6 +140,41 @@ const char *Ai_goal_text(int goal, int submode)
returnnullptr;
}
/**
* Reset all fields to their uninitialized defaults. But if this is being called before adding a new goal, the function will set the correct signature and time.
* Similarly the added mode, submode, and type can be assigned.
// Don't free up memory for user defined bitmaps, since
// BmpMan isn't the one in charge of allocating/deallocing them.
if(be->type==BM_TYPE_USER){
if(be->type==BM_TYPE_USER||be->type==BM_TYPE_3D){
#ifdef BMPMAN_NDEBUG
if(be->data_size!=0)
bm_texture_ram-=be->data_size;
@@ -891,6 +945,27 @@ int bm_get_info(int handle, int *w, int * h, ushort* flags, int *nframes, int *f
}
}
intbm_get_depth(inthandle,int*depth){
bitmap*bmp;
if(!bm_inited)return-1;
autoentry=bm_get_entry(handle);
Assertion(entry->handle==handle,"Invalid bitmap handle %d passed to bm_get_info().\nThis might be due to an invalid animation somewhere else.\n",handle);// INVALID BITMAP HANDLE!
if(entry->type!=BM_TYPE_3D){
*depth=0;
return-1;
}
bmp=&(entry->bm);
*depth=bmp->d;
returnhandle;
}
intbm_get_num_mipmaps(intnum){
autoentry=bm_get_entry(num);
@@ -1406,6 +1481,10 @@ static int bm_load_image_data(int handle, int bpp, ushort flags, bool nodebug)
bm_lock_user(handle,bs,bmp,true_bpp,flags);
break;
caseBM_TYPE_3D:
bm_lock_user(handle,bs,bmp,true_bpp,flags,false);
break;
default:
Warning(LOCATION,"Unsupported type in bm_lock -- %d\n",c_type);
return-1;
@@ -1516,10 +1595,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
// MAX_FILENAME_LEN-10 == 5 character frame designator plus '.' plus 3 letter ext plus NULL terminator
// we only check for -5 here since the filename should already have the extension on it, and it must have passed the previous check
if(strlen(filename)>MAX_FILENAME_LEN-5){
Warning(LOCATION,"Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n",filename,MAX_FILENAME_LEN-10);
if(img_cfp!=nullptr)
cfclose(img_cfp);
return-1;
// Don't check PNGs yet, because a PNG could be a regular non-animated image
if(type!=BM_TYPE_PNG){
Warning(LOCATION,"Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n",filename,MAX_FILENAME_LEN-10);
if(img_cfp!=nullptr)
cfclose(img_cfp);
return-1;
}
}
// it's an effect file, any readable image type with eff being txt
@@ -1530,7 +1612,7 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
cfclose(img_cfp);
return-1;
}else{
mprintf(("BMPMAN: Found EFF (%s) with %d frames at %d fps.\n",filename,anim_frames,anim_fps));
nprintf(("BmpMan","BMPMAN: Found EFF (%s) with %d frames at %d fps.\n",filename,anim_frames,anim_fps));
}
if(anim_fps==0){
Error(LOCATION,"animation (%s) has invalid fps of 0, fix this!",filename);
@@ -1599,10 +1681,18 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
throwe;
}
else{
mprintf(("Failed to load apng: %s\n",e.what()));
nprintf(("apng","Failed to load apng: %s\n",e.what()));
return-1;
}
}
// Now do the same filename length check that was deferred for PNGs above
if(strlen(filename)>MAX_FILENAME_LEN-5){
Warning(LOCATION,"Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n",filename,MAX_FILENAME_LEN-10);
{"-deferred_cockpit","Enable Deferred Lighting for Cockpits",true,EASY_ALL_ON|EASY_HI_MEM_ON,EASY_DEFAULT|EASY_HI_MEM_OFF,"Graphics","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-deferred_cockpit"},
//flag launcher text FSO on_flags off_flags category reference URL
//flag launcher text FSO on_flags off_flags category reference URL
{"-fps","Show frames per second on HUD",false,0,EASY_DEFAULT,"HUD","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps",},
{"-dualscanlines","Add another pair of scanning lines",true,0,EASY_DEFAULT,"HUD","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines",},
{"-targetinfo","Enable info next to target",true,0,EASY_DEFAULT,"HUD","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-targetinfo",},
{"-ballistic_gauge","Enable analog ballistic ammo gauge",true,0,EASY_DEFAULT,"HUD","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ballistic_gauge",},
//flag launcher text FSO on_flags off_flags category reference URL
{"-window","Run in window",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-window",},
{"-fullscreen_window","Run in fullscreen window",false,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fullscreen_window",},
{"-stretch_menu","Stretch interface to fill screen",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stretch_menu",},
{"-noscalevid","Disable scale-to-window for movies",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid",},
{"-ship_choice_3d","Use 3D models for ship selection",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ship_choice_3d",},
{"-weapon_choice_3d","Use 3D models for weapon selection",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-weapon_choice_3d",},
{"-3dwarp","Enable 3D warp",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp",},
{"-warp_flash","Enable flash upon warp",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash",},
//flag launcher text FSO on_flags off_flags category reference URL
{"-portable_mode","Store config in portable location",false,0,EASY_DEFAULT,"Launcher","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-portable_mode",},
//flag launcher text FSO on_flags off_flags category reference URL
{"-standalone","Run as standalone server",false,0,EASY_DEFAULT,"Multiplayer","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone",},
{"-startgame","Skip mainhall and start hosting",false,0,EASY_DEFAULT,"Multiplayer","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame",},
{"-closed","Start hosted server as closed",false,0,EASY_DEFAULT,"Multiplayer","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-closed",},
{"-gateway_ip","Set gateway IP address",false,0,EASY_DEFAULT,"Multiplayer","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gateway_ip",},
//flag launcher text FSO on_flags off_flags category reference URL
{"-no_set_gamma","Disable setting of gamma",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_set_gamma",},
{"-nomovies","Disable video playback",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomovies",},
{"-prefer_ipv4","Prefer IPv4 DNS lookups",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv4",},
{"-prefer_ipv6","Prefer IPv6 DNS lookups",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv6",},
{"-log_multi_packet","Log multi packet types ",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-log_multi_packet",},
{"-no_bsp_align","Disable pof BSP data alignment",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_bsp_align",},
#ifdef WIN32
{"-fix_registry","Use a different registry path",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fix_registry",},
{"-bmpmanusage","Show how many BMPMAN slots are in use",false,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-bmpmanusage",},
{"-pos","Show position of camera",false,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos",},
{"-stdout_log","Output log file to stdout",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stdout_log",},
{"-slow_frames_ok","Don't adjust timestamps for slow frames",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-slow_frames_ok",},
{"-imgui_debug","Show imgui debug/demo window in the lab",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-imgui_debug",},
cmdline_parmdualscanlines_arg("-dualscanlines",NULL,AT_NONE);// Cmdline_dualscanlines -- Change to phreaks options including new targeting code
cmdline_parmdualscanlines_arg("-dualscanlines",NULL,AT_NONE);// Cmdline_dualscanlines -- Change to phreaks options including new targeting code; semi-deprecated but still functional
cmdline_parmtargetinfo_arg("-targetinfo",NULL,AT_NONE);// Cmdline_targetinfo -- Adds ship name/class to right of target box -C
cmdline_parmrearm_timer_arg("-rearm_timer",NULL,AT_NONE);// Cmdline_rearm_timer; semi-deprecated but still functional-Mjn
cmdline_parmtargetinfo_arg("-targetinfo",NULL,AT_NONE);// Cmdline_targetinfo -- Adds ship name/class to right of target box -C; semi-deprecated but still functional-Mjn
//The cumulative one minus alpha value of the nebula. Corresponds to the multiplier of the current step when additively drawing to a fragment for which the steps closer to the camera are already drawn.
float cumOMAlpha = 1;
//The cumulative distance already travelled through the nebula.
float cumnebdist = 0;
//The color of the current fragment
vec3 cumcolor = vec3(0, 0, 0);
//While not perfectly accurate, it's sufficient to assume all gradients for the 3d texture lookups are identical
//All the following computations are just required if we have a stepcoloralpha that is non-zero.
if(stepcolor_alpha > 0.01)
{
//Noise - Technically, we need to do edge noise here but I'm not very happy with how it turned out. The cloud needs to be "eroded" by the noise as per the SIGGRAPH talk, but it's unclear as to how that can be achieved.
//So for now, don't do edge noise. noise_volume_tex.ba are still reserved for noise data for edge erosion.
//Diffuse
#ifdef NOISE
//Mix the actual nebula color with the noise color depending on the product of the noise channels multiplied with intensity, smooth-clamped from 0 to 1
Loaded 100 of 1029 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.