122 Commits
Author SHA1 Message Date
Goober5000 2b6e20360d assign sip->model_num from inside model_load, plus a few tweaks 2026-05-05 00:19:47 -04:00
BMagnu 5fc84d533d Actually load model if necessary (#7265) 2026-03-04 12:04:09 +09:00
BMagnu 252655cee5 Don't magic a model instance out of thin air (#7259) 2026-03-02 02:34:43 +00:00
wookieejedi 26e9ecab0e Allow mods to set threshold at which shield stops taking damage (#6847)
* 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
2025-07-19 18:24:49 -04:00
Mike Nelson 1977c083c7 Allow defining separate player and target shield icons for config (#6691)
* Allow defining separate player and target shield icons for config

* rename define to prevent confusion with a similar define in shield.cpp

* address some feedback
2025-05-02 07:58:25 -04:00
Mike Nelson 524d36332d per-hud config weapons and shield gauge ship (#6651) 2025-04-17 08:31:48 -04:00
Mike Nelson 60777154be Hud config upgrades (#6581)
* base working version

* localization and minor tweaks

* add retail UI controls

* Add way to hide gauges from Config view

* convert hud config from index matching to id matching

* clang
2025-03-22 22:47:38 -04:00
Goober5000 a92368da96 Merge pull request #6624 from Goober5000/shield_tweaks
some refinement of shield quadrants
2025-03-11 00:58:50 -04:00
wookieejedi 10d59399c6 Fix mini-shield custom filename (#6625) 2025-03-08 17:40:53 -05:00
Goober5000 44cdb29135 some refinement of shield quadrants
Remove the `n_quadrants` field because it is entirely redundant to the size of `shield_quadrant`.  Also, be more rigorous about the difference between `shield_get_quad(i)` (which can fluctuate) and `shield_quadrant[i]` (which gives the exact quadrant strength).  Finally add some C++ casts and move some checks to better places.
2025-03-08 01:10:59 -05:00
Mike Nelson acc382d169 config rendering method for messages, talking heads, and shield gauges (#6575) 2025-03-02 08:02:09 -05:00
Mike Nelson 5b736b1ddc Hud config framework (#6495)
* Add scaling for vfnts and scale multipler to gr_string

* nullptr

* Add scaling to a couple other string operations

* Add scaling features to additional bitmap drawing methods

* Implement framework for rendering hud gauges in config mode

* fix merge error

* address feedback
2025-02-03 07:01:47 -05:00
Goober5000 31a86e3f3d all the consts!
Some experimentation resulted in a lot of const-cascading.  This PR applies `const` to a large number of functions.
2024-11-07 23:33:13 -05:00
BMagnu 87704fc817 Refactor replacement texture to a modelinstance parameter (#6154)
* Move replacement textures from ship to modelinstance

* Actually set pmi

* Fix texture replace in fred as well

* Fix bad indent

* incorporate feedback
2024-05-21 17:18:32 +02:00
BMagnu 02e84f212a Fix HUD slewing (#5656)
* Fixup HUD for slewing

* Fix Training Message box

* Lead indicator slew

* Fix HUD Message Head

* Correctly render messages

* Fix HUD offset handling

* HUD offset never makes any sense

* Cleanup offset code

* Remove unused parameter

* Fix Talking Head in RTT mode
2023-10-16 01:44:17 +09:00
BMagnu febd8cd2ad Allow an asymmetric FOV / Frustrum (#5657)
* Enable Asymmetric Projection FOV

* Properly apply asymmetric FOV to g3_rotate_ functions

* De-CPP14-ify

* cleanup

* Make GCC happy

* Fix Vertical Asymmetric FOV

* Fix printf
2023-10-15 05:39:24 +09:00
Asteroth bc09f0672b better hud gauge load safety 2023-07-07 01:20:11 -04:00
JohnAFernandezandTaylor Richards d50a599934 Taylor's in-game fixes
Co-Authored-By: Taylor Richards <[email protected]>
2022-11-13 20:32:42 -05:00
Asteroth b14a27cdff fix model point shield handling for mini target shields (#3531) 2021-06-25 00:44:39 -04:00
asarium bd3632d1bf Enable remaining misc- checks and fix detected issues 2018-04-25 11:57:55 +02:00
asarium eeed22b91a Enable misc-unused-parameters
clang-tidy was used for fixing the warnings. It is not clear if this is
actually an improvement so this may still be disabled later.
2018-04-25 11:57:55 +02:00
asarium 8f06e338a4 Add typesafe handle types and use it in game sound system
This adds a new class which allows to create type safe resource handle
types. At the moment, the engine uses ints pretty much everywhere for
providing handles to resources created by the specific subsystems. Since
all ints are the same to the C/C++ typesystem it is perfectly legal to
pass a sound handle to the graphics API as a buffer handle which will
obviously cause issues.

This adds a new type called "ID" which is a wrapper class for a generic
handle but with added type safety. An instance of this class cannot be
passed to a function expecting another type of handle which provided
compile-time type safety for these APIs.

As an initial test I converted the game sound handles to this new type.
I already found a bug in the mainhall system thanks to this new type.
The mainhall used the game sound handles as sound instance handles which
probably meant that that specific code never really worked right. I
removed the code since there was no better alternative for fixing it.
2018-04-22 16:22:45 +02:00
z64555 a42b27c0b8 Moves player control check for modelpoint shields into hud_augment_shield_quadrant(). AI ships can now use shield_transfer() on quadrant indices larger than 3. 2017-12-08 15:01:10 -06:00
asarium 0522566790 Replace direct usages of Snds vector with a function call
This will make it easier to validate the used handles and is generally
better since it doesn't require a global sounds vector.
2017-10-09 15:02:29 +02:00
asarium 4c1ed2f66a Move graphics matrix handling out of OpenGL code
All transformations are now handled by shaders so there is nothing
special going on in the graphics API specific code anymore. Since model
uniform buffers require access to these matrices I moved the matrix
handling out of the graphics API code.
2017-09-05 12:36:32 +02:00
niffiwan bcf49b9630 Fix const var names & style 2017-04-04 17:10:03 +10:00
niffiwan 654f3545fc Tweak autodraw shield bar positions
See #1329, this makes the rear shields slightly further away from the
front, so that the model clip area matches the area where the shields
are drawn.
2017-04-03 20:10:05 +10:00
asarium 808231dd7d Fix generated shields rendering in cockpits
The generated shields did not respect the display offset specified in
the table so they were drawn out of the clipping bounds of the gauge
which meant that they were not visible. This fixes that by respecting
the specified display offset when rendering the shield icons.
2017-03-03 13:18:00 +01:00
asarium a02c2deb69 Render correct number of vertices for shield icon
I also added a few graphics debug scopes since I needed those for
tracking down which code renders the shield icons.

This fixes #1261.
2017-02-25 12:59:51 +01:00
z64555 b0d9c53688 Remove duplicate function get_max_shield_quad() 2016-11-25 15:07:37 -06:00
z64555 260673fcea Remove unused variables. 2016-11-25 15:04:11 -06:00
z64555 6f0888e30b Combine shield transfers from AI and Players into one code path
Fixed an Assert()
2016-11-25 15:04:08 -06:00
z64555 0a81104723 AI and Player shield balancing now share same codepath. 2016-11-25 15:01:28 -06:00
niffiwan bf21913708 Updates to max shield recharge fix
Use a helper function in appropriate places, add comments where not
Avoid a potential div/0 & add Assertion to shield_get_max_strength
2016-10-16 16:31:11 +10:00
MageKing17 bce17561ed Change pointless .size() calls into .empty() calls.
The codebase had quite a few instances of .size() being called and then checked to see if it was 0 or not (or less than 1, or greater-than-or-equal-to 1, which are basically equivalent), when .empty() could be called instead (negated or not, depending on what the original condition was).
2016-09-07 18:36:12 -07:00
SamuelCho a481999a24 OpenGL Core support. Introduction of material based draw system. Rewrote geometry batcher. 2016-08-17 00:13:19 -07:00
Fabian Woltermann 770fce8de5 Bitset flags -- take 2 (#775)
This introduces a new mechanism for handling bit flags. Instead of using an int (or two, or three) to write bits into, this uses the std::bitset in a wrapper class that accepts an enum class as input. This means that certain classes of errors we've had a few of in the engine, where a coder used the wrong set of flags or checked them against the wrong variable (SF_STEALTH vs SIF_STEALTH, for example) can now be detected at a compiler level rather than not at all.
2016-08-12 16:13:50 -07:00
MageKing17 70529dbd5a Deprecate -nohtl and -brief_lighting.
-nohtl hasn't worked for years, and -brief_lighting was always supposed to be a temporary flag before making the behavior always on.
2016-07-08 09:39:29 -07:00
SamuelCho 0f0f6377d0 Killed the last vestiges of ship_model_start/stop. 2015-12-13 23:51:24 -08:00
Lari Nieminen 8d0624b064 Fix a small glitch in shield icon alpha range
Calculates the alpha range using the actual number of shield segments instead of 4.
2015-12-08 14:08:34 +02:00
Goober5000 8a125ab019 remove obsolete const_casts 2015-10-28 00:18:31 -04:00
asarium 077dc61660 Fix format warnings in hudshield.cpp 2015-08-19 11:26:27 +02:00
Echelon9 47af1ff851 Simplify duplicative hud/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 c5493bb480 Scripted sort and uniq on (internal) project includes. Improves search time and as a by product removed a number of duplicative includes. 2015-06-22 20:24:30 +10:00
Cliff Gordon a4c1f89720 Merge remote-tracking branch 'origin/master' into fix/triplemon_hud
Conflicts:
	code/freespace2/freespace.cpp
2015-05-20 17:15:15 -05:00
asarium 3cfbcbe363 Fix signed < unsigned warning 2015-05-14 10:45:25 +02:00
Cliff Gordon 0ce31bf471 [fix/triplemon_hud] Yarn's triple-monitor fix, see http://www.hard-light.net/forums/index.php?topic=89262.0. Patch tweaked to work around changes in 9aed627. 2015-05-06 10:40:45 -05:00
Swifty c620372357 Soft shadows, deferred lighting, and various major graphics optimizations. 2015-05-02 14:35:37 -07:00
MageKing17 1a29b395ab Stop standalones from executing hud_shield_quadrant_hit().
Also add some assertions to avoid (or at least help detect) similar errors in the future. Should fix Mantis 2971.
2015-04-30 22:10:17 -07:00
Goober5000 85872114ee related to Mantis #2971: properly reset shield info when we have a null objp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11099 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:44 +10:00