19659 Commits
Author SHA1 Message Date
Fabian Woltermann 234219d88b Fix invalid model/instance access for OBJ_RAW_POF and OBJ_PROP (#7733)
Ensure proper checks for model_num and instance validity when accessing OBJ_RAW_POF and OBJ_PROP objects. Prevents crashes from out-of-bounds or missing data in Pof_objects and Props.
2026-08-23 13:34:44 +02:00
Goober5000 5a67e8e952 Merge pull request #7711 from Goober5000/fix/sexp_parsing
patch a hole in SEXP syntax checking
2026-08-18 00:52:21 -04:00
Goober5000 1ea98b19d5 tiny tweak fix to the comm menu
Reset the selected item when we open a new menu.  This keeps the display state and internal state in sync if the player mixes arrow presses and number presses.  Follow-up to #7688.
2026-08-16 15:10:35 -04:00
Goober5000 3f6a9f12fa Merge pull request #7688 from wookieejedi/fix-skip-hidden-menu-items
Fix COMMS_MENU_SELECT control usage with 'Hide  Rearm/Repair items' and cleanup selection visibility
2026-08-16 14:57:20 -04:00
Goober5000 860604a726 Merge pull request #7683 from wookieejedi/forward-speed-launch
Add weapon launch curve input 'Target Forward Speed'
2026-08-16 14:42:49 -04:00
Goober5000 a9f797d3f2 Merge pull request #7689 from wookieejedi/more-multi-fixes
Fix various multi bugs
2026-08-16 14:42:25 -04:00
Goober5000 cdd477fddf Merge pull request #7704 from wookieejedi/fix-ai-ramming-big-targets
More Fixes for AI Ramming into Stationary Targets
2026-08-16 13:20:59 -04:00
wookieejedi 4a1f16c453 update to new version 2026-08-16 13:06:10 -04:00
The Force 54caf6ec25 New guard-range sexp (#7606)
* New guard-range sexp

New guard-range sexp which allows different ranges for different guarders

* cast value

* Clang

* bugfixes

* fix CI

* Address Feedback

* address feedback

* typo
2026-08-16 17:53:41 +01:00
wookieejedi 0f3f80b03a Merge branch 'master' into fix-skip-hidden-menu-items 2026-08-16 08:56:40 -04:00
Kestrellius 1967daffd3 Vectorize MsgItems (#7687)
Convert MsgItems from an array to a vector, and remove the associated limit value and counter.

* vectorize msgitems

* appeasement

* leave me alone clang

* remove optional

* cleanup

* changes requested

* clang

* clang what is WRONG with you

* feedback

* remove flag in .h
2026-08-16 02:04:50 +00:00
Goober5000 da4f4e70ac patch a hole in SEXP syntax checking
An operator that isn't enclosed in parentheses could trigger an UNREACHABLE, which crashes in Debug and is undefined behavior in Release.  Catch it in a more appropriate way.
2026-08-15 15:21:03 -04:00
Goober5000 a4e33109a0 Merge pull request #7707 from Goober5000/fix/local_ssm
remove an unneeded SSM assertion and fix some parent checks
2026-08-15 12:13:01 -04:00
Goober5000 7418bf5f42 Merge pull request #7702 from wookieejedi/prop-type-fix
Update type Prop to ensure it's on object list
2026-08-14 18:01:27 -04:00
Goober5000 d5d4a16664 remove an unneeded SSM assertion and fix some parent checks
Contrary to the comment, local SSMs do not actually need a parent.

Also fix two other places where a parent was assumed but may not exist.
2026-08-14 15:11:10 -04:00
Fabian Woltermann f840e545b9 Fix base angle calculation for ventral turrets without custom matrices (#7706) 2026-08-14 20:45:18 +02:00
wookieejedi d5c371c7a2 clang 2 2026-08-12 16:20:17 -04:00
wookieejedi e983dfbe15 clang 2026-08-12 16:18:55 -04:00
wookieejedi 891a63420c fix old copy paste bug and power usage 2026-08-12 15:43:19 -04:00
wookieejedi 0107e1b25f clang 2026-08-12 13:35:41 -04:00
wookieejedi 9295d1a796 More Fixes for AI Ramming into Stationary Targets
TLDR: This is a long description, but it boils down to exposing 2 hardcoded AI values and updating 1 value in the optional 'better collision avoidance' behavior allows mods to substantially fix fighters ramming into capital ships they are attacking.

AI accidentally ramming into big ships while trying to evade fire from a hostile turret or a dogfight makes some sense given a chaotic combat situation. What does not seem good though is AI not being able to attack a large stationary target that is not shooting back and has no fighters around. This is especially evident in mods that use the new strafing AI fields, where AI will fly to a distant point then turn around to do an attack run, then once close enough pick another strafing run to conduct. In these situations, AI will commonly not pull up from the attack run in time, especially for mods that use different speeds or AI damp values compared to retail.

Fortunately, there exposing two values to the AI profiles allows modders to tune these values, the strafe retreat time and strafe retreat distance. By default these values are 2 seconds and 100 meters, which is commonly far too short for mods with higher speeds or larger damp values. Exposing these values allows modders to make the AI far more effective and virtually eliminate ramming into stationary ships they are attacking. For example, on current 26.0 with FotG testing we register 2-4 rams of a stationary target per minute. Using the new exposed values in this branch eliminates the ramming (after 10 minutes of firing no ramming occurs across multiple runs of this and other test missions).

Furthermore, this PR helps `better_collision_avoidance_triggered` function (enabled by using `better collision avoidance` in the `ai_profiles.tbl` fix an edge case with predicting collisions. On current master the `delta_time` value used in this function was `0`, which was only ever used eventually downstream in the `will_collide_with_big_ship` function call. This `will_collide_with_big_ship` function had an early return on line 7620:

```
int will_collide_with_big_ship(object *objp, vec3d *goal_point, object *big_objp, vec3d *collision_point, float delta_time)
{
	float		radius;
	vec3d	end_pos;

	radius = big_objp->radius + delta_time * objp->phys_info.speed;

	if (vm_vec_dist_quick(&big_objp->pos, &objp->pos) > radius) {
		return 0;
	}
```

This early return and the passing of `0` to the `delta_time` from `better_collision_avoidance_triggered` meant that the early out radius distance was only the big object's radius, and did not project any forward time. In other words, better collision avoidance only actually checked or triggered when the small ship was within the radius distance of the large ship. Thus, with ships that had geometry reach right to the edge of the object radius, it could result in the small ship not having enough time to react to avoid a collision. Notably, all other calls to `will_collide_with_big_ship` use a `delta_time` of 5-10. As such, this PR also fixes that edge case by ensuring the better collision avoidance also incorporates some lead travel time by passing a non-zero value for delta time. Given `better_collision_avoidance_triggered` aggression factor is 3.5 by default, it fit well in testing to pass this value to `delta_time`. That aggression factor is already tuneable for mods, so also using it here provides extra adaptability.

Overall these values and updates were tested and substantially remove collision accidents, especially with ships with high speeds and/or higher damps. The PR boils down to exposing two values to the AI profiles table and updating values in the optional 'better collision avoidance' flag, so it will not affect retail. Happy to discuss as well, thanks!
2026-08-12 12:57:29 -04:00
wookieejedi 075e1226b7 Update type Prop to ensure it's on object list
Seems like props were missing from the object type list, so adding them in this relatively small PR. Happy to edit or do something differently if folks want though!
2026-08-10 22:15:32 -04:00
wookieejedi 35d8c6ea4e Fix two small issues (#7690)
* Fix two small issues

Fix copy-paste bug where setting `$Ask Help Hull Percent:` never properly got set. Fortunately this does not affect the AI, only when the AI sends a message to the player asking for help.

Fix edge-case issue: in `find_turret_enemy`, the `turret-tgt-ship-tgt` shortcut takes the parent ship's target and indexes Ships[] with it unconditionally, but `aip->target_objnum` could be a weapon or asteroid, which could be at an index higher than the ships index, and then trying to look up team could lead to bad data.

* comment formatting
2026-08-08 10:26:53 -04:00
Goober5000 745398e6b9 Merge pull request #7679 from Goober5000/refactor/loadout_pools
refactor loadout pools for vectorized ship and weapon classes
2026-08-07 22:09:26 -04:00
Mike Nelson 96d5182bb1 Add text-to-speech Lua API to briefing/debrief/tech room UI sections (#7629)
Bind the existing fsspeech_* wrappers into the ui.Briefing, ui.CommandBriefing,
ui.Debriefing, and ui.TechRoom scripting sections so Lua UIs (e.g. SCPUI, which
overrides the native screens) can drive synthesized speech again.

Each section gets playTextToSpeech, stopTextToSpeech, pauseTextToSpeech,
isTextToSpeechPlaying, and isTextToSpeechEnabled. Briefing/command-brief/debrief
use FSSPEECH_FROM_BRIEFING; the tech room uses FSSPEECH_FROM_TECHROOM. fsspeech_play
already self-gates on the Speech.* options, so these are no-ops when speech is off.
2026-08-07 16:42:05 -04:00
Goober5000 4d50a1bef8 un-consolidate model flags (#7693)
Restore the original flag values that were consolidated in #7588.  Since the flags are saved in the mission file as an integer, the original values must be preserved.

Since `MR_ATTACHED_MODEL` was removed in the original PR, that is renamed to `MR_EMPTY_SLOT6`.
2026-08-07 08:41:43 +02:00
Goober5000 0e7f1c4d74 Merge pull request #7678 from Goober5000/refactor/static_alias
clean up static alias lists used for name lookups
2026-08-06 15:18:26 -04:00
wookieejedi 2e712f8e2e Fix various multi bugs
PR addresses various small but longstanding mutli-related bugs. In draft status pending additional testing.
2026-08-06 12:52:24 -04:00
wookieejedi 23f4a1ca1f Fix COMMS_MENU_SELECT control usage with 'Hide Rearm/Repair items'
The game settings flag '$Hide main Rearm/Repair items in Comms Gauge:' hides the 'Rearm and Repair' lines in the HUD Comms menu from appearing, which is useful for mods that do not have repair ships and thus those lines confuse players. Unfortunately, the newer `COMMS_MENU_SELECT` control bindings do not properly account for hidden menu items, so using those controls on a comms menu with 'Rearm and Repair' hidden means the selection index gets off and also confuses the player.

This PR fixes that by allowing `hud_squadmsg_selection_move_down()` and `hud_squadmsg_selection_move_up()` to skip hidden menu items. Tested and works as expected.

For folks using the COMMS_MENU_SELECT controls, there is also a current UI confusion when the comms menu is first brought up because the first item is selected, but the `Display_selector` does not show. Thus, players are unsure what item is actively selected even though one is actively selected. In the original comms menu select PR this was set to on by default, but then switched to off by default by a different developer a bit later. This choice is especially useful for mods that have many players with gamepads such as Event Horizon. Alternatively, mods that already have many number keys utilized for other gameplay aspects seem to prefer to keep the comms menu visuals as is and only show the selection if the player uses those keys. Given there is clearly arguments for both reasons, ideally modders should be able to choose how it displays for their own mods (always or off for the first pop-up of the Comms menu).  Thus, this PR adds that as a cleanup game option, too. This also was tested and works as expected.
2026-08-06 11:06:41 -04:00
wookieejedi 50935e540e Fix scripting copy-paste bug and other minor optimizations (#7684)
* Fix scripting copy-paste bug

The iterators for secondary banks for lua access had a copy-paste bug from primaries, so we should fix that. The early == -1 break masks it whenever a ship uses 3 or fewer secondary banks, which is probably why it went unnoticed.

Also add some additional low-hanging fruit optimizations.

* radar distance and other cleanup

* clang
2026-08-05 23:09:57 -04:00
Goober5000 304dbb60c5 Merge pull request #7680 from Goober5000/refactor/dense_class_data
store campaign allowed-class lists in sets
2026-08-04 23:10:07 -04:00
Goober5000 b1ada89f8d Merge pull request #7630 from Goober5000/claude/extract-name-conflict-checker
Extract common name conflict checker for FRED2 and qtFRED
2026-08-04 22:24:05 -04:00
Goober5000andClaude Opus 4.7 30d81a83fb store campaign allowed-class lists in sets
Convert the allowed-ships and allowed-weapons lists to sets, rather than naive vectors that stored a true/false for every class.  Since these are ordered sets, iteration occurs in the same sequence as iteration of `Ship_info` or `Weapon_info`.  Associated data structures such as `Granted_ships` and `Granted_weapons` are converted as well.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-08-04 22:14:58 -04:00
wookieejediandGoober5000 2821eb8ccf Update code/network/multi.h
Co-authored-by: Goober5000 <[email protected]>
2026-08-04 21:55:08 -04:00
wookieejedi 08bb369e46 fix order and multi bump 2026-08-04 16:07:06 -04:00
Taylor Richards 6d3c2873c4 improve support for gamepads (#7655)
Use the SDL gamepad API to add full gamepad support. Adds rumble for supported
gamepads and changes the FF in-game options to take immediate effect instead
of requiring a restart.

Additionally this makes changes to allow gamepad triggers to be used as both
an axis and a button. This support is specific to gamepads since we can
explicitly identify the trigger with the API and act on it accordingly. FSO
control config doesn't currently support such an action directly however so
we have to hack it in just a bit. Due to this the control binding will show
the trigger axis name bound to a button control only while a gamepad is
connected, otherwise it shows a button name associated with the trigger.
2026-08-04 15:49:46 -04:00
wookieejedi acd868fa49 one more multi clang 2026-08-04 09:56:21 -04:00
wookieejedi 4c4cc44310 multi packets 2026-08-04 09:05:08 -04:00
wookieejedi 61b7c9f3f1 clang auto format typo 2026-08-04 07:56:44 -04:00
wookieejedi af7a2f37ed clang again 2026-08-04 07:36:38 -04:00
wookieejedi 208cfdfed3 clang 2026-08-03 23:18:03 -04:00
wookieejedi 9ccfe9d9e3 Add weapon launch curve input 'Target Forward Speed'
Following style of 'target radius' and other useful weapon launch curve inputs, this PR adds 'Target Forward Speed' which can be useful to use as an input and then use FoF as an output to do things like make turrets have a tougher time having dynamic FoF depending on target speed.
2026-08-03 23:03:35 -04:00
Goober5000 3bfe71d834 Merge pull request #7670 from Goober5000/fix/msg_arg_count
send-message-list arg-count forgiveness, plus better error checking
2026-08-03 22:21:13 -04:00
BMagnu 09de3f1fb8 Fix deferred lighting on vulkan (#7682) 2026-08-03 15:52:34 +02:00
Goober5000andClaude Opus 4.7 77186c72fc refactor loadout pools for vectorized ship and weapon classes
Convert ship/weapon loadout pools from naive per-class arrays to ordered maps that list loadout entries.  Each entry represents a ship/weapon class and its count.  An absent entry means the class is not in this mission's loadout.  Since these are ordered maps, iteration of the map keys occurs in the same sequence as iteration of `Ship_info` or `Weapon_info`.

Includes several bugfixes:
- `csg_read_loadout` now clears both pools before reading.  Previously the pools were only zeroed in `mission_campaign_init`
- `restore_wss_data`: non-transmitted classes are now absent rather than memset to 0
- a copy-paste bug where the weapon pool entries were bounds-checked against MAX_SHIP_CLASSES
- `wss_maybe_restore_loadout`: the pool write-back now preserves loadout membership instead of writing a count for every class
- `ss_dump_to_list`/`ss_swap_list_slot`: returning a slot ship whose class is not in the pool now makes it available instead of silently losing it.  Unreachable in retail but reachable via script
- off-by-one errors in the Lua `Ship_Pool`/`Weapon_Pool` indexers

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-08-03 01:28:28 -04:00
Goober5000 3afa3293c8 Merge pull request #7672 from Goober5000/enhancement/containsKey
add contains, at_or, and value_or to the SCP maps
2026-08-03 01:25:50 -04:00
Goober5000 6bc6426672 clean up static alias lists used for name lookups
Refactor `Ship_class_names`, `Iff_info_names`, and `Ai_class_names` to be populated once at parse time, as opposed to ad-hoc and possibly many times.

Also make `Ai_classes` and `Spawn_names` proper SCP_vectors.
2026-08-02 18:26:47 -04:00
Fabian Woltermann cb284b7f13 Update shader logic for shadow handling and Vulkan large shader configurations (#7659)
Refactor shadow flag handling in shaders to improve compatibility with small-shader mode. Add support for Vulkan's `-no_large_shaders` switch to split model ubershaders for better driver compatibility. Adjust related comments and preprocessor checks for clarity.
2026-08-02 06:29:02 +02:00
Goober5000 10edea2291 add contains, at_or, and value_or to the SCP maps
Extend the various maps to add a `contains` function, just as several other containers already add `contains`.

Also add `at_or` and `value_or` functions to provide ways to query for map values without inserting anything by default, as `operator[]` does.  If the map does not contain the key, the default value is returned.  Use `at_or` to return a const reference and `value_or` to return a value.  (These are only added to `SCP_map` and `SCP_unordered_map`; a `SCP_multimap` equivalent isn't as clearly useful.)

Also add Class Template Argument Deduction (CTAD) guides, per existing precedent.  And delete function overloads that are intrinsic footguns.
2026-08-01 23:49:27 -04:00
BMagnu 9320ed7e19 Reasonably generic mouse position handling (#7674) 2026-08-01 19:46:57 +02:00