* add cockpit fov to in-game options and use a define for the default fov value for both fov options
* Add a controlling toggle option
* constexpr
* localization
In #5894, in the `add_dynamic_sexp` function in sexp_lookup.cpp, a call to `sexp->getHelpText()` was moved to the bottom of the function. Normally this would be fine, except that this occasion caused the `sexp` variable to be accessed after a `std::move`. The crash can be avoided by moving the last access of the `sexp` variable just a little bit earlier.
When waypoint start index and direction were added in #5698 / 42fc989 et seq., the `Fix_ai_path_order_bug` flag needed to be updated to account for those new options. This fixes that.
Fixes#6052.
Since the On Ship Collision hook can potentially be called twice, with the ships reversed, it is necessary for both parameters to have submodels specified. Otherwise +Override would not be able to handle both cases.
Followup to #6035.
* Add AI Flag to `align to target when guarding stationary ship`
When a ship is ordered to guard another ship that is stationary and not incredibly large, the AI will fly to a position then turn and face away from the targeted ship. This behavior is not ideal in various scenarios, including both blockade style formations and overall visuals.
The PR adds a flag that tells the AI to align to the target ship it is guarding once the AI has reached it's guarding position in this situation, which allows all the guarding ships to have the same orientation and look much better and work better for directional defenses.
Tested and works as expected. Also changed some `NULL` to `nullptr` in this function for cleanup.
* remove duplicate brackets
* convert multi team chat to use a struct/list setup
* use the correct array size define
* cleanup local vars & Asserts
* address feedback
* remove uncessary if
* multi pxo api
(cherry picked from commit 9af26da728a19b9d6c890968a314e8e56ecc1ddf)
* multi pxo help api
(cherry picked from commit f4df704576ddb648e9c486907b07ae172c859feb)
* minor fixes
* not extern
* break out chat message data into a table
* address some feedback
* return empty strings if not in multi
* use GetChannelByUser() instead
* once more with feeling
* correct documentation
Turn `Parse_names` into a vector and add SCP_string overloads of ship registry functions. Refactor calling code to use registry as appropriate. Remove an unused overload of `mission_parse_get_parse_object`.
* Add the submodel that was hit to the On Ship Collision scripting hook. (This will only be non-nil if the ship was the "heavy object".)
* Add a `getModel()` function to the scripted submodel object.
* Fix some incorrect documentation in `OnShipCollision`.
* Expose NoCollide and NoCollideThisOnly as virtual variables for submodels
* Allow submodels to be optionally specified in object:checkRayCollision
* Be sure to calculate ship-to-ship hit position before the override collision hook is called, in case the hook needs this value. (The other collision hooks already calculate the hit position before the override hook.)
- Set app name properly per Apple docs
- Use correct "FreeSpace Open" name
- Set version properly per Apple docs
- Add bundle identifier
- Update copyright date
- Remove localized strings since they are all English already
A design choice very early in FSO's scripting development established that invalid results return invalid objects. By using a game_settings.tbl flag, this allows invalid results to return nil instead.
* Fix CTD with HUD Preset Switching
After #5302 it was discoved that pressing the `Next` button in the HUD presets would cause a CTD.
Thanks for Lafiel for figuring this out
`If HC_current_file is HC_preset_filenames.size() - 1, then it'll oob on a vector access.`
Testing this PR fixes that crash.
* use static cast
* add extra ways to modify background elements in missions
This adds Lua API methods for getting suns and bitaps by index, as well as modifying their scale and position. This removes the need to completely add and remove a background element that only needs to be modified.
* big pruning of (int) casts
* Add control_info driver sources
* Properly deal with cockpits and their 'objnum's
* Add driven animation sets to weapons and cockpits
* enumify objnums
Several handle types in the scripting API used inheritance where composition would be more appropriate. This refactors those types, as well as removing the various handle types that were just aliases for `model_h`. These are just the C++-side types; all the Lua types remain as-is.
This also refactors `sound_h` to move the previous `isSoundValid` to `isValid` so that `ade_set_args` will work properly for sounds with the `Lua_API_returns_nil_instead_of_invalid_object` flag. The subclassing from `sound_entry_h` was removed and the "full validity check" was moved to `isValidWithEntry`. The Lua side remains unaffected, but additional documentation was added to clarify the usage.
Follow-up to #6009 and prerequisite to #6006 due to the `isValid` refactor for `sound_h`.
There was confusion in the lighting code between light indexes and sun indexes. These are usually the same, but not always. This makes several changes to fix light/sun handling.
1. Clarify the distinction between lights and suns and add a `sun_index` field
2. Add a flags field and assign the `dual_cone` boolean to it, as well as a new glare flag
3. Determine light glare by checking the light flag, not the sun (which never worked in the first place as the `stars_sun_has_glare` function checked bitmaps rather than suns)
* Create the ingame options game state
* Base working version of in-game options
* Cleanup + Optimization
* Localization pass
* more cleanup + documentation
* tooltips on option hover
* documentation and better inbounds check
* match case
* format strings instead of direct strings
* unused parameter
* address feedback
* localization id conflict with master
* Add this line back in
* pass the new option flags as well
* resolve xstr id conflict
There was an extra check during ship class parsing that prevented a ship class's type from being set if it had been set already. This dates back to commit 5f3a6ec7 and was added as a parsing safeguard rather than as part of any modular table checks. Since the parsing has changed, this extra check is no longer applicable. Removing the check allows a ship class with a different type to be created using an existing ship class as a template.
This rather insidious FRED bug was all down to an improper check for the current ship. It is possible for multiple objects of different types to be selected at the same time. If, for example, a waypoint and ship are selected, and the waypoint was selected first, the waypoint will be what `cur_object_index` refers to. Since the ship is the one and only ship selected, it will be what `single_ship` refers to. Therefore, to avoid flagging its own ship name as a duplicate, the loop should exclude the single ship, not the current object.
The bug can be reliably triggered by selecting a waypoint, then adding a ship to the selection, then switching the focus to another application and back to FRED. This finally squashes the bug.
This improves the ability of Lua to check for ship arrival status:
1. Deprecates the `isWarpingIn` function, which can be misleading, and replaces it with the equivalent `isWarpingStage1`
2. Adds an `isWarpingStage2` function to fill a gap in functionality
3. Adds an `isArrivingWarp` function (complementing the existing `isDepartingWarp` function) to cover both stage 1 and stage 2
In #2464, a somewhat hard-to-understand equation involving taking the modulo of a random number was replaced with a function that would do those calculations instead. The problem is that the function performed the *entire* formula, while the code it replaced was only operating on the *difference* between the two numbers. Fortunately, this is as easy to fix as changing a `+=` into just an `=`.
There were a few instances of `Random::next()` being called without ensuring its arguments couldn't trip an assertion. This should hopefully catch them all.
Before this commit, `IFF_COLOR_SELECTION`, `IFF_COLOR_MESSAGE`, and `IFF_COLOR_TAGGED` were hardcoded indices into the `Iff_colors` vector. This could cause problems if any of these three colors were set to the same RGB values (since `iff_init_color()` doesn't create a new entry if the color already exists in the vector), and if a modular table tried to change any of these colors nothing would happen (since it would just create a new entry in `Iff_colors` without doing anything to the hardcoded indices).
This commit instead changes the `#define`s into `extern int`s, and assigns the return value of `iff_init_color()` to those global variables upon parsing the special color values, meaning that any combination of the three can be set to the same color without causing issues, and modular tables can actually modify them.
Potential clutter from unused values in the `Iff_colors` vector is basically unchanged (technically slightly worse if a modular table overrides any of these special colors with a color that doesn't already exist in the vector), but should maybe be looked at in the future.
The general expectation is that model filenames can be specified as 'none' or '<none>' for no model, but as discovered by no tea, this was not consistent across the code base. For example, `$Model File: none` was handled as expected but `$External Model File: none` was not. This PR makes the handling consistent for all ship, weapon, and shockwave POF files, and also adds some extra checks when models are loaded.
1. Fix the item ID indexing on the popup submenus and make sure they correspond with the ship dropdown menu
2. Remove the "player start" popup menu option as it has very limited utility and was already removed in qtFRED
3. Reduce a bunch of casts by using more appropriate popup menu types
4. Actually place an object in the mission when one is chosen from the popup menu
Also:
1. Remove the `Default_player_model` variable as its use is redundant
2. Remove unused arguments of `create_player()`
The result of this special parsing should produce a mod string identical
to the string passed on the command line with the following exceptions:
directory name case, directory separators
Should address the following:
- no fundamental difference in modlist compared to Windows
- no errors or warnings that are not produced on Windows
- do not remove mods from list if missing
- verify mod directory is accessible and actually a directory
- do minimum amount of work to see if mod directory is valid
- fix bug with trainling slashes
Old Volition bug where the original directory is pushed onto a stack
before the chdir() call. If that call fails then the stack is left with
a used entry that won't be removed until restart and can cause the stack
to fill up. Now it's added only if the chdir() call succeeds.
Also take the opportunity to make Cfile_stack dynamic.
Change the casts used in the convenience #defines in floating.h. Since these #defines are used pretty widely, this should reduce the count of C-style casts in the codebase by quite a bit.
Also change the casts in floating.cpp while we're at it, and remove some obsolete or unused code.
Make sure all medal fields are properly assigned. In particular, if a modular -mdl.tbm is parsed, don't overwrite information from the base medals.tbl. Fixes a bug reported in Discord.
This fixes command briefing data apparently disappearing. The ui was not being properly initialized because model_changed was being called before the ui was initialized, leading to default values.
This also fixes a few other minor issues.
In #5649 / b6c0e8b, the ship registry was updated to take ship death rolls into account. There was one small wrinkle that it did not account for, however: SEXP operators that return numeric values had previously (i.e. before the introduction of the ship registry) checked the mission log for ship destruction, but after #5649 the EXITED status was not set until after the ship had completely exploded, resulting in certain SEXPs having their conditions slightly modified. The equivalent of checking the mission log for ship destruction is now checking the ship status for DEATH_ROLL, so it is necessary to make that change for the numeric SEXPs to behave as they did before.
The motivating result for all this is to fix SEXPs like `hits-left` firing after a ship has been destroyed but before it has finished exploding. This can be seen by loading the first non-training mission of FSPort and comparing the messages that are sent if you use cheats to kill Alpha 2.
SEXP helps should let the FREDder know whether a given ship argument
needs to be already in-mission for the SEXPression to operate. Update
the helps to include (ship needs to be in-mission) or (ship does not
need to be in-mission) or other relevant helpful information.
Check the filenames used to initialize HUD gauges and mark the gauge as hi-res if the filename starts with 2_. Also add a script method to return this value.
Additionally, make accessor methods `const`.
Since its creation, the `is-in-mission` sexp operator has only checked for ships. But mission designers might assume this also works for wings, leading to a situation where the sexp always returns false because no ship can have the same name as a wing. Fortunately wing functionality can be added to this sexp without affecting ship functionality.
This fixes a few items that were revealed in the course of Dark Visor's SEXP documentation PR. The EXITED status should return NAN_FOREVER, not just NAN. The CANT_EVAL value is never returned from the sexp on account of ship status, due to the preceding check, and is not an appropriate return value anyway; so that is removed. Finally, for a ship that can't move, the NAN return value is better than CANT_EVAL, since it represents the numeric situation more accurately and can also be checked by `is-nan`.
This adds a new field to particle effects so that particle rotation can be configured on a per-type basis, not just on a blanket basis. Implements #5941.
As reported by Trivial Psychic, if the number of subsystems exceeds the max as the result of a modular table, the error message was very misleading. This fixes the error message and also makes it report the correct number of parsed subsystems.
`ai_get_weapon` is not guaranteed to return a valid `wip`, so check for that here. This should now cover all uses of `ai_get_weapon` in the codebase.
Fixes an Event Horizon crash reported in Discord. Follow-up to #5842, commit 8dbe0e7.
Apple Silicon Macs require that all code is signed in order to run. Our builds
are partially signed due to the SDL framework already being signed, so it is
seen as broken. To fix that we need to codesign all the rest of the necessary
files with an ad-hoc signature in order to allow the builds to work properly.
This is a new method of ensuring that OPF_POSITIVE numbers are positive. It works for all numeric arguments, including variables and literals, and caches the status of the node to avoid lookups for every negative number on every frame. Tested on both operator and non-operator cases.
Follow-up to #5915.
Operators that specify OPF_POSITIVE should be guaranteed to get positive numbers. This code was previously disabled for performance reasons, but following the contract of the SEXP system is more important. A future PR will improve the performance of the functions used here.
Also, the `num-players` operator takes no arguments, so fix that.
In consultation with @BMagnu, code that validates data in the POF file itself should happen in `read_model_file_no_subsys`, as virtual POFs rely on their source files having correct data. I've added comments and slightly rearranged things to make this clearer, and also moved the new code from `read_and_process_model_file`. Additionally, I fixed two bugs by changing `parent > pm->n_models` to `parent >= pm->n_models` and adding a newline to the `nprintf`.
After getting the main state from the Lua registry, this function had
two Lua thread values on its Lua stack but we only removed one which
lead to a value being left on the stack.
Why did this not blow up before? Because undefined behavior.
The only place where this was called was when creating a Lua reference
value where luaL_ref is called in the same expression (see
UniqueLuaReference::create). The evaluation order of the parameters for
the make_shared call is not defined by the standard and for some reason
all major compilers (except clang) choose to execute the luaL_ref call
before the getMainThread call.
For those compilers, everything is fine. We have some extra values on
the Lua stack but that gets cleaned up after the API function finishes.
However, clang first evaluates the getMainThread which leaves an extra
Lua thread on the Lua stack. The luaL_ref call then references this
thread value instead of the intended value. In the concrete case, this
meant that LuaFunction saw that the reference points to a thread and
rightfully threw an exception.
This fixes#5904.
Use a single canonical `frametime` value for all HUD rendering, in both `hud_render_preprocess` and `hud_render_all`. Previously, certain functions called through `hud_render_preprocess` were using the full frametime, rather than the half frametime needed for VR when the HUD is rendered twice.
Fixes#5882.
Use a simpler, more robust, and more correct method of sharing the fire direction among beams: replicate the actual beam vector for all firing points. This further cleans up and simplifies the beam firing code and also clarifies some vector math.
1. make `check_ok_to_fire` return a boolean (like `check_los`)
2. make `check_ok_to_fire` and `check_los` both use a position argument since we don't need the whole turret
3. remove the redundant position prediction code from `ship_get_global_turret_gun_info` (since that needs to be a "pure" function) while making sure "share fire direction" still works
4. skip calculation of the vector in `ship_get_global_turret_gun_info` if we don't need it
5. move the position prediction code out of `aifft_rotate_turret` and into its own function
6. prune some gun position calculation calls since in most cases one will suffice
7. fix position "jitter" with weapon subsystem damage in missions that use gravity
8. `model_rotate_gun` now uses a nullptr position for a reset instead of an extra boolean argument
9. use a more efficient method to calculate gun barrel length
10. a couple variable name changes for clarity
1. Allow a `+` to appear in front of numbers, just as with `-`
2. Check for `.` and `,` within numbers to give a less misleading error message than "not a number"
3. The old number hack inadvertently skipped numeric literals, so specifically check for those
There are several SEXP argument types that themselves encompass multiple argument types: for example, ships and wings. This could be misleading when there is an error message displayed. So, this updates the error codes to explicitly cover all of the possibilities.
By using app image and switching to Checkout V1.
Also removes Vulkan SDK install, since it seems to be taken care of by the app image or is disabled. I can't figure it out from the app images.
This limit has not been bumped since the original public source release. The final mission in Shepherds has been experiencing mysterious bugs which were finally tracked down to the mission log overflowing its limit and discarding log entries. Ideally the mission log should be made dynamic and the pruning mechanisms removed, but for the 24.0 release, it suffices to bump the limit.
Volition used a bit of juggling when deleting the briefing editor pointer. Turns out this actually prevents a crash in certain situations, so let's put it back.
Follow-up to #5866.
This refactors the ship registry and the OSWPT struct to store data as indexes rather than pointers. This is a prerequisite for making these collections dynamic in the future. See also #5800.
* Reorganized opengl deferred light mesh drawing to submit all data before,
beginning to submit draws, and also to reduce total bind calls needed.
* Leftover unused variable cleanup
* CI didn't like my loops, maybe it'll like these.
* unused variable cleanup.
FRED has an autosave feature but it wasn't invoked in too many places. This adds autosaving whenever a major dialog is closed, unless it was closed by hitting Cancel. NB: Autosave is not yet implemented in qtFRED.
Also, `addvariabledlg` incorrectly referred to `OnOk` instead of `OnOK` and `CMessageEditorDlg` incorrectly referred to `OnOK` instead of `OnOk`, so this fixes those and distinguishes `OnOk` by renaming it `OnButtonOk` to be consistent with the event editor and other dialogs.
Calling `query_node_argument_type()` on a node with no parent is a valid use case, so return the proper argument type. Fixes a crash discovered by Applemush.
Ever since retail, the code has assumed that a soundtrack would always have arrival music. This removes that requirement. If arrival music is missing, it will just be skipped.
These variables are only ever used in the scope of `os_get_legacy_user_dir()`, so they can be scoped rather than global. This should fix a Coverity issue on the `DCF(low_mem` debug console function.
Adds a SEXP that specifically checks for whether a player has skipped a mission. This can be used to set tech room entries, allowed ships/weapons, and other campaign data that would otherwise break if a player skipped a mission.
This only applies to the the failed-five-times popup. For this to work with the `skipmemymissionyo` cheat, it would be necessary to load every intervening mission and check the events. That being said, `skipmemymissionyo` already automatically allows all ships and weapons, so there is much less, if any, need for this SEXP in that case.
An arm64 mac can run unittests on a x86_64 build, but not the other way
around. So if the target arch doesn't match the build host arch then
just skip the tests. Saves us from a far more complicated fix that would
only produce the same test results anyway.
Back in 2008 (in commit 2c45dbbb5f), some retail code incrementing `Player->failures_this_session` was removed, seemingly by accident. A month later, a bug related to this was fixed (in commit 28a408deee) in a different way. Since this fix is rendered redundant by the restoration of the original behavior, I've removed it and put back in the old behavior. This is only "mostly-retail" because the retail code didn't check `Game_mode & GM_CAMPAIGN_MODE`.
Qt has been added to the build image which eliminates the need to
dynamically install it which removed a possible point of failure.
At the moment this is only enabled for pull request builds and should
not affect nightly or release builds.
The previous version of the image accidentally removed the /tmp
directory which broke things in the GitHub actions.
Initially, an update for the upload/download actions was tried which had
no effect but keeping these updated is probably a good idea.
These new SEXP operators clear all status information from an event or goal, making it as if the event or goal had never been evaluated.
Implements feature discussed in #4184.
The requirement for delayed event status checks to be strictly greater than the event fired timestamp (see commit eed50619ca / PR #5267) means that `is-event-true-delay 0` will not work in debriefings if the event becomes true and the debriefing SEXPs are evaluated on the exact same timestamp. Normally this is not a problem, but one important exception is the `end-mission` operator which instantly sends the player to debriefing.
This timestamp behavior is working as designed and should be consistent as long as the `end-mission` operator has been around (I've verified it as far back as 3.7.4). But it does lead to inconvenient situations where the event that called `end-mission` cannot be evaluated by the debriefing. This makes it slightly more complicated to plan debriefing stages based on these events.
Therefore, it makes sense to add an exception to the event status function to ignore the delay if the evaluation is not in-mission. This is consistent with evaluating events that *never* fired and also satisfies the principle of least astonishment for mission designers.
This also adds relevant documentation to the event and goal status operators.
* SCPUI in-game language selector
* xstr support
* proper debug print format
* minor fixes
* Save the language as json data rather than an index into the languages array
* ext instead of id for clarity
* Do this more formally
* unused param
This advances the versions for Clang to 16 and GCC to 13 along with
fixing any warnings these new versions are detecting now.
The new image versions also include Vulkan so the additional workflow
step for installing that is not necessary anymore.
The overlapping checkboxes problem described in #5494 is the result of the checkbox list item height being slightly too small. A fix for this, which requires a subclass of `CCheckListBox`, is described in the following StackOverflow article:
https://stackoverflow.com/questions/3147958/mfc-cchecklistbox-items-overlap
It turns out there is already a subclass of `CCheckListBox` in the codebase: `ShipCheckListBox`, a class that was apparently left on the cutting room floor when DaveB refactored the team loadout dialog on 2/23/99. It allows an entire selected range of items to be toggled by pressing the spacebar. I've augmented it with the StackOverflow fix, and I've added it to the team loadout dialog as well as some other places that could benefit from it.
Fixes the other half of #5494.
We need to call `UpdateData()` in the `OnOK()` function and in several other places so that the member variables are populated with the most recent input from the UI. This prevents certain input (such as Player Entry Delay changes) from being lost by being overwritten with stale stored values.
This fixes a bug reported by Kitsune where the Player Entry Delay box did not work properly. It also fixes the random checkbox issue from #5494.
One of the features requested in #5378 (specifically the one requested in #5274), this adds a new "$Contrails use absolute speed:" option to game_settings.tbl, which makes the `ct_below_limit()` function check `objp->phys_info.speed` instead of `objp->phys_info.fspeed`. This allows contrails to appear when moving in a direction other than forwards.
This option was misleadingly named when originally introduced, so give it a more sensible name. The old name is still accepted for backwards compatibility.
* Allow Modders to Set Rotational Scaling Multiplier for Asteroids/Debris
Previously, there was no way to limit the velocity at which asteroids/debris randomly rotated. There was a way to set maximum speed, thus this PR follows that convention and adds a way to cap the rotational velocity scaling. This PR allows modders to set caps per type, including setting the value to 0 for no rotation.
A single scaling value was used b/c it was the most straightforward value to se via table and it was the employed the least code changes. Asteroids pick a random normalized vector for their rotation when spawning, and then that value is scaled by a random multiplier.
* use full multiplier instead
Convert additional timestamps to use the new timestamp system. This covers all timestamps referred to in freespace.cpp. For purposes of organization, the fade-in/fade-out timestamps have been moved to light.h|cpp and the training timestamps have been moved to missiontraining.h|cpp.
There are also several related code enhancements:
1. `FadeType` has been converted from `enum` to `enum class`
2. Initialization of the various training variables has been added to `training_mission_init` (previously they had never been reset between missions)
3. Validity checks have been added to the relevant locations for these timestamps
1. Use the `optional_string_fred`/`fout` pattern so the FRED comment parser can follow along with the mission file
2. Since the #Custom Data section is optional and requires a version bump, don't output the section header if the section is empty
* Add global to local for matrices
* Add lua integration
* Get Submodel from Submodel instance
* Add submodel functions
* Add model instance from submodel instance
* Fix index
* Fix copy paste error
Here's some low-hanging fruit for reducing the memory footprint of `ship_info`. This turns the maneuvering thrusters array into a vector, refactors the names a bit, fixes thruster activation when `-nosound` is active, reduces the number of calls to `ship_get_thruster_status`, adds some const-correctness, and converts the timestamps to the new system.
Previously (since 2012!) a waypoint would store its parent list as a pointer. However, this pointer can become invalidated if the waypoint list vector is resized. To prevent this, store the parent list as an index.
This also renames the waypoint's `objnum` field to `m_objnum` to match the naming of the other fields.
1. use `SIZE_T_ARG` instead of `"%lu"`; should fix format warning in #5780
2. since `HeapAllocator::checkRangesMerged()` has no effect unless running in debug, `#ifdef` out the function; should fix CI warning in #5778
Some patches for mission imports:
1. Check that the path isn't empty (the user didn't select "This PC") before continuing
2. Count successful imports
3. Avoid treating an import as a newly saved single mission unless the import was successful
In many calls to `ship_get_subsystem_strength`, the caller doesn't care about the actual number, just whether the subsystem type is destroyed. So this adds an optimization to check specifically for that. In the case of `SUBSYSTEM_ENGINE`, this avoids an iteration over every subsystem on the ship which, for a ship with many turrets, can be significant.
Some of the `frand_range` calls were used for integer calculations, so we can use `Random::next` now.
This also reduces the number of C-style casts in the codebase.
Add `const` to the `eval_enemy_obj_struct` struct so its values aren't inadvertently overwritten. Handle a bit of const-correctness propagation. Also add default member initialization to the struct.
One of the Voice Acting Manager dialog's strings is now too long for the .rc file and is truncated at 256 characters. Fortunately this can be worked around by setting it at runtime.
Add `const` to the `mc_info` struct so its values aren't inadvertently overwritten. Tweak some of the collision code to prevent overwrites.
Also remove the `flak_muzzle_flash` declaration since that function no longer exists.
1. Update soundtrack message to make it easier for modders to track down missing files
2. Update sexp help for ai-stay-near-ship to show the right argument count
In a few places where the game checks for the command sender, it should check for #Command as well, as long as the mission flag to override #Command is present.
Additionally, while the mission's command sender was originally intended to be a ship, it has been used to specify an alternative to #Command as well. But this caused problems when the "override #Command" mission flag was active, as it transformed a hashed source into a non-hashed source. So this commit adds a check to treat the source as hashed, if necessary, if a replacement has occurred.
Fixes#5749.
There is an implicit assumption in the code that the `MEF_DIRECTIVE_SPECIAL` flag could not be set on an event until after the `MEF_CURRENT` flag was also set. This change makes that assumption explicit, and also adds a check in `mission_process_event` to be sure the flag setting doesn't happen out of order. This situation is very rare, but can happen if the following conditions are true:
1. there is an event directive checking for the destruction of a wing
2. the wing has multiple waves
3. the directive uses the older `is-event-true-delay` technique to control when it is displayed
4. the directive becomes temporarily true before it can be displayed and while there are still waves remaining
This previously caused the "directive special" logic to occur before the "event current" logic occurred, skipping the proper setting of `born_on_date`.
Fixes Github #5725 and Mantis 930.
* Make sure we handle unknown location types
Avoids edge-case gargabe pointer 1522974
* Make sure local vectors are at least set to zero
For coverity 1522985
* Make sure from_table is initialized
When creating a replacement texture object, for coverity 1522989
* Change to Unreachable to help Linters
This was a false positive uninitialized scalar, Coverity 1523726. Hopefully, changing to UNREACHABLE() will help linters avoid this false positive in the future.
* Initialize xyw on this struct instantiation
For coverity 1523730
* Add early return for ade_set_args if error
For coverity 1523732
1. The player can target other object types besides ships, so when creating an `object_ship_wing_point_team`, make sure it is a ship
2. A few recent mission features require a version bump, but not all missions use these features; so do a "soft bump" where the mission version is updated only if necessary
3. Remove an unneeded #include by adding a `struct team_data` declaration (see #5599)
This is an actual edge case bug. If no countermeasure was set, and then one was set, there might be a garbage timestamp set that would give an incorrect countermeasure delay on next use.
For coverity 1093612, this function *should* never return zero, but it is no catastrophic if it does. Allowing it to return a negative value in some unknown edge case would allow it to clobber some other global data.
So now add a check for negative values and take no action if those negative values are reached. Assert on debug.
A mission in Mantle caused an invalid vector access when checking whether to vaporize a ship whose ship type was -1. Turns out having "no type" is actually allowed, so I audited all `class_type` accesses throughout the code for potential -1 accesses. Most were properly checked but a few were not. A few others needed to be tweaked.
(I suspect this is something that would be on the Coverity list if it isn't already.)
Yes. I know, I know, we're not going to use this code anymore. But just in case, I don't want this memory leak to have the possibility to exist in the future.
* Add Game Option to refresh selected weapon in loadout
This PR adds an option to always ensure the viewed weapon is one that can actually be on the selected ship when first clicking on the weapon loadout.
If you go to the loadout in the briefing and view the weapons on your ship, then go and change your ship class and go back to the weapon loadout screen, you will see that the weapon shown in the window on the right side is from your very first viewing before you changed your ship class. Displaying a weapon not allowed on a ship by default can be confusing to players, especially on mods like FotG where most ships have unique weapons.
The player can still of course click on a non-allowed weapon to view it, but with this PR the player will be initially shown a selected weapon that is allowed on the ship when opening the loadout editor.
Tested and works as expected.
* update order to be near weapon bools
The code has always checked a per-weapon-class value called `lock_fov` when comparing the dot product of a ship to its target to see if it can lock on to it, however the weapon table hasn't ever included a way to set this value; it's always the default value of 0.85. This just adds "+Lock FOV:" entries to aspect/javelin homing missile parsing after "+Seeker Strength:", which will set `lock_fov` as long as the supplied input is between 0 and 360 degrees.
These functions have not been called from what I can tell since the source code was released. But they did happen to trigger a clang warning, so it's time to get rid of them.
* Add stage notes feature for mission messages
* don't keep notes outside the mission editor
* use F_MULTITEXT and do lcl_replacements
* this should be multitext too
The fix in #5578 assumed that a previously playing soundtrack would properly set the timestamp, but if no soundtrack was previously played at all, this wouldn't happen. So if we deliberately don't play a soundtrack, be sure to set the timestamp as if `event_music_do_frame()` had been called.
Fixes#5705.
Occasionally, FRED can save a mission with a wing's ships out of order; this can happen if ships are deleted and FRED finds a free index in the middle of the ship list. This can cause benign but confusing mismatches in the ship registry, the hotkey list, and other places -- and it's also possible some mismatches may not be so benign, e.g. in multiplayer. Anyway, it's better for the ships to appear in the order the wing expects them, so this adds a routine to swap them around if necessary.
* nebula-fade-poofs
* Move this up because order of operations is important.
* Add some documentation
* Respect time compression
* Fix sexp description
* Make sure faded poofs do not flicker
* optimize
Fixes#3098. The `shipfx_eye_in_shadow` function did a collision check for cockpits, bit did not previously take into account of the viewpoint had a non-forward orientation (ie the player was using free look). This PR sets the collide check to take that into account with a 1 line fix. Tested with multiple FotG cockpits and fixes the issue.
* Add a divide by zero check
For coverity 1107324. Keeps framecount from dividing by zero in very rare circumstances.
* Add a clarifying comment
This marks isNaturalNumberFactor() so that we know it is the best way to get whether a number is a natural number.
Modulo division is slower and gives the same results.
* Spoiled by Rust
Before this change if the wrong endianness was used, the c style cast that was used here would lead to the argument being passed to getsockopt to lack the actual information.
Fixes coverity 1093482
(Directly cast to socklen_t)
Add "tactical" versions of disable and disarm goals which only perform the specific task without implying anything else. The target ship is not protected and attack goals are not cleared from other ships.
There is also a new AI profiles flag to make this the default hud squad message command instead of the classic disable/disarm.
The ai-fly-to-ship goal was added early in FSO's development but never worked right. Until recently it could crash; and even aside from the crash the AI would try to reach the target's exact position, causing repeated collisions. This folds ai-fly-to-ship into ai-stay-near-ship, since the behaviors are conceptually the same except for fly-to being satisfied as soon as the target is in range.
This also adds a new "escort" mode usable by both behaviors. The default Volition behavior is to swoop toward the target in a long, graceful arc; the new mode generates a goal point and flies directly to that point. These can be toggled via an optional sexp parameter.
There is also some minor cleanup and a new vec3d operator for convenience.
Needed for Scroll; depends on #5667.
If a ship is in the process of dying, it shouldn't be killed or self-destructed again. This fixes a bug noticed by RedMageJoe during the Derelict playthrough.
(This situation is distinct from a ship being hit while in the middle of its death roll. That shortens the death roll but does not try to kill the ship again.)
* Fixup HUD for slewing
* Fix Training Message box
* Lead indicator slew
* Fix HUD Message Head
* Correctly render messages
* Fix HUD offset handling
* HUD offset never makes any sense
* Cleanup offset code
* Remove unused parameter
* Fix Talking Head in RTT mode
Remove a whole bunch of ad-hoc code piled on top of the retail weapon cycling behavior, then replace it with a robust algorithm that takes all relevant attributes into account.
Fixes#5529.
Subsystem hitpoints are calculated as a percentage of the ship's hull strength as they are parsed. If a modular table modifies the ship's hull strength, the subsystems are not modified at the same time. This can lead to unreasonably large or small subsystem hitpoint values, as recently seen in the 1.3.0 version of Cardinal Spear.
This PR adds an option to defer hitpoint calculation until after parsing so that the subsystem is a percentage of the correct hull strength. Since this may affect the balance of existing mods, it is off by default unless the build targets 24.0 or later.
This also removes the long-unused `hull_percentage_of_hits` check and adds several log statements for significant options in game_settings.tbl.
Update the Lua enums to be consistent with the new ShipStatus enums.
Separately, add an extra ship registry check in the event a ship doesn't exist in the ship registry.
Use the same method for texture replacement in briefing popups that is already used in the tech room.
Also don't render shadows when the jump node is displayed, since it's not being lit anyway.
Normally the disabled/disarmed flags are only set if the destroyed subsystem is actually an engine or turret. This should be done for cheats as well, otherwise, for example, destroying any subsystem on a non-engined ship will cause it to become disabled.
There is a bit of code in missionparse that sets the parse object because in-game joining needs it. This is unrelated to ship status, so the status shouldn't be changed. This fixes the bug and adds a comment to clarify the situation, as well as some warnings to help track down incorrect joining states.
Fixes#5661. Follow-up to #5658 (where the regression was introduced) and #4836 (which fixed in-game joining).
The Star Fox barrel roll effect is achieved using a script which spawns a new ship. The script sets no-collide on this spawned ship, but it also tries to set the ship flag for all future ships -- and future ships require a parse object, which doesn't exist for a created ship. This patches the FALLTHROUGH in the sexp code to account for that possibility.
Separately, there are other ways a parse object pointer could become null through unusual code states, so this adds an INVALID status and several additional checks to defend against this crash in other circumstances.
The retail warp range multiplier can yield ridiculous results, like an Elysium warp being audible over 9000 meters away. So allow the multiplier to be set via ship type.
Adds a `DEATH_ROLL` status to specifically cover the state after ships have been destroyed but before they exit. I've also audited all code that interacts with the ship registry to use the correct state with this new state taken into consideration.
This fixes access to exploding ships that was broken when the ship registry framework was introduced. In particular, the `when destroyed X beam-lock-all X` QoL feature now works again.
CMake's copy_directory functions follow symlinks recursively as opposed to
preserving them. For mac frameworks, which make use of symlinks for versioning,
this causes the files to be duplicated multiple times in the copied framework.
Using rsync instead, just for frameworks, will properly duplicate the framework
while still avoiding the "file exists" error from cp.
Use GNU tar instead of the default bsdtar. This works around some weird
corruption bug triggered by the combination of the GitHub runner-VM, the llvm
linker, and bsdtar.
Adjust intermediate filenames such that they don't get uploaded to
indiegames by mistake.
Unpack builds as a single step instead of two.
If consecutive red-alert missions have different numbers of ships in a wing, then calculating the number of waves will not be correct. This necessitates the addition of wing status to the stored data for red-alert sequences.
Not only must wing data be stored in `Red_alert_wing_status`, but also in the CSG file. This necessitates a version bump. Fortunately, the current design of CSG files allows extra data to be added to a section without breaking old builds, since the CSG loader will just skip over the unrecognized data.
This also renames `red_alert_wingman_status` to `red_alert_ship_status` since it's not limited to wingmen, as well as fixing the omission of exited ships if they are in the player's wing but don't have the red-alert-carry flag.
Fixes#5637. Follow-up to #4457 and #5609.
Add some extra logic implied by the `Begun_detonation` flag. Missiles that are homing can have their targets, headings, speeds, and lifetimes changed for various reasons. If a missile has begun detonation, particularly if it is in "detonation limbo" because it is flying across a bowl-shaped turret, we don't want to change any of that. The "detonation limbo" weapon lifetime is only accurate if all of those values remain constant.
Follow up to #4006.
In #5477, I made the escort list respect hidden names by copying the behavior from `message_queue_process()`, which already checked those flags; however, this resulted in some dramatic behavioral changes for mods using callsigns for escort ships, and while making the behavior optional was a possibility, feedback suggested everyone would rather it just behaved like the target box and displayed both. So I replaced the code with similar logic from hudtargetbox.cpp, except with the "replace hidden name with ship class" code taking priority.
- handle double archiving of macOS builds so they'll work properly with Knossos
- fix issue where only a single configuration was included in the package
(Release or FastDebug, not both)
Statically link to libstdc++ for CI/CD builds in an attempt
to avoid compatibility issues without relying on a crippled
docker build image.
Should properly fix#5571
1. Allow setting the homing subsystem if the homing object has already been set
2. Use the `weapon_set_tracking_info` function if setting both object and subsystem, as it handles several important homing things
The `collides` and `no_collide` flags are equivalent, but opposite. So when sexps or scripts get or set those flags, allow each to be used as an anti-synonym (not exactly an antonym) for the other.
Two fixes for red alert missions:
1. Since any ship in the wing can be stored, not just the wing leader, the "prospective name" check should check for all possible names in each wave
2. If a wing wasn't actually stored, the red alert code should not reset the wing's wave number to 0
Follow-up to #4457.
Since `gr_string` can accept a length parameter, there's no need to copy each line before it is drawn.
Related to #5495 but not one of the two options mentioned.
The `Random::next(low, high)` function returns a value in [low, high]. This location should use the single-argument version, `Random::next(int modulus)`, which returns a value in [0, modulus-1].
As reported by Colt, there was a crash in the in-mission jump sequence in Shepherds where the mission previously worked. The proximate cause was a handwritten SEXP called via script that omitted whitespace before an opening parenthesis. This was incorrectly recognized by the upgraded SEXP parser as an invalid SEXP. Unfortunately, a separate bug in `get_line_num()` caused a crash when the parser tried to display a warning, because the function tried to calculate the line number of a SEXP that did not come from a parsed file.
This commit fixes the parser to recognize opening parentheses even when no whitespace precedes them, moves the output to the 'unexpected end of sexp' warnings will they will now be seen, and fixes `get_line_num()` to work when there is no parsed text.
Follow-up to #5520.
For certain calculations involving armor, the `GetDamage` function needs to know if the damage is being applied by a beam so it can apply the calculations with the proper frametime. The parameter was not provided in all cases, so this fixes that.
Follow-up to #1609.
1. Add a `vanish()` function for beam objects, to be consistent with other object types
2. Add a `BeamFree` virtvar, analogous to `TurretLocked`
3. Add timestamp variants of TurretLocked and BeamFree to be consistent with sexps
4. Add `BeamLife`, `BeamWarmup`, and `BeamWarmdown` virtvars so scripts can access table properties
5. Add "On Beam Death", "On Beam Warmup", and "On Beam Warmdown" hooks
6. Clarify some existing documentation and patch a couple things
The firing point gauge did not work as advertised; this fixes it. Unselected weapons are dimmed, selected weapons are normal, and firing weapons are bright.
This adds several fixes to make the event and menu music more robust:
1. The game will now run with zero soundtracks. All accesses into a potentially empty vector should now have checks.
2. Soundtracks and menu music are now checked for validity before being played (not just when importing a FSM mission).
3. The parsing validity checks and the in-game event music now check for skippable patterns using the same function.
4. Zero measures and zero samples-per-measure now cause the game to skip a pattern. Negative values now trigger a warning.
5. Omitting some or all of the `$Name:` lines for a soundtrack will not cause an assert.
Fixes#5576. Follow-up to #5572.
There is a built-in delay for the event music to start playing, but this delay gets stepped on if `change-soundtrack` is called when the mission first starts. So don't set the delay unless it has already elapsed at least once before.
When a non-looping persistent sound expires, `obj_snd_stop()` actually does need to be called. Even though the sound is no longer playing, the `Num_obj_sounds_playing` tally needs to be decremented, otherwise it will eventually exceed its limit and prevent any additional persistent sounds from playing. And it turns out `obj_snd_stop()` returns gracefully for sounds that aren't playing.
Follow-up to #3510. Fixes a bug that appears to have been around since retail.
The `mn.createWeapon()` function takes an optional group ID for weapons that share lighting, but the internal `weapon_create_group_id()` function was never exposed to the API. This adds that.
Since event music soundtracks use the exact file extension specified (see #5567), the validity check should also use the exact file extension specified.
Also, move the validity check to after parsing has completed because extensions may be overridden.
Currently, menu music will trim the extension and look for both OGG and WAV files, but event music will use the exact extension specified. This is intended but could lead to unexpected results in mods, so display a warning for the modder.
The crash in #5514 appears to be caused by some of the graphics code not being in the expected state for the synchronization. Looking at the code in `render_frame()`, a `gr_flip()` happens after one frame ends and before the next frame begins. That implies that this `gr_flip()` should not be here, as it is in the middle of a frame. For additional evidence, `gr_flip()` modifies the "uniform buffer manager" state, and that is part of the stack trace preceding the crash. Removing this `gr_flip()` fixes the crash.
The strange thing is that this code *doesn't run at all* while the campaign editor is active. I verified this by adding a MessageBox in place of `gr_flip()`; the MessageBox doesn't display until the campaign editor is exited. And yet, FRED crashes with `gr_flip()` present and doesn't crash with it removed. This calls for a new category of bug; I propose "spookybug", from spooky action-at-a-distance.
Fixes#5514.
The default movie subtitle font is font01.vf, but mods with custom font tables might not use this font. So this changes the handling slightly so that the movie player will use whatever the first available font is.
Follow-up to #1523. Fixes a sometimes spurious warning in mod initialization.
Supercaps use a physics flag on warpin that makes them slow down faster than they would under the normal physics code. This adds that flag as an option for custom warp parameters.
Since flags are not yet parsed when warp parameters are parsed, the code needs to skip ahead and peek at the flags in the same way as the weapon override.
1. Fall back to the FREDzone help docs if the local files cannot be found
2. Tweak url_launch error message and add a return value
This consequently removes the ReleaseWarning which wasn't the friendliest or clearest way to tell the user about a missing help file.
Since other functions in the scripting API remove extensions before loading the files, and since the internal functions expect them to be removed, the streaming anim API should handle that too.
As reported by Woutersmits, the GTT Nova did not dock with the GTD Hall in the first mission of Black Horizon. Attempting to run a debug build caused a CTD. Investigation showed that there was an invalid dockpoint triggering an Int3(). The dockpoint has been fixed, but to aid troubleshooting in the future, the Int3()'s in this function have been changed to more appropriate functions.
When weapon flags are parsed in a modular table and override the previous set of flags, certain flags must be kept to preserve the behavior of the weapon. The previous `preset_wi_flags` technique only worked if all such flags (homing, has-display-name, even whether the weapon turns) were set in the same modular table. If a modular table overrode the flags but didn't specify those lines over again, mysterious and subtle bugs would occur.
This modifies the flag parsing to explicitly preserve all appropriate flags from the existing weapon entry, which fixes the bug. It also allows all of the flags to be specified in one place, rather than scattering `preset_wi_flags` assignments throughout `parse_weapon`. And this also adds quite a few flags to the flag list that were not handled at all under the previous design.
Finally this fixes a few incorrect assignments of default values to fields that should only happen the first time a weapon entry is parsed.
Three fixes:
1. In commit fa0878b6b3 for PR #5338, the optional distance parameter was inadvertently changed to a bool. This fixes the parameter.
2. The distance parameter was previously parsed using `atoi` which works for number literals, so change to `eval_num` to allow sexp return values.
3. Make `eval_num` consistent with `eval_sexp` in the sense that evaluating an empty list is valid and returns false or 0.
Also takes advantage of the fact that `is_sexp_true` works for empty lists to streamline optional arguments in `ai_add_goal_sub_sexp`.
Copying a file with cp on top of another one is not allowed by default
so switching the command to use the CMake provided one will fix the
issue and will also unify the commands for all platforms.
The directory support is necessary for Mac where the SDL library is
actually a directory.
For mods which want primary weapons to 'detonate', setting the detonation range is not reliable because, due to rounding imprecision, either the range (which detonates) or the lifetime (which does not) may happen first. So this adds a flag to always detonate a weapon when its lifetime expires. Secondary weapons have this flag by default, but primary weapons can add this flag in the $Flags list. Additionally, if the detonation range and the predicted range due to lifetime are equal, the flag is added automatically.
Resolves#5521.
In #4702 this log line was changed to the 'Model' category, which made it hidden by default. This was missed in review but should be restored as it is a fairly important line.
Fixes#5507.
The hud-set-coords SEXP has always used exact pixels, without regard for the current screen resolution. This adds a similar scaling mechanism as is used for show-subtitle.
Fixes#5525.
When using the mission importer, missions were being corrupted for very subtle reasons: due to some code reordering in prior commits, `raw_ptr` would be initialized to `Parse_text_raw` before `Parse_text_raw` itself was initialized. This assignment was done in the `CFred_mission_save` constructor and the ordering dependency is not obvious. Since this is a highly fragile situation and has the potential to affect any use of `parse_comments()` in FRED, it's better to explicitly assign `raw_ptr` when it is needed, and just initialize it to nullptr in the constructor.
This also sets the version number to the legacy version (0.10) when the mission is saved in the retail format.
Modelread.cpp supports POF versions as low as 1900, but early model versions were not loaded properly because they relied on preprocessor directives rather than version checks. This changes the POF loading to correctly check version numbers and chunk IDs.
Fixes crashes when attempting to load a FS1 model.
1. When saving a campaign, the save directory should be the one that the campaign was just loaded from. If prompting the user, this should be the default save directory. This fixes a bug where campaigns were saved to %APPDATA% instead of where the FREDder might expect. This has been a bug ever since the migration of the game files from FreeSpace2 to %APPDATA%.
2. When saving a campaign, save only the external mission flags, not the working flags that are maintained during gameplay but have no meaning in the saved file.
* In fillValues(), Check the size values returned by SDL to assert they are non-negative. If they are negative, abort vector resize and mprintf the SDL Error.
Personae have a flag and a species bitfield. They're built up during parsing, but never explicitly zeroed out. This leads to ships occasionally getting an incorrect persona (especially common with support ships, which never have an explicit persona).
Additionally, this commit addresses an issue with the UES Aranyaka (and potentially other support ships belonging to species without a support persona). I'm honestly not sure why they were ever able to speak; however, with this change, they'll never be able to. As such, this commit introduces a "default support persona" to retain the desired behavior.
In f350e06851, two Int3()s were added to `message_translate_tokens()`, to check for possible out-of-bounds errors. However, in c70fdc3a52, just a couple months later, the code being protected by those bounds checks were put into `else` branches, meaning the `Int3()`s became redundant. This wouldn't actually cause any problems unless somebody passed a string with two `$`s at least 40 characters apart to `message_translate_tokens()`. Cue #4876, which started calling `message_translate_tokens()` on debriefing stages and recommendations, which can contain color tags. This still wouldn't cause problems as long as the color tags are in pairs within close proximity (`translate_key()` would say "that's not the name of a scan code" and leave the text between the two tags alone), but as soon as two color tags are far enough apart to trip the bounds check conditional, the `Int3()` would be hit. This is still fine on Release builds, which ignore `Int3()`s, but triggers a breakpoint on debug builds, which depending on the user's system, can result in a CTD. Since, as far as I can tell, the `Int3()`s haven't actually been meaningful since 2006, I've just removed them (and inverted the conditionals), and testing by the affected user confirms that it no longer CTDs.
When only one AI class performs autoscaling, the math formulas which use autoscaling will become meaningless (e.g. in `ai_maybe_launch_cmeasure()`) or will cause divide-by-zero errors (e.g. in `ai_manage_shield()`). And autoscaling is not very useful outside of the specific ways that Volition used it. So this adds some warnings and disables single-occurrence autoscaling.
Fixes#5474.
* fast version of setting position and orientation
* preliminary stale collide time
* add global collision cache stale flag instead
* clean up
* more clean up
* no periods >.>
* bring back single object version
* rename and bring back stale object list
* use a set
When fireballs were made dynamic in 609ed4ed94, the `MAX_FIREBALLS` #define lost any relationship to the fireball collection. This removes it and also correctly specifies the size of the fireball collection.
This fixes a CTD when accessing items in `mn.Fireballs` via script.
These #include lines are needed for the changes introduced in #5492. Not sure why they weren't picked up by CI, or why they work in some compilers but not others.
If you pause the game, say something into the microphone, then unpause, it can abruptly perform an action based on voice recognition; this is probably counter to player expectations. This adds a `gameseq_get_state() != GS_STATE_GAME_PAUSED` check to the existing conditional.
If the "Campaign Room only available in full version" popup is shown, it tries to reset `Active_campaign_index`, except that if a pilot is loaded with a missing campaign file, `Active_campaign_index` is -1. This causes an out-of-bounds array access, so let's present an alternate popup in this case (either one to select whatever the first campaign file found is, or the generic `popup_game_feature_not_in_demo()` if no campaign files are found).
Several related fixes:
1. Copy the actual ship name, not the display name, to `killer_parent_name` for two reasons:
1a. Since `killer_parent_name` is used to look up the ship, it must be the actual ship name, not the display name.
1b. Copying the display name can cause a buffer overflow because display names can be longer than 31 characters.
2. The display name functionality is moved to the more appropriate location in `player_generate_death_message()`.
3. Remove `player_get_killer_weapon_name()` which only served as a proxy check for whether the weapon index was used or not.
4. Use `ship_registry_get()` rather than `ship_name_lookup()`.
5. Add comments to clarify the use of `killer_parent_name`.
In at least two instances, `split_str_once()` can be called with width values derived from mod-supplied values that can be 0 or less (specifically, two hud gauges: if `+Messages:` has a `Max Width:` that's too small, or `+Directives:` has a `Max Line Width:` of 0 or less). Since user-supplied code shouldn't be tripping assertions, I looked into adding security around the calling sites when I realized that the assertion wasn't actually protecting against anything; the function would run just fine with a negative pixel width, it would just break with every whitespace. Since both calling sites that could trip the assertion already treat getting `src` back as output as an "I can't split this" error condition, it's perfectly fine (and skips iterating through the string) to just `return src` if the maximum pixel width is 0 or less, so let's just do that instead. Technically this is a behavior change in Release code, but the result of the old code would've been to spam the message log with every individual word in every message (if `Max Width:` was too small), and for directives to seemingly-randomly split only after the first word (if `Max Line Width:` was 0 or less). Not splitting at all is at least as correct, saves some pointless processing, and *should* still be obviously wrong if there was supposed to be a reasonable width value.
It appears that `(turret->turret_enemy_objnum < 0)` is an expected and allowed condition, so just assert that the objnum does not exceed MAX_OBJECTS.
Fixes#5470.
This is a bit tricky because both animated and non-animated PNGs use the same extension. So for PNGs we need to defer the filename length check until we know for sure that it is an animated image.
Fixes#5387.
PR adds extra validity check within `model_render_glowpoints` function. Other places in code that use `bank->submodel_parent` check for validity before looking up `pmi->submodel`, but this check was missing from this section (which caused a CTD in a mission restart due to `bank->submodel_parent` being -1).
See title. There were some cascade effects, but the changes are mostly contained to the model code. The calls to `gr_render_model` and `g3_render_primitives` use `const_cast` because constifying that API would require a whole other PR.
Issue #5459 notes that mission files that are too long will crash the FRED campaign editor, but this is an artificial restriction. The only need for a string buffer here is to enforce the correct mission extension, so use a SCP_string for this, and add checks for whether string manipulation is in fact necessary. (In most cases it isn't.)
Fixes#5459.
In certain cases, angles would be rounded to 360, where the expected range is 0-359. The range was guarded properly for skyboxes but not for bitmaps and suns. This fixes that. Additionally, since suns do not bank, the angle conversion now sets the bank to 0.
Fixes#5390.
Kitsune discovered that special characters, notably semicolons, were not properly handled in the Mission Specs editor. This adds appropriate handling of special characters for fields in that editor, similar fields in the campaign editor, and the corresponding places in qtFRED. This also makes error messages more descriptive for campaign load failures.
* validate chunk size to avoid align crash and add align skip flag
* change type from uint to int
* change mprintf output to a warning
* revert uint to int change and requested changes
* Init Particle shaders only if they're actually used
* set layout correctly
* Don't compile shadow shader if not needed
* Properly deal with capabilities
* Fix typo
* remove obsolete capability
1. Deprecate the old set-jumpnode-name sexp now that there is a set-jumpnode-display-name
2. Make the display name design consistent with ships and weapons; in particular add a `HasDisplayName()` function and automatically generate the display name for hash-truncated names
3. Keep the display name in sync when the name is changed in the FRED dialog
4. Fix the overriding of hash-truncated names with display names on the HUD
5. Fix the incorrect setting of the alphacolor flag when using FRED
6. Fix array out-of-bounds access when no object is selected
Follow-up to #5401.
1. Add const qualifier where appropriate to API methods
2. Change `TonemapperAlgorithm` from enum to enum class, for type safety and token scope
3. Update saving of lighting profile in FRED
4. Add saving of lighting profile in qtFRED
5. Add lighting profile (and asteroid) initialization to qtFRED
1. Add a function to retime *only* the collision pairs involving a specific object. This is useful when only one object has moved, since only collisions involving that object are affected.
2. Use this function when objects are moved for autopilot, via sexp, and via script.
Previously collision pairs were not retimed when objects were moved via script, leading to bugs. This fixes that.
* refactor how asteroid wrapping is done and setup for allowing or disallowing range check
* allow fred to toggle enhanced spawn checking
* field naming adjustment
* some minor tweaks
* Add sexp compatibility
* We don't need to save the boolean, just the string.
* full qtFRED support
There was a missing function call in qtFRED's initialization, which prevented custom HUD gauges from being loaded. This adds that. Additionally, this updates the deduplication code in `get_listing_opf_custom_hud_gauge` to match its counterpart in FRED.
Fixes#5422.
The `SCP_string_lcase_equal_to()()` and `SCP_string_lcase_less_than()()` functors are rather unwieldy to use in non-functor situations, so this adds conventional function equivalents.
Related to #5267, and again concerned with the original check for event delay:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
return SEXP_FALSE;
```
For events that were never evaluated at all, their timestamp remained 0. Thus the function did not return and the status of the event (which by definition was incomplete) was always checked.
After the timestamp refactoring, this comparison always returned SEXP_FALSE for these events. The correct behavior is to bypass invalid timestamps so that the status of the event is always checked.
This fixes the behavior of `is-event-false-delay` in debriefings.
The `stars_post_level_init()` change in #5403 exposed a bug where qtFRED would sometimes try to render the mission before all setup had been completed, causing a crash because `Show_iffs` was zero-length. This was due to the mission being created in the middle of initialization, instead of after initialization was complete. This fix moves `createNewMission()` to main.cpp, after initialization has finished, and in parallel with the command-line option to load a mission.
1. Skybox initialization (and perhaps other aspects of mission initialization) requires the existence of a timestamp snapshot, so make sure a snapshot has been taken before FRED creates a mission. Follow-up to #5343.
2. Move `stars_post_level_init()` to `Editor::createNewMission()` in qtFRED to be consistent with FRED's `create_new_mission()`.
Fixes a crash when the user tries to add a skybox when FRED first launches.
The `type_flags` on a model's dockpoints are determined by the dockpoint name. If the name changes, the flags should be updated accordingly.
This fixes a bug in Scroll where a dockpoint that was imported and renamed to start with the word "cargo" was not compatible with cargo docking as expected.
In retail, number parsing picked up immediately at the character after the number parsed, so parsing `0.50` as an int would yield 0, and then the next available characters would be `.50`. Even though parsing has been tightened up and made stricter, we can still "fail gracefully" by simulating the old behavior. And when failing gracefully, the message can be a warning.
Since `rand_sexp` also writes text into the sexp node for the seed value, its cache should be cleared too. And since this is a pretty common operation, wrap it in a `clear_cache` function.
Follow-up to #5381.
#5328 added a very useful culling for particles created by specific particle effects (ie weapons, now beams), though in an effort to simplify the culling process, that PR removed the necessary culling of default smoke on ships. This PR restores the culling of default smoke while also keeping the new culling of particle specific effects. Tested and works as expected, including fixing the slowdowns caused by the aforementioned removal of smoke effect culls.
The `rand` SEXP stores the result of its first call in the "low" node. Prior to PR #2402, this worked fine, but after that, the value is cached when first evaluated, meaning that subsequent calls to the `rand` SEXP will always return the lowest value in the range, not whatever number was rolled the first time.
This commit makes it so that writing the rolled value to the node's `text` attribute is immediately followed by deleting the no-longer cached value, so that the SEXP continues to work as intended.
When I made FSO not crash with demo data in PR #1156, I avoided calling `brief_maybe_blit_scene_cut()` if `Fade_anim` didn't load, when I should've made it do what the icculus port does in demo mode: pretend the animation finished immediately.
With this commit, the first mission of the demo correctly advances past the first briefing stage.
Per GCC optimisation guide, which applies equally well to clang:
* -funroll-loops should not be used unless directed by profiling. The compiler will already unroll loops when it's a good idea.
* clang and gcc now have -Og optimisation levels designed to enable debugging with good performance.
(second attempt at PR #4562)
* Fix max Z speed when using ETS and engine damage tracking
Follow up for #5137 and #5292. This engine strength check thus needs to be added to all instances where `max_vel.xyz.z` is updated, so a function was created and added in respective locations. Fixes#5367.
* cleanup and adding validity assertations
* cleanup outdated comments
* might as well make the cleanup look nice
* update to account for more edge cases
* cleanup
1. Disambiguate dialog IDs for the music player and the volumetric nebula dialogs
2. Fix compilation of qtFRED
3. Small refactor of Personas access to use STL functions where appropriate
1. When the "object" radio button is selected, the "point to" check box will also be selected
2. When an object is selected from the object list, the "object" radio button and "point to" check box will also be selected
Fixes#5356.
Take into account the collision flag and collision groups when spawning a ship. Should fix#5357.
Also clean up the code a bit, including setting a few `int`s to `bool`s and adding a missing axis case.
Because time compression adjusts the raw timestamp to be 0, it must use the exact value, not the snapshotted value, or the mission time will be slightly off. So this commit fixes that problem, as well as making sure that changes in time compression always occur at the start of a frame.
* initial API for hud config elements
* get rendering, highlighting, and selecting working
* Add a way to create color objects
* some cleanup and fixes
* go away we dont need you
* allow arbitrarily scaling the hud config draw
* last few config options and innitial preset handling
* vectorize hud presets and setup handling
* some last minute fixes
* iiiiiiiiiiiiiiiiiiiiiiint
* really
* documentation and address feedback
* completely revert this as well
* more documentation
* document all the things
* comment out unused parameter
* peach emoji retentive
* whatever
* return types
* color
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function. Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame. It is desirable to keep them all in sync.
This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame. This only affects simulation timestamps; real-time timestamps still use the live timer.
Follow-up to #5280:
1. Make the Rank virtvar actually return a rank object, to be consistent with other Lua API methods
2. Add a RankIndex virtvar to replicate the previous functionality
3. Make RankIndex return the expected 1-based index for Lua
This is a breaking change to the API, but since the original API is less than a month old, the impact should be small.
When parsing a list of numbers, such as in the $uvec or $fvec of models, a bug was reported where whitespace before the comma caused the number parsing to fail. This change checks for a comma after whitespace instead of checking for a comma as the very next character.
Extensible modular table handling for -ssm.tbm files was not very robust due to quite a few assumptions left over from straight .tbl parsing. Ostensibly optional fields were required, non-overridden fields were reset to defaults, etc. This improves XMT parsing and adds sensible defaults for SSM fields.
Here's a suggested followup to #5249. This converts the hotkey type to an enum for improved type safety. It also adds the corresponding Lua enums and adjusts the Type virtvar to return them.
Many of the recent scripting API enhancements are missing validity functions and validity checks, so this adds them. There are also some documentation fixes and a >= vs. > bugfix.
This allows warp parameters to be specified in species_defs.tbl, rather than requiring them to be specified for each ship in ships.tbl. Since this introduces a cyclic dependency between species_defs.tbl and sounds.tbl, the parsing of sounds.tbl is broken into two stages.
Implements request from #5283.
* read access to controls
* Early draft of checking keypresses in scpui
* detangle some code and prepare it for API usage
* API access to the core methods required
* move these checks into the UI methods
* comment
* fix bugs
* be smarter
* Need this stuff, too
* some more presets work
* unify func naming scheme
* cleanup and clarifications
* get detect keypress working
* allow searching and creating new presets based on current controls
* address feedback
* return nil if no preset is matched
* use the builtin methods which do the same thing, but slightly cleaner
* typo
* Fix intra-persona message borrowing logic
Closes#5299.
* Always assign personae for Support
Disabling the Auto_assign_personas flag had the side-effect of prohibiting support ships from ever speaking. Since a mod that wants this behavior (for whatever reason) can just not have a support persona, this commit makes an exception for them.
* Make Protect Target and Cover Me adaptive like Engage Enemy is
* Respect the allow subsitution flag
* Add "no-first-wave-message" wing flag
For when you want custom dialogue for the first wave, and automatic announcements for the rest.
* Fix FRED macro name
* Revert "synchronize simulation timestamps across the entire frame"
* try a proper fix instead of revert
* make sure nothing is reverted
* and back to full revert
* initial semi-working version
* better implementation of play and add stop and music.tbl viewer
* let the music window lose focus
* some cleanup
* add autoplay, next, previous
* use graphics
* Better dialog layout and allow ignoring files from the player list
* Make betterer
* a touch more cleanup
* revert this change
* missing bracket from merge conflict resolution
* address feedback
Historically, there's been a hardcoded 25% chance for Command to announce an enemy wing arrival. This is problematic for mods without Command, like BTA.
Originally the check for event delay was this:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
return SEXP_FALSE;
```
This returns false even when the mission time is equal to the timestamp. Therefore the timestamp check needs to use >, not >=.
Thanks to Durandal and ShivanSpS for helping to track this down.
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function. Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame. It is desirable to keep them all in sync.
This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame. This only affects simulation timestamps; real-time timestamps still use the live timer.
The logic used to select builtin messages was complex and hard to follow. This commit replaces it with logic that, while not identical, is both similar and more flexible. Additionally, the old logic had a major limitation when it came to downgrading messages: If a message type was defined for *any* persona, then it couldn't be downgraded for *any* persona. The new logic removes this limitation, and makes downgrade paths easier to define as well.
Some message types had hard-coded occurrence chances. These have been removed, and the default occurrence chance for the corresponding type modified to compensate.
* fixup error checking in regards to sexps using dynamic parameters
* anal retentive
* add more nonsense to make other nonsense work
* check these better
* dammit github
This reverts commit 542707c1c2.
* do this again but not in GitHub
* more nonsense to handle nonsense
* Revert "more nonsense to handle nonsense"
This reverts commit 6bc8b6e775.
* this is the song that never ends
This moves `LOG_SELF_DESTRUCTED` to the same place that `LOG_SHIP_DESTROYED` is recorded. This allows self-destruction to be correctly recorded when a ship is self-destructed via script, as well as when it is auto-repaired with a negative hull multiplier, or when ships are killed off in in-game joining.
* Add ability for a Lua sexp parameter to require a 'parent' parameter
* Add dockpoint as a return type
* variable conflicts
* var name
* qtfred
* address feedback
Chucked asteroids are always large. Therefore use their speed, not the
speed of the 1st parsed/small asteroid. Should not affect retail because
it uses the same speed for all three asteroids
Add XSTR entries for "or", "None", and "Nothing".
Note that there is already an XSTR entry for "none", but it does not have the right capitalization.
Note that "None" is localized in `textify_scancode` but not `textify_scancode_universal`.
This makes "Nothing" cargo use appropriate localization.
Fixes#5227.
Many values in `ai.tbl` can be inserted as overrides for their equivalent `Ai_profiles.tbl` values. (They are all optional and if not set for an AI class, the values in AI Profiles will be used.)
This is particularly useful for making very specific AI classes that still follow the main AI profiles table with easy to change values.
This PR adds `$firing requires exact los:` as an optional override to set in `ai.tbl`. This particular override is very useful, since it can be set to off by default in the `ai_profiles.tbl` for performance, but then set to on for some select AI classes within `ai.tbl`, and those AI classes can be easily changed on the fly in a mission.
I have not been able to keep up with code reviews for quite some time so
I should not be a default one.
Also fixed a copy issue which was missing an option to properly handle
already existing files.
1) follow-up to 5210: Avoid a memory leak caused by duplicating text, assigning it to a SCP_string, and then leaving the buffer in limbo
2) also keep the text as const char * since it's probably best to be consistent and keep the three types the same
3) be more scrupulous about checking for the existence of map entries, since the [] operator is create-if-not-found
This initializes `mc_info` to the correct values when it is constructed, removing the need for `mc_info_init`.
This PR also fixes a group of incorrectly inverted assignments in beam.cpp.
In PR #5202, a bunch of `Assert(child >= 0);` statements were replaced with `if (child < 0) return nullptr;`, except the first one kept the assertion's condition (inverting the logic). This fixes this accidental inversion.
Since older builds of FRED parse the mission version as a float, the version can contain a maximum of one decimal point. These changes allow FRED and FSO to disregard the build number when loading, saving, or comparing versions.
There is also a small fix to qtfred's saving of the author field.
* enhance handling of motion debris
* dunno what i was thinking here
* address feedback
* require all four bitmaps to be defined in new parsing method
* address feedback
`Roll_` and `Bank_` are synonyms, and the `Roll_` thruster flags should be `Yaw_` anyway, so rename them and rename their table strings. This still checks the old table strings for compatibility.
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.
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.
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.
message(STATUS"Using ccache for C compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_C_COMPILER_LAUNCHER${CCACHE_PROGRAM})
endif()
if(NOTCMAKE_CXX_COMPILER_LAUNCHER)
message(STATUS"Using ccache for C++ compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_CXX_COMPILER_LAUNCHER${CCACHE_PROGRAM})
endif()
endif()
IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_EXE_DIR"IMPORT_EXE_DIR-NOTFOUND"CACHEFILEPATH"Required for a cross compiling build, point to binary directory of a cmake build for the real OS")
> Tired of having your Menus in FSO be at a resolution of potato? Use SCPUI to have them rendered from Fake-HTML to the actual screensize as opposed to a prebuilt graphics!
> Tired of being limited to whatever people in the SCP hardcoded in for buttons? Use SCPUI to define buttons and all other manner of shenanigans as Lua-code just as you like.
> Tired of needing to replace a bajillion interface graphics to reskin FSO? Use SCPUI, and especially Mjn's existing collection of Lua, CSS, Fake-HTML and images, and you only need to replace about 250 graphics.
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.
Deprecations are a mechanism in FSO where a certain feature or aspect of the engine has changed or is no longer supported. Since this would normally break existing mods, we have the mod table feature "[tt]$Target Version:[/tt]" with which a mod can specify what version of FSO it was developed with. Any features listed under Deprecations will be removed or changed when the target version of a mod is at least the version released in this post.
[b]All platforms: [/b] For every day use, we recommend [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url], an integrated solution for downloading and launching mods.
[b]All platforms: [/b] For every day use, we recommend [url=https://knossosnet.github.io/Knossos-Release-Page/]Knossos.NET[/url], an integrated solution for downloading and launching mods.
[hidden=Alternative Launchers]
Cross-platform: [url=https://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (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] (legacy project for a unified launcher)
[b]Important:[/b] For best compatibility with FSO 3.8 and later you should use at least wxLauncher 0.12.
Windows: [url=http://scp.fsmods.net/builds/Launcher55g.zip]Launcher 5.5g[/url] ([url=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
Windows: [url=http://scp.fsmods.net/builds/Launcher55g.zip]Launcher 5.5g[/url] ([url=https://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=https://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=https://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=https://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=https://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Graphics_Settings]by hand[/url] or whatever you can figure out.[/hidden]
[b]What are those SSE, SSE2 and AVX builds I keep seeing everywhere?[/b]
[url=https://www.hard-light.net/forums/index.php?topic=65628.0]Your answer is in this topic.[/url]
Don't want to deal with that? Use [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url] and it will download the best build specifically for your PC!
Don't want to deal with that? Use [url=https://knossosnet.github.io/Knossos-Release-Page/]Knossos.NET[/url] and it will download the best build specifically for your PC!
[size=8pt]Compiled with Ubuntu 16.04 LTS 64-bit, GCC 5[/size]
${build(groups["Linux"].mainFile)}
@@ -52,14 +52,22 @@ These builds use a mechanism called [url=https://appimage.org/]AppImage[/url] wh
Alternatively, if there is a package in your software repository then you should use that. If you are the maintainer of such a package for a distribution then let us know and we will include that here.
[b][color=red]Not available[/color][/b] We recently lost access to our Mac CI environment which we usually used for compiling these builds so for the time being, there will be no builds for this OS.
These builds are not signed and so by default will fail to launch. To run them simply right-click on the app, click open, then click open again on the security confirmation dialog. You should only have to do this once for each app.
If running the game through Knossos or Knossos.NET this step should not be necessary.
[size=8pt][color=red][b]NOTE:[/b][/color] macOS builds currently have limited support and may exhibit issues not present on other platforms.[/size]
[hidden=TrackIR Users]
[size=12pt]Important!![/size]
An external DLL is required for FSO to use TrackIR functions. The following DLL is simply unpacked in to your main FreeSpace2 root dir.
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
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
if(!(En_objp->flags[Object::Object_Flags::Protected])||((aip->goals[0].ai_mode&(AI_GOAL_DISABLE_SHIP|AI_GOAL_DISABLE_SHIP_TACTICAL|AI_GOAL_DISARM_SHIP|AI_GOAL_DISARM_SHIP_TACTICAL))&&swip->wi_flags[Weapon::Info_Flags::Puncture])){//override lockdown on protected ships when using anti subsystem weapons - Valathil
// If ship is protected and very low on hits, don't fire missiles.
// these goals cannot be associated to wings, but can to a ship in a wing. So, we should find out
// if the ship is in a wing so we can purge goals which might operate on that wing
ship_index=ship_name_lookup(name);
if(ship_index==-1){
Int3();// get allender -- this is sort of odd
return;
Assertion(ship_index>-1,"Found a bad ship_index of %d in ai_goal_purge_invalid_goals, please report to the SCP!",ship_index);// get allender -- this is sort of odd
Assertion(ref_type==SEXP_ATOM_STRING||ref_type==SEXP_ATOM_CONTAINER_DATA,"Found a bad ref_type in ai_add_goal_sub_sexp of %d. Please report to the SCP!",ref_type);
// referenced by name
// save the waypoint path name -- the list will get resolved when the goal is checked
@@ -1399,15 +1465,8 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int /*
intgindex;
ai_goal*aigp;
#ifndef NDEBUG
// Goober5000 - none of the goals act on the actor, as in ai_add_goal_sub_sexp
if(!strcmp(name,Ships[aip->shipnum].ship_name))
{
// not good
Int3();
return;
}
#endif
Assertion(strcmp(name,Ships[aip->shipnum].ship_name)!=0,"The goals apply to the actor in ai_add_goal_ship_internal for ship %s, please report to the SCP!",name);
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n",Ships[objp->instance].ship_name,aigp->target_name));
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n",shipp->ship_name,aigp->target_name));
}
}
// Goober5000 - before doing anything else, check if this is a disarm goal for an arrived ship...
// short circuit a couple of cases. Ship not arrived shouldn't happen. Ship gone means
// we mark the goal as not achievable.
if(status==SHIP_STATUS_NOT_ARRIVED){
Int3();// get Allender. this shouldn't happen!!!
UNREACHABLE("Ship %s cannot rearm a target %s that hasn't arrived; get Allender or a SCP member",shipp->ship_name,aigp->target_name);// get Allender. this shouldn't happen!!!
Assertion(!Objects[enemy_objnum].flags[Object::Object_Flags::Protected],"find_turret_enemy selected an object of type %d %s that is protected, please report to the SCP!",Objects[enemy_objnum].type,Objects[enemy_objnum].type==OBJ_SHIP?Ships[Objects[enemy_objnum].instance].ship_name:"");
Assertion(ssp->turret_enemy_objnum>=0,"The turret enemy object number %d for %s on ship name %s is invalid.",ssp->turret_enemy_objnum,ssp->sub_name,shipp->ship_name);
Assertion(Asteroid_field.num_used_field_debris_types>0,"maybe_throw_asteroid() called while num_used_field_debris_types was 0; this should never happen, get a coder!");
// 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;
@@ -892,6 +946,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);
@@ -1407,6 +1482,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;
@@ -1517,10 +1596,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
@@ -1604,6 +1686,14 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
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);
std::pair<constchar*,int>{"Cockpit Field Of View",1840},
std::pair<constchar*,int>{"The vertical field of view for cockpit rendering. Only works if cockpits are active and cockpit FOV toggle is turned on.",1841})
//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",},
{"-capture_mouse","Capture the mouse within the window",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-capture_mouse",},
{"-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",},
{"-warp_flash","Enable flash upon warp",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash",},
{"-no_unfocused_pause","Don't pause if the window isn't focused",true,0,EASY_DEFAULT,"Gameplay","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause",},
//flag launcher text FSO on_flags off_flags category reference URL
{"-nosound","Disable all sound",false,0,EASY_DEFAULT,"Audio","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound",},
@@ -218,6 +223,7 @@ Flag exe_params[] =
//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",},
{"-no_ingame_options","Disable using ingame options",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ingame_options",},
{"-nomovies","Disable video playback",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomovies",},
{"-loadallweps","Load all weapons, even those not used",true,0,EASY_DEFAULT,"Troubleshoot","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps",},
@@ -235,6 +241,7 @@ Flag exe_params[] =
{"-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",},
#endif
@@ -262,7 +269,6 @@ Flag exe_params[] =
{"-verify_vps","Spew VP CRCs to vp_crcs.txt",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-verify_vps",},
{"-reparse_mainhall","Reparse mainhall.tbl when loading halls",false,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-reparse_mainhall",},
{"-no_unfocused_pause","Don't pause if the window isn't focused",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause",},
{"-benchmark_mode","Puts the game into benchmark mode",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode",},
{"-profile_write_file","Write profiling information to file",true,0,EASY_DEFAULT,"Dev Tool","http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file",},
@@ -273,6 +279,7 @@ Flag exe_params[] =
{"-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",},
"Sets the joystick deadzone. Integer value from 0 to 100 as a percentage of the joystick's range (100% would make the stick do nothing). Disables deadzone slider in the in-game Options menu.",AT_INT);//Cmdline_deadzone
@@ -412,8 +421,10 @@ int Cmdline_ship_choice_3d = 0;
Loaded 100 of 1211 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.