Compare commits

..
Author SHA1 Message Date
JohnAFernandez 0feab10244 Upgrade velocity compression in OO packet
Previously, the velocity could be off by up to 1 m/s.  This gives that packing function one more byte to work with, so that we have a lot more accuracy to work with.
2021-03-20 06:49:11 -04:00
JohnAFernandez b342ec50eb Properly Set net_signatures for wing ships
Previously wing ships were being given a net signature that was one too large.
2021-03-20 06:49:11 -04:00
Goober5000 61ef36b238 allow two SEXPs to be used in multiplayer that previously couldn't be
1) The ship-vanish SEXP (and script function) was already multiplayer-ready
2) The is-ship-visible SEXP was enhanced to add a second argument, which defaults to the player's ship in single-player mode
2021-03-20 06:49:11 -04:00
JohnAFernandez fe84d11025 Hopefully Temporary Disable Support ship in TvT
Support ship is not fully support per-team.  Logic for TvT has to be added otherwise players can "steal" each othere's support ships during the mission.
2021-03-20 06:49:11 -04:00
JohnAFernandez 735e00d839 Fix Missile Syncing Between Server and Client 2021-03-20 06:49:11 -04:00
JohnAFernandez 8bbe4733fb Fix implementation of multi_pack_unpack_desired_vel_and_desired_rotvel 2021-03-19 23:34:15 -04:00
JohnAFernandez 56f7dc2f8c Multi Version bump for 21_2
since many of the fixes and features require a multi bump.
2021-03-19 23:33:50 -04:00
JohnAFernandez 420c7ec171 Play directive completion sounds for clients (#2900)
* Allow Text to show failure on Clients

Function was accidentally returning false before sending an update on failure.

* Play directive sounds for clients

This adds a short client version of the function that initiates the directive completion sound.

* forgot to remove a failed experiment
2021-03-19 05:39:05 -04:00
Asteroth 8b94e58596 Merge pull request #3284 from Baezon/fix-rand-circle-sphere-bias
Fix probability distribution of vm_vec_random_in_circle/sphere
2021-03-19 02:23:31 -04:00
Asteroth b304ccbe96 Merge pull request #3305 from Strygon/chaseviewtest
Adding "Start missions in Chase View by default" flag in game_settings.tbl
2021-03-19 02:23:08 -04:00
JohnAFernandez 5bb934119c Limit instances of Client Collisions to Avoid Instant Death (#3164)
* Limit instances of Client Collisions to Avoid Instant Death

* Set timestamps correctly (take 2)

* Handle server check the same everywhere

* Clearer Logic Here
2021-03-18 17:24:08 -04:00
Fabian Woltermann 8c7a8e42b2 Merge pull request #3307 from The-E/fix/3206_submodel_property_parsing
Fix for #3306
2021-03-18 17:29:10 +01:00
Fabian Woltermann 9a06e0727c Make sure we check for any carriage return characters that may sneak in too 2021-03-18 16:52:15 +01:00
Strygon 08603009fb removed the redundancy 2021-03-17 20:40:02 +01:00
JohnAFernandez 609ed4ed94 Remove the fireball limit (#3224)
* Remove the fireball limit

* Handle Feedback

(Without the main PC, so really hoping I don't do any typos)
2021-03-17 14:21:06 -04:00
Strygon 3ab9f85a7a ditto 2021-03-17 17:50:19 +01:00
Strygon 45db675c35 Renaming the bool 2021-03-17 17:49:43 +01:00
Strygon 5b01a68352 Adding a few forgotten parts of the ChaseViewDefault code 2021-03-17 17:39:27 +01:00
Strygon 67cc6a66eb Adding ChaseView Flag functionality
This is where the game would put the player into chaseview/third person if the flag for it is set in game_settings.tbl
2021-03-17 17:38:32 +01:00
Strygon 842c84da7d Adding the actual flag for default chase view 2021-03-17 17:36:25 +01:00
Strygon 6598c25fda Adding support for Chase View flag 2021-03-17 17:35:39 +01:00
Goober5000 d716433848 Merge pull request #3300 from Baezon/fix-flak-substitute-assert
Fix assert with combining flak and non-flak using substitute
2021-03-17 00:34:14 -04:00
Asteroth 95235b353b Merge pull request #2885 from Baezon/expose-huge-small-targeting
Expose ability to be targeted by 'huge' and 'small only' weapons
2021-03-15 22:32:22 -04:00
Baezon ce1907c52a flak should use normal mflash methods 2021-03-15 18:30:47 -04:00
JohnAFernandez 895dbdddb8 Merge pull request #3295 from Goober5000/spacebar_popup
add text to context popup
2021-03-15 09:44:00 -04:00
Baezon 643cb6a2be update scripting functions 2021-03-14 15:37:43 -04:00
MageKing17 2348d4db64 Merge pull request #3297 from MageKing17/bugfix/sexp-ammo-safety-regression
Fix ammo safety regressions.
2021-03-14 11:45:04 -07:00
MageKing17 77534926c8 Comment clarification. 2021-03-14 11:16:54 -07:00
MageKing17 47c409a3d5 Fix ammo safety regressions.
When various SEXP functions related to ammo were consolidated back in June (in commit 54409ec928), certain safety catches meant to avoid having too much ammo or the wrong ammo capacity after changing weapons were lost. This commit adds code that should be functionally equivalent.
2021-03-14 10:43:06 -07:00
Goober5000 593fbdbf21 add text to context popup
The Space Bar is a valid shortcut, so indicate as such.  Fixes #3289.
2021-03-14 12:47:15 -04:00
Goober5000 69be3c8f35 Merge pull request #3293 from Goober5000/hotkey_range_check
simple hotkey range check
2021-03-14 00:04:14 -05:00
Goober5000 85fc1f7cea simple hotkey range check
This prevents the message from firing if the wing index is -1 which would cause an array underflow.  Fixes #3280.
2021-03-13 23:15:16 -05:00
Goober5000 59a5a343c8 Merge pull request #3291 from Baezon/fix-contrail-a_decay_exponent
Peoperly initialize alpha decay exponent for contrails
2021-03-13 22:14:38 -05:00
Baezon a3ce01f250 properly initialize a_decay_exponent 2021-03-13 20:33:54 -05:00
Asteroth 4b64c43ef8 Merge pull request #3274 from Baezon/shooter-damaging-weapons
Add shooter damaging weapons
2021-03-13 15:03:52 -05:00
Asteroth 4307d12762 Merge pull request #3285 from Baezon/fix-fit-and-set-obj-facing
Bugfix for FIT with set-object-facing
2021-03-13 14:59:52 -05:00
Asteroth 0d3d336d65 Merge pull request #3287 from Baezon/fix-aburn-trail
Properly initialize trail alpha exponents for afterburner trails
2021-03-13 14:59:24 -05:00
Baezon 256a047fab fix rand circle and sphere probability distribution 2021-03-12 16:13:52 -05:00
Baezon 222799b1a1 initialize trail alpha exponents for aburn trails 2021-03-12 16:03:50 -05:00
Fabian Woltermann 649fe7e3ce Merge pull request #3286 from Baezon/fix-to-the-fixed-fog
Fix for nebula fogging distance
2021-03-12 10:54:50 +01:00
Baezon 2e5e25dc09 revert #2222 and fix comment 2021-03-11 23:28:23 -05:00
Baezon 0612a72c2f fix FIT with set-object-facing 2021-03-11 15:41:55 -05:00
Baezon 22f7ff3443 fix bias from random_circle/sphere 2021-03-11 03:02:24 -05:00
Goober5000 5105f35a31 Merge pull request #3271 from Goober5000/better_parse_lists
rewrite stuffing of lists
2021-03-10 19:19:39 -05:00
Goober5000 f025572110 rewrite stuffing of lists
Consolidate all the functions which parse lists of data.  They're almost the same except for the data itself, so use templates.

As for the templated function which handles the list, boost the robustness by adding additional checking and error messages.
2021-03-10 18:50:12 -05:00
Goober5000 ed2cc47093 Merge pull request #3269 from Goober5000/annotation_fix
Various annotation fixes
2021-03-10 18:49:39 -05:00
Goober5000 4486b9ee10 Merge pull request #2923 from z64555/controls3
Controls3 - Primary/Secondary Bindings
2021-03-10 15:53:52 -05:00
Asteroth e8603e1617 Merge pull request #3247 from Baezon/better-subsys-attacking
Add improved subsystem attacking
2021-03-10 12:21:53 -05:00
Goober5000 f67860a502 Merge pull request #3283 from Goober5000/fix_isdigit_type
fix character type for isdigit
2021-03-10 11:37:54 -05:00
Goober5000 497a0e0805 fix character type for isdigit
Just like the `std::toupper` and `std::tolower` functions (see PR #3226), `std::isdigit` is designed to work with regular `char`, not `unsigned char`.
2021-03-10 10:51:56 -05:00
Goober5000 470a996b11 Merge pull request #3281 from Goober5000/beam_range_fxi
a few turret fixes
2021-03-09 23:09:59 -05:00
Goober5000 5bb9f427b4 a few turret fixes
This correctly calculates the turret position from the center (zero position) of its submodel instead of using the offset from the main model.

This patches a few more parts of the code and also adds a missing locale argument.
2021-03-09 22:39:13 -05:00
Goober5000 52df877ed9 Merge pull request #3276 from Goober5000/special_arg_fix
add small fix from SEXP containers PR
2021-03-09 21:43:28 -05:00
Asteroth 0eefd352d9 Merge pull request #3264 from Baezon/32-poofs
Increase max nebula poofs to 32
2021-03-08 14:44:26 -05:00
Baezon cf2e3e8641 lightning even with 0 poofs 2021-03-08 10:50:27 -05:00
Baezon f60d2d8e30 comment changes 2021-03-07 23:06:30 -05:00
Goober5000 a12a33b189 Merge pull request #3277 from Goober5000/movable_turret_fov_fix
Turrets on movable submodels
2021-03-07 21:29:28 -05:00
Baezon cf3ce54038 comment clarity 2021-03-07 14:20:55 -05:00
Goober5000 483a632c7f Merge pull request #3243 from Baezon/decouple-asteroids-species
Decouple asteroids from species
2021-03-07 13:13:13 -05:00
Goober5000 9a3fc507d6 Merge pull request #3261 from BMagnu/lua_campaignswitch
Lua add campaign switch function
2021-03-07 13:10:01 -05:00
z64555 19c0f64736 Upgrade a few Assert()'s into Assertion()'s with error messages 2021-03-07 09:56:21 -06:00
z64555 78ac82d6eb Replace Int3()'s with UNREACHABLE
* control_config_bind_btn uses UNREACHABLE macro when an unknown order is passed to it
2021-03-07 09:20:34 -06:00
Baezon 2dd40bcbd8 typo 2021-03-07 02:00:58 -05:00
JohnAFernandez 5da44a9d72 Merge pull request #3178 from Baezon/generic-debris-enhancement
Generic debris expansion and configuration
2021-03-07 00:19:25 -05:00
Goober5000 d75b0f4b4b additional minor cleanup 2021-03-06 20:03:59 -05:00
z64555 5c9582aefc Fix bug where "Clear Conflict" button was disabled on Ship tab unless the conflicted items included an axis. 2021-03-06 12:52:48 -06:00
Goober5000 ab478c4a0e Merge pull request #3275 from Goober5000/uoffset_addendum
addendum to u_offset
2021-03-05 22:44:00 -05:00
Goober5000 01daf25fe9 addendum to u_offset
This improves PR #3257 by updating the frametime after the beam fires, not before, so that the first frame will always be at offset zero
2021-03-05 22:15:55 -05:00
Goober5000 db73c27a53 add small fix from SEXP containers PR
While skimming the differencs in jg18's branch of PR #3253...
https://github.com/jg18/fs2open.github.com/tree/feature/sexp-containers-revised

...I noticed a TODO that is almost certainly a genuine bugfix.  As such, it deserves its own PR.  The line in question was last modified in 2012 by karajorma, and the bugfix should test for the special-arg in the entire actions tree rather than just the first action.
2021-03-05 22:00:51 -05:00
Baezon d972f353f1 better species name handling and XSTR 2021-03-03 22:05:12 -05:00
Baezon 9c1d1e64cc better self kill text 2021-03-03 20:22:50 -05:00
Goober5000 abc153e21e Merge pull request #3273 from NovachenFS2/TranslatedAsteroids
Translateable Asteroid Name in Asteroid Fields
2021-03-03 15:26:30 -05:00
Jenna Trassa 9385206e0e Feedback & lowercase debris code 2021-03-03 20:56:24 +01:00
Goober5000 3674f06400 Merge pull request #3272 from NovachenFS2/AsteroidTimer
Translateable Asteroid Impact Time
2021-03-03 14:36:14 -05:00
Goober5000 be780af04d Merge pull request #3268 from BMagnu/replace-texture-sexp
Add replace-texture SEXP
2021-03-03 14:33:21 -05:00
Goober5000 ec1d2e091e Merge pull request #3262 from Goober5000/enable_multi_for_two_sexps
allow two SEXPs to be used in multiplayer that previously couldn't be
2021-03-03 13:59:21 -05:00
Goober5000 106da3c95f allow two SEXPs to be used in multiplayer that previously couldn't be
1) The ship-vanish SEXP (and script function) was already multiplayer-ready
2) The is-ship-visible SEXP was enhanced to add a second argument, which defaults to the player's ship in single-player mode
2021-03-03 13:22:50 -05:00
Jenna Trassa 34649c7543 Translated Asteroid Name in Asteroid Fields 2021-03-03 17:25:37 +01:00
Baezon 0fcfe68164 add self-damaging weapons 2021-03-03 11:08:04 -05:00
Jenna Trassa 8b0e79703a A translateable Asteroid Impact Time 2021-03-03 14:55:29 +01:00
Baezon c3c4c21fc2 typo 2021-03-03 02:26:23 -05:00
Birk Magnussen 8471b8e444 Change Preload Error to Warning 2021-03-03 15:48:47 +09:00
Baezon 8a5483db0b retail name compatability 2021-03-03 01:08:15 -05:00
Baezon 708de001f3 Merge remote-tracking branch 'upstream/master' into decouple-asteroids-species 2021-03-02 19:55:00 -05:00
Birk Magnussen 6cdbb8159b Change SEXP Syntax, and allow Wings 2021-03-03 06:00:47 +09:00
Goober5000 03dbdf7f09 don't display unmodified annotations 2021-03-02 15:09:28 -05:00
m!m 1561a75b13 Merge pull request #3260 from BMagnu/simulatedspeedoverrides_tb
Add scripting API for accessing registered Simulated Speech Overrides
2021-03-02 17:51:49 +01:00
Goober5000 aff1ad40f3 better handling of unexpected characters that come after numbers 2021-03-02 11:31:16 -05:00
Birk Magnussen 19f48e3a10 Tidy up leftover code 2021-03-02 22:17:06 +09:00
Birk Magnussen 2c27707e00 Add replace-texture SEXP 2021-03-02 22:03:28 +09:00
BMagnuandm!m 9a854a7066 Add change to correct typecast
Co-authored-by: m!m <[email protected]>
2021-03-02 17:09:20 +09:00
Asteroth 897492e228 Merge pull request #3257 from BMagnu/beam_reset_offset
Add flag for beams to track uoffset individually
2021-03-02 03:08:02 -05:00
Asteroth 72d7b1bc9c Merge pull request #3259 from BMagnu/lssm_warpeffect
Added flag to select the warp effect type of LSSM's
2021-03-02 03:07:43 -05:00
Goober5000 14a8db0dda check for all possible strings 2021-03-01 21:01:01 -05:00
Goober5000 258ffdf56d a token consisting of a single + or - is not a valid number 2021-03-01 21:00:48 -05:00
Baezon bd5f709e14 must be 32 bits!!! 2021-03-01 12:14:13 -05:00
Baezon b6c29e3ffd increase max poofs to 32 2021-03-01 12:00:37 -05:00
Goober5000 c4374d11a9 replace world_to_turret_matrix 2021-03-01 00:02:44 -05:00
Goober5000 3b1aac26e8 remove most of turret_matrix stuff 2021-02-28 23:41:56 -05:00
Birk Magnussen bbc0f08541 Fix Warpout being affected as well. Fix Messages. Fix Init 2021-03-01 13:36:05 +09:00
Goober5000 d4c6c3e145 turret_norm should now be calculated properly 2021-02-28 21:48:15 -05:00
Goober5000 66b7b011c9 Merge pull request #3256 from Goober5000/switch_sexp
add switch and functional-switch operators
2021-02-28 18:00:59 -05:00
Birk Magnussen 2233d2eb9b Reflect used player object 2021-03-01 01:32:13 +09:00
Birk Magnussen e9b2047769 Add function to switch campaign 2021-03-01 01:27:14 +09:00
Birk Magnussen 781aa5c638 Fix warning 2021-03-01 00:55:05 +09:00
m!m b5212d69e4 Merge pull request #3258 from BMagnu/lua_file_cleanup
Changed File not closed error to a warning and automatic file close
2021-02-28 16:44:58 +01:00
Birk Magnussen 03eb74e616 Add scripting API for accessing registeres sso's 2021-03-01 00:32:42 +09:00
Birk Magnussen f0d5c5a499 Remove redundant close 2021-03-01 00:13:49 +09:00
Birk Magnussen 335f2476f9 Added flag to select the warp effect type of lssm's 2021-03-01 00:06:15 +09:00
Birk Magnussen 530916e0fa Changed File not closed error to a warning and automatic file close 2021-02-28 23:47:07 +09:00
Birk Magnussen b4791b3b10 Add flag for beams to track uoffset individually 2021-02-28 14:40:25 +09:00
Baezon 4bdb9165ea bugfix 2021-02-27 22:33:21 -05:00
Goober5000 8d4976dd95 add switch and functional-switch operators
Like the C equivalent, these SEXPs allow one action to be taken, or one value to be returned, based on a numeric expression.
2021-02-27 21:56:51 -05:00
m!m e393503eb2 Merge pull request #3244 from the-maddin/default_volume_issue
Set default volume on audiostream creation
2021-02-27 22:41:03 +01:00
JohnAFernandez 9c4d8f175b Merge pull request #3255 from Baezon/bugfix-trail-texture
Properly initialize trail texture stretch
2021-02-27 14:31:12 -05:00
m!m 002b8a69b1 Merge pull request #3251 from asarium/fix/actionsCompile
Add a CMake platform check for proper non-copyable type support
2021-02-27 20:08:05 +01:00
Baezon 529ba78c04 review tweak 2021-02-27 13:48:26 -05:00
Baezon 772eaa634a properly initialize texture stretch 2021-02-27 13:41:24 -05:00
asarium 7c909c6d69 Fix Visual Studio compilation around non-copyable type
This works around a compiler bug present in most older versions of MSVC
where it absolutely wanted to use a deleted copy constructor even if a
move constructor was available.

This just moves the relevant code into the default constructor.
2021-02-27 19:39:29 +01:00
JohnAFernandez a22f44ce01 Merge pull request #3187 from Baezon/swarm-cleanup
Give swarm missile handling a well-deserved makeover
2021-02-27 00:01:58 -05:00
JohnAFernandez 09671d9907 Merge pull request #3245 from Baezon/disabled-repair-fix
Bugfix for disabled fighters interupting their own support calls
2021-02-26 23:59:03 -05:00
Goober5000 da4b6b2f67 Merge pull request #3252 from Goober5000/main_hall_parsing_fix
when we're finished parsing a main hall, the next main hall should be a new one
2021-02-26 21:55:13 -05:00
the-maddin c0f351d92e fix indents 2021-02-27 00:01:08 +01:00
m!m 8700645d21 Merge pull request #3067 from asarium/lua/fullTypeCoverage
Add full type coverage for return types and variables
2021-02-26 23:06:55 +01:00
Goober5000 3fe59717c5 when we're finished parsing a main hall, the next main hall should be a new one
With modular tables, we might have modified an entry in the middle of the vector, in which case the next index would be an existing main hall.  If the next modular table then created a brand new main hall, it would overwrite that entry.  This makes sure the code always assumes the next main hall will come at the end of the list.
2021-02-26 16:47:05 -05:00
asarium 0fb712ed39 Add full type coverage for return types and variables
This introduces type parsing for all types used within the scripting
documentation. This improves the generated JSON output and also
validates new code via the unit test.
2021-02-26 22:37:37 +01:00
the-maddin 003fa68582 Remove leftover default setting 2021-02-26 22:23:46 +01:00
Baezon e3acb2c56b ai fighter support 2021-02-25 23:45:42 -05:00
Baezon 789f78aefd Merge remote-tracking branch 'upstream/master' into expose-huge-small-targeting 2021-02-25 23:36:59 -05:00
Baezon ec323a3960 combine flags 2021-02-25 23:15:29 -05:00
Baezon 86d01a3b0f Merge remote-tracking branch 'upstream/master' into disabled-repair-fix 2021-02-25 21:22:18 -05:00
Baezon a685b6f051 Merge remote-tracking branch 'upstream/master' into better-subsys-attacking 2021-02-25 21:20:51 -05:00
Goober5000 2ac85f3172 Merge pull request #3246 from Goober5000/back_inserter_include
add missing #include
2021-02-25 15:14:48 -05:00
Goober5000 18a15eed29 add missing #include
On some setups the hierarchy of #include files doesn't catch an <iterator>, so #include it explicitly.
2021-02-25 13:45:07 -05:00
m!m 413633855f Merge pull request #3248 from asarium/build/fixQt
Force aqt to a known good version
2021-02-25 19:11:01 +01:00
asarium ac5eb11c39 Force aqt to a known good version
There was another break in that package so this should hopefully make
our builds more stable.
2021-02-25 18:37:44 +01:00
m!m ca5ab260c9 Merge pull request #3242 from asarium/feature/actionExpression
Add dynamic expression support for actions
2021-02-25 18:17:34 +01:00
Baezon 80ba3b9e9c Merge remote-tracking branch 'upstream/master' into better-subsys-attacking 2021-02-25 02:30:18 -05:00
Baezon 81c771b8ea clean up 2021-02-25 02:13:02 -05:00
Baezon d86723ef07 bugfix disabled fighters calling for support 2021-02-24 16:10:04 -05:00
asarium d589234648 Some final changes 2021-02-24 18:04:19 +01:00
the-maddin 26aab09b8e Update scripting documentation audio_stream:play()
to reflect what the implementation actually does.
2021-02-24 02:16:01 +01:00
JohnAFernandez 55b8f3f642 More cleanup and Int3() refactors (#2744)
* Clean Up ai_attack_object()

There was an unused parameter, and no one has added subsystem targeting (at least to this function) in the past 20 years, so it's time to remove it and make it more readable.  Probably better to adjust that behavior somewhere else anyway.

Also changes an Int3() into

* More Int3 cleaning

Refactor a few Int3()'s in the AI code

* Feedback on is_ignore_object_sub

* Feedback, remove duplicate check, add documentation to preserve why it was there
2021-02-23 19:51:43 -05:00
the-maddin 063854384f Set sane default volumes on audiostream creation.
Looking throughthe code, it appears that
sound volumes are typically set when calling
the "play" function for in-engine uses of sounds.
No default values were, in fact, set explicitly at
creation, so they were initialized to 0.0f.

Scripting documentation, however, refers to
default volumes per type where no volume is
passed. New engine functionality should also
be able to rely on this.

I'm setting sane values found in other
parts of the sound system at stream creation,
to be used or overwritten later.
2021-02-24 01:45:05 +01:00
the-maddin 9ffcd780e9 Deduplicate stream creation code 2021-02-24 01:45:05 +01:00
the-maddin 4125d0bdba Fix stream slot leak
A wrong stream type could lead to a stream handle
being marked as used although no stream is created
2021-02-24 01:44:10 +01:00
the-maddin af29243157 Merge remote-tracking branch 'refs/remotes/upstream/master' 2021-02-23 20:52:40 +01:00
Fabian Woltermann 659d68e9b9 Merge pull request #3167 from EatThePath/cylinder-only-tube-lights
Cylinder only tube lights
2021-02-23 19:11:22 +01:00
m!m 3d856b77d9 Merge pull request #3229 from the-maddin/master
Scripting&Sound: Load sound from memory
2021-02-23 17:57:32 +01:00
Baezon f447fd4e23 unused variables 2021-02-23 01:13:08 -05:00
Baezon 8088cf0ab4 ints to floats 2021-02-23 00:53:10 -05:00
Baezon a69046000e cast to int 2021-02-23 00:12:29 -05:00
Baezon 881da211a2 misc tweaks 2021-02-22 23:23:49 -05:00
Baezon 622a28236e decouple species from asteroids 2021-02-22 22:55:34 -05:00
the-maddin d0edab2c74 Better instance preparation; no MIN macro 2021-02-23 00:47:13 +01:00
Martin Merget c715cf5c65 Merge remote-tracking branch 'refs/remotes/upstream/master' 2021-02-23 00:04:54 +01:00
z64555 1fca306fc9 Address clang-tidy issues. 2021-02-22 14:24:26 -06:00
asarium 02b1e38cd7 Add variables concept to expressions
This also includes the necessary setup work for using "position" and
"direction" in action expressions.
2021-02-22 18:39:06 +01:00
asarium 851a7663a8 Rework actions to use definitions
This introduces action definitions which can then be instantiated to
form actual actions with expressions as their parameters.
2021-02-22 18:02:22 +01:00
asarium bcaa7934c6 Allow implicit conversion from int to float
This is generally a safe operation and will make the system a bit easier
to use.
2021-02-22 18:02:22 +01:00
asarium 1d6052e81e Rework function handling 2021-02-22 18:02:22 +01:00
asarium a5a91b5acf Add Action expressions
This is a parser for a very simple language to allow for execution of
dynamic expressions with return values for use as action parameters. The
only "dynamic" part this currently supports are random ranges but more
features are planned for the future.
2021-02-22 18:02:22 +01:00
asarium aa7ea238b9 Update GTest 2021-02-22 18:02:22 +01:00
m!m 8b23ccdf2e Merge pull request #3061 from asarium/feature/actionSystem
Add dynamic action programming system
2021-02-22 18:00:58 +01:00
Baezon adea41e690 clarity edits 2021-02-21 21:56:34 -05:00
Baezon d463db3742 Merge remote-tracking branch 'upstream/master' into generic-debris-enhancement 2021-02-21 21:31:59 -05:00
Martin Merget 4305aed38d Factor out duplicate creation/opening code 2021-02-22 01:39:55 +01:00
z64555 f51502e4ae Make qtFred and Fred changes consistent with each other. 2021-02-21 18:16:55 -06:00
the-maddin 34eed12988 Extract shared code from AudioStream::Create and CreateMem
Also cleaned up control flow on failure as far as used macros allow.
2021-02-22 00:58:41 +01:00
the-maddin 60775e73b5 Fix MSVC builds v2 2021-02-21 22:30:17 +01:00
the-maddin e55b246756 Fix MSVC builds 2021-02-21 22:14:39 +01:00
the-maddin 438f48c835 Fix compiler/type issue 2021-02-21 21:51:34 +01:00
asarium 8f88801646 Add dynamic action programming system
This system adds the code necessary for letting content creators specify
complex events by specifying a simple, program-like sequence of
operations that will be executed by the engine when a certain event is
triggered.
2021-02-21 21:29:02 +01:00
the-maddin afc9e8132a renamed memfile functions & struct 2021-02-21 20:53:52 +01:00
the-maddin 371aaa1107 Moved, documented and renamed struct MemFileCursor 2021-02-21 20:46:55 +01:00
the-maddin ab7e6cbbe1 add LuaErrors for invalid input, fix off-by-one 2021-02-21 20:37:02 +01:00
m!m 340edd5ec0 Merge pull request #3239 from asarium/build/updateBuildImage
Update Linux build image and make consistent
2021-02-21 14:36:27 +01:00
asarium 88e6469fb4 Update Linux build image and make consistent
For some reason the last update of the PR pipeline did not update the
other workflows as well so we had some minor inconsistencies.

This should hopefully fix the nightly build issues for real this time.
2021-02-21 14:02:32 +01:00
BMagnu fd60dd342f Add vanish Lua function to some objects (#3238)
* Add vanish function to some objects

* Modify vanish function return. Modify fireball access

* Remove dedunant check for ship vanish
2021-02-21 11:59:49 +00:00
Asteroth dcd38539c2 Merge pull request #3237 from Baezon/fix-turret-inaccuracy
Bugfix to turret_inaccuracy
2021-02-21 00:19:39 -05:00
Baezon 70265c6f63 bugfix turret inaccuracy 2021-02-20 23:41:30 -05:00
JohnAFernandez 19b3f85eea Merge pull request #3220 from Baezon/turret-inaccuracy
Add turret-set-inaccuracy SEXP
2021-02-20 21:07:47 -05:00
JohnAFernandez 873ec133b4 Merge pull request #3204 from Baezon/icons-parsing-overhaul
Overhaul briefing icon parsing
2021-02-20 20:57:47 -05:00
Goober5000 88f6312fd8 Merge pull request #3234 from Goober5000/sim_hull_scripting
add SimHitpointsLeft
2021-02-20 16:51:11 -05:00
Goober5000 69c1398368 add SimHitpointsLeft 2021-02-20 16:13:14 -05:00
m!m 043b1d34c8 Merge pull request #3232 from asarium/fix/linuxNightly
Try to fix linux nightly builds
2021-02-20 21:34:51 +01:00
m!m 1226c894ed Merge pull request #3233 from asarium/build/githubRegistry
Store standalone image on GitHub
2021-02-20 21:34:40 +01:00
asarium 0fb7143f12 Store standalone image on GitHub
Docker Hub is going into a weird direction with their rate limits and
the GitHub Container Registry is better in that regard.

Old images will stay in Docker Hub for the time being though.
2021-02-20 18:34:25 +01:00
Fabian Woltermann 57c593f74e Merge pull request #3231 from Goober5000/fix_eval_numeric_sexp
fix mn.evaluateNumericSEXP
2021-02-20 14:54:53 +01:00
asarium cf3faa35cd Try to fix linux nightly builds
The default Python version appears to be too recent so let's try to have
this action use the python package that is installed in our build image.
2021-02-20 14:44:01 +01:00
Goober5000 2429b99184 fix mn.evaluateNumericSEXP
This is a follow-up to #2687.  The final implementation of evaluateNumericSEXP different from the testing implementation in a small but crucial way that prevented it from actually working.  Since it used `eval_num`, it didn't evaluate the specified SEXP node but rather the CAR (first element) of the node list.  This fixes that by putting the node in a temporary SEXP list so that `eval_num` will look in the right place.
2021-02-20 01:40:55 -05:00
Baezon 0f451e6190 more comments 2021-02-19 10:45:32 -05:00
the-maddin 366a96bdd4 Expose audiostreams from memory to LUA
Allow scripts to play any LUA binary string containing valid WAV data.
Useful for TTS data passed in via LUASockets.
2021-02-19 01:22:24 +01:00
the-maddin 8770ad74f8 Add support for audiostream from in-memory sound 2021-02-19 01:19:05 +01:00
the-maddin 68d5467e2a Add support for in memory sound 2021-02-19 01:16:39 +01:00
the-maddin ac2fa61f6e Add support for in-memory sound
Using the memory backend, treat sound in memory like sound in cfiles.
2021-02-19 01:14:40 +01:00
the-maddin 2060a1dabe Add backend for in-memory audio
FFmpegContext can now also hold a cursor over a vector of bytes instead of a cfile to store sound data in it.
Appropriate creation, reading seeking functions included.
2021-02-19 01:10:43 +01:00
Fabian Woltermann b561156f09 Merge pull request #3226 from Goober5000/tocase
additional case functions and checks
2021-02-18 14:08:34 +01:00
Goober5000 f3bca4384f additional case functions and checks
This refactors the tolower/toupper code to use standards-conformant logic, and also adds some helpful utility functions.  Regular tolower/toupper must be supplied a value that can be represented as `unsigned char`, but the std:: functions are a bit more robust.
2021-02-18 04:23:08 -05:00
Fabian Woltermann c00ff88a5a Merge pull request #3223 from Goober5000/case_insensitive_ships
make the ship lookup case insensitive
2021-02-18 09:10:57 +01:00
Goober5000 866b64ff8d maybe this works better 2021-02-17 12:12:17 -05:00
Goober5000 3acd74e894 make the ship lookup case insensitive
Does what it says on the tin.  Fixes #3221.
2021-02-17 11:31:45 -05:00
Goober5000 ffa6e594e7 Merge pull request #3222 from Goober5000/perform_actions_documentation
add clarification
2021-02-16 19:27:30 -05:00
Goober5000 39f9df11f7 add clarification 2021-02-16 18:35:11 -05:00
Baezon a606f2cafa modernize-use-auto 2021-02-16 10:52:56 -05:00
Baezon 592855c35d NULL -> nullptr 2021-02-16 02:27:11 -05:00
Baezon 3797171fb0 Merge remote-tracking branch 'upstream/master' into turret-inaccuracy 2021-02-16 02:23:45 -05:00
Baezon 028e40a43b add turret-set-inaccuracy sexp 2021-02-16 02:21:54 -05:00
Goober5000 36ea4c225b Merge pull request #3219 from Goober5000/model_instance_in_fred
add model instance support to FRED rendering
2021-02-15 09:33:55 -05:00
Goober5000 24df0efb6e add model instance support to FRED rendering
This changes FRED to properly initialize a model instance on ship creation and also use that instance when rendering the ship.  This prevents destroyed submodels from appearing.  Fixes #3212.
2021-02-15 08:34:12 -05:00
Fabian Woltermann db2eba92d5 Merge pull request #3213 from Goober5000/message_list_chain
add send-message-chain
2021-02-15 10:50:05 +01:00
Fabian Woltermann dd0bb3ceca Merge pull request #3214 from Goober5000/fix_event_editor_closing
fix event editor closing on key press
2021-02-15 10:15:18 +01:00
Fabian Woltermann f9da8c7db2 Merge pull request #3217 from Goober5000/fix_event_editor_delete
fix event node deletion behavior
2021-02-15 10:14:51 +01:00
Goober5000 82a93e9e47 fix event node deletion behavior
The defensive coding in #3191 against illegal cut/delete operations was a little too defensive.  This properly allows deletion of events when necessary, and it still guards against a Cut operation being improperly called due to a shortcut key press.

Fixes #3216.
2021-02-14 17:12:22 -05:00
z64555 754f0ea876 Removed unused local variable. 2021-02-14 10:33:49 -06:00
z64555 9145922cb1 Fix default_item to use default_bindings. 2021-02-14 09:59:36 -06:00
z64555 47e19207f9 Merge branch 'master' into controls3
Resolved Conflicts:
	code/controlconfig/controlsconfig.cpp
	code/controlconfig/controlsconfig.h
2021-02-14 09:48:55 -06:00
Goober5000 41f9dbb003 fix event editor closing on key press
Restores the MFC functions that were taken out in #3073.  These functions appeared redundant, but they were actually necessary to intercept the MFC handling of Enter and Escape.  In addition to fixing that behavior, this PR also adds some clarifying comments and renames some functions to prevent confusion.
2021-02-14 01:32:03 -05:00
Goober5000 c067651498 add send-message-chain
Implements send-message-chain as described in issue #3185.  Also fixes the default argument for message priority, and mirrors the default argument fix to qtFRED.
2021-02-14 00:23:57 -05:00
JohnAFernandez 2361152399 Merge pull request #3211 from JohnAFernandez/Messaging_Switch_to_Normal
Make "Normal" the default option for Messages
2021-02-13 23:28:47 -05:00
JohnAFernandez 0318e3f851 Make "Normal" the default option for Messages
Moves messages to the more suitable default of normal.  Also adds clarifying documentation.
2021-02-13 15:56:09 -05:00
Goober5000 d21f7b8915 Merge pull request #3208 from PhantomHoover/fix/misc-rand-sizes
Properly fix static_rand()'s range and account for this in functions that were misusing it
2021-02-13 14:32:18 -05:00
Phantom Hoover 640640b4b4 Properly fix static_rand()'s range and account for this in functions that were misusing it 2021-02-13 16:06:47 +00:00
Fabian Woltermann f87cf7df23 Merge pull request #3207 from Baezon/waypoint-complete-fit-bugfix
Fix for waypoint completion with FIT
2021-02-13 17:01:25 +01:00
Asteroth 616e6a9bc0 Merge pull request #3180 from Baezon/split-collision-light-width
Split beam width for collision purposes and lighting purposes
2021-02-13 02:15:17 -05:00
Goober5000 303787d97c Merge pull request #3206 from Goober5000/retail_hybrid_translation_behavior
restore retail behavior of XSTR
2021-02-12 17:48:23 -05:00
MageKing17 db2bd97669 Merge pull request #3205 from MageKing17/bugfix/controlconfigoverride-default-preset
If the first #ControlConfigOverride isn't named, use "default".
2021-02-12 14:29:01 -08:00
Baezon 5e38f3c0d4 fit waypoint bugfix 2021-02-12 11:12:24 -05:00
Goober5000 1e756d1a67 restore retail behavior of XSTR
This is a follow-up to #2390.  Retail used a weird hybrid approach where internal strings were translated but external strings were not.  This restores that behavior by adding another language, LCL_RETAIL_HYBRID, which is the default.  The game can still be run in completely untranslated or completely translated mode.

All three modes have been tested and translate strings, or not, as expected.  The `$Use tabled strings for the default language:` flag has also been tested and still works.
2021-02-11 19:47:12 -05:00
Baezon ec274d58db clang-tidy 2021-02-10 21:49:49 -05:00
Baezon 682c15d6b1 clang-tidy curse you 2021-02-10 21:41:37 -05:00
MageKing17 29fbebde16 If the first #ControlConfigOverride isn't named, use "default".
This causes it to replace the first preset in the list, which more closely approximates the old behavior.
2021-02-10 17:58:08 -08:00
JohnAFernandez bd7450c4e6 Merge pull request #3198 from Baezon/landmark-logging
Add 'landmark' logging
2021-02-10 20:40:40 -05:00
Baezon b843a5be3a clean up 2021-02-10 18:15:48 -05:00
Baezon be44e287ee overhaul brief icon parsing 2021-02-10 17:36:37 -05:00
Goober5000 af16a6bc42 Merge pull request #3191 from Goober5000/fred_indents_and_colors
Additional FRED features
2021-02-10 09:45:07 -05:00
Fabian Woltermann 6b7429ab5d Merge pull request #3192 from Baezon/turret-forced-target
Add turret-set-forced-target SEXP
2021-02-10 11:39:16 +01:00
Fabian Woltermann d4be72c49b Merge pull request #3203 from JohnAFernandez/Really-fix-hud-config-crash
Actually fix radar range turning to -1 after hud gauge config
2021-02-10 11:36:30 +01:00
JohnAFernandez 86308bbf34 Actually fix radar range turning to -1 after hud gauge config
Problem was caused by negative array index write in this section of code.
2021-02-10 00:05:27 -05:00
Goober5000 3d6124c7ad Merge pull request #3144 from Goober5000/fix_look_at
reimplement look_at
2021-02-09 21:48:52 -05:00
Baezon 6357c2a856 clang tidy 2021-02-07 23:40:14 -05:00
Allen A. Babb 0f1c5e0a42 Merge pull request #3201 from z64555/unhide_chocolate
Unhide chocolate - Revert default-disable of controls unusable with retail data.
2021-02-07 17:02:32 -06:00
z64555 cb692b22ba Add note comment to the CCI_builder. Controls that don't work in retail should be default disabled, but this relies on the coders making them to get it set the first time. 2021-02-07 14:23:44 -06:00
z64555 0b03c3f672 Add me to the cool kids club. Wait, no, not that one. 2021-02-07 14:15:35 -06:00
z64555 15d3dde5fa Unhide non-retail controls by default. Even though retail data can't make use of most of them, some mods may count on their visibility. 2021-02-07 14:06:27 -06:00
Baezon 24947b64d7 split light and collision width 2021-02-06 22:00:45 -05:00
Goober5000 61bb44d07b Merge pull request #3200 from wookieejedi/test-rotation-fix
Fix Bug with Reading Turret Rotation Axes
2021-02-06 14:44:07 -05:00
Goober5000 aa3eb4d42c Merge pull request #3199 from Goober5000/vecmat_projecc
add useful function
2021-02-06 14:19:36 -05:00
wookieejedi 2cdc74264c Fix Bug with Reading Turret Rotation Axes
Multipart turrets that have no rotation specified in PCS don't have `movement_type` assigned properly within `modelread.cpp`, which eventually leads to a fatal crash. This two line fixe properly specifies the `movement_type` and fixes the crash. Tested and confirmed. Thanks to @Goober5000 for the assistance and troubleshooting.
2021-02-06 13:59:23 -05:00
Goober5000 dd92a0f0bb add vm_vec_is_normalized and use it in several places 2021-02-06 13:46:54 -05:00
Goober5000 e699d991d1 add useful function 2021-02-06 00:19:57 -05:00
wookieejedi ede8c6a172 Merge pull request #3197 from wookieejedi/expose-countermeasure-firewait
Expose Additional Countermeasure Options to Modders
2021-02-06 00:08:36 -05:00
JohnAFernandez ba9205cd35 Make sure to pull from the bounds of the vector. 2021-02-05 23:40:24 -05:00
Baezon b7bd8d6fbb moar tweaks 2021-02-05 15:28:14 -05:00
Baezon 7015818ea5 review tweaks 2021-02-05 12:56:03 -05:00
wookieejedi c831235cd3 add warnings 2021-02-05 11:39:50 -05:00
Baezon a6b19706eb 'landmark' logging 2021-02-05 03:49:39 -05:00
wookieejedi de17df207a specify values for AI and use multipliers for fail and succeed 2021-02-04 22:38:06 -05:00
wookieejedi 5116471d8d simplify logic 2021-02-04 13:40:23 -05:00
wookieejedi e01bd28e79 Expose Additional Countermeasure Options to Modders
This PR provides modders with additional options to alter countermeasure values. Previously, countermeasures had a fixed, hardcoded fire wait time of 333 milliseconds, regardless of what `$Fire Wait:` was specified. Also, the AI would wait a fixed delay between firing of failed countermeasure launches and successful countermeasure launches. For successful launches the AI would double the fire wait. Also, Friendly ships would only use a fixed constant value for countermeasure firing chance, and not the value based on their class specific AI profile.

This PR exposes those values with the following options:
•	Add main AI table flag: `Friendly Ships Use AI Profile Countermeasures Firing Chance`. This will allow Friendly ships to use their AI class profile countermeasure firing chance instead of the default fixed value from main AI table.
•	Add value in CM section of weapons table: Countermeasures use fire wait time `+Use Fire Wait`. This is a boolean that allows the countermeasure’s fire wait to actually use what is specified in the `$Fire Wait:` section of that weapon.
•	Add value in CM section weapons table: `+Fail Delay Equals Fire Wait`. The delay between failed countermeasure launches is set to use the fire wait value.
•	Add value in CM section weapons table: `+Successful Launch Delay Multiplier`. This allows modders to set the value that is multiplied to fire wait for successful countermeasure launches.
2021-02-04 13:12:02 -05:00
Asteroth 994e42a27d Merge pull request #3175 from Baezon/trail-decay-exponent
Non-linear Trail decay and Texture stretch
2021-02-04 12:09:22 -05:00
wookieejedi 74c9139c1c Merge pull request #3195 from wookieejedi/fix-retail-cap-ship-speed
Fix speed differential for retail cap ships
2021-02-03 19:26:19 -05:00
wookieejedi 1d7070cf12 add claryifying parentheses 2021-02-03 18:18:04 -05:00
JohnAFernandez 19c19f1262 Remove the Unused Just_updated Flag
This flag is vestigal.  It was likely used in the FS1 codebase and then was not removed by the rushed FS2 multi team.  Whether or not an object uses physics_sim is determined earlier in `multi_oo_is_interp_object()`
2021-02-03 18:00:16 -05:00
wookieejedi 754f4a309c add deprecation check 2021-02-03 17:46:06 -05:00
Asteroth 83bd14586f Merge pull request #3179 from Baezon/empty-sound-fix
Don't search for empty sound names
2021-02-03 17:41:08 -05:00
wookieejedi 828a993eb6 Fix speed differential for retail cap ships
As astuetly determined by @Baezon `the speed differential for retail cap ships is caused by 'ships with no shields can manage ETS', being part of the bugfixes with target version`. This PR adds two flags per Discord suggestion, one for all ships and one for only small ships.
2021-02-03 17:14:39 -05:00
Asteroth 69b319a7d6 Merge pull request #2591 from Baezon/homing-primaries
Add homing primaries
2021-02-02 21:48:16 -05:00
Baezon 6414172898 Merge remote-tracking branch 'upstream/master' into homing-primaries 2021-02-02 21:15:05 -05:00
Baezon e78fccc294 unused variables 2021-02-02 20:49:33 -05:00
Baezon 54f1a86a5a clena up and finalization of subsys targeting 2021-02-02 20:06:40 -05:00
Baezon 8c387d7507 tentative subsys targeting 2021-02-02 11:31:05 -05:00
Baezon 476e916945 Merge remote-tracking branch 'upstream/master' into turret-forced-target 2021-02-01 22:12:50 -05:00
Asteroth 1d131403d5 Merge pull request #3176 from Baezon/damage-incidence-angle
Angle-based damage multiplier
2021-02-01 20:54:20 -05:00
Baezon e7cab7cb42 clang-tidy dont hurt me no mo 2021-02-01 14:24:44 -05:00
Baezon 7b2c8304ff typo 2021-02-01 13:25:44 -05:00
Goober5000 b6314feb29 add comment 2021-02-01 02:24:54 -05:00
Goober5000 a124722966 qtfred 2021-02-01 00:46:17 -05:00
Goober5000 47543ac7d4 implement keyboard shortcuts, implement mission saving for bg color 2021-02-01 00:46:17 -05:00
Goober5000 262b45188a resizable Event Editor 2021-02-01 00:46:17 -05:00
Goober5000 c0446cd03c color stuff works pretty well 2021-02-01 00:46:17 -05:00
Goober5000 bc37fda89e reorganize event annotations a bit
preliminary work for background color and changing indent
implement a sort-of-working background color change
2021-02-01 00:46:17 -05:00
Goober5000 275a439091 Merge pull request #3190 from Goober5000/quick_annotation_fix
mission save bugfix
2021-02-01 00:43:55 -05:00
Goober5000 f475ea4d25 mission save bugfix
Somehow during the annotation merge the save got borked.  This fixes mission saving.
2021-02-01 00:09:55 -05:00
Goober5000 72d2f9f1a1 reimplement look_at
This PR re-implements the look_at feature, which has been broken for many years.  A look-at rotation is a type of intrinsic_rotation, just like dumb-rotations. The same code handles both; the only difference is whether submodel_rotate or submodel_look_at is called to apply the actual movement.

The previous look_at parsing code has been optimized by performing the name-to-submodel resolution when the model is actually parsed, instead of when the first look-at rotation is called.  This avoids the need to store a name in the submodel struct and also avoids cluttering the look_at function.

This PR is essentially bookkeeping, except for the submodel_look_at method.  This method takes advantage of the submodel rotation upgrade and calculates angles in almost the same way as the new turret rotation code.  It's much more elegant, much less hackish, and works for all detail levels.
2021-01-31 14:31:40 -05:00
Goober5000 8ab3cf240b Merge pull request #3189 from Goober5000/fix_compilation_error
fix compilation
2021-01-31 14:30:16 -05:00
Goober5000 450900d2b5 fix compilation
Quick hotfix due to two branches being merged that were both compatible with master but not with each other.
2021-01-31 13:57:12 -05:00
Goober5000 68b6795d5a Merge pull request #3079 from Goober5000/stuff_number
convert float parsing to use strtof
2021-01-31 13:18:27 -05:00
Goober5000 868715867d Merge pull request #3056 from Goober5000/model_rotation_arbitrary_axis
Allow submodels to rotate around an arbitrary axis
2021-01-31 13:17:27 -05:00
Baezon 9b7cc77b55 revert multi compatability :( 2021-01-31 13:11:27 -05:00
Baezon d3355b0783 experimental multi compatability 2021-01-31 12:29:25 -05:00
m!m 6f382ce0d9 Merge pull request #3188 from asarium/fix/stdApiCrash
Fix crash in server REST API when omitting framecap
2021-01-31 17:02:19 +01:00
asarium dbfb5b9d34 Fix crash in server REST API when omitting framecap
Since the return value of the json library is null in that case it
crashed the server when no value was specified.
2021-01-31 16:08:33 +01:00
Allen A. Babb b3edc683fc Merge pull request #2907 from z64555/feature/controls2
Controls 0, 1, and 2 - Vectorize Controls_config, Refactor Control Presets, and Use Undosys for undo/redo actions done in the Controls configuration menu.
2021-01-30 10:04:58 -06:00
Asteroth f1ff6ebf55 Merge pull request #2870 from Baezon/armor-types-beam-weapon
Use armor/damage types for beam-weapon damage
2021-01-30 02:33:13 -05:00
Baezon f95e51b047 dont search for empty names 2021-01-30 00:05:17 -05:00
wookieejedi 213d20f7ef Merge pull request #3177 from Baezon/better-missile-avoid
Improved missile avoidance
2021-01-29 22:47:01 -05:00
Goober5000 a10e456de3 Merge pull request #3073 from Goober5000/fred_comments
Fred comments
2021-01-29 17:38:31 -05:00
Goober5000 5187ea5041 Revert "Disable Qt projects since downloads are broken"
This reverts commit 4aa33c7b3e from PR #3160.
2021-01-29 16:57:05 -05:00
z64555 9b42819dce Address Clang-Tidy issues. 2021-01-29 15:09:54 -06:00
z64555 c1d1a965c6 Think I got all of the index swapped. *Scrolls right* oh. 2021-01-29 04:40:58 -06:00
Baezon 89a8cbcbae review tweaks 2021-01-29 01:04:15 -05:00
z64555 b97e804123 Address signed/unsigned complaint. 2021-01-28 23:54:44 -06:00
Asteroth e0dd807bb4 Merge pull request #3145 from EatThePath/fix-type-d-beam-pulse-lighting
Stop including tube lights between anti-fighter beam pulses
2021-01-29 00:39:27 -05:00
Baezon 888c14aeaf flip max and min 2021-01-28 23:45:06 -05:00
Baezon ab64183981 Merge remote-tracking branch 'upstream/master' into generic-debris-enhancement 2021-01-28 22:57:42 -05:00
Baezon 055784dcff clean up swarm missiles 2021-01-28 22:33:01 -05:00
Baezon 91be428596 missing '$' 2021-01-28 20:27:36 -05:00
Baezon 0c0a9e4f26 typo 2021-01-28 20:24:54 -05:00
z64555 d6672d01cf Don't count an item in the reset check if the item is disabled.
* Remove errant Assert()
* Drop leading whitespace of preset $Name field
* Fix do_reset behavior due to incorrect default binding check.  Fix is possibly a backport.
* When $Text is specified for a bind item, set the XStr index to 0.
2021-01-28 19:16:07 -06:00
Goober5000 43ae0e3575 qtfred 2021-01-28 19:59:20 -05:00
Goober5000 2be4818d24 tweak parsing since we want to read annotations generally 2021-01-28 19:17:08 -05:00
Goober5000 9bebdbb575 rename event_comment to event_annotation 2021-01-28 18:56:15 -05:00
Goober5000 04cf220f2d comment capability for FRED
Add FRED comments. These aren't the typical source-code style comments that are embedded in mission or table files; these are regular strings that are stored as mission data. You might think of them as annotations. Right-click on any node in the event tree and click on Edit Comment to add one. The tree node will then show a different icon and the comment will be visible as a tooltip when you mouse over the node text.
2021-01-28 18:25:19 -05:00
Goober5000 61c7cc2856 Merge pull request #3141 from JohnAFernandez/Hud-config-screen-is-weird
Make sure the Hud_config_inited is reset when the screen is exited.
2021-01-28 14:29:29 -05:00
Asteroth d1f0f5002f Merge pull request #2775 from Baezon/burst-seed
Implement Beam Flags and some adjustments to burst handling
2021-01-28 11:51:30 -05:00
Baezon d3d016602d rename beam_flags -> beam_info_flags 2021-01-28 02:46:40 -05:00
Baezon f9e44f545e ignore empty sounds 2021-01-27 23:31:38 -05:00
Baezon 52f57df064 NULL -> nullptr 2021-01-27 23:25:19 -05:00
Baezon 61931520d1 Merge remote-tracking branch 'upstream/master' into generic-debris-enhancement 2021-01-27 23:06:45 -05:00
Baezon 229dd4c63c clean up 2021-01-27 20:59:01 -05:00
Baezon 7515422979 clarity parentheses 2021-01-27 20:14:33 -05:00
Baezon eb1d748907 safety 2021-01-27 17:25:28 -05:00
Baezon b87d3c65a0 Merge remote-tracking branch 'upstream/master' into better-missile-avoid 2021-01-27 15:11:08 -05:00
Baezon 8d841fa1cc clean up 2021-01-27 14:48:41 -05:00
Goober5000 537c4b6f24 Merge pull request #3172 from BMagnu/hotfix_keynames
Fix special char hex codes for utf8
2021-01-27 13:52:15 -05:00
Goober5000 f9a6c86cad Merge pull request #3162 from Goober5000/ship_create_display_name
default display names for script/sexp-created ships
2021-01-27 13:40:16 -05:00
Goober5000 db466048ea Merge pull request #3168 from Goober5000/debris_colgroup_check
add collision group checks to debris
2021-01-27 13:40:05 -05:00
m!m 6952b58846 Merge pull request #3174 from asarium/build/bumpVersion
Bump version
2021-01-27 19:12:45 +01:00
Baezon 284ad2941c Merge remote-tracking branch 'upstream/master' into better-missile-avoid 2021-01-27 12:53:24 -05:00
Baezon 76d295d2bc Merge remote-tracking branch 'upstream/master' into damage-incidence-angle 2021-01-27 12:47:55 -05:00
Baezon 66c38c43c6 clean up 2021-01-27 12:43:32 -05:00
asarium 2161ab563d Bump version 2021-01-27 17:55:37 +01:00
Baezon 6cd5510bd1 clean up 2021-01-27 10:49:32 -05:00
Birk Magnussen 25cca192db Switch Key Names from internal encoding to unicode in utf8 mode 2021-01-26 19:09:20 +09:00
Birk Magnussen e6067f756a Fix special char hex codes for utf8 2021-01-26 13:53:25 +09:00
Goober5000 6d9e9a2e3d add collision group checks to debris
Collision groups were checked between ships, weapons, and beams, but not debris.  This adds debris.
2021-01-24 01:07:11 -05:00
David Gibson 373d119f1a modernize nullptr for tidy 2021-01-23 21:58:47 -06:00
David Gibson 7cb2338325 removed now-superflous element counting loop from gr_opengl_deferred_lighting_finish 2021-01-23 21:10:54 -06:00
David Gibson ddcc94b0da Extended the tube light cylinder volumes for deferred lighting to encompass the end cap spheres, removed those spheres, and adjusted the shader handling of tube lights to account for this. 2021-01-23 20:56:07 -06:00
David Gibson 9a866434b8 Removed the end light volumes from the defered lighting setup for tubelights. 2021-01-23 17:31:12 -06:00
Goober5000 37e92e01b6 default display names for script/sexp-created ships
Now that the hash truncation logic is part of the ship display name, ships created by script or sexp should check this as well.
2021-01-22 23:06:48 -05:00
m!m 60047116fd Merge pull request #3160 from asarium/ci/disableQt
Disable Qt projects since downloads are broken
2021-01-22 16:54:54 +01:00
asarium 4aa33c7b3e Disable Qt projects since downloads are broken 2021-01-22 16:26:44 +01:00
m!m 373dbeb63f Merge pull request #3159 from Baezon/previous-bank-fix
Fix a bug with previous_bank and ship class swapping
2021-01-21 22:06:30 +01:00
m!m 361cc76c30 Merge pull request #3154 from Goober5000/redo_3149
fix a rare crash in the tech room
2021-01-21 21:47:53 +01:00
Baezon 3f27183d6d also reset previous bank 2021-01-21 01:04:13 -05:00
Baezon 4e5c74d729 add trail alpha decay exponent 2021-01-19 22:44:08 -05:00
Goober5000 3d976f53b4 fix a rare crash in the tech room
The tech room loop checked that all the lines could fit in the available screen real estate, but it didn't check to see that the number of lines was less than the array capacity.  Normally this never happened, but certain mods which use smaller fonts will overflow the limit.  This adds a proper bounds check and also increases the bounds so that more of the smaller lines can be used.
2021-01-17 11:21:41 -05:00
m!m e5af389803 Merge pull request #3150 from scp-fs2open/revert-3149-fix_techroom_crash
Revert "fix a rare crash in the tech room"
2021-01-17 17:14:30 +01:00
m!m ba0f2e7f83 Revert "fix a rare crash in the tech room" 2021-01-17 11:55:59 +01:00
Goober5000 f0987a4ad1 Merge pull request #3149 from Goober5000/fix_techroom_crash
fix a rare crash in the tech room
2021-01-17 02:15:55 -05:00
Goober5000 61dd4356f0 fix a rare crash in the tech room
The tech room loop checked that all the lines could fit in the available screen real estate, but it didn't check to see that the number of lines was less than the array capacity.  Normally this never happened, but certain mods which use smaller fonts will overflow the limit.  This adds a proper bounds check and also increases the bounds so that more of the smaller lines can be used.
2021-01-17 01:21:52 -05:00
David Gibson d9895455cd Addressed feedback and tidy issues with AA beam pulse lighting fixes 2021-01-15 13:09:43 -06:00
Baezon d9a7e786b5 Merge remote-tracking branch 'upstream/master' into burst-seed 2021-01-15 12:52:25 -05:00
David Gibson 40e7ce012e =Added some important brackets I negligently omitted 2021-01-15 00:28:59 -06:00
David Gibson 31227c659a added a check in beam_move_all_post() to avoid adding tube lights when anti-fighter beams are between pulses. Also added documenting comments to beam_type_b_get_status 2021-01-14 23:59:13 -06:00
JohnAFernandez 679f7f20d7 Switch the correct ammo variable.
The previous pr was supposed to fix what ammo capacity the ship was reloaded to, but instead it was changing how much ammo was in the magazine.
2021-01-14 09:23:52 -05:00
JohnAFernandez ff9b2fd6cd Make sure the Hud_config_inited is reset when the screen is exited. 2021-01-13 21:20:27 -05:00
Fabian Woltermann a939a73c14 Merge pull request #3139 from z64555/hud_config
More safety checks for the HUD_config struct
2021-01-13 22:20:43 +01:00
Goober5000 487aad8bbe a bit of cleanup and reorganization/simplification 2021-01-13 14:01:34 -05:00
Goober5000 554bbb884d remove angles from the submodel instance 2021-01-13 14:01:34 -05:00
Goober5000 020f14fb51 allow rotating submodels to rotate around an arbitrary axis 2021-01-13 14:01:28 -05:00
Goober5000 98e501acc7 remove the orientation field for submodels
Change the `orientation` field to `frame_of_reference` and remove it from submodel instance calculations.
2021-01-13 13:52:48 -05:00
Goober5000 3f5ad1239d Merge pull request #3140 from Goober5000/techroom_update
make model_set_up_techroom_instance a bit more robust
2021-01-13 13:51:47 -05:00
z64555 4e715352c9 Increment int strikes per CSG warning, as done in PLR code
* Use ReleaseWarnring instead of Warning
* Use correct upper boundry check logic on HUD_config::mail_color
2021-01-13 12:48:24 -06:00
Goober5000 5f538fa514 make model_set_up_techroom_instance a bit more robust
Follow-up to #3137.  I missed two important details in the first implementation: the triggered animation needs to be an "initial position" type, and `model_update_instance` needs to be run on all subobjects, not just turrets.

This should really fix #3123.  I still can't see the destroyed collector, but the Rahu no longer flickers when it spins around.
2021-01-13 13:17:31 -05:00
Goober5000 506ba911d0 Merge pull request #3137 from Goober5000/tech_room_instance
properly use model instances for tech room and briefing popups
2021-01-13 11:03:25 -05:00
z64555 f44cfa06c8 Adds more safety checks for PLR and CSG reading for the HUD_config structure.
* Adds a #define for the HC_color array size
* Doxy's the HUD_config struct
2021-01-12 23:12:20 -06:00
Goober5000 eeb6f5b091 properly use model instances for tech room and briefing popups
These two situations mostly relied on the obsolete model code which didn't include model instances.  Data for submodel positions and for whether a submodel is blown off are now stored exclusively in model instances, not the model itself.

This fixes #3124.
2021-01-12 23:15:37 -05:00
Fabian Woltermann 18cb07dc72 Merge pull request #3134 from EatThePath/tube-light-attenuation-recalc
Properly recalculate tube light attenuation
2021-01-11 20:28:19 +01:00
JohnAFernandez 3a4df0d89a Send them to Github instead of Mantis 2021-01-11 14:06:03 -05:00
JohnAFernandez d33f9db1f0 Move Standalone Running statement to after the init of Debug Statements 2021-01-11 14:05:01 -05:00
JohnAFernandez 75b26ef94b Fix unfocused multi interpolation inaccuracies (#3129)
Remove One Source of Client and Server having Different Timing

Multiplayer *must not* have its time affected by being in the background, because their clocks will come out of sync and movement from an out of focus multiplayer instance will appear to move in slow motion.  This fixes the timing discrepancy by only doing os_sleep when unfocused when in single player.
2021-01-11 14:04:23 -05:00
JohnAFernandez 398f4d9053 Remove Unused ClientDamage Commandline Option (#3132)
This option was likely part of an attempt to fix multi that never went anywhere. We now have rollback, which is on by default.
2021-01-11 14:02:52 -05:00
David Gibson 069947e397 Added a recalculation of tube light attenuation in fragment shader after proper distance is determined. fixes slash beam and penetration lighting issues 2021-01-11 11:55:45 -06:00
Fabian Woltermann 580d67eca7 Merge pull request #3133 from Baezon/slow-weapon-collide-fix
Fix collision culling for slow/accelerating weapons
2021-01-11 09:15:53 +01:00
Baezon 4bf93e08df fix collision culling for slow weapons 2021-01-11 00:45:42 -05:00
Fabian Woltermann 6c475130d1 Merge pull request #3126 from The-E/fix/ambient_light_in_lab
When setting the ambient factor in the lab, recalculate ambient lighting
2021-01-10 20:11:13 +01:00
Fabian Woltermann 6f0dec4169 When setting the ambient factor in the lab, recalculate ambient lighting 2021-01-10 19:44:24 +01:00
Goober5000 3b99402a0a Merge pull request #3121 from Goober5000/background_warning
make FRED validate all backgrounds, not just the active one
2021-01-10 09:21:45 -05:00
Fabian Woltermann 6c6ade116f Merge pull request #3120 from Goober5000/fix_3101
fix 3101
2021-01-10 12:43:47 +01:00
Fabian Woltermann 4f6c834587 Merge pull request #3122 from Baezon/glowpoint-timing-fix
Fix a bug with glowpoint timing
2021-01-10 12:42:42 +01:00
Baezon c486843e5f fix a bug with glowpoint timing 2021-01-10 03:11:25 -05:00
Goober5000 ec93ac4c0e fix 3101
Always update the ship class and loadout information in a ship's parse object, even if it is present at mission start.
2021-01-10 01:53:14 -05:00
Goober5000 2307d05086 make FRED validate all backgrounds, not just the active one
The background validation checks are somewhat convoluted, and misleading with multiple backgrounds, so this PR disables the standard main-background check if FRED is running.  It then adds a new FRED-specific background check that covers all backgrounds.

Additionally, this PR fixes a bug in an error message in `stars_get_first_valid_background`.

Fixes #3116.
2021-01-10 01:48:43 -05:00
Goober5000 d3d48ee6fa Merge pull request #3093 from Baezon/script-target-bracket-fix
Fix a crash with scripted targeting brackets
2021-01-08 18:13:44 -05:00
Baezon ac7bdbf269 fix bug in scripted targeting brackets 2021-01-08 17:30:28 -05:00
Goober5000 ddf00588d6 Merge pull request #3076 from Goober5000/hash_stuff
preprocess alt names before mission start
2021-01-08 16:03:10 -05:00
Goober5000 365ba2029e remove temporary function 2021-01-08 09:53:11 -05:00
Goober5000 02cdb106ba convert number parsing to use atoi and strtof
One small detail that was overlooked in PR #3021... KeldorKatarn's old code used `strtod` while the new code used `stuff_float`.  This wouldn't be a problem except that a couple MVP models use annoyingly formatted floats like 8.9e-08.  So I decided to convert `stuff_float` to use `strtof` and do some more upgrades while I was at it.
2021-01-08 09:25:25 -05:00
m!m 85a2a8f11e Merge pull request #3092 from Goober5000/strtof_patch
interim patch for get_user_vec3d_value
2021-01-08 10:47:42 +01:00
Goober5000 e76fdea8b9 interim patch for get_user_vec3d_value
As described in #3079, the old parsing of fvec and uvec used strtod and some POFs rely on this format.  This is a quickfix that uses the new parsing method for only `get_user_vec3d_value`.
2021-01-07 18:08:27 -05:00
Goober5000 726ce953c7 Merge pull request #3089 from Goober5000/fix_submodel_debris
de-parent live debris
2021-01-07 15:24:49 -05:00
JohnAFernandez a545a4ec27 Merge pull request #3087 from Baezon/lock-restriction-safety
Safety for lock restriction handling
2021-01-07 15:01:31 -05:00
Fabian Woltermann fc0662a9c4 Merge pull request #3080 from JohnAFernandez/Vectorize-Tech-Lists
Vectorize tech lists
2021-01-07 15:16:09 +01:00
JohnAFernandez e5685ded86 Keep the lists from being cleared early by removing unneeded the loops. 2021-01-07 00:33:21 -05:00
JohnAFernandez 226cbf1204 The true fix, check the correct value 2021-01-07 00:32:52 -05:00
Goober5000 043466309a de-parent live debris
It appears that live debris is not supposed to have a parent submodel; see the retail NTF Boadicea.  This removes the parent from any live debris that might have it.

This should fix #3078.
2021-01-07 00:02:49 -05:00
Baezon 766624600d update name 2021-01-06 18:04:59 -05:00
Baezon dab9a41f45 remove redundant check 2021-01-06 17:45:32 -05:00
m!m 51d8ab13d8 Merge pull request #3088 from EatThePath/fix-empty-secondaries-locking
off-by-one fix in early exit update_aspect_lock_information()
2021-01-06 23:25:53 +01:00
Baezon b93d30e12b unused variable 2021-01-06 14:46:44 -05:00
David Gibson 945db25578 corrected off-by-one issue in the early exit condition of update_aspect_lock_information() 2021-01-06 13:46:05 -06:00
Baezon 67de007ecb lock restrictions safety 2021-01-06 14:28:27 -05:00
JohnAFernandez e9a9b3b978 Merge pull request #3085 from Baezon/docking-collision-bugfix
Safety for check_for_docking_collision
2021-01-06 14:03:00 -05:00
Baezon e10522a2c7 safety for check_for_docking_collision 2021-01-06 13:18:27 -05:00
JohnAFernandez 9f33b432fc Simply this check 2021-01-05 00:07:07 -05:00
Goober5000 bdccb25b6e Merge pull request #3083 from Baezon/comment-delta-ang
Improve comment on vm_vec_delta_ang
2021-01-04 23:06:27 -05:00
Goober5000 6a049cc7f1 Merge pull request #3082 from JohnAFernandez/Update-Submodel-Comments
Update Comments for #548
2021-01-04 22:18:04 -05:00
JohnAFernandez 7a0578a797 Ok CI, I'll use nullptr 2021-01-04 22:14:36 -05:00
m!m 9879ef4abd Merge pull request #2388 from h3xx/fix-ccache-usage
Use CMAKE_*_COMPILER_LAUNCHER to run ccache
2021-01-04 19:18:29 +01:00
Dan Church fec72db558 Use CMAKE_*_COMPILER_LAUNCHER to run ccache
This is the recommended way to set this up.

Using this technique allows the user to replace the launcher with any
number of combinations of solutions such as
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache:distcc

Supported since CMake 3.4. On previous versions of CMake, it will just
ignore this setting.
2021-01-04 11:46:34 -06:00
Baezon fc7e1f0e40 improve comment on delta_ang 2021-01-03 22:51:17 -05:00
JohnAFernandez ecf2dfb8f9 Update Comments for #548 2021-01-03 22:28:18 -05:00
JohnAFernandez b81825326c Signed Vs Unsigned
AKA C'Mon CI!
2021-01-03 21:54:31 -05:00
JohnAFernandez b8c2c975c0 Change to a pointer
So that we can release bitmaps and animations properly.
2021-01-03 21:36:50 -05:00
JohnAFernandez dc0272e664 Fixes Part 1 2021-01-03 20:56:30 -05:00
JohnAFernandez 3e329d64dd Check the correct value in the animation code 2021-01-03 15:15:51 -05:00
JohnAFernandez 882ac2b1a1 Possibly Fix Memory Corruption Issue
Remove Unused Var
2021-01-03 15:14:11 -05:00
Goober5000 39abec6dfb Merge pull request #3077 from Goober5000/fix_model_instance
fix model_update_instance to handle LODs
2021-01-02 15:03:55 -05:00
Goober5000 b3153df6be preprocess alt names before mission start
For compatibility purposes some mods want alt names to truncate at the hash symbol. But we can't actually do that at mission load,
since we have to save them again in FRED. So this commit processes the names just before the mission starts.

To further complicate things, some mods actually want the hash to be displayed. So this commit introduces the double-hash as an escape sequence for a single hash.
2021-01-02 14:31:59 -05:00
Goober5000 b0fbf93055 fix model_update_instance to handle LODs
Add back the copying of model instance information to submodels in other LODs.  This was inadvertently removed in commit 88c1d8a02a.
2021-01-02 14:26:59 -05:00
Goober5000 2d942989e6 Merge pull request #3075 from JohnAFernandez/Fixing-Small-Fred-Mission_Save-Bug
Keep fred from adding extra texture replacements to mission file
2021-01-02 02:47:35 -05:00
JohnAFernandez 47dd186796 Standardize my ! 2021-01-02 02:11:40 -05:00
Goober5000 1fcfa82184 Merge pull request #3072 from JohnAFernandez/Add-Starting-Amoo-to-Scripting-Functions
Make sure that scripting changes the starting ammo as well as the weapon
2021-01-02 02:09:27 -05:00
Goober5000 6fc3d3cafe Merge pull request #3074 from Goober5000/fix_arc_type
fix a couple of issues
2021-01-02 01:52:35 -05:00
JohnAFernandez c7ea110652 Remove whitespace change 2021-01-02 01:41:15 -05:00
JohnAFernandez 8a81b18200 Keep fred from adding extra texture replacements to mission file 2021-01-02 01:37:37 -05:00
Goober5000 4182ea7fae fix a couple of issues
Prevent model instances from being overridden when they conflict with the model.  Fixes #3062.

Also fixes another spot that might be a problem.
2021-01-02 01:08:54 -05:00
JohnAFernandez 04f668651b Make sure that scripting changes the starting ammo as well as the weapon 2021-01-01 22:22:56 -05:00
m!m 71576c7784 Merge pull request #3066 from asarium/fix/releaseDebugUpload
Fix release debug file name
2021-01-01 15:59:16 +01:00
asarium 619e19268b Fix debug file name 2021-01-01 15:20:19 +01:00
m!m b372fb3655 Merge pull request #3065 from asarium/fix/modTableTestVersion
Increase test engine version to fix 21.0 tests
2021-01-01 13:28:07 +01:00
asarium ae7ac6d87d Increase test engine version to fix 21.0 tests
I just tried building 21.0 which is a higher version than the one used
in the test data which broke this test.

This should be a high enough version to not break any time soon...
2021-01-01 13:02:02 +01:00
m!m e1a2fe0313 Merge pull request #3059 from JohnAFernandez/Fix-Missile-Capacity-Bug
Fix the support ship refilling ships to the wrong secondary capacity
2020-12-31 12:04:31 +01:00
JohnAFernandez 521430fb9a Fix the support ship refilling ships to the wrong secondary capacity 2020-12-30 23:37:49 -05:00
Goober5000 3108b2f117 Merge pull request #3058 from Goober5000/weaponspew_fixes
weaponspew fixes
2020-12-30 11:02:00 -05:00
JohnAFernandez a764b3463c Warn the User About a Probable Incoming crash (#3011)
If SDL completely fails to get its preference path, at least warn the user so that it doesn't crash straight to the desktop without creating a debug build.
2020-12-30 10:37:58 -05:00
Goober5000 cb4f6f5250 Merge pull request #3057 from Goober5000/minor_model_fixes
some bugfixes from the submodel rotation branch
2020-12-30 01:12:00 -05:00
Goober5000 9f8fe77956 weaponspew fixes
Add calculations for the `puncture` flag, and handle beam damage factors appropriately.

Fixes #3044.
2020-12-30 01:10:31 -05:00
Goober5000 cda9967d9c add vecmat function 2020-12-30 00:35:22 -05:00
Goober5000 7a09a3d0c4 some bugfixes from the submodel rotation branch
Some things that clang noticed, plus a small usability improvement to the parsing of vectors in submodel properties.
2020-12-30 00:31:58 -05:00
m!m 839d3517b3 Merge pull request #3040 from asarium/test/ciTestBuilds
Add GitHub actions test build support
2020-12-29 09:56:40 +01:00
asarium a6b90a3780 Add GitHub actions test build support 2020-12-28 21:43:48 +01:00
m!m 05a778e542 Merge pull request #3037 from asarium/ci/uploadDebug
Also upload debug symbols to GitHub release
2020-12-28 21:08:26 +01:00
JohnAFernandez 573db31ba5 Set target name in ai goals to avoid an assert (#3041) 2020-12-28 15:04:47 -05:00
m!m 2727880fae Merge pull request #3039 from asarium/fix/2928
Apply particle source hack to correct vector
2020-12-28 20:21:17 +01:00
asarium 92e5f2f35d Apply particle source hack to correct vector
In the particle effect code there is a small hack required for getting
some constant pointers in a vector. However, there is another mechanism
where sources are not added to the sources vector if the sources are
currently being iterated through. That is necessary to avoid
accidentally invalidating the iterators.

The issue here was that the vector resizing hack was not applied to the
correct vector when we were currently iterating. This fixes that.

This fixes #2928.
2020-12-28 17:58:20 +01:00
m!m f4c11a42ec Merge pull request #3038 from SelfGamer/fix_ctd_on_death_with_support
Fix CTD on death while support is trying to dock
2020-12-28 14:46:36 +01:00
Birk Magnussen 4bc3ac8bee More Assertions 2 2020-12-28 19:34:30 +09:00
Birk Magnussen 5b12b84c57 More Assertions 2020-12-28 19:32:05 +09:00
Birk Magnussen f6b8e8e0ff nulltpr 2020-12-28 19:18:58 +09:00
Birk Magnussen 66aed78dd4 Add quickfix 2020-12-28 19:16:38 +09:00
Fabian Woltermann a5de6f8570 Merge pull request #3019 from SelfGamer/exactlos_update
Changed require exact los to track from the exact firing point instead of center
2020-12-28 10:16:40 +01:00
asarium fc744c78c7 Also upload debug symbols to GitHub release 2020-12-28 10:03:21 +01:00
m!m bc6b341eea Merge pull request #3036 from Goober5000/vec3d_props_dox
add documentation to get_user_vec3d_value
2020-12-28 09:53:33 +01:00
Goober5000 55b902382c add documentation 2020-12-28 01:19:44 -05:00
Goober5000 3a5e49b0c3 Merge pull request #3021 from Goober5000/turret_refactor
some refactor and cleanup
2020-12-27 09:33:49 -05:00
Goober5000 aef21cbe1b Merge pull request #3025 from JohnAFernandez/fix-nullptrs-in-turret-packet
Prevent Fire_turret from using null values
2020-12-27 09:16:13 -05:00
Goober5000 a3a26c781c Merge pull request #3035 from asarium/fix/luaDeprecationVersion
Update deprecation version of drawMonochromeImage
2020-12-27 09:15:14 -05:00
m!m aa222c4206 Merge pull request #3029 from JohnAFernandez/bypass-multi-when-using-start_mission
Keep incompatible commandline options from running simultaneously
2020-12-27 11:58:46 +01:00
asarium 57f73ab8dc Update deprecation version of drawMonochromeImage
This was 20.1 since I erronously thought that the "current" nightly
version was lower than that. This updates the version to a release that
has not been built yet.
2020-12-27 11:53:10 +01:00
JohnAFernandez d41d397e33 Keep nullptrs from crashing the fire flak packet. 2020-12-27 01:36:10 -05:00
JohnAFernandez b8e9b3c0ec Prevent Fire_turret from using null values 2020-12-27 01:36:10 -05:00
JohnAFernandez f088e12cb3 Keep incompatible commandline options from running simultaneously 2020-12-27 01:03:36 -05:00
Goober5000 7990691e83 Merge pull request #3026 from MageKing17/bugfix/capital-plus-secondary-regression
Fix capital+ regression in AI code for secondary weapon selection.
2020-12-26 20:53:42 -05:00
MageKing17 ac86dbae2f Fix capital+ regression in AI code for secondary weapon selection.
When weapon info flags were changed to the flagset model in #851 (commit 127976cd74), two instances where `WIF2_CAPITAL_PLUS` was either actively desired or passively not prohibited were lost in the transition; this commit restores looking for `Weapon::Info_Flags::Capital_plus` when targeting a big ship, and no longer prohibits capital+ weapons from being selected if a bomber+ weapon is sought and smart secondary weapon selection is enabled.
2020-12-26 12:45:32 -08:00
JohnAFernandez 7ac832f84f Merge pull request #3022 from asarium/fix/betterRand
Make model point picking more flexible
2020-12-25 11:20:13 -05:00
asarium 522fa1ac6a Make model point picking more flexible
This works around the Windows only limitation where the standard random
function only returns up to 2^15 which limits how many vertices in the
model can be picked.

Since we already have a function that handles this properly and returns
values in the entire integer range, using that fixes that low limit.
2020-12-25 15:36:25 +01:00
Goober5000 21f6591be2 some refactor and cleanup
1) modify and prune some turret function definitions
2) clean up KeldorKatarn's submodel orientation parsing
2020-12-24 22:50:49 -05:00
Birk Magnussen d1e1d79bca make require exact los respected by primaries 2020-12-25 04:20:03 +09:00
Birk Magnussen f0313fc68a Fix bad assertion 2020-12-25 03:19:47 +09:00
JohnAFernandez de7d0c79d3 Merge pull request #2214 from notimaginative/multi_packet_fixes
Multi packet fixes
2020-12-24 12:16:29 -05:00
Birk Magnussen 32c63963ea Changed require exact los to track from the exact firing point instead of center 2020-12-25 00:49:09 +09:00
m!m 77adaa6d86 Merge pull request #3004 from asarium/scripting/monochromeUv
Add AA bitmap support for standard gr.drawImage
2020-12-24 16:14:44 +01:00
m!m 92d1328e0f Merge pull request #3010 from asarium/lua/cmdBriefColors
Add scripting API to access briefing color tags
2020-12-24 16:10:50 +01:00
Taylor Richards 5f7b7ef702 fix issues discovered during beam test
- fix incorrect assertions for fighter beams
 - fix subsystem handling for spawned/floating beams
2020-12-24 09:45:17 -05:00
Taylor Richards 80d68ccc27 address issues raised during code review 2020-12-24 09:45:17 -05:00
Taylor Richards fdf3778014 bump multi version to 53 2020-12-24 09:45:17 -05:00
Taylor Richards ff5cb3cdf8 update turret_fired_packet() and flak_fired_packet()
- send pitch and heading as floats
 - use proper weapon id rather than guessing (fixes #2877)
2020-12-24 09:45:07 -05:00
Taylor Richards 5d410416c9 fix issues with client_update_packet()
- use correct macro for player_id
 - support more subsystems
 - optimize size of secondary weapon info
 - handle future compatibility issues with secondary ammo
2020-12-24 09:42:05 -05:00
Taylor Richards 5395cabdb3 support larger number of subsystems in various packets
secondary_fired_packet()
 turret_fired_packet()
 player_order_packet()
 homing_weapon_info()
 flak_fired_packet()
2020-12-24 09:41:59 -05:00
Taylor Richards 3a58940d35 update multi_capaign_*() packets
- add additional safety checks
 - allow for USHRT_MAX ship and weapon types
 - allow for USHRT_MAX mission events
 - optimize storage of mission count/num (int -> ubyte)
 - break campaign mission names into nice sized packets
2020-12-24 09:38:23 -05:00
Taylor Richards da37e363ae fix comparison warnings in ADD/GET macros with debug builds 2020-12-24 09:38:23 -05:00
Taylor Richards 0e55c36877 update netgame_descript_packet()
(based on PR 2109 by Cyborg17)

 - support compaign descriptions (Mantis 1826)
 - allow sending multiple packets to get entire description
 - update description of selected game on join screen if needed
2020-12-24 09:38:23 -05:00
Taylor Richards 9b97821616 optimize sexp_packet()
- chnage op count data type to short
   (can't have more space than that anyway)
 - get rid of some loops in favor of plain memcpy()
 - fewer magic numbers
 - use SEXP_MAX_PACKET_SIZE to fix packet size discrepancy
2020-12-24 09:38:23 -05:00
Taylor Richards 42cdd06b7d add ADD/GET_DATA_BLOCK() macros
These macros will grab a known sized block of data without
any manipulation. Should only be used with data which is
serialized/deserialized in another part of the code.
2020-12-24 09:38:23 -05:00
Taylor Richards 088f4422db set HEADER_LENGTH to a fixed size
This should *never* be something that can be changed
at runtime
2020-12-24 09:38:23 -05:00
Taylor Richards f989cf2c3a update beam_fired_packet()
- add bfi_flags
 - add proper bank/point data for fighters
 - allow for more than 255 subsystems
 - add data for targeted subsystem
 - add support for TARGETING_COORDS flag
 - add support for FLOATING_BEAM flag
 - add fire method
 - add initial packet support for type F beams
2020-12-24 09:38:23 -05:00
Taylor Richards dc1128d327 fix issues with wss_slots_data_packet()
- don't depend on hard-coded limits
 - store weapon and counts together
 - fix incorrect ship_class assignment
2020-12-24 09:38:23 -05:00
Taylor Richards 88e8d61816 optimize size of wss_update_packet() 2020-12-24 09:38:23 -05:00
Taylor Richards 97c4bcba61 support SHRT_MAX ship types in pslot_update_packet 2020-12-24 09:38:23 -05:00
Taylor Richards c4eecf9a0d fix multiple issues with wss data packet
- use standard ADD/GET macros
 - better detection of size issues
 - support SHRT_MAX ship types
 - support SHRT_MAX weapon types
 - use MAX_WSS_SLOTS & MAX_SHIP_WEAPONS safely
 - support sound indexes higher than 254
2020-12-24 09:38:23 -05:00
Taylor Richards 3de39b6274 tweak stats block packet to handle certain limits better 2020-12-24 09:38:23 -05:00
Taylor Richards a48b5e8203 scale MAX_SHIPS_PER_PACKET with packet size 2020-12-24 09:38:23 -05:00
Taylor Richards e91234cac0 remove network cutoff when more than retail ship limit
It's fixed now, so no reason to keep this
2020-12-24 09:38:23 -05:00
Taylor Richards 43a1952142 allow SHRT_MAX ship types in wss_slots_data_packet() 2020-12-24 09:38:23 -05:00
Taylor Richards af45954bab fix issues with post_sync_data_packet()
- allow for SHRT_MAX ship types
 - support total number of primary weapon banks
 - support total number of secondary weapon banks
2020-12-24 09:38:23 -05:00
Taylor Richards 796609b851 optimize size of player_settings_packet() 2020-12-24 09:38:23 -05:00
Taylor Richards 495efde52f optimize size of netplayer_slot_packet() 2020-12-24 09:38:23 -05:00
Taylor Richards 67d17e2c28 optimize size of ship_create_packet() 2020-12-24 09:38:23 -05:00
Taylor Richards 5fb1bbbb43 fix issues with multi options packets
- don't send structs
 - big endian compatible
2020-12-24 09:38:23 -05:00
Taylor Richards 8e40c14a49 optimize size of several player packets
player num/index should always be in 0-11 range
so only 1 byte is required
2020-12-24 09:38:23 -05:00
Taylor Richards 69fd25b376 optimize size of game_chat_packet()
server_msg is 0-2, which doesn't need 4 bytes
2020-12-24 09:38:22 -05:00
Taylor Richards 752f985433 optimize size of host_captain_change_packet()
don't need 4 bytes for a true/false
2020-12-24 09:38:22 -05:00
Taylor Richards 9e7a6eaee2 small optimization of process_game_query() 2020-12-24 09:38:22 -05:00
Taylor Richards 0a3465b4aa avoid breaking ship_status_packet() with new controls 2020-12-24 09:38:22 -05:00
Taylor Richards 454ddce232 fix join_request data
- tightly packed
 - better cross-platform compatibility
2020-12-24 09:38:22 -05:00
Taylor Richards c943600ee3 adjust *_STRING() macros to save space
- ADD/GET_STRING() will use 1-byte lengths (up to 255 chars)
 - ADD/GET_STRING_16() will use 2-byte lengths (up to 65,535 chars)
 - ADD/GET_STRING_32() added for compatiblity (game_active packet only!)
2020-12-24 09:38:22 -05:00
asarium c2f4d5f2b6 Use correct generic anim function to get hi-res support 2020-12-24 12:54:09 +01:00
asarium 4af292af5a Add scripting API to access briefing color tags 2020-12-24 12:54:09 +01:00
Goober5000 a3135497f1 Merge pull request #3015 from Goober5000/gun_rotation_fix2
move gun_submodel_rotation from model to instance
2020-12-23 18:53:17 -05:00
SelfGamer a47cfb7e7c Expose disposing FBO's to scripting (#3003)
* Expose disposing FBO's (with the option to keep the Bitmap Alive) to scripting

* Modernize nullptr

* Moved RenderTarget clearing to own public API

* Fixed Obsolete Comment

* Fix bad deletion of FBOs

* Resolve Memory Leak

* Change FBO cleanup to not reuse old ID's

* FIx oversight

* FIx oversight 2
2020-12-23 21:54:03 +01:00
m!m 4f4e02beb5 Merge pull request #3018 from asarium/feature/captureSdlLogs
Capture SDL logs to our standard logging output
2020-12-23 21:53:22 +01:00
m!m 55e502417a Merge pull request #3017 from asarium/ci/fixClangTidyDiff
Fix clang tidy commit range
2020-12-23 21:53:06 +01:00
asarium 0f220d2ecf Capture SDL logs to our standard logging output
This can be useful when SDL produces log output that helps with
debugging an issue.
2020-12-23 14:03:24 +01:00
asarium 2f24a131c7 Fix shell script 2020-12-23 12:07:43 +01:00
asarium c9dc17cb79 Fix workflow names 2020-12-23 11:43:01 +01:00
asarium fa7994f691 Fix clang tidy commit range
By only looking at the HEADs of the respective branches, we included
irrelevant changes in the diff passed to clang-tidy-diff so it was
possible to generate irrelevant warnings in a PR.
2020-12-23 11:39:30 +01:00
Goober5000 4b200586e6 Merge pull request #3014 from Goober5000/fix_3013
properly restore turret angles after calculating matrix
2020-12-23 02:34:57 -05:00
Goober5000 8ef92c944d move gun_submodel_rotation from model to instance
Since instance-specific fields have been moved to polymodel_instance and submodel_instance, the gun_submodel_rotation field should also be moved.  This is also reworked a bit to keeping track of the rotation via the normal submodel instance angles.

This removes an unnecessary look_at field as well.
2020-12-23 00:45:31 -05:00
Goober5000 78c957c6bb properly restore turret angles after calculating matrix
Since angles are no longer written in three redundant places, the temporary hijacking of the turret angles in `model_make_turret_matrix` was overwriting the turret's proper position.  So this PR just saves the angles and restores them when the calculation is done.
2020-12-22 22:14:12 -05:00
Goober5000 66280ee4d1 Merge pull request #3012 from Goober5000/submodel_null_check
additional null checks
2020-12-22 21:32:15 -05:00
Goober5000 b7b0d3a257 Merge pull request #3000 from Goober5000/model_instance_followup
another model to model_instance refactor
2020-12-22 21:31:14 -05:00
Goober5000 8cf900b6ad additional null checks
Some subsystem code was being run for submodels when the subsystem didn't necessarily have a submodel attached.
2020-12-22 15:28:44 -05:00
Goober5000 3ef527a04d Merge pull request #2988 from z64555/fix/issue_2966
In windows, attach to the console we're being evoked from and reopen STDIO streams.
2020-12-22 14:24:58 -05:00
Goober5000 6f8a297cf1 Merge pull request #3008 from Goober5000/submodel_bugfix
additional null checks
2020-12-22 14:24:22 -05:00
m!m 04135df1bf Merge pull request #3009 from asarium/ci/fixFtpWildcard
Fix nightly build FTP wildcard
2020-12-22 12:36:19 +01:00
Goober5000 0c5b04c427 additional null checks
Found a null pointer CTD in modelanim that slipped through initial testing.  Also added some defense-in-depth null checks to scripting.
2020-12-22 04:22:10 -05:00
asarium ec79fdea68 Fix nightly build FTP wildcard 2020-12-22 10:09:52 +01:00
JohnAFernandez 508b420f07 Set correct time stamp for already-locked indicators. (#3002) 2020-12-21 09:07:05 -05:00
asarium f25d98cebd Add AA bitmap support for standard gr.drawImage
Since that function already has full support for UV scaling it makes
sense to unify the behavior in one function instead of having a separate
monochrome function that does weird things.

Also deprecates that function since all its use cases are now covered by
drawImage.
2020-12-21 12:48:58 +01:00
m!m 4b7013ff86 Merge pull request #3001 from asarium/ci/githubReleaseBuilds
Add GitHub workflow for building releases
2020-12-21 10:20:42 +01:00
z64555 ea97272613 In windows, attach to the console we're being evoked from and reopen STDIO streams. 2020-12-20 18:19:12 -06:00
asarium 10d7417815 Add GitHub workflow for building releases
This uses GitHub actions for building Linux and Windows builds for
release tags.

Appveyor is now no longer used for building distribution packages and is
also not used for anything relevant anymore. If this works properly we
can disable that PR check to get better PR scalability.
2020-12-20 22:33:14 +01:00
m!m ded3131587 Merge pull request #2999 from asarium/build/extractBuildScripts
Extract build scripts into separate files
2020-12-20 22:30:21 +01:00
Goober5000 fe4661ec9f Merge pull request #2997 from SelfGamer/missionAwarenessAPI
Add Scripting API isNebula and isSubspace
2020-12-20 14:53:15 -05:00
Goober5000 c18b1b63fd another model to model_instance refactor
Remove arc information from bsp_info and move it to submodel_instance.  Add a model instance to each debris chunk to keep track of it.
2020-12-20 14:51:05 -05:00
Goober5000 bcf4b07a28 Merge pull request #2992 from Goober5000/model_instance_consolidation
consolidate model instance code
2020-12-20 13:23:14 -05:00
asarium 9fb47d22b5 Extract build scripts into separate files
This makes the workflows easier to manage, makes those build steps
reusable, and allows for easier migration to other CI services should
that be required at some point.
2020-12-20 18:26:05 +01:00
Fabian Woltermann c7c5592884 Merge pull request #2998 from The-E/fix/pof_name_in_lab
Fix oversight in the new lab HUD
2020-12-20 16:59:53 +01:00
Fabian Woltermann c2a76c7354 Print the model filename in the bottom right when a ship or modelled weapon is being displayed in the lab 2020-12-20 13:39:29 +01:00
Birk Magnussen dfe6858b21 Fix Type 2020-12-20 21:14:30 +09:00
Birk Magnussen 64b35534de Modernize functions 2020-12-20 21:03:05 +09:00
Birk Magnussen ce614d330d Modernize nullptr 2020-12-20 20:46:22 +09:00
Birk Magnussen 20bc769daa Add Scripting API isNebula and isSubspace 2020-12-20 20:17:34 +09:00
Goober5000 efe2d8476a 1) it's no longer necessary to call model_clear_instance before collision detection
2) call appropriate functions in collision detection because models might have instances
2020-12-18 13:46:49 -05:00
m!m 486d66ad28 Merge pull request #2993 from asarium/build/fixUploadGlob
Fix upload glob
2020-12-18 18:59:17 +01:00
asarium f10c40f873 Fix upload glob
The glob pattern was not correct. This should fix the nightly build
again.
2020-12-18 16:53:23 +01:00
Goober5000 88c1d8a02a consolidate model instance code 2020-12-18 01:32:43 -05:00
Goober5000 d80c43d6d9 Merge pull request #2989 from Goober5000/lab_destroy_subsystem
subobjects destroyed in the lab should stop spinning
2020-12-18 01:07:18 -05:00
Goober5000 d6e95360e0 subobject destroyed in the lab should stop spinning
The lab code didn't set subsystem strength for destroyed submodels.  This fixes that.
2020-12-17 20:10:38 -05:00
m!m 636aa35d7c Merge pull request #2987 from asarium/build/windowsBuilds
Build Windows nightlies with GitHub actions
2020-12-17 21:54:13 +01:00
asarium cdeac0c762 Build Windows nightlies with GitHub actions
This is much faster since all build variations can be compiled at the
same time. Only applies to nightly builds for now.
2020-12-17 18:28:10 +01:00
m!m e7a5492061 Merge pull request #2977 from asarium/build/datacoderUpload
Enable upload to datacorder for Linux builds
2020-12-17 09:30:03 +01:00
Baezon c65ae50b81 version 1 of generic debris enhancements 2020-12-17 01:58:00 -05:00
Goober5000 4491b842c9 Merge pull request #2983 from Goober5000/header_refactoring
hoist model_get and model_get_instance out of a bunch of functions
2020-12-16 15:33:29 -05:00
m!m f2a8295399 Merge pull request #2982 from asarium/build/clangTidyGithub
Use special GitHub action for clang-tidy
2020-12-16 19:11:04 +01:00
Goober5000 7c92dd9f7c hoist model_get and model_get_instance out of a bunch of functions 2020-12-16 11:55:31 -05:00
Goober5000 5fe8f00cb3 Merge pull request #2985 from Goober5000/turret_fix
fix a bit of improper referencing in rotateTurret
2020-12-16 11:43:19 -05:00
Goober5000 41851bbd1e fix a bit of improper referencing in rotateTurret
The object `instance` field is the index into Ships, not Objects.  In any case, position and orientation can be referenced directly.
2020-12-16 02:23:18 -05:00
Goober5000 ada08157a8 Merge pull request #2984 from Goober5000/fix_lab_crash
fix a CTD with the no-pain-flash flag
2020-12-15 22:03:07 -05:00
Goober5000 c457f24d67 fix two more crashes 2020-12-15 19:46:12 -05:00
Goober5000 4ddc2565d5 fix a CTD with the no-pain-flash flag
There were null checks for `Player_obj`, but whoever added the `No_pain_flash` flag bypassed them by dereferencing `Player_obj` in the top-level if() block.  This caused a crash when self-destructing ships in the F3 lab.

This PR moves the `Player_obj` check to the top-level block (which is also an implicit null check because `ship_objp` is not null by this point) which fixes the crash and also is more efficient.
2020-12-15 19:16:42 -05:00
asarium 8319940f92 Use special GitHub action for clang-tidy
This action should bring the clang-tidy issues in a better format by
displaying them inline in the diff.
2020-12-15 20:08:16 +01:00
asarium 92cd894de2 Enable upload to datacorder for Linux builds
Also run distribution builds in container. This uses the same container
for building PRs and distribution packages to ensure consistency
between them.

Also tries to fix an issue with a missing environment variable for the
tests.
2020-12-13 22:14:36 +01:00
m!m 3d792dcb1d Merge pull request #2978 from asarium/build/ghActions/clangTidy
Add clang-tidy checking to GitHub actions
2020-12-13 22:12:04 +01:00
m!m 53b73ca048 Merge pull request #2979 from Baezon/multilock-fix-los
Fix line-of-sight checking for multilock
2020-12-13 14:00:03 +01:00
Baezon 602dd45c10 fix los for multilock 2020-12-13 00:03:43 -05:00
asarium 451eab5b38 Add clang-tidy checking to GitHub actions
This just introduces the previously Travis integration and moves it to
GitHub actions.

This also found various issues around our libc++ support so I fixed that
as well.
2020-12-12 22:11:35 +01:00
z64555 89a2c4dbcb Missed another break. 2020-12-12 14:47:15 -06:00
z64555 2cd557e483 Expletives and default breaks. 2020-12-12 14:20:07 -06:00
z64555 e5df64ab75 Address uninitialized variable issue. 2020-12-12 12:20:54 -06:00
z64555 52b0b19d11 Update qtFred sexp_tree::get_listing_opf_keypress 2020-12-12 11:39:47 -06:00
z64555 36a2355e86 Address exceedingly frivolous signed/unsigned mismatch errors. 2020-12-11 17:44:45 -06:00
z64555 351e8e0c44 Address short/int size mismatches. 2020-12-11 15:59:31 -06:00
z64555 91e0d8f578 QoL: Highlight/select the found key, be it primary or secondary, should the search mode find it. 2020-12-11 12:41:46 -06:00
z64555 f8f26e3b23 Fix bug where search mode wouldn't detect joy buttons correclty.
* Fix bug where joy hats were ignored.
2020-12-11 12:41:46 -06:00
z64555 873a3c3442 Fix bug with displaying joy button text
* Fix a number of warnings
2020-12-11 12:41:46 -06:00
z64555 1318b814d3 Fix out-of-bounds error due to axis controls index. 2020-12-11 12:41:45 -06:00
z64555 4c8f5f789c Grey out empty/unbound items
* Joy axis bindings now use the same color logic as the keys and buttons
2020-12-11 12:41:45 -06:00
z64555 b9b922b235 Fix bug where int conflict wasn't incremented for unselected items.
* Fix color highlighting of mouse-over lines
* Fix color highlighting of selected bindings
* Fix bug when trying to select an item while the selected line is an axis control
* Allow user to select an empty item
* Expand hitbox of items so players aren't required to click exactly on the text to select it.
2020-12-11 12:41:45 -06:00
z64555 716b4a3205 Moves the listbox draw function out of do_frame()
* Adjusts listbox positioning and widths of the binding columns for better display.
* Adds DCF tools to adjust the text positioning in the listbox
2020-12-11 12:41:44 -06:00
z64555 3c592b799f Fix bug where the "disallowed key" popup would spam you, blocking you from doing a meaningful bind. 2020-12-11 12:41:44 -06:00
z64555 c8c8a8d896 Fix bug where unbound items were flagged as conflicted.
* Fix bug where Cc_lines was accessed after being cleared. (Incorrectly assumed control_config_cancel_exit() was an exit point)
2020-12-11 12:41:43 -06:00
z64555 12b19a32bd Fix bug where unbound joy buttons would persist as a valid binding. 2020-12-11 12:41:43 -06:00
z64555 40e114351c Miscellaneous fixes to allow building.
* declare CCB before CC_bind.
* update various functions to use new binding aggregate classes.
2020-12-11 12:41:43 -06:00
z64555 704c600ef0 update control_config_clear() 2020-12-11 12:41:42 -06:00
z64555 5dde26fc33 Update check_control_used() to use primary and secondary. 2020-12-11 12:41:42 -06:00
z64555 cb5f80b0d5 Complete refactor of control_config_do_frame()
* Add textify method to CC_bind
* Replace string printing of key and joy bindings with primary and secondary bindings.
2020-12-11 12:41:42 -06:00
z64555 32636968bd Refactor browse mode in control_config_do_frame()
* Allow joy button presses to dismiss help overlay while in browse mode
* Refactor selected item cycling
2020-12-11 12:41:41 -06:00
z64555 e546a75c6b Fix possible bug where joy btn was ignored in bind mode
* Refactor search mode in control_config_do_frame()
* Dismiss help overlay in search mode when joy button is pressed
* Fix possible bug where nav buttons were not reset in search mode
2020-12-11 12:41:41 -06:00
z64555 9b0aab3f82 replace CCI::joy_id and ::key_id with ::primary and ::secondary (through inheritance of CCB)
* Add convenience methods to CCB
* Convert CC_bind into a class and define convenience methods
* Set underlying type of enum CID to short
* controlconfigdefaults.tbl: Should the CCI be disabled by an override, clear its binding.
* Control config menu: Should the help overlay be active during bind mode, dismiss it, don't bind anything, and stay in bind mode (fixes inconstant behavior)
* Refactor bind mode handling in control_config_do_frame()
2020-12-11 12:41:40 -06:00
z64555 7f2baec387 Remove Control_config::key_default and ::joy_default, redirect calls to the default presets 2020-12-11 12:41:40 -06:00
z64555 392148f84b Fix crash in unit tests due to uninitialized Control_config vector. 2020-12-11 12:33:45 -06:00
z64555 577ae95026 Use ints instead of size_t because CI said so. 2020-12-11 07:40:42 -06:00
z64555 968d76431f Missing an amp. 2020-12-11 07:40:42 -06:00
z64555 c2408839d1 Fix out of bounds error due to dynamic containers cleared at wrong spot. 2020-12-11 07:40:41 -06:00
z64555 a03af2e4a9 Re-enables the undo feature in the controls config menu. 2020-12-11 07:40:41 -06:00
z64555 aec7589b94 Tweak Undo_item::save to correctly save a reference as a pointer
* Remove two uncessary Assets.  operator new should throw an exception should it fail.
* Move template functions into .h.  This resolves instancing problems when trying to define them in a .cpp
* Add Undo_system::empty() and ::empty_redo() for checking if an ::undo() or ::redo() is possible.
2020-12-11 07:40:41 -06:00
z64555 e1974d1b57 Fix potential issue where Undo_stacks delete tracked items when going out of scope, even after the items were passed onto an Undo_system 2020-12-11 07:40:40 -06:00
z64555 bc7809de43 Undo_system::save_stack() now ignores empty stacks passed to it. No need to check for stack size before saving.
* Implement Undo_stack::size()
* Spellcheck in undosys.h
2020-12-11 07:40:40 -06:00
z64555 f23a72e228 Minor changes 2020-12-11 07:40:40 -06:00
z64555 45a45a4eff Remove licensing. 2020-12-11 07:40:39 -06:00
z64555 7e9ce1c9f7 Initial draft of the instruction documentation
Fix two typos

Adds Undo_system::clear()

Whoops! Can't just simply clear the stacks,gotta clean stuff off the heap first.
2020-12-11 07:40:39 -06:00
z64555 dce37d529c Adds ability to save a stack of undo operations as a single undo-op within the system 2020-12-11 07:40:39 -06:00
z64555 f528b3caa5 Changes the system so that the undo() and redo() functions return references to the changed item and its container (if it was specified at launch). This should allow client code to quickly find and access it on its end by comparing pointer values.
Since the pair is returned instead of the size of the undo/redo stacks, stack size information has been moved to their own getter functions.
2020-12-11 07:40:38 -06:00
z64555 492320f8d3 z64555's Undo system! This is a generic undo system, so you can save any single item type (not C arrays) and do undo/redo stuff on them. 2020-12-11 07:40:38 -06:00
z64555 636b4b12e4 Vectorize control_config::Conflicts 2020-12-11 07:40:14 -06:00
z64555 93c96b8943 Re-enable display of current selected preset. 2020-12-11 07:40:14 -06:00
z64555 d1f94c7b92 Fix overwrite check.
Add check for cfile open correctly.
2020-12-11 07:40:13 -06:00
z64555 74ffcb2db8 Print "NONE" instead of "-1" For unbound keys. 2020-12-11 07:40:13 -06:00
z64555 c7112fd897 Adds function to write controlconfigdefaults.tbl using the default preset at time of call.
* Adds DC function 'write_ccd' to write the .tbl
* Adds DC function 'load_ccd' to reload the .tbl
2020-12-11 07:40:13 -06:00
z64555 1bb9ed8832 Remove unused variable for catch clause. 2020-12-11 07:40:13 -06:00
z64555 23f85da586 Move typedef after the declaration of the struct it uses. 2020-12-11 07:40:12 -06:00
z64555 f163f56c10 Cleanup controlsconfig.h and refactor some loops. 2020-12-11 07:40:12 -06:00
z64555 9c03e8c069 Remove dead comment. 2020-12-11 07:40:12 -06:00
z64555 92a76c05ee Adds ability for mod devs to change the naming of a control as it shows up in the config menu.
* Presets start from a clean slate, while Overrides inherite from hardcode defaults
2020-12-11 07:40:11 -06:00
z64555 730ab835a8 Add #ControlConfigPreset section to controlconfigdefault.tbl and allow multiple sections in the .tbl
* This is a section that only configures the bindings for a preset.  Allowing mod devs to add presets instead of just the overrides
* Added ability to resume parsing should a Binding not be found
2020-12-11 07:40:11 -06:00
z64555 ef89a4aa38 Refactor and cleanup control_config_common_load_overrides.
* Mod devs now have the option to override hardcoded defaults
2020-12-11 07:40:11 -06:00
z64555 f9474cf773 Refactor defaults.
* Hardcoded default bindings are now a preset
* rename controls_config_init_bindings() to control_config_common_init_bindings() for consistancy
2020-12-11 07:40:10 -06:00
z64555 96382b47e2 Initial work on presets and default keybinds. Defaults will be moved into a preset instead of lingering in the bindings vector, this may cause issues with training messages that reference controls by default keybinds. 2020-12-11 07:40:10 -06:00
z64555 99dfdf07a2 Refactor control_config_list_prepare()
Default Disable Non-retail controls
Expand CC_lines buffer to include NUM_JOY_AXIS_ACTIONS
2020-12-11 07:39:30 -06:00
z64555 62fa76d65e Fix wrong reference to array size.
Init Cc_lines, which is now dynamic
De-init Cc_lines and Control_config_backup when closing the menu.
2020-12-11 07:39:30 -06:00
z64555 1a482cab4a Remove Joy_table declaration for later PR.. 2020-12-11 07:39:30 -06:00
z64555 ec61af7e1c Revert obliteration of magic number. 2020-12-11 07:39:29 -06:00
z64555 d8d4e9ed2c Disable Presets and Undo capabilities. Only reset_all was spared.
* Revert Joy_axis_action_index changes.  Feature to be added later
* Strip out most of the preset and undo capability.  Only the backup ability survived.
2020-12-11 07:39:29 -06:00
z64555 38df849e6e Change Control_config array to an SCP_vector
* Hardcoded bindings are done at run-time instead of assignment
* Created a map that should retain backward compatibility with controlconfigdefaults.tbl and playerfiles, since a reorganization of the controls in the code is planned and would break compatibility.
2020-12-11 07:39:28 -06:00
Baezon d06eedf13c testing 2020-12-10 18:49:05 -05:00
Baezon a3d3be11fb initial testing version 2020-12-10 18:41:36 -05:00
Goober5000 ca7dda09b0 Merge pull request #2971 from Goober5000/model_preliminary_edits
Model preliminary edits
2020-12-10 15:06:48 -05:00
m!m aec33b2bd8 Merge pull request #2976 from asarium/build/linuxContainer
Use container for Linux building
2020-12-10 12:21:56 +01:00
m!m 36900f056f Merge pull request #2975 from asarium/build/githubRelease
Build Linux nightlies with GitHub actions
2020-12-09 20:19:06 +01:00
asarium c644ccba98 Use container for Linux building
This will make our builds independent of the underlying system and allow
for more reproducible builds since everything uses the same compilers
and environments.
2020-12-09 20:10:22 +01:00
asarium 22d8184ad2 Build Linux nightlies with GitHub actions
This creates a new workflow which will build linux binaries for
FastDebug and Release, combine them in a second step, and then upload
them.
2020-12-09 18:19:43 +01:00
Taylor Richards c5356c6af7 Merge pull request #2895 from notimaginative/mdns
Replace multicast code with mDNS/DNS-SD
2020-12-08 20:32:28 -05:00
JohnAFernandez f9e0ff5db6 Make sure lock indicators are done even if hud is disabled (#2970)
Someone already did the work.  Just making sure this function always runs even if the hud is diabled. (it just makes sense to)
2020-12-08 20:29:16 -05:00
Goober5000 b40833d76e CI fixes 2020-12-08 19:54:31 -05:00
Goober5000 b803b9f15c consolidate functions 2020-12-08 19:54:31 -05:00
Goober5000 b90fc2b3ad numeric to boolean 2020-12-08 19:54:31 -05:00
Goober5000 f0799d245e tweaks 2020-12-08 19:54:24 -05:00
Goober5000 f54ac8fc22 Merge pull request #2972 from SelfGamer/master
When Fullscreen, dialogs have no parent now. Should fix #2949
2020-12-08 16:36:21 -05:00
JohnAFernandez c98dd53c76 Fix fred control crash (#2969)
* Keep ships that we are centered on from moving

This prevents NAN from appearing from obscure vector math somewhere in the depths of fred.

* Also fix movement of centered objects in qtFRED
2020-12-08 16:26:29 -05:00
Birk Magnussen 6a68300fcc Moved Dialog Parent Window detection to function + small explanation 2020-12-09 04:13:36 +09:00
Birk Magnussen 21eefe5133 When Fullscreen, dialogs have no parent now. Should fix #2949 2020-12-09 03:34:01 +09:00
Goober5000 3fdc5a3784 cur_turn_rate -> current_turn_rate 2020-12-08 12:33:29 -05:00
JohnAFernandez 20ffa59a31 Merge pull request #2965 from Baezon/beam-init-width-fix
Fix an assert with 0 initial beam width
2020-12-08 00:59:58 -05:00
Baezon be76cd727a implement turret-forced-target 2020-12-08 00:07:23 -05:00
Goober5000 9b2f924109 Merge pull request #2967 from z64555/fix/issue_2960
Save fade-out color, even if its black.
2020-12-07 22:18:51 -05:00
z64555 761f50989e Partially revert refactoring.
*  Can't simply use the previous fade_out color as the default, because of an edge-case with legacy usage.  The refactor would disallow setting the fadout to black.
2020-12-07 17:07:17 -06:00
Goober5000 fa0043f93b Merge pull request #2962 from SelfGamer/master
Add flag for AI to only fire Turrets / Secondaries when having clear Line of Sight
2020-12-07 17:47:32 -05:00
z64555 464c867bb5 Save fade-out color, even if its black.
Refactor sexp_fade, and make the Fade_out color init to black on mission load, instead of init on game start.
2020-12-07 16:33:29 -06:00
Goober5000 8c27d60f0a Merge pull request #2957 from SelfGamer/fireball-scripting
Adds Fireball as a new Object Subclass to scripting
2020-12-07 16:43:41 -05:00
Baezon 663a070f06 no 0 initial width 2020-12-07 02:21:59 -05:00
Birk Magnussen 1e5652ea07 Adapt change requests by Goober for Fireballclass 2020-12-07 07:04:09 +09:00
Goober5000 a6f5f4c09c Merge pull request #2959 from Goober5000/some_turret_fixes
some fixes to aiturret code
2020-12-06 08:57:42 -05:00
Birk Magnussen 08fee6f807 Added more lua erros for bad warp effects 2020-12-06 20:48:49 +09:00
Birk Magnussen 16c4097992 Added error when using too short duration for warp effect 2020-12-06 20:42:19 +09:00
Birk Magnussen ccb6e52475 Simplify Early Out calculation for LoS calculation 2020-12-06 17:34:22 +09:00
Goober5000 bfb7631ad5 Merge pull request #2955 from PhantomHoover/feature/default-fit
Turn framerate-independent turning on by default
2020-12-05 22:44:18 -05:00
Goober5000 0dd12473a4 address feedback 2020-12-05 22:40:51 -05:00
Birk Magnussen 18d17b18e0 Added earlier outs for los detection 2020-12-06 11:08:02 +09:00
Birk Magnussen f10fd36706 Modernized function, iterate over used objects instead of all 2020-12-06 06:47:44 +09:00
Birk Magnussen d4e9958f0f Tidy Code. Add AI Flag for firing requires exact los 2020-12-06 05:48:17 +09:00
Birk Magnussen d72ea2c213 Add require exact los weapon flag 2020-12-06 04:05:40 +09:00
Goober5000 ed7eddc873 comment 2020-12-05 13:54:43 -05:00
Goober5000 c0e5d810be fix flak not jittering if it had the fire-down-normals flag 2020-12-05 13:43:41 -05:00
Birk Magnussen 042cd0682d Fixed Warning due to unused variable 2020-12-05 08:48:45 +09:00
Birk Magnussen 2fa8d1e23b Fixed Error in createWarpeffect, added createExplosion 2020-12-05 08:32:04 +09:00
Birk Magnussen 67ebbddb09 Added Fireball lua API + added createWarpeffect 2020-12-05 07:23:14 +09:00
Goober5000 e0bbdf5d17 Merge pull request #2954 from SelfGamer/master
Modified Ship-Ship Collision Overrides to fit other Ship-X collision Overrides
2020-12-04 15:28:08 -05:00
Phantom Hoover 83df3a003c Turn framerate-independent turning on by default 2020-12-04 17:38:09 +00:00
Goober5000 62a66a0e20 patch player sound issue; adjust code comment and variable scope 2020-12-03 21:19:57 -05:00
Goober5000 0ad267a6dd remove superfluous function 2020-12-03 21:19:57 -05:00
Goober5000 7eb18dddca clean up the second half, and remove an unused field 2020-12-03 21:19:53 -05:00
Goober5000 54343a0eee clean up the top half of ai_fire_from_turret 2020-12-03 21:18:16 -05:00
Birk Magnussen effe18c629 Added Comments to indicate moved code block for ship-ship collision override change 2020-12-04 10:40:08 +09:00
Goober5000 ec06843ac5 Merge pull request #2950 from Baezon/fire-down-normal-fix
Allow normal weapons to use 'fire down normals'
2020-12-03 19:30:21 -05:00
Birk Magnussen 90b4079746 Remove now unused parameter from ship_ship_check_collision due to warning 2020-12-04 08:07:45 +09:00
Birk Magnussen 3268e1d49b Modified Ship-Ship Collision Overrides to fit other Ship-X collision Overrides 2020-12-04 07:36:01 +09:00
Baezon e8fb55fafa shoot_vector -> pointer 2020-12-03 12:27:35 -05:00
Baezon 2d516ef3ac allow normal weapons to use 'fire down normals' 2020-12-02 20:18:24 -05:00
m!m 37ea2bdaf4 Merge pull request #2946 from SelfGamer/master
Scripting Bugfix: previous HUD set/get gauge color referred to config instead of ingame gauge
2020-12-02 18:04:53 +01:00
Goober5000 5f87f1da47 Merge pull request #2948 from MageKing17/bugfix/turret-change-weapon-4th-bank-fix
Fix turret-change-weapon comparing sec_slot to max primary banks.
2020-12-02 00:24:54 -05:00
Goober5000 8252d39bcf Merge pull request #2947 from Goober5000/short_circuiting_update
don't flush the tree when evaluating the *-argument conditionals
2020-12-02 00:24:36 -05:00
MageKing17 edcc3b7d59 Fix turret-change-weapon comparing sec_slot to max primary banks.
We should compare `sec_slot` to `MAX_SHIP_SECONDARY_BANKS`, not `MAX_SHIP_PRIMARY_BANKS`.
2020-12-01 18:36:02 -08:00
Goober5000 958237f95c don't flush the tree when evaluating the *-argument conditionals
This is a follow-up to PR #2942.  Given that the short-circuiting is now explicitly skipped for node trees containing the special argument, it should no longer be necessary to flush the conditional branch of the sexp tree.  (The .cache field is already skipped for special-arg nodes.)

The sexp tree is still explicitly flushed for `every-time` and `every-time-argument`.
2020-12-01 16:31:11 -05:00
Goober5000 bd3b0fc893 Merge pull request #2938 from MageKing17/feature/first-of-sexp
Add "first-of" SEXP that behaves like "any-of" with a cap.
2020-12-01 16:22:33 -05:00
Goober5000 9261b9b5d2 Merge pull request #2942 from PhantomHoover/fix/unsound-short-circuit
Don't short circuit eval_sexp on nodes which contain the special argument.
2020-12-01 16:20:41 -05:00
Birk Magnussen 4def488a11 Fixed new HUD Scripting API Variable for Gauge Count 2020-12-02 05:35:00 +09:00
Birk Magnussen 47af4b5652 Fixed Warning in new HUD API 2020-12-02 05:30:39 +09:00
Birk Magnussen f2d013ae0d Updated HUD Scripting API Docs Again 2020-12-02 05:03:27 +09:00
Birk Magnussen a30a289f68 Updated HUD Scripting API Docs 2020-12-02 03:36:35 +09:00
Birk Magnussen dacf61cf80 Moved HUD-Scripting API changes to newe function 2020-12-02 03:34:03 +09:00
Birk Magnussen b0db9e3aea Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2020-12-02 02:53:57 +09:00
Birk Magnussen 76c28ddccc Fixed HUD set Color call to use in game HUD instead of configs 2020-12-02 02:52:42 +09:00
Baezon 641cf48073 implement damage incidence angle 2020-12-01 12:37:22 -05:00
Phantom Hoover 909f4e9642 Don't short circuit eval_sexp on nodes which contain the special argument. 2020-11-29 20:49:12 +00:00
MageKing17 29e6aa1f17 Merge pull request #2941 from Baezon/another-copy-paste-error
Fix a small copy paste error in weapon parsing
2020-11-29 12:34:24 -08:00
Baezon 63f16b3fec fix a copy paste error 2020-11-28 20:38:25 -05:00
MageKing17 017bef3721 Merge pull request #2903 from JohnAFernandez/Adjust-timestamp-warning
Slightly alter when a timestamp warning is written to the log.
2020-11-28 12:02:44 -08:00
Fabian Woltermann 743bd306fe Merge pull request #2934 from PhantomHoover/fix/allow-treason-broken
Remove erroneous call to CDR.
2020-11-28 09:28:29 +01:00
Fabian Woltermann af08485286 Merge pull request #2929 from The-E/feature/expose_power_output
Expose the power output in the ship class to sexps and scripting
2020-11-28 09:27:59 +01:00
MageKing17 764b141175 Add "first-of" SEXP that behaves like "any-of" with a cap.
It takes a number as a maximum number of arguments that can be evaluated in a single call, but otherwise behaves very similarly to `any-of`; alternatively, if the number is 1, it's like an `in-sequence` that also skips arguments that don't satisfy the condition instead of just invalid ones.
2020-11-27 17:18:34 -08:00
JohnAFernandez f104bdef7e Merge pull request #2933 from asarium/fix/particleEdgeCase
Cover edge case in particle code
2020-11-27 15:05:33 -05:00
Fabian Woltermann 7be6f8adf4 Remove extraneous call to CDR 2020-11-27 19:30:13 +01:00
Phantom Hoover 2f9e64ed17 Remove erroneous call to CDR. 2020-11-27 18:14:12 +00:00
asarium 9766cc28d8 Cover edge case in particle code
There are some possibilities where we could get an expired pointer when
we create a persistent particle. This adds a check for that to avoid
crashing the engine in those case.

This is related to #2928.
2020-11-27 18:55:19 +01:00
Fabian Woltermann 0a4f9d5673 Evaluate the ship_entry correctly 2020-11-27 09:43:16 +01:00
Asteroth 20efcf04a1 Merge pull request #2924 from Baezon/big-ship-deathroll
Death roll for big ships and a death roll multiplier
2020-11-26 18:26:46 -05:00
Asteroth 93ea987a34 Merge pull request #2925 from Baezon/ship-split
Separate ship splitting explosions from propagating explosions
2020-11-26 18:26:32 -05:00
Fabian Woltermann 6423cc6001 Do not short-circuit evaluation here 2020-11-26 22:38:14 +01:00
JohnAFernandez 5e4c42426f Cleaner of Multi stats (#2918) 2020-11-26 12:13:35 -05:00
Fabian Woltermann 6f8763346c Expose the power output in the ship class to sexps and scripting 2020-11-26 16:36:19 +01:00
Goober5000 b0ef7859c8 Merge pull request #2915 from JohnAFernandez/Warn-About-Invalid-Squadron-Wings
Warn about and correct invalid squadron wings in multi
2020-11-26 00:14:51 -05:00
Baezon 1f7aca8cff cast to bool 2020-11-25 23:00:34 -05:00
Asteroth c0f7289880 Merge pull request #2927 from Baezon/no-docking-jitter
Reduce docking 'jitter'
2020-11-25 22:54:01 -05:00
JohnAFernandez 4a54370a5c Slightly alter when a timestamp warning is written to the log. 2020-11-25 22:46:53 -05:00
JohnAFernandez dcfd3aa8a9 feedback 2020-11-25 22:07:21 -05:00
Baezon a37d5f579f unused parameter 2020-11-25 17:04:01 -05:00
Baezon d367f2312b reduce docking jitter 2020-11-25 15:19:37 -05:00
Allen A. Babb 4671dbfdd5 Merge pull request #2911 from PhantomHoover/fix/dropped-hotkeys
Only save hotkeys if the player has actually added to the group, otherwise leave mission defaults in place
2020-11-24 17:46:19 -06:00
Taylor Richards 3e7fedd997 avoid doing mdns stuff in incompatible states 2020-11-24 10:06:27 -05:00
Baezon 79524e46d1 separate ship splitting explosions 2020-11-24 02:27:47 -05:00
Baezon 3fde7bb076 cat forget clone and move 2020-11-24 02:04:24 -05:00
Baezon d534c68f54 big ship death roll and deathroll multiplier 2020-11-24 00:04:29 -05:00
Goober5000 d31003afea Merge pull request #2909 from PhantomHoover/feature/tune-transfer
Add ships.tbl flags to tune most aspects of ETS behaviour
2020-11-23 13:14:34 -05:00
Goober5000 6c0d63f84a Merge pull request #2916 from Baezon/no-override-maneuver
Add 'Dont_override_old_maneuvers' flag to maneuvers
2020-11-23 13:09:32 -05:00
Phantom Hoover a4977f1a62 Only save hotkeys between missions if the player has added to them 2020-11-23 17:41:06 +00:00
Baezon 4024ff197d separate rotational and lateral maneuvers 2020-11-23 00:30:19 -05:00
Goober5000 ae9fdad600 Merge pull request #2902 from Baezon/lock-restrct-enhancements
Add IFF to missile lock restrictions, and now all missiles can use them
2020-11-22 12:49:06 -05:00
Baezon c90171d8a3 add no_override flag to maneuvers 2020-11-22 11:58:15 -05:00
Phantom Hoover 0151f1b5a8 Add ships.tbl flags to tune most aspects of ETS behaviour. 2020-11-21 23:07:21 +00:00
JohnAFernandez 515e1a2d26 Make Anti-Rubberbanding less aggressive to keep the client from showing nonsense (#2901) 2020-11-21 10:19:32 -05:00
JohnAFernandez caef2aecf0 Make sure that the oswpt object will have the correct status for an exited ship (#2913) 2020-11-21 09:57:19 -05:00
JohnAFernandez 2c43b7b506 Allow mission loading to circumvent multi Squadron bug 2020-11-21 09:54:08 -05:00
JohnAFernandez 97df2f3472 Merge pull request #2843 from Baezon/better-warp-collide
Fix some issues with warp collision
2020-11-21 01:03:32 -05:00
JohnAFernandez f61787b38a Merge pull request #2910 from notimaginative/fix_standalone_host_change
Update host pointer on standalone after host switch
2020-11-21 00:59:40 -05:00
Taylor Richards ce6c10535e address various ci warnings/errors 2020-11-21 00:57:03 -05:00
Taylor Richards cd5e1c297b replace old multicast code with mdns/dns-sd 2020-11-21 00:57:03 -05:00
Taylor Richards feadceef55 add mdns library 2020-11-21 00:57:03 -05:00
Goober5000 f8c9050da8 Merge pull request #2905 from Goober5000/weaponspew_tweak
adjust weapon calculations based on Discord analysis
2020-11-20 20:21:07 -05:00
Taylor Richards 29e9b1f109 update host pointer on standalone after host switch
fixes Mantis 1892
2020-11-20 14:43:46 -05:00
Baezon fe17aec76d no more travis wooo 2020-11-20 14:11:13 -05:00
Baezon 2dbaf53e49 no more travis wooo 2020-11-20 14:10:27 -05:00
Baezon 734314494f no more travis wooo 2020-11-20 14:07:55 -05:00
Baezon 96bd94dfa5 lock restriction enhancements 2020-11-20 12:04:03 -05:00
Baezon 849b4c57b6 no warning 2020-11-20 12:03:34 -05:00
Baezon de0933e1b9 expose targeting sizes 2020-11-20 12:03:34 -05:00
Baezon f2a367b75e NULL -> nullptr 2020-11-20 12:02:13 -05:00
Baezon 27b388eb7f a whitespace change yes really because travis hates me 2020-11-20 12:02:13 -05:00
Baezon 76a1b557b9 review tweaks and copy paste errors 2020-11-20 12:02:13 -05:00
Baezon bbd145410d big ship can exceed tabled velocity during warp too 2020-11-20 12:02:13 -05:00
Baezon 69c86c4733 more travis 2020-11-20 12:02:13 -05:00
Baezon 9959d8a671 travis 2020-11-20 12:02:13 -05:00
Baezon e203426230 missing warp_effect checks 2020-11-20 12:02:13 -05:00
Baezon 47dfdcb4c1 WHOOPS dont forget the remove your debug changes kids 2020-11-20 12:02:13 -05:00
Baezon aa8849f4e5 improved warp collision 2020-11-20 12:02:13 -05:00
Goober5000 2f38131cfd adjust weapon calculations based on Discord analysis 2020-11-19 00:37:55 -05:00
Goober5000 02a77d077d Merge pull request #2906 from Goober5000/fix_build
fix some sort of build problem in the continuous integration
2020-11-19 00:37:18 -05:00
Goober5000 ef0197971f fix some sort of build problem in the continuous integration 2020-11-18 21:11:09 -05:00
Goober5000 0f8a88bce9 Merge pull request #2904 from Baezon/fix-shock-damage-parse
Fix a bug with shockwave damage parsing
2020-11-18 18:19:40 -05:00
Goober5000 51decebf27 Merge pull request #2899 from notimaginative/fix_multi_loadout_team
Prevent loadout issues in multi due to iff changes
2020-11-18 13:55:38 -05:00
Baezon b70a28bfaa fix shockwave damage parsing 2020-11-18 13:26:18 -05:00
m!m 08297ddbb9 Merge pull request #2863 from jg18/freetype_prebuilt_for_mac
Use prebuilt FreeType library on Mac
2020-11-18 17:47:24 +01:00
Taylor Richards 22e13f88ba prevent loadout issues in multi due to iff changes 2020-11-17 04:20:16 -05:00
JohnAFernandez 383c821968 Remove the unused shield_integrity field (#2898) 2020-11-17 01:22:12 -05:00
Asteroth fd3ce9d6cd Merge pull request #2897 from Baezon/fix-lssm-trails
Update no-pspew-lssm with recent changes
2020-11-16 15:09:30 -05:00
Baezon b002cff3ee fix trail update oversight 2020-11-16 11:03:46 -05:00
Asteroth bee6c04c26 Merge pull request #2865 from Baezon/no-pspew-lssm
Some visual fixes to local ssms
2020-11-16 00:41:36 -05:00
Asteroth 0909855087 Merge pull request #2888 from Baezon/model-anim-fix
Fix a bug with model animation
2020-11-15 19:05:47 -05:00
Taylor Richards 042cb256de Merge pull request #2896 from notimaginative/fix_multi_cutscene_crash
Call common_select_init() before cutscenes where needed
2020-11-15 19:01:07 -05:00
Taylor Richards cad56bd533 call common_select_init() before cutscenes where needed
Fixes crashing in multi where ships are locked by host while a
client is on fiction viewer, command brief, red alert, or cutscene
2020-11-15 15:49:32 -05:00
Goober5000 2d291106d9 Merge pull request #2891 from Goober5000/message_sanity
don't access invalid memory if the shipnum is -1
2020-11-15 11:23:33 -05:00
JohnAFernandez 398985f97c Merge pull request #2880 from Baezon/afterburner-enhancements
Add some new afterburner options
2020-11-15 09:04:49 -05:00
JohnAFernandez 6d6f4446aa Merge pull request #2883 from Baezon/trail-spread
Add trail 'spread'
2020-11-15 09:03:01 -05:00
Baezon 18bf11b715 yes really just a whitespace change because travis hates me 2020-11-15 00:13:16 -05:00
Goober5000 32583f7216 don't access invalid memory if the shipnum is -1
This resolves #2887, even though that issue is really a case of bad data.
2020-11-14 22:24:49 -05:00
JohnAFernandez ce1858c4b6 Merge pull request #2890 from notimaginative/fix_multi_mission_closeout
Close out mission when returning to multi screens
2020-11-14 21:44:18 -05:00
JohnAFernandez b46c5f3e63 Merge pull request #2881 from Baezon/weapon-state-fixes
Two fixes to weapon states
2020-11-14 21:40:19 -05:00
Taylor Richards 0b41ee547b make sure mission is closed out when returning to multi screens 2020-11-14 19:57:58 -05:00
Baezon d4c5693e97 fix animation 2020-11-13 14:22:49 -05:00
JohnAFernandez 573746f229 Merge pull request #2759 from notimaginative/fix_multi_screen_timeouts
Fix multi screen timeouts
2020-11-13 02:33:50 -05:00
Baezon 8dba8f612e better comment 2020-11-12 14:28:14 -05:00
Baezon 89c1610ad7 better names 2020-11-12 00:21:46 -05:00
Baezon d4ac06fe81 comment for trail_add_segment and use vm_vec_zero 2020-11-11 23:39:04 -05:00
JohnAFernandez 455b839c27 Merge pull request #2876 from Baezon/scripting-frametime-fix
Fix 'getFrametime' scripting function
2020-11-11 21:07:55 -05:00
Baezon ec39f6c43b mandatory orient 2020-11-11 19:02:54 -05:00
Baezon e321b0c727 comment mistake 2020-11-11 18:52:08 -05:00
Baezon 8c640fb736 more comments 2020-11-11 17:24:14 -05:00
Baezon 048ee13269 implement trail "spread" 2020-11-11 16:56:22 -05:00
Baezon 899f03c8ff review tweaks 2020-11-11 01:32:22 -05:00
Baezon 2d9fdbe830 weapon state fixes 2020-11-11 01:20:22 -05:00
JohnAFernandez 433f170f52 AI Edge Case Fix (#2871) 2020-11-10 20:17:07 -05:00
Baezon 4b28f56edb actually deprecate old function 2020-11-10 12:53:51 -05:00
Baezon a4a281a0b8 move setting of flag 2020-11-10 02:41:58 -05:00
Baezon 23f8062346 add some afterburner fields 2020-11-10 01:44:00 -05:00
Taylor Richards 54a5e57181 clean up popupdead_do_frame() just a bit
- remove duplicate code block
 - use UNREACHABLE()
2020-11-09 20:00:47 -05:00
Taylor Richards 2c57ef119d Merge pull request #2878 from notimaginative/fix_pilot_file_issues
Fix pilot file data loss
2020-11-09 10:35:17 -05:00
Taylor Richards f11c12afe6 avoid verify() resetting data that it shouldn't
This fixes stats, variables, and techroom data for the
active pilot getting reset upon entering the barracks
2020-11-09 03:43:06 -05:00
Taylor Richards 0fc206ab97 fix invalid array in pilot file 2020-11-09 03:37:26 -05:00
JohnAFernandez b44a45cfa3 Should fix some crahes and inaccuracies at high pings (#2872)
* Should fix some crahes and inaccuracies at high pings

Feeding the wrong index to the rollback struct is a bad idea....  That's late night coding for you.

* Forgot one correction

* Also update the comment.
2020-11-09 00:11:49 -05:00
Goober5000 a0e5b8fc4d Merge pull request #2874 from The-E/feature/player_hook_var_in_huddraw
Add the "Player" hook variable to the CHA_HUDDRAW scripting trigger
2020-11-08 23:30:28 -05:00
Asteroth 5dbda7efd0 Merge pull request #2858 from Baezon/multi-beam-prep
Add beam parameter validation
2020-11-08 22:43:58 -05:00
Baezon 08f590b383 fix frametime 2020-11-08 22:32:21 -05:00
Fabian Woltermann 045a57745a Add the "Player" hook variable to the CHA_HUDDRAW scripting trigger 2020-11-08 14:38:33 +01:00
Taylor Richards 8950417c9e fix some timing problems
- account for frametime during movie playback to avoid sync issues
 - avoid incrementing timestamp more than once per frame in multi
2020-11-07 16:45:22 -05:00
Taylor Richards fb249d35cc add new NETPLAYER states
- Cutscenes
 - Fiction Viewer
 - Command Briefings
 - Red Alert
2020-11-07 16:44:11 -05:00
Taylor Richards ef648b313a confirm user wants to quit on respawn popup 2020-11-07 16:44:06 -05:00
Taylor Richards 0c66a3b33c fix crash on fiction viewer and cmd brief screens 2020-11-07 16:44:06 -05:00
Taylor Richards 9a913b5f35 prevent cutscenes from passing keyboard events to current state 2020-11-07 16:44:06 -05:00
Taylor Richards 3326874270 avoid replaying cutscene on briefing 2020-11-07 16:44:06 -05:00
Taylor Richards 05f4d36c52 stop common_music when exiting cmd brief and fiction viewer
This is necessary for multi to ensure that music is stopped.
common_select_close() would do this, but it's never inited for
these screens. So we need to manually do it if we aren't
transitioning to a screen with common_music.
2020-11-07 16:44:06 -05:00
Taylor Richards 153b6bbd6a handle multi quit properly in cmd brief and fiction viewer 2020-11-07 16:44:06 -05:00
Taylor Richards 463ca5ed01 allow multi clients to proceed to fiction viewer and cmd brief 2020-11-07 16:44:06 -05:00
Taylor Richards daa2da6a4a give time to network during playback loop if we should 2020-11-07 16:44:06 -05:00
JohnAFernandez 3238ce1614 Add CYCLE_PREIMARY_WEAPON_SEQUENCE to Multi controls sent to server. (#2866) 2020-11-07 14:23:34 -05:00
Baezon 8c9a6d049e use armor types for beam-weapon damage 2020-11-06 23:40:02 -05:00
jg18 d5c59d083c update prebuilt lib hash 2020-11-05 12:28:22 -08:00
Asteroth 498f82b0c4 Merge pull request #2823 from Baezon/continuous-spawn
Allow for continuously spawning weapons
2020-11-05 13:36:22 -05:00
Baezon 1359776651 no fb fire info fire method 2020-11-05 11:56:23 -05:00
Baezon 9034e4e043 revert and only do beam validation 2020-11-04 13:31:09 -05:00
Baezon 33805f1e37 travis 2020-11-04 00:24:15 -05:00
JohnAFernandez f21b1a7ace Multiplayer Resimulation for Client Fired Linear Weapons (Rollback) (#2788)
* Multiplayer Dumbfire Rollback

This creates a packet that sends the relative position and orientation info for a primary or dumbfire missle shot.  The client creates this packet when firing those two types of weapons and sends it to the server.  The server goes back to the frame that the client fired the weapon and quicky resimulates all the frames in-between.

This includes collision detection, restoring positions, orientations and veloicties, but not subsystem orientations.

* Address Feedback

* allow clients to send subsystem info

* Check for object number not weapon number

* Readability Adjustment
2020-11-03 22:56:25 -05:00
Baezon 64fa75d53e fix lssm trails 2020-11-03 12:42:06 -05:00
Joshua Glatt c733afc6bd Merge pull request #2857 from jg18/update_libpng_to_1.6.37
Update libpng to version 1.6.37
2020-11-03 08:52:30 -08:00
MageKing17 40dc4e9b74 Merge pull request #2862 from MageKing17/bugfix/display-name-template-fix
Don't perform automatic hash truncation before template-copying.
2020-11-03 01:22:25 -08:00
Baezon 729d515ea7 no pspew under lssm 3 2020-11-03 01:55:13 -05:00
jg18 e2675d4892 Use prebuilt FreeType library on Mac 2020-11-02 21:59:11 -08:00
MageKing17 b83f815dbb Don't perform automatic hash truncation before template-copying.
In commit 3b2af702f7, the hash truncation was changed so that instead of being part of the HUD, it's stored as the class's display name. However, this action was performed before `+Use Template:` was parsed, which would then overwrite the display name and clear the `Has_display_name` flag. I've moved it so that it now happens after the copy operation (and added a check for an existing display name, in case the template defines one). I use a new boolean variable to indicate that default display name creation needs to happen rather than duplicate that code.
2020-11-02 16:35:01 -08:00
Asteroth 5b0bbd5cde Merge pull request #2861 from Baezon/fix-collision-radius
Fix a bug with collision_radius_override
2020-11-02 16:59:41 -05:00
Baezon 53fdde6aea initialize collision_radius_override 2020-11-02 11:46:23 -05:00
jg18 31236b57cf update libpng to version 1.6.37 2020-11-01 09:56:21 -08:00
JohnAFernandez 42e29a96dd Merge pull request #2853 from JohnAFernandez/Fix-AutoAim-In-Multi
Allow polish_position() to use any player's position in multi
2020-10-31 22:39:26 -04:00
JohnAFernandez ee2560ac0f Merge pull request #2851 from Baezon/no-warn-radius-double
Don't warn for "no radius doubling" if the weapon isn't a bomb
2020-10-31 22:38:49 -04:00
Tyler Blount a92994fda5 Merge pull request #2840 from PhantomHoover/fix/slow-model-loads
Cache bitmap lookup buffers to avoid wasteful copying
2020-10-31 17:12:50 -06:00
Asteroth 2a9e33904c Merge pull request #2835 from Baezon/beam-no-parent-collide
Better excluding of beam-weapon collisions with the same parent
2020-10-31 17:18:20 -04:00
JohnAFernandez eb7a956a1e Allow polish_position() to use any player's position in multi 2020-10-31 16:46:50 -04:00
Baezon 7add73f27f rename hard_target_bomb and only warn for not interceptable 2020-10-31 01:12:30 -04:00
JohnAFernandez c4da36df52 Merge pull request #2847 from Baezon/radius-override
Add '$Collision Radius Override' to weapons
2020-10-30 20:13:08 -04:00
Phantom Hoover 7bcc18c622 Cache bitmap lookup buffers to avoid wasteful copying 2020-10-30 20:00:47 +00:00
Tyler Blount bd2c20fdc2 Merge pull request #2846 from TRBlount/new-licensing
Update terms of Licensing
2020-10-30 10:50:03 -06:00
Baezon ef34ce3883 0.f -> 0.0f 2020-10-30 11:50:47 -04:00
Baezon b3a71e9cf3 add radius override 2020-10-30 02:10:56 -04:00
Tyler Blount 9c75078026 Update terms of Licensing 2020-10-29 21:24:42 -06:00
Goober5000 0390f4abba Merge pull request #2845 from z64555/fix/mouse_buttons
Fixes #2844 where mouse buttons X1 and X2 were not detected.
2020-10-29 22:35:45 -04:00
z64555 9a2d996b53 Fixes #2844 where mouse buttons X1 and X2 were not detected. 2020-10-29 10:58:34 -05:00
Goober5000 4546c8784d Merge pull request #2842 from Goober5000/fix_debris_expiration
fix debris expiration
2020-10-28 23:18:06 -04:00
Goober5000 2aed10ee7f Merge pull request #2839 from Goober5000/fix_lock_indicator
redo the locking animations for multilock
2020-10-28 21:17:08 -04:00
Goober5000 b989492ef4 fix debris expiration
Fixes #2834, a bug where non-capital ships did not generate debris pieces from their hull.  It turns out this bug was introduced in #2416.  If the `DoesNotExpire` flag is substituted for the `lifeleft` variable , it should be done in all locations.
2020-10-28 19:35:50 -04:00
wookieejedi fea8086647 Merge pull request #2838 from Baezon/reset-burst-flag
Add "resets" burst flag
2020-10-28 15:54:05 -04:00
wookieejedi 97c801f7cc Merge pull request #2836 from wookieejedi/add-choose-random-bitmap-particle-effects
Add 'Choose Random Bitmap' for particle effects
2020-10-28 09:24:32 -04:00
Baezon 8dee9d8103 better delay handling 2020-10-27 23:35:19 -04:00
wookieejedi d23f995a58 optimize 2020-10-27 16:57:44 -04:00
wookieejedi 482b691f76 more appeasement 2020-10-27 14:49:27 -04:00
wookieejedi 04dc2aef57 appease travis 2020-10-27 08:07:08 -04:00
Goober5000 9eaa7bf024 redo the locking animations for multilock
The multilock patch did not handle `Lock_anim` in the best way, and handled `Lock_gauge` in a very bizarre way, despite the fact that they are two simple hud animations.  This changes the `lock_info` struct to track the correct `time_elapsed` value for both, and changes the locking code to use the values in the correct way.

Additionally, this properly loops the lock triangles on the FS1 lock indicator.  Strangely, even prior to the multilock merge it appears that the triangles wouldn't have animated more than a quarter turn.

Finally, this prevents the FS1 lock indicator from blinking, since in retail FS1 it didn't blink.

Tested with FSPort and no-mods.  Fixes #2826.
2020-10-27 02:55:36 -04:00
Goober5000 af83eda19a Merge pull request #2837 from Goober5000/fix_typo
fix typo and elaborate sexp help
2020-10-27 02:32:47 -04:00
Baezon 3db3dade77 implement "resets" burst flag 2020-10-27 01:39:35 -04:00
wookieejedi 34d6f5e44e and one more unit type fix 2020-10-26 23:18:06 -04:00
wookieejedi 20e65c0dbb remove unneeded int conversion 2020-10-26 22:55:13 -04:00
wookieejedi d762578fe0 incorporate feedback 2020-10-26 22:38:15 -04:00
Goober5000 283bcaf607 fix typo and elaborate sexp help 2020-10-26 20:51:00 -04:00
wookieejedi 032430d126 specify size_t type 2020-10-26 16:31:51 -04:00
wookieejedi 4b39f50b84 fix up 2020-10-26 16:05:58 -04:00
wookieejedi 879e7119d5 clean up redundancies 2020-10-26 15:54:40 -04:00
wookieejedi 8bc1c4c797 use pushback function 2020-10-26 14:08:14 -04:00
wookieejedi 01cc444836 Add 'Choose Random Bitmap' for Particle Effects 2020-10-26 13:47:26 -04:00
m!m a819d1860f Merge pull request #2827 from asarium/graphics/typesafeBufferHandles
Add type safe handle for graphics buffers
2020-10-26 17:59:18 +01:00
Baezon 858356cfd3 some fixes to beam collision 2020-10-26 11:43:10 -04:00
Goober5000 a8e1f02984 Merge pull request #2833 from Baezon/remote-detonate-fix
Fix `remote_detonaters_active` decrementing
2020-10-26 10:34:24 -04:00
Baezon f2e019d7fb review tweak 2020-10-25 21:36:31 -04:00
Baezon 62a1dae3b4 multi warning and no shadowing 2020-10-25 21:05:08 -04:00
Baezon c93c8e0bd7 fix remote_detonaters_active decrementing 2020-10-25 16:14:43 -04:00
Fabian Woltermann 339a33b0b7 Merge pull request #2832 from The-E/fix/2831_lab_crashes
Remove material editor, add exit button in the lab
2020-10-25 15:47:56 +01:00
Fabian Woltermann 33ce3f96f5 Remove material editor, add exit button 2020-10-25 13:03:38 +01:00
asarium 9da5cc17a3 Add type safe handle for graphics buffers
This converts the previous plain-int type for a buffer handle to an
instance of our ID class which provides type safety.
2020-10-25 12:16:05 +01:00
Baezon 3a83475c15 some fixes, added delay and minimum spawn interval 2020-10-25 00:44:14 -04:00
Tyler Blount 45417a0093 Merge pull request #2830 from PhantomHoover/fix/missile-locked-sexp
Avoid resetting player_has_lock unless they've actually lost their lock
2020-10-24 16:43:48 -06:00
Fabian Woltermann 0e5fbb1396 Fix a number of crash issues 2020-10-25 00:08:52 +02:00
Phantom Hoover 9a5186f637 Avoid resetting player_has_lock unless they've actually lost their lock 2020-10-24 20:26:55 +01:00
m!m dbcc60b359 Merge pull request #2829 from asarium/fix/2824
Make removing non-existent hook-vars a no-op
2020-10-24 17:33:39 +02:00
asarium 633d13a02e Make removing non-existent hook-vars a no-op
There are some usages where a hook variable is removed blindly which
caused issues in multi.

This fixes #2824.
2020-10-24 13:39:04 +02:00
Baezon dbf0d0de0d accurate total spawn count 2020-10-23 20:43:53 -04:00
wookieejedi 369f902d41 Merge pull request #2814 from bangstk/bugfix-hud-bg
Fix missing background color in paletted HUD gauges
2020-10-23 17:01:29 -04:00
Fabian Woltermann 23ea4eca43 Merge pull request #2517 from The-E/feature/lab_v2
Rewrite the lab
2020-10-23 18:01:47 +02:00
Fabian Woltermann fff5207d6c Disable the readability-non-const-parameter check on this line 2020-10-23 15:40:39 +02:00
Fabian Woltermann 4ad8f257bf Remove circular dependency 2020-10-23 08:18:23 +02:00
JohnAFernandez 2235a62cda Merge pull request #2810 from Baezon/better-collide-avoid
Improved collision avoidance for fighters
2020-10-22 22:06:34 -04:00
JohnAFernandez 4bd827f248 Merge pull request #2819 from notimaginative/fix_psnet_init
Address issues that can arise if psnet fails to init properly
2020-10-22 21:24:21 -04:00
JohnAFernandez c2b6a35196 Merge pull request #2813 from Baezon/fix-to-the-fix
Fix to the fix to initial missile physics set-up
2020-10-22 21:21:00 -04:00
Baezon 454c8f6bc3 no shadowing 2020-10-22 20:01:31 -04:00
Baezon a55e331302 spawn_chance for detonate_spawn too 2020-10-22 18:48:58 -04:00
Baezon 1926fcc5cb total_children_spawned -> total_detonation_children_spawned 2020-10-22 17:58:43 -04:00
Baezon 6506d0a49c v1 2020-10-22 14:32:20 -04:00
Fabian Woltermann 4e455913b9 Use a getter for the labmanager 2020-10-22 19:26:00 +02:00
m!m 51c8b22905 Merge pull request #2809 from asarium/graphics/2dFuncObs
Change graphics interface to function objects
2020-10-22 19:24:09 +02:00
Goober5000 6d8ab32971 Merge pull request #2822 from Baezon/bracket-deathroll-bug
Fix a bug with hud brackets during target deathroll
2020-10-22 11:22:09 -04:00
Fabian Woltermann 30436568f2 I don't even know 2020-10-22 08:04:01 +02:00
Baezon 7b6488aba2 array safety 2020-10-21 23:23:23 -04:00
Baezon 6808101e4a much cleaner this way 2020-10-21 23:10:35 -04:00
Baezon eae514a269 v1 2020-10-21 22:57:08 -04:00
Goober5000 f32f227db0 Merge pull request #2815 from Baezon/better-remote-detonate
Fix some inconsistencies with remote detonation
2020-10-21 14:21:16 -04:00
Fabian Woltermann d93d8e0e5e More CI fixes 2020-10-21 17:13:30 +02:00
Taylor Richards 7864a2891d abort if psnet failed to init on standalone 2020-10-21 10:57:24 -04:00
JohnAFernandez 04a4f98ced Merge pull request #2818 from JohnAFernandez/Fix-Silly-Ai-Debugging-Code
Add Missing Entries to Submode_text array
2020-10-21 05:54:56 -04:00
JohnAFernandez afc4fad4db And related comments 2020-10-20 23:48:08 -04:00
JohnAFernandez 1257396a1b Add Missing Entries to Submode_text array 2020-10-20 23:32:46 -04:00
Fabian Woltermann 52f0b7dbc6 Merge pull request #2802 from PhantomHoover/feature/screenshake-flag
Add -no_screenshake flag to optionally disable screen shaking effects…
2020-10-20 17:51:28 +02:00
Baezon ef65914129 v1 2020-10-19 13:40:25 -04:00
bangstk 01f4fb3f15 Fix missing HUD gauge backgrounds
Code was moved around between 3.8.0 and 19.0.0 which broke the colored backgrounds of paletted HUD gauges.

Palette index 15 is used by the HUD gauge graphics to indicate background area of HUD gauges. When the code to remap palette indexes to alpha values was moved to packunpack.cpp, palette index 15 was mistakenly mapped to the alpha for index 0 (nothing) rather than index 1 (what retail/3.8.0 code maps it to) causing all HUD gauges to be missing their dark transparent backgrounds.

Also: the code maps palette indexes [0, 15] to alpha values [0, 255]. But due to an oversight (palette index 15 not being part of this gradient] alpha value 255 is never used so the range of alpha values for HUD gauges ended up being [0, 238]. Conversion math tweaked to make the alpha range [0, 252] which is very close to 255.
2020-10-19 03:31:01 -04:00
Baezon d2de3b6b82 v1 2020-10-18 22:43:57 -04:00
Phantom Hoover 68385e7658 Disable no screenshake flag in multi 2020-10-18 20:22:03 +01:00
Fabian Woltermann 1ad6b78950 More CI things 2020-10-18 19:58:56 +02:00
Baezon baa1f23bdc travis appeasement 2020-10-18 12:43:07 -04:00
Taylor Richards 424840eabf fix issues with psnet init 2020-10-18 05:31:24 -04:00
Fabian Woltermann 1e406ae5d2 Another CI warning fix 2020-10-18 10:43:30 +02:00
Baezon a9bc56fd13 v1 2020-10-18 00:30:41 -04:00
m!m 395b4300f6 Merge pull request #2800 from asarium/vulkan/shaders
Add first basic rendering with Vulkan
2020-10-17 20:38:46 +02:00
Fabian Woltermann c5447966c2 More CI fxes 2020-10-17 17:53:30 +02:00
Fabian Woltermann b94b5475b6 actually remove the old lab code 2020-10-17 16:54:51 +02:00
Fabian Woltermann eebd5cdd4d Fix CI warnings 2020-10-17 16:50:47 +02:00
Fabian Woltermann 13cd2d3326 Make the AO flag work 2020-10-17 16:07:33 +02:00
Fabian Woltermann 241ba1e4e7 Fix crash on exit 2020-10-17 15:58:34 +02:00
asarium 287b843839 Change graphics interface to function objects
This will make it easier to have a graphics interface without relying on
global objects since the object can be kept alive in the function
object. No other functional changes since the existing syntax is also
valid for function objects.
2020-10-17 15:15:33 +02:00
Phantom Hoover 67e9a4263a NULL to nullptr to appease travis' caprice 2020-10-17 13:50:01 +01:00
m!m ede19df94d Merge pull request #2808 from JohnAFernandez/Add-buffer-to-object-update-packet
stop needs more space so as not to crash during really busy scenes
2020-10-17 13:00:15 +02:00
Goober5000 d771d499dd Merge pull request #2804 from Baezon/physics-missile-fixes
Two fixes to initial missile physics set-up
2020-10-17 01:35:06 -04:00
Goober5000 c7666faf08 Merge pull request #2807 from Goober5000/directive_lines_fix
properly handle directives with long words
2020-10-17 01:09:33 -04:00
JohnAFernandez 93a9a2ab51 stop needs more space so as not to crash during really busy scenes 2020-10-17 00:07:18 -04:00
Goober5000 f7b3322537 Merge pull request #2806 from TRBlount/fix/multilock-cs-swarm
Fix #2767
2020-10-16 21:14:51 -04:00
Goober5000 a4d10a3fe4 properly handle directive with long words
A follow-up of sorts to #2801, but independent of it.  If a directive line is not split, the HUD should handle it properly rather than Asserting and displaying the same line twice.
2020-10-16 21:02:36 -04:00
Tyler Blount 2f07c0785e Add comment for clarification 2020-10-16 17:34:05 -06:00
Tyler Blount 8090f60940 Don't clear locks for swarm/corkscrew missiles until the last missile needs to be fired 2020-10-16 16:15:48 -06:00
Goober5000 4be145999e Merge pull request #2803 from Goober5000/fix_special_exp_initialization
fix a very special case with ship field initialization
2020-10-16 13:42:35 -04:00
Baezon 39d28a14e8 travis 2020-10-16 12:53:22 -04:00
Baezon 1459f4bbcf v1 2020-10-16 01:52:47 -04:00
Goober5000 785cabfc4c fix a very special case with ship field initialization
If you create a kamikaze ship with ship-create, it won't work properly, because the explosion values are not initialized to -1 as expected.  This fixes that.
2020-10-15 22:13:06 -04:00
Phantom Hoover a137fa496f Add -no_screenshake flag to optionally disable screen shaking effects for afterburner/cannon/shockwaves 2020-10-15 21:23:23 +01:00
Goober5000 278370b0d6 Merge pull request #2801 from Goober5000/tweak_message_string_splitting
improve message string splitting for outlier cases
2020-10-15 12:39:00 -04:00
asarium 4a0a8463ee Add first basic rendering with Vulkan
This is basically the tutorial from vulkan-tutorial.com adapted to using
VulkanHpp and with some refactorings that extract some locigally
self-contained code.

Currently only draws a simple colored triangle.
2020-10-14 22:21:45 +02:00
Goober5000 455e2f9d8c improve message string splitting for outlier cases
If a message string contained a word that was too long, on its own, for the available screen real estate, the function wouldn't split the string at all.  The new behavior is to split the string even if the split location is suboptimal, since it's better to have as much of the message visible as possible.

Quoting from the code:

```
// only update the line break if:
// a) we don't have a line break yet;
// b) we're still within the required real estate
// (basically we want the latest line break that doesn't go off the edge of the screen,
// but if the *first* line break is off the end of the screen, we want that)
```
2020-10-14 15:57:09 -04:00
m!m bfe76fbf44 Merge pull request #2795 from Baezon/laser-particles
Allow for 'laser-style' particles
2020-10-14 20:21:50 +02:00
Goober5000 fbca15ae71 Merge pull request #2799 from Goober5000/invalidate_argument_default
the default for the argument sexps should be the most frequently-used case
2020-10-13 19:45:02 -04:00
Goober5000 4ecddc0408 the default for the invalidate-argument sexp should be the most frequently-used case 2020-10-13 16:16:41 -04:00
Goober5000 105137dc94 fix bug in ships with no allowed weapons list (#2796)
Phantom Hoover noticed this bug in Vassago's dirge.  For ships with no allowed weapons list (like Shivan ships) weapon culling would cause a crash.
2020-10-12 21:22:15 -04:00
Fabian Woltermann 83d499b999 master rebase 2020-10-12 21:41:44 +02:00
Fabian Woltermann 41afb6e32d ... 2020-10-12 21:01:42 +02:00
Fabian Woltermann c914a131ab small fix 2020-10-12 21:01:42 +02:00
Fabian Woltermann 98085d5281 more fixes 2020-10-12 21:01:42 +02:00
Fabian Woltermann 515a8e95c5 More stupid bugfixes 2020-10-12 21:01:42 +02:00
Fabian Woltermann 80c9af4c57 More fixings 2020-10-12 21:01:42 +02:00
Fabian Woltermann 06428448b3 Various fixes 2020-10-12 21:01:42 +02:00
Fabian Woltermann ca8f9e9adf small bugfixes 2020-10-12 21:01:42 +02:00
Fabian Woltermann 298f6c5aa9 fix typo 2020-10-12 21:01:42 +02:00
Fabian Woltermann 18aa525ce2 Make model rendering work again 2020-10-12 21:01:42 +02:00
Fabian Woltermann 7e98ed7990 Get more rendering in here 2020-10-12 21:01:42 +02:00
Fabian Woltermann 396fdc88f9 Start on the renderer 2020-10-12 21:01:42 +02:00
Fabian Woltermann 440045d017 Make it possible to exit the lab 2020-10-12 21:01:42 +02:00
Fabian Woltermann c650cec3da Add the missing dialogs 2020-10-12 21:01:42 +02:00
Fabian Woltermann 1c5621b89b Add weapons list 2020-10-12 21:01:41 +02:00
Fabian Woltermann 77a832f8f4 bugfixes 2020-10-12 21:01:41 +02:00
Fabian Woltermann 56140e5c9c Fix more CI warnings 2020-10-12 21:01:41 +02:00
Fabian Woltermann 305c0b915e Fix CI 2020-10-12 21:01:41 +02:00
Fabian Woltermann 8e45f3cf29 wip 2020-10-12 21:01:41 +02:00
m!m f7dd996a40 Merge pull request #2793 from asarium/lua/varargsDocs
Support vararg specifiers in Lua documentation
2020-10-12 19:45:02 +02:00
Baezon 13f911528f no implicit magic number, and initialize 0 2020-10-12 13:39:05 -04:00
asarium bb0631ab6e Support vararg specifiers in Lua documentation
This was the last thing that was missing for complete support of all
function parameter declarations.

To ensure parameter lists stay valid a unit test was added that will
validate the argument lists and cause the test to fail if they cannot be
parsed.
2020-10-12 17:59:57 +02:00
Baezon 773d6f9710 v1 2020-10-12 01:13:29 -04:00
JohnAFernandez 7d8dd55ec8 Merge pull request #2791 from Baezon/missile-turn-accel
Add 'Turning Acceleration Time' to missiles
2020-10-11 21:41:14 -04:00
Baezon 3bd999ee8e warn once for no flag 2020-10-11 19:30:33 -04:00
m!m 75ca28ea86 Merge pull request #2794 from wookieejedi/fix-non-shielded-ships-manage-ets
Fix to Non Shielded Ships Manage ETS
2020-10-11 19:12:18 +02:00
wookieejedi 950f248b03 Fix to Non Shielded Ships Manage ETS
This one line fix properly specifies which ship to use for ETS managment. The recent merge of `Non-shielded ships manage ETS` had a object reference error, so this rectifies that. Thanks to Axem for finding this!
2020-10-11 11:23:14 -04:00
Baezon b360435719 v1 2020-10-11 02:34:59 -04:00
m!m f54ad876aa Merge pull request #2789 from Baezon/respect-turntime-rotdamp
Add 'AI respect tabled turn time and rotdamp' flag
2020-10-10 18:49:26 +02:00
m!m 587c4f7cd1 Merge pull request #2790 from Baezon/ai-use-bank-const
Fix banking constant not applying to AI
2020-10-10 18:47:34 +02:00
Baezon 3eda3d9315 increase fudge to maintain retail 2020-10-09 23:37:28 -04:00
Baezon 53d2d6c028 v1 2020-10-09 23:19:41 -04:00
Baezon 01d2657532 v1 2020-10-09 23:00:21 -04:00
Goober5000 465af93dcd fix display names for wings (#2787)
Fix wing name generation, when using hash symbols, to use the new display name method.
2020-10-08 22:48:30 -04:00
JohnAFernandez 186fe51344 Object update packet upgrade (#2752)
* Object Update Refactor

    1. Keeps the object update packet aligned, even if the ship is dying or has not yet arrived on the client.
    2. Properly handles model point shields (yes, that's what was causing multi to crash the most!)
    3. Reworks positional interpolation timing and adds rotational interpolation, by sending timing information with every object update packet in a header shared between objects.
    4. Saves a lot of bandwidth by only sending data that is changing. (no more sending all subsystems once per second!)
    5. Better handles out of order packets (but can still use their information if recent enough!)
    6. Builds the basis for Rollback by beginning to record the positions and orientations and velocities of ships for the last 30 frames.
    7. Adds subsystem rotation -- Yeah, you saw that right, subsystems will now spin in multi.
    8. Waypoint movement is now enabled via sexp, and time to arrival of waypoints is updated on the target info gauge.

* Fix edge case crash and Incorporate feedback

* Clean Up Interpolate Angles Quick

* Restrain the client

* How was this still here???

* Make sure every part of OO uses OOC_INDEX_NULLPTR_SUBSYSTEM define

* Fix Way to Store Return Values

* Ok travis, we get it

* Ok travis.........
2020-10-08 15:29:06 -04:00
wookieejedi 8961b3cc8e Merge pull request #2783 from wookieejedi/allow-non-shielded-to-manage-ETS
Flag to allow ships with no shields to manage ETS
2020-10-06 16:18:06 -04:00
Goober5000 23b3aadf9b Message size fix (#2784)
* Fix underline length calculation in message scrollback
* Use SCP_string for message source (which allows ships with long display names to work without crashing) and message text
* Upgrade assorted functions to work with SCP_string
2020-10-06 14:31:03 -04:00
wookieejedi 443b3cd217 fix copy paste error 2020-10-06 14:07:19 -04:00
wookieejedi dabe025967 feedback and cleanup 2020-10-05 21:43:46 -04:00
wookieejedi 31d7a16e54 make capitalization consistent 2020-10-05 20:40:40 -04:00
wookieejedi 886e7f4f18 Flag to allow ships with no shields to manage ETS
Using the `No_shields` flag for ships is common usage in multiple mods, and as it turns out ships with that flag set will not have the AI manage ETS values due to an early return in the `ai_manage_ets` function. This PR adds an AI flag to allow ships with no shields to manage ETS regarding weapons and engines. This flag was tested and works as expected.
2020-10-05 19:57:09 -04:00
m!m a52f35fd28 Merge pull request #2782 from asarium/build/fixReleaseToolset
Fix toolset for Windows nightly and release builds
2020-10-04 12:26:54 +02:00
asarium fbdcf7cf50 Fix toolset for Windows nightly and release builds 2020-10-03 21:16:04 +02:00
m!m dc977f18ba Merge pull request #2781 from asarium/scripting/hookVarStack
Use a stack for scripting hook variables
2020-10-03 20:54:15 +02:00
asarium f71a86f2db Use a stack for scripting hook variables
Previously, if a script called a function that called another scripting
hook, some hook variables might be removed. This was the case since
after executing the hook the code would remove the set hook variables
again. If these variables had the same name as previously set variables,
they would overwrite and corrupt the state the original script expected.

This was unexpected behavior for script writers so this puts values on a
stack and only adds or removes from the stack instead of overwriting
values. This should make the hook variable state consistent for scripts
even if scripting hooks are called indirectly.
2020-10-03 15:37:20 +02:00
Goober5000 83666a0660 Merge pull request #2779 from Goober5000/weapon_sparks
add No_impact_spew weapon flag
2020-10-03 09:31:34 -04:00
m!m 6b946ed857 Merge pull request #2776 from asarium/fix/2773
Fix GCC-10 warnings
2020-10-03 11:26:06 +02:00
m!m 56f51f58e7 Merge pull request #2780 from Goober5000/fix_kill_crash
fix CTD when running ship:kill() with no parameters
2020-10-03 09:51:20 +02:00
Goober5000 53ad0ea163 fix CTD when running ship:kill() with no parameters 2020-10-03 00:02:46 -04:00
Baezon 799fa27d36 clarity comment 2020-10-02 23:14:45 -04:00
Goober5000 672ad1a489 Merge pull request #2778 from Baezon/javelin-fix
Fix a CTD with Javelin missiles
2020-10-02 22:14:23 -04:00
Goober5000 18c93f2b5a add No_impact_spew weapon flag
If you want to make a weapon that doesn't generate smoke particles on impact.
2020-10-02 22:12:59 -04:00
Baezon 06dd153f80 v1 2020-10-02 16:11:40 -04:00
asarium b4350a1d1e Fix GCC-10 warnings
This fixes some warnings reported by GCC 10 and enables that compiler to
be used by our CI pipelines.

This fixes #2773.
2020-10-02 18:49:01 +02:00
Baezon 01cd5a34b9 travis 2020-10-02 12:04:45 -04:00
Goober5000 fa72fa463b Merge pull request #2774 from Goober5000/flag_fixes
fix flags in ships.tbl and weapons.tbl
2020-10-02 10:16:20 -04:00
Baezon 9b3905a4bb v1 2020-10-02 02:53:13 -04:00
Goober5000 15061d5daf fix flags in ships.tbl and weapons.tbl
When flags are parsed, they can be reset.  This is a problem for flags that are set based on lines elsewhere in the entry, so each table uses its own method to get around it.  However, not all flags used this method - particularly the new Has_display_name flag.  This brings the flag management up to date.
2020-10-02 00:53:33 -04:00
Goober5000 39d77d891c Merge pull request #2770 from Baezon/improve-docked-shockwave
Improve shockwave handling for docked ships
2020-09-30 20:58:47 -04:00
Goober5000 2c3ad93f82 Merge pull request #2772 from Goober5000/warpout_fix
fix several places where the wrong matrix function was used
2020-09-30 20:06:07 -04:00
Goober5000 2be97cfde9 fix several places where the wrong matrix function was used 2020-09-30 15:17:43 -04:00
m!m 3e226f85e0 Merge pull request #2768 from asarium/opengl/spirvShaders
Add support for using Vulkan GLSL code with OpenGL
2020-09-29 22:57:11 +02:00
Goober5000 5f4124ee83 Merge pull request #2771 from Goober5000/for_player
add for-players sexp
2020-09-27 10:40:52 -04:00
asarium 56dc373bb9 Add support for using Vulkan GLSL code with OpenGL
This is an effort to be able to use the same GLSL code for both Vulkan
and OpenGL. This is done by first compiling the Vulkan GLSL code to
SPIR-V and then using a custom tool (which uses SPIRV-Cross) to convert
that back into GLSL 1.50 compatible code.

The required tool will be downloaded by CMake when glslc is found in the
path. This is included in the Vulkan SDK. To avoid having a hard
dependency on this, the generated files are included in the VCS and are
only regenerated when glslc is found on the system.
2020-09-27 12:45:05 +02:00
Goober5000 bfbc1389ab add for-players sexp
Useful for multiplayer missions.  Lists all currently valid player ships in the mission.  Works in both singleplayer and multiplayer.
2020-09-26 22:38:20 -04:00
m!m a3a27e9ad3 Merge pull request #2735 from Baezon/beam-collide-improve
Improve beam collision optimization
2020-09-26 23:01:30 +02:00
m!m 94fd9051d1 Merge pull request #2769 from Baezon/no-shield-print
Suppress "Too many triangles in shield hit" log spam
2020-09-26 22:57:53 +02:00
Baezon 470327933f v1 2020-09-25 23:05:44 -04:00
Baezon 540d200bec doing two PRs on the same area at the same time as always confusing 2020-09-25 22:47:33 -04:00
Baezon 7f46a3868d keep get_widest function 2020-09-25 21:28:25 -04:00
Baezon 5b6dd4d452 travis 2020-09-25 21:28:25 -04:00
Baezon 3370adc918 cleanup 2020-09-25 21:28:25 -04:00
Baezon ed8a89b68e collision optimize 2020-09-25 21:28:25 -04:00
Baezon d6442a096b store width 2020-09-25 21:28:25 -04:00
wookieejedi 0a88d5068e Merge pull request #2765 from Baezon/no-player-mflash
Suppress muzzle flashes from the player (and add a flag to re-enable it)
2020-09-25 21:19:39 -04:00
Baezon 414ad4a553 v1 2020-09-25 20:40:58 -04:00
Baezon cf270771f0 re enable muzzle flashes flag 2020-09-25 13:59:15 -04:00
Baezon 3cf9bc250a v1 2020-09-25 13:58:07 -04:00
Goober5000 2791acbd0c Merge pull request #2766 from Baezon/finished-growing-flag
Put beam->finished_growing into beam->flags
2020-09-24 22:13:28 -04:00
m!m 350ace3952 Merge pull request #2756 from asarium/rocket/documentEnvironment
Give Lua libRockets documents their own environment
2020-09-24 21:19:39 +02:00
m!m cfbce2a6cf Merge pull request #2762 from asarium/cmake/embeddedFilesRefactor
Refactor embedded files CMake code
2020-09-24 21:11:01 +02:00
Goober5000 58a9075002 Merge pull request #2740 from Baezon/no-framerate-dependance
Remove turning framerate dependence for AI
2020-09-24 14:45:10 -04:00
Baezon ed87b158c2 v1 2020-09-24 14:42:49 -04:00
Baezon b7ceb29be9 clarity comments 2020-09-24 01:00:21 -04:00
Baezon 60f20d055c review changes 2020-09-24 01:00:21 -04:00
Baezon 82b8f1726e travis cleanliness appeasement 2020-09-24 01:00:21 -04:00
Baezon 86a63f10b8 no shadowing 2020-09-24 01:00:21 -04:00
Baezon 232035e45d handle shockwaves and renaming 2020-09-24 01:00:21 -04:00
Baezon 7accd387a3 v2 2020-09-24 01:00:21 -04:00
Baezon 58ce531ec6 v1
V2
2020-09-24 01:00:21 -04:00
Goober5000 fa5bbf8531 Merge pull request #2764 from Goober5000/turret_fix
make the scripted turret firing code a bit more robust
2020-09-23 22:55:48 -04:00
JohnAFernandez 2e9a6c8ad6 Merge pull request #2763 from wookieejedi/specify-weapons-ss-threshold-turrent-inaccuracy
Expose Weapons SS Damage Threshold for Turret Inaccuracy
2020-09-23 22:14:34 -04:00
MageKing17 4778c7bbcc Merge pull request #2741 from Baezon/beam-grow
Add beam 'growth' in addition to shrinkage
2020-09-23 18:54:01 -07:00
JohnAFernandez 4cdab81ebb Merge pull request #2761 from Baezon/improve-homeworld-warp
Improve Homeworld warp effect
2020-09-23 21:33:19 -04:00
Goober5000 df53e49abf make the scripted turret firing code a bit more robust
The scripted code previously didn't check to see if a weapon bank was valid before firing it, which could have led to memory problems and starting March 15 would actually crash the game.  This adds a few safety checks.
2020-09-23 21:24:41 -04:00
wookieejedi 65bf014693 and another syntax fix... 2020-09-23 16:36:21 -04:00
wookieejedi 13325ef81a one more cleanup 2020-09-23 16:24:57 -04:00
wookieejedi 74b3374fe6 fix syntax issue 2020-09-23 16:00:18 -04:00
wookieejedi 984ee93d75 Expose Weapons SS Damage Threshold for Turret Inaccuracy
This PR adds a table entry that allows modders to specify the damage threshold for when turrents become less accurate due to weapon subsystem damage. A Game table setting is easier to set once and tune, thus this PR allows that efficent exposure to the modder and does not require a large change or complex table entry.
2020-09-23 15:25:16 -04:00
Baezon 2efe876fbd #define -> const float, and adjusted_progress for stage 3 2020-09-23 13:15:46 -04:00
asarium 0f2787639b Refactor embedded files CMake code
I have been thinking about some shader related techniques for the Vulkan
renderer and for that we will need to add embedded files in a different
environment than they are right now since the actual shader code will
not be needed in the engine.

For this reason, I extracted the "default file" mechanism to be more
generic so that all that is necessary to include a file is to just call
a custom CMake command and the function keeps track of what needs to be
done.

Also, since the "generic" code has worked pretty well so far I see no
reason to keep around two systems which just increases the amount of
code we need to maintain. So, I just removed the windows exclusive
implementation. Now all platforms use the same "generic" way of
embedding files.
2020-09-23 13:38:54 +02:00
Baezon 8d7536855b fix HW warp orient (always follows the ship's) 2020-09-23 01:49:53 -04:00
Baezon 9cbbb96880 timing re-adjusted for MAXIMUM accuracy 2020-09-23 01:21:41 -04:00
Goober5000 b22d9ce3c8 Merge pull request #2760 from Goober5000/play_sound_type_safety
polish some SEXPs
2020-09-23 00:21:21 -04:00
Baezon d9913d5b9e v1 2020-09-22 23:26:14 -04:00
Goober5000 147be6815c polish some SEXPs
Update SEXP help regarding variable types, and also add them to the SEXP syntax checker.

Fixes #2758.
2020-09-22 22:06:14 -04:00
Goober5000 410ab1ee5e Merge pull request #2757 from Goober5000/loadout_memory_optimization
optimze memory usage by weapon loadout
2020-09-22 13:33:16 -04:00
Goober5000 46691badb8 CI stuff 2020-09-21 22:05:00 -04:00
Goober5000 5a3c8d262c optimze memory usage by weapon loadout
The weapon loadout arrays wasted a ton of memory in several ways.  First, only friendly fighters and bombers have weapon loadouts; most ship classes do not need this storage.  Second, as DahBlount noticed, only 8 bits are needed for the flags, while the fields were using standard 32-bit ints.  Third, there are currently 500 weapon types but most loadouts only provide a dozen or so options.

This refactors the loadout storage to keep a short vector of weapon-flag pairs for each bank, and the bank storage is allocated only when needed.  The new `allowed_weapon_bank` class provides `operator[]` implementations so that the new API is almost completely compatible with the old one.  The only things that require the new API are assignments, since `operator[]` is read-only.  (A writable `operator[]` would not be able to tell when a flag value of 0 should be stored or not.)
2020-09-21 16:54:34 -04:00
asarium 9d9083ab52 Give Lua libRockets documents their own environment
This gives every document their own environment instead of using the
global environment. Previously it was necessary to store variables in
the global namespace since otherwise they could not be accessed by event
listeners.

This creates a separate environment table for every document so that all
<script> blocks and event handlers share the same "global" environment.
2020-09-21 21:07:00 +02:00
JohnAFernandez 3384699086 Merge pull request #2712 from Goober5000/red_alert_multi_sexp_support
add multi support for red-alert sexp
2020-09-21 11:34:34 -04:00
JohnAFernandez a043a14d69 Merge pull request #2631 from notimaginative/fix_multi_red-alert
Make redalert missions work better in multi
2020-09-21 11:34:13 -04:00
JohnAFernandez ee5336ed42 Merge pull request #2755 from notimaginative/fix_multi_weapon_crash
Fix multi crash when ship has less than two primary weapons
2020-09-21 09:43:51 -04:00
JohnAFernandez 6be2c665f0 Merge pull request #2754 from TRBlount/fix/multilock_aspect_loss
Fix #2724
2020-09-21 01:36:25 -04:00
Taylor Richards 9ca02e9e1a Merge pull request #2753 from notimaginative/fix_reliable_socket_memory_error
Fix memory error which broke reliable sockets
2020-09-20 23:57:10 -04:00
Taylor Richards 21642d5b75 fix multi crash when ship has < 2 primary weapons 2020-09-20 22:26:23 -04:00
Tyler Blount fe5eff2cee Fix #2724 2020-09-20 19:05:42 -06:00
Taylor Richards 46bc4e2e8c fix memory error which broke reliable sockets 2020-09-20 20:49:25 -04:00
Goober5000 49858825ac Merge pull request #2737 from Goober5000/credits_update
update credits
2020-09-20 14:21:48 -04:00
Taylor Richards 83116bbd11 disable replay mission button on red alert brief when multi 2020-09-20 13:30:03 -04:00
Taylor Richards 7c3906da00 always consider loadout locked on red-alert 2020-09-20 13:30:03 -04:00
Taylor Richards fe3069b94b make sure clients can proceed to red-alert brief 2020-09-20 13:30:03 -04:00
Taylor Richards 6795e0a940 handle exiting red-alert brief properly on multi 2020-09-20 13:30:03 -04:00
Taylor Richards eacc91ac8e fix issues with red-alert + multi
- support sync state before entering mission
 - return to briefing for sync and stats saving
 - handle campaign progression properly
 - initialize net_player state properly (fixes #2560)
2020-09-20 13:30:03 -04:00
JohnAFernandez 27faf89baa Fix Change IFF Multi Sexp 2020-09-20 09:53:47 -04:00
Taylor Richards f5a2cae122 Merge pull request #2608 from notimaginative/ipv6
IPv6 support
2020-09-20 09:46:44 -04:00
Baezon c143f9f6ec copy paste error 2020-09-19 22:10:01 -04:00
Taylor Richards b14122425a use newer define for multicast group joining 2020-09-19 06:35:19 -04:00
asarium bda31cd84f Use different hoster for build log
transfer.sh shut down some time ago and the output of the Mac build
tools is completely useless.
2020-09-19 11:40:13 +02:00
asarium ac6ed66c45 Disable XP toolset 2020-09-19 10:32:29 +02:00
JohnAFernandez f5a8556e54 Fix special Char crash
When I wrote the original change to a vector instead of an array, I was working on the assumption that this section of code was parsed after some other code that had already made sure that the special_char_indexes vector was at least three entries.  Further testing has revealed this is not true, and this fix keeps it from crashing.
2020-09-17 16:06:09 -04:00
Goober5000 33b4f1b5cc Merge pull request #2748 from JohnAFernandez/Enhance-ai-check-to-fix-crash
Fix an ai check
2020-09-17 12:41:04 -04:00
JohnAFernandez ce9fa02bc3 Fix an ai check
Keep multi from crashing from an out of bound check when trying ti set up a formation for a respawning ship.
2020-09-17 07:49:15 -04:00
wookieejedi fa7ad6a764 Merge pull request #2747 from wookieejedi/countermeasure-script-hook
Add Scripting Hook `On Countermeasure Fire`
2020-09-16 17:11:13 -04:00
wookieejedi 167e1430ee Clarify doc and add countermeasure object to hook 2020-09-16 15:35:11 -04:00
wookieejedi e544e1d081 Update ship.cpp
This PR adds a scripting hook which triggers when a ship fires a countermeasure. It has two variables, the ship firing the countermeasure and the number of countermeasures remaining. I have tested and it works as expected. This new hook complements the preexistsing `On Secondary Fire` and `On Primary Fire` hooks.
2020-09-16 12:58:34 -04:00
Goober5000 9b3f45ea1c Merge pull request #2745 from Goober5000/frheadding
make fred popup match the conventional pitch/bank/heading
2020-09-15 21:14:52 -04:00
Goober5000 34da5093bf make fred popup match the conventional pitch/bank/heading 2020-09-15 13:27:05 -04:00
Baezon 1a6f01c8d8 copy paste error 2020-09-15 13:06:35 -04:00
Goober5000 8a3556b648 Merge pull request #2738 from Goober5000/file_fixes
fix getPath() and add getName()
2020-09-15 11:55:07 -04:00
Goober5000 d1af5ed467 shut up clang, this wasn't even part of the PR 2020-09-15 04:12:29 -04:00
MageKing17 ad8fc46224 Merge pull request #2743 from Goober5000/special_char_index_tweak
don't break the parser in Unicode mode
2020-09-14 23:45:28 -07:00
Goober5000 a485e29b24 use DIR_SEPARATOR_CHAR 2020-09-15 02:36:32 -04:00
JohnAFernandez 87de1d1d77 Remove Int3()'s from ai.cpp and aibig.cpp 2020-09-14 20:53:31 -04:00
JohnAFernandez 8d41f5bcc6 Replace INT3's in Freespace.cpp 2020-09-14 20:53:31 -04:00
Goober5000 460f00a23e don't break the parser in Unicode mode
If a mod is running in Unicode mode, ignore Special Character Index if the table happens to supply it.
2020-09-14 19:25:33 -04:00
Goober5000 472babbb30 Merge pull request #2725 from JohnAFernandez/fix-special-characters-correctly
Minor Refactor of Special Character Index Handling
2020-09-14 19:22:22 -04:00
Goober5000 30a0946e47 update cf_find_file_location based on Taylor's patch 2020-09-14 19:16:35 -04:00
m!m 2a90d1f823 Merge pull request #2717 from asarium/lua/serializer
Add Lua API for serializing values
2020-09-14 22:25:26 +02:00
m!m 8ce8c061b2 Merge pull request #2742 from asarium/github/codeowners
Add basic code owners file
2020-09-14 19:34:28 +02:00
Goober5000 b821dc5798 CI pointed out memory leaks, so let's just use SCP_string 2020-09-13 23:19:37 -04:00
Goober5000 ca2a9b8721 address feedback and use an alternate separator method 2020-09-13 17:02:56 -04:00
Goober5000 12fad41962 fix getPath() and add getName()
The getPath() function would crash if the id was -1.  Also, there was no function for getting the file name.
2020-09-13 17:02:56 -04:00
Goober5000 07b975ee76 Merge pull request #2739 from Goober5000/ship_types_scripting
add tb.ShipTypes
2020-09-13 12:27:19 -04:00
asarium b3e7d03d78 Add basic code owners file 2020-09-13 14:58:12 +02:00
Baezon f66bd71a21 v1 2020-09-13 02:44:31 -04:00
Goober5000 f4924971f7 patch ship type lookup 2020-09-13 02:10:41 -04:00
Goober5000 8b3b15b4b2 add tb.ShipTypes
Add ShipTypes as a collection to complement ShipClasses.

Also check the correct init variable.
2020-09-13 00:46:28 -04:00
asarium cf4fe8accc Add Lua API for serializing values
This can be used by script code for reliably storing Lua values without
having to build a custom serialization format.

The C++ code can also be used by other code modules that want to
serialize data. The new classes simply return a byte array with an
unspecified format.

At the moment this uses a plain JSON encoding but could be extended in
the future to include either compression or BSON encoding if necessary.
The format is future compatible by using a simple header to identify
different kinds of formats.
2020-09-12 14:28:16 +02:00
Goober5000 e451ac5a96 updates 2020-09-12 00:58:48 -04:00
Goober5000 b96ff92671 update credits 2020-09-12 00:16:16 -04:00
Goober5000 ebe9694dd0 Merge pull request #2736 from Goober5000/fix_display_name
fix display name
2020-09-11 23:44:03 -04:00
Goober5000 09af27d194 fix display name
PR #2718 introduced the Has_display_name flag, but for mission parsing, the parse object flags were cleared subsequent to their assignment.  This moves the flag reset earlier in the function.
2020-09-11 21:03:37 -04:00
JohnAFernandez e29c172f27 Call send_ship before destroying it to avoid a crash. 2020-09-11 08:34:56 -04:00
Goober5000 0104a27795 clean up fiction viewer dialog a bit
Rampage noticed that the dialog would save a fiction viewer entry in some cases even if there was no story file.  This makes the handling a bit more robust.
2020-09-10 22:29:20 -04:00
Goober5000 daf890c080 Merge pull request #2728 from Goober5000/collision_hitpos
add Hitpos as a hook variable for all collision hooks
2020-09-10 12:09:25 -04:00
JohnAFernandez 332183d2e6 Fix declation of waypoint function so it can be used 2020-09-10 01:16:38 -04:00
Goober5000 d61b12bbf1 Merge pull request #2719 from Baezon/ai-store-slotnum
Store and reuse formation object slotnum
2020-09-09 20:47:47 -04:00
Goober5000 de0a9ca9c1 add Hitpos as a hook variable for all collision hooks
Also slightly optimizes some of the hooks because the adding/removing of hook variables should be guarded by the same if() block that controls execution.
2020-09-09 20:04:58 -04:00
Baezon 779ef46e22 s'more tweaks 2020-09-09 19:12:20 -04:00
Goober5000 41d6a46062 Merge pull request #2723 from Baezon/extern-camera-fixes
Two small fixes to the external camera
2020-09-09 14:37:34 -04:00
Goober5000 0cfd11f458 Merge pull request #2726 from Goober5000/fix_lab_ctd
fix a lab CTD
2020-09-09 14:36:58 -04:00
JohnAFernandez 1edf617537 Minor Refactor of Special Character Index Handling
1. Stores the filename from the table Parser into the font struct so we can lookup fonts via their filename.
2. Allow "+Special Character Font:" to specify the first entry with the same filename's special character index for their own special character index, provide a default if not, and allow the moddert to specify them manually, but do not override already recorded values if the default is picked in order to protect retail behavior.
3. Vectorize Special Character Indexes, so that we don't have a table limit that will randomly crash FSO based on what table you happened to write! Woohoo!
2020-09-09 09:05:15 -04:00
Goober5000 2b8687ff6a fix a lab CTD
Only ships have subobjects.
2020-09-09 02:24:50 -04:00
Goober5000 9476a68579 Merge pull request #2722 from scp-fs2open/revert-2706-Get-rid-of-LCL_MAX_FONTS-limitation
Revert "Change special_char_indexes to a vector"
2020-09-08 22:10:20 -04:00
Baezon 5586718e00 review tweaks 2020-09-08 22:05:52 -04:00
Baezon cb0f3461aa v1 2020-09-08 21:42:42 -04:00
Goober5000 c5c65a7031 Merge pull request #2720 from Goober5000/wing_formation_tweak
make wing formation parsing a little more robust
2020-09-08 20:21:59 -04:00
Goober5000 7c2e0ff01e Merge pull request #2718 from Goober5000/fix_zero_length_display_name
support zero-length display names
2020-09-08 20:21:39 -04:00
Goober5000 885e26feb0 Revert "Change special_char_indexes to a vector" 2020-09-08 20:20:21 -04:00
Goober5000 4bf6aaeddc make wing formation parsing a little more robust 2020-09-08 17:31:00 -04:00
Baezon bf4cc21951 v1 2020-09-08 03:05:42 -04:00
Goober5000 f6ca9cddfa support zero-length display names
Previously the code assumed that an empty display name was the same as no display name.  This adds a flag so that empty names are allowed.
2020-09-07 14:38:16 -04:00
Goober5000 4a218ab17a Merge pull request #2706 from JohnAFernandez/Get-rid-of-LCL_MAX_FONTS-limitation
Change special_char_indexes to a vector
2020-09-05 12:28:17 -04:00
Goober5000 0efe912daf Merge pull request #2710 from Goober5000/display_name_save_fix
don't save display name if it's auto-generated
2020-09-05 12:20:18 -04:00
Goober5000 2a77e8300d Merge pull request #2702 from Goober5000/prevent_duplicate_intel
prevent duplicate entries in the Intel room
2020-09-05 12:20:02 -04:00
Goober5000 9b750231d8 Merge pull request #2714 from Baezon/fix-formation-object
Fix a bug with form-on-wing on a object outside the wing
2020-09-05 03:30:17 -04:00
Goober5000 b51b03fca9 Merge pull request #2713 from Baezon/better-extern-camera
Add some quality of life improvements to external camera
2020-09-05 02:02:34 -04:00
Baezon 6e4ee916a0 aip->wingnum instead of shipp->wingnum 2020-09-05 01:38:53 -04:00
Baezon 62465a24f5 swap wingnum and index, moar MAX_SHIPS_PER_WING 2020-09-04 23:29:56 -04:00
Baezon c225cf7b90 autopilot argument 2020-09-04 23:09:59 -04:00
Baezon 303ee3fca1 const objp for object_get_model 2020-09-04 22:29:31 -04:00
Baezon d3eacb1a0f v1 2020-09-04 21:35:40 -04:00
Baezon c2cd958ce6 unused frame_times 2020-09-04 18:04:51 -04:00
Baezon 4df4987b81 v2 2020-09-04 17:36:53 -04:00
Goober5000 68888ef857 made this a little more robust 2020-09-04 13:34:32 -04:00
Goober5000 ceac6ddff2 add multi support for red-alert sexp
This makes the red-alert SEXP execute properly in multiplayer.

Note, this is just the SEXP.  Multi-knowledgeable people will need to evaluate `red_alert_start_mission` and `red_alert_maybe_move_to_next_mission` to make sure those functions will work properly in multiplayer.
2020-09-04 13:15:49 -04:00
Goober5000 1a32680440 patch tests 2020-09-04 01:12:20 -04:00
Goober5000 4e61c16bcd prevent duplicate entries in the Intel room 2020-09-04 01:12:20 -04:00
Goober5000 2f69429ba9 Merge pull request #2703 from Goober5000/audio_pause_unpause_for_f2
handle audio pause/unpause for all of the F2 screens
2020-09-04 00:55:03 -04:00
JohnAFernandez 50e6756bf7 Merge pull request #2707 from Goober5000/fix_mainhall_name
fix main hall indexing in modular tables
2020-09-04 00:32:02 -04:00
JohnAFernandez 69c0954198 Change special_char_indexes to a vector
LCL_MAX_FONTS is kept around just to facilitate parsing of the hardcoded table
2020-09-04 00:03:44 -04:00
Goober5000 b0776a3afa Merge pull request #2711 from asarium/fix/hookVars
Allow overwriting hook variables
2020-09-03 16:09:10 -04:00
Baezon f60e0950e7 v1 2020-09-03 15:24:49 -04:00
asarium 492fe461b0 Allow overwriting hook variables
The previous version used the wrong function for the map and so values
added later were not written to the map and so not available to Lua.

This fixes that by using the simple array operator.
2020-09-03 20:24:22 +02:00
Goober5000 774421a7f4 Merge pull request #2709 from notimaginative/fix_last_pilot_multi
properly set multi flag when using last multi pilot
2020-09-03 09:28:46 -04:00
Goober5000 4de0d8f7e9 don't save display name if it's auto-generated
Follow-up to PR #2674.  The auto-generated display name shouldn't be saved to the mission file.
2020-09-03 09:24:22 -04:00
Goober5000 2251ff5eb9 Merge pull request #2708 from Flip-Sandwich/master
removes int3 in turret firing code
2020-09-03 07:47:10 -04:00
faceman 96fd3889bc changes turret code to log instead of int3 when turret tries to fire on protected ship 2020-09-03 19:41:46 +10:00
Taylor Richards 51692f185b properly set multi flag when using last multi pilot
fixes following cmdline options:
 -connect
 -startgame
 -almission
2020-09-03 05:38:34 -04:00
Goober5000 ce3ca5cf0b Merge pull request #2701 from JohnAFernandez/Fix-miscelaneous-Multi-Bugs
Fix Two Multi Crash Points
2020-09-01 22:39:07 -04:00
Goober5000 9d15b2b02c fix main hall indexing in modular tables
This is a follow-up to #2675 which fixes the main hall naming for halls which have custom names and are not the first resolution.
2020-09-01 21:17:58 -04:00
JohnAFernandez 8bad12d8a2 Fix Two Multi Crash Points 2020-09-01 21:01:35 -04:00
Goober5000 0e1dfa7ab0 Merge pull request #2692 from Baezon/species-wing-positions
Allow for arbitrary wingmate relative positions
2020-09-01 14:38:23 -04:00
Goober5000 91502032e4 Merge pull request #2704 from chief1983/sun/gc-sections-workaround
Don't add --gc-sections linker arg on SunOS
2020-09-01 14:37:58 -04:00
Taylor Richards 3e04e955a4 fix build issues on FreeBSD 2020-09-01 14:36:10 -04:00
Goober5000 8964af428f Merge pull request #2705 from JohnAFernandez/Fix-Shockwave-Damage-Application
Fix 2526 and Add Two Game_setting.tbl flags
2020-09-01 09:02:54 -04:00
JohnAFernandez 6ba811ec6c Fix 2526 and Add Two Game_setting.tbl flags
Fixes 2526 by making the array a vector and also adds a Shockwaves always damage bombs game_setting.tbl setting and a Shockwaves_consistently_apply_damage game_settings.tbl setting.  The second one keeps bombs and asteroids from being hit more than once by shockwaves, like ships do!
2020-09-01 01:47:33 -04:00
Cliff 02cdcae848 gc-sections is misbehaving on SunOS since #2669, so skip the part that adds it to restore old behavior unless a proper fix can be found. 2020-08-31 21:09:07 -05:00
Goober5000 acb0c4cfd8 fix comment 2020-08-31 18:59:38 -04:00
Goober5000 48ea203b7b handle audio pause/unpause for all of the F2 screens
This is a follow-up to #2100.  Don't pause/unpause the audio if we are moving from/to the Control Config or HUD Config screens.  We could hit F2 and move around a bit before resuming the game, so we don't want the audio to resume until we're ready.
2020-08-31 18:02:28 -04:00
Goober5000 782898fba9 mmf 2020-08-31 16:59:58 -04:00
Goober5000 381df6eeb8 formation should now work in fred. 2020-08-31 16:21:30 -04:00
Goober5000 bf949f1ff0 move formations from species_defs.tbl to ships.tbl 2020-08-31 15:44:02 -04:00
Goober5000 9314781932 remove vestigial fred formation code (!) 2020-08-31 15:43:43 -04:00
Goober5000 d82dc93457 update fred dialog rc 2020-08-31 14:48:35 -04:00
Baezon a73c1de7b9 size_t MAX_SHIPS_PER_WING 2020-08-31 00:06:41 -04:00
Goober5000 a710aac4d4 Merge pull request #2593 from JohnAFernandez/Fix-Broken-Could-Be-Player_AI
Change MP Initial Player Wing Ship Behavior to Match SP
2020-08-30 22:01:53 -04:00
Goober5000 d5a7acc4a5 Merge pull request #2700 from Goober5000/more_vector_scripting
add some vector scripting functions
2020-08-30 13:26:45 -04:00
Goober5000 67ea05fefd add some vector scripting functions
createRandomVector
perturb (for vectors)
perturb (for matrixes)
randomInCircle
randomInSphere
2020-08-30 09:36:24 -04:00
Goober5000 2fee91cd4c Merge pull request #2674 from Goober5000/display_name
refactor display_name for ships, ship classes, and weapon classes
2020-08-30 09:21:32 -04:00
m!m 01f11470f3 Merge pull request #2699 from JohnAFernandez/Fix-Multi-Loadout-Bug
Fix the loadout memory bug
2020-08-30 14:55:44 +02:00
Baezon 1fc32dacf5 max ships in wing -1 instead of 5 2020-08-30 00:12:01 -04:00
Taylor Richards d30c0a2024 fix various errors from travis/appveyor 2020-08-30 00:03:14 -04:00
Taylor Richards ff01dc02a7 adjust data type to avoid header conflict 2020-08-30 00:03:14 -04:00
Taylor Richards e401f96cc3 add option to prefer IPv4 DNS addresses 2020-08-30 00:03:14 -04:00
Taylor Richards 9bb9aedc2a add a more robust filter for traffic from ourselves 2020-08-30 00:03:14 -04:00
Taylor Richards dd376b19d9 handle IPv4+IPv6 capable machines in a better way 2020-08-30 00:03:14 -04:00
Taylor Richards 52721dec06 report whether psnet socket is IPv6-only or dual-stack 2020-08-30 00:03:14 -04:00
Taylor Richards 459263b35f fix issues with reliable socket logging
- better error handling for ip string
 - port number in proper byte order
 - anonymize ip address
2020-08-30 00:03:14 -04:00
Taylor Richards 72dd631520 anonymize logged IP addresses 2020-08-30 00:03:14 -04:00
Taylor Richards 83d6d0fd53 bind psnet socket to any address
fixes issue where an IPv6 internet connection would fail
to connect properly if socket is only bound to a local
IPv4 interface
2020-08-30 00:03:14 -04:00
Taylor Richards 3e1b90b8c2 support IPv6 servers from game tracker 2020-08-30 00:03:14 -04:00
Taylor Richards 01ee4d077b make sure we are dual-stack by default (everywhere else) 2020-08-30 00:03:14 -04:00
Taylor Richards 90dbc8f2c3 deal with compiler errors and warnings on Windows 2020-08-30 00:03:14 -04:00
Taylor Richards 426b032882 clean up broadcast_game_query() 2020-08-30 00:03:14 -04:00
Taylor Richards e5044ee6ec port cftp to IPv6 2020-08-30 00:01:00 -04:00
Taylor Richards cff9cdc57d port chttpget to IPv6 2020-08-30 00:01:00 -04:00
Taylor Richards e06026f622 port PXO chat client to IPv6 2020-08-30 00:01:00 -04:00
Taylor Richards db0d0efd55 port PXO tracker client code to IPv6 2020-08-30 00:01:00 -04:00
Taylor Richards 92be33ad9c first pass at IPv6 support 2020-08-30 00:01:00 -04:00
Goober5000 46f410b921 Merge pull request #2698 from EatThePath/free-flight-rename
Renamed free flight speed related tag and variable for clarity and safety
2020-08-29 21:51:26 -04:00
Baezon 518c60dd08 review fixes 2020-08-29 21:50:42 -04:00
JohnAFernandez 143ce0da44 Fix the loadout memory bug 2020-08-29 21:34:02 -04:00
Goober5000 c3febbe01b Merge pull request #2687 from Goober5000/various_colgroup_fixes
various collision group fixes
2020-08-29 18:11:55 -04:00
Goober5000 f756b2a353 Merge pull request #2686 from Baezon/axial-turnrate-differences
Add "$respect ship axial turnrate differences:" flag (and fix a bug with 2673)
2020-08-29 16:49:14 -04:00
Baezon 67d1135c4f cast size() to int 2020-08-29 14:48:37 -04:00
Goober5000 8f7fcc0387 Merge pull request #2683 from TaGenius/feature/qtShipedit
Add ShipEditor to QtFred
2020-08-29 14:34:14 -04:00
Baezon 0aa0c80af8 more than one formation 2020-08-29 14:32:49 -04:00
David Gibson c38b989bb7 Renamed free flight speed related tag and variable for clarity and safety 2020-08-29 13:20:51 -05:00
Goober5000 6f774ccab1 various collision group fixes
Collision groups as previously coded were unusable due to Lua 5.1's lack of support for bitwise operators.  This fixes that deficiency in two ways:
1) Objects now have the functions `addToCollisionGroup` and `removeFromCollisionGroup`
2) An `evaluateNumericSEXP` function has been added for returning SEXP results as numbers (so that the bitwise SEXP operators can be used)
2020-08-29 13:49:36 -04:00
Goober5000 3d734948da Merge branch 'master' into display_name 2020-08-29 13:47:21 -04:00
Goober5000andm!m 05044290df Update code/scripting/api/objs/ship.cpp
Co-authored-by: m!m <[email protected]>
2020-08-29 13:45:30 -04:00
m!m 415151fddc Merge pull request #2641 from EatThePath/free-flight-restoration
Restoring the free flight speed missile table value to functioning
2020-08-29 17:10:07 +02:00
m!m 6953c6a3f5 Merge pull request #2585 from asarium/build/improvePCH
Add pstypes.h to precompiled header
2020-08-29 16:46:55 +02:00
m!m 382f2bdcd2 Merge pull request #2678 from asarium/lua/betterHookVars
Improve scripting hook variable system
2020-08-29 14:20:11 +02:00
Fabian Woltermann 44345fd71c Merge pull request #2696 from The-E/fix/light_from_turret_fired_weapons
Allow non-beam weapons fired from capships to cast lights
2020-08-29 12:54:34 +02:00
asarium b6dc287427 Add pstypes.h to precompiled header
At least on my system that saved ~25% of the compile time (2:01 to 1:33)
so it appears that this is indeed something that help compile
performance.

Also does some house cleaning by using the new PCH command of CMake if
it is available which reduces our dependencies.
2020-08-29 11:26:16 +02:00
asarium 2303785717 Improve scripting hook variable system
The previous system was kind of hacky and made things a bit inflexible.
This improves that system quite a bit and also adds unit tests for the
hook variable functionality.
2020-08-29 10:27:41 +02:00
Fabian Woltermann b01c6d2a82 Weapons fired from turrets have their group_id set to -1 by default and thus would never actually cast any lights 2020-08-29 09:05:08 +02:00
Fabian Woltermann 4f27585878 Merge pull request #2695 from Goober5000/debris_list_fix
handle Hull_debris_list for dynamic debris
2020-08-29 09:04:45 +02:00
Goober5000 d7d986f920 a bit of cleanup, and we only need to run the soft limit check once 2020-08-29 00:28:05 -04:00
Goober5000 eefbc543a0 handle Hull_debris_list for dynamic debris
With dynamic debris, as soon as the Debris vector was reallocated it invalidated the `prev` and `next` pointers.  I figured out how to dispense with the actual list entirely, since we mainly need to know how many hull debris pieces there are and whether an individual piece is on the "list".

This is a follow-up to #2649.
2020-08-29 00:18:39 -04:00
Goober5000 32cad9c1ec Merge pull request #2694 from Goober5000/more_debris_sounds
add more debris sounds
2020-08-28 17:49:45 -04:00
Goober5000 bdf7b23c3a Merge pull request #2693 from Goober5000/case_insensitive_sound_lookup
make sound lookup case-insensitive
2020-08-28 14:33:57 -04:00
Goober5000 1913d8cde2 add more debris sounds
Sounds for debris collision and explosion.
2020-08-28 12:50:40 -04:00
Goober5000 20913a5a90 Merge pull request #2675 from Goober5000/main_hall_override
add the ability to override main halls with modular tables
2020-08-28 11:44:37 -04:00
Goober5000 41df46a14e make sound lookup case-insensitive 2020-08-28 10:32:24 -04:00
Goober5000 9816a80b66 Merge pull request #2681 from Goober5000/more_for_counter_sexps
add for-ship-team and for-ship-species sexps
2020-08-28 09:49:03 -04:00
Goober5000 71ce8229d5 Merge pull request #2682 from Goober5000/fix_name_alignment
fix alignments in the hud gauge parsing
2020-08-28 09:37:29 -04:00
Baezon c1a2cc3959 v1 2020-08-28 00:50:49 -04:00
Baezon 2501b178d7 squash flag arguments and handle formation flying better 2020-08-27 16:50:55 -04:00
Goober5000 64f7b19ca0 Merge pull request #2690 from TRBlount/fix/multilock_ai_lock_set
Properly fix #2685
2020-08-27 16:38:16 -04:00
Cranston 2a669de730 Fix Clang
SOme More

Maybe The Last?

Workaround for false positive
2020-08-27 21:21:11 +01:00
Cranston f08433c106 More Linux FIxes and Name Labels/Layouts
Why is GCC So Fussy?
2020-08-27 21:20:53 +01:00
Cranston 2f4e052cd8 Main Dialog Complete
Try and Fix non windows compile errors

Fix Linux complete error(Hopefully)

More Linux fixes

Nearly There

Maybe?

Why were these in the original? They're never used?
2020-08-27 21:20:04 +01:00
Cranston 697eba8389 Add All form controls 2020-08-27 21:20:00 +01:00
Cranston 7af1eefa2b Enable/Disable Ship UI 2020-08-27 21:19:59 +01:00
Cranston eba1bd9fe6 Initial QTFred Ship Editor
Initial QTFred Ship Editor. Ui is nearly done first column has it core code
2020-08-27 21:19:59 +01:00
Goober5000 82292e4e2b Merge pull request #2679 from Goober5000/misc_enhancements
miscellaneous scripting and ship-destruction enhancements
2020-08-27 13:54:26 -04:00
Goober5000 321a67521f Merge pull request #2684 from Goober5000/some_fred_tweaks
Some fred enhancements
2020-08-27 13:54:10 -04:00
Tyler Blount a8148940be Properly fix #2685 2020-08-27 11:08:31 -06:00
Goober5000 1ce3680259 Merge pull request #2688 from TRBlount/fix/multilock_ai_lock_set
Set ai_info lock variable if the player has any lock slots firing
2020-08-27 12:59:17 -04:00
Tyler Blount c2e9c99ab5 Set ai_info lock variable if the player has any lock slots firing 2020-08-27 00:22:37 -06:00
Goober5000 19922ebf77 put the monitor tracing statements in a better spot 2020-08-27 01:35:02 -04:00
Baezon 6476596b7e less sips, adjusted slow_bank 2020-08-27 00:21:33 -04:00
Baezon 9abc253023 v1 2020-08-26 23:27:34 -04:00
Goober5000 5c19aebf16 add cloning in-place 2020-08-26 00:21:30 -04:00
Goober5000 ef93caa87c update menus, clarify some help stuff, reorder some stuff, get the dock move option working 2020-08-25 18:05:07 -04:00
Goober5000 d8c29faf1b let's try it this way 2020-08-25 17:15:10 -04:00
Goober5000 a606731c40 shut up, clang 2020-08-25 15:11:23 -04:00
Goober5000 1deaa36e07 fix alignments in the hud gauge parsing
Admiral Nelson led me to discover that the HUD gauges expected "right" or no string at all for the gauge alignment.  I added basic recognition of LEFT and RIGHT alignment.  Someone more familiar with the HUD than me can flesh it out more.
2020-08-25 14:52:56 -04:00
Goober5000 a3c32d929f add for-ship-team and for-ship-species sexps
This builds on the previous for-ship-class and for-ship-type sexps.
2020-08-25 13:25:42 -04:00
Goober5000 a19e163a32 Merge pull request #2680 from Baezon/epsilon-fix
Fix usage of float instead of int epsilon
2020-08-25 12:26:37 -04:00
Baezon 8ac2568a7b derp 2020-08-25 00:46:00 -04:00
Goober5000 13bb92348f Merge pull request #2640 from Baezon/orthogonalize
Improve vm_orthogonalize_matrix safety
2020-08-25 00:42:25 -04:00
Goober5000 afc2e51327 Merge pull request #2668 from Baezon/forward-matrix-interpolate
Overhaul forward and matrix_interpolate
2020-08-25 00:40:50 -04:00
Baezon dc413f2168 history comments 2020-08-24 01:01:37 -04:00
Baezon 32665e0028 overshoot padding 2020-08-24 00:50:42 -04:00
Baezon 132bcda055 comments for old names 2020-08-24 00:50:42 -04:00
Baezon 338e049cb1 renaming of functions 2020-08-24 00:50:42 -04:00
Baezon 29b30ab7ad just about ready 2020-08-24 00:50:42 -04:00
Baezon d5b70260e7 almost there 2020-08-24 00:50:00 -04:00
Baezon 0fada393fc wip
version 1

version 2
2020-08-24 00:50:00 -04:00
Baezon c5cf8621a2 expose maybe_normalize and use machine epsilon 2020-08-24 00:11:20 -04:00
Goober5000 d8012d4ff0 miscellaneous scripting and ship-destruction enhancements 2020-08-23 20:44:25 -04:00
David Gibson 69b5f3feb1 Addressed review feedback 2020-08-23 17:23:19 -05:00
Goober5000 2444115b80 Merge pull request #2673 from Baezon/ai-turning-fix
Fix AI banking when in formation
2020-08-23 16:56:32 -04:00
Goober5000 114b0198c3 Merge pull request #2676 from TRBlount/fix/heat_subsys_target
Set target info correctly if the weapon is a HEAT seeker
2020-08-23 16:41:05 -04:00
Goober5000 7bd46265ec Merge pull request #2677 from Goober5000/hook_variable_tweak
temporary hack to increase flexibility of hook variables
2020-08-23 16:21:43 -04:00
Goober5000 788245c33c temporary hack to increase flexibility of hook variables
This allows the coder to test for the existence of a hook variable by comparing it to `nil`.  The engine will currently error out and crash if you try to access a nonexistent table field, which is useful for catching typos, but has the disadvantage of disallowing a perfectly reasonable Lua coding practice.  So this change checks whether the missing field is part of `HookVariables`, and if so, rather than throwing an error, it just prints a message to the log.
2020-08-23 14:18:10 -04:00
Tyler Blount 85a0e92a4f Set target info correctly if the weapon is a HEAT seeker 2020-08-22 22:22:58 -06:00
Goober5000 77bac7a10f Merge pull request #2586 from Baezon/swamers-lead
Add '$Swarmers Lead Targets:' to game_settings.tbl
2020-08-22 08:38:28 -04:00
Fabian Woltermann 1012420370 Merge pull request #2664 from asarium/vulkan/mooooooreSetup
Add more Vulkan setup code
2020-08-22 11:10:14 +02:00
Goober5000 fc786b0473 Merge branch 'master' into swamers-lead 2020-08-21 22:50:25 -04:00
Goober5000 8999a9d633 add the ability to override main halls with modular tables
This adds full modular table support to mainhall.tbl, allowing subsequent tables to override previous main halls, and enabling use of the +nocreate option.
2020-08-21 20:56:59 -04:00
Goober5000 ea32b7ba2e Merge pull request #2667 from Goober5000/overlay_bump
make help overlays dynamic
2020-08-21 19:47:31 -04:00
Goober5000 0bfe80a4ec NULL to nullptr 2020-08-21 11:55:09 -04:00
Goober5000 6c1d29c3ed Merge pull request #2672 from rfht/master
clang 10 build: fix std::unique_lock<Mutex>::unique_lock syntax
2020-08-21 11:48:45 -04:00
Goober5000 10d2f8001c qtfred 2020-08-21 01:03:33 -04:00
Goober5000 3b2af702f7 refactor display_name for ships, ship classes, and weapon classes
Several things going on here:
1) refactor `get_display_string()` to `get_display_name()` to be more precise
2) likewise, refactor `alt_name` to `display_name`
3) automatically generate display names when parsing the ship, ship class, and weapon class for the first time
4) remove the on-the-fly truncation of names with hash symbols

Basically this subsumes the `end_string_at_first_hash_symbol` logic into the display name.  Rather than truncate the name every time it's displayed, truncate it once when it's parsed.  This takes advantage of the previous display name infrastructure, since display names are a superset of the case of truncating the hash symbol.

This also has the benefit of now allowing hash symbols within display names.  When updating Destiny of Peace, I noticed that "Lockheed Shuttle #4" would no longer display properly; and it was not previously possible to fix this even with display names.

I could pull out the `get_display_string()` and `alt_name` renaming into a separate PR if desired.
2020-08-21 00:15:38 -04:00
Baezon ad6e5f9289 nullptr 2020-08-21 00:06:34 -04:00
Baezon 2d1325c9d2 clean up unused variables 2020-08-20 21:28:59 -04:00
Baezon 0857f67875 v1 2020-08-20 20:50:04 -04:00
thfrwn 55a388f96b try_lock -> try_to_lock to fix clang 10 build 2020-08-20 11:37:44 -06:00
asarium fbdb25a10d Add more Vulkan setup code
This adds the Vulkan code for choosing a physical device, creating a
logical device from that and then initializing a swap chain.

This also contains code for filling out the graphics API pointers with
stub functions so that the API functions can be developed gradually.
These changes allow FSO to "run" with Vulkan but nothing is rendered
yet.
2020-08-20 19:08:02 +02:00
m!m 72a853cd39 Merge pull request #2669 from asarium/build/incrementalLinking
Improve Linux linking performance
2020-08-20 19:02:07 +02:00
MageKing17 148392023f Merge pull request #2670 from MageKing17/cleanup/hudartillery-parse-error-reporting
Improve error reporting related to SSM strikes.
2020-08-19 21:21:28 -07:00
Goober5000 b66620e974 Merge pull request #2671 from TRBlount/fix/multilock_snd_loop
Fix missile track loop playing infinitely
2020-08-19 23:57:03 -04:00
Tyler Blount 70bf31fbf6 Fix missile track loop playing infinitely 2020-08-19 20:20:26 -06:00
MageKing17 54f276c6be Improve error reporting related to SSM strikes.
First, in hudartillery.cpp, change some errors to warnings (actually error_display(1, ...) to error_display(0, ...), but same difference).

Second, change a Warning to an error_display(0, ...), and make it actually name the SSM strike instead of just reporting the name of the weapon it's using.

Third, do the weapon_info_lookup() earlier so we can use error_display() to point to the right line, and tell the modder that an invalid weapon invalidates the entire SSM strike (instead of just silently discarding the whole thing at the end).

Finally, in weapons.cpp, change validate_SSM_entries() to mention if Ssm_info is empty (instead of, say, telling the modder that the index needs to be between 0 and 4294967295—or, rather, -1 expressed as an unsigned 32-bit integer, since Ssm_info.size() - 1 is, indeed, -1 when the vector is empty).
2020-08-19 17:08:02 -07:00
asarium 5e1615da58 Improve Linux linking performance
This does two things:
 1. Use thin archives which speeds up static library creation by only
    storing references to the object files instead of copying them all
 2. Allow to use the gold linker with GCC along with an option for
    incremental linking. Since this is undesirable for non-development
    builds it is disabled by default.
2020-08-19 21:16:36 +02:00
Goober5000 0a35d257ca Merge pull request #2665 from TRBlount/fix/multilock_banks
Don't trigger ship_start/stop_secondary_fire assert on empty bank
2020-08-19 14:54:31 -04:00
Tyler Blount 1edba8d795 Handle empty banks correctly 2020-08-19 11:11:13 -06:00
Goober5000 cb76db0402 Merge pull request #2663 from Goober5000/intel_stuff
make Intel stuff dynamic
2020-08-18 19:42:06 -04:00
Goober5000 abed6f503e make help overlays dynamic
With a lot of main hall entries, the MAX_HELP_OVERLAYS limit will get hit.  Pretty simple to just make it dynamic.
2020-08-18 17:12:51 -04:00
Goober5000 8ff676ab1b Merge pull request #2612 from JohnAFernandez/Fix-Client-MP-Campaign-Crash
Patch a Crash Point
2020-08-18 15:10:06 -04:00
Goober5000 9144e161de address feedback and fix tests 2020-08-18 14:53:01 -04:00
Goober5000 88d397a6fc test stuff 2020-08-18 14:53:01 -04:00
Goober5000 1534cc9b2e and fred 2020-08-18 14:53:01 -04:00
Goober5000 b6998a3e21 make Intel stuff dynamic
1) Make Intel_info a vector instead of a fixed-size array
2) Make intel descriptions SCP_string so they can be any length
2020-08-18 14:53:01 -04:00
Goober5000 097b7714a2 Merge pull request #2666 from Goober5000/localization_fix
synchronize localization
2020-08-18 14:52:17 -04:00
Goober5000 e5dec42773 fix tests 2020-08-17 22:03:36 -04:00
Goober5000 cc9733760d match case-insensitive comparison 2020-08-17 21:25:25 -04:00
Goober5000 012ec2ac7a fix localization synchronization
Back in PR #2390, I fixed translation behavior in `lcl_ext_localize_sub` for SCP_string, but neglected to also fix it for `char*`.  This PR remedies that.

I also added `!=0` to the string compare to match the `!=0` used with `strcmp`.
2020-08-17 21:10:48 -04:00
Tyler Blount 4e5631ef70 Merge pull request #2660 from scp-fs2open/revert-2658-revert-2652-update_dds_utils
Revert "Revert "Update DDS Utilities to DX10 Standard""
2020-08-17 16:55:28 -06:00
Goober5000 bedc199dbd Merge pull request #2662 from Goober5000/dockpoint_warning
add warning for duplicate dockpoints
2020-08-17 13:11:06 -04:00
wookieejedi 5c1d49b561 Merge pull request #2622 from Baezon/second-order-lead
Allow for second-order lead indicator prediction
2020-08-17 12:49:44 -04:00
Goober5000 8f469dd00c add warning for duplicate dockpoints
Just for sanity's sake.  This just displays a Warning without modifying the dockpoint name.  I considered an nprintf but figured a Warning was more appropriate.
2020-08-17 00:49:23 -04:00
Tyler Blount 0b3ba445ea Fix WinAPI warnings 2020-08-16 17:35:31 -06:00
Tyler Blount c3c323acd6 Revert "Revert "Update DDS Utilities to DX10 Standard"" 2020-08-15 14:13:11 -06:00
m!m 4362af668a Merge pull request #2656 from asarium/build/optionalOpenGL
Make the OpenGL backend an optional component
2020-08-15 22:06:55 +02:00
Tyler Blount d789be22e3 Merge pull request #2658 from scp-fs2open/revert-2652-update_dds_utils
Revert "Update DDS Utilities to DX10 Standard"
2020-08-15 12:54:11 -06:00
Tyler Blount 5779117e30 Revert "Update DDS Utilities to DX10 Standard" 2020-08-15 12:52:25 -06:00
Tyler Blount 82280b472b Merge pull request #2652 from TRBlount/update_dds_utils
Update DDS Utilities to DX10 Standard
2020-08-15 12:47:49 -06:00
Goober5000 d284ba7241 Merge pull request #2657 from Goober5000/ship_create_protecc
ship-create protecc
2020-08-15 13:16:20 -04:00
m!m bac4d07469 Merge pull request #2655 from asarium/fix/adeDocMemLeak
Fix memory leak in scripting documentation
2020-08-15 12:41:46 +02:00
Tyler Blount 376e67b9ce Fix CI errors 2020-08-14 15:30:06 -06:00
Goober5000 1f4ff04890 handle SEXP_NAN_FOREVER 2020-08-14 16:25:11 -04:00
Goober5000 e4cd5675d0 handle SEXP_KNOWN_* 2020-08-14 15:53:02 -04:00
Tyler Blount ccb6bdc08d Make capability system outputs user friendly 2020-08-14 13:15:47 -06:00
Tyler Blount d35199e5bb Add system for checking mod required rendering features 2020-08-14 11:58:38 -06:00
asarium 4568172287 Make the OpenGL backend an optional component
This can be used for producing even leaner builds for standalone
servers. It also provides a nice architecture verification since now
using internal OpenGL functions will cause a compilation or linking
failure.
2020-08-14 18:52:14 +02:00
asarium dc0e5713e3 Fix memory leak in scripting documentation 2020-08-14 18:38:22 +02:00
Tyler Blount 613913f10f Fix clang-tidy errors 2020-08-14 10:35:28 -06:00
Goober5000 c099ca1abc Merge pull request #2654 from Goober5000/luasexp_soundentry
add LuaSEXP support for soundentry (OPF_GAME_SND)
2020-08-14 11:45:43 -04:00
Goober5000 49e6289d38 Merge pull request #2653 from Goober5000/buffer_fix
use SCP_string instead of fixed buffer
2020-08-14 11:43:49 -04:00
Goober5000 b6b7487db1 add LuaSEXP support for soundentry (OPF_GAME_SND) 2020-08-14 01:18:34 -04:00
Goober5000 8cde06370a Merge pull request #2634 from Baezon/species-class-multilock
Allow multilock missiles to restrict lock based on class or species
2020-08-14 00:46:55 -04:00
Goober5000 cf42e1db68 use SCP_string instead of fixed buffer
With very long mods, this error message can overflow the buffer.  So I changed it to a SCP_string.
2020-08-14 00:07:16 -04:00
Tyler Blount 94f3e1ec77 BC7 now loads correctly
Includes changes to bitmap flags and compiler related fixes
2020-08-13 21:51:11 -06:00
Tyler Blount 2ba7e339b5 Update GLAD and remove old headers 2020-08-13 21:51:11 -06:00
Tyler Blount 2ddfa00670 Add DX11 DDS Header information 2020-08-13 21:51:11 -06:00
Goober5000 ca73feb36b Merge pull request #2651 from Goober5000/for_ship_class
add for-ship-class and for-ship-type sexps
2020-08-13 22:16:59 -04:00
Goober5000 e01c799cc1 Merge pull request #2649 from Goober5000/debris_enhancements
Debris enhancements
2020-08-13 14:21:16 -04:00
Goober5000 de8164aa9c add for-ship-class and for-ship-type sexps
These sexps work just like for-counter, supplying arguments for when-argument.  They will list all ships that are present in the mission and are of a certain class or type.
2020-08-13 14:15:25 -04:00
Goober5000 51ea05068e make the no-disappear flag really prevent the subobject from being blown off, as opposed to blowing it off and then restoring it 2020-08-13 00:38:10 -04:00
Goober5000 2dec0af410 add code to tell if debris is one of those tiny models
make Debris dynamic, and use a soft limit at 64 pieces (the old MAX)
add per-class specification of death roll sounds
2020-08-12 23:51:39 -04:00
Baezon 1f62919a46 cleaner temp lists 2020-08-12 20:56:19 -04:00
m!m 6c3dc57ce4 Merge pull request #2645 from asarium/rocket/moreCmdBriefApis
Add more scripting APIs for the command briefing
2020-08-12 15:41:01 +02:00
asarium 8d8f304514 Add more scripting APIs for the command briefing
This covers the various APIs needed for getting the last parts of the
new command briefing UI to work.
2020-08-12 09:43:09 +02:00
m!m 72bd948852 Merge pull request #2648 from asarium/fix/unbalancedLuaStack
Fix various issues of an unbalanced Lua stack
2020-08-12 09:38:10 +02:00
m!m e9d193f12e Merge pull request #2644 from asarium/scripting/customExecutionContext
Add scripting API for custom execution context
2020-08-12 09:37:50 +02:00
Goober5000 74a8e4b6aa Merge pull request #2639 from Goober5000/secondary_bank_fix
fix crash from multilock merge
2020-08-11 12:55:55 -04:00
asarium b94f12092b Fix various issues of an unbalanced Lua stack
This fixes three issues where the Lua stack was not cleaned up properly:
- On hook execution, the return value was left on the stack
- For ADE initialization, the global tables were left on the stack
- In libRocket, a metatable was left on the stack
2020-08-11 09:45:25 +02:00
asarium 8fcb05bfd0 Add scripting API for custom execution context
This allows a script to create its own execution context so that it can
control when a coroutine is valid to play based on custom data.

Also adds a function which causes a coroutine to end in an error.
2020-08-11 09:38:39 +02:00
Goober5000 be472686f2 Merge pull request #2647 from Goober5000/fireball_filenames
clean up fireball filename init
2020-08-11 02:44:32 -04:00
Goober5000 85d57f56fc Merge pull request #2646 from Baezon/no-black-void
Banish the Black Void
2020-08-11 01:17:48 -04:00
Goober5000 8a607369be clean up fireball filename init
GCC 10.1.0 complained about the filename overwriting itself in the old version of the code.  This was a false positive, but the code wasn't terribly clear, so I cleaned it up a bit.
2020-08-10 22:57:27 -04:00
Baezon 666c2a4402 bool valid vec 2020-08-10 22:31:44 -04:00
Baezon c1942c5359 bool! not int 2020-08-10 22:15:54 -04:00
JohnAFernandez c512eea234 Set Campaign Type For Multiplayer Clients
This allows us to correctly check for campaign type if needed and fixes a variable bug.
2020-08-10 21:27:20 -04:00
Baezon 73d64d9460 review changes 2020-08-10 21:23:27 -04:00
Baezon 573c8b8892 bool return 2020-08-10 19:50:40 -04:00
Baezon d48559d455 double the doubles 2020-08-10 19:09:17 -04:00
m!m 3e7868b663 Merge pull request #2643 from asarium/lua/fixSkipArgs
Capture Ade skip arguments locally
2020-08-10 21:48:55 +02:00
m!m 3596ec5820 Merge pull request #2637 from asarium/build/luaApiExport
Enable dllexport for Lua API
2020-08-10 21:48:32 +02:00
Baezon d92c7a8ea3 doubles for inverting 2020-08-10 15:02:12 -04:00
David Gibson c432c1cce1 Reinstituted freeflight speed parsing and implemented it's use. 2020-08-10 11:18:44 -05:00
Goober5000 514ca1bda9 Merge pull request #2642 from Goober5000/debris_ambient
Several small sound-related enhancements
2020-08-10 09:50:14 -04:00
m!m 4272c2eea5 Merge pull request #2636 from asarium/rocket/scrollingText
Add scrolling text element for libRocket
2020-08-10 12:04:34 +02:00
asarium 31dfa49ebc Capture Ade skip arguments locally
These variables can be used for changing the behavior of the ade_ API
functions. However, they apply to all the ade_get calls so if there is a
call to ade_get_args from an ade_get_args call then it will reuse the
previously set values and produce incorrect results.

This captures those variables as soon as possible and then resets them
so that subsequent calls start with the default values for those
variables.
2020-08-10 09:39:08 +02:00
asarium f12a8ff432 Add scrolling text element for libRocket
This emulates the "scrolling text" effect that is present in briefings.
It is not exactly the same since it just goes pixel wise and not by
character but it looks good enough.
2020-08-10 09:38:30 +02:00
Goober5000 b419d3fac5 Merge pull request #2632 from EatThePath/fix-freeflight
Restored retail-like handling of speed during freeflight time.
2020-08-09 21:34:30 -04:00
Goober5000 00e1a5fcba add collision sounds 2020-08-09 16:58:38 -04:00
Goober5000 83d9d352ff Merge pull request #2604 from Baezon/consistent-apply-whack-args
Supply world coordinates in whack function calls
2020-08-09 15:32:41 -04:00
Goober5000 c9fcbb10da Merge branch 'master' into swamers-lead 2020-08-09 13:53:07 -04:00
Goober5000 e3368be15c Merge pull request #2635 from chief1983/update/libRocket
update/libRocket: Update libRocket to latest master.
2020-08-09 13:03:38 -04:00
Baezon 7e42b36d4a nullptr 2020-08-08 23:26:21 -04:00
Baezon 2b92e10e15 clean up 2020-08-08 21:58:40 -04:00
Baezon 48313c826f v2 2020-08-08 21:16:43 -04:00
m!m 95ebb62de5 Merge pull request #2638 from asarium/lua/audioStreamApi
Add generic audio stream API
2020-08-08 22:22:49 +02:00
Baezon c8cb3d45fc orthogonalize safety 2020-08-08 15:55:33 -04:00
Goober5000 a1a0bd3e0e fix crash from multilock merge
After the multilock PR #2207, ships without secondary weapons will crash the game.  This can easily be seen in the very first training mission of the FS2 main campaign, and it is due to an invalid bank access in `ship_stop_secondary_fire`.  The `current_secondary_bank` is 0, but there are 0 secondary banks.  The Assert catches this, but that's not enough.

This change fixes the crash, as it initializes the current banks to -1 instead of 0.  However I'm not familiar with the new multilock way of doing things so I can't say if that is correct in all cases.
2020-08-08 13:50:31 -04:00
Goober5000 06c6434d44 debris ambient sounds, optional ship sounds, begin collision sounds 2020-08-08 13:49:06 -04:00
asarium 1001bfb760 Add generic audio stream API
The previous API only allowed very limited access to the audio stream
system. These changes add full support for playing all types of audio
streams via a dedicated API.
2020-08-08 19:36:39 +02:00
asarium 646a5d60f8 Enable dllexport for Lua API
This allows external libraries to load the Lua API from our executable
even if it is linked statically. This is useful for a Lua debugger which
needs to interact with the Lua API.
2020-08-08 18:00:52 +02:00
Baezon 847f3229e0 gonna be here all night 2020-08-08 00:48:28 -04:00
Baezon 5a89cac8d1 more c++ 11 2020-08-08 00:21:57 -04:00
Baezon 314e231778 c++ 11-ify 2020-08-08 00:00:38 -04:00
Baezon 6927b5cef1 objectify 2020-08-07 23:28:43 -04:00
Cliff Gordon 5e168bee5f update/libRocket: Update libRocket to latest master. 2020-08-07 09:20:41 -05:00
Baezon ededcd8156 v1 2020-08-07 03:20:26 -04:00
Goober5000 fb4b71c935 Merge pull request #2613 from Baezon/ai-before-physics
Add 'Process AI before Physics' flag
2020-08-06 23:22:58 -04:00
Baezon 860423b577 wip 2020-08-06 20:48:16 -04:00
David Gibson 9ec972f9c4 Restored retail-like handling of speed during freeflight time. 2020-08-05 18:15:03 -05:00
Goober5000 fa6f996827 Merge pull request #2594 from JohnAFernandez/Keep-Connectionless-Players-Out-Of-Multi
Keeps players From Accessing Multi Screens When No Connection Available.
2020-08-05 14:45:05 -04:00
Goober5000 6ac9161469 Merge pull request #2611 from notimaginative/libpcp_solaris
Changes for libpcp to work on Solaris/OpenIndiana
2020-08-05 14:41:35 -04:00
Goober5000 67f4b53c12 Merge pull request #2599 from JohnAFernandez/Fix-Connecting-To-Non-PXO-Games-Specific
Fix Non-Standalone Servers Failing to Switch Between PXO and Non-PXO
2020-08-05 14:40:42 -04:00
m!m 0a970690ec Merge pull request #2623 from asarium/scripting/redAlertMission
Add Lua function for checking for a red alert mission
2020-08-05 18:31:33 +02:00
Baezon b4ec1b32ba better subtype determiner 2020-08-05 01:54:47 -04:00
Baezon 1e56ad942c clarity comment 2020-08-05 01:40:07 -04:00
Baezon f2dae734a3 better comment 2020-08-04 15:41:03 -04:00
Baezon 5b6c7f5d64 assertions
and also if the object isnt a ship it should bail before trying to index Ships[] or compare to MAX_SHIPS
2020-08-04 14:44:32 -04:00
Goober5000 38a3679f37 Merge pull request #2621 from Goober5000/luasexp_modification
add the ability to use multiple sexp parameter variants
2020-08-04 13:57:50 -04:00
asarium 8e108f7745 Add Lua function for checking for a red alert mission
Also fixes a bug in the function that is used by the libRocket pilot
selection UI.
2020-08-04 17:28:01 +02:00
Goober5000 10d98f38bd Merge pull request #2618 from The-E/fix/init_aa_preset_correctly
Make sure gr_aa_preset_last_frame is initialized correctly
2020-08-04 01:20:28 -04:00
Goober5000 d47c4ebff5 Merge pull request #2620 from EatThePath/wep-limit-bump
increased weapon type limit from 300 to 500, matching ship class limit
2020-08-04 01:19:53 -04:00
Baezon fd1204e491 version 2 2020-08-04 00:30:10 -04:00
Baezon c9784bc538 version 1 2020-08-03 23:57:45 -04:00
wookieejedi d411bc9c2d Merge pull request #2619 from wookieejedi/add-extra-primary-link-check
Fix Missing Check for Primary Linking
2020-08-03 22:54:26 -04:00
Goober5000 0ed13a69e7 add the ability to use multiple sexp parameter variants
This is specifically for OPF_SHIP.  Currently if you specify a LuaSEXP with OPF_SHIP, it only works for ships that are present in the mission when the SEXP is called.  This is my attempt at a LuaSEXP parameter variant that will return a valid ship name regardless of the ship status.  It required a bit of finagling the existing API.
2020-08-03 21:26:39 -04:00
David Gibson b601065328 increased weapon type limit from 300 to 500, matching ship class limit 2020-08-03 15:15:23 -05:00
Goober5000 d9b4fab691 Merge pull request #2615 from Goober5000/colgroup2
add new versions of the collision group sexps
2020-08-03 16:13:56 -04:00
wookieejedi eaa419610f Fix Missing Check for Primary Linking
Previously, `ai_link_energy_levels_always` or `ai_link_ammo_levels_maybe` could allow a ship to link weapons even if the `No_primary_linking` flag was setfor that ship. This PR fixes that by added a check for `No_primary_linking` before `ai_link_energy_levels_always` or `ai_link_ammo_levels_maybe` is evaluated.
2020-08-03 16:00:42 -04:00
Tyler Blount bb8bc3b773 Merge pull request #2617 from TRBlount/fix/multilock_snd_banks
Fix for #2616
2020-08-03 11:53:30 -06:00
Fabian Woltermann 657c3b55e2 Make sure gr_aa_preset_last_frame is initialized correctly 2020-08-03 19:46:48 +02:00
Tyler Blount 0caea780a3 Clear locks on successful secondary bank change 2020-08-02 21:38:52 -06:00
Tyler Blount 671301a936 Fix lock sounds not playing correctly with multilock 2020-08-02 16:14:20 -06:00
Goober5000 0177ebd66f add new versions of the collision group sexps
In most cases you have one group to/from which you are adding or removing several ships, but the existing sexps are designed for one ship and many groups.  This adds new sexps designed for one group and many ships.
2020-08-01 00:15:52 -04:00
Goober5000 27940d2f55 Merge pull request #2614 from Goober5000/orientation_editor
Allow actually editing orientations in the orientation editor
2020-08-01 00:14:30 -04:00
Baezon f6603514b1 default value 2020-07-31 23:01:00 -04:00
Baezon a4f7d10391 review changes + functions 2020-07-31 22:20:07 -04:00
Goober5000 b06eac63c8 this threshold makes more sense 2020-07-31 20:13:29 -04:00
Goober5000 53ef41856c add orientation editing 2020-07-31 18:35:01 -04:00
Goober5000 cd04ce24f1 reorder controls for tabbing 2020-07-31 18:33:11 -04:00
Taylor Richards 069e1eea0f clean up defines to avoid multiple lookup types 2020-07-31 18:27:25 -04:00
Goober5000 1bc26c4da1 fred.rc and resource.h changes 2020-07-31 16:32:58 -04:00
Baezon 626c1fc42f travis appeasement 2020-07-30 23:23:10 -04:00
Baezon 385ae2c0b3 travis appeasement 2020-07-30 23:21:08 -04:00
Goober5000 d841d2a91b Merge pull request #2603 from Goober5000/on_debris_created
more complete scripting support for debris
2020-07-30 21:42:05 -04:00
Baezon 4ef217121e flag 2020-07-30 21:23:37 -04:00
Goober5000 46673a6277 Merge pull request #2610 from asarium/doc/makeNewHooksObvious
Add comment about new hooks system to legacy hook list
2020-07-30 16:44:53 -04:00
Taylor Richards cdd50bfc15 make libpcp work on Solaris/OpenIndiana 2020-07-30 16:05:48 -04:00
Goober5000 c868178cc0 Merge pull request #2600 from Goober5000/scripting_rand32
add several more scripting functions
2020-07-30 15:28:01 -04:00
Baezon 20acea31f2 review changes 2020-07-30 15:06:36 -04:00
Goober5000 f2ea3e24b1 use new script hook API 2020-07-30 12:18:52 -04:00
Goober5000 c768d13f33 address feedback 2020-07-30 11:57:09 -04:00
Goober5000 516040c96d Merge pull request #2609 from Goober5000/lua_argument_sanity
add sanity check to Lua SEXP arguments
2020-07-30 11:51:20 -04:00
asarium 33f3b72be1 Add comment about new hooks system to legacy hook list
Since the old system is deprecated it needs to be made obvious that new
hooks should not be added using that system.
2020-07-30 17:15:53 +02:00
Goober5000 2fde6aa69c add sanity check 2020-07-29 21:27:38 -04:00
Goober5000 2dddbaa6ae add some more useful functions 2020-07-29 21:26:16 -04:00
Tyler Blount a212a6042c Merge pull request #2605 from JohnAFernandez/Multilock_Multiplayer_Patch_Final
Multilock Patch
2020-07-29 14:27:48 -06:00
Goober5000 7e8520f375 Merge pull request #2607 from notimaginative/fix_pxo_lobby_crash
Fix pilot info bug and crash in PXO chat lobby
2020-07-29 10:05:19 -04:00
Taylor Richards b5dc556412 fix pinfo crash and bug in PXO chat lobby 2020-07-29 01:22:20 -04:00
JohnAFernandez e979b07ce1 Remove Sneaky Rollback Logic for Dumbfires 2020-07-28 22:01:56 -04:00
JohnAFernandez 9383510388 Multilock Patch 2020-07-28 21:50:55 -04:00
Goober5000 9b7549213d might as well add these too 2020-07-27 13:38:44 -04:00
JohnAFernandez fd18a21482 Fix Non-Standalone Servers Failing to Switch Between PXO and Non-PXO
Add a function to check if PXO is in use rather than just initialized, so that a very important flag can be properly set.
2020-07-27 13:29:58 -04:00
JohnAFernandez cb048132cf Change MP Initial Ship Behavior to Match SP 2020-07-27 13:18:06 -04:00
Baezon f95f48448e world coords for all whacks 2020-07-27 01:11:00 -04:00
Tyler Blount bc4c9f6bea Merge pull request #2207 from TRBlount/multilock_maintain
Merge Multilock
2020-07-26 22:31:18 -06:00
Goober5000 83d2ac8818 more complete scripting support for debris
Adds a hook for debris creation, and adds DoNotExpire and LifeLeft virtual variables for controlling debris removal.
2020-07-26 22:02:51 -04:00
Tyler Blount 530f3e22ac Bump Multiplayer Version
A multiplayer version bump is required as missiles no longer function due to multilock. This will be remedied asap.
2020-07-26 18:38:57 -06:00
Tyler Blount f03f97bbcd Fix Travis CI errors 2020-07-26 18:38:57 -06:00
Tyler Blount c749f41d7f Fix incorrect capitalization for Ships_inited variable 2020-07-26 18:38:57 -06:00
Tyler Blount 02249c5650 Don't reset target restrictions during table load
Prevents an issue with load order causing target restrictions to be reset.
2020-07-26 18:38:57 -06:00
Tyler Blount f64e0396bf Remove unneeded code and some style changes 2020-07-26 18:38:57 -06:00
Tyler Blount b969b45b68 Correctly implement fixes from #73 2020-07-26 18:38:57 -06:00
Tyler Blount 9dbdf06c89 CI and Lock fixes 2020-07-26 18:38:57 -06:00
Tyler Blount eaac6ccfbb Use correct comparison 2020-07-26 18:38:57 -06:00
Tyler Blount 4bdded6650 Fix some CI errors 2020-07-26 18:38:57 -06:00
Tyler Blount 25f0f3fca1 Finally fix no dumbfire
also some miscellaneous changes
2020-07-26 18:38:56 -06:00
Tyler Blount 8413da3352 Perhaps this works? 2020-07-26 18:38:56 -06:00
Tyler Blount a283b93e85 No Dumbfire fix
Another fix for MLMs associated with the No Dumbfire flag.
2020-07-26 18:38:56 -06:00
Tyler Blount f089404520 More fixes
Contains changes related to failed CI builds and feedback.
2020-07-26 18:38:56 -06:00
Tyler Blount 2610bc632a Lost fixes
These were lost during a rebase at one point. Will leave this commit as separate to avoid issues in the future.
2020-07-26 18:38:56 -06:00
Swifty 32c38e696d Initial commit of multilock missile features. 2020-07-26 18:38:56 -06:00
Goober5000 d10fa93c3c Merge pull request #2601 from Baezon/fix-recoil
Fix usage of ship_recoil_modifier
2020-07-26 14:43:29 -04:00
Goober5000 4e5a29454f Merge pull request #2602 from Goober5000/add_otf
add OTF fonts
2020-07-26 11:13:36 -04:00
Goober5000 7f47132e78 add OTF fonts
There are fonts with an .otf extension that are similar to .ttf, and in fact can be opened with our TTF code.  So this adds support for that extension.
2020-07-26 02:10:49 -04:00
Baezon 22a3d57894 add recoil to clone and move 2020-07-26 00:52:21 -04:00
Goober5000 57e4fcd901 trololol... 2020-07-26 00:29:28 -04:00
Goober5000 8bc57c3cd2 add several more scripting functions
Add ba.rand32() and ba.rand32f(), and gr.clear(); enhance streaminganim:process(); fix streaminganim:timeLeft().
2020-07-25 23:21:40 -04:00
Goober5000 2c7fee1c93 Merge pull request #2595 from chief1983/fix/sun_fionbio
fix/sun_fionbio: Load filio.h on Sun for FIONBIO
2020-07-25 11:05:58 -04:00
Goober5000 c860a0e14a Merge pull request #2597 from chief1983/fix/sun_sun
fix/sun_sun: Use 'bgsun' instead of 'sun'
2020-07-25 11:05:50 -04:00
Goober5000 40862bb781 Merge pull request #2598 from Goober5000/fix_special_ship
adjust special_ship index if a ship exits a wing
2020-07-25 11:05:40 -04:00
Goober5000 66ee735ebe Merge pull request #2596 from chief1983/fix/sun_renderdoc
fix/sun_renderdoc: Make Solaris a recognized platform for renderdoc.
2020-07-25 11:04:50 -04:00
Goober5000 673a0c60a2 adjust special_ship index if a ship exits a wing
If a ship is destroyed or departed, the special_ship index would get out of sync.  This fixes that.
2020-07-24 23:45:57 -04:00
chief1983 ce7ba67843 fix/sun_sun: 'sun' is a reserved keyword on Sun, so use bgsun here instead. 2020-07-24 17:49:50 -05:00
chief1983 387c9e4a9c fix/sun_renderdoc: Make Solaris a recognized platform for renderdoc. 2020-07-24 17:48:10 -05:00
chief1983 fd5fba62aa fix/sun_fionbio: This include is needed on Sun platforms for it to have access to FIONBIO. 2020-07-24 17:45:16 -05:00
JohnAFernandez 58b35f9348 Keeps players From Accessing Multi Screens When No Connection Available.
Leaving the ability to go onto the multi screens will cause undesired behavior and asserts. (like trying to validate the tables when there is no connection in the first place.)  Also only sets the game state to multi once we're sure that we're going to enter a multi game.
2020-07-24 13:17:31 -04:00
Goober5000 fdc160807f Merge pull request #2581 from Goober5000/dont_bank_ship_flag
add ship-maneuver flags to ship_info
2020-07-24 12:35:43 -04:00
Goober5000 91007d9f83 Merge pull request #2592 from Goober5000/fix_get_line_num
fix line number counting
2020-07-24 01:29:28 -04:00
Goober5000 8ca10d46be fix line number counting
When I rewrote `strip_comments()` to take quotes into account, I didn't correspondingly update `get_line_num()`.  This fixes that.  I discovered that a Lua file with a lot of semicolons inside quotes was erroneously getting the past-EOF warning.

Also, in the event that the warning *is* tripped, this exits the loop instead of repeatedly displaying the warning.
2020-07-23 23:46:12 -04:00
Baezon 27544e781a Revert "no homing when out of range"
This reverts commit eebfb7eadb.
2020-07-23 21:12:51 -04:00
Goober5000 207227038f Merge pull request #2587 from Goober5000/additional_vecmat_scripting
Additional scripting enhancements
2020-07-23 16:49:28 -04:00
Goober5000 6e40248490 add vector interpolation, sexp variable name, and joystick axis inversion
add several more vecmat functions to scripting
2020-07-23 14:43:02 -04:00
Baezon eebfb7eadb no homing when out of range 2020-07-23 12:30:28 -04:00
m!m a302d1ac00 Merge pull request #2588 from asarium/build/optionalVulkan
Make Vulkan an optional component
2020-07-23 17:55:14 +02:00
Baezon e6938bd14d verison 1 2020-07-22 23:48:53 -04:00
Baezon 1f1d7065cd v1 2020-07-22 23:26:06 -04:00
Goober5000 f1cd5be6ed Merge pull request #2543 from Goober5000/fix_sexp_hint
fix sexp auto-complete for manually-entered text
2020-07-22 15:20:50 -04:00
asarium bc0ea7d929 Make Vulkan an optional component
This makes it possible to still compile FSO on platforms that are not
supported by the Vulkan headers.
2020-07-22 18:20:59 +02:00
Goober5000 cd2a0437e0 Merge pull request #2573 from Goober5000/tech_db_scripting_vars
cleanup of tech room, and scripting stuff
2020-07-21 22:38:58 -04:00
Goober5000 e499e651c7 Merge pull request #2583 from Goober5000/orientation_enhancements
add scripting function to create matrix from vectors
2020-07-21 17:26:42 -04:00
Goober5000 fd30238743 Merge pull request #2555 from Baezon/whack-fix
Fix physics whack for docked ships
2020-07-21 15:30:16 -04:00
Baezon 8bd033705f swarmers lead targets 2020-07-21 14:48:24 -04:00
Goober5000 7634f55ae9 Merge pull request #2584 from JohnAFernandez/Fix_Retail_Weapon_Energy_UBER_BUG
Move unsetting of Wep Cheat to Gamestate code
2020-07-21 14:48:24 -04:00
Goober5000 709208bff4 address feedback 2020-07-21 14:46:06 -04:00
Goober5000 096218a324 address feedback 2020-07-21 14:36:57 -04:00
Goober5000 3833881f8e Merge pull request #2411 from notimaginative/fix_pxo_stats
fix various issues with PXO stats
2020-07-21 01:59:00 -04:00
JohnAFernandez fd7af0bdf8 Move unsetting of Wep Cheat to Gamestate code
Where it belongs.
2020-07-21 01:52:02 -04:00
Goober5000 0071fbde1a add scripting function to create matrix from vectors 2020-07-20 21:58:02 -04:00
Goober5000 712bb1fe89 add ship-maneuver flags to ship_info 2020-07-19 22:27:38 -04:00
Baezon a6f060e128 clarity edits 2020-07-19 15:06:29 -04:00
Baezon 34b04b1ca8 PR review fixes 2020-07-18 22:28:51 -04:00
Goober5000 f03df9e7cc Merge pull request #2579 from JohnAFernandez/Return-To-PXO-After-Re-enable
Go back to login if you're trying to use PXO
2020-07-18 13:34:47 -04:00
Goober5000 192272a914 Merge pull request #2450 from JohnAFernandez/Fix_Ai_messaging
Allow Team Leaders to Send Messages
2020-07-18 13:33:50 -04:00
Fabian Woltermann fd2f9cc326 Merge pull request #2570 from Goober5000/vm_vec_mag_quicker
make _quick quicker
2020-07-18 18:55:57 +02:00
Fabian Woltermann 714514533b Merge pull request #2580 from JohnAFernandez/Fix-minor-pxo-screen-rendering-bug
Fix sidebars retaining old rendering from mission quick exit
2020-07-18 18:54:45 +02:00
Baezon 6e7908833a more fix 2020-07-17 23:40:51 -04:00
JohnAFernandez b7d7ebe6cf Allow Team Leaders to Send Messages and use ship registry to look up the team and slot
Team Leader function was returning 0 instead of 1 when the team captain was messaging AI.

This optimizes, cleans up, and gets rid of edge-case buggy behaviour.  Thank you ship_registry!
2020-07-17 22:44:24 -04:00
JohnAFernandez 185d12859c Fix sidebars retaining old rendering from mission quick exit
And also a minor typo
2020-07-17 22:26:57 -04:00
Baezon c49cf7fd6a bugfix 2020-07-17 21:00:26 -04:00
Baezon 06322bb977 better names and const fix 2020-07-17 20:07:09 -04:00
JohnAFernandez f832b5baf1 Go back to login if you're trying to use PXO 2020-07-16 22:33:47 -04:00
Goober5000 2191bf9265 Merge pull request #2577 from notimaginative/inputbox_paste
Allow pasting clipboard contents into input boxes
2020-07-16 21:21:11 -04:00
Goober5000 559e38d0cf Merge pull request #2575 from Baezon/fix-moi-init
Improve physics_ship_init safety
2020-07-16 21:21:02 -04:00
Goober5000 d9dd116199 Merge pull request #2578 from Goober5000/fix_show_subtitle
fix show-subtitle
2020-07-16 21:20:28 -04:00
Goober5000 f8f6bbc53c fix show-subtitle
For older campaigns which used show-subtitle, the eval_num conversion inadvertently changed the rgb to default to 0, instead of 255.  This restores the default to 255.
2020-07-16 15:30:52 -04:00
Taylor Richards d778c5864d paste from clipboard into inputbox 2020-07-16 11:52:36 -04:00
Fabian Woltermann 90d3a275ea Merge pull request #2576 from notimaginative/pxo_query_bomb_fix
Fix query bomb in PXO game tracker
2020-07-16 13:58:39 +02:00
Taylor Richards a03cd49d0c fix loop to use reference 2020-07-16 03:20:15 -04:00
Baezon 2d1ae42db0 more specific comments 2020-07-15 23:47:32 -04:00
Baezon ef42b545cf initial commit 2020-07-15 18:15:21 -04:00
Goober5000 e0437727dc Merge pull request #2568 from notimaginative/pxo_game_tracker_cleanup
Clean up PXO client-side game tracker
2020-07-15 13:28:02 -04:00
Goober5000 31fa2ac444 cleanup of tech room, and scripting stuff
1) Upgrade the pilot file code to correctly save flags whether entries are added *or* removed
2) Make the tech-db/tech-db-multi ship flag handling consistent
3) Add scripting support for intel entries
4) Add scripting support for adding and removing entries from the tech room
5) Minor cleanup
2020-07-15 13:27:27 -04:00
Goober5000 e4f7bc8c57 Merge pull request #2572 from Baezon/shockwave-fix
Randomized weapon shockwave orientations
2020-07-15 13:08:59 -04:00
Goober5000 a5667010e1 Merge pull request #2574 from Baezon/no-infinity
Add infinity to invalid vector criteria
2020-07-15 13:01:43 -04:00
Baezon 8de1248713 no infinite vectors allowed 2020-07-15 01:10:47 -04:00
Baezon 8fdc11180f cleaner tau 2020-07-14 12:06:42 -04:00
Goober5000 92bd872caf Merge pull request #2562 from JohnAFernandez/Fix-Standalone-Interactive-Dialog-Crashes
Fix Standalone Crashes
2020-07-14 09:41:00 -04:00
Goober5000 8ffdbba488 Merge pull request #2571 from Baezon/no-docking-collision
Prevent indrectly docked ships from colliding
2020-07-14 09:40:41 -04:00
Goober5000 28c8c3000f Merge pull request #2569 from Goober5000/robustify_json_string
some UTF-8 improvements
2020-07-14 09:40:07 -04:00
Baezon de80a3bacc better name 2020-07-14 01:42:22 -04:00
Baezon 12d6422556 no collision for dockING ships either 2020-07-13 23:51:05 -04:00
Baezon 3adf6e4553 No indirect docking collision 2020-07-13 21:50:07 -04:00
Goober5000 d6b3d8cba7 remove old tests 2020-07-13 20:52:26 -04:00
Goober5000 815de46c6d make _quick quicker
The functions derived from `vm_vec_mag_quick` run *slower* than `vm_vec_mag`, according to @Baezon who did some testing.  So this PR makes all calls to the _quick functions use their more accurate counterparts.
2020-07-13 20:49:50 -04:00
Baezon 5fa9d17cc5 randomized shockwave orientations 2020-07-13 20:15:20 -04:00
Goober5000 8b310a3e08 Merge pull request #2564 from Baezon/cargo-no-recover
Prevent cargo containers from recovering from a collision
2020-07-13 16:05:36 -04:00
Goober5000 4bd49c2b95 address feedback 2020-07-13 15:43:47 -04:00
Goober5000 c13a3330f6 some UTF-8 improvements
1) Write all non-UTF-8 strings to JSON, either by converting or truncating
2) Add `coerce_to_utf8` function
3) Tweak `read_raw_file_text` because the function returns length on success, not 0
2020-07-13 14:33:28 -04:00
Goober5000 7744e177c5 Merge pull request #2567 from Baezon/quick-dist-fix
Relative error for mag and dist_quick, and seeded vecmat tests
2020-07-12 14:33:17 -04:00
Taylor Richards 7db6662978 avoid querying tracker at LAN refresh internals 2020-07-12 14:00:57 -04:00
Taylor Richards 72a610574e set and update game data properly 2020-07-12 13:30:18 -04:00
Baezon 1512e7c8c2 moar bugfix 2020-07-12 12:53:05 -04:00
Goober5000 b49ea7b4c2 Merge pull request #2566 from Goober5000/fix_fred_node_correction
fix FRED's verify_and_fix_arguments
2020-07-12 12:33:34 -04:00
Baezon 96239d4117 formatting 2020-07-12 12:28:19 -04:00
Taylor Richards 4220a426d6 fix gtrack updates to work more reliably 2020-07-12 12:12:59 -04:00
Baezon e0e74c8277 bugfix 2020-07-12 03:51:31 -04:00
Baezon a5a41e8ea6 Review adjustments 2020-07-12 03:14:01 -04:00
Baezon c497aa32d5 relative error for mag and dist_quick, and seeded tests 2020-07-12 00:33:13 -04:00
Goober5000 412c0310d3 Merge pull request #2565 from Goober5000/fix_destroy_before_mission
sometimes the FSO code is like Jenga
2020-07-12 00:28:09 -04:00
Goober5000 42314e5a58 fix FRED's verify_and_fix_arguments
This was a fun one.  Volition used a bizarre and very poorly named "flag" static variable to track iterations through the `verify_and_fix_arguments` function.  I'm not sure how this actually works, but on comparing with the original public source code I see that @asarium didn't quite fix the "declaration masks class variable" compiler warning the right way.  This rolls back that 2016 change and fixes it properly.

The effect of this fix is so that FRED will correctly handle arguments when node data types change, such as when the modify-variable argument is changed from a numeric variable to a string variable.
2020-07-11 23:44:24 -04:00
Goober5000 b12d0986c5 sometimes the FSO code is like Jenga
The #2528 fix broke ships destroyed before mission start because their arrival delay was *already* set up (as a bogus timestamp).  So this change adds a special exception for that.
2020-07-11 22:34:09 -04:00
Baezon c6cbb1f380 Cargo containers won't recover from collisions 2020-07-11 20:18:24 -04:00
Goober5000 ecc678c1e5 Merge pull request #2561 from Goober5000/traitor_cleanup
traitor table addendum
2020-07-11 11:10:07 -04:00
Baezon abe17c7885 comment fix 2020-07-11 02:01:17 -04:00
Baezon 17613e0612 Only one whack
re-factored so that only the 'dock root' is whacked, all other docked ships will adjust to match the root
2020-07-11 00:05:10 -04:00
Baezon b6f1ceeabd PR review changes 2020-07-11 00:05:10 -04:00
Baezon eb64241355 Assert -> Assertion and made a bunch of them 2020-07-11 00:04:48 -04:00
Baezon 3178ef593e NULL -> nullptr 2020-07-11 00:04:48 -04:00
Baezon 47418008f4 unused variable clean up 2020-07-11 00:04:48 -04:00
Baezon 9b33685598 Fix physics whack for docked ships
Properly whacks all ships that are docked together when any are whacked, makes everything more consistent by calling ship_apply_whack instead of physics_apply_whack, whacking in general now unrotates its hit pos to get a world pos like physics whack was expecting and adds a few matrix helper functions.
2020-07-11 00:04:48 -04:00
Goober5000 cc3ebaf965 Merge pull request #2556 from Baezon/vecmat
Addition of matrix3 functions in vecmat
2020-07-10 23:54:05 -04:00
JohnAFernandez 48ccd37d09 Fix Standalone Crashes
Standalones would crash if they had an error dialog pop up because of a nullptr.  This just checks for the nullptr and returns early to prevent the crash.
2020-07-10 23:44:01 -04:00
Goober5000 587abefb45 upon further consideration, the text is what depends on the persona 2020-07-10 21:21:03 -04:00
Goober5000 5951d05587 Merge pull request #2559 from Goober5000/debriefing_persona_enhancements
Debriefing persona enhancements
2020-07-10 21:03:04 -04:00
Baezon 32baf3dc5c Even more appveyor appeasement 2020-07-10 20:23:36 -04:00
Baezon da9442261a more appeasing of appveyor 2020-07-10 13:31:33 -04:00
Baezon 81980e3486 make dist_quick slightly more permissive 2020-07-09 22:42:37 -04:00
Baezon b9fd69285d remove unused variable 2020-07-09 21:54:57 -04:00
Baezon 453a3f213d Merge The_E's vector test functions 2020-07-09 20:39:19 -04:00
Goober5000 baa1bd2a18 Merge pull request #2558 from Goober5000/fix_skipmemymissionyo
fix skipmemymissionyo
2020-07-09 13:50:53 -04:00
Goober5000 a5b8c7b376 add debriefing persona sexp and make a few additional tweaks 2020-07-09 12:49:38 -04:00
Goober5000 26f4531300 fix skipmemymissionyo 2020-07-09 11:47:07 -04:00
Goober5000 1304a36c96 parse traitor.tbl at game launch, and select persona-specific text 2020-07-09 11:18:40 -04:00
Baezon 82c13da494 Added vecmat test
also trying to placate appveyor by using a variable instead of a literal i guess?
2020-07-09 00:34:25 -04:00
Goober5000 e40e54abc0 Merge pull request #2557 from Goober5000/fix_numeric_arguments
Fix numeric arguments
2020-07-08 16:52:32 -04:00
Goober5000 d4053ea2e9 fix <argument> in numeric nodes, and also fix more error printing 2020-07-08 14:51:52 -04:00
Goober5000 4250a4e2bb fix error variable printing 2020-07-08 13:50:12 -04:00
Baezon f4794341bb bugfix 2020-07-08 01:32:49 -04:00
Baezon f1a3ac449e Addition of matrix3 functions in vecmat
Added inverse, add, add2, sub, sub2 and a ZERO_MATRIX.
2020-07-08 00:51:06 -04:00
Goober5000 d7922c843a Merge pull request #2553 from Goober5000/fix_has_xstr
fix XSTR lookup for $Has XSTR:
2020-07-07 18:18:52 -04:00
Goober5000 b319d97b2a fix XSTR lookup for $Has XSTR:
If we specify an XSTR index, we want the internal control lookup to happen regardless of whether the game is running in untranslated mode or not.
2020-07-07 13:34:53 -04:00
Goober5000 07c8f0945b Merge pull request #2547 from Goober5000/event_flags_polishing
lazily write the flag list to prevent empty flag lists
2020-07-07 12:02:51 -04:00
Fabian Woltermann 4819f25c58 Merge pull request #2551 from Goober5000/fix_mantis_2871
fix Mantis 2871
2020-07-07 16:06:19 +02:00
Goober5000 101a1573fa Merge pull request #2550 from Goober5000/fix_mantis_2181
fix Mantis 2181
2020-07-06 23:38:23 -04:00
Goober5000 0c53682ab8 fix Mantis 2871
There was an AI class validity check for the pilot, but not for turret weapons.  This fixes that.

Also, the p_object parameter to this functino was named `objp`, which is misleading because that's usually used for object.  I renamed it p_objp.
2020-07-06 21:39:10 -04:00
Goober5000 36bd7d4c61 Merge pull request #2542 from Goober5000/clear_debris_sexp
add clear-debris sexp
2020-07-06 21:10:17 -04:00
Goober5000 392d9f6dbb fix Mantis 2181
This just uses vm_vec_normalize_safe.  If two objects spawn on top of each other, the code will now sort them properly without printing a null vec3d warning.
2020-07-06 21:04:24 -04:00
Goober5000 5480c004f5 Merge pull request #2548 from Goober5000/fix_endgame
fix the special-warpout-name sexp
2020-07-06 20:29:30 -04:00
Goober5000 d7832b4b39 fix the special-warpout-name sexp
grrr...
2020-07-06 18:42:35 -04:00
Goober5000 4b45a8602d Merge pull request #2546 from Goober5000/fix_get_damage_caused
fix copy-paste mistake
2020-07-05 11:45:38 -04:00
Goober5000 f3672ad12f lazily write the flag list to prevent empty flag lists 2020-07-04 16:44:30 -04:00
Goober5000 4e85009596 fix copy-paste mistake 2020-07-04 15:09:56 -04:00
Goober5000 7a9bd1cfaa blah 2020-07-03 16:48:05 -04:00
Goober5000 d293a9c18b api compatibility 2020-07-03 16:33:49 -04:00
Goober5000 9337c8a4b3 fix compilation 2020-07-03 16:09:59 -04:00
Goober5000 d1e0112cd2 Merge pull request #2541 from Goober5000/background_fix
fix background bug when loading subsequent missions
2020-07-03 16:05:40 -04:00
Goober5000 1a928632e0 fix sexp auto-complete for manually-entered text
The old way of finding the closest match of sexp text to entered text didn't work very well.  This method uses Levenstein distance.
2020-07-03 16:00:43 -04:00
m!m 7cd9359dec Merge pull request #2519 from asarium/feature/externalSexps
Add system for adding SEXPs externally
2020-07-03 19:56:11 +02:00
Goober5000 ef1f462c3b add clear-debris sexp
Simiar to the clear-weapons sexp (renamed from remove-weapons).
2020-07-03 13:34:39 -04:00
Goober5000 cc707264ae fix background bug when loading subsequent missions
FRED's handling of mission loading and creation is a bit wonky.  The `stars_post_level_init()` function should run for each new mission, not just once when FRED is started.  That fixes a background editor crash and I also did a bit of other cleanup.
2020-07-03 12:44:43 -04:00
asarium 62d6b3c834 Add system for adding SEXPs externally
This adds a "clear-debris" SEXP with a new system for declaring SEXPs
outside of sexp.cpp. This makes it easier to keep code modules self
contained since they do not need to export previously private
functionality just for having missiong being able to interface with it.

This is mostly a proof-of-concept which only supports basic parameter
types (booleans and integers).
2020-07-03 18:13:47 +02:00
Goober5000 cb9803a20a Merge pull request #2540 from Goober5000/dock_leader_message
clarify these warnings based on feedback
2020-07-02 18:43:54 -04:00
Goober5000 4a21436b9a Merge pull request #2536 from Goober5000/change_background_sexp
allow switching between multiple backgrounds
2020-07-02 14:56:22 -04:00
Goober5000 d2625be6d8 clarify these warnings based on feedback 2020-07-02 14:25:23 -04:00
Goober5000 42e2c71ca1 Merge pull request #2538 from Goober5000/fix_ship_registry
fix ship registry in regards to wings with multiple waves
2020-07-02 11:47:21 -04:00
Goober5000 e34506d40d Merge pull request #2537 from Goober5000/fix_missing_sexp_error_checks
fill in two missing error checks, and tweak a few others
2020-07-02 01:29:54 -04:00
Goober5000 d440d29d21 fix ship registry in regards to wings with multiple waves
The ship registry previously stored the ship name as a pointer, but that pointer was reused when subsequent waves of a wing overwrote a p_object from the first wave.  So, the name is now copied into an array.

Additionally, subsequent waves of a wing are now "eagerly" stored in the ship registry so that the p_object reference can be stored as well.
2020-07-02 01:23:55 -04:00
Goober5000 69234e3a3c make qtfred happy 2020-07-02 00:46:12 -04:00
Goober5000 595a2f884a make clang happy 2020-07-01 23:53:19 -04:00
Goober5000 c3f58c3cf5 fill in two missing error checks, and tweak a few others 2020-07-01 23:46:38 -04:00
Goober5000 7e947e522e allow switching between multiple backgrounds
For quite some time missions have had the ability to edit more than one background.  This was previously used for fallback loading in case the first background's bitmaps were not available, but I realized it would be very handy to allow switching between backgrounds for in-mission jumps.

The FRED background dialog can now add and remove backgrounds from the list.  Additionally, a new `change-background` sexp can instantly switch between backgrounds without messing around with bitmap references.
2020-07-01 23:32:12 -04:00
Goober5000 48080abbb5 Merge pull request #2534 from Goober5000/fix_hud_message_offset
fix HUD message offset for messages that come from [none]
2020-06-30 17:57:37 -04:00
Goober5000 9359362ea6 make clang happy 2020-06-30 14:23:18 -04:00
Goober5000 a8d0123d63 Merge pull request #2522 from CasparKielwein/ck/cleanup_sexp.cpp
small cleanup in  sexp.cpp
2020-06-30 13:33:07 -04:00
Goober5000 65cdb0232d fix HUD message offset for messages that come from [none]
Tracked down another Volition bug, first reported by recead.  When messages do not have the ": " substring (which only happens when they are from MSG_SOURCE_NONE), they would calculate the wrong string size.  This is because the two-character offset was added to the pointer *before* the pointer was checked for null, and so non-matches were considered matches with strings beginning at memory offset 2.
2020-06-30 13:13:48 -04:00
Goober5000 16bfeee6e1 Merge pull request #2529 from Goober5000/patch_exited_sexps
handle vanished ships for sexps that check exited_index
2020-06-30 02:12:36 -04:00
Goober5000 ec7bac99b5 handle vanished ships for sexps that check exited_index
When ships vanish, they are in the EXITED state but their `exited_index` is -1 *and* their `shipp` pointer is null.  So check for this.
2020-06-29 22:43:32 -04:00
Goober5000 d9ea352dab Merge pull request #2528 from Goober5000/fix_arrival_delay_handling
fix arrival delay handling
2020-06-29 22:13:55 -04:00
Goober5000 36d93db0a4 fix arrival delay handling
Volition's arrival code used eager evaluation of arrival cues even before the mission was finished parsing.  With the new sexp optimization code, this can fail because the sexps can depend on ships which are not even parsed yet and thus are not in the ship registry.  So I moved the arrival_delay initialization and added some comprehensive comments explaining what is going on.
2020-06-29 18:29:00 -04:00
CasparKielwein a8398629d7 in Sexp add to uncalled functions to list of multi_sexp_* calls.
Fix: Call multi_sexp_reset_time_compression instead of non-multi version
2020-06-29 21:58:45 +02:00
CasparKielwein cbb3fda960 in sexp.cpp use make indentation consistent using tabs 2020-06-29 21:58:45 +02:00
CasparKielwein cb5a406204 In sexp.cpp a bit of trivial cleanup as requested by clang-tidy. 2020-06-29 21:58:45 +02:00
CasparKielwein ad0b0ba07a In sexp.cpp remove a few unused functions and variable declarations.
Only code was removed where no reference in the whole project could be found.
Redundant declarations are already imported through inludes.
2020-06-29 21:58:45 +02:00
Goober5000 90163e8208 Merge pull request #2524 from Goober5000/does_not_move_ai
a few fixes for ships which shouldn't move
2020-06-29 00:12:04 -04:00
Goober5000 b5f59c7efc a few fixes for ships which shouldn't move
1) Prevent ships from turning in `ai_turn_towards_vector` if they have the `immobile` flag.  This was missed because it is a rotation that doesn't originate in `obj_move_call_physics`.
2) Prevent ships from evading shockwaves if they're playing dead.

Also there is a small conversion of an int to a bool.
2020-06-28 20:08:29 -04:00
Fabian Woltermann f755af02b9 Merge pull request #2521 from The-E/fix/local_ssms
Fix issue with local ssms not actually working correctly when being fired from a turret
2020-06-28 18:36:53 +02:00
Fabian Woltermann 064fe31df7 When resolving targets for local ssms, check both the weapon's target_num _and_ it's tracking info. 2020-06-28 10:20:46 +02:00
CasparKielwein 4f384d56ef in sexp.cpp replace NULL with nulltpr 2020-06-27 20:58:24 +02:00
Goober5000 c44e681c58 Merge pull request #2518 from Goober5000/constify_ctext
constify CTEXT
2020-06-27 12:16:10 -04:00
wookieejedi a065b7b967 Merge pull request #2514 from wookieejedi/min-range-ai
Allow AI Flag Use Primary Range to work with Min Range Too
2020-06-27 09:29:06 -04:00
Goober5000 7bb5a1d0fc fix CI complaints 2020-06-26 16:04:12 -04:00
Goober5000 51864a08ae reorder functions 2020-06-26 14:47:40 -04:00
Goober5000 5bc1d9da30 constify_ctext 2020-06-26 14:47:39 -04:00
Goober5000 3fc8b307f0 Merge pull request #2513 from Goober5000/more_sexp_caching
giant refactor of sexps to use caching for ships and wings
2020-06-26 14:40:48 -04:00
Goober5000 498ee4ca2d Merge pull request #2515 from Goober5000/fix_2512
better handling of non-truncated hotspot sounds
2020-06-26 12:59:57 -04:00
Goober5000 39858fdfe0 giant refactor of sexps to use caching for ships and wings 2020-06-26 12:59:31 -04:00
Goober5000 921ee8668b better handling of non-trucated hotspot sounds
The cause of the #2512 bug was using the new main hall to look up sounds from the old main hall, which would crash in several cases.  The lookup was performed when testing whether or not to truncate a door sound when changing screens or states.  Dan Wentz requested that "glowy" sounds not be truncated, so this preserves that check.  Rather than test the indexes of the door regions, this tests the indexes of the sounds in sounds.tbl.

Right now the retail sound indexes are hard-coded, but it would be easy to make this configurable from mainhall.tbl if modders wanted that ability.

This fixes #2512.
2020-06-25 17:51:43 -04:00
wookieejedi f390829e91 Allow AI Flag Use Primary Range to work with Min Range Too
The ship table value `+Weapon Min Range:` was ever used for turret firing calculations. This PR adds it as part of the cacluation for other instances, but only if the AI flag `Use_actual_primary_range` is used.
2020-06-25 17:23:55 -04:00
Goober5000 a9122b7e93 Merge pull request #2511 from Goober5000/upgrade_misc_sexps_5
upgrade yet more miscellaneous sexps
2020-06-25 11:17:40 -04:00
Goober5000 233c86b0d4 Merge pull request #2506 from Goober5000/subsys_rotation
upgrade sexps affecting rotating submodels
2020-06-25 11:17:20 -04:00
niffiwan 647081a547 Merge pull request #2492 from asarium/feature/scriptingTypesValidation
Validate scripting documentation type names
2020-06-25 17:05:38 +10:00
Goober5000 0099e0a1c9 Merge pull request #2504 from Goober5000/upgrade_misc_sexps
upgrade misc sexps
2020-06-24 18:23:03 -04:00
Goober5000 6001065901 smol tweak 2020-06-24 14:06:56 -04:00
Goober5000 6d2e653dd1 upgrade yet more miscellaneous sexps 2020-06-24 14:05:27 -04:00
Goober5000 137090fd81 Merge pull request #2510 from Goober5000/upgrade_misc_sexps_4
upgrade some more miscellaneous sexps
2020-06-24 13:53:33 -04:00
Goober5000 5f92d4f3cd Merge pull request #2509 from Goober5000/upgrade_weapon_create_and_ship_effect
upgrade weapon-create and ship-effect
2020-06-24 13:50:31 -04:00
Goober5000 5dca2a95a8 Merge pull request #2508 from Goober5000/upgrade_misc_sexps_3
upgrade armor/damage and arrival/departure sexps
2020-06-24 13:47:04 -04:00
Goober5000 7a37218fd6 Merge branch 'master' into subsys_rotation 2020-06-24 11:53:19 -04:00
asarium 0d7ade0ca8 Validate scripting documentation type names
This will check if the type names specified in the argument lists of
scripting functions actually refer to valid type scripting names.
2020-06-24 17:52:33 +02:00
Goober5000 72a5eb0c49 Merge pull request #2507 from Goober5000/upgrade_misc_2
upgrade more misc sexps
2020-06-24 11:46:14 -04:00
Goober5000 44d29908c2 Merge pull request #2505 from Goober5000/upgrade_visibility_sexps
upgrade sexps affecting ship visibility
2020-06-24 11:39:31 -04:00
Goober5000 8394d0d623 upgrade misc sexps
last-order-time, set-player-orders, ship-vanish, shield-quad-low
2020-06-24 11:30:17 -04:00
wookieejedi 050e9ad67a Merge pull request #2503 from wookieejedi/add-shield-weapon-recharge-to-ship-object
Add Shield and Weapon Regen Rates to Ship Object and Expose to Scripting
2020-06-23 22:17:22 -04:00
Goober5000 2bb4152aab Merge pull request #2502 from Goober5000/exited_ship_tweak
fix exited ship mismatch
2020-06-23 18:52:45 -04:00
Fabian Woltermann c2b7374dc3 Merge pull request #2493 from The-E/feature/more_lab_things
Animations in the lab and code cleanup
2020-06-23 22:44:45 +02:00
Fabian Woltermann 96551f4990 Fix FRED too 2020-06-23 18:19:15 +02:00
Goober5000 698ab9ec07 upgrade some more miscellaneous sexps 2020-06-23 12:07:25 -04:00
Goober5000 3513b2d075 upgrade weapon-create and ship-effect 2020-06-23 12:02:47 -04:00
Goober5000 5ad73b5ead upgrade armor/damage and arrival/departure sexps 2020-06-23 11:58:56 -04:00
Goober5000 15d8c962e9 upgrade more misc sexps 2020-06-23 11:53:26 -04:00
Fabian Woltermann 7487fc3042 Address review comments 2020-06-23 17:44:52 +02:00
Goober5000 cb44c66642 upgrade sexps affecting rotating submodels 2020-06-23 11:42:30 -04:00
Goober5000 06478cd64a upgrade sexps affecting ship visibility 2020-06-23 11:38:28 -04:00
wookieejedi 52030b1cc6 Add Shield and Weapon Regen Rates to Ship Object and Expose to Scripting
Previously a ship's shields and weapon regeneration per second rates were only stored in the ship_info strut, thus they should not be changed during a mission or via scripting (see #2236 and and #2239). There are many precedents for taking a ship_info value ans copying it to a ship_object value so the value can be changed on a per ship basis in mission (auto aim FOV is one of many examples). This PR thus copies the shield and weapon recharge values to the ship_object and exposes those new values to scripting.
2020-06-23 10:45:45 -04:00
Goober5000 f67026e7f5 Merge pull request #2500 from Goober5000/upgrade_docking_sexps
upgrade various docking and cargo sexps
2020-06-23 10:41:58 -04:00
Goober5000 7cfa4d8d7c fix exited ship mismatch 2020-06-23 10:40:32 -04:00
Goober5000 8c18c0cf33 Merge pull request #2497 from Goober5000/num_ships
upgrade num-in-battle, num-in-wing, num-in-box
2020-06-23 09:00:47 -04:00
Goober5000 10705235ed Merge pull request #2498 from Goober5000/escort_list
upgrade add-remove-escort, damaged-escort-priority, and damaged-escort-priority-all
2020-06-23 08:58:01 -04:00
Goober5000 c257e30c49 Merge pull request #2496 from Goober5000/weapon_selected
upgrade weapon_selected and related sexps
2020-06-23 08:45:00 -04:00
Goober5000 01cda9874e Merge pull request #2499 from Goober5000/turret_sexps_1
upgrade various turret sexps
2020-06-23 08:37:12 -04:00
Goober5000 ad54976711 upgrade various docking and cargo sexps 2020-06-23 08:24:58 -04:00
Fabian Woltermann d8aa134c9a Merge pull request #2494 from wookieejedi/expose-damp-to-scripting
Expose 'Damp' to Scripting
2020-06-23 10:40:42 +02:00
Goober5000 89242bc213 upgrade various turret sexps 2020-06-22 18:22:15 -04:00
Goober5000 c845e6ca3d upgrade add-remove-escort, damaged-escort-priority, and damaged-escort-priority-all 2020-06-22 18:13:47 -04:00
Goober5000 16c80bb0bb upgrade num-in-battle, num-in-wing, num-in-box 2020-06-22 18:10:33 -04:00
Goober5000 61a3ab10a3 upgrade weapon_selected and related sexps
primary/secondary weapon selected, energy percent, shields-left
2020-06-22 18:03:47 -04:00
Goober5000 dc28840fd2 Merge pull request #2495 from Goober5000/subsys_fixes
fix a few things with subsystem sexp operations
2020-06-22 18:01:12 -04:00
Goober5000 352a50775a fix a few things with subsystem sexp operations
1) Something wookieejedi noticed: destroying all turrets didn't trigger the DISARMED mission log event.  This is because a code ordering decision intended to accommodate the destroyed check caused the hitpoints to not be correct when they were checked within `do_subobj_destroyed_stuff`.  Instead I changed the blow-up check to use the same code for set-strength as for sabotage-strength.  This handles destruction properly and also tracks hitpoints properly.
2) Aggregate points were being recalculated for every subsystem operation where they only needed to be recalculated at the end of the sexp, so I moved that.
2020-06-22 14:43:41 -04:00
Fabian Woltermann b2306753cd more fixes.... 2020-06-22 18:13:07 +02:00
Fabian Woltermann 4c923d799e Travis demands sacrifice 2020-06-22 18:05:38 +02:00
Fabian Woltermann 3df8b6adee Just kidding, travis is never happy 2020-06-22 14:58:40 +02:00
Fabian Woltermann 3d76c5dde0 Use modern loops to make travis happy 2020-06-22 11:07:13 +02:00
Fabian Woltermann 94e392033e Get scripted animation triggers 2020-06-22 09:04:53 +02:00
Fabian Woltermann 2cb4320072 Code cleanup 2020-06-22 08:48:24 +02:00
Fabian Woltermann bb30c90568 More qtFred fixes 2020-06-22 08:38:42 +02:00
Fabian Woltermann cdc582c196 Fix FRED and QtFred issues 2020-06-21 23:04:01 +02:00
wookieejedi dd31579397 Update info 2020-06-21 15:25:36 -04:00
Fabian Woltermann 977a675a67 Add a default route to this particular switch 2020-06-21 21:22:21 +02:00
Fabian Woltermann 3bc5e7a729 Correct a casting error 2020-06-21 21:12:52 +02:00
Goober5000 13ea38fe2f Merge pull request #2490 from Goober5000/upgrade_subsys_sexps
upgrade the hits-left-subsystem sexps
2020-06-21 15:08:50 -04:00
Goober5000 cfa209530b Merge pull request #2491 from Goober5000/upgrade_iff_sexps
upgrade the iff sexps
2020-06-21 15:07:38 -04:00
Fabian Woltermann 898eabd725 Reorganizes the animation menu to be clearer and filterable 2020-06-21 20:49:36 +02:00
wookieejedi 21342f83c4 Expose 'Damp' to Scripting
Many physics values are exposed to scripting, including rotational damp. This PR exposes the linear damp to scripting. Note that in the code the linear damp is called `side_slip_time_const`.
2020-06-21 14:23:37 -04:00
Fabian Woltermann 74c87e2304 Trigger turret firing and turret fired anims 2020-06-21 19:25:50 +02:00
Fabian Woltermann 2b2d687bc7 Animations! 2020-06-21 18:19:04 +02:00
Fabian Woltermann ec494f0229 Change the model anim type enums to a enum class 2020-06-21 14:51:43 +02:00
Goober5000 c398b1dc73 Merge pull request #2488 from Goober5000/upgrade_ai_class_sexps
upgrade is- and change- ai-class
2020-06-20 23:23:19 -04:00
Goober5000 4034e73438 Merge pull request #2487 from Goober5000/upgrade_subsys_strength_sexps
upgrade subsys strength sexps
2020-06-20 22:13:00 -04:00
Goober5000 a24ba07e1e Merge pull request #2486 from Goober5000/upgrade_guardian_sexps
upgrade guardian sexps
2020-06-20 20:01:45 -04:00
Goober5000 09fe728c76 Merge pull request #2485 from Goober5000/message_and_ets
upgrade message function and ets sexps
2020-06-20 18:42:41 -04:00
Goober5000 d3e06effa1 Merge pull request #2480 from Goober5000/ammo_sexps
Ammo sexps
2020-06-20 17:33:51 -04:00
m!m 31c47509e8 Merge pull request #2483 from asarium/feature/cmdBriefApi
Add support for libRocket command briefing
2020-06-20 21:32:36 +02:00
Goober5000 883d048447 fix logical check 2020-06-20 14:23:09 -04:00
asarium ef395640d3 Add support for libRocket command briefing
This adds access to the command briefing data parsed from the mission
file to the scripting API so it can be used by the UI scripts for the
high res UI.

Also switches the animation support to using the generic anim to use
streaming to improve performance.
2020-06-20 18:17:01 +02:00
Goober5000 fd45163157 Merge pull request #2484 from asarium/build/fixQtInstall
Fix GitHub actions Qt install
2020-06-20 12:16:01 -04:00
Fabian Woltermann 7952622a79 wuip 2020-06-20 15:38:29 +02:00
Fabian Woltermann dd7e0576d4 Initial menus 2020-06-20 15:38:29 +02:00
Fabian Woltermann 1811f6c273 Code cleanup, grouping for primary weapons 2020-06-20 15:38:29 +02:00
asarium 980a9a2e96 Fix GitHub actions Qt install
Seems like there is a bug in aqtinstall in the newest version. 0.8 was
the last version to work correctly.
2020-06-20 10:21:19 +02:00
Goober5000 208198f327 upgrade message function and ets sexps 2020-06-19 16:48:17 -04:00
Goober5000 05784d28e1 upgrade guardian sexps 2020-06-19 16:45:03 -04:00
Goober5000 4e72c93523 upgrade subsys strength sexps 2020-06-19 16:41:23 -04:00
Goober5000 d3454b0486 upgrade is- and change- ai-class 2020-06-19 16:38:59 -04:00
Goober5000 3ffe294f5c upgrade the iff sexps 2020-06-19 16:37:30 -04:00
Goober5000 edc9fd0de4 upgrade the hits-left-subsystem sexps 2020-06-19 16:24:37 -04:00
Goober5000 803363f364 Merge pull request #2482 from Goober5000/fix_argument_detection
fix argument detection in sexps
2020-06-17 19:30:52 -04:00
Goober5000 3c17765ba0 fix argument detection in sexps
The previous method worked for FSO, but not FRED.  This method works for both.
2020-06-17 16:07:22 -04:00
Goober5000 187edb4679 Merge pull request #2481 from wookieejedi/fix-disarmed-delay
Fix new version of `disarmed-delay`
2020-06-17 15:38:12 -04:00
wookieejedi f5c8126783 Fix new version of disarmed-delay
Boolean needs to be false not true since `disarmed-delay` is not checking disabled status.
2020-06-17 12:32:52 -04:00
wookieejedi 4bb3132ebb Merge pull request #2474 from wookieejedi/add-large-path-radius-AI-option
Add Large Radius Option as AI Flag for Following Subsystem Path Points
2020-06-16 17:40:35 -04:00
Goober5000 b7e4f5c3c6 Merge pull request #2475 from Goober5000/time_docked_and_cargo
upgrade time-docked and various cargo sexps
2020-06-16 15:33:44 -04:00
wookieejedi 88866efe97 make min a variable 2020-06-16 15:00:35 -04:00
wookieejedi eab6eb639e update comments 2020-06-16 14:45:08 -04:00
wookieejedi 6ebc378827 incorporate comments 2020-06-16 14:39:37 -04:00
Goober5000 899e0c9967 Merge pull request #2476 from Goober5000/weapons_depleted
some more sexp upgrades
2020-06-16 14:15:12 -04:00
Goober5000 aadd7ecbf1 Merge pull request #2479 from Goober5000/objective_sexp_fix
fix some sexps
2020-06-15 22:56:35 -04:00
Goober5000 54409ec928 upgrade and merge the various ammo sexps 2020-06-15 22:54:38 -04:00
wookieejedi 03adff7e42 update logic 2020-06-15 22:22:29 -04:00
Goober5000 3a5884e2c2 fix some sexps
Fix the waypoints-done-delay sexp to work for both ships and wings.

Also, fix the set-object-speed sexp (which is deprecated anyhow) to work for all ships in a wing, not just the wing leader.
2020-06-15 21:13:01 -04:00
wookieejedi 3d77340917 fix missing print call 2020-06-15 10:49:54 -04:00
wookieejedi addbb683fc incorporate comments 2020-06-15 10:17:08 -04:00
Goober5000 e026558b21 some more sexp upgrades
* Merge primary and secondary weapons depleted
* Upgrade the nav/autopilot sexps
2020-06-15 01:32:13 -04:00
Goober5000 a034c3e8da upgrade time-docked and various cargo sexps 2020-06-15 00:33:49 -04:00
Goober5000 7f1d21e69a Merge pull request #2472 from Goober5000/time_sexps
merge and upgrade the time sexps
2020-06-14 23:43:55 -04:00
Goober5000 dc30a7834a Merge pull request #2470 from Goober5000/combine_goal_sexps
combine goal sexps
2020-06-14 23:25:46 -04:00
Goober5000 095a392d5d Merge pull request #2471 from Goober5000/combine_other_sexps
combine and upgrade more sexps
2020-06-14 22:24:31 -04:00
Goober5000 133d73f14e Merge pull request #2473 from asarium/fix/2468
Completely remove santlr4_shared target
2020-06-14 22:13:30 -04:00
Goober5000 fc36b7ce2c Merge pull request #2469 from Goober5000/ship_flag_check
small sexp upgrades
2020-06-14 21:59:44 -04:00
wookieejedi a4f4670b6d remove print statement 2020-06-14 16:40:01 -04:00
wookieejedi 34dd460efb Update naming 2020-06-14 16:39:10 -04:00
wookieejedi 683b433733 fix name 2020-06-14 16:06:43 -04:00
wookieejedi 217778e165 Add Large Raduis Option as AI Flag for Following Path Points
Previously, the default distance for determining if a ship had finished a point in a model path was only 5. This worked fine for ships with low damp or no Newtonian physics. However, it did not work well with ships that use higher damps or Newtonian physics, becuase those ships contiunatlly overshoot that 5 meter distance and get stuck flying in a large circle trying to reach that point. This fix allows modders to set an AI flag to specify that the path distance check uses a larger value of 775 for points that are not the last point in the path. If desired I can add a game settings option that allows modders to set this value.
2020-06-14 16:03:51 -04:00
asarium 56f82479f8 Completely remove santlr4_shared target
This fixes #2468.
2020-06-14 21:25:59 +02:00
Goober5000 aedf541e37 combine hits-left and sim-hits-left 2020-06-14 14:35:15 -04:00
Goober5000 426498efa4 merge and upgrade the time sexps 2020-06-14 14:29:45 -04:00
Goober5000 63d40b7edc combine and upgrade more sexps
This combines the alt-name and callsign sexps, as well as the ship-class and ship-type sexps.
2020-06-14 14:21:31 -04:00
Goober5000 75d8116451 combine goal sexps 2020-06-14 14:12:36 -04:00
Goober5000 b59da60027 also combine gse_recharge 2020-06-14 14:07:37 -04:00
Goober5000 63ccb84299 combine is_ship_stealthy and is_friendly_stealth_invisible, and fix a spelling mistake 2020-06-14 14:02:05 -04:00
Fabian Woltermann e440b978e7 Merge pull request #2467 from EatThePath/spew-more
Extend weaponspew to handle burst weapons and beam weapons
2020-06-14 12:30:26 +02:00
Fabian Woltermann 47afe9303d Merge pull request #2449 from Goober5000/upgrade_objective_sexps_2
upgrade the objective sexps 2
2020-06-14 12:29:25 +02:00
m!m ae3ea33a8a Merge pull request #2465 from asarium/feature/parameterDocumentation
Add capability to have comments in scripting args
2020-06-14 11:55:29 +02:00
m!m 194bd79029 Merge pull request #2466 from asarium/fix/antlrInstall
Fix Antlr installation step
2020-06-14 11:53:33 +02:00
Goober5000 1861065495 add these tweaks to keep the major merges in optimum shape 2020-06-13 21:37:13 -04:00
David Gibson ed5f6a260f Adjusted spacing on weapon descriptions for beams to match formatting for non-beams 2020-06-13 18:58:57 -05:00
David Gibson e9a5bb3250 Restores mvp-style range and velocity handling, and adapts it properly to consider beam weapons. 2020-06-13 18:22:25 -05:00
David Gibson a5ba2ceba9 Corrected comment inaccuracies 2020-06-13 18:13:06 -05:00
David Gibson 0ad15fd3ef Accounted for the differences in range/velocity handling for beams 2020-06-13 17:05:06 -05:00
David Gibson 930b3fe699 Second pass on burst and beam spew for accuracy 2020-06-13 16:14:59 -05:00
David Gibson ffcb4b8c99 first pass of including beam and burst weapons 2020-06-13 14:48:01 -05:00
Goober5000 3ecc0062ab small tweak 2020-06-13 15:16:59 -04:00
Goober5000 a458a0f608 Merge pull request #2409 from Goober5000/weaponspew_tweak
expand -weaponspew to all non-beam weapons
2020-06-13 15:11:33 -04:00
asarium 54b3b9c05e Fix Antlr installation step
This will remove the installation rules for Antlr since they are not
relevant for us.
2020-06-13 21:07:41 +02:00
Goober5000 ff1e328c60 tweak sexp name 2020-06-13 15:07:32 -04:00
Goober5000 bfc8075226 upgrade the objective sexps 2
There's another chunk of objective sexps farther down in sexp.cpp, so this PR addresses those.
2020-06-13 15:06:21 -04:00
asarium 15db77d7fe Add capability to have comments in scripting args
Putting something between /* and */ behind a parameter will make that
appear in the HTML and JSON output now.
2020-06-13 21:03:22 +02:00
Goober5000 ec31c969a0 Merge pull request #2448 from Goober5000/upgrade_objective_sexps
upgrade the objective sexps
2020-06-13 14:59:15 -04:00
Goober5000 8b0e64fa39 Merge pull request #2464 from Goober5000/shut_up_wesley
fix a couple things with mainhall intercom sounds
2020-06-13 14:55:05 -04:00
Goober5000 6771462206 Merge pull request #2452 from Goober5000/upgrade_distance_sexps
fix the way SEXPs check ship distances
2020-06-13 14:50:29 -04:00
m!m f4a8cfcfa0 Merge pull request #2463 from asarium/feature/unifyLuaDoc
Unify and clean up Lua documentation generation
2020-06-13 20:33:35 +02:00
asarium 4a6628e16f Unify and clean up Lua documentation generation
I added a pretty generic container structure for the scripting
documentation when adding JSON output. However, I did not use that new
structure for the HTML output since that was just too much work.

This moves the HTML output over to the new structure so now the
scripting API handling code is independent from how the resulting
documentation is generated. I also moved that code out of the main
scripting code which removes quite a lot of clutter in those files.

This is mostly a straight port of the old code with no significant
changes (except the changes to make it use the new data).
2020-06-13 16:46:26 +02:00
Goober5000 0d1c0e359c silence door and misc sounds too 2020-06-13 01:31:26 -04:00
Goober5000 0ab274dae8 also stop ambient sounds if we're switching campaigns 2020-06-13 00:02:40 -04:00
Goober5000 67ed3a4c7b fix a couple things with mainhall intercom sounds
As noticed in issue #2458, intercom sounds did not stop when pausing the game or loading a mission.  I fixed this by augmenting `main_hall_stop_ambient()` to also stop the intercom.

Additionally, it turns out that the intercom delays were not being calculated correctly due to a very bizarre random number formula.  I overloaded `rand32()` to add a min/max variant and used this instead.
2020-06-12 23:13:11 -04:00
niffiwan f417a87e98 Merge pull request #2461 from asarium/fix/scriptingExit
Remove debug exit
2020-06-13 13:05:34 +10:00
Goober5000 388e4734c5 Merge pull request #2460 from Goober5000/cache_argument_node
cache on the argument node
2020-06-12 17:09:43 -04:00
Fabian Woltermann 0f551fada7 Merge pull request #2459 from The-E/feature/lab_weapons_display
Allow weapons in the lab
2020-06-12 22:59:49 +02:00
Fabian Woltermann e967bd0d68 Use a subsystem index instead of the subobject number to blow up subsystems 2020-06-12 22:36:10 +02:00
asarium d0a642903b Remove debug exit 2020-06-12 21:19:48 +02:00
Goober5000 1d54eb1755 do not cache argument nodes because the action nodes aren't flushed 2020-06-12 14:55:38 -04:00
Fabian Woltermann bf8416d0cf Merge pull request #2456 from JohnAFernandez/Prevent-Edge-Case-Multi-Crash
Prevent Standalone Crash
2020-06-12 17:01:23 +02:00
Fabian Woltermann 43cc6c458a Merge pull request #2457 from asarium/feature/antlrArgParser
Use Antlr for generating argument list parser
2020-06-12 16:13:16 +02:00
Fabian Woltermann 701a2b8c91 More code cleanup 2020-06-12 09:28:15 +02:00
Fabian Woltermann 9f4aab01ea Defer weapon loading until we actually need them
Small code cleanup
2020-06-12 09:24:53 +02:00
Goober5000 49801a152e move from sexp.h to sexp.cpp, and friendlier-ize arg_item 2020-06-12 00:51:50 -04:00
Goober5000 d182b2d951 cache on the argument node
When special arguments are used, the current node cannot be cached because it always contains "<argument>".  So this feature adds the ability to forward the caching to the SEXP node that contains the value being referenced.  To enable this, the internal argument list now contains both the argument text and the node being referenced.  (If there is no node to reference, such as with `for-counter`, the reference will be -1.)
2020-06-12 00:26:31 -04:00
asarium ca27ae16f2 Use Antlr for generating argument list parser
This adds an Antlr grammar for parsing argument lists instead of using a
hand written parser. This allows to write much more complicated syntax
constructs and have all the code being auto-generated. It will also
produce a much more correct parser instead of having all those hacks in
the hand-written one.

This also adds (in addition to supporting the previous syntax) support
for function types along with support for them in HTML and JSON output
formats.

The ANTLR generated parser is included in source form so that it is not
necessary to have an ANTLR installation around if you are not going to
change the grammar. Also includes the necessary runtime code from Antlr.
2020-06-11 21:57:52 +02:00
Fabian Woltermann df99d49681 Make travis happy..... 2020-06-11 18:09:12 +02:00
Fabian Woltermann cf119d241e Initialize Beams too 2020-06-11 16:37:09 +02:00
Fabian Woltermann c19cfccdfa Remove more unused variables 2020-06-11 16:30:41 +02:00
Fabian Woltermann 531cb27254 Make weapon firing more elegant 2020-06-11 16:20:56 +02:00
Fabian Woltermann 69c511497d Remove unused variable 2020-06-11 14:47:34 +02:00
Fabian Woltermann 0c5040e6e1 Avoid int comparison warnings 2020-06-11 14:39:57 +02:00
Fabian Woltermann 779b45417c Use the correct import path 2020-06-11 14:28:55 +02:00
Fabian Woltermann 9f30736a1a Put the action window submenus into separate windows to avoid overlapping menu items. 2020-06-11 13:41:20 +02:00
Fabian Woltermann 1904979006 Get the external weapons display function back
Add action to switch loadouts
Add action to fire weapons
2020-06-11 11:18:08 +02:00
JohnAFernandez c794bef328 Prevent Standalone Crash
If a standalone has only one player connected in a dogfight mission it will crash.  Not fully sure why this doesn't crash in other circumstances, but this check should just be here, anyway.
2020-06-09 23:37:55 -04:00
Goober5000 8a3a40a617 Merge pull request #2455 from Goober5000/fix_compact_multitext
fix compact_multitext_string
2020-06-09 20:40:00 -04:00
Goober5000 f962804b30 fix compact_multitext_string
This is a follow-up to PR #2373.  Tomimaki noticed that the first character was truncated in the cutscene description, and it turned out that the algorithm was slightly wrong.
2020-06-09 19:11:34 -04:00
Fabian Woltermann 84ee31f12a Merge pull request #2441 from EatThePath/min-angles
Settable minimum spawn angles.
2020-06-08 19:52:57 +02:00
Goober5000 8c60e6c5a8 Merge pull request #2453 from Goober5000/xstr_tweak
match strings.tbl
2020-06-08 13:48:20 -04:00
Goober5000 dcbb528d04 change sexp names 2020-06-08 11:52:16 -04:00
Goober5000 92ffff7fac match strings.tbl 2020-06-08 00:18:58 -04:00
Goober5000 1ba8c66a3a tweak the api 2020-06-07 22:47:13 -04:00
Goober5000 156bc2c5d4 fix the way SEXPs check ship distances
Retail has a hud_find_target_distance function that returns the distance between the player position and a bounding box.  This is useful for the HUD because it shows the distance to the perimeter of an object like a jump node or a large ship.  However, this function was re-used for the `distance` SEXP, resulting in the awkward situation where the distance is measured from one ship's center to another ship's bounding box.  This can lead to unexpected results and it also means that the SEXP returns a different distance when the arguments are swapped.

This PR deprecates the original SEXP and introduces the new SEXPs `center-distance` and `bbox-distance` which use consistent methods for both ships.  It also renames the `distance-ship-subystem` SEXP to `center-distance-subsystem` and adds a new `bbox-distance-subsystem` SEXP.
2020-06-07 22:36:46 -04:00
m!m 25d16c3102 Merge pull request #2446 from asarium/feature/scriptingArgParsing
Add parser for scripting argument documentation
2020-06-07 12:06:28 +02:00
m!m c3ac0a3461 Merge pull request #2421 from asarium/feature/luaExecutors
Add feature to execute Lua coroutines at specific points
2020-06-07 12:04:44 +02:00
Goober5000 f0fea13d04 address parameter shadowing noticed by clang 2020-06-07 01:00:29 -04:00
Goober5000 2eea3d3aa8 this is good to have as well 2020-06-07 00:43:18 -04:00
Goober5000 af187f7fbf add the change in function calls 2020-06-07 00:40:20 -04:00
Goober5000 09183fee12 upgrade the objective sexps
Another - hopefully bite-size - sexp upgrade stage.  This takes the objective SEXPs (those which are primarily concerned with the mission log) and upgrades them to use the ship registry.
2020-06-07 00:22:33 -04:00
Goober5000 fa4743a341 Merge pull request #2438 from Goober5000/get_player_from_ship_node
upgrade get_player_from_ship_node
2020-06-06 23:31:33 -04:00
asarium d54d7d41e6 Output parameter information to JSON
Also fixes the parameter strings which currently could not be parsed by
the argument parser.
2020-06-06 23:45:36 +02:00
asarium 614a636ed5 Fix clang-tidy issues
Not sure why travis saw these since I didn't change anything there but
fixing these is also good.
2020-06-06 23:24:08 +02:00
wookieejedi 812452c492 Merge pull request #2447 from The-E/fix/lab_issues
Fix a lab issue and add more explosions
2020-06-06 16:32:03 -04:00
asarium 016c07dc3a Add feature to execute Lua coroutines at specific points
This adds a mechanism for running generic operations at specific points
of the frame execution. This can be used by any part of the code an not
just Lua since it simply executes std::functions. It also adds an
"execution context" concept that specifies in which situation an
operation should be executed.

This is then used by the Lua Coroutines code for resuming coroutines at
specific points instead of always when the awaited promise resolves.
2020-06-06 21:29:48 +02:00
Goober5000 3a8569daad this is now needed 2020-06-06 14:31:36 -04:00
David Gibson 536e97592d minor style fixes 2020-06-06 13:17:12 -05:00
Goober5000 e38a973e80 use enum class 2020-06-06 14:15:55 -04:00
Goober5000 f0cf899787 This expands -weaponspew to optionally list all non-beam weapons. 2020-06-06 14:15:55 -04:00
Goober5000 716cd15281 address feedback 2020-06-06 13:55:00 -04:00
Goober5000 56f3ffae11 convert to p_objp to be consistent 2020-06-06 13:55:00 -04:00
Goober5000 6d53697725 upgrade get_player_from_ship_node
This PR upgrades the function, and the sexps that use it, to take advantage of the new sexp caching.  It also makes `script_eval_multi` more robust in the face of players who might be respawning.
2020-06-06 13:54:59 -04:00
Goober5000 1b11d0d6a9 Merge pull request #2437 from Goober5000/oswpt_and_ship_flag_refactor
another stage of the sexp refactor
2020-06-06 13:53:42 -04:00
m!m 9eb7b4a27b Merge pull request #2445 from asarium/fix/ensureLuaFunctionState
Ensure Lua functions are executed in correct state
2020-06-06 18:59:28 +02:00
Fabian Woltermann 3ee7200ccd Make Travis happy, maybe? 2020-06-06 17:31:46 +02:00
David Gibson 025cf3c7b9 converted some NULL pointers to nullptr as travis commands 2020-06-06 10:11:46 -05:00
Fabian Woltermann c7d08eead3 Add an action to destroy individual subsystems 2020-06-06 15:00:49 +02:00
asarium 367564733e Add parser for scripting argument documentation
This adds a simple parser that takes the existing argument
documentations and parses them so that better documentation can be
generated from that information. This should be sufficient for providing
proper documentation generation for the most common and simple cases of
argument lists (type, name, possible default value, and optional
groups).
2020-06-06 14:02:33 +02:00
asarium 04174e00f8 Ensure Lua functions are executed in correct state
This will ensure that Lua functions will always be executed in the
correct Lua state. Since we now have multiple threads (which are
different lua_State objects) it is possible that the current code could
execute a Lua function in the main state instead of the thread that is
currently executing. This can lead to weird behavior and probably also
to issues inside Lua.
2020-06-06 14:00:23 +02:00
m!m 9e11710369 Merge pull request #2444 from asarium/feature/luaTracing
Add scripting API for tracing custom code
2020-06-06 13:54:11 +02:00
David Gibson b7aeb763f3 fixed my misunderstanding of the const changes in static_rand_cone 2020-06-05 21:38:06 -05:00
David Gibson 9ec63f0882 fixed inconsistent constness in the new overload for static_rand_cone, and added constness to the existing version. 2020-06-05 21:38:06 -05:00
David Gibson 64f61df93f added multiplayer versionof min angle spawn logic 2020-06-05 21:38:06 -05:00
David Gibson a20096abfa added min-angle supporting version of static_rand_cone 2020-06-05 21:38:06 -05:00
David Gibson bb76e2fdcd Implemented minimum angle option for spawned weapons, single player only currently. 2020-06-05 21:38:06 -05:00
Goober5000 13acf77f5a address feedback 2020-06-05 21:34:50 -04:00
Goober5000 5536fbf13b Merge pull request #2443 from Goober5000/refine_exited_state
refine ShipStatus::EXITED state
2020-06-05 20:36:29 -04:00
Goober5000 05d1262abe Merge pull request #2442 from Goober5000/update_clang_tidy
update .clang-tidy based on Discord comments
2020-06-05 20:26:21 -04:00
asarium e8e549ff08 Add scripting API for tracing custom code
This can be used by Lua code to trace the runtime of their code in the
same way the engine already is capable of doing for most in-mission and
mission loading code.

Also adds some tracing scopes to the libRocket code
2020-06-05 22:14:55 +02:00
Goober5000 5f1957a9f8 Merge pull request #2439 from wookieejedi/fix-armor-string-function
Fix minor mis-setting of script function for displaying armor string
2020-06-05 14:23:55 -04:00
Goober5000 d0f1519f60 refine ShipStatus::EXITED state
There is a slight discontinuity where ships that are destroyed have their mission log entries added a bit before `ship_cleanup` is called.  This addresses that.
2020-06-05 14:20:35 -04:00
Goober5000 fdf2bf6ba2 update .clang-tidy based on Discord comments
This removes `readability-avoid-const-params-in-decls` from the list of things clang checks.  Function declarations and headers should be the same, so it makes no sense to warn about `const` in one but not the other.

This also alphabetizes the exceptions for easier reading.
2020-06-05 13:57:24 -04:00
Fabian Woltermann 67d048aa6c further improvements 2020-06-05 16:26:57 +02:00
wookieejedi 59073533a8 Fix minor missetting of script function for displaying armor string
Previosuly, using the script function ArmorClass did not properly display the actual armor class, instead it always displayed -1. This PR fixes that. I have tested these changes and they now proprely display the armor class.
2020-06-04 18:06:03 -04:00
Goober5000 f7b43e5fd0 convert to p_objp to be consistent 2020-06-04 13:06:06 -04:00
m!m 2e8fc3264d Merge pull request #2430 from asarium/feature/libRocketCampaign
Make the campaign room API available to scripting
2020-06-04 16:55:27 +02:00
wookieejedi 8ce3f1e365 Merge pull request #2436 from wookieejedi/fix-weapon-loading
Fix Pilot and Subsystem Weapon Loading
2020-06-04 10:04:43 -04:00
Goober5000 77d26970ff and another one 2020-06-04 01:58:35 -04:00
Goober5000 57d2cb2871 deal with clang 2020-06-04 01:28:21 -04:00
Goober5000 a5be6ed2ea another stage of the sexp refactor
This PR uses `eval_ship` and `eval_wing` to optimize `object_ship_wing_point_team` and `sexp_deal_with_ship_flags`.  The API changed a bit, but to ensure compatibility, there are fields and functions to support the old behavior.  These are temporary and will be removed when all changes have been merged via PRs.
2020-06-04 00:44:32 -04:00
wookieejedi b2489eff7d add comments 2020-06-04 00:31:10 -04:00
wookieejedi e850f043f7 Fix Pilot and Subsytem Weapon Loading
This PR fixes the logic for setting weapon amounts for both the pilot and subsystems of a ship. Previoisly in #PR 2318 this distinction was not checked, so this PR properly adds that check and distinction.
2020-06-03 23:35:27 -04:00
asarium bf521f1c6b Make the campaign room API available to scripting
This makes the necessary campaign room API available to the scripting
API so that it can be implemented using libRocket. Also adds an
engine.sleep function which I needed for making my Lua debugger work
reliably.
2020-06-03 17:49:15 +02:00
Fabian Woltermann ee3da1cb55 Merge pull request #2435 from Goober5000/constify_autopilot
add const-correctness to the autopilot API
2020-06-03 10:40:31 +02:00
Goober5000 70ee8461ab add const-correctness to the autopilot API
This was suggested by the sexp overhaul but is useful on its own too.  Some of the `const` changes cascade a bit.
2020-06-02 23:06:48 -04:00
Tyler Blount 4b49f49206 Merge pull request #2434 from TRBlount/fix/thruster_depth
Temporary fix for thrusters rendering through ship geometry
2020-06-02 15:28:17 -06:00
Goober5000 f948687ce7 Merge pull request #2429 from Goober5000/beam_turret_sexp_consolidation
consolidate several sexps related to beams and turrets
2020-06-02 17:07:48 -04:00
Goober5000 d1214a0164 Merge pull request #2431 from Goober5000/sexp_overhaul_infrastructure
additional infrastructure for sexp caching and ship registry
2020-06-02 16:08:19 -04:00
Tyler Blount 37bf779e77 Remove unused variable 2020-06-02 13:02:48 -06:00
Tyler Blount 28fd52aa51 Change tertiary thruster depth 2020-06-02 11:52:29 -06:00
Tyler Blount 8a6b784d5f Merge pull request #2433 from The-E/fix/thrusters_in_lab
Switch on the physics system when displaying thrusters
2020-06-02 11:32:51 -06:00
Fabian Woltermann dd2e01d9a9 Also make sure that weapon thrusters work 2020-06-02 08:44:19 +02:00
Fabian Woltermann e566dc2f30 Switch on the physics system when displaying thrusters 2020-06-02 08:34:24 +02:00
Goober5000 ff3939b437 add a couple things to bump the CI build 2020-06-02 00:44:58 -04:00
Goober5000 80f0663cfa shut up, clang 2020-06-01 23:11:29 -04:00
Goober5000 ed5360899e add back the send_ship(shipnum) funcion, and also add the sim-hull fix 2020-06-01 21:29:18 -04:00
Goober5000 6354e5d2ce add non-sexp.cpp (and minimal sexp.cpp changes) from overhaul wip 2020-06-01 21:14:10 -04:00
Goober5000 e47540b47a deal with shadowed declaration 2020-06-01 18:22:50 -04:00
Goober5000 289664dea2 consolidate several sexps related to beams and turrets
This is part of the ongoing sexp overhaul relating to performance and caching.  This PR combines functions for several sexps that are very similar, and it also uses the `eval_ship` speedy lookup function.  As a bonus, it allows `turret-tagged-only` and `turret-tagged-clear` to run for multiple ships at a time.
2020-06-01 00:19:10 -04:00
Goober5000 a782fc560e Merge pull request #2427 from Goober5000/tree_lookup_speedup
optimize sexp tree lookup
2020-05-31 16:49:37 -04:00
wookieejedi 9ad57ee9e3 Merge pull request #2426 from wookieejedi/toggle-intel-entries
Adds `tech-remove-intel-xstr` sexp
2020-05-31 16:48:24 -04:00
wookieejedi 2526fa70dc Add in commented sections 2020-05-31 14:09:31 -04:00
wookieejedi 9109876de7 Fix overlapping ID 2020-05-31 13:53:10 -04:00
wookieejedi 79f98a223d and one more spacing fix 2020-05-31 13:48:46 -04:00
wookieejedi f3a37494f6 Fix last missing character 2020-05-31 13:47:50 -04:00
wookieejedi 855048e126 fix missing character 2020-05-31 13:45:40 -04:00
Goober5000 3663c3f9e9 optimize sexp tree lookup
The `special_argument_appears_in_sexp_tree` function can run multiple times per event, especially for repeating events, so it's a good idea to cache the result.  This avoids the need to iterate through potentially the entire tree, checking every single node.
2020-05-31 13:39:17 -04:00
wookieejedi aa502c4b81 Incorporate feedback 2020-05-31 13:30:48 -04:00
wookieejedi 4ecb35b97f Adds tech-remove-intel-xstr sexp
In regards to @MjnMixael's request in #2425, this PR adds the sexp `tech-remove-intel-xstr`, which simply toggles off the specified intel entry.
2020-05-31 09:35:29 -04:00
Goober5000 c41d9bbf5a Merge pull request #2424 from The-E/fix/weapon_crashes_lab
Fix a crash in the Lab when viewing bombs
2020-05-30 22:35:37 -04:00
Fabian Woltermann 65a8f39479 Remove unnecessary comment 2020-05-30 21:05:11 +02:00
Fabian Woltermann 922b06fe3b These checks are not necessary 2020-05-30 21:04:24 +02:00
Fabian Woltermann fd37e21a11 Clean up objects and particle effects when switching models.
Also pause physics when we do not need them.
2020-05-30 21:01:47 +02:00
Fabian Woltermann b6dceaf692 Do not do any radar processing nonsense while in the lab 2020-05-30 20:46:50 +02:00
Goober5000 3851aba765 Merge pull request #2420 from Goober5000/use_get_operator_optimizations
use get_operator_* optimizations
2020-05-30 12:42:10 -04:00
Goober5000 52be12f262 tweak 2020-05-30 01:19:46 -04:00
Goober5000 a039b41c3b use get_operator_* optimizations
Awhile back, the get_operator_const and get_operator_index functions were enhanced to cache the result of the operator lookup.  But this only works when called on the node itself, not the text.  So let's call these functions on the node whenever possible.
2020-05-30 00:58:29 -04:00
m!m c37ea59cbd Merge pull request #2419 from asarium/fix/mainHallOutOfRange
Fix out of range memory access in main hall
2020-05-29 16:27:27 +02:00
m!m 408fe27c32 Merge pull request #2397 from asarium/feature/luaPromises
Add Lua API for promises and async coroutines
2020-05-29 16:27:15 +02:00
wookieejedi ab0f7d853d Merge pull request #2404 from wookieejedi/fix-draw-offscreen-indicator-lua-call
Fixes gr.drawOffscreenIndicator
2020-05-28 13:29:53 -04:00
asarium 74cc1d4c92 Fix out of range memory access in main hall
If you press a key such as Ctrl the code gets a bitfield with a high bit
set so when the key code is used as an index it produces an out of range
error.

Thank you AddressSanitizer!
2020-05-28 18:03:01 +02:00
wookieejedi 6a36babf54 move restore out of if block 2020-05-28 10:01:13 -04:00
Fabian Woltermann e4f5771420 Merge pull request #2418 from The-E/fix/debris_creation
Make sure that large ship debris is correctly markes as not expiring
2020-05-27 20:34:15 +02:00
Fabian Woltermann 1055d026f6 Make sure that large ship debris is correctly markes as not expiring 2020-05-27 18:20:45 +02:00
Goober5000 d5e7b7ffed Merge pull request #2410 from notimaginative/silence_debug_spew
remove super annoying debug spew on console
2020-05-27 10:38:50 -04:00
Goober5000 27afbed6e1 Merge pull request #2399 from wookieejedi/fix-ai-guard-this
Fix 'Guard Attack This' Behavior with AI Flag
2020-05-26 17:52:46 -04:00
Goober5000 b773ed8fd7 Merge pull request #2416 from The-E/fix/debris_deletion
Fix a bug in the debris deletion code
2020-05-26 17:16:37 -04:00
Fabian Woltermann 9907c98fe2 Fix unintentional behaviour change, add comment about the purpose of the Hull_debris_list 2020-05-26 21:11:55 +02:00
Fabian Woltermann 0c9bbe5223 Fix a bug in the debris deletion code introduced by the lab explosion feature commit. This also makes the debris code use the new flag system to mark debris pieces as nondeleteable instead of relying on a magic lifeleft value. 2020-05-26 16:55:45 +02:00
asarium 08c6e0d072 Introduce error state of promises
This is necessary after all to properly clean up resources if an
operation becomes invalid.

Also bumps Visual Studio version to 2017 on Appveyor.
2020-05-24 22:07:09 +02:00
Goober5000 5cfc3cf059 Merge pull request #2413 from Goober5000/fred_loadout_fix
fix incorrect consolidation
2020-05-24 13:11:43 -04:00
Goober5000 bec5d02750 Merge pull request #2414 from Goober5000/fix_retail_save_format
fix corrupted retail save format
2020-05-24 13:11:29 -04:00
wookieejedi 38e3c425c5 remove flag 2020-05-24 09:00:26 -04:00
asarium ebcf686cf7 Add Lua API for promises and async coroutines
This adds a Lua API for representing asynchronous operations and running
coroutines based on those operations comfortably. This is very similar
to features other languages have introduced such as C# or JavaScript. In
fact, the whole "promise" thing is derived from how JavaScript
represents these operations.

This is the initial and very basic system for supporting async
coroutines in Lua. There is no native support for running these
operations at specific points (they run whenever the awaited promise
resolved) or making sure they do not leak through different game states.
2020-05-24 12:36:01 +02:00
Goober5000 2d3fef4cf2 fix corrupted retail save format
This is a follow-up to #2348.  One part of the change wasn't tested, and it turned out to be important.
2020-05-24 01:11:19 -04:00
Goober5000 89be07116b fix incorrect consolidation
In PR #2318, I consolidated the code a little too much.  The partial-loadout checks should not have been under the `SUBSYS_STATUS_NO_CHANGE` check, because this would cause partial loadouts to fail if the percentage was adjusted but the actual weapon in the loadout was not changed.

Thanks to @wookieejedi for spotting this bug.
2020-05-24 00:22:13 -04:00
Goober5000 96bee4a4fa Merge pull request #2405 from Goober5000/xstr_tweak
tweak some untranslated internal XSTR strings
2020-05-21 23:35:19 -04:00
Goober5000 98d7a9f6f6 tweak some untranslated internal XSTR strings
This is a minor follow-up to PR #2390.  There are a few minor differences between untranslated strings and the internal strings in strings.tbl; this PR fixes them.
2020-05-21 19:09:03 -04:00
Goober5000 3e638bbe9e Merge pull request #2406 from asarium/build/fixQtCache
Use architecture specific cache for Qt
2020-05-21 19:08:31 -04:00
asarium e4d10fd127 Use architecture specific cache for Qt
Otherwise 32-bit might bet binaries for 64-bit or the other way around.
2020-05-21 23:17:54 +02:00
wookieejedi 47e6162eba update so check includes wing section 2020-05-21 15:29:26 -04:00
m!m 7c3e5bc4fc Merge pull request #2403 from asarium/build/githubQt
Install Qt in GitHub actions
2020-05-21 17:34:14 +02:00
Goober5000 539662fd28 Merge pull request #2402 from Goober5000/sexp_data_caching
SEXP data caching
2020-05-21 10:45:04 -04:00
Goober5000 57b534c554 extra insurance 2020-05-20 21:42:00 -04:00
wookieejedi 0b0a78cb06 cleanup whitespace diff 2020-05-20 12:25:25 -04:00
Goober5000 6ec28f6de5 Merge pull request #2389 from Goober5000/ai_goal_target_name_fix
make Goal_target_names dynamic
2020-05-19 23:27:40 -04:00
wookieejedi 94689972b6 refactor function per discussion 2020-05-19 16:28:27 -04:00
wookieejedi 6143953dd9 Fixes gr.drawOffscreenIndicator
Previously the scripting call `gr.drawOffscreenIndicator` did not properly draw the indicator and/or return coordinates. After some bug hunting it turns out it is because there gauge was not being set to active. This PR adds that line and retores the intended functionality. Tested and works as expected.
2020-05-19 15:31:18 -04:00
Goober5000 e265727ea1 add catch based on feedback 2020-05-19 14:50:42 -04:00
Goober5000 fb27a8a599 or this 2020-05-19 13:48:47 -04:00
Goober5000 b4843b466d use default member initializers and non-shadowy parameter names 2020-05-19 13:48:47 -04:00
Goober5000 ee953aa270 don't remove the parse object because it's still valid 2020-05-19 13:48:47 -04:00
Goober5000 9923c87bc1 cache ships, numeric literals, and variables 2020-05-19 13:48:47 -04:00
Goober5000 cf7f8446b2 wip 2020-05-19 13:48:47 -04:00
Goober5000 8667891fc2 use dynamic strings 2020-05-19 13:48:06 -04:00
Goober5000 5f74388790 add newline 2020-05-19 13:48:06 -04:00
Goober5000 067b250be9 make Goal_target_names dynamic
If ever there were more than 100 goal targets in a mission, the old version of ai_get_goal_target_name would start corrupting memory.  Rather than making a hacky workaround, this just makes it dynamic.
2020-05-19 13:48:06 -04:00
Goober5000 775984ae36 Merge pull request #2390 from Goober5000/xstr_revert
clean up handling of translated vs. untranslated English
2020-05-19 12:51:41 -04:00
Goober5000 3a7e604af9 Merge pull request #2401 from Goober5000/small_sexp_fix
make some debug code only run in debug
2020-05-19 12:50:19 -04:00
Goober5000 d4c429f3b1 Merge pull request #2394 from Goober5000/weapon_stats
Weapon statistics for comparison and extended descriptions
2020-05-19 12:49:35 -04:00
Goober5000 933f20efaa Merge pull request #2392 from Goober5000/modify_weapons_loadout_check
modify weapons loadout check
2020-05-19 12:48:59 -04:00
wookieejedi 5155e23430 Add as default to version 20 and up 2020-05-19 11:38:02 -04:00
asarium e3b1beb187 Install Qt in GitHub actions
This allows building QtFred on Windows which was the last thing missing
to achieve parity with Appveyor.
2020-05-19 17:11:05 +02:00
m!m 6ca29a79ba Merge pull request #2400 from asarium/build/clangReadability
Enable sensible clang readability checks
2020-05-19 17:04:29 +02:00
Taylor Richards 95690b1e11 properly update stats info in chat lobby 2020-05-19 04:15:06 -04:00
Taylor Richards 4f2765fdf2 compensate for ignored pad value in stats struct size 2020-05-19 04:15:06 -04:00
Taylor Richards 899997d1c1 fix sizing issues in stats conversion
These issues caused the stats packet to keep growing during
every conversion between network and game structs causing
memory issues and data corruption. These bugs were hidden by
the fact that stats packets were discarded by the server due
to another bug.
2020-05-19 04:15:06 -04:00
Taylor Richards 4e8fa1253b remove super annoying debug spew on console 2020-05-19 04:13:40 -04:00
Goober5000 498e5ef42e make some debug code only run in debug
This code is highly inefficient (find_parent_operator() is O(n) for Num_sexp_nodes, and it runs every frame for all sexps with negative values) and should not actually be necessary.  But it is useful as a debug tool, so I added some #ifdef's.
2020-05-18 21:05:41 -04:00
asarium d29e236250 Enable sensible clang readability checks
This enables the clang readability checks that I found to be sensible. I
disabled a few that would have caused a lot of unnecessary warnings in
our code.
2020-05-18 20:57:19 +02:00
wookieejedi 584db57cce Fix 'Guard Attack This' Behaviow with AI Flag
This PR allows the setting `Guards Attack This` in `objecttype.tbl` to actually work.

Background: there are two instances in the code where AI that is patrolloing/guarding a ship decideds to go attack guardees attacker. One case is if the guardee is hit, and the other case if there are just hostile ships present (ie it scans the mission every so often).
The `Guards Attack This` check was only applied to the scna the mission case, and not the guardee hit case. Thus if the guardee was hit by a ship that had the  `Guards Attack This` setting off, the guard would still attack since that check was never being performed for that guard case. By default all object types hae `Guards Attack This` set to `true.` But if a modder didn't want fighters guarding a ship to go off and try to kill a large captial ship then they may think setting this value would be a good way to do that. Unforunately this wouldn't work, for the reasons outlined above.

Chnage: this PR adds the `Guards Attack This` check into the guardee is hit case, estentally making the behavior work as expected by a modder. Given this is a AI behavior change I have added an optional AI flag to toggle this fix on. I have tested this and it works as expected.
2020-05-18 09:00:38 -04:00
Goober5000 880005f758 or this 2020-05-16 14:22:46 -04:00
Goober5000 ec1a35f624 better variable name 2020-05-16 14:22:46 -04:00
Goober5000 575573334b modify weapons loadout check
Based on feedback, this PR now allows gaps in weapon loadouts, but if any gaps exist they must come at the bottom.
2020-05-16 14:22:46 -04:00
Goober5000 82b9a392e1 fix CI thing 2020-05-16 14:22:00 -04:00
Goober5000 ab2a2d46d6 make cmdline-friendly 2020-05-16 14:22:00 -04:00
Goober5000 b0f812b808 some fixes 2020-05-16 14:22:00 -04:00
Goober5000 7e8ffcec86 also list weapons whose base weapon is player-allowed 2020-05-16 14:22:00 -04:00
Goober5000 7a9bebecf6 fix multiplier based on new info 2020-05-16 14:22:00 -04:00
Goober5000 c005aa5ce2 tweak 2020-05-16 14:22:00 -04:00
Goober5000 1d00c296dd include additional missiles 2020-05-16 14:22:00 -04:00
Goober5000 dd4036d8df add useful comment 2020-05-16 14:22:00 -04:00
Goober5000 4b42829aa0 MVP weapon stats, and fix shockwave determination 2020-05-16 14:22:00 -04:00
Goober5000 7f8eaa275c weapon stats for spreadsheet 2020-05-16 14:22:00 -04:00
Goober5000 329fd023ec Merge pull request #2396 from Goober5000/2298_followup
revert the clang-tidy changes from #2298
2020-05-16 14:20:04 -04:00
Goober5000 2e0a84010e revert the clang-tidy changes from #2298
These are far too pedantic, and were not related to the feature in #2298 anyway.
2020-05-16 00:01:06 -04:00
Goober5000 9e0c37364c Merge pull request #2298 from asarium/feature/pureLuaScriptTable
Add capability to have a pure lua script
2020-05-15 15:39:46 -04:00
Goober5000 d83d1b41ee make clang happy 2020-05-15 15:34:54 -04:00
Goober5000 d26a12464c clean up handling of translated vs. untranslated English
Since the original release of FS2, internal strings have been translated to their English entries in strings.tbl but external strings have not been translated to their English entries in tstrings.tbl.  It appears that string translation was universal until it was disabled via a hack, probably due to FRED idiosyncrasies (see comment in `fred_init()`), and then not re-enabled for release.  PR #2343 re-enabled it, but this turned out to have undesirable side-effects since many mods used incorrect XSTR indexes for external strings.

This PR restores the previous behavior and also cleanly separates localization into translated and untranslated modes.  FRED will always run in untranslated mode.  FSO will run in translated mode for all languages except English, where it will run in untranslated mode UNLESS the new option `$Use tabled strings for the default language` is enabled in game_settings.tbl.
2020-05-14 19:19:52 -04:00
Goober5000 f80693213c Merge pull request #2387 from Goober5000/fix_improper_ai_get_goal_target_name
fix improper usage of ai_get_goal_target_name
2020-05-14 19:08:21 -04:00
Goober5000 dbc26548f5 Merge pull request #2377 from wookieejedi/fix-warp-flag-issues
Fix warp flag and code issues
2020-05-13 23:41:31 -04:00
Goober5000 1ef90d79c4 Apply suggestions from code review
some comment tweaks
2020-05-13 20:15:36 -04:00
Goober5000 caf3eaad98 fix improper usage of ai_get_goal_target_name
The ship goals dialog was incorrectly assigning a goal target name for every dockpoint, which could quickly cause the limit to be exceeded if the FREDder browsed a lot of dockpoints.

This also indicates a need to fix the goal target name system as the counter is never decremented.  That will be in a subsequent PR.
2020-05-13 03:05:17 -04:00
Goober5000 efbace48b8 Merge pull request #2332 from Goober5000/mantis_3147_flag
add an ai-profiles flag to govern the Mantis 3147 fix
2020-05-13 00:48:44 -04:00
Goober5000 d961fa1bb6 use mod_supports_version 2020-05-12 21:46:19 -04:00
Tyler Blount c6a999ab7a Merge pull request #2384 from TRBlount/fix/weapon_render_type
Make sure modular tables can overwrite weapon model info
2020-05-12 00:20:01 -06:00
wookieejedi 5df12322e5 Incorporate feedback 2020-05-11 18:05:21 -04:00
wookieejedi f7d474cb77 Merge branch 'master' into fix-warp-flag-issues 2020-05-11 16:35:37 -04:00
Tyler Blount 764a74dbd2 Make sure modular tables can overwrite weapon model info 2020-05-11 13:54:50 -06:00
Goober5000 1d471e254b Merge pull request #2342 from Goober5000/mantis_1947
implement Mantis 1947, treat ship comm systems the same as player comm systems
2020-05-10 15:36:45 -04:00
Goober5000 771d0c7a38 Merge pull request #2383 from wookieejedi/update-pow)-to-multiply
Update cases of pow(x,2) to just multiply values
2020-05-10 14:45:47 -04:00
wookieejedi 94bfb2fe75 Update cases of pow(x,2) to just multiply values
Having recalled that other SCP folks stated pow shoud not be used to do simple squaring, I figured it might be a good idea to update the two instances I found where that was the case.
2020-05-10 13:17:03 -04:00
Fabian Woltermann 8fd2813ddd Merge pull request #2382 from The-E/fix/particles_in_lab
do on-frame processing for particle effects in the lab
2020-05-10 17:38:11 +02:00
Fabian Woltermann a0180fc004 Init the particle system and use the correct frametime counter 2020-05-10 15:29:28 +02:00
Fabian Woltermann 7a6aa5334d do on-frame processing for particle effects in the lab 2020-05-10 13:20:18 +02:00
Goober5000 d8f388996d Merge pull request #2376 from The-E/feature/kill_ship_in_lab
Make explosions happen in the lab
2020-05-10 00:31:56 -04:00
wookieejedi da55499817 Merge pull request #2381 from wookieejedi/fix-texture-replace-with-showship
Fixes texture replace not working with show ship
2020-05-09 23:32:21 -04:00
wookieejedi e1dbcf4dd6 Add back in disabled check for future use of the engines ok function 2020-05-09 17:18:31 -04:00
wookieejedi cb5a1000a6 Fixes texture replace not working with show ship
This PR allows the `ship_render_show_ship_cockpit` function to properly detect replacement textures. Fortunately just a one line fix.
2020-05-09 15:48:34 -04:00
Fabian Woltermann 94bd8da5db Merge pull request #2373 from Goober5000/parse_tweaks
some code tweaks from an old branch
2020-05-09 20:21:01 +02:00
Fabian Woltermann 03926b8dde Merge pull request #2379 from The-E/fix/naked_int3_in_missionmessage
Remove naked int3() call in missionmessage
2020-05-09 18:44:18 +02:00
Fabian Woltermann 764bbac99f The original Volition code called Int3() here; since there is a way out that does not require us to crash, we should just not crash. 2020-05-09 10:43:13 +02:00
wookieejedi 280ff2d4f0 Incorporate feedback 2020-05-08 22:40:58 -04:00
wookieejedi 45775a0d97 One more update to the scripting function calls 2020-05-08 11:29:07 -04:00
wookieejedi c4d405e33e change to nullptr 2020-05-08 11:14:53 -04:00
wookieejedi 86e1ebaf08 fixed copy paste error with new script function 2020-05-08 10:34:20 -04:00
wookieejedi 82921467a5 Update ship.cpp 2020-05-08 09:58:35 -04:00
wookieejedi c2820f10c8 Updates and fixes multiple warp out related code 2020-05-08 09:53:32 -04:00
Goober5000 d52bddf0dc Merge pull request #2347 from EatThePath/disable-doublefire-take-2
Disable doublefire take 2
2020-05-08 02:01:40 -04:00
Fabian Woltermann cd88663a92 Avoid a signed/unsigned comparison 2020-05-08 07:56:08 +02:00
Goober5000 0e9a72a37b make clang happy 2020-05-07 21:57:18 -04:00
Fabian Woltermann 1c10479d2f Pause the AI while in the lab 2020-05-07 22:27:47 +02:00
David Gibson b88ccfb924 added an explanatory comment. Also reunited some related code I'd inadvertantly pushed apart, per review. 2020-05-07 15:09:19 -05:00
Fabian Woltermann 11e9fa27c6 REdo a few things 2020-05-07 22:00:19 +02:00
Fabian Woltermann f4f6e74456 Add new "Actions" window to the lab viewer and add a "Destroy Ship" action to make explosions happen 2020-05-07 21:35:25 +02:00
Fabian Woltermann de2e9ada72 WIP 2020-05-07 21:34:12 +02:00
Fabian Woltermann 4005a60b32 Merge pull request #2375 from The-E/fix/damage_lightning_in_lab
Make the lab's "show damage lightning" flag work again.
2020-05-07 21:31:48 +02:00
Fabian Woltermann 2e6306d85f Merge pull request #2374 from The-E/fix/texture_replacement_in_lab
Apply tabled texture replacements when loading ships in the F3 lab
2020-05-07 20:36:16 +02:00
Fabian Woltermann e1f231fcf0 Use the tabled max hull strength instead of a constant 2020-05-07 19:01:36 +02:00
Fabian Woltermann 86e898c9ea Use modern loops 2020-05-07 16:04:06 +02:00
Fabian Woltermann df1491fd9e Make the lab's "show damage lightning" flag work again.
Note that it may take a few frames for lightning to disappear when unchecking that checkbox.
2020-05-07 15:18:56 +02:00
Fabian Woltermann 0b8f203371 Apply tabled texture replacements when loading ships in the F3 lab 2020-05-07 14:48:14 +02:00
wookieejedi 1d152fcc73 Merge pull request #2371 from wookieejedi/on-depature-started-hook
Add `On Departure Started` Hook
2020-05-06 22:48:42 -04:00
Goober5000 c9fb046024 update header 2020-05-06 14:38:40 -04:00
Goober5000 c4b8020ebc some code tweaks from an old branch
Minor edits from an obsolete branch that are still useful in cleaning up the code.
2020-05-06 14:25:08 -04:00
wookieejedi a2c7a344da Add On Departure Started Hook
This PR adds a scripting hook which triggers when a ship begins it's departure process. It has one variable that is the ship. I have tested and it works as expected. This new hook is very useful for triggering events whenever a ship needs an alteration to it's departure methods. For example, in Fate of the Galaxy we require ships to warp out along a certain vector. This hook allows us to see when the ship is begining that depature and then break the ship's warp, order the ship to instead follow a waypoint path, and then jump out.
2020-05-06 09:25:10 -04:00
Goober5000 f8e5c9f7a3 Merge pull request #2343 from Goober5000/fix_mantis_2942
implement XSTR check as described in Mantis 2942
2020-05-05 22:28:20 -04:00
wookieejedi bebb69e28f Merge pull request #2369 from wookieejedi/pain-flash-hook
Adds `On Pain Flash` Scripting Hook
2020-05-05 16:59:45 -04:00
Goober5000 aef4c1ba3c address feedback 2020-05-05 14:38:50 -04:00
Goober5000 801a6031e3 Merge pull request #2367 from Goober5000/aiturret_fix
fix some code rot
2020-05-05 14:01:34 -04:00
Goober5000 4c573e2989 Merge pull request #2368 from Goober5000/support_ship_override
add two useful cheat keys
2020-05-05 14:00:59 -04:00
wookieejedi aa4e300153 switch to correct hook type 2020-05-05 13:55:57 -04:00
wookieejedi 3695f0ff93 remove unneeded CHAPAINFLASH 2020-05-05 13:51:36 -04:00
wookieejedi 7dc38f7752 Update to new script format 2020-05-05 13:46:53 -04:00
Goober5000 5ab611a8b1 this reason is only applicable in debug builds 2020-05-05 12:08:22 -04:00
Goober5000 0577b69d69 address CI complaint 2020-05-05 11:48:46 -04:00
wookieejedi 6897024b29 Adds On Pain Flash Scripting Hook
This PR adds a scripting hook which triggers when the pain flash is shown. It has one variable that lists what type of flash was shown, shield with `Pain_Type == 0` and hull with `Pain_Type == 1` .  I have tested and it works as expected.
2020-05-05 10:03:48 -04:00
Fabian Woltermann ffd5fdc764 Merge pull request #2366 from wookieejedi/carry-glowmap-status
Updates glowmap settings for a ship to also apply to ship's cockpit
2020-05-05 10:21:53 +02:00
Goober5000 e985961ed5 add two useful cheat keys
`+Shift+R will enable or disable support ships

`+Shift+U will scan or unscan the targeted ship, or ship subsystem
2020-05-05 01:02:17 -04:00
Goober5000 89a722d41a placeholder for future feature implementation 2020-05-05 00:14:16 -04:00
Goober5000 3ca187127d move comment 2020-05-05 00:01:30 -04:00
Goober5000 35e67d4574 possibly fix some code rot 2020-05-04 23:33:06 -04:00
wookieejedi 8b7253cfc1 Updates glowmap settings for a ship to also apply to ship's cockpit
The sexps that activate and deactive glowmaps are very useful for ships, though previously the glowmap status was not passed to the ship's cockpit. This PR adds the ability for glowmap status to carry to this ship's cockpit (if it has one).
2020-05-04 22:07:49 -04:00
Goober5000 7ec425f341 Merge pull request #2345 from Goober5000/fix_mantis_2791
Fix mantis 2791
2020-05-04 20:27:29 -04:00
Goober5000 e4b2791c4e Merge pull request #2353 from Goober5000/support_ship_cleanup
clean up the support ship code a bit
2020-05-04 16:13:06 -04:00
Fabian Woltermann e5c2b76469 Merge pull request #2363 from The-E/fix/post_process_aa_cmdline
Unify the way post-process antialiasing is switched on
2020-05-04 22:12:39 +02:00
Goober5000 4c5bc1fa6c Merge pull request #2360 from Goober5000/fix_2335
fix issue 2335
2020-05-04 16:12:18 -04:00
Fabian Woltermann 857a622caa Make Travis happy 2020-05-04 21:29:53 +02:00
Fabian Woltermann bdc6145b2c Deprecates the -fxaa and -smaa cmdline parameters in favour of a more generalized -aa; This also ensures that the smaa render targets are always initialized. 2020-05-04 18:30:11 +02:00
wookieejedi 07ce8a9c70 Merge pull request #2362 from wookieejedi/fix-glowmap-explode-flag
Fix Glowmap flag not carrying over to final ship explosion
2020-05-04 07:35:36 -04:00
wookieejedi e42ed47c61 Previously if a ship's glowmaps were deactivated via sexp, then the glowmaps would reaactivie at the ship's final explosinos. This PR fixes that by carrying that flag into the ship explosion FX code.
Previously if a ship's glowmaps were deactivated via sexp, then the glowmaps would reaactivie at the ship's final explosinos. This PR fixes that by carrying that flag into the ship explosion FX code.
2020-05-03 23:36:42 -04:00
Goober5000 ce3b9b62b1 Merge pull request #2336 from Goober5000/hotkey_fixes
add +Hotkey Team: to override IFF designation in hotkey list
2020-05-03 17:29:35 -04:00
Goober5000 794863c5e7 Merge pull request #2348 from Goober5000/mantis_2867
bring save format up to date (Mantis 2867)
2020-05-03 15:42:48 -04:00
asarium 544029f66f Add capability to have a pure lua script
This adds the capability to have a Lua script that does not need to use
our table syntax at all but instead defines the hooks by calling API
functions. This also makes it possible to add hook functions at runtime
if the script requires that.

Also clean up some unused debug stuff.
2020-05-03 14:33:42 +02:00
Goober5000 38e04b6151 Merge pull request #2354 from Goober5000/cue_voice_tweak
add overlooked generic file
2020-05-02 16:48:56 -04:00
Goober5000 3c76cc6524 add overlooked generic file
It turns out that the extant placeholder wav has an underscore in the filename, so add that to the list.
2020-05-02 13:54:13 -04:00
niffiwan 3c7f73f4d8 Merge pull request #2349 from Goober5000/allow_empty_weapons_on_locked_ships
allow empty weapons on locked ships
2020-05-02 20:01:23 +10:00
Fabian Woltermann 5366073356 Merge pull request #2358 from The-E/fix/aa_shader_unloading
A followup to the recent SMAA fixes
2020-05-01 13:30:56 +02:00
Fabian Woltermann 23fbdf7e64 Clean up the aa shader loading/unloading code to handle cases where we switch between FXAA and SMAA correctly 2020-05-01 10:55:20 +02:00
Goober5000 4cb3b393da clean up the support ship code a bit
Due to code rot, the support ship hull repair code was a bit more tangled than it should have been, so I tidied it up.  I also fixed a bug Sarn noticed where a support ship would think all subsystems were repaired if the hull repair rate was set to 0.
2020-04-29 01:39:18 -04:00
Goober5000 9c44e77da0 allow empty weapons on locked ships
As noticed in Discord, in loop1-2 some of your wingmen have missing weapons, but as the ships are locked it's impossible for the player to modify them.  These ships should not be part of the check.
2020-04-28 23:51:37 -04:00
Goober5000 d9d372121a missed one 2020-04-28 23:24:13 -04:00
Goober5000 6df90a8ec7 newline 2020-04-28 23:12:51 -04:00
Goober5000 289defdeff smol fix 2020-04-28 23:11:33 -04:00
Goober5000 a54ebc3114 bring save format up to date (Mantis 2867)
FSO-specific features should now all be properly marked off with checks for retail format.
2020-04-28 23:02:10 -04:00
David Gibson 4a5ff2860b now check doublefire validity flags before drawing doublefire HUD indicator 2020-04-28 16:06:20 -05:00
David Gibson f8f1b44405 Check doublefire flag validity before firing any missile 2020-04-28 14:50:33 -05:00
David Gibson f13faf4cba added new flags and flag loading for the doublefire disabling options 2020-04-28 13:57:44 -05:00
Goober5000 9dd6bcf81d warn if there is a gap in the path sequence 2020-04-28 00:39:46 -04:00
Goober5000 3356edff2b warn if model paths do not have unique names 2020-04-28 00:16:06 -04:00
Goober5000 07acdde69a fix Mantis 2791
This is a pretty easy fix; sorry it took seven years!

Instead of firing an Int3() when a ship has no arrival paths, just log it and continue.  And change the upstream warnings, which should have been more visible, from WarningEx to Warning.
2020-04-27 23:43:45 -04:00
Goober5000 c89ea8e8dd update test case 2020-04-27 23:22:34 -04:00
Goober5000 d6c1a3dec4 implement XSTR check as described in Mantis 2942
Certain mods provide their own tstrings.tbl, but this runs into trouble when you localize data meant for one mod using a tstrings.tbl meant for another mod.  See the Mantis ticket:
http://scp.indiegames.us/mantis/view.php?id=2942
and also the HLP post:
http://www.hard-light.net/forums/index.php?topic=85041.msg1716600#msg1716600

This PR adds an optional flag that will check the untranslated string against the "default language" translated string.  The two strings should be identical.  If they aren't, the code assumes there is a tstrings.tbl mismatch.

I modified the mission listing code to enable this check when localizing mission info (titles and descriptions), and to avoid adding the mission to the list if there is a mismatch.  Fortunately, I think mission listing is the only place where this bug is likely to happen.
2020-04-27 22:42:13 -04:00
Goober5000 30d41eff8b fix issue 2335
Modify the early-out condition to remain in the function if we still need to render a dumbfire lead indicator.

Fixes #2335.
2020-04-27 20:32:45 -04:00
Goober5000 cc39cfe6f2 don't send builtin messages for ships with damaged comms, and don't select them when looking for unsilenced ships either 2020-04-27 16:32:43 -04:00
Goober5000 d0daa43ccf since the code assumes all subsystems are dead if the ship is dying, add some flag checks to allow death messages to play (and be scrambled appropriately) if we have the ai_profiles flag active 2020-04-27 02:30:42 -04:00
Goober5000 e0cd2806f8 move quick-abort checks to before message priority checking
From the comments:

	// Do some checks to see if we are actually going to play this message at all.  These checks have been moved above the
	// "if ( Num_messages_playing )" block because we don't want to cancel an existing message if we have nothing to replace it with.

Additionally, by not incrementing `Num_playing_messages` if the code skips to `all_done`, this prevents messages that aren't playing from delaying messages in the queue that are actually valid and should play.
2020-04-27 02:24:26 -04:00
Goober5000 4f026a66ab fix small bug where speech was stopped when it wasn't supposed to be 2020-04-27 02:17:42 -04:00
Goober5000 28df82a03f fix bug where scramble status overrode subystem status 2020-04-27 02:13:08 -04:00
Goober5000 06f1b7d872 fix some int/bool stuff 2020-04-26 18:16:08 -04:00
Goober5000 1dfe3a8d9f implement Mantis 1947 feature request
This adds an ai_profiles flag that checks comm systems for non-player ships.  If their comm system is damaged, they will not send messages and you will not be able to issue squadmsg orders.

See also:
http://scp.indiegames.us/mantis/view.php?id=1947
2020-04-26 18:08:28 -04:00
Goober5000 aa46ae6639 add version-specific enabling of bugfix flags 2020-04-26 17:13:13 -04:00
Goober5000 c8b1f56a09 missed one 2020-04-16 13:37:36 -04:00
Goober5000 8cc9eb2352 change to bool, for great C++ justice 2020-04-16 13:20:39 -04:00
Goober5000 3d08119734 add +Hotkey Team: to override IFF designation in hotkey list
This is in response to Mantis 1424:
http://scp.indiegames.us/mantis/view.php?id=1424

Since retail, the hotkey lists have been determined based on what attacks the player.  Mod makers may want to change this, so this PR adds the following options:

Default - retail behavior
Friendly/Enemy (or Hostile) - display in the specified list regardless of who attacks whom
None - don't display in the hotkey list at all

This PR also slightly cleans up the hotkey list function with a small optimization and a few tweaky fixes for edge cases.
2020-04-15 13:47:11 -04:00
Goober5000 6f5e500a1e add an ai-profiles flag to govern the Mantis 3147 fix 2020-04-14 17:50:16 -04:00
1204 changed files with 107797 additions and 38008 deletions

No files matched your search

+5 -4
View File
@@ -3,17 +3,18 @@ Language: Cpp
Standard: Cpp11
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowAllArgumentsOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
+19 -5
View File
@@ -1,19 +1,31 @@
---
Checks: "-*,\
modernize-*,\
-modernize-raw-string-literal,\
-modernize-use-using,\
-modernize-make-unique,\
-modernize-use-trailing-return-type,\
-modernize-avoid-c-arrays,\
-modernize-make-unique,\
-modernize-raw-string-literal,\
-modernize-use-trailing-return-type,\
-modernize-use-using,\
performance-*,\
-performance-type-promotion-in-math-fn,\
misc-*,\
-misc-macro-parentheses,\
-misc-misplaced-widening-cast,\
-misc-non-private-member-variables-in-classes,\
-misc-static-assert,\
-misc-unused-parameters,\
-misc-non-private-member-variables-in-classes,\
readability-*,\
-readability-avoid-const-params-in-decls,\
-readability-else-after-return,\
-readability-function-size,\
-readability-identifier-naming,\
-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
-readability-isolate-declaration,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-qualified-auto,\
-readability-uppercase-literal-suffix,\
"
WarningsAsErrors: ''
HeaderFilterRegex: 'code/.*$|freespace2/.*$|qtfred/.*$|test/src/.*$|build/.*$'
@@ -23,5 +35,7 @@ CheckOptions:
value: 'assert,Assert,Assertion'
- key: 'modernize-use-emplace.ContainersWithPushBack'
value: 'std::vector;std::deque;std::list;SCP_vector;SCP_deque;SCP_list'
- key: 'readability-braces-around-statements.ShortStatementLines'
value: '4' # Avoid flagging simple if (...) return false; statements
...
+4
View File
@@ -9,3 +9,7 @@ indent_style = tab
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.sh]
indent_style = space
indent_size = 4
+10
View File
@@ -0,0 +1,10 @@
cmake/ @asarium
code/executor/ @asarium
code/scpui/ @asarium
code/scripting/ @asarium
code/controlconfig/ @z64555
+212
View File
@@ -0,0 +1,212 @@
name: Build Nightly package
on:
push:
tags:
- 'nightly_*'
env:
QT_VERSION: 5.12.9
jobs:
build_linux:
strategy:
matrix:
configuration: [FastDebug, Release]
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-e29f882
steps:
- name: Cache Qt
id: cache-qt-lin
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: gcc-5
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: |
LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Generate AppImage
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: linux-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/install/*.AppImage
linux_zip:
name: Build Linux distribution zip
needs: build_linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: '0'
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: linux-Release
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: linux-FastDebug
path: builds
- name: Create Distribution package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Linux
- name: Upload result package
working-directory: ./builds
env:
INDIEGAMES_USER: ${{ secrets.INDIEGAMES_USER }}
INDIEGAMES_SSHPASS: ${{ secrets.INDIEGAMES_PASSWORD }}
DATACORDER_USER: ${{ secrets.DATACORDER_USER }}
DATACORDER_SSHPASS: ${{ secrets.DATACORDER_PASSWORD }}
run: $GITHUB_WORKSPACE/ci/linux/upload_dist_package.sh nightly
build_windows:
strategy:
matrix:
configuration: [FastDebug, Release]
arch: [Win32, x64]
simd: [SSE2]
name: Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt (32 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'Win32' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win32_msvc2017
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Install Qt (64 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'x64' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win64_msvc2017_64
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
shell: bash
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
shell: bash
run: |
cmake --build . --config "$CONFIGURATION" --target INSTALL -- /verbosity:minimal
ls -alR "$(pwd)/install"
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
shell: bash
run: ./bin/$CONFIGURATION/unittests --gtest_shuffle
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: windows-${{ matrix.configuration }}-${{ matrix.arch }}-${{ matrix.simd }}
path: ${{ github.workspace }}/build/install/*
windows_zip:
name: Build Windows distribution zip
needs: build_windows
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
strategy:
matrix:
arch: [Win32, x64]
simd: [SSE2]
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: '0'
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: windows-Release-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: windows-FastDebug-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Create Distribution package
working-directory: ./builds
shell: bash
env:
ARCH: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Windows
- name: Upload result package
working-directory: ./builds
shell: bash
env:
INDIEGAMES_USER: ${{ secrets.INDIEGAMES_USER }}
INDIEGAMES_SSHPASS: ${{ secrets.INDIEGAMES_PASSWORD }}
DATACORDER_USER: ${{ secrets.DATACORDER_USER }}
DATACORDER_SSHPASS: ${{ secrets.DATACORDER_PASSWORD }}
run: $GITHUB_WORKSPACE/ci/linux/upload_dist_package.sh nightly
+265
View File
@@ -0,0 +1,265 @@
name: Build Release package
on:
push:
tags:
- 'release_*'
env:
QT_VERSION: 5.12.9
jobs:
create_release:
name: Create GitHub release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Store upload URL
run: |
echo -n "${{ steps.create_release.outputs.upload_url }}" > upload_url
- name: Persist upload URL
uses: actions/upload-artifact@v2
with:
name: upload_url
path: ${{ github.workspace }}/upload_url
build_linux:
strategy:
matrix:
configuration: [FastDebug, Release]
name: Linux
needs: create_release
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-e29f882
steps:
- name: Cache Qt
id: cache-qt-lin
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: gcc-5
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: |
LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Generate AppImage
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: linux-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/install/*.AppImage
linux_zip:
name: Build Linux distribution zip
needs: build_linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: '0'
- name: Download upload URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: .
- name: Extract upload URL
id: extractUploadUrl
run: echo "::set-output name=upload_url::$(cat upload_url)"
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: linux-Release
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: linux-FastDebug
path: builds
- name: Create Distribution package
id: generate_package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Linux
- name: Upload result package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
asset_path: ${{ steps.generate_package.outputs.package_path }}
asset_name: ${{ steps.generate_package.outputs.package_name }}
asset_content_type: ${{ steps.generate_package.outputs.package_mime }}
build_windows:
strategy:
matrix:
configuration: [FastDebug, Release]
arch: [Win32, x64]
simd: [SSE2, AVX]
needs: create_release
name: Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt (32 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'Win32' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win32_msvc2017
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Install Qt (64 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'x64' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win64_msvc2017_64
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
shell: bash
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
shell: bash
run: |
cmake --build . --config "$CONFIGURATION" --target INSTALL -- /verbosity:minimal
ls -alR "$(pwd)/install"
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
shell: bash
run: ./bin/$CONFIGURATION/unittests --gtest_shuffle
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: windows-${{ matrix.configuration }}-${{ matrix.arch }}-${{ matrix.simd }}
path: ${{ github.workspace }}/build/install/*
windows_zip:
name: Build Windows distribution zip
needs: build_windows
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
strategy:
matrix:
arch: [Win32, x64]
simd: [SSE2, AVX]
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: '0'
- name: Download upload URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: .
- name: Extract upload URL
id: extractUploadUrl
run: echo "::set-output name=upload_url::$(cat upload_url)"
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: windows-Release-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: windows-FastDebug-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Create Distribution package
id: generate_package
working-directory: ./builds
shell: bash
env:
ARCH: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Windows
- name: Upload result package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
asset_path: ${{ steps.generate_package.outputs.package_path }}
asset_name: ${{ steps.generate_package.outputs.package_name }}
asset_content_type: ${{ steps.generate_package.outputs.package_mime }}
- name: Upload debug symbols
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
asset_path: ${{ steps.generate_package.outputs.debug_path }}
asset_name: ${{ steps.generate_package.outputs.debug_name }}
asset_content_type: ${{ steps.generate_package.outputs.debug_mime }}
+226
View File
@@ -0,0 +1,226 @@
name: Build Test package
on:
push:
branches:
- 'test/*'
env:
QT_VERSION: 5.12.9
jobs:
build_linux:
strategy:
matrix:
configuration: [FastDebug, Release]
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-e29f882
steps:
- name: Cache Qt
id: cache-qt-lin
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Set up test version
shell: bash
run: |
[[ "${{ github.ref }}" =~ ^refs\/heads\/test\/(.*)$ ]]
# Override the revision string so that the builds are named correctly
echo "set(FSO_VERSION_REVISION_STR ${BASH_REMATCH[1]})" > "version_override.cmake"
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: gcc-5
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: |
LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Generate AppImage
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: linux-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/install/*.AppImage
linux_zip:
name: Build Linux distribution zip
needs: build_linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
fetch-depth: '0'
ref: '${{ github.ref }}'
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: linux-Release
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: linux-FastDebug
path: builds
- name: Create Distribution package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Linux
- name: Upload result package
working-directory: ./builds
env:
INDIEGAMES_USER: ${{ secrets.INDIEGAMES_USER }}
INDIEGAMES_SSHPASS: ${{ secrets.INDIEGAMES_PASSWORD }}
DATACORDER_USER: ${{ secrets.DATACORDER_USER }}
DATACORDER_SSHPASS: ${{ secrets.DATACORDER_PASSWORD }}
run: $GITHUB_WORKSPACE/ci/linux/upload_dist_package.sh test
build_windows:
strategy:
matrix:
configuration: [FastDebug, Release]
arch: [Win32, x64]
simd: [SSE2]
name: Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Set up test version
shell: bash
run: |
[[ "${{ github.ref }}" =~ ^refs\/heads\/test\/(.*)$ ]]
# Override the revision string so that the builds are named correctly
echo "set(FSO_VERSION_REVISION_STR ${BASH_REMATCH[1]})" > "version_override.cmake"
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt (32 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'Win32' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win32_msvc2017
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Install Qt (64 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.arch == 'x64' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win64_msvc2017_64
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
shell: bash
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
shell: bash
run: |
cmake --build . --config "$CONFIGURATION" --target INSTALL -- /verbosity:minimal
ls -alR "$(pwd)/install"
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
shell: bash
run: ./bin/$CONFIGURATION/unittests --gtest_shuffle
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: windows-${{ matrix.configuration }}-${{ matrix.arch }}-${{ matrix.simd }}
path: ${{ github.workspace }}/build/install/*
windows_zip:
name: Build Windows distribution zip
needs: build_windows
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
strategy:
matrix:
arch: [Win32, x64]
simd: [SSE2]
steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
fetch-depth: '0'
ref: '${{ github.ref }}'
- name: Download Release builds
uses: actions/download-artifact@v1
with:
name: windows-Release-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: windows-FastDebug-${{ matrix.arch }}-${{ matrix.simd }}
path: builds
- name: Create Distribution package
working-directory: ./builds
shell: bash
env:
ARCH: ${{ matrix.arch }}
SIMD: ${{ matrix.simd }}
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Windows
- name: Upload result package
working-directory: ./builds
shell: bash
env:
INDIEGAMES_USER: ${{ secrets.INDIEGAMES_USER }}
INDIEGAMES_SSHPASS: ${{ secrets.INDIEGAMES_PASSWORD }}
DATACORDER_USER: ${{ secrets.DATACORDER_USER }}
DATACORDER_SSHPASS: ${{ secrets.DATACORDER_PASSWORD }}
run: $GITHUB_WORKSPACE/ci/linux/upload_dist_package.sh test
+73 -50
View File
@@ -2,76 +2,73 @@ name: Check a pull request
on: [pull_request]
env:
QT_VERSION: 5.12.9
jobs:
build_linux:
strategy:
matrix:
configuration: [Debug, Release]
compiler: [gcc-5, gcc-9, clang-4.0]
compiler: [gcc-5, gcc-10, clang-9]
cmake_options: [""]
include:
# Also include configurations that check if the code compiles without the graphics backends
- configuration: Debug
compiler: gcc-10
cmake_options: -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_VULKAN=OFF
- configuration: Release
compiler: gcc-10
cmake_options: -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_VULKAN=OFF
name: Linux
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-e29f882
steps:
- name: Prepare Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:beineri/opt-qt571-xenial
sudo add-apt-repository ppa:msulikowski/valgrind # For fixing a bug with valgrind 3.11 which does not recognize the rdrand instruction
sudo apt-get -yq update
sudo apt-get -yq install cmake ninja-build libopenal-dev libreadline6-dev libpng12-dev libjpeg62-dev liblua5.1-0-dev libjansson-dev libsdl2-dev libfreetype6-dev valgrind qt57base g++-5 g++-9 clang-4.0 clang-tidy-4.0 libc++-dev libc++abi-dev
# Fix a header bug present in ubuntu...
sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h
- name: Cache Qt
id: cache-qt-lin
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: 0
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
run: |
if [ "$COMPILER" = "gcc-5" ]; then
export CC=gcc-5
export CXX=g++-5
fi
if [ "$COMPILER" = "gcc-9" ]; then
export CC=gcc-9
export CXX=g++-9
fi
if [ "$COMPILER" = "clang-4.0" ]; then
export CC=clang-4.0
export CXX=clang++-4.0
fi
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
if [[ "$CC" =~ ^clang.*$ ]]; then
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
fi
mkdir build
cd build
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON ..
JOB_CMAKE_OPTIONS: ${{ matrix.cmake_options }}
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
- name: Compile
working-directory: ./build
run: ninja -k 20 all
run: LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: |
if [ "$CONFIGURATION" = "Debug" ]; then
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$GITHUB_WORKSPACE/ci/travis/valgrind.supp" ./bin/unittests --gtest_shuffle
else
./bin/unittests --gtest_shuffle
fi
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Run Clang Tidy
# Clang-tidy reuses the precompiled headers so this only makes sense for the clang compilers
if: startsWith(matrix.compiler, 'clang-')
run: $GITHUB_WORKSPACE/ci/linux/clang_tidy.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Process clang-tidy warnings
if: startsWith(matrix.compiler, 'clang-')
uses: asarium/clang-tidy-action@v1
with:
fixesFile: clang-fixes.yaml
build_windows:
strategy:
matrix:
@@ -87,6 +84,31 @@ jobs:
name: Checkout
with:
submodules: true
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt (32 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.compiler == 'MSVC' && matrix.arch == 'Win32' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win32_msvc2017
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Install Qt (64 bit)
uses: jurplel/install-qt-action@v2
if: ${{ matrix.compiler == 'MSVC' && matrix.arch == 'x64' }}
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
arch: win64_msvc2017_64
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
aqtversion: ==0.8
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -102,7 +124,8 @@ jobs:
-DFSO_BUILD_FRED2="OFF" -DCMAKE_BUILD_TYPE=$CONFIGURATION -G "Ninja" ..
else
cmake -DFSO_USE_SPEECH="ON" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DMSVC_SIMD_INSTRUCTIONS=SSE2 -DFSO_BUILD_FRED2="ON" -G "Visual Studio 16 2019" -T "v142" -A "$ARCHITECTURE" ..
-DMSVC_SIMD_INSTRUCTIONS=SSE2 -DFSO_BUILD_FRED2="ON" -G "Visual Studio 16 2019" \
-DFSO_BUILD_QTFRED=ON -T "v142" -A "$ARCHITECTURE" ..
fi
- name: Compile
working-directory: ./build
@@ -3,7 +3,8 @@ name: Publish Standalone docker image
on:
push:
tags:
- '*'
- 'nightly_*'
- 'release_*'
jobs:
build_images:
@@ -12,13 +13,9 @@ jobs:
configuration: [FastDebug, Release]
include:
- configuration: FastDebug
latest_tag: latest_debug
nightly_tag: nightly_debug
release_tag: release_debug
tag_suffix: -debug
- configuration: Release
latest_tag: latest
nightly_tag: nightly
release_tag: release
tag_suffix: ""
fail-fast: false
runs-on: ubuntu-latest
steps:
@@ -26,23 +23,30 @@ jobs:
name: Checkout
with:
submodules: true
- name: Docker login
run: echo ${{ secrets.DOCKER_ACCESSTOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Docker build
run: docker build --build-arg build_type=${{ matrix.configuration }} -f docker/standalone/Dockerfile -t ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Push latest tag
run: |
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }}
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ghcr.io/scp-fs2open/standalone_server
tag-latest: false
- name: Push nightly tag
if: contains(github.ref, 'refs/tags/nightly_')
run: |
docker tag ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.nightly_tag }}
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.nightly_tag }}
- name: Push release tag
if: contains(github.ref, 'refs/tags/release_')
run: |
docker tag ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.release_tag }}
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.release_tag }}
- name: Login to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/standalone/Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}${{ matrix.tag_suffix }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
build_type=${{ matrix.configuration }}
+2 -28
View File
@@ -86,19 +86,6 @@ matrix:
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Debug" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DCLANG_USE_LIBCXX=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- clang-4.0
- libc++-dev
- libc++abi-dev
- os: linux
env: CONFIGURATION="Debug" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
@@ -116,7 +103,7 @@ matrix:
env: CONFIGURATION="Debug"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET=v141_xp CMAKE_GENERATOR="Visual Studio 15 2017"
env: CONFIGURATION="Debug" CMAKE_TOOLSET=v141 CMAKE_GENERATOR="Visual Studio 15 2017"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
@@ -140,19 +127,6 @@ matrix:
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Release" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DCLANG_USE_LIBCXX=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- clang-4.0
- libc++-dev
- libc++abi-dev
- os: linux
env: CONFIGURATION="Release" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
@@ -170,7 +144,7 @@ matrix:
env: CONFIGURATION="Release"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET=v141_xp CMAKE_GENERATOR="Visual Studio 15 2017"
env: CONFIGURATION="Release" CMAKE_TOOLSET=v141 CMAKE_GENERATOR="Visual Studio 15 2017"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
# There is a GCC compiler bug with MinGW that causes compilation failures on Windows at the moment
+19 -3
View File
@@ -8,6 +8,7 @@ if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
endif()
include(cmake/util.cmake)
include(cmake/embed_file.cmake)
# Set a few policies
set_policy(CMP0051 NEW)
@@ -43,9 +44,14 @@ PROJECT(FS2_Open)
find_program(CCACHE_PROGRAM ccache)
# Currently only GCC support ccache properly without generating additional warnings
if(CCACHE_PROGRAM AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Using ccache for compilation: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
if(NOT CMAKE_C_COMPILER_LAUNCHER)
message(STATUS "Using ccache for C compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
endif()
if(NOT CMAKE_CXX_COMPILER_LAUNCHER)
message(STATUS "Using ccache for C++ compilation: ${CCACHE_PROGRAM}")
SET(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
endif()
endif()
IF(CMAKE_CROSSCOMPILING)
@@ -121,6 +127,10 @@ option(FSO_RELEASE_LOGGING "Enable logging output for release builds" OFF)
OPTION(FSO_BUILD_WITH_FFMPEG "Enable the usage of FFmpeg for sound and custscenes" ON)
OPTION(FSO_BUILD_WITH_OPENGL "Enable compilation of the OpenGL renderer" ON)
OPTION(FSO_BUILD_WITH_VULKAN "Enable compilation of the Vulkan renderer" ON)
MARK_AS_ADVANCED(FORCE FSO_CMAKE_DEBUG)
MARK_AS_ADVANCED(FORCE FSO_BUILD_INCLUDED_LIBS)
MARK_AS_ADVANCED(FORCE FSO_USE_OPENALSOFT)
@@ -131,6 +141,8 @@ mark_as_advanced(FORCE FSO_INSTALL_DEBUG_FILES)
mark_as_advanced(FORCE ENABLE_COTIRE)
mark_as_advanced(FORCE FSO_RELEASE_LOGGING)
mark_as_advanced(FORCE FSO_BUILD_WITH_FFMPEG)
mark_as_advanced(FORCE FSO_BUILD_WITH_OPENGL)
mark_as_advanced(FORCE FSO_BUILD_WITH_VULKAN)
# Include cotire file from https://github.com/sakra/cotire/
include(cotire)
@@ -157,6 +169,8 @@ ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(parsers)
ADD_SUBDIRECTORY(code)
ADD_SUBDIRECTORY(freespace2)
@@ -205,3 +219,5 @@ message(STATUS "Building qtFRED: ${FSO_BUILD_QTFRED}")
message(STATUS "Fatal warnings: ${FSO_FATAL_WARNINGS}")
message(STATUS "Release logging: ${FSO_RELEASE_LOGGING}")
message(STATUS "With FFmpeg: ${FSO_BUILD_WITH_FFMPEG}")
message(STATUS "With OpenGL: ${FSO_BUILD_WITH_OPENGL}")
message(STATUS "With Vulkan: ${FSO_BUILD_WITH_VULKAN}")
+7
View File
@@ -12,4 +12,11 @@ Modifications by members of the FreeSpace Source Code Project are
released under whatever terms the individual authors choose, but the
above notice continues to apply to all fs2_open code.
All modifications made on or after November 1, 2020, shall be released under
the terms within [Unlicense](Unlicense.md). Modifications made before said date are released
under the previous terms with the exception of modifications made by members
of the FreeSpace Source Code Project that opt-in to the terms of Unlicense. Additionally,
a list of contributors who have opted in to the Unlicense terms can be found
in [**Licensing**](https://github.com/scp-fs2open/fs2open.github.com/wiki/Licensing).
See [**Licensing**](https://github.com/scp-fs2open/fs2open.github.com/wiki/Licensing) for more information.
+24
View File
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to [**Unlicense**](https://unlicense.org).
+2 -2
View File
@@ -8,11 +8,11 @@ environment:
matrix:
- BuildID: 0
CMAKE_GENERATOR: Visual Studio 14 2015
PlatformToolset: v140_xp
PlatformToolset: v140
QT_DIR: C:\Qt\5.9\msvc2015
- BuildID: 1
CMAKE_GENERATOR: Visual Studio 14 2015 Win64
PlatformToolset: v140_xp
PlatformToolset: v140
QT_DIR: C:\Qt\5.9\msvc2015_64
before_build:
- git submodule update --init --recursive
+48 -48
View File
@@ -9,56 +9,56 @@ class BuildConfig {
}
$NightlyConfigurations = @(
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
},
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$false;
}
# [BuildConfig]@{
# Generator="Visual Studio 14 2015 Win64";
# PackageType="Win64";
# Toolset="v140";
# SimdType="SSE2";
# QtDir="C:\Qt\5.9\msvc2015_64";
# SourcePackage=$false;
# },
# [BuildConfig]@{
# Generator="Visual Studio 14 2015";
# PackageType="Win32";
# Toolset="v140";
# SimdType="SSE2";
# QtDir="C:\Qt\5.9\msvc2015";
# SourcePackage=$false;
# }
)
$ReleaseConfigurations = @(
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$true;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32-AVX";
Toolset="v140_xp";
SimdType="AVX";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64-AVX";
Toolset="v140_xp";
SimdType="AVX";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
}
# [BuildConfig]@{
# Generator="Visual Studio 14 2015";
# PackageType="Win32";
# Toolset="v140";
# SimdType="SSE2";
# QtDir="C:\Qt\5.9\msvc2015";
# SourcePackage=$true;
# }
# [BuildConfig]@{
# Generator="Visual Studio 14 2015";
# PackageType="Win32-AVX";
# Toolset="v140";
# SimdType="AVX";
# QtDir="C:\Qt\5.9\msvc2015";
# SourcePackage=$false;
# }
# [BuildConfig]@{
# Generator="Visual Studio 14 2015 Win64";
# PackageType="Win64";
# Toolset="v140";
# SimdType="SSE2";
# QtDir="C:\Qt\5.9\msvc2015_64";
# SourcePackage=$false;
# }
# [BuildConfig]@{
# Generator="Visual Studio 14 2015 Win64";
# PackageType="Win64-AVX";
# Toolset="v140";
# SimdType="AVX";
# QtDir="C:\Qt\5.9\msvc2015_64";
# SourcePackage=$false;
# }
)
$BuildConfigurations = $null
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#
#
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
SCRIPT=$(readlink -f "$0")
HERE=$(dirname "$SCRIPT")
COMMIT_RANGE=$1..$2
if ! git rev-list $COMMIT_RANGE 2>&1 >/dev/null; then
echo "\$COMMIT_RANGE ($COMMIT_RANGE) is not valid for this build (probably caused by a rebase)."
exit 0
fi
# In order to get a proper diff without irrelevant changes, we need to determine where we branched off from the base
# branch
BASE_COMMIT=$(git merge-base $1 $2)
echo "Running clang-tidy on changed files"
git diff -U0 --no-color "$BASE_COMMIT..$2" | \
$HERE/clang-tidy-diff.py -path "$(pwd)/build" -p1 \
-regex '(code(?!\/graphics\/shaders\/compiled)|freespace2|qtfred|test|build|tools)\/.*\.(cpp|h)' \
-clang-tidy-binary /usr/bin/clang-tidy-9 -j$(nproc) -export-fixes "$(pwd)/clang-fixes.yaml"
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
if [ "$COMPILER" = "gcc-5" ]; then
export CC=gcc-5
export CXX=g++-5
fi
if [ "$COMPILER" = "gcc-10" ]; then
export CC=gcc-10
export CXX=g++-10
fi
if [ "$COMPILER" = "clang-9" ]; then
# Work around bug in clang that uses the wrong installation directory: https://bugs.llvm.org/show_bug.cgi?id=47460
export CC=$(readlink -f $(which clang-9))
export CXX=$(readlink -f $(which clang++-9))
fi
LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CMAKE_OPTIONS="$JOB_CMAKE_OPTIONS"
if [[ "$COMPILER" =~ ^clang.*$ ]]; then
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCLANG_USE_LIBCXX=ON"
fi
mkdir build
cd build
export CXXFLAGS
export CFLAGS
export LD_LIBRARY_PATH
cmake -G Ninja -DFSO_FATAL_WARNINGS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $CMAKE_OPTIONS \
-DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_BUILD_APPIMAGE=ON -DCMAKE_BUILD_TYPE=$CONFIGURATION \
-DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON \
-DSHADERS_ENABLE_COMPILATION=ON ..
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
SCRIPT=$(readlink -f "$0")
HERE=$(dirname "$SCRIPT")
OS="$1"
source $HERE/dist_functions.sh
if [ "$OS" = "Linux" ]; then
tar -cvzf "$(get_package_name)-builds-Linux.tar.gz" *
echo "::set-output name=package_path::$(pwd)/$(get_package_name)-builds-Linux.tar.gz"
echo "::set-output name=package_name::$(get_package_name)-builds-Linux.tar.gz"
echo "::set-output name=package_mime::$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-Linux.tar.gz")"
elif [ "$OS" = "Windows" ]; then
7z a -xr'!*.pdb' "$(get_package_name)-builds-$ARCH-$SIMD.zip" "*"
echo "::set-output name=package_path::$(pwd)/$(get_package_name)-builds-$ARCH-$SIMD.zip"
echo "::set-output name=package_name::$(get_package_name)-builds-$ARCH-$SIMD.zip"
echo "::set-output name=package_mime::$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-$ARCH-$SIMD.zip")"
7z a "$(get_package_name)-debug-$ARCH-$SIMD.7z" "*.pdb"
echo "::set-output name=debug_path::$(pwd)/$(get_package_name)-debug-$ARCH-$SIMD.7z"
echo "::set-output name=debug_name::$(get_package_name)-debug-$ARCH-$SIMD.7z"
echo "::set-output name=debug_mime::$(file -b --mime-type "$(pwd)/$(get_package_name)-debug-$ARCH-$SIMD.7z")"
else
echo "Invalid OS: $OS"
fi
+70
View File
@@ -0,0 +1,70 @@
function get_package_name() {
if git describe --match 'nightly_*' --exact-match 2>/dev/null >/dev/null; then
echo -n "$(git describe --match "nightly_*" --exact-match)"
return
fi
if git describe --match 'release_*' --exact-match 2>/dev/null >/dev/null; then
echo -n "$(git describe --match "release_*" --exact-match | sed 's/release_/fs2_open_/i')"
return
fi
if [[ "$(git branch --show-current)" =~ ^test\/(.*)$ ]]; then
echo -n "test_${BASH_REMATCH[1]}"
return
fi
echo "unknown_config"
}
function get_version_name() {
if git describe --match 'nightly_*' --exact-match 2>/dev/null >/dev/null; then
local tag_name=$(git describe --match "nightly_*" --exact-match)
# Use the bash regex matching for getting the relevant part of the tag name
[[ $tag_name =~ ^nightly_(.*)$ ]]
echo -n "${BASH_REMATCH[1]}"
return
fi
if git describe --match 'release_*' --exact-match 2>/dev/null >/dev/null; then
local tag_name=$(git describe --match "release_*" --exact-match)
# Use the bash regex matching for getting the relevant part of the tag name
[[ $tag_name =~ ^release_(.*)$ ]]
echo -n "${BASH_REMATCH[1]}"
return
fi
if [[ "$(git branch --show-current)" =~ ^test\/(.*)$ ]]; then
echo -n "${BASH_REMATCH[1]}"
return
fi
echo "unknown_config"
}
function upload_files_to_sftp() {
# We need empty glob patterns to "disappear" in the for loop below since this will be run for different configurations
# where it may be possible that some of the file patterns will not be present
shopt -s nullglob
echo "cd $2/" > sftp_batch
echo "mkdir $(get_version_name)" >> sftp_batch
# Create directory but do not cause an error if it already exists
sshpass -e sftp -oBatchMode=no -o "StrictHostKeyChecking no" -b sftp_batch $1 || true
echo "cd $2/$(get_version_name)/" > sftp_batch
for file in *.tar.gz *.7z *.zip; do
echo "put $file" >> sftp_batch
done
echo "bye" >> sftp_batch
sshpass -e sftp -oBatchMode=no -o "StrictHostKeyChecking no" -b sftp_batch $1
rm sftp_batch
}
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
INSTALL_FOLDER=$1
# Install Freespace2 targets
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER -DCOMPONENT=Unspecified -P cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER -DCOMPONENT=Freespace2 -P cmake_install.cmake
# We need to be a bit creative for determining the AppImage name since we don't want to hard-code the name
FILENAME="$(find $INSTALL_FOLDER/bin -name 'fs2_open_*' -type f -printf "%f\n").AppImage"
appimagetool -n $INSTALL_FOLDER "$INSTALL_FOLDER/$FILENAME"
chmod +x "$INSTALL_FOLDER/$FILENAME"
ls -al $INSTALL_FOLDER
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
SCRIPT=$(readlink -f "$0")
HERE=$(dirname "$SCRIPT")
export LD_LIBRARY_PATH=$(pwd)/bin/lib:$LD_LIBRARY_PATH
if [ "$CONFIGURATION" = "Debug" ]; then
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$HERE/valgrind.supp" ./bin/unittests --gtest_shuffle
else
./bin/unittests --gtest_shuffle
fi
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
UPLOAD_TYPE=$1
SCRIPT=$(readlink -f "$0")
HERE=$(dirname "$SCRIPT")
source $HERE/dist_functions.sh
if [ "$UPLOAD_TYPE" = "nightly" ]; then
SSHPASS=$INDIEGAMES_SSHPASS upload_files_to_sftp "$INDIEGAMES_USER@scp.indiegames.us" "public_html/builds/nightly"
SSHPASS=$DATACORDER_SSHPASS upload_files_to_sftp "$DATACORDER_USER@porphyrion.feralhosting.com" "www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly"
elif [ "$UPLOAD_TYPE" = "test" ]; then
SSHPASS=$DATACORDER_SSHPASS upload_files_to_sftp "$DATACORDER_USER@porphyrion.feralhosting.com" "www/datacorder.porphyrion.feralhosting.com/public_html/builds/test"
else
echo "Unknown upload type $UPLOAD_TYPE"
exit 1
fi
@@ -145,20 +145,19 @@
fun:dl_open_worker
}
{
<insert_a_suppression_name_here>
dlopen leak
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_dl_exception_create
fun:_dl_signal_error
fun:_dl_map_object
fun:dl_open_worker
fun:_dl_catch_exception
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_exception
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
obj:*
obj:*
fun:call_init.part.0
fun:call_init
fun:_dl_init
fun:dl_open_worker
}
-24
View File
@@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -e
if ! git rev-list $TRAVIS_COMMIT_RANGE 2>1 >/dev/null; then
echo "\$TRAVIS_COMMIT_RANGE ($TRAVIS_COMMIT_RANGE) is not valid for this build (probably caused by a rebase)."
exit 0
fi
cd "$TRAVIS_BUILD_DIR"
echo "Running clang-tidy on changed files"
git diff -U0 --no-color $TRAVIS_COMMIT_RANGE | \
$TRAVIS_BUILD_DIR/ci/travis/clang-tidy-diff.py -path "$TRAVIS_BUILD_DIR/build" -p1 \
-regex '(code|freespace2|qtfred|testsrc|build|tools)\/.*\.(cpp|h)' \
-clang-tidy-binary /usr/bin/clang-tidy-9 -j$(nproc) -quiet 2>/dev/null | \
tee clang-tidy-output.txt
if [[ -n $(grep "warning: " clang-tidy-output.txt) ]] || [[ -n $(grep "error: " clang-tidy-output.txt) ]]; then
echo "Errors or warnings were detected in the clang-tidy output!"
exit 1
else
echo -e "\033[1;32m\xE2\x9C\x93 passed:\033[0m clang-tidy test succeeded";
fi
+1 -1
View File
@@ -18,7 +18,7 @@ elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
XCODE_RET=${PIPESTATUS[0]}
if [ "$XCODE_RET" -ne "0" ]; then
tar -cvzf build.log.tar.gz build.log
curl --upload-file build.log.tar.gz "https://transfer.sh/build.log.tar.gz"
curl --upload-file build.log.tar.gz "https://keep.sh"
exit $XCODE_RET
fi
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
-2
View File
@@ -4,8 +4,6 @@ include(WriteCompilerDetectionHeader)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
set(CMAKE_CXX_STANDARD 11)
set(REQUIRED_CXX_FEATURES cxx_rvalue_references cxx_nullptr)
get_property(CMAKE_CXX_KNOWN_FEATURES GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
write_compiler_detection_header(
+114
View File
@@ -0,0 +1,114 @@
set(_EMBEDD_FILE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(target_embed_files _target)
set(options)
set(oneValueArgs RELATIVE_TO PATH_TYPE_PREFIX)
set(multiValueArgs FILES)
cmake_parse_arguments(EMBED "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT DEFINED EMBED_RELATIVE_TO)
set(EMBED_RELATIVE_TO "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
if (NOT IS_ABSOLUTE "${EMBED_RELATIVE_TO}")
get_filename_component(EMBED_RELATIVE_TO "${EMBED_RELATIVE_TO}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
foreach (file ${EMBED_FILES})
get_filename_component(_absoluteFile "${file}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
file(RELATIVE_PATH _pathType "${EMBED_RELATIVE_TO}" "${_absoluteFile}")
get_filename_component(_pathType ${_pathType} DIRECTORY)
if (DEFINED EMBED_PATH_TYPE_PREFIX)
if (_pathType)
set(_pathType "${EMBED_PATH_TYPE_PREFIX}/${_pathType}")
else()
# Avoid trailing / when we are in the same directory
set(_pathType "${EMBED_PATH_TYPE_PREFIX}")
endif()
endif()
if (NOT _pathType)
# If it is still empty then we need to work around yet another annoying CMake behavior where it ignores
# "empty" property strings
set(_pathType ".")
endif()
set_property(TARGET ${_target} APPEND PROPERTY EMBEDDED_FILES "${_absoluteFile}")
set_property(TARGET ${_target} APPEND PROPERTY EMBEDDED_FILES_BASE_DIR "${EMBED_RELATIVE_TO}")
set_property(TARGET ${_target} APPEND PROPERTY EMBEDDED_FILES_PATH_TYPE "${_pathType}")
endforeach()
endfunction()
function(handle_embedded_files _target)
get_target_property(_filesToEmbed ${_target} EMBEDDED_FILES)
get_target_property(_baseDirs ${_target} EMBEDDED_FILES_BASE_DIR)
get_target_property(_pathTypes ${_target} EMBEDDED_FILES_PATH_TYPE)
SET(DEF_OUT_FILES)
set(INCLUDE_LIST)
set(ARRAY_ELEMENTS)
list(LENGTH _filesToEmbed _numFiles)
FOREACH(i RANGE ${_numFiles})
# Why must CMake always do the unexpected thing? The foreach variant includes the last index as opposed to every
# other sensible language which does not include it...
if (i GREATER_EQUAL _numFiles)
break()
endif()
list(GET _filesToEmbed ${i} _filePath)
list(GET _baseDirs ${i} _baseDir)
list(GET _pathTypes ${i} _pathType)
if (_pathType STREQUAL ".")
# Handle the workaround we had to do for empty path types
set(_pathType "")
endif()
file(RELATIVE_PATH _relativeFilePath "${_baseDir}" "${_filePath}")
SET(_outputBasePath "${CMAKE_CURRENT_BINARY_DIR}/embedded_files/${_relativeFilePath}")
# For some reason this is needed...
get_filename_component(_outputDirectory ${_outputBasePath} DIRECTORY)
file(MAKE_DIRECTORY ${_outputDirectory})
# Retrieve the path type name from the relative path
file(TO_NATIVE_PATH "${_pathType}" _pathType)
if (MINGW)
# There is a bug in CMake where it thinks MinGW uses forward slashes for paths but we need backslashes for Windows builds
string(REPLACE "/" "\\" _pathType "${_pathType}")
endif()
# Properly escape back slashes in strings
string(REPLACE "\\" "\\\\" _pathType "${_pathType}")
get_filename_component(FILE_NAME "${_relativeFilePath}" NAME)
string(MAKE_C_IDENTIFIER "${_relativeFilePath}" FIELD_NAME)
set(HEADER_FILE "${_outputBasePath}.h")
set(SOURCE_FILE "${_outputBasePath}.cpp")
set(ALL_OUTPUTS "${HEADER_FILE}" "${SOURCE_FILE}")
set(FIELD_NAME "Embedded_${FIELD_NAME}")
set(INCLUDE_LIST "${INCLUDE_LIST}\n#include \"${HEADER_FILE}\"")
set(ARRAY_ELEMENTS "${ARRAY_ELEMENTS}\n\t{ \"${_pathType}\", \"${FILE_NAME}\" , ${FIELD_NAME} , ${FIELD_NAME}_size },")
add_custom_command(
OUTPUT ${ALL_OUTPUTS}
COMMAND embedfile "${_filePath}" "${_outputBasePath}" "${FIELD_NAME}"
MAIN_DEPENDENCY "${_filePath}"
COMMENT "Generating string file for ${_filePath}"
)
list(APPEND DEF_OUT_FILES ${ALL_OUTPUTS})
ENDFOREACH()
configure_file("${_EMBEDD_FILE_BASE_DIR}/embedded_files.inc.in" "${CMAKE_CURRENT_BINARY_DIR}/embedded_files/embedded_files.inc")
target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/embedded_files")
target_sources(${_target} PRIVATE ${DEF_OUT_FILES})
source_group("Generated Files\\Embedded Files" FILES ${DEF_OUT_FILES})
endfunction()
+2 -2
View File
@@ -20,8 +20,8 @@ target_link_libraries(platform INTERFACE ${WIN32_LIBS})
target_compile_definitions(platform INTERFACE WIN32 USE_OPENAL _WINDOWS)
# Specify minimum Windows version for the headers (currently this is XP)
target_compile_definitions(platform INTERFACE NTDDI_VERSION=0x05010000 _WIN32_WINNT=0x0501)
# Specify minimum Windows version for the headers (currently this is Vista)
target_compile_definitions(platform INTERFACE NTDDI_VERSION=0x06000000 _WIN32_WINNT=0x0600)
SET(EXE_GUI_TYPE WIN32)
set(PLATFORM_WINDOWS TRUE CACHE INTERNAL "" FORCE)
-1
View File
@@ -42,7 +42,6 @@ CHECK_FUNCTION_EXISTS(strlwr SCP_HAVE_STRLWR)
CHECK_INCLUDE_FILE("strings.h" SCP_HAVE_STRINGS_H)
check_symbol_exists(snprintf "stdio.h" SCP_HAVE_SNPRINTF)
check_symbol_exists(_snprintf "stdio.h" SCP_HAVE__SNPRINTF)
set(PLATFORM_CHECK_HEADER "${GENERATED_SOURCE_DIR}/platformChecks.h")
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/platformChecks.h.in "${PLATFORM_CHECK_HEADER}")
+12
View File
@@ -23,6 +23,7 @@ endif()
if (CLANG_USE_LIBCXX)
set(CXX_BASE_FLAGS "${CXX_BASE_FLAGS} -stdlib=libc++")
target_link_libraries(compiler INTERFACE "c++" "c++abi")
endif()
# Initialize with an empty string to make sure we always get a clean start
@@ -117,3 +118,14 @@ endif()
# Always define this to make sure that the fixed width format macros are available
target_compile_definitions(compiler INTERFACE __STDC_FORMAT_MACROS)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
# GNU ar: Create thin archive files.
# Requires binutils-2.19 or later.
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
target_link_libraries(compiler INTERFACE m)
+39 -8
View File
@@ -8,6 +8,8 @@ MESSAGE(STATUS "Doing configuration specific to gcc...")
option(GCC_ENABLE_LEAK_CHECK "Enable -fsanitize=leak" OFF)
option(GCC_ENABLE_ADDRESS_SANITIZER "Enable -fsanitize=address" OFF)
option(GCC_ENABLE_SANITIZE_UNDEFINED "Enable -fsanitize=undefined" OFF)
option(GCC_USE_GOLD "Use the gold linker instead of the standard linker" OFF)
option(GCC_GENERATE_GDB_INDEX "Adds linker option to generate the gdb index for debug builds" OFF)
# These are the default values
set(C_BASE_FLAGS "-march=native -pipe")
@@ -23,6 +25,16 @@ endif()
# Initialize with an empty string to make sure we always get a clean start
set(COMPILER_FLAGS "")
set(LINKER_FLAGS "")
if (GCC_USE_GOLD)
OPTION(GCC_INCREMENTAL_LINKING "Use incremental linking" OFF)
set(LINKER_FLAGS "${LINKER_FLAGS} -fuse-ld=gold")
if (GCC_INCREMENTAL_LINKING)
set(LINKER_FLAGS "${LINKER_FLAGS} -fno-use-linker-plugin -Wl,-z,norelro -Wl,--incremental")
endif()
endif()
# This is a slight hack since our flag setup is a bit more complicated
_enable_extra_compiler_warnings_flags()
@@ -30,9 +42,11 @@ set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
# Place each function and data in its own section so the linker can
# perform dead code elimination
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdata-sections -ffunction-sections")
if (NOT GCC_INCREMENTAL_LINKING)
# Place each function and data in its own section so the linker can
# perform dead code elimination
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdata-sections -ffunction-sections")
endif()
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# Force color diagnostics for Ninja generator
@@ -98,7 +112,7 @@ set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-but-set-variabl
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
# Always use the base flags and add our compiler flags at the bacl
# Always use the base flags and add our compiler flags at the back
set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_C_FLAGS "${C_BASE_FLAGS} ${COMPILER_FLAGS}")
@@ -108,7 +122,7 @@ set(CMAKE_C_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}")
IF (MINGW)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++ -Wl,--enable-auto-import")
@@ -121,17 +135,25 @@ endif()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g")
if (GCC_GENERATE_GDB_INDEX)
# For pure debug binaries, generate a gdb index for better debugging
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,--gdb-index")
endif()
IF(NOT MINGW)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
# Allow the linker to perform dead code elimination; this is considered
# experimental for COFF and PE formats and thus disabled for Windows builds
# (https://sourceware.org/binutils/docs/ld/Options.html)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
if (NOT GCC_INCREMENTAL_LINKING AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
endif()
ENDIF(NOT MINGW)
IF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-zignore")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-zignore")
ENDIF()
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
@@ -140,3 +162,12 @@ endif()
# Always define this to make sure that the fixed width format macros are available
target_compile_definitions(compiler INTERFACE __STDC_FORMAT_MACROS=1)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
# GNU ar: Create thin archive files.
# Requires binutils-2.19 or later.
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
+3
View File
@@ -17,6 +17,9 @@ ELSE("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
MESSAGE(STATUS "No special handling for this compiler present, good luck!")
ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
find_package(Threads REQUIRED)
target_link_libraries(compiler INTERFACE Threads::Threads)
# Copy release settings to FastDebug
set(CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
+43 -7
View File
@@ -140,14 +140,34 @@ macro(set_if_not_defined VAR VALUE)
endif()
endmacro(set_if_not_defined)
macro(configure_cotire target)
if(ENABLE_COTIRE)
# Disable unity build as it doesn't work well for us
set_target_properties(${target} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
function(set_precompiled_header _target _headerPath)
if (COMMAND target_precompile_headers)
target_compile_definitions(${_target} PRIVATE CMAKE_PCH)
target_precompile_headers(${_target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${_headerPath}>")
else()
if (ENABLE_COTIRE)
message("${_headerPath}")
set_target_properties(${_target} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${_headerPath}")
cotire(${target})
# Disable unity build as it doesn't work well for us
set_target_properties(${_target} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(${_target})
else()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${_target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${_headerPath}>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${_target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/FI ${_headerPath}>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(${_target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${_headerPath}>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
target_compile_options(${_target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${_headerPath}>")
ELSE()
MESSAGE("Unknown compiler for global includes. This will probably break the build.")
ENDIF()
endif()
endif()
endmacro(configure_cotire)
endfunction()
macro(add_target_copy_files)
foreach(file ${ARGN})
@@ -184,7 +204,7 @@ function(detect_simd_instructions _out_var)
endfunction()
function (check_linker_flag _flag _out_var)
SET(CMAKE_REQUIRED_FLAGS "${_flag}")
SET(CMAKE_REQUIRED_LINK_OPTIONS "${_flag}")
CHECK_C_COMPILER_FLAG("" ${_out_var})
endfunction(check_linker_flag)
@@ -198,6 +218,22 @@ function(suppress_warnings _target)
endif()
endfunction(suppress_warnings)
# Suppresses warnings for the specified files
function(suppress_file_warnings)
if (MSVC)
set_source_files_properties(
${ARGN}
PROPERTIES
COMPILE_FLAGS "/W0")
else()
# Assume everything else uses GCC style options
set_source_files_properties(
${ARGN}
PROPERTIES
COMPILE_FLAGS "-w")
endif()
endfunction(suppress_file_warnings)
function(list_target_dependencies _target _out_var)
set(out_list)
+1 -1
View File
@@ -6,7 +6,7 @@ if (EXISTS "${PROJECT_SOURCE_DIR}/version_override.cmake")
include("${PROJECT_SOURCE_DIR}/version_override.cmake")
endif()
set_if_not_defined(FSO_VERSION_MAJOR 20)
set_if_not_defined(FSO_VERSION_MAJOR 21)
set_if_not_defined(FSO_VERSION_MINOR 1)
set_if_not_defined(FSO_VERSION_BUILD 0)
+28 -24
View File
@@ -1,13 +1,12 @@
include(util)
INCLUDE(source_groups.cmake)
INCLUDE(voice_rec.cmake)
ADD_LIBRARY(code STATIC ${source_files} ${VOICE_REC_FILES})
target_compile_features(code PUBLIC ${REQUIRED_CXX_FEATURES})
INCLUDE(default_files.cmake)
target_compile_features(code PUBLIC cxx_std_11)
if (MSVC)
target_compile_definitions(code PUBLIC "PDB_DEBUGGING=1")
@@ -19,7 +18,9 @@ TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${FREESPACE_HEADERS})
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${GENERATED_SOURCE_DIR})
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${GENERATED_SOURCE_DIR}/code)
target_link_libraries(code PUBLIC OpenGL)
if (FSO_BUILD_WITH_OPENGL)
target_link_libraries(code PUBLIC OpenGL)
endif()
TARGET_LINK_LIBRARIES(code PUBLIC openal)
TARGET_LINK_LIBRARIES(code PUBLIC ${LUA_LIBS})
@@ -45,7 +46,13 @@ target_link_libraries(code PUBLIC libRocket)
target_link_libraries(code PUBLIC pcp)
target_link_libraries(code PUBLIC vulkan-hpp)
if (FSO_BUILD_WITH_VULKAN)
target_link_libraries(code PUBLIC vulkan-hpp)
endif()
target_link_libraries(code PUBLIC parsers)
target_link_libraries(code PUBLIC mdns)
enable_clang_tidy(code)
@@ -56,6 +63,8 @@ ENDIF(FSO_USE_SPEECH)
TARGET_LINK_LIBRARIES(code PUBLIC jansson)
target_link_libraries(code PUBLIC variant)
# Headers for standalone "gui" on UNIX
IF(UNIX)
TARGET_LINK_LIBRARIES(code PUBLIC ${MONGOOSE_LIBS})
@@ -67,22 +76,6 @@ IF(FSO_BUILD_TOOLS)
ADD_SUBDIRECTORY(cfileextractor)
ENDIF(FSO_BUILD_TOOLS)
if (ENABLE_COTIRE)
set_target_properties(code PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h")
else()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/FI ${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
ELSE()
MESSAGE("Unknown compiler for global includes. This will probably break the build.")
ENDIF()
endif()
if (FSO_RELEASE_LOGGING)
target_compile_definitions(code PUBLIC SCP_RELEASE_LOGGING)
endif()
@@ -90,9 +83,20 @@ endif()
if (FSO_BUILD_WITH_FFMPEG)
target_compile_definitions(code PUBLIC WITH_FFMPEG)
endif()
if (FSO_BUILD_WITH_OPENGL)
target_compile_definitions(code PUBLIC WITH_OPENGL)
endif()
if (FSO_BUILD_WITH_VULKAN)
target_compile_definitions(code PUBLIC WITH_VULKAN)
endif()
include(util)
configure_cotire(code)
include(shaders.cmake)
target_embed_files(code FILES ${default_files_files} RELATIVE_TO "def_files")
handle_embedded_files(code)
set_precompiled_header(code "${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h")
# Ensure that Xcode generates debug symbols on macOS for Debug builds
set_target_properties(code PROPERTIES XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES")
+8
View File
@@ -0,0 +1,8 @@
#include "Action.h"
namespace actions {
Action::~Action() = default;
}
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include "common.h"
namespace actions {
enum class ActionResult
{
Finished,
Errored,
Wait
};
class Action {
public:
virtual ~Action() = 0;
virtual ActionResult execute(ProgramLocals& locals) const = 0;
virtual std::unique_ptr<Action> clone() const = 0;
};
} // namespace actions
+21
View File
@@ -0,0 +1,21 @@
#include "ActionDefinition.h"
namespace actions {
ActionDefinition::ActionDefinition(SCP_string name, SCP_vector<ActionParameter> parameters)
: m_name(std::move(name)), m_parameters(std::move(parameters))
{
}
ActionDefinition::~ActionDefinition() = default;
const SCP_string& ActionDefinition::getName() const
{
return m_name;
}
const SCP_vector<ActionParameter>& ActionDefinition::getParameters() const
{
return m_parameters;
}
} // namespace actions
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include "Action.h"
#include "actions/expression/ActionExpression.h"
#include "actions/expression/Value.h"
namespace actions {
struct ActionParameter {
SCP_string name;
expression::ValueType type;
};
class ActionDefinition {
public:
ActionDefinition(SCP_string name, SCP_vector<ActionParameter> parameters);
virtual ~ActionDefinition();
const SCP_string& getName() const;
const SCP_vector<actions::ActionParameter>& getParameters() const;
virtual flagset<ProgramContextFlags> getRequiredContext() const = 0;
virtual std::unique_ptr<Action> createAction(
const SCP_unordered_map<SCP_string, expression::ActionExpression>& parameterExpressions) const = 0;
private:
SCP_string m_name;
SCP_vector<ActionParameter> m_parameters;
};
} // namespace actions
+145
View File
@@ -0,0 +1,145 @@
#include "ActionDefinitionManager.h"
#include "BuiltinActionDefinition.h"
#include "actions/types/MoveToSubmodel.h"
#include "actions/types/ParticleEffectAction.h"
#include "actions/types/PlaySoundAction.h"
#include "actions/types/SetDirectionAction.h"
#include "actions/types/SetPositionAction.h"
#include "actions/types/WaitAction.h"
#include "utils/join_string.h"
namespace actions {
namespace {
void parseActionParameters(const SCP_vector<ActionParameter>& params,
SCP_unordered_map<SCP_string, expression::ActionExpression>& parameterExpressions,
const expression::ParseContext& context)
{
// We do not impose a set order of the parameters so we need to do something similar to the outer loop and
// check for every possibility in a loop.
for (size_t i = 0; i < params.size(); ++i) {
// We might be doing some empty loops here in case of errors but there is a bound so this will finish
// eventually
for (const auto& parameter : params) {
// Do not check for parameters which we already found
if (parameterExpressions.find(parameter.name) != parameterExpressions.end()) {
continue;
}
const auto paramString = "+" + parameter.name + ":";
if (!optional_string(paramString.c_str())) {
continue;
}
// We found our parameter!
parameterExpressions[parameter.name] =
expression::ActionExpression::parseFromTable(parameter.type, context);
break;
}
}
}
} // namespace
const ActionDefinitionManager& ActionDefinitionManager::instance()
{
static const ActionDefinitionManager manager;
return manager;
}
void ActionDefinitionManager::addDefinition(std::unique_ptr<ActionDefinition> def)
{
m_definitions.push_back(std::move(def));
}
std::unique_ptr<Action> ActionDefinitionManager::parseAction(const flagset<ProgramContextFlags>& context_flags,
const expression::ParseContext& context) const
{
// We search through all definitions for every time we want to check for an action. This is not the most efficient
// way to handle this since it results in an O(n^2) runtime. A better alternative would be to either construct a
// regex with all the accepted actions as alternatives (although runtime of this is also doubtful) or peek at the
// next token, extract the relevant part (The stuff between "+" and ":") and then look that up in a map. Then we
// would get down to O(n).
// Since this only happens at parse time, this is good enough for now.
for (const auto& actionDef : m_definitions) {
const auto parseString = "+" + actionDef->getName() + ":";
if (!optional_string(parseString.c_str())) {
continue;
}
SCP_unordered_map<SCP_string, expression::ActionExpression> parameterExpressions;
const auto& params = actionDef->getParameters();
if (params.size() == 1) {
// Single parameters are expected to be placed directly after the action name
parameterExpressions[params.front().name] =
expression::ActionExpression::parseFromTable(params.front().type, context);
} else {
parseActionParameters(params, parameterExpressions, context);
if (parameterExpressions.size() != params.size()) {
SCP_vector<ActionParameter> missingParameters;
std::copy_if(params.cbegin(),
params.cend(),
std::back_inserter(missingParameters),
[&parameterExpressions](const ActionParameter& param) {
const auto iter = parameterExpressions.find(param.name);
return iter == parameterExpressions.cend();
});
SCP_vector<SCP_string> missingParameterNames;
std::transform(missingParameters.cbegin(),
missingParameters.cend(),
std::back_inserter(missingParameterNames),
[](const ActionParameter& param) { return "+" + param.name; });
const auto namesList = util::join_container(missingParameterNames, ", ");
error_display(0, "Missing parameters for action '%s': %s", parseString.c_str(), namesList.c_str());
// Fix up the parameter list so that we can continue parsing
for (const auto& missingParam : missingParameters) {
parameterExpressions[missingParam.name] = expression::ActionExpression();
}
}
}
auto actionInstance = actionDef->createAction(parameterExpressions);
const auto requiredFlags = actionDef->getRequiredContext();
if ((context_flags & requiredFlags) != requiredFlags) {
// We are missing at least one context flag so this action is not valid here. We still return the action
// here though since that is the only way we can keep parsing the table without throwing random error
// messages at the user. However, this will trigger an Assertion (in debug) or crashes when the action is
// actually run later.
error_display(0,
"The action %s is not available in the current context. This will lead to an Assertion failure when "
"this action is triggered.",
parseString.c_str());
}
return actionInstance;
}
return std::unique_ptr<Action>();
}
ActionDefinitionManager::ActionDefinitionManager()
{
addDefinition(
std::unique_ptr<ActionDefinition>(new BuiltinActionDefinition<types::MoveToSubmodel>("Move To Subobject")));
addDefinition(std::unique_ptr<ActionDefinition>(
new BuiltinActionDefinition<types::ParticleEffectAction>("Start Particle Effect")));
addDefinition(
std::unique_ptr<ActionDefinition>(new BuiltinActionDefinition<types::PlaySoundAction>("Play 3D Sound")));
addDefinition(
std::unique_ptr<ActionDefinition>(new BuiltinActionDefinition<types::SetDirectionAction>("Set Direction")));
addDefinition(
std::unique_ptr<ActionDefinition>(new BuiltinActionDefinition<types::SetPositionAction>("Set Position")));
addDefinition(std::unique_ptr<ActionDefinition>(new BuiltinActionDefinition<types::WaitAction>("Wait")));
}
} // namespace actions
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include "ActionDefinition.h"
namespace actions {
class ActionDefinitionManager {
public:
// This type is supposed to be global so it may not be copied
ActionDefinitionManager(const ActionDefinitionManager&) = delete;
ActionDefinitionManager& operator=(const ActionDefinitionManager&) = delete;
ActionDefinitionManager(ActionDefinitionManager&&) noexcept = default;
ActionDefinitionManager& operator=(ActionDefinitionManager&&) noexcept = default;
std::unique_ptr<Action> parseAction(const flagset<ProgramContextFlags>& context_flags,
const expression::ParseContext& context) const;
static const ActionDefinitionManager& instance();
private:
ActionDefinitionManager();
void addDefinition(std::unique_ptr<ActionDefinition> def);
SCP_vector<std::unique_ptr<ActionDefinition>> m_definitions;
};
} // namespace actions
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "ActionDefinition.h"
#include "expression/Value.h"
namespace actions {
template <typename TAction>
class BuiltinActionDefinition : public ActionDefinition {
using ActionValueType = typename TAction::ValueType;
public:
BuiltinActionDefinition(SCP_string name)
: ActionDefinition(std::move(name), {{"parameter", expression::ValueTypeTraits<ActionValueType>::type}})
{
}
~BuiltinActionDefinition() override = default;
flagset<ProgramContextFlags> getRequiredContext() const override
{
return flagset<ProgramContextFlags>(TAction::getRequiredExecutionContextFlags());
}
std::unique_ptr<Action> createAction(
const SCP_unordered_map<SCP_string, expression::ActionExpression>& parameterExpressions) const override
{
const auto paramIter = parameterExpressions.find("parameter");
// This should have been caught earlier
Assertion(paramIter != parameterExpressions.cend(), "Could not find built-in parameter!");
return std::unique_ptr<Action>(new TAction(paramIter->second.template asTyped<ActionValueType>()));
}
};
} // namespace actions
+174
View File
@@ -0,0 +1,174 @@
#include "Program.h"
#include "Action.h"
#include "actions/ActionDefinitionManager.h"
#include "executor/global_executors.h"
#include "tracing/Monitor.h"
#include "tracing/categories.h"
#include "tracing/tracing.h"
namespace {
using namespace actions;
tracing::Monitor<int> RunningProgramsMonitor("RunningPrograms", 0);
struct ProgramRunner {
tracing::RunningCounter runningCounter{RunningProgramsMonitor};
ProgramInstance instance;
explicit ProgramRunner(const ProgramInstance& _instance) : instance(_instance) {}
executor::Executor::CallbackResult operator()()
{
TRACE_SCOPE(tracing::ProgramStepOne);
auto res = instance.step();
switch (res) {
case ProgramState::Running:
// If the program is still running then we need to reschedule our execution
return executor::Executor::CallbackResult::Reschedule;
case ProgramState::Done:
case ProgramState::Errored:
default:
return executor::Executor::CallbackResult::Done;
}
}
};
} // namespace
namespace actions {
ProgramInstance::ProgramInstance(const actions::Program* program) : _program(program) {}
ProgramState ProgramInstance::step()
{
if (!_locals.host.IsValid()) {
return ProgramState::Done;
}
auto& actions = _program->getActions();
for (; _currentInstruction < actions.size(); ++_currentInstruction) {
auto& action = actions[_currentInstruction];
auto result = action->execute(_locals);
if (result == ActionResult::Errored) {
return ProgramState::Errored;
}
if (result == ActionResult::Wait) {
// Action is not done yet, call again next frame
return ProgramState::Running;
}
// Action finished, run next action in program
}
// End of program reached, we are done now
return ProgramState::Done;
}
ProgramLocals& ProgramInstance::locals()
{
return _locals;
}
const ProgramLocals& ProgramInstance::locals() const
{
return _locals;
}
const SCP_vector<std::unique_ptr<actions::Action>>& Program::getActions() const
{
return _actions;
}
Program::Program() = default;
ProgramInstance Program::newInstance() const
{
return ProgramInstance(this);
}
void Program::parseActions(const flagset<ProgramContextFlags>& context_flags, const expression::ParseContext& context)
{
while (true) {
auto action = ActionDefinitionManager::instance().parseAction(context_flags, context);
if (!action) {
break;
}
_actions.push_back(std::move(action));
}
}
Program::Program(const Program& other) { *this = other; }
Program& Program::operator=(const Program& other)
{
_actions.clear();
_actions.reserve(other._actions.size());
for (auto& action : other._actions) {
_actions.emplace_back(action->clone());
}
return *this;
}
Program& Program::operator=(Program&&) noexcept = default;
Program::Program(Program&&) noexcept = default;
bool ProgramSet::isEmpty() const
{
return _programs.empty();
}
ProgramSet::ProgramSet() = default;
ProgramSet::ProgramSet(const flagset<ProgramContextFlags>& context_flags) : _contextFlags(context_flags) {}
void ProgramSet::start(object* objp, const vec3d* local_pos, const matrix* local_orient, int submodel) const
{
if (_contextFlags[ProgramContextFlags::HasObject]) {
Assertion(objp != nullptr, "Invalid object pointer supplied.");
}
if (_contextFlags[ProgramContextFlags::HasSubobject]) {
Assertion(submodel >= 0, "Invalid subobject supplied.");
}
for (const auto& prog : _programs) {
auto instance = prog.newInstance();
instance.locals().host = object_h(objp);
instance.locals().localPosition = *local_pos;
instance.locals().localOrient = *local_orient;
instance.locals().hostSubobject = submodel;
instance.locals().variables = getDefaultTableVariables();
// Just use the executor system to take care of running this program
executor::OnSimulationExecutor->post(ProgramRunner(instance));
}
}
ProgramSet ProgramSet::parseProgramSet(const char* tag, const flagset<ProgramContextFlags>& context_flags)
{
ProgramSet set(context_flags);
const auto parseContext = getTableParseContext();
while (optional_string(tag)) {
Program p;
p.parseActions(context_flags, parseContext);
set._programs.push_back(std::move(p));
}
return set;
}
} // namespace actions
+112
View File
@@ -0,0 +1,112 @@
#pragma once
#include "globalincs/pstypes.h"
#include "Action.h"
#include "common.h"
namespace actions {
class Program;
class ProgramSet;
enum class ProgramState
{
Running,
Done,
Errored
};
/**
* @brief An instance of a program execution
*
* A program instance contains all information related to a single execution of a program. A program instance is
* independent from other instances. Local variables used by actions are stored in a specific structure which can be
* used by actions to keep track of state in this specific instance.
*/
class ProgramInstance {
size_t _currentInstruction = 0;
ProgramLocals _locals;
const Program* _program = nullptr;
public:
explicit ProgramInstance(const Program* program);
ProgramState step();
ProgramLocals& locals();
const ProgramLocals& locals() const;
};
/**
* @brief A program specified in a table
*
* A program is a sequential collection of Actions which are executed in sequence.
*/
class Program {
SCP_vector<std::unique_ptr<Action>> _actions;
public:
Program();
Program(const Program& other);
Program& operator=(const Program& other);
Program(Program&& other) noexcept;
Program& operator=(Program&& other) noexcept;
const SCP_vector<std::unique_ptr<actions::Action>>& getActions() const;
/**
* @brief Creates a new program instance from this program
*
* The program instance is initialized to its initial values.
*
* @return The new program instance
*/
ProgramInstance newInstance() const;
void parseActions(const flagset<ProgramContextFlags>& context_flags, const expression::ParseContext& context);
};
/**
* @brief A set of parsed programs
*
* Programs are parsed in sets of zero or more programs to make it possible for the content creator to split up
* programs.
*/
class ProgramSet {
flagset<ProgramContextFlags> _contextFlags;
SCP_vector<Program> _programs;
public:
ProgramSet();
explicit ProgramSet(const flagset<ProgramContextFlags>& context_flags);
bool isEmpty() const;
/**
* @brief Starts the execution of all programs within this set with the specified parameters
* @param objp The object on which this program is executed
* @param local_pos The local position relative to the object or the subsystem if specified
* @param local_orien The local orientation relative to the object or the subsystem if specified
* @param submodel The submodel of the model to which this program is attached to.
*/
void start(object* objp, const vec3d* local_pos, const matrix* local_orient, int submodel = -1) const;
/**
* @brief Parses a program set of zero or more programs
*
* The tag is entirely optional and if it doesn't appear in the current table then an empty set will be returned
* which does nothing if started.
*
* @param tag The tag which is required before a program can be specified
* @param context_flags A set of flags which specify in which environment the program will be used. This is used
* mainly for validating the used actions.
* @return The parsed program set.
*/
static ProgramSet parseProgramSet(const char* tag, const flagset<ProgramContextFlags>& context_flags = {});
};
} // namespace actions
+27
View File
@@ -0,0 +1,27 @@
#include "common.h"
namespace actions {
expression::ParseContext getTableParseContext()
{
expression::ParseContext ctx;
auto& locals = ctx.variables.addScope("locals");
locals.addMember("position", expression::ValueType::Vector);
locals.addMember("direction", expression::ValueType::Vector);
return ctx;
}
expression::ProgramVariables getDefaultTableVariables()
{
expression::ProgramVariables vars;
vars.setValue({"locals", "position"}, expression::Value(vmd_zero_vector));
vars.setValue({"locals", "direction"}, expression::Value(vmd_zero_vector));
return vars;
}
} // namespace actions
+59
View File
@@ -0,0 +1,59 @@
#pragma once
#include "globalincs/flagset.h"
#include "actions/expression/ParseContext.h"
#include "actions/expression/ProgramVariables.h"
#include "math/vecmat.h"
#include "object/object.h"
class object;
class ship_subsys;
namespace actions {
struct ProgramLocals {
object_h host;
vec3d localPosition = vmd_zero_vector;
matrix localOrient = vmd_identity_matrix;
int hostSubobject = -1;
int waitTimestamp = 0;
expression::ProgramVariables variables;
};
/**
* @brief A list of flags for altering the program parsing behavior
*
* This should be used for differentiating between different program environments when validating the program (e.g. a
* particle effect requires an object host).
*/
// clang-format off
FLAG_LIST(ProgramContextFlags) {
HasObject = 0, //!< The program will be started with an object host
HasSubobject, //!< The program will be started with a subobject host
NUM_VALUES
};
// clang-format on
/**
* @brief Constructs the "table" parse context
*
* This is the context that is available when parsing a program from an external table (e.g. ships or weapons).
*
* @return The parse context
*/
expression::ParseContext getTableParseContext();
/**
* @brief Gets a program variables instance initialized with the default values
*
* The values are consistent with what is required for the default table parse context;
*
* @return The program variables
*/
expression::ProgramVariables getDefaultTableVariables();
} // namespace actions
@@ -0,0 +1,66 @@
#include "ActionExpression.h"
#include "ExpressionParser.h"
#include "TypeDefinition.h"
#include "actions/expression/nodes/AbstractExpression.h"
namespace actions {
namespace expression {
namespace {
SCP_string getTypeName(ValueType type)
{
const auto& typeDef = TypeDefinition::forValueType(type);
return typeDef.getName();
}
} // namespace
ActionExpression ActionExpression::parseFromTable(ValueType expectedReturnType, const ParseContext& context)
{
SCP_string expressionText;
stuff_string(expressionText, F_NAME);
ExpressionParser parser(expressionText);
auto expression = parser.parse(context);
if (!expression) {
error_display(0, "Failed to parse action expression:\n%s", parser.getErrorText().c_str());
return ActionExpression();
}
auto type = expression->getExpressionType();
// Check if the type this evaluates to matches what we expect
if (!checkTypeWithImplicitConversion(type, expectedReturnType)) {
error_display(0,
"Expression evaluates to type <%s> but <%s> was expected!",
getTypeName(type).c_str(),
getTypeName(expectedReturnType).c_str());
return ActionExpression();
}
// Everything is valid
return ActionExpression(expression);
}
Value ActionExpression::execute(const ProgramVariables& variables) const
{
// Do not crash on invalid expressions
if (!isValid()) {
return Value();
}
return m_expression->execute(variables);
}
bool ActionExpression::isValid() const
{
return m_expression != nullptr;
}
} // namespace expression
} // namespace actions
@@ -0,0 +1,83 @@
#pragma once
#include "ParseContext.h"
#include "ProgramVariables.h"
#include "TypeDefinition.h"
#include "parse/parselo.h"
namespace actions {
namespace expression {
namespace nodes {
class AbstractExpression;
}
template <typename T>
class TypedActionExpression;
/**
* @brief An expression that can be executed to compute a value at runtime
*
* This is the basis of having dynamic values in actions by allowing mods to specify complex expressions that make use
* of variables and functions for computing their values at runtime.
*/
class ActionExpression {
public:
ActionExpression() = default;
Value execute(const ProgramVariables& variables) const;
bool isValid() const;
template <typename T>
TypedActionExpression<T> asTyped() const;
static ActionExpression parseFromTable(ValueType expectedReturnType, const ParseContext& context);
protected:
explicit ActionExpression(std::shared_ptr<nodes::AbstractExpression> expression)
: m_expression(std::move(expression))
{
}
std::shared_ptr<nodes::AbstractExpression> m_expression;
};
/**
* @brief An action expression with a specific type specified at compile time
*
* This is most useful for built-in actions that have the required type fixed at compile time.
*
* @tparam T The type of the expression value.
*/
template <typename T>
class TypedActionExpression {
public:
explicit TypedActionExpression(ActionExpression expression) : m_expression(std::move(expression)) {}
T execute(const ProgramVariables& variables) const
{
// Do not crash on invalid expressions
if (!m_expression.isValid()) {
return T();
}
return m_expression.execute(variables).template get<T>();
}
static TypedActionExpression<T> parseFromTable(const ParseContext& context)
{
return ActionExpression::parseFromTable(ValueTypeTraits<T>::type, context).template asTyped<T>();
}
private:
ActionExpression m_expression;
};
template <typename T>
TypedActionExpression<T> ActionExpression::asTyped() const
{
return TypedActionExpression<T>(*this);
}
} // namespace expression
} // namespace actions
@@ -0,0 +1,194 @@
#include "ExpressionParser.h"
#include "actions/expression/nodes/FunctionCallExpression.h"
#include "actions/expression/nodes/LiteralExpression.h"
#include "actions/expression/nodes/RandomRangeExpression.h"
#include "actions/expression/nodes/VariableReferenceExpression.h"
#include "actions/expression/nodes/VectorConstructorExpression.h"
#include "libs/antlr/ErrorListener.h"
PUSH_SUPPRESS_WARNINGS
#include "action_expression/generated/ActionExpressionLexer.h"
#include "action_expression/generated/ActionExpressionParser.h"
#include "action_expression/generated/ActionExpressionVisitor.h"
POP_SUPPRESS_WARNINGS
namespace actions {
namespace expression {
namespace {
class ExpressionBuilderVisitor : public ActionExpressionVisitor {
public:
antlrcpp::Any visitExpression_main(ActionExpressionParser::Expression_mainContext* context) override
{
return visit(context->expression());
}
antlrcpp::Any visitExpression(ActionExpressionParser::ExpressionContext* context) override
{
if (context->value_expression() != nullptr) {
return visit(context->value_expression());
}
if (context->parenthesis_expression()) {
return visit(context->parenthesis_expression());
}
if (context->random_range_expression()) {
return visit(context->random_range_expression());
}
if (context->variable_reference_expression()) {
return visit(context->variable_reference_expression());
}
// This is an operator so treat it as one.
antlr4::Token* operatorTok;
SCP_string operatorText;
if (context->PLUS() != nullptr) {
operatorTok = context->PLUS()->getSymbol();
operatorText = context->PLUS()->getText();
} else {
operatorTok = context->MINUS()->getSymbol();
operatorText = context->MINUS()->getText();
}
const auto leftExpr = visit(context->expression(0)).as<std::shared_ptr<nodes::AbstractExpression>>();
const auto rightExpr = visit(context->expression(1)).as<std::shared_ptr<nodes::AbstractExpression>>();
auto operatorExpression = std::make_shared<nodes::FunctionCallExpression>(operatorTok,
true,
std::move(operatorText),
SCP_vector<std::shared_ptr<nodes::AbstractExpression>>{leftExpr, rightExpr});
return std::static_pointer_cast<nodes::AbstractExpression>(operatorExpression);
}
antlrcpp::Any visitVariable_reference_expression(
ActionExpressionParser::Variable_reference_expressionContext* context) override
{
const auto identifiers = context->IDENTIFIER();
SCP_vector<SCP_string> partNames;
partNames.reserve(identifiers.size());
std::transform(identifiers.begin(),
identifiers.end(),
std::back_inserter(partNames),
[](antlr4::tree::TerminalNode* node) { return node->getText(); });
SCP_vector<antlr4::Token*> partTokens;
partTokens.reserve(identifiers.size());
std::transform(identifiers.begin(),
identifiers.end(),
std::back_inserter(partTokens),
[](antlr4::tree::TerminalNode* node) { return node->getSymbol(); });
auto expression =
std::make_shared<nodes::VariableReferenceExpression>(std::move(partNames), std::move(partTokens));
return std::static_pointer_cast<nodes::AbstractExpression>(expression);
}
antlrcpp::Any visitRandom_range_expression(ActionExpressionParser::Random_range_expressionContext* context) override
{
auto expression = std::make_shared<nodes::RandomRangeExpression>(context->RAND_L_PAREN()->getSymbol(),
visit(context->expression(0)).as<std::shared_ptr<nodes::AbstractExpression>>(),
visit(context->expression(1)).as<std::shared_ptr<nodes::AbstractExpression>>());
return std::static_pointer_cast<nodes::AbstractExpression>(expression);
}
antlrcpp::Any visitLiteral_expression(ActionExpressionParser::Literal_expressionContext* context) override
{
std::shared_ptr<nodes::LiteralExpression> expression;
if (context->FLOAT() != nullptr) {
expression = std::make_shared<nodes::LiteralExpression>(context->FLOAT()->getSymbol(),
Value(std::stof(context->FLOAT()->getText())));
} else if (context->INT() != nullptr) {
expression = std::make_shared<nodes::LiteralExpression>(context->INT()->getSymbol(),
Value(std::stoi(context->INT()->getText())));
} else {
const auto idText = context->STRING()->getText();
// Cut off the first and last characters since those are the < > braces
expression = std::make_shared<nodes::LiteralExpression>(context->STRING()->getSymbol(),
Value(idText.substr(1, idText.size() - 2)));
}
return std::static_pointer_cast<nodes::AbstractExpression>(expression);
}
antlrcpp::Any visitParenthesis_expression(ActionExpressionParser::Parenthesis_expressionContext* context) override
{
return visit(context->expression());
}
antlrcpp::Any visitValue_expression(ActionExpressionParser::Value_expressionContext* context) override
{
return visitChildren(context);
}
antlrcpp::Any visitVec3d_constructor(ActionExpressionParser::Vec3d_constructorContext* context) override
{
auto xExpression = visit(context->expression(0)).as<std::shared_ptr<nodes::AbstractExpression>>();
auto yExpression = visit(context->expression(1)).as<std::shared_ptr<nodes::AbstractExpression>>();
auto zExpression = visit(context->expression(2)).as<std::shared_ptr<nodes::AbstractExpression>>();
auto expression = std::make_shared<nodes::VectorConstructorExpression>(context->L_PAREN()->getSymbol(),
xExpression,
yExpression,
zExpression);
return std::static_pointer_cast<nodes::AbstractExpression>(expression);
}
};
} // namespace
ExpressionParser::ExpressionParser(SCP_string expressionText) : m_expressionText(std::move(expressionText)) {}
std::shared_ptr<nodes::AbstractExpression> ExpressionParser::parse(const ParseContext& context)
{
antlr4::ANTLRInputStream input(m_expressionText);
ActionExpressionLexer lexer(&input);
antlr4::CommonTokenStream tokens(&lexer);
::ActionExpressionParser parser(&tokens);
// By default we log to stderr which we do not want
parser.removeErrorListeners();
libs::antlr::ErrorListener errListener;
parser.addErrorListener(&errListener);
antlr4::tree::ParseTree* tree = parser.expression_main();
std::shared_ptr<nodes::AbstractExpression> exprReturn;
if (errListener.diagnostics.empty()) {
// Only do semantic checking if syntax is valid
ExpressionBuilderVisitor builder;
exprReturn = tree->accept(&builder).as<std::shared_ptr<nodes::AbstractExpression>>();
if (!exprReturn->validate(&parser, context)) {
exprReturn = nullptr;
} else {
exprReturn->validationDone();
}
}
if (!errListener.diagnostics.empty()) {
SCP_stringstream outStream;
for (const auto& diag : errListener.diagnostics) {
SCP_string tokenUnderline;
if (diag.tokenLength > 1) {
tokenUnderline = SCP_string(diag.tokenLength - 1, '~');
}
outStream << m_expressionText << "\n"
<< SCP_string(diag.columnInLine, ' ') << "^" << tokenUnderline << "\n"
<< diag.errorMessage << "\n";
}
m_errorText = outStream.str();
return nullptr;
}
return exprReturn;
}
const SCP_string& ExpressionParser::getErrorText() const
{
return m_errorText;
}
} // namespace expression
} // namespace actions
@@ -0,0 +1,27 @@
#pragma once
#include "globalincs/pstypes.h"
#include "ParseContext.h"
#include "actions/expression/nodes/AbstractExpression.h"
namespace actions {
namespace expression {
class ExpressionParser {
public:
ExpressionParser(SCP_string expressionText);
std::shared_ptr<nodes::AbstractExpression> parse(const ParseContext& context);
const SCP_string& getErrorText() const;
private:
SCP_string m_expressionText;
SCP_string m_errorText;
};
} // namespace expression
} // namespace actions
@@ -0,0 +1,90 @@
#include "FunctionManager.h"
#include "TypeDefinition.h"
#include "math/vecmat.h"
namespace actions {
namespace expression {
namespace {
template <typename T>
Value value_plus(const SCP_vector<Value>& parameters)
{
return Value(parameters[0].get<T>() + parameters[1].get<T>());
}
template <typename T>
Value value_minus(const SCP_vector<Value>& parameters)
{
return Value(parameters[0].get<T>() - parameters[1].get<T>());
}
} // namespace
const FunctionManager& FunctionManager::instance()
{
static const FunctionManager manager;
return manager;
}
void FunctionManager::addOperator(const SCP_string& name,
std::initializer_list<ValueType> parameterTypes,
ValueType returnType,
FunctionImplementation implementation)
{
m_operators[name].push_back({name, parameterTypes, returnType, std::move(implementation)});
}
const FunctionDefinition* FunctionManager::findOperator(const SCP_string& name,
const SCP_vector<ValueType>& parameters) const
{
const auto iter = m_operators.find(name);
if (iter == m_operators.end()) {
return nullptr;
}
// Prefer exact matches
for (const auto& funcDef : iter->second) {
if (funcDef.parameterTypes == parameters) {
return &funcDef;
}
}
// Now check if there are matches with implicit conversions
for (const auto& funcDef : iter->second) {
// Reject functions with different amount of elements
if (funcDef.parameterTypes.size() != parameters.size()) {
continue;
}
auto funcParamIter = funcDef.parameterTypes.cbegin();
auto actualParamIter = parameters.cbegin();
bool match = true;
for (; funcParamIter != funcDef.parameterTypes.cend(); ++funcParamIter, ++actualParamIter) {
if (!checkTypeWithImplicitConversion(*actualParamIter, *funcParamIter)) {
// Also doesn't match with implicit conversions
match = false;
break;
}
}
if (match) {
return &funcDef;
}
}
return nullptr;
}
FunctionManager::FunctionManager()
{
addOperator("+", {ValueType::Integer, ValueType::Integer}, ValueType::Integer, value_plus<int>);
addOperator("+", {ValueType::Float, ValueType::Float}, ValueType::Float, value_plus<float>);
addOperator("+", {ValueType::Vector, ValueType::Vector}, ValueType::Vector, value_plus<vec3d>);
addOperator("-", {ValueType::Integer, ValueType::Integer}, ValueType::Integer, value_minus<int>);
addOperator("-", {ValueType::Float, ValueType::Float}, ValueType::Float, value_minus<float>);
addOperator("-", {ValueType::Vector, ValueType::Vector}, ValueType::Vector, value_minus<vec3d>);
}
} // namespace expression
} // namespace actions
+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include "Value.h"
namespace actions {
namespace expression {
using FunctionImplementation = std::function<Value(const SCP_vector<Value>& parameters)>;
struct FunctionDefinition {
SCP_string name;
SCP_vector<ValueType> parameterTypes;
ValueType returnType;
FunctionImplementation implementation;
};
class FunctionManager {
public:
// This type is supposed to be global so it may not be copied
FunctionManager(const FunctionManager&) = delete;
FunctionManager& operator=(const FunctionManager&) = delete;
FunctionManager(FunctionManager&&) noexcept = default;
FunctionManager& operator=(FunctionManager&&) noexcept = default;
void addOperator(const SCP_string& name,
std::initializer_list<ValueType> parameterTypes,
ValueType returnType,
FunctionImplementation implementation);
const FunctionDefinition* findOperator(const SCP_string& name, const SCP_vector<ValueType>& parameterTypes) const;
static const FunctionManager& instance();
private:
FunctionManager();
SCP_unordered_map<SCP_string, SCP_vector<FunctionDefinition>> m_operators;
};
} // namespace expression
} // namespace actions
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "ProgramVariables.h"
namespace actions {
namespace expression {
struct ParseContext {
ProgramVariablesDefinition variables;
};
} // namespace expression
} // namespace actions
@@ -0,0 +1,61 @@
#include "ProgramVariables.h"
namespace actions {
namespace expression {
ProgramVariablesDefinition& ProgramVariablesDefinition::addScope(const SCP_string& name)
{
auto scope = std::unique_ptr<ProgramVariablesDefinition>(new ProgramVariablesDefinition());
auto scopePtr = scope.get();
m_scopes.insert(std::make_pair(name, std::move(scope)));
return *scopePtr;
}
void ProgramVariablesDefinition::addMember(const SCP_string& name, ValueType type)
{
m_memberTypes[name] = type;
}
ProgramVariablesDefinition* ProgramVariablesDefinition::getScope(const SCP_string& name) const
{
const auto iter = m_scopes.find(name);
if (iter == m_scopes.cend()) {
return nullptr;
}
return iter->second.get();
}
ValueType ProgramVariablesDefinition::getMemberType(const SCP_string& name) const
{
const auto iter = m_memberTypes.find(name);
if (iter == m_memberTypes.cend()) {
return ValueType::Invalid;
}
return iter->second;
}
Value ProgramVariables::getValue(std::initializer_list<const char*> memberPathParts) const
{
return getValue<decltype(memberPathParts)>(memberPathParts);
}
void ProgramVariables::setValue(std::initializer_list<const char*> memberPathParts, Value value)
{
setValue<decltype(memberPathParts)>(memberPathParts, std::move(value));
}
Value ProgramVariables::getValue(const SCP_string& fullMemberName) const
{
const auto iter = m_values.find(fullMemberName);
// This should have been validated earlier
Assertion(iter != m_values.end(), "Could not find member %s in variables!", fullMemberName.c_str());
return iter->second;
}
} // namespace expression
} // namespace actions
@@ -0,0 +1,61 @@
#pragma once
#include "Value.h"
#include "utils/join_string.h"
namespace actions {
namespace expression {
struct ProgramVariables {
public:
template <typename TContainer>
static SCP_string getMemberName(const TContainer& memberPathParts)
{
return util::join_container(memberPathParts, ".");
}
template <typename TContainer>
Value getValue(const TContainer& memberPathParts) const
{
const auto name = getMemberName(memberPathParts);
return getValue(name);
}
Value getValue(std::initializer_list<const char*> memberPathParts) const;
Value getValue(const SCP_string& fullMemberName) const;
template <typename TContainer>
void setValue(const TContainer& memberPathParts, Value value)
{
const auto name = getMemberName(memberPathParts);
m_values[name] = std::move(value);
}
void setValue(std::initializer_list<const char*> memberPathParts, Value value);
private:
SCP_unordered_map<SCP_string, Value> m_values;
};
class ProgramVariablesDefinition {
public:
ProgramVariablesDefinition& addScope(const SCP_string& name);
void addMember(const SCP_string& name, ValueType type);
ProgramVariablesDefinition* getScope(const SCP_string& name) const;
ValueType getMemberType(const SCP_string& name) const;
private:
SCP_unordered_map<SCP_string, std::unique_ptr<ProgramVariablesDefinition>> m_scopes;
SCP_unordered_map<SCP_string, ValueType> m_memberTypes;
};
} // namespace expression
} // namespace actions
@@ -0,0 +1,60 @@
#include "TypeDefinition.h"
namespace actions {
namespace expression {
// Integers can be safely converted to floats (for the most part)
TypeDefinition TypeDefinition::s_integer("Integer", {ValueType::Float});
// No implicit conversions here
TypeDefinition TypeDefinition::s_float("Float", {});
TypeDefinition TypeDefinition::s_vector("Vector", {});
// Identifiers are a technicality needed for making non-math values work but they have no further use other than their
// string content
TypeDefinition TypeDefinition::s_identifier("Identifier", {});
TypeDefinition::TypeDefinition(SCP_string name, SCP_vector<actions::expression::ValueType> allowedImplicitConversion)
: m_name(std::move(name)), m_allowedImplicitConversions(std::move(allowedImplicitConversion))
{
}
const SCP_string& TypeDefinition::getName() const
{
return m_name;
}
const SCP_vector<actions::expression::ValueType>& TypeDefinition::getAllowedImplicitConversions() const
{
return m_allowedImplicitConversions;
}
const TypeDefinition& TypeDefinition::forValueType(ValueType type)
{
switch (type) {
case ValueType::Integer:
return s_integer;
case ValueType::Float:
return s_float;
case ValueType::Vector:
return s_vector;
case ValueType::String:
return s_identifier;
default:
UNREACHABLE("Invalid value type!");
return s_integer; // Make compiler happy
}
}
bool checkTypeWithImplicitConversion(ValueType currentType, ValueType expectedType)
{
if (currentType == expectedType) {
// No need to consider implicit conversions;
return true;
}
const auto& currentTypeDef = TypeDefinition::forValueType(currentType);
const auto& allowedConversions = currentTypeDef.getAllowedImplicitConversions();
// For now, no transitiv conversions are allowed
return std::find(allowedConversions.cbegin(), allowedConversions.cend(), expectedType) != allowedConversions.cend();
}
} // namespace expression
} // namespace actions
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "Value.h"
namespace actions {
namespace expression {
class TypeDefinition {
public:
TypeDefinition(SCP_string name, SCP_vector<actions::expression::ValueType> allowedImplicitConversion);
const SCP_string& getName() const;
const SCP_vector<actions::expression::ValueType>& getAllowedImplicitConversions() const;
static const TypeDefinition& forValueType(ValueType type);
// This type is supposed to be global so it may not be copied
TypeDefinition(const TypeDefinition&) = delete;
TypeDefinition& operator=(const TypeDefinition&) = delete;
TypeDefinition(TypeDefinition&&) = delete;
TypeDefinition& operator=(TypeDefinition&&) = delete;
private:
SCP_string m_name;
// The types this type is allowed to implicitly convert to
SCP_vector<ValueType> m_allowedImplicitConversions;
static TypeDefinition s_integer;
static TypeDefinition s_float;
static TypeDefinition s_vector;
static TypeDefinition s_identifier;
};
bool checkTypeWithImplicitConversion(ValueType currentType, ValueType expectedType);
} // namespace expression
} // namespace actions
+80
View File
@@ -0,0 +1,80 @@
#include "Value.h"
#include "math/vecmat.h"
namespace actions {
namespace expression {
Value::Value(int val) : m_value(val) {}
Value::Value(float val) : m_value(val) {}
Value::Value(const vec3d& val) : m_value(val) {}
Value::Value(SCP_string val) : m_value(std::move(val)) {}
ValueType actions::expression::Value::getType() const
{
switch (m_value.index()) {
case 1:
return ValueType::Integer;
case 2:
return ValueType::Float;
case 3:
return ValueType::Vector;
case 4:
return ValueType::String;
default:
return ValueType::Invalid;
}
}
int Value::getInteger() const
{
return get<int>();
}
float Value::getFloat() const
{
return get<float>();
}
vec3d Value::getVector() const
{
return get<vec3d>();
}
SCP_string Value::getIdentifier() const
{
return get<SCP_string>();
}
bool operator==(const Value& lhs, const Value& rhs)
{
return lhs.m_value == rhs.m_value;
}
bool operator!=(const Value& lhs, const Value& rhs)
{
return !(rhs == lhs);
}
std::ostream& operator<<(std::ostream& os, const Value& value)
{
os << "Value<";
switch (value.getType()) {
case ValueType::Invalid:
os << "INVALID";
break;
case ValueType::Integer:
os << value.get<int>();
break;
case ValueType::Float:
os << value.get<float>();
break;
case ValueType::Vector:
os << value.get<vec3d>();
break;
case ValueType::String:
os << value.get<SCP_string>();
break;
}
os << ">";
return os;
}
} // namespace expression
} // namespace actions
+104
View File
@@ -0,0 +1,104 @@
#pragma once
#include "globalincs/pstypes.h"
#include <mpark/variant.hpp>
namespace actions {
namespace expression {
namespace detail {
template <typename ToType>
struct implicit_conversion {
template <typename T>
ToType operator()(const T&)
{
throw std::runtime_error("Invalid implicit conversion.");
}
};
template<>
struct implicit_conversion<float> {
inline float operator()(int val) {
return i2fl(val);
}
template <typename T>
float operator()(const T&)
{
throw std::runtime_error("Invalid implicit conversion.");
}
};
} // namespace detail
enum class ValueType
{
Invalid,
Integer,
Float,
Vector,
String,
};
template <typename T>
struct ValueTypeTraits;
template <>
struct ValueTypeTraits<int> {
static constexpr ValueType type = ValueType::Integer;
};
template <>
struct ValueTypeTraits<float> {
static constexpr ValueType type = ValueType::Float;
};
template <>
struct ValueTypeTraits<vec3d> {
static constexpr ValueType type = ValueType::Vector;
};
template <>
struct ValueTypeTraits<SCP_string> {
static constexpr ValueType type = ValueType::String;
};
class Value {
public:
Value() = default;
explicit Value(int val);
explicit Value(float val);
explicit Value(const vec3d& val);
explicit Value(SCP_string val);
ValueType getType() const;
int getInteger() const;
float getFloat() const;
vec3d getVector() const;
SCP_string getIdentifier() const;
template <typename T>
T get() const
{
const auto currentType = getType();
const auto expectedType = ValueTypeTraits<T>::type;
if (currentType == expectedType) {
// No conversion necessary
return mpark::get<T>(m_value);
}
return mpark::visit(detail::implicit_conversion<T>{}, m_value);
}
friend bool operator==(const Value& lhs, const Value& rhs);
friend bool operator!=(const Value& lhs, const Value& rhs);
friend std::ostream& operator<<(std::ostream& os, const Value& value);
private:
mpark::variant<mpark::monostate, int, float, vec3d, SCP_string> m_value;
};
} // namespace expression
} // namespace actions
@@ -0,0 +1,31 @@
#include "AbstractExpression.h"
namespace actions {
namespace expression {
namespace nodes {
AbstractExpression::AbstractExpression(antlr4::Token* token) : m_token(token) {}
AbstractExpression::~AbstractExpression() = default;
antlr4::Token* AbstractExpression::getToken() const
{
return m_token;
}
ValueType AbstractExpression::getExpressionType() const
{
// Since expressions are immutable, caching this will be more efficient
if (m_cachedType == ValueType::Invalid) {
m_cachedType = determineReturnType();
}
return m_cachedType;
}
void AbstractExpression::validationDone()
{
// This pointer will become invalid after this so reset it now to avoid issues
m_token = nullptr;
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,38 @@
#pragma once
#include "actions/expression/ParseContext.h"
#include "actions/expression/Value.h"
#include <Parser.h>
#include <Token.h>
namespace actions {
namespace expression {
namespace nodes {
class AbstractExpression {
public:
AbstractExpression(antlr4::Token* token);
virtual ~AbstractExpression();
virtual Value execute(const ProgramVariables& variables) const = 0;
virtual bool validate(antlr4::Parser* parser, const ParseContext& context) = 0;
virtual void validationDone();
ValueType getExpressionType() const;
antlr4::Token* getToken() const;
protected:
virtual ValueType determineReturnType() const = 0;
antlr4::Token* m_token = nullptr;
mutable ValueType m_cachedType = ValueType::Invalid;
};
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,95 @@
#include "FunctionCallExpression.h"
#include "actions/expression/TypeDefinition.h"
namespace actions {
namespace expression {
namespace nodes {
FunctionCallExpression::FunctionCallExpression(antlr4::Token* token,
bool isOperator,
SCP_string functionName,
SCP_vector<std::shared_ptr<AbstractExpression>> parameterExpressions)
: AbstractExpression(token), m_isOperator(isOperator), m_functionName(std::move(functionName)),
m_parameterExpressions(std::move(parameterExpressions))
{
}
FunctionCallExpression::~FunctionCallExpression() = default;
Value FunctionCallExpression::execute(const ProgramVariables& variables) const
{
SCP_vector<Value> parameterValues;
parameterValues.reserve(m_parameterExpressions.size());
std::transform(m_parameterExpressions.cbegin(),
m_parameterExpressions.cend(),
std::back_inserter(parameterValues),
[&variables](const std::shared_ptr<AbstractExpression>& expression) { return expression->execute(variables); });
return m_functionDef->implementation(parameterValues);
}
bool FunctionCallExpression::validate(antlr4::Parser* parser, const ParseContext& context)
{
bool valid = true;
for (const auto& paramExpression : m_parameterExpressions) {
valid &= paramExpression->validate(parser, context);
}
if (!valid) {
// Exit early if there were errors since the values below are meaningless otherwise
return false;
}
Assertion(m_isOperator, "Non-operator functions are not supported yet!");
SCP_vector<ValueType> parameterTypes;
std::transform(m_parameterExpressions.cbegin(),
m_parameterExpressions.cend(),
std::back_inserter(parameterTypes),
[](const std::shared_ptr<AbstractExpression>& expression) { return expression->getExpressionType(); });
const auto functionDef = FunctionManager::instance().findOperator(m_functionName, parameterTypes);
if (functionDef == nullptr) {
SCP_stringstream paramListStream;
if (!parameterTypes.empty()) {
paramListStream << "<" << TypeDefinition::forValueType(parameterTypes.front()).getName() << ">";
for (auto iter = parameterTypes.cbegin() + 1; iter != parameterTypes.cend(); ++iter) {
paramListStream << ", <" << TypeDefinition::forValueType(*iter).getName() << ">";
}
}
parser->notifyErrorListeners(m_token,
SCP_string("Could not find a definition for the ") + (m_isOperator ? "operator" : "function") + " '" +
m_functionName + "' with parameters (" + paramListStream.str() + ")",
nullptr);
return false;
}
m_functionDef = functionDef;
return true;
}
ValueType FunctionCallExpression::determineReturnType() const
{
return m_functionDef->returnType;
}
void FunctionCallExpression::validationDone()
{
AbstractExpression::validationDone();
// We no longer need this so we can save some memory
m_functionName.clear();
m_functionName.shrink_to_fit();
for (const auto& paramExpression : m_parameterExpressions) {
paramExpression->validationDone();
}
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,38 @@
#pragma once
#include "AbstractExpression.h"
#include "actions/expression/FunctionManager.h"
#include "actions/expression/Value.h"
namespace actions {
namespace expression {
namespace nodes {
class FunctionCallExpression : public AbstractExpression {
public:
FunctionCallExpression(antlr4::Token* token,
bool isOperator,
SCP_string functionName,
SCP_vector<std::shared_ptr<AbstractExpression>> parameterExpressions);
~FunctionCallExpression() override;
Value execute(const ProgramVariables& variables) const override;
bool validate(antlr4::Parser* parser, const ParseContext& context) override;
void validationDone() override;
protected:
ValueType determineReturnType() const override;
private:
bool m_isOperator;
SCP_string m_functionName;
const FunctionDefinition* m_functionDef = nullptr;
SCP_vector<std::shared_ptr<AbstractExpression>> m_parameterExpressions;
};
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,30 @@
#include "LiteralExpression.h"
namespace actions {
namespace expression {
namespace nodes {
LiteralExpression::LiteralExpression(antlr4::Token* token, Value literalValue)
: AbstractExpression(token), m_literalValue(std::move(literalValue))
{
}
LiteralExpression::~LiteralExpression() = default;
Value LiteralExpression::execute(const ProgramVariables& /*variables*/) const
{
return m_literalValue;
}
bool LiteralExpression::validate(antlr4::Parser* /*parser*/, const ParseContext& /*context*/)
{
// Literals are always valid
return true;
}
ValueType LiteralExpression::determineReturnType() const
{
return m_literalValue.getType();
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,28 @@
#pragma once
#include "AbstractExpression.h"
#include "actions/expression/Value.h"
namespace actions {
namespace expression {
namespace nodes {
class LiteralExpression : public AbstractExpression {
public:
LiteralExpression(antlr4::Token* token, Value literalValue);
~LiteralExpression() override;
Value execute(const ProgramVariables& variables) const override;
bool validate(antlr4::Parser* parser, const ParseContext& context) override;
protected:
ValueType determineReturnType() const override;
private:
Value m_literalValue;
};
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,108 @@
#include "RandomRangeExpression.h"
#include "actions/expression/TypeDefinition.h"
#include "utils/RandomRange.h"
namespace actions {
namespace expression {
namespace nodes {
namespace {
template <typename T>
Value executeHelper(const Value& leftVal, const Value& rightVal)
{
auto leftContentVal = leftVal.get<T>();
auto rightContentVal = rightVal.get<T>();
if (leftContentVal == rightContentVal) {
// no need to do random stuff here
return Value(rightContentVal);
}
if (rightContentVal < leftContentVal) {
// We can fix this issue
std::swap(leftContentVal, rightContentVal);
}
// Might be a bit inefficient not to cache this somehow but the bounds can be dynamic
return Value(util::UniformRange<T>(leftContentVal, rightContentVal).next());
}
} // namespace
RandomRangeExpression::RandomRangeExpression(antlr4::Token* token,
std::shared_ptr<AbstractExpression> leftExpression,
std::shared_ptr<AbstractExpression> rightExpression)
: AbstractExpression(token), m_leftExpression(std::move(leftExpression)),
m_rightExpression(std::move(rightExpression))
{
}
RandomRangeExpression::~RandomRangeExpression() = default;
Value RandomRangeExpression::execute(const ProgramVariables& variables) const
{
const auto leftVal = m_leftExpression->execute(variables);
const auto rightVal = m_rightExpression->execute(variables);
if (leftVal.getType() == ValueType::Integer) {
return executeHelper<int>(leftVal, rightVal);
} else {
return executeHelper<float>(leftVal, rightVal);
}
}
bool RandomRangeExpression::validate(antlr4::Parser* parser, const ParseContext& context)
{
bool valid = true;
valid &= m_leftExpression->validate(parser, context);
valid &= m_rightExpression->validate(parser, context);
if (!valid) {
// Exit early if there were errors since the values below are meaningless otherwise
return false;
}
const auto leftType = m_leftExpression->getExpressionType();
const auto rightType = m_rightExpression->getExpressionType();
const auto& leftTypedef = TypeDefinition::forValueType(leftType);
const auto& rightTypedef = TypeDefinition::forValueType(rightType);
// Both values must be the same
if (leftType != rightType) {
parser->notifyErrorListeners(m_rightExpression->getToken(),
"Inconsistent types for random range. Must be the same but got <" + leftTypedef.getName() + "> and <" +
rightTypedef.getName() + ">.",
nullptr);
return false;
}
// And we only support floats or integers
if (leftType != ValueType::Float && leftType != ValueType::Integer) {
parser->notifyErrorListeners(m_leftExpression->getToken(),
"Invalid parameter type for random range. Must be <Float> or <Integer> but got <" + leftTypedef.getName() +
">.",
nullptr);
return false;
}
// Everything is fine.
return true;
}
ValueType RandomRangeExpression::determineReturnType() const
{
// Return type is the same as the contained return types
return m_leftExpression->getExpressionType();
}
void RandomRangeExpression::validationDone()
{
AbstractExpression::validationDone();
m_leftExpression->validationDone();
m_rightExpression->validationDone();
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,30 @@
#pragma once
#include "AbstractExpression.h"
namespace actions {
namespace expression {
namespace nodes {
class RandomRangeExpression : public AbstractExpression {
public:
RandomRangeExpression(antlr4::Token* token,
std::shared_ptr<AbstractExpression> leftExpression,
std::shared_ptr<AbstractExpression> rightExpression);
~RandomRangeExpression() override;
Value execute(const ProgramVariables& variables) const override;
bool validate(antlr4::Parser* parser, const ParseContext& context) override;
void validationDone() override;
protected:
ValueType determineReturnType() const override;
private:
std::shared_ptr<AbstractExpression> m_leftExpression;
std::shared_ptr<AbstractExpression> m_rightExpression;
};
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,69 @@
#include "VariableReferenceExpression.h"
namespace actions {
namespace expression {
namespace nodes {
VariableReferenceExpression::VariableReferenceExpression(SCP_vector<SCP_string> references,
SCP_vector<antlr4::Token*> referenceTokens)
: AbstractExpression(referenceTokens.back()), m_references(std::move(references)),
m_referenceTokens(std::move(referenceTokens))
{
}
VariableReferenceExpression::~VariableReferenceExpression() = default;
Value VariableReferenceExpression::execute(const ProgramVariables& variables) const
{
return variables.getValue(m_fullVariablePath);
}
bool VariableReferenceExpression::validate(antlr4::Parser* parser, const ParseContext& context)
{
// Start out in the global scope
auto currentScope = &context.variables;
SCP_string currentScopeName("<global>");
for (size_t i = 0; i < m_references.size() - 1; ++i) {
const auto nextScope = currentScope->getScope(m_references[i]);
if (nextScope == nullptr) {
parser->notifyErrorListeners(m_referenceTokens[i],
"Could not find scope " + m_references[i] + " in scope " + currentScopeName + ".",
nullptr);
return false;
}
currentScope = nextScope;
currentScopeName = m_references[i];
}
auto variableType = currentScope->getMemberType(m_references.back());
if (variableType == ValueType::Invalid) {
parser->notifyErrorListeners(m_referenceTokens.back(),
"Could not find variable " + m_references.back() + " in scope " + currentScopeName + ".",
nullptr);
return false;
}
// Cache this so we don't duplicate all this code in determineReturnType()
m_variableType = variableType;
m_fullVariablePath = ProgramVariables::getMemberName(m_references);
return true;
}
ValueType VariableReferenceExpression::determineReturnType() const
{
return m_variableType;
}
void VariableReferenceExpression::validationDone()
{
AbstractExpression::validationDone();
// Clear these since they are not necessary anymore
m_references.clear();
m_referenceTokens.clear();
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,32 @@
#pragma once
#include "AbstractExpression.h"
namespace actions {
namespace expression {
namespace nodes {
class VariableReferenceExpression : public AbstractExpression {
public:
VariableReferenceExpression(const SCP_vector<SCP_string> references,
SCP_vector<antlr4::Token*> referenceTokens);
~VariableReferenceExpression() override;
Value execute(const ProgramVariables& variables) const override;
bool validate(antlr4::Parser* parser, const ParseContext& context) override;
void validationDone() override;
protected:
ValueType determineReturnType() const override;
private:
ValueType m_variableType = ValueType::Invalid;
SCP_string m_fullVariablePath;
SCP_vector<SCP_string> m_references;
SCP_vector<antlr4::Token*> m_referenceTokens;
};
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,87 @@
#include "VectorConstructorExpression.h"
#include "actions/expression/TypeDefinition.h"
namespace actions {
namespace expression {
namespace nodes {
VectorConstructorExpression::VectorConstructorExpression(antlr4::Token* token,
std::shared_ptr<AbstractExpression> xExpression,
std::shared_ptr<AbstractExpression> yExpression,
std::shared_ptr<AbstractExpression> zExpression)
: AbstractExpression(token), m_xExpression(std::move(xExpression)), m_yExpression(std::move(yExpression)),
m_zExpression(std::move(zExpression))
{
}
VectorConstructorExpression::~VectorConstructorExpression() = default;
Value VectorConstructorExpression::execute(const ProgramVariables& variables) const
{
auto xValue = m_xExpression->execute(variables);
auto yValue = m_yExpression->execute(variables);
auto zValue = m_zExpression->execute(variables);
vec3d vecVal;
vecVal.xyz.x = xValue.getFloat();
vecVal.xyz.y = yValue.getFloat();
vecVal.xyz.z = zValue.getFloat();
return Value(vecVal);
}
bool VectorConstructorExpression::validate(antlr4::Parser* parser, const ParseContext& context)
{
bool valid = true;
valid &= m_xExpression->validate(parser, context);
valid &= m_yExpression->validate(parser, context);
valid &= m_zExpression->validate(parser, context);
if (!valid) {
// Exit early if there were errors since the values below are meaningless otherwise
return false;
}
if (!checkTypeWithImplicitConversion(m_xExpression->getExpressionType(), ValueType::Float)) {
const auto& typeDef = TypeDefinition::forValueType(m_xExpression->getExpressionType());
parser->notifyErrorListeners(m_xExpression->getToken(),
"Invalid value type for vector constructor. Expected <Float>, got <" + typeDef.getName() + ">",
nullptr);
valid = false;
}
if (!checkTypeWithImplicitConversion(m_yExpression->getExpressionType(), ValueType::Float)) {
const auto& typeDef = TypeDefinition::forValueType(m_yExpression->getExpressionType());
parser->notifyErrorListeners(m_yExpression->getToken(),
"Invalid value type for vector constructor. Expected <Float>, got <" + typeDef.getName() + ">",
nullptr);
valid = false;
}
if (!checkTypeWithImplicitConversion(m_zExpression->getExpressionType(), ValueType::Float)) {
const auto& typeDef = TypeDefinition::forValueType(m_zExpression->getExpressionType());
parser->notifyErrorListeners(m_zExpression->getToken(),
"Invalid value type for vector constructor. Expected <Float>, got <" + typeDef.getName() + ">",
nullptr);
valid = false;
}
return valid;
}
ValueType VectorConstructorExpression::determineReturnType() const
{
// No need to look at the expressions here since we will always be a vector
return ValueType::Vector;
}
void VectorConstructorExpression::validationDone()
{
AbstractExpression::validationDone();
m_xExpression->validationDone();
m_yExpression->validationDone();
m_zExpression->validationDone();
}
} // namespace nodes
} // namespace expression
} // namespace actions
@@ -0,0 +1,34 @@
#pragma once
#include "AbstractExpression.h"
#include "actions/expression/Value.h"
namespace actions {
namespace expression {
namespace nodes {
class VectorConstructorExpression : public AbstractExpression {
public:
VectorConstructorExpression(antlr4::Token* token,
std::shared_ptr<AbstractExpression> xExpression,
std::shared_ptr<AbstractExpression> yExpression,
std::shared_ptr<AbstractExpression> zExpression);
~VectorConstructorExpression() override;
Value execute(const ProgramVariables& variables) const override;
bool validate(antlr4::Parser* parser, const ParseContext& context) override;
void validationDone() override;
protected:
ValueType determineReturnType() const override;
private:
std::shared_ptr<AbstractExpression> m_xExpression;
std::shared_ptr<AbstractExpression> m_yExpression;
std::shared_ptr<AbstractExpression> m_zExpression;
};
} // namespace nodes
} // namespace expression
} // namespace actions
+79
View File
@@ -0,0 +1,79 @@
#include "MoveToSubmodel.h"
#include "math/vecmat.h"
#include "parse/parselo.h"
#include "ship/ship.h"
#include <utility>
namespace actions {
namespace types {
flagset<ProgramContextFlags> MoveToSubmodel::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{ProgramContextFlags::HasObject, ProgramContextFlags::HasSubobject};
}
MoveToSubmodel::MoveToSubmodel(expression::TypedActionExpression<ValueType> subObjectExpression)
: m_subObjectExpression(std::move(subObjectExpression))
{
}
MoveToSubmodel::~MoveToSubmodel() = default;
ActionResult MoveToSubmodel::execute(ProgramLocals& locals) const
{
// The calling code should ensure that this never happens
Assertion(locals.hostSubobject >= 0, "Did not have a valid host subobject.");
auto instance = object_get_model_instance(locals.host.objp);
Assertion(instance != -1, "Model instances are required if a host subobject is specified.");
auto pmi = model_get_instance(instance);
auto pm = model_get(pmi->model_num);
const auto destinationSubObject = m_subObjectExpression.execute(locals.variables);
bool goToParent = false;
if (destinationSubObject == "<parent>") {
goToParent = true;
}
if (goToParent) {
// Special case when we simply want to go to our parent without explicitly specifying its name
auto parentSubobject = pm->submodel[locals.hostSubobject].parent;
if (parentSubobject < 0) {
Warning(LOCATION,
"Current program subobject %s on model %s has no parent!",
pm->submodel[locals.hostSubobject].name,
pm->filename);
return ActionResult::Errored;
}
// We have a valid parent so this move will work properly
locals.hostSubobject = parentSubobject;
return ActionResult::Finished;
}
// We need to do a linear search for the right subobject
for (int i = 0; i < pm->n_models; ++i) {
const auto submodel = pm->submodel[i];
if (subsystem_stricmp(destinationSubObject.c_str(), submodel.name) == 0) {
// Found something!
locals.hostSubobject = i;
return ActionResult::Finished;
}
}
Warning(LOCATION, "Could not find subobject %s in model %s!", destinationSubObject.c_str(), pm->filename);
return ActionResult::Errored;
}
std::unique_ptr<Action> MoveToSubmodel::clone() const
{
return std::unique_ptr<Action>(new MoveToSubmodel(*this));
}
} // namespace types
} // namespace actions
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include "globalincs/flagset.h"
#include "actions/Action.h"
#include "actions/expression/ActionExpression.h"
namespace actions {
namespace types {
class MoveToSubmodel : public Action {
public:
using ValueType = SCP_string;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
explicit MoveToSubmodel(expression::TypedActionExpression<ValueType> subObjectExpression);
~MoveToSubmodel() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<ValueType> m_subObjectExpression;
};
} // namespace types
} // namespace actions
@@ -0,0 +1,76 @@
#include "ParticleEffectAction.h"
#include "math/vecmat.h"
#include "parse/parselo.h"
#include "ship/ship.h"
#include <utility>
namespace actions {
namespace types {
flagset<ProgramContextFlags> ParticleEffectAction::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{ProgramContextFlags::HasObject};
}
ParticleEffectAction::ParticleEffectAction(expression::TypedActionExpression<ValueType> effectExpression)
: m_effectExpression(std::move(effectExpression))
{
}
ParticleEffectAction::~ParticleEffectAction() = default;
ActionResult ParticleEffectAction::execute(ProgramLocals& locals) const
{
auto effectIdx = particle::ParticleManager::get()->getEffectByName(m_effectExpression.execute(locals.variables));
if (!effectIdx.isValid()) {
// In case the parsing code failed
return ActionResult::Errored;
}
using namespace particle;
auto source = ParticleManager::get()->createSource(effectIdx);
vec3d local_pos;
matrix local_orient;
if (locals.hostSubobject != -1) {
auto instance = object_get_model_instance(locals.host.objp);
Assertion(instance != -1, "Model instances are required if a host subobject is specified.");
auto pmi = model_get_instance(instance);
auto pm = model_get(pmi->model_num);
find_submodel_instance_point_orient(&local_pos,
&local_orient,
pm,
pmi,
locals.hostSubobject,
&locals.localPosition,
&locals.localOrient);
} else {
local_pos = locals.localPosition;
local_orient = locals.localOrient;
}
local_pos += locals.variables.getValue({"locals", "position"}).getVector();
auto direction = locals.variables.getValue({"locals", "direction"}).getVector();
source.moveToObject(locals.host.objp, &local_pos);
source.setOrientationFromNormalizedVec(&direction, true);
source.finish();
return ActionResult::Finished;
}
std::unique_ptr<Action> ParticleEffectAction::clone() const
{
return std::unique_ptr<Action>(new ParticleEffectAction(*this));
}
} // namespace types
} // namespace actions
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include "actions/Action.h"
#include "actions/expression/ActionExpression.h"
#include "particle/ParticleManager.h"
namespace actions {
namespace types {
class ParticleEffectAction : public Action {
public:
using ValueType = SCP_string;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
explicit ParticleEffectAction(expression::TypedActionExpression<ValueType> effectExpression);
~ParticleEffectAction() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<ValueType> m_effectExpression;
};
} // namespace types
} // namespace actions
+65
View File
@@ -0,0 +1,65 @@
//
//
#include "PlaySoundAction.h"
#include "ship/ship.h"
#include <utility>
namespace actions {
namespace types {
flagset<ProgramContextFlags> PlaySoundAction::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{ProgramContextFlags::HasObject};
}
PlaySoundAction::PlaySoundAction(expression::TypedActionExpression<ValueType> soundIdExpression)
: m_soundIdExpression(std::move(soundIdExpression))
{
}
PlaySoundAction::~PlaySoundAction() = default;
ActionResult PlaySoundAction::execute(ProgramLocals& locals) const
{
vec3d local_pos;
matrix local_orient;
if (locals.hostSubobject != -1) {
auto instance = object_get_model_instance(locals.host.objp);
Assertion(instance != -1, "Model instances are required if a host subobject is specified.");
auto pmi = model_get_instance(instance);
auto pm = model_get(pmi->model_num);
find_submodel_instance_point_orient(&local_pos,
&local_orient,
pm,
pmi,
locals.hostSubobject,
&locals.localPosition,
&locals.localOrient);
} else {
local_pos = locals.localPosition;
local_orient = locals.localOrient;
}
local_pos += locals.variables.getValue({"locals", "position"}).getVector();
vec3d global_pos;
vm_vec_unrotate(&global_pos, &local_pos, &locals.host.objp->orient);
global_pos += locals.host.objp->pos;
const auto soundId = gamesnd_get_by_name(m_soundIdExpression.execute(locals.variables).c_str());
// Sound is not attached to the host but the object sound system currently only supports persistent sounds
snd_play_3d(gamesnd_get_game_sound(soundId), &global_pos, &Eye_position);
return ActionResult::Finished;
}
std::unique_ptr<Action> PlaySoundAction::clone() const
{
return std::unique_ptr<Action>(new PlaySoundAction(*this));
}
} // namespace types
} // namespace actions
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include "actions/Action.h"
#include "actions/expression/ActionExpression.h"
#include "gamesnd/gamesnd.h"
namespace actions {
namespace types {
class PlaySoundAction : public Action {
public:
using ValueType = SCP_string;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
explicit PlaySoundAction(expression::TypedActionExpression<ValueType> soundIdExpression);
~PlaySoundAction() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<ValueType> m_soundIdExpression;
};
} // namespace types
} // namespace actions
+39
View File
@@ -0,0 +1,39 @@
#include "SetDirectionAction.h"
#include "math/vecmat.h"
#include "parse/parselo.h"
#include <utility>
namespace actions {
namespace types {
flagset<ProgramContextFlags> SetDirectionAction::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{};
}
SetDirectionAction::SetDirectionAction(expression::TypedActionExpression<vec3d> newDirExpression)
: m_newDirExpression(std::move(newDirExpression))
{
}
SetDirectionAction::~SetDirectionAction() = default;
ActionResult SetDirectionAction::execute(ProgramLocals& locals) const
{
auto dir = m_newDirExpression.execute(locals.variables);
vm_vec_normalize_safe(&dir);
locals.variables.setValue({"locals", "direction"}, expression::Value(dir));
return ActionResult::Finished;
}
std::unique_ptr<Action> SetDirectionAction::clone() const
{
return std::unique_ptr<Action>(new SetDirectionAction(*this));
}
} // namespace types
} // namespace actions
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include "actions/Action.h"
#include "actions/expression/ActionExpression.h"
namespace actions {
namespace types {
class SetDirectionAction : public Action {
public:
using ValueType = vec3d;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
SetDirectionAction(expression::TypedActionExpression<ValueType> newDirExpression);
~SetDirectionAction() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<ValueType> m_newDirExpression;
};
} // namespace types
} // namespace actions
+34
View File
@@ -0,0 +1,34 @@
#include "SetPositionAction.h"
#include "parse/parselo.h"
#include <utility>
namespace actions {
namespace types {
flagset<ProgramContextFlags> SetPositionAction::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{};
}
SetPositionAction::SetPositionAction(expression::TypedActionExpression<ValueType> newPositionExpression)
: m_newPosExpression(std::move(newPositionExpression))
{
}
SetPositionAction::~SetPositionAction() = default;
ActionResult SetPositionAction::execute(ProgramLocals& locals) const
{
locals.variables.setValue({"locals", "position"}, expression::Value(m_newPosExpression.execute(locals.variables)));
return ActionResult::Finished;
}
std::unique_ptr<Action> SetPositionAction::clone() const
{
return std::unique_ptr<Action>(new SetPositionAction(*this));
}
} // namespace types
} // namespace actions
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include "actions/Action.h"
#include "actions/expression/ActionExpression.h"
namespace actions {
namespace types {
class SetPositionAction : public Action {
public:
using ValueType = vec3d;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
SetPositionAction(expression::TypedActionExpression<ValueType> newPositionExpression);
~SetPositionAction() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<vec3d> m_newPosExpression;
};
} // namespace types
} // namespace actions
+48
View File
@@ -0,0 +1,48 @@
#include "WaitAction.h"
#include "io/timer.h"
#include "parse/parselo.h"
namespace actions {
namespace types {
flagset<ProgramContextFlags> WaitAction::getRequiredExecutionContextFlags()
{
return flagset<ProgramContextFlags>{};
}
WaitAction::WaitAction(expression::TypedActionExpression<float> waitTimeExpression)
: _waitTimeExpression(std::move(waitTimeExpression))
{
}
WaitAction::~WaitAction() = default;
ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
{
if (!timestamp_valid(locals.waitTimestamp)) {
auto waitTime = _waitTimeExpression.execute(locals.variables);
// Catch errors in the expression
if (waitTime < 0.001f) {
waitTime = 0.001f;
}
locals.waitTimestamp = timestamp(fl2i(waitTime * TIMESTAMP_FREQUENCY));
}
if (!timestamp_elapsed(locals.waitTimestamp)) {
// Wait until the timestamp is elapsed
return ActionResult::Wait;
}
// Timestamp is elapsed. The timestamp is elapsed so that timestamp_valid above returns false for the next wait
// action
locals.waitTimestamp = 0;
return ActionResult::Finished;
}
std::unique_ptr<Action> WaitAction::clone() const
{
return std::unique_ptr<Action>(new WaitAction(*this));
}
} // namespace types
} // namespace actions
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include "actions/Action.h"
#include "actions/common.h"
#include "actions/expression/ActionExpression.h"
#include "utils/RandomRange.h"
namespace actions {
namespace types {
class WaitAction : public Action {
public:
using ValueType = float;
static flagset<ProgramContextFlags> getRequiredExecutionContextFlags();
explicit WaitAction(expression::TypedActionExpression<ValueType> waitTimeExpression);
~WaitAction() override;
ActionResult execute(ProgramLocals& locals) const override;
std::unique_ptr<Action> clone() const override;
private:
expression::TypedActionExpression<ValueType> _waitTimeExpression;
};
} // namespace types
} // namespace actions
+16 -15
View File
@@ -18,8 +18,7 @@
#include "ship/ship.h"
int Total_goal_target_names = 0;
char Goal_target_names[MAX_GOAL_TARGET_NAMES][NAME_LENGTH];
SCP_vector<char *> Goal_target_names;
ai_info Ai_info[MAX_AI_INFO];
ai_info *Player_ai;
@@ -37,8 +36,7 @@ int ai_get_slot(int shipnum)
return i;
}
Warning( LOCATION, "Couldn't get AI slot" );
Int3();
Error( LOCATION, "Couldn't get AI slot, please tell a coder!");
return -1;
}
@@ -82,22 +80,25 @@ void set_wingnum(int objnum, int wingnum)
Ai_info[ai_index].wing = wingnum;
}
char *ai_get_goal_target_name(const char *name, int *index)
const char *ai_get_goal_target_name(const char *name, int *index)
{
Assert(name != NULL);
Assert(index != NULL);
int i;
Assertion(name != nullptr && index != nullptr, "Arguments cannot be null!");
for (i=0; i < Total_goal_target_names; i++)
for (int i = 0; i < static_cast<int>(Goal_target_names.size()); ++i) {
if (!stricmp(name, Goal_target_names[i])) {
*index = i;
return Goal_target_names[i];
}
}
Assert(Total_goal_target_names < MAX_GOAL_TARGET_NAMES);
Assertion(strlen(name) <= NAME_LENGTH - 1, "Goal target name %s is too long. Needs to be 31 characters or less.", name);
i = Total_goal_target_names++;
strcpy_s(Goal_target_names[i], name);
*index = i;
return Goal_target_names[i];
*index = static_cast<int>(Goal_target_names.size());
Goal_target_names.push_back(vm_strdup(name));
return Goal_target_names[*index];
}
void ai_clear_goal_target_names()
{
for (auto ptr : Goal_target_names)
vm_free(ptr);
Goal_target_names.clear();
}
+20 -17
View File
@@ -70,6 +70,7 @@ extern ai_flag_name Ai_flag_names[];
#define AITTV_FAST (1<<0) // Turn fast, not slowed down based on skill level.
#define AITTV_VIA_SEXP (1<<1) // Goober5000 - via sexp
#define AITTV_IGNORE_BANK (1<<2) // Goober5000 - ignore bank when turning
#define AITTV_SLOW_BANK_ACCEL (1<<3) // Asteroth - used by formation flying
#define KAMIKAZE_HULL_ON_DEATH -1000.0f // Hull strength ship gets set to if it crash-dies.
@@ -83,7 +84,7 @@ typedef struct ai_goal {
fix time; // time at which this goal was issued.
int priority; // how important is this goal -- number 0 - 100
char *target_name; // name of the thing that this goal acts upon
const char *target_name; // name of the thing that this goal acts upon
int target_name_index; // index of goal_target_name in Goal_target_names[][]
waypoint_list *wp_list; // waypoints that this ship might fly.
int target_instance; // instance of thing this ship might be chasing (currently only used for weapons; note, not the same as objnum!)
@@ -93,19 +94,17 @@ typedef struct ai_goal {
// (AIGF_DOCKER_INDEX_VALID and AIGF_DOCKEE_INDEX_VALID tell us to use indexes; otherwise we use names)
// these are the dockpoints used on the docker and dockee ships, not the ships themselves
union {
char *name;
const char *name;
int index;
} docker;
union {
char *name;
const char *name;
int index;
} dockee;
} ai_goal;
#define MAX_GOAL_TARGET_NAMES 100
#define AIM_CHASE 0
#define AIM_EVADE 1
#define AIM_GET_BEHIND 2
@@ -184,6 +183,7 @@ typedef struct ai_class {
// Submode definitions.
// Note: These need to be renamed to be of the form: AIS_mode_xxxx
// Cyborg17 -- If you add submodes for AI_CHASE, you *have to* add entries to Submode_text[] in aicode.cpp
#define SM_CONTINUOUS_TURN 1 // takes parm: vector_id {0..3 = right, -right, up, -up}
#define SM_ATTACK 2
#define SM_EVADE_SQUIGGLE 3
@@ -472,8 +472,8 @@ typedef struct ai_info {
fix avoid_check_timestamp; // timestamp at which to next check for having to avoid ship
vec3d big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
vec3d big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
vec3d big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
vec3d big_recover_1_direction; // A relative direction to fly towards when recovering from collision with a big ship, stage 1.
vec3d big_recover_2_pos; // Global point to fly towards when recovering from collision with a big ship, stage 2.
int big_recover_timestamp; // timestamp at which it's OK to re-enter stage 1.
int abort_rearm_timestamp; // time at which this rearm should be aborted in a multiplayer game.
@@ -487,7 +487,10 @@ typedef struct ai_info {
flagset<AI::Maneuver_Override_Flags> ai_override_flags; // flags for marking ai overrides from sexp or lua systems
control_info ai_override_ci; // ai override control info
int ai_override_timestamp; // mark for when to end the current override
int ai_override_lat_timestamp; // mark for when to end the current lateral maneuver override
int ai_override_rot_timestamp; // mark for when to end the current rotational maneuver override
int form_obj_slotnum; // for flying in formation object mode, the position in the formation
} ai_info;
// Goober5000
@@ -513,8 +516,6 @@ typedef struct {
#define BURST_DURATION 500 // decay time over which Player->damage_this_burst falls from MAX_BURST_DAMAGE to 0
extern int Mission_all_attack; // !0 means all teams attack all teams.
extern int Total_goal_target_names;
extern char Goal_target_names[MAX_GOAL_TARGET_NAMES][NAME_LENGTH];
extern void update_ai_info_for_hit(int hitter_obj, int hit_obj);
extern void ai_frame_all(void);
@@ -556,10 +557,11 @@ void ai_process( object * obj, int ai_index, float frametime );
int get_wingnum(int objnum);
void set_wingnum(int objnum, int wingnum);
char *ai_get_goal_target_name(const char *name, int *index);
const char *ai_get_goal_target_name(const char *name, int *index);
void ai_clear_goal_target_names();
extern void init_ai_system(void);
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp, int ship_info_index = -1);
extern void ai_attack_object(object *attacker, object *attacked, int ship_info_index = -1);
extern void ai_evade_object(object *evader, object *evaded);
extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
extern void ai_ignore_wing(object *ignorer, int wingnum);
@@ -569,7 +571,7 @@ extern void ai_do_default_behavior(object *obj);
extern void ai_start_waypoints(object *objp, waypoint_list *wp_list, int wp_flags);
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hit_normal);
extern void ai_ship_destroy(int shipnum);
extern void ai_turn_towards_vector(vec3d *dest, object *objp, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec = nullptr, int sexp_flags = 0);
extern void ai_turn_towards_vector(vec3d *dest, object *objp, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec = nullptr, vec3d* turnrate_mod = nullptr);
extern void init_ai_object(int objnum);
extern void ai_init(void); // Call this one to parse ai.tbl.
extern void ai_level_init(void); // Call before each level to reset AI
@@ -582,8 +584,7 @@ extern void ai_update_danger_weapon(int objnum, int weapon_objnum);
// called externally from MissionParse.cpp to position ships in wings upon arrival into the
// mission.
extern void get_absolute_wing_pos( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
extern void get_absolute_wing_pos_autopilot( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
extern void get_absolute_wing_pos(vec3d *result_pos, object *leader_objp, int wingnum, int wing_index, bool formation_object_flag, bool autopilot = false);
// Interface from goals code to AI. Set ship to guard. *objp guards *other_objp
extern void ai_set_guard_object(object *objp, object *other_objp);
@@ -621,7 +622,7 @@ extern int might_collide_with_ship(object *obj1, object *obj2, float dot_to_enem
extern int ai_fire_primary_weapon(object *objp); //changed to return weather it fired-Bobboau
extern int ai_fire_secondary_weapon(object *objp);
extern float ai_get_weapon_dist(ship_weapon *swp);
extern void turn_towards_point(object *objp, vec3d *point, vec3d *slide_vec, float bank_override);
extern void turn_towards_point(object *objp, vec3d *point, vec3d *slide_vec, float bank_override, matrix* target_orient = nullptr, int flags = 0);
extern int ai_maybe_fire_afterburner(object *objp, ai_info *aip);
extern void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, ai_info *aip);
@@ -633,7 +634,7 @@ void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos,
// function to change rearm status for ai ships (called from sexpression code)
extern void ai_set_rearm_status( int team, int new_status );
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, char *shipname );
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, const char *shipname );
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point, bool update_clients = true);
extern void ai_do_objects_undocked_stuff( object *docker, object *dockee );
@@ -666,4 +667,6 @@ void ai_update_aim(ai_info *aip);
//SUSHI: Random evasive sidethrust
void do_random_sidethrust(ai_info *aip, ship_info *sip);
void ai_formation_object_recalculate_slotnums(int form_objnum, int exiting_objnum = -1);
#endif
+18 -2
View File
@@ -63,7 +63,9 @@ namespace AI {
Dont_bank_when_turning, // maps to CIF_DONT_BANK_WHEN_TURNING
Dont_clamp_max_velocity, // maps to CIF_DONT_CLAMP_MAX_VELOCITY
Instantaneous_acceleration, // maps to CIF_INSTANTANEOUS_ACCELERATION
Never_expire, // don't clear the maneuver when the timestamp is up
Lateral_never_expire, // don't clear the lateral maneuver when the timestamp is up
Rotational_never_expire, // don't clear the rotational maneuver when the timestamp is up
Dont_override_old_maneuvers,// doesn't clear any previous maneuvers
NUM_VALUES
};
@@ -84,13 +86,17 @@ namespace AI {
Assist_scoring_scales_with_damage,
Beams_damage_weapons,
Big_ships_can_attack_beam_turrets_on_untargeted_ships,
Check_comms_for_non_player_ships,
Disable_linked_fire_penalty,
Disable_player_secondary_doublefire,
Disable_ai_secondary_doublefire,
Disable_weapon_damage_scaling,
Dont_insert_random_turret_fire_delay,
Fix_ai_class_bug,
Fix_ai_path_order_bug,
Fix_heat_seeker_stealth_bug,
Fix_linked_primary_bug,
Fix_ramming_stationary_targets_bug,
Force_beam_turret_fov,
Free_afterburner_use,
Glide_decay_requires_thrust,
@@ -114,13 +120,23 @@ namespace AI {
Smart_secondary_weapon_selection,
Smart_shield_management,
Smart_subsystem_targeting_for_turrets,
Strict_turred_tagged_only_targeting,
Strict_turret_tagged_only_targeting,
Support_dont_add_primaries, //Prevents support ship from equipping new primary as requested in http://scp.indiegames.us/mantis/view.php?id=3198
Turrets_ignore_target_radius,
Use_actual_primary_range,
Use_subsystem_path_point_radii,
Use_additive_weapon_velocity,
Use_newtonian_dampening,
Use_only_single_fov_for_turrets,
No_turning_directional_bias,
Use_axial_turnrate_differences,
all_nonshielded_ships_can_manage_ets,
fightercraft_nonshielded_ships_can_manage_ets,
Better_collision_avoidance,
Require_exact_los,
Improved_missile_avoidance,
Friendlies_use_countermeasure_firechance,
Improved_subsystem_attack_pathing,
NUM_VALUES
};
+76 -3
View File
@@ -7,11 +7,12 @@
#include "globalincs/pstypes.h"
#include "def_files/def_files.h"
#include "ai/ai_profiles.h"
#include "ai/aibig.h"
#include "def_files/def_files.h"
#include "globalincs/pstypes.h"
#include "localization/localize.h"
#include "mod_table/mod_table.h"
#include "parse/parselo.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
@@ -371,10 +372,16 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$navigation subsystem governs warpout capability:", AI::Profile_Flags::Navigation_subsys_governs_warp);
set_flag(profile, "$check communications for non-player ships:", AI::Profile_Flags::Check_comms_for_non_player_ships);
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AI::Profile_Flags::No_min_dock_speed_cap);
set_flag(profile, "$disable linked fire penalty:", AI::Profile_Flags::Disable_linked_fire_penalty);
set_flag(profile, "$disable player secondary doublefire:", AI::Profile_Flags::Disable_player_secondary_doublefire);
set_flag(profile, "$disable ai secondary doublefire:", AI::Profile_Flags::Disable_ai_secondary_doublefire);
set_flag(profile, "$disable weapon damage scaling:", AI::Profile_Flags::Disable_weapon_damage_scaling);
set_flag(profile, "$use additive weapon velocity:", AI::Profile_Flags::Use_additive_weapon_velocity);
@@ -391,6 +398,8 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$fix linked primary weapon decision bug:", AI::Profile_Flags::Fix_linked_primary_bug);
set_flag(profile, "$fix ramming stationary targets bug:", AI::Profile_Flags::Fix_ramming_stationary_targets_bug);
set_flag(profile, "$prevent turrets targeting too distant bombs:", AI::Profile_Flags::Prevent_targeting_bombs_beyond_range);
set_flag(profile, "$smart subsystem targeting for turrets:", AI::Profile_Flags::Smart_subsystem_targeting_for_turrets);
@@ -437,6 +446,8 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$support don't add primaries:", AI::Profile_Flags::Support_dont_add_primaries);
set_flag(profile, "$firing requires exact los:", AI::Profile_Flags::Require_exact_los);
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
if (optional_string("$ai path mode:"))
{
@@ -454,7 +465,7 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$fix ai path order bug:", AI::Profile_Flags::Fix_ai_path_order_bug);
set_flag(profile, "$strict turret-tagged-only targeting:", AI::Profile_Flags::Strict_turred_tagged_only_targeting);
set_flag(profile, "$strict turret-tagged-only targeting:", AI::Profile_Flags::Strict_turret_tagged_only_targeting);
set_flag(profile, "$aspect bomb invulnerability fix:", AI::Profile_Flags::Aspect_invulnerability_fix);
@@ -464,6 +475,18 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$use actual primary range:", AI::Profile_Flags::Use_actual_primary_range);
if (optional_string("$override radius for subsystem path points:")) {
int path_radii;
stuff_int(&path_radii);
if (path_radii >= Minimum_subsystem_path_pt_dist) {
profile->subsystem_path_radii = path_radii;
} else {
mprintf(("Warning: \"$override radius for subsystem path points:\" should be >= %i (read %i). Value will not be used. ", Minimum_subsystem_path_pt_dist, path_radii));
}
}
set_flag(profile, "$use POF radius for subsystem path points:", AI::Profile_Flags::Use_subsystem_path_point_radii);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive speed multiplier:")) {
@@ -490,7 +513,36 @@ void parse_ai_profiles_tbl(const char *filename)
stuff_boolean(&temp);
profile->flags.set(AI::Profile_Flags::Allow_primary_link_at_start, !temp);
}
if (optional_string("$lead indicator second-order prediction factor:")) {
stuff_float(&profile->second_order_lead_predict_factor);
if (profile->second_order_lead_predict_factor > 1 || profile->second_order_lead_predict_factor < 0) {
mprintf(("Warning: \"$lead indicator second-order prediction factor\" must be 0 - 1, resetting to 0.\"\n"));
profile->second_order_lead_predict_factor = 0;
}
}
if (optional_string("$ships with no shields can manage ETS:"))
{
mprintf(("Warning: \"$ships with no shields can manage ETS\" flag is deprecated in favor of \"$any ship with no shields can manage ETS\"\n"));
bool temp;
stuff_boolean(&temp);
profile->flags.set(AI::Profile_Flags::all_nonshielded_ships_can_manage_ets, temp);
}
set_flag(profile, "$no directional bias for missile and ship turning:", AI::Profile_Flags::No_turning_directional_bias);
set_flag(profile, "$respect ship axial turnrate differences:", AI::Profile_Flags::Use_axial_turnrate_differences);
set_flag(profile, "$any ship with no shields can manage ETS:", AI::Profile_Flags::all_nonshielded_ships_can_manage_ets);
set_flag(profile, "$fighters/bombers with no shields can manage ETS:", AI::Profile_Flags::fightercraft_nonshielded_ships_can_manage_ets);
set_flag(profile, "$better combat collision avoidance for fightercraft:", AI::Profile_Flags::Better_collision_avoidance);
set_flag(profile, "$improved missile avoidance for fightercraft:", AI::Profile_Flags::Improved_missile_avoidance);
set_flag(profile, "$friendly ships use AI profile countermeasure chance:", AI::Profile_Flags::Friendlies_use_countermeasure_firechance);
set_flag(profile, "$improved subsystem attack pathing:", AI::Profile_Flags::Improved_subsystem_attack_pathing);
// if we've been through once already and are at the same place, force a move
if (saved_Mp && (saved_Mp == Mp))
@@ -564,8 +616,10 @@ void ai_profile_t::reset()
flags.reset();
ai_path_mode = 0;
subsystem_path_radii = 0;
bay_arrive_speed_mult = 0;
bay_depart_speed_mult = 0;
second_order_lead_predict_factor = 0;
for (int i = 0; i < NUM_SKILL_LEVELS; ++i) {
max_incoming_asteroids[i] = 0;
@@ -624,4 +678,23 @@ void ai_profile_t::reset()
for (int i = 0; i <= MAX_DETAIL_LEVEL; ++i) {
detail_distance_mult[i] = 0;
}
// via Github #2332, enable bugfixes if we are targeting version 20 and up
if (mod_supports_version(20, 0, 0)) {
flags.set(AI::Profile_Flags::Huge_turret_weapons_ignore_bombs);
flags.set(AI::Profile_Flags::Fix_linked_primary_bug);
flags.set(AI::Profile_Flags::Prevent_targeting_bombs_beyond_range);
flags.set(AI::Profile_Flags::Fix_heat_seeker_stealth_bug);
flags.set(AI::Profile_Flags::Allow_vertical_dodge);
flags.set(AI::Profile_Flags::Fix_ai_class_bug);
flags.set(AI::Profile_Flags::Ai_guards_specific_ship_in_wing);
flags.set(AI::Profile_Flags::Fix_ai_path_order_bug);
flags.set(AI::Profile_Flags::Aspect_invulnerability_fix);
flags.set(AI::Profile_Flags::Use_actual_primary_range);
flags.set(AI::Profile_Flags::fightercraft_nonshielded_ships_can_manage_ets);
}
// this flag has been enabled ever since 3.7.2
if (mod_supports_version(3, 7, 2)) {
flags.set(AI::Profile_Flags::Fix_ramming_stationary_targets_bug);
}
}
+6
View File
@@ -97,11 +97,17 @@ public:
int ai_path_mode;
// radii to use for the radius for subsystem path points and default value --wookieejedi
int subsystem_path_radii;
// Ships flying bay paths will gradually accelerate/decelerate instead of
// flying the whole path at max speed
float bay_arrive_speed_mult;
float bay_depart_speed_mult;
// How much 0-1 of a second-order lead prediction factor to add to lead indicators. Affects only the HUD indicator, and autoaim.
float second_order_lead_predict_factor;
void reset();
};
+181 -20
View File
@@ -21,6 +21,7 @@
#include "ship/afterburner.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
#include "object/objcollide.h"
#ifdef _MSC_VER
@@ -370,7 +371,8 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
float dot = 1.0f, min_dot;
object *target_objp;
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
auto shipp = &Ships[Pl_objp->instance];
aip = &Ai_info[shipp->ai_index];
if ( aip->target_objnum < 0 )
return 0;
@@ -382,7 +384,8 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
float dist;
// Get models of both source and target
polymodel *pm = model_get( Ship_info[Ships[Pl_objp->instance].ship_info_index].model_num );
polymodel *pm = model_get( Ship_info[shipp->ship_info_index].model_num );
polymodel_instance *pmi = model_get_instance( shipp->model_instance_num );
polymodel *pm_t = model_get( Ship_info[Ships[target_objp->instance].ship_info_index].model_num );
// Necessary sanity check
@@ -403,8 +406,8 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
aip->path_subsystem_next_check = timestamp(1500);
// get world pos of eye (stored in geye)
ep = &(pm->view_positions[Ships[Pl_objp->instance].current_viewpoint]);
model_find_world_point( &geye, &ep->pnt, pm->id, 0, &Pl_objp->orient, &Pl_objp->pos );
ep = &(pm->view_positions[shipp->current_viewpoint]);
model_instance_find_world_point( &geye, &ep->pnt, pm, pmi, 0, &Pl_objp->orient, &Pl_objp->pos );
// get world pos of subsystem
vm_vec_unrotate(&gsubpos, &aip->targeted_subsys->system_info->pnt, &En_objp->orient);
@@ -431,7 +434,6 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
min_dot = (target_objp->phys_info.fspeed > 5.0f?MIN_DOT_TO_ATTACK_MOVING_SUBSYS:MIN_DOT_TO_ATTACK_SUBSYS);
if ( (checked_sight && ((!subsys_in_sight) || (dot < min_dot)) ) ) {
aip->path_goal_dist = 5;
subsys_path_num = aip->targeted_subsys->system_info->path_num;
if ( ((aip->path_start) == -1 || (aip->mp_index != subsys_path_num)) && subsys_path_num < pm_t->n_paths ) {
// maybe create a new path
@@ -461,9 +463,41 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
Assert(aip->path_length >= 2);
dist = vm_vec_dist_quick(&Path_points[aip->path_start+aip->path_length-2].pos, &Pl_objp->pos);
// distance setting --wookieejedi
if ( aip->path_cur >= (aip->path_start+aip->path_length-1) ) {
// register that path is done and reset goal distance to default
aip->path_goal_dist = Default_subsystem_path_pt_dist;
path_done=1;
}
// if not done then set path distances based on specified options
else {
bool found_point = false;
// 1. use radii of path points if specified
if (aip->ai_profile_flags[AI::Profile_Flags::Use_subsystem_path_point_radii]) {
// need a valid path and point in model to use pof specified radius
int path_num = aip->targeted_subsys->system_info->path_num;
if ((0 <= path_num) && (path_num < pm_t->n_paths)) {
// need a valid place in the path
if ((0 <= aip->path_cur) && (aip->path_cur < aip->path_length)) {
float path_point_radius = pm_t->paths[path_num].verts[aip->path_cur].radius;
int goal_dist = fl2i(path_point_radius);
// only set if >= Minimum path distance specified in aibig.h
if (goal_dist >= Minimum_subsystem_path_pt_dist) {
aip->path_goal_dist = goal_dist;
found_point = true;
}
}
}
}
// 2. use radii value in ai_profiles table if specified and no valid point found
if (!found_point && The_mission.ai_profile->subsystem_path_radii) {
aip->path_goal_dist = The_mission.ai_profile->subsystem_path_radii;
}
// 3. use default radii value if no valid point or specified radii
else {
aip->path_goal_dist = Default_subsystem_path_pt_dist;
}
}
min_dot = (target_objp->phys_info.fspeed > 5.0f?MIN_DOT_TO_ATTACK_MOVING_SUBSYS:MIN_DOT_TO_ATTACK_SUBSYS);
if ( (checked_sight && subsys_in_sight) && (dot > min_dot) ) {
@@ -496,6 +530,112 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
return 0;
}
bool ai_new_maybe_reposition_attack_subsys() {
ai_info* aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
if (aip->target_objnum < 0 || aip->targeted_subsys == nullptr)
return false;
object* target_objp = &Objects[aip->target_objnum];
// dont bother with this if you're still far away
if (vm_vec_dist(&Pl_objp->pos, &target_objp->pos) > target_objp->radius * 2.0f + 2000.0f)
return false;
vec3d geye, gsubpos;
eye* ep;
polymodel* pm = model_get(Ship_info[Ships[Pl_objp->instance].ship_info_index].model_num);
// get world pos of eye (stored in geye)
ep = &(pm->view_positions[Ships[Pl_objp->instance].current_viewpoint]);
model_find_world_point(&geye, &ep->pnt, pm->id, 0, &Pl_objp->orient, &Pl_objp->pos);
// get world pos of subsystem
vm_vec_unrotate(&gsubpos, &aip->targeted_subsys->system_info->pnt, &En_objp->orient);
vm_vec_add2(&gsubpos, &En_objp->pos);
// you're in sight! shoot it!
if (ship_subsystem_in_sight(En_objp, aip->targeted_subsys, &geye, &gsubpos, 0))
return false;
// not in sight, gotta get there
vec3d tgt2pl = Pl_objp->pos - target_objp->pos;
vec3d tgt2subsys = gsubpos - target_objp->pos;
float pl_dist = vm_vec_mag(&tgt2pl);
float subsys_dist = vm_vec_mag(&tgt2subsys) * 1.3f; // add a bit to this, we don't want to go directly at the subsys, we want to go above it
float angle2subsys = vm_vec_delta_ang(&tgt2pl, &tgt2subsys, nullptr);
float angle2goal = angle2subsys;
if (angle2goal > 1.2f) // let's not try to go more than about 70 degrees around the ship
angle2goal = 1.2f;
// we'll start by travelling along the sphere at our current distance around the ship
// remember that goal_pos will be relative to our target_ship (so we can scale in and out easily)
vec3d goal_pos, cross;
vm_vec_cross(&cross, &tgt2pl, &tgt2subsys);
vm_vec_normalize(&cross);
vm_vec_negate(&cross);
vm_rot_point_around_line(&goal_pos, &tgt2pl, angle2goal, &vmd_zero_vector, &cross);
// then scale in (or out) towards our subsys
vec3d world_goal_pos;
float new_radius = ((subsys_dist - pl_dist) * (angle2goal / angle2subsys)) + pl_dist;
vm_vec_copy_scale(&world_goal_pos, &goal_pos, new_radius / pl_dist);
world_goal_pos += target_objp->pos;
vec3d* good_pos = nullptr;
if (pp_collide(&Pl_objp->pos, &world_goal_pos, target_objp, Pl_objp->radius * 4.0f)) {
// ok best case won't work
if (pl_dist > subsys_dist) {
//we're farther away than the subsys, let's try at our current distance
world_goal_pos = goal_pos + target_objp->pos;
if (!pp_collide(&Pl_objp->pos, &world_goal_pos, target_objp, Pl_objp->radius * 4.0f))
good_pos = &world_goal_pos;
}
// ok, let's start moving it away and see if that's better
for (float i = 1.0f; i < 4.0f; i += 1.0f) {
if (good_pos)
break;
vm_vec_copy_scale(&world_goal_pos, &goal_pos, (new_radius / pl_dist) * powf(1.3f,i));
world_goal_pos += target_objp->pos;
if (!pp_collide(&Pl_objp->pos, &world_goal_pos, target_objp, Pl_objp->radius * 4.0f))
good_pos = &world_goal_pos;
}
// welp this sucks, just run away i guess
if (!good_pos) {
vm_vec_copy_normalize(&world_goal_pos, &tgt2pl);
world_goal_pos *= target_objp->radius + pl_dist;
world_goal_pos += target_objp->pos;
good_pos = &world_goal_pos;
}
}
else
good_pos = &world_goal_pos;
ai_turn_towards_vector(good_pos, Pl_objp, nullptr, nullptr, 0.0f, 0);
float subsys_distance = vm_vec_dist(&Pl_objp->pos, &gsubpos);
// full speed until you're close, then slow down a bit
accelerate_ship(aip, subsys_distance > 200.0f ? 1.0f : subsys_distance / 200.0f);
if (!(Ships[Pl_objp->instance].flags[Ship::Ship_Flags::Afterburner_locked])) {
if (subsys_distance > 300.0f) {
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 2 * F1_0;
}
}
else
afterburners_stop(Pl_objp);
}
return true;
}
// This function is only called from ai_big_chase_attack() when a ship is flying very slowly and
// attacking a big ship. The ship should scan for enemy fighter/bombers... if any are close, then
// return 1, otherwise return 0;
@@ -604,7 +744,10 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
}
// see if Pl_objp needs to reposition to get a good shot at subsystem which is being attacked
if ( ai_big_maybe_follow_subsys_path() ) {
if (aip->ai_profile_flags[AI::Profile_Flags::Improved_subsystem_attack_pathing]) {
if (ai_new_maybe_reposition_attack_subsys())
return;
} else if ( ai_big_maybe_follow_subsys_path() ) {
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags[AI::AI_Flags::Kamikaze])) {
afterburners_stop(Pl_objp);
}
@@ -631,8 +774,8 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
compute_desired_rvec(rvec, enemy_pos, &Pl_objp->pos);
else
rvec = NULL;
ai_turn_towards_vector(enemy_pos, Pl_objp, sip->srotation_time, nullptr, rel_pos, 0.0f, 0, rvec);
ai_turn_towards_vector(enemy_pos, Pl_objp, nullptr, rel_pos, 0.0f, 0, rvec);
// calc range of primary weapon
weapon_travel_dist = ai_get_weapon_dist(&Ships[Pl_objp->instance].weapons);
@@ -706,7 +849,7 @@ void ai_big_chase_ct()
extern void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 = -1, int priority2 = -1);
extern float set_secondary_fire_delay(ai_info *aip, ship *shipp, weapon_info *swip, bool burst);
extern void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp);
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vec3d *goal_point, float delta_time);
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vec3d *goal_point, float delta_time, float time_scale = 1.f);
extern void maybe_cheat_fire_synaptic(object *objp);
@@ -724,7 +867,14 @@ static void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy)
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
swp = &Ships[Pl_objp->instance].weapons;
if (dot_to_enemy > 0.95f - 0.5f * En_objp->radius/MAX(1.0f, En_objp->radius + dist_to_enemy)) {
float target_radius = En_objp->radius;
// normal subsystem attacking uses whether or not its on a path and skips this function entirely to stop "over-eager" firing
// since the improved method doesnt use paths, refine the target radius to stop over-eager shooting
if (aip->ai_profile_flags[AI::Profile_Flags::Improved_subsystem_attack_pathing] && aip->targeted_subsys != nullptr)
target_radius = aip->targeted_subsys->system_info->radius;
if (dot_to_enemy > 0.95f - 0.5f * target_radius/MAX(1.0f, target_radius + dist_to_enemy)) {
aip->time_enemy_in_range += flFrametime;
// Chance of hitting ship is based on dot product of firing ship's forward vector with vector to ship
@@ -798,6 +948,7 @@ static void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy)
} else {
swp->burst_counter[current_bank_adjusted] = 0;
}
swp->burst_seed[current_bank_adjusted] = rand32();
}
} else {
if (swip->burst_shots > swp->burst_counter[current_bank_adjusted]) {
@@ -810,6 +961,7 @@ static void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy)
} else {
swp->burst_counter[current_bank_adjusted] = 0;
}
swp->burst_seed[current_bank_adjusted] = rand32();
}
}
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
@@ -1006,7 +1158,10 @@ void ai_big_chase()
float dist_normal_to_enemy;
if (vm_vec_mag_squared(&aip->big_attack_surface_normal) > 0.9) {
dist_normal_to_enemy = fl_abs((dist_to_enemy * vm_vec_dot(&vec_to_enemy, &aip->big_attack_surface_normal)));
if (aip->ai_profile_flags[AI::Profile_Flags::Improved_subsystem_attack_pathing])
dist_normal_to_enemy = fl_abs((dist_to_enemy / vm_vec_dot(&vec_to_enemy, &aip->big_attack_surface_normal)));
else // I'm fairly sure this retail code VVV meant to use / instead of *
dist_normal_to_enemy = fl_abs((dist_to_enemy * vm_vec_dot(&vec_to_enemy, &aip->big_attack_surface_normal)));
} else {
// don;t have normal so use a conservative value here
dist_normal_to_enemy = 0.3f * dist_to_enemy;
@@ -1283,13 +1438,17 @@ void ai_big_strafe_attack()
ai_info *aip;
vec3d target_pos;
vec3d rand_vec;
float target_dist, target_dot, accel, t;
float accel, t;
float target_dist = 0.0f;
float target_dot = 0.0f;
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
if ( ai_big_maybe_follow_subsys_path(0) ) {
return;
}
if (aip->ai_profile_flags[AI::Profile_Flags::Improved_subsystem_attack_pathing]) {
if (ai_new_maybe_reposition_attack_subsys())
return;
} else if (ai_big_maybe_follow_subsys_path(0))
return
ai_big_attack_get_data(&target_pos, &target_dist, &target_dot);
if ( ai_big_strafe_maybe_retreat(&target_pos) )
@@ -1297,7 +1456,7 @@ void ai_big_strafe_attack()
if (aip->ai_flags[AI::AI_Flags::Kamikaze]) {
if (target_dist < 1200.0f) {
ai_turn_towards_vector(&target_pos, Pl_objp, Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time, nullptr, nullptr, 0.0f, 0);
ai_turn_towards_vector(&target_pos, Pl_objp, nullptr, nullptr, 0.0f, 0);
accelerate_ship(aip, 1.0f);
if ((target_dist < 400.0f) && ai_maybe_fire_afterburner(Pl_objp, aip)) {
afterburners_start(Pl_objp);
@@ -1406,9 +1565,11 @@ void ai_big_strafe_glide_attack()
flight_dot_to_enemy = vm_vec_dot(&target_objp->pos, &norm_vel_vec); //Angle between flight path and target ship
//If we're following a path, then we shouldn't be doing glide strafe
if ( ai_big_maybe_follow_subsys_path(0) ) {
if (aip->ai_profile_flags[AI::Profile_Flags::Improved_subsystem_attack_pathing]) {
if (ai_new_maybe_reposition_attack_subsys())
return;
} else if (ai_big_maybe_follow_subsys_path(0))
return;
}
//Gets a point on the target ship to attack, as well as distance and the angle between the nose of the attacker and that point.
ai_big_attack_get_data(&target_pos, &target_dist, &target_dot);
@@ -1422,7 +1583,7 @@ void ai_big_strafe_glide_attack()
vm_vec_sub(&targetToAttacker, &Pl_objp->pos, &target_objp->pos);
matrix orient;
vm_vector_2_matrix(&orient, &targetToAttacker, NULL, NULL);
vm_vec_random_in_circle(&tangentPoint, &target_objp->pos, &orient, target_objp->radius + GLIDE_STRAFE_DISTANCE, 1);
vm_vec_random_in_circle(&tangentPoint, &target_objp->pos, &orient, target_objp->radius + GLIDE_STRAFE_DISTANCE, true);
//Get tangent point in coords relative to ship, scale it up so the actual goal point is far away, then put back in world coords
vm_vec_sub2(&tangentPoint, &Pl_objp->pos);
vm_vec_scale(&tangentPoint, 1000.0f);
@@ -1674,7 +1835,7 @@ void ai_big_strafe()
break;
default:
Int3(); // Illegal submode for AIM_STRAFE
Error(LOCATION, "Ai_big_strafe() just tried to use an illegal submode. Go tell a coder!");
break;
}
+4
View File
@@ -27,6 +27,10 @@ void ai_big_strafe_maybe_attack_turret(const object *ship_objp, const object *we
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov=1.0f);
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float weapon_travel_dist, float fov=1.0f);
// default distance for following subsystem path points --wookieejedi
// the value is 5 because that was the original value specified in ai_big_maybe_follow_subsys_path()
const int Default_subsystem_path_pt_dist = 5;
const int Minimum_subsystem_path_pt_dist = 1;
#endif
+885 -491
View File
File diff suppressed because it is too large. Load diff
+80 -59
View File
@@ -25,6 +25,8 @@
#include "ship/ship.h"
#include "weapon/weapon.h"
// Just a reference to this struct being for looking up a ship's team in TVT
struct ship_registry_entry;
// all ai goals dealt with in this code are goals that are specified through
// sexpressions in the mission file. They are either specified as part of a
@@ -134,28 +136,48 @@ const char *Ai_goal_text(int goal)
return NULL;
}
// function to maybe add the form on my wing goal for a player's starting wing. Called when a player wing arrives.
void ai_maybe_add_form_goal( wing *wingp )
void ai_maybe_add_form_goal(wing* wingp)
{
// Cyborg17 - Changes from the client would just get overridden by the server anyway
// might as well keep them more closely in sync.
if (MULTIPLAYER_CLIENT) {
return;
}
int j;
// iterate through the ship_index list of this wing and check for orders. We will do
// this for all ships in the wing instead of on a wing only basis in case some ships
// in the wing actually have different orders than others
for ( j = 0; j < wingp->current_count; j++ ) {
ai_info *aip;
for (j = 0; j < wingp->current_count; j++) {
ai_info* aip;
Assert( wingp->ship_index[j] != -1 ); // get Allender
Assert(wingp->ship_index[j] != -1); // get Allender
aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index];
// don't process Player_ship
if ( aip == Player_ai )
// don't process a Player_ship
if (Objects[Ships[aip->shipnum].objnum].flags[Object::Object_Flags::Player_ship]) {
continue;
}
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
// it is sufficient enough to check the first goal entry to see if it has a valid goal
if ( aip->goals[0].ai_mode == AI_GOAL_NONE ) {
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip );
if (aip->goals[0].ai_mode == AI_GOAL_NONE) {
// Need to have a more specific target in multi, or they may end up trying to target standalone placeholder.
// So form on their team leader. In dogfight, all player-slot ai die, so just exclude.
if (MULTIPLAYER_MASTER && !(Netgame.type_flags & NG_TYPE_DOGFIGHT)) {
int wingnum;
if (Netgame.type_flags & NG_TYPE_TEAM) {
const ship_registry_entry* ship_regp = ship_registry_get(Ships[wingp->ship_index[j]].ship_name);
wingnum = TVT_wings[ship_regp->p_objp->team];
ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[Wings[wingnum].special_ship]].ship_name, aip);
} else {
wingnum = Starting_wings[0];
ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[Wings[wingnum].special_ship]].ship_name, aip);
}
} else if (!(Game_mode & GM_MULTIPLAYER)) {
ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip);
}
}
}
}
@@ -273,15 +295,12 @@ void ai_clear_ship_goals( ai_info *aip )
// add scripting hook for 'On Goals Cleared' --wookieejedi
Script_system.SetHookObject("Ship", &Objects[Ships[aip->shipnum].objnum]);
Script_system.RunCondition(CHA_ONGOALSCLEARED);
Script_system.RemHookVars(1, "Ship");
Script_system.RemHookVars({"Ship"});
}
void ai_clear_wing_goals( int wingnum )
void ai_clear_wing_goals( wing *wingp )
{
int i;
wing *wingp = &Wings[wingnum];
//p_object *objp;
// clear the goals for all ships in the wing
for (i = 0; i < wingp->current_count; i++) {
@@ -292,15 +311,13 @@ void ai_clear_wing_goals( int wingnum )
}
// clear out the goals for the wing now
// clear out the goals for the wing now
for (i = 0; i < MAX_AI_GOALS; i++) {
wingp->ai_goals[i].ai_mode = AI_GOAL_NONE;
wingp->ai_goals[i].signature = -1;
wingp->ai_goals[i].priority = -1;
wingp->ai_goals[i].flags.reset();
}
}
// routine which marks a wing goal as being complete. We get the wingnum and a pointer to the goal
@@ -310,7 +327,7 @@ void ai_clear_wing_goals( int wingnum )
void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
{
int mode, submode, priority, i;
char *name;
const char *name;
ai_goal *aigp;
wing *wingp;
@@ -388,7 +405,7 @@ void ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list, ai_info *ai
{
int i, j;
ai_goal *purge_goal;
char *name;
const char *name;
int mode, ship_index, wingnum;
// get locals for easer access
@@ -835,11 +852,10 @@ void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, i
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
{
int node, dummy, op;
char *text;
Assert ( Sexp_nodes[sexp].first != -1 );
node = Sexp_nodes[sexp].first;
text = CTEXT(node);
op = get_operator_const( node );
aigp->signature = Ai_goal_signature++;
@@ -848,8 +864,6 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->type = type;
aigp->flags.reset();
op = get_operator_const( text );
switch (op) {
case OP_AI_WAYPOINTS_ONCE:
@@ -1018,7 +1032,7 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
}
if ( aigp->priority > MAX_GOAL_PRIORITY ) {
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", text, aigp->priority, MAX_GOAL_PRIORITY));
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", CTEXT(node), aigp->priority, MAX_GOAL_PRIORITY));
aigp->priority = MAX_GOAL_PRIORITY;
}
@@ -1083,14 +1097,9 @@ int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp )
int goalsubmode = -1;
/* Sexp node */
int node = -1;
int node = Sexp_nodes[sexp].first;
/* The operator to use */
char* op_text = NULL;
int op = -1;
node = Sexp_nodes[ sexp ].first;
op_text = CTEXT( node );
op = get_operator_const( op_text );
int op = get_operator_const( node );
/* We now need to determine what the mode and submode values are*/
switch( op )
@@ -1217,11 +1226,10 @@ int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp )
}
// code to add ai goals to wings.
void ai_remove_wing_goal_sexp(int sexp, int wingnum)
void ai_remove_wing_goal_sexp(int sexp, wing *wingp)
{
int i;
int goalindex = -1;
wing *wingp = &Wings[wingnum];
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
if ( !Fred_running ) {
@@ -1252,10 +1260,9 @@ void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
}
// code to add ai goals to wings.
void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
void ai_add_wing_goal_sexp(int sexp, int type, wing *wingp)
{
int i;
wing *wingp = &Wings[wingnum];
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
if ( !Fred_running ) {
@@ -1413,21 +1420,17 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
{
ship *shipp = &Ships[objp->instance];
// always valid if has subspace drive
if (!(shipp->flags[Ship::Ship_Flags::No_subspace_drive]))
// always valid if has working subspace drive, not disabled, and not limited by subsystem strength
if ( ship_can_warp_full_check(shipp) )
return AI_GOAL_ACHIEVABLE;
// if no subspace drive, only valid if our mothership is present
// check that we have a mothership and that we can depart to it
if (shipp->departure_location == DEPART_AT_DOCK_BAY)
{
int anchor_shipnum = ship_name_lookup(Parse_names[shipp->departure_anchor]);
if (anchor_shipnum >= 0 && ship_useful_for_departure(anchor_shipnum, shipp->departure_path_mask))
return AI_GOAL_ACHIEVABLE;
// if we can't warp, we can only depart if the ship (or its wing) departs to a fighter bay and the mothership is present
if (ship_can_bay_depart(shipp)) {
return AI_GOAL_ACHIEVABLE;
}
else {
return AI_GOAL_NOT_KNOWN;
}
return AI_GOAL_NOT_KNOWN;
}
@@ -1652,26 +1655,36 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
else
{
auto ship_entry = ship_registry_get(aigp->target_name);
if (!ship_entry)
{
status = SHIP_STATUS_UNKNOWN;
}
// goal ship is currently in mission
if ( ship_name_lookup( aigp->target_name ) != -1 )
else if (ship_entry->status == ShipStatus::PRESENT)
{
status = SHIP_STATUS_ARRIVED;
}
// goal ship is still on the arrival list
else if ( mission_check_ship_yet_to_arrive(aigp->target_name) )
else if (ship_entry->status == ShipStatus::NOT_YET_PRESENT)
{
status = SHIP_STATUS_NOT_ARRIVED;
}
// goal ship has left the area
else if ( ship_find_exited_ship_by_name(aigp->target_name) != -1 )
else if (ship_entry->status == ShipStatus::EXITED)
{
status = SHIP_STATUS_GONE;
}
else
{
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n", Ships[objp->instance].ship_name, aigp->target_name));
status = SHIP_STATUS_UNKNOWN;
}
if (status == SHIP_STATUS_UNKNOWN)
{
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n", Ships[objp->instance].ship_name, aigp->target_name));
}
}
// Goober5000 - before doing anything else, check if this is a disarm goal for an arrived ship...
@@ -2105,7 +2118,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// if this object was flying in formation off of another object, remove the flag that tells him
// to do this. The form-on-my-wing command is removed from the goal list as soon as it is called, so
// we are safe removing this bit here.
aip->ai_flags.remove(AI::AI_Flags::Formation_object);
int old_form_objnum = -1;
if (aip->ai_flags[AI::AI_Flags::Formation_object]) {
// save who he was following so we can tell any others
// who are following to re-organize
old_form_objnum = aip->goal_objnum;
aip->ai_flags.remove(AI::AI_Flags::Formation_object);
}
// Goober5000 - we may want to use AI for the player
// AL 3-7-98: If this is a player ship, and the goal is not a formation goal, then do a quick out
@@ -2128,14 +2147,14 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// Mike -- debug code!
// If a ship has a subobject on it, attack that instead of the main ship!
ai_attack_object( objp, other_obj, NULL);
ai_attack_object( objp, other_obj);
break;
case AI_GOAL_CHASE_WEAPON:
Assert( Weapons[current_goal->target_instance].objnum >= 0 );
other_obj = &Objects[Weapons[current_goal->target_instance].objnum];
Assert( other_obj->signature == current_goal->target_signature );
ai_attack_object( objp, other_obj, NULL );
ai_attack_object( objp, other_obj);
break;
case AI_GOAL_GUARD:
@@ -2260,7 +2279,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
shipnum = ship_name_lookup( current_goal->target_name );
Assert( shipnum >= 0 );
other_obj = &Objects[Ships[shipnum].objnum];
ai_attack_object( objp, other_obj, NULL);
ai_attack_object( objp, other_obj);
ai_set_attack_subsystem( objp, current_goal->ai_submode ); // submode stored the subsystem type
if (current_goal->ai_mode != AI_GOAL_DESTROY_SUBSYSTEM) {
if (aip->target_objnum != -1) {
@@ -2282,14 +2301,14 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
break;
case AI_GOAL_CHASE_ANY:
ai_attack_object( objp, NULL, NULL );
ai_attack_object( objp, nullptr);
break;
// chase-ship-class is chase-any but restricted to a subset of ships
case AI_GOAL_CHASE_SHIP_CLASS:
shipnum = ship_info_lookup( current_goal->target_name );
Assertion( shipnum >= 0, "The target of AI_GOAL_CHASE_SHIP_CLASS must refer to a valid ship class!" );
ai_attack_object( objp, NULL, NULL, shipnum );
ai_attack_object( objp, nullptr, shipnum );
break;
case AI_GOAL_WARP: {
@@ -2371,6 +2390,8 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
break;
}
if (old_form_objnum != -1)
ai_formation_object_recalculate_slotnums(old_form_objnum);
}
void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name)
+3 -3
View File
@@ -102,11 +102,11 @@ extern int ai_goal_num(ai_goal *goals);
// adds goals to ships/wing through sexpressions
extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
extern void ai_add_wing_goal_sexp( int sexp, int type, wing *wingp );
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name );
extern int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp );
extern void ai_remove_wing_goal_sexp(int sexp, int wingnum);
extern void ai_remove_wing_goal_sexp( int sexp, wing *wingp );
// adds goals to ships/sings through player orders
extern void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
@@ -114,7 +114,7 @@ extern void ai_add_wing_goal_player( int type, int mode, int submode, char *ship
extern void ai_remove_ship_goal( ai_info *aip, int index );
extern void ai_clear_ship_goals( ai_info *aip );
extern void ai_clear_wing_goals( int wingnum );
extern void ai_clear_wing_goals( wing *wingp );
extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
+5 -2
View File
@@ -26,9 +26,12 @@ int object_is_targetable(object *target, ship *viewer);
int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold);
//Returns true if OK for *aip to fire its current weapon at its current target.
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip);
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip, int secondary_bank, ship_subsys* turret);
//Returns true if *aip has a line of sight to its current target.
bool check_los(int objnum, int target_objnum, float threshold, int primary_bank, int secondary_bank, ship_subsys* turret);
//Does all the stuff needed to aim and fire a turret.
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum);
void ai_fire_from_turret(ship *shipp, ship_subsys *ss);
#endif
+372 -354
View File
File diff suppressed because it is too large. Load diff
+28 -14
View File
@@ -151,14 +151,21 @@ int unpack_pixel(anim_instance *ai, ubyte *data, ubyte pix, int aabitmap, int bp
bit_16 = (ushort)pix;
break;
case 8:
// 8 bit-per-pixel aa bitmaps are a bit special since they only use value in the range [0, 15] where 15 wraps
// around back to 0. Since the rest of the code expects the value to be in the range [0, 255] the pixel value
// needs to be adjusted here. By muliplying the value with 17 the original range [0, 15] is mapped to [0, 255]
if (pix >= 15) {
bit_8 = 0;
} else {
bit_8 = (ubyte)(pix * 17);
// 8 bit-per-pixel aa bitmaps are a bit special since they only use a palette index value in the range [0, 15]. These
// palette indexes must be remapped to alpha values between [0, 255] which is what graphics code expects. Palette
// range [0, 14] is a gradient from black to white, and palette index 15 is a special color which indicates the background
// area of a HUD gauge. Retail code uses the final alpha value for index 1 for this special index to give gauges a dark
// transparent background.
if (pix > 15) {
bit_8 = 255;
}
else if (pix == 15) {
bit_8 = 18;
}
else {
bit_8 = (ubyte)(pix * 18);
}
break;
default:
Int3();
@@ -242,14 +249,21 @@ int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count = 0,
bit_16 = (ushort)pix;
break;
case 8 :
// 8 bit-per-pixel aa bitmaps are a bit special since they only use value in the range [0, 15] where 15 wraps
// around back to 0. Since the rest of the code expects the value to be in the range [0, 255] the pixel value
// needs to be adjusted here. By muliplying the value with 17 the original range [0, 15] is mapped to [0, 255]
if (pix >= 15) {
bit_8 = 0;
} else {
bit_8 = (ubyte)(pix * 17);
// 8 bit-per-pixel aa bitmaps are a bit special since they only use a palette index value in the range [0, 15]. These
// palette indexes must be remapped to alpha values between [0, 255] which is what graphics code expects. Palette
// range [0, 14] is a gradient from black to white, and palette index 15 is a special color which indicates the background
// area of a HUD gauge. Retail code uses the final alpha value for index 1 for this special index to give gauges a dark
// transparent background.
if (pix > 15) {
bit_8 = 255;
}
else if (pix == 15) {
bit_8 = 18;
}
else {
bit_8 = (ubyte)(pix * 18);
}
break;
default :
Int3();
+156 -150
View File
@@ -36,8 +36,8 @@
#include "particle/particle.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "ship/shiphit.h"
#include "species_defs/species_defs.h"
#include "stats/scoring.h"
#include "weapon/weapon.h"
@@ -49,9 +49,9 @@ asteroid_obj Asteroid_objs[MAX_ASTEROID_OBJS]; // array used to store asteroid o
asteroid_obj Asteroid_obj_list; // head of linked list of asteroid_obj structs
// used for randomly generating debris type when there are multiple sizes.
#define SMALL_DEBRIS_WEIGHT 8
#define MEDIUM_DEBRIS_WEIGHT 4
#define LARGE_DEBRIS_WEIGHT 1
const float SMALL_DEBRIS_WEIGHT = 8.0f;
const float MEDIUM_DEBRIS_WEIGHT = 4.0f;
const float LARGE_DEBRIS_WEIGHT = 1.0f;
int Asteroids_enabled = 1;
int Num_asteroids = 0;
@@ -256,7 +256,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
return NULL;
}
if((asteroid_type < 0) || (asteroid_type >= (((int)Species_info.size() + 1) * NUM_DEBRIS_SIZES))) {
if((asteroid_type < 0) || (asteroid_type >= (int)Asteroid_info.size())) {
return NULL;
}
@@ -487,31 +487,6 @@ static void asteroid_load(int asteroid_info_index, int asteroid_subtype)
}
}
/**
* Returns a weight that depends on asteroid size.
*
* The weight is then used to determine the frequencty of different sizes of ship debris
*/
static int get_debris_weight(int ship_debris_index)
{
int size = ship_debris_index % NUM_DEBRIS_SIZES;
switch (size)
{
case ASTEROID_TYPE_SMALL:
return SMALL_DEBRIS_WEIGHT;
case ASTEROID_TYPE_MEDIUM:
return MEDIUM_DEBRIS_WEIGHT;
case ASTEROID_TYPE_LARGE:
return LARGE_DEBRIS_WEIGHT;
default:
Int3();
return 1;
}
}
/**
* Create all the asteroids for the mission
*/
@@ -524,11 +499,11 @@ void asteroid_create_all()
// choose next type from table ship_debris_odds_table by rand()%max_weighted_range,
// the threshold *below* which the debris type is selected.
struct {
int random_threshold;
float random_threshold;
int debris_type;
} ship_debris_odds_table[MAX_ACTIVE_DEBRIS_TYPES];
int max_weighted_range = 0;
float max_weighted_range = 0.0f;
if (!Asteroids_enabled)
return;
@@ -551,7 +526,7 @@ void asteroid_create_all()
// Calculate the odds table
for (idx=0; idx<num_debris_types; idx++) {
int debris_weight = get_debris_weight(Asteroid_field.field_debris_type[idx]);
float debris_weight = Asteroid_info[Asteroid_field.field_debris_type[idx]].spawn_weight;
ship_debris_odds_table[idx].random_threshold = max_weighted_range + debris_weight;
ship_debris_odds_table[idx].debris_type = Asteroid_field.field_debris_type[idx];
max_weighted_range += debris_weight;
@@ -598,7 +573,7 @@ void asteroid_create_all()
} else {
Assert(num_debris_types > 0);
int rand_choice = rand() % max_weighted_range;
float rand_choice = frand() * max_weighted_range;
for (idx=0; idx<MAX_ACTIVE_DEBRIS_TYPES; idx++) {
// for ship debris, choose type according to odds table
@@ -928,7 +903,6 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
Assert( other_obj->type == OBJ_WEAPON );
mc.model_instance_num = Asteroids[num].model_instance_num;
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
model_clear_instance( mc.model_num );
mc.orient = &pasteroid->orient; // The object's orient
mc.pos = &pasteroid->pos; // The object's position
mc.p0 = &other_obj->last_pos; // Point 1 of ray to check
@@ -942,7 +916,11 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
if (hitnormal)
{
vec3d normal;
model_find_world_dir(&normal, &mc.hit_normal, mc.model_num, mc.hit_submodel, mc.orient);
if (mc.model_instance_num >= 0)
model_instance_find_world_dir(&normal, &mc.hit_normal, mc.model_instance_num, mc.hit_submodel, mc.orient);
else
model_find_world_dir(&normal, &mc.hit_normal, mc.model_num, mc.hit_submodel, mc.orient);
*hitnormal = normal;
}
@@ -1010,51 +988,51 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// first test against the sphere - if this fails then don't do any submodel tests
mc.flags = MC_ONLY_SPHERE | MC_CHECK_SPHERELINE;
SCP_vector<int> submodel_vector;
polymodel_instance *pmi;
if (model_collide(&mc)) {
// Set earliest hit time
asteroid_hit_info->hit_time = FLT_MAX;
auto pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
auto pm = model_get(pmi->model_num);
// Do collision the cool new way
if ( asteroid_hit_info->collide_rotate ) {
// We collide with the sphere, find the list of rotating submodels and test one at a time
SCP_vector<int> submodel_vector;
model_get_rotating_submodel_list(&submodel_vector, heavy_obj);
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
// turn off all rotating submodels and test for collision
for (size_t j=0; j<submodel_vector.size(); j++) {
pmi->submodel[submodel_vector[j]].collision_checked = true;
// turn off all rotating submodels, collide against only 1 at a time.
// turn off collision detection for all rotating submodels
for (auto submodel: submodel_vector) {
pmi->submodel[submodel].collision_checked = true;
}
// reset flags to check MC_CHECK_MODEL | MC_CHECK_SPHERELINE and maybe MC_CHECK_INVISIBLE_FACES and MC_SUBMODEL_INSTANCE
mc.flags = copy_flags | MC_SUBMODEL_INSTANCE;
// check each submodel in turn
for (size_t i=0; i<submodel_vector.size(); i++) {
// turn on submodel for collision test
pmi->submodel[submodel_vector[i]].collision_checked = false;
for (auto submodel: submodel_vector) {
auto smi = &pmi->submodel[submodel];
// turn on just one submodel for collision test
smi->collision_checked = false;
// set angles for last frame (need to set to prev to get p0)
angles copy_angles = pmi->submodel[submodel_vector[i]].angs;
matrix copy_matrix = smi->canonical_orient;
// find the start and end positions of the sphere in submodel RF
pmi->submodel[submodel_vector[i]].angs = pmi->submodel[submodel_vector[i]].prev_angs;
world_find_model_instance_point(&p0, &light_obj->last_pos, pmi, submodel_vector[i], &heavy_obj->last_orient, &heavy_obj->last_pos);
smi->canonical_orient = smi->canonical_prev_orient;
world_find_model_instance_point(&p0, &light_obj->last_pos, pm, pmi, submodel, &heavy_obj->last_orient, &heavy_obj->last_pos);
pmi->submodel[submodel_vector[i]].angs = copy_angles;
world_find_model_instance_point(&p1, &light_obj->pos, pmi, submodel_vector[i], &heavy_obj->orient, &heavy_obj->pos);
smi->canonical_orient = copy_matrix;
world_find_model_instance_point(&p1, &light_obj->pos, pm, pmi, submodel, &heavy_obj->orient, &heavy_obj->pos);
mc.p0 = &p0;
mc.p1 = &p1;
mc.orient = &vmd_identity_matrix;
mc.submodel_num = submodel_vector[i];
mc.submodel_num = submodel;
if ( model_collide(&mc) ) {
if ( mc.hit_dist < asteroid_hit_info->hit_time ) {
@@ -1065,23 +1043,23 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// set up asteroid_hit_info for rotating submodel
if (asteroid_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
model_instance_find_world_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, pm, pmi, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
vec3d int_light_pos, diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, pm, pmi, mc.hit_submodel, &heavy_obj->orient, &zero);
}
}
// Don't look at this submodel again
pmi->submodel[submodel_vector[i]].collision_checked = true;
smi->collision_checked = true;
}
}
// Recover and do usual ship_ship collision, but without rotating submodels
// Now complete base model collision checks that do not take into account rotating submodels.
mc.flags = copy_flags;
*mc.p0 = copy_p0;
*mc.p1 = copy_p1;
@@ -1097,7 +1075,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// get collision normal if not edge hit
if (asteroid_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
model_instance_find_world_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, pm, pmi, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
@@ -1113,7 +1091,6 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// Asteroid is heavier obj
mc.model_instance_num = Asteroids[num].model_instance_num;
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
model_clear_instance( mc.model_num );
mc.orient = &pasteroid->orient; // The object's orient
mc.radius = model_get_core_radius(Ship_info[Ships[pship_obj->instance].ship_info_index].model_num);
@@ -1137,6 +1114,23 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
}
}
// check if the hit point is beyond the clip plane if the ship is warping.
if (mc_ret_val) {
WarpEffect* warp_effect = nullptr;
ship* shipp = &Ships[pship_obj->instance];
// this is extremely confusing but mc.hit_point_world isn't actually in world coords
// everything above was calculated relative to the heavy's position
vec3d actual_world_hit_pos = mc.hit_point_world + heavy_obj->pos;
if ((shipp->is_arriving()) && (shipp->warpin_effect != nullptr))
warp_effect = shipp->warpin_effect;
else if ((shipp->flags[Ship::Ship_Flags::Depart_warp]) && (shipp->warpout_effect != nullptr))
warp_effect = shipp->warpout_effect;
if (warp_effect != nullptr && point_is_clipped_by_warp(&actual_world_hit_pos, warp_effect))
mc_ret_val = 0;
}
if ( mc_ret_val ) {
@@ -1768,7 +1762,7 @@ static void asteroid_parse_section(asteroid_info *asip)
}
required_string("$Detail distance:");
asip->num_detail_levels = stuff_int_list(asip->detail_distance, MAX_ASTEROID_DETAIL_LEVELS, RAW_INTEGER_TYPE);
asip->num_detail_levels = (int)stuff_int_list(asip->detail_distance, MAX_ASTEROID_DETAIL_LEVELS, RAW_INTEGER_TYPE);
required_string("$Max Speed:");
stuff_float(&asip->max_speed);
@@ -1782,7 +1776,7 @@ static void asteroid_parse_section(asteroid_info *asip)
if(optional_string("$Explosion Animations:")){
int temp[MAX_FIREBALL_TYPES];
int parsed_ints = stuff_int_list(temp, MAX_FIREBALL_TYPES, RAW_INTEGER_TYPE);
auto parsed_ints = stuff_int_list(temp, MAX_FIREBALL_TYPES, RAW_INTEGER_TYPE);
asip->explosion_bitmap_anims.clear();
asip->explosion_bitmap_anims.insert(asip->explosion_bitmap_anims.begin(), temp, temp+parsed_ints);
}
@@ -1829,20 +1823,81 @@ static void asteroid_parse_section(asteroid_info *asip)
} else
Warning(LOCATION, "Invalid asteroid reference %i used for $Split in asteroids table, ignoring.", split_type);
}
if (optional_string("$Spawn Weight:")) {
stuff_float(&asip->spawn_weight);
if (asip->spawn_weight <= 0.0f) {
Warning(LOCATION, "Spawn weight for asteroid '%s' must be greater than 0", asip->name);
asip->spawn_weight = 1.0f;
}
} else {
switch (Asteroid_info.size() % NUM_DEBRIS_SIZES)
{
case ASTEROID_TYPE_SMALL:
asip->spawn_weight = SMALL_DEBRIS_WEIGHT;
break;
case ASTEROID_TYPE_MEDIUM:
asip->spawn_weight = MEDIUM_DEBRIS_WEIGHT;
break;
case ASTEROID_TYPE_LARGE:
asip->spawn_weight = LARGE_DEBRIS_WEIGHT;
break;
default:
UNREACHABLE("Here be dragons");
}
}
}
// changes the name to "[species] Debris" if it had a name like "[species] debris #"
void maybe_change_asteroid_name(asteroid_info* asip) {
SCP_string name = asip->name;
size_t split = std::string::npos;
for (species_info species : Species_info) {
if (name.compare(0, strlen(species.species_name), species.species_name) == 0) {
split = strlen(species.species_name);
break;
}
}
if (split == std::string::npos)
return;
SCP_string remaining_name = name.substr(split + 1, name.length());
split = remaining_name.find(' ');
if (split == std::string::npos)
return;
SCP_string debris = remaining_name.substr(0, split);
SCP_string num = remaining_name.substr(split + 1, remaining_name.length());
if (stricmp(debris.c_str(), "Debris") != 0)
return;
if (num.empty() || std::find_if(num.begin(), num.end(), [](char c) {
return !std::isdigit(c, SCP_default_locale);
}) != num.end())
return;
// make sure this asteroid would correspond the 'species section' of the old style retail asteroids
if (Asteroid_info.size() < NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES && Asteroid_info.size() >= NUM_DEBRIS_SIZES) {
int idx = (int)(Asteroid_info.size()) / NUM_DEBRIS_SIZES - 1;
strcpy_s(asip->name, Species_info[idx].species_name);
strcat(asip->name, " ");
strcat(asip->name, XSTR("debris", 348));
}
}
/**
Read in data from asteroid.tbl into Asteroid_info[] array.
After this function is completes, the Asteroid_info[] array will
contain exactly three asteroids per species plus exactly three
generic asteroids. These three asteroids are a set
of small, medium, and large asteroids in that exact order.
If asteroid.tbl contains too many or too few asteroids as per
the rules above this function will abort the engine with an
error message stating the number expected and it will write
to the debug.log how everything was parsed.
After this function is complete, the Asteroid_info[] array
will have at least 3 generic asteroids plus whatever else
special ones were added in the table. The generic asteroids are
a set of small, medium, and large asteroids in that exact order.
Note that by saying "asteroid" this code is talking about
the asteroids and the debris that make up asteroid fields
@@ -1854,12 +1909,6 @@ that is being protected.
static void asteroid_parse_tbl()
{
char impact_ani_file[MAX_FILENAME_LEN];
// How did we get here without having any species defined?
Assertion(!Species_info.empty(),
"Cannot parse asteroids/debris if there "
"are no species for them to belong to."
);
try
{
@@ -1869,8 +1918,6 @@ static void asteroid_parse_tbl()
required_string("#Asteroid Types");
size_t tally = 0;
size_t max_asteroids =
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
#ifndef NDEBUG
SCP_vector<SCP_string> parsed_asteroids;
@@ -1883,82 +1930,41 @@ static void asteroid_parse_tbl()
asteroid_parse_section(&new_asteroid);
size_t species = tally / NUM_DEBRIS_SIZES;
if (tally >= max_asteroids)
{
#ifdef NDEBUG
// Bump the warning count in release so they get something
// even if the message never gets displayed.
Warning(LOCATION, "Ignoring extra asteroid/debris");
#else
SCP_string msg("Ignoring extra asteroid/debris '");
msg.append(new_asteroid.name);
msg.append("'\n");
Warning(LOCATION, "%s", msg.c_str());
parsed_asteroids.push_back(msg);
#endif
}
else
{
maybe_change_asteroid_name(&new_asteroid);
#ifndef NDEBUG
SCP_string msg;
msg.append("Parsing asteroid: '");
msg.append(new_asteroid.name);
msg.append("' as a '");
msg.append((species == 0) ? "generic" : Species_info[species - 1].species_name);
msg.append("'");
switch (tally % NUM_DEBRIS_SIZES) {
case ASTEROID_TYPE_SMALL:
msg.append(" small\n");
break;
case ASTEROID_TYPE_MEDIUM:
msg.append(" medium\n");
break;
case ASTEROID_TYPE_LARGE:
msg.append(" large\n");
break;
default:
Error(LOCATION, "Get a coder! Math has broken!\n"
"Important numbers:\n"
"\ttally: " SIZE_T_ARG "\n"
"\tNUM_DEBRIS_SIZES: %d\n",
tally, NUM_DEBRIS_SIZES
);
msg.append(" unknown\n");
}
parsed_asteroids.push_back(msg);
#endif
Asteroid_info.push_back(new_asteroid);
SCP_string msg;
msg.append("Parsing asteroid: '");
msg.append(new_asteroid.name);
msg.append("' as a '");
msg.append((tally >= NUM_DEBRIS_SIZES) ? "generic" : "special");
msg.append("'");
switch (tally % NUM_DEBRIS_SIZES) {
case ASTEROID_TYPE_SMALL:
msg.append(" small\n");
break;
case ASTEROID_TYPE_MEDIUM:
msg.append(" medium\n");
break;
case ASTEROID_TYPE_LARGE:
msg.append(" large\n");
break;
default:
Error(LOCATION, "Get a coder! Math has broken!\n"
"Important numbers:\n"
"\ttally: " SIZE_T_ARG "\n"
"\tNUM_DEBRIS_SIZES: %d\n",
tally, NUM_DEBRIS_SIZES
);
msg.append(" unknown\n");
}
parsed_asteroids.push_back(msg);
#endif
Asteroid_info.push_back(new_asteroid);
tally++;
}
required_string("#End");
if (tally != max_asteroids)
{
#ifndef NDEBUG
mprintf(("Asteroid.tbl as parsed:\n"));
for (SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
iter != parsed_asteroids.end(); ++iter)
{
mprintf(("%s\n", iter->c_str()));
}
#endif
Error(LOCATION,
"Found " SIZE_T_ARG " asteroids/debris when " SIZE_T_ARG " expected\n\n"
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
SIZE_T_ARG " = " SIZE_T_ARG "*%d + %d\n\n"
#ifdef NDEBUG
"Run a debug build to see a list of all parsed asteroids\n",
#else
"See the debug.log for a listing of all parsed asteroids\n",
#endif
tally, max_asteroids,
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
);
}
Asteroid_impact_explosion_ani = -1;
required_string("$Impact Explosion:");
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
+2
View File
@@ -73,6 +73,8 @@ public:
int model_num[NUM_DEBRIS_POFS];
SCP_vector<int> explosion_bitmap_anims;
float fireball_radius_multiplier; // the model radius is multiplied by this to determine the fireball size
SCP_string display_name; // only used for hud targeting display and for 'ship' asteroids
float spawn_weight; // ship asteroids only, relative proportion to spawn compared to other types in its asteroid field
asteroid_info( )
: num_detail_levels( 0 ), max_speed( 0 ), damage_type_idx( 0 ),
Loaded 100 of 1204 files, more files were not shown because too many files have changed in this diff. Show more