13 Commits
Author SHA1 Message Date
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
Goober5000 eeffbd692f make hitpoint sexps safer to use in debriefing
There is a rather large design flaw in FreeSpace debriefings... debriefing SEXPs can refer to in-mission ship data, while all ships (and all objects) are deleted as soon as the mission completes.  Specifically, `obj_delete()` is called which sets all objects to `OBJ_NONE` and marks them as freed, although the data still exists in the various arrays.  This is the use-after-free problem, but applied to the in-game object system, rather than memory accessed by pointers.

It's probably best to defer fixes to an as-needed basis.  As for hitpoint SEXPs, this change updates them to use the object and ship references from the ship registry, since the ship registry is not cleared by the time the debriefing is loaded.  (Using `objp->instance` and `shipp->objnum` at this point would be problematic.)  Since subsystems are also cleared at this point, this also updates the warning messages in those functions.

Fixes an Assert seen in debug mode in Inferno.
2025-01-12 16:52:16 -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
Asteroth d49e24fa0c Add healing weapons (#2873)
* basic proof of concept: healing weapons

* implement healing weapons

* remove unused parameter

* travis

* more travis

* endless travis

* earlier multi client return

* update find_submodel_instance_world_point

* review tweaks
2021-05-25 23:03:20 -04:00
CasparKielwein e622d81e89 remove unused functions and defines in object/code 2018-12-29 16:45:47 +01: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
z64555 14c4e553dd Doxy and organize objectshield functions. Declared shield_balance. 2016-11-25 10:42:37 -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
zookeeper 8cd19aa588 Merged model point shields from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10135 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Zacam 6c702a11e6 svn:eol-type set to LF. 2012-01-13 18:37:09 +00:00
portej05 719825f80d The big CVS comment removal. This chops approx. 3.5mb off a full checkout.
I've tested this through compiling and through hand checking. 
Normalises line endings in ALL files to \n.
2009-06-20 08:08:20 +00:00
WMCoolmon da6af09832 Add objectshield.h and include it in files that require it. 2008-03-15 20:46:07 +00:00