The numeric branch of the OPF_GAME_SND check in check_sexp_syntax never
actually ran until the type2 variable-overload bug was fixed, so missions
using a sound index of -1 ("no sound" / "default") loaded fine. Now that
the check is live, explicitly allow -1, which the runtime already treats as
an invalid (unset) sound. Also return the more descriptive
SEXP_CHECK_INVALID_GAME_SND / SEXP_CHECK_INVALID_FIREBALL error codes, and
let nested-operator (SEXP_ATOM_LIST) arguments fall through since their type
is already validated upstream.
Also route the Lua SEXP soundentry argument through sexp_get_sound_index so
it accepts a table index, an operator, or a name like the core SEXPs do,
instead of only a name.
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
If invalid UTF-8 is encountered, return the standard Unicode replacement character 0xFFFD. When incrementing or decrementing, make a best effort to follow the code's instructions. It might produce one or more � characters, but that's better than an Error and a hard crash.
Also move character constants to standardized locations.
CButton::SetBitmap blits a bitmap verbatim and does not perform the
magic-color substitution MFC applies when loading toolbar bitmaps. So a
button bitmap's background -- the legacy C0C0C0 gray baked into play.bmp
et al., or a magenta transparency key -- was drawn literally, reading as
a dark/colored rectangle instead of matching the real button face
(~F0F0F0 on modern Windows), and a disabled bitmap button embossed its
whole opaque rectangle into a solid gray square.
Add load_button_icon() to management.{cpp,h}, which builds an icon from
a button bitmap by keying out a background color into a transparency
mask. Driven through BS_ICON/SetIcon, the OS blends it with the button
face and grays it correctly when disabled. Route every play/media button
through it (event editor, briefing, debriefing, command brief, music
player, sound environment). Also add load_btnface_mapped() -- a
toolbar-style color remap -- kept as a lighter alternative for
always-enabled buttons.
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
MMessage's avi_info/wave_info unions hold strdup'd filenames in FRED
(indices in the game), but moves copied the pointers without nulling
the source, so every vector shift on Messages left moved-from elements
aliasing live allocations -- one careless edit away from a double-free.
Wrap each union in a MessageMediaRef struct whose moves null the source
and whose copies stay shallow (the event editor's backup pattern copies
then re-strdups). MMessage keeps its implicit copy and gains a correct
implicit move; access syntax at all use sites is unchanged.
Add a message_free_media_names() helper and use it at the FRED
delete/wipe sites. Two fixes ride along: messages_init() now frees
mission messages' media names before discarding them, closing a leak
that fired on every mission load in FRED; and the message editor's
OnDelete now uses the move-based array_remove_slot instead of a
copy-shift that left a stale aliasing tail.
No destructor: the active union member depends on Fred_running, and
shallow copies alias, so freeing remains explicit.
Co-authored-by: Claude Fable 5 <[email protected]>
Turrets with initial animations flip animation angles every frame in the techroom. The commit returns TriStateBool from model_get_cached_ui_render_instance specifically so callers can run setup only when a new instance is created, but only `render_tech_model` (the Lua path) actually checks it.
Since the instance is cached and persists across frames, every frame re-runs clearShipData + initial-animation start on an already-animated instance, re-applying the initial animations relative to the current (already-animated) pose. This is what seems to produces the per-frame flip/jitter.
This PR caches it to prevent this, and fixes#7526. Tests confirm it works as expected.
Center reticle does not move if player is looking around, but there is a bug where the drawn firepoints of the center reticle do impromperly sway when the player is looking around. This is b/c the live global Eye_matrix, which has the free-look rotation baked into it by `object_get_eye()` then `compute_slew_matrix(eye_orient, &Viewer_slew_angles)`
Thus, do note use `Eye_matrix` b/c firepoints will sway if looking around, instead just use 'object_get_eye' with the properly set values.
Tested and fire-points work as normal but also fix the issue when looking around in free-look or TrackIR.
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.
Several dialogs already null their global at the top of DestroyWindow, but a few do not: briefing, debriefing, event, background, message, cutscene, goal, and Fred_view_wnd. OnClose nulls in those five cover the user-initiated close path, but any teardown that bypasses OnClose leaves a dangling pointer that could be dereferenced.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
A user-declared destructor, even an empty one, suppresses the implicit
move operations, so waypoint and waypoint_list were silently copy-only:
every Waypoint_lists erase, insert, and reallocation deep-copied entire
lists, and inserting a waypoint mid-path copied every shifted waypoint.
Removing the destructors restores the implicit moves (correct and
noexcept, since the members are vec3d/int and SCP_vector/SCP_string),
turning those shifts into pointer steals. The implicit deep copies
remain available and unchanged. Waypoint identity is index-encoded in
Objects[].instance and renumbered on insert/erase, so relocation
semantics are unaffected.
Co-Authored-By: Claude Fable 5 <[email protected]>
Due to a copy-paste error, the event editor would always be marked modified. Fix the comparison.
This bug originally appeared in QtFRED also, but no longer does.
Follow-up to #6529.
* 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
Fixes a startup assertion failure in Star Fox: Event Horizon, where a Lua
call to gr.freeAllModels() wiped Polygon_model_instances but left the UI
render instance cache holding stale indices. The next state transition
called model_clear_cached_ui_render_instances() which asserted in
model_delete_instance().
Closes#7513
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
After a drag-drop that consumed the last unit of a roster class, the
active list could shrink while SS_active_list_start was non-zero,
making items above the stuck offset (including default ships returned
to the pool, such as Seth fighters) unreachable: the up-arrow handler
short-circuits when size <= max_show without resetting the offset.
- Clamp the preserved scroll offset in ss_synch_interface() against
SS_active_list_size - MAX_ICONS_ON_SCREEN.
- Harden common_scroll_down_pressed() to reset *start to 0 when the
whole list fits on screen.
Fixes#6240
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* 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
* 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
* ship texture replacement stylization pass
* refactor UI to be dynamic
* properly save textures and load them on apply
* clang
* address feedback
* clang
Implement a spherical-coordinate orbit camera for both the MFC (FRED2)
and Qt (qtFRED) editors, providing intuitive 3D viewport navigation
similar to other 3D editing tools.
Controls:
- Middle mouse drag: orbit rotate around pivot point
- Shift + middle mouse drag: pan the pivot point
- Right mouse drag: orbit rotate (alternative to middle mouse)
- Shift + right mouse drag: pan (alternative to shift + middle mouse)
- Mouse wheel: zoom in/out
- Right click without drag: context menu (preserving existing feature)
Camera pivot selection:
- If an object is selected, orbit around that object
- Otherwise, intersect the camera forward ray with the current grid
plane to find a natural pivot point
- Falls back to grid center if the camera is parallel to the grid
Grid-plane awareness:
- Orbit axes are derived from The_grid->gmatrix using vm_vec_rotate
and vm_vec_unrotate, so the camera orbits correctly on all three
grid planes (XZ, XY, YZ), not just the default XZ plane
- The look-at matrix uses the grid's up vector (uvec) rather than a
hardcoded world-up direction
Robust zoom/pan scaling:
- Zoom uses an exponential formula (powf) so the distance multiplier
is always positive regardless of physics_speed setting (1-500)
- Pan uses a clamped speed factor to avoid excessive movement at high
physics_speed values
State management:
- Keyboard camera movement (process_controls) invalidates orbit state,
so the next mouse drag re-initializes from the current view
- Orbit state is per-viewport in qtFRED (EditorViewport members) and
global in FRED2 (matching existing conventions in each codebase)
Implementation:
- FRED2: orbit math in fredrender.cpp, mouse handlers in fredview.cpp
- qtFRED: orbit math in EditorViewport.cpp, mouse/wheel handlers in
renderwidget.cpp; RenderWindow::event() updated to forward middle
button and wheel events to RenderWidget
Also fix an AND vs OR bug in FRED's process_controls().
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
The OPF_SUBSYSTEM argument-conversion path in LuaSEXP only verified
has_shipp() before calling ship_entry->objp(). A ship registry entry
retains its shipnum after the ship is destroyed or departed, but its
objnum is reset to -1, so objp() either asserts (debug) or dereferences
Objects[-1] (release) when the entry is looked up by Lua scripting
during, for example, an OnMissionAboutToEnd hook.
Tighten the check to has_objp() so absent ships short-circuit to an
empty handle, and correct the early-return type from l_Ship to
l_Subsystem. Apply the matching type correction to OPF_DOCKER_POINT,
which has the same return-type mismatch but no CTD because it never
dereferences objp().
Fixes#7206.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two related fixes flagged by an audit of vm_vector_2_matrix_norm callers:
ParticleEffectAction: locals.direction defaulted to vmd_zero_vector,
which would trip vm_vector_2_matrix_norm's unit-length assertion (and
divide by zero in release) when an action program emitted a particle
effect without first running a Set Direction action. Default to
vmd_z_vector so the unset-direction path always feeds a unit vector.
matrix_h / Lua orientation type: the element indexer (m[1..9] = x)
wrote arbitrary floats straight into mtx.a1d[idx] and the resulting
non-orthonormal matrix could flow into obj->orient via the Orientation
virt-vars on object/modelinstance/subsystem, breaking downstream engine
code that assumes the basis vectors are unit length. getInterpolated
had the same problem by design (pure linear interp, no normalization).
Adds a fourth MatrixState, NeedsOrthonormalize, which the indexer
setter and getInterpolated use to flag their output. ValidateMatrix
and ValidateAngles now call vm_orthogonalize_matrix when they observe
that state, so any consumer that reads through GetMatrix/GetAngles
gets a valid orientation without each call site needing its own guard.
getInterpolated is also marked ADE_FUNC_DEPRECATED at FSO 26.0 in
favor of rotationalInterpolate; mods targeting older versions keep
the legacy linear blend (now safely orthonormalized on use).
Per @BMagnu's review feedback on #7493: factor the yborder calculation
and clip-rect application into two file-local helpers so future changes
to the letterbox proportions live in one place.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
game_render_hud calls gr_reset_clip() before game_flash_diminish, so the
sunspot palette flash was painting over the black bars during the
supernova camera cut. Re-apply the letterbox clip around gr_flash when
it would otherwise overdraw the bars (supernova HIT+ or GM_DEAD),
matching the condition already used in game_set_view_clip.
Partial fix for #4152.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Setting SDL_HINT_JOYSTICK_THREAD=1 before SDL_InitSubSystem(SDL_INIT_JOYSTICK)
tells SDL2 to run joystick polling and HID device-detection on a dedicated
background thread, rather than processing them inline inside SDL_PollEvent
on the main thread.
Without this hint, every WM_DEVICECHANGE broadcast (which Windows sends when
*any* HID device wakes, sleeps, or pulses the USB bus) causes SDL to walk
every HID device class via SetupAPI / cfgmgr32 from inside SDL_PollEvent,
stalling the frame loop for multiple seconds on machines with many HID
peripherals - especially wireless Logitech mice and keyboards that
periodically pulse the bus. Diagnosed via ProcMon stack capture on one
affected user's machine, with the slow frame's call chain ending in
SDL2.dll -> SETUPAPI.dll -> cfgmgr32.dll -> kernel registry queries against
HKLM\System\CurrentControlSet\Enum\HID\*.
With the hint enabled, that work happens on SDL's own thread and the main
thread just dequeues already-collected events.
* change to new fog system
* Fix fog conversion issues
* remove unused old neb values
* Update scripting API
* temporary old-value round trip
* Rewrite nebula fog with four explicit parameters
Replace the legacy `+Fog Near Mult` / `+Fog Far Mult` model — which
depended on fixed engine constants — with four parameters that map
directly to renderer behavior:
+Fog 1000m Visibility fraction of light surviving 1000m of fog
+Fog Near Distance meters from camera where fog begins
+Fog Skybox Clip Distance max render distance for the skybox in fog
+Fog Clip Distance max render distance for the scene in fog
The deferred-lighting fog shader, material system, model renderer,
object sort, and the Lua mission API all consume the new parameters
directly. The legacy `Neb2_fog_near_mult` / `Neb2_fog_far_mult`
globals are removed.
Mission parsing accepts either the legacy keys or the modern keys.
Legacy values are converted to the modern set at parse time, and a
per-mission flag (`Neb2_fog_use_legacy_values`) records which keys to
write back on save. The flag is cleared only when something actually
changes, so opening and OK'ing an unmodified legacy mission preserves
its on-disk format. Saving uses `optional_string_fred` to preserve
user comments through edit cycles.
FRED2 and QtFRED background editors both expose the four parameters
in place of the old multipliers, with friendly labels and tooltips.
Both editors validate input (visibility clamped to [0, 1]; near
distance must be > 0; skybox and scene clip distances may be 0 to
disable fog at that range) and use a snapshot-and-compare at close
time so that a no-op open-then-OK never spuriously rewrites a legacy
mission in the modern format.
FRED2's background dialog is also reorganized so that "Display bg
bitmaps in nebula", "Override nebula fog palette", the RGB row, and
the four fog parameters all sit inside the Nebula group box; the
"Old Nebula" group box is restored below it with its Pattern, Color,
Pitch, Bank, and Heading controls back inside the frame. The dialog
now overrides PreTranslateMessage so that the new fog tooltips —
and the previously broken "Save sun/bitmap angles in correct format"
tooltip — actually fire.
QtFRED's BackgroundEditor.ui adds four QDoubleSpinBox controls in
the existing nebula form layout, with per-field decimals chosen to
avoid scientific notation, and per-field min/max declaring the
validation rules. The QtFRED help page is updated to describe the
new fields.
* fix tooltips
* restore forward-renderer fog
* Clang Tidy
* address feedback
* Refine nebula fog rewrite
- Rename Neb2_fog_use_legacy_values to Neb2_fog_save_legacy_values
to reflect that the flag governs save format, not runtime
behavior.
- Decide both the save flag and the legacy-to-modern conversion
purely from whether the file contains modern fog keys, dropping
the prior heuristic based on required_fso_version. A mission
without modern keys (legacy- or retail-format) converts on load
and saves back in legacy format; missions with modern keys are
saved as modern.
- Snapshot the four fog values as floats at editor open and use
fl_equal for the no-change comparison in both FRED2 and QtFRED,
replacing the FRED2 CString comparison and the QtFRED strict
inequality.
- Document the on-disk invariant in missionsave: when not saving
legacy keys, the four modern keys must always be written (never
gated on "only if non-default"), since the parser uses their
presence to decide whether to run the conversion on next load.
---------
Co-authored-by: Goober5000 <[email protected]>
* Initial KTX1/ETC2 support
* Conditional glad include
* remove unused function
* define glenum for non opengl build
* remove unused param
* fix qtbuild
* change ktx format to enum
* use nullptr
* ktx: support the same etc2 formats available in amd compressonator
* add comments and missing include
* correct flag type
* clarify variable name for clang
* cleanup
* update glad loader to GL4.3
A few visual improvements requested on Discord:
1. Use a configurable LOD to draw the outline wireframe, defaulting to LOD 1
2. Draw subsystem names with a dark outline to make them more visible
3. Draw the subsystem boundary boxes with thicker lines
* initial changes
* add GLAD_ES loader
* Implement basic es compatibility header
* re-add accidentally deleted break
* Add GLES BC7 extension to glad and improve extension support report
* fix some enum mappings
* Use the ARB name for geo shader check
* Add es espand shader includes
* Fix glbufferstorage mapping
* fix some gl errors on opengl es
* Enable GL_CLIP_DISTANCE
* Add format conversions
* add bgba 8888 to rgba 8888 converter
* disable GLAD_GL_ARB_timer_query
* Properly handle wgl + opengl es on windows
* initial enable imgui gles
* add GL_BGR to GL_RGBA conversion
* inform opengl es on menu
* small corrections to the es header
* small refactor of glTexSubImage3D
* remove expandincludes, existing code already did that better
* change default graphic values for opengl es
* compile imgui with opengl es 3 on linux
* allow qtfred to run on opengl es
* improve es compatibility header and remove shader precision quantification
* add compiler hints
* remove unused structs
* Fix imgui crashing on windows with gles, use angle lib
* Do not use MSAA under OpenGL ES, at least for now
MSAA will need an alternative path for GL ES using GL_EXT_multisampled_render_to_texture and GL_EXT_multisampled_render_to_texture2
* add missing profile handler
* cleanup
* revert color_attachment_4/5 fbo workarounds
* Adjustments to log output and enable GL_BLEND
* Implement glGetQueryObjectui64v on es layer
* Fix deferred and decals support
Also added glGetTexImage(), glQueryCounter() and some additional comments
* Revert changes to default values of graphics options
* Minor improvements to glTexSubImage3D()
This will download the appimagetool utility as part of the install step so
that the newest version of both the tool and the runtime is always used. Moving
it out of the build image allows us to take advantage of newer capabilities,
such as no longer having an external dependency on libfuse2.
* add wing display names
Adds display name capability for wings, matching the pattern and infrastructure of display names for ships. As in #7234, wing display names take precedence over ship display names, if both are provided; because if ship display names took precedence, a ship would have the same display name in every wave.
All the relevant display locations are handled, including the HUD, escort list, message box, and mission log. Lua API support is provided as well.
Adds full support for both FRED and QtFRED, including the always-save-display-names setting.
Addresses #7189 and the last request from #1730.
* add help text from #7234
Follow-up to #7251, which added `set-guard-range`
This PR exposes that value to scripting, so scripters do not have to use the more expensive `runSEXP` to use it.
The value is initialized as -1 (`max_guard_radius = -1.0f;` line 7913 in ship.cpp), hence the default value for the script is -1.
* Release Build Safety
* Move to using standard models.
* Avoid using .indexes() to fix heap coruption
* More work on selection function
* major cleanup and refactor
* enable drag and drop
* multi edit support
* cleanup
* fix build issue on linux
* revert non-weapons dialog changes
* clang
* clang
* update help doc
* better model/dialog code split
* further cleanup
* static
* keep primary and secondary banks aligned
---------
Co-authored-by: The Force <[email protected]>
1. more robust handling of missing fireball graphics
2. fix handling of error dialogs on Linux so that the engine doesn't silently continue on an error!
Fixes#6793.
If you set AA level to None, save, then close the game, then re-enter the game and switch the AA mode to an MSAA mode, then the screen will just be black until the game is restarted. This does not happen when switching from None to FXAA because FXAA works because its post-pass uses `Scene_luminance_texture` and `Scene_ldr_texture`, which are always created as part of standard scene setup.
There are two ways to fix this, either require AA mode to require a game restart (though that may complicate the lab) or allow resource allocation for SMAA always.
Honestly I like the idea of keeping the lower-end machines optimized and not allocating for SMAA but simply running it always but for this PR have just allowed it always run.
Happy to discuss whichever option folks think is best!
* add imgui speech options
* adapt existing windows sapi speech implementation
* adapt existing mac speech integration
* add speech linux stubs
* add speech support in linux
* Add array checks
* Use dlopen for speech-dispatcher
* corrrect lib name
* missing includes and static cast
* do not change mac file type
* fix clang tidy warnings 1
* set tts rate
* set localization ids
* fix clang tidy warnings 2
* correct symbol name
* Remove voice cache and fix win enumerate_voices overriding voice selection
* fix mac rate
Done by notimaginative
* requested changes
* re-add voice cache for linux
* Open connection for linux get flags
* fix missing }
* change voice option combobox to std::pair
* delete duplicated voice id sanitizer on windows set voice
* Use pairs for speech_enumerate_voices() and adapt linux speech
* use reference
* actually free vector memory
* Clear voice cache when ingame options closes
* Use extern to call fsspeech_options_cleanup()
* update localization ids
* Fixing some linux and window speech oversights
* Apply volume and rate after a voice change, correct voice, volume and rate apply order
Fix#4089, part 2:
- properly link special-point subsystems with -destroyed submodels, if such a relationship exists and a game_settings.tbl flag is set
- add some helper functions for -destroyed variants of submodels (and now subsystems)
Fix#4089, part 1:
- give the `my_replacement` and `i_replace` fields clearer names
- for submodels with the `Is_damaged` flag (representing -destroyed variants or debris), initialize them to blown-off (the true fix for #3078, fixing a regression introduced in the model instance refactor)
- roll back the de-parenting of live debris from #3089 (726ce953c7), because it was a wrong fix to the initialization bug and introduced its own subtle bug when positioning live debris
- roll back the `Can_move` flag skipping from #4138 (063d7afcfe), because it was another wrong fix to the initialization bug
- add some clarifying comments
Fix a few items flagged by Coverity and Claude:
- properly check for an unassigned ship node, rather than just Asserting, since this could be affected by mission data
- properly check for null containers for the same reason
- rename `ai_goal_find_empty_slot` to `ai_goal_allocate_slot` and edit comments to reflect its not-quite-side-effect-free role
When a streaming OpenAL source plays through all queued buffers it
transitions to AL_STOPPED. Per the spec, queueing more buffers after
that does not auto-resume playback -- alSourcePlay must be called
again. This is the likely cause of music and briefing voices cutting
out.
To fix this, check for underrun and call alSourcePlay if needed. Also
double MAX_STREAM_BUFFERS from 4 to 8, bumping the margin to ~2s
of queued audio.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Some code refactoring to allow mission titles to be strings of any length. Titles that are too long to actually display (based on string width) will be visibly truncated using `font::force_fit_string`, but the underlying title will not be affected. Multiplayer is still subject to the 31-character length limit, so titles sent over the network will still have characters truncated.
Also removes some redundant calls to `gr_get_string_size`, since `font::force_fit_string` returns the fitted string width.
* new qtfred error checker
* fix some issues
* clang
* more clang
* clean up and fixes
* missed a comment
* add help documentation
* surface auto corrected issues more clearly
* some cleanup
FastDebug FSO compiled with /MDd (debug CRT) but imported Qt's Release
libraries via CMAKE_MAP_IMPORTED_CONFIG_FASTDEBUG = Release Debug. Qt
Release ships /MD, so any allocation crossing the qtfred <-> Qt boundary
went into one heap and came back out of the other, tripping
_CrtIsValidHeapPointer on a perfectly-valid std::string dtor. Latent for
ages because it only surfaces when an allocation actually crosses;
opening a mission file is one such path.
To paper over the resulting STL layout difference, FastDebug also forced
_ITERATOR_DEBUG_LEVEL=0 so qtfred's std::string matched Release Qt's.
Not needed once we link Debug Qt, and keeping it would introduce a fresh
mismatch (qtfred IDL=0 vs Debug Qt IDL=2).
Fix:
- Map FastDebug imports to "Debug Release \"\"" in qtfred/CMakeLists.
Debug picks Qt's debug libs; Release is a defensive fallback; the
empty entry falls back to plain IMPORTED_LOCATION, required because
Qt's host tools (uic/moc/rcc/qhelpgenerator) ship a single variant
with no IMPORTED_LOCATION_<CONFIG>. Must precede find_package(Qt5):
CMake snapshots the variable into each target's MAP_IMPORTED_CONFIG
property at creation time. (Also why the prior "Release Debug" was
silently a no-op -- set after find_package, ignored; CMake fell
back to Release on its own.)
- Extend the qwindows/qsqlite plugin POST_BUILD copies' "d"-suffix
generator expression to match FastDebug as well as Debug, so the
Debug Qt runtime finds qwindowsd.dll / qsqlited.dll alongside.
- Drop the FastDebug-only _ITERATOR_DEBUG_LEVEL=0 from the MSVC
toolchain file. Qt was the sole consumer; pure-C deps don't care.
Cost: FastDebug STL containers pick up MSVC's debug-iterator overhead.
Reasonable trade for a config named "Debug with optimizations".
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Curve input follow-up to #6926 and #6889, in that it adds two new curve input Nebula and Particle Detail Levels for use within the particle effects table. These new inputs will allow modders to develop effects that can properly be optimized per varying particle and nebula detail levels.
PR #7334 caused an unintended side effect when building both FRED and QtFRED. With QtFRED enabled, FRED2 sources were compiled with _AFXDLL defined while still linking against static MFC, causing a crash on startup. To fix this, keep the conditionals in sync between cmake/toolchain-msvc.cmake and fred2/CMakeLists.txt.
Also, do not explicitly add static MFC libraries if we are using dynamic linking.
* 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]>
Per Claude:
> The `IF` opens with `(MSVC_USE_RUNTIME_DLL OR FSO_BUILD_QTFRED)` but the `ELSE` and `ENDIF` only reference `(MSVC_USE_RUNTIME_DLL)`. CMake requires the argument in `ELSE`/`ENDIF` to match the `IF` exactly (or be omitted).
* help dialog and documentation
* compile help in headless mode
* scene browser help file
* attempt to get CI working for linux
* debug attempt
* Fix split method to use QString::SkipEmptyParts
* Revert "debug attempt"
This reverts commit cb046e1b3305577ff50e95d5b748f6d1dbf025fb.
* clang
* update help
* correct name
* Inject sexps.html into help and add find in page controls
* update help based on recent commits
* better tutorial asset loading
* no const
* update help again
* Build using /MD flag if building QTFred and on windows
Fixes Multiple QTFred heap crashes due to mismatched runtime types.
* Actually Change Right value
Three out-of-bounds/UB fixes for issue #6793:
- asteroid_create_all: skip field_debris_type[idx] == -1 entries when
building the DG_DEBRIS odds table and loading models; iterate only
over valid table slots during spawn. Matches the guard already present
in asteroid_frame.
- missionparse: bounds-check subtype before indexing colors[] in the
obsolete +Field Debris Type: parsing path.
- verify_asteroid_list: guard the asteroid_list[0] fallback access
against an empty list.
- asteroid_init: emit an mprintf when no asteroids are defined instead
of returning silently.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Per Claude:
The key things the new comments add that the old ones were missing:
1. Palette RGB colors are completely ignored — only the index value is used as alpha. This is the non-obvious invariant that @notimaginative described.
2. Exact mapping table — makes the * 18 / * 17 math immediately readable, and clarifies the ANI vs PCX difference (> 15 clamps to opaque in ANI but transparent in PCX).
3. The broken-palette consequence — explicitly states that a reversed palette causes a white square, linking to #4148 so future readers understand the context.
* fix hotkey not saving/loading
* fix docking setup flow
* fix all/none in flags list not updating ui
* fix tri-state flag issues with multi selection
* fix initial status checkboxes
* fix no warp effect
* more fixes
* fix flag hiding
* allow any flag to be skipped for player starts
* another fix for no warp effect
* smarter context menu
* fixes for object orient editor
Turns out 7360 causes cockpits to not render. That PR had updated `GL_DEPTH_ATTACHMENT` to `GL_DEPTH_STENCIL_ATTACHMENT` but missed two spots. This PR fixes that and tests show cockpits now work. (Root cause was the save/restore zbuffer swap using the old GL_DEPTH_ATTACHMENT point — once the scene texture became a combined depth-stencil, re-binding just the depth slot left stencil dangling and made the FBO incomplete.)
* color variable or container rows based on type
* add props and jump nodes to layer filters
* make goals dialog dynamic and fix bugs
* cleanup
* missed these
Fix issue with our Linux build image where libfontconfig1 isn't installed, but
is needed by some Qt5 libs. Since aqt is used to install a more up-to-date
Qt5 version than what's provided by the distro we don't have the usual
dependency resolution needed to prevent this.
This is a stop-gap measure to fix testing of pull requests for QtFred, and
only applies to that specifc workflow. The arm64 Linux image also has a broken
Qt install so this workaround is useless with normal workflows. A proper fix
will require updating the Linux build image to fix the Qt dependency problem
and related issues.
* fix mission stats message count
* fix texture replace for retail textures
* fix heap issue in ship alt class
* fix props menu item
* some ui clarity
* unify up/down buttons to use our painted icons
* fixup ship and wing cues toggles
* rename and move Object Orientation menu item
* menu seperator styling for dark mode
* qtfred dockable objects list
* fix jumpnode rendering
* more ouline panel features
* fix for wings
* remember list expansions
* clean up wing selection and layer handling
* disable top and bottom docking
* give scene outliner some padding
* replace old selection dialog with the scene browser
* fix some minor issues
* right click for wings and waypoint paths
* clang
* clang again
* fix status bar message
* 25 1 checks
* clang
* more clang
* address feedback
* draft set-target-player-sexp
* Missed a few entries and duplicates
* Missed another entry
* Yet another missed entry
* Fix subsystem not showing up being targeted
* Fix subsystem targeting in set-player-target SEXP
* remove reduntant return
* change sexp category to better suit feature
Fixes the long-standing intermittent bug where the GTD Orion#Repulse in
Silent Threat: Reborn's "Forced Hand" mission spawns with all subsystems
unlinked, leaving the ship untargetable and undisableable. The same root
cause has been reported since at least 2015 (HLP topic 89403) and was
provisionally closed in #3147 as fixed by #3858, but #3858 was an unrelated
parse_ship_values memory leak fix and never actually addressed this
behavior. Recently the underlying check at ship.cpp ~8043 was promoted
from Warning to Error (#5591), which is why Release players are now
hitting a hard error dialog instead of just seeing missing subsystems.
Root cause
----------
model_unload() walks Ship_info and resets si.model_num = -1 on every
ship_info that referenced the model, but does not touch
si.subsystems[k].model_num. Subsystem entries are left pointing at the
freed model id. When a subsequent mission reloads the same pof under a
new id, ship variants that share the model rely on
ship_copy_subsystem_fixup() to re-link their subsystem arrays, but the
fixup matches by name via model_copy_subsystems() and any unmatched
destination subsystem stays at -1. The mismatch case in
model_copy_subsystems() was guarded only by Int3(), which is a no-op in
Release builds, so the failure was completely silent until subsys_set()
errored out much later with no useful context.
The bug is intermittent because it depends on three independent ordering
factors: which prior mission was last played, which Orion variant that
mission used, and the iteration order of Ship_info during the next
mission's ship_page_in().
Changes
-------
* model_unload(): when clearing si.model_num for an unloaded model, also
clear every si.subsystems[k].model_num that pointed at the same id.
This is the structural fix and eliminates the entire class of stale
subsystem pointers surviving across mission boundaries.
* model_copy_subsystems(): replace the silent Int3() in the name-mismatch
branch with Error(LOCATION, ...) naming the unmatched subsystem. This
surfaces a failure mode that has been invisible in Release builds for
over a decade and gives modders an actionable diagnostic when sibling
ship classes that share a model have inconsistent subsystem names.
* ship.cpp: introduce verify_ship_subsystems_linked() helper that checks
every model_subsystem on a ship_info is linked into the same model the
ship is using, and fails with Error(LOCATION, ...) naming both
polymodels if not. This is the canonical post-condition for both
ship_copy_subsystem_fixup() and model_load() (which is supposed to
link subsystems via do_new_subsystem()).
* ship_create(): call verify_ship_subsystems_linked() after
ship_copy_subsystem_fixup() so that any failure to link a subsystem
is surfaced with full context (ship name, subsystem name, both model
filenames) instead of propagating to a generic error in subsys_set()
much later. This closes a long-standing asymmetry where ship_page_in()
had a guard (added by zookeeper in 2015) but ship_create() did not.
* ship_page_in(): three post-fixup verifications were gated by
#ifndef NDEBUG with Warning() or Assertion() calls, both of which are
no-ops in Release builds. Replace each with a verify_ship_subsystems_linked()
call so they fire in Release as well.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
playerGet() indexed Ship_info with ship_class without bounds checking.
Before ship selection, ship_class is -1, which as an unsigned index
causes an out-of-bounds access. Add bounds check using ship_info_size(),
matching the pattern used elsewhere in the codebase. Also update the
Windows standalone GUI to use ship_info_size() for consistency.
Fixes#7366
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Clean up the syntax checker, using clearer variable names for each check, and most importantly unique variable names. Fixes several bugs where syntax checking failed because the same variable was overwritten with incompatible type information.
Also fixes a bug in `check_operator_argument_count` where the count check never ran due to a mixup of `op_index` and `op_const`.
* Implement Photo Mode
* fix gr string errors
* return raw char array
* control conflict groups and better photo param defines
* better param identification in real time
* make photo mode hude dynamically sized
* fix xstrs after all changes
* missed a few
* use modern loop
Net_player[idx] (pointer arithmetic from current player) was used instead
of Net_players[idx] (global array index), causing the status display to
read from wrong offsets. This coincidentally worked for the host at index 0
but showed incorrect status for all other players — most visibly on
standalone servers where no client is at index 0.
Fixes#7358
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* rename misleading variable check_again to never_check_again
The first element of collision_result means "never check again" per the
typedef comment, but was destructured as check_again (opposite meaning).
Rename to never_check_again to match the actual semantics and prevent
future confusion.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix data races in ship-weapon collision threading
Two thread-safety bugs in ship_weapon_check_collision, which runs on
worker threads:
1. update_danger_weapon() wrote to Ai_info[] (danger_weapon_objnum,
danger_weapon_signature) without synchronization. Multiple weapons
targeting the same ship would race on the same Ai_info entry.
2. Homing missile detonation logic wrote wp->lifeleft and
wp->weapon_flags directly on the Weapons[] global array.
Fix: defer both writes to the main-thread post-processing phase via
new flags in ship_weapon_collision_data. Also convert the collision
data from a 6-element tuple to a named struct for readability.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix data race in ship-ship collision submodel checking
ship_ship_check_collision() toggled pmi->submodel[].collision_checked
flags on the heavy ship's polymodel_instance to selectively enable/
disable submodel collision checks. When two collision pairs shared the
same heavy ship, worker threads would race on the same pmi entries.
Fix: add a collision_checked_override pointer to mc_info that lets
callers provide a thread-local array of collision_checked values.
model_collide() uses the override when set, falling back to the
pmi->submodel[] field otherwise. ship_ship_check_collision() now
builds a local SCP_vector<char> and passes it via the override,
completely avoiding writes to shared polymodel_instance state.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* Ensure threads have spun down before continuing non-threaded execution
* address review feedback for ship-weapon collision threading
- postproc flag now accumulates incrementally instead of being OR'd
at the final return, ensuring all return paths respect it
- early return for predictive collisions now preserves the
should_update_danger_weapon flag in the collision data
- moved nprintf detonation debug print to the main-thread process
pass for thread safety
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* move collision_checked from pmi into mc_info for thread safety
collision_checked flags were transient per-collision-pass state that
didn't belong in the shared polymodel_instance. Now mc_info owns an
SCP_vector<char> that model_collide auto-initializes from pmi when
empty. All collision callers (ship-ship, asteroid, debris, prop)
updated to manipulate mc.collision_checked instead of pmi->submodel[].
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* Convert to CV and spinup counter
* Update comment
---------
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: BMagnu <[email protected]>
Collection of fixes for multiple issues with the multi code found by Claude AI (by way of Goober5000), plus additional issues noted by myself while checking the code. These fixes are primarily focused on the interpolation code.
These changes should not be breaking and are largely exclusive to server-side handling, but still need to be tested thoroughly before being merged. Any tests must be done with at least the server (master) using the fixes.
* set line edit fields to max length in code
* fix some dialog window titles
* remove unused context help button on Windows
* address some easy todo items
* static access
* Fix multiplayer standalone crash: client stats race + host accept code
Fixes a crash in multiplayer PXO/tracker games hosted on a standalone
server where clients crash at debrief close after scoring a kill:
pilotfile.cpp:295: Ship kills of '<ship class>' not found,
should have been added by pilotfile::update_stats
Two independent root causes were found, both of which must be fixed for
correct behavior:
--- Root cause 1: race condition in multi_sexp_end_mission() (sexp.cpp) ---
The previous code called send_debrief_event() before
multi_handle_end_mission_request() as a "hack" to skip the warp-out
sequence when an end-mission SEXP fires. On standalone servers this is
a race condition: scoring_eval_kill only runs on the master, and the
master hasn't broadcast m_okKills to clients yet at the point
multi_sexp_end_mission() is called. Entering debrief this early causes
scoring_level_close() to run with zeroed m_okKills, so
Pilot.update_stats() creates no kill entries for that session.
When debrief_close() later calls scoring_backout_accept() it cannot
find those entries and hits the UNREACHABLE.
Fix: Remove the send_debrief_event() call entirely. The normal flow
via multi_handle_end_mission_request() has the server broadcast stats
first and then send MISSION_END, which causes the client to enter
debrief with correct kill data already populated. The master enters
debrief through sexp_end_mission() -> send_debrief_event() as before.
The behavioral side-effect of removing this hack: clients that go
through the normal warp-out sequence will no longer skip it on
end-mission. Clients in a state where they cannot warp still receive
immediate debrief via multi_handle_sudden_mission_end().
--- Root cause 2: host accept code never set on PXO standalone (multiui.cpp) ---
In multi_debrief_accept_hit() and multi_debrief_esc_hit(), when the
game is a PXO/tracker game and the local player is the game host
(NETINFO_FLAG_GAME_HOST), the code calls send_store_stats_packet() to
tell clients to record their stats. It then sets
Multi_debrief_stats_accept_code = 1 via the per-client response path
inside the NETINFO_FLAG_AM_MASTER block.
On a standalone server the game host is NOT the master
(NETINFO_FLAG_AM_MASTER is false for the client-side host). The
NETINFO_FLAG_AM_MASTER block is skipped entirely, and
send_store_stats_packet() uses multi_io_send_to_all_reliable() which
skips the local player — so the host never receives its own packet.
Multi_debrief_stats_accept_code stays at -1 (unset).
When debrief_close() checks this value and sees it is not 1, it
assumes stats were tossed or the window was closed without accepting,
and runs scoring_backout_accept() unconditionally. With fix 1 in place
this no longer crashes (entries exist), but silently strips all session
kill credit from the host's pilot record.
Fix: After the send_store_stats_packet() block, call
multi_debrief_stats_accept() unconditionally for the game host so the
accept code is set locally regardless of whether the host is also the
standalone master.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* Preserve end-mission warp-out skip via deferred debrief entry
The previous fix removed send_debrief_event() from
multi_sexp_end_mission() entirely, which was correct for the stats
race condition but had a side effect: clients would no longer skip the
warp-out sequence when an end-mission SEXP fires. The warp-out skip
was an intentional feature — process_endgame_packet() checks whether
the client is already in debrief state and, if so, bypasses
multi_warpout_all_players().
Restore the original behavior by deferring the send_debrief_event()
call to process_endgame_packet() rather than eliminating it.
multi_sexp_end_mission() now sets Multi_sexp_end_mission_pending=true
before calling multi_handle_end_mission_request(). When the client
receives the MISSION_END packet, process_endgame_packet() checks the
flag, calls send_debrief_event() there, then falls through to the
debrief-state check which skips the warp-out exactly as before.
This is safe because send_endgame_packet() calls multi_broadcast_stats()
before sending MISSION_END. Both use reliable delivery, so stats are
guaranteed to be received and applied before MISSION_END is processed,
meaning scoring_level_close() now sees correct kill data when
send_debrief_event() fires.
Alt-J-initiated mission ends are unaffected: the flag is never set,
so the warp-out proceeds normally for those paths.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* Revert multiui.cpp accept code change — tracker master owns stats
The previous change added multi_debrief_stats_accept() calls for the
game host in multi_debrief_accept_hit() and multi_debrief_esc_hit() to
work around Multi_debrief_stats_accept_code staying -1 on a standalone
server. This was based on incorrect analysis.
In PXO tracker games the standalone master is intentionally the sole
authority for stat storage (via multi_fs_std_tracker_store_stats() in
multi_standalone_postgame_close()). The host and clients must not save
stats to their local pilot files independently. Multi_debrief_stats_
accept_code remaining -1 and triggering scoring_backout_accept() on the
host is correct behavior: kills are backed out of the local pilot file
because the tracker holds the authoritative record, not the local file.
The race condition fix (deferred send_debrief_event()) is sufficient to
prevent the crash: Pilot.update_stats() now creates kill entries with
correct m_okKills data, so scoring_backout_accept() can find and remove
them cleanly rather than hitting the UNREACHABLE.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* Move Multi_sexp_end_mission_pending from multiutil to multi and reset in multi_vars_init()
Addresses review feedback: the flag has no relation to multiutil, and
resetting it in multi_vars_init() ensures it is always cleared between
missions regardless of which code path was taken.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---------
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
When a waypoint is deleted from a list, the remaining waypoints after it shift down (e.g. Path:3 becomes Path:2). SEXP and AI goal references were properly invalidated for the deleted waypoint, but were not updated for any subsequent waypoint to reflect the new numbering.
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* add head animation picker dialog for event messages
* get animations working
all previewing all head anis
cleanup
* reorganize files
* make these static
* no const
* more static
* updated var name
* missed one
Adds multi.cfg options to allow easy tweaking of standalone servers to better handle mods
with faster ships and/or weapons that don't behave reliably with rollback or lower fps.
Put ships getting whacked by weapons or other objects into simulation mode to avoid odd
position changes when client-side whacks get overridden by server interoplation updates.
Fixes timing bug that used the wrong timestamp for primary and secondary weapon shots on
clients. This resulted in a discrepancy between client and server timing which caused weapon
shots to bypass the rollback system and become unreliable.
Add safety checks for signal updates to avoid array boundary issues. And be sure to reasses
packet indexes when a new packet arrives instead of waiting a frame for index updates.
Afterburn hack is to fix trails and model animations getting triggered so that clients and hosts
see them. The hack needs to be reset before multi_oo_unpack_client_data() though, not after.
Fixes behavior that was broken in #2752
mg_start() calls InitializeCriticalSection(&global_log_file_lock) on
every invocation, but mg_stop() never calls DeleteCriticalSection.
Re-initializing an already-initialized critical section is undefined
behavior on Windows and corrupts the heap, causing the next allocation
to throw an exception.
Make the Win32 initialization (WSAStartup + InitializeCriticalSection)
one-shot via a static flag, and remove the asymmetric WSACleanup from
mg_stop so resources remain valid across mg_start/mg_stop cycles.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
When a player enters the mission loop screen from the main hall, there was no code to handle the stopping of main hall music and ambient sound. Add code to handle this specific case.
Also fix `Loop_sound` not being initialized to -1 `in loop_brief_init()`, which caused an assert when closing the loop brief screen if no branch brief sound was defined for the mission.
Fixes#7330.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The waypoint class stored its position in m_position separately from the game object's pos field, requiring callers to manually keep both in sync. Now get_pos() and set_pos() delegate to the object position when the game object exists, falling back to the parsed position only if the object does not exist.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* Fix `targest nearest attacking ship` in multiplayer
Pressing 'Target Nearest Attacker` in multiplayer does not work when a ship has spontaneously targeted another ship. This is because within, `multi_oo_pack_data` `goals[0].target_name` only covers explicitly ordered goal targets and is empty for spontaneous IFF-based engagements, which means `target_signature` does not return the proper value. This PR adds an extra check for that to pefer the live target_objnum so clients know who is actually being attacked.
Tested and works as expected.
* comment cleanup
* comment cleanup
* Add lab panning controls and align to pof tools
* pan based on camera view coords not world coords
* reset view option
* change scrolling to use mouse wheel
* Better ui for controls reference
* clang
* Tune ups for standalones
Fixes two warnings from building in standalone and also provide, also adds needed function to actually tell if game is in standalone mode.
* better fix for armor flags
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]>
Convert `debriefing_editor_dlg` from a modal stack-allocated dialog to a modeless heap-allocated dialog, matching the pattern of the briefing editor. Update FRED infrastructure accordingly.
Add `focus_sexp(int node)` to `debriefing_editor_dlg`, mirroring the existing method in `briefing_editor_dlg`. Fix both `focus_sexp()` implementations to search all team debriefings/briefings instead of only the currently selected team, so nodes in non-zero teams are found correctly in TVT missions.
Fix `debriefing set_modified()` calls to only set the flag if the debriefing data actually changes, rather than every time the editor was opened.
Since bitmaps, suns, and skyboxes store their coordinates as floating-point numbers, we can allow mission designers to specify floating-point numbers in the FRED UI. This PR modifies the dialogs in FRED and QtFRED to allow two decimal places for pitch, bank, and heading.
Implements #7170.
1. Change `ai_profile_lookup` and `multi_xfer_lookup` to use `const char *`, since all the other lookup functions do
2. Remove several unneeded `const_cast`s, some of which are now made possible by the non-const `data()` overload in C++17
3. Change `campaign_link` to use `const char*`
4. Use better string management in `test::FSTestFixture::init_cmdline()`
1. Add optional `start_index` and `num_items` parameters to the find/count functions in utility.h.
2. Fix an accidental recursion bug.
3. Change appropriate parameters to `size_t` and cast appropriately.
4. Add two forms of `SCP_vector_contains_lcase`.
5. Enhance `sprintf` and add `sprintf_concat` for `SCP_string`.
The scripted `gr.drawOffscreenIndicator` was missing a critical `resetClip();` which meant it was using whatever the previous stack's clipping distance was, and thus not draw in the actual correct location.
This 1 line PR fixes that and the fix works as intended.
1. When loading and saving lighting profiles, treat an empty string as equivalent to the default name
2. Remove unused fields from the mission struct
3. Properly guard union initialization in `add_message`
If the graphics system fails to fully init for some reason then it's possible
for the imgui backend and/or renderer to not be initialized. Those subsystems
*must* be initialized before being shut down so we need to check for that to
avoid hitting assertions inside of imgui.
Also add a safety check for making sure that an imgui context exists before
attempting to initialize the backend/renderer. A simple assertion should work
for this as it would take a coder messing something up in order to trip it.
1. Properly initialize campaign links and elements so that stale values don't stick around from previously loaded campaigns.
2. Clear internal flag bits from campaign missions to prevent invalid state from being loaded from a campaign file.
3. Properly check the main hall when saving flags in retail format.
4. Clean up parsing and saving of mission loop data, which had been broken ever since retail. Add compatibility checks for the old format.
Not using the return value from `optional_string_fred` triggers Coverity warnings, but it turns out those "consume token" blocks aren't actually needed.
While we're at it, make the token parsing a little more robust in campaignsave.cpp and clean up the newline behavior.
- generate appimage for qtfred if it's available
- separate fso and qtfred install roots
- move fso appimage files out of global space
- fix qtfred appimage launch script
- prefer X11 Qt backend for qtfred
FRED can get into a weird state if a warning appears while a ship is being created, e.g. if the ship has a null moment of inertia. So, prevent FRED from rendering a ship if it hasn't been fully initialized yet.
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.
Testing in FotG exposed a bug that dates back to retail. During mission parsing, arrival and departure anchors were represented by indexes into `Parse_names`. After parsing, they were converted to ship indexes -- but only in FRED. Since some functions are shared between FRED and FS2, this can produce inconsistent results, which can be hard to detect since parse indexes and ship indexes are usually the same.
This refactors arrival and departure anchors to be represented by ship registry indexes in all cases. It also adds conversion functions for the benefit of FRED and QtFRED since those dialogs were designed with ship indexes in mind.
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/
1. The `waypoint_stuff_name` function used the wrong length when building the waypoint name, causing the number to be written past the end of the string in most cases. Not sure how this escaped testing.
2. Change two Assertions, which had no effect due to the comma operator, to Errors, which match their counterparts in their respective functions.
3. Make `internal_error` consistent between the campaign editor, the mission editor, and qtFRED, and prune an unnecessary string copy.
Follow-up to #7104. Fixes#7254.
An upstream bug in libpcpnatpmp caused it to not pass along ping failure
messages in the internal state which then triggered multiple issues with
both the library itself and FSO. This fixes the bug in the pcp library
and takes care of the portfwd log spam issues in FSO as well.
This one would be good for the upcoming point release, as on Stable 25.0, if your threat gauge is flashing during a mission and then you quit the mission and go to the HUD Config screen, then the gauge remains flashing.
This PR fixes that by simply not flashing the gauge while in configure mode. Tested and fixes the bug as expected.
The existing `cannot-perform-scan` flag prevents the cargo from being shown on the HUD, but some modders would like to see the cargo while still preventing a ship from being able to perform a scan. So, this renames the existing flag to `cannot-perform-scan-hide-cargo` and adds a new `cannot-perform-scan-show-cargo` flag. Compatibility code in both mission parsing and flag evaluation ensures that missions using the old flag will still work.
Note that if both `cannot-perform-scan-hide-cargo` and `cannot-perform-scan-show-cargo` are set, the former will take precedence.
Add a useful function for getting a ship_info pointer from a ship registry entry. Also rename `ship_has_dock_bay` to `ship_has_hangar_bay` for clarity, since docking bays and docking points are not the same thing. Finally, add a `model_has_hangar_bay` function.
Make sure that missions without props will still be compatible with earlier mission file formats. If props are included, bump the mission file version. Also, fix some newline behavior in the save code.
Fix a crash caused in part by some missing UI calls in FRED2 and in part by subtle object life cycle issues. Depending on whether FRED receives the focus during mission load (which can happen if the autosave dialog appears) it could access props that were in the process of being cleaned up but were still referenced. This isn't specifically a props issue; it could happen to any FSO object stored in a SCP_vector, since the vector can be cleared.
The quick mission init is to prevent a whole bunch of unnecessary and risky processing during a transient loading state, but it has the nice side effect of making mission list loading noticeably faster.
* Add curve to control the duration of a particle source
* Also add fractional Life Left curve input for sources
* Actually register new particle curve output
* 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]>
* Generalize mission save from original FRED
* make qtfred use the new generalized missionsave
* split campaign save into a sister class
* allow unlimited campaign description length to be saved
* have the campaign editor pass the links to save properly
* cleanup
* future todo
* fixes
* more fixes
* cleanup vars
* clang
* add missing guardian threshold and fix var name
* more clang
* conflict resolution error
* update qtfred to use the new campaign save
1. Add default strings for variables and containers, providing something more appropriate than `<new default required!>`.
2. Replace the `Assert` in `add_default_operator` with a check for a valid variable index. This prevents a crash if FRED adds an operator that takes a variable as an argument and there are no variables in the mission.
3. Add the correct variable type to `get_listing_opf_variable_names()` to fix SEXP tree construction in certain circumstances.
Apply the same fixes to QtFRED as well.
These were coded for the `split_str` refactor, but are generally useful elsewhere as well.
1. Use SCP_string in some utility functions where appropriate
2. Avoid copying C-strings in some utility functions where it isn't necessary
3. Add concat functions to `SCP_vector`
4. Change return type `int` to `bool` on some common parselo functions
5. Add `find_white_space` and `find_gray_space` parselo functions
Just as special tokens are replaced in debriefings, replace them in command briefings and briefings as well.
Change `string_replace_tokens_with_keys` to `message_translate_tokens` (since it's the same thing) and add a `replaceContainers` script API function to complement `replaceVariables` and `replaceTokens`.
Also replace every category of token in `sexp_modify_variable` and add comments to places where token replacement might be expected but happens elsewhere.
#6670 added support for custom gauges and also cleaned up the color setting of hud gauges when using 'Select All'. It seems two copy paste bug slipped through the cracks (ie the order of colors was copied from red to blue/green, when really the order should have been updated).
This PR restores the proper order and fixes the bug.
* Revert "Move insignia post-processing to model load"
This reverts commit 665d7145b6.
* Revert "Cleanup of old insignia stuff"
This reverts commit fdf98a1f3a.
* Revert "render insignias as decals"
This reverts commit 24cdeb3c95.
* Isolate reverts to insignias
* Fix oversight
* clang tidy
A timestamp set to 1 means an immediate timestamp, and so the `int` version of `timestamp_elapsed` should account for that, just as it does in the `TIMESTAMP` and `UI_TIMESTAMP` versions. Normally the number comparison means the check will still work, but during mission initialization the timestamp code is not running. This caused destroy-before-mission ships to be added to the arrival list when they shouldn't have been.
Also fix logic in `timestamp_elapsed_safe`, where the `TIMESTAMP` and `UI_TIMESTAMP` versions were correct, but the `int` version had a bug dating back to retail that caused it to return true for uninitialized (zero) timestamps rather than false. Practically speaking, this fix has no effect because the function is only used in multiplayer and none of the instances use integer-0 to indicate uninitialized, but this will at least fix any uses in the future.
Add the ability to configure the `less` operator for `SCP_set`, `SCP_map`, and so forth. Add comparison operators to the type-safe `ID` class so that it can be used with these data structures.
All other display names are `SCP_string`, so make these `SCP_string` as well to be consistent and to allow arbitrary-length display names.
Also fix a few infelicities with German translation and the script API.
* Fix warning of unbound keys for newer controls
Under some circumstances, FSO will warn the player if a key is unbound if that they need to press to complete a training event. This logic though only works for keys with XSTRs from 507-619. Any control that was added with a different XSTR will not be picked up correctly, and thus the message displayed to the player will be incorrect, confusing, and not helpful.
To fix this `missiontraining.cpp` around line 757 needs to account for the newer controls as well.
This PR adds those needed checks, and this fixes the issue. This fix is especially needed for mods that use training missions with newer controls such as FotG. Note, we do ship with a full default controls table with all the needed keys bound, but we have found players will be players and simply change all their controls before even starting the training missions. Thus they unbind key training controls, and with this bug they are unable to correct their controls. With this fix they are properly able to update their controls as needed to complete the training missions.
Fixes#7172.
* var name update
Move the rendering of ships with effects to immediately after rendering of ships. This fixes rendering in several edge cases where, currently, additively-rendered items, among others, are incorrectly obscured by ships with effects. This affects anything that doesn't render to the depth buffer -- nebula poofs, particles, lasers, beams, engine glows, etc.
Forward-rendered objects (due to transparency) still interact incorrectly with full nebula fog, but that's out of scope for this PR.
Rewrite `force_fit_string` to be more robust and to remove the potential for memory access violations. Also audit all of the length parameters in the calling functions - some of them were the buffer size, not the length. This should fix the mysterious crash in the mission log screen.
A ship which has a display name and belongs to a wing will display that name no matter what wave it appears in. Since this should only be done when the mission designer deliberately wants it to be done, omit this case from the cases covered by the "Always save display names" feature. (To always save a display name in this case would require saving one for the wing, but a wing display name feature does not yet exist.)
Fixes#7140. Followup to #6810.
* Add flag to respect detailboxes in model collide checks
* Don't check detailboxes that are invisible for sunglare checks
* Use local coords
* Actualyl also run the check for cockpits & show ship
* Be less stupid
Message Lines were not being rendered to the proper position for certain resolutions per issue #7143.
#6575 seemed to be the commit it broke on, and looking at that commit it showed that code added `x` and `y` to the render string positions, even though `x` and `y` did not exist there before.
This 1-line PR fixes that issue, and it is confirmed to fix the issue by KamiGaAtaeta. Also I checked and on more standard resolutions the message lines still display as expected in both mission and the HUD Config screen.
* Fix haloing in cockpit shadows
Cockpits can use shadows, but the small geometry of cockpits and the current shadow pass methods result in bad looking shadow halos and poor quality. The issue is that small scale geometry, like cockpit struts/pillars, cast overlapping shadows--and these overlapping shadows need to use a different shadowing method then the default larger external shadows.
I made a small edit the to the shadows file to fix it for small scale shadows (external shadows, IE those at longer ranges, remain using their method since that method works better at longer ranges). In FotG we have been using this update for years and it works very well.
KamiGaAtaeta was having these halo issues on the FS Ship Interiors project, and this shader update fixed those issues. Thus, per suggestion from Lafiel, I'm PRing this fix so everyone can easily use it.
* remove dead code
The `$Scannable` field in objecttypes.tbl controls whether a ship can be targeted by the "target unscanned ship" key. This is independent of which ship types can actually be *scanned*, which is not connected to any field in objecttypes.tbl.
So, this PR renames the `$Scannable` field to `$Targetable as unscanned:` to be clearer about what it actually does, and it adds the missing counterpart `$Scannable by default:` flag to specify which ship types can actually be scanned.
Note that this is only relevant for legacy scanning behavior. Mods which use `$Unify scanning behavior:` do not need either of the ship type flags.
The `$Scannable` field in objecttypes.tbl controls whether a ship can be targeted by the "target unscanned ship" key. In retail, these were cargo containers and freighters. This is independent of which ship types can actually be *scanned*, which in retail were cargo containers and *transports*. Since the targetability is meaningless without the ability to scan, this fixes the retail inconsistency by moving the targetability from Freighter to Transport.
Note that this is only relevant for legacy scanning behavior. Mods which use `$Unify scanning behavior:` do not experience the inconsistency.
* Two 1-line fixes for new particle lights
This PR provides 2 semi-fixes for the particle lights with 2 simple conditionals.
------------
First, it fixes#7124. In sum, it fixes the issue that new particle lights not affected by light quality slider. This fix is done by adding a conditional check so that particle lights only render when weapon lights do, at the highest lighting setting. This ensures that lower end machines can properly turn off particle lights to help with performance.
------------
Second, this PR adds an extra conditional to ensure that the system does not attempt to render particle lights if the radii is <= 0.
Light emitters logically do not cast light if the light emit radius is <= 0. In 2015, there are assertations in each of the `light_add` functions that trigger if the radii are <= 0.
With the new particle lights and addition of curves for particle lights, this can make result in light radii <= 0. This approach is useful to allow things like hit effects to only give off light if the hit effect is large enough (IE if it hits a large ship scale the radii to be larger, and if it is too far away or a small ship scale the radii to 0). So, in those situations of <= 0 light radii, the modder would expect that the light point is just not shown and simply not attempted to be rendered. Unfortunately, this is not quite the case, as any light radii <= for particle lights will trigger the assertation within the `light_add` functions.
The fix for this is simply to have early conditional checks for light radii. There is already precent for this in the code in 3 locations--1) within the weapon light code in `object.cpp` line `1365`; 2) within the beam light code in `beam.cpp` at line `2009`; and 3) within the fireball light code in `object.cpp` line `1457`. Note these sections also early out if the light intensity is <= 0 as an optimization step, which also makes sense.
This PR simply follows that precedence for particle lights by adding an early out if the light radii are 0. This allows modders to properly use a range of radii and helps ensure internal consistency with the code mentioned above that already does this early out for weapon and beam lights.
----------
Given the benefits listed above, having this PR in before stable would be fantastic (or a relatively quick point release after stable).
Tested and fixes the issue as expected. Happy to answer any questions and/or discuss!
* comment signpost
The object and ship indexes held by the ship registry do not actually need to be cleared until `ship_cleanup` completes. This will allow the ship to be referenced in any functions (via script hooks or otherwise) that are called during cleanup.
Tweak related script documentation while we're at it.
Follow-up to #7120. Fixes#7122.
The `setAutoScaleBehavior` function call should go after the null check to prevent crashing FSO if the font fails to load.
Also, if a font fails to load, skip over it so that subsequent fonts can be parsed.
The `play-sound-from-file` sexp did not have any way to automatically recycle audio handles, instead relying on other sexps to explicitly close them. It is more modder-friendly to implicitly free any handles of streams that have finished playing, so this PR adds that capability. It also adds a Warning in the event that an unused audio handle cannot be found.
Fixes#7108.
This dates back to commit `300d5fc2c1`. It probably did something at some point, but with various upgrades over the years, it no longer has any effect.
It looks like a lot of the model interp code (e.g. `model_interp_defpoints`, which isn't called anywhere) can be removed as well, but that's a bit more involved.
Addresses a behavior idiosyncrasy encountered by Solaris. If this flag is enabled, explosions with a visual radius of 0 do not have fireballs created, and do not have the fireball lifetime added to the explosion lifetime.
First, fix a crash reported in Discord: prevent FRED or QtFRED from giving a waypoint list a name that is too long.
Also fix the updating of references, including for the constituent points, if a waypoint list is renamed.
At some point the mission log became unable to display entries that wrapped around to subsequent lines. Fix that by keeping track of how many lines each entry occupies and adjusting the display accordingly.
This will correctly display mission log segments on multiple lines, but it uses the current string splitting technique which does not split properly in all cases. The splitting will work properly once the `split_str_once` refactor is merged.
* Allow mods to easily tune 'Target Hostile Bomb or Bomber' control
The `Target Hostile Bomb or Bomber` control targets bombs or bombers, though in mods may want a way to easily set exactly what this control does while still leveraging the utility of the 'bomb' flag for weapons and/or 'bomber' flag for ships (both of which affect AI behavior in various ways).
For example, in Solaris, Darius wants a way a way to allow players to only target bombs, while still allowing ships to be classified as as 'bomber'. In this case, the 'only bombs' option can be used. This PR adds a `$Behavior for pressing 'Target Hostile Bomb or Bomber' control:` to allow mods to set the behavior to `default` `only bombs` or `only bombers`.
For example, in FotG we want to allow players to target just bombers, as bombs themselves are hard to shoot down (critically though we still want the player to be able to manually target a bomb via 'target object in reticle'. This allows players to prioritize and easily target bombers while allowing skilled pilots to retain the option of manually shooting down bombs if they want an extra challenge. In this case the 'only bomber' option can be used.
Tested and works as expected in all cases.
* update using cleaned up function
* extra alt option for default case
* warning cleanup
* update default message
* whitespace clang
* appease clang with brackets
* Adds an optional bool to `mouse_down()` for `must_be_mousewheel` to only process mousewheel events.
* Used within `controlsconfig.cpp::check_control_used()` to handle a special case with the mousewheel to allow using it for `CC_TYPE_TRIGGER` controls.
* Cleanup and fix `hud_target_missile`
The function `hud_target_missile` is what runs when the `Target Hostile Bomb or Bomber` control is pressed. Notably, it does not work if there is only 1 hostile bomber. The issue is that the loop within `hud_target_missile` is designed to search for the "next" target, but when there's only one valid target, the loop logic skips over it. But, `hud_target_missile` correctly will target if there is only 1 bomb though, so the fix is to just update the ship bomber logic similarly. This PR updates the logic of the bomber search so it matches the bombs search, that way the bomber search can target a bomber if there is only 1 present in the mission (just as how the existing bomb search will let you target 1 bomb if there is only 1 bomb in the mission currently).
This PR also takes the opportunity to cleanup the function with more clear variable and function naming, along with two new internal bools which will be very helpful for later planned PRs.
Fixes#7050. Tested and works as expected.
* rework hud_target_hostile_bomb_or_bomber
* appease clang
* additional cleanup and modernization
* more cleanup for select previous
Infamously, in FSO, a wing whose mothership is destroyed will not, itself, be considered destroyed if it has more waves remaining, because wing cleanup and logging typically only happen when the last ship in the last wave exits the mission. Instead, with no mothership to arrive from, waves will simply no longer arrive. Events that check to see if the wing is destroyed or departed will never fire.
This PR fixes that behavior, ensuring that the wing is cleaned up and logged properly, by using the same logic as the enhanced `cancel-future-waves` SEXP operator. This is tied to a new `$cancel future waves of any wing launched from an exited ship:` AI profiles flag which is enabled by default on 25.0+.
When checking for subsystems within range of a hit, more than one subsystem is unusual, and 32 (the original `MAX_SUBSYS_LIST` value) is so unlikely as to be impossible. So bumping it to 200 was not needed here -- DTP might have confused it with one of the other subsystem limits. But rather than reducing the limit again, we can simply make the array into a vector.
If the `cancel-future-waves` sexp is called when a wave is not present, it would previously not handle wing cleanup, such as setting flags and updating the mission log.
* Allow 'No Impact Debris' to also apply to explosions
The ship/subsystem flag `no impact debris` prevents the default debris shards from spawning, which is very valuable especially now that impact effects can be completely customized via the -particles table. Now that particle effects are also an option for ship and subsystems explosions, it is also invaluable to have the ability to turn off the spawning of shards when either of those explosions happen.
This PR uses the same flag of `no impact debris` and simply does not spawn the default shards for ship explosions or subsystem explosions of that flag is enabled. I thought about adding two new flags, but that would add to the flag clutter, and most folks who use these flags to turn off impacts I would estimate also want them off for actual explosions. Also, a new flag called `no explosion debris` would likely be confusing, so if a new flag were to be added it should be called something like `no default explosion debris shards` or something. Overall I've opted with the simpler and cleaner solution to just have it all under the impact flags. If two new flags are desired though I can easily add them.
Tested and works as expected.
* throw clang a bone
* use two different flags
* update flag name
* typo and logic fix
* allow custom generic debris to always work
* update to better methods
* cleanup logic
* clang
`optional_string_either` advances the parser by default, but `required_string_either` does not advance the parser by default. So be sure to advance the parser here.
Followup to #7069.
For type safety, use enum class rather than int.
Also make a few miscellaneous tweaks such as adding a new casting macro and making detail level settings a bit cleaner.
* initial cleanup
* rough in more code by copying from debrief
* make buildable
* prep the briefing data model
* completed data model
* activate the ui
* unused param
* stub this
* cmake list is important
* set max cam transition higher
* static cast
* refactored campaign dialog model
* begin setting up the ui code
* work on available missions list
* available missions filter
* working state
* better available missions list
* add tooltip
* handle the retail file format
* add custom data button
* prep for mission graph
* prep for campaign graph widget
* basic functioning nodes
* Basic edges implementation
* path arrows and names
* graph view upgrades
* fixup mode handling
* clean comments
* add some styling
* drag to connect
* add and remove mission nodes
* minor cleanup
* edge emphasis based on selection
* style tweak
* cleanup some graph and tree interactions
* clean out old code
* add getters for lists
* implement the rest of the detail controls
* custom data
* cleanup
* add branch manipulation controls
* branch move buttons
* set as first command
* linux is soooo sensitive (to case)
* more case
* unused param
* fixes
* more terminator checks
* namespaces are fun for the whole family
* Clang
* Private, you're fired!
* refactor variables/containers model and variables ui
* get containers working
* switch to tab view and add filters
* fix the filters
* fixes
* ooo
* static casts
* more static cast
* unused
* clang
Docked wings are created with a sort of reverse-bootstrapped initialization sequence, since normally wings are created first and the wing creates the ships. Issue #7041 found a hole in this sequence, as the mission log entry was added before the IFF was assigned. Fix this bug, and potential future bugs, by moving the assignment of certain fields to immediately before the docked wing is brought in. AI can't be moved that easily, so fix AI setup by calling a separate function.
Fixes#7041.
It's possible for ships to be designated as arrival or departure anchors when these ships do not actually have hangar bays. This cannot normally happen in the interface but can happen when missions are edited in a text editor, or are imported, or the modpack is changed. So add warnings and checks for this situation.
Missions with invalid anchors would previously cause crashes, so update the anchor code to fail gracefully:
1. Negative anchors (especially -1) could trip up the bitwise-AND in the mission saving code, so check for negative anchors *before* checking the special-anchor flag
2. In the event a mission runs with a negative anchor (which shouldn't happen because even `<error>` is added as a recognized anchor), handle the situation with if()s as well as Asserts
* Add parent / host input curves
* reorder some includes to allow particles access to ship.h
* Allow modular_curves to deal with functions returning optionals
* Add convenience function to return an optional from an objp and an instance type
* Add a bunch of particle curve inputs
* Fix internal linkage warning
* Add hitpoint and shield fraction (albeit limited to ships)
* Switch to using signals/slots rather than connect
* Adds coloured persona box
Adds coloured persona box/ fixes persona loading, and reduces amount of data reset on model change
* Update To new flags widget
Updates To new flags widget this reqires moving several non flag items to other dialogs, which also lead to adding a new feature that lets a custom guardian threshold be set in editor
* Switch to size_t
* Make Mission Spec work with changes to Flaglist
* Remove Duplicate member
* Clang Appeasement
* Make static
* Properly initialise guardian threshold
* Convert Player Orders dialog to Checklist box
Unfortunately also formats Shipeditordialogmodel
* Update Custom warp to modern style
* Update Initial status to modern style
* Missed a file
* Update Ship Flags Closing
* Remove QT Code from model
* Update Ship Goals Closing
* Update Special Stats Closing
* Minor Changes
* Replace Paths Dialog With generic checkbox dialog
* Update Texture Replace to modern style
* Cast to int
* Initialize then append
* Clang Fixes
* Two didn't save
* More Clang
* Tighten NOLINT's
* Remove dead code
* Change to built in buttons
1. Add new SEXP operators for setting and fading poofs that will work with one or more arguments, or no arguments (which will affect all poofs at once).
2. Update SEXP help, including clarification that the three `nebula-change-` operators require a nebula to be active to have any effect.
By default, the player's wing will be issued a form-on-wing order at the beginning of the mission if the wing has no other initial goals. Wings in the "starting wings" list that are not the player's wing will also be issued this goal if they arrive after mission start and have no other initial goals. This PR adds a flag to disable this behavior.
* unify naming and some ui cleanup
* sidetracked by a typo
* another sidetrack
* show team list as dropdown like other dialogs
* This is a mess
* cleanup model init and apply
* tweaks
* clear string vars
* validate variables
* some cleanup
* refactor data model
* finish the model and begin the ui
* start getting the ship list working
* fix multi select issues
* activate all 4 lists
* activate teams, filters, selection stuff
* fixes
* clang
* one more cleanup
From Sept 15 onward in fast debug I hit this error when using weapon create
ASSERTION: "cur_frame < part->nframes" at particle.cpp:371
Assert: "cur_frame < part->nframes"
File: particle.cpp
Line: 371
Thanks to lafiel, `that assert should have an `|| (part->nframes == 0 && cur_frame == 0) appended beaause while we need to stay inbounds for animations, frame 0 for both is valid for static images`
The `$better combat collision avoidance for fightercraft:` flag is incredibly useful in preventing AI from hitting large ships while attacking, and the ability to tune the collision avoidance aggression factor further helps mods tune behavior based on their ship speeds (tuning that value is via `+combat collision avoidance aggression for fightercraft:` ). Nevertheless, the improve collision avoidance still is not performed for that actual fightercraft's actual target, so there can be situations where a fast fighter attacks a large ship with high speed, and then when that fighter break off from the attack they turn directly into the large ship's hull. Allowing the target to be incorporated into the `better_collision_avoidance_triggered` check prevents this from happening. To allow the target to be a part of the checks we just simply need to not pass an 'ignor_ship` argument to `maybe_avoid_big_ship`.
This PR adds that ability via flag. This new flag is tested and works as expected. For example, without the flag a squadron of TIEs in FotG would literally ram themselves to death attacking some of our larger capital ships because they would break off attack too late, but with this flag they no longer accidentally collide at all. In discussion with Asteroth it was decided to make this enhanced behavior behind a flag, too.
This PR also fixes a small oversight from the original #2810 where `next_check_time` was never actually used within the `else` block of `maybe_avoid_big_ship`.
* Make particles aware of the effect that spawned them
* Allow modular curves to call global functions from submember inputs
* Add more in and outputs for particle lifetime curves
* Allow post-curve velocity as a curve input
* fix warning and incorrect assig
* Disable CheckTriviallyCopyableMove
* Clang Tidy
Beams in general, and slash beams most likely, can collide with the edge of a model, which will cause a non-normalized vector assertion when particle effects are created. So comment out the normal assignment until a more comprehensive fix can be coded.
When `$Contrail Speed Threshold:` and `+Volumetric Nebula:` are used in a mission, builds since 23.1 would throw an error, since the fields were loaded in a different order than they were saved. It turned out that the save order was the correct order, so this fixes the load order.
Fix heap corruption with smaller mipmaps due to decompression output
always being a 4x4 block rather than actual mipmap size. It's necessary to
pad the allocated data size to allow for the overflow.
Fix heap corruption with DXT1 due to using improper data offsets for the type.
Fix data offsets not always taking the depth value into account.
Adjust code for slight increase in decode performance.
Update bcdec to 0.98
* Removing block to allow volumetric and background nebulas to render at the same time
* Updating code from feedback on pull request #6853
* What the... did I miss a line?
* Dual fog layering should now work when both nebula types are active
Small and subtle fix: move the CINEMATIC options inside the preceding if() block in the same way that the flare style options are inside their preceding if() block. This prevents the CINEMATIC options from being reset to their default values in subsequent modular table parsing. Followup to #6500.
This fixes two build issues:
- `vk::PFN_DebugReportCallbackEXT` takes `vk::DebugReport*EXT` not C
type `VkDebugReport*EXT` since version 1.3.304.
(KhronosGroup/Vulkan-Hpp@d5a18dc87e)
- `vk::ObjectDestroy` was moved to namespace `vk::detail` in version
1.3.301.
(KhronosGroup/Vulkan-Hpp@6e5489fcd9)
Guard them with version checks, so that compiling with older verions
of Vulkan keeps working.
Closes#6416.
* Expose value of idle circling with 'attack-any'
The attack-any order is extremely useful and utilized order, and there was one aspect that was ripe for exposure to modders: the `CHASE_CIRCLE_DIST` that was used to determine how big of a circle to fly around while the AI waited for new hostiles to arrive. For ships with high speeds, like FotG and others, the default radius of 200 m was a bit on the small side, which lead to ships flying in tight circles. This was was counterproductive to goals of tuning the AI to have a more cinematic style, such as where AI would fly around in large distances while waiting for enemies to arrive. Fortunately, this value is easy to expose and allow modders to tune with just a new ai_profiles value.
Tested and works as expected.
* improve name and use correct distance
* Switch to using signals/slots rather than connect
* Adds coloured persona box
Adds coloured persona box/ fixes persona loading, and reduces amount of data reset on model change
* Update To new flags widget
Updates To new flags widget this reqires moving several non flag items to other dialogs, which also lead to adding a new feature that lets a custom guardian threshold be set in editor
* Switch to size_t
* Make Mission Spec work with changes to Flaglist
* Remove Duplicate member
* Clang Appeasement
* Make static
* Properly initialise guardian threshold
* Match file framework of mission events to the rest
* first pass at splitting up the model and ui layers
* fix up message side of event editor
* fix event selection
* fix lots of event bugs
* Get event annotations working
* type to search for operators
* control annotations
* Add event dragging and fix event deletion
* cleanup
* Event and Msg order manipulation
* implement some remaining message todos
* minor cleanup
* prep for browse ani dialog picker
* basic file browser for now
* cleanup
* unused var
* more unused
* clang
* static member access
* rebase error
* fix rebase error
* address feedback
* missing parenthesis
Any place in FRED that uses XSTR is susceptible to double quotes interfering with the standard XSTR format, not just the expected briefing, debriefing, messages, etc. This PR adds `lcl_fred_replace_stuff()` - which handles not only quotes but semicolons and slashes as well - to the other places where XSTR is used.
(Note that quotes are handled just fine in non-XSTR fields. Semicolons will still truncate non-XSTR fields, but addressing that is beyond the scope of this PR as it would require editing every text field in FRED. Fortunately, errant semicolons merely modify the text as opposed to corrupting the mission file.)
Fixes#7005 in both FRED and qtFRED; tested in both. Caveat aedificator: the briefing editor is not yet implemented in qtFRED, so the relevant fixes to briefing icon labels and closeup labels cannot yet be ported over.
Parse errors that are actually errors should use `error_display(1, ...)`, rather than merely logging them (which doesn't abort parsing) or using `Error` (which omits the line number and file name).
Fixes#7002. Tested with a modified script file that produces the same error.
* Switch to using signals/slots rather than connect
* Adds coloured persona box
Adds coloured persona box/ fixes persona loading, and reduces amount of data reset on model change
* Update To new flags widget
Updates To new flags widget this reqires moving several non flag items to other dialogs, which also lead to adding a new feature that lets a custom guardian threshold be set in editor
* Switch to size_t
* Make Mission Spec work with changes to Flaglist
* Remove Duplicate member
* Clang Appeasement
* Make static
* begin asteroid dialog rewrite
* activate fields
* clean up connections
* clean up and rearrange files for consistency
* use constructor to zero out the field when needed
* fix checks errors
* remove duplicate lines
* add missing z
* wing editor dialog base functionality
* flags and path masks plus some cleanup
* squad logo selection
* custom warp params using the ship editor version
* some cleanup
* some finalization
* cleanup, fixes, and clang
* remove duplicate lines after rebase
* merge namespaces
The `_s` functions throw an exception if the string's length is exceeded. But in an error reporting routine, we are far more interested in the string than the exception, and we'd rather get a partial error message than a crash. Plus this bit of code is already set up to truncate the string anyway.
This should fix build issues on ARM64 Windows.
Note that the project name changed from libpcp to libpcpnatpmp and is in
active development again after a multi-year period of inactivity. There
are currently no versioned releases. This is hash b5fe5e2.
During maintenance of the active games list it's possible for the list to be
cleared before a stale item is removed leading to a access violation. So we
need to confirm the list isn't empty when attemping to erase the stale entry.
This also fixes a bug where the list entry index is incremented even when an
entry is removed which can cause an improper selection index being used.
* Add Files and UI
* Initial Setup of dialog
* Finish Dialog
* Obey Rule of 3(Possibly)
Why Cant the compiler do this?
add const
* Fix use of default keyword
* bit more
* Remove unused Vars
* Missed one
* Clang work
* Remove future proofing as the compiler doesnt like it
* Make static/ Apply de morgans
* Lets try this one
* Revert to inital and supress warning
Also switch to Assertions
Broken in #6948 but the original didn't work properly either due to conversion
to int32_t and the resulting size limit.
Big assist from Goober5000 for noticing the bug and helping to sort out the
wonky values.
UI elements with custom mouse cursors wouldn't show them due to the cursor
being reset at the start of each frame. To fix this we need to be sure that
we only reset when the element is no longer active.
A previous attempt to fix the end-mission sexp in multi such that it wouldn't
trigger the jump out sequence was horribly broken. Notable safety checks, state
changes and server/client syncing was skipped over. This caused, as one
particular bug, a standalone server to stop communicating with the game host.
When this happened stats couldn't be accepted/tossed and you were stuck at the
debrief screen, being forced to disconnect from the standalone in order to
continue.
A proper fix for this is to use multi sexps to tell clients to enter a debrief
state before the standard end mission request is handled. This will allow it
the bypass the actual warp out animation for players while still doing the
normal end of mission handling.
NOTE: This is a breaking, but not fatal, multi change and should be safe
considering the recent version bump in early June. As such an additional
version bump is not required with this for 25.0.
Background:
Many mods, especially Event Horizon, have highlighted how versatile and useful using nebula are for creating a wide variety of immersive effects beyond just nebula, including weather, volcanic ash, specialty debris falling from the sky, and more. In addition volumetric nebula have opened another realm of possibilities for modders to creatively utilize. Furthermore, modders can not leverage the powerful updates to the particle system to create a wide diversity of effects, which can be also utilized within nebula (or any mission) by making weapons with those effects and then spawning those weapons with scripts/sexps. Just one creative example is exploding rock debris from a volcano (like in Event Horizon). The visuals of nebula poof though are of course spawned in density according to the `Nebula Detail Level` graphics slider in the Graphics tab of the Options menu. Thus, what the player sets will affect visuals of the nebula. As a modder creating visuals, this can have the effect where particle effects spawned from weapons used in nebula may look different in less dense fields. Ideally there could be a way for the modder to incorporate this Nebula slider detail into the development of their effects, to ensure that the effect visuals properly reflect and integrate with the nebula density that the player might see. The solution to this problem is luckily not difficult, as PR #6889 shows how it can be dealt with. That PR added a particle curve input `Particle Usage Score` which is incredibly useful to allow particle effects to scale visually according to the `Particle Detail Level` that the player has set in the Graphics tab of the Options menu. As such this utility could also be extended to the Nebula detail level to allow modders to develop weapon spawned effects for nebula missions that properly visually integrate with the nebula detail level.
This PR
This PR follows and extends the relatively simple approach of #6889, in that it adds a new curve input `Nebula Usage Score` for use within the particle effects table. This new input will allow modders to develop effects that can properly mesh with varying nebula detail levels--all with the aim to further expand the visuals and range of nebula utility for environmental effects.
From discussion with VR players, it appears that being able to toggle off the skybox/starfield/planet background is very useful to some players to prevent motion sickness. Currently, FSO has the toggle in the Graphics Options window for `Planets/Backgrounds` but it only turns off planet bitmaps. This PR suggests it should be expanded into an accessibility role for players, and properly turn off all background elements--so planets, plus skybox rendering (especially now since most mods also use skyboxes as backgrounds, whereas in early days this was not primarily the case).
Happy to discuss and/or add as a flag if folks think that would be needed.
This has an interesting history. In the original Volition source release, global damage was set to originate from the shockwave position, which would have avoided the fireball issue fixed by #6882. (Technically, though, this was only done for huge ships which would have still left the problem for smaller ships.) In c2716d4ee8, this code was changed to run in non-HTL mode in an attempt to fix a bug. Then in 70529dbd5a, as part of the removal of non-HTL mode, the code was entirely deleted. So, this restores the code.
The #6882 fix is still valid, both because it works for non-huge ships, and because shockwaves may not necessarily originate from the subobject being destroyed. The #6882 fix also subsumes the effect of the restored code, but it's still good to restore the code in case future development may depend on it.
Multiple issues were discovered to be from improper targeting data in multi
tracing back to the addition of multi-lock. This was due to differences in
how targeting works in single/multi and de-sync of this info between server
and client. Collecting accurate targeting data on the server and making sure
that the client will use that data resolves the tracking and sync issues.
Background:
Currently, skybox models can be set in FRED to have `No Z-Buffer` on or off. It is off by default, which is good because it ensures ships and other game objects cannot be rendered behind a skybox. Critically though, skybox models may have sub-models, especially now that animated sub-models are a feature (thanks to BMagnu!). If a skybox is using sub-models and `No Z-Buffer` is turned off, then there will be no proper model occlusion for the skybox and there will be ugly z fighting. Overall, BMangu stated "we could clear the depth buffer after the skybox with another flag".
Update
This PR fixes that issue by adding a new FRED game settings flag, `$Skybox internal depth consistency:` which when set to yes properly ensures there is internally consistency z-sorting with the skybox and any submodels it may have while at the same time ensuring that if `No Z-Buffer` is set in FRED that the skybox still correctly is always drawn behind mission objects like ships/debris.
Many thanks to @Bmagnu for the discussion and help in identifying and creating a proper fix for this issue that is clean, surgical, and supports all existing uses of `No Z-Buffer`.
Tested and works as expected. Fixes#6913.
Move Ship Files To there own folder for legibility
Set File stucture
Create Layout
Rough outline established
Ship data fully loading
limit multiselection to one type
Add in missing conditon
Add weaponlist loading and move Bank model to its own file
Delete Missed file
Fix Cmake file
Change to size_ts
Fix Arrivals
Partial Drag and drop / better multi-select
Finish drag and drop / add ammo editing
Add Saving
Feature Complete
The socket is a value to be assigned, not an index to be used. As such there
is no safety check to be done here and doing so just breaks things.
Fixes networking on Windows.
* Back in business hopefully
* Refactor
* Resolve CI issue in aigoals.cpp
* Updating order.cpp
* Whoops
* Updated objecttypes.tbl to incorporate attack ship type
* Fix clang-tidy issue
* Forgot one other instance
---------
Co-authored-by: wookieejedi <[email protected]>
* Another particle fix for standalones
Fix more standalone crashes from particles by "allowing the code to create particles, and just silently quit if in standalone. I.e., accept an invalid effect handle if in standalone and that'll just quit out the source on its first frame of processing." Thanks to @Bmagnu for the fix! Putting here to allow taylor and chief to more easily test.
* add needed include
* and another fix
In current master the debris creation logic was really showing some rust, which resulted in inconsistent behavior when using `Lifetime Min` and `Lifetime Max` for debris in the `ships.tbl`. Specifically, by default debris can randomly be set as `DoNotExpire` if the check `(Random::next() < (Random::MAX_VALUE / 6))` is false. This was set *before* the code that set the lifetimes from `Min` and `Max` from the table though, which could randomly result in debris with infinite lifetimes even if a min and max were specified (and the ship was small, since large ships trigger infinite debris by default always).
Also, by default, ships with a radius larger than 50 meters always had infinite debris lifetimes because of `MIN_RADIUS_FOR_PERSISTENT_DEBRIS`. Thus, this PR also allows modders to set that value in the game settings table.
Tested and works as expected.
Fix use of incorrect data macro
Fix packet size safety check
Fix sequence order issue with client data packet (Cyborg)
Cleanup code to address readability and maintence issues
The if statement wouldn't trigger as defined which caused the incorrect data
offsets to be used. This resulted in corrupted textures and invalid memory
reads of uncompressed textures if the hardware texture detail slider was set
to anything other than max.
SDL 1.2 had an issue using SDL_Delay() on Mac where it caused bad stuttering
and freezes. A hack was added to avoid this, but it causes 100% CPU usage when
it should be a sleep state, so it wasn't ideal.
With SDL 2 this issue was resolved with the underlying code being unified for
all *NIX variants and that problematic Mac-specific code was removed. So now
we can remove the hack to offer a little better performance on Macs.
The `+Rotation Factor:` value in the ship collide section of the ships table has been around for many years, but raising that value beyond the default of 0.2 results in ship collisions that can result in the colliding ship spinning at ludicrous rotational velocities that last for over 10 seconds (this is especially evident with long ships with high speeds).
This PR adds a field after `+Rotation Factor:` called `+Rotation Magnitude Maximum:` which serves as a maximum for the resulting rotational velocity from a ship collision in degrees per second. By default this is -1 and thus disabled.
Tested and works as expected, and now properly allows mods to have ships spin out if they have collision while not spinning out at wild speeds that look immersion breaking.
* Fix engine not updating with change-ship
Yet another caveat of the change-ship function was discovered by Darius, who found that that both the 3D assigned engine sounds and the 2D throttle/cockpit engine sounds do not properly updated when a ship type is changed via sexp/script.
This PR fixes this by properly calling the respective clearing functions and it also resets the throttle sound check timestamp to ensure the 2D sounds are indeed updated on the next frame.
Tested and works as expected. Fixes#6892.
* cleanup for safety
Dumbfire missiles are client fired for rollback purposes. However players would see
their missiles fire twice due to the server also sending a fire packet back to the player.
So we need to prevent the player that fired the missile in question from getting that
extra packet.
#6248 added an extra subtraction line to calculating when a bomb can be shot down `extra_buggy_time`, but that value should only be calculated if `Aspect_invulnerability_fix` is off. Specifically, the `else if` checks on lines 79 and 97 of `collideweaponweapon.cpp` were getting hit even when `Aspect_invulnerability_fix` was enabled, so ensure that if that flag is on that it correctly keeps the `extra_buggy_time` at 0.
Fix works as expected, happy to edit or tune however.
#6808 converted all Pspews to use the new particle effects, though that in turn lead to a fun little visual bug. Overall, particles on weapons will only be rendered if they are valid, and the is valid check included a `weapon_state == m_weaponstate` check (IE states had to match between what the weapon object held and what the particle held. When a weapon switches to homing that particle state was never updated, b/c before 6808 it never needed to be. This lead to the particle effects from pspews not rendering when a missile was in homing mode.
This PR fixes that issue by also updating the particle host status whenever the weapon state changes (uses the same logic as when the particle spawns the first time).
Tested and works as expected.
A minor bug in #6077 resulted in a crash loading campaigns on the multi ui.
The bug itself was not fatal, however it triggered a cascade of poor error
handling which led to a crash. A lot of these issues date back to retail.
This fixes the minor bug, and hopefully adds enough error handling to
preemptively squash a repeat of the crash problem.
Small one-line fix that follows up #6849. That PR removed the `!(Viewer_mode & VM_EXTERNAL))` check within a section of `ship_render_player_ship` to optimize insignia rendering, but turns out that check is needed to ensure `show-ship` properly works. This PR restores that check to fix this bug, and ideally the thoughts about slightly optimizing insignias can be considered later.
Tested and works as expected.
* Cleanup of Shield Hitpoint Threshold
Overall cleanup that does a few things:
1) Changes `ship_is_shield_up` from integer to bool.
2) `ship_is_shield_up` was only ever called to look at one quadrant, never for all quadrants, so took the opportunity to update the 'all-quadrant' block to account for ships with a non-standard number of shield quadrants.
3) ` MAX(2.0f, Shield_percent_skips_damage * shield_get_max_quad(ship_objp)` was used many times throughout the code (and will be used at least 2 more times with #6848), so simply consolidated all of those uses into a new function called `ship_shield_hitpoint_threshold`. Happy to edit the name however.
4) Removed un-needed redundant comments from `ship_is_shield_up` definition in `ship.h` since those comments were already present in the actual function within `shield.cpp`, and all the other functions used comments in that file instead.
Again happy to tune or edit with any other choices.
* use proper default arg style
* actually commit the updated files
* appease modern clang
* clang round 2
Found a very interesting edge case bug with `$Preload briefing icon models:.`
Situation: Mission 1 has a briefing which has a ship class A as the class (and thus loads the model), but the ship class A is not actually in that mission so no subsystems are loaded. Then in mission 2, the ship class A is actually in the mission but FSO tries to reuse the slot that was loaded, but realizes no subsystems were loaded and makes an error message. I that is because the preload code for the briefing icons on `missionparse.cpp` line 6664 just calls `model_load` but does not specify the subsystem argument.
I've also attached a retail mod reproducible campaign (2 missions, first is 5 seconds long). When the second mission loads the incorrect subsystem warning appears.
This PR properly loads the subsystems and fixes the bug. Tested and works as expected.
* Allow mods to set threshold at which shield stops taking damage
FSO logic dictates that shields collisions and any related sound or visuals related to shields are skipped if the shields are under 10%. This is rather unintuitive especially for mods, so this PR creates a game setting value that allows mods to set this value.
Also, this PR fixes a bug where the HUD shield gauge would try and incorporate this feature but did not do it correctly. Specifically, the gauge skips shield segment rendering if the raw shield strength was 0.1 not the percent. Incorrectly using the raw value results in HUD shields being rendered (albeit faintly) even if the damage was skipping the shield and directly damaging the hull. In other words, if the shield segment was 8%, the shield segment would show faintly even the shield is skipping damage.
Tested and works as expected. Also happy to discuss or answer any questions!
* update local variable name for clarity
* rename `ship_quadrant_shield_strength`
* cleanup with updated get percent function
* more cleanup
* wording and safety tuning
* use correct default number
This allows the first half of a modular -neb.tbm to be skipped, allowing just poofs to be specified without the need for a preceding empty bitmap section. It's a follow-up to #5128 which allowed just bitmaps to be specified without the need for a subsequent empty poof section.
* Slots for custom post processing effects
Post processing effects such as tint or dithering have their uniforms hardcoded, which means the only want to create new post-process effects for a mod is to overwrite an existing effect.
Requested for DEM2, this PR creates 4 blank slots for mods to create new post processing effects--2 floats and 2 vec3. This approach to create blank slots for modders follows the successful strategy used for Custom_Controls 1-5.
Note, this PR also adds `tint` to the default `post_processing.tbl` which had it missing (even though tint is a valid effect with a valid uniform buffer already).
Happy to discuss more or edit however.
* fix ordering
* get proper number of physical cpu cores on macOS
macOS has an easy way to get the physical cpu count so let's use it. Also with
Apple Silicon there are performance and efficiency cores so we need to make
sure we ignore those low-perf cores when getting the count.
* improve error handling
Since this sexp was implemented, there has been a bug that prevented multiple variable-controlled audio streams from working. One default and one variable-controlled stream could coexist, but any subsequent variable-controlled stream would reuse a previous stream's handle if the variable's current value was a valid handle. This adjusts the code to properly create a new handle for every invocation of the sexp with a variable.
The following cases have been tested and now all work properly:
1. The default handle by itself
2. One variable handle by itself
3. One variable handle with one default handle
4. Multiple variable handles
5. Multiple variable handles with one default handle
Follow-up to #2115.
Some SEXP help did not have newlines separating what should be separate lines of text, or spaces separating what should be separate words. Add newlines or spaces where appropriate. (Regexes are A-1 SUPAR.)
* add new conditions
* don't worry about it
* implement new conditions
* bugfixing
* handle pokethrough differently
* clang for the clang god
* appeasement
* to the last i grapple with thee
* from hell's heart etc
* bugfixing
* support hits while dying
* fix shield math, cleanup
* fix memory error
Ever since retail, when encountering a comment, FRED would add an extra newline and mix `\r` with `\r\n`, often causing other bugs. The reason for this is subtle. C and C++ library functions will automatically convert `\n` to `\r\n` and back again when reading and writing in text mode, but FRED mission files are read in binary mode and written in text mode. Normally the parsing code can accommodate reading raw newlines of any type, but comments are copied verbatim from what is read to what is written. A comment ending in `\r\n` will therefore be written as `\r\r\n` which will add an extra incompatible newline.
At one point (in commit a988f5eab2) a fix was made for this, but it only applied to multiline comments, not all comments. Therefore, this PR moves the fix to a common function and uses it for all comment styles.
Add assertions to the model parsing macros to guard against accessing out-of-bounds memory. Patch the model parsing routines to avoid going out of bounds, even if the out of bounds situations are temporary and benign.
* Make scripting use the full-blown particle system
* Add reverse option
* Add animation reversal as an option to modern particles
* Start implementation of beam particles
* Add multi-emission particle source API for legacy particles
* Attach beam muzzle particles to the correct host
* Reorder code in order to facilitate apparent visual size as modular curve input for particles
* fix lua api
* Typo
* Fix scripting and beam muzzle particles
* Remove muzzleflash code, prepare to replace with particles
* Begin mflash effect conversion
* Pass final parameters to mflashes and fix curve
* Remove deprecated particle function
* Add debris flame particles
* remove weapon_explosion table
* Convert shield explosion particles
* Fix modular curve full inputs and convert particle curve inputs accordingly
* Allow particle volume offset and rotation with curve-based rot around fvec
* Add Ring and Point Volumes
* Convert PSPEW to new system
* Make particle curve timing aware of interp
* Update todos
* get rid of performance waste
* Add last parameter for converted pspews
* Fix pspew bugs
* Fix direction for default pspew
* Fix order for voluem rotation
* particle vel interp
* particle vel interp 2
* Make beam muzzle stay parented to the firing ship, as it's likely the more commonly intended variamnt
* fix scripting particle lifetime
* Allow beam muzzle particle override
* Skip invalid pspews
* remove pspew dcf code
* Fix sparkler stretch
* Correct sparkler bia
* General sparkler weirdness
* Tune distribution of sparklers
* Convert Asteroid particles
* Fix conversion warning
* Fix conversion warning again
* Fix conversion warning again again
* Really clang?
Various cleanup associated with the `toStdString()` function in qtFRED. Now that `lcase_equal` exists, it is no longer necessary to compare the C strings. Additionally, QString has its own `isEmpty()` function.
Fix a qtFRED memory access bug when checking for autosaved files. Passing a temporary variable to a function as a reference, then returning it, led to a dangling reference access. Rewrite the `maybeUseAutosave` function to avoid this.
Add several API features to improve scripting support for subsystems.
1. A `CanonicalName` virtvar to provide a clear way to get subsystem names for indexing and referencing
2. `Submodel` and `SubmodelInstance` virtvars to get the submodel information associated with the subsystem, if it exists
3. A `getSubsystemList()` function to provide a subsystem iterator
Applies a stable sort to the keys of a map container before saving the container to the mission file. The underlying container is not modified. Implements #6803.
(Lists are not sorted because the mission designer might have a particular order in mind for them.)
* Allow Custom Gauges to fully use parent type colors
#6670 allowed for custom coloring of HUD gauges, so this PR follows that up with fixing a few edge cases where mods with custom gauges that are linked to parent gauge types accurately reflect the color of their parent gauge type in both the new saved HUD file and the in-mission HUD.
This ability to link color to parent gauges for custom gauges the player cannot edit is what the behavior has always been, so this PR does not change any expected behavior it simply ensures that the new HUD updates and various combinations of table entries for `Config` are all robustly accounted for. For example, in FotG we have multiple non-configurable custom gauges all tied to the center reticle, so if the player changes the color of the center reticle all the custom gauges set to that type also automatically change color.
Tested and works as expected.
* appease clang
* one more clang
* clang needs to calm down
* instruct clang to be calm
* fix comment typo
* Prevent Potential Memory Problems with squadmsg hook function
Within `hud_squadmsg_run_order_issued_hook` it is possible for the calling code to pass `nullptr` as the target parameter, which would cause memory problems with the several instances of `Objects[target->objnum]`. This PR mitigates that potential while testing of `hud_squadmsg_run_order_issued_hook` still works as expected.
* add more safety
On current master players have the ability to name their control preset `...` which creates issues with Windows. This 1-line PR allows that the only non-alphanumeric characters allowed in the control preset name are `-` or `_`.
Tested and works as expected.
Since `builtin_message` might store strdup'd names, we might need to free them when the struct is destroyed. Add a destructor for this purpose, and add corresponding constructors per the Rule of 5.
(Use `vm_strdup` rather than `strdup` for enhanced memory tracking.)
1. Don't display the selection arrows until the selection is actually moved, to avoid interfering with the standard selection feature
2. Use static variables and the new `TIMESTAMP` data type
3. Minor cleanup
Follow-up to #6736.
* AI Cleanup and Flag Fixes
This PR does 3 things.
1) Cleanup `ship_subsystem_in_sight` so it properly returns a bool, which is the return type of the function. Also update `ai_big_maybe_follow_subsys_path` to be a bool instead of int.
2) Adds `+subsystem attack pathing extra distance:` for use within `"$improved subsystem attack pathing:"`. FotG found, especially with the new strafing values we use, could really use the ability to set at what distance `ai_new_maybe_reposition_attack_subsys()` determines if it wants to pick a new point or not. By default the value was 2000.
3) In FotG we started using the `standard_strafe` mode more now thanks to #6511, but we have now discovered some inherit issues with it, namely that it will prematurely trigger `ai_big_strafe_maybe_retreat` because the distance it uses for determining if a collision is going to occur is `dist_normal_to_target`, which commonly resulted in the AI flying to a point to start a strafe, then thinking it would collide with the target and then retreating from strafe mode, only to realize it was now far enough to re-engage strafe mode, which commonly resulted in AI just flying around not accomplishing much. This PR adds a flag which instead uses the `distance_to_target` and a check to see if the ship is even facing the target.
Overall all are tested and work as expected. Happy to change or tune however requested, especially regarding point 3.
* clang cleanup
* cleanup copy paste name
* remove un-needed exposed float
* Allow Display Name to be used in Kills Stats by Ship Class
Currently, the display that is shown for kills by ship type does not use display name of the ship class, which makes the ship classes look different than the other areas where they are displayed throughout the game. This PR fixes that by using display name when rendering the kill stats. Note, this PR does not edit the pilot file structure at all, it simply just tunes how the names are displayed/rendered.
Importantly though, display names do not have to be unique, while the ship class names do. Thus, this PR also consolidates the number of kills of ship classes with the same display name (For example, FotG uses classes like `X-wing#Red` and `X-wing#Blue`, but both have the same display name of `X-wing`, so this consolidation means FSO will simple display `X-wing` with the sum. Overall, mods not using display name will be unaffected, while mods that do use display name will now have it properly work in the barracks and debrief rendering.
Tested and works as expected.
* remove flag for now
* move assert
* use handy get_display_name
* Per Request add flag for `$Disabled engines are silent:`
Follow-up to #6781 as there are modders who use engine sound as ambient sound. Also cleans up the sound engine disabled logic.
* cleanup name
* update flag name
Currently, the `$better combat collision avoidance for fightercraft:` flag only checks for possible big ship collisions when in normal chase mode (`AIM_CHASE`), but strafing a big ship is a separate AI mode (`AIM_STRAFE`). Per discussion with Asteroth, strafe attacking should also check for better collision avoidance, as the modder likely would expect that to fall under this AI flag. Also took the chance to make the collision avoidance check into a function to improve maintenance and usability.
Several refinements:
1. Make the case labels consistent between the setting and getting of the virtvar, for ease of comparison and troubleshooting.
2. Consolidate CHASE_WING and GUARD_WING for setting, like they already are for getting.
3. Consolidate STAY_STILL for getting, using one simple trick.
4. Remove the KEEP_SAFE_DISTANCE goal, since it has no target. Fixes#6761
5. Fix CHASE_SHIP_CLASS which put the getting case in the setting section, and consequently did not handle setting.
The code for generating spark sounds was incorrectly copied from debris to ships, dating all the way back to retail. The sound should be played once per generation event, not once for every electrical arc active on the ship. This fixes a bug that caused overlapping electrical arc sounds.
* Add method to get a font's font family
* nullptr
* add more safety checks
* pass font data instead of font data members
* return an empty string instead of unknown
The new enum class collection of AI goal modes did not handle the superposition of states that could occur when multiple ships were selected in FRED. Add a special FRED-only state for this purpose.
* Two Sound Updates
On current master, destroyed engines still make noise and the `Engine Minimum Volume` is not used by big ships. This PR makes two new game settings flags which allow mods to mitigate those issues (`$Unify minimum engine sound:` and `$Disabled engines are silent:`).
Tested and works as expected.
I also added both of these to the 25.0 default, but happy to alter however.
* disabled eng snd does not need flag fix
* ensure retail large ships still sound loud
This PR adds two new localization strings, which allow modders to change how the numbers in the comms menu are displayed, and it incorporates styling for the comms selection controls from #6736, too.
Tested and works as expected.
* Added new keybinds, keycontrol handlers, hudsquadmsg methods for alternate communication menu control scheme
* .gitignore update. CMake in VStudio places builds in [Oo]ut/ folder by default
* Added support for menu pages
* Small formatting cleanup
* code cleanup
* removed unecessary variable
* Updates after code review
* Updated comments
* XSTR_SIZE correction
* Allow ship debris pieces hitpoints depend on radius
Currently, ship debris pieces have their hitpoints set via a Max and Min range. This constricts modders by needing all debris pieces to have somewhat the same size, otherwise the uniform random hitpoints assignment will could make small pieces much stronger than big pieces.
This PR adds a new field `+Hitpoints Radius Multiplier:` which is just a value that multiplies the debris radius, this value, and the debris hitpoints to calculate a final hitpoints value for the spawned debris piece.
This multiplier thus allows modders to have debris pieces that are very large have much strong hitpoints then debris pieces that are very small.
* incorporate feedback fix
* match other logical checks
* Actually pr-test fastdbg
* Set embedfile msvc runtime
* Restructure toolchain files so that embedfile is also built accordingly
* Conditional AFXDLL
* Set iterator level globally
* Update nightly build to use windows 2022
* Update build-release.yaml
* Update build-test.yaml
* Update test-pull_request.yaml
* Upgrade to CMake 3.21+
temp commit
* remove cotire due to incompatibilities
* Update dependencies to compile on CMake 4 with no warnings
* Update ANTLR4
* Update GTest
* Fix Windows CI
* Fix case sensitive ANTLR include
* Fix naming issues and disable shared ANTLR+
* Include Mess for MSVC
* fix new windows signed/unsigned compare warning
* FRED2 linking settings
* Don't clang tidy gtest
---------
Co-authored-by: Tyler Blount <[email protected]>
* Fix two small visual-based bugs
PR fixes/cleans up two small visual bugs/clean-up aspects.
1) If a mod uses the autoaim frame feature of the center reticle (IE the center reticle switches to a second bitmap if a target is within the autoaim cone), then there is currently an edge case bug where if the player's target dies while in the autoaim cone, the value tracking whether or not to use the autoaim frame is never reset to false. This results in the autoaim frame remaining even when the target is dead and long destroyed. This PR properly resets the autoaim bool to false if the target is not valid, and overall works now as expected.
2) #6555 moved warp options to tables instead of via in-game options, but there was a line of code that still referenced `WarpFlash`, where that option was forced off in standalones. This PR properly removes that line and instead puts the standalone check as part of the input warp queue function.
* also cleanup techroom subsystem loading
1. Allow "Stay near me" and "Stay near my target" to work even if the teams do not match
2. Allow "Stay near my target" to be issued regardless of team
3. Avoid divide-by-zero errors when running `ai_stay_near()`
The button should now say restore when the item has already been deleted. Also, this expands how well we warn about deletions and will dynamically decide if we need to warn about deletion.
It turns out that an empty string is not the only possible desired value if the filtered string is "-". "-0" should return "0", but would return "" before this.
- key: 'performance-move-const-arg.CheckTriviallyCopyableMove' # This isn't actually performance relevant, but using move on trivially copyable types can well indicate that the variable should not be used anymore, such as when passing a builder type to the finialization function
@@ -105,7 +111,7 @@ OPTION(FSO_USE_OPENALSOFT "Download and build OpenAL Soft instead of using the s
OPTION(FSO_FATAL_WARNINGS"Determines if warnings in the build are considered fatal errors, primarily used for CI"OFF)
SET(FSO_FREESPACE_PATH"${CMAKE_INSTALL_PREFIX}"CACHEFILEPATH"The path of the FreeSpace directory you want to use. Please note that you will have to change CMAKE_INSTALL_PREFIX if you change this at some point.")
SET(FSO_FREESPACE_PATH"${CMAKE_INSTALL_PREFIX}"CACHEPATH"The path of the FreeSpace directory you want to use. Please note that you will have to change CMAKE_INSTALL_PREFIX if you change this at some point.")
SET(FSO_RUN_ARGUMENTS""CACHESTRING"Additional arguments passed to a generated executable when run with the generated build files.")
@@ -121,10 +127,25 @@ OPTION(FSO_BUILD_WITH_DISCORD "Build with Discord support" ON)
OPTION(FSO_BUILD_WITH_OPENGL"Enable compilation of the OpenGL renderer"ON)
OPTION(FSO_BUILD_WITH_OPENGL_DEBUG"Enables debug option for OpenGL"OFF)
OPTION(FSO_BUILD_WITH_OPENGL_ES"When building OpenGL, use OpenGL ES compatibility layer (External shaders only!)"OFF)
OPTION(FSO_BUILD_WITH_VULKAN"Enable compilation of the Vulkan renderer"OFF)
Goal_on_hold,// when set, this goal cannot currently be satisfied, although it could be in the future
Subsys_needs_fixup,// when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
Goal_override,// paired with ai_goal_type::DYNAMIC to mean this goal overrides any other goal
Want_override,// a goal should set this flag if Goal_override should be assigned when the goal is achievable
Purge,// purge this goal next time we process
Goals_purged,// this goal has already caused other goals to get purged
Purge_when_new_goal_added,// this goal is perpetual until any other goal is added, at which time it sets its own Purge flag
Goals_purged,// this goal has already caused other goals to get purged (because it is something like ai-disarm that renders other goals invalid)
Depart_sound_played,// Goober5000 - replacement for AL's hack ;)
Target_own_team,// this attack goal is allowed to target friendlies
Afterburn_hard,// afterburn as hard as possible to the goal
Waypoints_in_reverse,// decrement instead of increment
Clear_all_goals_first,// this goal wipes all goals (including itself) before it runs (handled separately, and in a different place, from purging invalid goals)
NUM_VALUES
};
@@ -129,6 +132,7 @@ namespace AI {
Smart_shield_management,
Smart_subsystem_targeting_for_turrets,
Strict_turret_tagged_only_targeting,
Ships_intercept_mines,// all AI-controlled ships autonomously engage hostile mines within mine_targetable_range of themselves
Support_dont_add_primaries,//Prevents support ship from equipping new primary as requested in https://scp.indiegames.us/mantis/view.php?id=3198
mprintf(("Warning: $default form-on-wing priority: should be > 0 (read %d). Value will not be used.\n",priority));
}
}
set_flag(profile,"$do not clear goals when running form-on-wing:",AI::Profile_Flags::Do_not_clear_goals_when_running_form_on_wing);
set_flag(profile,"$do not clear goals when running stay-still:",AI::Profile_Flags::Do_not_clear_goals_when_running_stay_still);
set_flag(profile,"$do not set override when assigning form-on-wing:",AI::Profile_Flags::Do_not_set_override_when_assigning_form_on_wing);
set_flag(profile,"$purge player-issued form-on-wing after subsequent order:",AI::Profile_Flags::Purge_player_issued_form_on_wing_after_subsequent_order);
set_flag(profile,"$cancel future waves of any wing launched from an exited ship:",AI::Profile_Flags::Cancel_future_waves_of_any_wing_launched_from_an_exited_ship);
//The following raycast tends to make up 10%(!) of total AI-frametime for basically no benefit, especially in the common case for turrets where the normal isn't even queried.
{AI::AI_Flags::No_dynamic,"Will stop allowing the AI to pursue dynamic goals (eg: chasing ships it was not ordered to)."},
{AI::AI_Flags::Free_afterburner_use,"Will allow AI to use afterburners when attacking a big ship, flying to a target position, guarding a ship, and flying in formation."},
{AI::AI_Flags::Waypoints_no_formation,"Ship will not form up with its wingmates while running waypoints with them."},
{AI::AI_Flags::Kamikaze,"Ship will attack big ships by colliding with them and exploding."},
Warning(LOCATION,"Ship %s was set to arrive from fighter bay on object %s, but no fighter bay exists on that ships' model (%s).\n",shipp->ship_name,parent_shipp->ship_name,pm->filename);
@@ -13871,9 +14058,8 @@ int ai_find_closest_depart_path(ai_info *aip, polymodel *pm, int allowed_path_ma
floatdist,min_dist,min_free_dist;
vec3d*source;
model_path*mp;
ship_bay*bay;
bay=pm->ship_bay;
constauto&bay=pm->ship_bay;
best_free_path=best_path=-1;
min_free_dist=min_dist=1e20f;
@@ -13950,9 +14136,9 @@ int ai_acquire_depart_path(object *pl_objp, int parent_objnum, int allowed_path_
@@ -1526,7 +1661,7 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int /*
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);
AI_GOAL_SCHROEDINGER,// used for FRED when multiple ships are selected with different orders
AI_GOAL_CHASE,// per the original #define list, AI_GOAL_CHASE started at 2 (1<<1)
AI_GOAL_CHASE,
AI_GOAL_DOCK,// used for undocking as well
AI_GOAL_WAYPOINTS,
AI_GOAL_WAYPOINTS_ONCE,
@@ -80,7 +80,8 @@ enum ai_goal_mode : uint8_t
AI_GOAL_FLY_TO_SHIP,
AI_GOAL_IGNORE_NEW,
AI_GOAL_CHASE_SHIP_CLASS,
AI_GOAL_PLAY_DEAD_PERSISTENT,
AI_GOAL_CHASE_SHIP_TYPE,
AI_GOAL_PLAY_DEAD_PERSISTENT,// Disables subsystem rotation/translation among other things but there is a carveout for that in the lab in ship_move_subsystems() and ai_process_subobjects()
Assertion(!asip->end_particles.isValid()||asip->breakup_delay.has_value(),"Asteroid %s has end particles but no breakup delay. Parsing should not have allowed this!",asip->name);
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})
XSTR("Confirm new custom preset name.\n\nThe name must not be empty or a default preset.\n\n Press [Enter] to accept, [Esc] to abort to config menu.",1867),
// Conflict group bitmasks. Bindings only conflict if their groups overlap (bitwise AND != 0).
staticconstintCONFLICT_GROUP_DEFAULT=(1<<0);//!< Standard gameplay bindings
staticconstintCONFLICT_GROUP_PHOTO_MODE=(1<<1);//!< Bindings used within photo mode
classCCI:publicCCB{
public:
// Inherited from CCB
@@ -586,6 +604,7 @@ public:
// Items Set in menu
chartab;//!< what tab (category) it belongs in
intconflict_groups=CONFLICT_GROUP_DEFAULT;//!< Bitmask of conflict groups. Bindings only conflict with others sharing at least one group.
intindexXSTR;//!< what string index we should use to translate this with an XSTR 0 = None, 1= Use item index + CONTROL_CONFIG_XSTR, 2 <= use CCI::indexXSTR directly
SCP_stringtext;//!< describes the action in the config screen
snd_play_3d(gamesnd_get_game_sound(sound_index),&fireball_objp->pos,&Eye_position,fireball_objp->radius,NULL,0,1.0F,SND_PRIORITY_SINGLE_INSTANCE,NULL,fb->warp_sound_range_multiplier);// play warp sound effect
Loaded 100 of 1570 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.