1544 Commits
Author SHA1 Message Date
dustinspace217andDustinspace217 12bddb8366 P3: Add weapon_info::clone (#7847)
* Add weapon_info::clone

Copies every member of a weapon class, following ship_info::clone, so a
weapon can be created from another as ship templates do. The
CLONE_UNIQUE_PTR macro moves from ship.cpp to utils/string_utils.h so
both clone functions share it.

* Group weapon_info::clone fields as the struct declares them

---------

Co-authored-by: Dustinspace217 <[email protected]>
2026-11-04 01:16:41 -05:00
Goober5000andClaude Sonnet 5.5 014e14af6f Remove 3D shockwave glow map warning
The warning fired for any 3D shockwave model without a glow map, but it turns out that situation is fine.  Drop the warning along with the cmdline include it required.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-09 00:38:27 -04:00
Goober5000andClaude Opus 5 c342b6df61 Warn when a 3D shockwave model has no glow map (#7795)
Check each 3D shockwave model when it is loaded and warn if none of its textures has a glow map. The check is skipped when glow maps are disabled, since they are not loaded then.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-09-24 11:23:11 +09:00
Goober5000andClaude Fable 5.1 b609a6857b Time an animated shockwave base texture like its glow map
A 3D shockwave's glow map already takes its frame from the shockwave's
elapsed time so the animation spans the shockwave's life.  Do the same
for an animated base texture, and skip the radius fade for it, since the
artist's frames then control the brightness the way they do for the glow.
A static base texture still fades with the radius.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-22 01:58:37 -04:00
Goober5000andClaude Opus 5 e2be023f84 Replace the Cockpit_active global with computed predicates
Cockpit_active was latched inside ship_render_player_ship(), which only
runs when Viewer_obj is non-null.  External, chase, warp-chase, topdown,
free-camera and dead views all null Viewer_obj, so the flag froze at its
last cockpit-view value and cockpitinactive HUD gauges vanished.  It was
also read before being written each frame (by the show-ship check and the
shadow helpers), so those decisions lagged a frame on any transition.

Replace it with three functions computed on demand:
- ship_cockpit_enabled(sip): the ship has a cockpit model and cockpits
  aren't disabled; used by the Show_ship_only_if_cockpits_enabled checks
- ship_render_player_cockpit(sip): the above, outside topdown view;
  replaces three duplicated copies of that expression
- ship_render_player_cockpit_active(): whether the viewer's cockpit is
  being rendered this frame; used by the HUD cockpit-view-choice checks

With the predicate correct, the VM_CHASE special cases added for #4804
are no longer needed and are removed.  In chase view, cockpitinactive
gauges now also respect pop-up state, No_ets, and setRenderOverride,
which the early return in HudGauge::canRender() used to bypass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-11 23:39:05 -04:00
Goober5000andClaude Opus 4.7 190472f77e Remove the weapon class limit
With every fixed-size weapon-class-indexed structure now converted to dynamic containers, we can finally remove the `MAX_WEAPON_TYPES` limit!

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-09-08 13:20:36 -04:00
Goober5000andClaude Fable 5.1 04e698c29b fix weapon substitution bank attribution and turret ammo accounting
Follow-up to #7635.

Pass the firing bank explicitly through weapon_create() and beam_fire()
instead of searching the ship's banks by weapon class, which could
attribute substitution patterns to the wrong bank.  Factor the
substitution logic into get_weapon_substitution_tuple() and only apply
linked/dual-fire pairing to ship-level fire, not turret fire.  Skip
substitution on multiplayer clients, since the server already resolved it.

Derive turret bank indices from the weapon slot being fired rather than
the turret's bank cursor, so ammo and substitution state are tracked on
the bank that actually fired.  Previously a single-selection turret could
consume ammo from a bank it never fired, and non-ammo turrets (whose
cursors stay at -1) would have skipped substitution entirely.

Use the Player_ship object flag rather than Player_obj in
ship_secondary_bank_can_dual_fire() so the server and clients agree on
dual fire for remote players, and guard ship_secondary_has_ammo() against
a negative bank index.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 19:22:45 -04:00
Goober5000 1c817b5965 Merge pull request #7737 from Goober5000/refactor/team_data
refactor team loadout data structures in preparation for lifting the ship class limit
2026-08-28 16:48:39 -04:00
Goober5000andClaude Fable 5 d413e52b33 External weapon model refactor: consolidate per-bank state, fix design issues (#7634)
* consolidate per-bank external weapon model state into one struct

The state for a bank's external weapon model was scattered across two
structs and three naming schemes: the model instance and its weapon in
ship_weapon, the firing-point chain counter in a combined array indexed
with the bank + MAX_SHIP_PRIMARY_BANKS packing convention, and the
gatling spin rate/angle on ship itself.

Gather them into external_weapon_state, with one array for primary
banks and one for secondary banks in ship_weapon.  This removes the
index-packing convention (ship_get_external_model_fp_offset now takes
the bank's state directly), and ship_delete now also frees secondary
instances should a future weapon ever create one.

No behavior change.

Co-Authored-By: Claude Fable 5 <[email protected]>

* update external weapon model spin in per-frame processing

The gatling spin state was integrated inside ship_fire_primary (spin-up)
and ship_stop_fire_primary_bank (spin-down), which entangled a per-frame
visual/state update with the firing event paths and had two quirks:

- Spin-down only ran when something called the stop-fire path, so a bank
  could freeze mid-spin (e.g. AI ships that stop calling
  ship_fire_primary without going through ship_stop_fire_primary).
- The spin angle only advanced when the ship class set
  $Show Primary Models:, so identical weapon state evolved differently
  per ship class even though the rate (which gates firing) always ran.

Banks that try to fire now just request spin-up, and
update_external_weapon_spin() -- called from ship_process_post next to
update_reload_percent(), which was moved out of the physics code for
the same reason -- integrates the rate and angle every frame.  The
firing gate (no shots until the barrels reach full speed) is unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>

* make external_model_num mean what it says; gate firing offsets on drawn models

Since the original 2005 implementation, external_model_num was bashed
to model_num at parse time when no $External Model File: was given, so
every POF-rendered weapon appeared to have an external model.  All the
checks downstream therefore tested 'has any model' while reading as
'has an external model', and two paths leaked the fallback into
gameplay:

- ship_fire_secondary applied the external-model firing point offset
  without checking $Show Secondary Models: (unlike the primary path),
  so any missile whose own in-flight POF contained gun points would
  have its launch position offset on every ship in the game.
- The AI line-of-sight check, copied from ship_fire_secondary,
  applied the offset with no draw check for either bank type, so for
  primaries it could disagree with the actual firing path.

external_model_num now stays -1 unless $External Model File: was
given.  Rendering code (ship_render_weapon_models, the HUD hardpoints
gauge, and the gatling instance helper) falls back to the weapon's own
model at the point of use, preserving the existing display of missiles
on hardpoints.  Firing point offsets now require a dedicated external
model *and* the bank's models to actually be drawn, in all three
paths.  In practice this does not change firing behavior, because GPNT
chunks are never added to weapon models except when explicitly built
as external models.

Co-Authored-By: Claude Fable 5 <[email protected]>

* warn on external weapon model conventions that are silently ignored

Two load-bearing conventions of the external weapon model feature had
no diagnostics:

- Only the first gun bank of an external model supplies firing points;
  additional banks are silently ignored.  Warn when an external model
  has more than one gun bank.
- $Show Primary Models: / $Show Secondary Models: must list exactly
  one bool per weapon bank; missing entries silently default to not
  drawing.  Warn when the list length doesn't match the bank count.

Co-Authored-By: Claude Fable 5 <[email protected]>

* orient external weapon models along their slot's firing normal

External weapon models were always rendered pointing ship-forward, and
reloading missiles slid backward along fixed -Z, regardless of the gun
or missile point's normal -- so a bank angled 45 degrees outward fired
along its normal while its mounted model pointed dead ahead.  The
per-slot angle offset was also applied as a roll about ship-forward
rather than about the firing axis.

ship_get_weapon_model_slot_transform now builds the slot orientation
from the firing normal (identity for the usual dead-ahead normal, so
existing forward-facing mounts render exactly as before) with the
angle-offset roll applied about that axis, and slides reloading
missiles along the normal.

Correspondingly, ship_get_external_model_fp_offset now rotates the
external model's firing-point offset by the same slot transform, so
shots continue to emerge from the drawn barrels on angled mounts, and
now also respect the angle-offset roll (previously the offset was
added unrotated, mismatching rolled models).

Co-Authored-By: Claude Fable 5 <[email protected]>

* address review: same-frame spool-up gating; optional slot transform outputs

Move the update_external_weapon_spin() call from ship_process_post() to the top of ship_process_pre().  The update now happens before any firing attempt in the frame, so the spool-up firing gate sees the current frame's spin rate, as it did on master where the update happened inside the firing code.  This also makes the ordering consistent for the AI regardless of Framerate_independent_turning.

Also make both outputs of ship_get_weapon_model_slot_transform() optional.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-27 22:08:06 -07:00
Goober5000andClaude Opus 4.7 49a9141073 Convert team_data to sparse loadout entry vectors
team_data was the last persistence-adjacent structure sized by MAX_SHIP_CLASSES: four parallel ship arrays plus four parallel weapon arrays (one slot per mission-file loadout line, holding a class or a sexp variable name, and a count or a sexp variable name) with manual num_*_choices counters, plus a dense per-class weapon_required flag array.  Convert all of it to the sparse-container family:

  ship_list / ship_list_variables / ship_count / ship_count_variables
    -> SCP_vector<loadout_entry> ship_choices
  weaponry_pool / weaponry_count / weaponry_pool_variable /
  weaponry_amount_variable
    -> SCP_vector<loadout_entry> weapon_choices
  bool weapon_required[MAX_WEAPON_TYPES]
    -> SCP_set<int> required_weapons

where loadout_entry is {class_index, count, class_variable, count_variable}, with empty variable strings meaning the value was given literally.  num_ship_choices / num_weapon_choices become .size().

Intentional behavior fixes, all previously latent memory errors or
data bugs:

 * is_ship_assignable stored an alt ship CLASS in a variable used as a
   loadout list INDEX when default_to_this_class was false, then
   swapped to ship_list[class] - garbage for any mission where the two
   domains diverge.  It now swaps to the alt class itself, per the
   evident intent.

 * The default-ship fallback read ship_list[0] even when a team had
   zero ship choices; it now leaves default_ship at -1, and
   ss_fixup_team_data guards its append of the default ship accordingly.

 * FRED2's dumpstats indexed Ships[] with a ship class when printing
   loadout entries; it now prints the entry's class or variable name
   directly.

 * Team parse now clears the previous mission's entries explicitly
   rather than relying on overwrite-in-place.

This clears the largest remaining cluster of MAX_SHIP_CLASSES references on the way to lifting the ship class limit.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-08-27 00:58:20 -04:00
Goober5000 ee4b554dd4 standardize and update the various _INDEX macros 2026-08-23 21:38:52 -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 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
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 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
Goober5000 4e26511055 Merge pull request #7635 from Goober5000/fix/firingpoints
fix dual fire handling for banks that cannot use it
2026-07-28 19:42:24 -04:00
Goober5000andClaude Fable 5 60c554354c fix dual fire handling for banks that cannot use it
The Secondary_dual_fire flag is per-ship, but not every secondary bank
can dual fire.  Previously the HUD drew the dual fire link icon even
when the armed bank had only one firepoint, and firing such a bank
cleared the flag entirely, silently discarding the player's dual fire
preference for the other banks.

Extend the ignored-rather-than-cleared approach already established
for no-doublefire weapons to the single-firepoint case:

- add ship_secondary_bank_can_dual_fire() as the single source of truth
  for bank validity, No_doublefire, ai_profiles restrictions, and
  firepoint count
- ship_fire_secondary() now fires single and leaves the flag alone when
  the bank cannot dual fire, instead of removing the flag
- the weapons gauges and the hardpoints gauge consult the helper, so the
  link icon and second-firepoint highlight are no longer drawn for
  incapable banks
- the dual fire toggle on a single-firepoint bank now explains why it
  cannot dual fire and leaves the preference untouched
- restoring the saved dual fire preference no longer depends on bank 0's
  firepoint count, since incapable banks now simply ignore the flag
- key control and force feedback also consult the helper

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-28 01:08:07 -04:00
The Force da05081405 Fix C4709 Warnings In modern VS (#7576)
* Fix C4709 Warnings on latest VS

* more

* suppress false positive

* Switch to using any/none_of

* Address Feedback

* Fix Line endings?

* Fix commits and strip out flag_combinator

* more fixes

* nolint
2026-07-26 14:33:00 +01:00
Taylor Richards 039880491a port to SDL3 (#7220)
Basic port from SDL2 to SDL3. Also updates imgui to 1.92.5.
2026-07-23 15:52:27 +02:00
Goober5000 3e317d9734 Merge pull request #7515 from Goober5000/feature/reorder_ships_wings
add a Reorder Ships and Wings editor to FRED
2026-07-20 23:56:30 -04:00
Goober5000 47d5ccca35 Merge pull request #7588 from Goober5000/cleanup/external_weapons
External weapon model cleanup: consolidate duplicated logic, fix several longstanding bugs
2026-07-20 23:40:35 -04:00
Goober5000andClaude Fable 5 7b241812ed make ship move-correct
Ship's implicit move operations compiled but were semantically broken in
two ways: moving copied the subsys_list sentinel's links verbatim,
leaving the bookend nodes of the intrusive subsystem list pointing at
the old sentinel address; and the raw owning warpin_effect /
warpout_effect pointers were copied without nulling the source, so a
vacated Ships[] slot aliased live WarpEffects that ship::clear() (on
slot reuse) or ship_close() (which walks every slot) would delete out
from under the destination ship.

Fix both at the member level so the compiler-generated moves are
correct by composition:

- Add ship_subsys_sentinel, derived from ship_subsys, whose move
  operations re-link the bookend nodes (handling the null-linked,
  self-referential-empty, and populated source states) and leave the
  moved-from sentinel as an initialized empty list.  Copying is
  deleted.  Public inheritance keeps &ship::subsys_list convertible to
  ship_subsys*, so list_init, GET_FIRST, and every other call site is
  unchanged.

- Convert warpin_effect and warpout_effect to std::unique_ptr.  The
  delete-and-null blocks in ship::clear(), ship_close(), and
  ship_set_warp_effects() collapse into reset(); call sites that borrow
  the pointer into a raw local now use get().

With the members handling themselves, declare ship's special member
functions: defaulted default constructor and moves, deleted copies
(previously implicit via the unique_ptr members, now stated intent).
The moves are deliberately not declared noexcept because members like
SCP_map and std::deque do not have standard-guaranteed nothrow moves;
the computed exception specification is used instead.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-20 23:04:56 -04:00
Goober5000andClaude Fable 5 ea0e4feafa consolidate duplicated per-weapon page-in code
weapons_page_in(), weapons_page_in_cheats(), and weapon_page_in() each
duplicated the same ~60-line block for loading a weapon's models and
graphics.  Extract it into a weapon_page_in_one() helper; the cheats
variant passes load_graphics = false to preserve its behavior of
loading only model geometry.

Also fix the tautological Assertion in the default render_type case:
the old condition was always true inside that branch, so it could never
fire.  It now asserts render_type == WRT_NONE, which is the only other
legitimate value (invisible weapons).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-13 13:19:22 -04:00
wookieejedi 1ca6c6a188 Fix shockwave damage bug (#7601)
* Fix two shockwave bugs

Bug:
Ship and SEXP created shockwaves with 0 speed last forever. A shockwave speed <= 0 is an "instant" shockwave, but the speed is used as a denominator for total_time. Dividing by 0 that creates in infinite shockwave (frozen at its initial radius of 1.0).

Fix:
Thus, add a safeguard to protect against the infinite duration. Note, ship-death and sexp shockwave run shockwave straight to shockwave_create(), whereas weapon shockwaves run weapon_do_area_effect() if <= 0 speed.

Bug:
It is possible the shockwave may have lifetime shorter than one frame (e.g. high speed, small radius), which by default results in shockwave applying no damage.

Fix:
Provide optional fix to ensure shockwave is not killed until after this frame's damage pass has run.

Tested and work as expected.

* just the 1expire fix

* comment cleanup
2026-07-12 22:56:37 -04:00
Goober5000andClaude Opus 4.8 bed228d264 avoid undefined behavior from UNREACHABLE on reachable code paths (#7555)
* avoid undefined behavior from UNREACHABLE on reachable code paths

UNREACHABLE expands to __assume(false) / __builtin_unreachable() in
release builds, which is undefined behavior if the code is ever actually
reached. Many UNREACHABLE sites only guard against unexpected-but-
possible runtime states (values from tables, mission/save files, network
packets, scripting, or user input), so reaching them should degrade
gracefully rather than invoke UB.

Replace UNREACHABLE with Assertion(false, ...) at all such sites. It
still pops an error in debug builds, but in release it is a harmless
no-op that simply falls through to the following code. Sites that are
genuinely unreachable by local invariants (e.g. a switch over a bounded
random number) are left as UNREACHABLE.

A few converted sites had no safe fall-through -- an uninitialized read,
null dereference, or null call would have followed -- so they also get a
minimal recovery: initialize the value, guard the dereference, return
early, or skip the offending item.

Where the converted site was a simple guard of the form
    if (x) { Assertion(false, ...); return; }
hoist the check onto the invariant instead:
    Assertion(!x, ...);
    if (x) { return; }
This states the expectation directly and shows the offending value in
the debug popup, while keeping the same graceful runtime degradation.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* addendum

After consultation with Lafiel, use UNREACHABLE in situations that are effectively impossible even if not provably impossible.  UNREACHABLE = "this shouldn't ever happen"; Assertion = "if this ever happens, it's a coding error".  Also fix a few other sites and change a couple to Warnings.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-09 11:20:25 +09:00
BMagnu 21b8035e63 Fix possibly negative pspew value init (#7541)
* Fix possibly negative pspew value init

* fix math
2026-06-21 01:59:20 +02:00
Goober5000 ee50cde0e1 more robust handling of modelinstance teardown
Set model instances to -1 when objects are deleted, and guard against null model instances in `modelinstance_replace_active_texture`.  This may fix a crash in Event Horizon.
2026-06-12 22:39:50 -04:00
wookieejedi 0076cdb74d Fix 'ignore if dead' flag (#7509)
* Fix 'ignore if dead' flag

Fixes #7508.

The subsystem flag "ignore if dead" that many mods use is supposed to "prevent homing weapons from attempting to hit the now destroyed submodel and instead tells them to home on the main hull of the target."

Though, in actuality, the code makes the weapon dumb fire instead of home. This bug means if you destroy a subsystem with this flag, then lock onto it with an aspect weapon and fire the weapon, the weapon will just dumb fire.

With `wp->homing_subsys` cleared as this PR does, the homing code at `weapons.cpp`:5730 falls into its else branch and picks an attack point on the ship body (`ai_big_pick_attack_point / hobjp->pos`) — which is what the flag promises. Javelins, which can only home on engines, will still correctly try to re-acquire another engine in the block just below and drop lock if there's none.

This fix is tested and now the flag works as expected.

* fix for javelins
2026-06-09 12:15:29 -04:00
Mike Nelson f4d84ec47a Support Rearm Pool, Limits, and Other Features (#7249)
* framework for support ship rearm pool and flags

* scripting api

* FRED support

* QtFRED support

* do not save non-player-allowed weapons

* tvt and mission versioning

* fix variable name

* minor fixes and clarity

* oops

* add qtfred help docs

* fixes and cleanup

* clang and readability

* address feedback

* address feedback
2026-06-05 11:33:19 +02:00
Mike Nelson 31f77e5a32 Mines weapon type & weapon proximity triggers (#7461)
* new mine weapon type

* some fixes and cleanup

* fix some parsing issues

* make sure mines get plotted

* make mine spawned objects can get a correct target

* some cleanup and additional features

* chasing mines

* some Lua tweaks

* generalize proximity detonations

* minor tweaks

* collapse namespace

* address feedback
2026-06-05 14:06:00 +09:00
Goober5000 74dad95054 Merge pull request #7479 from Goober5000/fix/more_misc_bugs
miscellaneous fixes
2026-05-28 01:42:51 -04:00
BMagnu a715542405 Make beam impacts trigger even without beam flash / pierce effects (#7480) 2026-05-27 09:50:48 -04:00
Goober5000 11a58f4600 miscellaneous fixes
-weapon_spew_stats terminology, cfile fix, trigger count fix
2026-05-26 22:08:04 -04:00
Mike Nelson 9180ff364e icon closeup zoom and pos (#7398) 2026-05-09 10:50:03 -04:00
Goober5000andClaude Opus 4.6 3f85d6172a use std::move() for local variables that are copied but not reused (#7308)
* use std::move() for local variables that are copied but not reused

Addresses ~140 Coverity "Variable copied when it could be moved"
defects across 74 files.  Every std::move() targets a local variable
whose value is consumed by push_back, emplace, assignment, lambda
capture, or a function call and is never read again afterward.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* clang: use std::make_shared

* clang: use std::make_unique

* address feedback

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-05-07 14:40:38 +09:00
Goober5000 7e74e35240 Merge pull request #7258 from Goober5000/split_str_once_preliminary_cleanup
preliminary cleanup for split_str_once refactor
2026-04-29 21:53:12 -04:00
Goober5000 185b0f3dd4 Merge pull request #7296 from Goober5000/cleanup/weapon_spew_stats_refactor
refactor -weapon_spew_stats
2026-04-01 19:24:16 -04:00
Goober5000andClaude Opus 4.6 fa86575606 Suppress Coverity GLOBAL_INIT_ORDER false positives for safe globals
Add coverity[GLOBAL_INIT_ORDER] annotations to ~50 global variables
across 27 files. These were all analyzed and confirmed safe:

- ~48 OptionBuilder::finish() globals use a Meyers singleton
  (OptionsManager::instance()), which guarantees safe init order.
  Destruction is also safe due to shared_ptr ref-counting.
- 6 default-constructed container globals (vectors, maps) have no
  cross-TU dependencies at construction or destruction time.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-22 15:00:25 -04:00
Goober5000 50a4febe88 refactor -weapon_spew_stats
This splits out the stat calculation and MediaVP text generation into their own functions so that they can be used elsewhere.
2026-03-17 00:22:50 -04:00
Kestrellius df7413ad4f address review 2026-03-11 19:55:41 -07:00
Kestrellius 1fc7dd1fc5 dist squared 2026-03-11 18:42:34 -07:00
Goober5000 89e7fd91da particle fixes and subsystem speedup
1. Modify `ship_get_subsys_for_submodel` to use the subsystem indexer.  This changes the operation from O(n) to O(1) and also allows the function to work with turret gun barrels.
2. Add an `isValid` check to `ParticleSource::finishCreation` to prevent unknown state from being accessed if the source is not valid.
3. Tweak `EffectHostTurret` and make sure it works for fighter beams.
4. Prevent `createOnTurret` from running on submodels that are not turrets.
2026-03-08 20:15:02 -04:00
Goober5000 3aff98e5e3 preliminary cleanup for split_str_once refactor
String processing enhancement prerequisites for the upcoming `split_str_once` PR.

1. Add overloads of some string processing functions with a length parameter, to allow processing of substrings of C-strings
2. Add overloads of gr_printf that work with string lengths
3. Add constructors to `HUD_message_data` and `line_node`
4. Rename "size" to "len" in `vm_strndup` for clarity
5. Fill in some string attribute annotations
6. Make the rest of the HUD render functions `const`
7. Removed unneeded circular #includes in code/globalincs/memory/
2026-03-06 00:03:00 -05:00
Mike Nelson 8e23ce837f Add feature to customize how CMs are launched (#7224) 2026-03-05 15:15:56 -05:00
Goober5000 3763a29b16 Merge pull request #7098 from Goober5000/utility_enhancements
several utility enhancements
2026-02-19 00:31:45 -05:00
Mike NelsonandAsteroth 070a8e18fa Adds Props as a new object type (#6836)
* First draft of prop object type

* Add prop editor dialog in FRED

* prop sexps

* lua table prop support

* lab support

* lua mission access to props

* prop collision support

* use std::optional so the object->instance id is always valid

* allow props to block suns

* minor cleanup and remove arbitrary limit. Still limited to 500 objects.

* Sort props by category

* cleanup

* implement collision hooks

* parse prop flags and further ensure props are inited and closed correctly

* Add Cyborg's multi suggestions

* fix missing header

* add props to empty slots if available

* add multi signature

* fix rebase issues and match collisions to the new multithread style

* appease Clang the Conquerer

* save/parse mission prop classes by name

* Clean up comments and finish TODOs

* fix string errors

* clang wants this to be static now

* address feedback

* address feedback

* Use model num from prop info instead

* merge prop and ship collision group sexps together

* fix rebase bug

* address feedback

* fix name shadowing

* ship heavy submodel

* clang

---------

Co-authored-by: Asteroth <[email protected]>
2026-02-16 14:41:34 +01:00
Goober5000 7277fc11ff Merge pull request #7186 from Goober5000/ship_class_display_name
make ship and weapon class display names SCP_string
2026-02-14 21:23:50 -05:00