mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
* 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]>