Compare commits

...
Author SHA1 Message Date
SirKnightly 0e1e98da41 Automated build commit 2023-10-06 17:08:44 +00:00
Goober5000 1ae9aaab21 Merge pull request #5669 from Goober5000/additional_shipstatus_fixes
additional ShipStatus fixes
2023-10-06 01:13:45 -04:00
Goober5000 3a46ed66ba additional ShipStatus fixes
Update the Lua enums to be consistent with the new ShipStatus enums.

Separately, add an extra ship registry check in the event a ship doesn't exist in the ship registry.
2023-10-06 00:38:23 -04:00
Goober5000 1812efa209 Merge pull request #5666 from Goober5000/fix_briefing_popup
fix replacement textures in briefing popup
2023-10-05 23:07:28 -04:00
Goober5000 2966757e62 Merge pull request #5668 from Goober5000/better_message
tweak error message
2023-10-05 23:07:20 -04:00
Goober5000 bc3aad374e tweak error message
For better debugging.
2023-10-05 22:23:02 -04:00
Goober5000 c5d192524e Merge pull request #5665 from notimaginative/add_mac_to_forum_posts
add macOS builds back to forum release build posts
2023-10-05 02:24:10 -04:00
Goober5000 7a47cc0521 fix replacement textures in briefing popup
Use the same method for texture replacement in briefing popups that is already used in the tech room.

Also don't render shadows when the jump node is displayed, since it's not being lit anyway.
2023-10-05 00:59:57 -04:00
Taylor Richards a33cc0f6c4 add macOS builds back to forum release build posts 2023-10-05 00:22:55 -04:00
Goober5000 af4ec4facc Merge pull request #5663 from Goober5000/fix_5661
remove incorrect setting of ship status
2023-10-04 23:10:52 -04:00
Goober5000 d897643217 tweak messages per feedback 2023-10-04 22:25:29 -04:00
Goober5000 6631975e45 some additional fixes 2023-10-04 21:15:30 -04:00
Goober5000 fa2b135bb1 remove incorrect setting of ship status
There is a bit of code in missionparse that sets the parse object because in-game joining needs it.  This is unrelated to ship status, so the status shouldn't be changed.  This fixes the bug and adds a comment to clarify the situation, as well as some warnings to help track down incorrect joining states.

Fixes #5661.  Follow-up to #5658 (where the regression was introduced) and #4836 (which fixed in-game joining).
2023-10-04 20:46:22 -04:00
Tyler Blount 7f4d78f44a Merge pull request #5639 from Goober5000/red_alert_wing_status
add wing status to red-alert system
2023-10-03 18:11:30 -07:00
Tyler Blount 10f484a504 Merge pull request #5649 from Goober5000/fix_ship_status
fix ShipStatus states to correctly account for exploding ships
2023-10-03 18:11:25 -07:00
Tyler Blount f0c8c9ad74 Merge pull request #5658 from Goober5000/fix_barrel_roll
fix barrel roll crash in Star Fox: Event Horizon
2023-10-03 18:11:18 -07:00
Goober5000 79579eda94 fix barrel roll crash in Star Fox: Event Horizon
The Star Fox barrel roll effect is achieved using a script which spawns a new ship.  The script sets no-collide on this spawned ship, but it also tries to set the ship flag for all future ships -- and future ships require a parse object, which doesn't exist for a created ship.  This patches the FALLTHROUGH in the sexp code to account for that possibility.

Separately, there are other ways a parse object pointer could become null through unusual code states, so this adds an INVALID status and several additional checks to defend against this crash in other circumstances.
2023-10-03 14:00:22 -04:00
Goober5000 be8ec82649 Merge pull request #5642 from BMagnu/fix_null_shiphit
Fix null dereference when a subsystem is hit for damage by a null object
2023-10-02 20:20:56 -04:00
Goober5000 b72b7688f9 Merge pull request #5634 from Baezon/fix-ai-subsys-attack-subobj
Fix for improved subsys attack pathing
2023-10-02 20:20:32 -04:00
Birk Magnussen c2e01864d5 Incorporate feedback 2023-10-02 17:48:03 +02:00
Goober5000 7a4d4466fd Merge pull request #5651 from Goober5000/fly_to_ship_mode_fix
fix crash when a ship has the fly-to-ship goal
2023-10-02 11:14:05 -04:00
Goober5000 ec75cac4d9 fix crash when a ship has the fly-to-ship goal
Add the missing AI mode in the switch block.  Also remove some redundant `break`s.
2023-10-02 00:04:02 -04:00
Goober5000 b6c0e8b562 fix ShipStatus states to correctly account for exploding ships
Adds a `DEATH_ROLL` status to specifically cover the state after ships have been destroyed but before they exit.  I've also audited all code that interacts with the ship registry to use the correct state with this new state taken into consideration.

This fixes access to exploding ships that was broken when the ship registry framework was introduced.  In particular, the `when destroyed X beam-lock-all X` QoL feature now works again.
2023-10-01 18:10:55 -04:00
JohnAFernandez 8d0570846b Merge pull request #5647 from notimaginative/fix_mac_id10t_error
fix bad extraction command in mac distribution zip
2023-10-01 12:55:19 -04:00
Taylor Richards 93d0624b3e fix bad extraction command in mac distribution zip 2023-10-01 03:22:15 -04:00
Goober5000 563445466e Merge pull request #5646 from Goober5000/warning_message_tweaks
tweak some model warning messages
2023-09-30 22:32:40 -04:00
Goober5000 b7e9d4c9cb tweak some model warning messages
Per a thread in the TBP forum, elaborate on these model warnings a bit.

Two other small code tweaks as well.
2023-09-30 20:06:41 -04:00
Birk Magnussen 348fb5ffb4 Change to variables 2023-10-01 01:25:38 +02:00
Taylor Richards d754c2cb50 tweak directory copying for frameworks on macOS (#5641)
CMake's copy_directory functions follow symlinks recursively as opposed to
preserving them. For mac frameworks, which make use of symlinks for versioning,
this causes the files to be duplicated multiple times in the copied framework.
Using rsync instead, just for frameworks, will properly duplicate the framework
while still avoiding the "file exists" error from cp.
2023-09-30 08:51:35 -04:00
Taylor Richards b760c5dec8 tweak mac build packaging (#5640)
Use GNU tar instead of the default bsdtar. This works around some weird
corruption bug triggered by the combination of the GitHub runner-VM, the llvm
linker, and bsdtar.

Adjust intermediate filenames such that they don't get uploaded to
indiegames by mistake.

Unpack builds as a single step instead of two.
2023-09-30 08:51:01 -04:00
JohnAFernandez 9c9b06a1b1 Merge pull request #5635 from MjnMixael/fix_gameplay_help
Do not clear Help Text
2023-09-30 05:02:20 -04:00
Birk Magnussen 30da49be81 Fix null dereference when hit for damage by a null object 2023-09-30 09:55:47 +02:00
Goober5000 c2d0eafc36 add wing status to red-alert system
If consecutive red-alert missions have different numbers of ships in a wing, then calculating the number of waves will not be correct.  This necessitates the addition of wing status to the stored data for red-alert sequences.

Not only must wing data be stored in `Red_alert_wing_status`, but also in the CSG file.  This necessitates a version bump.  Fortunately, the current design of CSG files allows extra data to be added to a section without breaking old builds, since the CSG loader will just skip over the unrecognized data.

This also renames `red_alert_wingman_status` to `red_alert_ship_status` since it's not limited to wingmen, as well as fixing the omission of exited ships if they are in the player's wing but don't have the red-alert-carry flag.

Fixes #5637.  Follow-up to #4457 and #5609.
2023-09-28 21:14:11 -04:00
mjn-mixael e3c7f81412 do not clear this 2023-09-27 23:17:32 -05:00
Asteroth 2b155c7a30 separate variable 2023-09-27 16:40:29 -04:00
Goober5000 df69993a84 Merge pull request #5633 from Goober5000/tweak_weapon_detonation
fix weapon detonation
2023-09-27 15:30:44 -04:00
Asteroth 3fb5bf1f5f fix world pos getting of target subsys 2023-09-27 14:35:53 -04:00
Goober5000 6823e24350 fix weapon detonation
Add some extra logic implied by the `Begun_detonation` flag.  Missiles that are homing can have their targets, headings, speeds, and lifetimes changed for various reasons.  If a missile has begun detonation, particularly if it is in "detonation limbo" because it is flying across a bowl-shaped turret, we don't want to change any of that.  The "detonation limbo" weapon lifetime is only accurate if all of those values remain constant.

Follow up to #4006.
2023-09-27 13:30:37 -04:00
MageKing17 305a7f6630 Show both name and callsign in escort list.
In #5477, I made the escort list respect hidden names by copying the behavior from `message_queue_process()`, which already checked those flags; however, this resulted in some dramatic behavioral changes for mods using callsigns for escort ships, and while making the behavior optional was a possibility, feedback suggested everyone would rather it just behaved like the target box and displayed both. So I replaced the code with similar logic from hudtargetbox.cpp, except with the "replace hidden name with ship class" code taking priority.
2023-09-26 16:33:45 -07:00
Goober5000 4ba6191e0c Merge pull request #5623 from notimaginative/fix_macos_packaging
fix macOS build packaging issues
2023-09-25 17:14:44 -04:00
Tyler Blount b4f633767e Merge pull request #5616 from Goober5000/HomingSubsys_fix
some fixes for setting HomingSubsystem in script
2023-09-25 13:56:24 -07:00
Taylor Richards 6dbfba2c9f fix macOS build packaging issues
- handle double archiving of macOS builds so they'll work properly with Knossos
 - fix issue where only a single configuration was included in the package
   (Release or FastDebug, not both)
2023-09-22 22:14:15 -04:00
Taylor Richards 9748de5ec1 Merge pull request #5621 from notimaginative/use_static_libstdc++
use static libstdc++
2023-09-22 22:13:05 -04:00
Taylor Richards 0765c7be95 try and fix clang build error 2023-09-22 16:17:23 -04:00
Taylor Richards 73f8e57961 statically link to libstdc++
Statically link to libstdc++ for CI/CD builds in an attempt
to avoid compatibility issues without relying on a crippled
docker build image.

Should properly fix #5571
2023-09-22 15:13:43 -04:00
Taylor Richards 743d8dd666 Revert "Revert "Update build image with curl and jq preinstalled""
This reverts commit f67814aaae.
2023-09-22 15:12:20 -04:00
Goober5000 7b410b2116 some fixes for setting HomingSubsystem in script
1. Allow setting the homing subsystem if the homing object has already been set
2. Use the `weapon_set_tracking_info` function if setting both object and subsystem, as it handles several important homing things
2023-09-20 23:29:04 -04:00
Tyler Blount 8fed4437ee Merge pull request #5614 from MjnMixael/fix_setting_mission_stats
Fix setting mission stats
2023-09-20 10:57:05 -07:00
Tyler Blount ad25418f92 Merge pull request #5613 from MjnMixael/fix_get_shipclass_kills
Fix Lua API Error with Player Stats
2023-09-20 10:52:15 -07:00
mjn-mixael 5972457ad5 fix setting mission stats 2023-09-19 10:57:30 -05:00
mjn-mixael 35876bc17e fix api error 2023-09-18 23:15:56 -05:00
Goober5000 46fa212db6 Merge pull request #5610 from Goober5000/collide_and_no_collide_sync
sync setting and getting of collides and no_collide
2023-09-17 18:28:22 -04:00
Goober5000 d0d65cd30c Merge pull request #5609 from Goober5000/red_alert_followup
improve checks for red-alert status
2023-09-17 18:28:15 -04:00
Goober5000 cb0e9ce601 sync setting and getting of collides and no_collide
The `collides` and `no_collide` flags are equivalent, but opposite.  So when sexps or scripts get or set those flags, allow each to be used as an anti-synonym (not exactly an antonym) for the other.
2023-09-17 01:23:31 -04:00
Goober5000 13bc0362c8 improve checks for red-alert status
Two fixes for red alert missions:
1. Since any ship in the wing can be stored, not just the wing leader, the "prospective name" check should check for all possible names in each wave
2. If a wing wasn't actually stored, the red alert code should not reset the wing's wave number to 0

Follow-up to #4457.
2023-09-17 00:17:39 -04:00
Goober5000 5749b856df Merge pull request #5606 from Goober5000/revert_5547
Revert 5547 and 5580
2023-09-16 15:39:35 -04:00
Goober5000 f67814aaae Revert "Update build image with curl and jq preinstalled"
This reverts commit 0219e65b00.
2023-09-16 14:58:39 -04:00
Goober5000 24daea79f3 Revert "Change ubuntu-latest to ubuntu-20.04"
This reverts commit 45306da4fe.
2023-09-16 14:58:27 -04:00
Goober5000 0f013f920b Revert "modify per feedback"
This reverts commit 679c3606c5.
2023-09-16 14:58:17 -04:00
Goober5000 d0c3c7db21 Merge pull request #5602 from Goober5000/sexp_fixes
fix crash in unusually formatted handwritten SEXP
2023-09-16 13:34:26 -04:00
Goober5000 be678c2f54 Merge pull request #5603 from Goober5000/fix_message_candidates
fix random selection of message candidates
2023-09-16 13:34:14 -04:00
Goober5000 16180306ad fix random selection of message candidates
The `Random::next(low, high)` function returns a value in [low, high].  This location should use the single-argument version, `Random::next(int modulus)`, which returns a value in [0, modulus-1].
2023-09-16 02:12:22 -04:00
Goober5000 865045a231 fix crash in unusually formatted handwritten SEXP
As reported by Colt, there was a crash in the in-mission jump sequence in Shepherds where the mission previously worked.  The proximate cause was a handwritten SEXP called via script that omitted whitespace before an opening parenthesis.  This was incorrectly recognized by the upgraded SEXP parser as an invalid SEXP.  Unfortunately, a separate bug in `get_line_num()` caused a crash when the parser tried to display a warning, because the function tried to calculate the line number of a SEXP that did not come from a parsed file.

This commit fixes the parser to recognize opening parentheses even when no whitespace precedes them, moves the output to the 'unexpected end of sexp' warnings will they will now be seen, and fixes `get_line_num()` to work when there is no parsed text.

Follow-up to #5520.
2023-09-15 15:12:44 -04:00
Tyler Blount 0b54c741a6 Merge pull request #5599 from MjnMixael/fix_scpui_reset_loadout
Actually reset the weapon pool with SCPUI
2023-09-14 15:26:32 -07:00
mjn-mixael baa34f1ffe Actually reset the weapon pool, dummy 2023-09-14 10:46:52 -05:00
Tyler Blount 0220ad0563 Merge pull request #5594 from MjnMixael/fix_campaign_saving_scpui
Save player after changing campaign in scpui
2023-09-10 13:55:59 -07:00
Tyler Blount 910521bdfe Merge pull request #4457 from JohnAFernandez/restore-red-alert-flags
Fix wing persistence and ensure checks for depleted wings are valid
2023-09-10 13:55:34 -07:00
Goober5000 7003e5caa2 get the wave count correct 2023-09-10 13:49:31 -04:00
mjn-mixael 8efe146300 save player after changing campaign in scpui 2023-09-09 23:01:59 -05:00
Asteroth a14fb35713 initialize trail info better (#5588) 2023-09-09 02:41:55 -04:00
Goober5000 2d0dc7798d unused variable 2023-09-09 00:41:44 -04:00
Goober5000 8242e3b94b small edits 2023-09-08 19:40:53 -04:00
Goober5000 16cb6b3f2f rewrite red-alert bashing routine 2023-09-08 19:13:58 -04:00
Goober5000 8c9be400a6 Merge branch 'master' into restore-red-alert-flags 2023-09-08 00:57:54 -04:00
Goober5000 7974a682ef Merge pull request #5581 from TRBlount/briefing_icon_scale_followup
Follow-up for briefing icon scaling
2023-09-07 23:12:11 -04:00
Goober5000 41af098d19 Merge pull request #5582 from TRBlount/starfield_timestamp_fix
Update starfield animation handling
2023-09-07 23:12:04 -04:00
Goober5000 4c95370f74 add parse object flag for starting wing, and move starting wing checks to post-processing 2023-09-07 20:56:54 -04:00
Goober5000 a6730a997c feedback 2023-09-07 19:15:56 -04:00
Goober5000 c5b84d9406 Merge pull request #5589 from Goober5000/beam_armor_fix
supply parameter for is_beam in all armor checks
2023-09-07 16:40:52 -04:00
Tyler Blount d2f5a12d5f Add parentheses to make order of operations more clear 2023-09-06 19:26:20 -07:00
Tyler Blount 6f6e839bbf Update starfield animation handling 2023-09-06 19:23:48 -07:00
Goober5000 065524fd4b Merge pull request #5586 from Goober5000/firepoint_followup
fix the logic for lighting up firing points
2023-09-06 18:22:27 -04:00
Goober5000 c84cb7ab64 supply parameter for is_beam in all armor checks
For certain calculations involving armor, the `GetDamage` function needs to know if the damage is being applied by a beam so it can apply the calculations with the proper frametime.  The parameter was not provided in all cases, so this fixes that.

Follow-up to #1609.
2023-09-06 18:17:37 -04:00
Goober5000 587ed4e41f convert magic number to constant 2023-09-06 12:13:36 -04:00
John Fernandez d73d46feb2 Stupidest typo in history 2023-09-04 14:50:01 -04:00
Goober5000 a881b339cc fix the logic for lighting up firing points
The firing point gauge did not work as advertised; this fixes it.  Unselected weapons are dimmed, selected weapons are normal, and firing weapons are bright.
2023-09-04 14:25:06 -04:00
Tyler Blount 1f90be0a86 Merge pull request #5584 from Goober5000/firepoint_fix
fix crash in firepoint gauge
2023-09-04 11:06:42 -07:00
Goober5000 4ce02ce291 fix crash in firepoint gauge
The gauge assumes that all firepoints will always have weapons, but it's possible for a ship to have less than the maximum number of weapons.
2023-09-03 18:07:40 -04:00
John Fernandez 7d83ece711 And make sure we can call the constructor 2023-09-01 19:34:25 -04:00
John Fernandez 9ee1a6eb23 Add a constructor for red_alert_wing_status 2023-09-01 19:25:36 -04:00
John Fernandez f258554304 add bash wingman status
And function calls.
2023-09-01 19:02:19 -04:00
John Fernandez 994048eb24 Create Struct And functions for restoring wings
This needs to be separate from ships
2023-09-01 16:54:46 -04:00
Tyler Blount 0af3197a90 Follow-up for briefing icon scaling 2023-09-01 12:15:41 -07:00
Goober5000 e5824b41bb Merge pull request #5580 from Goober5000/ubuntu_version_tweak
Change ubuntu-latest to ubuntu-20.04
2023-09-01 12:41:25 -04:00
Goober5000 679c3606c5 modify per feedback 2023-08-31 17:30:08 -04:00
Mike Nelson acbab034cc wtf (#5579) 2023-08-30 23:03:48 -04:00
Goober5000 45306da4fe Change ubuntu-latest to ubuntu-20.04 2023-08-30 22:57:29 -04:00
Goober5000 f09c7b3ba5 Merge pull request #5577 from Goober5000/additional_music_checks
additional music checks
2023-08-30 13:11:28 -04:00
John Fernandez 964f495238 A theoretical fix for invalid checks
Replace `wingp->num_waves == 0` with valid `wingp->current_wave >= wingp->num_waves` and correct six year old copy paste error.
2023-08-29 01:25:33 -04:00
Goober5000 865f7e725c Merge pull request #5578 from Goober5000/soundtrack_start_fix
fix soundtrack timestamp when change-soundtrack is called immediately
2023-08-27 16:33:28 -04:00
Goober5000 6a550a6701 additional music checks
This adds several fixes to make the event and menu music more robust:
1. The game will now run with zero soundtracks.  All accesses into a potentially empty vector should now have checks.
2. Soundtracks and menu music are now checked for validity before being played (not just when importing a FSM mission).
3. The parsing validity checks and the in-game event music now check for skippable patterns using the same function.
4. Zero measures and zero samples-per-measure now cause the game to skip a pattern.  Negative values now trigger a warning.
5. Omitting some or all of the `$Name:` lines for a soundtrack will not cause an assert.

Fixes #5576.  Follow-up to #5572.
2023-08-25 19:22:03 -04:00
Goober5000 ad2531efcc fix soundtrack timestamp when change-soundtrack is called immediately
There is a built-in delay for the event music to start playing, but this delay gets stepped on if `change-soundtrack` is called when the mission first starts.  So don't set the delay unless it has already elapsed at least once before.
2023-08-25 19:20:21 -04:00
Goober5000 8af06b9e78 Merge pull request #5575 from Goober5000/obj_sound_fix
fix persistent sounds not clearing their tally
2023-08-25 19:08:06 -04:00
Goober5000 b6eef2e8f2 fix persistent sounds not clearing their tally
When a non-looping persistent sound expires, `obj_snd_stop()` actually does need to be called.  Even though the sound is no longer playing, the `Num_obj_sounds_playing` tally needs to be decremented, otherwise it will eventually exceed its limit and prevent any additional persistent sounds from playing.  And it turns out `obj_snd_stop()` returns gracefully for sounds that aren't playing.

Follow-up to #3510.  Fixes a bug that appears to have been around since retail.
2023-08-25 13:27:09 -04:00
BMagnu 2feeb34629 Move light calculation out of vertex shader (#5573) 2023-08-25 05:46:02 +09:00
Goober5000 9d28ba568c Merge pull request #5572 from Goober5000/5567_followup
fix validity check for soundtracks
2023-08-23 22:28:53 -04:00
Goober5000 1b6ed75d73 filename is already truncated 2023-08-23 21:10:05 -04:00
Goober5000 4cf7ab3474 fix validity check for soundtracks
Since event music soundtracks use the exact file extension specified (see #5567), the validity check should also use the exact file extension specified.

Also, move the validity check to after parsing has completed because extensions may be overridden.
2023-08-23 20:39:26 -04:00
Goober5000 bd4b9cb0d7 Merge pull request #5568 from Goober5000/fix_campaign_crash
fix crash in campaign editor
2023-08-22 20:32:13 -04:00
Goober5000 926e10584c Merge pull request #5567 from Goober5000/event_music_extension_agnostic
handle extension mismatch in event music
2023-08-22 20:32:05 -04:00
Goober5000 defab61664 handle extension mismatch in event music
Currently, menu music will trim the extension and look for both OGG and WAV files, but event music will use the exact extension specified.  This is intended but could lead to unexpected results in mods, so display a warning for the modder.
2023-08-22 15:48:21 -04:00
Goober5000 7dc971a6f2 fix crash in campaign editor
The crash in #5514 appears to be caused by some of the graphics code not being in the expected state for the synchronization.  Looking at the code in `render_frame()`, a `gr_flip()` happens after one frame ends and before the next frame begins.  That implies that this `gr_flip()` should not be here, as it is in the middle of a frame.  For additional evidence, `gr_flip()` modifies the "uniform buffer manager" state, and that is part of the stack trace preceding the crash.  Removing this `gr_flip()` fixes the crash.

The strange thing is that this code *doesn't run at all* while the campaign editor is active.  I verified this by adding a MessageBox in place of `gr_flip()`; the MessageBox doesn't display until the campaign editor is exited.  And yet, FRED crashes with `gr_flip()` present and doesn't crash with it removed.  This calls for a new category of bug; I propose "spookybug", from spooky action-at-a-distance.

Fixes #5514.
2023-08-22 12:47:14 -04:00
Goober5000 e0a6ca9abd Merge pull request #5563 from Goober5000/movie_subtitle_font_tweak
fix $Movie subtitle font: for custom fonts
2023-08-21 16:42:11 -04:00
Goober5000 613fad21c9 fix $Movie subtitle font: for custom fonts
The default movie subtitle font is font01.vf, but mods with custom font tables might not use this font.  So this changes the handling slightly so that the movie player will use whatever the first available font is.

Follow-up to #1523.  Fixes a sometimes spurious warning in mod initialization.
2023-08-19 13:25:13 -04:00
Goober5000 91497d5056 Merge pull request #5560 from Goober5000/fred_help
improve launching of FRED help
2023-08-17 21:25:16 -04:00
Goober5000 e796a4fe00 improve launching of FRED help
1. Fall back to the FREDzone help docs if the local files cannot be found
2. Tweak url_launch error message and add a return value

This consequently removes the ReleaseWarning which wasn't the friendliest or clearest way to tell the user about a missing help file.
2023-08-16 12:28:53 -04:00
Goober5000 03f01604d9 Merge pull request #5559 from Goober5000/fix_5515
assign weapon particle effects properly
2023-08-16 11:27:30 -04:00
Goober5000 1547526057 Merge pull request #5558 from Goober5000/streaminganim_extension
some streaming animation fixes
2023-08-16 11:27:21 -04:00
Goober5000 7602b88756 assign weapon particle effects properly
Since `std::unordered_map.insert` does nothing if a key already exists, use bracket notation.  Fixes #5515.
2023-08-15 23:16:07 -04:00
Goober5000 4812ff529d Merge pull request #5550 from Goober5000/modular_weapon_flags
fix flags in modular weapon entries being cleared
2023-08-15 17:41:26 -04:00
Goober5000 fe42c7bdff make alpha value work for streaming EFFs 2023-08-14 18:07:21 -04:00
Goober5000 f706d6c0a0 use the correct resize mode 2023-08-14 17:40:47 -04:00
Goober5000 16b9225533 remove extensions from streaming animations
Since other functions in the scripting API remove extensions before loading the files, and since the internal functions expect them to be removed, the streaming anim API should handle that too.
2023-08-14 16:41:20 -04:00
Goober5000 64d9b6fb74 Merge pull request #5548 from Goober5000/stay_near_ship_fixes
ai-stay-near-ship fixes
2023-08-13 09:27:52 -04:00
Goober5000 b40f5a15b2 Merge pull request #5553 from Goober5000/nightly_porphyrion_to_perses
nightly build updates
2023-08-10 00:07:24 -04:00
Goober5000 52a5c356cf Merge pull request #5551 from Goober5000/dock_goal_achievability
remove Int3()'s in ai_mission_goal_achievable
2023-08-09 23:51:56 -04:00
Goober5000 b270c44ede use https for indiegames 2023-08-09 15:17:45 -04:00
Goober5000 6cf6f8a6fe update server 2023-08-09 15:14:43 -04:00
Goober5000 c273496c1e remove obsolete build files 2023-08-09 15:08:36 -04:00
Goober5000 8933aaff38 address feedback and add more chex 2023-08-09 15:01:41 -04:00
Goober5000 a3de0db735 remove Int3()'s in ai_mission_goal_achievable
As reported by Woutersmits, the GTT Nova did not dock with the GTD Hall in the first mission of Black Horizon.  Attempting to run a debug build caused a CTD.  Investigation showed that there was an invalid dockpoint triggering an Int3().  The dockpoint has been fixed, but to aid troubleshooting in the future, the Int3()'s in this function have been changed to more appropriate functions.
2023-08-09 04:11:47 -04:00
Goober5000 0dcb60f805 fix flags in modular weapon entries being cleared
When weapon flags are parsed in a modular table and override the previous set of flags, certain flags must be kept to preserve the behavior of the weapon.  The previous `preset_wi_flags` technique only worked if all such flags (homing, has-display-name, even whether the weapon turns) were set in the same modular table.  If a modular table overrode the flags but didn't specify those lines over again, mysterious and subtle bugs would occur.

This modifies the flag parsing to explicitly preserve all appropriate flags from the existing weapon entry, which fixes the bug.  It also allows all of the flags to be specified in one place, rather than scattering `preset_wi_flags` assignments throughout `parse_weapon`.  And this also adds quite a few flags to the flag list that were not handled at all under the previous design.

Finally this fixes a few incorrect assignments of default values to fields that should only happen the first time a weapon entry is parsed.
2023-08-09 01:49:35 -04:00
MageKing17 1bc7732b6e Merge pull request #5549 from MjnMixael/fix_sexp_descriptions
Correct a few sexp descriptions
2023-08-08 22:44:41 -07:00
mjn-mixael 2a64abfe92 correct a few sexp descriptions 2023-08-08 17:00:12 -05:00
Goober5000 d1e81be2aa ai-stay-near-ship fixes
Three fixes:
1. In commit fa0878b6b3 for PR #5338, the optional distance parameter was inadvertently changed to a bool.  This fixes the parameter.
2. The distance parameter was previously parsed using `atoi` which works for number literals, so change to `eval_num` to allow sexp return values.
3. Make `eval_num` consistent with `eval_sexp` in the sense that evaluating an empty list is valid and returns false or 0.

Also takes advantage of the fact that `is_sexp_true` works for empty lists to streamline optional arguments in `ai_add_goal_sub_sexp`.
2023-08-08 13:07:21 -04:00
Goober5000 e285641ac6 Merge pull request #5528 from Goober5000/detonate_on_expiration
'detonate on expiration' weapon flag
2023-08-07 22:18:58 -04:00
Goober5000 d3b1ad4328 remove vestigial debug variables 2023-08-07 16:59:02 -04:00
Tyler Blount 914f0e13e3 Merge pull request #5526 from Goober5000/hud_set_coords
add screen resolution scaling for hud-set-coords
2023-08-06 15:22:08 -07:00
m!m df68da3dd6 Merge pull request #5547 from asarium/image_curl_jq
Update build image with curl and jq preinstalled
2023-08-06 18:15:05 +02:00
asarium 0219e65b00 Update build image with curl and jq preinstalled
The install step in the CI pipeline is no longer needed after this
change and has been removed.
2023-08-06 17:09:42 +02:00
m!m cc171a6344 Merge pull request #5546 from asarium/fix_file_exists
Fix "File exists" error
2023-08-06 16:44:23 +02:00
asarium 7d066a1c45 Fix "File exists" error
Copying a file with cp on top of another one is not allowed by default
so switching the command to use the CMake provided one will fix the
issue and will also unify the commands for all platforms.

The directory support is necessary for Mac where the SDL library is
actually a directory.
2023-08-06 14:46:46 +02:00
Tyler Blount 6677fcabae Merge pull request #5513 from Goober5000/fred_campaign_path
fix a couple bugs in the campaign editor
2023-08-04 13:46:44 -07:00
Tyler Blount 171d36bf7f Merge pull request #5527 from Goober5000/fix_5507
add model filename back into debug log
2023-08-04 13:46:35 -07:00
Tyler Blount 9018ddf0d5 Merge pull request #5539 from MjnMixael/fix_bitmap_fps
Fix animated background bitmaps rendering with incorrect framerate
2023-08-04 13:46:28 -07:00
Tyler Blount d847236dd2 Merge pull request #5537 from MjnMixael/fix_loadout_ctd
Fix: Prevent loadout related CTD
2023-08-04 13:46:20 -07:00
mjn-mixael 0ee3d099ab and not or dummy 2023-08-02 09:28:07 -05:00
mjn-mixael 9aa48579b0 also check upper range 2023-08-02 09:19:26 -05:00
mjn-mixael bb28d0b859 account for very low framerates 2023-08-02 09:17:01 -05:00
mjn-mixael 2ef3a935e4 Fix animated background bitmaps rendering with incorrect framerate 2023-08-02 08:23:52 -05:00
mjn-mixael 233fa38890 Prevent loadout related CTD 2023-08-01 16:16:30 -05:00
Goober5000 e91d6ed17b 'detonate on expiration' weapon flag
For mods which want primary weapons to 'detonate', setting the detonation range is not reliable because, due to rounding imprecision, either the range (which detonates) or the lifetime (which does not) may happen first.  So this adds a flag to always detonate a weapon when its lifetime expires.  Secondary weapons have this flag by default, but primary weapons can add this flag in the $Flags list.  Additionally, if the detonation range and the predicted range due to lifetime are equal, the flag is added automatically.

Resolves #5521.
2023-07-29 18:23:38 -04:00
Goober5000 f6c86464aa add model filename back into debug log
In #4702 this log line was changed to the 'Model' category, which made it hidden by default.  This was missed in review but should be restored as it is a fairly important line.

Fixes #5507.
2023-07-29 15:29:29 -04:00
Goober5000 dd0af0e07c add screen resolution scaling for hud-set-coords
The hud-set-coords SEXP has always used exact pixels, without regard for the current screen resolution.  This adds a similar scaling mechanism as is used for show-subtitle.

Fixes #5525.
2023-07-29 15:21:43 -04:00
Goober5000 24031db712 Merge pull request #5520 from Goober5000/variable_token_fixes
SEXP parsing cleanup and fixes
2023-07-29 14:18:44 -04:00
Goober5000 d82b02a54a Merge pull request #5517 from Goober5000/fix_fred_bugs
fix mission corruption in FRED
2023-07-29 14:15:10 -04:00
Goober5000 a21876127d comment 2023-07-28 19:54:42 -04:00
Goober5000 f64de84e7c address feedback 2023-07-28 17:08:22 -04:00
Goober5000 feadc0bd69 feedback 2023-07-28 16:45:44 -04:00
Goober5000 1252d794db Merge pull request #5509 from Baezon/fix-laser-single-segment-trails
Some more fixes for laser single segment trails
2023-07-27 23:12:49 -04:00
Goober5000 58fcbde152 Merge pull request #5511 from z64555/fillValues_more_error
Add more error checking in joy-sdl.cpp.
2023-07-27 23:12:24 -04:00
Goober5000 b3970798e1 variables will only be referenced in nodes, not generators like for-counter 2023-07-27 16:14:06 -04:00
Goober5000 da34e25bc3 handle things properly on parse error 2023-07-27 16:07:15 -04:00
Goober5000 7fc75c0d6c more robust handling of Mp, especially after error 2023-07-27 15:04:38 -04:00
Goober5000 859978fd84 upgrade container parsing as well; and check for malformed variable tokens 2023-07-27 03:38:17 -04:00
Goober5000 7781d9fcda fix sexp variables in argument lists 2023-07-27 02:19:54 -04:00
Asteroth 03e876f65b no shadow 2023-07-27 00:58:10 -04:00
Goober5000 9480869e0a make variable parsing more robust; don't assume that an @ is always followed by a valid variable name; fix length checks; soften non-fatal Errors to error_display(0) 2023-07-27 00:04:15 -04:00
Goober5000 481e82303c use tokens in sexp help 2023-07-26 14:55:31 -04:00
Goober5000 689ac56bc8 fix mission corruption in FRED
When using the mission importer, missions were being corrupted for very subtle reasons: due to some code reordering in prior commits, `raw_ptr` would be initialized to `Parse_text_raw` before `Parse_text_raw` itself was initialized.  This assignment was done in the `CFred_mission_save` constructor and the ordering dependency is not obvious.  Since this is a highly fragile situation and has the potential to affect any use of `parse_comments()` in FRED, it's better to explicitly assign `raw_ptr` when it is needed, and just initialize it to nullptr in the constructor.

This also sets the version number to the legacy version (0.10) when the mission is saved in the retail format.
2023-07-26 03:39:17 -04:00
Goober5000 c5469982c8 fix a couple bugs in the campaign editor
1. When saving a campaign, the save directory should be the one that the campaign was just loaded from.  If prompting the user, this should be the default save directory.  This fixes a bug where campaigns were saved to %APPDATA% instead of where the FREDder might expect.  This has been a bug ever since the migration of the game files from FreeSpace2 to %APPDATA%.
2. When saving a campaign, save only the external mission flags, not the working flags that are maintained during gameplay but have no meaning in the saved file.
2023-07-25 01:49:10 -04:00
z64555 db64a212d6 Adds more error checking in joy-sdl.cpp.
* In fillValues(), Check the size values returned by SDL to assert they are non-negative.  If they are negative, abort vector resize and mprintf the SDL Error.
2023-07-24 19:01:08 -05:00
Asteroth 0a07b7e0ad some fixes for laser single segment trails 2023-07-24 18:37:03 -04:00
Tyler Blount 833d181700 Merge pull request #5504 from Baezon/fix-cmeasure-single-segment-trail
Fix for countermeasures with a single segment trail
2023-07-23 10:08:35 -07:00
Tyler Blount dfc716d91a Merge pull request #5501 from naomimyselfandi/zero-out-persona-bitfields
Explicitly zero out persona bitfields
2023-07-23 09:58:49 -07:00
Goober5000 8dd6a27418 Merge pull request #5475 from Goober5000/ai_autoscaling_check
prevent AI autoscaling for only a single autoscaled class
2023-07-22 21:46:25 -04:00
Asteroth 691ae8752e fix for countermeasures with a single segment trail 2023-07-20 23:42:35 -04:00
Asteroth 14b4fd3465 Fix weapon flags +override handling wrt spawn flag (#5488)
* fix wep flags +override wrt spawn

* Revert "fix wep flags +override wrt spawn"

This reverts commit 08a2bee1ca.

* parse +override ahead of time

* use string list instead

* hopefully fix whitespace???
2023-07-19 17:09:11 -04:00
Naomi Coffman fc6a1402c3 Explicitly zero out persona bitfields
Personae have a flag and a species bitfield. They're built up during parsing, but never explicitly zeroed out. This leads to ships occasionally getting an incorrect persona (especially common with support ships, which never have an explicit persona).

Additionally, this commit addresses an issue with the UES Aranyaka (and potentially other support ships belonging to species without a support persona). I'm honestly not sure why they were ever able to speak; however, with this change, they'll never be able to. As such, this commit introduces a "default support persona" to retain the desired behavior.
2023-07-19 15:04:18 -04:00
MageKing17 275f96d80c Remove Int3()s from message_translate_tokens().
In f350e06851, two Int3()s were added to `message_translate_tokens()`, to check for possible out-of-bounds errors. However, in c70fdc3a52, just a couple months later, the code being protected by those bounds checks were put into `else` branches, meaning the `Int3()`s became redundant. This wouldn't actually cause any problems unless somebody passed a string with two `$`s at least 40 characters apart to `message_translate_tokens()`. Cue #4876, which started calling `message_translate_tokens()` on debriefing stages and recommendations, which can contain color tags. This still wouldn't cause problems as long as the color tags are in pairs within close proximity (`translate_key()` would say "that's not the name of a scan code" and leave the text between the two tags alone), but as soon as two color tags are far enough apart to trip the bounds check conditional, the `Int3()` would be hit. This is still fine on Release builds, which ignore `Int3()`s, but triggers a breakpoint on debug builds, which depending on the user's system, can result in a CTD. Since, as far as I can tell, the `Int3()`s haven't actually been meaningful since 2006, I've just removed them (and inverted the conditionals), and testing by the affected user confirms that it no longer CTDs.
2023-07-18 13:34:26 -07:00
Goober5000 850d706df2 prevent AI autoscaling for only a single autoscaled class
When only one AI class performs autoscaling, the math formulas which use autoscaling will become meaningless (e.g. in `ai_maybe_launch_cmeasure()`) or will cause divide-by-zero errors (e.g. in `ai_manage_shield()`).  And autoscaling is not very useful outside of the specific ways that Volition used it.  So this adds some warnings and disables single-occurrence autoscaling.

Fixes #5474.
2023-07-18 01:05:18 -04:00
Goober5000 b06c8e72e1 Merge pull request #5499 from Goober5000/fireball_fix
fix Lua API access to Fireballs array
2023-07-18 00:34:53 -04:00
Asteroth b1fd9ffffb Improve performance of collision retiming (#5496)
* fast version of setting position and orientation

* preliminary stale collide time

* add global collision cache stale flag instead

* clean up

* more clean up

* no periods >.>

* bring back single object version

* rename and bring back stale object list

* use a set
2023-07-18 00:28:49 -04:00
Goober5000 e2c264cec4 fix Lua API access to Fireballs array
When fireballs were made dynamic in 609ed4ed94, the `MAX_FIREBALLS` #define lost any relationship to the fireball collection.  This removes it and also correctly specifies the size of the fireball collection.

This fixes a CTD when accessing items in `mn.Fireballs` via script.
2023-07-17 23:33:22 -04:00
Fabian Woltermann 3f889137d7 Merge pull request #5497 from The-E/fix/warn_for_invalid_trail_textures
Add a warning for cases when we couldn't load a trail bitmap
2023-07-17 23:53:48 +02:00
Fabian Woltermann 19f1e6b4ee remove bothersome warning 2023-07-17 23:07:37 +02:00
Goober5000 7e692ebca6 Merge pull request #5498 from Goober5000/5492_followup
add missing #includes to fix compilation
2023-07-17 16:17:03 -04:00
Goober5000 0067a57f8f add missing #includes to fix compilation
These #include lines are needed for the changes introduced in #5492.  Not sure why they weren't picked up by CI, or why they work in some compilers but not others.
2023-07-17 14:58:24 -04:00
Fabian Woltermann e028162dc2 update batching assertions 2023-07-17 18:54:12 +02:00
Fabian Woltermann 9b26439dd3 Add a warning for cases when we couldn't load a trail bitmap 2023-07-17 17:12:33 +02:00
Tyler Blount 1431270287 Merge pull request #5483 from Baezon/hud-gauge-load-safety
Improved hud gauge loading safety
2023-07-16 15:49:17 -07:00
Tyler Blount 06e74fa976 Merge pull request #5491 from MageKing17/bugfix/demo-missing-campaign
When playing the demo, don't try to reset if no campaign is active.
2023-07-16 15:47:59 -07:00
Tyler Blount 318fde51d7 Merge pull request #5492 from MageKing17/bugfix/voice-recognition-while-paused
Ignore voice recognition events while game is paused.
2023-07-16 15:47:51 -07:00
MageKing17 d253302fc9 Also check popup_active() and popupdead_is_active(). 2023-07-12 16:07:17 -07:00
MageKing17 560eb31e4f Ignore voice recognition events while game is paused.
If you pause the game, say something into the microphone, then unpause, it can abruptly perform an action based on voice recognition; this is probably counter to player expectations. This adds a `gameseq_get_state() != GS_STATE_GAME_PAUSED` check to the existing conditional.
2023-07-12 15:09:36 -07:00
MageKing17 493df37287 When playing the demo, don't try to reset if no campaign is active.
If the "Campaign Room only available in full version" popup is shown, it tries to reset `Active_campaign_index`, except that if a pilot is loaded with a missing campaign file, `Active_campaign_index` is -1. This causes an out-of-bounds array access, so let's present an alternate popup in this case (either one to select whatever the first campaign file found is, or the generic `popup_game_feature_not_in_demo()` if no campaign files are found).
2023-07-12 14:53:40 -07:00
BMagnu 32298b89fd Properly deinit io lib LuaFunctions (#5485) 2023-07-11 07:03:52 +09:00
Asteroth d6ee515873 remove testing prints 2023-07-07 01:22:40 -04:00
Asteroth bc09f0672b better hud gauge load safety 2023-07-07 01:20:11 -04:00
Goober5000 859534a75c Merge pull request #5482 from Goober5000/ship_killer_name_fix
fix some bugs revealed by ships with long display names
2023-07-07 00:41:59 -04:00
Goober5000 5f8234d1cd fix some bugs revealed by ships with long display names
Several related fixes:
1. Copy the actual ship name, not the display name, to `killer_parent_name` for two reasons:
  1a. Since `killer_parent_name` is used to look up the ship, it must be the actual ship name, not the display name.
  1b. Copying the display name can cause a buffer overflow because display names can be longer than 31 characters.
2. The display name functionality is moved to the more appropriate location in `player_generate_death_message()`.
3. Remove `player_get_killer_weapon_name()` which only served as a proxy check for whether the weapon index was used or not.
4. Use `ship_registry_get()` rather than `ship_name_lookup()`.
5. Add comments to clarify the use of `killer_parent_name`.
2023-07-03 20:08:26 -04:00
Goober5000 03e0904398 Merge pull request #5477 from MageKing17/cleanup/ship-name-handling
Avoid displaying hidden ship names in the escort list.
2023-07-03 17:18:43 -04:00
Goober5000 99170a3a70 Merge pull request #5480 from Goober5000/dockpoint_checks
add some additional safety checks for dockpoint paths
2023-07-03 17:18:31 -04:00
Goober5000 9b72fb6592 add some additional safety checks for dockpoint paths
1. Check that a path index is in range
2. Check that a path's parent submodel is the same as the dockpoint's parent submodel
2023-07-03 12:35:34 -04:00
Goober5000 ed6adeb281 Merge pull request #5479 from Goober5000/fix_instructor_check
fix instructor check
2023-07-02 22:59:55 -04:00
Goober5000 7c13df5881 fix instructor check
Fix the instructor check for whether a ship should circle or not.  Follow-up to #5353.  Fixes #5478.
2023-07-02 22:13:54 -04:00
BMagnu c6a98ad228 Clear Thread-stuff more aggressively (#5476) 2023-07-03 04:38:15 +09:00
MageKing17 927567ffed Avoid displaying hidden ship names in the escort list.
Secondarily, display callsigns in the escort list, if one is given.
2023-07-02 11:26:52 -07:00
Tyler Blount 5ebf530a30 Merge pull request #5473 from MageKing17/bugfix/avoid-split-line-once-assertion
Remove `max_pixel_w > 0` assertion from `split_str_once()`.
2023-06-30 08:44:48 -07:00
MageKing17 b32b54a737 Remove max_pixel_w > 0 assertion from split_str_once().
In at least two instances, `split_str_once()` can be called with width values derived from mod-supplied values that can be 0 or less (specifically, two hud gauges: if `+Messages:` has a `Max Width:` that's too small, or `+Directives:` has a `Max Line Width:` of 0 or less). Since user-supplied code shouldn't be tripping assertions, I looked into adding security around the calling sites when I realized that the assertion wasn't actually protecting against anything; the function would run just fine with a negative pixel width, it would just break with every whitespace. Since both calling sites that could trip the assertion already treat getting `src` back as output as an "I can't split this" error condition, it's perfectly fine (and skips iterating through the string) to just `return src` if the maximum pixel width is 0 or less, so let's just do that instead. Technically this is a behavior change in Release code, but the result of the old code would've been to spam the message log with every individual word in every message (if `Max Width:` was too small), and for directives to seemingly-randomly split only after the first word (if `Max Line Width:` was 0 or less). Not splitting at all is at least as correct, saves some pointless processing, and *should* still be obviously wrong if there was supposed to be a reasonable width value.
2023-06-28 11:56:38 -07:00
Goober5000 447ed95878 Merge pull request #5469 from Goober5000/fix_5387
tweak filename length check for PNGs
2023-06-25 01:33:02 -04:00
Goober5000 1ddf247fd5 Merge pull request #5471 from Goober5000/fix_5470
fix Assertion in turret_swarm_set_up_info
2023-06-25 00:32:16 -04:00
Goober5000 7f05f775af fix Assertion in turret_swarm_set_up_info
It appears that `(turret->turret_enemy_objnum < 0)` is an expected and allowed condition, so just assert that the objnum does not exceed MAX_OBJECTS.

Fixes #5470.
2023-06-23 22:55:41 -04:00
Goober5000 6cfc54499d tweak filename length check for PNGs
This is a bit tricky because both animated and non-animated PNGs use the same extension.  So for PNGs we need to defer the filename length check until we know for sure that it is an animated image.

Fixes #5387.
2023-06-21 03:45:14 -04:00
Joshua Glatt 4fa5c0d3e7 Fix save on mission close' container (#5463) 2023-06-20 21:12:37 -07:00
Goober5000 8c237626a5 Merge pull request #5462 from Goober5000/fix_5459
allow getting of mission info even for files with long names
2023-06-20 18:10:09 -04:00
BMagnu 41312265d5 Decouple MSAA from deferred end (#5467) 2023-06-21 06:17:56 +09:00
Goober5000 ee42e767a5 add warning to save; and make loading/saving more robust 2023-06-19 16:17:01 -04:00
wookieejedi f6b445ed2e Fix crash that can occur due to invalid glow point bank (#5465)
PR adds extra validity check within `model_render_glowpoints` function. Other places in code that use `bank->submodel_parent` check for validity before looking up `pmi->submodel`, but this check was missing from this section (which caused a CTD in a mission restart due to `bank->submodel_parent` being -1).
2023-06-18 22:14:16 -04:00
Goober5000 126c2e27f7 allow getting of mission info even for files with long names
Issue #5459 notes that mission files that are too long will crash the FRED campaign editor, but this is an artificial restriction.  The only need for a string buffer here is to enforce the correct mission extension, so use a SCP_string for this, and add checks for whether string manipulation is in fact necessary.  (In most cases it isn't.)

Fixes #5459.
2023-06-17 01:05:59 -04:00
Tyler Blount f4aa5c079f Merge pull request #5461 from TRBlount/23_2_RC
Begin 23.2 Release Cycle
2023-06-16 19:10:13 -07:00
Tyler Blount 4f9e1360a5 Update changelog and release.mako for 23.2 2023-06-16 17:13:38 -07:00
Tyler Blount d839f9f3c9 Merge pull request #5444 from Goober5000/5401_followup
refinements of jump node features
2023-06-16 14:38:12 -07:00
Tyler Blount 9d10066da7 Merge pull request #5318 from Goober5000/per_species_warp
add per-species warp effects
2023-06-16 14:35:45 -07:00
Goober5000 d42f3f79ac Merge pull request #5457 from Goober5000/zero_sun_bank
fix angle conversions in FRED
2023-06-15 22:32:33 -04:00
Goober5000 32982351dc Merge pull request #5456 from Goober5000/kitsune_fix
handle special characters in additional places in FRED
2023-06-15 22:32:24 -04:00
Goober5000 bcb9e48586 fix angle conversions in FRED
In certain cases, angles would be rounded to 360, where the expected range is 0-359.  The range was guarded properly for skyboxes but not for bitmaps and suns.  This fixes that.  Additionally, since suns do not bank, the angle conversion now sets the bank to 0.

Fixes #5390.
2023-06-14 14:31:12 -04:00
wookieejedi df323423dd Update Some Newish CM Options to Floats (#5452) 2023-06-12 19:24:07 -04:00
Goober5000 26abf577cc handle special characters in additional places in FRED
Kitsune discovered that special characters, notably semicolons, were not properly handled in the Mission Specs editor.  This adds appropriate handling of special characters for fields in that editor, similar fields in the campaign editor, and the corresponding places in qtFRED.  This also makes error messages more descriptive for campaign load failures.
2023-06-11 16:34:50 -04:00
BMagnu 7c0827aaa2 Move bad check (#5455) 2023-06-10 23:13:26 +02:00
Asteroth 4845f6837d fix ai reposition oversight (#5454) 2023-06-08 20:13:46 -04:00
Shivansps 15e7fb16d1 Validate chunk size to avoid align crash and add align skip flag (#5450)
* validate chunk size to avoid align crash and add align skip flag

* change type from uint to int

* change mprintf output to a warning

* revert uint to int change and requested changes
2023-06-08 16:05:56 -04:00
Asteroth 60f3aa59d6 Make lasers less kinky (#5446)
* properly handle trapezoidal bitmaps

* clean up

* fixup single segment trails too

* fix
2023-06-07 19:59:07 -04:00
BMagnu 8562dde955 OpenGL Capability Handling (#5445)
* Init Particle shaders only if they're actually used

* set layout correctly

* Don't compile shadow shader if not needed

* Properly deal with capabilities

* Fix typo

* remove obsolete capability
2023-06-07 19:58:55 -04:00
Mike Nelson 85f915f352 Fix typo and copy/paste error (#5449) 2023-06-06 16:39:35 -04:00
Goober5000 23f6b39597 Merge pull request #5407 from z64555/fix/5405
Fix 5405
2023-06-05 21:45:01 -04:00
Goober5000 c7bc0a7263 Merge pull request #5443 from Goober5000/lighting_profiles_followup
some updates to the lighting profile code
2023-06-05 21:44:35 -04:00
Goober5000 3ae178e125 refinements of jump node features
1. Deprecate the old set-jumpnode-name sexp now that there is a set-jumpnode-display-name
2. Make the display name design consistent with ships and weapons; in particular add a `HasDisplayName()` function and automatically generate the display name for hash-truncated names
3. Keep the display name in sync when the name is changed in the FRED dialog
4. Fix the overriding of hash-truncated names with display names on the HUD
5. Fix the incorrect setting of the alphacolor flag when using FRED
6. Fix array out-of-bounds access when no object is selected

Follow-up to #5401.
2023-06-05 00:41:38 -04:00
Goober5000 e7cb174684 Merge pull request #5442 from Goober5000/retime_pairs_fix_and_update
some refinements for retiming of object collision pairs
2023-06-04 22:11:04 -04:00
Goober5000 aef5a022a8 Merge pull request #5440 from Goober5000/drop_shadows_option
add game_settings.tbl option to enable HUD drop shadows by default
2023-06-04 16:38:49 -04:00
Goober5000 fe77cbee3c Merge pull request #5441 from MjnMixael/default_cm_class
Lua access to default countermeasure class
2023-06-04 16:38:42 -04:00
Goober5000 ab5e016dbb some updates to the lighting profile code
1. Add const qualifier where appropriate to API methods
2. Change `TonemapperAlgorithm` from enum to enum class, for type safety and token scope
3. Update saving of lighting profile in FRED
4. Add saving of lighting profile in qtFRED
5. Add lighting profile (and asteroid) initialization to qtFRED
2023-06-04 16:09:51 -04:00
Goober5000 91e7bea55e Merge pull request #5439 from Goober5000/followup_stuff
Fixes for lab backgrounds and curve initialization
2023-06-04 16:09:23 -04:00
Goober5000 c72b8b0cf4 some refinements for retiming of object collision pairs
1. Add a function to retime *only* the collision pairs involving a specific object.  This is useful when only one object has moved, since only collisions involving that object are affected.
2. Use this function when objects are moved for autopilot, via sexp, and via script.

Previously collision pairs were not retimed when objects were moved via script, leading to bugs.  This fixes that.
2023-06-04 16:04:53 -04:00
mjn-mixael c07389ce6b invalid weapon 2023-06-04 09:22:01 -05:00
z64555 f07e3322e9 Use a std::runtime_error instead of std::exception, because messages in std::exceptions are not a cstdlib spec.
* Update doxy to reflect changes
2023-06-04 09:04:17 -05:00
Goober5000 8e242b4c40 Merge pull request #5433 from Goober5000/sexp_tree_search
Sexp tree searching and filtering
2023-06-03 23:33:19 -04:00
Asteroth 9bd3b00b49 add single segment trails (#5432) 2023-06-02 21:28:45 -04:00
Asteroth 46b886df2c add single segment trails (#5432) 2023-06-02 20:23:07 -04:00
Asteroth 87ad9d99c4 add single segment trails (#5432) 2023-06-02 20:22:40 -04:00
mjn-mixael 1a946beed1 lua access to default countermeasure class 2023-06-02 17:40:44 -05:00
Goober5000 720d938a3a address feedback 2023-06-02 16:26:25 -04:00
Goober5000 ab63301d22 Merge pull request #5401 from MjnMixael/translatable_jump_node
Enhance jump node handling
2023-06-01 22:43:08 -04:00
Goober5000 f1bed594f8 Merge pull request #5435 from MjnMixael/lua_is_player_allowed
Flags to see if a ship or weapon class is player allowed
2023-06-01 22:42:58 -04:00
Goober5000 8a44ff160f Merge pull request #5438 from MjnMixael/fix_default_lighting_profile
Default profile name needs to be added after reset()
2023-06-01 22:42:48 -04:00
Goober5000 ee74f86c5e use correct #Background bitmaps string, use correct string skipping, and do a little tidying 2023-06-01 15:58:39 -04:00
Goober5000 68d216d973 add curves_init and alphabetize #include list 2023-06-01 15:38:22 -04:00
Goober5000 d7d9f10208 add game_settings.tbl option to enable HUD drop shadows by default
As requested by a comment on #4543.
2023-06-01 15:23:41 -04:00
mjn-mixael cc567edaf7 default profile name needs to be added after reset() 2023-05-31 15:50:20 -05:00
mjn-mixael fd6b670a04 flags to see if a ship or weapon is player allowed 2023-05-31 11:37:59 -05:00
Goober5000 b24594acb8 Merge pull request #5418 from scp-fs2open/dependabot/pip/ci/post/requests-2.31.0
Bump requests from 2.26.0 to 2.31.0 in /ci/post
2023-05-30 22:56:52 -04:00
Goober5000 af84b91619 Merge pull request #5421 from BMagnu/modular_subsystem_set_data
Virtual POFs: Modify Subsystems
2023-05-30 22:56:34 -04:00
Goober5000 e28e681d08 Merge pull request #5426 from Baezon/all-poofs-default
All poofs on by default
2023-05-30 22:56:24 -04:00
Goober5000 b223665c3d Merge pull request #5434 from TheForce172/fix/qtFredload
Quick fix to qtfred loading on linux
2023-05-30 22:55:53 -04:00
The Force 303e482047 Quick fix to allow qtfred to compile on ubuntu 2023-05-30 23:53:26 +01:00
Goober5000 8fc28b01ea work with operator indexes to reduce back-and-forth between const and index 2023-05-30 15:41:24 -04:00
Goober5000 278355cac0 select text by default, and implement escape 2023-05-30 15:41:22 -04:00
Goober5000 9bd10e55c6 sort operators by cost when filtering, and use the same best-match strategy in sexp_match_closest_operator 2023-05-30 15:41:17 -04:00
Joshua Glatt a10c733122 allow using container data with ai-waypoints* SEXPs (#5429) 2023-05-29 15:24:18 -07:00
Goober5000 a06573b15e implement type-to-filter and enter-to-confirm 2023-05-29 00:31:27 -04:00
Goober5000 4ff90d3716 move some utilities to a better location, plus a slight refactor 2023-05-28 22:47:38 -04:00
Goober5000 01b96de318 fix handle mismatch 2023-05-28 22:42:23 -04:00
Goober5000 eb959cd0bf make the tooltip explain why an operator can't be selected 2023-05-28 22:42:23 -04:00
Goober5000 46dee9ff0c use selected operators, and prevent disabled operators from being confirmed 2023-05-28 22:42:23 -04:00
Goober5000 579ce220ab fix some sexp help text 2023-05-28 22:42:23 -04:00
Goober5000 09ae954d8e disable operators with incompatible return types 2023-05-28 22:42:23 -04:00
Goober5000 4c43f22a7a multiline tooltips work 2023-05-28 22:42:22 -04:00
Goober5000 9967ed5150 add a new MFC control for the operators 2023-05-28 22:42:22 -04:00
Goober5000 ff2ec6a2ab preliminary sexp operator popup 2023-05-28 22:42:22 -04:00
z64555 9b0846c897 Try const std::exception &e, as per Goober5000's suggestion. 2023-05-27 20:25:41 -05:00
Mike Nelson 2ed78ab1a8 Fix asteroid wrapping (#5419)
* refactor how asteroid wrapping is done and setup for allowing or disallowing range check

* allow fred to toggle enhanced spawn checking

* field naming adjustment

* some minor tweaks

* Add sexp compatibility

* We don't need to save the boolean, just the string.

* full qtFRED support
2023-05-27 15:03:49 -04:00
Goober5000 5373ceb650 Merge pull request #5425 from Goober5000/comm_menu_hook
add hooks for comm menu opening and closing
2023-05-27 12:07:52 -04:00
Goober5000 8e7a93698b Merge pull request #5424 from Goober5000/hud_gauge_qtfred_update
patch qtFRED's handling of hud gauges
2023-05-27 12:07:44 -04:00
Taylor Richards b3532e71cc add support for loose lz4 compressed files (#5411) 2023-05-26 22:43:13 -04:00
EatThePath bee289cfa9 Merge pull request #5423 from EatThePath/ltp/fix-reset-new-profiles
call reset() on new profiles to ensure properly set default values.
2023-05-26 21:46:10 -04:00
Asteroth 5bf35ef048 all poofs on by default 2023-05-26 17:44:58 -04:00
Asteroth 16e0e3d6c4 Use volume particles for poofs (#5412)
* allow volume particles for poofs

* fix
2023-05-26 16:23:06 -04:00
Goober5000 59a5d2642c add hooks for comm menu opening and closing
Implements #5420.
2023-05-26 12:51:34 -04:00
Goober5000 346bbb61a2 patch qtFRED's handling of hud gauges
There was a missing function call in qtFRED's initialization, which prevented custom HUD gauges from being loaded.  This adds that.  Additionally, this updates the deduplication code in `get_listing_opf_custom_hud_gauge` to match its counterpart in FRED.

Fixes #5422.
2023-05-26 11:34:11 -04:00
ETP 2ba173d208 call reset() on new profiles to ensure properly set default values. 2023-05-25 20:13:04 -04:00
Birk Magnussen f4b6a4af61 Property Append Mode proper 2023-05-25 20:55:22 +02:00
Birk Magnussen f8220ccd60 Property Append Mode 2023-05-25 20:54:04 +02:00
Birk Magnussen be29fc9eaa fix warning 2023-05-25 12:15:18 +02:00
Birk Magnussen 4d25b34c1b Add Subsystem data change 2023-05-25 12:12:55 +02:00
EatThePath b32e7b35f7 fix #5416 by loading correct table filenames and ensuring tonemapper is parsed into proper profile. (#5417)
Also fixes semi-spurious warnings about missing default profile by ensuring proper creation of the default profile even if no files are found.
2023-05-22 22:46:58 -04:00
dependabot[bot] b837c4fa7a Bump requests from 2.26.0 to 2.31.0 in /ci/post
Bumps [requests](https://github.com/psf/requests) from 2.26.0 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.26.0...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-05-23 02:42:44 +00:00
Goober5000 7443fed890 Merge pull request #5415 from Goober5000/iequals
add lcase_equal and lcase_lessthan
2023-05-21 21:19:12 -04:00
Asteroth d4beb69328 Add player damage inflicted factor (#5406)
* add player damage inflicted factor

* update default file
2023-05-21 08:17:31 -04:00
Goober5000 d6f3fc76f9 Merge pull request #5414 from Goober5000/fix_event_delay_status
fix evaluation of event status for some events
2023-05-20 18:53:58 -04:00
Goober5000 3e0c7f0721 add lcase_equal and lcase_lessthan
The `SCP_string_lcase_equal_to()()` and `SCP_string_lcase_less_than()()` functors are rather unwieldy to use in non-functor situations, so this adds conventional function equivalents.
2023-05-20 18:21:37 -04:00
Goober5000 d0409ee7be Merge pull request #5409 from Goober5000/fred_and_parse_cleanup
some cleanup and refactoring
2023-05-20 12:41:10 -04:00
Fabian Woltermann 04ad198bb1 Merge pull request #5380 from EatThePath/ltp/multiple-profiles
Ltp/multiple profiles
2023-05-20 10:27:21 +02:00
Fabian Woltermann ca66b41a9e Merge branch 'master' into ltp/multiple-profiles 2023-05-20 10:02:05 +02:00
Goober5000 38c04d0ab3 fix evaluation of event status for some events
Related to #5267, and again concerned with the original check for event delay:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
    return SEXP_FALSE;
```
For events that were never evaluated at all, their timestamp remained 0.  Thus the function did not return and the status of the event (which by definition was incomplete) was always checked.

After the timestamp refactoring, this comparison always returned SEXP_FALSE for these events.  The correct behavior is to bypass invalid timestamps so that the status of the event is always checked.

This fixes the behavior of `is-event-false-delay` in debriefings.
2023-05-19 23:11:35 -04:00
Goober5000 d784f18a52 Merge pull request #5410 from Goober5000/fix_qtfred_init
fix qtFRED initialization
2023-05-19 20:57:29 -04:00
Mike Nelson d87cd04aad Traitor overrides feature (#5404)
* Traitor overrides feature

* must code the way goober codes or else

* clarity is key when you're ocd

* even more clarity
2023-05-19 13:07:50 -04:00
ETP aec4977e6e cleaned up some dead commented code 2023-05-19 13:05:28 -04:00
Goober5000 c7ad3592a6 fix qtFRED initialization
The `stars_post_level_init()` change in #5403 exposed a bug where qtFRED would sometimes try to render the mission before all setup had been completed, causing a crash because `Show_iffs` was zero-length.  This was due to the mission being created in the middle of initialization, instead of after initialization was complete.  This fix moves `createNewMission()` to main.cpp, after initialization has finished, and in parallel with the command-line option to load a mission.
2023-05-19 00:37:13 -04:00
Goober5000 1fe528b86d Merge pull request #5403 from Goober5000/skybox_timestamp_fix
patch FRED handling of starfield setup
2023-05-18 18:33:24 -04:00
Goober5000 34663c68bd some cleanup and refactoring
Refactor and clean up some of the code, and add some fixes and utility functions.  This covers the non-X-Wing part of #5277.
2023-05-18 18:28:09 -04:00
Asteroth 29e77013ab init curves in fred (#5408) 2023-05-18 04:51:51 -04:00
z64555 3ec4480c13 We actually want to throw when the pointer is a nullptr, thank you. 2023-05-17 09:38:54 -05:00
z64555 562dd95da3 Replace Assertion within io::joystick::Joystick's constructor with a throw.
* Add try-catch block within enumerateJoysticks() to catch the exception thrown by the Joystick constructor and log the deviceid and the SDL error.
2023-05-17 08:49:47 -05:00
Goober5000 2b1cd53db9 Merge pull request #5397 from Goober5000/lua_is_player
add ship:isPlayer()
2023-05-14 22:05:21 -04:00
Goober5000 be8c3ebb2f patch FRED handling of starfield setup
1. Skybox initialization (and perhaps other aspects of mission initialization) requires the existence of a timestamp snapshot, so make sure a snapshot has been taken before FRED creates a mission.  Follow-up to #5343.
2. Move `stars_post_level_init()` to `Editor::createNewMission()` in qtFRED to be consistent with FRED's `create_new_mission()`.

Fixes a crash when the user tries to add a skybox when FRED first launches.
2023-05-14 15:35:18 -04:00
BMagnuandFabian Woltermann b0b05b35fd MSAA (#5400)
* Add MS buffers

* Implement basic MSAA with commandline

* Move MSAA init to deferred pipeline

* Fix shadows when MSAA is enabled

* Implement resolve shader

* Cleanup basic resolve shader

* Implement front-first depth-aware MSAA resolve

* Fix background resolve

* Allow setting MSAA level

* Ensure good MSAA level

* Code Median shader for different sample counts

* Cleanup

* Add MSAA options toggle

* Add MSAA sample count pre-parsing

* Add GL scope

Co-authored-by: Fabian Woltermann <[email protected]>

* Typo
2023-05-14 08:14:51 +00:00
ETP 7beb28b4f6 added lab interface for selecting lighting profiles. 2023-05-13 21:12:59 -04:00
ETP a094eb00c8 Trim out some future feature code. 2023-05-13 21:12:59 -04:00
ETP 6ccde7b01d maybe appease CI 2023-05-13 21:12:58 -04:00
ETP 62b70e74ca Rebasing lighting profile switchery 2023-05-13 21:12:58 -04:00
EatThePath 89ffbb5a34 Merge pull request #5347 from EatThePath/ltp/profile-code-reorg
lighting profile code reorg
2023-05-13 21:11:58 -04:00
mjn-mixael 4c7e9f6585 On second thought, this should still be Name and not DisplayName 2023-05-12 16:38:07 -05:00
mjn-mixael 78b957982b enhance jump node handling 2023-05-12 15:30:41 -05:00
Goober5000 8aa5a22f5d Merge pull request #5399 from BMagnu/modularpof_parent_subsystem
Fix modular pof handling of dock / path parent names
2023-05-12 14:19:16 -04:00
BMagnu 26cfc8d017 Make check case insensitive 2023-05-13 01:52:40 +09:00
Goober5000 5ed0a9161c Merge pull request #5398 from Goober5000/update_dock_flags
update type_flags when dock name changes
2023-05-12 11:39:36 -04:00
Birk Magnussen 6f8c8e802a fix modular pof handling of dock / path parent names 2023-05-12 10:26:13 +02:00
Goober5000 712a70444b update type_flags when dock name changes
The `type_flags` on a model's dockpoints are determined by the dockpoint name.  If the name changes, the flags should be updated accordingly.

This fixes a bug in Scroll where a dockpoint that was imported and renamed to start with the word "cargo" was not compatible with cargo docking as expected.
2023-05-12 04:08:38 -04:00
Goober5000 eaf57bddf3 add ship:isPlayer()
Add Lua functions to check whether a ship or parse object is a player ship.
2023-05-12 00:35:29 -04:00
wookieejedi 29f82cb5d7 Fix two undocking bugs for small ships (#5396) 2023-05-11 17:06:42 -04:00
Goober5000 7846e593a0 Merge pull request #5394 from BMagnu/fix_anim_crash_dead_ship
Add additional checks for Animation List handling of nonexistent polymodel instances
2023-05-08 23:19:40 -04:00
Birk Magnussen ff3be1a4e3 Add additional checks for animation list handling of nonexistent polymodel instances 2023-05-06 13:42:21 +02:00
Goober5000 25348edff2 Merge pull request #5391 from Goober5000/tweak_int_parsing
make number parsing a little more forgiving
2023-05-05 14:38:04 -04:00
Goober5000 0bdcd3c2f4 Merge pull request #5393 from MjnMixael/lua_enum_index_fix
Lua Enum Hotfix
2023-05-05 14:37:54 -04:00
mjn-mixael 13a990a98f this needs to be converted from base 1 2023-05-05 10:14:48 -05:00
Asteroth 18ba984f3e fix for weapons with lots of inherited velocity (#5392) 2023-05-05 07:58:37 -04:00
Fabian Woltermann 488db515ce Merge pull request #5388 from BMagnu/fix_shader_hdr
Fix HDR conversions in main shader
2023-05-05 13:54:20 +02:00
Mike Nelson 3f8e3360f9 Some additional splash screen features (#5379)
* some additional splash screen features

* Do this based on actual milliseconds

* splash screen is skipped in standalone

* os_poll()
2023-05-04 14:24:10 -04:00
Goober5000 61579f746c make number parsing a little more forgiving
In retail, number parsing picked up immediately at the character after the number parsed, so parsing `0.50` as an int would yield 0, and then the next available characters would be `.50`.  Even though parsing has been tightened up and made stricter, we can still "fail gracefully" by simulating the old behavior.  And when failing gracefully, the message can be a warning.
2023-05-03 22:44:55 -04:00
Asteroth 02a40ae905 Remove model octants (#5373)
* remove model octants

* actually remove the struct

* comments

* remove scratch comment

* initialize
2023-05-01 23:54:43 -04:00
Goober5000 04a9de69ea Merge pull request #5375 from Goober5000/4562_redux
Modernise CFLAGS on Mac/Linux
2023-05-01 23:25:20 -04:00
Goober5000 1457bb0c7f Merge pull request #5386 from MjnMixael/no_unicode_font_error
Warn instead of error for bitmap fonts in unicode
2023-05-01 23:25:01 -04:00
Goober5000 275c7ffe66 Merge pull request #5389 from Goober5000/5381_followup
clear caches for both nodes in rand_sexp
2023-05-01 23:23:41 -04:00
Goober5000 e120bb90b6 clear caches for both nodes in rand_sexp
Since `rand_sexp` also writes text into the sexp node for the seed value, its cache should be cleared too.  And since this is a pretty common operation, wrap it in a `clear_cache` function.

Follow-up to #5381.
2023-05-01 16:36:58 -04:00
Goober5000 10ce1ac625 sync toolchain-apple-clang.cmake flags with the ones in toolchain-clang.cmake 2023-05-01 14:54:08 -04:00
Birk Magnussen baada08eca Fix shader 2023-05-01 20:00:59 +02:00
Goober5000 996a2002e6 Merge pull request #5377 from Goober5000/remove_old_fred_components
remove some obsolete FRED components
2023-04-30 20:48:50 -04:00
wookieejedi 5a1ac87802 Update recent particle optimizations to fix edge case slowdowns (#5385)
#5328 added a very useful culling for particles created by specific particle effects (ie weapons, now beams), though in an effort to simplify the culling process, that PR removed the necessary culling of default smoke on ships. This PR restores the culling of default smoke while also keeping the new culling of particle specific effects. Tested and works as expected, including fixing the slowdowns caused by the aforementioned removal of smoke effect culls.
2023-04-30 15:15:37 -04:00
mjn-mixael 9e5894512c warn instead of error 2023-04-30 10:57:15 -05:00
MageKing17 e5301b7595 Fix the rand SEXP's use of cached values. (#5381)
The `rand` SEXP stores the result of its first call in the "low" node. Prior to PR #2402, this worked fine, but after that, the value is cached when first evaluated, meaning that subsequent calls to the `rand` SEXP will always return the lowest value in the range, not whatever number was rolled the first time.

This commit makes it so that writing the rolled value to the node's `text` attribute is immediately followed by deleting the no-longer cached value, so that the SEXP continues to work as intended.
2023-04-30 11:31:32 -04:00
MageKing17 ae91e4af1b Actually handle a missing Fade_anim properly. (#5382)
When I made FSO not crash with demo data in PR #1156, I avoided calling `brief_maybe_blit_scene_cut()` if `Fade_anim` didn't load, when I should've made it do what the icculus port does in demo mode: pretend the animation finished immediately.

With this commit, the first mission of the demo correctly advances past the first briefing stage.
2023-04-29 17:13:37 -07:00
Fabian Woltermann b77902309a Merge pull request #5384 from The-E/fix/division_by_zero_when_rendering_glowpoints
fix crash in glowpoint rendering
2023-04-29 19:32:32 +02:00
Fabian Woltermann 09a1485a7b this makes sure we do not run into a division by zero under certain circumstances. Also skips glowpoint rendering if the glowpoint is currently invisible 2023-04-29 18:04:39 +02:00
Asteroth 63df812d79 Add beam particles (#5330)
* add beam particles

* tweaks

* more tweaks

* fix warning

* dumb c++

* fix switch

* spelling
2023-04-29 08:45:31 -04:00
Goober5000 4dc6fd417f Merge pull request #5374 from Goober5000/required_for_mission_fred
Add FRED support for the "required weapon" feature
2023-04-27 14:41:11 -04:00
Goober5000 f15c5188c3 remove some obsolete FRED components
- remove FolderDlg which hasn't been needed since we dropped support for Visual Studio 6
    (see version history of MFC, https://mariusbancila.ro/blog/2015/08/12/version-history-of-vc-mfc-and-atl/)
- remove dialog1 which isn't used
2023-04-27 14:37:01 -04:00
Asteroth b8dacdd898 afterburning hard ignores wings (#5376) 2023-04-27 02:51:41 -04:00
Goober5000 b97430e5a0 move from setjmp to try/catch 2023-04-26 19:36:16 -04:00
Goober5000 64c27d8186 fix unused variable warnings 2023-04-26 19:36:16 -04:00
Asteroth d43cf1018d ensure pmi for this lookup (#5372) 2023-04-25 22:27:41 -04:00
Goober5000 e7048f6940 make CI happy 2023-04-25 13:25:08 -04:00
Goober5000 ef1933ec1b Modernise CFLAGS on Mac/Linux
Per GCC optimisation guide, which applies equally well to clang:
* -funroll-loops should not be used unless directed by profiling. The compiler will already unroll loops when it's a good idea.
* clang and gcc now have -Og optimisation levels designed to enable debugging with good performance.

(second attempt at PR #4562)
2023-04-25 13:22:18 -04:00
Goober5000 2a74c93313 link with team loudout dialog 2023-04-25 12:51:23 -04:00
Goober5000 143c52d252 add checkboxlistdlg 2023-04-25 12:18:00 -04:00
Goober5000 53ba2e792a modify loadout dialog 2023-04-25 12:18:00 -04:00
Goober5000 06df0a8a4d Merge pull request #5332 from Goober5000/xmt_ssm
improve XMT handling of ssm.tbl
2023-04-25 00:14:04 -04:00
Taylor Richards 28747bb1b7 warn when a critical file might be be shadowed (#5350) 2023-04-24 02:19:30 -04:00
wookieejedi f2987aa749 Fix max Z speed when using ETS and engine damage tracking (#5368)
* Fix max Z speed when using ETS and engine damage tracking

Follow up for #5137 and #5292. This engine strength check thus needs to be added to all instances where `max_vel.xyz.z` is updated, so a function was created and added in respective locations. Fixes #5367.

* cleanup and adding validity assertations

* cleanup outdated comments

* might as well make the cleanup look nice

* update to account for more edge cases

* cleanup
2023-04-23 22:01:05 -04:00
Fabian Woltermann 938eacdee9 Merge pull request #5370 from The-E/fix/crash_when_logging_ai_submode
Fix crash when logging ai submode
2023-04-23 20:08:47 +02:00
Fabian Woltermann 898c0c1945 fix a crash when attempting to log the ai being in certain submodes 2023-04-23 19:19:44 +02:00
Fabian Woltermann 6234c97f4f fix invalid access when choosing builtin messages (#5369) 2023-04-23 17:19:23 +00:00
Fabian Woltermann 8dd4a05cd1 fix invalid access when choosing builtin messages 2023-04-23 18:52:15 +02:00
BMagnu 6e561761d1 Cleanup Variable Names for Volumetrics (#5362)
* Rename opacityDistance

* Add oversight
2023-04-23 08:16:12 -04:00
Goober5000 b3f237b8c1 Merge pull request #5366 from Goober5000/fred_rc_fixes
some FRED cleanup
2023-04-22 12:14:37 -04:00
Goober5000 587d5af8ca some FRED cleanup
1. Disambiguate dialog IDs for the music player and the volumetric nebula dialogs
2. Fix compilation of qtFRED
3. Small refactor of Personas access to use STL functions where appropriate
2023-04-21 23:16:51 -04:00
Goober5000 0cc28cf8fc Merge pull request #5348 from MjnMixael/sync_color_handling
Deprecate old versions in favor of versions that use color objects
2023-04-21 21:49:08 -04:00
Goober5000 5c9b309293 Merge pull request #5361 from Goober5000/fred_orient_qol
FRED object editor QOL improvements
2023-04-21 21:48:38 -04:00
Mike Nelson c19f05a9d9 organize and map additional keys (#5354) 2023-04-21 21:05:54 -04:00
BMagnu ab4d1fb779 Skip anim if type is unknown (#5363) 2023-04-22 02:28:27 +09:00
BMagnu 13e1f28c4a FRED Dialog for Volumetrics (#5351)
* Add volumetrics dialog skeleton

* Implement first fields in dialog

* Add dialog to main window

* Fix Spinners

* Add all non-noise inputs

* Add Noise Fields

* Fix errors

* Add Tooltips

* Fix fred menu

* Init dialog
2023-04-22 01:06:58 +09:00
Goober5000 bce1e7c2d9 Merge pull request #5360 from Goober5000/improve_spawn_collision
improve spawn collision checking
2023-04-21 09:40:47 -04:00
Goober5000 2f654c496c FRED object editor QOL improvements
1. When the "object" radio button is selected, the "point to" check box will also be selected
2. When an object is selected from the object list, the "object" radio button and "point to" check box will also be selected

Fixes #5356.
2023-04-20 23:58:18 -04:00
Goober5000 1feef8ff2a improve spawn collision checking
Take into account the collision flag and collision groups when spawning a ship.  Should fix #5357.

Also clean up the code a bit, including setting a few `int`s to `bool`s and adding a missing axis case.
2023-04-20 22:31:34 -04:00
Asteroth fa0878b6b3 Add an Ai goal flag to afterburn hard (#5338)
* add afterburn hard flag

* return some ab locked checks

* this one too

* more tweaks
2023-04-20 19:42:35 -04:00
wookieejedi 21d1ffd3bd Fixes CTD with New Particle Lifetime Curve (#5358)
Turns out Velocity Lifetime Curve was never initialized.
2023-04-20 14:39:46 -04:00
Goober5000 237fea6cbf Merge pull request #5355 from Goober5000/enhanced_sexp_warnings
enhance some SEXP warnings
2023-04-20 11:29:42 -04:00
mjn-mixael 95649dafa1 cleanup 2023-04-20 09:37:33 -05:00
EatThePath 427873a345 remove int3 from the rest of the batching things (#5349) 2023-04-20 07:43:29 -04:00
Asteroth 4a53ff742d Add debris density (#5340)
* add debris density

* doc new param
2023-04-20 02:48:19 -04:00
Goober5000 581c834353 Merge pull request #5337 from Goober5000/various_tweaks
Various tweaks and polishing
2023-04-19 22:20:53 -04:00
Goober5000 58f3e8fb06 Merge pull request #5345 from MjnMixael/finalize_scpui_api
Finalize scpui api
2023-04-19 22:20:06 -04:00
Goober5000 d7a2bba630 enhance some SEXP warnings
These messages add the context of the actual SEXPs causing the warnings to be displayed.  Motivated by Admiral Nelson's mod debugging work.
2023-04-19 22:15:21 -04:00
Goober5000 0d6791ff1d Merge pull request #5353 from Goober5000/joe_fixes
Joe fixes
2023-04-19 22:14:33 -04:00
Asteroth 9be559622e dont overwrite a disallowed depart order (#5352) 2023-04-19 17:30:09 -04:00
Asteroth 31b23d8c50 Whackable debris and asteroids (#5291)
* whackable debris and asteroids

* fixes

* review tweaks

* some more review tweaks
2023-04-19 10:56:46 -04:00
Asteroth 56f010a231 Add arbitrary curves support (#5323)
* Add arbitrary curves support

* review tweaks

* pretty sure i dont need this anymore
2023-04-19 08:13:06 -04:00
Goober5000 f0322a12f2 remove unused variable 2023-04-18 20:50:17 -04:00
Goober5000 f62e437dbd properly handle wingmen that are destroyed before mission 2023-04-18 19:50:32 -04:00
Goober5000 41e338e8ab Joe fix: if the Instructor is known to a mission, it should govern training messages 2023-04-18 19:49:29 -04:00
Goober5000 6ce1f5276a Joe fix: if a ship can't find a dock path, the game shouldn't crash 2023-04-18 19:46:36 -04:00
mjn-mixael 623f887495 documentation 2023-04-18 09:18:36 -05:00
mjn-mixael 3f6eae0836 Update methods to optionally accept and return color objects 2023-04-18 08:37:30 -05:00
Asteroth 0bffa82422 fix wep glowpoints (#5344) 2023-04-18 08:04:16 -04:00
Goober5000 d203d2915f Merge pull request #5343 from Goober5000/synchronized_timestamps_take_2
synchronize simulation timestamps across the entire frame
2023-04-17 19:15:32 -04:00
EatThePath 64af9e520c Merge pull request #5154 from EatThePath/opt/less-batching-find
Optimizing the trail renderer by avoiding repeated batch_find calls
2023-04-17 16:15:59 -05:00
ETP 77c7aee8f4 Moved the configurable profile adjustments into their own file 2023-04-17 14:58:14 -05:00
mjn-mixael eafab41823 unify language and capitolization 2023-04-17 14:50:38 -05:00
BMagnu bbb7599512 Add proper time wrapping for animations (#5339) 2023-04-18 04:40:04 +09:00
BMagnu 522e1aa360 Restrict player order accept ship (#5341) 2023-04-18 04:39:56 +09:00
ETP 57f9455f6c moving lighting profiles into a namespace and arranging it as cleanup for future changes 2023-04-17 14:36:41 -05:00
ETP a8035fec36 Applied formatting to lighting profiles files 2023-04-17 14:06:21 -05:00
Goober5000 9b337b714b take a new snapshot when time compression is updated 2023-04-17 12:10:56 -04:00
mjn-mixael f5a08bb694 change api description to finalize 2023-04-17 08:53:52 -05:00
mjn-mixael da7d9f28b9 global to param 2023-04-17 08:53:26 -05:00
Asteroth 4bbc9f3eb3 Improve particle culling and performance (#5328)
* better particle culling

* remove range on emitters

* explicit cast

* bit more efficient
2023-04-17 08:03:41 -04:00
Asteroth 7c4b9272d5 Randomize particle rotation (#5335)
* randomize particle rotation

* spelling

* initialize it, dummy
2023-04-17 07:37:38 -04:00
Goober5000 051d85d05c fix time compression with snapshotted timestamps
Because time compression adjusts the raw timestamp to be 0, it must use the exact value, not the snapshotted value, or the mission time will be slightly off.  So this commit fixes that problem, as well as making sure that changes in time compression always occur at the start of a frame.
2023-04-16 22:19:57 -04:00
Goober5000 b487969e5f use constant 2023-04-16 14:27:59 -04:00
ngld 86a81bfb9c Merge pull request #5342 from ngld/pr/fix-nightly-upload 2023-04-16 19:39:15 +02:00
ngld d7c22b126c Mark the nightly upload step as succesful as long as at least one mirror got the file 2023-04-16 19:00:32 +02:00
Mike Nelson 108def6224 Scpui Hud Config API (#5302)
* initial API for hud config elements

* get rendering, highlighting, and selecting working

* Add a way to create color objects

* some cleanup and fixes

* go away we dont need you

* allow arbitrarily scaling the hud config draw

* last few config options and innitial preset handling

* vectorize hud presets and setup handling

* some last minute fixes

* iiiiiiiiiiiiiiiiiiiiiiint

* really

* documentation and address feedback

* completely revert this as well

* more documentation

* document all the things

* comment out unused parameter

* peach emoji retentive

* whatever

* return types

* color
2023-04-16 08:13:06 -04:00
BMagnu ff296f8f98 Add a Translation Moveable (#5313)
* Add Translation Moveable

* Update SEXP docs

* Update some strings
2023-04-16 20:56:44 +09:00
Goober5000 4106414858 timestamps need to be synced in FRED too 2023-04-15 22:36:22 -04:00
Goober5000 9c5b4dfb49 synchronize simulation timestamps across the entire frame
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function.  Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame.  It is desirable to keep them all in sync.

This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame.  This only affects simulation timestamps; real-time timestamps still use the live timer.
2023-04-15 22:17:23 -04:00
Goober5000 1083f34ffc Merge pull request #5336 from Goober5000/rank_adjustment
tweak rank handling in Lua
2023-04-15 22:04:38 -04:00
Mike Nelson 3c30257816 Modular messages table (#5285)
* modular messages table

* clarify warning
2023-04-16 08:40:25 +09:00
BMagnu 023a7d3e68 "On Frame but actually Wait before you continue"-Executor (#5314)
* add 'syncronized async run'

* cleanup

* cleanup 2

* Properly free the screen

* Incorporate feedback
2023-04-16 08:39:49 +09:00
BMagnu f32b575f0c Allow 0-Asteroid setups (#5329)
* Allow 0-Asteroid setups

* Make mission brief error non fatal
2023-04-16 08:39:04 +09:00
Asteroth 1525f829b7 Flush empty cbrief voice filenames to "None" (#5333)
* make clearing cbrief voice easier

* qtfred too

* ani_filename too
2023-04-15 15:06:37 -04:00
Goober5000 a932dc94c0 Merge pull request #5307 from MjnMixael/explicit_no_wrap
Explicitely do not split lines when making the message log
2023-04-15 14:59:09 -04:00
Goober5000 55a92a32de a bit of encapsulation 2023-04-15 14:23:05 -04:00
Goober5000 0c8a6c6f97 small streamlining 2023-04-15 14:23:05 -04:00
Goober5000 5e3f8e4792 Merge pull request #5334 from Goober5000/check_whitespace_comma
check for whitespace between token and comma
2023-04-15 14:19:37 -04:00
Goober5000 7018a560b9 streamline type conversion 2023-04-15 00:06:33 -04:00
Goober5000 bcc964d0fa color tweaks 2023-04-15 00:06:33 -04:00
Goober5000 8fbe2c244a address feedback 2023-04-14 20:34:19 -04:00
Goober5000 c6a2dcdfa9 tweak rank handling in Lua
Follow-up to #5280:

1. Make the Rank virtvar actually return a rank object, to be consistent with other Lua API methods
2. Add a RankIndex virtvar to replicate the previous functionality
3. Make RankIndex return the expected 1-based index for Lua

This is a breaking change to the API, but since the original API is less than a month old, the impact should be small.
2023-04-14 19:17:46 -04:00
Goober5000 d28db605a9 avoid repeated commas 2023-04-14 11:51:03 -04:00
Goober5000 67428f506c grayspace makes more sense here 2023-04-14 10:56:11 -04:00
Goober5000 0ff15cfe16 check for whitespace between token and comma
When parsing a list of numbers, such as in the $uvec or $fvec of models, a bug was reported where whitespace before the comma caused the number parsing to fail.  This change checks for a comma after whitespace instead of checking for a comma as the very next character.
2023-04-14 02:51:01 -04:00
Goober5000 4ee4f51ee2 improve XMT handling of ssm.tbl
Extensible modular table handling for -ssm.tbm files was not very robust due to quite a few assumptions left over from straight .tbl parsing.  Ostensibly optional fields were required, non-overridden fields were reset to defaults, etc.  This improves XMT parsing and adds sensible defaults for SSM fields.
2023-04-14 01:12:09 -04:00
Goober5000 4da52ca23b Merge pull request #5325 from Goober5000/hotkey_followup
convert hotkey types to enum
2023-04-14 01:07:44 -04:00
Fabian Woltermann 1d52bc5876 make sure deferred_global_data follows the alignment rules (#5331) 2023-04-13 20:45:56 +00:00
Asteroth 689dca1f3f bugfix accidental swap (#5324) 2023-04-12 14:55:04 -04:00
Goober5000 bb53f7ee68 type safety revealed something 2023-04-12 10:55:38 -04:00
Goober5000 78d9562661 feedback and fix 2023-04-12 10:55:38 -04:00
Goober5000 b7d1270439 convert hotkey types to enum
Here's a suggested followup to #5249.  This converts the hotkey type to an enum for improved type safety.  It also adds the corresponding Lua enums and adjusts the Type virtvar to return them.
2023-04-12 10:55:36 -04:00
Goober5000 257ba70d70 Merge pull request #5326 from Goober5000/validity_checks
add validity checks
2023-04-12 10:52:39 -04:00
Goober5000 10e5875289 add validity checks
Many of the recent scripting API enhancements are missing validity functions and validity checks, so this adds them.  There are also some documentation fixes and a >= vs. > bugfix.
2023-04-12 00:14:20 -04:00
BMagnu 64de96f6ce Fix Subsystem serialization (#5319) 2023-04-12 00:31:54 +09:00
Asteroth ac9636733f ets fixes (#5317) 2023-04-11 06:31:04 +09:00
Asteroth a2df152323 Add fov values to .pof models (#5244)
* add model fov values

* initialize proper defaults

* set defaults directly
2023-04-11 06:30:17 +09:00
Goober5000 fbca88d36d add per-species warp effects
This allows warp parameters to be specified in species_defs.tbl, rather than requiring them to be specified for each ship in ships.tbl.  Since this introduces a cyclic dependency between species_defs.tbl and sounds.tbl, the parsing of sounds.tbl is broken into two stages.

Implements request from #5283.
2023-04-10 17:24:38 -04:00
Mike Nelson e01a5359ac Scpui API for Control Config (#5305)
* read access to controls

* Early draft of checking keypresses in scpui

* detangle some code and prepare it for API usage

* API access to the core methods required

* move these checks into the UI methods

* comment

* fix bugs

* be smarter

* Need this stuff, too

* some more presets work

* unify func naming scheme

* cleanup and clarifications

* get detect keypress working

* allow searching and creating new presets based on current controls

* address feedback

* return nil if no preset is matched

* use the builtin methods which do the same thing, but slightly cleaner

* typo
2023-04-07 12:02:13 -04:00
BMagnu e2b205ffaa Modular POF Features 2 (#5209)
* Add weapon bank copy

* Add Path / Dock point copying

* cleanup

* Fix dock points

* Fix copy paste error

* Incorporate feedback

* Incorporate feedback 2

* delete copy assignment
2023-04-07 08:12:20 +09:00
Goober5000 1388866ddd Merge pull request #5315 from Goober5000/fix_qtfred_compilation
fix qtfred compilation
2023-04-06 11:04:31 -04:00
Goober5000 7e9e8bcb62 additional fixes 2023-04-05 21:14:45 -04:00
Goober5000 deded57112 fix qtfred compilation
Fix various compilation warnings and errors.
2023-04-05 20:56:53 -04:00
BMagnu 599a1893c3 Add +Use Ship as Template (#5311)
* Implement +Use Ship as Template

* Update Warning Message
2023-04-06 07:10:30 +09:00
Goober5000 dbff592f94 Merge pull request #5312 from Goober5000/chase_view_toggle
make 'player starts in chase view' a toggle
2023-04-05 13:00:23 -04:00
Goober5000 9c00070154 revert view on escape 2023-04-05 00:04:58 -04:00
Asteroth 203b738f79 Add $CockpitLaunchSnd (#5300)
* add cockpit launch snd

* whoops

* another whoopsie
2023-04-04 23:40:15 -04:00
Goober5000 b016163bf3 make 'player starts in chase view' a toggle
Per request of #5226.  This PR also makes the variable names more consistent.
2023-04-04 23:34:03 -04:00
Fabian Woltermann 884d47611f Merge pull request #5310 from The-E/fix/5309_div_by_zero_in_glowpoint_rendering
fix rare division-by-zero caused by unchecked data
2023-04-03 18:56:30 +02:00
Fabian Woltermann a786e2d541 fix rare division-by-zero caused by unchecked data 2023-04-03 18:16:44 +02:00
Goober5000 dc2370393e Merge pull request #5251 from Goober5000/move_self_destruct_log
move self-destruct mission logging to ship_hit_kill
2023-04-03 10:28:50 -04:00
Mike Nelson 0dd4daf2eb modular traitor + cleanup (#5188) 2023-04-03 14:12:57 +02:00
naomimyselfandi 949141c611 Message filter follow up (#5304)
* Fix intra-persona message borrowing logic

Closes #5299.

* Always assign personae for Support

Disabling the Auto_assign_personas flag had the side-effect of prohibiting support ships from ever speaking. Since a mod that wants this behavior (for whatever reason) can just not have a support persona, this commit makes an exception for them.

* Make Protect Target and Cover Me adaptive like Engage Enemy is

* Respect the allow subsitution flag
2023-04-03 08:11:46 -04:00
Fabian Woltermann 14689265ce Merge pull request #5308 from TRBlount/fix/vulkan_build
Prevent build error when Vulkan SDK isn't installed
2023-04-03 09:23:53 +02:00
Tyler Blount 837ac8d08e Also force if the option is set, but Vulkan could not be found 2023-04-02 19:56:50 -07:00
Tyler Blount 6cac2af8e4 Default to OFF for FSO_BUILD_WITH_VULKAN 2023-04-02 18:47:41 -07:00
mjn-mixael 80004f2996 explicitely do not split lines 2023-04-02 19:43:53 -05:00
Asteroth e3cd5c819f removal of current_max_speed (#5292) 2023-04-01 16:13:08 -04:00
Asteroth 39273db918 $beaminfo implies beam flag (#5297) 2023-04-01 16:12:32 -04:00
Asteroth cd36ce336f small fix for type5 fighter beams (#5298) 2023-04-01 16:11:54 -04:00
Goober5000 dcdade36a3 Merge pull request #5293 from Goober5000/5290_followup
additional constraint on Command arrival messages
2023-03-30 22:05:52 -04:00
naomimyselfandi cbbd197cd3 Add "no-first-wave-message" wing flag (#5288)
* Add "no-first-wave-message" wing flag

For when you want custom dialogue for the first wave, and automatic announcements for the rest.

* Fix FRED macro name
2023-03-30 21:17:03 -04:00
Goober5000 5d4cd31a79 fix IFF logic for teams that attack themselves (#5294)
If a team explicitly attacks itself, then the same-team checks should not apply.  Fixes a bug reported by SilverAngelX on Discord.
2023-03-30 21:16:45 -04:00
Asteroth 835285248e No overlapping turret sounds (#5295)
* prevent overlapping turret sounds

* whitespace

* fixes
2023-03-30 21:16:32 -04:00
Goober5000 682cffa610 additional constraint on Command arrival messages
Command should not be considered if the mission explicitly prevents Command from sending builtin messages.

Follow-up to #5290.
2023-03-29 00:31:03 -04:00
EatThePath 4753d0f761 Merge pull request #5290 from naomimyselfandi/configurable-command-arrival-message-chance
Dehardcode Command arrival message chance
2023-03-28 22:41:49 -05:00
Mike Nelson 85bcfd56e8 force expand wings instead of toggle for scpui (#5286) 2023-03-28 07:40:03 -04:00
Mike Nelson af88697348 Parse and save asteroids by name (#5134)
* parse and save asteroids by name

* typo

* update version
2023-03-28 07:38:14 -04:00
ETP 633f138afe Remove Int3() from new versions of batching_add_ for modernization 2023-03-27 23:46:54 -05:00
David Gibson d7ebb8f062 Optimizing the trail renderer building code path moderately by avoiding repeated batch_find calls 2023-03-27 23:01:05 -05:00
BMagnu 272d6261c4 Generic Lua Multiplayer RPC (#4835)
* Add automatic lua obj serialization function dispatch

* Implement fundamental and object de/serialization

* Proper default case for package deserialization

* Add No Multi func

* Add Serialization part

* Fix max encoding size for userdata

* Implement exception handling

* Start Implementing lua RPC

* Prepare waitAsync for RPC

* Add packet order enforcing and forwarding

* Add RPC registry

* Make RPCs callable

* Add waitRPC

* Add serializers

* Fix GCC error

* Explicitly specify lua_net_exception

* Fix Warnings

* Replace Seriliaze fundamental with cross-platform data types

* Appease Clang

* Prevent serialization CTD on invalid objects

* Actually use the temporaries assigned

* Fix OSWPT shadow

* Fix table deserialize order

* Incorporate Feedback

* Fix Warnigs

* ix WArnings 2

* Add sanity checks for OSWPT wing serialization

* Multi Bump

* Forgot we have american-style dates there
2023-03-28 03:07:03 +09:00
wookieejedi 2a492e00c2 Revert "synchronize simulation timestamps across the entire frame" (#5287)
* Revert "synchronize simulation timestamps across the entire frame"

* try a proper fix instead of revert

* make sure nothing is reverted

* and back to full revert
2023-03-27 09:59:23 -04:00
Fabian Woltermann c816a65c63 Merge pull request #5289 from EatThePath/restore-envmap-hotkey-export
restored the keyboard hotkey for envmap export.
2023-03-26 21:48:44 +02:00
Mike Nelson 8d762d3fbe fredTunes, Fredify, Fred Music, or whatever. It's a music player. (#5101)
* initial semi-working version

* better implementation of play and add stop and music.tbl viewer

* let the music window lose focus

* some cleanup

* add autoplay, next, previous

* use graphics

* Better dialog layout and allow ignoring files from the player list

* Make betterer

* a touch more cleanup

* revert this change

* missing bracket from merge conflict resolution

* address feedback
2023-03-25 13:52:11 -04:00
Naomi Coffman fec9603a09 Fix brainfart 2023-03-25 13:51:17 -04:00
Naomi Coffman 78cb768546 Dehardcode Command arrival message chance
Historically, there's been a hardcoded 25% chance for Command to announce an enemy wing arrival. This is problematic for mods without Command, like BTA.
2023-03-25 13:27:16 -04:00
David Gibson de057e421e restored the keyboard hotkey for envmap export. 2023-03-25 11:57:41 -05:00
Fabian Woltermann 9308318199 Merge pull request #5253 from naomimyselfandi/more-flexible-dynamic-messages
More flexible dynamic messages
2023-03-24 10:50:39 +01:00
Fabian Woltermann 17b34508e9 Merge pull request #5280 from MjnMixael/medals_access
Scpui API for medals access
2023-03-24 10:49:45 +01:00
Fabian Woltermann bcf0ab1957 Merge pull request #5256 from MjnMixael/texture_filtering_option
Expose texture filtering as a built-in option
2023-03-24 10:48:44 +01:00
Fabian Woltermann 18a679052b Merge pull request #5282 from qazwsxal/fix/gamma_stopgap
FIX: Incorrect gamma calculations in shaders.
2023-03-23 22:05:19 +01:00
Adam Leach d516ab3c23 Stopgap patch to make envmaps work again. 2023-03-23 19:33:41 +00:00
mjn-mixael dceea0d7a5 don't need this 2023-03-23 13:17:51 -05:00
mjn-mixael 1fdf8b1756 access to array sizes 2023-03-23 12:52:11 -05:00
mjn-mixael d76c733d66 nothing to see here 2023-03-23 12:23:03 -05:00
mjn-mixael c92d383b69 scpui api for medals access 2023-03-23 11:19:46 -05:00
Fabian Woltermann 7c6e27e83d Merge pull request #5279 from Baezon/clip-planes
Add clip planes to game_settings.tbl
2023-03-23 14:12:40 +01:00
Fabian Woltermann f2eca9ca3f Merge pull request #5249 from MjnMixael/scpui_hotkeys
Scpui hotkeys
2023-03-23 14:11:13 +01:00
Asteroth 31e891df0d rename and betterchecking 2023-03-23 05:04:02 -04:00
Fabian Woltermann 98f1777040 Merge pull request #5252 from MjnMixael/capitalize_icon_names
these should be capitalized
2023-03-23 10:01:15 +01:00
Asteroth af41dbae37 add clip planes to game_settings 2023-03-22 19:48:05 -04:00
mjn-mixael 242c7184b8 Merge branch 'master' into scpui_hotkeys
# Conflicts:
#	code/scripting/api/libs/ui.cpp
2023-03-22 09:14:21 -05:00
Fabian Woltermann 2f28dc2f1e Merge pull request #5239 from MjnMixael/scpui_game_help
SCPUI methods for the Game Help UI
2023-03-22 15:11:11 +01:00
mjn-mixael 88166d58bc Merge branch 'master' into scpui_hotkeys
# Conflicts:
#	code/scripting/api/libs/ui.cpp
#	code/source_groups.cmake
2023-03-22 08:33:11 -05:00
mjn-mixael 51c55550f0 Merge branch 'master' into scpui_game_help
# Conflicts:
#	code/scripting/api/libs/ui.cpp
2023-03-22 08:25:33 -05:00
BMagnu 9caa9c4c7c Expose some Nebula settings to Lua (#5268)
* Add more nebula options

* rename vars due to windows api defines
2023-03-22 12:42:18 +01:00
Mike Nelson fbf0db09a7 Scpui Mission Log (#5242)
* SCPUI access to scrollback items (mission event log and message log)

* copy paste error

* check the objective flags instead of the action flags now

* rename actions -> segments
2023-03-21 20:03:35 -04:00
Asteroth 6afb160ebd add some parameters for corkscrew start angle (#5275) 2023-03-21 20:03:20 -04:00
Naomi Coffman 6752a7f196 Fix bad merge 2023-03-20 11:30:05 -04:00
Naomi Coffman 2cb9b94f61 Merge branch 'master' into more-flexible-dynamic-messages 2023-03-20 11:07:36 -04:00
Goober5000 6f7c949e16 Merge pull request #5267 from Goober5000/event_timestamp_check_fix
fix an edge case in is-event-true-delay and related sexps
2023-03-20 11:04:32 -04:00
Goober5000 5b411f4041 Merge pull request #5266 from Goober5000/timestamp_snapshot
synchronize simulation timestamps across the entire frame
2023-03-20 11:04:14 -04:00
Naomi Coffman 91acdfbc23 Ensure variable is initialized 2023-03-20 10:58:46 -04:00
Mike Nelson 29ea809790 toggle auto-assigning personas (#5125) 2023-03-19 21:50:26 -04:00
Goober5000 7540c79993 add comment 2023-03-19 00:01:20 -04:00
Goober5000 eed50619ca fix an edge case in is-event-true-delay and related sexps
Originally the check for event delay was this:
```
if ( (fix) Mission_events[i].timestamp + delay >= Missiontime )
    return SEXP_FALSE;
```
This returns false even when the mission time is equal to the timestamp.  Therefore the timestamp check needs to use >, not >=.

Thanks to Durandal and ShivanSpS for helping to track this down.
2023-03-17 15:00:06 -04:00
Goober5000 685f641696 synchronize simulation timestamps across the entire frame
Prior to the timer upgrade, all simulation timestamps shared identical timer and timestamp values for the duration of the frame, since they were only updated within the `game_set_frametime` function.  Since the timer upgrade depends on the system clock, timestamps evaluated near the end of the frame will be very slightly later than timestamps evaluated near the beginning of the frame.  It is desirable to keep them all in sync.

This PR tweaks the timestamp system to take a snapshot at the beginning of the frame, then use that snapshot for the entire duration of the frame.  This only affects simulation timestamps; real-time timestamps still use the live timer.
2023-03-17 14:14:55 -04:00
Asteroth 32cfb59a9e fix a bug in mission log with subsys names (#5261) 2023-03-16 22:43:15 -04:00
Goober5000 75a14625cf Merge pull request #3392 from the-maddin/qt-campaign-editor
QtFRED campaign editor
2023-03-15 15:15:48 -04:00
Goober5000 56869f10a5 Merge pull request #5259 from MjnMixael/qtfred_warning_fix
Use qtfred style warning instead of fred style
2023-03-15 15:15:22 -04:00
Goober5000 482d4a19a8 Merge branch 'master' into qtfred_warning_fix 2023-03-15 14:18:11 -04:00
Goober5000 2baf97b07a Merge pull request #5257 from DMJC/master
Fixes for Missionsave.cpp and BriefingEditorDialog.ui
2023-03-15 14:13:33 -04:00
mjn-mixael 27d9e412cb use qtfred style warning instead of fred 2023-03-15 08:02:32 -05:00
James Carthew 6e51c7cc05 Fixed missionsave.cpp - removed deprecated MB_OK MessageBox command. 2023-03-15 22:16:05 +10:30
James Carthew 638745cb16 Fixed compilation error in BriefingEditorDialog.ui 2023-03-15 22:15:01 +10:30
mjn-mixael 900abcf680 expose texture filtering as a built-in option 2023-03-14 11:00:55 -05:00
Mike Nelson b74937d74f always test goober-suggested code for errors (#5254) 2023-03-13 16:38:55 -04:00
Naomi Coffman 2c42f425dc Remove some hardcoded send chances
I missed these earlier. Oh well. They're gone now.
2023-03-11 20:51:32 -05:00
Naomi Coffman fd82ff70f1 Merge all friendly arrival messages into one type 2023-03-11 19:14:14 -05:00
Naomi Coffman 1b5b902bdd Remove unused parameters
These were always 0, and now they're gone.
2023-03-11 18:11:56 -05:00
Naomi Coffman 730eddc73a Localize message type parsing 2023-03-11 17:57:03 -05:00
Naomi Coffman 39b24a5789 Add subject filters to most messages 2023-03-11 17:39:49 -05:00
Naomi Coffman 43bd4d95fa Support sender filters 2023-03-11 17:39:49 -05:00
Naomi Coffman 7a5c145436 Parse message filters
They're not used yet, but they do get parsed.
2023-03-11 11:39:06 -05:00
Naomi Coffman 95f5839b5f Disenlongate method names 2023-03-11 11:39:06 -05:00
Naomi Coffman 8d1171ae88 Add message types for every standard player order
This commit also changes a couple confusing message type names.
2023-03-11 11:39:06 -05:00
Naomi Coffman 11987590af Overhaul builtin message matching logic
The logic used to select builtin messages was complex and hard to follow. This commit replaces it with logic that, while not identical, is both similar and more flexible. Additionally, the old logic had a major limitation when it came to downgrading messages: If a message type was defined for *any* persona, then it couldn't be downgraded for *any* persona. The new logic removes this limitation, and makes downgrade paths easier to define as well.
2023-03-11 09:34:01 -05:00
Naomi Coffman 629857adfb Always use the tabled occurrence chance
Some message types had hard-coded occurrence chances. These have been removed, and the default occurrence chance for the corresponding type modified to compensate.
2023-03-11 09:33:55 -05:00
Naomi Coffman 29c644c10c Store message priority and timing with the type 2023-03-11 08:27:46 -05:00
mjn-mixael 2bb705eca0 these should be capitalized 2023-03-10 10:39:46 -06:00
Mike Nelson b1033732f1 fixup error checking in regards to sexps using dynamic parameters (#5245)
* fixup error checking in regards to sexps using dynamic parameters

* anal retentive

* add more nonsense to make other nonsense work

* check these better

* dammit github

This reverts commit 542707c1c2.

* do this again but not in GitHub

* more nonsense to handle nonsense

* Revert "more nonsense to handle nonsense"

This reverts commit 6bc8b6e775.

* this is the song that never ends
2023-03-10 03:05:53 -05:00
Goober5000 39d5fc36f7 Merge pull request #5250 from Goober5000/tweak_techroom_modelnum
fix Techroom_modelnum references
2023-03-10 00:06:53 -05:00
Goober5000 ede86efa99 move self-destruct mission logging to ship_hit_kill
This moves `LOG_SELF_DESTRUCTED` to the same place that `LOG_SHIP_DESTROYED` is recorded.  This allows self-destruction to be correctly recorded when a ship is self-destructed via script, as well as when it is auto-repaired with a negative hull multiplier, or when ships are killed off in in-game joining.
2023-03-09 23:47:19 -05:00
Goober5000 8b63f9528d fix Techroom_modelnum references
These should be >=, not >
2023-03-09 22:19:35 -05:00
mjn-mixael 08471e8749 cleanup includes 2023-03-09 16:41:18 -06:00
mjn-mixael 465190b154 fix some issues based on testing 2023-03-09 16:38:31 -06:00
mjn-mixael 3c498e65ec get hotkeys by line 2023-03-09 15:56:30 -06:00
mjn-mixael aa91e93aa6 copy/paste 2023-03-09 14:36:27 -06:00
mjn-mixael 3e24e21e4d add a dumb 2023-03-09 10:25:36 -06:00
mjn-mixael 6d142428c3 remove a dumb 2023-03-09 10:14:04 -06:00
mjn-mixael 92f140c080 add functions 2023-03-09 10:03:37 -06:00
mjn-mixael 03555ebce4 some cleanup and prep 2023-03-09 09:56:39 -06:00
Goober5000 0d3922d483 Merge pull request #5247 from Goober5000/fix_submodel_iteration
fix submodel sanity check
2023-03-08 19:51:37 -05:00
Goober5000 0f88965aed fix submodel sanity check
If a submodel doesn't have a parent, set `parent_sm` to nullptr instead of a random value.
2023-03-08 19:09:29 -05:00
Goober5000 a65813b292 Merge pull request #5234 from Goober5000/new_hud_gauges
add missing HUD gauges
2023-03-08 15:30:50 -05:00
Goober5000 8236a87d25 Merge pull request #5243 from Goober5000/add_ship_flags
add some ship flags to the alter-ship-flag lists
2023-03-08 15:29:55 -05:00
mjn-mixael e105b57a26 read access to mission hotkeys for scpui 2023-03-08 14:23:33 -06:00
Asteroth 482034a383 Adjust movement sanity checks to account for more situations (#5240)
* adjust movement sanity checks

* traverse through children

* use `model_iterate_submodel_tree`
2023-03-08 15:18:57 -05:00
Goober5000 5e255dd8d1 add some ship flags to the alter-ship-flag lists
A few ship flags were missing from these lists.
2023-03-07 22:40:21 -05:00
mjn-mixael 55a89dc13d clarify documentation 2023-03-07 13:27:00 -06:00
Fabian Woltermann 7205808e76 Merge pull request #5149 from MjnMixael/refactor_scrollback_msg
Refactor Msg_scrollback_lines
2023-03-07 18:11:06 +01:00
Goober5000 0b2c356fe8 Merge pull request #5241 from MjnMixael/fix_subsy_node_check
Check the op const, not the op dummy
2023-03-07 10:37:08 -05:00
JohnAFernandez 199fca289c Merge pull request #5223 from Baezon/shudder-multipliers
Add shudder multipliers
2023-03-07 10:29:12 -05:00
mjn-mixael c1260fc533 Check the op const, not the op dummy 2023-03-07 08:10:50 -06:00
niffiwan f9c9474b0c Merge pull request #5235 from niffiwan/fix/chucked-asteroids-speed
use large asteroids speed when chucking asteroids
2023-03-07 20:41:04 +10:00
niffiwan 625a77bdb1 Merge pull request #5238 from Baezon/remove-vestigal-attach-thrusters
Remove `Attach_thrusters` submodel flag
2023-03-07 20:40:29 +10:00
mjn-mixael 1d9fa9719c some cleanup 2023-03-06 18:26:19 -06:00
mjn-mixael bc2218a87b use a table 2023-03-06 18:22:33 -06:00
mjn-mixael b2e56dc408 Initial setup of lua access to help sections 2023-03-06 17:33:09 -06:00
mjn-mixael 8cd8e9b0ff address feedback 2023-03-06 09:45:55 -06:00
Fabian Woltermann 2392a6cc7d Merge pull request #5231 from BMagnu/volumetric_nebulae
Localized Volumetric Nebulae
2023-03-06 16:38:14 +01:00
Fabian Woltermann c8fd2af450 Merge pull request #5090 from MjnMixael/scpui_closeup_icons
SCPUI methods required for handling closeup briefing icon stuff
2023-03-06 16:36:44 +01:00
Mike Nelson 46d1386690 Enhance Dynamic SEXPs with parent parameters (#5033)
* Add ability for a Lua sexp parameter to require a 'parent' parameter

* Add dockpoint as a return type

* variable conflicts

* var name

* qtfred

* address feedback
2023-03-06 22:27:06 +09:00
BMagnu 7b288deb62 Add missing return statements 2023-03-06 14:26:29 +01:00
BMagnu 5be591a345 Separate parsing from initialization and remove RAII 2023-03-06 14:16:03 +01:00
niffiwan 5cc0404efc use input asteroids speed
In case anyone wants to change the type of asteroids chucked at ships in
future
2023-03-06 21:48:03 +10:00
Asteroth ece792d35b remove vestigal flag 2023-03-06 02:17:52 -05:00
BMagnu 7893f0e3c5 Remove superfluous comment 2023-03-06 00:15:59 +09:00
BMagnuandFabian Woltermann c2a61c7d86 Update volumetric fog uniform buffer
Co-authored-by: Fabian Woltermann <[email protected]>
2023-03-06 00:14:58 +09:00
Fabian Woltermann a918212fe6 Merge pull request #5237 from BMagnu/opengl_debug_access
Add new OpenGL Debug Mode to cmake
2023-03-05 15:42:15 +01:00
Birk Magnussen e561b9e915 Add new OpenGL Debug Mode to cmake 2023-03-05 14:56:53 +01:00
Fabian Woltermann 9d41b1bb1e Merge pull request #5236 from qazwsxal/gr_debug_groups
Enable debug scope on release builds
2023-03-05 14:21:17 +01:00
Birk Magnussen b3502ba413 Add GR debug scopes 2023-03-05 13:13:51 +01:00
Birk Magnussen 3917890981 Don't render volumetrics when fog is disabled 2023-03-05 13:03:01 +01:00
Adam Leach a150dc8255 Enable debug scope on release builds 2023-03-05 11:33:45 +00:00
niffiwan aa4c3840f4 use large asteroids speed when chucking asteroids
Chucked asteroids are always large. Therefore use their speed, not the
speed of the 1st parsed/small asteroid. Should not affect retail because
it uses the same speed for all three asteroids
2023-03-05 21:14:02 +10:00
niffiwan 65f96cbf42 Merge pull request #5233 from Baezon/fix-thruster-flicker
Small fix for thruster flicker
2023-03-05 21:06:30 +10:00
Mike Nelson e664849346 Use subsystem names instead of model names (#5217)
* use subsystem names instead of model names

* address feedback
2023-03-05 19:02:35 +09:00
Mike Nelson c7a5f87b1b Document options files (#5177)
* Some documentation

* top level descriptions
2023-03-05 19:01:45 +09:00
Goober5000 b265124459 add missing HUD gauges
Looks like the last time this list was updated was in commit 2cded90031, and other gauges have been added since then.  So let's update the list.
2023-03-05 01:36:09 -05:00
Asteroth 89f10a5495 small fix for thruster flicker 2023-03-05 00:55:14 -05:00
Birk Magnussen 2f4bea8b21 Fix claaaaang 2023-03-05 00:41:44 +01:00
Birk Magnussen 473f907a40 Fix more warnings 2023-03-05 00:28:34 +01:00
Birk Magnussen 8af5d4cf93 Tidy up more after lib 2023-03-05 00:06:06 +01:00
Birk Magnussen 58fd88a113 Tidy up after lib's warnings 2023-03-05 00:00:05 +01:00
Birk Magnussen b50456c244 Fix GCC Warns 2 2023-03-04 23:57:00 +01:00
Birk Magnussen 97fde4d149 Fix GCC Warns 2023-03-04 23:48:06 +01:00
Birk Magnussen 5b06f84771 Correct depth for FoV abberation 2023-03-04 23:24:34 +01:00
Birk Magnussen e194e84c27 Add FRED round trip support 2023-03-04 22:30:29 +01:00
Goober5000 e103eaeb45 add some XSTR entries (#5229)
Add XSTR entries for "or", "None", and "Nothing".

Note that there is already an XSTR entry for "none", but it does not have the right capitalization.

Note that "None" is localized in `textify_scancode` but not `textify_scancode_universal`.

This makes "Nothing" cargo use appropriate localization.

Fixes #5227.
2023-03-04 08:57:29 -06:00
Goober5000 8153e32351 Merge pull request #5224 from Baezon/ai-movement-flags
Update some movement flags to work for AI too
2023-03-03 23:29:20 -05:00
Goober5000 fd66eb7550 Merge pull request #5230 from Baezon/fix-damage-scaling-bug
Fix damage scaling oversight
2023-03-03 23:29:01 -05:00
Asteroth 02805be745 fix damage scaling oversight 2023-03-03 21:32:07 -05:00
Goober5000 f8f61e8b62 Merge pull request #5104 from Goober5000/persona_species
Persona species enhancements
2023-03-03 18:25:53 -05:00
BMagnu cfba7ec067 optimize Shader performance 2023-03-03 09:10:14 +01:00
Birk Magnussen 5e285e42bc Set proper texture address mide 2023-03-02 21:17:56 +01:00
Birk Magnussen 975b31dc91 Fix nebula alpha 2023-03-02 21:04:41 +01:00
MjnMixael 7a24e0e4c6 Refactor gameplay help (#5119)
* refactor gameplay help

* OCD

* some read better than others

* typo
2023-03-02 22:10:08 +09:00
MjnMixael 259828316d Use weapon tech model if no anim (#5075)
* initial working version

* cleanup and generalize variable names
2023-03-02 22:09:13 +09:00
BMagnu 3a3d2c4438 Tidy up shader code 2023-03-02 13:54:11 +01:00
BMagnu 4af5bf405f Make volumetrics obey nebula quality settings 2023-03-02 13:38:53 +01:00
BMagnu 7827cb4835 Add Noise intnsity lab integration 2023-03-02 13:01:10 +01:00
BMagnu db8292be03 Add noise color intensity 2023-03-02 12:54:00 +01:00
BMagnu 1b1a8983ee Properly check for uploaded textures 2023-03-02 12:39:14 +01:00
BMagnu 5e9dd9aef5 Calculate alpha for things rendered after the nebula 2023-03-02 12:35:35 +01:00
BMagnu c342a22507 handle 3d array access using define 2023-03-02 11:42:07 +01:00
Asteroth 15b1ed8822 fix name (#5225) 2023-03-02 10:23:49 +00:00
Asteroth a0e94eca92 update some movement flags to work for AI too 2023-03-01 21:11:23 -05:00
Asteroth 6720115b95 fix retail star look by applying gamma correction (#5222) 2023-03-01 20:19:00 -05:00
Asteroth c3d6d72941 add for engine wash too 2023-02-28 20:13:08 -05:00
Asteroth 0428fa221f add shudder multipliers 2023-02-28 20:08:26 -05:00
Birk Magnussen 7f83dd8ddb Fix volume map generation 2023-02-28 21:51:34 +01:00
Birk Magnussen dd1641fd15 Fix coordinates 2023-02-28 21:11:07 +01:00
Birk Magnussen 53b1dc690a Enter values from empirical testing 2023-02-28 20:27:11 +01:00
Birk Magnussen 5392a0d9fe Fix lab volumetrics 2023-02-28 20:24:46 +01:00
BMagnu 2f0e2f591f Adjust alpha of neb-affected effects 2023-02-28 14:17:49 +01:00
BMagnu cc1e26dd25 Fix skip_to_start_of_string_one_of 2023-02-27 16:56:08 +01:00
BMagnu 14b37add71 ImGui integration for neb settings 2023-02-27 16:49:39 +01:00
BMagnu e1f071036f Lab parse volumetric nebula 2023-02-27 15:55:03 +01:00
BMagnu 6b0f49cf3b Begin Lab integration 2023-02-27 09:37:11 +01:00
wookieejedi 9d57ca14de Add line of sight as optional AI override (#5220)
Many values in `ai.tbl` can be inserted as overrides for their equivalent `Ai_profiles.tbl` values. (They are all optional and if not set for an AI class, the values in AI Profiles will be used.)

This is particularly useful for making very specific AI classes that still follow the main AI profiles table with easy to change values.

This PR adds `$firing requires exact los:` as an optional override to set in `ai.tbl`. This particular override is very useful, since it can be set to off by default in the `ai_profiles.tbl` for performance, but then set to on for some select AI classes within `ai.tbl`, and those AI classes can be easily changed on the fly in a mission.
2023-02-26 21:43:40 -05:00
Birk Magnussen 2298c3fb31 Properly unload volume textures 2023-02-25 00:13:59 +01:00
Birk Magnussen 8f697dd03a Fix Noise, Fix Scale, Fix Pos 2023-02-24 23:50:50 +01:00
Goober5000 6eeeb788dc Merge pull request #5218 from Goober5000/5210_5157_followup
5210 and 5157 followup
2023-02-24 17:22:42 -05:00
BMagnu a60512cfa4 Add parsing for nebula settings 2023-02-24 14:51:18 +01:00
BMagnu 2fd24ecf29 Begin integration into mission 2023-02-24 14:16:38 +01:00
BMagnu 9cdbf4b5ed Load configurable noise 2023-02-24 11:59:21 +01:00
m!m d2e57becd3 Merge pull request #5219 from asarium/codeowners_update
Remove myself from code owners
2023-02-24 11:40:00 +01:00
asarium 305fa3c6eb Remove myself from code owners
I have not been able to keep up with code reviews for quite some time so
I should not be a default one.

Also fixed a copy issue which was missing an option to properly handle
already existing files.
2023-02-24 11:17:53 +01:00
Goober5000 7a2caea6ea here too 2023-02-23 23:02:30 -05:00
Goober5000 0fc8fcfad3 localization tweaks
1) follow-up to 5210: Avoid a memory leak caused by duplicating text, assigning it to a SCP_string, and then leaving the buffer in limbo
2) also keep the text as const char * since it's probably best to be consistent and keep the three types the same
3) be more scrupulous about checking for the existence of map entries, since the [] operator is create-if-not-found
2023-02-23 22:32:28 -05:00
Goober5000 dbe731782a prevent memory leaks in the mission log by using unique_ptr (since message_log_remove_segs no longer exists to free the strings) 2023-02-23 21:06:49 -05:00
Goober5000 6bc6b0f1e2 use SCP_string optimizations here 2023-02-23 20:35:48 -05:00
Birk Magnussen 6eee49a868 Optimize smoothing mode of volumetrics shader 2023-02-23 20:55:26 +01:00
Birk Magnussen b6f0e8e4e8 Build noise lib in release 2023-02-23 20:55:08 +01:00
BMagnu 1a5c39154d Very basic volumetric noise setup 2023-02-23 15:33:06 +01:00
Fabian Woltermann b373ad2df4 Merge pull request #5036 from MjnMixael/lua_access_to_enums
allow scripts to read LuaEnums and add LuaEnums
2023-02-23 14:46:48 +01:00
Fabian Woltermann 39c5336847 Merge pull request #5210 from MjnMixael/mapify_builtin_strings
Mapify builtin strings
2023-02-23 14:38:32 +01:00
Fabian Woltermann 9cfc6f4b07 Merge pull request #5157 from MjnMixael/refactor_scrollback_log
Refactor mission log scrollback
2023-02-23 14:35:15 +01:00
Fabian Woltermann 9190d90536 Merge pull request #5158 from MjnMixael/lua_goals_virtvars
Add virtvars for goal satisfaction and score
2023-02-23 14:33:54 +01:00
Fabian Woltermann 50fee8eb8a Merge pull request #5211 from Baezon/increase-snd-update
Increase sound update rate
2023-02-23 14:33:03 +01:00
Fabian Woltermann 7f44bd1969 Merge pull request #5213 from MjnMixael/check_dup_enum_items
Check duplicate enum items
2023-02-23 14:32:48 +01:00
BMagnu 03e3bdb40a cleanup noise 2023-02-23 12:33:33 +01:00
BMagnu c127b2b982 Make Edge smoothing toggleable 2023-02-23 11:06:50 +01:00
BMagnu 15d078aad2 Add edge smoothing and fix size ordering 2023-02-23 10:47:27 +01:00
Birk Magnussen 92fc993597 Remove UB due to Non uniform control flow 2023-02-23 00:48:53 +01:00
Birk Magnussen 88dd1f843b Disable noise 2023-02-23 00:14:26 +01:00
Birk Magnussen 084085a53f Make noise loadable 2023-02-22 23:19:45 +01:00
BMagnu eb81b50c55 Actually load noise volume texture 2023-02-22 16:50:19 +01:00
BMagnu 6e91356f47 Properly pass volumetric pso/size 2023-02-22 16:48:39 +01:00
BMagnu 9dbf5df152 Add Noise sampling to volumetric shader 2023-02-22 16:11:33 +01:00
BMagnu c2c02470d1 Add noise generation 2023-02-22 14:52:55 +01:00
BMagnu e78fbfb9be Add worley noise 2023-02-22 14:09:21 +01:00
BMagnu 756f0a9732 Incorporate new COLLIDE_ALL for nebula rendering 2023-02-22 12:26:54 +01:00
BMagnu 68ad0c826b Merge branch 'master' into volumetric_nebulae 2023-02-22 09:31:41 +01:00
Goober5000 f02ff33311 Merge pull request #5204 from Goober5000/enhance_sexp_comments
Enhance sexp comments
2023-02-21 21:40:25 -05:00
Goober5000 98268b139c Merge pull request #5214 from Goober5000/mc_info_init_update
add initializers to mc_info
2023-02-21 21:40:12 -05:00
Goober5000 5b175673ed add initializers to mc_info
This initializes `mc_info` to the correct values when it is constructed, removing the need for `mc_info_init`.

This PR also fixes a group of incorrectly inverted assignments in beam.cpp.
2023-02-21 19:09:10 -05:00
Asteroth 1dc4a210b7 Add collision flag for colliding with all polies (#5212)
* add collision flag for colliding with all polies

* copy paste error
2023-02-22 04:45:18 +09:00
mjn-mixael eaed502d62 break the loops 2023-02-21 12:25:49 -06:00
mjn-mixael 267921b443 skip the outer loop, not the inner loop 2023-02-21 11:51:07 -06:00
mjn-mixael 439f59e1f2 check for duplicates here, too 2023-02-21 09:12:54 -06:00
mjn-mixael ce8724a653 disallow enum duplicates 2023-02-21 09:10:48 -06:00
mjn-mixael ed78597635 check for duplicate enum items 2023-02-21 08:39:47 -06:00
mjn-mixael af41185acb Merge branch 'master' into lua_access_to_enums 2023-02-21 08:00:02 -06:00
MjnMixael 61247bf3e2 sexps to check turret weapons (#5072) 2023-02-21 18:11:21 +09:00
MjnMixael c83b4b5838 is-ship-emp-active sexp (#5071)
* is-ship-emp-active sexp

* remove these

* remove counting

* unused variable declarations
2023-02-21 18:11:00 +09:00
MjnMixael f6ffe4e399 add pre-parse enums support (#5011)
* add pre-parse enums support

* Skip to the next defined enum if one already exists by this name.

* do this as string instead of char array
2023-02-21 18:10:52 +09:00
Asteroth 18b48214a2 Fix some issues with damage application (#5084)
* fix some issues with damage application

* typo

* turn off flag for new versions

* update versions to apply to post 23.0 nightlies
2023-02-21 18:10:44 +09:00
Asteroth ddc5c7ac8b increase sound update rate 2023-02-21 01:17:09 -05:00
Goober5000 9d0629f657 Merge pull request #5196 from MjnMixael/flag_sexp_descriptions
Flag sexp descriptions
2023-02-20 23:26:29 -05:00
mjn-mixael 7d0743d5ed SCP_string 2023-02-20 18:01:08 -06:00
mjn-mixael 9e24469928 emplace 2023-02-20 17:28:21 -06:00
mjn-mixael 4483d5051b remote the last of the old array and actually copy the data into the map 2023-02-20 17:06:01 -06:00
the-maddin 4e9309a154 Comment branch types 2023-02-20 21:15:08 +01:00
the-maddin 439c22b528 Merge branch 'master' into qt-campaign-editor 2023-02-20 21:07:01 +01:00
Fabian Woltermann e3be23ac7f disable the fog pass when rendering cockpits (#5208) 2023-02-20 23:17:47 +09:00
MjnMixael 39c71d3a7b Flag to apply hud shudder to chase view (#5145)
* flag to apply hud shudder to chase view

* not not
2023-02-20 23:13:24 +09:00
MjnMixael b2fe7a94ae Remove nebula bitmap limit (#5128)
* Remove nebula bitmap limit

* FRED bounds check and qtFRED

* remove length checks
2023-02-20 23:13:10 +09:00
Asteroth b7353b2027 Add turret-fired-since SEXP (#5061)
* add turret-fired-since

* update to new timestamp system

* unused variables
2023-02-20 22:10:49 +09:00
BMagnu bef3f33f6a Always to sample buffer assign 2023-02-20 11:04:55 +01:00
BMagnu d0f051847c reduce 3d texture build from O(n^3) to O(n^2) 2023-02-20 11:00:41 +01:00
Fabian Woltermann 153d3effaa Merge pull request #5160 from The-E/feature/vulkan
make the vulkan support buildable again
2023-02-20 10:54:11 +01:00
Fabian Woltermann 96f0c66722 shut down the imgui SDL backend regardless of graphics API selected 2023-02-20 10:27:31 +01:00
Goober5000 bdea153270 Merge pull request #5163 from MjnMixael/lua_update_discord
Lua update discord
2023-02-19 18:40:18 -05:00
mjn-mixael 13e28a3102 const the header, dummy 2023-02-19 14:58:17 -06:00
Goober5000 b089dabadc Merge pull request #5207 from MageKing17/bugfix/negative-check-inversion
Fix negative child check inversion.
2023-02-19 15:54:48 -05:00
Goober5000 a20dd3bea9 Merge pull request #5174 from MjnMixael/get_audiostream_duration
get audiostream duration in float seconds
2023-02-19 15:46:30 -05:00
mjn-mixael 5dc8b04dab boom chikka const const 2023-02-19 14:32:48 -06:00
mjn-mixael 00995f5516 typos 2023-02-19 14:29:00 -06:00
MageKing17 8846e043fb Fix negative child check inversion.
In PR #5202, a bunch of `Assert(child >= 0);` statements were replaced with `if (child < 0) return nullptr;`, except the first one kept the assertion's condition (inverting the logic). This fixes this accidental inversion.
2023-02-19 12:26:37 -08:00
Goober5000 89c6d330f8 Merge pull request #5159 from MjnMixael/credits_no_splitting
Prevent line splitting if building credits for SCPUI
2023-02-19 15:10:14 -05:00
Goober5000 42db9f2e7b Merge pull request #5169 from MjnMixael/countermeasure_cargo_size
Feature for countermeasures to respect cargo size
2023-02-19 15:06:17 -05:00
Goober5000 35f4dab373 Update code/sound/audiostr.h
Update documentation
2023-02-19 14:44:41 -05:00
mjn-mixael 2ed504eb82 clarified descriptions 2023-02-19 10:48:48 -06:00
MjnMixael 5074a939ed Merge branch 'master' into lua_update_discord 2023-02-19 10:39:11 -06:00
Fabian Woltermann ec4222b412 Merge pull request #5190 from MjnMixael/lua_os_focus
Lua method to check if the game has focus
2023-02-19 17:22:27 +01:00
Fabian Woltermann 901dfe310b Merge pull request #5186 from MjnMixael/on_warp_complete_hook
On warp complete hook
2023-02-19 17:21:58 +01:00
Fabian Woltermann 5f6f4c11b2 Merge pull request #5191 from MjnMixael/unlimited_power
Unlimited Power
2023-02-19 17:21:07 +01:00
Fabian Woltermann 2de1441bf1 Merge pull request #5192 from MjnMixael/cutscene_custom_data
Cutscene custom data
2023-02-19 17:20:48 +01:00
Fabian Woltermann e1de3b6ac4 Merge pull request #5202 from Goober5000/deblongify_fred
deblongify fred
2023-02-19 17:20:02 +01:00
Fabian Woltermann 6960fe58c8 Merge pull request #5203 from Baezon/no-bsp-tree-optimization
Remove previous bsp tree skipping optimization
2023-02-19 17:19:46 +01:00
Fabian Woltermann 4b6a791b02 pin vulkan version to 1.3.204.0 2023-02-19 15:43:17 +01:00
Fabian Woltermann 801b693e63 make sure the WITH_VULKAN compile time flag is still set 2023-02-19 15:43:17 +01:00
Fabian Woltermann 0ab3a85289 cleanup 2023-02-19 15:43:17 +01:00
Fabian Woltermann faf8fb2ecc don't build vulkan on macos for now either 2023-02-19 15:43:17 +01:00
Fabian Woltermann 0fbc422ca0 remove vulkan references from the lab 2023-02-19 15:43:17 +01:00
Fabian Woltermann c835481e6d x86 builds don't get vulkan 2023-02-19 15:43:17 +01:00
Fabian Woltermann 4deaecece9 more compile fixes 2023-02-19 15:43:17 +01:00
Fabian Woltermann 1387c46b67 fix the rest of the pipelines 2023-02-19 15:43:17 +01:00
Fabian Woltermann acd4486fc1 remove unfinished imgui init 2023-02-19 15:43:17 +01:00
Fabian Woltermann b7343690de move vulkan sdk install to similar place in macos pipeline 2023-02-19 15:43:17 +01:00
Fabian Woltermann 7d39df9871 fix missing fall-through in case statement 2023-02-19 15:43:17 +01:00
Fabian Woltermann 4ab8d35b8b add curl to the gha container 2023-02-19 15:43:16 +01:00
Fabian Woltermann 3e7e3bfb4d more cleanup 2023-02-19 15:43:16 +01:00
Fabian Woltermann 42a16b4c7d fix minor issues breaking compilation in CI 2023-02-19 15:43:16 +01:00
Fabian Woltermann 7ea7953cd7 wip 2023-02-19 15:43:16 +01:00
Fabian Woltermann 0bb898ae2e download the vulkan sdk in the pipeline 2023-02-19 15:43:16 +01:00
Fabian Woltermann c6831d8b30 instead of shipping our own copy of vulkan-hpp, use the one in the official SDK 2023-02-19 15:43:16 +01:00
Asteroth 68aec1edef Merge remote-tracking branch 'upstream/master' into no-bsp-tree-optimization 2023-02-19 04:07:07 -05:00
Fabian Woltermann 072fee459b Merge pull request #5199 from Baezon/refactor-submodel-rand-points
Add `GetVertex()` and `NumVertices()` script functions and clean up random submodel point retrieval a bit
2023-02-19 08:58:03 +01:00
Goober5000 d85d854646 make multiline work in text editor 2023-02-18 16:17:32 -05:00
Goober5000 23c5355bc7 make multiline comments display properly without length restriction 2023-02-18 15:45:28 -05:00
Asteroth eba379330e update naming and remove unused function 2023-02-18 15:31:06 -05:00
Asteroth f75f08f7ba remove previous optimization 2023-02-18 15:15:41 -05:00
Goober5000 0357df1e7d add comment 2023-02-18 15:01:44 -05:00
Asteroth 7a5c6df202 update docs and prints 2023-02-18 14:58:00 -05:00
Goober5000 628ac80f2c prevent fred from crashing on a node that shouldn't be there 2023-02-18 14:55:18 -05:00
Goober5000 ea58a760ff prevent the BLONG by capturing keypresses 2023-02-18 14:09:44 -05:00
Fabian Woltermann 5e79d94bad Merge pull request #5201 from The-E/fix/deprecated_github_actions
Fix github CI deprecation warnings
2023-02-18 19:48:23 +01:00
Goober5000 2f4059b7fd Merge pull request #5198 from Goober5000/fix_mission_version
mission version numbers should be major.minor
2023-02-18 13:46:18 -05:00
Fabian Woltermann b030148c21 Merge pull request #5019 from Goober5000/query_referenced_update
more #define updates
2023-02-18 18:45:22 +01:00
MjnMixael 754c351498 per bank autoaim (#5074)
adds per-bank autoaim feature
2023-02-18 18:43:03 +01:00
Fabian Woltermann f45a6fb58c removes soon to be deprecated github CI commands. For details see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ 2023-02-18 18:30:08 +01:00
Asteroth 6e25fbb50f unused variable 2023-02-17 23:55:22 -05:00
Asteroth db5a37c178 add num vertices script func 2023-02-17 23:23:24 -05:00
Asteroth b68e424213 refactor getting random vertices and script func 2023-02-17 23:03:57 -05:00
Goober5000 af428ca6b9 other feedback 2023-02-17 21:59:57 -05:00
Goober5000 731b5d53c5 change case 2023-02-17 21:50:42 -05:00
Birk Magnussen 3042846e62 Fix model-based volume generation 2023-02-18 00:17:44 +01:00
Goober5000 8d27682126 mission version numbers should be major.minor
Since older builds of FRED parse the mission version as a float, the version can contain a maximum of one decimal point.  These changes allow FRED and FSO to disregard the build number when loading, saving, or comparing versions.

There is also a small fix to qtfred's saving of the author field.
2023-02-17 12:32:54 -05:00
mjn-mixael 9f20cb1921 descriptions 2023-02-17 10:03:54 -06:00
BMagnu 8b75bbbb0d Add model read for 3d texture sample 2023-02-17 15:09:21 +01:00
BMagnu 9220b48592 Fix Typo and test oversampling 2023-02-17 13:26:18 +01:00
BMagnu f7f2b5f025 Encapsulate 3d texture render in volumetrics class 2023-02-17 11:59:13 +01:00
BMagnu 2531a31b1e tidyup parameters 2023-02-17 10:42:23 +01:00
Goober5000 8d406c2167 Merge pull request #5069 from MjnMixael/popup_shortcut_var
Pass shortcut key character to Lua as a hook variable
2023-02-16 22:32:44 -05:00
Goober5000 0813a7f416 Merge pull request #5195 from MjnMixael/fix_qtfred_building
missed items required to build qtfred
2023-02-16 22:31:45 -05:00
Goober5000 9a1badf444 Merge pull request #5193 from MjnMixael/object_death_documentation
Match documentation description to actual hook names.
2023-02-16 22:30:28 -05:00
MjnMixael 5df51711fe add ability to disable grid rendering for each stage (#5053)
* add ability to disable grid rendingering for each stage

* revert these
2023-02-16 22:22:32 -05:00
MjnMixael 7ec27f147f Allow for arbitrary briefing icon scaling (#5047)
* allow for arbitrary briefing icon scaling

* only apply valid scale values
2023-02-16 22:22:16 -05:00
mjn-mixael e972cdc2cf explicit size_t 2023-02-16 21:10:07 -06:00
mjn-mixael f220075bbe missed items required to build qtfred 2023-02-16 20:45:01 -06:00
mjn-mixael 730c84308e qtFRED support 2023-02-16 20:36:04 -06:00
mjn-mixael badde3ad96 Let FRED display flag descriptions 2023-02-16 17:12:47 -06:00
BMagnu 1371dc3a08 Add attribution before I forget 2023-02-16 16:11:09 +01:00
mjn-mixael 0c5342b875 Match documentation to actual hook names. 2023-02-16 09:05:30 -06:00
BMagnu 4c3024e5fc Add Beer-Powder absorption for diffuse lighting 2023-02-16 16:03:47 +01:00
mjn-mixael bbb7539fb6 cutscene custom data 2023-02-16 08:50:03 -06:00
BMagnu a9a110e8fa Add Heyney Greenstein Scattering 2023-02-16 14:58:19 +01:00
BMagnu a71dbbab6a Tidy up shader and prepare for diffuse lighting 2023-02-16 13:29:43 +01:00
BMagnu 3e8be9c8a3 Fix emissive blur 2023-02-16 12:30:56 +01:00
mjn-mixael b2270e4714 OPF_BOLT_TYPE is the senate 2023-02-15 18:24:37 -06:00
mjn-mixael 5410b3ef46 sssssssnake case 2023-02-15 16:54:17 -06:00
mjn-mixael 5344b45c47 scripting documentation 2023-02-15 16:48:11 -06:00
mjn-mixael 2bdf6c21f2 i pity the bool 2023-02-15 16:44:41 -06:00
mjn-mixael 5b2bd80609 cleanup os_foreground() 2023-02-15 16:42:03 -06:00
mjn-mixael 8063fc3863 Unlimited Power 2023-02-15 16:34:15 -06:00
Birk Magnussen 9ac262579d Document Emissive Attempts 2023-02-15 20:39:16 +01:00
mjn-mixael 4924f56613 lua method to check if the game has focus 2023-02-15 10:01:59 -06:00
BMagnu dbc2cb1c27 prepare volumetric shader for multi-influence color 2023-02-15 15:51:14 +01:00
Fabian Woltermann 076ad7770b remove main shader compile-time flags (#5055) 2023-02-15 15:20:11 +01:00
BMagnu 3c942fc409 Proper step calculation based on nebula parameters 2023-02-15 15:09:37 +01:00
BMagnu 5f48e55990 Proper alpha-considering ray marching 2023-02-15 14:26:48 +01:00
MjnMixael aaee1e5a32 enhance handling of motion debris (#5022)
* enhance handling of motion debris

* dunno what i was thinking here

* address feedback

* require all four bitmaps to be defined in new parsing method

* address feedback
2023-02-15 17:13:48 +09:00
MjnMixael ce274209c1 adds hudgage and event to the valid types of a Lua Sexp parameter (#5018) 2023-02-15 17:13:38 +09:00
MjnMixael 7be49e67d1 modular autopilot table (#4978)
* modular autopilot table

* clarical comment
2023-02-15 17:13:29 +09:00
BMagnu 8731ad1448 Add option to deprecate hooks (#5184)
* Add hook deprecation to calls

* Deprecate hooks properly

* Change OnSplashScreen hook callig

* Check for deprecated hooks at script time

* include hooks directly

* Check deprecation for lua added hooks

* Write deprecation notice to docs

* rescope Target_version

* fix typo
2023-02-15 17:12:25 +09:00
Birk Magnussen a5f634885b Get volumetric ray marching working 2023-02-15 01:14:34 +01:00
Goober5000 fe4d93393b Merge pull request #5122 from Goober5000/parse_object_colgroup
make collision_group_id accessible to parse objects
2023-02-14 18:45:06 -05:00
Birk Magnussen 9de6beb4c2 First working raycast 2023-02-14 21:03:18 +01:00
BMagnu 4485efe484 Add FRED SpaceMouse support (#4984)
* Add hidapi lib

* Add Spacemouse Interface

* Integrate HID API

* Implement basic 3dconnexion hid protocol

* FRED Spacemouse integration

* QtFRED support

* Fix assertion

* More devices

* Increase polling

* Wireless resetting

* QtFRED polling frequency

* Add nonlinear scalings

* Linux Build Options for HIDAPI

* Linux Build Options for HIDAPI 2

* Fix GCC

* Resolve Type Aliasing

* Fix out-of-focus control

* rename searchSpaceMouse
2023-02-15 03:00:08 +09:00
mjn-mixael 12a0a8642e override then normal hook 2023-02-14 09:56:22 -06:00
mjn-mixael e246616fac on warp complete hook 2023-02-14 09:43:35 -06:00
BMagnu d3701166af Properly clear new composite buffer 2023-02-14 16:41:57 +01:00
BMagnu e1db2ca59a Hooks into deferred draw code 2023-02-14 15:39:05 +01:00
BMagnu 063a567fe4 Being volumetrics calculations 2023-02-14 15:22:23 +01:00
BMagnu c32c655350 Keep Emissive texture intact during deferred render step 2023-02-14 15:21:00 +01:00
BMagnu 91d274cd6d Add 3D-Texture support 2023-02-14 14:36:28 +01:00
MjnMixael 08742f36e8 enable commandline language setting (#5013) 2023-02-14 17:28:09 +09:00
MjnMixael 24571d099e modular ai classes table (#4945)
* modular ai classes table

* bool instead of int

* merge these
2023-02-14 17:27:16 +09:00
MjnMixael f29c48965e fictionviewer localization (#5012)
* fictionviewer localization

* Move this to it's own method

* C_str
2023-02-14 17:26:36 +09:00
MjnMixael fbb209ef6b Modular rank table (#4854)
* vectorize ranks

* Add modular table parsing

* int

* comments

* prevent field overwriting if tbm is used

* address feedback

* off by one
2023-02-14 17:25:52 +09:00
Goober5000 7cc9f72cac Merge pull request #5077 from MjnMixael/gameplay_profiles_alias
Allow gameplay_profiles.tbl to be an alias of ai_profiles.tbl
2023-02-13 21:45:21 -05:00
Goober5000 6f7f9c2f48 Merge pull request #5120 from MjnMixael/scpui_pause_screen
funcs and virtvars for SCPUI pause screen
2023-02-13 21:45:12 -05:00
Goober5000 d398ce25fb Merge pull request #5117 from MjnMixael/pause_weapon_sounds
Expose pausing weapon sounds
2023-02-13 21:39:39 -05:00
Goober5000 3c59687d75 Merge pull request #5185 from MjnMixael/splash_screens_range
Keep splash screen rand choice in range
2023-02-13 21:13:19 -05:00
mjn-mixael ef3af0e254 Keep this in range 2023-02-13 14:56:27 -06:00
MjnMixael 40807000ad Merge branch 'master' into countermeasure_cargo_size 2023-02-12 23:18:02 -06:00
Goober5000 de5a422fc0 Merge pull request #5146 from MjnMixael/on_asteroid_created
On asteroid created hook
2023-02-12 21:25:32 -05:00
Goober5000 4b86f32b21 Merge pull request #5183 from Goober5000/thruster_flag_rename
rename thruster flags
2023-02-12 20:52:48 -05:00
Goober5000 09b6552908 rename thruster flags
`Roll_` and `Bank_` are synonyms, and the `Roll_` thruster flags should be `Yaw_` anyway, so rename them and rename their table strings.  This still checks the old table strings for compatibility.
2023-02-12 19:42:26 -05:00
Goober5000 de3e158b73 Merge pull request #5182 from Baezon/fix-thruster-sounds
Fix thruster sounds and add flag for player thruster sounds
2023-02-12 19:36:38 -05:00
Goober5000 a0c0766146 Merge pull request #5181 from Goober5000/build_fix
build compatibility fix
2023-02-12 19:24:12 -05:00
Asteroth 05790db5e7 clean up 2023-02-12 18:47:02 -05:00
Asteroth d28833e92a fix thruster sounds and add flag 2023-02-12 15:55:23 -05:00
Goober5000 60e5ba9541 Merge pull request #5139 from MjnMixael/has_armor_sexp
has-armor-type sexp
2023-02-12 15:40:53 -05:00
Goober5000 705d4a519f Merge pull request #5175 from MjnMixael/unlimit_cheats
Remove message requirement for custom cheats
2023-02-12 15:39:38 -05:00
Goober5000 950fbf1a13 Merge pull request #5178 from MjnMixael/lua_free_models
Lua method to free all loaded models
2023-02-12 15:39:27 -05:00
Goober5000 dd0b099d9b Merge pull request #5176 from MjnMixael/disable_old_debug_cmnds
Remove some old debug key checks in mainhall
2023-02-12 15:39:19 -05:00
Goober5000 ca6f25f5af Merge pull request #5085 from Goober5000/play_dead_ets
prevent ship from managing ETS if it is playing dead
2023-02-12 13:34:21 -05:00
MjnMixael 09215672a1 override to set glowpoint bank to default off (#5091) 2023-02-12 09:54:23 -05:00
MjnMixael 1076493ceb choose random splash image (#5054)
* choose random splash image

* address feedback
2023-02-12 09:52:57 -05:00
Goober5000 28a1e2a3d4 build compatibility fix
Follow-up to #5138.  Tweak the function header to be more compatible with different build environments; some don't like the `= ""` for some reason.
2023-02-11 22:18:38 -05:00
MjnMixaelandGoober5000 280d8c8c8a increase mission author name length limit (#5162)
* increase mission author name length limit

* use string_copy

---------

Co-authored-by: Goober5000 <[email protected]>
2023-02-12 08:29:18 +09:00
MjnMixael 58e7d50b1c Add to description 2023-02-11 16:19:24 -06:00
Goober5000 1c4db98bc5 Merge pull request #5180 from Goober5000/update_version_23.1.x
bump version to 23.1.x
2023-02-11 16:53:33 -05:00
Goober5000 214c6e3d5c bump version to 23.1.x 2023-02-11 16:28:59 -05:00
Goober5000 eaa063ba65 Merge pull request #5152 from Goober5000/mission_versioning
add versioning support to missions
2023-02-11 16:19:33 -05:00
mjn-mixael 002ab4885e gate float divisions behind mod flag 2023-02-11 14:48:55 -06:00
Goober5000 58175aa386 Merge pull request #5179 from Goober5000/model_sanity_checks
add some sanity checks for submodel indexes
2023-02-11 15:41:24 -05:00
Goober5000 0e70c4918a Merge pull request #5079 from MjnMixael/visible_node_comments
Make sexp node comments more visible at a glance
2023-02-11 15:37:27 -05:00
Goober5000 0d75790a6a Merge pull request #5138 from MjnMixael/force_emp_sexp
hud-force-emp-effect sexp
2023-02-11 15:36:48 -05:00
Goober5000 85e11ecd6d Merge pull request #5096 from MjnMixael/opf_turret_type
Implement opf_turret_type
2023-02-11 15:36:35 -05:00
Goober5000 3651239a6b Merge pull request #5010 from Goober5000/more_category_updates
more category updates
2023-02-11 15:33:28 -05:00
mjn-mixael 041a390660 no team, dummy 2023-02-11 14:26:39 -06:00
Goober5000 6bc1bff0ab add some sanity checks for submodel indexes
Add some checks during model load for submodel indexes that could be out of range due to a corrupt model.
2023-02-11 00:32:24 -05:00
mjn-mixael de1215f64e unused 2023-02-10 21:40:10 -06:00
mjn-mixael d101227721 lua method to free all loaded models 2023-02-10 20:57:23 -06:00
mjn-mixael 13b7f626a9 appease etp 2023-02-10 09:30:38 -06:00
mjn-mixael 0e375e2e0d remove some old debug key checks in mainhall 2023-02-10 09:00:38 -06:00
mjn-mixael a360245857 remove message requirement for custom cheats 2023-02-09 15:08:30 -06:00
mjn-mixael d0e26adc20 appease goober 2023-02-07 16:08:32 -06:00
wookieejedi 9403f17fbb Adds safety checks to scripting orders with waypoints (#5173)
* Adds safety checks to scripting orders with waypoints

Turns out setting a waypoint order then trying to get to target of that order in the same frame triggers a crash in the scripting API for ship orders (`order.cpp` line 295). This was due to invalid lookups which lacked safety checks.

This PR adds those safety checks. Now, if this situation is encountered, it leaves `objnum` at -1 and thus returns an object for which `isValid` is false.

Fix is tested and works as expected. Also fixes #5172

* appease clang

* cleanup thanks to Goober

* clang again

* forgot to re-add the nullptr

* remove redundant checks
2023-02-07 15:57:39 -05:00
mjn-mixael 289266d959 get audiostream duration in milliseconds 2023-02-07 13:18:53 -06:00
Goober5000 9a7b3fe0d6 Merge pull request #5171 from MjnMixael/clear_credits_scpui
Clear credits before rebuilding
2023-02-04 20:50:40 -05:00
mjn-mixael c5ea47fd05 clear credits before rebuilding 2023-02-04 01:26:04 -06:00
Goober5000 11dcb01a98 Merge pull request #5167 from Baezon/fix-ai-secondary-selection
Fix inadvertent AI usage of invalid weapons
2023-02-03 19:29:32 -05:00
mjn-mixael 4f36c6a781 feature for countermeasures to respect cargo size 2023-02-03 10:15:32 -06:00
BMagnu 605e89a01a Fix WeaponUsedConditions (#5165) 2023-02-03 06:23:48 +09:00
Asteroth 2100a0d2f3 change ai_choose_secondary_weapon to return validity 2023-02-02 15:37:27 -05:00
Goober5000 37f7c569b8 Merge pull request #5156 from Baezon/no-invalid-priority2-assignment
Dont assign a possibly -1 priority2_index
2023-02-01 19:48:37 -05:00
mjn-mixael 4a8991703f missed comma 2023-02-01 12:17:58 -06:00
mjn-mixael 34232bd5d8 const char instead of SCP_string 2023-02-01 12:03:44 -06:00
mjn-mixael 7eca7febcb expose setting discord presence 2023-02-01 11:52:41 -06:00
mjn-mixael 0ad91aaf3d prevent line splitting if building credits for SCPUI 2023-01-31 16:19:40 -06:00
mjn-mixael e83609b121 properly force fit the actions 2023-01-30 14:22:57 -06:00
mjn-mixael 1d93e9bff6 variable collision 2023-01-30 14:01:24 -06:00
mjn-mixael a568f514a3 add virtvars for goal satisfaction and score 2023-01-30 13:59:31 -06:00
mjn-mixael ed8a511fe9 refactor mission log scrollback 2023-01-30 13:37:02 -06:00
MjnMixael 1a6517cf51 if no valid choices, bail (#5153) 2023-01-30 13:42:47 -05:00
Asteroth e9c3b7e4b2 little clearer 2023-01-30 13:24:44 -05:00
Asteroth 2ae50c4a70 dont assign a possibly -1 priority2_index 2023-01-30 13:22:14 -05:00
Asteroth a5546a5dc7 better safety for ai_select_secondary_weapon (#5151) 2023-01-30 01:45:13 -05:00
Goober5000 f083018628 Merge pull request #5107 from MjnMixael/better_verify_orders
some validity checks to order sending
2023-01-28 20:43:37 -05:00
Goober5000 3c723c9ea9 add versioning support to missions
This finally enables the `$Version:` field in FreeSpace missions, which has been present ever since the beginning of FS1's development but has never been used for its intended purpose.  This field now stores the version of FSO that is required to run the mission.  If the version of the engine is not sufficient to run the version of the mission, then a) the mission is hidden from the mission listing, or b) a friendly notification is displayed if the mission is loaded anyway (for example, through a campaign).  Furthermore, FRED will notify the user if the mission's version is migrated from any version other than the legacy 0.10.

It will be the responsibility of coders who modify the mission format to also update the `MISSION_VERSION` constant with the appropriate major/minor/build/revision of the format change.
2023-01-28 18:01:51 -05:00
mjn-mixael e9be428cd1 refactor Msg_scrollback_lines 2023-01-27 16:36:03 -06:00
Goober5000 07768b2d2d Merge pull request #5142 from EatThePath/remove_trail_exclusion
Removed unhelpful optimization from trail rendering
2023-01-26 20:34:13 -05:00
Goober5000 543c7f220c Merge pull request #5144 from MjnMixael/fix_weapon_origin
If we're not drawing weapon models then skip all this
2023-01-26 20:34:02 -05:00
mjn-mixael 8360bae5af on asteroid created hook 2023-01-26 11:24:33 -06:00
mjn-mixael 6162c475a0 float 2023-01-26 08:34:34 -06:00
mjn-mixael 9419f24184 warning 2023-01-26 08:30:26 -06:00
Goober5000 ed14e03f73 Merge pull request #5141 from MjnMixael/scpui_load_hires
Allow way to prevent scpui loading hires animations
2023-01-25 22:47:33 -05:00
Goober5000 6cd74c979a Merge pull request #5137 from MjnMixael/num_linkable_weapons
Check if we have at least two linkable weapons
2023-01-25 22:46:34 -05:00
Goober5000 67d5acd836 Merge pull request #5143 from Goober5000/fix_tips
patch player tips
2023-01-25 20:25:01 -05:00
Goober5000 7978cbae0b Merge pull request #5140 from MjnMixael/check_beam_damage_factor
Warn if beams have damage factors while damage factors are disabled
2023-01-25 20:24:50 -05:00
mjn-mixael fe787ade08 if we're not drawing weapon models then skip all this 2023-01-25 17:06:07 -06:00
mjn-mixael 236b648b11 address feedback 2023-01-25 08:43:11 -06:00
mjn-mixael 414c630d04 address feedback 2023-01-25 08:31:36 -06:00
Goober5000 c70806a705 patch player tips
1. Be consistent about the check for `Player` being null, as the `Player` variable may be used later in the function without a null check
2. Return early if there are no tips to show, so as to prevent a crash
3. Use `Random::next` rather than `frand_range`
4. Use `SCP_string` to avoid string overflow

Fixes a crash discovered in Star Fox: Event Horizon
2023-01-25 00:01:36 -05:00
David Gibson 6ecfe2f186 Removed unhelpful optimization from trail rendering 2023-01-24 16:58:36 -06:00
mjn-mixael e0baaa6087 Allow way to prevent scpui loading hires animations 2023-01-24 16:20:00 -06:00
mjn-mixael 663ce18fab warn if beams have damage factors while damage factors are disabled 2023-01-24 12:28:33 -06:00
mjn-mixael d7bbecfa16 has-armor-type sexp 2023-01-24 11:20:25 -06:00
mjn-mixael d2e1e2b5de hud-force-emp-effect sexp 2023-01-23 21:50:36 -06:00
mjn-mixael 9e1181b70f check if we have at least two linkable weapons 2023-01-23 09:04:15 -06:00
Tyler Blount ae5c49e970 Merge pull request #5136 from scp-fs2open/fix/post-release-secrets
Inherit secrets when publishing Release builds
2023-01-22 20:49:40 -07:00
Tyler Blount 14d51b4584 Inherit secrets when publishing Release builds 2023-01-22 19:03:52 -07:00
Goober5000 b92954877d Merge pull request #5135 from Goober5000/fix_5089
fix sunglares when lightshafts are disabled
2023-01-22 15:02:08 -05:00
Asteroth 3047a226a3 Better account for runtime gravity changes (#5130)
* better account for changing gravity

* use `obj_used_list`

* check should_be_dead
2023-01-22 14:40:13 -05:00
MjnMixael 9974457df0 let passive fields wrap if gravity is involved (#5132) 2023-01-22 13:56:34 -05:00
Goober5000 11f2635abd add parse object collision group to sexps 2023-01-21 18:53:40 -05:00
Goober5000 df8268368a make collision_group_id accessible to parse objects
Add collision groups to parse objects so they can be set before arrival via script.
2023-01-21 18:10:51 -05:00
Goober5000 c72e214c47 fix sunglares when lightshafts are disabled
This is another case of a bug introduced by a bugfix, in this case #3885.  The original bug inadvertently made sun glare work in most cases where it was supposed to.

This commit removes the check for lightshafts when drawing the sun glare.  Since sun glare can be drawn regardless of whether lightshafts are enabled, the only thing that matters is to check that the view is not shadowed.
2023-01-21 17:52:55 -05:00
EatThePath 7177361c82 Merge pull request #5126 from EatThePath/fix-my-cmdline-mess
adding proper launcher documentation for some of my recent flags
2023-01-21 09:12:51 -06:00
Asteroth 654b0a0e42 Improve handling of failure to find spawn weapons (#5111)
* improve handling of failure to find spawn weps

* docs

* shadowing
2023-01-21 01:33:25 -05:00
Goober5000 add6a60439 Merge pull request #5129 from MjnMixael/more_asteroid_sexp_fixes
Move these checks into asteroid.cpp
2023-01-20 21:26:50 -05:00
MjnMixael 5694e5c810 Allow negative number in event editor (#5106)
* allow negative number in event editor

* handle qtFRED ui also
2023-01-20 18:06:08 +01:00
Goober5000 5c8806d040 Merge pull request #5127 from Goober5000/dont_blast_nocollide
don't blast no-collide objects
2023-01-19 21:38:57 -05:00
mjn-mixael 798e47409a Move these checkes into asteroid.cpp 2023-01-18 16:24:48 -06:00
Goober5000 f8acd4f898 don't blast no-collide objects
In the same way that navbuoys aren't blasted by explosions, no-collide objects shouldn't be blasted either.

Fixes #5068.
2023-01-18 01:59:20 -05:00
David Gibson 689467e21f ADding proper launcher documentation for some of my recent flags 2023-01-17 13:14:10 -06:00
Goober5000 b6ff2caa0a update the .mako file for release posts (#5118)
* update the .mako file for release posts

1. Change the "previous release" thread to 22.2
2. Change http to https where possible
3. Link to the github Bug Triage page rather than the Mantis filter
2023-01-17 01:52:15 +00:00
mjn-mixael 6b097be0a6 use me daddy 2023-01-16 14:15:56 -06:00
mjn-mixael 9980c3f5c5 funcs and virtvars for SCPUI pause screen 2023-01-16 14:02:01 -06:00
mjn-mixael bd1a288cd9 expose pausing weapon sounds 2023-01-15 21:02:50 -06:00
Tyler Blount 5020cf8b64 Merge pull request #5114 from z64555/fix_5113
Fix and expand upon debug safety catcher for ccfg.tbl flag reading.
2023-01-15 15:12:56 -07:00
Tyler Blount 4f1d486ea3 Merge pull request #5110 from MjnMixael/fix_asteroid_sexps
make sure we have an argument
2023-01-15 13:30:07 -07:00
Fabian Woltermann e8c9a0a3aa do not update the gl buffer for a batch if the batch is empty (#5115) 2023-01-15 19:15:47 +01:00
z64555 2bc1247002 Fix and expand upon debug safety catcher for ccfg.tbl flag reading.
* Expand upon some comments for clarity on assumptions and optimizations
* Define the CCF_NONE flag for posterity
2023-01-15 10:59:48 -06:00
mjn-mixael d8a052128e remove returns 2023-01-14 17:29:32 -06:00
mjn-mixael fa3631c9b9 make sure we have an argument 2023-01-14 17:24:43 -06:00
Fabian Woltermann 0fcf7e0fbe Remove the screen signature (#5108) 2023-01-14 16:45:10 +01:00
mjn-mixael ddde9079c9 some validity checks to order sending 2023-01-13 15:48:28 -06:00
Goober5000 d562104c0f Merge pull request #5105 from MjnMixael/fix_skipping_first_debris
don't skip first debris item
2023-01-12 22:42:25 -05:00
mjn-mixael a1dbf2e917 don't skip first debris item 2023-01-12 12:16:39 -06:00
Goober5000 eca7db0315 allow personas to be used by more than one species 2023-01-12 12:47:12 -05:00
Goober5000 be4d7acb6a change substitute_missing_messages to an actual flag, and add a no automatic assignment flag 2023-01-12 00:49:21 -05:00
Goober5000 02e5cc4353 remove PERSONA_FLAG_VASUDAN, since it is no longer assigned, and fix the -Vas suffix on the personas, which has apparently been broken since the species upgrade 2023-01-11 23:55:28 -05:00
JohnAFernandez d55a604ca5 Merge pull request #5098 from MjnMixael/fix_team_color_parse
fix team color parsing
2023-01-11 16:31:15 -05:00
mjn-mixael 481c0a490b address feedback 2023-01-11 08:14:29 -06:00
Fabian WoltermannandFabian Woltermann 264a44085d when checking sexp text strings, make sure to account for usages of <argument> (#5100)
Co-authored-by: Fabian Woltermann <[email protected]>
2023-01-10 21:33:39 +01:00
Goober5000 da3ed275d4 Merge pull request #5095 from MageKing17/bugfix/asteroid-targets-fred-crash
Avoid calling `asteroid_add_target()` in FRED.
2023-01-09 23:58:43 -05:00
Goober5000 44bebf17b8 Merge pull request #5097 from MjnMixael/add_missing_help
Add missing help for ship-untag sexp
2023-01-09 23:58:26 -05:00
mjn-mixael 0b234af925 fix team color parsing 2023-01-09 12:40:52 -06:00
mjn-mixael 5ca15685ef Add missing help for ship-untag sexp 2023-01-09 11:37:41 -06:00
mjn-mixael 2a5b930941 implement opf_turret_type for turret-protect-ship and turret-unprotect-ship 2023-01-09 11:13:37 -06:00
MageKing17 98713dadc1 Avoid calling asteroid_add_target() in FRED.
PR #5058 made `count_incident_asteroids()` use `Asteroid_obj_list` instead of `obj_used_list`; a perfectly sensible change in and of itself. However, PR #4827 had previously made `asteroid_obj_list_init()` only be called if FRED wasn't running (presumably because of the iteration through `Asteroid_objs` to clear flags, which is wasted effort in FRED). The problem is that without `list_init()` being called on `Asteroid_obj_list`, its `prev` and `next` were `nullptr` instead of linking back to itself, which means the beginning of the list and the end of the list were no longer considered the same (the iterator's `begin()` calls `GET_FIRST(head)`, which is effectively `head->next`, while `end()` calls `END_OF_LIST(head)`, which is effectively just `head`). This meant that iterating over `list_range(Asteroid_obj_list)` was returning `nullptr` as the first element of the list, and trying to dereference that would cause a crash. This was still not a problem in and of itself, as long as nothing tried to iterate over `Asteroid_obj_list` while FRED was running, which theoretically shouldn't be necessary...

PR #3704 changed mission parsing so that when parsing a ship with a name that matches one of the `Asteroid_field.target_names`, it would call `asteroid_add_target()` to initialize the relevant data for the asteroid field to fling asteroids at that ship. `asteroid_add_target()` calls `count_incident_asteroids()`, which (since PR #5058) iterates over `Asteroid_obj_list`, causing a crash due to dereferencing a null pointer on any mission that defines `$Asteroid Targets:` (and then actually has such a target be parsed).

While this could be solved by unconditionally initializing `Asteroid_obj_list`, there's really no need to do anything with `Asteroid_obj_list` in FRED, so instead the `asteroid_add_target()` call has been gated behind a `!Fred_running` check, and `Assertion()`s have been added to make sure `Asteroid_obj_list` has been initialized at the beginning of any function that does anything with it (besides initialize it), to catch similar problems in the future.

Fixes #5092.
2023-01-09 06:43:58 -08:00
Goober5000 b0f5a4cffb Merge pull request #5082 from MjnMixael/port_to_qtfred
This case was never ported to qtFRED
2023-01-08 13:32:09 -05:00
mjn-mixael 2881482182 fix rendering of jump nodes 2023-01-07 11:11:02 -06:00
mjn-mixael 661732a45b only load the model in the retail ui 2023-01-07 02:23:36 -06:00
mjn-mixael dd9faf9438 more missed stuff 2023-01-07 02:03:44 -06:00
mjn-mixael 856997326b some cleanup 2023-01-07 01:49:58 -06:00
mjn-mixael d52c2da8b5 take a break youve earned it 2023-01-07 01:48:39 -06:00
mjn-mixael c6a1639a82 scpui methods required for handling closeup briefing icon stuff 2023-01-07 01:48:39 -06:00
Goober5000 fc2cac617f Merge pull request #5087 from MjnMixael/fix_brief_api_highlight
fix api brief map not rendering icon highlight arrows
2023-01-06 21:09:27 -05:00
mjn-mixael 96bd06fbc1 fix api brief map not rendering icon highlight arrows 2023-01-06 09:49:16 -06:00
mjn-mixael d62e38d996 unify get_listing_opf_subsystem 2023-01-06 08:56:01 -06:00
Goober5000 a0181e715d prevent ship from managing ETS if it is playing dead
This was the bug found recently that was thought to be related to #2157.  It turns out that ships will manage ETS even if they are playing dead, which caused a ship to accelerate during a ship-maneuver as it directed more power to engines.  So this PR adds a "$ships playing dead don't manage ETS:" flag to control this behavior.  Tested and works.

This also capitalizes two flags that did not have an initial capital letter.
2023-01-06 03:04:11 -05:00
Goober5000 d8fe4a11be Merge pull request #5042 from MjnMixael/asteroid_sexp_missed_items
A few missed items and fixes to the asteroid debris sexp
2023-01-05 21:11:00 -05:00
MjnMixael 1a4abd9977 Typo 2023-01-05 12:29:42 -06:00
mjn-mixael aa6b1030f1 This case was never ported to qtFRED 2023-01-05 11:04:34 -06:00
mjn-mixael 3752a54a63 move 2023-01-05 10:48:47 -06:00
JohnAFernandez a49acc92f3 Merge pull request #5076 from MjnMixael/warn_dogfight_weapons
Warn dogfight weapons
2023-01-05 11:00:56 -05:00
MjnMixael 5ba4e50685 remove ignored missions from the lab list (#5081) 2023-01-05 10:06:28 +01:00
Goober5000 24e3243289 Merge pull request #5078 from MjnMixael/fix_fred_coords_input
Disallow overly large input in FRED Orientation Editor
2023-01-04 18:29:13 -05:00
mjn-mixael dbbd6b7705 Make sexp node comments more visible at a glance 2023-01-04 16:08:10 -06:00
mjn-mixael ae135b4922 mission profiles instead of gameplay profiles 2023-01-04 13:48:16 -06:00
mjn-mixael c1987aba62 < instead of <= 2023-01-04 13:44:57 -06:00
mjn-mixael 6f7bcbd0ff check INT_MIN also 2023-01-04 13:42:55 -06:00
mjn-mixael 9a8d5cde53 disallow overly large input 2023-01-04 09:08:58 -06:00
mjn-mixael efc5a370d5 better error message 2023-01-04 08:22:05 -06:00
mjn-mixael 4760bc7e2b Move this into the main loop 2023-01-04 08:14:24 -06:00
mjn-mixael 9c167b279d throw in -gmp.tbm as optional match to -aip.tbm 2023-01-03 21:25:59 -06:00
mjn-mixael 1884e4c4d1 allow gameplay_profiles.tbl to be an alias of ai_profiles.tbl 2023-01-03 21:21:37 -06:00
Goober5000 a7b46dba58 Merge pull request #5060 from MjnMixael/fix_mainhall_anims
SCPUI needs to be able run game_close_level
2023-01-03 21:23:38 -05:00
mjn-mixael cc079aedfa clearer warning message 2023-01-03 20:01:45 -06:00
mjn-mixael f3937a8f68 only run the check if the mission is a dogfight mission 2023-01-03 19:59:52 -06:00
mjn-mixael 1f7cdca5a9 optional 2023-01-03 19:56:56 -06:00
mjn-mixael d36a95962f warn if dogfight mission doesn't have dogfight weapons 2023-01-03 19:55:34 -06:00
Goober5000 d2eff1f141 Merge pull request #5073 from Goober5000/fixed_chain_repeat
restore retail behavior of chaining to repeating events
2023-01-03 19:03:33 -05:00
Goober5000 9ce7748c20 Merge pull request #5039 from Goober5000/object_iteration_fixes
more robust object iteration
2023-01-03 19:03:22 -05:00
mjn-mixael c74d523e18 third attempt at getting past that one guy 2023-01-03 14:52:55 -06:00
mjn-mixael 0bc26cab24 Revert "make sure game time is running in the mainhall"
This reverts commit 155e043bb0.
2023-01-03 08:37:06 -06:00
Goober5000 0d56bb9999 restore retail behavior of chaining to repeating events
To avoid changing behavior of existing mods, simulate the retail behavior unless the bugfix is explicitly activated.  The buggy retail behavior is to evaluate a chained event, not skip it, if the event is repeating, regardless of whether the repeat timestamp has elapsed.
2023-01-03 01:37:18 -05:00
Goober5000 f2fa235522 Merge pull request #5058 from Goober5000/missile_obj_list_iteration
add should-be-dead checks for missile and asteroid iterations
2023-01-02 14:19:03 -05:00
Goober5000 7829989478 Merge pull request #5070 from MjnMixael/fix_ingame_joystick
Make sure all 4 in-game joystick options get evaluated
2023-01-02 01:12:43 -05:00
mjn-mixael a8e411d310 Make sure all 4 ingame joystick options get evaluated 2023-01-01 23:30:50 -06:00
mjn-mixael 8cf7796809 Pass shortcut key character to Lua as a hook variable 2023-01-01 18:04:05 -06:00
Goober5000 07924f078a use Missile_obj_list or Asteroid_obj_list instead of obj_used_list where appropriate 2023-01-01 18:13:29 -05:00
Goober5000 782980844b add checks to Missile_obj_list and Asteroid_obj_list 2023-01-01 18:13:29 -05:00
Goober5000 c95865442e Merge pull request #5065 from notimaginative/fix_joystick_loops
swap loop order to fix joystick detection issue
2023-01-01 18:00:35 -05:00
Goober5000 f484ddef06 Merge pull request #5066 from notimaginative/fix_joyid_problem
use correct joystick id type (instance -> device)
2023-01-01 18:00:26 -05:00
JohnAFernandez 0c687f37c1 Merge pull request #5062 from Baezon/team-color-split-ships
Ensure 'split ships' are team colored
2022-12-31 23:24:56 -05:00
Goober5000 6de5c96127 add should-be-dead checks for object iterations (#5050)
Follow-up to #5040.  This extends the checks to most iterations over `obj_used_list` in FSO.  There are a few exceptions such as `waypoint_add` and `waypoint_remove`, plus a few others.  And none of the object iterations in FRED have the guard because FRED does not use the same object life cycle as FSO.
2022-12-31 23:23:39 -05:00
Taylor Richards 083984efec add support for .vpc extension on VP archives (#5067)
.vpc is identical to existing .vp except that it is allowed to
contain compressed files. This allows builds and tooling to know
that although the archive itself is retail compatible, it's content
may require special handling.

Simply rename your existing .vp to .vpc to indicate that it may
use compressed files. Existing tools can be updated to be able to
handle the compressed content within.

Although not recommended, the same archive can exist as both .vp
and .vpc for maximum compatibility. Both archives will be indexed
but the content of the .vpc will have priority.
2022-12-31 18:58:28 -05:00
Taylor Richards 9346f67d5c use correct joystick id type (instance -> device)
fixes #4793
2022-12-30 21:57:10 -05:00
Taylor Richards d2322cb2c2 swap loop order to fix joystick detection issue
fixes #4792
2022-12-30 21:48:34 -05:00
Asteroth 96f2a3b045 ensure split ships are team colored 2022-12-30 00:45:03 -05:00
Goober5000 e2e14bb6df Merge pull request #5059 from Baezon/team-color-change-pobjp
Check for parse object before team color change
2022-12-29 14:37:04 -05:00
mjn-mixael 155e043bb0 make sure game time is running in the mainhall 2022-12-29 11:01:43 -06:00
Asteroth ef721b3192 check for parse object 2022-12-29 03:27:38 -05:00
Goober5000 06ded501c8 Merge pull request #5056 from Goober5000/comment_tweak
comment tweak
2022-12-29 01:08:51 -05:00
Goober5000 9540caff5a Merge pull request #5057 from MageKing17/bugfix/use-universal-textifying
Use `textify_scancode_universal()` in more places.
2022-12-29 00:07:48 -05:00
MageKing17 3eacbc0e0b Use textify_scancode_universal() in more places.
Controls6 (PR #4133) changed `textify_scancode()` to be more l10n-aware, and added `textify_scancode_universal()` to continue serving the function of providing the values expected by scripts. Except there was one `textify_scancode()` call in the scripting system that wasn't changed, and it also wasn't used in FRED (for providing values for the `OPF_KEYPRESS` argument type, as used with `key-pressed`). This commit fixes both of these oversights, which *should* mean that all instances where a script or mission file needs to reference a keypress now use the same strings as before controls6.
2022-12-28 18:03:07 -08:00
Goober5000 a2d4576c4f comment tweak
Add a useful summary to the comment about event timestamps.
2022-12-28 17:34:15 -05:00
Fabian WoltermannandFabian Woltermann c727e40b8a apply the HDR colorspace stuff _after_ mixing in the team color glows (#5052)
Co-authored-by: Fabian Woltermann <[email protected]>
2022-12-28 18:48:20 +01:00
Goober5000 78b385e41b Merge pull request #5051 from Goober5000/wing_fix_and_error_checks
fix wing cues and add some more error checks
2022-12-27 15:30:34 -05:00
Goober5000 5485efe904 fix wing cues and add some more error checks
Fixes #5045 by correctly initializing wing arrival and departure cues.  Follow-up to #4856.  Also adds a bit more SEXP error checking.
2022-12-27 01:33:53 -05:00
Goober5000 85bb14898f Merge pull request #5040 from Goober5000/ship_obj_list_iteration
add should-be-dead checks for all ship iterations
2022-12-26 22:28:00 -05:00
MjnMixael a3bbf13da6 prevent access to goals outside the vector (#5044)
prevent access to goals outside the vector
2022-12-24 21:12:56 -05:00
JohnAFernandez 10d3bdda06 Merge pull request #5041 from MjnMixael/consolidate_tech_rendering
consolidation of tech rendering methods
2022-12-24 11:59:12 -05:00
Goober5000 dd93284777 Merge pull request #5043 from Baezon/no-pobjp-crash-fix
Fix a crash in `change_ship_type`
2022-12-23 13:14:06 -05:00
Goober5000 d6bb97d8f2 address feedback 2022-12-23 02:11:54 -05:00
Goober5000 46293ad0fe add should-be-dead checks for all ship iterations
When iterating through `Ship_obj_list`, check the `Should_be_dead` flag before using the object.  This fixes #4990 and adds defense-in-depth checks to guard against similar errors elsewhere.

I considered moving the `Ship_obj_list` removal from `obj_delete` to `ship_cleanup`, but decided it would be prudent to avoid fundamental changes to lifecycle management.
2022-12-23 00:51:31 -05:00
mjn-mixael 8aa4a86e1c set shadow override 2022-12-22 07:02:10 -06:00
Asteroth ca7618c993 check for if a ship has a parse object first 2022-12-22 04:02:43 -05:00
mjn-mixael fc21e12dfd A few missed items and fixes to the asteroid debris sexp 2022-12-21 21:11:14 -06:00
mjn-mixael a662f8168c consolidation of tech rendering methods 2022-12-21 20:45:40 -06:00
Goober5000 c2b93549a2 more robust object iteration
When iterating through various object collections, check for the should-be-dead flag to avoid returning objects that are on the verge of being deleted.

Separately, this adds the `isExpiring` function to check for should-be-dead objects.

This PR also makes object iteration consistent across all object types, both to reduce code duplication and to ensure that the length and iteration are done using the same algorithm.  Furthermore, if the number of should-be-dead objects is nonzero, the Lua array count for that frame will be different from the internal array count for that frame.

Fixes #5034.
2022-12-21 19:51:02 -05:00
Goober5000 32852c967e Merge pull request #5037 from Goober5000/hud_lock_iteration_fix
patch hud-lock iteration for objects that aren't ships
2022-12-21 12:44:46 -05:00
Goober5000 342373e2a1 Merge pull request #5038 from Goober5000/patch_hud_target_live_turret
patch some crash vulnerabilities in hud_target_live_turret
2022-12-21 12:43:59 -05:00
Goober5000 1070d1dbea patch hud-lock iteration for objects that aren't ships
Add a few more safety checks; don't assume every item is a ship.
2022-12-21 00:40:09 -05:00
Goober5000 6cf6b3266f patch some crash vulnerabilities in hud_target_live_turret
These checks risked causing a crash or memory access violation if they were ever encountered with an invalid target when `auto_advance` is true.
2022-12-20 20:40:43 -05:00
mjn-mixael 3b3a45d2d8 fix documentation 2022-12-20 16:07:52 -06:00
mjn-mixael 9f1c00c581 allow scripts to read LuaEnums and add LuaEnums 2022-12-20 15:53:40 -06:00
Asteroth f464b30089 update regen rates and autoaim fov on ship class change (#5029) 2022-12-21 00:17:23 +09:00
Asteroth 0fb6b2ae0d Update 22.4 version references to 23.0 (#5025)
* update references to 22.4 to 23.0

* fix a few more version references
2022-12-21 00:16:51 +09:00
Fabian Woltermann 18c182acc8 script hooks must be declared within global_hooks so that both FRED and FSO can see them (#5031) 2022-12-20 11:55:36 +01:00
Taylor Richards c9291e3f1c address issues related to cf.openFile() error handling (#5030)
- fix crash bug when path only contains dir separators
 - fix error handling when no path is specified in write mode
 - clarify function documentation

Fixes #5028
2022-12-20 01:27:51 -05:00
Goober5000 00f0cc4847 Merge pull request #5027 from Goober5000/comm_menu_open
add hu.isCommMenuOpen
2022-12-19 20:33:04 -05:00
Tyler Blount 2f8e10b8d8 Merge pull request #5024 from scp-fs2open/fix/CI-POST-result-status
Change check of POST response result
2022-12-18 20:35:01 -07:00
Tyler Blount 0acb22456c Respecify the env for Post Builds auto-trigger 2022-12-18 14:15:04 -07:00
Tyler Blount 22c8ae024e Change check of POST response result
This modified the check as `text` has been changed in the Requests API. In order to make the code compatible with the JSON result, we check `resp.status_code` instead.
2022-12-18 13:53:32 -07:00
Tyler Blount 5857b569a1 Merge pull request #5023 from scp-fs2open/fix/build-post-23.0-RC1
Fix failure to post Mac builds to forums
2022-12-18 11:31:26 -07:00
Tyler Blount 9136c04a34 Fix failure to post Mac builds to forums
Also includes replacement of string literals with constants to reduce maintenance overhead in the event the name of a group changes.
2022-12-18 10:22:31 -07:00
Fabian WoltermannandFabian Woltermann 87926995df Feature/dear imgui (#4987)
* Add imgui

* migrate render options

* remove wmcgui

* Add subsystem selection and highlighting

* Add a syntactic sugar extension for imgui

* don't rebuild the mission list every frame

* Add imgui_sugar extension

* Move helper functions out of lab_ui, add function to display consolidated table text for object

* add button to export cubemap

* fix entering and exiting the lab

* refactor some of this for greater cleanness

* use techroom lighting when no mission background is set

* minor things

* add imguizmo

* add imguizmo

* Add imgui

* migrate render options

* remove wmcgui

* Add subsystem selection and highlighting

* Add a syntactic sugar extension for imgui

* don't rebuild the mission list every frame

* Move helper functions out of lab_ui, add function to display consolidated table text for object

* add button to export cubemap

* fix entering and exiting the lab

* refactor some of this for greater cleanness

* minor things

* add imguizmo

* add imguizmo

* Add button to reset changes made in the render dialog

* refactoring

* unfuck rebase

* fix issue with loose mission files

* use with_CollapsingHeader for greater uniformity

* add weapon selection functionality

* make primaries and secondaries fire again

* implement animation triggers

* avoid crash when switching back and forth between ships with and without team colors

* add control to set team color setting to renderer texture dialog

* make sure the table text updates when the ship class changes

* let rotating subsystems rotate

* do not add imgui.h to pstypes

* code cleanup

* add subsys highlighter from fred

* Highlight non-modelled subsystems as well

* add cmdline flag to show the imgui demo dialogue

* fix compiler warnings reported by CI

* fix error when building the subsystem list

* refactor variable/method naming

* code cleanup

* remove vestigial code

* update to imgui 1.89.1

* add credits entry for imgui

* use the imgui namespace

* Separate the background dialog out into its own window

* make sure the subsystem highlights are placed correctly

Co-authored-by: Fabian Woltermann <[email protected]>
2022-12-18 16:29:20 +01:00
Goober5000 87a051a933 Merge branch 'master' into more_category_updates 2022-12-18 01:31:47 -05:00
BMagnu 66becc983e Fix OnBeamCollision oversight (#5021) 2022-12-18 01:04:59 +00:00
Goober5000 47564d1505 Merge pull request #5008 from MjnMixael/asteroid_sexp_error_checks
Add missing asteroid debris argument type error checking
2022-12-16 23:04:13 -05:00
Goober5000 7022ba191a ci stuff 2022-12-16 23:03:27 -05:00
Goober5000 4572aa1bc1 Merge pull request #5004 from JohnAFernandez/fix-use-of-incorrect-variables
Use the correct variables in this function
2022-12-16 22:58:59 -05:00
Goober5000 d36db98974 Merge pull request #5014 from MjnMixael/fix_render_tech_model
Do not include -destroyed subobjects in renderTechModel
2022-12-16 22:58:48 -05:00
Goober5000 a822d2ad60 Merge pull request #5016 from Goober5000/navpoint_fixes
initialize NavPoint properly
2022-12-16 22:58:41 -05:00
Goober5000 e3fc5f8bc1 add hu.isCommMenuOpen
A script function to tell if the comms menu is open
2022-12-16 22:20:52 -05:00
Goober5000 8d672bddb3 change SEXP_SRC_* to enum class 2022-12-16 22:10:22 -05:00
Goober5000 dc281a56f8 change SEXP_MODE_* to enum class 2022-12-16 19:45:05 -05:00
Goober5000 7b0a8eff9e change REF_TYPE_* to enum class 2022-12-16 19:41:45 -05:00
Fabian Woltermann 386e068890 Merge pull request #5015 from The-E/fix/old_ai_weapon_link_copypasta
fix vintage copypasta bug
2022-12-16 21:09:50 +01:00
Goober5000 5a674a7db1 initialize NavPoint properly
Initialize NavPoint values any time a NavPoint object is created, not just when the `clear()` function is run.
2022-12-16 12:59:53 -05:00
Fabian Woltermann 5984be99b6 fix vintage copypasta bug 2022-12-16 18:35:52 +01:00
mjn-mixael 84962ff33c Remove model instances after rendering 2022-12-16 09:39:11 -06:00
mjn-mixael 3136e0debf Use a model instance to prevent rendering destroyed subobjects 2022-12-16 09:31:19 -06:00
Goober5000 7318221e6a Merge pull request #5002 from Goober5000/beam_team
beam teams
2022-12-15 17:46:26 -05:00
Goober5000 c3477e88a7 beam teams
Add a Team virtvar to beam objects in Lua.
2022-12-15 15:44:54 -05:00
MjnMixael f1f27b21b7 Use define 2022-12-15 10:52:58 -06:00
Goober5000 52455bbc62 Merge pull request #5009 from MjnMixael/dynamic_sexp_enum
Dynamic sexp enum
2022-12-15 11:31:49 -05:00
mjn-mixael 25a4f66451 missed items 2022-12-15 01:01:10 -06:00
mjn-mixael e0eb7ef3d6 this should have a more unique name 2022-12-14 22:49:41 -06:00
mjn-mixael 2909e8fa2b address feedback 2022-12-14 22:32:51 -06:00
mjn-mixael a47658b336 address feedback 2022-12-14 15:41:36 -06:00
mjn-mixael 42a88a9e3f Comment 2022-12-14 13:54:17 -06:00
mjn-mixael 174976d2bb Better global name 2022-12-14 13:52:50 -06:00
mjn-mixael 911639d1b0 Add missing asteroid debris argument type error checking 2022-12-14 13:46:40 -06:00
mjn-mixael 5366f235ca Allow custom Lua Enums 2022-12-14 13:45:14 -06:00
Fabian Woltermann 76b301b4f1 Merge pull request #5007 from The-E/fix/5006_ssm_struct_not_initialized
Fix an issue with ssms sending uninitialized messages
2022-12-14 17:04:46 +01:00
mjn-mixael 49b486a326 use enum for list types 2022-12-14 09:12:11 -06:00
Fabian Woltermann c39861a600 When parsing an ssm, make sure to only use a custom message when one is actually defined 2022-12-14 15:18:05 +01:00
John Fernandez bb42302ba3 Use the correct variables in this function 2022-12-13 21:47:10 -05:00
Goober5000 d722f50f8b more category updates
1. Allow categories, not just subcategories, to be added by scripted SEXPs.
2. Allow subcategories in different categories to have the same name.
2022-12-13 21:16:26 -05:00
Goober5000 29217cc2aa Merge pull request #5000 from Baezon/playdead-player-turrets
Allow player turrets to fire despite play dead
2022-12-13 19:15:53 -05:00
BMagnu 385478824e Fix refactor bug (#5001) 2022-12-13 20:56:48 +00:00
Asteroth b0c6d81d89 ship_move_subsystems too 2022-12-13 15:38:21 -05:00
Asteroth 5d66f3108f allow player turrets to fire despite play dead 2022-12-13 15:02:08 -05:00
Goober5000 922be2ff36 Merge pull request #4999 from BMagnu/problematic_counter_lib
Remove problematic counter library
2022-12-13 13:52:52 -05:00
BMagnu af1f0eaeca Rework Script Conditions (#4960)
* add skeleton for hook condition API

* Begin Scripting Hook refactor

* Program Hook Conditions for current new-style hooks

* Replace more hooks

* Fully transition global hooks

* Convert legacy hooks pt. 1

* Convert legacy hooks pt. 2

* Convert legacy hooks pt. 3

* Post-conversion cleanup

* restore parsing

* Add Documentation and fix parsing

* Fixup engine ingame hook adding

* Fixup engine ingame hook adding again

* Fix warnings

* Fix GCC unqualified template base lookup

* unqualified lookup v2

* Virtual Destrcutors

* Fix Clang

* Fix ship objp hook condition shadow

* Remove global hook include in ship.h

* Incorporate Feedback

* Incorporate Feedback 2

* Add revision to inline version specififer
2022-12-14 03:51:27 +09:00
Birk Magnussen 6b3f99eafd comment for OP_NOT_AN_OP 2022-12-13 18:43:01 +01:00
Birk Magnussen cb008706a4 Tidy up comment 2022-12-13 18:37:08 +01:00
Birk Magnussen 9366963e42 Fix formatting 2022-12-13 18:32:27 +01:00
Birk Magnussen 7ed7b37f9a Replace enum in switch for readability purposes 2022-12-13 18:25:26 +01:00
Birk Magnussen a62a9cd5e0 Remove enum type name for safery 2022-12-13 18:21:32 +01:00
BMagnu 80b75352bf Respect First OP 2022-12-13 16:10:45 +01:00
BMagnu c58216f9c3 Remove Counter library 2022-12-13 16:04:55 +01:00
Goober5000 f40a018785 Merge pull request #4996 from MageKing17/bugfix/let-vc-2017-compile-again
Add missing locale argument to `std::isdigit()` calls.
2022-12-12 15:21:00 -05:00
JohnAFernandez cf9bfb8939 Merge pull request #4997 from Goober5000/subcategory_fixes
subcategory fixes and followup
2022-12-12 12:32:55 -05:00
Goober5000 74db049f85 subcategory fixes and followup
Several items here:
1. Patches several category and subcategory validation checks (comparisons to -1 rather than _NONE) that were missed in #4965.
2. Adds sanity checks to both built-in operators and scripted sexps to ensure categories and subcategories are consistent.
3. Deconflicts several built-in sexps that had inconsistent categories.

The inconsistent operators were:
* script-eval-string
* set-wing-formation
* get-ets-value
* turret-get-primary-ammo
* turret-get-secondary-ammo
* get-fov

Follow-up to #4965 and #4995.
2022-12-12 00:08:21 -05:00
MageKing17 7fde659b42 Add missing locale argument to std::isdigit() calls.
Much like a previous instance (fixed in #3281, although the function in question was later removed), `std::isdigit()` without a locale argument prevents MSVC 2017 from compiling FSO.
2022-12-11 20:11:42 -08:00
EatThePath 780ab89b61 Merge pull request #4995 from Goober5000/fix_4994
fix subcategory comparison
2022-12-11 22:04:52 -06:00
Goober5000 afbdd39bde fix subcategory comparison
Empty subcategories are now OP_SUBCATEGORY_NONE, not -1.  Fixes #4994.

Also fixes a cast warning in missionparse.cpp.
2022-12-11 22:27:47 -05:00
JohnAFernandez 6e159345d8 Merge pull request #4993 from MjnMixael/fix_passive_arc_iterator
fix passive arc iteration
2022-12-11 19:41:34 -05:00
MjnMixael a421d38455 Asteroid/Debris cleanup + Modular asteroids table (#4870)
* set-asteroid-field sexp

* errors

* scope

* set-debris-field sexp

* Clarify sexp documentation

* num_debris_sizes

* allow any order and activate display name feature

* unify naming scheme

* modular -ast.tbm

* styling

* decouple sexp parsing and asteroid field creation methods

* remove this

* fix merge oversights

* Remove this check

* reorder

* use scp_string instead

* spacing

* Only setup display name if it's empty

* Use define instead of magic numbers

* Ensure asteroid types get the correct spawn weight

* Warn if spawn weight is set for asteroid type

* typo

* Correctly handle asteroid split types

* iiiiiiiiiiiiiiiiiint

* address feedback
2022-12-11 19:29:23 -05:00
mjn-mixael c69bc1e395 fix passive arc iteration 2022-12-11 18:04:42 -06:00
Goober5000 e89a661210 Merge pull request #4992 from Goober5000/fix_4991
fix crash in ship_close_cockpit_displays
2022-12-10 22:20:32 -05:00
Goober5000 1e834010e0 fix crash in ship_close_cockpit_displays
This function can be called when `shipp` is null, so check for that.

Fixes #4991.
2022-12-10 21:37:28 -05:00
Goober5000 4b172c0ca9 Merge pull request #4965 from Goober5000/sexp_category_bump
SEXP operators, categories, and subcategories refactoring
2022-12-10 15:18:53 -05:00
Asteroth eb3b7544b5 ensure animations load first if available (#4986) 2022-12-10 08:45:21 -05:00
Goober5000 207540303f multi version bump for new SEXP operator IDs 2022-12-09 14:44:30 -05:00
Goober5000 89ed5be8c7 Merge pull request #4875 from Goober5000/dynamic_events
dynamic events and goals
2022-12-09 13:53:54 -05:00
Goober5000 57395a772a address feedback 2022-12-09 13:47:23 -05:00
Goober5000 e179caa339 add defaults to switch blocks 2022-12-09 13:47:23 -05:00
Goober5000 621593c39f convert categories, subcategories, and operator IDs 2022-12-09 13:47:23 -05:00
Goober5000 da66b8c08c use enum for sexp error check 2022-12-09 13:47:23 -05:00
Goober5000 ffed86e8a0 typesafe oswpt_type 2022-12-09 13:47:23 -05:00
Goober5000 719148beaa typesafe sexp_oper_type 2022-12-09 13:47:23 -05:00
Goober5000 1a487473d7 MAX_OPERATORS is no longer used 2022-12-09 13:47:23 -05:00
Goober5000 eddca6bdf0 Merge pull request #4961 from Goober5000/support_ship_cleanup
clean up support ship mode in all cases
2022-12-09 13:14:45 -05:00
Goober5000 226e956fcc dynamic events and goals
Make events and goals dynamic in missions and campaigns.  When parsing, initialize all fields to their defaults.
2022-12-09 13:10:39 -05:00
Goober5000 a88ccb69e7 Merge pull request #4963 from Goober5000/messageq_enhancement
make message queue dynamic
2022-12-09 11:03:54 -05:00
Goober5000 10bdf5c03b Address feedback 2022-12-08 21:53:10 -05:00
Goober5000 12cbf9ab61 make message queue dynamic
Use a vector for storing the message queue so it can be whatever size the mission needs.

As part of this, add `free` and `vm_free` deleters to be usable with `unique_ptr` and enhance `insertion_sort` to be usable with vectors.

Fixes #4959.
2022-12-08 21:53:10 -05:00
Goober5000 6496b97d21 Merge pull request #4985 from Goober5000/disable_qt_again
try disabling Qt builds
2022-12-08 21:50:33 -05:00
Goober5000 721680cb60 try disabling Qt builds
Per the example in #3160, disable Qt builds for the time being.
2022-12-08 19:54:46 -05:00
Goober5000 c4cf9edd41 Merge pull request #4983 from Goober5000/wing_formation_script_2
exposes wing formation via scripting
2022-12-08 13:32:15 -05:00
Goober5000 7f22137bc3 exposes wing formation via scripting
A rework of #4980, adding a wing formation type and a way to access them via `tb.WingFormations`.
2022-12-08 12:02:33 -05:00
Goober5000 fd77eba855 Merge pull request #4975 from Goober5000/sendMessage_enhancement
enhance sendMessage to allow messages sent from ships
2022-12-07 20:46:06 -05:00
MjnMixael e72e90b9cc Only set the colors for passive lightning (#4982) 2022-12-07 22:39:46 +00:00
MjnMixael 6d070c88b7 clean traitor.tbl parsing (#4949) 2022-12-07 17:29:05 -05:00
BMagnu 57f529e902 Fix edge case bugs with moveables in combination with special polymodels being animated (#4981) 2022-12-07 20:43:36 +00:00
MjnMixael a51b2750aa pre parse icons to get an accurate count (#4925)
* pre parse icons to get an accurate count

* static

* Some code clarity
2022-12-07 11:00:03 -05:00
MjnMixael fce04d5907 do correct math at parse (#4979) 2022-12-07 15:40:19 +00:00
wookieejedi 07a21a607a Mod Table Settings for Arc Widths (#4967)
* Mod Table Settings for Arc Widths

There is currently a way to set the color of EMP and Damage Arcs in game_settings.tbl, but no way to change the width.

This PR adds options useful to modders to set the width and how it is calculated. Looking over the code and asking around, I developed these exposed options.

The options also allow modders to control the arc widths in multiple ways. For example, if you want to set a constant width for all ships you would set the `+Do Not Use Width Multiplier Over Radius:` to something huge, and if you wanted no arcs ever you would set the `+Width Default:` to 0.

They are tested and work as expected.

* clang

* fix copy paste error from #2053

* tab cleanup

* whitespace cleanup 2

* same for type ship and damage
2022-12-07 07:24:05 -05:00
wookieejedi 3f21ba4d17 Expose decal options useful for modders (#4957)
* Fixes CTD with decals on dying ships

If a ship was getting shot with weapons that used decals, the decal code would hit an assertation, because the invalid decals were not being all removed.

This PR updates the decal cleanup loop, to ensure that no decals are missed and all invalid ones are removed. Tests confirm this fixes the issue.

Also cleaned up some comments and moved another assertation before setting of variables.

* Exposes modder useful options to decals

Now that decals are very stable, this PR exposes two options that are very useful for using decals, a random range for the radius along with the option to have a random rotation when the decal is created.

Tested and everything works as expected.

* add script ability to toggle decals

* properly use set arg not func

* fix two minor things in decal shader

* one more cleanup line

* fixes
2022-12-07 07:23:57 -05:00
Goober5000 0c49b09fd7 Merge pull request #4977 from Goober5000/set_formation
add changeable formation flying
2022-12-07 00:38:10 -05:00
Goober5000 e824caeea3 add changeable formation flying
Add a SEXP to change the formation and formation scale on-the-fly.
2022-12-06 23:16:54 -05:00
Goober5000 0211f44df9 Merge pull request #4973 from MjnMixael/fix_custom_data
Fix custom data when using tbms
2022-12-06 22:53:15 -05:00
Goober5000 823566244f Merge pull request #4953 from Baezon/fullneb-background-bgs
Add mission flag to show bg bitmaps despite fullneb
2022-12-06 22:52:51 -05:00
Goober5000 0e80428d48 Merge pull request #4946 from MjnMixael/per_weapon_autoaim
per weapon auto aim feature
2022-12-06 22:52:14 -05:00
Goober5000 ab3eb196b9 Merge pull request #4976 from Goober5000/fix_player_cheat_check
move player-is-cheating to the correct category
2022-12-06 22:06:08 -05:00
MjnMixael bc3da4fed7 custom colors for passive lightning (#4969)
* custom colors for passive lightning

* initialize member variables and apparently this can't be nullptr

* Small bugfix
2022-12-06 19:57:16 -05:00
Goober5000 ed06a424e2 move player-is-cheating to the correct category 2022-12-06 19:25:19 -05:00
Goober5000 bb3b3b7b13 Merge pull request #4974 from MjnMixael/remove_at_symbol
move @ removal up
2022-12-06 18:54:29 -05:00
Goober5000 affb402ee7 Merge pull request #4972 from Goober5000/mission_do_departure_cleanup
clean up mission_do_departure
2022-12-06 18:52:58 -05:00
Goober5000 7ac37d45c3 enhance sendMessage to allow messages sent from ships
Allow `mn.sendMessage` to send from a ship source, not only a string source, by allowing the ship object to be specified as the first argument.  Also add `ship:sendMessage` which is a more streamlined version of the same thing.
2022-12-06 16:40:00 -05:00
mjn-mixael b3b349a2f0 three lines for this short comment is silly 2022-12-06 12:50:35 -06:00
mjn-mixael 2988aa8fc8 move @ removal up 2022-12-06 12:43:33 -06:00
mjn-mixael 4d84e4c2a0 Make sure custom_data is properly cleared or carried over when shipclass info is reset or cloned/moved 2022-12-06 09:48:33 -06:00
Goober5000 d9dfceb279 clean up mission_do_departure
Since `mission_do_departure` can be called for multiple frames in a row, make sure that certain things run only once.
2022-12-05 22:00:51 -05:00
Goober5000 9dfb36962c Merge pull request #4971 from Goober5000/fix_cockpit_ctd
fix a crash when the Knossos explodes in A Flaming Sword
2022-12-05 21:45:26 -05:00
Goober5000 c634e64f27 fix a crash when the Knossos explodes in A Flaming Sword
The ship being accessed here is the viewer object, not the loop iterator.

Follow-up to #4936.
2022-12-05 19:56:48 -05:00
mjn-mixael 662d5f743a address feedback 2022-12-05 09:59:06 -06:00
BMagnu fb223c1dbe Properly init cockpit_model_instance to -1 (#4966) 2022-12-05 15:32:09 +00:00
BMagnu 5bb869953e Animate More Things (#4936)
* Add Cockpit AnimSet

* Add Skybox Animset

* Add cockpit model instanc

* Render ship cockpit with instance

* Finish scripting API

* Add moveables

* Fix Typo

* Fix moveable table value get

* Fix copy paste error

* Add Cockpit AnimSet

* Add Skybox Animset

* Add cockpit model instanc

* Render ship cockpit with instance

* Finish scripting API

* Add moveables

* Fix Typo

* Fix moveable table value get

* Fix copy paste error

* Add Animation Scripting Handle

* Add proper saving of skybox anim triggers

* Properly step non-obj animations

* Incorporate feedback

* Incorporate feedback

* Fix comparison
2022-12-05 10:00:29 +09:00
Goober5000 97614517a2 Merge pull request #4962 from Goober5000/set_weapon_protecc
add some additional weapon checks
2022-12-04 15:17:49 -05:00
Goober5000 0a29a74bc8 Merge pull request #4964 from Goober5000/squadron_wing_name_fix
fix wing name matching
2022-12-04 15:07:11 -05:00
MjnMixael 7c695eebd0 Allow setting glowpoint light intensity (#4955) 2022-12-05 04:56:06 +09:00
Goober5000 8f6e6e97f5 fix wing name matching
The logic designed to match Epsilon and Epsilon#clone would be tripped up by Pi and Pisces.  Tweak the string matching to handle this.

Fixes a bug reported on the forums: https://www.hard-light.net/forums/index.php?topic=98576.0
2022-12-04 14:06:56 -05:00
Goober5000 9c9ca3bcd6 remove unneeded function prototypes 2022-12-04 00:25:14 -05:00
MjnMixael bdea3d53c0 set-asteroid-field and set-debris-field sexps (#4860)
* set-asteroid-field sexp

* errors

* scope

* set-debris-field sexp

* Clarify sexp documentation

* num_debris_sizes

* styling

* decouple sexp parsing and asteroid field creation methods
2022-12-03 22:10:50 -05:00
Goober5000 360dcd4e1e add some additional weapon checks
Enhance set-primary-weapon and set-secondary-weapon to check the validity of the weapon bank and weapon type.
2022-12-03 20:34:15 -05:00
Goober5000 5a9136a5c2 clean up support ship mode in all cases
Whether a ship is a support ship or its target, and whether it is destroyed or vanished, its repair/rearm mode should be cleaned up in a consistent way.  This fixes a bug in Series Resurrecta where calling `ship-vanish` on a support ship put things into a broken state.
2022-12-03 20:06:32 -05:00
Goober5000 9fbcd71442 Merge pull request #4948 from Goober5000/isMouseButtonDownCount
add mouseButtonDownCount and flushMouse
2022-12-02 11:03:57 -05:00
Goober5000 7e337944f0 Merge pull request #4943 from EatThePath/better-dynsexp-error
Improved error message for missing sexp action
2022-12-01 21:25:24 -05:00
wookieejedi 31e55f4d12 Fixes CTD with decals on dying ships (#4956)
If a ship was getting shot with weapons that used decals, the decal code would hit an assertation, because the invalid decals were not being all removed.

This PR updates the decal cleanup loop, to ensure that no decals are missed and all invalid ones are removed. Tests confirm this fixes the issue.

Also cleaned up some comments and moved another assertation before setting of variables.
2022-12-01 14:18:46 -05:00
Goober5000 398cf2f8c3 add flushMouse 2022-11-30 23:36:14 -05:00
Goober5000 028ee9ec23 deprecate isMouseButtonDown and add mouseButtonDownCount
Implements #4429.
2022-11-30 22:04:48 -05:00
Goober5000 5b1f668e6f Merge pull request #4954 from Goober5000/patch_event_timestamps
fix event status evaluation for repeating events
2022-11-30 19:41:19 -05:00
Goober5000 08626aeecf fred2 support 2022-11-30 00:46:40 -05:00
Goober5000 42fba1c7f2 fix event status evaluation for repeating events
Two situations in the event timestamp life cycle, chain delays and event status delays, require accommodation for the timestamp-plus-interval case described in `mission_process_event()`.  Commit 06fc8c73 applied the fix for chain delays; this applies the same fix to event status delays.

Follow-up to #4633.  Fixes #4951.
2022-11-29 23:42:55 -05:00
Asteroth 3ed90e2b89 Add Fullneb_background_bitmaps mission flag 2022-11-29 23:00:39 -05:00
mjn-mixael 9e2aa0377f per weapon auto aim feature 2022-11-28 14:19:00 -06:00
Kiloku 4106176aab Cheat framework allowing for custom cheats, sexp for cheat used and On Cheat lua hook (#4387)
* Add SpawnShipCheat and convert Bravos spawning to it

* Clean-up and add canUseCheat() check

* Move some stuff to parent CustomCheat class

* Add cheat-used SEXP and On Cheat scripting hook

* Add cheat tbls and tbms, fix custom cheat detection, move cheat hooks to global hooks

* Add a default virtual destructor to CustomCheats for its derived classes to use

* Initialize buffers with memset so clang will calm down, also move cheat check a bit to keep old cheats

* Attempt to appease MSVC

* Clean-up and formatting

* Ensure custom cheats fit in the cheat code buffer

* Fix a merge mistake

* Move pre-set cheat to embedded cheats table

* Use appropriate types for stuff_string

* Remove unnecessary copying of the cheat buffer

* Explicit nullchecking

* Avoid copying values for initializing CustomCheat

* move cheat checking function to cheats_table.h, fix a typo

* Clarify OP_USED_CHEAT sexp description

* Remove unnecessary casting

* Use list initalization for Ship Cheats

* Move a few method definitions from the .h to .cpp

* Change buffer to const char*
2022-11-29 01:30:54 +09:00
Goober5000 ea93f29654 Merge pull request #4916 from Goober5000/fix_3849
guard against unknown variables
2022-11-27 22:50:34 -05:00
Goober5000 dbd1c027e8 Merge pull request #4944 from Goober5000/fix_fotg_ctd
fix crash on mission load
2022-11-27 17:10:49 -05:00
Goober5000 77fc5150c7 fix crash on mission load
Some subsystems will not have submodel instances, so make sure their velocities are not reset.  Fixes a crash in FotG.
2022-11-27 15:23:04 -05:00
Goober5000 027f109f9f Merge pull request #4929 from Goober5000/supplemental_autoscaling_fix
fix the rest of the autoscaled attributes
2022-11-27 14:37:22 -05:00
Goober5000 1b744a6ae1 Merge pull request #4932 from Goober5000/fix_event_dragging
make sexp_tree dragging more user-friendly
2022-11-27 14:37:07 -05:00
David Gibson 125e1e26bf Improved error message for missing sexp action 2022-11-27 13:28:50 -06:00
Taylor Richards 20dcdb2904 use case-insensitive comparison of cfile pathtypes (#4942)
fixes #4941
2022-11-27 13:37:32 -05:00
Taylor Richards 0be895d8bd add proper support of subfolders to lua listFiles (#4940)
Also updates function description to be more accurate and
document filter format for subfolder searches.

fixes #4939
2022-11-27 11:53:10 -05:00
BMagnu f76048b269 Enhance OnDialogX Hooks to encompass Death Popups (#4938)
* Add Scripting hooks to death popups

* Fix type

* cleanup
2022-11-27 19:01:50 +09:00
Goober5000 18150673c3 Merge pull request #4934 from Goober5000/ai_play_dead_fix
don't process turrets or subsystems when playing dead
2022-11-26 12:41:53 -05:00
BMagnu 5034855d4d Check if Texture is valid first (#4937) 2022-11-27 02:28:46 +09:00
Goober5000 1d5c802a9c handle speeds when removing play-dead 2022-11-25 12:20:45 -05:00
Goober5000 35380e8e24 don't process turrets or subsystems when playing dead
In the submodel reorganization in commit 575c050da4, subobject movement was moved out of the AI pipeline, which inadvertently removed the play-dead check that prevents subsystem movement.  This broke a few missions such as Scroll's 'Thor's Hammer'.  This PR restores the check.

Fixes #4933.
2022-11-25 11:35:13 -05:00
MjnMixael 649b513481 Modular bolts (#4880)
* better types and initialize objects with reasonable values

* modular -ltng.tbm

* fixes

* remove warning on no glow being defined

* do not error in FRED since the above code won't load the texture in FRED
2022-11-25 03:35:57 -05:00
Goober5000 cb7c760255 make sexp_tree dragging more user-friendly
FREDders expect events (and goals and campaign links) to land where you drag them.  So when dragging items earlier in the list, insert them before the item they are dropped on.
2022-11-24 20:55:18 -05:00
Goober5000 412cd8a993 Merge pull request #4931 from Goober5000/fix_warnings
fix two warnings
2022-11-24 16:43:33 -05:00
wookieejedi 1c45a18d9b Add Option to allow weapons that hit player to place per-weapon sound (#4921)
* Add Option to allow weapons that hit player to place per-weapon sound

Weapons that lasers or missiles that hit the player also play a hard coded sound, which is not ideal when trying to give valuable audio feedback to player.

This PR allows modders to stop the behavior and have the weapon class impact sound specified in the weapons table play instead of the hard coded sounds.

Tested and works as expected.

* add per class shockwave and weapon sounds

* naming update
2022-11-24 17:03:05 +00:00
MjnMixael 0af43628ad add set-order-allowed-for-target sexp (#4884) 2022-11-23 22:28:52 -05:00
Goober5000 8d8cdd9206 fix two warnings
`warning C4305: 'argument': truncation from 'double' to 'float'`
2022-11-23 22:25:51 -05:00
Goober5000 23a48ed9a8 Merge pull request #4927 from Goober5000/no_fred_weapons
add no_fred flag for weapons, and patch no_fred for ships
2022-11-23 21:43:28 -05:00
Goober5000 261e37d047 Merge pull request #4928 from Goober5000/options_tweaks
style tweaks for recently added options
2022-11-23 21:43:06 -05:00
BMagnu 67d0fb3dce Add 'Dont stop running sounds' (#4924) 2022-11-23 16:43:52 +09:00
Goober5000 c40764b65c add no_fred flag for weapons, and patch no_fred for ships
The new `no_fred` flag prevents weapons from being listed in the dropdown lists in the weapon dialog.  Also this fixes `no_fred` ships to not appear either: previously they were hidden in the main window dropdown but still appeared in the ship editor.

In order to vastly simplify the dropdown list code, the weapon dialog was refactored to use arrays of variables rather than one hardcoded variable per bank.

Implements #3643.
2022-11-22 21:30:25 -05:00
Goober5000 77be140a45 fix the rest of the autoscaled attributes
PR #4516 did not cover all of the autoscaled AI class attributes, since a few of them were labeled differently.  This adds checks to grab the correct autoscale index for the remaining cases:

```
$Afterburner Use Factor:
$Shockwave Evade Chances Per Second:
$Get Away Chance:
$Secondary Range Multiplier:
```

Fortunately, Sushi's investigation was pretty thorough.  Between these remaining cases and @EatThePath's autoscaling review, this PR should cover the complete set of autoscaling situations.

Fixes #4922.
2022-11-22 21:18:34 -05:00
Goober5000 89fb43b83d style tweaks for recently added options
1. Since Discord is both a common noun and a proper noun, capitalize it here to clarify what it refers to.
2. Capitalize the first letter of the Hotkey internal variable to follow the global variable convention.  And might as well clarify, while we're at it, that it hides hidden ships, not all ships.
2022-11-22 19:53:13 -05:00
Asteroth 13a08371cf fix an oversight from gravity changes (#4926) 2022-11-22 16:05:39 -05:00
Asteroth 732f1bdcbe Fix strange warp glow sizing (#4244)
* fix warp glow sizing

* whoops
2022-11-22 11:07:24 -05:00
EatThePath 8e560a0ba4 More old dead shader override code that isn't hooked to anything anymore. (#4861) 2022-11-22 11:06:51 -05:00
EatThePath 406c28d871 Add yaml file defining build options for vscode cmake tools users. (#4858) 2022-11-22 11:06:34 -05:00
Taylor Richards c9374ec6fb add text-to-speech support for macOS (#4914)
* add text-to-speech support for macOS

* only add Obj-C langs on mac

* move obj-c file to apple-specific block
2022-11-22 11:05:13 -05:00
Taylor Richards 072e1123d9 avoid playing voice messages with aux effects (EFX) (#4923) 2022-11-22 11:04:13 -05:00
Goober5000 e402af803b fix full ship list selection in FRED (#4919) 2022-11-21 20:15:44 -05:00
Asteroth 219bcca23a Implement gravity (#4803)
Adds gravity! Applies on a per-mission basis, and weapons, ships, debris, and asteroids now have a configurable "gravity const" which multiplies the effect of gravity on them, by default everything except debris is 0 (meaning no effect even when the mission has gravity). AI and the lead indicator will also lead for ballistic trajectories as well, given a gravity-affected weapon. No FRED support or gravity direction control yet, to come in later PRs.
2022-11-21 20:13:35 -05:00
Strygon 91eb48c5b8 Setting up Vampirism again... again (#4911)
* Setting up Vampirism again
2022-11-20 17:07:27 -05:00
MjnMixael d0fea8e14c option to always hide hidden hotkey ships (#4877) 2022-11-20 17:04:22 -05:00
John Fernandez d29ead20f6 optional feedback 2022-11-20 17:03:20 -05:00
John Fernandez 760a91376c Fix a warning
We shouldn't be checking that the `cci_h` is valid by seeing if it is greater than -1 because by that point it never will be.  Instead, we should be checking that the incoming id is valid and setting to the invalid state if it is not.
2022-11-20 17:03:20 -05:00
Goober5000 cf7919aef6 fix crash when changing ship classes in FRED (#4917)
PR #4908 had a small bug that caused a crash in FRED.  The code in question is only needed and only relevant when changing ship classes in-mission.
2022-11-20 21:56:43 +00:00
JohnAFernandez 2b6058d6f4 Adjust ssssssssssi in one more place (#4913)
* Fix crashes with sssi

We need to init in both places to avoid purging goals before ssi is set.

* Make sure we adjust for the wingp->special_ship--

Make sure we adjust sssi on ship death
2022-11-20 09:11:40 -05:00
Goober5000 7693138f56 also qtfred 2022-11-19 20:48:48 -05:00
Goober5000 d06e5ee627 guard against unknown variables
If a variable can't be found, fail gracefully instead of Asserting.  These changes will allow the mission to be saved and/or loaded, and will also allow the user to open the Event Editor and replace the nonexistent variable.  This fixes the crash/assertion failure in #3849, as well as the case where the variable is edited in the mission file.
2022-11-19 20:43:02 -05:00
Goober5000 5eddd06f44 Merge pull request #4915 from Goober5000/4878_followup
fix a copy+paste error
2022-11-19 20:23:59 -05:00
Goober5000 e62c148c53 fix a copy+paste error
This was accidentally introduced in #4878.
2022-11-19 18:54:39 -05:00
Goober5000 bfa498b378 Merge pull request #4898 from MjnMixael/force_sensor_static_sexp
hud-force-sensor-static sexp
2022-11-18 21:52:25 -05:00
Goober5000 ecb78479ce Merge pull request #4910 from MjnMixael/generate_script_name
allow getting message names in script generation
2022-11-18 21:51:55 -05:00
Goober5000 70b8a8e81e Merge pull request #4885 from Goober5000/fred_campaign_path
fix campaign loading in FRED
2022-11-18 21:49:57 -05:00
mjn-mixael 4e6ff9c355 allow getting message names in script generation 2022-11-18 11:06:34 -06:00
MjnMixael 2811e56d39 setup callsign and altname fields to use the full 31 characters allowed (#4905)
* setup callsign and altname fields to use the full 31 characters allowed

* no magic numbers
2022-11-18 10:06:09 -05:00
John Fernandez cd67d8ac6a Move the assertion.
This is just a much simpler and cleaner version of the same check.
2022-11-17 19:45:29 -05:00
MjnMixael 735b41631d ship flag to exempt it from targeting restrictions (#4878)
* ship flag to exempt it from nebula targeting restrictions

* Make this flag more generic

* address feedback
2022-11-17 07:38:37 -05:00
JohnAFernandezandGoober5000 203c5a04f6 Add special ship info index (#4908)
* Add special_ship_ship_info_index

* Change the wing's sssii if it's the wing leader

* Ignominious Lack of P

* Update code/ai/aigoals.cpp

Co-authored-by: Goober5000 <[email protected]>

* Update code/ai/aigoals.cpp

fix indentation

Co-authored-by: Goober5000 <[email protected]>
2022-11-17 05:46:13 +00:00
Goober5000 6918993994 Merge pull request #4907 from Goober5000/reanimate_textures
by default, start texture animation at the beginning of a mission
2022-11-16 23:46:53 -05:00
Goober5000 22782333c9 by default, start texture animation at the beginning of a mission
For all POFs that use animated textures, if no starting timestamp is specified, assume animation started at the beginning of the mission.  This fixes a bug reported in Starfox: Event Horizon where weapon POF animated textures stopped animating after the texture timestamp upgrade.
2022-11-16 22:50:04 -05:00
MjnMixael 727b3dc5c2 check nebula and poof bitmaps at parse time (#4895) 2022-11-16 10:47:00 -05:00
MjnMixael 76392de698 Fix overhead style (#4893)
* move initialization of overhead style

* Still need to init these colors for scpui
2022-11-16 07:37:58 -05:00
EatThePath d848adc1cf hook up cone light profile values (#4900) 2022-11-16 07:37:15 -05:00
wookieejedi 493158174a Fix Flashlights (#4902)
Area_normalisation term in deferred shader was not getting set properly for cone lights, which caused things like ship headlights to not work properly.

Tested and fixes issue as expected. Thanks to Qaz and EatThePath for pointing out how to fix it!
2022-11-16 07:36:48 -05:00
mjn-mixael 786b4b74f1 missed one 2022-11-15 21:29:04 -06:00
mjn-mixael 1f311adf13 hud init and better variable name 2022-11-15 20:20:20 -06:00
Goober5000 bd062d155e Merge pull request #4892 from MjnMixael/resize_fred_briefing
Increase default Briefing window size and allow custom setting
2022-11-15 20:53:15 -05:00
Goober5000 98a3c64cc8 fix campaign loading in FRED
Load campaigns using the full path provided by the user, not just from the configured mod paths.

Also tweaks initialization based on the campaign having already been cleared in `mission_campaign_clear()`.
2022-11-15 20:40:33 -05:00
JohnAFernandez 6255b9b154 Make sure that we check the correct instance (#4897) 2022-11-15 12:02:55 -05:00
mjn-mixael 2e42f9f215 hud-force-sensor-static sexp 2022-11-15 10:44:30 -06:00
Taylor Richards 3e57da1681 add support for subfolders to cfile (#4771)
* add subfolder support to cfile

* sort files in VP archives before indexing them

* fix indexing of sub-subfolders

* remove unused 8B22K & 16B11K sound path types

* add more items to skip subfolder scanning

* fix windows build issues

* fix unit tests by allowing 0-byte files to be indexed

* fix file indexing on windows

* add test for cfile subfolders

* remove specific 'markup' and 'css' interface subfolders

They aren't directly referenced anywhere by pathtype and the new
subfolder code will continue to index and load files from them

* add player binds to list of always-root locations

* remove file-based localization support

An alternative is left in place for old fonts, as that was the only place
it appeared to be used.

This method of file localization conflicts with subfolder support however
so if it's needed in the future then changes to the subfolder code will
be necessary.

* add subfolder support to cf_find_file_location_ext()

* add subfolder tests for cf_find_file_location*()

* add shlwapi to needed win32 libs

* small bit of cleanup

* add subfolder support to cf_get_file_list()

* add tests for cfile subfolder lists

* report files that might be shadowed

* fix issue with lists when a filter is used

Also fixes discrepancy in older cf_get_file_list() when a sub path
is specified (should be used in all cases, not just glob).

* address review suggestions
2022-11-15 08:00:13 -05:00
BMagnu f2f53b718d Actually assign enum value for constants (#4896) 2022-11-15 15:28:47 +09:00
Goober5000 dbf94acf02 Merge pull request #4881 from Goober5000/fred_swap_fix
fix swapping of things in FRED
2022-11-14 14:37:35 -05:00
JohnAFernandez 8712e69130 Merge pull request #4836 from JohnAFernandez/Fix-in-Game-Joining-Backup
Fix in game joining
2022-11-14 11:14:40 -05:00
JohnAFernandez 0d27a0f086 Enable client turrets to track targets (#4791)
* Enable clients to move turrets

This allows clients to user server data to move turrets according to the timing and target data on the server.  Uses a small packet to do so.
2022-11-14 15:58:41 +00:00
Goober5000 b9896ea611 Merge pull request #4890 from Goober5000/fix_wing_leader_check
fix wing leader check
2022-11-14 10:43:00 -05:00
John FernandezandTaylor Richards 11d571ed43 Fix a few other crash fixes that still existed
Co-Authored-By: Taylor Richards <[email protected]>
2022-11-14 10:30:28 -05:00
John FernandezandTaylor Richards 206ca742ab Further Fixes from Taylor
These fix up the in-game confirm packet and help sync client and server through a few timing fixes.

Co-Authored-By: Taylor Richards <[email protected]>
2022-11-14 10:30:28 -05:00
JohnAFernandezandBMagnu c89bc89cdc Use Lafiel's Fix
Fixes a check that object flags did not exceed ubyte size * 8.

Co-authored-by: BMagnu <[email protected]>
2022-11-14 10:30:28 -05:00
John Fernandez 4b26d38534 Fix mistake And Add lock clearing for multilock 2022-11-14 10:30:28 -05:00
John Fernandez bd79cc9a7a Buttress error reporting
fix
2022-11-14 10:30:28 -05:00
John FernandezandTaylor Richards 79c3571d2f Deny in-game Join for SW games
Because these are competitive games, we cannot allow in-game joining.

Co-Authored-By: Taylor Richards <[email protected]>
2022-11-14 10:30:28 -05:00
John Fernandez 2365174b55 Use tabs here 2022-11-14 10:30:28 -05:00
John Fernandezandwookieejedi 32b1e563bb Fix from Wookie for Joining more than once
Make sure that in game joiners adjust their time more than once.

Co-Authored-By: wookieejedi <[email protected]>
2022-11-14 10:30:28 -05:00
John Fernandez f8de460b75 Fix ships not moving
Revert "Fix ships not moving"

This reverts commit e989ad440009a20c1d0b1957ff0f10cc856d8fea.

Update multi_ingame.cpp
2022-11-14 10:30:28 -05:00
John Fernandez ba665bfc9d Attempt to adjust timing for in-game joiners
This allows in game joiners to avoid interpolation and physics bugs by using the first incoming timing from the server as its local missiontime.
2022-11-14 10:30:28 -05:00
JohnAFernandez 4e8203a066 Patch in-game joining crashes
Patches multiple things about in-game joining to allow it to be enabled by default.
2022-11-14 10:30:27 -05:00
BMagnu bd2c50aa1d Refactor Lua Enums (#4867)
* Refactor bitfield enums

* Add default case for lua switch

* Add default case for more lua switches

* Fix Warnings

* constexpr
2022-11-14 17:31:50 +09:00
JohnAFernandezandTaylor Richards d50a599934 Taylor's in-game fixes
Co-Authored-By: Taylor Richards <[email protected]>
2022-11-13 20:32:42 -05:00
Goober5000 9d898cb585 Merge pull request #4891 from Goober5000/cannot_perform_scan_flag
add cannot-perform-scan flag
2022-11-13 18:41:59 -05:00
Goober5000 b6d3065876 Merge pull request #4888 from Goober5000/fix_animated_textures
use correct math for animated textures
2022-11-13 16:14:01 -05:00
Goober5000 b2f5ea9065 Merge pull request #4764 from MjnMixael/3d_select_settings
3d select settings
2022-11-13 16:13:17 -05:00
mjn-mixael 495872e8fa ordering 2022-11-13 15:08:39 -06:00
MjnMixael 760cc543b7 replace keybinds in debriefing (#4876) 2022-11-13 16:05:14 -05:00
mjn-mixael abec56ee05 use a single variable array 2022-11-13 14:46:53 -06:00
mjn-mixael bab0752af2 increase default window size and allow custom setting 2022-11-13 10:31:16 -06:00
Goober5000 320ebd4762 add cannot-perform-scan flag
Prevents the player from performing a cargo or subsystem scan.  Can be toggled using alter-ship-flag.
2022-11-13 00:37:56 -05:00
Goober5000 48cd9b2989 fix wing leader check
The `special ship` field stores the index in the wing's `ship_index` array.  It does not store the shipnum itself.
2022-11-12 18:43:41 -05:00
Goober5000 e22112e0a9 use correct math for animated textures
Fixes #4887.  Follow-up to #4704.
2022-11-12 14:11:11 -05:00
Asteroth e85fabf671 bugfix arg order (#4882) 2022-11-11 23:06:42 -05:00
Goober5000 51f50132d2 Merge pull request #4886 from MageKing17/bugfix/make-sound-environment-sexp-errors-recoverable
Make sound environment SEXP errors recoverable.
2022-11-11 23:00:21 -05:00
MageKing17 6ef8028794 Make sound environment SEXP errors recoverable.
Adds `SEXP_CHECK_INVALID_SOUND_ENVIRONMENT` and `SEXP_CHECK_INVALID_SOUND_ENVIRONMENT_OPTION` to `sexp_recoverable_error()`. Neither causes a fatal problem, and the former can be spuriously triggered if EFX is disabled.
2022-11-11 16:40:01 -08:00
MjnMixael b5328a81c2 increase object limits (#4849) 2022-11-11 12:54:54 -05:00
EatThePath 63a0c9bdb9 Merge pull request #4883 from Goober5000/ai_profiles_bump
bump MAX_AI_PROFILES
2022-11-11 11:03:29 -06:00
Goober5000 2b3c533d09 bump MAX_AI_PROFILES
Previous limit lasted from 2005-11-21 until now (from commit b33caf6f45).  We'll see how long this one lasts.
2022-11-11 00:41:14 -05:00
Goober5000 351aed432f Merge pull request #4866 from Goober5000/formation_enhancements
add wing formation align button
2022-11-10 22:13:28 -05:00
MjnMixael 3367b5739f Fix poof name parsing and fix lab not knowing about the new parsing (#4879)
* Fix poof name parsing and fix lab not knowing about the new parsing

* address feedback
2022-11-10 21:40:26 -05:00
Goober5000 bd50aadf5c fix swapping of things in FRED
This properly updates event and goal signatures when events are moved around.  Fixes Mantis bugs 1005, 1961, and 2998.
2022-11-10 15:47:20 -05:00
mjn-mixael 3e87c3f54e not needed 2022-11-09 10:12:31 -06:00
mjn-mixael 35e6bc9df0 setup overhead style as a type enum 2022-11-09 09:16:57 -06:00
Goober5000 8ddbad645b Merge pull request #4874 from Goober5000/fix_path_masks
use correct path masks for parse objects
2022-11-08 23:48:00 -05:00
Goober5000 1736c9b230 use correct path masks for parse objects
Parse objects have their path masks temporarily set to -1 during parsing, since at that point the mask represents an index, not a bitfield.  In all other cases, the path mask defaults to 0.

Fixes #4873.
2022-11-08 23:14:10 -05:00
Goober5000 0b2dc58d5a add formation scale 2022-11-08 22:52:38 -05:00
Goober5000 94358c20e9 add wing formation align button
This button allows wings to be arranged in their formation so that they don't scramble around when they arrive.
2022-11-08 22:48:31 -05:00
Goober5000 2fba619a67 Merge pull request #4865 from Goober5000/clean_up_old_fields
clean up some obsolete fields
2022-11-08 22:37:53 -05:00
Goober5000 2984f21999 Merge pull request #4872 from Goober5000/init_ship_for_lab
fix lab CTD
2022-11-08 17:26:45 -05:00
Goober5000 f823a8dc62 fix lab CTD 2022-11-08 15:19:09 -05:00
MjnMixael 415924bbbd Fix num comparison for FS2 medals (#4869)
* Fix num comparison for FS2 medals

* works better if you get the proper position
2022-11-08 14:42:22 -05:00
Goober5000 e8fdfa5513 clean up some obsolete fields
Remove `behavior`, `type`, and `wing`, which are either unused or redundant.
2022-11-07 22:43:50 -05:00
Goober5000 0721792b93 Merge pull request #4856 from Goober5000/clear_mission_refactor
refactor mission initialization
2022-11-07 21:46:56 -05:00
Goober5000 5ab63a8ec9 use the clear-wing function when creating a wing in fred 2022-11-07 20:41:54 -05:00
Goober5000 21751a8a58 Merge pull request #4863 from Goober5000/lua_is_docked
add numDocked and isDocked
2022-11-07 20:29:26 -05:00
Goober5000 d43be3eba4 Merge pull request #4868 from Goober5000/decal_parse_fix
fix decal debug warnings in FRED
2022-11-07 14:23:03 -05:00
Goober5000 e64d6a062e fix decal debug warnings in FRED
Prevent warnings from being displayed due to decals not being loaded.
2022-11-07 11:19:00 -05:00
EatThePath f3601d8178 Merge pull request #4826 from MjnMixael/optional_discord_presence
Optional discord presence
2022-11-07 08:59:30 -06:00
MjnMixael 1ba0b8dcbe Modular medals (#4851)
* Modular medals table

* Remove Num_medals completely

* Handle badges out of order and allow setting of masks to handle mask indecies out of order

* const const const

* qtFRED

* address feedback
2022-11-07 22:53:28 +09:00
MjnMixael 26269e10bf toggle-asteroid-field sexp (#4857) 2022-11-07 22:52:52 +09:00
MjnMixael 6e1b194c38 Modular iff table (#4845)
* split up init, parsing, and data resolution

* modular iff table

* address feedback
2022-11-07 22:52:44 +09:00
Goober5000 7c26c19671 add numDocked and isDocked
Two useful script functions.
2022-11-06 16:19:45 -05:00
Goober5000 4ace4f6d5a nebula fix 2022-11-06 11:27:18 -05:00
Goober5000 1ec38ff71a parse object stuff 2022-11-06 11:27:18 -05:00
Goober5000 b48d2faa80 wing stuff 2022-11-06 11:27:18 -05:00
Goober5000 00acefea86 some fixes 2022-11-06 11:27:18 -05:00
Goober5000 cce4be4bfb refactor mission initialization
Gather all the mission initialization code into a common function for clarity and ease of expansion.  Previously, the various parsing routines contained initialization as well as parsing.  As a bonus, quite a few redundant initializations are streamlined.
2022-11-06 11:27:18 -05:00
Goober5000 f873a6fc99 Merge pull request #4862 from Goober5000/check_sexp_syntax_fix
improve SEXP syntax checking
2022-11-06 11:25:39 -05:00
Asteroth 2777e45a95 Add isMultipart and getModelFlag functions on subsystems (#4846)
* add `getModelFlag` function

* add ismultipartturret function

* fix

* fix link
2022-11-06 23:59:54 +09:00
Asteroth 924013b521 add burst shots and delay to scripts (#4847) 2022-11-06 23:59:34 +09:00
Goober5000 b44f9f6125 improve SEXP syntax checking
When the top-level operator of a SEXP is not found, flag the error instead of crashing.  This is helpful for missions that contain unsupported scripted SEXPs.

Also be sure to set the bad node in the event of a NONOP_ARGS syntax error.
2022-11-06 05:09:40 -05:00
EatThePath aef869aa2a Merge pull request #4859 from EatThePath/fix-loadout-flicker
always set the default gloss uniform since it is now always used
2022-11-05 14:07:05 -05:00
Asteroth 18d3c01576 Allow overriding gvec in fireWeapon on subsystems (#4852)
* allow for overriding of gvec

* update docs

* fix docs
2022-11-05 14:13:01 -04:00
David Gibson 830fed0bdc always set the default gloss uniform since it is now always used. Fixes flickering issue 2022-11-05 11:16:51 -05:00
MjnMixael bff3d433e2 properly get badge name (#4853) 2022-11-05 10:01:44 -04:00
Asteroth f5fe1c5d65 small fix for turret fire pos in beam-fire (#4848) 2022-11-04 19:16:40 -04:00
EatThePath e371032e5e Merge pull request #4850 from qazwsxal/shader_geom_fix
Minor lighting shader fixes
2022-11-03 22:58:01 -05:00
JohnAFernandez 595d63c001 Merge pull request #4841 from JohnAFernandez/Add-check-to-Escort-list-in-multi
Make sure that the escort list only lists valid targets on multi
2022-11-03 12:24:43 -04:00
EatThePath 06fc2c81f9 Shader/Material cleanup pass (#4838)
* Ripping out the gloss override code because it's vestigial

* Remove redundant teammask declaration.

* The NORMAL_ALPHA shader feature appears both useless and unusable.
Consequently, I'm removing it.
2022-11-02 17:19:54 -04:00
Adam Leach 8ec89751bb Use the correct k value for geometry term. Actually use area_norm 2022-11-02 16:32:54 +00:00
BMagnu d85c1431a4 libRocket Texture Passthrough (#4822)
* Properly handle lua texture refcounting

* Add linkTexture ui method

* Incorporate feedback
2022-11-02 18:25:22 +09:00
MjnMixael bd151095b3 implement modular nebula.tbl (#4834)
* implement modular nebula.tbl

* Address feedback and skip > 32 poofs

* read/write nebula poofs by name

* qtfred changes

* variable name

* log -> warning

* nullptr and make sure to only set bitmap_name when it's actually defined
2022-11-02 18:25:13 +09:00
Goober5000 7e8e28e6e8 Merge pull request #4844 from Goober5000/timestamp_compare_fix
fix timestamp_in_between functions
2022-11-01 14:33:58 -04:00
MjnMixael e6ef239ae6 Modular tips (#4843)
* vectorize tips

* make tips.tbl extendable with -tip.tbm
2022-11-01 21:46:22 +09:00
Goober5000 5f54188e5b add a few scripting dock functions (#4839)
* add a few scripting dock functions

Add setDocked, setUndocked, and jettison.

* address feedback
2022-11-01 21:45:49 +09:00
Asteroth a29378d245 Clearable Ship/Subsystem Targets via script (#4842)
* make sure Targets can be cleared with `nil`

* move `set_targeted_subsys` calls
2022-11-01 21:43:26 +09:00
MjnMixael 346817f3d0 Further limit what built-in UI elements can be setup when using SCPUI (#4824)
* Further limit what built-in UI elements can be setup when using SCPUI

* remove superfluous declaration
2022-11-01 21:43:14 +09:00
MjnMixael f0ecf8c2aa allow borrowing flyby sounds from a previously parsed species (#4828) 2022-11-01 21:43:01 +09:00
Goober5000 a86074e3cd fix timestamp_in_between functions
Fix the comparison and add documentation to the compare functions.
2022-11-01 01:10:59 -04:00
MjnMixael 0b9f0f25c9 Dont add whitespace for no_fred ships in the main list (#4833)
* Dont add whitespace for no_fred ships in the main list

* whitespace and better variable name

* fix comparisons
2022-10-31 18:45:21 +09:00
Asteroth 7d800e48ae Add $On Camera Set Up hook (#4832)
* add on camera set up hook

* typo
2022-10-31 03:28:48 -04:00
John Fernandez a00a7a7f26 Make sure that the escort list
Only lists valid targets on multi
2022-10-30 20:52:30 -04:00
Goober5000 874e22b8e1 Merge pull request #4831 from Goober5000/new_autoscale
take non-autoscaling AI classes into account when autoscaling
2022-10-30 00:05:34 -04:00
JohnAFernandez 18c1abb14f Merge pull request #4825 from MjnMixael/full_int3_fix
remove misplaced int3() and allow the game to continue with -1
2022-10-29 16:30:27 -04:00
JohnAFernandez 6cd217589b Merge pull request #4490 from JohnAFernandez/fix-traitors-multilocking-each-other
Allow multilock between traitors
2022-10-29 16:16:08 -04:00
Goober5000 0e477367ef Merge pull request #4827 from Goober5000/asteroid_target_init
asteroid field fix/refactor
2022-10-27 19:54:20 -04:00
BMagnu 8a3a99ccbd UI Popup Scripting Hook (#4806)
* Add Popup Init Hook

* Finish popup hooks

* Fix warnings

* Fix fallthrough

* feedback
2022-10-27 16:23:23 +09:00
MjnMixael 291f4f68ea Allow adding custom head anis to the list in FRED (#4818) 2022-10-27 16:22:49 +09:00
EatThePath 7a9a33d16c These old vars did something once, but not anymore (#4823) 2022-10-27 16:22:36 +09:00
Goober5000 1b0dd83c27 type safety 2022-10-26 21:07:44 -04:00
Goober5000 b42831b981 take non-autoscaling AI classes into account when autoscaling
This adds an AI profiles flag that filters autoscaling so that only the index and number of autoscaled classes are considered, not the index and number of all AI classes.

Fixes #4516.
2022-10-26 21:02:59 -04:00
Goober5000 e8bbb97f96 add clarifying comment 2022-10-26 20:42:03 -04:00
Goober5000 0a9032fc03 asteroid field fix/refactor
Some refactoring with asteroid fields:
1. Moves asteroid throwing targets into the Asteroid_field struct, in anticipation of potentially multiple fields in the future
2. Moves some initialization code into `asteroid_level_init`
3. Calls `asteroid_level_init` when a mission is cleared
4. Loads asteroid targets as part of the asteroid field update/init logic.  This fixes a FRED bug reported in Discord where asteroid targets stay in the dialog when a new mission is loaded
5. Remove `Default_asteroid_throwing_behavior` flag as it is equivalent to checking that the target list is empty
2022-10-26 19:16:08 -04:00
mjn-mixael 8bc5723d43 create mod.tbl and built-in option to enable or disable discord presence 2022-10-26 14:13:53 -05:00
mjn-mixael 37022fa5c2 Setup discord presence to be able to be toggled 2022-10-26 14:12:58 -05:00
mjn-mixael f4f223908c remove misplaced int3() and allow the game to continue with a value of -1 2022-10-26 10:13:48 -05:00
Goober5000 f07c4481ff Merge pull request #4820 from Goober5000/lua_type_check_cleanup
clean up stack when checking type
2022-10-25 09:43:34 -04:00
Goober5000 e6b9ff7361 Merge pull request #4704 from Goober5000/texture_timestamp
upgrade texture animation code to use new timestamps
2022-10-24 23:49:42 -04:00
MjnMixael b3c900803e translate key tokens in tips (#4808) 2022-10-24 16:51:08 -04:00
Goober5000 fdbdcec2b1 clean up stack when checking type
The `ade_odata_is_userdata_type` function didn't clean up its stack properly, as it left type information there for error reporting.  But there are other reasons to check userdata types besides error reporting, so this adds a flag to clean up in most situations.

Fix courtesy of @BMagnu.
2022-10-24 11:09:52 -04:00
MjnMixael 9d122616dd Update credits (#4799)
* add self and naomi to SCP credits

* Add EatThePath, Kiloku, and Lafiel as well
2022-10-24 10:36:32 -04:00
EatThePath f8e99e6012 Actually dynamically populate the empty debug filter files (#4817)
* Actually dynamically populate the default debug filters properly for empty files, rather than just enable everything.

* whitespace shuffle
2022-10-24 18:37:11 +09:00
BMagnu 2116d1fe66 Modular POF Features (#4713)
* Add turret copying

* Ad addturret parsing

* Fix gun_nr error

* Fix strncpy_s

* Fix strings better

* Cleanup submodel / turret copying

* Add 'Add Engine'

* Add Glowpoints, add Special Subsys

* Remember to keep the glowpoint texture

* Fix unused param
2022-10-24 18:35:51 +09:00
Goober5000 1cc027666e Merge pull request #4814 from Goober5000/fix_debris_crash
handle debris model instances correctly when shadows are enabled
2022-10-23 15:04:17 -04:00
Goober5000 fde3589d1d handle debris model instances correctly when shadows are enabled
Fixes #4813.
2022-10-23 14:13:08 -04:00
BMagnu 2080824a20 Can has high rez plz k thx bye (#4805) 2022-10-22 18:47:58 +09:00
Goober5000 11b37bbeae Merge pull request #4787 from Goober5000/createdebris
create debris using script functions
2022-10-21 23:24:47 -04:00
Goober5000 41074956a8 more fixes 2022-10-21 12:01:25 -04:00
MjnMixael c63ce5de8c Allow writing to player mission specific stats (#4801)
* Allow writing to player mission specific stats

* Documentation

* return false
2022-10-21 20:25:35 +09:00
MjnMixael 17e42e92cf cockpitinactive gauges should render in chase view (#4804)
* cockpitinactive gauges should render in chase view

* Simplify
2022-10-21 20:25:24 +09:00
Goober5000 debedf26ef partial fix 2022-10-20 23:32:30 -04:00
MjnMixael 90c4316a5e Update scpui documentation (#4802)
* Update documentation

* Typo
2022-10-20 19:13:03 +09:00
Goober5000 9782f191b9 Merge pull request #4789 from Goober5000/timestamps_3
music and training message timestamp conversion
2022-10-19 20:02:47 -04:00
Goober5000 49fb2f07c0 refactor per feedback, tweak to fix circular #include, use accessor, reorder, fix namespaces, fix API documentation 2022-10-19 14:44:57 -04:00
Goober5000 f24277c39e make clang happy 2022-10-19 14:22:10 -04:00
Goober5000 452c8370dc model instances are not needed for debris in many cases 2022-10-19 14:22:10 -04:00
Goober5000 77179dc183 add mn.createDebris
This is a new Lua API function that allows creation of arbitrary debris pieces, whether chunks of a ship's hull or shards of shrapnel.  All of the parameters are optional, and a wide variety of situations are possible ranging from vaporized bits to static chunks to chunks propelled by an explosion.
2022-10-19 14:22:10 -04:00
Goober5000 d37a446894 music and training message timestamp conversion 2022-10-19 14:11:23 -04:00
MjnMixael 7a5b840338 Allow setting an override wireframe color globally and add option to set target monitor style and wireframe color per gauge (#4786) 2022-10-19 21:51:35 +09:00
MjnMixael 50cd91bd86 Damage, swarm, corkscrew info virtvars (#4798)
* Add access to damage type, swarm, and corkscrew data

* Also return if the weapons have the appropriate flags

* Return nil for invalid handle and clarify documentation
2022-10-19 21:51:22 +09:00
MjnMixael 00c8b946a4 Modular species table (#4775)
* Add modular ability to add intel entries

* Allow for +nocreate in modular tables

* Allow intel.tbl as an alias of species.tbl

* Additional error checking and remove tests that are no longer required

* const
2022-10-19 21:51:15 +09:00
Asteroth 4c6f043274 Add a bunch of movement stats to ship class script api (#4797)
* add a bunch of script physics values

* fix

* small doc fix (its just called "damp" barely worth mentioning)
2022-10-18 20:54:30 -04:00
MjnMixael 307c770c58 Enable hud rearm timer in hud_gauges.tbl (#4777)
* Enable hud rearm timer in hud_gauges.tbl

* Comment
2022-10-18 22:21:51 +09:00
JohnAFernandez bd0e6bb990 Add an update interval for client update packets (#4796) 2022-10-18 21:54:16 +09:00
MjnMixael 0a6729b03d enable target info in hud_gauges.tbl (#4778)
* enable target info in hud_gauges.tbl

* Comment
2022-10-18 17:08:44 +09:00
Fabian Woltermann 9e56ba43a5 Merge pull request #4783 from MjnMixael/render_no_lighting
Allow option to choose to render with no lighting
2022-10-17 19:30:40 +02:00
Fabian Woltermann f76e110c87 Merge pull request #4795 from The-E/fix/4794_bump_max_instance_depth
Bump the MAX_INSTANCE_DEPTH constant to 32
2022-10-17 19:30:08 +02:00
Fabian Woltermann a8328a8ee7 bumps the MAX_INSTANCE_DEPTH constant to 32.
This bump should be sufficient to cover complex animation states. This fixes #4794
2022-10-17 18:59:51 +02:00
mjn-mixael 6464900fa1 Fully deprecate -ship_choice_3d and -weapon_choice_3d 2022-10-17 09:58:48 -05:00
mjn-mixael 64bd233c49 API to access the new 3d select settings in game_settings.tbl 2022-10-17 09:58:15 -05:00
mjn-mixael 2d4d886a6a Add Game Settings options for 3d ship and weapon select 2022-10-17 09:58:15 -05:00
mjn-mixael 32b059ae07 fix documentation 2022-10-17 08:09:26 -05:00
mjn-mixael 1af0a1082b int to bool 2022-10-17 08:04:02 -05:00
Goober5000 f34294cf95 Merge pull request #4788 from Goober5000/force_arrival_for_reinforcements
fix makeShipArrive and makeWingArrive for reinforcements
2022-10-17 01:16:56 -04:00
wookieejedi 5d60e56614 Update $POF file Techroom: Usage (#4785)
* Update `$POF file Techroom:` Usage

Currently `$POF file Techroom:` is only used in the weapons loadout screen (despite having techroom in the name). This PR expands the use of the `$POF file Techroom:` to shiploadout select and the actual techroom.

If it is desired I can put it behind a game settings flag, but IMO it would make the most sense for modders to have this just work as the actual name implies.

* clean up code with feedback

* typo fix in comment
2022-10-15 21:12:19 -04:00
wookieejedi 4d581e92e8 1 Line fix for player view render check (#4790)
Fix for recent updates to cockpit rendering check, which was false if the player was the only ship in a mission. `instance >0` was used but it is supposed to be `instance >= 0` (The object index is valid if larger or equal to 0, while the signature is only valid equal or larger to 1.) Tested and fix works as expected.
2022-10-15 21:59:14 +00:00
Goober5000 3d515ddfb7 upgrade texture animation code to use new timestamps
Timestamp changes for texture animation, both on ships and on the skybox.
2022-10-15 12:24:05 -04:00
Goober5000 9161601cac Merge pull request #4780 from Goober5000/alter_ship_flag_listing
prevent duplicate flag names in the alter-ship-flag list
2022-10-15 11:53:29 -04:00
MjnMixael 09a307b17d Virtvar to access the energy a weapon consumes (#4784)
* Virtvar to access the energy a weapon consumes

* quick fix
2022-10-15 09:54:44 -04:00
Goober5000 848d133fe3 Merge pull request #4767 from Goober5000/enhanced_print
enhance ba.print and add ba.println
2022-10-14 21:40:11 -04:00
Goober5000 8f8a6ca527 warning tweak 2022-10-14 21:08:47 -04:00
Goober5000 a2af63726e fix makeShipArrive and makeWingArrive for reinforcements
The script functions should make the ships/wings arrive even if they are reinforcement, so this PR fixes that.  Also, this PR adds some additional verification of the `num_uses` of reinforcements, especially when the player calls for a wing that is already present but has more uses remaining.
2022-10-14 20:44:39 -04:00
JohnAFernandez 8ea13a2b49 Merge pull request #4773 from MjnMixael/fix_target_team_colors
apply team colors to all target view styles
2022-10-14 15:25:23 -04:00
Goober5000 b67ae48590 Merge pull request #4782 from Goober5000/submodel_indexer_fix
model.Submodels fix
2022-10-14 14:04:12 -04:00
MjnMixael 3dcfa99c4a add warp flash to ingame options (#4776) 2022-10-14 10:04:59 -04:00
mjn-mixael 7a5a54d009 Allow option to choose to render with no lighting 2022-10-14 09:00:35 -05:00
Goober5000 da7228cedb model.Submodels fix
Guard against the indexer being invalid, e.g. if the model isn't loaded yet.
2022-10-14 02:07:35 -04:00
Goober5000 aa7a57ef4e Merge pull request #4781 from Goober5000/collision_fix
collision fix
2022-10-14 01:01:09 -04:00
Goober5000 c300278328 collision fix
Fix a typo in `collide_ship_ship`.  Also tweak some lines for clarity.
2022-10-14 00:28:44 -04:00
Goober5000 8b3dccce1c prevent duplicate flag names in the alter-ship-flag list 2022-10-13 15:35:50 -04:00
MjnMixael d323421817 Use a local int for model storage in renderTechModel (#4779)
* Use a local int for model storage here

* null -> nullptr
2022-10-13 17:06:03 +00:00
MjnMixael 7ab80a0162 Toggle cockpit (#4772)
* proof of concept

* Account for shadows

* Option to tie individual HUD gauges to the cockpit option

* Do this in a more user-friendly way

* Address feedback
2022-10-13 19:42:00 +09:00
Goober5000 d1b16d5269 Merge pull request #4762 from Goober5000/flag_list_cleanup
remove obsolete field
2022-10-13 02:02:08 -04:00
Goober5000 446b50cbaf Merge pull request #4774 from Goober5000/fix_ui_timestamp_check
fix updating of ui_timestamps
2022-10-11 20:02:22 -04:00
Goober5000 187cd35e74 add additional comments 2022-10-11 19:28:02 -04:00
Goober5000 e95d214143 Merge pull request #4756 from Goober5000/ship_entry_and_related
Add Lua API for ship registry
2022-10-11 19:24:54 -04:00
MjnMixael 6ae8674615 Correctly set credits default even for scpui access (#4768)
* Correctly set credits default even for scpui access

* These also need to move up for the same reason

* Match retail functionality
2022-10-11 16:47:10 +09:00
Goober5000 7c01485d2d fix updating of ui_timestamps
Since the debug pause check needs to use UI timestamps, and since UI timestamps must keep track of time regardless of time compression, pausing, or mission status, move the updating and checking to `game_do_state_common`.

Also fix a type conversion warning.
2022-10-11 01:06:33 -04:00
Goober5000 3850acdd23 documentation updates 2022-10-10 22:45:14 -04:00
mjn-mixael e3424b4350 apply team colors to all target view styles 2022-10-10 12:56:04 -05:00
Goober5000 f10e35e8dd Merge pull request #4769 from Goober5000/credits_get_music
get the credits music without starting it
2022-10-10 09:43:24 -04:00
MjnMixael bc6282b34b These were reversed (#4770) 2022-10-10 17:48:47 +09:00
Goober5000 d8ad8ebc77 get the credits music without starting it
Starting the music should happen in `credits_init`, not whenever someone needs to know the file name.
2022-10-09 15:41:54 -04:00
Goober5000 ab83a94eb4 remove obsolete field
The `flag_list` field is left over from before the type-safe refactor.  It was used to specify either the `flags` or `flags2` bitfield.
2022-10-07 13:24:52 -04:00
Goober5000 663474516f Merge pull request #4752 from Goober5000/arrival_departure_info
add arrival and departure info for wings, ships, and parse objects
2022-10-07 12:26:59 -04:00
wookieejedi 0dfed6de4b Add maximum self repair percentages for health and subsystems (#4761)
* Add maximum self repair percentages for health and subsystems

Adds two new options to help with the automatic self repairs for hull and subsystems: `$Hull Self Repair Maximum:` and `$Subsystem Self Repair Maximum:`. These values allow mods to specify how much a ship's hull or subsystem can self repair to, which is very useful to have some auto repair but not enough to make the hull or subsystem 100%.

Also cleans up the `ship_auto_repair_frame` function with removing un-used define values, improving comments, and making formatting consistent. Also updates the parse sections of repair rate for hull and subsystems to print to the log if values are being clamped.

Probably easiest to review with hiding whitespace changes.

* update local names to be easier matches to surrounding code

* incorporate feedback

Add back in define, fix == 0 checks, and fix edge case logic bugs
2022-10-07 12:05:23 -04:00
Goober5000 d73ac59383 enhance ba.print and add ba.println
There was code that could interpret any Lua type as an argument for printing, so I adapted it to be used in ba.print(), ba.warning(), and ba.error().  Also ba.println() seemed like a useful thing to add.
2022-10-06 22:52:58 -04:00
Goober5000 a47b2440d3 add ship registry 2022-10-06 20:43:09 -04:00
Goober5000 7d6f261221 add getWing() to parse_object 2022-10-06 20:43:09 -04:00
Goober5000 473521f5ed Merge pull request #4759 from Goober5000/wing_flags
add wing flags
2022-10-06 18:58:00 -04:00
Goober5000 f1f234b89d Merge pull request #4702 from EatThePath/debug-log-cleanup
Moved more things to debug filters, and associated cleanup
2022-10-06 16:57:27 -04:00
MjnMixael 00d067be47 Fix one missed resize mode (#4765) 2022-10-06 15:53:30 -04:00
David Gibson 2ba9a03d9a Restored submodel detail level message 2022-10-05 20:37:33 -05:00
Goober5000 14929db6fe address feedback and add sexps 2022-10-05 18:00:16 -04:00
Goober5000 6ce8963e13 Merge pull request #4757 from Goober5000/animated_effects_to_timestamp
make animated ship effects use the new timestamps
2022-10-05 16:39:08 -04:00
Goober5000 364741ef8f additional flag error checking 2022-10-05 11:40:54 -04:00
BMagnu 209cb7cba8 Enable PNG blobs in LibRocket (#4754)
* Allow reading PNGs from b64, including in librocket

* fix memleak

* tidyup

* fix bad delete

* Force flush on png write

* Pass more image size
2022-10-05 16:57:09 +09:00
Goober5000 02aed5fde4 Merge pull request #4760 from Goober5000/removeSoundByIndex_fix
removeSoundByIndex should be 1-based
2022-10-05 00:12:31 -04:00
Goober5000 8694c042f7 add wing flags
Add setFlag and getFlag for wings, just like for ships and parse objects
2022-10-04 23:59:30 -04:00
Goober5000 3f86fbc7ad removeSoundByIndex should be 1-based
Looks like no mods use this script method, so this change should be safe.
2022-10-04 23:40:10 -04:00
Goober5000 fded868f8c Merge pull request #4758 from Goober5000/4751_followup
fix a last-minute error check
2022-10-04 23:25:26 -04:00
Taylor Richards f1a7a98639 fix and clean up cf_create_default_path_string(): (#4747)
- consolidate old and new functions
 - add missing location flags override from earlier fix
 - add proper error handling where needed
2022-10-04 23:18:28 -04:00
Goober5000 ec8354957d fix a last-minute error check 2022-10-04 22:49:44 -04:00
Goober5000 afeca7cc8f add the same for ships and parse objects 2022-10-04 21:45:56 -04:00
Goober5000 f0542553d6 make animated ship effects use the new timestamps
In addition to type-safety, this now adjusts ship effects properly for time compression and pausing.
2022-10-04 21:42:47 -04:00
Goober5000 cfefaef385 add arrival and departure info for wings
Virtual variables corresponding to the same fields as in `set-arrival-info` and `set-departure-info`.  Plus more variables.  Some refactoring as well.
2022-10-04 20:59:52 -04:00
Goober5000 90638ce534 Merge pull request #4751 from Goober5000/ship_arrival_script_functions
Ship/Wing arrival script functions
2022-10-04 20:56:30 -04:00
MjnMixael 36b0fa046b Move rendering of the 3d overhead to it's own method and create an api (#4749)
* Move rendering of the overhead model to it's own method and create an API to call it.

* fix typos
2022-10-05 02:52:38 +09:00
Goober5000 c1d687f560 prevent redundant arrivals and return whether ships were created 2022-10-03 19:41:26 -04:00
Goober5000 94f99c35f9 remove obsolete fields 2022-10-03 19:36:27 -04:00
Goober5000 61ceeff893 and also for wings 2022-10-03 19:36:27 -04:00
Goober5000 ae3bbd2959 make a parse object arrive 2022-10-03 19:36:27 -04:00
Goober5000 0702a38e1c Merge pull request #4750 from Goober5000/lua_mission_music_scores
add getMusicScore and setMusicScore
2022-10-03 19:09:56 -04:00
Goober5000 064d3a7549 add getMusicScore and setMusicScore
Two new Lua API methods, plus some minor refactoring.
2022-10-03 17:14:33 -04:00
EatThePath e32e01eb50 Added an API function to allow clearing the log during play. (#4741)
* Added an API function to allow clearing the log during play.

* document test fix maybe

* return something
2022-10-04 04:17:53 +09:00
Goober5000 c661ae4590 Merge pull request #4703 from Goober5000/control_used_upgrade
upgrade controls code to use type-safe timestamps
2022-10-02 21:02:32 -04:00
Goober5000 7a654b7e7b per feedback 2022-10-02 20:13:19 -04:00
MjnMixael d902c7612b Api to render the 3d selection effect (#4737)
* Api to render the 3d selection effect

* Missing include

* documentation

* error message for effect type

* documentation
2022-10-03 08:25:15 +09:00
BMagnu 979d305afe Add screenToBlob scripting function (#4738)
* extract base64 routines

* Add screenToBlob scripting method

* Fix variable shadow

* Fix variable shadow again

* Fix usused variable
2022-10-03 07:33:46 +09:00
Goober5000 f14acf9fc1 Merge pull request #4744 from Goober5000/lua_cap_waypoint_speed
add WaypointSpeedCap
2022-10-02 16:54:52 -04:00
JohnAFernandez c2895ba8a4 Fix subsystem health and comparison frames (#4666)
* Fix subsystem change handling code

Make sure that subsystem help actually gets updated.

* change from pointer to literal

I had decided to use `new` in the past when I was less experienced.  So this changes it back to regular angle variables.

(And White space fix requested by Wookie)
2022-10-02 16:52:36 +00:00
MjnMixael 419c56d012 check if weapon is required by current mission (#4731) 2022-10-02 20:23:36 +09:00
MjnMixael e30931b6d2 API to save the current loadout to the player file (#4739)
* API to save the current loadout to the player file

* cleanup
2022-10-02 20:23:31 +09:00
Goober5000 20653ece8e add WaypointSpeedCap
As requested by FotG
2022-10-02 00:13:50 -04:00
Fabian Woltermann 77476edd73 Merge pull request #4735 from The-E/fix/lua_rendering_outside_of_objectrender
When rendering stuff outside of ON OBJECT RENDER hooks, use immediate mode
2022-10-01 22:06:37 +02:00
Fabian WoltermannandGoober5000 e69f2b3fec Update code/scripting/api/libs/graphics.cpp
Co-authored-by: Goober5000 <[email protected]>
2022-10-01 21:39:08 +02:00
wookieejedi 1e61964055 Add AI flag to support ai bay arrivals > 10 seconds (#4733)
* Add AI flag to support ai bay arrivals > 10 seconds

Currently, if an AI ship is emerging from a bay path, the AI will stop following that path after only 10 seconds (and some distance away from the starting point). This results in AI breaking off a path early if a bay arrival path is long and/or uses a slow bay arrive multipliers. For bays that require the ship to follow the exact path this results in AI that then run into the parent ship and each other.

This PR adds a flag which disables that 10 second timeout. Also, in my tests having a flag to disable works best, as opposed to setting a max time (which is hard to calculate with varying ship speeds and varying bay path lengths).

PR is tested and works as expected.

* fix spelling
2022-10-01 12:39:17 -04:00
MjnMixael f5c83fbb40 primary -> secondary (#4740) 2022-10-01 08:44:55 -04:00
MjnMixael 7819d8262d Only check for greater than, not equal to (#4734) 2022-10-01 08:43:20 -04:00
MjnMixael 1edf63c617 take userdata and return int (#4736) 2022-10-01 08:43:13 -04:00
Fabian Woltermann b2ab98a979 When rendering stuff outside of ON OBJECT RENDER hooks, use immediate mode 2022-10-01 10:49:39 +02:00
Goober5000 1b9ab28d29 Merge pull request #4732 from BMagnu/add_local_anims
Add local coordinate relations to allow restoring old absolute behaviour
2022-09-30 19:03:36 -04:00
Goober5000 c5cbd2297c Merge pull request #4726 from Goober5000/decals_right_side_up
flip decals right-side up
2022-09-30 19:03:09 -04:00
wookieejedi 678922472a Fix Remove-Order not working for Play Dead Orders (#4720)
* Fix Remove-Order not working for Play Dead Orders

Play-dead orders set a special case of the ai mode (AIM_PLAY_DEAD), which had special handling to return early in the AI frame function. Remove-order does not change the ai mode though, and thus even when a play-dead order was removed the `AIM_PLAY_DEAD' remained, which would continually trigger an early out in AI frame, which in turn would make turrets not fire on ships, even when the play-dead order was removed. No other orders had this early return, which is why remove order works for them.

This PR accounts for that special handling case. There also seemed to be an extra cleanup line for rearm and repair, so this was added right after that step.

Tested and works as expected.

* make fix flag enabled

* appease clang
2022-09-30 08:34:02 -04:00
Asteroth c9972f678a add on mouse wheel hook (#4724) 2022-09-30 16:46:52 +09:00
MjnMixael ef850ad302 Handle errors from create_wings() in an API friendly way (#4730) 2022-09-30 16:46:45 +09:00
MjnMixael 4d620bb3c7 API for checking and setting if a slot is filled or empty (#4729) 2022-09-30 16:45:06 +09:00
MjnMixael e963cfda93 return the actual number of starting wings (#4728) 2022-09-30 16:44:58 +09:00
BMagnu 4fa9a43e0e refactor names 2022-09-30 09:31:50 +02:00
BMagnu a9ec68ced6 Encapsulate relation parsing 2022-09-30 09:27:20 +02:00
Birk Magnussen 92a1a2c441 Add Local Coordinate relations to restore old absolute 2022-09-29 22:55:42 +02:00
MjnMixael 384e228347 Reset loadout to default and handle commit mission error returns (#4719)
* Reset loadout to default and handle commit mission error returns

* Return enum instead of int codes

* comment
2022-09-29 22:35:09 +09:00
MjnMixael 35ee34b86a isDisabled returns if the ship is used in the mission + some documentation fixes (#4725) 2022-09-29 16:19:05 +09:00
MjnMixael 2149a0e1ee API access to the remaining ship class strings (#4721)
* API access to the remaining ship class strings

* copy paste errors

* Actually return the string
2022-09-29 16:18:50 +09:00
MjnMixael 5979d29463 Scpui loadout pools (#4698)
* API Access to the ship and weapon pools

* func to indexer

* Make ship and weapon pools writable
2022-09-29 16:18:26 +09:00
MjnMixael e369cf98d3 API access to weapons allowed on a ship class and/or in a specific bank (#4697)
* API access to weapons allowed on a ship class and/or in a specific bank

* Allow just checking the ship and not banks

* # This is a combination of 2 commits.

syntax fix

Add method to get number of primary and secondary banks

* We don't need these

* get default weapons for each bank

* # This is a combination of 2 commits.

documentation

return secondary not primary

* fix merge error

* Address feedback
2022-09-29 16:18:14 +09:00
Goober5000 08b7fc68b7 flip decals right-side up
For some reason, decals appear upside-down unless the uvec is flipped.
2022-09-28 22:07:28 -04:00
MjnMixael 44d042edb8 Make Wss_slots writable (#4717)
* Make Wss_slots writable

* cleanup
2022-09-28 22:53:45 +09:00
EatThePath 8edb25c235 Merge pull request #4479 from Kiloku/long_turrets
Allow turrets to use their firepoints for target-leading calculations
2022-09-27 20:21:22 -05:00
EatThePath f641f0283e Merge branch 'master' into debug-log-cleanup 2022-09-27 10:34:12 -05:00
David Gibson b76294e528 Returned some more serious lines to the general categories. 2022-09-27 10:32:18 -05:00
David Gibson e86bbb0138 cleanup to the cleanup of filters
Moved more things to debug filters, and associated cleanup
2022-09-27 10:25:50 -05:00
Asteroth af4b23b7c4 handle 0 duration better (#4716) 2022-09-27 20:11:14 +09:00
BMagnu f0068b13a0 Prevent dangling threads from crashing FSO on close (#4701)
* Prevent dangling threads from crashing FSO on close

* Fix warning

* Properly allow multiple parent threads for unittests

* Fix Test

* Redo it using the lua GC method

* tidyup

* Fix Warnings

* Fix double default

* get rid of explicitly defined copy constructor to allow implicit copy assign to exist
2022-09-27 15:32:13 +09:00
JohnAFernandezandwookieejedi 2e3ff7410c Add corrections in multi ship record (#4650)
The ship record for player ships is not always accurate.  So as to correct entries as valid packets are received.

Also, remove a case where null vectors were being passed to the physics engine.

Co-Authored-By: wookieejedi <[email protected]>

Co-authored-by: wookieejedi <[email protected]>
2022-09-26 22:14:08 -04:00
Goober5000 ac57537f94 Merge pull request #4718 from Goober5000/script_vecmat_copy
a couple of scripting enhancements
2022-09-26 21:21:34 -04:00
Goober5000 1794ba87b3 address feedback 2022-09-26 19:54:18 -04:00
EatThePath 03a9c24330 Merge pull request #4711 from EatThePath/finaldata
created new "_override" universal mod directory
2022-09-26 18:43:09 -05:00
Goober5000 e2dbfca1c3 allow customizing of debug particle color 2022-09-26 18:45:19 -04:00
Goober5000 00746f1f92 add copy methods for matrixes and vectors 2022-09-26 18:43:50 -04:00
Fabian Woltermann 11ec3b64c6 Merge pull request #4712 from MjnMixael/ShipSelect3b
Lua API read-only access to the actual loadout
2022-09-26 15:38:31 +02:00
mjn-mixael eb3c8a25fb MAX_SHIP_WEAPONS 2022-09-26 08:03:40 -05:00
Asteroth 6cad66c7e7 Make sure immobile objects always have 0 velocity (#4708)
* make sure immobile objects are always 0 vel

* doesnt need to be conditional
2022-09-26 18:52:12 +09:00
David Gibson b69ac0cdd3 Implementing formatting and naming feedback 2022-09-25 19:53:54 -05:00
Goober5000 7d854c96c4 Merge pull request #4707 from Goober5000/fix_scripting_line_num
fix off-by-one error in Lua line numbering
2022-09-25 18:35:31 -04:00
David Gibson b572ef45eb added command line flag for override and addressed feedback 2022-09-25 16:16:09 -05:00
Fabian Woltermann ac27124243 Merge pull request #4715 from EatThePath/ltp-mult-lab-fix
Moved lab access to light multipliers to cleaner path
2022-09-25 19:06:21 +02:00
EatThePath 0152b7829a Merge pull request #4714 from Baezon/no-continuous-turn
Flag to turn off continuous turn when attacking
2022-09-25 11:37:57 -05:00
David Gibson 7d0393d565 Moved lab access to light multipliers to cleaner path 2022-09-25 11:35:29 -05:00
Asteroth 76c54a1016 flag to turn off continuous turn when attacking 2022-09-24 19:59:00 -04:00
mjn-mixael 1e7ee8b345 Lua API read-only access to the actual loadout 2022-09-24 16:30:44 -05:00
EatThePath 367e19b751 Merge pull request #4694 from MjnMixael/ScpuiShipSelect
Scpui ship select
2022-09-24 15:15:13 -05:00
David Gibson d0241d060c created new "load_last" universal mod directory 2022-09-24 15:00:16 -05:00
kiloku ad9bf0af71 Reset setting on mod_table_reset() 2022-09-24 10:35:25 -03:00
kiloku 4f8cf06e57 Game settings option to consider all turrets long 2022-09-24 10:32:54 -03:00
kiloku 8ef408c746 ship_get_global_turret_gun_info needs a gvec to not crash 2022-09-24 10:31:33 -03:00
kiloku 075bbe7e3b Add flag to list for parsers 2022-09-24 10:31:33 -03:00
kiloku 0a6558eea9 Adds new flag Turret_distant_firepoint that allows long turrets to aim correctly 2022-09-24 10:31:32 -03:00
BMagnu 19a7814e50 Merge Show Ship and Cockpit Renderpasses (#4705)
* Setup merge of ship model and cockpit

* Merge extmodel and cockpit rendering

* Fix hasCockpitModel check

* Fix non-coord-share mode and deferred

* Make extmodel shadowcast toggleable

* Fix extmodel shadows

* Make cockpit pass somewhat configurable

* tidyup
2022-09-24 22:10:55 +09:00
Goober5000 44802949da fix off-by-one error in Lua line numbering
This fixes the newline count used to make the parsed Lua code align with the source file.
2022-09-23 23:43:30 -04:00
BMagnu d186aefa92 Adds a cache for modular POFs (#4690)
* cleanup submodel index replacement

* Add modelreplace cache

* Move RenameSubobjects to new API

* Fix and tidyup

* Fix GCC error

* fix macro

* Appease Clang

* Properly skip reading non-final leaves from the cache

* fix warning

* Safe-stringify, incorporate comments
2022-09-23 18:38:50 +09:00
EatThePath 7c3e07ab7b Unify default filters and consolidate the new lua category 2022-09-22 21:58:24 -05:00
Goober5000 b49f70fbc3 upgrade controls code to use type-safe timestamps
This requires splitting the `used` field into digital and analog components.  The digital field stores the last-used timestamp, whereas the analog field stores the last value.
2022-09-22 22:26:34 -04:00
Adam Leach fed039fd54 logic error fix - update envMatrix even if there's no specmap (#4699) 2022-09-22 22:00:19 -04:00
Goober5000 2b1e08431c Merge pull request #4633 from Goober5000/event_and_goal_timestamps
convert event-related timestamps to new system
2022-09-22 18:51:06 -04:00
Goober5000 b0e8f260bb Merge pull request #4695 from Goober5000/more_sexps_to_scripts
a few more script enhancements
2022-09-22 18:50:11 -04:00
MjnMixael f7d84dfe76 Update ui.cpp
return
2022-09-22 09:13:27 -05:00
mjn-mixael 601a41bb60 return invalid handle 2022-09-22 08:17:19 -05:00
MjnMixael 5f183832e1 Scpui api briefing map (#4656)
* API version of the briefing map

* Cleanup

* Further cleanup

* # This is a combination of 2 commits.

Fix resizing and cleanup remaining static anim calls

Revert changes completely

* Fix documentation

* implement initBriefing and rearrange map drawing methods to match.

* Documentation

* nullptr
2022-09-22 16:04:14 +09:00
Goober5000 c7b1092a96 a few more script enhancements
1) Add the "no-thrusters" ship flag to the list of flag that can be used by alter-ship-flag or the ship's setFlag function
2) Add a `FireRateMultiplier` virtvar to control the firing rate of turrets (fulfills #4300)
3) Add a `setGlowPointBankActive` function to do the same thing as `activate-glow-point-bank`/`deactivate-glow-point-bank`
2022-09-22 02:12:17 -04:00
mjn-mixael 764c996361 Swap order 2022-09-21 18:39:58 -05:00
mjn-mixael 2f5ccc5b1a unused parameter 2022-09-21 18:02:52 -05:00
mjn-mixael 3a171493b0 Cleanup 2022-09-21 17:29:20 -05:00
mjn-mixael 655fe8d7f1 Loadout wing API (+4 squashed commit)
Squashed commit:

[83e8522d1] Comments

[50686ce6a] Wing Slot data

[450a0f6e1] Common Init

[0c603313e] Rough in WIP
2022-09-21 17:27:38 -05:00
wookieejedi 0c2a6a4f28 Fix multi lib (#4692)
Just adding 1 missing include
2022-09-21 22:08:38 +00:00
MjnMixael 3d700589c5 Give Lua access to the select anims and images (#4687) 2022-09-22 05:31:24 +09:00
EatThePath 33f24f1b4d -luadev flag and lua log filter (#4681)
* Adds new default 'lua' filter category for all lua errors and output
Adds -luadev flag that currently only makes lua errors non-fatal.

* Correcting unreachable code.

* Missed a halting code path for luadevmode

* comment fix
2022-09-22 05:31:06 +09:00
Goober5000 5e3f72229c Merge pull request #4684 from Goober5000/set_and_get_ship_flags
add setFlag and getFlag for ships and parse objects
2022-09-21 12:39:00 -04:00
Goober5000 544234743e update ship flags 2022-09-21 08:43:29 -04:00
Goober5000 fdb5506d41 make autodoc happy 2022-09-20 20:16:54 -04:00
Goober5000 7ff6da8b8b Merge pull request #4664 from Goober5000/script_model_queue_render
use queued rendering instead of immediate rendering for scripts
2022-09-20 20:09:34 -04:00
Goober5000 ce4563867d Merge pull request #4682 from MjnMixael/MissionTime
Mission time
2022-09-20 20:09:25 -04:00
Goober5000 9c71a3a1a0 allow an arbitrary number of flag arguments 2022-09-20 20:06:11 -04:00
MjnMixael eddda373d3 Allow API to optionally not start the next mission. (#4679)
* Allow API to optionally not start the next mission.

* false -> true
2022-09-21 08:16:04 +09:00
Joshua Glatt 86f458f01a Allow modifying map container data when the map is an argument (#4683)
* allow modifying map container data when the map is an argument

* skip past an invalid map key, avoid infinite loop
2022-09-21 08:11:17 +09:00
wookieejedi 7926366ee6 Update max priority for scripting AIgoals (#4685) 2022-09-20 19:09:16 -04:00
MjnMixael 710d7a614c These go here (#4689) 2022-09-21 08:08:47 +09:00
Goober5000 a379411d7a add ParsedShips indexer and update terminology 2022-09-20 16:08:43 -04:00
Goober5000 35abc3e3f5 Merge pull request #4688 from Goober5000/hud_gauge_fix
fix cargo scan type parsing
2022-09-20 15:18:04 -04:00
Goober5000 a89ba892a2 add setFlag and getFlag for ships and parse objects
This mirrors alter-ship-flag and are-ship-flags-set.
2022-09-20 14:43:24 -04:00
Goober5000 d1ba57bc23 fix cargo scan type parsing
Because of idiosyncrasies of `required_string_one_of`, use a different technique.
2022-09-20 14:16:04 -04:00
mjn-mixael 931cfdebb0 explicit bool 2022-09-19 20:34:10 -05:00
mjn-mixael f7b19553c8 nullptr while I'm here 2022-09-19 19:36:11 -05:00
mjn-mixael 6579719a04 documentation 2022-09-19 19:17:34 -05:00
mjn-mixael 68f03b5328 Add isInMission and always return getMissionTime 2022-09-19 19:05:54 -05:00
Goober5000 7fea61f618 Merge pull request #4669 from TRBlount/feature/movie_alpha
Allow movies to be alpha blended through the LUA Movie Player API
2022-09-19 18:50:20 -04:00
Goober5000 91d8031c32 Merge pull request #4677 from BMagnu/absolute_translation
Add Absolute Translation
2022-09-19 18:50:12 -04:00
wookieejedi 7b3705ad61 Fix VS Warning (#4676)
* Fix VS Warning

If this is trivial and not needed feel free to dismiss, but this one-line PR simply fixes a warning that keeps showing up when building with VS.

* individually cast

* cleaner fix
2022-09-19 17:40:35 -04:00
Goober5000 9a2a85198a Merge pull request #4680 from MjnMixael/ReverseHasDebriefing
This needs to be reversed to return the expected value
2022-09-19 17:25:06 -04:00
mjn-mixael cbd3d7da24 This needs to be reversed to return the expected value 2022-09-19 15:26:09 -05:00
JohnAFernandez 54f030ae6c Merge pull request #4671 from Goober5000/custom_hud_scan
add -dualscanlines as a HUD config option
2022-09-19 13:26:19 -04:00
Goober5000 be31334212 Merge pull request #4675 from MjnMixael/FixScramble
Fix returning int when bool expected in API
2022-09-19 11:50:40 -04:00
mjn-mixael 41dd60d111 Fix returning int when bool expected 2022-09-19 08:48:17 -05:00
BMagnu e88b898839 Add absolute translation 2022-09-19 11:57:40 +02:00
Goober5000 94fe34f619 a couple of animation fixes (#4673)
Done at Lafiel's direction.
2022-09-18 23:08:19 +00:00
Goober5000 56803e7c9f Merge pull request #4615 from MjnMixael/ScpuiDebriefingLibrary
Scpui API debriefing library
2022-09-18 18:36:33 -04:00
Goober5000 7a8b8d5fdc Merge pull request #4667 from BMagnu/seamless_anim_flag
Flag for seamless animations with startup period
2022-09-18 18:36:11 -04:00
Goober5000 782600ba7a Merge pull request #4663 from Goober5000/lighting_followup
lighting followup
2022-09-18 04:41:34 -04:00
Goober5000 36972b35f5 Merge pull request #4668 from Goober5000/stop_looping_animation
add stopLoopingSubmodelAnimation
2022-09-18 04:41:24 -04:00
Birk Magnussen cc027a91fc Incorporate Feedback 2022-09-18 10:23:15 +02:00
Goober5000 222a75f3e6 semi-deprecate dualscanlines, and put the default option in the 'else' block 2022-09-18 02:13:11 -04:00
Asteroth 5823c5f4b5 add disco scan lines 2022-09-18 01:41:14 -04:00
Goober5000 4c16c95b9b add -dualscanlines as a HUD config option
Allow different types of cargo scans, including the -dualscanline behavior, to be specified in the HUD gauges table.  Right now the options are "default" and "dualscanlines".
2022-09-18 00:50:28 -04:00
mjn-mixael ac82d8349c Virtvar -> Func 2022-09-17 22:24:48 -05:00
Tyler Blount 2f0a15da28 Remove alpha conditional check in VideoPresenter 2022-09-17 17:02:35 -07:00
Tyler Blount 0d78538a91 Update video shader and add alpha controls to VideoPresenter API 2022-09-17 15:53:04 -07:00
Goober5000 1e0845ca5e Merge pull request #4661 from scp-fs2open/dependabot/pip/ci/post/mako-1.2.2
Bump mako from 1.1.5 to 1.2.2 in /ci/post
2022-09-17 18:47:39 -04:00
Goober5000 6d204a7bc5 lighting followup
Two small fixes to follow up the lighting PRs

1) Change the mprintf to a Warning, both to be consistent with other deprecation warnings and to notify modders that they might need to accommodate the new lighting system
2) Parse any leftover data so that legacy tables don't cause FSO to choke on parsing
2022-09-17 18:43:36 -04:00
Goober5000 622c99fa2f add stopLoopingSubmodelAnimation
A script command to mirror the SEXP operator.
2022-09-17 17:45:28 -04:00
Goober5000 aafa386f22 Merge pull request #4237 from TheForce172/fix/shipEditorCleanup
QTFRED: Ship Editor Cleanup 2
2022-09-17 16:51:41 -04:00
Goober5000 29f1280df7 Merge pull request #4336 from virusman/pr/mac-release-builds
Add release CI config for Mac
2022-09-17 16:43:50 -04:00
BMagnu 5593bd168d Add optional deferred lighting pass for cockpits (#3445)
* Add deferred cockpit lighting

* Put deferred Cockpits behind a flag

* (hopefully) fix bad in-case initializer

* clear non base color buffer in subsequent deferred passes

* Proper deferred Cockpit rendering

* undo whitespace changes
2022-09-17 15:29:35 -04:00
Goober5000 b14db41126 Merge pull request #4647 from Goober5000/frame_debug_tweak
better adjustment of timestamp delta
2022-09-16 22:20:55 -04:00
Goober5000 85c1ae1f4b use queued rendering instead of immediate rendering for scripts
Scripts that render models in the On Object Render hook were effectively doing immediate renders in the middle of queued renders.  This caused some data, such as model orientation, to 'leak' between renders.  It might also have something to do with why the bug in #4637 had the particular graphical side effects that it did.

Anyway, changing the immediate renders to queued renders fixes the leaky orientations, and is probably a good upgrade for other reasons as well.
2022-09-16 17:27:50 -04:00
wookieejedi ad817795e2 Fix smart spawn flag (#4662)
Courtesy of Lafiel, this code fixes special flags such as those related to `spawn`. (Bug arose in #4620).

Tested and fixes the problem and works as expected.
2022-09-16 20:46:16 +00:00
Birk Magnussen 2a8ee1f80b Properly set flag 2022-09-16 21:43:34 +02:00
dependabot[bot] 1b82c101f6 Bump mako from 1.1.5 to 1.2.2 in /ci/post
Bumps [mako](https://github.com/sqlalchemy/mako) from 1.1.5 to 1.2.2.
- [Release notes](https://github.com/sqlalchemy/mako/releases)
- [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES)
- [Commits](https://github.com/sqlalchemy/mako/commits)

---
updated-dependencies:
- dependency-name: mako
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
2022-09-16 19:03:37 +00:00
BMagnu 7d42bf08a6 Fix Animation 3D Sound (#4658)
* Add options to enable animation sound to actually be 3D

* Fix typo

* Fix objnum valid check
2022-09-16 14:35:10 -04:00
mjn-mixael 8d8cf0a41c Prevent multiple instances of evaluated debrief sexps 2022-09-16 12:44:10 -05:00
Fabian Woltermann ef496f08e0 Merge pull request #4657 from Goober5000/4602_followup
additional polishing of the briefing API
2022-09-16 15:47:49 +02:00
BMagnu 47b5bc6b64 Add flag safeguard 2022-09-16 13:38:15 +02:00
BMagnu 3f3ff4f685 Add Seamless with startup animation mode 2022-09-16 13:15:07 +02:00
BMagnu dc320d0768 Add special flag to animations 2022-09-16 11:36:00 +02:00
Goober5000 c9ca58f504 update 2022-09-15 20:09:55 -04:00
BMagnu cf8f90e93d Properly encapsulate special flag parsing (#4620)
* properly encapsulate special flag parsing

* Cleanup Cpp11 mess

* Fix missing include in vmallocator.h

* Fix bad merge

* address feedback
2022-09-16 07:39:45 +09:00
Goober5000 06fc8c73a5 this flag deserves its own commit 2022-09-15 18:38:57 -04:00
Goober5000 d92496ee02 convert event-related timestamps to new system
This change covers just the timestamps associated with goals and events, for better review and isolation purposes.

Follow-up to #4569.
2022-09-15 18:38:53 -04:00
Goober5000 c13e262bb8 Merge pull request #4640 from Goober5000/hud_scripting_enhancements
several minor HUD enhancements
2022-09-15 18:34:36 -04:00
Fabian Woltermann 8d93276423 Merge pull request #4654 from qazwsxal/light-power-fix
Light power fix
2022-09-15 20:08:58 +02:00
Fabian Woltermann 69915a1364 Merge pull request #4653 from qazwsxal/thicc_lights
Improved beam, blob and warp lighting
2022-09-15 20:07:53 +02:00
Fabian Woltermann 179f0c0f47 Merge pull request #4659 from qazwsxal/fix/sim_room_fix
Fix retail UI crash when campaign missions are selected in simulator
2022-09-15 19:09:58 +02:00
Adam Leach 5254a5867d keep MSVC happy 2022-09-15 17:51:02 +01:00
Adam Leach 2a4b5b0dee Remove duplicate. 2022-09-15 17:49:22 +01:00
David Gibson fea116ea82 fix ambient lighting to match 2022-09-15 17:47:25 +01:00
David Gibson b6bc5175da Add default brightness profile adjust and retune the techroom rendering appropriately. 2022-09-15 17:47:25 +01:00
David Gibson 02ebdd50d0 Switched to default size zero light emitters 2022-09-15 17:47:00 +01:00
David Gibson c5800b722d Adding configurable source radius to the lighting data and uniforms 2022-09-15 17:46:42 +01:00
Adam Leach 0eb5197ecd Fixes retail UI crash when campaign missions are selected in simulator 2022-09-15 17:35:13 +01:00
David Gibson cf0a785029 adjusted the width of beam light cores 2022-09-15 17:04:25 +01:00
Adam Leach a9a9c89c98 Actually fix lighting error (and document) 2022-09-15 17:04:25 +01:00
Adam Leach f9424a1b88 Factor out spherelight calcs, fix lighting error when inside spherelight 2022-09-15 17:04:25 +01:00
Adam Leach b0467d0697 Clamp beam length to prevent light from going past start/end points. 2022-09-15 17:04:25 +01:00
David Gibson d93e6cf752 Adjusted fireball sizing 2022-09-15 17:04:25 +01:00
David Gibson e00635d430 Switched to default size zero light emitters 2022-09-15 17:04:25 +01:00
David Gibson 413e817733 Attached reasonabled defaults to the new source radius settings 2022-09-15 17:04:25 +01:00
David Gibson e37427a24b Adding configurable source radius to the lighting data and uniforms 2022-09-15 17:04:25 +01:00
Adam Leach 30d534fe32 Documentation and a small optimisation. 2022-09-15 17:04:25 +01:00
Adam Leach b77b820aa2 Initial work for lights with adjustable emitter size and tube rendering. 2022-09-15 17:04:25 +01:00
mjn-mixael ce9dd1eaf3 cleanup includes 2022-09-15 10:41:57 -05:00
Fabian Woltermann 6c83a72403 Merge pull request #4652 from qazwsxal/qaz-shaders
Improved shaders and image based lighting
2022-09-15 17:39:07 +02:00
mjn-mixael 54b6efcf25 Address feedback 2022-09-15 10:27:45 -05:00
mjn-mixael 925aa44ebb Compare pointer to nullptr instead of 0 2022-09-15 10:27:42 -05:00
mjn-mixael f0f23b5fd0 Address feedback 2022-09-15 10:27:38 -05:00
mjn-mixael 7d77b8ebc0 Return this exactly to previous state 2022-09-15 10:27:35 -05:00
mjn-mixael 6f0f3a10eb Address feedback 2022-09-15 10:27:31 -05:00
mjn-mixael f011e59d61 Remove unreachable code 2022-09-15 10:27:22 -05:00
mjn-mixael d718c76906 Some cleanup 2022-09-15 10:27:21 -05:00
Mike N 895d4dce1a debriefing api access 2022-09-15 10:27:19 -05:00
Goober5000 e146a24f9e additional polishing of the briefing API
Follow-up to #4602.  Overall the PR was good, but there are a few extra small changes that should go in. In order of priority:

1) The `exitLoop`, `skipMission`, and `skipTraining` functions should check for campaign mode.
2) The `isVisible` virtvar should be changed to a function, because calling it may have side effects.  In standard usage, the briefing formula is evaluated exactly once per stage on briefing initialization, so scripts should follow this convention.
3) The `hasGoalsSlide` function should be called `hasGoalsStage`, because "stage" is the common terminology in FSO.
4) Paging out mission messages is already done in `game_level_close` and should be removed from not only the scripting method but the method it was based on.
5) For consistency, unused parameters should use the `SCP_UNUSED` macro.
6) The `isTraining` flag check can be slightly streamlined using the double-not trick.
2022-09-15 11:20:00 -04:00
EatThePath c66f90b46d Implemented a command line flag that forces a fixed RNG seed, (#4599)
* Implemented a command line flag that forces a fixed RNG seed, which reseeds the RNG on every mission load.

* Naming changes and bounds checking
2022-09-15 22:30:26 +09:00
Adam Leach d4ad137251 Converted warning to log message as the data is just ignored 2022-09-15 13:21:11 +01:00
Adam Leach 1e695cf807 Merge branch 'master' into qaz-shaders 2022-09-15 10:18:03 +01:00
Goober5000 850f2904dc Merge pull request #4603 from Goober5000/timestamp_migration_2
more timestamp migration
2022-09-15 02:01:19 -04:00
Goober5000 086e386b75 Merge pull request #4655 from Goober5000/improve_huge_fire_info_lookup
improve huge_fire_info lookup
2022-09-14 22:32:09 -04:00
EatThePath 452f554193 Crossing the specular rubicon (#4302)
* Applying directional brightness profile value, disconnected spec flags and made specular light always equal to diffuse light

* Switched over to new command line arguments

* Wire lab up to new lighting controls, and provide backwards-compatible defaults for emissive.

* cleanup unused new function

* make static some functions that can be static

* revise command-line and emissive handling

* handled specular sun depreciation and general removal of specular value handling

* Removed specular light color as a separate value in the uniform buffers.

* cleanup of leftover/post-rebase specular references

* further post-rebase repair of light flags command line and leftover specular

* move techroom/selection/breifing 'room' lights to a common function and
augment lighting setup for current rendering

* fixed some mishandling of lighting modifiers.

* Addressed code clarity and comments from review
2022-09-15 05:47:58 +09:00
Goober5000 15dc0aba77 improve huge_fire_info lookup
According to EatThePath's frame profiling, this one ship name lookup takes 2% of the frame time.  It can be easily optimized by making use of the ship registry.
2022-09-14 14:39:32 -04:00
Adam Leach 9cccab3f18 unused var check 2022-09-14 17:54:05 +01:00
Adam Leach 36a714b93f Merge branch 'master' into qaz-shaders 2022-09-14 16:56:57 +01:00
MjnMixael 70609bb3b9 Cleanup Fiction, Red Alert, and Loop Brief based on feedback on other PRs (#4649) 2022-09-14 16:01:57 +09:00
BMagnu 10a47781a0 Change cmd_briefing API to reference from copy (#4646) 2022-09-14 16:01:42 +09:00
MjnMixael ff55a39dd4 Scripting functions required for SCPUI conversion of all four Tech Room UIs (#4591)
* Documentation (+6 squashed commit)

Squashed commit:

[ea8550b54] Resolve errors

[9ab0a576d] Add way to count number of elements in the arrays

[eb74146cc] Correct this boolean check

[60fbc6008] Missed one

[78e65a4b7] Avoid naming collision

[4ea5ddead] Clean unneeded log print and compare like variables

* Adding simulator room here seems like a pretty safe option

* Scpui API to access to build the tech room cutscene list and a few methods to help playing the cutscene and return to the menu accurately

* Scpui API access for credits related data

* # This is a combination of 7 commits.

Clean unneeded log print and compare like variables

Avoid naming collision

Missed one

Correct this boolean check

Add way to count number of elements in the arrays

Resolve errors

Documentation

* Address feedback

* Address feedback

* Add virtvar isCampaignMission
2022-09-14 16:01:34 +09:00
Goober5000 ae57ea7158 Merge pull request #4643 from Goober5000/small_hook_refactor
small hook refactor
2022-09-13 18:24:45 -04:00
MjnMixael ef85e94e40 SCPUI API elements required for the Briefing (#4602)
* API elements required for the Briefing

* Resolve errors

* Check if the mission is a Scramble mission

* Add one missed flag check

* Slight API naming adjustment

* Address feedback

* Address Feedback again

* Differentiate var names
2022-09-14 04:39:20 +09:00
Goober5000 258e735af2 better adjustment of timestamp delta
When debugging, don't adjust the timestamp by the exact difference, since that would make the frametime 0 and cause div-0 errors.  Instead pretend that the previous frame was a reasonable duration.  Also, perform the timestamp check separately from the frametime check, since they are not always consistent.
2022-09-12 21:22:56 -04:00
Goober5000 19f193f533 Merge pull request #4644 from Goober5000/remove_asserts
remove two unnecessary asserts
2022-09-12 15:56:51 -04:00
wookieejedi d5eca2fab1 Auto Truncate default ship names (#4642)
* Auto Truncate default ship names

Previously, placing a ship that had a long class name might create a default name that was too long and thus trigger a buffer overflow assert.

Such behavior was confusing if someone was just placing things in FRED and not sure at all what happened or how to fix it.

This PR replaces the assert with code to auto truncate the ship class part of the name to ensure that the default name will fit into the designated size.

* change var name
2022-09-12 13:26:53 -04:00
Goober5000 f932c2da6a Merge pull request #4645 from Goober5000/fix_4637
fix script conditions for ships
2022-09-12 03:09:25 -04:00
BMagnu 14f94eb34f Add Angle SEXPs (#4641)
* Add angle SEXPs

* Convert to Degrees
2022-09-12 15:11:57 +09:00
Goober5000 4be8851c16 fix script conditions for ships
Like #4559 before it for weapons, this fixes the script conditions for ships.  The problem was the same: the script condition would evaluate to true if none of the objects under consideration were ships.  The fix is the same as well.  I checked all the other script condition categories, so no similar bugs should pop up in the future.

Fixes #4637.
2022-09-12 00:05:24 -04:00
Goober5000 5e4abb30a3 remove two unnecessary asserts
It's not necessary here to assert on the correct variable type, as having the wrong type here won't cause the code to break.  More importantly, the error will have been flagged before this point anyway, and this code is used for formatting the SEXP to be displayed in an error message.  It's not helpful to pre-empt an error message with an assert.
2022-09-11 23:21:16 -04:00
wookieejedi f2dd37fab3 Allow Autotarget to target new target when current target is deathrolling (#4638)
Discussion starts here: https://discord.com/channels/223511295431933953/722747742996267068/1018264927699476571
2022-09-11 22:29:56 -04:00
Goober5000 974981520d change names 2022-09-11 22:25:57 -04:00
Goober5000 46bd9ecae8 fred and qtfred 2022-09-11 22:24:25 -04:00
Goober5000 9fcf17b9e6 better distinguish between builtin and custom hud gauges, and allow both when the functions can handle it 2022-09-11 22:09:24 -04:00
Goober5000 9056a9c89b partial revert of 2e839eda0; these sexps need to get any gauge, not just the custom ones 2022-09-11 21:16:50 -04:00
Goober5000 0480fa69d9 several minor HUD enhancements
add `getDirectiveLines` and `setPosition` script functions
properly error if trying to set a HUD gauge name
remove the unneeded `Directive_frames_loaded` variable
improve accuracy of SEXP help for HUD gauge operators
2022-09-11 21:16:50 -04:00
virusman 288e3b86d1 Add release CI config for Mac 2022-09-11 16:03:55 -07:00
Goober5000 8bc4064670 small hook refactor
Basically just changing some parameter names.
2022-09-11 15:07:17 -04:00
Goober5000 9e6e95108d Merge pull request #4636 from Goober5000/fix_4635
properly account for string sizes in debrief_choose_voice
2022-09-11 13:00:29 -04:00
wookieejedi 375ccd7413 Fix conditional for Always_warn_player_about_unbound_keys (#4639)
Properly check if mission is singleplayer for the `Always_warn_player_about_unbound_keys` game option.
2022-09-11 11:17:00 -04:00
Kiloku d0c76a7eaa New options for lead indicators (#4411)
* Adds Lead Indicator Behavior option to game_settings.tbl

* Adds dont merge lead indicators flag to weapons, allowing homing secondaries to have their own lead indicators no matter what.

* Removed unused variable that was added just for testing

* add explicit int to float conversion to appease build checks

* Move some things around to avoid potentially undefined values

* Clean-up + address feedback

* Remove redundancy
2022-09-11 23:57:40 +09:00
Goober5000 7462dd68f8 fix subtitle clipping (#4625)
For subtitles drawn using the `$Show-subtitle base resolution:` feature, text near the side of the screen would get clipped off mysteriously.  The clipping corresponded precisely to the edge of a 4:3 boundary, which led me to discover that the clip boundary was still at the side of a 4:3 box, rather than a 16:10 box as was expected.  Explicitly setting the clip boundary when setting the screen scale fixed the issue.

For any graphics coders in the know, is this actually the proper fix?
2022-09-11 20:00:54 +09:00
Fabian Woltermann 9ba91d870c Merge pull request #4632 from The-E/fix/4614_demotion_went_too_far
Fix issue with new pilots getting demoted too fast
2022-09-10 21:15:05 +02:00
Asteroth ef57ffc2f4 Add maneuvering thruster easing (#4623)
some thruster and comment clean up, and thruster easing
2022-09-09 18:36:04 -05:00
Goober5000 1509448a34 properly account for string sizes in debrief_choose_voice
The null terminator was written past the end of the string buffer, which intruded on the next field in the struct.  Fixing this fixes #4635.  Also adjust the string concatenation a couple lines up because it could also write past the end of the buffer.
2022-09-09 12:07:07 -04:00
EatThePath bb232382cf Merge pull request #4528 from MageKing17/feature/default-shockwave-damage-types
Add default shockwave damage types functionality.
2022-09-09 09:53:30 -05:00
Fabian Woltermann e21dfcb457 when resetting stats before replaying a mission, check the rank table to see which rank the player should be 2022-09-08 19:17:47 +02:00
Goober5000 ae3fb54c02 add more timestamp documentation 2022-09-08 02:42:38 -04:00
Goober5000 16a8a46f42 Merge pull request #4579 from MjnMixael/RenderWeaponTechModel
Implement renderTechModel() and renderTechModel2() for weapons
2022-09-07 20:09:06 -04:00
Goober5000 9cb2892ca9 Merge pull request #4629 from Goober5000/script_interpolate_matrices
rotational interpolation
2022-09-07 16:48:26 -04:00
Fabian Woltermann c9c4632a87 Merge pull request #4631 from The-E/fix/lab_crash_when_destroying_dead_ship
Fix lab crash when destroying a destroyed ship
2022-09-07 19:29:43 +02:00
Fabian Woltermann f2abe516f3 check if the current lab object is actually a ship before trying to destroy it 2022-09-07 18:54:05 +02:00
Asteroth cb7d117bdf Automatic thruster activation (#4617)
* automatic thruster activation and glide thruster activation

* finalizing tweaks

* fixes

* whoops
2022-09-07 18:36:37 +09:00
Asteroth de503bb2d5 small fix for banking (#4624) 2022-09-07 18:35:30 +09:00
Goober5000 39b57cbf41 rotational interpolation
Add script support for rotational interpolation of matrixes (orientations) and vectors.
2022-09-06 21:48:03 -04:00
Goober5000 66473f03ab Merge pull request #4621 from Goober5000/fix_supercap_warpout
fix supercap immediate warpout
2022-09-06 18:20:15 -04:00
MageKing17 dbd3721b00 Default-enable inheriting damage type in mods targeting 22.4+. 2022-09-06 13:04:44 -07:00
BMagnu 565047e93b Implement a proper std::optional alternative (#4619)
* Add optional lib

* Replace modelreplace optionals

* Replace Animation Optional

* rework modelanimationdata constructors
2022-09-06 17:05:05 +09:00
BMagnu ee4d74a1af Prevent closed thread from re-closing (#4622) 2022-09-06 03:17:13 +00:00
JohnAFernandez f2038a8a1a Merge pull request #4613 from JohnAFernandez/Add-Interpolate-Matrices-For-Multi
Add interpolate matrices for multi
2022-09-05 19:40:36 -04:00
John Fernandez a93eeebff0 Fixes for Matrix interp 2022-09-05 19:05:12 -04:00
Goober5000 5d57da1755 fix supercap immediate warpout
Supercaps have a special physics flag applied when they warp in so that they slow down quickly.  However, if a supercap immediately warps out again - as in Deus Ex Machina and DEM: Interlude - this physics flag will interfere with the process so that the ship doesn't accelerate immediately even though the warpout portal is opening.  This will cause the ship to miss the portal and clip off a section.  The solution is to clear the flag once the warpout process starts.
2022-09-05 16:35:03 -04:00
Goober5000 fe44dda809 Merge pull request #4521 from Goober5000/end_of_mission_cutscene
mission-specific cutscene enhancements
2022-09-05 04:51:15 -04:00
Goober5000 3da5910c23 Merge pull request #4618 from Goober5000/object_radius
add Radius virtvar for objects
2022-09-05 04:25:22 -04:00
Goober5000 268a483bdb add Radius virtvar for objects
Surprised it hasn't been added before now.
2022-09-05 01:31:18 -04:00
Asteroth 6440c64b77 Fix cfread string's handling of null terminated strings (#4583)
* fix cfread string's handling of null terminated strings

* clarity and doc edits
2022-09-05 04:15:50 +09:00
BMagnu 2a2ed22e5b Enable LuaAI to use more arguments (#4577)
* Enhance LuaAI args

* Pass the Lua Parameters

* Cleanup debugging comment

* Fix warnings
2022-09-03 22:31:52 +09:00
PhantomHoover 402ee8636e Remove unused and costly checksum during model read (#4592)
Profiling shows this taking about 10% of the total time in loading BP's Icarus mission, and the result isn't even read any more!
2022-09-03 22:16:50 +09:00
BMagnu 74ba7899fd Virtual / Modular POFs (#4590)
* Integrate Barebones Framework

* further integration

* Add brak in read

* Defer subsystem generation

* Unentangle pof parsing and subsystem info writing

* finalize modelreplace skeleton

* Begin submodel copying

* First prototype of modular pofs demonstratable

* Allow Submodel Renaming

* Add copy children and set offset

* properly handle depth

* Add header modification

* Fix issues with parsing

* Fix Warnings

* incorporate feedback

* de std-ify

* Incorporate Feedback 2

* Fix macro

* Remove ref

* Enhance error messages
2022-09-03 22:15:56 +09:00
Goober5000 bc5ee36bd8 Merge pull request #4552 from Goober5000/additional_shudder_support
enhanced control for the global ship shudder
2022-09-03 00:12:42 -04:00
naomimyselfandi a8c8549015 Respect hashes in ship and wing names in the loadout screen (#4609)
* Respect hashes in ship and wing names in the loadout screen

* Use get_display_name()
2022-09-02 08:36:07 -04:00
naomimyselfandi 89dc0c66dc Allow assigning support ship per species (#4608)
* Allow assigning support ship per species

* Respond to PR feedback
2022-09-02 08:15:26 -04:00
Kiloku 05495cd1bc Add optional Drop Shadows to HUD (#4543)
* Add drop shadows to HUD text

* Add drop shadow to reticle

* Add control to toggle Drop Shadows

* Double render reticle shadows

* Use gauge_color instead of creating a temp var

* Add shadows to ETS gauges

* Set shadow default to false and adjust formatting

* Restore numbering for controlsconfig
2022-09-01 22:06:00 -04:00
wookieejedi d905410591 Allow mods to change Emp flash color, intensity, and string (#4607)
* Allow mods to change Emp flash color, intensity, and string

EMP is the only text warning that does not use an entry in the strings table (and thus it's the only text warning gauge that mods cannot change and/or translate). This PR adds a string entry for it to allow mods to translate and change the string like all other HUD gauge text warnings.

Also, EMP flash has a hard coded color and strength factor for the flash, whereas generic pain and shield pain have a configurable flash strength factor (shield pain flash is based on shield color, while generic pain is based on damage dealt). This PR also allows modders to change the strength intensity and color following previously established methods.

This PR also fixes a case of "Launch" that fell through the cracks. The function is supplied the translated string, but within the function it does not check for the translation.

Everything is tested and works as expected.

* incorporate feedback

* convert to float during parse

* incorporate more feedback

* improve safety checks
2022-09-01 21:31:16 -04:00
Fabian Woltermann 9a5e34b546 Merge pull request #4612 from The-E/fix/4604-defer_adding_hooks_until_safe
defer adding new scripting hooks until after hook processing is done
2022-09-01 19:03:24 +02:00
Fabian Woltermann a1b48d0a9e defer adding new scripting hooks until after hook processing is done 2022-09-01 18:30:48 +02:00
Taylor Richards bb06c75cb4 handle irc motd error to prevent connection hang (#4610)
A MOTD missing (422) message is non-fatal and should be handled the
same as a MOTD end (376) message to prevent the chat connection
process from hanging.
2022-09-01 05:57:01 -04:00
Taylor Richards ea2d9d9167 prepend PXO game identity to chat lobby window (#4606)
For help with troubleshooting, list what game/mod PXO identifies
this instance is running in the chat lobby stream.
2022-09-01 05:56:24 -04:00
John Fernandez 5d267307b2 Change last orient to sensible value
Previously this could be set to bad data, since the last orient calculated could be based on stale data.
2022-08-31 15:54:56 -04:00
John Fernandez dc625bca33 Change to interpolating matrices
Should create a steadier interpolation
2022-08-31 13:33:25 -04:00
John FernandezandAsteroth 2b0f35b58b Add an explicit Interpolate Matrices function
Written by Asteroth, derived from our ai code.  I added a couple safety checks and changed the type to void to match our library.

Co-Authored-By: Asteroth <[email protected]>
2022-08-31 13:33:25 -04:00
Asteroth a9b485da3d associate a single version to submodel translation (#4605) 2022-08-31 01:13:11 -04:00
MjnMixael ebc8ebd638 Add $Mod Title and $Mod Version options to game_settings.tbl (#4565)
* Add $Mod Title and $Mod Version options to game_settings.tbl for mainhall and Lua use

* Fix comparison

* documentation

* address feedback

* typo
2022-08-30 10:57:06 -04:00
Goober5000 ba82e4ef57 Merge pull request #4582 from Goober5000/model_translation
Model translation
2022-08-29 12:46:28 -04:00
Goober5000 6c7c093729 some more timestamps 2022-08-29 10:42:03 -04:00
Goober5000 3d74bac90b more timestamp migration
More conversion of timestamps to the new system.  Follow-up to #4569.
2022-08-29 09:27:30 -04:00
Goober5000 74ab0f7878 Merge pull request #4601 from Goober5000/good_rearm_time_fix
fix good-rearm-time bug
2022-08-29 00:59:56 -04:00
Goober5000 ef4c3984b5 fix good-rearm-time bug
The original implementation of `ai_good_time_to_rearm` did not revert to being a "bad" time to rearm when the time was up.  This fixes that and adds an AI profiles flag to toggle it.

Also converts `ai_rearm_timestamp` to use the new TIMESTAMP type.
2022-08-29 00:00:15 -04:00
JohnAFernandez 51ca0d20ee Merge pull request #4600 from MjnMixael/ColorTagFix
This should be func not virtvar
2022-08-28 18:17:22 -04:00
Goober5000 41d2cdc82c Merge pull request #4569 from Goober5000/asteroid_debris_timestamps
convert some timestamps to the new system
2022-08-28 17:44:41 -04:00
mjn-mixael 63d4a7ce8c This should be func not virtvar 2022-08-28 14:52:31 -05:00
MjnMixael 6425a999a6 Some User Interface API cleanup and generalization (#4595)
* Move colors up one level and generalize

* Initialize this first

* These are common to both all Briefings, so put them in the general Briefing category
2022-08-28 14:27:17 -04:00
MjnMixael be00e257b8 Scripting functions required for SCPUI conversion of Red Alert (#4587)
* Scripting functions required for SCPUI conversion of Red Alert

* Correct documenation

* Address feedback

* Missed return

* Briefings
2022-08-28 13:18:12 -04:00
wookieejedi 650ae9a074 Some extra safety checks for fiction viewer scripts (#4598)
Protects `Fiction_viewer_active_stage` if it reads a stage of -1 (it would have thrown a vector access error because the index is out of range). Also, given a lot of other scripting functions have additional built in error checks, I just added those to the fiction viewer functions.
2022-08-28 09:11:57 -04:00
MjnMixael 60509b2c3c Scripting functions required for SCPUI conversion of Loop Brief. (#4586)
* Scripting functions required for SCPUI conversion of Loop Brief.

* nullptr

* Fix documentation and make setting choice optional, defaulting to false.

* Documetation fix
2022-08-28 08:52:41 -04:00
Goober5000 67729990e3 we don't need to bump the multi version yet 2022-08-27 13:10:05 -04:00
Goober5000 9116f5de2d improve API 2022-08-27 13:10:05 -04:00
Goober5000 018363dac6 edit lab flag 2022-08-27 13:10:05 -04:00
Goober5000 662d71a57a add model animation support, based on Lafiel's guidance 2022-08-27 13:10:05 -04:00
Goober5000 d3807cbd08 add subsystem sexps 2022-08-27 13:10:05 -04:00
Goober5000 5cf412aad8 implement stepped and regular translation as controlled by subsystems 2022-08-27 13:10:05 -04:00
Goober5000 a1215c6d6f infrastructure for handling submodel translations - maintaining, colliding, rendering 2022-08-27 13:10:05 -04:00
Goober5000 d25a477ffc Merge pull request #4560 from Goober5000/floating_point_followup
floating-point followup
2022-08-27 13:00:43 -04:00
MjnMixaelandAsteroth 150608a980 Base method to determine Debug vs Release (#4597)
* Base method to determine Debug vs Release

* small spelling fix

Co-authored-by: Asteroth <[email protected]>
2022-08-27 11:42:06 -04:00
wookieejedi 1df396bbf4 Allow test_line_of_sight to return intersecting object signature (#4596)
* Allow `test_line_of_sight` to return intersecting object signature

The `test_line_of_sight` can currently provide the closest intersecting distance, but it would be very useful, especially for AI scripting, if this function could also return the signature of the intersecting object. This PR adds that functionality.

Tested and works as expected. Happy to discuss strategies for changing implementation, too. The extra, third return value for object signature was added to `getLineOfSightFirstIntersect` function because that function already returns 2 values. Thus, it will remain compatible with older scripts which only save the first 2 returned values.

* fix documentation

* fix typo

* return object instead of sig

* fix pointer

* use pointer pointer for full fix

* name clarification
2022-08-26 23:05:07 -04:00
MjnMixael a884633723 Fix documentation (#4594) 2022-08-26 23:03:54 -04:00
mjn-mixael 762d855e99 Implement renderTechModel() and renderTechModel2() for weapons 2022-08-26 12:21:40 -05:00
Goober5000 19e407df62 convert some timestamps to the new system
Mostly debris and asteroid timestamps, but also arc timestamps for ships.
2022-08-25 21:40:18 -04:00
Goober5000 8c47a03df9 Merge pull request #4469 from Goober5000/more_voice_acting_buttons
Voice acting manager enhancements
2022-08-25 21:37:55 -04:00
Goober5000 4dfb29f9d8 adjust MOI values per feedback 2022-08-25 21:36:40 -04:00
Goober5000 e67ea63121 use std::max 2022-08-25 21:36:40 -04:00
Goober5000 60540d2a57 floating-point followup
Floating-point comparisons are tricky beasts.  See this article for a good summary of the issues involved:
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

This PR improves support somewhat, although there are obviously situations in the code (such as comparisons to 0) that should still be addressed.  This PR makes the following improvements:
1) Tightens the threshold on `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` from 1e-16 and 1e-36 to FLT_EPSILON
2) Tightens the threshold for parsing `turn_time` in POFs
3) Restores the previous implementation of `fl_equal`
4) Adds a dedicated `IS_MOI_VEC_NULL` for moment of inertia values
5) Improves documentation

Follow-up to #4535 and #4443.
2022-08-25 21:36:40 -04:00
Goober5000 a1f58671e5 enhanced control for the global ship shudder
Allow the variables controlling ship shudder to be independently set using scripting.  Also add new flags to apply the shudder without decay and apply the shudder regardless of camera.

Also change the shudder timestamp to the new style.
2022-08-25 21:36:17 -04:00
Goober5000 c239490899 Merge pull request #4593 from virusman/pr/fix-mac-builds
Fix Mac builds by overriding py7zr version
2022-08-25 21:06:41 -04:00
virusman c30500b66e Fix Mac builds by overriding py7zr version 2022-08-25 17:11:46 -07:00
MjnMixael 6d26547928 Scripting functions necessary for SCPUI Fiction Viewer (#4584)
Scripting functions necessary for SCPUI Fiction Viewer
2022-08-25 18:16:42 -04:00
wookieejedi 261dc508f8 Script function for turnTowardsOrientation (#4578)
A simple copy of the same function on `ai_helper`, now usable on plain ships too.
2022-08-23 22:23:30 -04:00
Goober5000 a0890c291a Merge pull request #4585 from Goober5000/fix_sound_parsing
fix overriding of originally-empty sounds
2022-08-23 22:13:16 -04:00
MjnMixael 89ff900e68 Make cutscenes.tbl extendable with -csn.tbm (#4571)
* Make cutscenes.tbl extendable with -ccn.tbm

* Only let first cutscene of any parsed file be visible by default

* Implement +nocreate support and change modular ext from ccn to csn

* Remove commented out code

* Initialize char* as NULL

* Address feedback

* cleanup
2022-08-23 07:38:46 -04:00
Goober5000 f469da2606 fix overriding of originally-empty sounds
Follow-up to #3743.  A sound that was originally parsed as empty, but then re-parsed as non-empty, would still have the `GAME_SND_NOT_VALID` flag from the original attempt.  This fixes that by clearing the flag each time the filename is read.
2022-08-23 01:28:12 -04:00
Goober5000 38d099ebd6 Merge pull request #4581 from Goober5000/fs1_reticle_supplement
add missing hud_gauges.tbl options
2022-08-22 21:54:11 -04:00
Goober5000 063bf44a19 Merge pull request #4397 from Goober5000/separate_ondeath_hooks
add new hooks for each object type
2022-08-22 19:38:07 -04:00
Goober5000 9c61b389d6 add missing hud_gauges.tbl options
These options for controlling the locking animation are toggled by `$Reticle Style:` but were otherwise not available to HUD gauges.
2022-08-21 22:10:45 -04:00
Goober5000 2b582676a6 make OnShipDeath overridable, per request 2022-08-21 20:53:04 -04:00
Goober5000 ba36ad69f5 add new hooks for each object type
Splits the existing On Death hook into independent hooks for each relevant type.  Adds On Ship Death, On Missile Death, etc.  Also adds On Missile Death Started to complement On Ship Death Started.
2022-08-21 20:53:04 -04:00
BMagnu 76be16f6b2 Fix Typo (#4580) 2022-08-21 23:31:04 +00:00
BMagnu 2557478d55 Allow changing Animation Instance speed (#4572)
* Allow changing animation speed

* Return nil from function

* address feedback
2022-08-22 03:14:34 +09:00
Asteroth c68e737c51 cap zoom distance and lower sensitivity (#4557) 2022-08-22 02:18:01 +09:00
PhantomHoover a95ecf9c9c Fix dangling pointer in sexp.cpp (#4561)
If you define a variable inside a block, its lifetime is confined to that block. So oswpt needs to be lifted into the parent block.
2022-08-22 02:17:49 +09:00
PhantomHoover c153fa8d26 Fix dangling pointer in hudparse.cpp (#4558) 2022-08-22 02:16:42 +09:00
wookieejedi 0f6ea85224 Fix setting of $Shadow Quality Default: (#4576)
`$Shadow Quality Default:` allows mods to specify what the default shadow quality should be, given that `-enable_shadows` flag is used. If a mod used this game settings option but the player did not use the `-enable_shadows` flag, then a parsing error would show up.

This PR fixes that bug by reordering two lines. Tested and fix works as expected.
2022-08-21 12:04:35 -04:00
JohnAFernandez d1d63a912a Prioritize players in object update (#4575)
* Make sure that players are updated the more often

Mitigates the increased latency from multiple clients getting each other's positions.

And Adjust update times:

Because LAN settings are now widely used even on non-LAN connections, shift High to a little bit less frequently in some situations, and adjust LAN settings so that it doesn't take quite as much bandwidth for updating ships that are `rear_medium` or `rear_far`.

Also update comments.

* Remove unused define

This was used in the previous version of the object update code and doesn't need to be here anymore.
2022-08-21 11:15:47 -04:00
BMagnu 55eab4c7e7 Add turnTowardsOrientation (#4563) 2022-08-21 08:24:39 -04:00
Goober5000 38fbe6311e Merge pull request #4555 from MjnMixael/LuaPersonaAccess
Implement ability to get and set a ship's persona index
2022-08-21 00:54:50 -04:00
EatThePath 0b97fc2c8e Merge pull request #4554 from MjnMixael/OnLoadoutStarted
Add hook just before loadout parsing
2022-08-20 23:21:27 -05:00
MjnMixael 5f5b08b594 Mouse option strings (#4570)
* Updated display strings for mouse settings

* Reverse these to match input functionality

* Fix whitespace

* Update mouse.cpp

Fix whitespace again
2022-08-20 22:10:03 -04:00
The Force 88bae48ded Actually Alt-name & callsigns and don't update window if closed 2022-08-20 19:23:20 +01:00
Goober5000 12227fd0ab Merge pull request #4567 from Goober5000/fix_stepped_rotation
fix stepped rotation
2022-08-20 12:15:13 -04:00
Goober5000 74112e13f7 fix stepped rotation
As part of the cleanup in preparation for model translation, there was a bit of code review that was actually incorrect.  The calculation of the current step needs to be rounded down, because the step isn't actually complete until it fully reaches the next number.  Rounding the step causes the submodel to jump around in all sorts of weird ways.

Follow-up to #4443.
2022-08-20 10:53:50 -04:00
wookieejedi f82bf2276b Allows default shadow quality to be per mod (#4553) 2022-08-20 07:16:29 -04:00
BMagnu 61197d4c12 Add SEXP to stop an animation after loop (#4566)
* Add Animation Instance Flags

* Add SEXP barebones

* Unify and simplify animation parsing

* Clean up animation calling and use new animationlist api

* Add missing break
2022-08-20 18:44:17 +09:00
BMagnu 5a53de0eb8 Fix WeaponClass Script Condition (#4559)
* Fix Weaponclass hook

* remove bad include
2022-08-20 03:23:51 +09:00
MjnMixael 9b36fd1f6f Lua scan time (#4551)
* Add Lua access to a ship's Scan Time

* Disallow writing to the shipclass value

* Remove ship access in favor of shipclass access. Resolve read only issue.

* Cleanup and error if script attempts to set Scan Time

* Whoops. Still need to get the shipclass.
2022-08-19 07:57:56 -04:00
PhantomHoover 5ea90dcb46 Fix: Missing includes breaking Linux builds. Including the same thing twice in a row. A completely unnecessary recursive include loop. (#4556) 2022-08-19 07:50:51 -04:00
mjn-mixael 1d5c457c83 Fix issue 2022-08-19 00:28:59 -05:00
Mike N c0c7854c86 Address feedback 2022-08-18 16:01:32 -05:00
Mike N 3e884bd384 Change hook name 2022-08-18 12:57:38 -05:00
Mike N 103522b72a Implement ability to get and set a ship's persona index 2022-08-18 12:55:16 -05:00
Mike N 9a08bbf597 Add hook just before loadout parsing 2022-08-18 11:21:07 -05:00
Goober5000 34018db925 Merge pull request #4421 from Goober5000/add_missing_sexp_goals
add missing SEXP goals
2022-08-18 10:11:39 -04:00
Kiloku 843eda19dd Prevent subsystem fireWeapon scripting function from triggering an assert (#4537)
* Prevent an assert from being triggered down the line by giving a LuaError for invalid weapons

* Reword error message to match function documentation
2022-08-18 21:26:10 +09:00
Asteroth bfb77b2a00 add isPositionInFOV script function (#4540) 2022-08-18 21:25:40 +09:00
BMagnu 269bb1b221 Add scripting API and conditions for executing on server only (#4548)
* Add scripting API and conditions for executing on server only

* feedback
2022-08-18 21:13:05 +09:00
Goober5000 f68849f0d3 add missing SEXP goals
The rearm-ship and fly-to-ship goals were never set up to work with the `add-goal` SEXP.  This adds the necessary code to make them both work.
2022-08-17 23:07:38 -04:00
BMagnu 967619ab09 Add options to selectively disable shadows (#4536)
* Add options to selectively disable shadows

* Encapsulate logic

* Add comment for new functions
2022-08-18 05:42:43 +09:00
Asteroth 6e7fcdaac7 copy script function from ai helpers to plain ships (#4539) 2022-08-17 14:33:06 -04:00
Asteroth 96d6b8bc3f error if they try to change this (#4549) 2022-08-17 14:31:51 -04:00
Goober5000 3d741cea93 Merge pull request #4427 from Goober5000/ai_goal_refinement
Ai goal refinement
2022-08-17 12:24:43 -04:00
JohnAFernandez 9d6cdd9d84 Multi collision fix (ship-ship) collisions (#4542)
Change Interpolation function to bool

And calculate last position instead of just setting it

This should help FSO prevent some very odd collision issues when two ships collide
2022-08-17 09:14:07 -04:00
Goober5000 7eee0f9164 reorder code 2022-08-17 00:37:28 -04:00
Asteroth 8dc9081244 add script function for turret num fire points (#4538) 2022-08-16 12:09:30 -04:00
wookieejedi 31dc7c2269 Fix misspelled ID name for in-game options (#4541)
Thanks to MjnMixael for catching this.
2022-08-15 17:03:52 +00:00
Goober5000 0ca8add409 Merge pull request #4535 from wookieejedi/fix-null-vec-calculations
Fix False Null MOI warnings
2022-08-15 00:33:36 -04:00
wookieejedi 48cd864a59 comment update 2022-08-13 22:16:06 -04:00
Kiloku 89b369cd07 Merge pull request #4352 from Kiloku/aspect_immune_ship_flag
Add new ship flag Aspect_immune
2022-08-14 01:00:19 +01:00
kiloku f78f94c1f0 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into aspect_immune_ship_flag 2022-08-13 19:33:18 -03:00
MageKing17 f2f4ade45e Automatically calculate length of flag name lists. (#4532)
`Ai_flag_names[]`, `Object_flag_names[]`, and `Ship_flag_names[]` all had an associated `#define` containing their length that had to manually be incremented whenever new flag names were added to the list. This commit instead makes the number of flags in the list be computed by simple `sizeof` division, so now adding a new entry just requires adding the entry, rather than remembering to bump a `#define`. Tested in FRED to make sure populating `OPF_SHIP_FLAG` entries still works.
2022-08-13 13:30:06 -04:00
wookieejedi 294b8bd9ec appease clang 2022-08-13 10:58:32 -04:00
wookieejedi 4074cf4c9c Fix False Null MOI warnings
In #4443, `fl_near_zero` was set to use default epsilon values in the `IS_VEC_NULL` check. In this comparison, epsilon is the wrong threshold because it used to have a much smaller threshold. The fix restores the previous definitions of `IS_VEC_NULL` and `IS_VEC_NULL_SQ_SAFE` by exposing the epsilon value as an optional parameter (similar to how `IS_NEAR_ZERO` used to work. This PR also restores `IS_VEC_NULL_SQ_SAFE` where it was replaced by `IS_VEC_NULL.`
2022-08-13 09:59:10 -04:00
wookieejedi 8420e00ee1 Allow Mods to specific default multi update speeds (#4531)
Previosuly, the default object update speed setting for new players was `High`. Many mods, such as Fate of the Galaxy, do multiplayer tests where we have to ensure players are using the highest object update speed, which is LAN. This extra step is cumbersome and prone to players' forgetfulness.

This PR allows mods to set the default multiplayer object update speed for new pilots to mitigate this issue. Tested and works as expected.
2022-08-13 08:57:18 -04:00
Kiloku f767190ce8 Merge branch 'scp-fs2open:master' into aspect_immune_ship_flag 2022-08-13 12:30:04 +01:00
Goober5000 165db5d28b Merge pull request #4400 from Goober5000/lua_frame_cleanup
clean up Lua frame handling a bit
2022-08-12 21:29:20 -04:00
Goober5000 5f1ab9bfa8 Merge pull request #4442 from Goober5000/turret_barrel_fov
add ships.tbl override for turret fov
2022-08-12 21:28:49 -04:00
kiloku da51f480ed Yet another formatting fix 2022-08-12 14:27:17 -03:00
kiloku fa494aa8ce Fix comment formatting 2022-08-12 12:52:04 -03:00
kiloku 4e29b31ed8 Merge branch 'Kiloku-aspect_immune_ship_flag' into aspect_immune_ship_flag 2022-08-12 11:45:33 -03:00
kiloku a90e95bb33 Merge branch 'aspect_immune_ship_flag' of https://github.com/Kiloku/fs2open.github.com into Kiloku-aspect_immune_ship_flag 2022-08-12 11:42:17 -03:00
Goober5000 dfeb15f8e5 more cleanup in preparation for model translation (#4443)
* more cleanup in preparation for model translation

1) Clean up stepped rotation, fixing some logic, adding safeguards for invalid values, and allowing rotations to go in the opposite direction
2) Add more specific SEXP error checking for AWACS and rotating subsystems
3) Assorted refactoring and polishing

* address feedback, plus a bit of extra cleanup
2022-08-11 08:17:17 -04:00
JohnAFernandez 7733f2b0bb Only check that ships have left the mission (#4511) 2022-08-11 08:16:08 -04:00
Goober5000 5a6b389916 Merge pull request #4518 from Goober5000/hud_gauges_ux
don't prune HUD gauges by resolution in FRED
2022-08-09 19:55:50 -04:00
Goober5000 59f0b7eddf Merge pull request #4464 from Goober5000/must_go_faster
add x500 and x1000 movement speeds
2022-08-09 19:55:36 -04:00
Goober5000 ed1bce988f only attenuate a persistent sound by engine strength if it's an engine sound (#4506)
Previously the persistent object sound management code would attenuate all script-assigned sounds by engine strength, and would not play them at all if the engine was off.  This fixes the code to only apply that logic if the sound is in fact and engine sound.
2022-08-09 10:32:58 -04:00
Asteroth 53cb148180 bugfix for salvo mode and forced target (#4508) 2022-08-09 10:32:28 -04:00
JohnAFernandez f2f00cdb6e Bump to 22.3 (#4529) 2022-08-09 07:36:19 -04:00
MageKing17 7bd18faafa Add optional suffixes to add to inherited damage types.
This allows you to automatically append, for example, "-shock" to the damage type to make the shockwave damage type, so a weapon with "Heavy" damage type would automatically have its shockwave assigned the damage type "Heavy-shock".
2022-08-06 23:04:01 -07:00
MageKing17 9869f2f8d5 Allow shockwaves to have a default damage type.
This includes both separate defaults for dinky and non-dinky shockwaves, as well as automatic inheritance of the parent weapon's damage type (and if both are enabled simultaneously, the default is only used if there's nothing to inherit because the parent weapon doesn't set a damage type).
2022-08-06 23:04:01 -07:00
MageKing17 372f96cfc0 Const-correctness for damage_type_add() and damage_type_get_idx().
Neither of these modify their input, so the argument not being `const` was just stopping `const` strings from being used as input.
2022-08-06 23:04:01 -07:00
Tyler Blount 8038422eda Capture empty strings too 2022-08-06 16:21:18 -07:00
Tyler Blount dca5d84ae6 Merge pull request #4502 from Kiloku/markdown-testing
Preliminary Changelog for 22.2.0
2022-08-06 15:22:35 -07:00
Kiloku c5bd3ba96e Update Changelog.md 2022-08-05 09:31:30 -03:00
Kiloku f75837922e Formatting fix 2022-08-05 09:30:56 -03:00
Kiloku 71fc9cc37b Update Changelog.md 2022-08-05 09:25:19 -03:00
JohnAFernandez 6359cb973c Merge pull request #4526 from JohnAFernandez/Allow-OBJ-GHOST-in-Assert
Add OBJ_GHOST to this assert and add comments
2022-08-04 19:59:06 -04:00
John Fernandez bafa6d9896 Add OBJ_GHOST to this assert and add comments
This assert catches any weapon's parent object type, which can include OBJ_GHOST, which is a dead player.  OBJ_GHOST is being encountered in this function using BPC when the player dies via beam weapon and (likely) when the players weapon are hitting an enemy ship at the same time.  Because the player ship can damage an enemy after it is dead, allow for that in this function.
2022-08-03 10:34:39 -04:00
Kiloku 7f1310bef5 Update Changelog.md 2022-08-03 09:19:55 -03:00
Goober5000 d48cab0fce mission-specific cutscene enhancements
Add `$Post-debriefing Cutscene:`, and make `$Post-briefing Cutscene:` a synonym for `$Pre-game Cutscene:`.
2022-08-01 20:58:19 -04:00
Goober5000 8c7f9e5e9e don't prune HUD gauges by resolution in FRED
FRED needs to work with any HUD gauge in the table, so don't prune any based on resolution.  Fixes #4517.

This also improves checking for duplicate names in the FRED gauge list.
2022-07-30 17:31:48 -04:00
Kiloku 6095e2ae1c Hopefully final changelog version for 22.2.0! 2022-07-28 07:42:59 -03:00
Kiloku f24a8e6876 Add changes up to RC8 2022-07-25 08:51:54 -03:00
Kiloku a1973e323e Move item to the correct category. 2022-07-25 08:51:27 -03:00
Kiloku 72d9d86008 Address feedback 2022-07-25 08:42:14 -03:00
Kiloku fec0c7a3b6 Merge branch 'scp-fs2open:master' into markdown-testing 2022-07-25 12:37:45 +01:00
Kiloku 4619ab6b59 Minor grammar, spelling and formatting fixes 2022-07-20 11:32:15 -03:00
Kiloku 4070013d8a Add changes up to RC7 2022-07-20 11:08:23 -03:00
Kiloku c8fac05fbe Update Changelog.md 2022-07-20 10:23:52 -03:00
Kiloku 0bc03a1dab Improve changelog from feedback 2022-07-20 10:21:40 -03:00
Kiloku b1c0793bff Preliminary Changelog for 22.2.0 2022-07-19 19:15:09 -03:00
Adam Leach 92d4820995 Fix envmap shading transparent pixels. 2022-07-16 17:46:41 +01:00
Adam Leach 6b6b58fa9d specColor is already premultiplied by aoFactors.y 2022-07-13 23:38:14 +01:00
Adam Leach b8f0b8ec05 optimisation. with envmap, halfVec == normal by definition. 2022-07-13 23:22:23 +01:00
Adam Leach a8f1f668c1 Fixed bug where anti-glint could be too strong 2022-07-13 23:12:35 +01:00
Adam Leach d2d7f17385 moved anti-glint so IBL glint prevented too. 2022-07-13 23:12:11 +01:00
John Fernandez 4b23a1bd44 Feedback 2022-07-12 21:33:16 -04:00
John Fernandez 9f40a341cc Allow multilock between traitors
Use the proper attacking function here, as traitors need to be able to attack each other in dogfight mode.
2022-07-12 21:24:30 -04:00
Goober5000 826dfd01fc clean up Lua frame handling a bit
There's no need to keep all this infrastructure to run every frame for a barely used situation.  This cleans it up a bit and does the position reset in the actual drawString function.
2022-07-08 18:59:10 -04:00
Goober5000 67d8d56dd0 add a message if the copy detects inconsistent personas 2022-07-08 18:55:08 -04:00
Goober5000 b95e04743e restrict to wingman personas rather than fighter/bombers 2022-07-08 00:30:10 -04:00
Goober5000 495010275b add helpful dialog box 2022-07-06 12:08:38 -04:00
Goober5000 4b686359ec tweak dialog and add note 2022-07-05 22:53:26 -04:00
Goober5000 09e72fe917 bugfixes 2022-07-05 22:43:58 -04:00
Goober5000 7c019c4157 implement functions 2022-07-05 22:43:58 -04:00
Goober5000 bc44909501 constify 2022-07-05 21:14:30 -04:00
Goober5000 f942837785 stub out functions 2022-07-05 20:56:03 -04:00
Goober5000 72355be198 FRED UI for new voice acting buttons 2022-07-05 20:49:27 -04:00
Adam Leach af1da1c93f Potential fix for warp portal envmap lighting? 2022-07-04 10:42:31 +01:00
Goober5000 d0d22f04a7 add x500 and x1000 movement speeds
As requested by Asteroth.
2022-07-02 13:26:27 -04:00
Goober5000 abb81c6eaa add ships.tbl override for turret fov
Add `$Turret Barrel FOV:` option for turrets in ships.tbl, as requested by CP5670.
2022-06-25 18:42:50 -04:00
the-maddin ddeb40aa61 checks fix 2022-06-25 00:19:11 +02:00
Goober5000 5b87f62d6a add optional distance to ai-stay-near-ship 2022-06-19 19:04:45 -04:00
Goober5000 b0057e959d move ai goal stuff to aigoals.h 2022-06-19 19:04:44 -04:00
Adam Leach 5e4d6cc5de Implement IBL based off envmaps
Fixed environment map rendering


shift fresnel term to match ordering of ComputeGGX, document shader code.


Envmaps: Use tangentMatrix to build local coordinate system 


Fixed geometry self-shading calcs to improve shading of rough surfaces.


Cite paper correctly


optimsed env sampling 


Put envmap face generation a loop to make it easier to read


Precalculate points on circle for even faster envmap sampling..


Guard against NaNs


Revert to simpler envmap calcs, significantly faster on slower GPUs.


typo


We don't need the sample points any more.


Diffuse IBL shading


Fix gamma issues in envmap rendering


AO term on envmaps.


fix lab crash with retail data


Always render envmaps - PBR shouldn't care if a shine/specmap exists.
2022-06-18 19:57:54 +01:00
Adam Leach 5f4566620f UE4 based shaders
Better approximation in geometry/visibility term
Fixed Fresnel/Schlick model to be dependent on view in line with learn openGL PBR theory
introduce energy conservation term for diffuse rendering

Just use specColor instead of trying to figure out metalness.


Pull out g1 function for reuse


UE4 based shaders

Better approximation in geometry/visibility term
Fixed Fresnel/Schlick model to be dependent on view in line with learn openGL PBR theory
introduce energy conservation term for diffuse rendering

Just use specColor instead of trying to figure out metalness.


Pull out g1 function for reuse
2022-06-18 19:57:12 +01:00
the-maddin db68e30862 fix qvector error 2022-06-13 23:02:48 +02:00
David Gibson e78157908d fixed some mishandling of lighting modifiers. 2022-06-12 18:51:08 -05:00
the-maddin a1fc0907cf unified warning message handling 2022-06-13 01:00:04 +02:00
The Force 16d32f3730 Fix text entry
Try and fix editable dropdowns
Change  pass-by value rather than refrence
2022-06-12 02:24:19 +01:00
the-maddin 2c5f52a28d Integrated error checking
numbered to reflect campaigntreewnd.cpp
2022-06-12 02:04:12 +02:00
The Force 1e7cdbda47 Move All Ship Editor file so subfolder
Move All Ship Editor file so subfolder so it easier to navigate
2022-06-11 00:02:42 +01:00
The Force 7b04b3b27a Missed bit 2022-06-10 23:27:14 +01:00
The Force 13f3322ae8 Address Feedback 2022-06-10 23:24:34 +01:00
David Gibson 70b9c34f1a move techroom/selection/breifing 'room' lights to a common function and
augment lighting setup for current rendering
2022-06-04 20:40:12 -05:00
the-maddin 3d5ae71fc6 Merge remote-tracking branch 'refs/remotes/upstream/master' into qt-campaign-editor 2022-06-04 23:46:34 +02:00
the-maddin 5d0fadba19 doxy 2022-06-04 23:46:16 +02:00
kiloku 69d3f47e34 Re-added missing linebreak in ship flag list 2022-06-04 14:02:54 -03:00
kiloku ecbebfab00 Fix some undesired whitespace changes 2022-06-04 13:26:28 -03:00
kiloku aecc626634 Add new ship flag Aspect_immune which stops ships from being locked onto by aspect seeking weapons 2022-06-04 12:54:16 -03:00
David Gibson 13180db544 Merge remote-tracking branch 'origin/master' into light-flags-rubicon-2 2022-06-03 15:50:26 -05:00
David Gibson a7b59b4620 further post-rebase repair of light flags command line and leftover specular 2022-06-03 15:39:08 -05:00
David Gibson ee72bcec69 cleanup of leftover/post-rebase specular references 2022-06-03 14:07:57 -05:00
David Gibson cfa7d1736b Removed specular light color as a separate value in the uniform buffers. 2022-06-03 13:27:06 -05:00
David Gibson 252d0cb56a handled specular sun depreciation and general removal of specular value handling 2022-06-03 13:27:05 -05:00
David Gibson 4e835bafdb revise command-line and emissive handling 2022-06-03 13:26:29 -05:00
David Gibson 33f8109dfb make static some functions that can be static 2022-06-03 13:26:05 -05:00
David Gibson 89e17ec2f1 cleanup unused new function 2022-06-03 13:26:05 -05:00
David Gibson d73f8bf968 Wire lab up to new lighting controls, and provide backwards-compatible defaults for emissive. 2022-06-03 13:26:05 -05:00
David Gibson 6ee2699f51 Switched over to new command line arguments 2022-06-03 13:26:05 -05:00
David Gibson 23a46dcb65 Applying directional brightness profile value, disconnected spec flags and made specular light always equal to diffuse light 2022-06-03 13:22:54 -05:00
The Force 9a04166d9f Add comment to address feedback
Add comment
2022-05-25 16:13:49 +01:00
The Force f86a869509 Change class to dialog rather than widget 2022-05-25 16:13:49 +01:00
The Force e4cadff3f5 const initial status editor
Finish Consting
2022-05-25 16:13:49 +01:00
The Force 465c8cb2d4 More Doxy and clarify function names
Finish doxy ship editor
2022-05-25 16:13:49 +01:00
The Force 9acc16dde3 Properly encapsulate data 2022-05-25 16:13:49 +01:00
The Force 6fc5f2e979 Fix crash bug with cargo 2022-05-25 16:13:49 +01:00
The Force a6665320e9 Add clang fixies that accidently got removed 2022-05-25 16:13:49 +01:00
The Force 9100cc9bc5 Const Parameters
Properly privatise and const model data
2022-05-25 16:13:49 +01:00
the-maddin 2eb6410de8 Merge branch 'master' into qt-campaign-editor 2022-05-22 22:36:23 +02:00
the-maddin 401a26623a changes z64555 v1.4 2022-05-22 15:17:31 +02:00
the-maddin 9336d7264f changes z64555 v1.3 2022-05-22 14:17:15 +02:00
The Force 6024b0026f Convert to unique_ptr 2022-05-18 18:59:53 +01:00
The Force 4320760e8e Merge branch 'master' into fix/shipEditorCleanup 2022-05-18 18:16:26 +01:00
The Force a20afd147e Doxygen Ship Editor 2022-05-17 19:27:49 +01:00
The Force cea490ab62 Constify Ship Editor
Add missed lines
2022-05-17 17:42:56 +01:00
The Force 20faa3083d Merge branch 'master' into fix/shipEditorCleanup 2022-05-17 15:18:57 +01:00
The Force 65ef9e3ac4 Fix references to changed name 2022-05-15 13:34:53 +01:00
The Force 42e2870410 Merge branch 'feature/shipTBLViewer' into fix/shipEditorCleanup 2022-05-15 13:32:56 +01:00
The Force ca3bc07959 More descriptive Name 2022-05-15 13:31:15 +01:00
the-maddin ec3ad17fa2 changes z64555 v1.2 2022-05-09 01:35:15 +02:00
the-maddin d9a9cb5f9d changes z64555 v1.1 2022-05-09 01:34:47 +02:00
The Force f21ac8fd04 Clean-up Special stats dialog 2022-05-04 03:43:17 +01:00
The Force cb36670ce0 Clang-tidy 2022-05-04 03:39:01 +01:00
The Force bc2be1cbdf Clean-up Player orders dialog 2022-05-04 03:36:06 +01:00
The Force fa4c49e951 Clean-up Texture Replacement 2022-05-04 03:23:34 +01:00
The Force b6e259e374 Clean-up Flags Dialog 2022-05-04 03:05:52 +01:00
The Force ab307fe4a6 Clean-up Initial Status Dialog 2022-05-04 02:58:41 +01:00
The Force 9e8982edb4 GCC Appeasement 2022-05-01 20:22:08 +01:00
The Force 9afe340f46 Cleqanup Goals Dialog 2022-05-01 20:05:24 +01:00
The Force c07a679d87 Add TBL VIewer 2022-05-01 19:20:11 +01:00
The Force ba2ef3cb9d Fix newtype loading 2022-05-01 18:45:27 +01:00
The Force 30537a2ce9 Clang fix 2022-04-30 23:56:04 +01:00
The Force 328d3cce8c Try to avoid trigraph error 2022-04-30 23:43:18 +01:00
The Force b18f9ecee0 More GCC 2022-04-30 23:41:04 +01:00
The Force a5dbc27018 Cater to gcc 2022-04-30 23:33:58 +01:00
The Force c18ae68d65 Missed this 2022-04-30 23:29:29 +01:00
The Force 6c22137075 Change to new dialog loading style 2022-04-30 23:27:26 +01:00
The Force 41a3d9561d Add Tooltips 2022-04-30 23:16:04 +01:00
The Force e3228c0241 Fix Crash Bug 2022-04-30 18:02:49 +01:00
The Force b63da42715 Memory Cleanup 2022-04-30 16:44:19 +01:00
The Force 9d6f729f81 Add TBL Viewer 2022-04-30 14:48:00 +01:00
the-maddin 0a7ff1bc1a changes jg18 v3 2022-04-29 01:28:37 +02:00
the-maddin e5f80a160a incorporate feedback 2022-04-21 00:32:36 +02:00
the-maddin e3a153ef5b Clarify abbreviations 2022-04-11 23:36:39 +02:00
the-maddin ccf86293ce incorporate feedback 2022-03-29 00:59:59 +02:00
the-maddin f142780b95 clang 2022-03-25 00:55:49 +01:00
the-maddin 48f99e36b0 Merge branch 'master' into qt-campaign-editor 2022-03-25 00:22:45 +01:00
the-maddin 8bf51ff858 fix CheckedDataListModel pointer issue
(cherry picked from commit 3d4c03ede65657c38d5271cd70caa2e0eedef6bf)
2022-03-25 00:15:18 +01:00
the-maddin 84cb7fddba Export campaign model to Campaign struct
(cherry picked from commit 00ca3070063ba9859d316ac5e5da27aa67084561)
2022-03-25 00:15:15 +01:00
the-maddin 566d15dfec Add first mission selection, always keep valid
(cherry picked from commit 961a58a9b6bc261b6d11bf37a90bd457f602edc0)
2022-03-25 00:15:12 +01:00
the-maddin 0d82ca5be2 clang stuff
(cherry picked from commit 3ca042cc115372043527b94156faeb69b542aac7)
2022-03-25 00:15:06 +01:00
the-maddin 4857f320ad Saving part 2: Campaign Specs to Campaign
Move model Campaign Steps to engine campaign
struct

(cherry picked from commit 796eae1a8e003ba9b704692d460f909c20f49970)
2022-03-25 00:15:02 +01:00
the-maddin 636f6933be Ensure correct flags and loop state
(cherry picked from commit 68583f28cffa37a284b236173c29f11bf8ede1c5)
2022-03-25 00:14:58 +01:00
the-maddin a8483c5a8a Saving part 1: Output Campaign to file
Output a Campaign with ordered cmissions to a file,
like it is read.
This version does not depend on any FRED model/
implementation.

(cherry picked from commit c8aa141295de9f45813bc2bb762f3f2290ebad6d)
2022-03-25 00:14:53 +01:00
the-maddin 5eb4c35572 clang msvc
(cherry picked from commit 6faa6d41d87fdca6c9acc24b080451cd3fbfce59)
2021-09-28 22:46:30 +02:00
the-maddin 15752d1729 Integrate branch buttons into context menu
(cherry picked from commit fb986ea29efd7e9612d76e0722733d33a2f95aa3)
2021-09-28 20:23:13 +02:00
the-maddin 413842c84a Branch moving & branch UI misc
(cherry picked from commit 9ecb5b734de149ad85e2ad3c4409a20714b4f96a)
2021-09-28 20:23:13 +02:00
the-maddin e41bde6dad Fix branch sexptree popup menu part 3
(cherry picked from commit 4cd06c05b56518ac92ca0d63203437a7fa38de6c)
2021-09-28 20:23:13 +02:00
the-maddin e37ca8fd8e Model data access fix
(cherry picked from commit
effea261ecb607c09422ec9973522b02821bee6e)
2021-09-28 20:23:13 +02:00
the-maddin e2099271c6 Fix branch sexptree popup menu part 2
(cherry picked from commit 53d5d25c3a21876b3246af3eeff91ded7c37b678)
2021-09-28 20:23:13 +02:00
the-maddin 19817f4cda reorder model impl and lazy init some constants
(cherry picked from commit f2b2385a27b52a2088421c203560309e38444fcd)
2021-09-28 20:23:13 +02:00
the-maddin c41e5c9d7f Always replace corrupted model after load attempt
(cherry picked from commit ed8be26f81e80b72e147ea54b54b7440606e302c)
2021-09-28 20:23:13 +02:00
the-maddin b08109c2fe Fix branch sexptree popup menu part 1
(cherry picked from commit 17319ea5deb48e4ac27af804033dabc5907e781f)
2021-09-28 20:23:13 +02:00
the-maddin 30b484b276 Use AssociatedPlainTextDocument
(cherry picked from commit 5abb00e4382840e04474905f1477121173bd986a)
2021-09-28 20:23:13 +02:00
the-maddin 2989034394 Dialog cleanup
(cherry picked from commit 024be9d0e6d3c447c6b2bc972be4dddc9b31bfc2)
2021-09-28 20:23:13 +02:00
the-maddin eec2ce1713 Model structure and TextEdit cleanup
(cherry picked from commit 306de2da527128583841f0cb73363fb5ca222b16)
2021-09-28 20:23:13 +02:00
the-maddin 439f633364 Add branches & conditions in model
(cherry picked from commit 730bf0d9d5ff55b1b0e99c73c79ce12e5af67d48)
2021-09-28 20:23:13 +02:00
the-maddin 458d2f5e12 custom mission selection & linking context menu
(cherry picked from commit 31d2b9d0e02c803fa06b369772d754da70187c3c)
2021-09-28 20:23:13 +02:00
the-maddin 2f361340fc Parse eligible & campaign missions for event names
(cherry picked from commit 62a6ae9f6fc8cb7955b7804aeb951564c5bd3bd0)
2021-09-28 20:23:13 +02:00
the-maddin 41d65630f8 validate and use current branch index
(cherry picked from commit 072796d1f76325ec5e9be38c899951420d3ea781)
2021-09-28 20:23:13 +02:00
the-maddin 5e57094f8e Merge branch 'master' into qt-campaign-editor 2021-09-19 14:27:07 +02:00
the-maddin ae9b604f44 Merge branch 'master' into qt-campaign-editor 2021-06-29 23:31:08 +02:00
the-maddin 8db39a6c61 WIP note
(cherry picked from commit fdd2b54af8c4a9ca7f1370dfba09f277a78edc3c)
2021-06-29 23:27:58 +02:00
the-maddin ec84c7183e comboBox tweak
(cherry picked from commit cf0232f33f20b27ffa03ff2ee4ed6590822f149c)
2021-06-29 23:27:54 +02:00
the-maddin 16a5b1ccc7 Improve mission list robustness 2021-06-29 01:14:11 +02:00
the-maddin 856726d000 pick pulled model changes 2021-06-29 01:14:07 +02:00
the-maddin dd2c5a22a4 Comboboxes for loop brief & anim
also cmbBox cleanup
2021-06-29 01:12:35 +02:00
the-maddin b97129da86 Cleanup mission list loading, drop mission object 2021-06-29 01:10:56 +02:00
the-maddin a7badba0d8 cleanup 2021-06-29 01:10:52 +02:00
the-maddin 93a1f3e6b4 Use finer UI update control instead of modelChanged 2021-06-29 01:10:29 +02:00
the-maddin b19399021d load and display loop data 2021-06-29 01:08:38 +02:00
the-maddin c95fe1c9d1 clang
(cherry picked from commit 488dcdb1cc762d51826409df6d239fbad978a1e6)
2021-06-20 12:54:51 +02:00
the-maddin f405496791 Clang-tidy fixes 2021-06-20 01:21:32 +02:00
the-maddin 33b63e5b6c Implement FRED-Mission button 2021-06-20 00:56:10 +02:00
the-maddin b64bd789b6 Some more clang fixes 2021-06-20 00:56:10 +02:00
the-maddin 9011319e2f Use new CheckedDataListModel 2021-06-20 00:56:10 +02:00
the-maddin 3fd825b1de SaveAs shortcut 2021-06-20 00:56:10 +02:00
the-maddin b21d380240 Handle branch tree selection 2021-06-20 00:56:10 +02:00
the-maddin c2e8ba9fa6 Use campaign branch sexp_tree and load formulas 2021-06-20 00:56:10 +02:00
the-maddin 61fb9c5dd1 CMission Data: use combo boxes where possible 2021-06-20 00:56:10 +02:00
the-maddin f7ecb85df6 CampaignMissionData: load cmission, display
editable cmission data

Also make CheckedDataList construction translator
callbacks explicitly const.
2021-06-20 00:56:10 +02:00
the-maddin 144ae46ccc model initialisation cleanup 2021-06-20 00:56:10 +02:00
the-maddin 1a81682472 Show player number of multi campaigns
according to first mission.
2021-06-20 00:56:10 +02:00
the-maddin 3349c99a0a Clean up data entry widget signalling 2021-06-20 00:56:10 +02:00
the-maddin 6e2723a313 Update widgets on mission selection change 2021-06-20 00:56:10 +02:00
the-maddin 9241c49f32 Warn before dropping unloadable missionDropped
because it won't be shown for re-selection after
next load of campaign
2021-06-20 00:56:10 +02:00
the-maddin 80fc7a5cbf gcc11: add missing include
(cherry picked from commit 9959cdad5535abf56a156f1924d260a64e688d57)
2021-06-20 00:56:10 +02:00
the-maddin ca982fa1ae Immutable campaignType, file load & menu changes
Since the campaign type determines the compatible
missions, changing it would require invalidating
the mission list. So I'm restricting it to being
set on campaign creation.
2021-06-20 00:56:10 +02:00
the-maddin 20fc9d629c Create available mission list
Unlike FRED, I'm using a checked list of all
missions, not a simple list of the unused ones.
I'm showing uneditable / packaged missions
in yellow, missing / unloadable missions in red.
Also keeping missions loaded.
2021-06-20 00:56:10 +02:00
the-maddin 881f47670c Use CheckedDataListModel improvements
Make necessary changes and improvements
in model usage.
2021-06-20 00:56:10 +02:00
the-maddin 54a64cb91e Deal with windows filenames in CFile
(cherry picked from commit 0ed5a18fd9883166bbef8360ae9f2cfed3ae7f69)
2021-06-20 00:56:10 +02:00
the-maddin 232eb2a099 Allow full-length paths for campaign files
so qtfred can load them fro outside the cfile tree.
2021-06-20 00:56:10 +02:00
the-maddin fc65df048f Register initial... lists changes 2021-05-06 00:48:37 +02:00
the-maddin f2cfac14b3 Fix compile issue, correct reload behaviour 2021-05-06 00:37:10 +02:00
the-maddin 5cbe64c793 Implement initial ships/weapons lists, intialize
model by loading campaign file
2021-05-06 00:03:15 +02:00
the-maddin e2b9a5a1a2 Initial campaign loading & trivial uiUpdate
functionality
2021-05-06 00:03:08 +02:00
the-maddin da83c3aa41 Tie campaignmodel to campaign file, use QStrings in
model

String conversion should happen on load/save, not
every UI update/cahnge
2021-05-06 00:02:58 +02:00
the-maddin 30237c8988 initial updateUI, explicit model modification
flagging
2021-05-06 00:02:56 +02:00
the-maddin ca23d30c99 File ops UI logic, cleanup 2021-05-06 00:02:43 +02:00
the-maddin 53e30ba771 Connect some more signals/slots 2021-05-06 00:00:46 +02:00
the-maddin c4f84ea9f5 alternative layout 2021-05-05 23:58:50 +02:00
the-maddin 7acd4c6491 sync changes to model (initial) 2021-05-05 23:58:50 +02:00
the-maddin 04c136f59e add model with initial functionality 2021-05-05 23:58:50 +02:00
the-maddin 3768473270 Add more slots 2021-05-05 23:58:50 +02:00
the-maddin 52427a7ec3 Add initial CampaignEditorDialog
ui with most basic functionality
2021-05-05 23:58:50 +02:00
1045 changed files with 178693 additions and 113101 deletions

No files matched your search

-8
View File
@@ -1,14 +1,6 @@
cmake/ @asarium
ci/ @asarium @z64555
code/executor/ @asarium
code/scpui/ @asarium
code/scripting/ @asarium
code/controlconfig/ @z64555
code/model/modelanimation*.* @bmagnu
+94 -63
View File
@@ -15,27 +15,32 @@ jobs:
configuration: [FastDebug, Release]
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-8a6bbbe
container: ghcr.io/scp-fs2open/linux_build:sha-3d30dc5
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
# - 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -109,31 +114,36 @@ jobs:
name: Checkout
with:
submodules: true
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
# - 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
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
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -144,11 +154,19 @@ jobs:
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" ..
if [ "$ARCHITECTURE" = "Win32" ]; then
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -DFSO_BUILD_WITH_VULKAN="OFF" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
else
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
fi
- name: Compile
working-directory: ./build
env:
@@ -220,26 +238,32 @@ jobs:
name: Mac
runs-on: macos-latest
steps:
- name: Cache Qt
id: cache-qt-mac
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-mac.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
# - name: Cache Qt
# id: cache-qt-mac
# 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-mac.outputs.cache-hit }}
# setup-python: 'false'
# aqtversion: ==1.1.3
# py7zrversion: '==0.19.*'
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: 0
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Set up test version
shell: bash
run: |
@@ -263,13 +287,15 @@ jobs:
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Package build result
working-directory: ./build
run: cd bin && tar -cvzf macos-build.tar *.app
working-directory: ./build/bin
# Use GNU tar here (part of runner image) to avoid weird corruption bug with bsdtar
# Ref: https://github.com/actions/runner-images/issues/2619
run: gtar -cvzf macos-build-${{ matrix.configuration }}.tgz *.app
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: mac-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/bin/macos-build.tar
path: ${{ github.workspace }}/build/bin/macos-build-${{ matrix.configuration }}.tgz
mac_zip:
name: Build Mac distribution zip
needs: build_mac
@@ -292,6 +318,11 @@ jobs:
with:
name: mac-FastDebug
path: builds
- name: Unpack builds
working-directory: ./builds
run: |
tar -xvzf macos-build-Release.tgz
tar -xvzf macos-build-FastDebug.tgz
- name: Create Distribution package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Mac
+173 -49
View File
@@ -44,11 +44,11 @@ jobs:
name: Linux
needs: create_release # Don't run this job until create_release is done and successful
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-8a6bbbe
container: ghcr.io/scp-fs2open/linux_build:sha-3d30dc5
steps:
- name: Cache Qt
id: cache-qt-lin
uses: actions/cache@v1
# - name: Cache Qt
# id: cache-qt-lin
# uses: actions/cache@v1
# cache the Qt directory so we don't have to reinstall it every time
# cache.inputs:
# path - A list of files, directories, and wildcard patterns to cache and restore. See @actions/glob for supported patterns.
@@ -56,11 +56,11 @@ jobs:
# restore-keys - An ordered list of keys to use for restoring the cache if no cache hit occurred for key
# cache.outputs:
# cache-hit true when an exact match was found for the key, false otherwise.
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
# with:
# path: ${{ github.workspace }}/../Qt
# key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
# - name: Install Qt
# uses: jurplel/install-qt-action@v2
# installs Qt in the action workflow
# install-qt-action.inputs:
# version desired qt version to install
@@ -81,18 +81,23 @@ jobs:
# Qt5_DIR / Qt6_DIR
# Qt bin dir appended to PATH
# QT_PLUGIN_PATH, QML2_IMPORT_PATH, PKG_CONFIG_PATH, LD_LIBRARY_PATH
with:
version: ${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/..
cached: ${{ steps.cache-qt-lin.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
# 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
# checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
name: Checkout
with:
submodules: true # `true` to checkout submodules, `recursive` to recursively checkout submodules
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -186,34 +191,39 @@ jobs:
name: Checkout
with:
submodules: true
- name: Cache Qt
# Cache Qt
id: cache-qt-win
uses: actions/cache@v1
# - name: Cache Qt
# # 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)
# # Install Qt 32bit if matrix.arch == Win32
# 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)
# # Install Qt 64bit if matrix.arch == x64
# 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
path: ${{ github.workspace }}/../Qt
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt (32 bit)
# Install Qt 32bit if matrix.arch == Win32
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)
# Install Qt 64bit if matrix.arch == x64
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
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -224,11 +234,19 @@ jobs:
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" ..
if [ "$ARCHITECTURE" = "Win32" ]; then
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -DFSO_BUILD_WITH_VULKAN="OFF" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
else
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
fi
- name: Compile
working-directory: ./build
env:
@@ -310,11 +328,117 @@ jobs:
${{ steps.generate_package.outputs.package_path }}
${{ steps.generate_package.outputs.debug_path }}
build_mac:
strategy:
matrix:
configuration: [FastDebug, Release]
compiler: [clang]
arch: [x86_64]
name: Mac
needs: create_release
runs-on: macos-latest
steps:
# - name: Cache Qt
# id: cache-qt-mac
# 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-mac.outputs.cache-hit }}
# setup-python: 'false'
# aqtversion: ==1.1.3
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: 0
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
ARCHITECTURE: ${{ matrix.arch }}
JOB_CMAKE_OPTIONS: ${{ matrix.cmake_options }}
run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh
- name: Compile
working-directory: ./build
run: LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Package build result
working-directory: ./build/bin
# Use GNU tar here (part of runner image) to avoid weird corruption bug with bsdtar
# Ref: https://github.com/actions/runner-images/issues/2619
run: gtar -cvzf macos-build-${{ matrix.configuration }}.tgz *.app
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: mac-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/bin/macos-build-${{ matrix.configuration }}.tgz
mac_zip:
name: Build Mac distribution zip
needs: build_mac
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@v2
with:
name: mac-Release
path: builds
- name: Download FastDebug builds
uses: actions/download-artifact@v2
with:
name: mac-FastDebug
path: builds
- name: Unpack builds
working-directory: ./builds
run: |
tar -xvzf macos-build-Release.tgz
tar -xvzf macos-build-FastDebug.tgz
- name: Create Distribution package
id: generate_package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Mac
- name: Upload result package
uses: actions/upload-artifact@v2
with:
name: ${{ steps.generate_package.outputs.package_name }}
path: ${{ steps.generate_package.outputs.package_path }}
- name: Publish result package
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.generate_package.outputs.package_path }}
post_build:
name: Post builds to Nebula and Forum
needs: [linux_zip, windows_zip]
needs: [linux_zip, windows_zip, mac_zip]
uses: ./.github/workflows/post-build-release.yaml
with:
linux_result: ${{ needs.linux_zip.result }}
windows_result: ${{ needs.windows_zip.result }}
mac_result: ${{ needs.mac_zip.result }}
releaseTag: ${{ github.ref_name }}
secrets: inherit
+6
View File
@@ -24,6 +24,12 @@ jobs:
name: Checkout
with:
submodules: true
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
+94 -63
View File
@@ -15,23 +15,22 @@ jobs:
configuration: [FastDebug, Release]
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-8a6bbbe
container: ghcr.io/scp-fs2open/linux_build:sha-3d30dc5
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
# - 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:
@@ -42,6 +41,12 @@ jobs:
[[ "${{ 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -122,31 +127,36 @@ jobs:
[[ "${{ 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
# - 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
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
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -157,11 +167,19 @@ jobs:
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" ..
if [ "$ARCHITECTURE" = "Win32" ]; then
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -DFSO_BUILD_WITH_VULKAN="OFF" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
else
cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$SIMD" \
-DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \
-DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \
-G "Visual Studio 16 2019" -T "v142" ..
fi
- name: Compile
working-directory: ./build
env:
@@ -234,26 +252,32 @@ jobs:
name: Mac
runs-on: macos-latest
steps:
- name: Cache Qt
id: cache-qt-mac
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-mac.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
# - name: Cache Qt
# id: cache-qt-mac
# 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-mac.outputs.cache-hit }}
# setup-python: 'false'
# aqtversion: ==1.1.3
# py7zrversion: '==0.19.*'
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
fetch-depth: 0
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Set up test version
shell: bash
run: |
@@ -276,13 +300,15 @@ jobs:
XDG_RUNTIME_DIR: /root
run: $GITHUB_WORKSPACE/ci/linux/run_tests.sh
- name: Package build result
working-directory: ./build
run: cd bin && tar -cvzf macos-build.tar *.app
working-directory: ./build/bin
# Use GNU tar here (part of runner image) to avoid weird corruption bug with bsdtar
# Ref: https://github.com/actions/runner-images/issues/2619
run: gtar -cvzf macos-build-${{ matrix.configuration }}.tgz *.app
- name: Upload build result
uses: actions/upload-artifact@v2
with:
name: mac-${{ matrix.configuration }}
path: ${{ github.workspace }}/build/bin/macos-build.tar
path: ${{ github.workspace }}/build/bin/macos-build-${{ matrix.configuration }}.tgz
mac_zip:
name: Build Mac distribution zip
needs: build_mac
@@ -305,6 +331,11 @@ jobs:
with:
name: mac-FastDebug
path: builds
- name: Unpack builds
working-directory: ./builds
run: |
tar -xvzf macos-build-Release.tgz
tar -xvzf macos-build-FastDebug.tgz
- name: Create Distribution package
working-directory: ./builds
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Mac
+15 -15
View File
@@ -25,22 +25,22 @@ jobs:
cmake_options: -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_VULKAN=OFF
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-8a6bbbe
container: ghcr.io/scp-fs2open/linux_build:sha-3d30dc5
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
# - 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
+14 -1
View File
@@ -10,6 +10,9 @@ on:
windows_result: # job.result
required: true
type: string
mac_result: # job.result
required: true
type: string
releaseTag:
required: true
type: string
@@ -55,6 +58,15 @@ jobs:
env:
LINUX_RESULT: ${{ inputs.linux_result }}
WINDOWS_RESULT: ${{ inputs.windows_result }}
MAC_RESULT: ${{ inputs.mac_result }}
GITHUB_REPO: ${{ github.repository }} # repo this workflow was called from
INDIEGAMES_USER: ${{ secrets.INDIEGAMES_USER }}
INDIEGAMES_SSHPASS: ${{ secrets.INDIEGAMES_PASSWORD }}
NEBULA_USER: ${{ secrets.NEBULA_USER }}
NEBULA_PASSWORD: ${{ secrets.NEBULA_PASSWORD }}
HLP_API: ${{ secrets.HLP_API }}
HLP_KEY: ${{ secrets.HLP_KEY }}
RELEASE_TAG: ${{ inputs.releaseTag }}
run: python ci/post/main.py release
- name: Post Builds (Manual trigger)
@@ -63,7 +75,8 @@ jobs:
env:
LINUX_RESULT: success
WINDOWS_RESULT: success
MAC_RESULT: success
run: |
echo "releaseTag= ${{ env.RELEASE_TAG }}"
echo "repository= ${{ github.repository }}"
python ci/post/main.py release
python ci/post/main.py release
+88 -63
View File
@@ -22,23 +22,22 @@ jobs:
cmake_options: -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_VULKAN=OFF
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-8a6bbbe
container: ghcr.io/scp-fs2open/linux_build:sha-3d30dc5
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
# - 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:
@@ -48,7 +47,12 @@ jobs:
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ matrix.configuration }}-${{ matrix.compiler }}
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -89,31 +93,36 @@ jobs:
name: Checkout
with:
submodules: true
- name: Cache Qt
id: cache-qt-win
uses: actions/cache@v1
# - 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: Prepare Vulkan SDK
uses: humbletim/[email protected]
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
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -125,12 +134,23 @@ jobs:
cd build
if [ "$COMPILER" = "MinGW" ]; then
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -DCMAKE_BUILD_TYPE=$CONFIGURATION -G "Ninja" ..
if [ "$ARCHITECTURE" = "Win32" ]; then
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -DFSO_BUILD_WITH_VULKAN="OFF" -DCMAKE_BUILD_TYPE=$CONFIGURATION -G "Ninja" ..
else
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -DCMAKE_BUILD_TYPE=$CONFIGURATION -G "Ninja" ..
fi
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" \
-DFSO_BUILD_QTFRED=ON -T "v142" -A "$ARCHITECTURE" ..
if [ "$ARCHITECTURE" = "Win32" ]; then
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" -DFSO_BUILD_WITH_VULKAN="OFF" -G "Visual Studio 16 2019" \
-DFSO_BUILD_QTFRED=OFF -T "v142" -A "$ARCHITECTURE" ..
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" \
-DFSO_BUILD_QTFRED=OFF -T "v142" -A "$ARCHITECTURE" ..
fi
fi
- name: Compile
working-directory: ./build
@@ -167,21 +187,21 @@ jobs:
name: Mac
runs-on: macos-latest
steps:
- name: Cache Qt
id: cache-qt-mac
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-mac.outputs.cache-hit }}
setup-python: 'false'
aqtversion: ==1.1.3
# - name: Cache Qt
# id: cache-qt-mac
# 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-mac.outputs.cache-hit }}
# setup-python: 'false'
# aqtversion: ==1.1.3
# py7zrversion: '==0.19.*'
- uses: actions/checkout@v1
name: Checkout
with:
@@ -191,7 +211,12 @@ jobs:
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ matrix.configuration }}-${{ matrix.compiler }}
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
@@ -216,4 +241,4 @@ jobs:
if: startsWith(matrix.compiler, 'clang-')
uses: asarium/clang-tidy-action@v1
with:
fixesFile: clang-fixes.yaml
fixesFile: clang-fixes.yaml
+1
View File
@@ -4,3 +4,4 @@
[submodule "lib/libRocket"]
path = lib/libRocket
url = https://github.com/asarium/libRocket.git
-175
View File
@@ -1,175 +0,0 @@
language: bash
sudo: required
dist: xenial
cache:
directories:
- $HOME/cmake-3.8
- $HOME/.ccache
- $HOME/curl_cache
addons:
apt:
packages: &global_deps
- ninja-build
- libopenal-dev
- libreadline6-dev
- libpng12-dev
- libjpeg62-dev
- liblua5.1-0-dev
- libjansson-dev
- libsdl2-dev
- libfreetype6-dev
- qt57base
coverity_scan:
project:
name: "scp-fs2open/fs2open.github.com"
notification_email: [email protected]
build_command: "ci/travis/script.sh"
# must match TRAVIS_BRANCH check below
branch_pattern: coverity_scan
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
# also note that fork's don't get access to secure keys
# you have to test using a branch in the main repo
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
# These declarations set INDIEGAMES_USER and INDIEGAMES_PASSWORD for uploading nightly builds to the indiegames server
- secure: "lUuRu8XIi8MKNf1ebOfyC4iVEpPyASojJIDWXRo2bNqEF4ILAljXdkVeXeN6H5yKCHD52cxCNTtyePIG/o3p3QEuGSVud9bDS3D7LaQicLETGGrsw3l07U49gF2OKHXGopg0MzBbZUU9QmhoFTAe8t6PV9NDuEayYCheqvTqjZg="
- secure: "E/DHLYcPK/hBUqxBYYlUqp5sjgvIqY5A0qRHyQ4bmjsB+WB/Xx71bGCSiF7hk6lTxar1ZI1i5RAXXh9AIvNVaYAIdEOlCP+q3gvwCYuc5naZEKmkxlUCf0oEL4O9Fye93A/3VkFHuBdC1TGPYYf69m4W5r4367wWO9dPRIdWpJA="
# These declarations set DATACORDER_USER and DATACORDER_PASSWORD
- secure: "dpBH/dDN3bmU/NFlh+2v9isNx9wX0ocoRy+W+kBXRH32sosUGp26REhMqgVRpBNP5oxPBU8ic5bEogxAYWCB+0xUygBbkxAwyMPgoA34s0OXdTCY/ofw14ni8qqV2Ffy7fQJbP/jkMURyiMHx3kBTxNv3YjxKJqLnOuOMlQLpT8="
- secure: "tLMRBD1Ufp5iKNwlqPDVbbuczgusaXNoBJyAnPATpJq2YwlkW4j3PqP9rW5vd85+52xam2EOP20w9PoBR5J6FLdiXRu4Lf7yCEhSHFAgowVqQj8QcJpPlyXr90bM4emFGrGqpdxVwxyQ5AFhKwLuEZKsI14GYLN+UMEwpNCMing="
deploy:
- provider: releases
api_key:
secure: "q619+eQTe7lv8UVphK4OIzU8Jw84KBbVkuprN2sWIubRcV3IbZr2+WahJoUMt+nyhiy3YjDYtstO2ZgkxupwnZgwGUBVIiD1c4SPuyy+HTjNMOtiVsEUHT2hf+xPAemWpTlK5HcwhMmHAOh6rt6dEj57QOg0gcmGiwD/tCbEriA="
skip_cleanup: true
file_glob: true
file: "/tmp/builds/*"
on:
condition: '"$RELEASE_BUILD" == true'
tags: true
- provider: script
script: bash ci/travis/ftp_deploy.sh
on:
condition: '"$NIGHTLY_BUILD" == true'
tags: true
- provider: script
skip_cleanup: true
script: bash ci/travis/ftp_deploy.sh
on:
condition: $TEST_BUILD = true
all_branches: true
matrix:
include:
# note that gcc Debug MUST be 1st for Coverity
- os: linux
env: CONFIGURATION="Debug" CC=gcc-5 CXX=g++-5
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-5
- os: linux
env: CONFIGURATION="Debug" CC=gcc-9 CXX=g++-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Debug" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-9
script:
- ./ci/travis/script.sh
- ./ci/travis/clang_tidy.sh
- os: osx
env: CONFIGURATION="Debug"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET=v141 CMAKE_GENERATOR="Visual Studio 15 2017"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
- os: linux
env: CONFIGURATION="Release" CC=gcc-5 CXX=g++-5
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-5
- os: linux
env: CONFIGURATION="Release" CC=gcc-9 CXX=g++-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Release" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-9
script:
- ./ci/travis/script.sh
- ./ci/travis/clang_tidy.sh
- os: osx
env: CONFIGURATION="Release"
- os: windows
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
allow_failures:
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
fast_finish: true
before_install:
# ugly hack; if running a coverity scan abort all except the 1st build
# see note re gcc compiler above needing to be 1st
# also note that branch_pattern & the TRAVIS_BRANCH check must match
# unfortunately COVERITY_SCAN_BRANCH isn't defined until later in the
# build process
- if ([[ "${TRAVIS_JOB_NUMBER##*.}" != "1" ]] && [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]); then false ; fi
- source "./ci/travis/check_release.sh"
- "./ci/travis/before_install.sh"
install:
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then export PATH="/c/Program Files/CMake/bin":$PATH; fi
- "./ci/travis/install.sh"
- export PATH=$HOME/cmake-3.6/bin:$PATH
before_script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then QT_ENV_SCRIPT=$(find /opt -name 'qt*-env.sh'); source $QT_ENV_SCRIPT; fi
- "./ci/travis/before_script.sh"
script:
- if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi
+17 -5
View File
@@ -39,7 +39,13 @@ endif(NOT CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
# Override standard CMake configurations
set(CMAKE_CONFIGURATION_TYPES Debug Release FastDebug CACHE STRING "Available configurations" FORCE)
PROJECT(FS2_Open)
set(FSO_LANGUAGES C CXX)
if(APPLE)
set(FSO_LANGUAGES ${FSO_LANGUAGES} OBJC OBJCXX)
endif()
PROJECT(FS2_Open LANGUAGES ${FSO_LANGUAGES})
find_program(CCACHE_PROGRAM ccache)
# Currently only GCC support ccache properly without generating additional warnings
@@ -83,9 +89,11 @@ IF(RESET_INSTALL_PREFIX)
ENDIF(NOT $ENV{FS2PATH} STREQUAL "")
ENDIF(RESET_INSTALL_PREFIX)
IF (WIN32)
OPTION(FSO_USE_SPEECH "Use Windows specific text-to-speach libraries" ON)
IF(WIN32 OR APPLE)
OPTION(FSO_USE_SPEECH "Use text-to-speach libraries" ON)
ENDIF(WIN32 OR APPLE)
IF (WIN32)
OPTION(FSO_USE_VOICEREC "Enable voice recognition support" ON)
OPTION(FSO_BUILD_FRED2 "Build FRED2 binary" ON)
@@ -129,8 +137,9 @@ 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_OPENGL_DEBUG "Enables debug option for OpenGL" OFF)
OPTION(FSO_BUILD_WITH_VULKAN "Enable compilation of the Vulkan renderer" ON)
OPTION(FSO_BUILD_WITH_VULKAN "Enable compilation of the Vulkan renderer" OFF)
MARK_AS_ADVANCED(FORCE FSO_CMAKE_DEBUG)
MARK_AS_ADVANCED(FORCE FSO_BUILD_INCLUDED_LIBS)
@@ -143,6 +152,7 @@ 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_OPENGL_DEBUG)
mark_as_advanced(FORCE FSO_BUILD_WITH_VULKAN)
# Include cotire file from https://github.com/sakra/cotire/
@@ -208,8 +218,10 @@ include(package)
include(doxygen)
# Print used options to log
IF (WIN32)
IF(WIN32 OR APPLE)
message(STATUS "Using text to speech: ${FSO_USE_SPEECH}")
ENDIF()
IF (WIN32)
message(STATUS "Using voice recogition: ${FSO_USE_VOICEREC}")
message(STATUS "Building FRED2: ${FSO_BUILD_FRED2}")
elseif(UNIX)
+566
View File
@@ -3,7 +3,573 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [23.2.0] - 2023-06-16
### Changes
<details><summary> <b>Big Feature: MSAA</b> </summary>
> The return of a long forgotten feature, with optimizations and improvements
> Noticeable reduction to artifacts caused by subpixel geometry and glinting.
</details>
<details><summary> <b>Big Feature: SCPUI</b> </summary>
> A modernized approach to defining menus in FS
> Tired of having your Menus in FSO be at a resolution of potato? Use SCPUI to have them rendered from Fake-HTML to the actual screensize as opposed to a prebuilt graphics!
> Tired of being limited to whatever people in the SCP hardcoded in for buttons? Use SCPUI to define buttons and all other manner of shenanigans as Lua-code just as you like.
> Tired of needing to replace a bajillion interface graphics to reskin FSO? Use SCPUI, and especially Mjn's existing collection of Lua, CSS, Fake-HTML and images, and you only need to replace about 250 graphics.
</details>
<details><summary> <b>Big Feature: Localized Volumetric Nebulae</b> </summary>
> Allows specifying a POF as the "hull" of a nebula, which will be rendered using ray marching
> Further details can be found on the [GitHub Pull Request](https://github.com/scp-fs2open/fs2open.github.com/pull/5231)
> Note: As this is a new feature, many improvements and optimizations remain to be made
> Adapted from Andrew Schneider's 2015 SIGGRAPH talk "The real-time volumetric cloudscapes of Horizon: Zero Dawn"
</details>
<details><summary>Game: </summary>
- Per bank autoaim
</details>
<details><summary>Animation: </summary>
- Fix CTD on bad legacy animation data
- Add proper time wrapping for Animations
- Actually handle a mssing `Fade_anim` properly
</details>
<details><summary>Controls: </summary>
- Organize and map additional keys to librocket
- Catch when SDL fails to open a joystick that is enumerated by the OS
</details>
<details><summary>FRED: </summary>
- Add SpaceMouse support
- Add pre-parse enums support
- Add music player to FRED
- Enhanced SEXP comments
- FRED Dialog for Volumetrics
- QoL improvements to Object Editor
- Add FRED support for the "required weapon" feature
- SEXP Tree search and filter
</details>
<details><summary>QtFRED: </summary>
- Campaign Editor
- Add SpaceMouse support
- Make 'player starts in chase view' a toggle
</details>
<details><summary>Graphics: </summary>
- "The other great shader flag removal effort"
- Enhance handling of motion debris
- Expose texture filtering as a built-in option
- Improved particle culling and performance
- Optimized trail renderer
- Beam Particles
- Multiple lighting profiles
- Use volume particles for poofs
- Optimize for simple trails
- Kink shamed the laser bitmaps
</details>
<details><summary>HUD: </summary>
- Flag to apply HUD shudder to chase view
- Add missing HUD gauges
- Explicitly do not split lines when making the message log
</details>
<details><summary>Localization: </summary>
- Add some XSTR entries
</details>
<details><summary>Modding: </summary>
- Mapify built-in strings
- Allow `gameplay_profiles.tbl` to be an alias of `ai_profiles.tbl`
- Modular rank table
- Toggle auto-assigning personas
- Add some parameters for corkscrew starting angle
- Add clip planes to `game_settings.tbl`
- Add `+Use ship` as a Template
- Modular messages table
- Add arbitrary curves support
- Traitor overrides
- Add support for loose lz4 compressed files
- Add per-species warp effects
</details>
<details><summary>Models: </summary>
- Fix submodel sanity check
- Fix techroom modelnum references
- Adjust movement sanity checks to account for more situations
- Modular POF Features 2
- Add fov values to .pof models
- Add a Translation Moveable
- Remove model octants
- Fix glowpoints on animated submodels
- Update type_flags when dock name changes
- Add additional checks for Animation List handling of nonexistent polymodel instances
- Virtual POFs: Modify Subsystems
- Validate chunk size to avoid alignment crash and add align skip flag
</details>
<details><summary>Multiplayer: </summary>
- Generic Lua Multiplayer RPC
</details>
<details><summary>Performance: </summary>
- Increase sound update rate
- Add `line of sight` as an optional AI override
</details>
<details><summary>SEXPs: </summary>
- `turret-fired-since`, returns `true` if the specified turret has fired in the last `N` milliseconds
- `is-ship-emp-active`, returns `true` if the specified ship or list of ships is currently under an EMP effect
- `turret-has-primary` and `turret-has-secondary`, returns `true` if the specified turret contains the specified weapon
- `has-armor-type`, returns `true` if the specified ship or subsystem has the specified armor type
- `OPF_ANY_HUD_GAUGE` and `OPF_EVENT_NAME`, new Lua SEXP parameters
- Enhance Dynamic SEXPs with parent parameters
- Add "afterburn hard" AI goal flag
</details>
<details><summary>Scripting: </summary>
- Add option to deprecate hooks
- Get audiostream duration in float seconds
- Lua method to check if the game has focus
- `On warp complete` hook
- Allow Lua to set the Discord presence to custom strings
- Add virtvars for goal satisfaction and score
- Allow scripts to read and add LuaEnums
- Funcs and virtvars for SCPUI pause screen
- Expose pausing weapon sounds
- Make collision_group_id accessible to parse objects
- Pass shortcut key character to Lua as a hook variable
- Lua method to free all loaded models
- `On Asteroid Created` hook
- SCPUI methods required for handling closeup briefing icons
- Expose some Nebula settings to Lua
- SCPUI mission log
- SCPUI APIsfor the Game Help UI, medals access, and control config
- Force expand wings instead of toggle for SCPUI
- Add misc. validity checks
- Convert hotkey types to enum
- Finalize SCPUI API
- Blocking `On Frame` executor
- SCPUI Hud Config API
- Configurable restriction for ships that accept Lua player orders
- Add `ship::isPlayer()`
- Lua access to default countermeasures class
- Flag to check if a ship or weapon class is player allowed
- Add hooks for comm menu opening/closing
</details>
<details><summary>Technical: </summary>
- Improve CFLAGS handling
</details>
## [22.2.0] - 2022-08-06
```
Changelog note:
As of this version, in an attempt to make the changelog easier to navigate and read,
each section will have collapsible subsections, ordered alphabetically by topic.
Headlining features will always be on top.
```
### Added
<details><summary> <b>Big Feature: SEXP Containers</b> </summary>
> As opposed to a SEXP variable, which stores only one value, a SEXP container stores a collection of values.
> Consequently, containers allow for handling data in much more sophisticated ways than variables.
> Containers come in two types:
> * List container - an ordered sequence of values, sort of a cross between Python lists and deques
> * Map container - pairs of keys associated with data, like Lua tables or Python dictionaries
> Further details in the [SEXP Containers announcement thread](https://www.hard-light.net/forums/index.php?topic=98209.0)
</details>
<details><summary> <b>Big Feature: LuaAI</b> </summary>
> LuaAI allows scripters to add a new AI Goal (like ai-chase) that will run script instead of internal logic.
> Adding a Lua AI section in a -sexp.tbm and a few functions to a corresponding -sct.tbm to define the AI logic in certain conditions. More documentation on these functions is available in the LuaAISEXP-Object of the Scripting Docs.
</details>
<details><summary>AI:</summary>
- `$AI ignores aspect lock for leading:` Flag, which lets AI continue to lead their target while performing an Aspect Lock
</details>
<details><summary>Animation: </summary>
- `pause on reverse` Flag
</details>
<details><summary>Controls: </summary>
- Handle international keyboard layouts
- Re-Add `-joy-info` command line flag, for slightly quicker Joystick GUID retrieval
- Add `-controlconfig_tbl` command line flag to print out a template controlconfigdefaults.tbl
</details>
<details><summary>FRED: </summary>
- Support the full number of nebula poofs using a multi-select list
- Add the ability to edit nebula fog colors, since that previously was not part of the FRED UI
- Flags `same-arrival-warp-when-docked` and `same-departure-warp-when-docked` to allow docked ships to still use custom warp parameters
- Allow highlighting custom-colored events by drawing a border on them
- Can now rotate objects relative to other objects in the Object Editor
- Dialog to calculate relative distance and orientation between ships
- Flag "Point using uvec" to point ships while incorporating the ship's uvec
- `ai-attackable-if-no-collide` flag, which prevents turrets from ignoring a target with `no_collide`
</details>
<details><summary>QtFRED: </summary>
- Reinforcements Dialog
- Implemented Replace Data for Number and String
- Texture Replacement Dialog
- TBL Viewer in the Ship Editor
</details>
<details><summary>Graphics: </summary>
- Allow particles to use a random chance for spawning through the `+Chance` parameter
- Command-line parameter `-fov_cockpit` which allows setting an FoV for the cockpit model separately from the viewport FoV. This allows using custom FoVs without distorting the cockpit
- Allow user to export environment map to a PNG from the F3 Lab by pressing M
- Weapon lights: Configurable lighting data for weapons, both on a per-weapon basis and globally via lighting profiles
- Implemented debug sphere queuing and rendering
</details>
<details><summary>Localization: </summary>
- Make strings for Match Speed Indicator, Glide Indicator, and Afterburner Indicator translateable
</details>
<details><summary>Modding: </summary>
- `game_settings.tbl` setting `$Supernova hits at zero:`, which causes Supernovae to hit when the timer gets to 0, instead of the default of hitting 5 seconds before the time is up
- `game_settings.tbl` settings `$Show-subtitle uses pixels:` and `$Show-subtitle base resolution:`, which can be used in conjunction to scale subtitles
- `game_settings.tbl` setting `$Always warn player about unbound keys used in Directives Gauge:`, to show such warning to players when needed (without it these warnings only apply to Training Missions)
- Ship flags `fail-sound-locked-primary` and `fail-sound-locked-secondary` to allow the firing fail sound to play if the player tries to fire weapons that are locked
- Subsystem Flag "hide turret from loadout stats"
- Allow weapon to override turret name with `$Turret Name:`
</details>
<details><summary>Multiplayer: </summary>
- Save PXO stats to local pilot file
</details>
<details><summary>Performance: </summary>
- Preload subspace tunnel if the `mission-set-subspace` SEXP is used in the mission
</details>
<details><summary>SEXPs: </summary>
- `cancel-future-waves`, for stopping wings that still had waves queued from spawning
- Added optional flag to `show-subtitle-text` and `show-subtitle-image` to not change the subtitle aspect ratio
- `set-nav-color` and `set-nav-visited-color`, which allows setting custom colors to Navpoints in a mission
</details>
<details><summary>Scripting: </summary>
- Support for decals (see `decaldefinition` in the Scripting documentation)
- Missile list iterator: `mn.getMissileList()`
- Campaign Start hook: `On Campaign Begin`
- Player Loaded hook: `On Player Loaded`
- Added a few functions to get information on HUD gauges (check `HudGauge` in the Scripting documentation)
- Function `ship.checkVisibility` which checks if a ship can appear on the viewer's radar
- Function `hu.flashTargetBox` which causes the target box to flash
- Function `hu.getTargetDistance` to return the distance to target as reported by the HUD
- Function `mn.hasLineOfSight` which checks if one point has line of sight to the other
- Function `mn.getLineOfSightFirstIntersect` which checks for line of sight and returns the distance of the first interruption if not
- Variable `gr.CurrentResizeMode`, which can get or set the scaling mode to be used by the `gr.*` drawing methods
- Function `gr.draw3dLine`, which draws a line in space between two points
- Allow SCPUI to run `$On Briefing Stage:` hooks
- New bindings to allow proper hooking into control actions based on the control's enumeration name
- Allow scripted controls to override hardcoded functionality
- Fennel script support
- Lua BitOp 1.0.2 extension library, allowing the usage of bit operations
</details>
<details><summary>Technical: </summary>
- Class encapsulation for Volition's linked list
- Improve a debug console message to be more informative
- Type-safe `TIMESTAMP` class
- Add `timestamp_since()` function
- Add methods to compare timestamps, calculate deltas from an existing timestamp and a number of milliseconds, and to calculate deltas between timestamps
- Create a command line option for logging data packets
- Add more information to Multi-related debug logging
- Enable Doxygen for QTFred
- Set up Mac builds on CI, allowing builds to be published automatically for Mac
- Add some logging to `waitAsync`
</details>
### Changed
<details><summary>Game: </summary>
- Only display one popup when the player gets to the main hall
- Allow an unlimited number of ship flags to be parsed at once
</details>
<details><summary>AI: </summary>
- Improve Player Orders to allow for a nearly unlimited number of player orders, as opposed to the 32 before
- Update `ai_turn_towards_vector` to use a target velocity for banking
</details>
<details><summary>Audio: </summary>
- Allow unlimited soundtracks and spooled music (Previously limited to 30 and 50 respectively)
- Allow unlimited sound effects
- Dynamically set the maximum number of audio channels based on how many the user's system can support
</details>
<details><summary>FRED: </summary>
- CTRL+V is now add-paste (used to be CTRL+P)
- CTRL+SHIFT+V is now overwrite-paste (used to be CTRL+V)
- Replace `Always_show_goals` with `Toggle_showing_goals` which toggles whether the goals are shown, and works in any mission (instead of only Training Missions)
- No longer disable icon dropdowns for models that have their own icons
- No longer change the ship class when the icon type is a special popup
- Make the number of player orders FRED can handle dynamic
- Restore original Error Checking behavior where the function would exit after one check (for consistency)
- Exclude player ships from Error Checking for ships in a wing sharing the same orders
- Split "No subsystems found" and "Not all subsystems have a record in ships.tbl" warnings into two different warning flags
</details>
<details><summary>Graphics: </summary>
- Improved light attenuation to look more real
- Increase POF vertex limit, allowing up to `2^32 - 1` vertices to be used by a single subobject
</details>
<details><summary>Performance: </summary>
- Delay `ai_new_maybe_reposition_attack_subsys` to only run once a second. Before this change, it could take around 13% of runtime in crowded missions
- Cached subsystem indexing, speeding up subsystem lookups, which run for multiple ships, multiple times per frame
</details>
<details><summary>Scripting: </summary>
- Enhance help text for Lua SEXPs
- Converted the following Lua Hooks to the new format to add documentation: `On Death`, `On Game Init`, `On Ship Collision`
</details>
<details><summary>Technical: </summary>
- Turn `insertion_sort` into a templated function that uses assignment
- CMake: Update `PREBUILT_VERSION_NAME` to latest (mac libs)
- Optimized space used in the new POF version
- Cleanup model code
- Cleanup beam light functions by consolidating some duplicated code and removing unreachable logic
- Cleanup wing wave code
- Move special parsing functions into new `parsehi.cpp` and `parsehi.h` files
- Actually clear delayed SSM parsing data when it's no longer needed
- Allow C++ to interact more with LuaTables, allowing it to extract userdata like objects or ships from them
- Use `SCP_string` for constructing multi/event log lines
- Replace `+Orders Accepted:` Bitfield with flag list
- Handle deprecated command line flags programmatically, avoiding lots of code duplication
- Set up debug_filter.cfg to have default filters that can be turned off
</details>
### Removed
<details><summary>FRED: </summary>
- Remove the `Allow Daisy-Chained Docking` mission flag
- Remove "Delete Item" from the right-click menu in the Event Editor
</details>
<details><summary>Technical: </summary>
- Remove light filtering data which didn't work and increased code complexity
- Remove a pointless assert that checked if `SEXP_NODE_INCREMENT` (a define, set at 250) was greater than zero
</details>
### Fixed
<details><summary>Game: </summary>
- Missing whitespace in credits
- Stopped destroyed submodels from showing in Techroom
- Prevent a crash when an object dies in the same frame as their goal
- Always record primary bank ammo capacity during ship creation, preventing situations where a ballistic weapon would accidentally be set to zero ammo
- Properly remove ships from the Techroom when they're not in the Tech Database
- Load the correct Techroom data after a Tech Database Reset
- Don't tick Supernova timer while the game is paused
- Make `set-camera-facing` use default identity orientation when the `$Use host orientation` flag is active and no host is present
- When a hotkey text replacement string refers to an unbound control, use the name of the binding instead of "none"
- Fix usage of default tech database flags
- Prevent a crash in the loadout screen with a weapons-locked ship
- Fix two crashes in the F3 lab
- End the campaign properly when a mission is skipped, preventing crashing in some situations
- Prevent a crash when a message is sent from an invalid source
- Prevent a broken campaign state if the player quits the game from the options menu during the debriefing
- Add some checks before converting a message to Command
- Prevent accidentally skipping cutscenes caused by hitting the spacebar during a loading screen
- Fixed an issue where ships would start with the wrong hull values in Red Alert missions
</details>
<details><summary>AI: </summary>
- Fix turret swarm weapons by removing a few checks that are no longer valid
- Fix a few issues with maneuvers
</details>
<details><summary>Animations: </summary>
- Fix broken turret animations in the Techroom
</details>
<details><summary>Audio: </summary>
- Fix cockpit engine sound volume changing unexpectedly
- Fix a timing bug that would sometimes prevent music from being initialized when re-playing a mission
- Check all possible extensions for audio files
</details>
<details><summary>Controls: </summary>
- Flush the mouse state after toggling between `Use_mouse_to_fly` states, preventing situations where a stale mouse state would be used
- Fix a conflict between Free Look View controls and directional thrust controls
</details>
<details><summary>FRED: </summary>
- Prevent Ship Select Dialog from crashing if there are too many IFFs
- Support saving nebula fog colors
- Properly save `nav-carry-status` flag
- Don't treat a bare `<argument>` as an error
- Prevent adding duplicated variables and display an error to the user when they try
- Clean up some parse problems
- Fix assignment of alt-name when using the hash
- Guard against off-by-one errors in `replace_one` and `replace_all`
- Improve error checking of campaign loop branches
- Improve error reporting for bad SEXP nodes
- Prevent a crash with paste/add-paste when the clipboard was empty
- Prevent rounding/conversion issues that caused FRED to think an angle or position was modified when it wasn't
- Skip absent ships or wings when running `clear-goals`, instead of stopping the whole operation
</details>
<details><summary>Graphics: </summary>
- Disable Lightshafts while the Supernova glare effect is active. This partial fix ensures the glare shows up with the correct brightness
- Update and correctly load environment maps in F3 Lab
- Correctly set textures and Team Colors with `change-ship-class`
- Fixes Team Colors not working with `show-ship`
- Correct positioning and angles for background bitmaps and suns
- Clean up ship arrival and departure effects
- Fix clearing a skybox model when it isn't the mission default
- Fix an assertion with Fireball LODs which would wrongly trigger if the number of LODs was the same as the maximum
</details>
<details><summary>HUD: </summary>
- Make HUD Target distance consistent
- Fix a crash with scripted HUDs
- Correctly update RTT Cockpit Gauges with `change-ship-class`
- Ignore HUD brackets with a size of zero or less (instead of just crashing)
- Squad menu wasn't scrolling properly with PageDown in some cases
- Fix issues with loading of hud config presets
- Fix parsing issues with HUD color presets
- Continue parsing remaining gauges if one isn't found
- Use translated strings both when saving and loading
- Fix an issue where a target's orders would be displayed wrongly in the target box
- Fix asteroid brackets disappearing or displaying wrong values
</details>
<details><summary>Modding: </summary>
- Delay processing `$Player Weapon Precedence:` until after parsing, avoiding ships starting with the wrong weapons in some situations
- Make the `$Player Weapon Precedence:` list actually give precedence
- Empty `+Orders Accepted List:` entries were causing the ship to accept the default orders, instead of no orders as would be correct
- Show a Warning if a turret submodel is not an immediate child of the base object and handle it as a single-part object to prevent a crash
</details>
<details><summary>Multiplayer: </summary>
- Limit client collisions to prevent bugs, such as flinging players with high pings who collided multiple times between packet updates
- Fix multiple timestamp issues
- Multi messaging and multi pause screen
- Make sure maintenance stuff (pings, voice, file xfer, etc.) isn't affected by pausing or time compression
- Sync issues caused by options menu and screenshots
- Prevent an error with long messages in PXO Chat by using proper buffer size
- Fix some issues with Multiplayer SEXPs
- Try to handle incompatible sexp packets better
- Fix operator name issue with debug messages
- Enable the new show-subtitle-text options
- Improve interpolation, fixing the jerkiness that used to occur when the interpolation code basically guessed the timing on when packets were coming in
- Fix rollback primary collisions, vastly improving accuracy on moving targets even at high pings
- Fix the standalone ship being added to ship list
- Stop non-printable keys adding text to multi message buffer
- Prevent the standalone from crashing if a player tried to switch secondaries in a ship that doesn't have secondaries
- Fix a standalone crash from disabled uniform buffer manager
- Prevent a crash related to Observer-type players
- Fix network issues on MacOS
</details>
<details><summary>Scripting: </summary>
- Make hook conditions consistent and handle combinations that didn't work properly before
- Fix `maybePlayCutscene` arguments
- Add `isActive` checks for new-style script hooks
- Sync the two `VIRTVAR`s for Orientation in subsystems and submodel instances, which behaved in different ways
- Fixed a few timing and framerate related issues for playing movies via script
- Ensure the Lua interpreter has enough space in its stack, and allow reserving more space if necessary
- Fixed an memory leak in the Lua interpreter caused by string-eval sexps, which never cleaned up the generated code
</details>
<details><summary>SEXPs: </summary>
- Avoid setting .rest for `Locked_sexp_true/false` with malformed SEXPs
- Fix some memory management problems in the `for-*` operators, avoiding a memory leak
- Fix crash when removing form-on-wing order with `remove-goal`
- Fix `show-subtitle` SEXP which was missing the `width` argument
- Reset volumes changed via `adjust-audio-volume` when the mission closes
- Prevent too many dynamic SEXPs from breaking the SEXP system
</details>
<details><summary>Technical: </summary>
- Check if index is valid before accessing `Weapon_info`, preventing CTDs under certain conditions
- When `weapon_create` was called while `MAX_WEAPONS` was reached, the previous algorithm didn't achieve desired results, and simply locked up the game. Instead, we now simply won't allow a new weapon to be created in such condition
- Refactored Supernova code and fixed some state transition issues in it
- Prevent crashes in the event of a subsystem mismatch during `change_ship_type`
- Change include order to fix compilation of unit tests on Mac
- Patch freeing of SEXP nodes, preventing a crash in certain conditions
- Fix a memory leak in model code
- Fix a crash in the Ship Creation code if a ship's name was exactly the maximum allowed length
- Removed vestigial bit-depth asserts for aabitmaps, preventing crashes with certain image types
- Prevent a crash when Escort Priority was parsed for a ship not present in the Escort List
- Fix a bunch of graphics functions to respect GR_STUB, preventing problems in standalone server
- Clean up line endings in several files (replaced CRLF with LF basically everywhere)
- Fixed a timestamp issue which helps lay the groundwork to add In-Game Joining to multiplayer
- Prevent pilot and campaign files from having invalid values, by clamping them within the expected ranges when saving and loading
- Also warn the player if such an invalid value was detected, telling them which setting had the wrong value and what it was reset to
- Try to avoid assertions by preventing invalid types from being handled by `obj_team()`
- Shut down the SEXP system before the Scripting system, otherwise a crash could happen if the SEXP system held references to Lua
</details>
----
## [22.0.0] - 2022-04-01 ([Thread](https://www.hard-light.net/forums/index.php?topic=98125.0))
### Changed
- Controls5 PR (aka multi-joy)
-2
View File
@@ -1,7 +1,5 @@
FreeSpace2 *S*ource *C*ode *P*roject
==
[![Travis-CI Build Status](https://travis-ci.org/scp-fs2open/fs2open.github.com.svg?branch=master)](https://travis-ci.org/scp-fs2open/fs2open.github.com)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/scp-fs2open/fs2open.github.com?branch=master&svg=true)](https://ci.appveyor.com/project/SirKnightly/fs2open-github-com/branch/master)
[![Coverity](https://img.shields.io/coverity/scan/870.svg)](https://scan.coverity.com/projects/870)
Building
-62
View File
@@ -1,62 +0,0 @@
version: 1.0.0.{build}
image: Visual Studio 2015
configuration:
- Debug
- Release
clone_depth: 10
environment:
matrix:
- BuildID: 0
CMAKE_GENERATOR: Visual Studio 14 2015
PlatformToolset: v140
QT_DIR: C:\Qt\5.9\msvc2015
- BuildID: 1
CMAKE_GENERATOR: Visual Studio 14 2015 Win64
PlatformToolset: v140
QT_DIR: C:\Qt\5.9\msvc2015_64
before_build:
- git submodule update --init --recursive
build_script:
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/build.ps1
test_script:
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/test.ps1
deploy:
- provider: GitHub
auth_token:
secure: h55Scpy+3vmo1Yb7WlSIGA4d9DRnsbzUYc2LYsQdByQHZHbqrqjBpicH0D2FFLEO
on:
ReleaseBuild: true # deploy on release push only
- provider: FTP
protocol: sftp
host: scp.indiegames.us
username:
secure: SFivQZfatqWHXK1ijYK3GQ==
password:
secure: q6Zk/412o1ri+NEya1dl1Q==
folder: public_html/builds/nightly/$(VersionName)
on:
NightlyBuild: true # deploy on nightly push only
- provider: FTP
protocol: sftp
host: porphyrion.feralhosting.com
username:
secure: 36+bVD8eJgI0BVbi7TZ4zQ==
password:
secure: CrzmDVca8AGG08iWPA1gOD4Ge06+wJ3rcBagBGclwYQ=
folder: www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly/$(VersionName)
on:
NightlyBuild: true # deploy on nightly push only
- provider: FTP
protocol: sftp
host: porphyrion.feralhosting.com
username:
secure: 36+bVD8eJgI0BVbi7TZ4zQ==
password:
secure: CrzmDVca8AGG08iWPA1gOD4Ge06+wJ3rcBagBGclwYQ=
folder: www/datacorder.porphyrion.feralhosting.com/public_html/builds/test/$(VersionName)
on:
TestBuild: true # deploy on test build push only
-164
View File
@@ -1,164 +0,0 @@
class BuildConfig {
[string]$Generator
[string]$PackageType
[string]$Toolset
[string]$SimdType
[string]$QtDir
[Bool]$SourcePackage
}
$NightlyConfigurations = @(
# [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";
# 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
# Default values
$ReleaseBuild = $false
$NightlyBuild = $false
$TestBuild = $false
# Set to true to test either the release or the nightly part of this script
$ReleaseTest = $false
$NightlyTest = $false
$TestBuildTest = $false
if ($ReleaseTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)"))) {
# Tag matches
$ReleaseBuild = $true
$PackageName = "fs2_open_$($matches[1])"
$BuildConfigurations = $ReleaseConfigurations
}
if ($NightlyTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)"))) {
# Tag matches
$NightlyBuild = $true
$PackageName = "nightly_$($matches[1])"
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
$BuildConfigurations = $NightlyConfigurations
}
if ($TestBuildTest -Or ([System.Convert]::ToInt32($env:APPVEYOR_PULL_REQUEST_NUMBER) -le 0 -And ("$env:APPVEYOR_REPO_BRANCH" -match "^test\/(.*)"))) {
# Tag matches
$TestBuild = $true
$PackageName = "test_$($matches[1])"
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
$BuildConfigurations = $NightlyConfigurations
# Override the revision string so that the builds are named correctly
[System.IO.File]::WriteAllLines("$env:APPVEYOR_BUILD_FOLDER/version_override.cmake", "set(FSO_VERSION_REVISION_STR $env:VersionName)")
}
# Multiply by 2 so that we can add 0 or 1 for debug or release Configs
$buildID = [convert]::ToInt32($env:BuildID) * 2
if ($Env:Configuration -eq "Release") {
$buildID = $buildID + 1
}
$DeployBuild = $false
if ($ReleaseBuild -Or $NightlyBuild -Or $TestBuild) {
$DeployBuild = $true
}
Set-AppveyorBuildVariable 'ReleaseBuild' "$ReleaseBuild"
Set-AppveyorBuildVariable 'NightlyBuild' "$NightlyBuild"
Set-AppveyorBuildVariable 'TestBuild' "$TestBuild"
New-Item build -type directory
Set-Location -Path build
if ($DeployBuild) {
# Release build
if ($buildID -ge $BuildConfigurations.Length) {
# Not needed
exit 0
}
$buildConfig = $BuildConfigurations[$buildID]
if ($buildConfig.SourcePackage -eq $True) {
7z a -xr'!.git' "$($PackageName)-source-Win.zip" "$env:APPVEYOR_BUILD_FOLDER"
Push-AppveyorArtifact "$($PackageName)-source-Win.zip"
}
cmake -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER/../install" -DFSO_USE_SPEECH="ON" `
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$($buildConfig.SimdType)" `
-DQT5_INSTALL_ROOT="$($buildConfig.QtDir)" -DFSO_BUILD_QTFRED=ON `
-DFSO_INSTALL_DEBUG_FILES="ON" `
-G "$($buildConfig.Generator)" -T "$($buildConfig.Toolset)" ..
$Configs = @("Release", "FastDebug")
foreach ($config in $Configs) {
cmake --build . --config "$config" --target INSTALL -- /verbosity:minimal
if (! ($?)) {
Add-AppveyorMessage "A release build failed!"
exit 1
}
}
7z a -xr'!*.pdb' "$($PackageName)-builds-$($buildConfig.PackageType).zip" "$env:APPVEYOR_BUILD_FOLDER/../install/*"
Push-AppveyorArtifact "$($PackageName)-builds-$($buildConfig.PackageType).zip"
7z a "$($PackageName)-debug-$($buildConfig.PackageType).7z" "$env:APPVEYOR_BUILD_FOLDER/../install/*.pdb"
Push-AppveyorArtifact "$($PackageName)-debug-$($buildConfig.PackageType).7z"
} else {
cmake -DFSO_USE_SPEECH="ON" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="ON" -DFSO_BUILD_TESTS="ON" -DMSVC_SIMD_INSTRUCTIONS=SSE2 `
-DFSO_BUILD_QTFRED=ON -DQT5_INSTALL_ROOT="$env:QT_DIR" -DFSO_BUILD_FRED2="ON" `
-G "$Env:CMAKE_GENERATOR" -T "$Env:PlatformToolset" ..
cmake --build . --config "$Env:CONFIGURATION" -- /verbosity:minimal
if (! ($?)) {
exit 1
}
}
-13
View File
@@ -1,13 +0,0 @@
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild) -Or [System.Convert]::ToBoolean($env:TestBuild)) {
# Skip tests for deployment
exit 0
} else {
write "Running unit tests..."
# Run unit tests
&"$pwd\bin\$Env:CONFIGURATION\unittests.exe" --gtest_shuffle 2>&1
if (! ($?)) {
exit 1
}
}
+6 -3
View File
@@ -18,10 +18,11 @@ LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH
if [ "$RUNNER_OS" = "macOS" ]; then
CXXFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas"
CFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas"
PLATFORM_CMAKE_OPTIONS=""
# TODO: Vulkan support is disabled on MacOS due to issues with the test suite not linking correctly
PLATFORM_CMAKE_OPTIONS="-DFSO_BUILD_WITH_VULKAN=OFF"
export CMAKE_OSX_ARCHITECTURES="$ARCHITECTURE"
else
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas -static-libstdc++"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
PLATFORM_CMAKE_OPTIONS="-DFSO_BUILD_APPIMAGE=ON"
fi
@@ -29,6 +30,8 @@ fi
CMAKE_OPTIONS="$JOB_CMAKE_OPTIONS"
if [[ "$COMPILER" =~ ^clang.*$ ]]; then
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCLANG_USE_LIBCXX=ON"
# force clang to silently allow -static-libstdc++ flag
CXXFLAGS="$CXXFLAGS -Qunused-arguments"
fi
mkdir build
@@ -43,5 +46,5 @@ if [ "$RUNNER_OS" = "macOS" ]; then
fi
cmake -G Ninja -DFSO_FATAL_WARNINGS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $CMAKE_OPTIONS $PLATFORM_CMAKE_OPTIONS \
-DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DCMAKE_BUILD_TYPE=$CONFIGURATION \
-DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON \
-DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=OFF \
-DSHADERS_ENABLE_COMPILATION=ON ..
+13 -13
View File
@@ -10,27 +10,27 @@ 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")"
echo "package_path=$(pwd)/$(get_package_name)-builds-Linux.tar.gz" >> $GITHUB_OUTPUT
echo "package_name=$(get_package_name)-builds-Linux.tar.gz" >> $GITHUB_OUTPUT
echo "package_mime=$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-Linux.tar.gz")" >> $GITHUB_OUTPUT
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")"
echo "package_path=$(pwd)/$(get_package_name)-builds-$ARCH-$SIMD.zip" >> $GITHUB_OUTPUT
echo "package_name=$(get_package_name)-builds-$ARCH-$SIMD.zip" >> $GITHUB_OUTPUT
echo "package_mime=$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-$ARCH-$SIMD.zip")" >> $GITHUB_OUTPUT
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")"
echo "debug_path=$(pwd)/$(get_package_name)-debug-$ARCH-$SIMD.7z" >> $GITHUB_OUTPUT
echo "debug_name=$(get_package_name)-debug-$ARCH-$SIMD.7z" >> $GITHUB_OUTPUT
echo "debug_mime=$(file -b --mime-type "$(pwd)/$(get_package_name)-debug-$ARCH-$SIMD.7z")" >> $GITHUB_OUTPUT
elif [ "$OS" = "Mac" ]; then
tar -cvzf "$(get_package_name)-builds-Mac.tar.gz" *
tar -cvzf "$(get_package_name)-builds-Mac.tar.gz" *.app
echo "::set-output name=package_path::$(pwd)/$(get_package_name)-builds-Mac.tar.gz"
echo "::set-output name=package_name::$(get_package_name)-builds-Mac.tar.gz"
echo "::set-output name=package_mime::$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-Mac.tar.gz")"
echo "package_path=$(pwd)/$(get_package_name)-builds-Mac.tar.gz" >> $GITHUB_OUTPUT
echo "package_name=$(get_package_name)-builds-Mac.tar.gz" >> $GITHUB_OUTPUT
echo "package_mime=$(file -b --mime-type "$(pwd)/$(get_package_name)-builds-Mac.tar.gz")" >> $GITHUB_OUTPUT
else
echo "Invalid OS: $OS"
fi
+13 -3
View File
@@ -10,11 +10,21 @@ 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"
any_success=false
if SSHPASS=$INDIEGAMES_SSHPASS upload_files_to_sftp "$INDIEGAMES_USER@scp.indiegames.us" "public_html/builds/nightly"; then
any_success=true
fi
SSHPASS=$DATACORDER_SSHPASS upload_files_to_sftp "$DATACORDER_USER@porphyrion.feralhosting.com" "www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly"
if SSHPASS=$DATACORDER_SSHPASS upload_files_to_sftp "$DATACORDER_USER@perses.feralhosting.com" "www/datacorder.perses.feralhosting.com/public_html/builds/nightly"; then
any_success=true
fi
if [ "$any_success" = "false" ]; then
echo "All uploads failed"
exit 1
fi
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"
SSHPASS=$DATACORDER_SSHPASS upload_files_to_sftp "$DATACORDER_USER@perses.feralhosting.com" "www/datacorder.perses.feralhosting.com/public_html/builds/test"
else
echo "Unknown upload type $UPLOAD_TYPE"
exit 1
+1 -1
View File
@@ -40,7 +40,7 @@ class ForumAPI:
"body": content
})
if resp.text != "OK":
if resp.status_code != 200:
print("Post failed! Response: %s" %resp.text)
return resp.json()
+7 -3
View File
@@ -42,7 +42,7 @@ MAJOR_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_MAJO
MINOR_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_MINOR (\d+)\)")
BUILD_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_BUILD (\d+)\)")
REVISION_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_REVISION (\d+)\)")
REVISION_STR_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_REVISION_STR (\w+)\)")
REVISION_STR_VERSION_PATTERN = re.compile("(?:set_if_not_defined|set)\(FSO_VERSION_REVISION_STR (\w*)\)")
LOG_FORMAT = """
------------------------------------------------------------------------%n
@@ -137,8 +137,8 @@ def main():
"pass": os.environ["INDIEGAMES_SSHPASS"],
"path": "public_html/builds/{type}/{version}/",
"mirrors": (
"https://porphyrion.feralhosting.com/datacorder/builds/{type}/{version}/{file}",
"http://scp.indiegames.us/builds/{type}/{version}/{file}",
"https://perses.feralhosting.com/datacorder/builds/{type}/{version}/{file}",
"https://scp.indiegames.us/builds/{type}/{version}/{file}",
),
},
"nebula": {
@@ -260,6 +260,10 @@ def main():
if "Linux" not in groups.keys():
print("ERROR: No Linux builds were detected!")
sys.exit(1)
if "Mac" not in groups.keys():
print("ERROR: No Mac builds were detected!")
sys.exit(1)
# z64: What dose this do???
# print(installer.render_installer_config(version, groups, config))
+25 -18
View File
@@ -7,6 +7,13 @@ import requests
from file_list import ReleaseFile
from util import retry_multi, GLOBAL_TIMEOUT
LINUX_KEY = "Linux"
MACOSX_KEY = "Mac"
WIN32_SSE2_KEY = "Win32-SSE2"
WIN64_SSE2_KEY = "Win64-SSE2"
WIN32_AVX_KEY = "Win32-AVX"
WIN64_AVX_KEY = "Win64-AVX"
metadata = {
'type': 'engine',
'title': 'FSO',
@@ -26,28 +33,28 @@ metadata = {
}
platforms = {
'Linux': 'linux',
'MacOSX': 'macosx',
'Win32-SSE2': 'windows',
'Win64-SSE2': 'windows',
'Win32-AVX': 'windows',
'Win64-AVX': 'windows'
LINUX_KEY: 'linux',
MACOSX_KEY: 'macosx',
WIN32_SSE2_KEY: 'windows',
WIN64_SSE2_KEY: 'windows',
WIN32_AVX_KEY: 'windows',
WIN64_AVX_KEY: 'windows'
}
envs = {
'Linux': 'linux && x86_64', # Linux only has 64bit builds
'MacOSX': 'macosx',
'Win32-SSE2': 'windows',
'Win64-SSE2': 'windows && x86_64',
'Win32-AVX': 'windows && avx',
'Win64-AVX': 'windows && avx && x86_64'
LINUX_KEY: 'linux && x86_64', # Linux only has 64bit builds
MACOSX_KEY: 'macosx',
WIN32_SSE2_KEY: 'windows',
WIN64_SSE2_KEY: 'windows && x86_64',
WIN32_AVX_KEY: 'windows && avx',
WIN64_AVX_KEY: 'windows && avx && x86_64'
}
subdirs = {
'Win32-SSE2': 'x86',
'Win64-SSE2': 'x64',
'Win32-AVX': 'x86_avx',
'Win64-AVX': 'x64_avx'
WIN32_SSE2_KEY: 'x86',
WIN64_SSE2_KEY: 'x64',
WIN32_AVX_KEY: 'x86_avx',
WIN64_AVX_KEY: 'x64_avx'
}
@@ -103,7 +110,7 @@ def render_nebula_release(version, stability, files, config):
'filename': dest_fn
})
if group == 'Linux' and fn.endswith('.AppImage'):
if group == LINUX_KEY and fn.endswith('.AppImage'):
if 'qtfred' in fn:
if '-FASTDBG' in fn:
label = 'QtFRED Debug'
@@ -128,7 +135,7 @@ def render_nebula_release(version, stability, files, config):
'label': label,
'properties': props,
})
elif group == 'MacOSX' and fn.startswith(os.path.basename(fn) + '.app/'):
elif group == MACOSX_KEY and fn.startswith(os.path.basename(fn) + '.app/'):
if 'qtfred' in fn:
if '-FASTDBG' in fn:
label = 'QtFRED Debug'
+20 -13
View File
@@ -9,20 +9,20 @@ PLACEHOLDER
Deprecations are a mechanism in FSO where a certain feature or aspect of the engine has changed or is no longer supported. Since this would normally break existing mods we have the mod table feature "[tt]$Target Version:[/tt]" with which a mod can specify what version of FSO it was developed with. The features listed above will be removed or changed when the target version of a mod is at least the version released in this post.
[size=5pt]Previous [url=https://www.hard-light.net/forums/index.php?topic=97293.0]21.0 Release Thread[/url][/size]
[size=5pt]Previous [url=https://www.hard-light.net/forums/index.php?topic=98682.0]23.0.0 Release Thread[/url][/size]
Launchers, if you don't have one already:
[b]All platforms: [/b] For every day use, we recommend [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url], an integrated solution for downloading and launching mods.
[hidden=Alternative Launchers]
Cross-platform: [url=http://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (ongoing project for a unified launcher, you should upgrade to the latest RC/test build if you have not yet)
Cross-platform: [url=https://www.hard-light.net/forums/index.php?topic=89162]wxLauncher 0.12.x Test Build[/url] (ongoing project for a unified launcher, you should upgrade to the latest RC/test build if you have not yet)
[b]Important:[/b] For best compatibility with FSO 3.8 and later you should use at least wxLauncher 0.12.
Windows: [url=http://scp.fsmods.net/files/Launcher55g.zip]Launcher 5.5g[/url] ([url=http://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=http://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=http://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=http://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=http://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Graphics_Settings]by hand[/url] or whatever you can figure out.[/hidden]
Windows: [url=http://scp.fsmods.net/builds/Launcher55g.zip]Launcher 5.5g[/url] ([url=https://scp.indiegames.us/builds/Launcher55g.zip]Mirror[/url]) ([url=https://www.mediafire.com/?wdvzn7hhhzh418m]Mirror[/url]) Not compatible with Windows 8+, use wxLauncher above
OS X: Soulstorm's [url=https://www.hard-light.net/forums/index.php/topic,51391.0.html]OS X Launcher 3.0[/url]
Linux: [url=https://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/url] or [url=https://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Graphics_Settings]by hand[/url] or whatever you can figure out.[/hidden]
[img]http://scp.indiegames.us/img/windows-icon.png[/img] [color=green][size=12pt]Windows (32/64-bit)[/size][/color]
[img]https://scp.indiegames.us/img/windows-icon.png[/img] [color=green][size=12pt]Windows (32/64-bit)[/size][/color]
[size=8pt]Compiled using GitHub Actions on Windows Server 2019 (10.0.17763), Visual Studio Enterprise 2019[/size]
[b]64-bit:[/b] ${build(groups["Win64"].mainFile)}
@@ -40,29 +40,36 @@ Linux: [url=http://www.hard-light.net/forums/index.php/topic,53206.0.html]YAL[/
[size=8pt]This one is based on the AVX Optimizations from the MSVC Compiler.[/size]
[b]What are those SSE, SSE2 and AVX builds I keep seeing everywhere?[/b]
[url=http://www.hard-light.net/forums/index.php?topic=65628.0]Your answer is in this topic.[/url]
[url=https://www.hard-light.net/forums/index.php?topic=65628.0]Your answer is in this topic.[/url]
Don't want to deal with that? Use [url=https://www.hard-light.net/forums/index.php?topic=94068.0]Knossos[/url] and it will download the best build specifically for your PC!
[/hidden]
[img]http://scp.indiegames.us/img/linux-icon.png[/img] [color=green][size=12pt]Linux 64-bit[/size][/color]
[img]https://scp.indiegames.us/img/linux-icon.png[/img] [color=green][size=12pt]Linux 64-bit[/size][/color]
[size=8pt]Compiled with Ubuntu 16.04 LTS 64-bit, GCC 5[/size]
${build(groups["Linux"].mainFile)}
These builds use a mechanism called [url=http://appimage.org/]AppImage[/url] which should allow these builds to run on most Linux distributions. However, we recommend that you compile your own builds which will result in less issues.
These builds use a mechanism called [url=https://appimage.org/]AppImage[/url] which should allow these builds to run on most Linux distributions. However, we recommend that you compile your own builds which will result in less issues.
Alternatively, if there is a package in your software repository then you should use that. If you are the maintainer of such a package for a distribution then let us know and we will include that here.
[img]http://scp.indiegames.us/img/mac-icon.png[/img] [color=green][size=12pt]OS X[/size][/color]
[b][color=red]Not available[/color][/b] We recently lost access to our Mac CI environment which we usually used for compiling these builds so for the time being, there will be no builds for this OS.
[img]https://scp.indiegames.us/img/mac-icon.png[/img] [color=green][size=12pt]macOS[/size][/color]
[size=8pt]macOS 10.9+, 64-bit (Intel)[/size]
${build(groups["Mac"].mainFile)}
These builds are not signed and so by default will fail to launch. To run them simply right-click on the app, click open, then click open again on the security confirmation dialog. You should only have to do this once for each app.
If running the game through Knossos or Knossos.NET this step should not be necessary.
[size=8pt][color=red][b]NOTE:[/b][/color] macOS builds currently have limited support and may exhibit issues not present on other platforms.[/size]
[hidden=TrackIR Users]
[size=12pt]Important!![/size]
An external DLL is required for FSO to use TrackIR functions. The following DLL is simply unpacked in to your main FreeSpace2 root dir.
TrackIR is only supported on Windows.
[url=http://www.mediafire.com/download.php?4zw024zrh44etse]TrackIR SCP DLL[/url] ([url=http://scp.fsmods.net/builds/scptrackir.zip]Mirror[/url]) ([url=http://scp.indiegames.us/builds/scptrackir.zip]Mirror[/url])[/hidden]
[url=https://www.mediafire.com/download.php?4zw024zrh44etse]TrackIR SCP DLL[/url] ([url=http://scp.fsmods.net/builds/scptrackir.zip]Mirror[/url]) ([url=https://scp.indiegames.us/builds/scptrackir.zip]Mirror[/url])[/hidden]
Known issues:
[list]
[li][url=https://github.com/scp-fs2open/fs2open.github.com/issues]Github issues[/url] and [url=https://github.com/scp-fs2open/fs2open.github.com/pulls]pending pull requests[/url][/li]
[li]See the list of [url=http://scp.indiegames.us/mantis/search.php?project_id=1&status_id%5B%5D=10&status_id%5B%5D=20&status_id%5B%5D=30&status_id%5B%5D=40&status_id%5B%5D=50&priority_id%5B%5D=40&priority_id%5B%5D=50&priority_id%5B%5D=60&sticky_issues=on&sortby=last_updated&dir=DESC&per_page=200&hide_status_id=-2]Fix for next release[/url] bugs - mark a bug as an elevated priority (high, urgent, immediate) to get it included in that filter.[/li]
[li]See the list of [url=https://github.com/scp-fs2open/fs2open.github.com/projects/8]bugs ranked by priority[/url][/li]
[/list]
+2 -2
View File
@@ -1,3 +1,3 @@
Mako==1.1.5
requests==2.26.0
Mako==1.2.2
requests==2.31.0
semantic-version==2.8.5
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env sh
set -ex
if [ "$NIGHTLY_BUILD" = true ]; then
echo "Generating bintray config..."
sed -e "s/\$VERSION_NAME/$VERSION_NAME/" ci/bintray.template.json > ci/bintray.json
fi
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env sh
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository -y "ppa:msulikowski/valgrind" # For fixing a bug with valgrind 3.11 which does not recognize the rdrand instruction
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository -y 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
sudo apt-get -yq update
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
# Nothing to do here
:
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
# Nothing to do here
:
fi
-50
View File
@@ -1,50 +0,0 @@
#!/usr/bin/env bash
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
mkdir -p /tmp/builds
if [ "$RELEASE_BUILD" = true ]; then
# Package the source code in release builds
PARENT_DIR="$(basename "$PWD")"
(cd .. && tar -czvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
fi
fi
mkdir -p build
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
if [ "$BUILD_DEPLOYMENT" = true ]; then
for config in $BUILD_CONFIGS
do
mkdir -p $config
cd $config
eval $CMAKE -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX="/tmp/release/$config" \
-DFSO_BUILD_APPIMAGE=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_QTFRED=OFF ../..
cd ..
done
else
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON ..
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
if [ "$BUILD_DEPLOYMENT" = true ]; then
cmake -G "Xcode" -DFSO_FATAL_WARNINGS=ON -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_INSTALL_PREFIX="/tmp/release" ..
else
cmake -G "Xcode" $CMAKE_OPTIONS ..
fi
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
if [ "$CMAKE_GENERATOR" = "Ninja" ]; then
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -G "$CMAKE_GENERATOR" ..
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 "$CMAKE_GENERATOR" -T "$CMAKE_TOOLSET" ..
fi
fi
-74
View File
@@ -1,74 +0,0 @@
#!/usr/bin/env sh
RELEASE_BUILD=false
NIGHTLY_BUILD=false
TEST_BUILD=false
BUILD_DEPLOYMENT=false
BUILD_CONFIGS="Release FastDebug"
VERSION_NAME=""
PACKAGE_NAME=""
RELEASE_PATTERN="^release_(.*)$"
NIGHTLY_PATTERN="^nightly_(.*)$"
TEST_BUILD_PATTERN="^test\/(.*)$"
# These are for testing
NIGHTLY_TEST=false
RELEASE_TEST=false
TEST_BUILD_TEST=false
if [ "$RELEASE_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $RELEASE_PATTERN ]]; then
echo "This is a release tag!";
RELEASE_BUILD=true;
PACKAGE_NAME="fs2_open_${BASH_REMATCH[1]}";
fi
if [ "$NIGHTLY_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $NIGHTLY_PATTERN ]]; then
echo "This is a nightly tag!";
NIGHTLY_BUILD=true;
VERSION_NAME="${BASH_REMATCH[1]}";
PACKAGE_NAME="nightly_${BASH_REMATCH[1]}";
fi
if [ "$TEST_BUILD_TEST" = true ] || [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" =~ $TEST_BUILD_PATTERN ]]; then
echo "This is a test build branch!";
TEST_BUILD=true;
if [ "$TEST_BUILD_TEST" = true ]; then
VERSION_NAME="test";
PACKAGE_NAME="test_test";
else
VERSION_NAME="${BASH_REMATCH[1]}";
PACKAGE_NAME="test_${BASH_REMATCH[1]}";
fi
# Override the revision string so that the builds are named correctly
echo "set(FSO_VERSION_REVISION_STR $VERSION_NAME)" > "$TRAVIS_BUILD_DIR/version_override.cmake"
fi
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ] || [ "$TEST_BUILD" = true ]); then
BUILD_DEPLOYMENT=true;
fi
if [ "$BUILD_DEPLOYMENT" = true ]; then
if ([ "$TRAVIS_OS_NAME" = "linux" ] && (! [[ "$CC" =~ ^gcc-5.*$ ]])); then
echo "Skipping non-release compiler";
exit 0;
fi
if ([[ "$CONFIGURATION" == "Debug" ]]); then
echo "Skipping non-release configuration";
exit 0;
fi
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
echo "Skipping non-release platform"
exit 0
fi
fi
export RELEASE_BUILD
export NIGHTLY_BUILD
export TEST_BUILD
export BUILD_DEPLOYMENT
export BUILD_CONFIGS
export VERSION_NAME
export PACKAGE_NAME
-89
View File
@@ -1,89 +0,0 @@
#!/usr/bin/env bash
set -e
set -u
if [[ ! "$(curl -V)" == *"sftp"* ]]; then
# Before
echo "Before:"
curl -V
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -f ~/curl_cache/curl*.deb ]; then
cd ~/curl_cache
sudo dpkg -i libcurl3*.deb
sudo dpkg -i curl*.deb
else
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
mkdir /tmp/curl
cd /tmp/curl
sudo apt-get update
sudo apt-get install build-essential debhelper libssh2-1-dev libgnutls-dev libidn11-dev libkrb5-dev libldap2-dev libnss3-dev librtmp-dev libtool openssh-server quilt
apt-get source curl
sudo apt-get build-dep curl
cd curl-*
export DEB_BUILD_OPTIONS="nocheck"
sudo dpkg-buildpackage -uc -us -j"$(grep -c ^processor /proc/cpuinfo)"
cd ..
dpkg -l | grep curl
ls -al
if [ ! -d ~/curl_cache ]; then
mkdir ~/curl_cache
fi
cp libcurl3*.deb curl*.deb ~/curl_cache
sudo dpkg -i libcurl3*.deb
sudo dpkg -i curl*.deb
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew install libssh2
if [ -d ~/curl_cache/curl ]; then
cd ~/curl_cache/curl
sudo make install
else
mkdir /tmp/curl
cd /tmp/curl
curl -LO "https://curl.haxx.se/download/curl-7.64.0.tar.bz2"
tar -xjf curl-7.64.0.tar.bz2
cd curl-7.64.0
./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --with-libssh2 --with-darwinssl --without-ca-bundle --without-ca-path
make -j"$(sysctl hw.logicalcpu | cut -d " " -f 2)"
if [ ! -d ~/curl_cache ]; then
mkdir ~/curl_cache
fi
cp -a . ~/curl_cache/curl
sudo make install
fi
export PATH=/usr/local/bin:$PATH
fi
# After
echo "After:"
curl -V
fi
cd /tmp/builds
for file in *; do
if [ "$TEST_BUILD" = true ]; then
# Upload to datacorder
curl -k "sftp://porphyrion.feralhosting.com/www/datacorder.porphyrion.feralhosting.com/public_html/builds/test/$VERSION_NAME/" --user "$DATACORDER_USER:$DATACORDER_PASSWORD" -T "$file" --ftp-create-dirs
else
# Upload to indiegames
curl -k "sftp://scp.indiegames.us/~/public_html/builds/nightly/$VERSION_NAME/" --user "$INDIEGAMES_USER:$INDIEGAMES_PASSWORD" -T "$file" --ftp-create-dirs
# Upload to datacorder
curl -k "sftp://porphyrion.feralhosting.com/~/www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly/$VERSION_NAME/" --user "$DATACORDER_USER:$DATACORDER_PASSWORD" -T "$file" --ftp-create-dirs
fi
done
-47
View File
@@ -1,47 +0,0 @@
#!/usr/bin/env bash
set -ex
FILENAME=
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
if [ ! -d "$HOME/cmake-3.8/bin" ]; then
# If the cache does not currently contain CMake then download and install it
mkdir -p $HOME/cmake-3.8/
wget -O /tmp/cmake.tar.gz --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz
tar -xzf /tmp/cmake.tar.gz -C $HOME/cmake-3.8/ --strip-components=1
fi
export PATH=$HOME/cmake-3.8/bin:$PATH
cd $HOME
if [ "${BUILD_DEPLOYMENT}" = true ]; then
wget -O appimagetool -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" # (64-bit)
chmod a+x ./appimagetool
wget -O linuxdeployqt -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" # (64-bit)
chmod a+x ./linuxdeployqt
fi
sudo apt-get -yq install valgrind
if [[ "$CC" = "clang-9" ]]; then
sudo apt-get -yq install clang-9 clang-tidy-9
fi
if [[ "$CC" = "clang-4.0" ]]; then
# Fix a header bug present in ubuntu...
sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
gem install xcpretty
brew update
brew outdated cmake || brew upgrade cmake
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
choco install mingw ninja
fi
cmake --version
-68
View File
@@ -1,68 +0,0 @@
#!/usr/bin/env sh
set -ex
mkdir -p /tmp/builds
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
cd build
for config in $BUILD_CONFIGS
do
cd "$config"
# Compile all targets
ninja all
# Install Freespace2 targets
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/fso -DCOMPONENT=Unspecified -P cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/fso -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 /tmp/release/$config/fso/bin -name 'fs2_open_*' -type f -printf "%f\n").AppImage"
$HOME/appimagetool -n /tmp/release/$config/fso "/tmp/release/$config/fso/$FILENAME"
: <<'END'
# Install qtFRED targets
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/qtfred/usr -DCOMPONENT=Unspecified -P cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/qtfred/usr -DCOMPONENT=qtFRED -P cmake_install.cmake
PREV="$(pwd)"
cd /tmp/release/$config/qtfred
unset QTDIR; unset QT_PLUGIN_PATH; unset LD_LIBRARY_PATH
$HOME/linuxdeployqt usr/qtfred.desktop -bundle-non-qt-libs
# Move our AppRun script to the right location
mv usr/AppRun AppRun
echo "Embed newer libstdc++ for distros that don't come with it (ubuntu 14.04)";
mkdir -p usr/optional/; mkdir -p usr/optional/libstdc++/;
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./usr/optional/libstdc++/;
$HOME/appimagetool -n . "$(find /tmp/release/$config/qtfred/usr/bin -name 'qtfred_*' -type f -printf "%f\n").AppImage"
cd "$PREV"
END
cd ..
done
cp `find /tmp/release -name '*.AppImage' -print` /tmp/release
(cd /tmp/release && tar -cvzf /tmp/builds/$PACKAGE_NAME-builds-Linux.tar.gz *.AppImage)
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd build
for config in $BUILD_CONFIGS
do
cmake --build . --config "$config" --target install | tee build.log \
| xcpretty
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"
exit $XCODE_RET
fi
done
ls -al /tmp/release
(cd /tmp/release && tar -cvzf /tmp/builds/$PACKAGE_NAME-builds-MacOSX.tar.gz *)
fi
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env sh
set -e
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
ninja -k 20 all
if [ "$CONFIGURATION" = "Debug" ]; then
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$TRAVIS_BUILD_DIR/ci/travis/valgrind.supp" ./bin/unittests --gtest_shuffle
else
./bin/unittests --gtest_shuffle
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cmake --build . --config "$CONFIGURATION" | tee build.log | xcpretty
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://keep.sh"
exit $XCODE_RET
fi
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
if [ "$CMAKE_GENERATOR" = "Ninja" ]; then
cmake --build . --config "$CONFIGURATION"
else
cmake --build . --config "$CONFIGURATION" -- /verbosity:minimal
fi
fi
+16
View File
@@ -0,0 +1,16 @@
buildType:
default: release
description: R
choices:
release:
short: Release
long: Release builds
buildType: Release
fastDebug:
short: FastDebug
long: Debug with optimizations
buildType: FastDebug
debug:
short: Debug
long: Debug without optimizations
buildType: Debug
+2
View File
@@ -9,6 +9,8 @@ if (WIN32)
if (NOT HAVE_SAPI_H)
message(SEND_ERROR "sapi.h could not be found on your platform. Please disable speech support.")
endif()
elseif(APPLE)
# it should just work
else()
message(SEND_ERROR "Text to Speech is not supported on this platform!")
endif()
+1
View File
@@ -10,6 +10,7 @@ SET(WIN32_LIBS
winmm
ws2_32
psapi
shlwapi
)
IF (MINGW)
+3 -3
View File
@@ -4,7 +4,7 @@ MESSAGE(STATUS "Doing configuration specific to Apple Clang...")
# TODO: Actually add Mac specific flags here...
# Suppress specific warning
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops -fsigned-char -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fsigned-char -Wno-unknown-pragmas")
# Omit "conversion from string literal to 'char *' is deprecated" warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings")
@@ -13,6 +13,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-char-subscripts")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
set(CMAKE_CXX_FLAGS_RELEASE "-Wno-unused-variable")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "-Wextra -Wshadow -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -Wshadow")
+3 -3
View File
@@ -33,7 +33,7 @@ set(COMPILER_FLAGS "")
_enable_extra_compiler_warnings_flags()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsigned-char -Wno-unknown-pragmas")
# Omit "argument unused during compilation" when clang is used with ccache.
if(${CMAKE_CXX_COMPILER} MATCHES "ccache")
@@ -85,7 +85,7 @@ endif()
set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-parameter")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
set(COMPILER_FLAGS_DEBUG "-Og -g -Wshadow")
# Always use the base flags and add our compiler flags at the bacl
set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
@@ -120,7 +120,7 @@ if (FSO_FATAL_WARNINGS)
target_compile_options(compiler INTERFACE "-Werror")
endif()
# Always define this to make sure that the fixed width format macros are available
# 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)
+3 -3
View File
@@ -45,7 +45,7 @@ endif()
_enable_extra_compiler_warnings_flags()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsigned-char -Wno-unknown-pragmas")
if (NOT GCC_INCREMENTAL_LINKING)
# Place each function and data in its own section so the linker can
@@ -115,7 +115,7 @@ endif()
set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered -Wno-unused-parameter")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
set(COMPILER_FLAGS_DEBUG "-Og -g -Wshadow")
# Always use the base flags and add our compiler flags at the back
set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
@@ -165,7 +165,7 @@ if (FSO_FATAL_WARNINGS)
target_compile_options(compiler INTERFACE "-Werror")
endif()
# Always define this to make sure that the fixed width format macros are available
# 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)
+30 -17
View File
@@ -67,30 +67,43 @@ ENDIF(EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${FILE}\")
ENDFUNCTION(EP_CHECK_FILE_EXISTS)
MACRO(COPY_FILE_TO_TARGET _target _file)
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND cp -a "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "copying '${_file}'..."
)
if (IS_DIRECTORY "${_file}")
get_filename_component(_dirName "${_file}" NAME)
if (PLATFORM_MAC AND ("${_file}" MATCHES ".framework$"))
# This is stupid, but it preserves symlinks, unlike copy_directory_if_different.
# Otherwise we end up creating duplicate files in the copied framework.
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND rsync -rlq "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}"
COMMENT "copying '${_file}'..."
VERBATIM
)
else()
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/${_dirName}"
COMMENT "copying '${_file}'..."
VERBATIM
)
endif()
else()
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "copying '${_file}'..."
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "copying '${_file}'..."
VERBATIM
)
endif()
endmacro(COPY_FILE_TO_TARGET)
MACRO(COPY_FILES_TO_TARGET _target)
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND mkdir -p "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "Creating '$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/'..."
)
endif()
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "Creating '$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/'..."
VERBATIM
)
FOREACH(file IN LISTS TARGET_COPY_FILES)
COPY_FILE_TO_TARGET("${_target}" "${file}")
ENDFOREACH(file)
+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 22)
set_if_not_defined(FSO_VERSION_MAJOR 23)
set_if_not_defined(FSO_VERSION_MINOR 1)
set_if_not_defined(FSO_VERSION_BUILD 0)
+21 -5
View File
@@ -20,6 +20,9 @@ TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${GENERATED_SOURCE_DIR}/code)
if (FSO_BUILD_WITH_OPENGL)
target_link_libraries(code PUBLIC OpenGL)
if(FSO_BUILD_WITH_OPENGL_DEBUG)
add_definitions(-DFS_OPENGL_DEBUG)
endif()
endif()
TARGET_LINK_LIBRARIES(code PUBLIC openal)
@@ -47,10 +50,6 @@ target_link_libraries(code PUBLIC libRocket)
target_link_libraries(code PUBLIC pcp)
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)
@@ -68,6 +67,14 @@ target_link_libraries(code PUBLIC variant)
target_link_libraries(code PUBLIC any)
target_link_libraries(code PUBLIC optional)
target_link_libraries(code PUBLIC anl)
target_link_libraries(code PUBLIC hidapi::hidapi)
target_link_libraries(code PUBLIC imgui)
# Headers for standalone "gui" on UNIX
IF(UNIX)
TARGET_LINK_LIBRARIES(code PUBLIC ${MONGOOSE_LIBS})
@@ -90,7 +97,16 @@ 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)
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
target_compile_definitions(code PUBLIC WITH_VULKAN)
target_link_libraries(code PRIVATE Vulkan::Vulkan)
target_compile_definitions(code PUBLIC WITH_VULKAN VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VK_NO_PROTOTYPES)
else()
message(WARNING "FSO_BUILD_WITH_VULKAN was set, but the package was unable to be found. Forcing OFF.")
set(FSO_BUILD_WITH_VULKAN OFF CACHE BOOL "Enable compilation of the Vulkan renderer" FORCE)
endif()
endif()
include(shaders.cmake)
+1 -1
View File
@@ -18,7 +18,7 @@ struct ProgramLocals {
matrix localOrient = vmd_identity_matrix;
int hostSubobject = -1;
int waitTimestamp = 0;
TIMESTAMP waitTimestamp = TIMESTAMP::invalid();
expression::ProgramVariables variables;
};
+3 -3
View File
@@ -20,7 +20,7 @@ WaitAction::~WaitAction() = default;
ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
{
if (!timestamp_valid(locals.waitTimestamp)) {
if (!locals.waitTimestamp.isValid()) {
auto waitTime = _waitTimeExpression.execute(locals.variables);
// Catch errors in the expression
@@ -28,7 +28,7 @@ ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
waitTime = 0.001f;
}
locals.waitTimestamp = timestamp(fl2i(waitTime * TIMESTAMP_FREQUENCY));
locals.waitTimestamp = _timestamp(fl2i(waitTime * MILLISECONDS_PER_SECOND));
}
if (!timestamp_elapsed(locals.waitTimestamp)) {
// Wait until the timestamp is elapsed
@@ -36,7 +36,7 @@ ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
}
// Timestamp is elapsed. The timestamp is elapsed so that timestamp_valid above returns false for the next wait
// action
locals.waitTimestamp = 0;
locals.waitTimestamp = TIMESTAMP::invalid();
return ActionResult::Finished;
}
std::unique_ptr<Action> WaitAction::clone() const
-28
View File
@@ -52,34 +52,6 @@ void ai_free_slot(int ai_index)
Ai_info[ai_index].shipnum = -1;
}
int get_wingnum(int objnum)
{
int shipnum, ai_index;
shipnum = Objects[objnum].instance;
ai_index = Ships[shipnum].ai_index;
return Ai_info[ai_index].wing;
}
void set_wingnum(int objnum, int wingnum)
{
int shipnum, ai_index;
Assert(Objects[objnum].type == OBJ_SHIP);
shipnum = Objects[objnum].instance;
Assert((shipnum >= 0) && (shipnum < MAX_SHIPS));
ai_index = Ships[shipnum].ai_index;
Assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) );
Ai_info[ai_index].wing = wingnum;
}
const char *ai_get_goal_target_name(const char *name, int *index)
{
Assertion(name != nullptr && index != nullptr, "Arguments cannot be null!");
+17 -61
View File
@@ -12,6 +12,7 @@
#ifndef _AI_H
#define _AI_H
#include "ai/aigoals.h"
#include "ai/ai_profiles.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
@@ -33,8 +34,14 @@ typedef struct ai_flag_name {
char flag_name[TOKEN_LENGTH];
} ai_flag_name;
#define MAX_AI_FLAG_NAMES 2
typedef struct ai_flag_description {
AI::AI_Flags flag;
SCP_string flag_desc;
} ai_flag_description;
extern ai_flag_name Ai_flag_names[];
extern ai_flag_description Ai_flag_descriptions[];
extern const int Num_ai_flag_names;
// dock_orient_and_approach() modes.
#define DOA_APPROACH 1 // Approach the current point on the path (aip->path_cur)
@@ -55,18 +62,6 @@ extern ai_flag_name Ai_flag_names[];
#define AISS_3 43 // Gotten near spot, fly about there.
#define AISS_1a 44 // Pick a new nearby spot because we are endangered, then go to AISS_2
#define MAX_AI_GOALS 5
// types of ai goals -- tyese types will help us to determination on which goals should
// have priority over others (i.e. when a player issues a goal to a wing, then a seperate
// goal to a ship in that wing). We would probably use this type in conjunction with
// goal priority to establish which goal to follow
#define AIG_TYPE_EVENT_SHIP 1 // from mission event direct to ship
#define AIG_TYPE_EVENT_WING 2 // from mission event direct to wing
#define AIG_TYPE_PLAYER_SHIP 3 // from player direct to ship
#define AIG_TYPE_PLAYER_WING 4 // from player direct to wing
#define AIG_TYPE_DYNAMIC 5 // created on the fly
// Flags to ai_turn_towards_vector().
#define AITTV_FAST (1<<0) // Turn fast, not slowed down based on skill level.
#define AITTV_VIA_SEXP (1<<1) // Goober5000 - via sexp
@@ -76,39 +71,7 @@ extern ai_flag_name Ai_flag_names[];
#define KAMIKAZE_HULL_ON_DEATH -1000.0f // Hull strength ship gets set to if it crash-dies.
// structure for AI goals
typedef struct ai_goal {
int signature; // Unique identifier. All goals ever created (per mission) have a unique signature.
int ai_mode; // one of the AIM_* modes for this goal
int ai_submode; // maybe need a submode
int type; // one of the AIG_TYPE_* values above
flagset<AI::Goal_Flags> flags; // one of the AIGF_* values above
fix time; // time at which this goal was issued.
int priority; // how important is this goal -- number 0 - 100
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!)
int target_signature; // signature of object this ship might be chasing (currently only used for weapons; paired with above value to confirm target)
// unions for docking stuff.
// (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 {
const char *name;
int index;
} docker;
union {
const char *name;
int index;
} dockee;
object_ship_wing_point_team lua_ai_target;
} ai_goal;
// individual AI modes aka AI behaviors
#define AIM_CHASE 0
#define AIM_EVADE 1
#define AIM_GET_BEHIND 2 // This mode is not actually implemented.
@@ -138,8 +101,7 @@ typedef struct ai_goal {
#define MAX_WAYPOINTS_PER_LIST 20
#define MAX_ENEMY_DISTANCE 2500.0f // Maximum distance from which a ship will pursue an enemy.
#define AI_GOAL_NONE -1
#define MAX_AI_GOALS 5
#define AI_ACTIVE_GOAL_DYNAMIC 999
typedef struct ai_class {
@@ -277,8 +239,6 @@ extern pnode *Ppfp; // Free pointer in path points.
typedef struct ai_info {
flagset<AI::AI_Flags> ai_flags; // Special flags for AI behavior.
int shipnum; // Ship using this slot, -1 means none.
int type; //
int wing; // Member of what wing? -1 means none.
int behavior; // AI behavior; vestigial field from early development of FS1
int mode;
@@ -504,9 +464,12 @@ typedef struct ai_info {
int multilock_check_timestamp; // when to check for multilock next
SCP_vector<std::pair<int, ship_subsys*>> ai_missile_locks_firing; // a list of missile locks (locked objnum, locked subsys) the ai is currently firing
object_ship_wing_point_team lua_ai_target;
ai_lua_parameters lua_ai_target;
} ai_info;
int ai_maybe_autoscale(int absolute_index = -1);
int ai_get_autoscale_index(int absolute_index = -1);
// Goober5000
typedef struct {
vec3d docker_point;
@@ -531,11 +494,6 @@ typedef struct {
extern int Mission_all_attack; // !0 means all teams attack all teams.
extern void update_ai_info_for_hit(int hitter_obj, int hit_obj);
extern void ai_frame_all(void);
extern int find_guard_obj(void);
extern ai_info Ai_info[];
extern ai_info *Player_ai;
@@ -546,7 +504,6 @@ extern int Num_ai_classes;
extern int Ai_firing_enabled;
extern const char *Skill_level_names(int skill_level, int translate = 1);
extern int Ai_goal_signature;
extern control_info AI_ci;
@@ -570,9 +527,6 @@ void ai_object_init(object * obj, int ai_index);
// Called once a frame
void ai_process( object * obj, int ai_index, float frametime );
int get_wingnum(int objnum);
void set_wingnum(int objnum, int wingnum);
const char *ai_get_goal_target_name(const char *name, int *index);
void ai_clear_goal_target_names();
@@ -640,6 +594,8 @@ extern int ai_fire_primary_weapon(object *objp); //changed to return weather it
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, matrix* target_orient = nullptr, int flags = 0);
extern bool ai_willing_to_afterburn_hard(ai_info* aip);
extern void ai_afterburn_hard(object* objp, ai_info* aip);
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);
@@ -687,6 +643,6 @@ void do_random_sidethrust(ai_info *aip, ship_info *sip);
void ai_formation_object_recalculate_slotnums(int form_objnum, int exiting_objnum = -1);
bool test_line_of_sight(vec3d* from, vec3d* to, std::unordered_set<const object*>&& excluded_objects = {}, float threshold = 10.0f, bool test_for_shields = false, bool test_for_hull = true, float* first_intersect_dist = nullptr);
bool test_line_of_sight(vec3d* from, vec3d* to, std::unordered_set<const object*>&& excluded_objects = {}, float threshold = 10.0f, bool test_for_shields = false, bool test_for_hull = true, float* first_intersect_dist = nullptr, object** first_intersect_obj = nullptr);
#endif
+15 -4
View File
@@ -45,7 +45,8 @@ namespace AI {
Purge, // purge this goal next time we process
Goals_purged, // this goal has already caused other goals to get purged
Depart_sound_played,// Goober5000 - replacement for AL's hack ;)
Target_own_team,
Target_own_team, // this attack goal is allowed to target friendlies
Afterburn_hard, // afterburn as hard as possible to the goal
NUM_VALUES
};
@@ -121,7 +122,7 @@ namespace AI {
Smart_shield_management,
Smart_subsystem_targeting_for_turrets,
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
Support_dont_add_primaries, //Prevents support ship from equipping new primary as requested in https://scp.indiegames.us/mantis/view.php?id=3198
Turrets_ignore_target_radius,
Use_actual_primary_range,
Use_subsystem_path_point_radii,
@@ -130,8 +131,9 @@ namespace AI {
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,
All_nonshielded_ships_can_manage_ets,
Fightercraft_nonshielded_ships_can_manage_ets,
Ships_playing_dead_dont_manage_ets,
Better_collision_avoidance,
Require_exact_los,
Improved_missile_avoidance,
@@ -145,6 +147,15 @@ namespace AI {
Prevent_negative_turret_ammo,
Fix_keep_safe_distance,
Ignore_aspect_when_leading,
Fix_good_rearm_time_bug,
No_continuous_turn_on_attack,
Fixed_removing_play_dead_order,
Disable_bay_emerge_timeout,
Adjusted_AI_class_autoscale,
Carry_shield_difficulty_scaling_bug,
Whackable_debris,
Whackable_asteroids,
Dynamic_goals_afterburn_hard,
NUM_VALUES
};
+50 -6
View File
@@ -223,6 +223,9 @@ void parse_ai_profiles_tbl(const char *filename)
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Damage Inflicted Factor:"))
parse_float_list(profile->player_damage_inflicted_scale, NUM_SKILL_LEVELS);
// represented in fractions of F1_0
if (optional_string("$Predict Position Delay:"))
{
@@ -546,16 +549,18 @@ void parse_ai_profiles_tbl(const char *filename)
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);
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, "$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, "$fighters/bombers with no shields can manage ETS:", AI::Profile_Flags::Fightercraft_nonshielded_ships_can_manage_ets);
set_flag(profile, "$ships playing dead don't manage ETS:", AI::Profile_Flags::Ships_playing_dead_dont_manage_ets);
set_flag(profile, "$better combat collision avoidance for fightercraft:", AI::Profile_Flags::Better_collision_avoidance);
@@ -600,6 +605,23 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$AI ignores aspect lock for leading:", AI::Profile_Flags::Ignore_aspect_when_leading);
set_flag(profile, "$fix good-rearm-time bug:", AI::Profile_Flags::Fix_good_rearm_time_bug);
set_flag(profile, "$no continuous turn on attack:", AI::Profile_Flags::No_continuous_turn_on_attack);
set_flag(profile, "$remove-goal properly removes play-dead order:", AI::Profile_Flags::Fixed_removing_play_dead_order);
set_flag(profile, "$bay arrivals not time limited:", AI::Profile_Flags::Disable_bay_emerge_timeout);
set_flag(profile, "$use adjusted AI class autoscale:", AI::Profile_Flags::Adjusted_AI_class_autoscale);
set_flag(profile, "$carry shield difficulty scaling bug:", AI::Profile_Flags::Carry_shield_difficulty_scaling_bug);
set_flag(profile, "$debris affected by physics whacks:", AI::Profile_Flags::Whackable_debris);
set_flag(profile, "$asteroids affected by physics whacks:", AI::Profile_Flags::Whackable_asteroids);
set_flag(profile, "$dynamic goals afterburn hard:", AI::Profile_Flags::Dynamic_goals_afterburn_hard);
// if we've been through once already and are at the same place, force a move
if (saved_Mp && (saved_Mp == Mp))
@@ -642,12 +664,21 @@ void ai_profiles_init()
// init retail entry first
parse_ai_profiles_tbl(NULL);
// Allow mission_profiles.tbl to be a alias of ai_profiles.tbl, but only load one or the other.
// mission_profiles.tbl would be newer so assume intended, but print to the log to be sure - Mjn
char filename[MAX_FILENAME_LEN] = "ai_profiles.tbl";
if (cf_exists_full("mission_profiles.tbl", CF_TYPE_TABLES)) {
mprintf(("mission_profiles.tbl was found! Using that instead of ai_profiles.tbl...\n"));
strcpy_s(filename, "mission_profiles.tbl");
}
// now parse the supplied table (if any)
if (cf_exists_full("ai_profiles.tbl", CF_TYPE_TABLES))
parse_ai_profiles_tbl("ai_profiles.tbl");
if (cf_exists_full(filename, CF_TYPE_TABLES))
parse_ai_profiles_tbl(filename);
// parse any modular tables
parse_modular_table("*-aip.tbm", parse_ai_profiles_tbl);
parse_modular_table("*-msp.tbm", parse_ai_profiles_tbl);
// set default if specified
temp = ai_profile_lookup(Default_profile_name);
@@ -701,6 +732,7 @@ void ai_profile_t::reset()
shield_energy_scale[i] = 0;
afterburner_recharge_scale[i] = 0;
player_damage_scale[i] = 0;
player_damage_inflicted_scale[i] = 0;
subsys_damage_scale[i] = 0;
beam_friendly_damage_cap[i] = 0;
@@ -750,7 +782,7 @@ void ai_profile_t::reset()
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);
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)) {
@@ -760,6 +792,10 @@ void ai_profile_t::reset()
if (mod_supports_version(3, 6, 10)) {
flags.set(AI::Profile_Flags::Reset_last_hit_target_time_for_player_hits);
}
// backwards compatible flag for a bug accidentally introduced during this time
if (mod_supports_version(3, 6, 14) && !mod_supports_version(23, 1, 0)) {
flags.set(AI::Profile_Flags::Carry_shield_difficulty_scaling_bug);
}
if (mod_supports_version(21, 4, 0)) {
flags.set(AI::Profile_Flags::Fixed_ship_weapon_collision);
}
@@ -768,4 +804,12 @@ void ai_profile_t::reset()
flags.set(AI::Profile_Flags::Prevent_negative_turret_ammo);
flags.set(AI::Profile_Flags::Fix_keep_safe_distance);
}
if (mod_supports_version(23, 0, 0)) {
flags.set(AI::Profile_Flags::Fix_good_rearm_time_bug);
flags.set(AI::Profile_Flags::No_continuous_turn_on_attack);
flags.set(AI::Profile_Flags::Fixed_removing_play_dead_order);
}
if (mod_supports_version(23, 2, 0)) {
flags.set(AI::Profile_Flags::Ships_playing_dead_dont_manage_ets);
}
}
+2 -1
View File
@@ -21,7 +21,7 @@
#define AI_RANGE_AWARE_SEC_SEL_MODE_RETAIL 0
#define AI_RANGE_AWARE_SEC_SEL_MODE_AWARE 1
#define MAX_AI_PROFILES 5
#define MAX_AI_PROFILES 8
class ai_profile_t {
public:
@@ -53,6 +53,7 @@ public:
float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available
float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge
float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player
float player_damage_inflicted_scale[NUM_SKILL_LEVELS]; // damage applied by the player
float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire
+97 -79
View File
@@ -67,7 +67,6 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check=1);
void ai_big_strafe_position();
static int ai_big_strafe_maybe_retreat(const vec3d *target_pos);
extern int model_which_octant_distant_many( vec3d *pnt, int model_num,matrix *model_orient, vec3d * model_pos, polymodel **pm, int *octs);
extern void compute_desired_rvec(vec3d *rvec, vec3d *goal_pos, vec3d *cur_pos);
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *collision_normal);
@@ -83,10 +82,9 @@ void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec,
vec3d result_point, best_point;
vec3d rel_point;
int num_tries;
model_octant *octp;
polymodel *pm;
int i, q, octs[4];
int i;
ship_info *sip = &Ship_info[Ships[objp->instance].ship_info_index];
polymodel* pm = model_get(sip->model_num);
model_subsystem *tp = NULL;
if (ss != NULL)
tp = ss->system_info;
@@ -94,63 +92,53 @@ void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec,
best_point = objp->pos;
nearest_dist = weapon_travel_dist;
model_which_octant_distant_many(attacker_objp_pos, sip->model_num, &objp->orient, &objp->pos, &pm, octs);
// attempt anywhere from 16 to 4 times, more if we're closer
num_tries = (int) (vm_vec_dist(&objp->pos, attacker_objp_pos)/objp->radius);
if (num_tries >= 4)
num_tries = 1;
else
num_tries = 4 - num_tries;
num_tries = (4 - num_tries) * 4;
// Index #0 is best one.
if ( pm->octants[octs[0]].verts ) {
*local_attack_point = *pm->octants[octs[0]].verts[0]; // Set just in case it doesn't get set below.
} else {
vm_vec_zero(local_attack_point);
}
vm_vec_zero(local_attack_point);
for (q=0; q<4; q++) {
octp = &pm->octants[octs[q]];
if (octp->nverts > 0) {
auto collision_tree = model_get_bsp_collision_tree(pm->submodel[pm->detail[0]].collision_tree_index);
if (num_tries > octp->nverts)
num_tries = octp->nverts;
if (!collision_tree->poly_centers.empty()) {
int num_polies = (int)collision_tree->poly_centers.size();
if (num_tries > octp->nverts)
num_tries = octp->nverts;
if (num_tries > num_polies)
num_tries = num_polies;
for (i=0; i<num_tries; i++) {
int index;
float dist, dot;
vec3d v2p;
for (i=0; i<num_tries; i++) {
int index;
float dist, dot;
vec3d v2p;
index = (int) (frand() * (octp->nverts));
index = (int) (frand() * num_polies);
rel_point = *octp->verts[index];
vm_vec_unrotate(&result_point, &rel_point, &objp->orient);
vm_vec_add2(&result_point, &objp->pos);
rel_point = collision_tree->poly_centers[index];
vm_vec_unrotate(&result_point, &rel_point, &objp->orient);
vm_vec_add2(&result_point, &objp->pos);
dist = vm_vec_normalized_dir(&v2p, &result_point, attacker_objp_pos);
bool in_fov = false;
dist = vm_vec_normalized_dir(&v2p, &result_point, attacker_objp_pos);
bool in_fov = false;
dot = vm_vec_dot(&v2p, attacker_objp_fvec);
if (tp == NULL) {
if (dot > fov)
in_fov = true;
} else {
in_fov = turret_fov_test(ss, attacker_objp_fvec, &v2p);
}
dot = vm_vec_dot(&v2p, attacker_objp_fvec);
if (tp == NULL) {
if (dot > fov)
in_fov = true;
} else {
in_fov = turret_fov_test(ss, attacker_objp_fvec, &v2p);
}
if (in_fov) {
if (dist < nearest_dist) {
nearest_dist = dist;
best_point = result_point;
*local_attack_point = rel_point;
Assert( !vm_is_vec_nan(local_attack_point) );
if (dot > (1.0f + fov)/2.0f) // If this point is quite good, quit searching for a better one.
goto done_1;
}
if (in_fov) {
if (dist < nearest_dist) {
nearest_dist = dist;
best_point = result_point;
*local_attack_point = rel_point;
Assert( !vm_is_vec_nan(local_attack_point) );
if (dot > (1.0f + fov)/2.0f) // If this point is quite good, quit searching for a better one.
goto done_1;
}
}
}
@@ -174,8 +162,6 @@ done_1:
}
mc_info mc;
mc_info_init(&mc);
mc.model_instance_num = Ships[objp->instance].model_instance_num;
mc.model_num = sip->model_num;
mc.orient = &objp->orient;
@@ -549,11 +535,11 @@ bool ai_new_maybe_reposition_attack_subsys() {
// get world pos of eye (stored in geye)
ep = &(pm->view_positions[Ships[Pl_objp->instance].current_viewpoint]);
model_local_to_global_point(&geye, &ep->pnt, pm->id, 0, &Pl_objp->orient, &Pl_objp->pos);
model_local_to_global_point(&geye, &ep->pnt, pm, 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);
polymodel* tgt_pm = model_get(Ship_info[Ships[target_objp->instance].ship_info_index].model_num);
model_local_to_global_point(&gsubpos, &vmd_zero_vector, tgt_pm, aip->targeted_subsys->system_info->subobj_num, &En_objp->orient, &En_objp->pos);
// you're in sight! shoot it!
if (ship_subsystem_in_sight(En_objp, aip->targeted_subsys, &geye, &gsubpos, 0))
@@ -618,6 +604,7 @@ bool ai_new_maybe_reposition_attack_subsys() {
else
good_pos = &world_goal_pos;
aip->next_dynamic_path_check_time = timestamp( AI_DYNAMIC_PATH_RECHECK_DELAY );
aip->last_dynamic_path_goal = *good_pos;
}
else{ //Not enough time has passed till recheck.
@@ -631,15 +618,17 @@ bool ai_new_maybe_reposition_attack_subsys() {
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_willing_to_afterburn_hard(aip) && subsys_distance > 1000.0f)
ai_afterburn_hard(Pl_objp, aip);
else 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);
}
} else
afterburners_stop(Pl_objp);
return true;
}
@@ -661,16 +650,17 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
// are near
if ( sip->is_small_ship() ) {
if ( timestamp_elapsed(aip->scan_for_enemy_timestamp) ) {
ship_obj *so;
object *test_objp;
ship *test_sp;
float dist_squared;
aip->scan_for_enemy_timestamp = timestamp(SCAN_FIGHTERS_INTERVAL);
// iterate through ships, and see if any fighter/bomber from opposite team are near
so = GET_FIRST(&Ship_obj_list);
while( so != END_OF_LIST(&Ship_obj_list) ) {
for (auto so: list_range(&Ship_obj_list)) {
test_objp = &Objects[so->objnum];
if (test_objp->flags[Object::Object_Flags::Should_be_dead])
continue;
test_sp = &Ships[test_objp->instance];
if ( iff_x_attacks_y(Ships[Pl_objp->instance].team, test_sp->team) ) {
@@ -681,7 +671,6 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
}
}
}
so = GET_NEXT(so);
}
}
}
@@ -706,6 +695,9 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
if (Pl_objp->phys_info.speed < 3.0f) {
object *objp;
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
if (objp->flags[Object::Object_Flags::Should_be_dead])
continue;
if ((objp->type == OBJ_WEAPON) && (iff_x_attacks_y(Ships[Pl_objp->instance].team, Weapons[objp->instance].team)))
if (Weapon_info[Weapons[objp->instance].weapon_info_index].subtype == WP_LASER) {
vec3d in_vec;
@@ -756,7 +748,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
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])) {
if ((Pl_objp->phys_info.flags & PF_AFTERBURNER_ON) && !(aip->ai_flags[AI::AI_Flags::Kamikaze]) && !ai_willing_to_afterburn_hard(aip)) {
afterburners_stop(Pl_objp);
}
return;
@@ -848,7 +840,9 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
} else {
accelerate_ship(aip, accel);
if ((aip->ai_flags[AI::AI_Flags::Free_afterburner_use] || aip->ai_profile_flags[AI::Profile_Flags::Free_afterburner_use]) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (accel > 0.95f)) {
if (ai_willing_to_afterburn_hard(aip) && accel > 0.99f && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked])) {
ai_afterburn_hard(Pl_objp, aip);
} else if ((aip->ai_flags[AI::AI_Flags::Free_afterburner_use] || aip->ai_profile_flags[AI::Profile_Flags::Free_afterburner_use]) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (accel > 0.95f)) {
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 3*F1_0;
@@ -867,9 +861,9 @@ void ai_big_chase_ct()
ai_chase_ct();
}
extern void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 = -1, int priority2 = -1);
extern bool 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 bool 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, float time_scale = 1.f);
extern void maybe_cheat_fire_synaptic(object *objp);
@@ -900,7 +894,7 @@ static void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy)
// Chance of hitting ship is based on dot product of firing ship's forward vector with vector to ship
// and also the size of the target relative to distance to target.
if (dot_to_enemy > MAX(0.5f, 0.90f + aip->ai_accuracy/10.0f - En_objp->radius/MAX(1.0f,dist_to_enemy))) {
if (dot_to_enemy > std::max(0.5f, 0.90f + aip->ai_accuracy / 10.0f - En_objp->radius / std::max(1.0f, dist_to_enemy))) {
ship *temp_shipp;
temp_shipp = &Ships[Pl_objp->instance];
@@ -921,9 +915,9 @@ static void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy)
if (tswp->num_secondary_banks > 0) {
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
bool valid_secondary = ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
int current_bank = tswp->current_secondary_bank;
if (current_bank > -1) {
if (current_bank > -1 && valid_secondary) {
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
if(!(En_objp->flags[Object::Object_Flags::Protected]) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags[Weapon::Info_Flags::Puncture] )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
@@ -1019,6 +1013,8 @@ void ai_big_switch_to_chase_mode(ai_info *aip)
aip->submode_start_time = Missiontime;
}
extern weapon_info* ai_get_weapon(ship_weapon* swp);
// Make object Pl_objp chase object En_objp, which is a big ship, not a small ship.
void ai_big_chase()
{
@@ -1038,16 +1034,38 @@ void ai_big_chase()
player_pos = Pl_objp->pos;
ai_big_pick_attack_point(En_objp, Pl_objp, &enemy_pos, 0.8f);
// Compute the predicted position of the center of the ship, then add the delta to the goal pos.
if (En_objp->phys_info.speed > 3.0f) {
set_predicted_enemy_pos(&predicted_enemy_pos, Pl_objp, &En_objp->pos, &En_objp->phys_info.vel, aip);
vm_vec_add2(&enemy_pos, &predicted_enemy_pos);
vm_vec_sub2(&enemy_pos, &En_objp->pos);
} else
predicted_enemy_pos = En_objp->pos;
weapon_info* wip = ai_get_weapon(&shipp->weapons);
bool ballistic_aiming = !IS_VEC_NULL(&The_mission.gravity) && wip->gravity_const != 0.0f;
bool valid_ballistic_trajectory = true;
if (aip->targeted_subsys != NULL) {
get_subsystem_pos(&enemy_pos, En_objp, aip->targeted_subsys);
if (!ballistic_aiming) {
// Compute the predicted position of the center of the ship, then add the delta to the goal pos.
if (En_objp->phys_info.speed > 3.0f) {
set_predicted_enemy_pos(&predicted_enemy_pos, Pl_objp, &En_objp->pos, &En_objp->phys_info.vel, aip);
vm_vec_add2(&enemy_pos, &predicted_enemy_pos);
vm_vec_sub2(&enemy_pos, &En_objp->pos);
} else
predicted_enemy_pos = En_objp->pos;
if (aip->targeted_subsys != NULL) {
get_subsystem_pos(&enemy_pos, En_objp, aip->targeted_subsys);
}
} else {
if (aip->targeted_subsys != NULL) {
get_subsystem_pos(&enemy_pos, En_objp, aip->targeted_subsys);
}
vec3d gravity = The_mission.gravity * wip->gravity_const;
vec3d target;
valid_ballistic_trajectory =
physics_lead_ballistic_trajectory(&player_pos, &enemy_pos, &En_objp->phys_info.vel, wip->max_speed, &gravity, &target);
if (valid_ballistic_trajectory) {
enemy_pos = Pl_objp->pos + target * vm_vec_dist(&Pl_objp->pos, &enemy_pos);
predicted_enemy_pos = enemy_pos;
} else {
set_predicted_enemy_pos(&predicted_enemy_pos, Pl_objp, &En_objp->pos, &En_objp->phys_info.vel, aip);
}
}
dist_to_enemy = vm_vec_normalized_dir(&vec_to_enemy, &enemy_pos, &player_pos); // - En_objp->radius;
@@ -1078,7 +1096,7 @@ void ai_big_chase()
// If just acquired target, or target is not in reasonable cone, don't refine believed enemy position.
if ((dot_to_enemy < 0.25f) || (aip->target_time < 1.0f) || (aip->ai_flags[AI::AI_Flags::Seek_lock])) {
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy - En_objp->radius, En_objp->radius);
} else if (aip->targeted_subsys != NULL) {
} else if (aip->targeted_subsys != NULL && !ballistic_aiming) {
Assert(aip->targeted_subsys != NULL);
get_subsystem_pos(&enemy_pos, En_objp, aip->targeted_subsys);
vm_vec_add2(&enemy_pos, &predicted_enemy_pos);
@@ -1110,7 +1128,7 @@ void ai_big_chase()
}
}
if (aip->target_time < 2.0f)
if (!aip->ai_profile_flags[AI::Profile_Flags::No_continuous_turn_on_attack] && aip->target_time < 2.0f)
if ((dot_to_enemy < 0.9f) || (dist_to_enemy > 300.0f)) {
aip->submode = SM_CONTINUOUS_TURN;
aip->submode_start_time = Missiontime - fl2f(2.75f); // This backdated start time allows immediate switchout.
@@ -1318,7 +1336,7 @@ void ai_big_chase()
// I noticed AI ships firing inappropriately when following a path near a big ship.
// TODO: investigate why ships fire (and aren't close to hitting ship) when following a path near
// a big ship
if (aip->mode != AIM_EVADE && aip->path_start == -1 ) {
if (aip->mode != AIM_EVADE && aip->path_start == -1 && (!ballistic_aiming || valid_ballistic_trajectory)) {
ai_big_maybe_fire_weapons(dist_to_enemy, dot_to_enemy);
} else {
if (flFrametime < 1.0f)
+734 -394
View File
File diff suppressed because it is too large. Load diff
+238 -139
View File
@@ -13,6 +13,7 @@
#include "ai/aigoals.h"
#include "ai/ailua.h"
#include "globalincs/linklist.h"
#include "globalincs/utility.h"
#include "mission/missionlog.h"
#include "mission/missionparse.h"
#include "network/multi.h"
@@ -21,7 +22,9 @@
#include "object/objectdock.h"
#include "object/waypoint.h"
#include "parse/sexp.h"
#include "parse/sexp/LuaAISEXP.h"
#include "playerman/player.h"
#include "scripting/global_hooks.h"
#include "scripting/scripting.h"
#include "ship/ship.h"
#include "ship/awacs.h"
@@ -54,7 +57,7 @@ struct ship_registry_entry;
// goals given from the player to other ships in the game are also handled in this
// code
int Ai_goal_signature;
int Ai_goal_signature = 0;
int Num_ai_dock_names = 0;
char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
@@ -137,6 +140,41 @@ const char *Ai_goal_text(int goal, int submode)
return nullptr;
}
/**
* Reset all fields to their uninitialized defaults. But if this is being called before adding a new goal, the function will set the correct signature and time.
* Similarly the added mode, submode, and type can be assigned.
*/
void ai_goal_reset(ai_goal *aigp, bool adding_goal, int ai_mode, int ai_submode, int type)
{
if (ai_mode != AI_GOAL_NONE)
Assertion(adding_goal, "If a goal mode is being assigned, the adding_goal parameter must be true so that the signature and mission time can be set");
aigp->signature = adding_goal ? Ai_goal_signature++ : -1;
aigp->ai_mode = ai_mode;
aigp->ai_submode = ai_submode;
aigp->type = type;
aigp->flags.reset(); // must reset the flags since not doing so will screw up goal sorting.
aigp->time = adding_goal ? Missiontime : 0;
aigp->priority = -1;
aigp->target_name = nullptr;
aigp->target_name_index = -1;
aigp->wp_list = nullptr;
aigp->target_instance = -1;
aigp->target_signature = -1;
aigp->int_data = 0;
aigp->float_data = 0.0f;
aigp->docker.name = nullptr;
aigp->dockee.name = nullptr;
aigp->lua_ai_target.target.clear();
aigp->lua_ai_target.arguments.clear();
}
void ai_maybe_add_form_goal(wing* wingp)
{
// Cyborg17 - Changes from the client would just get overridden by the server anyway
@@ -217,6 +255,8 @@ void ai_post_process_mission()
// mission following the orders in the mission file right away instead of waiting N seconds
// before following them. Do both the created list and the object list for safety
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
if (objp->flags[Object::Object_Flags::Should_be_dead])
continue;
if ( objp->type != OBJ_SHIP )
continue;
ai_process_mission_orders( OBJ_INDEX(objp), &Ai_info[Ships[objp->instance].ai_index] );
@@ -268,17 +308,37 @@ void ai_remove_ship_goal( ai_info *aip, int index )
if (index == aip->active_goal)
{
auto shipp = &Ships[aip->shipnum];
// rearm/repair needs a bit of extra cleanup
if (aip->goals[index].ai_mode == AI_GOAL_REARM_REPAIR)
ai_abort_rearm_request(&Objects[Ships[aip->shipnum].objnum]);
ai_abort_rearm_request(&Objects[shipp->objnum]);
// play dead needs some extra cleanup, too
if (aip->goals[index].ai_mode == AI_GOAL_PLAY_DEAD || aip->goals[index].ai_mode == AI_GOAL_PLAY_DEAD_PERSISTENT)
{
// wookieejedi - there is an early return for the mode AIM_PLAY_DEAD in AI frame, so it needs to be set back to AIM_NONE
if (aip->ai_profile_flags[AI::Profile_Flags::Fixed_removing_play_dead_order])
{
aip->mode = AIM_NONE;
aip->submode_start_time = Missiontime;
}
// Goober5000 - any ship subsystems will start moving now, so their initial velocity should be 0 to match original behavior
for (auto pss = GET_FIRST(&shipp->subsys_list); pss != END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss))
{
if (pss->submodel_instance_1)
{
pss->submodel_instance_1->current_turn_rate = 0.0f;
pss->submodel_instance_1->current_shift_rate = 0.0f;
}
}
}
aip->active_goal = AI_GOAL_NONE;
}
aip->goals[index].ai_mode = AI_GOAL_NONE;
aip->goals[index].signature = -1;
aip->goals[index].priority = -1;
aip->goals[index].flags.reset(); // must reset the flags since not doing so will screw up goal sorting.
ai_goal_reset(&aip->goals[index]);
// mwa -- removed this line 8/5/97. Just because we remove a goal doesn't mean to do the default
// behavior. We will make the call commented out below in a more reasonable location
@@ -304,10 +364,9 @@ void ai_clear_ship_goals( ai_info *aip )
}
// add scripting hook for 'On Goals Cleared' --wookieejedi
if (Script_system.IsActiveAction(CHA_ONGOALSCLEARED)) {
Script_system.SetHookObject("Ship", &Objects[Ships[aip->shipnum].objnum]);
Script_system.RunCondition(CHA_ONGOALSCLEARED, &Objects[Ships[aip->shipnum].objnum]);
Script_system.RemHookVars({"Ship"});
if (scripting::hooks::OnGoalsCleared->isActive()) {
scripting::hooks::OnGoalsCleared->run(scripting::hooks::ShipSourceConditions{ &Ships[aip->shipnum] },
scripting::hook_param_list(scripting::hook_param("Ship", 'o', &Objects[Ships[aip->shipnum].objnum])));
}
}
@@ -326,10 +385,7 @@ void ai_clear_wing_goals( wing *wingp )
// 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();
ai_goal_reset(&wingp->ai_goals[i]);
}
}
@@ -384,10 +440,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
continue;
if ( (aigp->ai_mode == mode) && (aigp->ai_submode == submode) && (aigp->priority == priority) && !stricmp(name, aigp->target_name) ) {
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();
ai_goal_reset(aigp);
break;
}
}
@@ -487,7 +540,7 @@ void ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list, ai_info *ai
// for wings we grab the ship type of the wing leader
if (ai_wingnum >= 0) {
ai_ship_type = Ship_info[Ships[Wings[ai_wingnum].special_ship].ship_info_index].class_type;
ai_ship_type = Ship_info[Wings[ai_wingnum].special_ship_ship_info_index].class_type;
}
// otherwise we simply grab it from the ship itself
else {
@@ -523,6 +576,8 @@ void ai_goal_purge_all_invalid_goals(ai_goal *aigp)
for (sop = GET_FIRST(&Ship_obj_list); sop != END_OF_LIST(&Ship_obj_list); sop = GET_NEXT(sop))
{
if (Objects[sop->objnum].flags[Object::Object_Flags::Should_be_dead])
continue;
ship *shipp = &Ships[Objects[sop->objnum].instance];
ai_goal_purge_invalid_goals(aigp, Ai_info[shipp->ai_index].goals, &Ai_info[shipp->ai_index], -1);
}
@@ -632,7 +687,7 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
}
}
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
// look for docking points of the appropriate type. Use cargo docks for cargo ships.
/*
if (Ship_info[Ships[shipnum].ship_info_index].flags[Ship::Info_Flags::Cargo]) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
@@ -659,37 +714,29 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
// from the mission goals (i.e. those goals which come from events) in that we don't
// use sexpressions for goals from the player...so we enumerate all the parameters
void ai_add_goal_sub_player(int type, int mode, int submode, char *target_name, ai_goal *aigp, const object_ship_wing_point_team& lua_target )
void ai_add_goal_sub_player(int type, int mode, int submode, char *target_name, ai_goal *aigp, const ai_lua_parameters& lua_target )
{
Assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) );
aigp->time = Missiontime;
aigp->type = type; // from player for sure -- could be to ship or to wing
aigp->ai_mode = mode; // major mode for this goal
aigp->ai_submode = submode; // could mean different things depending on mode
ai_goal_reset(aigp, true, mode, submode, type);
aigp->lua_ai_target = lua_target;
if ( mode == AI_GOAL_WARP ) {
if (submode >= 0) {
aigp->wp_list = find_waypoint_list_at_index(submode);
Assert(aigp->wp_list != NULL);
} else {
aigp->wp_list = NULL;
}
}
if ( mode == AI_GOAL_CHASE_WEAPON ) {
aigp->target_instance = submode; // submode contains the instance of the weapon
aigp->target_signature = Objects[Weapons[submode].objnum].signature;
} else {
aigp->target_instance = -1;
aigp->target_signature = -1;
}
if ( target_name != NULL )
aigp->target_name = ai_get_goal_target_name( target_name, &aigp->target_name_index );
else
aigp->target_name = NULL;
// special case certain orders from player so that ships continue to do the right thing
@@ -758,29 +805,15 @@ void ai_add_goal_sub_scripting(int type, int mode, int submode, int priority, ch
{
Assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) );
aigp->time = Missiontime;
aigp->type = type; // from player for sure -- could be to ship or to wing
aigp->ai_mode = mode; // major mode for this goal
aigp->ai_submode = submode; // could mean different things depending on mode
if ( mode == AI_GOAL_WARP )
aigp->wp_list = NULL;
ai_goal_reset(aigp, true, mode, submode, type);
if ( mode == AI_GOAL_CHASE_WEAPON ) {
aigp->target_instance = submode; // submode contains the instance of the weapon
aigp->target_signature = Objects[Weapons[submode].objnum].signature;
}
if ( mode == AI_GOAL_WAYPOINTS_ONCE || mode == AI_GOAL_WAYPOINTS ) {
// should be the same as setting via sexp, see ai_add_goal_sub_sexp
// set to null so the AI code can setup the new waypoint list, see ai_mission_goal_achievable
aigp->wp_list = nullptr;
}
if ( target_name != NULL )
aigp->target_name = ai_get_goal_target_name( target_name, &aigp->target_name_index );
else
aigp->target_name = NULL;
aigp->priority = priority;
}
@@ -792,35 +825,29 @@ void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipn
empty_index = ai_goal_find_empty_slot(aip->goals, aip->active_goal);
aigp = &aip->goals[empty_index];
ai_add_goal_sub_scripting(AIG_TYPE_PLAYER_SHIP, mode, submode, priority, shipname, aigp);
//WMC - hack to get docking setup correctly
if ( mode == AI_GOAL_DOCK ) {
aigp->docker.name = Ships[aip->shipnum].ship_name;
aigp->dockee.name = shipname;
aigp->flags.remove(AI::Goal_Flags::Dockee_index_valid);
aigp->flags.remove(AI::Goal_Flags::Docker_index_valid);
}
ai_add_goal_sub_scripting(AIG_TYPE_PLAYER_SHIP, mode, submode, priority, shipname, aigp);
if ( (mode == AI_GOAL_REARM_REPAIR) || ((mode == AI_GOAL_DOCK) && (submode == AIS_DOCK_0)) ) {
if ( (mode == AI_GOAL_REARM_REPAIR) || (mode == AI_GOAL_DOCK) ) {
ai_goal_fixup_dockpoints( aip, aigp );
}
aigp->signature = Ai_goal_signature++;
}
// adds a goal from a player to the given ship's ai_info structure. 'type' tells us if goal
// is issued to ship or wing (from player), mode is AI_GOAL_*. submode is the submode the
// ship should go into. shipname is the object of the action. aip is the ai_info pointer
// of the ship receiving the order
void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip, const object_ship_wing_point_team& lua_target)
void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip, const ai_lua_parameters& lua_target)
{
int empty_index;
ai_goal *aigp;
empty_index = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
// get a pointer to the goal structure
aigp = &aip->goals[empty_index];
ai_add_goal_sub_player( type, mode, submode, shipname, aigp, lua_target );
@@ -829,17 +856,14 @@ void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, a
// on both ships. Code is here instead of in ai_add_goal_sub_player() since a dock goal
// should only occur to a specific ship.
if ( (mode == AI_GOAL_REARM_REPAIR) || ((mode == AI_GOAL_DOCK) && (submode == AIS_DOCK_0)) ) {
if ( (mode == AI_GOAL_REARM_REPAIR) || (mode == AI_GOAL_DOCK) ) {
ai_goal_fixup_dockpoints( aip, aigp );
}
aigp->signature = Ai_goal_signature++;
}
// adds a goal from the player to the given wing (which in turn will add it to the proper
// ships in the wing
void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum, const object_ship_wing_point_team& lua_target)
void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum, const ai_lua_parameters& lua_target)
{
int i, empty_index;
wing *wingp = &Wings[wingnum];
@@ -863,7 +887,7 @@ void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, i
// common routine to add a sexpression mission goal to the appropriate goal structure.
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
void ai_add_goal_sub_sexp( int sexp, int type, ai_info *aip, ai_goal *aigp, char *actor_name )
{
int node, dummy, op;
@@ -871,12 +895,8 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
node = Sexp_nodes[sexp].first;
op = get_operator_const( node );
aigp->signature = Ai_goal_signature++;
aigp->target_name = NULL;
aigp->time = Missiontime;
ai_goal_reset(aigp, true);
aigp->type = type;
aigp->flags.reset();
switch (op) {
@@ -885,11 +905,10 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
int ref_type;
ref_type = Sexp_nodes[CDR(node)].subtype;
if (ref_type == SEXP_ATOM_STRING) { // referenced by name
if (ref_type == SEXP_ATOM_STRING || ref_type == SEXP_ATOM_CONTAINER_DATA) { // referenced by name
// save the waypoint path name -- the list will get resolved when the goal is checked
// for achievability.
aigp->target_name = ai_get_goal_target_name(CTEXT(CDR(node)), &aigp->target_name_index); // waypoint path name;
aigp->wp_list = NULL;
} else
Int3();
@@ -934,7 +953,6 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
case OP_AI_WARP:
aigp->ai_mode = AI_GOAL_WARP;
aigp->target_name = ai_get_goal_target_name(CTEXT(CDR(node)), &aigp->target_name_index); // waypoint path name;
aigp->wp_list = NULL;
aigp->priority = atoi( CTEXT(CDR(CDR(node))) );
break;
@@ -944,13 +962,30 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
// Goober5000 - optional undock with something
if (CDR(CDR(node)) != -1)
aigp->target_name = ai_get_goal_target_name( CTEXT(CDR(CDR(node))), &aigp->target_name_index );
else
aigp->target_name = NULL;
aigp->ai_mode = AI_GOAL_UNDOCK;
aigp->ai_submode = AIS_UNDOCK_0;
break;
case OP_AI_REARM_REPAIR:
{
aigp->ai_mode = AI_GOAL_REARM_REPAIR;
aigp->target_name = ai_get_goal_target_name(CTEXT(CDR(node)), &aigp->target_name_index);
aigp->priority = atoi( CTEXT(CDR(CDR(node))) );
// this goal needs some extra setup
// if this doesn't work, the goal will be immediately removed
auto ship_entry = ship_registry_get(aigp->target_name);
if (ship_entry && ship_entry->shipp)
{
auto target_aip = &Ai_info[ship_entry->shipp->ai_index];
target_aip->ai_flags.set(AI::AI_Flags::Awaiting_repair);
Assertion(aip != nullptr, "Must provide aip if assigning a rearm goal!");
ai_goal_fixup_dockpoints( aip, aigp );
}
break;
}
case OP_AI_STAY_STILL:
aigp->ai_mode = AI_GOAL_STAY_STILL;
aigp->target_name = ai_get_goal_target_name(CTEXT(CDR(node)), &aigp->target_name_index); // waypoint path name;
@@ -961,8 +996,6 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->target_name = ai_get_goal_target_name( CTEXT(CDR(node)), &aigp->target_name_index );
aigp->docker.name = ai_add_dock_name(CTEXT(CDR(CDR(node))));
aigp->dockee.name = ai_add_dock_name(CTEXT(CDR(CDR(CDR(node)))));
aigp->flags.remove(AI::Goal_Flags::Dockee_index_valid);
aigp->flags.remove(AI::Goal_Flags::Docker_index_valid);
aigp->priority = atoi( CTEXT(CDR(CDR(CDR(CDR(node))))) );
aigp->ai_mode = AI_GOAL_DOCK;
@@ -989,6 +1022,20 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->ai_mode = AI_GOAL_KEEP_SAFE_DISTANCE;
break;
case OP_AI_STAY_NEAR_SHIP:
{
bool is_nan, is_nan_forever;
aigp->target_name = ai_get_goal_target_name( CTEXT(CDR(node)), &aigp->target_name_index );
aigp->priority = atoi( CTEXT(CDDR(node)) );
if ( CDDDR(node) < 0 )
aigp->float_data = 300.0f;
else
aigp->float_data = i2fl(eval_num(CDDDR(node), is_nan, is_nan_forever));
aigp->ai_mode = AI_GOAL_STAY_NEAR_SHIP;
break;
}
case OP_AI_FORM_ON_WING:
aigp->priority = 99;
aigp->target_name = ai_get_goal_target_name(CTEXT(CDR(node)), &aigp->target_name_index);
@@ -1001,9 +1048,9 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
case OP_AI_GUARD:
case OP_AI_GUARD_WING:
case OP_AI_EVADE_SHIP:
case OP_AI_STAY_NEAR_SHIP:
case OP_AI_IGNORE:
case OP_AI_IGNORE_NEW:
case OP_AI_FLY_TO_SHIP:
aigp->target_name = ai_get_goal_target_name( CTEXT(CDR(node)), &aigp->target_name_index );
aigp->priority = atoi( CTEXT(CDR(CDR(node))) );
@@ -1036,8 +1083,10 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->ai_mode = AI_GOAL_IGNORE;
} else if ( op == OP_AI_IGNORE_NEW ) {
aigp->ai_mode = AI_GOAL_IGNORE_NEW;
} else if ( op == OP_AI_FLY_TO_SHIP ) {
aigp->ai_mode = AI_GOAL_FLY_TO_SHIP;
} else
Int3(); // this is impossible
UNREACHABLE("Coding error: unhandled AI goal in ai_add_goal_sub_sexp!");
break;
@@ -1050,12 +1099,16 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
aigp->ai_mode = AI_GOAL_LUA;
aigp->ai_submode = op;
object_ship_wing_point_team target;
if(luaAIMode->needsTarget) {
eval_object_ship_wing_point_team(&aigp->lua_ai_target, localnode);
eval_object_ship_wing_point_team(&target, localnode);
localnode = CDR(localnode);
}
aigp->priority = atoi( CTEXT(localnode) );
aigp->lua_ai_target = { std::move(target), luaAIMode->sexp.getSEXPArgumentList(CDR(localnode)) };
}
else {
UNREACHABLE("Invalid SEXP-OP number %d for an AI goal!", op);
@@ -1069,24 +1122,46 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
// Goober5000 - we now have an extra optional chase argument to allow chasing our own team
if ( op == OP_AI_CHASE || op == OP_AI_CHASE_WING || op == OP_AI_CHASE_SHIP_CLASS || op == OP_AI_DISABLE_SHIP || op == OP_AI_DISARM_SHIP ) {
if ((CDDDR(node) != -1) && is_sexp_true(CDDDR(node)))
if (is_sexp_true(CDDDR(node)))
aigp->flags.set(AI::Goal_Flags::Target_own_team);
}
if ( op == OP_AI_DESTROY_SUBSYS ) {
if ((CDDDDR(node) != -1) && is_sexp_true(CDDDDR(node)))
if (is_sexp_true(CDDDDR(node)))
aigp->flags.set(AI::Goal_Flags::Target_own_team);
}
// maybe get the afterburn hard flag
if (op == OP_AI_CHASE_ANY) {
if (is_sexp_true(CDDR(node)))
aigp->flags.set(AI::Goal_Flags::Afterburn_hard);
}
if (op == OP_AI_GUARD ||
op == OP_AI_GUARD_WING ||
op == OP_AI_WAYPOINTS ||
op == OP_AI_WAYPOINTS_ONCE ||
op == OP_AI_FLY_TO_SHIP) {
if (is_sexp_true(CDDDR(node)))
aigp->flags.set(AI::Goal_Flags::Afterburn_hard);
}
if (op == OP_AI_CHASE ||
op == OP_AI_CHASE_WING ||
op == OP_AI_CHASE_SHIP_CLASS ||
op == OP_AI_DISABLE_SHIP ||
op == OP_AI_DISARM_SHIP ||
op == OP_AI_STAY_NEAR_SHIP) {
if (is_sexp_true(CDDDDR(node)))
aigp->flags.set(AI::Goal_Flags::Afterburn_hard);
}
if (op == OP_AI_DESTROY_SUBSYS || op == OP_AI_DOCK) {
if (is_sexp_true(CDDDDDR(node)))
aigp->flags.set(AI::Goal_Flags::Afterburn_hard);
}
// Goober5000 - since none of the goals act on the actor,
// don't assign the goal if the actor's goal target is itself
if (aigp->target_name != NULL && !strcmp(aigp->target_name, actor_name))
{
// based on ai_remove_ship_goal, these seem to be the only statements
// necessary to cause this goal to "never have been assigned"
aigp->ai_mode = AI_GOAL_NONE;
aigp->signature = -1;
aigp->priority = -1;
aigp->flags.reset();
ai_goal_reset(aigp);
}
}
@@ -1239,6 +1314,14 @@ int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp )
priority = 99;
goalmode = AI_GOAL_FORM_ON_WING;
break;
case OP_AI_FLY_TO_SHIP:
priority = ( CDR( CDR(node) ) >= 0 ) ? atoi( CTEXT( CDR( CDR( node ) ) ) ) : -1;
goalmode = AI_GOAL_FLY_TO_SHIP;
break;
case OP_AI_REARM_REPAIR:
priority = ( CDR( CDR(node) ) >= 0 ) ? atoi( CTEXT( CDR( CDR( node ) ) ) ) : -1;
goalmode = AI_GOAL_REARM_REPAIR;
break;
default:
const ai_mode_lua* luaAIMode = ai_lua_find_mode(op);
if(luaAIMode != nullptr){
@@ -1268,10 +1351,7 @@ int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp )
/* Clear out the contents of the goal. We can't use ai_remove_ship_goal since it needs ai_info and
* we've only got ai_goals */
aigp[goalindex].ai_mode = AI_GOAL_NONE;
aigp[goalindex].signature = -1;
aigp[goalindex].priority = -1;
aigp[goalindex].flags.reset(); // must reset the flags since not doing so will screw up goal sorting.
ai_goal_reset(&aigp[goalindex]);
return goalindex;
}
@@ -1309,7 +1389,7 @@ void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
int gindex;
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
ai_add_goal_sub_sexp( sexp, type, &aip->goals[gindex], Ships[aip->shipnum].ship_name );
ai_add_goal_sub_sexp( sexp, type, aip, &aip->goals[gindex], Ships[aip->shipnum].ship_name );
}
// code to add ai goals to wings.
@@ -1333,7 +1413,7 @@ void ai_add_wing_goal_sexp(int sexp, int type, wing *wingp)
int gindex;
gindex = ai_goal_find_empty_slot( wingp->ai_goals, -1 );
ai_add_goal_sub_sexp( sexp, type, &wingp->ai_goals[gindex], wingp->name );
ai_add_goal_sub_sexp( sexp, type, nullptr, &wingp->ai_goals[gindex], wingp->name );
}
}
@@ -1364,12 +1444,9 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int /*
// find an empty slot to put this goal in.
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
aigp = &(aip->goals[gindex]);
ai_goal_reset(aigp, true);
aigp->signature = Ai_goal_signature++;
aigp->time = Missiontime;
aigp->type = AIG_TYPE_DYNAMIC;
aigp->flags.reset();
aigp->flags.set(AI::Goal_Flags::Goal_override);
switch ( goal_type ) {
@@ -1453,12 +1530,11 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
{
int status;
ai_achievability return_val;
object *objp;
ai_info *aip;
int index = -1, sindex = -1;
int modelnum = -1;
objp = &Objects[objnum];
auto objp = &Objects[objnum];
Assert( objp->instance != -1 );
aip = &Ai_info[Ships[objp->instance].ai_index];
@@ -1521,8 +1597,11 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// if not, the status is not known because more ships of that class could arrive in the future
// (c.f. AI_GOAL_CHASE_WING subsequent to the next switch statement)
if ( aigp->ai_mode == AI_GOAL_CHASE_SHIP_CLASS ) {
for (objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) {
if ((objp->type == OBJ_SHIP) && !strcmp(aigp->target_name, Ship_info[Ships[objp->instance].ship_info_index].name)) {
for (auto so: list_range(&Ship_obj_list)) {
auto class_objp = &Objects[so->objnum];
if (class_objp->flags[Object::Object_Flags::Should_be_dead])
continue;
if ((class_objp->type == OBJ_SHIP) && !strcmp(aigp->target_name, Ship_info[Ships[class_objp->instance].ship_info_index].name)) {
return ai_achievability::ACHIEVABLE;
}
}
@@ -1674,7 +1753,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
default:
Int3();
UNREACHABLE("Unhandled AI goal %d", aigp->ai_mode);
status = 0;
break;
}
@@ -1718,7 +1797,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
status = SHIP_STATUS_UNKNOWN;
}
// goal ship is currently in mission
else if (ship_entry->status == ShipStatus::PRESENT)
else if (ship_entry->status == ShipStatus::PRESENT || ship_entry->status == ShipStatus::DEATH_ROLL)
{
status = SHIP_STATUS_ARRIVED;
}
@@ -1746,9 +1825,16 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// Goober5000 - before doing anything else, check if this is a disarm goal for an arrived ship...
if ((status == SHIP_STATUS_ARRIVED) && (aigp->ai_mode == AI_GOAL_DISARM_SHIP))
{
// if the ship has no turrets, we can't disarm it!
if (Ships[ship_name_lookup(aigp->target_name)].subsys_info[SUBSYSTEM_TURRET].type_count == 0)
return ai_achievability::NOT_ACHIEVABLE;
sindex = ship_name_lookup(aigp->target_name);
if ( sindex >= 0 ) {
// if the ship has no turrets, we can't disarm it!
if (Ships[sindex].subsys_info[SUBSYSTEM_TURRET].type_count == 0)
return ai_achievability::NOT_ACHIEVABLE;
} else {
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
}
}
// if the goal is an ignore/disable/disarm goal, then
@@ -1789,7 +1875,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
if ( (aigp->dockee.index == -1) || (aigp->docker.index == -1) ) {
Int3(); // for now, allender wants to know about these things!!!!
Warning(LOCATION, "Cannot determine docking information for %s!", Ships[objp->instance].ship_name); // for now, allender wants to know about these things!!!!
return ai_achievability::NOT_ACHIEVABLE;
}
@@ -1799,7 +1885,10 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// we must also determine if we're prevented from docking for any reason
sindex = ship_name_lookup(aigp->target_name);
Assert( sindex >= 0 );
if (sindex < 0) {
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
}
object *goal_objp = &Objects[Ships[sindex].objnum];
// if the ship that I am supposed to dock with is docked with something else, then I need to put my goal on hold
@@ -1849,9 +1938,16 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// might happen too, so err on the safe side. (Yay for emergent paragraph justification!)
if ((aip->mode == AIM_DOCK) && (aip->submode >= AIS_UNDOCK_0))
{
// only put it on hold if it's someone other than the guy we're undocking from right now!!
if (aip->goal_objnum != Ships[ship_name_lookup(aigp->target_name)].objnum)
return ai_achievability::NOT_KNOWN;
sindex = ship_name_lookup(aigp->target_name);
if ( sindex >= 0 ) {
// only put it on hold if it's someone other than the guy we're undocking from right now!!
if (aip->goal_objnum != Ships[sindex].objnum)
return ai_achievability::NOT_KNOWN;
} else {
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
}
}
} else if ( (aigp->ai_mode == AI_GOAL_DESTROY_SUBSYSTEM) && (status == SHIP_STATUS_ARRIVED) ) {
@@ -1865,7 +1961,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
aigp->ai_submode = ship_find_subsys( &Ships[sindex], aigp->docker.name );
aigp->flags.remove(AI::Goal_Flags::Subsys_needs_fixup);
} else {
Int3();
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
}
}
@@ -1874,7 +1970,10 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// for ignoring a ship, call the ai_ignore object function, then declare the goal satisfied
sindex = ship_name_lookup( aigp->target_name );
Assert( sindex != -1 ); // should be true because of above status
if (sindex < 0) {
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
}
ignored = &Objects[Ships[sindex].objnum];
ai_ignore_object(objp, ignored, (aigp->ai_mode == AI_GOAL_IGNORE_NEW));
@@ -1908,7 +2007,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
else if ( status == SHIP_STATUS_UNKNOWN )
return ai_achievability::NOT_KNOWN;
Int3(); // get allender -- bad logic
UNREACHABLE("Invalid status variable %d for ship %s; get Allender or a SCP member", status, Ships[objp->instance].ship_name); // get allender -- bad logic
break;
}
@@ -1920,7 +2019,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// short circuit a couple of cases. Ship not arrived shouldn't happen. Ship gone means
// we mark the goal as not achievable.
if ( status == SHIP_STATUS_NOT_ARRIVED ) {
Int3(); // get Allender. this shouldn't happen!!!
UNREACHABLE("Ship %s cannot rearm a target %s that hasn't arrived; get Allender or a SCP member", Ships[objp->instance].ship_name, aigp->target_name); // get Allender. this shouldn't happen!!!
return ai_achievability::NOT_ACHIEVABLE;
}
@@ -1928,9 +2027,8 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
return ai_achievability::NOT_ACHIEVABLE;
sindex = ship_name_lookup( aigp->target_name );
if ( sindex < 0 ) {
Int3();
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
return ai_achievability::NOT_ACHIEVABLE;
}
@@ -1966,7 +2064,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
default:
Int3(); // invalid case in switch:
UNREACHABLE("Unhandled AI goal %d", aigp->ai_mode); // invalid case in switch:
}
return ai_achievability::NOT_KNOWN;
@@ -2077,11 +2175,11 @@ void validate_mission_goals(int objnum, ai_info *aip)
if ( (aip->goals[0].ai_mode != AI_GOAL_NONE) && (aip->goals[0].flags[AI::Goal_Flags::Goal_on_hold]) )
aip->mode = AIM_NONE;
// if the active goal is a rearm/repair goal, the put all other valid goals (which are not repair goals)
// on hold
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR) && object_is_docked(&Objects[objnum]) ) {
// if the active goal is a rearm/repair or undock goal,
// then put all other valid goals (which are not rearm/repair or undock goals) on hold
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR || aip->goals[0].ai_mode == AI_GOAL_UNDOCK) && object_is_docked(&Objects[objnum]) ) {
for ( i = 1; i < MAX_AI_GOALS; i++ ) {
if ( (aip->goals[i].ai_mode == AI_GOAL_NONE) || (aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR) )
if ( aip->goals[i].ai_mode == AI_GOAL_NONE || aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR || aip->goals[i].ai_mode == AI_GOAL_UNDOCK )
continue;
aip->goals[i].flags.set(AI::Goal_Flags::Goal_on_hold);
}
@@ -2400,13 +2498,14 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
break;
case AI_GOAL_FORM_ON_WING:
// get the ship first, since we're going to wipe it out next
shipnum = ship_name_lookup( current_goal->target_name );
Assert( shipnum >= 0 );
other_obj = &Objects[Ships[shipnum].objnum];
// for form on wing, we need to clear out all goals for this ship, and then call the form
// on wing AI code
// clearing out goals is okay here since we are now what mode to set this AI object to.
ai_clear_ship_goals( aip );
shipnum = ship_name_lookup( current_goal->target_name );
Assert( shipnum >= 0 );
other_obj = &Objects[Ships[shipnum].objnum];
ai_form_on_wing( objp, other_obj );
break;
@@ -2416,8 +2515,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];
// todo MK: hook to keep support ship near other_obj -- other_obj could be the player object!!!
float dist = 300.0f; // How far away to stay from ship. Should be set in SEXP?
float dist = current_goal->float_data; // How far away to stay from ship. Should be set in SEXP?
ai_do_stay_near(objp, other_obj, dist);
break;
}
@@ -2449,7 +2547,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
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)
void ai_update_goal_references(ai_goal *goals, sexp_ref_type type, const char *old_name, const char *new_name)
{
int i, mode, flag, dummy;
@@ -2459,8 +2557,8 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
flag = 0;
switch (type)
{
case REF_TYPE_SHIP:
case REF_TYPE_PLAYER:
case sexp_ref_type::SHIP:
case sexp_ref_type::PLAYER:
switch (mode)
{
case AI_GOAL_CHASE:
@@ -2477,7 +2575,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
}
break;
case REF_TYPE_WING:
case sexp_ref_type::WING:
switch (mode)
{
case AI_GOAL_CHASE_WING:
@@ -2486,7 +2584,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
}
break;
case REF_TYPE_WAYPOINT:
case sexp_ref_type::WAYPOINT:
switch (mode)
{
case AI_GOAL_WAYPOINTS:
@@ -2495,7 +2593,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
}
break;
case REF_TYPE_PATH:
case sexp_ref_type::WAYPOINT_PATH:
switch (mode)
{
case AI_GOAL_WAYPOINTS:
@@ -2506,7 +2604,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
break;
default:
Warning(LOCATION, "unhandled FRED reference type %d in ai_update_goal_references", type);
Warning(LOCATION, "unhandled FRED reference type %d in ai_update_goal_references", static_cast<int>(type));
break;
}
@@ -2523,7 +2621,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c
}
}
int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
bool query_referenced_in_ai_goals(ai_goal *goals, sexp_ref_type type, const char *name)
{
int i, mode, flag;
@@ -2533,7 +2631,8 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
flag = 0;
switch (type)
{
case REF_TYPE_SHIP:
case sexp_ref_type::SHIP:
case sexp_ref_type::PLAYER:
switch (mode)
{
case AI_GOAL_CHASE:
@@ -2550,7 +2649,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
}
break;
case REF_TYPE_WING:
case sexp_ref_type::WING:
switch (mode)
{
case AI_GOAL_CHASE_WING:
@@ -2559,7 +2658,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
}
break;
case REF_TYPE_WAYPOINT:
case sexp_ref_type::WAYPOINT:
switch (mode)
{
case AI_GOAL_WAYPOINTS:
@@ -2568,7 +2667,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
}
break;
case REF_TYPE_PATH:
case sexp_ref_type::WAYPOINT_PATH:
switch (mode)
{
case AI_GOAL_WAYPOINTS:
@@ -2581,11 +2680,11 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name)
if (flag) // is this a valid goal to parse for this conversion?
{
if (!stricmp(goals[i].target_name, name))
return 1;
return true;
}
}
return 0;
return false;
}
char *ai_add_dock_name(const char *str)
+68 -6
View File
@@ -12,16 +12,30 @@
#ifndef _AIGOALS_H
#define _AIGOALS_H
#include "ai/ai_flags.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "parse/sexp.h"
#include "scripting/lua/LuaTypes.h"
#include "scripting/lua/LuaValue.h"
struct wing;
struct ai_info;
struct ai_goal;
// macros for goals which get set via sexpressions in the mission code
// types of ai goals -- tyese types will help us to determination on which goals should
// have priority over others (i.e. when a player issues a goal to a wing, then a seperate
// goal to a ship in that wing). We would probably use this type in conjunction with
// goal priority to establish which goal to follow
#define AIG_TYPE_EVENT_SHIP 1 // from mission event direct to ship
#define AIG_TYPE_EVENT_WING 2 // from mission event direct to wing
#define AIG_TYPE_PLAYER_SHIP 3 // from player direct to ship
#define AIG_TYPE_PLAYER_WING 4 // from player direct to wing
#define AIG_TYPE_DYNAMIC 5 // created on the fly
#define AI_GOAL_NONE -1
// IMPORTANT! If you add a new AI_GOAL_x define, be sure to update the functions
// ai_update_goal_references() and query_referenced_in_ai_goals() or else risk breaking
// Fred. If the goal you add doesn't have a target (such as chase_any), then you don't have
@@ -86,6 +100,51 @@ struct ai_goal;
enum class ai_achievability { ACHIEVABLE, NOT_ACHIEVABLE, NOT_KNOWN, SATISFIED };
struct ai_lua_parameters {
object_ship_wing_point_team target;
luacpp::LuaValueList arguments;
};
// structure for AI goals
typedef struct ai_goal {
int signature; // Unique identifier. All goals ever created (per mission) have a unique signature.
int ai_mode; // one of the AIM_* modes for this goal
int ai_submode; // maybe need a submode
int type; // one of the AIG_TYPE_* values above
flagset<AI::Goal_Flags> flags; // one of the AIGF_* values above
fix time; // time at which this goal was issued.
int priority; // how important is this goal -- number 0 - 100
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!)
int target_signature; // signature of object this ship might be chasing (currently only used for weapons; paired with above value to confirm target)
// extra goal-specific data
int int_data;
float float_data;
// unions for docking stuff.
// (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 {
const char *name;
int index;
} docker;
union {
const char *name;
int index;
} dockee;
ai_lua_parameters lua_ai_target;
} ai_goal;
extern void ai_goal_reset(ai_goal *aigp, bool adding_goal = false, int ai_mode = AI_GOAL_NONE, int ai_submode = -1, int type = -1);
typedef flag_def_list ai_goal_list;
extern ai_goal_list Ai_goal_names[];
@@ -96,6 +155,9 @@ extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
extern const char *Ai_goal_text(int goal, int submode);
// every goal in a mission gets a unique signature
extern int Ai_goal_signature;
// extern function definitions
extern void ai_post_process_mission();
extern void ai_maybe_add_form_goal( wing *wingp );
@@ -107,14 +169,14 @@ extern int ai_goal_num(ai_goal *goals);
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, wing *wingp );
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name);
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_info *aip, 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, 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, const object_ship_wing_point_team& lua_target = object_ship_wing_point_team());
extern void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum, const object_ship_wing_point_team& lua_target = object_ship_wing_point_team());
extern void ai_add_ship_goal_player(int type, int mode, int submode, char* shipname, ai_info* aip, const ai_lua_parameters& lua_target = { object_ship_wing_point_team(), luacpp::LuaValueList{} });
extern void ai_add_wing_goal_player(int type, int mode, int submode, char* shipname, int wingnum, const ai_lua_parameters& lua_target = { object_ship_wing_point_team(), luacpp::LuaValueList{} });
extern void ai_remove_ship_goal( ai_info *aip, int index );
extern void ai_clear_ship_goals( ai_info *aip );
@@ -125,8 +187,8 @@ extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
extern void ai_mission_goal_complete( ai_info *aip );
extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name);
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name);
extern void ai_update_goal_references(ai_goal *goals, sexp_ref_type type, const char *old_name, const char *new_name);
extern bool query_referenced_in_ai_goals(ai_goal *goals, sexp_ref_type type, const char *name);
extern char *ai_add_dock_name(const char *str);
extern int ai_query_goal_valid( int ship, int ai_goal_type );
+83 -71
View File
@@ -58,7 +58,10 @@ void run_ai_lua_action(const luacpp::LuaFunction& action, const ai_mode_lua& lua
luacpp::LuaValueList luaParameters;
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_AI_Helper.Set(object_h(&Objects[Ships[aip->shipnum].objnum]))));
if (lua_ai.needsTarget) {
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(aip->lua_ai_target)));
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(aip->lua_ai_target.target)));
}
for (const auto& additionalParam : aip->lua_ai_target.arguments) {
luaParameters.push_back(additionalParam);
}
auto retVals = action.call(Script_system.GetLuaSession(), luaParameters);
@@ -74,14 +77,10 @@ void ai_lua(ai_info* aip){
const auto& lua_ai = Lua_ai_modes.at(aip->submode);
auto dynamicSEXP = sexp::get_dynamic_sexp(aip->submode);
const auto& lua_ai_sexp = lua_ai.sexp;
const auto& action = lua_ai_sexp.getAction();
if (dynamicSEXP != nullptr && typeid(*dynamicSEXP) == typeid(sexp::LuaAISEXP)) {
auto lua_ai_sexp = static_cast<sexp::LuaAISEXP*>(dynamicSEXP);
const auto& action = lua_ai_sexp->getActionFrame();
run_ai_lua_action(action, lua_ai, aip);
}
run_ai_lua_action(action, lua_ai, aip);
}
void ai_lua_start(ai_goal* aigp, object* objp){
@@ -98,15 +97,10 @@ void ai_lua_start(ai_goal* aigp, object* objp){
const auto& lua_ai = Lua_ai_modes.at(aigp->ai_submode);
auto dynamicSEXP = sexp::get_dynamic_sexp(aigp->ai_submode);
const auto& lua_ai_sexp = lua_ai.sexp;
const auto& action = lua_ai_sexp.getActionEnter();
if (dynamicSEXP != nullptr && typeid(*dynamicSEXP) == typeid(sexp::LuaAISEXP)) {
auto lua_ai_sexp = static_cast<sexp::LuaAISEXP*>(dynamicSEXP);
const auto& action = lua_ai_sexp->getActionEnter();
run_ai_lua_action(action, lua_ai, aip);
}
run_ai_lua_action(action, lua_ai, aip);
}
bool ai_lua_is_valid_target_intrinsic(int sexp_op, int target_objnum, ship* self) {
@@ -139,36 +133,32 @@ bool ai_lua_is_valid_target_intrinsic(int sexp_op, int target_objnum, ship* self
return false;
}
bool ai_lua_is_valid_target_lua(const ai_mode_lua& mode, int sexp_op, int target_objnum, ship* self) {
auto dynamicSEXP = sexp::get_dynamic_sexp(sexp_op);
bool ai_lua_is_valid_target_lua(const ai_mode_lua& mode, int target_objnum, ship* self) {
if (dynamicSEXP != nullptr && typeid(*dynamicSEXP) == typeid(sexp::LuaAISEXP)) {
auto lua_ai_sexp = static_cast<sexp::LuaAISEXP*>(dynamicSEXP);
const auto& action = lua_ai_sexp->getTargetRestrict();
const auto& action = mode.sexp.getTargetRestrict();
if (!action.isValid())
return true;
if (!action.isValid())
return true;
luacpp::LuaValueList luaParameters;
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_Ship.Set(object_h(&Objects[self->objnum]))));
if (mode.needsTarget) {
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(object_ship_wing_point_team(&Ships[Objects[target_objnum].instance]))));
}
luacpp::LuaValueList luaParameters;
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_Ship.Set(object_h(&Objects[self->objnum]))));
if (mode.needsTarget) {
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(object_ship_wing_point_team(&Ships[Objects[target_objnum].instance]))));
}
auto retVals = action.call(Script_system.GetLuaSession(), luaParameters);
auto retVals = action.call(Script_system.GetLuaSession(), luaParameters);
if (!retVals.empty() && retVals[0].getValueType() == luacpp::ValueType::BOOLEAN) {
return retVals[0].getValue<bool>();
}
else {
Error(LOCATION, "LuaAI target restriction function did not return a valid boolean!");
}
if (!retVals.empty() && retVals[0].getValueType() == luacpp::ValueType::BOOLEAN) {
return retVals[0].getValue<bool>();
}
else {
Error(LOCATION, "LuaAI target restriction function did not return a valid boolean!");
}
return true;
}
bool ai_lua_is_valid_target(int sexp_op, int target_objnum, ship* self) {
bool ai_lua_is_valid_target(int sexp_op, int target_objnum, ship* self, size_t order) {
const ai_mode_lua& mode = *ai_lua_find_mode(sexp_op);
//All targetless AI modes are fine
@@ -184,56 +174,78 @@ bool ai_lua_is_valid_target(int sexp_op, int target_objnum, ship* self) {
if (!ai_lua_is_valid_target_intrinsic(sexp_op, target_objnum, self))
return false;
// check if this order can be issued against the target
ship *shipp = &Ships[Objects[target_objnum].instance];
if (shipp->orders_allowed_against.find(order) == shipp->orders_allowed_against.end()) {
return false;
}
}
//If we haven't bailed yet, query the custom callback
return ai_lua_is_valid_target_lua(mode, sexp_op, target_objnum, self);
return ai_lua_is_valid_target_lua(mode, target_objnum, self);
}
bool ai_lua_is_valid_ship(int sexp_op, bool isWing, ship* self)
{
const player_order_lua& order = *ai_lua_find_player_order(sexp_op);
switch (order.shipRestrictions) {
case player_order_lua::ship_restrictions::ANY:
return true;
case player_order_lua::ship_restrictions::WING:
return isWing;
case player_order_lua::ship_restrictions::IN_PLAYER_WING:
return self->wingnum != -1 && Ships[Player_obj->instance].wingnum == self->wingnum;
case player_order_lua::ship_restrictions::PLAYER_WING:
return isWing && self->wingnum != -1 && Ships[Player_obj->instance].wingnum == self->wingnum;
}
return false;
}
ai_achievability ai_lua_is_achievable(const ai_goal* aigp, int objnum){
const auto& lua_ai = Lua_ai_modes.at(aigp->ai_submode);
auto dynamicSEXP = sexp::get_dynamic_sexp(aigp->ai_submode);
const auto& action = lua_ai.sexp.getAchievable();
if (dynamicSEXP != nullptr && typeid(*dynamicSEXP) == typeid(sexp::LuaAISEXP)) {
auto lua_ai_sexp = static_cast<sexp::LuaAISEXP*>(dynamicSEXP);
const auto& action = lua_ai_sexp->getAchievable();
if (!action.isValid())
return ai_achievability::ACHIEVABLE;
if (!action.isValid())
luacpp::LuaValueList luaParameters;
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_Ship.Set(object_h(&Objects[objnum]))));
if (lua_ai.needsTarget) {
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(aigp->lua_ai_target.target)));
}
for (const auto& additionalParam : aigp->lua_ai_target.arguments) {
luaParameters.push_back(additionalParam);
}
auto retVals = action.call(Script_system.GetLuaSession(), luaParameters);
if (!retVals.empty() && retVals[0].getValueType() == luacpp::ValueType::USERDATA) {
scripting::api::enum_h enumData;
retVals[0].getValue(scripting::api::l_Enum.Get(&enumData));
if (!enumData.IsValid()) {
Error(LOCATION, "LuaAI SEXP achievability hook returned an invalid avilability enum.");
return ai_achievability::ACHIEVABLE;
luacpp::LuaValueList luaParameters;
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_Ship.Set(object_h(&Objects[objnum]))));
if (lua_ai.needsTarget) {
luaParameters.push_back(luacpp::LuaValue::createValue(action.getLuaState(), scripting::api::l_OSWPT.Set(aigp->lua_ai_target)));
}
auto retVals = action.call(Script_system.GetLuaSession(), luaParameters);
if (!retVals.empty() && retVals[0].getValueType() == luacpp::ValueType::USERDATA) {
scripting::api::enum_h enumData;
retVals[0].getValue(scripting::api::l_Enum.Get(&enumData));
if (!enumData.IsValid()) {
Error(LOCATION, "LuaAI SEXP achievability hook returned an invalid avilability enum.");
return ai_achievability::ACHIEVABLE;
}
switch (enumData.index) {
case scripting::api::LE_LUAAI_ACHIEVABLE:
return ai_achievability::ACHIEVABLE;
case scripting::api::LE_LUAAI_NOT_YET_ACHIEVABLE:
return ai_achievability::NOT_KNOWN;
case scripting::api::LE_LUAAI_UNACHIEVABLE:
return ai_achievability::NOT_ACHIEVABLE;
default:
Error(LOCATION, "LuaAI SEXP achievability hook returned an invalid avilability enum.");
return ai_achievability::ACHIEVABLE;
}
}
else {
Error(LOCATION, "LuaAI SEXP achievability hook did not return any avilability enum!");
switch (enumData.index) {
case scripting::api::LE_LUAAI_ACHIEVABLE:
return ai_achievability::ACHIEVABLE;
case scripting::api::LE_LUAAI_NOT_YET_ACHIEVABLE:
return ai_achievability::NOT_KNOWN;
case scripting::api::LE_LUAAI_UNACHIEVABLE:
return ai_achievability::NOT_ACHIEVABLE;
default:
Error(LOCATION, "LuaAI SEXP achievability hook returned an invalid avilability enum.");
return ai_achievability::ACHIEVABLE;
}
}
else {
Error(LOCATION, "LuaAI SEXP achievability hook did not return any avilability enum!");
}
return ai_achievability::ACHIEVABLE;
}
+8 -1
View File
@@ -4,9 +4,13 @@
#include "ai/aigoals.h"
#include "mission/missionmessage.h"
#include "ship/ship.h"
#include "parse/sexp.h"
#include "globalincs/globals.h"
namespace sexp { class LuaAISEXP; }
struct ai_mode_lua {
const sexp::LuaAISEXP& sexp;
bool needsTarget;
const char* hudText;
};
@@ -16,8 +20,10 @@ struct player_order_lua {
SCP_string parseText = "";
SCP_string displayText = "";
enum class target_restrictions : int { TARGET_ALLIES, TARGET_ALL, TARGET_OWN, TARGET_ENEMIES, TARGET_SAME_WING, TARGET_PLAYER_WING, TARGET_ALL_CAPS, TARGET_ALLIED_CAPS, TARGET_ENEMY_CAPS, TARGET_NOT_SELF } targetRestrictions = target_restrictions::TARGET_ALL;
enum class ship_restrictions : int { ANY, WING, IN_PLAYER_WING, PLAYER_WING } shipRestrictions = ship_restrictions::ANY;
};
void ai_lua_add_mode(int sexp_op, const ai_mode_lua& mode);
bool ai_lua_add_order(int sexp_op, player_order_lua order);
bool ai_lua_has_mode(int sexp_op);
@@ -25,5 +31,6 @@ const ai_mode_lua* ai_lua_find_mode(int sexp_op);
const player_order_lua* ai_lua_find_player_order(int sexp_op);
void ai_lua(ai_info* aip);
void ai_lua_start(ai_goal* aigp, object* objp);
bool ai_lua_is_valid_target(int sexp_op, int target_objnum, ship* self);
bool ai_lua_is_valid_target(int sexp_op, int target_objnum, ship* self, size_t order);
bool ai_lua_is_valid_ship(int sexp_op, bool isWing, ship* self);
ai_achievability ai_lua_is_achievable(const ai_goal* aigp, int objnum);
+142 -48
View File
@@ -14,6 +14,7 @@
#include "network/multi.h"
#include "network/multimsgs.h"
#include "object/objectdock.h"
#include "scripting/global_hooks.h"
#include "scripting/scripting.h"
#include "render/3d.h"
#include "ship/ship.h"
@@ -57,11 +58,19 @@ const char *Turret_target_order_names[NUM_TURRET_ORDER_TYPES] = {
#define EEOF_BIG_ONLY (1<<0) // turret fires only at big and huge ships
#define EEOF_SMALL_ONLY (1<<1) // turret fires only at small ships
#define EEOF_TAGGED_ONLY (1<<2) // turret fires only at tagged ships
#define EEOF_BEAM (1<<3) // turret is a beam
#define EEOF_FLAK (1<<4) // turret is flak
#define EEOF_LASER (1<<5) // turret is a laser
#define EEOF_MISSILE (1<<6) // turret is a missile
const char* Turret_valid_types[NUM_TURRET_TYPES] = {
"Beam",
"Flak",
"Laser",
"Missile",
};
typedef struct eval_enemy_obj_struct {
int turret_parent_objnum; // parent of turret
float weapon_travel_dist; // max targeting range of turret weapon
@@ -765,7 +774,6 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
{
//float weapon_travel_dist;
int weapon_system_ok;
object *objp;
eval_enemy_obj_struct eeo;
ship_weapon *swp = &turret_subsys->weapons;
@@ -862,9 +870,10 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
int n_w_classes = (int)tt->weapon_class.size();
bool found_something;
object *ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list)) {
for (auto ptr: list_range(&obj_used_list)) {
if (ptr->flags[Object::Object_Flags::Should_be_dead])
continue;
found_something = false;
if(tt->obj_type > -1 && (ptr->type == tt->obj_type)) {
@@ -915,15 +924,10 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
if(!(found_something)) {
//we didnt find this object within this priority group
//skip to next without evaluating the object as target
ptr = GET_NEXT(ptr);
continue;
}
evaluate_obj_as_target(ptr, &eeo);
ptr = GET_NEXT(ptr);
}
//homing weapon entry...
@@ -994,8 +998,10 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
{
// Missile_obj_list
for( mo = GET_FIRST(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) {
objp = &Objects[mo->objnum];
auto objp = &Objects[mo->objnum];
if (objp->flags[Object::Object_Flags::Should_be_dead])
continue;
Assert(objp->type == OBJ_WEAPON);
if ((Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Bomb]) || (Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Turret_Interceptable]))
{
@@ -1015,7 +1021,9 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
//Return if a ship is found
// Ship_used_list
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
objp = &Objects[so->objnum];
auto objp = &Objects[so->objnum];
if (objp->flags[Object::Object_Flags::Should_be_dead])
continue;
evaluate_obj_as_target(objp, &eeo);
}
@@ -1043,7 +1051,9 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
if ( !all_turret_weapons_have_flags(swp, tmp_flagset) ) {
// Asteroid_obj_list
for ( ao = GET_FIRST(&Asteroid_obj_list); ao != END_OF_LIST(&Asteroid_obj_list); ao = GET_NEXT(ao) ) {
objp = &Objects[ao->objnum];
auto objp = &Objects[ao->objnum];
if (objp->flags[Object::Object_Flags::Should_be_dead])
continue;
evaluate_obj_as_target(objp, &eeo);
}
@@ -1319,7 +1329,7 @@ int aifft_rotate_turret(object *objp, ship *shipp, ship_subsys *ss, object *lep,
if (ss->turret_enemy_objnum != -1) {
model_subsystem *tp = ss->system_info;
vec3d gun_pos, gun_vec, target_moving_direction;
vec3d gun_pos, gun_vec, target_vel;
//float weapon_speed;
float weapon_system_strength;
//HACK HACK HACK -WMC
@@ -1357,14 +1367,33 @@ int aifft_rotate_turret(object *objp, ship *shipp, ship_subsys *ss, object *lep,
}
}
target_moving_direction = ss->last_aim_enemy_vel;
target_vel = ss->last_aim_enemy_vel;
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
if (The_mission.ai_profile->flags[AI::Profile_Flags::Use_additive_weapon_velocity]) {
vm_vec_scale_sub2(&target_moving_direction, &objp->phys_info.vel, wip->vel_inherit_amount);
vm_vec_scale_sub2(&target_vel, &objp->phys_info.vel, wip->vel_inherit_amount);
}
set_predicted_enemy_pos_turret(predicted_enemy_pos, &gun_pos, objp, &enemy_point, &target_moving_direction, wip->max_speed, ss->turret_time_enemy_in_range * (weapon_system_strength + 1.0f)/2.0f);
if (tp->flags[Model::Subsystem_Flags::Turret_distant_firepoint] || Always_use_distant_firepoints) {
//The firing point of this turret is so far away from the its center that we should consider this for firing calculations
//This will do the enemy position prediction based on their relative position and speed to the firing point, not the turret center.
vec3d temp;
ship_get_global_turret_gun_info(objp, ss, &gun_pos, &temp, 1, nullptr);
}
if (IS_VEC_NULL(&The_mission.gravity) || wip->gravity_const == 0.0f)
set_predicted_enemy_pos_turret(predicted_enemy_pos, &gun_pos, objp, &enemy_point, &target_vel, wip->max_speed, ss->turret_time_enemy_in_range * (weapon_system_strength + 1.0f)/2.0f);
else {
vec3d shoot_vec;
if (physics_lead_ballistic_trajectory(&gun_pos, &enemy_point, &target_vel, wip->max_speed, &The_mission.gravity, &shoot_vec)) {
*predicted_enemy_pos = gun_pos + shoot_vec * 1000.0f;
} else {
if ((ss->system_info->flags[Model::Subsystem_Flags::Turret_reset_idle]) && (timestamp_elapsed(ss->rotation_timestamp))) {
ret_val = model_rotate_gun(objp, pm, pmi, ss, predicted_enemy_pos, true);
}
return ret_val;
}
}
//Mess with the turret's accuracy if the weapon system is damaged.
if (weapon_system_strength < Weapon_SS_Threshold_Turret_Inaccuracy) {
@@ -1643,11 +1672,21 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
if (wip->wi_flags[Weapon::Info_Flags::Flak]) {
wait *= aip->ai_ship_fire_delay_scale_friendly * 0.5f;
if (aip->ai_class_autoscale)
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
{
if (The_mission.ai_profile->flags[AI::Profile_Flags::Adjusted_AI_class_autoscale])
wait += (ai_get_autoscale_index(Num_ai_classes) - ai_get_autoscale_index(aip->ai_class) - 1) * 40.0f;
else
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
}
} else {
wait *= aip->ai_ship_fire_delay_scale_friendly;
if (aip->ai_class_autoscale)
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
{
if (The_mission.ai_profile->flags[AI::Profile_Flags::Adjusted_AI_class_autoscale])
wait += (ai_get_autoscale_index(Num_ai_classes) - ai_get_autoscale_index(aip->ai_class) - 1) * 100.0f;
else
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
}
}
} else {
// flak guns need to fire more rapidly
@@ -1658,13 +1697,23 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
wait *= aip->ai_ship_fire_delay_scale_hostile * 0.5f;
}
if (aip->ai_class_autoscale)
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
{
if (The_mission.ai_profile->flags[AI::Profile_Flags::Adjusted_AI_class_autoscale])
wait += (ai_get_autoscale_index(Num_ai_classes) - ai_get_autoscale_index(aip->ai_class) - 1) * 40.0f;
else
wait += (Num_ai_classes - aip->ai_class - 1) * 40.0f;
}
} else if (wip->wi_flags[Weapon::Info_Flags::Huge]) {
// make huge weapons fire independently of team
wait *= aip->ai_ship_fire_delay_scale_friendly;
if (aip->ai_class_autoscale)
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
{
if (The_mission.ai_profile->flags[AI::Profile_Flags::Adjusted_AI_class_autoscale])
wait += (ai_get_autoscale_index(Num_ai_classes) - ai_get_autoscale_index(aip->ai_class) - 1) * 100.0f;
else
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
}
} else {
// give team friendly an advantage
if (Ships[aip->shipnum].team == Player_ship->team) {
@@ -1673,7 +1722,12 @@ void turret_set_next_fire_timestamp(int weapon_num, weapon_info *wip, ship_subsy
wait *= aip->ai_ship_fire_delay_scale_hostile;
}
if (aip->ai_class_autoscale)
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
{
if (The_mission.ai_profile->flags[AI::Profile_Flags::Adjusted_AI_class_autoscale])
wait += (ai_get_autoscale_index(Num_ai_classes) - ai_get_autoscale_index(aip->ai_class) - 1) * 100.0f;
else
wait += (Num_ai_classes - aip->ai_class - 1) * 100.0f;
}
}
}
// vary wait time +/- 10%
@@ -1717,7 +1771,7 @@ void turret_update_enemy_in_range(ship_subsys *turret, float seconds)
/**
* Fire a weapon from a turret
*/
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *firing_vec, vec3d *predicted_pos = nullptr, float flak_range_override = 100.0f)
bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum, vec3d *turret_pos, vec3d *firing_vec, vec3d *predicted_pos = nullptr, float flak_range_override = 100.0f, bool play_sound = true)
{
matrix turret_orient;
int weapon_objnum;
@@ -1841,11 +1895,15 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
parent_ship->last_fired_turret = turret;
turret->last_fired_weapon_info_index = turret_weapon_class;
turret->turret_last_fired = _timestamp();
if (Script_system.IsActiveAction(CHA_ONTURRETFIRED)) {
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", nullptr, "Beam", objp, "Target", turret_enemy_objp);
Script_system.RunCondition(CHA_ONTURRETFIRED, &Objects[parent_objnum], objp);
Script_system.RemHookVars({"Ship", "Weapon", "Beam", "Target"});
if (scripting::hooks::OnTurretFired->isActive()) {
scripting::hooks::OnTurretFired->run(scripting::hooks::WeaponUsedConditions{ parent_ship , turret_enemy_objp, SCP_vector<int>{ turret_weapon_class }, true },
scripting::hook_param_list(
scripting::hook_param("Ship", 'o', &Objects[parent_objnum]),
scripting::hook_param("Beam", 'o', objp),
scripting::hook_param("Target", 'o', turret_enemy_objp)
));
}
}
@@ -1980,15 +2038,19 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
parent_ship->last_fired_turret = turret;
turret->last_fired_weapon_info_index = wp->weapon_info_index;
turret->turret_last_fired = _timestamp();
wp->target_num = turret->turret_enemy_objnum;
// AL 1-6-97: Store pointer to turret subsystem
wp->turret_subsys = turret;
if (Script_system.IsActiveAction(CHA_ONTURRETFIRED)) {
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", objp, "Beam", nullptr, "Target", turret_enemy_objp);
Script_system.RunCondition(CHA_ONTURRETFIRED, &Objects[parent_objnum], objp);
Script_system.RemHookVars({"Ship", "Weapon", "Beam", "Target"});
if (scripting::hooks::OnTurretFired->isActive()) {
scripting::hooks::OnTurretFired->run(scripting::hooks::WeaponUsedConditions{ parent_ship , turret_enemy_objp, SCP_vector<int>{ turret_weapon_class }, wip->subtype == WP_LASER },
scripting::hook_param_list(
scripting::hook_param("Ship", 'o', &Objects[parent_objnum]),
scripting::hook_param("Weapon", 'o', objp),
scripting::hook_param("Target", 'o', turret_enemy_objp)
));
}
// if the gun is a flak gun
@@ -2026,7 +2088,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
}
}
if ( wip->launch_snd.isValid() ) {
if ( play_sound && wip->launch_snd.isValid() ) {
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
if ( parent_objnum != OBJ_INDEX(Player_obj) || (turret->flags[Ship::Subsystem_Flags::Play_sound_for_player]) ) {
snd_play_3d( gamesnd_get_game_sound(wip->launch_snd), turret_pos, &View_position );
@@ -2052,7 +2114,8 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
turret->flags.set(Ship::Subsystem_Flags::Has_fired); //set has fired flag for scriptng - nuke
//Fire animation stuff
Ship_info[parent_ship->ship_info_index].animations.start(model_get_instance(parent_ship->model_instance_num), animation::ModelAnimationTriggerType::TurretFired, animation::anim_name_from_subsys(turret->system_info), animation::ModelAnimationDirection::FWD, true);
Ship_info[parent_ship->ship_info_index].animations.get(model_get_instance(parent_ship->model_instance_num), animation::ModelAnimationTriggerType::TurretFired, animation::anim_name_from_subsys(turret->system_info))
.start(animation::ModelAnimationDirection::FWD, true);
return true;
}
@@ -2102,11 +2165,19 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
Ships[Objects[tsi->parent_objnum].instance].last_fired_turret = tsi->turret;
tsi->turret->last_fired_weapon_info_index = tsi->weapon_class;
tsi->turret->turret_last_fired = _timestamp();
if (Script_system.IsActiveAction(CHA_ONTURRETFIRED)) {
Script_system.SetHookObjects(4, "Ship", &Objects[tsi->parent_objnum], "Weapon", &Objects[weapon_objnum], "Beam", nullptr, "Target", &Objects[tsi->turret->turret_enemy_objnum]);
Script_system.RunCondition(CHA_ONTURRETFIRED, &Objects[tsi->parent_objnum], &Objects[weapon_objnum]);
Script_system.RemHookVars({"Ship", "Weapon", "Beam", "Target"});
if (scripting::hooks::OnTurretFired->isActive()) {
scripting::hooks::OnTurretFired->run(scripting::hooks::WeaponUsedConditions{
&Ships[Objects[tsi->parent_objnum].instance],
&Objects[tsi->turret->turret_enemy_objnum],
SCP_vector<int>{ tsi->weapon_class }, Weapon_info[tsi->weapon_class].subtype == WP_LASER
},
scripting::hook_param_list(
scripting::hook_param("Ship", 'o', &Objects[tsi->parent_objnum]),
scripting::hook_param("Weapon", 'o', &Objects[weapon_objnum]),
scripting::hook_param("Target", 'o', &Objects[tsi->turret->turret_enemy_objnum])
));
}
// muzzle flash?
@@ -2234,6 +2305,12 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
// Rotate the turret even if time hasn't elapsed, since it needs to turn to face its target.
int use_angles = aifft_rotate_turret(objp, shipp, ss, lep, &predicted_enemy_pos, &gvec);
// Multiplayer clients are now able to try to track their targets and also reset to their idle positions.
// But everything after this point is turret firing, so we need to bail here.
if (MULTIPLAYER_CLIENT) {
return;
}
if ((tp->flags[Model::Subsystem_Flags::Fire_on_target]) && (ss->points_to_target >= 0.0f))
{
// value probably needs tweaking... could perhaps be made into table option?
@@ -2338,6 +2415,15 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
}
}
// If the barrel of this turret is long, we shouldn't try to fire if the enemy is under the gun.
// Note that this isn't the same thing as min_range, which is unrelated to barrel length.
if (tp->flags[Model::Subsystem_Flags::Turret_distant_firepoint] || Always_use_distant_firepoints) {
vec3d fpoint, fvec;
ship_get_global_turret_gun_info(objp, ss, &fpoint, &fvec, use_angles, &predicted_enemy_pos);
auto barrel_length = vm_vec_dist(&fpoint, &gpos);
if (dist_to_enemy < barrel_length) continue;
}
// Don't try to fire beyond weapon_limit_range (or within min range)
if (dist_to_enemy < weapon_min_range || dist_to_enemy > weapon_firing_range) {
// it's possible another weapon is in range, but if not,
@@ -2526,7 +2612,9 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
bool in_fov = turret_fov_test(ss, &gvec, &v2e);
bool something_was_ok_to_fire = false;
if (in_fov) {
// the only reason predicted_enemy_pos might be zero, while everything else is valid is if
// its a ballistic trajectory with no valid path
if (in_fov && num_valid && predicted_enemy_pos != vmd_zero_vector) {
// Do salvo thing separately - to prevent messing up things
int number_of_firings;
@@ -2540,6 +2628,8 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
number_of_firings = num_valid;
}
auto sound_played = gamesnd_id();
for (int i = 0; i < number_of_firings; ++i)
{
int valid_index;
@@ -2549,6 +2639,13 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
valid_index = i;
auto wip = get_turret_weapon_wip(&ss->weapons, valid_weapons[valid_index]);
bool play_sound = false;
if (sound_played != wip->launch_snd) {
sound_played = wip->launch_snd;
play_sound = true;
}
// Forces the firing turret to retain the firingpoints of their weapons:
// if the turret has multiple banks, the first bank will only fire from the first firepoint,
// the second bank only from the second firepoint, and so on.
@@ -2651,7 +2748,6 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
vm_vec_scale_add(&end, &gpos, &gvec, model_get_radius(model_num));
mc_info hull_check;
mc_info_init(&hull_check);
hull_check.model_instance_num = shipp->model_instance_num;
hull_check.model_num = model_num;
hull_check.orient = &objp->orient;
@@ -2669,15 +2765,13 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
{
// starting animation checks
if (ss->turret_animation_position == MA_POS_NOT_SET) {
bool started = false;
//For legacy animations using subtype for turret number
started |= Ship_info[shipp->ship_info_index].animations.startAll(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, animation::ModelAnimationDirection::FWD, false, false, false, ss->system_info->subobj_num, true);
auto animList = Ship_info[shipp->ship_info_index].animations.getAll(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, ss->system_info->subobj_num, true);
//For modern animations using proper triggered-by-subsys name
started |= Ship_info[shipp->ship_info_index].animations.start(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, animation::anim_name_from_subsys(ss->system_info), animation::ModelAnimationDirection::FWD);
if (started) {
int duration = Ship_info[shipp->ship_info_index].animations.getTimeAll(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, ss->system_info->subobj_num, true);
int duration2 = Ship_info[shipp->ship_info_index].animations.getTime(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, animation::anim_name_from_subsys(ss->system_info));
ss->turret_animation_done_time = timestamp(duration > duration2 ? duration : duration2);
animList += Ship_info[shipp->ship_info_index].animations.get(model_get_instance(shipp->model_instance_num), animation::ModelAnimationTriggerType::TurretFiring, animation::anim_name_from_subsys(ss->system_info));
if (animList.start(animation::ModelAnimationDirection::FWD)) {
ss->turret_animation_done_time = timestamp(animList.getTime());
ss->turret_animation_position = MA_POS_SET;
}
}
@@ -2706,7 +2800,7 @@ void ai_turret_execute_behavior(ship *shipp, ship_subsys *ss)
flak_jitter_aim(&shoot_vector, dist_to_enemy, ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS), wip);
}
turret_fire_weapon(valid_weapons[valid_index], ss, parent_objnum, &gpos, &shoot_vector, &predicted_enemy_pos);
turret_fire_weapon(valid_weapons[valid_index], ss, parent_objnum, &gpos, &shoot_vector, &predicted_enemy_pos, 100.0f, play_sound);
}
else
{
@@ -2814,7 +2908,7 @@ bool turret_adv_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mo
bool turret_fov_test(ship_subsys *ss, vec3d *gvec, vec3d *v2e, float size_mod)
{
bool in_fov = false;
if (ss->system_info->flags[Model::Subsystem_Flags::Turret_restricted_fov])
if (ss->system_info->turret_base_fov > -1.0f)
in_fov = turret_adv_fov_test(ss, gvec, v2e, size_mod);
else
in_fov = turret_std_fov_test(ss, gvec, v2e, size_mod);
+1 -6
View File
@@ -397,8 +397,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
t1 = timer_get_fixed_seconds();
for ( i = 0; i < frame_diff; i++ ) {
anim_check_for_palette_change(instance);
// if we're playing backwards, every frame must be a keyframe and we set the data ptr here
if(instance->direction == ANIM_DIRECT_REVERSE){
if ( anim_instance_is_streamed(instance) ) {
@@ -643,7 +641,7 @@ void anim_read_header(anim *ptr, CFILE *fp)
if (diff != 0) {
if (ptr->height > 16) {
mprintf(("ANI %s with size %dx%d (%.1f%% wasted)\n", ptr->name, ptr->width, ptr->height, waste));
nprintf(("ANI","ANI %s with size %dx%d (%.1f%% wasted)\n", ptr->name, ptr->width, ptr->height, waste));
}
}
#endif
@@ -790,9 +788,6 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
cfclose(fp);
// store screen signature, so we can tell if palette changes
ptr->screen_sig = gr_screen.signature;
anim_set_palette(ptr);
}
-9
View File
@@ -18,13 +18,6 @@
const int packer_code = PACKER_CODE;
const int transparent_code = 254;
void anim_check_for_palette_change(anim_instance *instance) {
if ( instance->parent->screen_sig != gr_screen.signature ) {
instance->parent->screen_sig = gr_screen.signature;
anim_set_palette(instance->parent);
}
}
anim_instance *init_anim_instance(anim *ptr, int bpp)
{
anim_instance *inst;
@@ -97,8 +90,6 @@ ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap
return NULL;
}
anim_check_for_palette_change(inst);
if ( anim_instance_is_streamed(inst) ) {
if ( xlate_pal ){
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation, aabitmap, bpp);
-2
View File
@@ -58,7 +58,6 @@ typedef struct anim {
ubyte xparent_g; // green component for the transparent color in source image
ubyte xparent_b; // blue component for the transparent color in source image
int flags;
uint screen_sig;
int file_offset; // file offset to start of frame data
int cache_file_offset;
ubyte *cache;
@@ -105,7 +104,6 @@ anim_instance *init_anim_instance(anim *ptr, int bpp);
void free_anim_instance(anim_instance *inst);
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
void anim_set_palette(anim *a);
void anim_check_for_palette_change(anim_instance *inst);
#endif /* __PACKUNPACK_H__ */
+761 -300
View File
File diff suppressed because it is too large. Load diff
+37 -28
View File
@@ -14,34 +14,29 @@
#include "globalincs/globals.h" // for NAME_LENGTH
#include "globalincs/pstypes.h"
#include "io/timer.h"
class object;
class polymodel;
struct collision_info_struct;
class model_draw_list;
#define MAX_ASTEROIDS 512
#define MAX_ASTEROIDS 2000 //Increased from 512 to 2000 in 2022
#define NUM_DEBRIS_SIZES 3
#define NUM_DEBRIS_POFS 3 // Number of POFs per debris size
#define NUM_ASTEROID_SIZES 3
#define NUM_ASTEROID_POFS 3 // Number of POFs per debris size
#define ASTEROID_TYPE_DEBRIS -1
#define ASTEROID_TYPE_SMALL 0
#define ASTEROID_TYPE_MEDIUM 1
#define ASTEROID_TYPE_LARGE 2
// these should always be equal for the benefit of generic asteroids (c.f. asteroid_page_in)
#define MAX_ACTIVE_DEBRIS_TYPES NUM_DEBRIS_SIZES
#define MAX_ACTIVE_DEBRIS_TYPES NUM_ASTEROID_SIZES
// Goober5000 - currently same as MAX_SHIP_DETAIL_LEVELS (put here to avoid an #include)
#define MAX_ASTEROID_DETAIL_LEVELS 5
// whether to do retail behavior, just throw at the first big ship in the field
// must be explicitly opted out of by the mission
extern bool Default_asteroid_throwing_behavior;
extern SCP_vector<SCP_string> Asteroid_target_ships;
// Data structure to track the active asteroids
typedef struct asteroid_obj {
asteroid_obj *next, *prev;
@@ -53,16 +48,18 @@ extern asteroid_obj Asteroid_obj_list;
// Data structure for determining a type and amount of other asteroids an
// asteroid will split to when destroyed.
typedef struct asteroid_split_info {
int asteroid_type;
int min;
int max;
int asteroid_type; //index position
char name[NAME_LENGTH]; //asteroid name
int min; //minimum asteroids to spawn
int max; //maximum asteroids to spawn
} asteroid_split_info;
class asteroid_info
{
public:
char name[NAME_LENGTH]; // name for the asteroid
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
int type; // type of asteroid, 0 = small, 1 = medium, 2 = large, -1 = debris
char pof_files[NUM_ASTEROID_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
int num_detail_levels; // number of detail levels for this ship
int detail_distance[MAX_ASTEROID_DETAIL_LEVELS]; // distance to change detail levels at
float max_speed; // cap on speed for asteroid
@@ -74,27 +71,29 @@ public:
float blast; // maximum blast impulse from area effect explosion
float initial_asteroid_strength; // starting strength of asteroid
SCP_vector< asteroid_split_info > split_info;
polymodel *modelp[NUM_DEBRIS_POFS];
int model_num[NUM_DEBRIS_POFS];
polymodel *modelp[NUM_ASTEROID_POFS];
int model_num[NUM_ASTEROID_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
float gravity_const; // multiplier for mission gravity
asteroid_info( )
: num_detail_levels( 0 ), max_speed( 0 ), damage_type_idx( 0 ),
: type(ASTEROID_TYPE_DEBRIS), num_detail_levels(0), max_speed(0), damage_type_idx(0),
damage_type_idx_sav( -1 ), inner_rad( 0 ), outer_rad( 0 ),
damage( 0 ), blast( 0 ), initial_asteroid_strength( 0 ),
fireball_radius_multiplier( -1 )
fireball_radius_multiplier( -1 ), spawn_weight( 1 ), gravity_const( 0 )
{
name[ 0 ] = 0;
display_name = "";
memset( detail_distance, 0, sizeof( detail_distance ) );
for (int i = 0; i < NUM_DEBRIS_POFS; i++)
for (int i = 0; i < NUM_ASTEROID_POFS; i++)
{
modelp[i] = NULL;
model_num[i] = -1;
pof_files[i][0] = 0;
pof_files[i][0] = '\0';
}
}
};
@@ -108,9 +107,9 @@ typedef struct asteroid {
int model_instance_num;
int asteroid_type; // 0..MAX_DEBRIS_TYPES
int asteroid_subtype; // Index in asteroid_info for modelnum and modelp
int check_for_wrap; // timestamp to check for asteroid wrapping around field
int check_for_collide; // timestamp to check for asteroid colliding with escort ships
int final_death_time; // timestamp to swap in new models after explosion starts
TIMESTAMP check_for_wrap; // timestamp to check for asteroid wrapping around field
TIMESTAMP check_for_collide; // timestamp to check for asteroid colliding with escort ships
TIMESTAMP final_death_time; // timestamp to swap in new models after explosion starts
int collide_objnum; // set to objnum that asteroid will be impacting soon
int collide_objsig; // object signature corresponding to collide_objnum
vec3d death_hit_pos; // hit pos that caused death
@@ -121,7 +120,7 @@ typedef struct asteroid {
// TYPEDEF FOR DEBRIS TYPE
typedef enum {
DG_ASTEROID,
DG_SHIP
DG_DEBRIS
} debris_genre_t;
// TYPEDEF FOR FIELD TYPE
@@ -134,7 +133,7 @@ typedef struct asteroid_field {
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
float bound_rad;
int has_inner_bound;
bool has_inner_bound;
vec3d inner_min_bound;
vec3d inner_max_bound;
vec3d vel; // Average asteroid moves at this velocity.
@@ -144,6 +143,9 @@ typedef struct asteroid_field {
debris_genre_t debris_genre; // type of debris (ship or asteroid) [generic type]
int field_debris_type[MAX_ACTIVE_DEBRIS_TYPES]; // one of the debris type defines above
int num_used_field_debris_types; // how many of the above are used
bool enhanced_visibility_checks; // if true then range checks are overridden for spawning and wrapping asteroids in the field
SCP_vector<SCP_string> target_names; // default retail behavior is to just throw at the first big ship in the field
} asteroid_field;
extern SCP_vector< asteroid_info > Asteroid_info;
@@ -157,21 +159,28 @@ extern vec3d Asteroid_icon_closeup_position; // closeup position for asteroid f
extern float Asteroid_icon_closeup_zoom; // zoom position for asteroid field briefing icon rendering
void asteroid_init();
bool asteroid_is_within_view(vec3d *pos, float range, bool range_override = false);
void asteroid_level_init();
void asteroid_level_close();
void asteroid_create_all();
void asteroid_render(object * obj, model_draw_list *scene);
void asteroid_create_asteroid_field(int num_asteroids, int field_type, int asteroid_speed, bool brown, bool blue, bool orange, vec3d o_min, vec3d o_max, bool inner_box, vec3d i_min, vec3d i_max, SCP_vector<SCP_string> targets);
void asteroid_create_debris_field(int num_asteroids, int asteroid_speed, int debris1, int debris2, int debris3, vec3d o_min, vec3d o_max, bool enhanced);
void asteroid_render(object* obj, model_draw_list* scene);
void asteroid_delete( object *asteroid_objp );
void asteroid_process_pre( object *asteroid_objp );
void asteroid_process_post( object *asteroid_objp);
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL, vec3d* hitnormal=NULL );
void asteroid_hit( object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage );
void asteroid_hit( object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage, vec3d* force );
int asteroid_count();
int asteroid_collide_objnum(object *asteroid_objp);
float asteroid_time_to_impact(object *asteroid_objp);
void asteroid_show_brackets();
void asteroid_target_closest_danger();
void asteroid_add_target(object* objp);
int get_asteroid_index(const char* asteroid_name);
// need to extern for keycontrol debug commands
object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroid_subtype, bool check_visibility = false);
// need to extern for multiplayer
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec);
+56 -48
View File
@@ -47,10 +47,9 @@ NavMessage NavMsgs[NP_NUM_MESSAGES];
int audio_handle;
int NavLinkDistance;
// time offsets for autonav events
int LockAPConv;
int EndAPCinematic;
int MoveCamera;
int camMovingTime;
TIMESTAMP LockAPConv;
TIMESTAMP EndAPCinematic;
TIMESTAMP MoveCamera;
//float CameraSpeed;
bool CinematicStarted, CameraMoving;
vec3d cameraPos, cameraTarget;
@@ -151,6 +150,9 @@ bool CanAutopilot(const vec3d *targetPos, bool send_msg)
for (ship_obj *so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so))
{
object *other_objp = &Objects[so->objnum];
if (other_objp->flags[Object::Object_Flags::Should_be_dead])
continue;
// attacks player?
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags[Ship::Info_Flags::Cargo])) // ignore cargo
@@ -206,8 +208,9 @@ bool StartAutopilot()
{
// Check for support ship and dismiss it if it is not doing anything.
// If the support ship is doing something then tell the user such.
for ( object *objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) )
for (auto so: list_range(&Ship_obj_list))
{
auto objp = &Objects[so->objnum];
if ((objp->type == OBJ_SHIP) && !(objp->flags[Object::Object_Flags::Should_be_dead]))
{
Assertion((objp->instance >= 0) && (objp->instance < MAX_SHIPS),
@@ -262,9 +265,9 @@ bool StartAutopilot()
}
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
LockAPConv = timestamp(); // lock convergence instantly
LockAPConv = _timestamp(); // lock convergence instantly
else
LockAPConv = timestamp(3000); // 3 seconds before we lock convergence
LockAPConv = _timestamp(3 * MILLISECONDS_PER_SECOND); // 3 seconds before we lock convergence
Player_use_ai = 1;
set_time_compression(1);
lock_time_compression(true);
@@ -402,7 +405,7 @@ bool StartAutopilot()
&& Autopilot_flight_leader != &Objects[Ships[i].objnum]) //only if not flight leader's object
{
ai_info *aip = &Ai_info[Ships[i].ai_index];
int wingnum = aip->wing, wing_index = get_wing_index(&Objects[Ships[i].objnum], wingnum);
int wingnum = Ships[i].wingnum, wing_index = get_wing_index(&Objects[Ships[i].objnum], wingnum);
vec3d goal_point;
object *leader_objp = get_wing_leader(wingnum);
@@ -828,9 +831,8 @@ bool StartAutopilot()
//CameraMoving = false;
EndAPCinematic = timestamp((10000*tc_factor)+NPS_TICKRATE); // 10 objective seconds before end of cinematic
MoveCamera = timestamp((5500*tc_factor)+NPS_TICKRATE);
camMovingTime = int(4.5*float(tc_factor));
EndAPCinematic = _timestamp((10 * MILLISECONDS_PER_SECOND * tc_factor) + NPS_TICKRATE); // 10 objective seconds before end of cinematic
MoveCamera = _timestamp(fl2i(5.5 * MILLISECONDS_PER_SECOND * tc_factor) + NPS_TICKRATE);
set_time_compression((float)tc_factor);
}
@@ -923,10 +925,7 @@ void EndAutoPilot()
if ( ((aigp->target_name != NULL) && !stricmp(aigp->target_name, goal_name))
&& (aigp->ai_mode == goal) )
{
aigp->ai_mode = AI_GOAL_NONE;
aigp->signature = -1;
aigp->priority = -1;
aigp->flags.reset();
ai_goal_reset(aigp);
}
}
}
@@ -947,10 +946,7 @@ void EndAutoPilot()
if ( ((aigp->target_name != NULL) && !stricmp(aigp->target_name, goal_name))
&& (aigp->ai_mode == goal) )
{
aigp->ai_mode = AI_GOAL_NONE;
aigp->signature = -1;
aigp->priority = -1;
aigp->flags.reset();
ai_goal_reset(aigp);
}
}
}
@@ -1015,7 +1011,7 @@ void nav_warp(bool prewarp=false)
vm_vec_scale(&velocity, (float)Ai_info[Ships[Autopilot_flight_leader->instance].ai_index].waypoint_speed_cap);
// Find all ships that are supposed to autopilot with the player and move them
// to the cinimatic location or the final destination
// to the cinematic location or the final destination
for (int i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1
@@ -1024,11 +1020,12 @@ void nav_warp(bool prewarp=false)
{
vm_vec_add(&Objects[Ships[i].objnum].pos, &Objects[Ships[i].objnum].pos, &targetPos);
Objects[Ships[i].objnum].phys_info.vel = velocity;
// retime collision pairs
if (Objects[Ships[i].objnum].flags[Object::Object_Flags::Collides])
obj_collide_obj_cache_stale(&Objects[Ships[i].objnum]);
}
}
// retime all collision pairs
obj_collide_retime_cached_pairs();
}
// ********************************************************************************************
@@ -1053,15 +1050,13 @@ void NavSystem_Do()
if(cam != NULL)
cam->set_rotation_facing(&Player_obj->pos);
if (timestamp() >= MoveCamera && !CameraMoving && vm_vec_mag(&cameraTarget) > 0.0f)
if (timestamp_elapsed(MoveCamera) && !CameraMoving && vm_vec_mag(&cameraTarget) > 0.0f)
{
//Free_camera->set_position(&cameraTarget, float(camMovingTime), float(camMovingTime)/2.0f);
//Free_camera->set_translation_velocity(&cameraTarget);
CameraMoving = true;
}
if (timestamp() >= EndAPCinematic || !CanAutopilot())
if (timestamp_elapsed(EndAPCinematic) || !CanAutopilot())
{
nav_warp();
EndAutoPilot();
@@ -1189,6 +1184,10 @@ void send_autopilot_msgID(int msgid)
if (msgid < 0 || msgid >= NP_NUM_MESSAGES)
return;
// bail out if message is not set
if (NavMsgs[msgid].message[0] == '\0')
return;
send_autopilot_msg(NavMsgs[msgid].message, NavMsgs[msgid].filename);
}
// ********************************************************************************************
@@ -1218,7 +1217,7 @@ void send_autopilot_msg(const char *msg, const char *snd)
}
if (msg[0] != '\0' && strcmp(msg, "none") != 0)
message_training_queue("autopilot builtin message", timestamp(0), 5); // display message for five seconds
message_training_queue("autopilot builtin message", TIMESTAMP::immediate(), 5); // display message for five seconds
}
// ********************************************************************************************
@@ -1228,6 +1227,15 @@ void NavSystem_Init()
for (int i = 0; i < MAX_NAVPOINTS; i++)
Navs[i].clear();
//Initialize all these as empty strings so we can detect and bail out later -Mjn
for (int i = 0; i < NP_NUM_MESSAGES; i++)
NavMsgs[i].message[0] = '\0';
//Set defaults here before parsing
NavLinkDistance = 1000;
AutopilotMinEnemyDistance = 5000;
AutopilotMinAsteroidDistance = 1000;
LockWeaponsDuringAutopilot = false;
AutoPilotEngaged = false;
CurrentNav = -1;
audio_handle = -1;
@@ -1235,10 +1243,9 @@ void NavSystem_Init()
UseCutsceneBars = true;
// defaults... can be tabled or bound to mission later
if (cf_exists_full("autopilot.tbl", CF_TYPE_TABLES))
parse_autopilot_table("autopilot.tbl");
else
parse_autopilot_table(NULL);
parse_autopilot_table("autopilot.tbl");
parse_modular_table("*-aplt.tbm", parse_autopilot_table);
}
// ********************************************************************************************
@@ -1249,10 +1256,16 @@ void parse_autopilot_table(const char *filename)
try
{
if (filename == NULL)
read_file_text_from_default(defaults_get_file("autopilot.tbl"));
else
if (!Parsing_modular_table) {
// if table doesn't exist, use the default table
if (cf_exists_full(filename, CF_TYPE_TABLES))
read_file_text(filename, CF_TYPE_TABLES);
else
read_file_text_from_default(defaults_get_file("autopilot.tbl"));
} else {
read_file_text(filename, CF_TYPE_TABLES);
}
reset_parse();
@@ -1260,23 +1273,17 @@ void parse_autopilot_table(const char *filename)
required_string("#Autopilot");
// autopilot link distance
required_string("$Link Distance:");
stuff_int(&NavLinkDistance);
if (optional_string("$Link Distance:"))
stuff_int(&NavLinkDistance);
if (optional_string("$Interrupt autopilot if enemy within distance:"))
stuff_int(&AutopilotMinEnemyDistance);
else
AutopilotMinEnemyDistance = 5000;
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
stuff_int(&AutopilotMinAsteroidDistance);
else
AutopilotMinAsteroidDistance = 1000;
if (optional_string("$Lock Weapons During Autopilot:"))
stuff_boolean(&LockWeaponsDuringAutopilot);
else
LockWeaponsDuringAutopilot = false;
// optional no cutscene bars
if (optional_string("+No_Cutscene_Bars"))
@@ -1291,13 +1298,14 @@ void parse_autopilot_table(const char *filename)
"$Support Present:", "$Support Working:" };
for (int i = 0; i < NP_NUM_MESSAGES; i++)
{
required_string(msg_tags[i]);
if (optional_string(msg_tags[i])) {
required_string("+Msg:");
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
required_string("+Msg:");
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
required_string("+Snd File:");
stuff_string(NavMsgs[i].filename, F_NAME, 256);
required_string("+Snd File:");
stuff_string(NavMsgs[i].filename, F_NAME, 256);
}
}
+8 -7
View File
@@ -29,16 +29,17 @@
class NavPoint
{
public:
char m_NavName[32];
int flags;
ubyte normal_color[3];
ubyte visited_color[3];
char m_NavName[32] = { 0 };
int flags = 0;
ubyte normal_color[3] = { 0x80, 0x80, 0xFF };
ubyte visited_color[3] = { 0xFF, 0xFF, 0x00 };
const void *target_obj;
int waypoint_num; //only used when flags & NP_WAYPOINT
const void *target_obj = nullptr;
int waypoint_num = -1; //only used when flags & NP_WAYPOINT
const vec3d *GetPosition();
// these assignments should match the initialization
void clear()
{
m_NavName[0] = 0;
@@ -78,7 +79,7 @@ extern bool AutoPilotEngaged;
extern int CurrentNav;
extern NavPoint Navs[MAX_NAVPOINTS];
extern NavMessage NavMsgs[NP_NUM_MESSAGES];
extern int LockAPConv;
extern TIMESTAMP LockAPConv;
extern SCP_map<int,int> autopilot_wings;
// Cycles through the NavPoint List
+1 -1
View File
@@ -100,7 +100,7 @@ void bm_lock_apng( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort fla
void bm_lock_jpg( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags );
void bm_lock_pcx( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags );
void bm_lock_tga( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags );
void bm_lock_user( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags );
void bm_lock_user( int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags, bool convert = true );
const size_t BM_BLOCK_SIZE = 4096;
+105 -14
View File
@@ -53,6 +53,7 @@ MONITOR(SizeBitmapPage)
// --------------------------------------------------------------------------------------------------------------------
// Definition of public variables (declared as extern in bmpman.h).
int ENVMAP = -1;
int IRRMAP = -1;
size_t bm_texture_ram = 0;
int Bm_paging = 0;
@@ -584,6 +585,59 @@ int bm_create(int bpp, int w, int h, void *data, int flags) {
return n;
}
int bm_create_3d(int bpp, int w, int h, int d, void* data) {
Assert((bpp == 16) || (bpp == 24) || (bpp == 32));
Assertion(bm_inited, "bmpman must be initialized before this function can be called!");
int n = find_block_of(1);
// Out of bitmap slots
if (n == -1)
return -1;
// make sure that we have valid data
if (data == nullptr) {
UNREACHABLE("No valid data recieved for 3D Bitmap creation!");
return -1;
}
auto entry = bm_get_entry(n);
memset(entry, 0, sizeof(bitmap_entry));
sprintf_safe(entry->filename, "TMP%dx%dx%d+%d", w, h, d, bpp);
entry->type = BM_TYPE_3D;
entry->comp_type = BM_TYPE_NONE;
entry->bm.w = (short)w;
entry->bm.h = (short)h;
entry->bm.d = (short)d;
entry->bm.rowsize = (short)w;
entry->bm.bpp = (ubyte)bpp;
entry->bm.true_bpp = (ubyte)bpp;
entry->bm.flags = (ubyte)BMP_TEX_XPARENT;
entry->bm.data = 0;
entry->bm.palette = nullptr;
entry->info.user.bpp = (ubyte)bpp;
entry->info.user.data = data;
entry->info.user.flags = (ubyte)BMP_TEX_XPARENT;
entry->signature = Bm_next_signature++;
entry->handle = n;
entry->mem_taken = (w * h * d * (bpp >> 3));
entry->load_count++;
bm_update_memory_used(n, (int)entry->mem_taken);
gr_bm_create(bm_get_slot(n));
return n;
}
void bm_convert_format(bitmap *bmp, ushort flags) {
int idx;
@@ -627,7 +681,7 @@ void bm_free_data(bitmap_slot* bs, bool release)
// Don't free up memory for user defined bitmaps, since
// BmpMan isn't the one in charge of allocating/deallocing them.
if (be->type==BM_TYPE_USER) {
if (be->type == BM_TYPE_USER || be->type == BM_TYPE_3D) {
#ifdef BMPMAN_NDEBUG
if ( be->data_size != 0 )
bm_texture_ram -= be->data_size;
@@ -683,7 +737,7 @@ void bm_free_data_fast(int handle)
// Don't free up memory for user defined bitmaps, since
// BmpMan isn't the one in charge of allocating/deallocing them.
if (be->type == BM_TYPE_USER) {
if (be->type == BM_TYPE_USER || be->type == BM_TYPE_3D) {
#ifdef BMPMAN_NDEBUG
if ( be->data_size != 0 )
bm_texture_ram -= be->data_size;
@@ -891,6 +945,27 @@ int bm_get_info(int handle, int *w, int * h, ushort* flags, int *nframes, int *f
}
}
int bm_get_depth(int handle, int* depth) {
bitmap* bmp;
if (!bm_inited) return -1;
auto entry = bm_get_entry(handle);
Assertion(entry->handle == handle, "Invalid bitmap handle %d passed to bm_get_info().\nThis might be due to an invalid animation somewhere else.\n", handle); // INVALID BITMAP HANDLE!
if (entry->type != BM_TYPE_3D) {
*depth = 0;
return -1;
}
bmp = &(entry->bm);
*depth = bmp->d;
return handle;
}
int bm_get_num_mipmaps(int num) {
auto entry = bm_get_entry(num);
@@ -1406,6 +1481,10 @@ static int bm_load_image_data(int handle, int bpp, ushort flags, bool nodebug)
bm_lock_user(handle, bs, bmp, true_bpp, flags);
break;
case BM_TYPE_3D:
bm_lock_user(handle, bs, bmp, true_bpp, flags, false);
break;
default:
Warning(LOCATION, "Unsupported type in bm_lock -- %d\n", c_type);
return -1;
@@ -1516,10 +1595,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
// MAX_FILENAME_LEN-10 == 5 character frame designator plus '.' plus 3 letter ext plus NULL terminator
// we only check for -5 here since the filename should already have the extension on it, and it must have passed the previous check
if (strlen(filename) > MAX_FILENAME_LEN - 5) {
Warning(LOCATION, "Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n", filename, MAX_FILENAME_LEN - 10);
if (img_cfp != nullptr)
cfclose(img_cfp);
return -1;
// Don't check PNGs yet, because a PNG could be a regular non-animated image
if (type != BM_TYPE_PNG) {
Warning(LOCATION, "Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n", filename, MAX_FILENAME_LEN - 10);
if (img_cfp != nullptr)
cfclose(img_cfp);
return -1;
}
}
// it's an effect file, any readable image type with eff being txt
@@ -1530,7 +1612,7 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
cfclose(img_cfp);
return -1;
} else {
mprintf(("BMPMAN: Found EFF (%s) with %d frames at %d fps.\n", filename, anim_frames, anim_fps));
nprintf(("BmpMan","BMPMAN: Found EFF (%s) with %d frames at %d fps.\n", filename, anim_frames, anim_fps));
}
if (anim_fps == 0) {
Error(LOCATION, "animation (%s) has invalid fps of 0, fix this!", filename);
@@ -1599,10 +1681,18 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
throw e;
}
else {
mprintf(("Failed to load apng: %s\n", e.what()));
nprintf(("apng","Failed to load apng: %s\n", e.what()));
return -1;
}
}
// Now do the same filename length check that was deferred for PNGs above
if (strlen(filename) > MAX_FILENAME_LEN - 5) {
Warning(LOCATION, "Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF/APNG, minus the extension, is %i characters.\n", filename, MAX_FILENAME_LEN - 10);
if (img_cfp != nullptr)
cfclose(img_cfp);
return -1;
}
}
else {
Warning(LOCATION, "Unsupported image type: %i", type);
@@ -1834,7 +1924,7 @@ int bm_load_sub_fast(const char *real_filename, int *handle, int dir_type, bool
}
int bm_load_sub_slow(const char *real_filename, const int num_ext, const char **ext_list, CFILE **img_cfp, int dir_type) {
auto res = cf_find_file_location_ext(real_filename, num_ext, ext_list, dir_type, false);
auto res = cf_find_file_location_ext(real_filename, num_ext, ext_list, dir_type);
// could not be found, or is invalid for some reason
if (!res.found)
@@ -2387,7 +2477,7 @@ void bm_lock_tga(int handle, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags
bm_convert_format(bmp, flags);
}
void bm_lock_user(int /*handle*/, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags) {
void bm_lock_user(int /*handle*/, bitmap_slot *bs, bitmap *bmp, int bpp, ushort flags, bool convert) {
auto be = &bs->entry;
// Unload any existing data
@@ -2427,7 +2517,8 @@ void bm_lock_user(int /*handle*/, bitmap_slot *bs, bitmap *bmp, int bpp, ushort
break;
}
bm_convert_format(bmp, flags);
if (convert)
bm_convert_format(bmp, flags);
}
int bm_make_render_target(int width, int height, int flags) {
@@ -2511,7 +2602,7 @@ void *bm_malloc(int n, size_t size) {
void bm_page_in_aabitmap(int handle, int nframes) {
int i;
if (handle == -1)
if (handle < 0)
return;
Assert(bm_get_entry(handle)->handle == handle);
@@ -2622,7 +2713,7 @@ void bm_page_in_stop() {
}
}
mprintf(("Bmpman: %d/%d bitmap slots in use.\n", total_bitmaps, total_slots));
nprintf(("BmpMan","BMPMAN: %d/%d bitmap slots in use.\n", total_bitmaps, total_slots));
#endif
Bm_paging = 0;
@@ -3130,7 +3221,7 @@ int bm_unload_fast(int handle, int clear_render_targets) {
return -1; // Already been released
}
if (be->type == BM_TYPE_USER) {
if (be->type == BM_TYPE_USER || be->type == BM_TYPE_3D) {
return -1;
}
+28 -2
View File
@@ -79,7 +79,9 @@ enum BM_TYPE
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT5, //!< 32-bit cubemap (compressed cubemap surface)
BM_TYPE_3D //!< 3D in-memory
};
/**
@@ -90,6 +92,7 @@ struct bitmap
{
short w; //!< Width, in number of pixels
short h; //!< Height, in number of pixels
short d; //!< Depth, in number of pixels
short rowsize; //!< What you need to add to go to next row
int bpp; //!< Requested bitdepth of each pixel. ( 7, 8, 15, 16, 24, 32)
int true_bpp; //!< The image's actual bitdepth
@@ -116,6 +119,7 @@ extern const char *bm_ani_ext_list[]; //!< List of extensions for those types
extern const int BM_ANI_NUM_TYPES; //!< Calculated number of bitmap animation types
extern int ENVMAP; //!< References a map that is for environment mapping -Bobboau
extern int IRRMAP; //!< References a filtered envmap for diffuse environment lighting - qazwsxal
/**
* @brief Initilizes the bitmap manager
@@ -216,6 +220,19 @@ int bm_load_duplicate(const char *filename);
*/
int bm_create(int bpp, int w, int h, void *data = NULL, int flags = 0);
/**
* Loads a 3D bitmap which exists somewhere in the RAM.
*
* @param bpp The bitdepth of the bitmap
* @param w The width of the bitmap
* @param h The height of the bitmap
* @param d The depth of the bitmap
* @param[in] data The bitmap's data glob
*
* @note The used RAM cannot be freed until bm_release is called on the created bitmap
*/
int bm_create_3d(int bpp, int w, int h, int d, void* data = nullptr);
/**
* @brief Unloads a bitmap's data, but not the bitmap info
*
@@ -372,6 +389,16 @@ int bm_is_valid(int handle);
*/
int bm_get_info(int handle, int *w = nullptr, int * h = nullptr, ushort* flags = nullptr, int *nframes = nullptr, int *fps = nullptr);
/**
* @brief Gets 3D info on the bitmap indexed by handle.
*
* @param[out] depth If non-null, gets the depth
*
* @returns The handle on success
* @returns -1 on failure
*/
int bm_get_depth(int handle, int* depth);
/**
* @brief Gets the filename of the bitmap indexed by handle
*
@@ -546,7 +573,6 @@ void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, u
*/
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
/**
* @brief Returns the compression type of the bitmap indexed by handle
+6
View File
@@ -831,7 +831,10 @@ void subtitle::do_frame(float frametime)
auto sizing_mode = do_screen_scaling ? GR_RESIZE_FULL : GR_RESIZE_NONE;
if (do_screen_scaling)
{
gr_set_screen_scale(Show_subtitle_screen_adjusted_res[0], Show_subtitle_screen_adjusted_res[1]);
gr_set_clip(0, 0, Show_subtitle_screen_adjusted_res[0], Show_subtitle_screen_adjusted_res[1]);
}
// do the actual drawing ---------------------
@@ -879,7 +882,10 @@ void subtitle::do_frame(float frametime)
// finished the actual drawing ---------------
if (do_screen_scaling)
{
gr_reset_screen_scale();
gr_reset_clip();
}
// restore old font
if (old_fontnum >= 0)
+78 -57
View File
@@ -59,8 +59,6 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_MODELS, "data" DIR_SEPARATOR_STR "models", ".pof", CF_TYPE_DATA },
{ CF_TYPE_TABLES, "data" DIR_SEPARATOR_STR "tables", ".tbl .tbm .lua", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS, "data" DIR_SEPARATOR_STR "sounds", ".wav .ogg", CF_TYPE_DATA },
{ CF_TYPE_SOUNDS_8B22K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "8b22k", ".wav .ogg", CF_TYPE_SOUNDS },
{ CF_TYPE_SOUNDS_16B11K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "16b11k", ".wav .ogg", CF_TYPE_SOUNDS },
{ CF_TYPE_VOICE, "data" DIR_SEPARATOR_STR "voice", "", CF_TYPE_DATA },
{ CF_TYPE_VOICE_BRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "briefing", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_VOICE_CMD_BRIEF, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "command_briefings", ".wav .ogg", CF_TYPE_VOICE },
@@ -70,7 +68,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav .ogg", CF_TYPE_VOICE },
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav .ogg", CF_TYPE_DATA },
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .ogg .mp4 .srt .webm .png",CF_TYPE_DATA },
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff .png .jpg", CF_TYPE_DATA },
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff .png .jpg .rml .rcss", CF_TYPE_DATA },
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf .ttf .otf", CF_TYPE_DATA },
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .png .dds .sdr", CF_TYPE_DATA },
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".pcx .ani .eff .tga .jpg .png .dds", CF_TYPE_DATA },
@@ -79,6 +77,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .png .dds", CF_TYPE_PLAYERS },
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css .json", CF_TYPE_PLAYERS },
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr .json", CF_TYPE_PLAYERS },
{ CF_TYPE_PLAYER_BINDS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "presets", ".json", CF_TYPE_PLAYERS },
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .bx", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .png .jpg .dds .fs2 .txt", CF_TYPE_DATA },
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
@@ -88,10 +87,7 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_INTEL_ANIMS, "data" DIR_SEPARATOR_STR "intelanims", ".pcx .ani .eff .tga .jpg .png .dds", CF_TYPE_DATA },
{ CF_TYPE_SCRIPTS, "data" DIR_SEPARATOR_STR "scripts", ".lua .lc .fnl", CF_TYPE_DATA },
{ CF_TYPE_FICTION, "data" DIR_SEPARATOR_STR "fiction", ".txt", CF_TYPE_DATA },
{ CF_TYPE_FREDDOCS, "data" DIR_SEPARATOR_STR "freddocs", ".html", CF_TYPE_DATA },
{ CF_TYPE_INTERFACE_MARKUP, "data" DIR_SEPARATOR_STR "interface" DIR_SEPARATOR_STR "markup", ".rml", CF_TYPE_INTERFACE },
{ CF_TYPE_INTERFACE_CSS, "data" DIR_SEPARATOR_STR "interface" DIR_SEPARATOR_STR "css", ".rcss", CF_TYPE_INTERFACE },
{ CF_TYPE_PLAYER_BINDS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "presets", ".json", CF_TYPE_PLAYERS },
{ CF_TYPE_FREDDOCS, "data" DIR_SEPARATOR_STR "freddocs", ".html", CF_TYPE_DATA }
};
// clang-format on
@@ -329,7 +325,7 @@ static int _cfile_chdir(const char *new_dir, const char *cur_dir __UNUSED)
*/
int cfile_push_chdir(int type)
{
char dir[CFILE_ROOT_DIRECTORY_LEN];
SCP_string dir;
char OriginalDirectory[CFILE_ROOT_DIRECTORY_LEN];
_getcwd(OriginalDirectory, CFILE_ROOT_DIRECTORY_LEN - 1);
@@ -342,9 +338,9 @@ int cfile_push_chdir(int type)
strcpy_s(Cfile_stack[Cfile_stack_pos++], OriginalDirectory);
cf_create_default_path_string(dir, sizeof(dir) - 1, type, NULL);
cf_create_default_path_string(dir, type, NULL);
return _cfile_chdir(dir, OriginalDirectory);
return _cfile_chdir(dir.c_str(), OriginalDirectory);
}
/**
@@ -469,26 +465,26 @@ char *cf_add_ext(const char *filename, const char *ext)
*/
int cf_delete(const char *filename, int path_type, uint32_t location_flags)
{
char longname[MAX_PATH_LEN];
SCP_string longname;
Assert(CF_TYPE_SPECIFIED(path_type));
cf_create_default_path_string(longname, sizeof(longname) - 1, path_type, filename, false, location_flags);
cf_create_default_path_string(longname, path_type, filename, location_flags);
return (_unlink(longname) != -1);
return (_unlink(longname.c_str()) != -1);
}
// Same as _access function to read a file's access bits
int cf_access(const char *filename, int dir_type, int mode)
{
char longname[MAX_PATH_LEN];
SCP_string longname;
Assert( CF_TYPE_SPECIFIED(dir_type) );
cf_create_default_path_string( longname, sizeof(longname)-1, dir_type, filename );
cf_create_default_path_string(longname, dir_type, filename);
return access(longname,mode);
return access(longname.c_str(), mode);
}
@@ -533,18 +529,18 @@ int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, co
#ifdef _WIN32
void cf_attrib(const char *filename, int set, int clear, int dir_type)
{
char longname[MAX_PATH_LEN];
SCP_string longname;
Assert( CF_TYPE_SPECIFIED(dir_type) );
cf_create_default_path_string( longname, sizeof(longname)-1, dir_type, filename );
cf_create_default_path_string(longname, dir_type, filename);
FILE *fp = fopen(longname, "rb");
FILE *fp = fopen(longname.c_str(), "rb");
if (fp) {
fclose(fp);
DWORD z = GetFileAttributes(longname);
SetFileAttributes(longname, z | (set & ~clear));
DWORD z = GetFileAttributes(longname.c_str());
SetFileAttributes(longname.c_str(), z | (set & ~clear));
}
}
@@ -555,13 +551,13 @@ int cf_rename(const char *old_name, const char *name, int dir_type)
Assert( CF_TYPE_SPECIFIED(dir_type) );
int ret_code;
char old_longname[_MAX_PATH];
char new_longname[_MAX_PATH];
SCP_string old_longname;
SCP_string new_longname;
cf_create_default_path_string( old_longname, sizeof(old_longname)-1, dir_type, old_name );
cf_create_default_path_string( new_longname, sizeof(old_longname)-1, dir_type, name );
cf_create_default_path_string(old_longname, dir_type, old_name);
cf_create_default_path_string(new_longname, dir_type, name);
ret_code = rename(old_longname, new_longname );
ret_code = rename(old_longname.c_str(), new_longname.c_str());
if(ret_code != 0){
switch(errno){
case EACCES :
@@ -605,7 +601,7 @@ void cf_create_directory(int dir_type, uint32_t location_flags)
{
int num_dirs = 0;
int dir_tree[CF_MAX_PATH_TYPES];
char longname[MAX_PATH_LEN];
SCP_string longname;
struct stat statbuf;
Assertion( CF_TYPE_SPECIFIED(dir_type), "Invalid dir_type passed to cf_create_directory." );
@@ -623,10 +619,10 @@ void cf_create_directory(int dir_type, uint32_t location_flags)
int i;
for (i=num_dirs-1; i>=0; i-- ) {
cf_create_default_path_string(longname, sizeof(longname) - 1, dir_tree[i], nullptr, false, location_flags);
if (stat(longname, &statbuf) != 0) {
mprintf(( "CFILE: Creating new directory '%s'\n", longname ));
mkdir_recursive(longname);
cf_create_default_path_string(longname, dir_tree[i], nullptr, location_flags);
if (stat(longname.c_str(), &statbuf) != 0) {
mprintf(( "CFILE: Creating new directory '%s'\n", longname.c_str() ));
mkdir_recursive(longname.c_str());
}
}
}
@@ -648,7 +644,7 @@ void cf_create_directory(int dir_type, uint32_t location_flags)
//
CFILE* _cfopen(const char* source, int line, const char* file_path, const char* mode, int type, int dir_type,
bool localize, uint32_t location_flags)
bool /* localize */, uint32_t location_flags)
{
/* Bobboau, what is this doing here? 31 is way too short... - Goober5000
if( strlen(file_path) > 31 )
@@ -675,13 +671,13 @@ CFILE* _cfopen(const char* source, int line, const char* file_path, const char*
// the harddisk. No fancy packfile stuff here!
if ( strchr(mode,'w') || strchr(mode,'+') || strchr(mode,'a') ) {
char longname[_MAX_PATH];
SCP_string longname;
auto last_separator = strrchr(file_path, DIR_SEPARATOR_CHAR);
// For write-only files, require a full path or a path type
if ( last_separator ) {
// Full path given?
strcpy_s(longname, file_path );
longname = file_path;
} else {
// Path type given?
Assert( dir_type != CF_TYPE_ANY );
@@ -689,7 +685,7 @@ CFILE* _cfopen(const char* source, int line, const char* file_path, const char*
// Create the directory if necessary
cf_create_directory(dir_type, location_flags);
cf_create_default_path_string(longname, sizeof(longname) - 1, dir_type, file_path, false, location_flags);
cf_create_default_path_string(longname, dir_type, file_path, location_flags);
}
Assert( !(type & CFILE_MEMORY_MAPPED) );
@@ -728,7 +724,7 @@ CFILE* _cfopen(const char* source, int line, const char* file_path, const char*
strcpy_s(happy_mode, mode);
}
FILE *fp = fopen(longname, happy_mode);
FILE *fp = fopen(longname.c_str(), happy_mode);
if (fp) {
return cf_open_fill_cfblock(source, line, last_separator ? (last_separator + 1) : file_path, fp, dir_type);
}
@@ -739,10 +735,8 @@ CFILE* _cfopen(const char* source, int line, const char* file_path, const char*
//================================================
// Search for file on disk, on cdrom, or in a packfile
char copy_file_path[MAX_PATH_LEN]; // FIX change in memory from cf_find_file_location
strcpy_s(copy_file_path, file_path);
auto find_res = cf_find_file_location(file_path, dir_type, location_flags);
auto find_res = cf_find_file_location( copy_file_path, dir_type, localize, location_flags );
if ( find_res.found ) {
// Fount it, now create a cfile out of it
@@ -1239,15 +1233,17 @@ void cfread_string(char *buf, int n, CFILE *file)
} while (c != 0 );
}
void cfread_string_len(char *buf,int n, CFILE *file)
void cfread_string_len(char *buf, int buffer_size, CFILE *file)
{
int len;
len = cfread_int(file);
Assertion( (len < n), "len: %i, n: %i", len, n );
if (len)
Assertion( (len <= buffer_size), "String cannot fit in buffer, len: %i, buffer: %i", len, buffer_size);
if (len) {
cfread(buf, len, 1, file);
Assertion(len != buffer_size || buf[len - 1] == 0, "Unterminated string does not fit in buffer");
}
buf[len] = 0;
buf[MIN(len, buffer_size - 1)] = 0;
}
SCP_string cfread_string_len(CFILE *file)
@@ -1846,28 +1842,53 @@ int cfile_get_path_type(const SCP_string& dir)
{
SCP_string buf = dir;
// Remove trailing slashes; avoid buffer overflow on 1-char strings
while (buf.size() > 0 && (buf[buf.size() - 1] == '\\' || buf[buf.size() - 1] == '/')) {
buf.resize(buf.size() - 1);
// remove leading and trailing slashes
if ( !buf.empty() ) {
auto start = buf.find_first_not_of("\\/");
auto end = buf.find_last_not_of("\\/");
if (start == SCP_string::npos) {
buf = "";
} else if ( (start > 0) || (end < buf.length()-1) ) {
buf = buf.substr(start, end-start+1);
}
}
// Remove leading slashes
while (buf.size() > 0 && (buf[0] == '\\' || buf[0] == '/')) {
buf = buf.substr(1);
if (buf.empty()) {
return CF_TYPE_ROOT;
}
// Use official DIR_SEPARATOR_CHAR
for (char& c : buf) {
if (c == '\\' || c == '/') {
c = DIR_SEPARATOR_CHAR;
}
}
extern void normalize_directory_separators(SCP_string &str);
normalize_directory_separators(buf);
// identify path type
auto best_match = CF_TYPE_INVALID;
for (auto& Pathtype : Pathtypes) {
if (Pathtype.path != nullptr && buf == Pathtype.path) {
return Pathtype.index;
if ( !Pathtype.path ) {
continue;
}
// skip root, it should have been detected before getting here
if (Pathtype.index == CF_TYPE_ROOT) {
continue;
}
// don't allow unknown subdirs directly under data
if (Pathtype.index == CF_TYPE_DATA) {
if (buf == Pathtype.path) {
best_match = CF_TYPE_DATA;
}
continue;
}
// for everything else just find closest match, allowing for unknown subdirectories
if ( !strnicmp(buf.c_str(), Pathtype.path, strlen(Pathtype.path)) ) {
best_match = Pathtype.index;
}
}
return CF_TYPE_INVALID;
return best_match;
}
+37 -40
View File
@@ -49,42 +49,38 @@ typedef struct {
#define CF_TYPE_MODELS 5
#define CF_TYPE_TABLES 6
#define CF_TYPE_SOUNDS 7
#define CF_TYPE_SOUNDS_8B22K 8
#define CF_TYPE_SOUNDS_16B11K 9
#define CF_TYPE_VOICE 10
#define CF_TYPE_VOICE_BRIEFINGS 11
#define CF_TYPE_VOICE_CMD_BRIEF 12
#define CF_TYPE_VOICE_DEBRIEFINGS 13
#define CF_TYPE_VOICE_PERSONAS 14
#define CF_TYPE_VOICE_SPECIAL 15
#define CF_TYPE_VOICE_TRAINING 16
#define CF_TYPE_MUSIC 17
#define CF_TYPE_MOVIES 18
#define CF_TYPE_INTERFACE 19
#define CF_TYPE_FONT 20
#define CF_TYPE_EFFECTS 21
#define CF_TYPE_HUD 22
#define CF_TYPE_PLAYERS 23
#define CF_TYPE_PLAYER_IMAGES 24
#define CF_TYPE_SQUAD_IMAGES 25
#define CF_TYPE_SINGLE_PLAYERS 26
#define CF_TYPE_MULTI_PLAYERS 27
#define CF_TYPE_CACHE 28
#define CF_TYPE_MULTI_CACHE 29
#define CF_TYPE_MISSIONS 30
#define CF_TYPE_CONFIG 31
#define CF_TYPE_DEMOS 32
#define CF_TYPE_CBANIMS 33
#define CF_TYPE_INTEL_ANIMS 34
#define CF_TYPE_SCRIPTS 35
#define CF_TYPE_FICTION 36
#define CF_TYPE_FREDDOCS 37
#define CF_TYPE_INTERFACE_MARKUP 38
#define CF_TYPE_INTERFACE_CSS 39
#define CF_TYPE_PLAYER_BINDS 40
#define CF_TYPE_VOICE 8
#define CF_TYPE_VOICE_BRIEFINGS 9
#define CF_TYPE_VOICE_CMD_BRIEF 10
#define CF_TYPE_VOICE_DEBRIEFINGS 11
#define CF_TYPE_VOICE_PERSONAS 12
#define CF_TYPE_VOICE_SPECIAL 13
#define CF_TYPE_VOICE_TRAINING 14
#define CF_TYPE_MUSIC 15
#define CF_TYPE_MOVIES 16
#define CF_TYPE_INTERFACE 17
#define CF_TYPE_FONT 18
#define CF_TYPE_EFFECTS 19
#define CF_TYPE_HUD 20
#define CF_TYPE_PLAYERS 21
#define CF_TYPE_PLAYER_IMAGES 22
#define CF_TYPE_SQUAD_IMAGES 23
#define CF_TYPE_SINGLE_PLAYERS 24
#define CF_TYPE_MULTI_PLAYERS 25
#define CF_TYPE_PLAYER_BINDS 26
#define CF_TYPE_CACHE 27
#define CF_TYPE_MULTI_CACHE 28
#define CF_TYPE_MISSIONS 29
#define CF_TYPE_CONFIG 30
#define CF_TYPE_DEMOS 31
#define CF_TYPE_CBANIMS 32
#define CF_TYPE_INTEL_ANIMS 33
#define CF_TYPE_SCRIPTS 34
#define CF_TYPE_FICTION 35
#define CF_TYPE_FREDDOCS 36
#define CF_MAX_PATH_TYPES \
41 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
37 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
// TRUE if type is specified and valid
#define CF_TYPE_SPECIFIED(path_type) (((path_type)>CF_TYPE_INVALID) && ((path_type)<CF_MAX_PATH_TYPES))
@@ -326,15 +322,17 @@ void cfread_vector(vec3d* vec, CFILE* file, vec3d* deflt = nullptr);
// to n characters.
void cfread_string(char *buf,int n, CFILE *file);
/**
* @brief Read a fixed length string that is not null-terminated, with the length stored in file
* @brief Read a fixed length string that is not null-terminated, with the length stored in file.
*
* If it is not null-terminated, the length of the string *must* be less than the size of the buffer (to make room for one)
*
* @param buf Pre-allocated array to store string
* @param n Size of pre-allocated array
* @param buffer_size Size of pre-allocated array
* @param file File to read from
*
* @note Appends NULL character to string (buf)
*/
void cfread_string_len(char *buf,int n, CFILE *file);
void cfread_string_len(char *buf,int buffer_size, CFILE *file);
/**
* @brief Read a string from the file where the length is stored in the file
@@ -393,7 +391,7 @@ struct CFileLocation {
// size - File size
// offset - Offset into pack file. 0 if not a packfile.
// Returns: If not found returns 0.
CFileLocation cf_find_file_location(const char* filespec, int pathtype, bool localize = false,
CFileLocation cf_find_file_location(const char* filespec, int pathtype,
uint32_t location_flags = CF_LOCATION_ALL);
struct CFileLocationExt : public CFileLocation {
@@ -417,8 +415,7 @@ struct CFileLocationExt : public CFileLocation {
// offset - Offset into pack file. 0 if not a packfile.
// Returns: If not found returns -1, else returns offset into ext_list.
// (NOTE: This function is exponentially slow, so don't use it unless truely needed!!)
CFileLocationExt cf_find_file_location_ext(const char* filename, const int ext_num, const char** ext_list, int pathtype,
bool localize = false);
CFileLocationExt cf_find_file_location_ext(const char* filename, const int ext_num, const char** ext_list, int pathtype);
// Functions to change directories
int cfile_chdir(const char *dir);
+653 -338
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -42,8 +42,8 @@ bool cf_check_location_flags(uint32_t check_flags, uint32_t desired_flags);
// Output: path - Fully qualified pathname.
//Returns 0 if result would be too long (invalid result)
int cf_create_default_path_string(char* path, uint path_max, int pathtype, const char* filename = nullptr,
bool localize = false, uint32_t location_flags = CF_LOCATION_ALL);
int cf_create_default_path_string(SCP_string& path, int pathtype, const char* filename = nullptr, bool localize = false,
uint32_t location_flags = CF_LOCATION_ALL);
int cf_create_default_path_string(SCP_string& path, int pathtype, const char* filename = nullptr,
uint32_t location_flags = CF_LOCATION_ALL);
#endif //_CFILESYSTEM_H
+186
View File
@@ -0,0 +1,186 @@
#include "cheats_table.h"
#include "parse/parselo.h"
void cheat_table_init() {
customCheats.clear();
if (cf_exists_full("cheats.tbl", CF_TYPE_TABLES)) {
parse_cheat_table("cheats.tbl");
}
parse_modular_table("*-cht.tbm", parse_cheat_table);
}
bool CustomCheat::canUseCheat() {
return !requireCheatsEnabled || Cheats_enabled;
}
void CustomCheat::runCheat() {
if (!canUseCheat()) return;
//Only try to send the message if we actually have one to send and are in a mission
if (!cheatMsg.empty() && (Game_mode & GM_IN_MISSION))
HUD_printf("%s", cheatMsg.c_str());
scripting::hooks::OnCheat->run(scripting::hook_param_list(scripting::hook_param("Cheat", 's', cheatCode)));
CheatUsed = cheatCode;
}
void SpawnShipCheat::runCheat() {
CustomCheat::runCheat();
if (canUseCheat() && (Game_mode & GM_IN_MISSION) && Player_obj != nullptr) {
extern void prevent_spawning_collision(object *new_obj);
ship_subsys *ptr;
char name[NAME_LENGTH];
int ship_idx, ship_class;
// if not found, then don't create it :(
ship_class = ship_info_lookup(shipClassName.c_str());
if (ship_class < 0)
return;
vec3d pos = Player_obj->pos;
matrix orient = Player_obj->orient;
pos.xyz.x += frand_range(-700.0f, 700.0f);
pos.xyz.y += frand_range(-700.0f, 700.0f);
pos.xyz.z += frand_range(-700.0f, 700.0f);
int objnum = ship_create(&orient, &pos, ship_class);
if (objnum < 0)
return;
ship *shipp = &Ships[Objects[objnum].instance];
shipp->ship_name[0] = '\0';
shipp->display_name.clear();
for (size_t j = 0; j < Player_orders.size(); j++)
shipp->orders_accepted.insert(j);
// Goober5000 - stolen from support ship creation
// create a name for the ship with a number. look for collisions until one isn't found anymore
ship_idx = 1;
do {
sprintf(name, "%s %d", shipName.c_str(), ship_idx);
if ( (ship_name_lookup(name) == -1) && (ship_find_exited_ship_by_name(name) == -1) )
{
strcpy_s(shipp->ship_name, name);
break;
}
ship_idx++;
} while(1);
shipp->flags.set(Ship::Ship_Flags::Escort);
shipp->escort_priority = 1000 - ship_idx;
// now make sure we're not colliding with anyone
prevent_spawning_collision(&Objects[objnum]);
// Goober5000 - beam free
for (ptr = GET_FIRST(&shipp->subsys_list); ptr != END_OF_LIST(&shipp->subsys_list); ptr = GET_NEXT(ptr))
{
// mark all turrets as beam free
if (ptr->system_info->type == SUBSYSTEM_TURRET)
{
ptr->weapons.flags.set(Ship::Weapon_Flags::Beam_Free);
ptr->turret_next_fire_stamp = timestamp((int)frand_range(50.0f, 4000.0f));
}
}
// Cyborg17 to prevent a nullptr...
ship_set_warp_effects(&Objects[objnum]);
// warpin
shipfx_warpin_start(&Objects[objnum]);
}
}
void parse_cheat_table(const char* filename) {
try {
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
optional_string("#CUSTOM CHEATS");
while (optional_string("$Cheat:")) {
SCP_string code, msg, shipClass, shipName;
bool requireCheats = false;
bool shipSpawn = false;
required_string("+Code:");
stuff_string(code, F_RAW);
//We are limited to the buffer size used for the traditional cheats. We can still use short cheats, though.
if (code.length() > CHEAT_BUFFER_LEN) {
Warning(LOCATION, "Cheat code %s is too long. It will be cut off to maximum length (%i characters).", code.c_str(), CHEAT_BUFFER_LEN);
code = code.substr(0, CHEAT_BUFFER_LEN);
}
if (optional_string("+Message:")) {
stuff_string(msg, F_MESSAGE);
}
if (optional_string("+RequireCheats:")) {
stuff_boolean(&requireCheats);
}
if (optional_string("+SpawnShip:")) {
shipSpawn = true;
required_string("+Name:");
stuff_string(shipName, F_NAME);
required_string("+Class:");
stuff_string(shipClass, F_NAME);
int shipClassInfo = ship_info_lookup(shipClass.c_str());
if (shipClassInfo < 0) {
shipSpawn = false;
Warning(LOCATION, "There is no ship class named '%s'. The '%s' cheat won't summon a ship.", shipClass.c_str(), code.c_str());
}
}
if (shipSpawn) {
std::unique_ptr<CustomCheat> shipCheat(new SpawnShipCheat(code, msg, requireCheats, shipClass, shipName));
if(customCheats.count(code) == 1) {
Warning(LOCATION, "A cheat for code '%s' already exists. It will be replaced.", code.c_str());
customCheats[code] = std::move(shipCheat);
} else {
customCheats.emplace(code, std::move(shipCheat));
}
} else {
std::unique_ptr<CustomCheat> cheat(new CustomCheat(code, msg, requireCheats));
if(customCheats.count(code) == 1) {
Warning(LOCATION, "A cheat for code '%s' already exists. It will be replaced.", code.c_str());
customCheats[code] = std::move(cheat);
} else {
customCheats.emplace(code, std::move(cheat));
}
}
}
required_string("#END");
}
catch (const parse::ParseException& e) {
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
bool checkForCustomCheats(const char* buffer, int buffer_length) {
const char* check_buffer = buffer;
for (int i = 0; i < buffer_length; i++) {
if (*check_buffer == '\0') {
check_buffer++;
}
else {
break;
}
}
// Loop through our map of custom cheats and check if the code is within the buffer.
// We don't just check for equality, as the player may have typed other characters before the cheat.
for (auto &ccheat : customCheats) {
auto found = std::strstr(check_buffer, ccheat.first.c_str());
if (found != nullptr) {
ccheat.second->runCheat();
return true;
}
}
return false;
}
+49
View File
@@ -0,0 +1,49 @@
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "io/key.h"
#include "hud/hudmessage.h"
#include "hud/hudsquadmsg.h"
#include "scripting/global_hooks.h"
#include "scripting/hook_api.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#define CHEAT_BUFFER_LEN 17
class CustomCheat {
public:
SCP_string cheatCode;
SCP_string cheatMsg;
bool requireCheatsEnabled;
CustomCheat(SCP_string cheat_code, SCP_string cheat_msg, bool require_cheats_enabled) :
cheatCode(std::move(cheat_code)),
cheatMsg(std::move(cheat_msg)),
requireCheatsEnabled(require_cheats_enabled) { }
virtual ~CustomCheat() = default;
virtual void runCheat();
bool canUseCheat();
};
class SpawnShipCheat : public CustomCheat {
protected:
SCP_string shipClassName;
SCP_string shipName;
public:
SpawnShipCheat(SCP_string cheat_code, SCP_string cheat_msg, bool require_cheats_enabled, SCP_string class_name, SCP_string ship_name) : CustomCheat(cheat_code, cheat_msg, require_cheats_enabled),
shipClassName(std::move(class_name)),
shipName(std::move(ship_name)) { }
void runCheat() override;
};
static SCP_map<SCP_string, std::unique_ptr<CustomCheat>> customCheats;
void cheat_table_init();
void parse_cheat_table(const char* filename);
bool checkForCustomCheats(const char* converted_buffer, int buffer_length);
+130 -54
View File
@@ -22,6 +22,7 @@
#include "network/multi_log.h"
#include "options/OptionsManager.h"
#include "osapi/osapi.h"
#include "osapi/dialogs.h"
#include "parse/sexp.h"
#include "scripting/scripting.h"
#include "sound/openal.h"
@@ -155,6 +156,7 @@ typedef struct
// Please group them by type, ie graphics, gameplay etc, maximum 20 different types
Flag exe_params[] =
{
//flag launcher text FSO on_flags off_flags category reference URL
{ "-nospec", "Disable specular", true, EASY_DEFAULT | EASY_HI_MEM_OFF, EASY_ALL_ON | EASY_HI_MEM_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nospec", },
{ "-noglow", "Disable glow maps", true, EASY_DEFAULT | EASY_HI_MEM_OFF, EASY_ALL_ON | EASY_HI_MEM_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noglow", },
{ "-noenv", "Disable environment maps", true, EASY_DEFAULT | EASY_HI_MEM_OFF, EASY_ALL_ON | EASY_HI_MEM_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noenv", },
@@ -170,9 +172,12 @@ Flag exe_params[] =
{ "-fb_thrusters", "Enable Framebuffer Thrusters", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_thrusters", },
{ "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT | EASY_HI_MEM_OFF, EASY_ALL_ON | EASY_HI_MEM_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
{ "-enable_shadows", "Enable Shadows", true, EASY_ALL_ON | EASY_HI_MEM_ON, EASY_DEFAULT | EASY_HI_MEM_OFF, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-enable_shadows"},
{ "-deferred_cockpit", "Enable Deferred Lighting for Cockpits", true, EASY_ALL_ON | EASY_HI_MEM_ON, EASY_DEFAULT | EASY_HI_MEM_OFF, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-deferred_cockpit"},
//flag launcher text FSO on_flags off_flags category reference URL
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-fps", "Show frames per second on HUD", false, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps", },
{ "-dualscanlines", "Add another pair of scanning lines", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines", },
{ "-targetinfo", "Enable info next to target", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-targetinfo", },
@@ -180,25 +185,27 @@ Flag exe_params[] =
{ "-rearm_timer", "Enable rearm/repair completion timer", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-rearm_timer", },
{ "-ballistic_gauge", "Enable analog ballistic ammo gauge", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ballistic_gauge", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-window", "Run in window", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-window", },
{ "-fullscreen_window", "Run in fullscreen window", false, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fullscreen_window", },
{ "-stretch_menu", "Stretch interface to fill screen", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stretch_menu", },
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
{ "-nomotiondebris", "Disable motion debris", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
{ "-ship_choice_3d", "Use 3D models for ship selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ship_choice_3d", },
{ "-weapon_choice_3d", "Use 3D models for weapon selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-weapon_choice_3d", },
{ "-3dwarp", "Enable 3D warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
{ "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
{ "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
{ "-no_screenshake", "Disable screen shaking", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_screenshake", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-nosound", "Disable all sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound", },
{ "-nomusic", "Disable music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomusic", },
{ "-no_enhanced_sound", "Disable enhanced sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_enhanced_sound", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-portable_mode", "Store config in portable location", false, 0, EASY_DEFAULT, "Launcher", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-portable_mode", },
{ "-joy_info", "Outputs SDL joystick info", true, 0, EASY_DEFAULT, "Launcher", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-joy_info",},
//flag launcher text FSO on_flags off_flags category reference URL
{ "-standalone", "Run as standalone server", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone", },
{ "-startgame", "Skip mainhall and start hosting", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame", },
{ "-closed", "Start hosted server as closed", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-closed", },
@@ -207,7 +214,9 @@ Flag exe_params[] =
{ "-clientdamage", "", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-clientdamage", },
{ "-mpnoreturn", "Disable flight deck option", true, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mpnoreturn", },
{ "-gateway_ip", "Set gateway IP address", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gateway_ip", },
{ "-ingame_join", "Disable in-game joining", true, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-no_set_gamma", "Disable setting of gamma", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_set_gamma", },
{ "-nomovies", "Disable video playback", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomovies", },
{ "-noparseerrors", "Disable parsing errors", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noparseerrors", },
@@ -226,13 +235,16 @@ Flag exe_params[] =
{ "-prefer_ipv4", "Prefer IPv4 DNS lookups", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv4", },
{ "-prefer_ipv6", "Prefer IPv6 DNS lookups", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-prefer_ipv6", },
{ "-log_multi_packet", "Log multi packet types ", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-log_multi_packet",},
{ "-no_bsp_align", "Disable pof BSP data alignment", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_bsp_align", },
#ifdef WIN32
{ "-fix_registry", "Use a different registry path", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fix_registry", },
#endif
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
//flag launcher text FSO on_flags off_flags category reference URL
{ "-override_data", "Enable override directory", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-override_data", },
{ "-bmpmanusage", "Show how many BMPMAN slots are in use", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-bmpmanusage", },
{ "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
{ "-stats", "Show statistics", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stats", },
@@ -260,6 +272,9 @@ Flag exe_params[] =
{ "-gr_debug", "Output graphics debug information", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gr_debug", },
{ "-stdout_log", "Output log file to stdout", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stdout_log", },
{ "-slow_frames_ok", "Don't adjust timestamps for slow frames", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-slow_frames_ok", },
{ "-imgui_debug", "Show imgui debug/demo window in the lab", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-imgui_debug", },
{ "-luadev", "Make lua errors non-fatal", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-luadev", },
{"-vulkan", "Use vulkan render backend", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-vulkan", },
};
// clang-format on
@@ -316,17 +331,15 @@ int Cmdline_use_last_pilot = 0;
// Graphics related
cmdline_parm fov_arg("-fov", "Vertical field-of-view factor", AT_FLOAT); // Cmdline_fov -- comand line FOV -Bobboau
cmdline_parm fov_cockpit_arg("-fov_cockpit", "Vertical field-of-view factor for Cockpits", AT_FLOAT);
cmdline_parm clip_dist_arg("-clipdist", "Changes the distance from the viewpoint for the near-clipping plane", AT_FLOAT); // Cmdline_clip_dist
cmdline_parm spec_static_arg("-spec_static", "Adjusts suns contribution to specular highlights", AT_FLOAT);
cmdline_parm spec_point_arg("-spec_point", "Adjusts laser weapons contribution to specular highlights", AT_FLOAT);
cmdline_parm spec_tube_arg("-spec_tube", "Adjusts beam weapons contribution to specular highlights", AT_FLOAT);
cmdline_parm ambient_factor_arg("-ambient_factor", "Adjusts ambient light applied to all parts of a ship", AT_INT); // Cmdline_ambient_factor
cmdline_parm ambient_power_arg("-ambient", "Multiplies the brightness of all ambient light", AT_FLOAT);
cmdline_parm light_power_arg("-light", "Multiplies the brightness of all light", AT_FLOAT);
cmdline_parm emissive_power_arg("-emissive", "Multiplies the brightness of all ambient light", AT_FLOAT);
cmdline_parm emissive_arg("-emissive_light", "Enable emissive light from ships", AT_NONE); // semi-deprecated but still functional
cmdline_parm env("-noenv", NULL, AT_NONE); // Cmdline_env
cmdline_parm glow_arg("-noglow", NULL, AT_NONE); // Cmdline_glow -- use Bobs glow code
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL, AT_NONE); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
cmdline_parm noscalevid_arg("-noscalevid", NULL, AT_NONE); // Cmdline_noscalevid -- disable video scaling that fits to window
cmdline_parm spec_arg("-nospec", NULL, AT_NONE); // Cmdline_spec --
cmdline_parm emissive_arg("-emissive_light", "Enable emissive light from ships", AT_NONE); // Cmdline_no_emissive -- don't use emissive light in OGL
cmdline_parm normal_arg("-nonormal", NULL, AT_NONE); // Cmdline_normal -- disable normal mapping
cmdline_parm height_arg("-noheight", NULL, AT_NONE); // Cmdline_height -- enable support for parallax mapping
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL, AT_NONE);
@@ -339,16 +352,19 @@ cmdline_parm deprecated_fxaa_arg("-fxaa", nullptr, AT_NONE);
cmdline_parm deprecated_fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-2), requires post-processing and -fxaa", AT_INT);
cmdline_parm deprecated_smaa_arg("-smaa", nullptr, AT_NONE);
cmdline_parm deprecated_smaa_preset_arg("-smaa_preset", "SMAA quality (0-3), requires post-processing and -smaa", AT_INT);
cmdline_parm msaa_enabled_arg("-msaa", nullptr, AT_INT);
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
cmdline_parm fb_thrusters_arg("-fb_thrusters", NULL, AT_NONE);
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT);
cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE);
cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE); // Cmdline_no_deferred
cmdline_parm deferred_lighting_cockpit_arg("-deferred_cockpit", nullptr, AT_NONE);
cmdline_parm anisotropy_level_arg("-anisotropic_filter", NULL, AT_INT);
float Cmdline_clip_dist = Default_min_draw_distance;
int Cmdline_ambient_factor = 128;
float Cmdline_ambient_power = 1.0f;
float Cmdline_emissive_power = 0.0f;
float Cmdline_light_power = 1.0f;
int Cmdline_env = 1;
int Cmdline_mipmap = 0;
int Cmdline_glow = 1;
@@ -362,7 +378,9 @@ int Cmdline_softparticles = 0;
int Cmdline_bloom_intensity = 25;
bool Cmdline_force_lightshaft_off = false;
int Cmdline_no_deferred_lighting = 0;
bool Cmdline_deferred_lighting_cockpit = false;
int Cmdline_aniso_level = 0;
int Cmdline_msaa_enabled = 0;
// Game Speed related
cmdline_parm no_fpscap("-no_fps_capping", "Don't limit frames-per-second", AT_NONE); // Cmdline_NoFPSCap
@@ -373,21 +391,18 @@ int Cmdline_no_vsync = 0;
// HUD related
cmdline_parm ballistic_gauge("-ballistic_gauge", NULL, AT_NONE); // Cmdline_ballistic_gauge
cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE); // Cmdline_dualscanlines -- Change to phreaks options including new targeting code
cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE); // Cmdline_dualscanlines -- Change to phreaks options including new targeting code; semi-deprecated but still functional
cmdline_parm orb_radar("-orbradar", NULL, AT_NONE); // Cmdline_orb_radar
cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE); // Cmdline_rearm_timer
cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE); // Cmdline_targetinfo -- Adds ship name/class to right of target box -C
cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE); // Cmdline_rearm_timer; semi-deprecated but still functional-Mjn
cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE); // Cmdline_targetinfo -- Adds ship name/class to right of target box -C; semi-deprecated but still functional-Mjn
int Cmdline_ballistic_gauge = 0; // WMCoolmon's gauge thingy
int Cmdline_dualscanlines = 0;
int Cmdline_orb_radar = 0;
int Cmdline_rearm_timer = 0;
int Cmdline_targetinfo = 0;
// Gameplay related
cmdline_parm use_3dwarp("-3dwarp", nullptr, AT_NONE); // Is now Fireball_use_3d_warp
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", nullptr, AT_NONE); // Cmdline_ship_choice_3d
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", nullptr, AT_NONE); // Cmdline_weapon_choice_3d
cmdline_parm use_warp_flash("-warp_flash", nullptr, AT_NONE); // Cmdline_warp_flash
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", nullptr, AT_NONE);
cmdline_parm stretch_menu("-stretch_menu", nullptr, AT_NONE); // Cmdline_stretch_menu
@@ -397,7 +412,6 @@ cmdline_parm deadzone("-deadzone",
int Cmdline_ship_choice_3d = 0;
int Cmdline_weapon_choice_3d = 0;
int Cmdline_warp_flash = 0;
int Cmdline_autopilot_interruptable = 1;
int Cmdline_stretch_menu = 0;
int Cmdline_no_screenshake = 0;
@@ -421,8 +435,8 @@ cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL, AT_NONE); // Cmdline_mpnoreturn
cmdline_parm objupd_arg("-cap_object_update", "Multiplayer object update cap (0-3)", AT_INT);
cmdline_parm gateway_ip_arg("-gateway_ip", "Set gateway IP address", AT_STRING);
char *Cmdline_almission = NULL; //DTP for autoload multi mission.
int Cmdline_ingamejoin = 0;
char *Cmdline_almission = nullptr; //DTP for autoload multi mission.
int Cmdline_ingamejoin = 1;
int Cmdline_mpnoreturn = 0;
int Cmdline_objupd = 3; // client object updates on LAN by default
char *Cmdline_gateway_ip = nullptr;
@@ -430,8 +444,10 @@ char *Cmdline_gateway_ip = nullptr;
// Launcher related options
cmdline_parm portable_mode("-portable_mode", NULL, AT_NONE);
cmdline_parm joy_info("-joy_info", "Outputs SDL joystick info", AT_NONE);
cmdline_parm lang_arg("-language", "Language name as defined in strings.tbl", AT_STRING);
bool Cmdline_portable_mode = false;
SCP_string Cmdline_lang;
// Troubleshooting
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE); // Cmdline_load_all_weapons
@@ -452,6 +468,7 @@ cmdline_parm noshadercache_arg("-noshadercache", NULL, AT_NONE);
cmdline_parm prefer_ipv4_arg("-prefer_ipv4", nullptr, AT_NONE);
cmdline_parm prefer_ipv6_arg("-prefer_ipv6", nullptr, AT_NONE);
cmdline_parm log_multi_packet_arg("-log_multi_packet", nullptr, AT_NONE);
cmdline_parm no_bsp_align_arg("-no_bsp_align", nullptr, AT_NONE);
#ifdef WIN32
cmdline_parm fix_registry("-fix_registry", NULL, AT_NONE);
#endif
@@ -473,9 +490,12 @@ bool Cmdline_noshadercache = false;
bool Cmdline_prefer_ipv4 = false;
bool Cmdline_prefer_ipv6 = false;
bool Cmdline_dump_packet_type = false;
bool Cmdline_no_bsp_align = false;
#ifdef WIN32
bool Cmdline_alternate_registry_path = false;
#endif
uint Cmdline_rng_seed = 0;
bool Cmdline_reuse_rng_seed = false;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
@@ -507,7 +527,11 @@ cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_
cmdline_parm graphics_debug_output_arg("-gr_debug", nullptr, AT_NONE); // Cmdline_graphics_debug_output
cmdline_parm log_to_stdout_arg("-stdout_log", nullptr, AT_NONE); // Cmdline_log_to_stdout
cmdline_parm slow_frames_ok_arg("-slow_frames_ok", nullptr, AT_NONE); // Cmdline_slow_frames_ok
cmdline_parm fixed_seed_rand("-seed", nullptr, AT_INT); // Cmdline_rng_seed,Cmdline_reuse_rng_seed;
cmdline_parm luadev_arg("-luadev", "Make lua errors non-fatal", AT_NONE); // Cmdline_lua_devmode
cmdline_parm override_arg("-override_data", "Enable override directory", AT_NONE); // Cmdline_override_data
cmdline_parm imgui_debug_arg("-imgui_debug", nullptr, AT_NONE);
cmdline_parm vulkan("-vulkan", nullptr, AT_NONE);
char *Cmdline_start_mission = NULL;
int Cmdline_dis_collisions = 0;
@@ -540,6 +564,10 @@ bool Cmdline_debug_window = false;
bool Cmdline_graphics_debug_output = false;
bool Cmdline_log_to_stdout = false;
bool Cmdline_slow_frames_ok = false;
bool Cmdline_lua_devmode = false;
bool Cmdline_override_data = false;
bool Cmdline_show_imgui_debug = false;
bool Cmdline_vulkan = false;
// Other
cmdline_parm get_flags_arg(GET_FLAGS_STRING, "Output the launcher flags file", AT_STRING);
@@ -562,6 +590,12 @@ cmdline_parm deprecated_missile_lighting_arg("-missile_lighting", "Deprecated",
cmdline_parm deprecated_cache_bitmaps_arg("-cache_bitmaps", "Deprecated", AT_NONE);
cmdline_parm deprecated_no_emissive_arg("-no_emissive_light", "Deprecated", AT_NONE);
cmdline_parm deprecated_postprocess_arg("-post_process", "Deprecated", AT_NONE);
cmdline_parm deprecated_spec_static_arg("-spec_static", "Deprecated", AT_NONE);
cmdline_parm deprecated_spec_point_arg("-spec_point", "Deprecated", AT_NONE);
cmdline_parm deprecated_spec_tube_arg("-spec_tube", "Deprecated", AT_NONE);
cmdline_parm deprecated_ambient_factor_arg("-ambient_factor", "Deprecated", AT_NONE); //
cmdline_parm deprecated_ship_choice_3d_arg("-ship_choice_3d", "Deprecated", AT_NONE);
cmdline_parm deprecated_weapon_choice_3d_arg("-weapon_choice_3d", "Deprecated", AT_NONE);
#ifndef NDEBUG
// NOTE: this assumes that os_init() has already been called but isn't a fatal error if it hasn't
@@ -801,7 +835,7 @@ void os_validate_parms(int argc, char *argv[])
// if we got a -help, --help, -h, or -? then show the help text, otherwise show unknown option
if (!stricmp(token, "-help") || !stricmp(token, "--help") || !stricmp(token, "-h") || !stricmp(token, "-?")) {
printf("FreeSpace 2 Open, version %s\n", FS_VERSION_FULL);
printf("Website: http://scp.indiegames.us\n");
printf("Website: https://scp.indiegames.us\n");
printf("Github (bug reporting): https://github.com/scp-fs2open/fs2open.github.com/issues\n\n");
printf("Usage: fs2_open [options]\n");
@@ -1716,7 +1750,7 @@ bool SetCmdlineParams()
if(targetinfo_arg.found())
{
Cmdline_targetinfo = 1;
Extra_target_info = true;
}
if(nomovies_arg.found() ) {
@@ -1809,10 +1843,6 @@ bool SetCmdlineParams()
}
}
if( clip_dist_arg.found() ) {
Min_draw_distance = Cmdline_clip_dist = clip_dist_arg.get_float();
}
if (orb_radar.found())
{
Cmdline_orb_radar = 1;
@@ -1823,7 +1853,7 @@ bool SetCmdlineParams()
}
if ( use_warp_flash.found() ) {
Cmdline_warp_flash = 1;
Fireball_warp_flash = true;
}
if ( allow_autpilot_interrupt.found() ) {
@@ -1841,22 +1871,21 @@ bool SetCmdlineParams()
if ( stretch_menu.found() ) {
Cmdline_stretch_menu = 1;
}
// new lighting lines
if ( ambient_power_arg.found() )
Cmdline_ambient_power = ambient_power_arg.get_float();
// specular comand lines
if ( spec_point_arg.found() ) {
static_point_factor = spec_point_arg.get_float();
if (emissive_power_arg.found() && emissive_power_arg.has_param()) {
Cmdline_emissive_power = emissive_power_arg.get_float();
} else if (emissive_arg.found() || emissive_power_arg.found()) {
// for legacy support no argument param defaults to the old emissive value
Cmdline_emissive_power = 0.30f;
}
if ( spec_static_arg.found() ) {
static_light_factor = spec_static_arg.get_float();
}
if (light_power_arg.found())
Cmdline_light_power = light_power_arg.get_float();
if ( spec_tube_arg.found() ) {
static_tube_factor = spec_tube_arg.get_float();
}
if ( spec_arg.found() )
{
if (spec_arg.found()) {
Cmdline_spec = 0;
}
@@ -1908,25 +1937,31 @@ bool SetCmdlineParams()
}
}
if (msaa_enabled_arg.found()) {
Cmdline_msaa_enabled = msaa_enabled_arg.get_int();
switch (Cmdline_msaa_enabled) {
case 0:
case 4:
case 8:
case 16:
break;
default:
Warning(LOCATION, "Requested illegal MSAA sample count %d. Allowed are: 0, 4, 8, 16. Setting to 0.", Cmdline_msaa_enabled);
Cmdline_msaa_enabled = 0;
break;
}
}
if ( glow_arg.found() )
Cmdline_glow = 0;
if ( ship_choice_3d_arg.found() )
Cmdline_ship_choice_3d = 1;
if ( weapon_choice_3d_arg.found() )
Cmdline_weapon_choice_3d = 1;
if (ingamejoin_arg.found() )
Cmdline_ingamejoin = 1;
Cmdline_ingamejoin = 0;
if ( start_mission_arg.found() ) {
Cmdline_start_mission = start_mission_arg.str();
}
if ( ambient_factor_arg.found() )
Cmdline_ambient_factor = ambient_factor_arg.get_int();
if ( output_scripting_arg.found() )
Output_scripting_meta = true;
@@ -1984,6 +2019,15 @@ bool SetCmdlineParams()
{
Cmdline_portable_mode = true;
}
if (lang_arg.found())
{
Cmdline_lang = lang_arg.str();
}
if (no_bsp_align_arg.found()) {
Cmdline_no_bsp_align = true;
}
#ifdef WIN32
if (fix_registry.found()) {
@@ -2009,10 +2053,6 @@ bool SetCmdlineParams()
Cmdline_no_fbo = 1;
}
if ( emissive_arg.found() ) {
Cmdline_emissive = 1;
}
if ( rearm_timer_arg.found() )
Cmdline_rearm_timer = 1;
@@ -2072,11 +2112,17 @@ bool SetCmdlineParams()
if( enable_shadows_arg.found() )
{
// if only using `enable_shadows` then default quality level can be overriden in mod_settings.tbl --wookieejedi
Shadow_quality_uses_mod_option = true;
Shadow_quality = ShadowQuality::Medium;
}
if( shadow_quality_arg.found() )
{
// set that we are not using default shadow quality level --wookieejedi
Shadow_quality_uses_mod_option = false;
switch (shadow_quality_arg.get_int()) {
case 0:
Shadow_quality = ShadowQuality::Disabled;
@@ -2105,6 +2151,11 @@ bool SetCmdlineParams()
Cmdline_no_deferred_lighting = 1;
}
if( deferred_lighting_cockpit_arg.found() )
{
Cmdline_deferred_lighting_cockpit = true;
}
if (anisotropy_level_arg.found())
{
Cmdline_aniso_level = anisotropy_level_arg.get_int();
@@ -2160,12 +2211,27 @@ bool SetCmdlineParams()
if (slow_frames_ok_arg.found()) {
Cmdline_slow_frames_ok = true;
}
if ( luadev_arg.found()) {
Cmdline_lua_devmode = true;
}
if ( override_arg.found()) {
Cmdline_override_data = true;
}
if (imgui_debug_arg.found()) {
Cmdline_show_imgui_debug = true;
}
if (show_video_info.found())
{
Cmdline_show_video_info = true;
}
if (vulkan.found()) {
Cmdline_vulkan = true;
}
//Deprecated flags - CommanderDJ
if (deprecated_no_emissive_arg.found()) {
Cmdline_emissive = 0;
@@ -2230,6 +2296,16 @@ bool SetCmdlineParams()
Cmdline_dump_packet_type = true;
}
if (fixed_seed_rand.found()) {
Cmdline_rng_seed = abs(fixed_seed_rand.get_int());
if (Cmdline_rng_seed>0) {
Cmdline_reuse_rng_seed = true;
}
else {
Warning(LOCATION,"-seed must be an integer greater than 0. Invalid input seed will be disregarded.");
}
}
return true;
}
+10 -7
View File
@@ -52,11 +52,9 @@ extern char *Cmdline_center_res;
// FSO OPTIONS -------------------------------------------------
// Graphics related
extern float Cmdline_clip_dist;
extern float static_light_factor;
extern float static_point_factor;
extern float static_tube_factor;
extern int Cmdline_ambient_factor;
extern float Cmdline_ambient_power;
extern float Cmdline_emissive_power;
extern float Cmdline_light_power;
extern int Cmdline_env;
extern int Cmdline_glow;
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
@@ -68,8 +66,10 @@ extern int Cmdline_softparticles;
extern int Cmdline_bloom_intensity;
extern bool Cmdline_force_lightshaft_off;
extern int Cmdline_no_deferred_lighting;
extern bool Cmdline_deferred_lighting_cockpit;
extern int Cmdline_emissive;
extern int Cmdline_aniso_level;
extern int Cmdline_msaa_enabled;
// Game Speed related
extern int Cmdline_NoFPSCap;
@@ -80,12 +80,10 @@ extern int Cmdline_ballistic_gauge;
extern int Cmdline_dualscanlines;
extern int Cmdline_orb_radar;
extern int Cmdline_rearm_timer;
extern int Cmdline_targetinfo;
// Gameplay related
extern int Cmdline_ship_choice_3d;
extern int Cmdline_weapon_choice_3d;
extern int Cmdline_warp_flash;
extern int Cmdline_autopilot_interruptable;
extern int Cmdline_stretch_menu;
extern int Cmdline_no_screenshake;
@@ -106,6 +104,7 @@ extern char *Cmdline_gateway_ip;
// Launcher related options
extern bool Cmdline_portable_mode;
extern SCP_string Cmdline_lang;
// Troubleshooting
extern int Cmdline_load_all_weapons;
@@ -155,6 +154,10 @@ extern bool Cmdline_debug_window;
extern bool Cmdline_graphics_debug_output;
extern bool Cmdline_log_to_stdout;
extern bool Cmdline_slow_frames_ok;
extern bool Cmdline_lua_devmode;
extern bool Cmdline_override_data;
extern bool Cmdline_show_imgui_debug;
extern bool Cmdline_vulkan;
enum class WeaponSpewType { NONE = 0, STANDARD, ALL };
extern WeaponSpewType Cmdline_spew_weapon_stats;
+8
View File
@@ -51,6 +51,14 @@ void cmeasure_set_ship_launch_vel(object *objp, object *parent_objp, int arand)
objp->phys_info.max_vel.xyz.z = -25.0f;
vm_vec_copy_scale(&objp->phys_info.desired_vel, &objp->orient.vec.fvec, objp->phys_info.max_vel.xyz.z );
// if this cmeasure has a single segment trail, let the trail know since we just changed the velocity
// yeah this is hacky but that's what this function gets for CHANGING the velocity on objects with a ""CONSTANT VELOCITY""
weapon* wp = &Weapons[objp->instance];
if (wp->trail_ptr && wp->trail_ptr->single_segment) {
wp->trail_ptr->vel[0] = objp->phys_info.vel;
wp->trail_ptr->vel[1] = objp->phys_info.vel;
}
}
/**
File diff suppressed because it is too large. Load diff
+126 -4
View File
@@ -23,6 +23,7 @@
#define CCF_HAT 0x04 //!< btn is a hat
#define CCF_BALL 0x02 //!< btn is a ball
#define CCF_BUTTON 0x01 //!< btn is actually a button
#define CCF_NONE 0x00 //!< No flags. Alias is "NONE"
/*!
* These are used to index a corresponding axis value from an array.
@@ -294,6 +295,8 @@ enum IoActionId : int {
JOY_ABS_THROTTLE_AXIS = 127,
JOY_REL_THROTTLE_AXIS = 128,
TOGGLE_HUD_SHADOWS,
/*!
* This must always be below the last defined item
*/
@@ -430,6 +433,26 @@ private:
short btn = -1; //!< The button, key combo, or axis that's bound.
};
/**
* @struct cc_line
* @brief Defines an interactable line to display control names and their bindings
*/
struct cc_line {
const char* label;
int cc_index; // index into Control_config of item
int y; // Y coordinate of line
int kx, kw, jx, jw; // x start and width of keyboard and joystick bound text
};
/**
* @struct conflict
* @brief Defines an conflict between bindings
*/
struct conflict {
int first = -1; // index of other control in conflict with this one
int second = -1; // index of other control in conflict with this one
};
/*!
* A pair of bindings.
* @note Please don't set the bindings directly, use ::take() instead.
@@ -565,7 +588,9 @@ public:
CC_type type; //!< manner control should be checked in
// Items used during gameplay
int used; //!< has control been used yet in mission? If so, this is the timestamp. For axes, this denotes the last frame's value
TIMESTAMP digital_used; //!< has control been used yet in mission? If so, this is the timestamp.
// Note this is not a UI timestamp because this is purely for mission timing purposes.
int analog_value; // For axes, this denotes the last frame's value
bool disabled = true; //!< whether this action should be available at all
bool locked = false; //!< whether this action will be triggered by the respectively bound key
bool scriptEnabledByDefault = false; //!< whether this binding will execute it's registered hooks if triggered. Resets each mission
@@ -636,6 +661,15 @@ private:
SCP_vector<CCI>& ControlConfig;
};
enum class selItem : int {
selItem_REND, // Must be first to allow cycling
None,
Primary,
Secondary,
selItem_END // Must be last to allow cycling
};
extern int Failed_key_index;
@@ -644,6 +678,9 @@ extern int Joy_sensitivity;
extern int Control_config_overlay_id;
extern SCP_vector<cc_line> Cc_lines; //!< Stores the keyboard details for the UI
extern SCP_vector<conflict> Conflicts; //!< Stores conflict data for the keybinds
extern SCP_vector<CCI> Control_config; //!< Stores the keyboard configuration
extern SCP_vector<CC_preset> Control_config_presets; // tabled control presets; pointers to config_item arrays
extern const char **Joy_button_text; // String table of button labels. XSTR'd on init.
@@ -684,7 +721,7 @@ void control_config_common_close();
/*!
* @brief init config menu
*/
void control_config_init();
void control_config_init(bool API_Access = false);
/*!
* @brief do a frame of the config menu
@@ -694,12 +731,73 @@ void control_config_do_frame(float frametime);
/*!
* @brief close config menu
*/
void control_config_close();
void control_config_close(bool API_Access = false);
/*!
* @brief setup for binding a control
*/
void control_config_do_bind(bool API_Access = false);
/*!
* @brief setup for searching a control
*/
void control_config_do_search(bool API_Access = false);
/**
* @brief Unbinds the selected control
*/
bool control_config_remove_binding(int ctrl, selItem item, bool API_Access = false);
/**
* @brief Clears all conflicting control bindings, except the selected control
*/
bool control_config_clear_other(int ctrl, bool API_Access = false);
/**
* @brief Unbinds ALL controls
* TODO: unbind axes and reset inversion
*/
bool control_config_clear_all(bool API_Access = false);
/**
* @brief Reverts all bindings to their preset. If already default, cycle to the next presets.
*/
bool control_config_do_reset(bool cycle = true, bool API_Access = false);
/**
* @brief Toggles a modifier on or off for a control binding
*/
bool control_config_toggle_modifier(int bit, int ctrl, bool API_Access = false);
/**
* @brief Toggles inversion for the selected axis control
*/
bool control_config_toggle_invert(int ctrl, selItem item, bool API_Access = false);
/*!
* @brief Performs a single undo opration, reverting the most recent change to bindings, if any
*/
void control_config_do_undo(bool API_Access = false);
/*!
*@brief Runs every frame to check for input and binds the input if appropriate
*/
int control_config_bind_key_on_frame(int ctrl, selItem item, bool API_Access = false);
/*!
*@brief Runs every frame to check for input. Returns the index of the item the key is bound to or -1 if nothing.
*/
int control_config_search_key_on_frame(bool API_Access = false);
/*!
* Does a cursory conflict check, then accepts changes to the bindings, if any, and request the menu to close.
*/
bool control_config_accept(bool API_Access = false);
/*!
* @brief Cancel configuration of controls, revert any changes, return to previous menu/game state
*/
void control_config_cancel_exit();
void control_config_cancel_exit(bool API_Access = false);
/*!
* @brief Copies all bindings within preset into Control_config
@@ -730,6 +828,30 @@ bool control_config_use_preset_by_name(const SCP_string &name);
SCP_vector<CC_preset>::iterator control_config_get_current_preset(bool invert_agnostic = false);
/*!
* @brief Deletes the preset
*
* @returns TRUE if successful
* @returns FALSE if the preset is default or currently selected
*/
bool control_config_delete_preset(CC_preset preset);
/*!
* @brief Clones a preset
*
* @returns TRUE if successful
* @returns FALSE if the preset already exists with that name
*/
bool control_config_clone_preset(CC_preset preset, SCP_string name);
/*!
* @brief Saves a preset with the current controls
*
* @returns TRUE if successful
* @returns FALSE if the preset already exists with that name
*/
bool control_config_create_new_preset(SCP_string name);
/*!
* Returns the IoActionId (index within Control_config[]) of a control bound to the given key
*
+48 -9
View File
@@ -258,6 +258,7 @@ void control_config_common_init_bindings() {
// HUD
(TOGGLE_HUD, KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, 1, "Toggle HUD", CC_TYPE_TRIGGER)
(TOGGLE_HUD_CONTRAST, KEY_L, -1, COMPUTER_TAB, 1, "Toggle High HUD Contrast", CC_TYPE_TRIGGER)
(TOGGLE_HUD_SHADOWS, KEY_ALTED | KEY_L, -1, COMPUTER_TAB, 0, "Toggle HUD Drop Shadows", CC_TYPE_TRIGGER)
(HUD_TARGETBOX_TOGGLE_WIREFRAME, KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, 1, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER)
// Custom Controls
@@ -409,6 +410,7 @@ SCP_unordered_map<SCP_string, IoActionId> old_text = {
{"Increase Time Compression", TIME_SPEED_UP},
{"Decrease Time Compression", TIME_SLOW_DOWN},
{"Toggle High HUD Contrast", TOGGLE_HUD_CONTRAST},
{"Toggle HUD Drop Shadows", TOGGLE_HUD_SHADOWS},
{"(Multiplayer) Toggle Network Info", MULTI_TOGGLE_NETINFO},
{"(Multiplayer) Self Destruct", MULTI_SELF_DESTRUCT},
@@ -641,7 +643,9 @@ const char *translate_key(char *key)
if (!first.empty() && !second.empty()) {
strcpy_s(text, first.textify().c_str());
strcat_s(text, " or ");
strcat_s(text, " ");
strcat_s(text, XSTR("or", 1672));
strcat_s(text, " ");
strcat_s(text, second.textify().c_str());
} else if (!first.empty()) {
@@ -651,7 +655,7 @@ const char *translate_key(char *key)
strcpy_s(text, second.textify().c_str());
} else {
strcpy_s(text, "None");
strcpy_s(text, XSTR("None", 1673));
}
return text;
@@ -662,7 +666,7 @@ const char *textify_scancode(int code)
static char text[BTN_MSG_LEN];
if (code < 0)
return "None";
return XSTR("None", 1673);
int keycode = code & KEY_MASK;
@@ -736,7 +740,8 @@ void control_config_common_init()
}
for (int i = 0; i < Action::NUM_VALUES; i++) {
Control_config[i + JOY_AXIS_BEGIN].used = JOY_AXIS_CENTER;
Control_config[i + JOY_AXIS_BEGIN].analog_value = JOY_AXIS_CENTER;
Control_config[i + JOY_AXIS_BEGIN].digital_used = TIMESTAMP::invalid();
}
// TODO It's not memory efficient to keep the presets loaded into memory all the time, but we do need to know which
@@ -794,6 +799,8 @@ void control_config_common_init()
Mouse_button_text[6] = vm_strdup(XSTR("Wheel Down", 1656));
Mouse_button_text[7] = vm_strdup(XSTR("Wheel Left", 1657));
Mouse_button_text[8] = vm_strdup(XSTR("Wheel Right", 1658));
Script_system.OnStateDestroy.add([](lua_State*) -> void { Lua_hooks.clear(); });
}
/*
@@ -1122,6 +1129,7 @@ void LoadEnumsIntoActionMap() {
ADD_ENUM_TO_ACTION_MAP(TIME_SLOW_DOWN)
ADD_ENUM_TO_ACTION_MAP(TOGGLE_HUD_CONTRAST)
ADD_ENUM_TO_ACTION_MAP(TOGGLE_HUD_SHADOWS)
ADD_ENUM_TO_ACTION_MAP(MULTI_TOGGLE_NETINFO)
@@ -1396,7 +1404,8 @@ void control_enable_hook(IoActionId id, bool enable) {
}
/**
* Stuffs the CCF flags into the given char. Needs item_id for validation
* Stuffs the CCF flags into the given char. Needs item_id for validation.
* @details Unknown, unrecognized, or excessive flags are silently ignored on Release builds. Debug builds complain.
*/
void stuff_CCF(char& flags, size_t item_id) {
Assert(item_id < Control_config.size());
@@ -1410,7 +1419,9 @@ void stuff_CCF(char& flags, size_t item_id) {
SCP_string flag_str;
size_t pos = 0;
size_t len = 0;
// Lambda to add flags.
// Debug version Eats the substring as it is found.
auto ADD_FLAG = [&](char id) {
flag_str = ValToCCF(id);
pos = szTempBuffer.find(flag_str);
@@ -1421,6 +1432,8 @@ void stuff_CCF(char& flags, size_t item_id) {
}
};
#else
// Lambda to add flags.
// Release version doesn't modify szTempBuffer as it searches for substrings.
auto ADD_FLAG = [&](char id) {
if (szTempBuffer.find(ValToCCF(id)) != SCP_string::npos)
flags |= id;
@@ -1434,13 +1447,38 @@ void stuff_CCF(char& flags, size_t item_id) {
ADD_FLAG(CCF_HAT);
ADD_FLAG(CCF_BALL);
#ifndef NDEBUG
// Eat the "CCF_NONE" and "NONE" substrings
auto EAT_FLAG = [&](SCP_string str) {
pos = szTempBuffer.find(str);
len = str.length();
if (pos != SCP_string::npos) {
if (flags != 0) {
// Complain about bad habits
error_display(0,
"Flag 'NONE' passed to config item %i along with other flags, ignoring: \n'%s'",
static_cast<int>(item_id),
szTempBuffer.c_str()
);
}
szTempBuffer.erase(pos, len);
}
};
EAT_FLAG("CCF_NONE");
EAT_FLAG("NONE");
// Complain about any unknown flag strings
replace_all(szTempBuffer, ",", " ");
drop_white_space(szTempBuffer);
if (!szTempBuffer.empty()) {
error_display(0, "Unknown flags passed to config item %i, ignoring: \n'%s'", static_cast<int>(item_id), szTempBuffer.c_str());
error_display(0,
"Unknown (or excessive) flags passed to config item %i, ignoring: \n'%s'",
static_cast<int>(item_id),
szTempBuffer.c_str()
);
}
#endif
@@ -2272,7 +2310,7 @@ SCP_string ValToCCF(char id) {
}
if (str.empty()) {
// If unsupported flags, or no flags at all, list as "None"
// If unsupported flags, or (id == CCF_NONE), list as "None"
str = "NONE";
}
@@ -2756,7 +2794,8 @@ CCI& CCI::operator=(const CCI& A) {
indexXSTR = A.indexXSTR;
text = A.text;
type = A.type;
used = A.used;
analog_value = A.analog_value;
digital_used = A.digital_used;
disabled = A.disabled;
locked = A.locked;
scriptEnabledByDefault = A.scriptEnabledByDefault;
+28 -2
View File
@@ -35,7 +35,7 @@ Section lookupSectionValue(const char* name) {
return Section::Invalid;
}
void load_preset_files() {
void load_preset_files(SCP_string clone) {
SCP_vector<SCP_string> filelist;
cf_get_file_list(filelist, CF_TYPE_PLAYER_BINDS, NOX("*.json"), CF_SORT_NAME, nullptr,
CF_LOCATION_ROOT_USER | CF_LOCATION_ROOT_GAME | CF_LOCATION_TYPE_ROOT);
@@ -128,7 +128,8 @@ void load_preset_files() {
// Done with the file
auto it = preset_find_duplicate(preset);
if (it == Control_config_presets.end()) {
// If we just cloned the file, then allow the duplicate. Just this once.
if ((clone == preset.name) || (it == Control_config_presets.end())) {
Control_config_presets.push_back(preset);
} else if ((it->name != preset.name) || (it->type != Preset_t::pst)) {
@@ -147,6 +148,31 @@ bool preset_file_exists(SCP_string name) {
return cf_exists(name.c_str(), CF_TYPE_PLAYER_BINDS) != 0;
}
bool delete_preset_file(CC_preset preset) {
// can't remove the default preset!
if (preset.name == "default") {
return false;
}
auto it = control_config_get_current_preset();
// can't remove the currently loaded preset either!
if (preset.name == it->name) {
return false;
}
SCP_string filename = preset.name + ".json";
cf_delete(filename.c_str(), CF_TYPE_PLAYER_BINDS, CF_LOCATION_ROOT_USER | CF_LOCATION_ROOT_GAME | CF_LOCATION_TYPE_ROOT);
// Reload the presets from file.
Control_config_presets.resize(1);
load_preset_files();
return true;
}
bool save_preset_file(CC_preset preset, bool overwrite) {
// Must have a name
if (preset.name.empty()) {
+13 -1
View File
@@ -209,12 +209,24 @@ private:
*/
bool save_preset_file(CC_preset preset, bool overwrite);
/**
* @brief Deletes the given preset to file.
* @param[in] preset The preset to delete
*
* @returns True if successful, or
* @returns False Preset is default, or
* @returns False Preset file is the currently selected preset
*/
bool delete_preset_file(CC_preset preset);
/**
* @brief Loads in all preset .json files from 'players/presets'
* @details If a preset file is unique, it is loaded into the game and available for use by the player. However, if
* a preset is a duplicate of another preset, it is ignored, and the player is warned of it
*
* @param[in] clone Used to check if we just cloned a particular preset and allows just that clone in without warning
*/
void load_preset_files();
void load_preset_files(SCP_string clone = "");
/**
* @brief Checks if the given preset is a duplicate within Control_config_presets vector
+19 -3
View File
@@ -95,7 +95,7 @@ void VideoPresenter::uploadVideoFrame(const VideoFramePtr& frame) {
}
}
void VideoPresenter::displayFrame(float x1, float y1, float x2, float y2) {
void VideoPresenter::displayFrame(float x1, float y1, float x2, float y2, float alpha) {
GR_DEBUG_SCOPE("Draw video frame");
movie_vertex vertex_data[4];
@@ -127,10 +127,26 @@ void VideoPresenter::displayFrame(float x1, float y1, float x2, float y2) {
layout.add_vertex_component(vertex_format_data::POSITION2, sizeof(vertex_data[0]), offsetof(movie_vertex, pos));
layout.add_vertex_component(vertex_format_data::TEX_COORD2, sizeof(vertex_data[0]), offsetof(movie_vertex, uv));
if (_properties.pixelFormat == FramePixelFormat::YUV420) {
switch (_properties.pixelFormat) {
case FramePixelFormat::YUV420:
material_set_movie(&_movie_material,
_planeTextureHandles[0],
_planeTextureHandles[1],
_planeTextureHandles[2],
alpha);
gr_render_movie(&_movie_material, PRIM_TYPE_TRISTRIP, &layout, 4, gr_immediate_buffer_handle, offset);
} else {
break;
case FramePixelFormat::BGR:
material_set_unlit(&_rgb_material, _planeTextureHandles[0], alpha, false, false);
gr_render_primitives(&_rgb_material, PRIM_TYPE_TRISTRIP, &layout, 0, 4, gr_immediate_buffer_handle, offset);
break;
case FramePixelFormat::BGRA:
material_set_unlit(&_rgb_material, _planeTextureHandles[0], alpha, true, false);
gr_render_primitives(&_rgb_material, PRIM_TYPE_TRISTRIP, &layout, 0, 4, gr_immediate_buffer_handle, offset);
break;
default:
UNREACHABLE("Unhandled enum value!");
break;
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ class VideoPresenter {
void uploadVideoFrame(const VideoFramePtr& frame);
void displayFrame(float x1, float y1, float x2, float y2);
void displayFrame(float x1, float y1, float x2, float y2, float alpha = 1.0f);
};
}
}
+103 -23
View File
@@ -48,38 +48,101 @@ void cutscene_close()
}
}
// initialization stuff for cutscenes
void cutscene_init()
static cutscene_info *get_cutscene_pointer(char *cutscene_filename)
{
atexit(cutscene_close);
for (int i = 0; i < (int)Cutscenes.size(); i++) {
if (!stricmp(cutscene_filename, Cutscenes[i].filename)) {
return &Cutscenes[i];
}
}
// Didn't find anything.
return NULL;
}
static void cutscene_info_init(cutscene_info *csni)
{
csni->filename[0] = '\0';
csni->name[0] = '\0';
csni->description = NULL;
csni->flags = {};
}
// initialization stuff for cutscenes
void parse_cutscene_table(const char* filename)
{
char buf[MULTITEXT_LENGTH];
cutscene_info cutinfo;
cutscene_info csnt;
cutscene_info_init(&csnt);
cutscene_info *csnp;
bool create_if_not_found = true;
try
{
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// parse in all the cutscenes
Cutscenes.clear();
skip_to_string("#Cutscenes");
ignore_white_space();
bool isFirstCutscene = true;
while (required_string_either("#End", "$Filename:"))
{
bool csn_new = false;
required_string("$Filename:");
stuff_string(cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN);
stuff_string(csnt.filename, F_PATHNAME, MAX_FILENAME_LEN);
required_string("$Name:");
stuff_string(cutinfo.name, F_NAME, NAME_LENGTH);
if (optional_string("+nocreate")) {
if (!Parsing_modular_table) {
Warning(LOCATION, "+nocreate flag used for cutscene in non-modular table\n");
}
create_if_not_found = false;
}
required_string("$Description:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
cutinfo.description = vm_strdup(buf);
// Does this cutscene exist already?
// If so, load this new info into it
csnp = get_cutscene_pointer(csnt.filename);
if (csnp != NULL) {
if (!Parsing_modular_table) {
error_display(1,
"Error: Cutscene %s already exists. All cutscene names must be unique.",
csnt.filename);
}
} else {
// Don't create cutscene if it has +nocreate and is in a modular table.
if (!create_if_not_found && Parsing_modular_table) {
if (!skip_to_start_of_string_either("$Filename:", "#End")) {
error_display(1, "Missing [#End] or [$Filename] after cutscene %s", csnt.filename);
}
continue;
}
Cutscenes.push_back(csnt);
csn_new = true;
csnp = &Cutscenes[Cutscenes.size() -1];
}
//If $Name is not found use the $Filename instead because this field needs data
//but only do this if if we're parsing the tbl and not a tbm
if (optional_string("$Name:")) {
stuff_string(csnp->name, F_NAME, NAME_LENGTH);
mprintf(("Adding cutscene %s\n", csnp->name));
} else if (strlen(csnp->name) == 0) {
strcpy_s(csnp->name, csnt.filename);
mprintf(("Missing $Name: in cutscene.tbl. Using filename %s instead.\n", csnt.filename));
}
//If $Description is not found we can leave it blank
if (optional_string("$Description:")) {
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
csnp->description = vm_strdup(buf);
}
if (optional_string("$cd:"))
{
@@ -88,13 +151,14 @@ void cutscene_init()
stuff_int(&junk);
}
cutinfo.flags.reset();
if (csn_new) {
csnp->flags.reset();
}
if (isFirstCutscene)
if (Cutscenes.empty())
{
isFirstCutscene = false;
// The original code assumes the first movie is the intro, so make it viewable
cutinfo.flags.set(Cutscene::Cutscene_Flags::Viewable);
csnp->flags.set(Cutscene::Cutscene_Flags::Viewable);
}
if (optional_string("$Always Viewable:"))
@@ -102,17 +166,19 @@ void cutscene_init()
bool flag;
stuff_boolean(&flag);
if (flag)
cutinfo.flags.set(Cutscene::Cutscene_Flags::Always_viewable);
csnp->flags.set(Cutscene::Cutscene_Flags::Always_viewable);
}
if (optional_string("$Never Viewable:"))
{
bool flag;
stuff_boolean(&flag);
if (flag)
cutinfo.flags.set(Cutscene::Cutscene_Flags::Never_viewable);
csnp->flags.set(Cutscene::Cutscene_Flags::Never_viewable);
}
if (optional_string("$Custom data:")) {
parse_string_map(csnp->custom_data, "$end_custom_data", "+Val:");
}
Cutscenes.push_back(cutinfo);
}
required_string("#End");
@@ -124,6 +190,20 @@ void cutscene_init()
}
}
void cutscene_init()
{
atexit(cutscene_close);
Cutscenes.clear();
// first parse the default table
parse_cutscene_table("cutscenes.tbl");
// parse any modular tables
parse_modular_table("*-csn.tbm", parse_cutscene_table);
}
// marks a cutscene as viewable
void cutscene_mark_viewable(const char* filename)
{
+1
View File
@@ -32,6 +32,7 @@ typedef struct cutscene_info
char name[NAME_LENGTH];
char* description;
flagset<Cutscene::Cutscene_Flags> flags;
SCP_map<SCP_string, SCP_string> custom_data;
} cutscene_info;
extern SCP_vector<cutscene_info> Cutscenes;
+8 -3
View File
@@ -174,10 +174,15 @@ void determine_display_positions(Player* player, PlaybackState* state) {
void initialize_player_state(Player* player, PlaybackState* state) {
determine_display_positions(player, state);
state->subtitle_font = font::FontManager::getFontIndex(Movie_subtitle_font);
if (!Movie_subtitle_font.empty()) {
state->subtitle_font = font::FontManager::getFontIndex(Movie_subtitle_font);
if (state->subtitle_font < 0) {
Warning(LOCATION, "Failed to load subtitle font '%s'! Subtitles will be disabled.", Movie_subtitle_font.c_str());
if (state->subtitle_font < 0) {
Warning(LOCATION, "Failed to load subtitle font '%s'! Subtitles will be disabled.", Movie_subtitle_font.c_str());
}
}
else if (font::FontManager::numberOfFonts() > 0) {
state->subtitle_font = 0; // if not explicitly specified, default to the first available font
}
}
+4 -3
View File
@@ -355,7 +355,8 @@ void Player::stopPlayback() {
audioPlaybackClose(&m_state);
videoPlaybackClose(&m_state);
m_decoderThread->join();
if(m_decoderThread->joinable())
m_decoderThread->join();
}
void Player::decoderThread() {
@@ -385,13 +386,13 @@ const PlayerState& Player::getInternalState() const {
const MovieProperties& Player::getMovieProperties() const {
return m_state.props;
}
void Player::draw(float x1, float y1, float x2, float y2) {
void Player::draw(float x1, float y1, float x2, float y2, float alpha) {
if (!m_state.currentFrame) {
return;
}
if (m_state.videoPresenter) {
m_state.videoPresenter->displayFrame(x1, y1, x2, y2);
m_state.videoPresenter->displayFrame(x1, y1, x2, y2, alpha);
}
}
SCP_string Player::getCurrentSubtitle() {
+1 -1
View File
@@ -110,7 +110,7 @@ class Player {
* @param x2 The X coordinate of the bottom right corner
* @param y2 The Y coordinate of the bottom right corner
*/
void draw(float x1, float y1, float x2, float y2);
void draw(float x1, float y1, float x2, float y2, float alpha = 1.0f);
/**
* @brief Gets the subtitle text that should be displayed now
+244 -152
View File
@@ -25,8 +25,10 @@
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "scripting/global_hooks.h"
#include "scripting/hook_api.h"
#include "scripting/scripting.h"
#include "scripting/api/objs/vecmath.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "species_defs/species_defs.h"
@@ -34,8 +36,8 @@
#include "utils/Random.h"
#include "weapon/weapon.h"
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
#define DEBRIS_SOUND_DELAY 2000 // time to start debris sound after created
constexpr int MIN_RADIUS_FOR_PERSISTENT_DEBRIS = 50; // ship radius at which debris from it becomes persistant
constexpr int DEBRIS_SOUND_DELAY = 2000; // time to start debris sound after created
int Num_hull_pieces; // number of hull pieces in existence
// we now maintain a kind of "virtual" Hull_debris_list,
@@ -54,18 +56,11 @@ int Debris_num_submodels = 0;
#define DEBRIS_INDEX(dp) (int)(dp-Debris.data())
const auto OnDebrisCreatedHook = scripting::Hook::Factory(
"On Debris Created",
"Invoked when a piece of debris is created.",
{
{"Debris", "debris", "The newly created debris object"},
{"Source", "object", "The object (probably a ship) from which this debris piece was spawned."},
});
/**
* Start the sequence of a piece of debris writhing in unholy agony!!!
*/
static void debris_start_death_roll(object *debris_obj, debris *debris_p)
static void debris_start_death_roll(object *debris_obj, debris *debris_p, vec3d *hitpos = nullptr)
{
if (debris_p->is_hull) {
// tell everyone else to blow up the piece of debris
@@ -87,6 +82,15 @@ static void debris_start_death_roll(object *debris_obj, debris *debris_p)
}
}
if (scripting::hooks::OnDebrisDeath->isActive()) {
scripting::hooks::OnDebrisDeath->run(scripting::hook_param_list(
scripting::hook_param("Debris", 'o', debris_obj),
scripting::hook_param("Hitpos",
'o',
scripting::api::l_Vector.Set(hitpos ? *hitpos : vmd_zero_vector),
hitpos != nullptr)));
}
debris_obj->flags.set(Object::Object_Flags::Should_be_dead);
}
@@ -185,7 +189,9 @@ void debris_delete( object * obj )
db = &Debris[num];
model_delete_instance(db->model_instance_num);
if (db->model_instance_num >= 0) {
model_delete_instance(db->model_instance_num);
}
if ( db->is_hull ) {
debris_remove_from_hull_list(db);
@@ -218,7 +224,7 @@ void debris_process_post(object * obj, float frame_time)
if ( timestamp_elapsed(db->sound_delay) ) {
obj_snd_assign(objnum, db->ambient_sound, &vmd_zero_vector);
db->sound_delay = 0;
db->sound_delay = TIMESTAMP::invalid();
}
}
@@ -238,17 +244,17 @@ void debris_process_post(object * obj, float frame_time)
if ( !timestamp_elapsed(db->fire_timeout) && timestamp_elapsed(db->next_fireball)) {
db->next_fireball = timestamp_rand(db->arc_frequency,db->arc_frequency*2 );
db->next_fireball = _timestamp_rand(db->arc_frequency,db->arc_frequency*2 );
db->arc_frequency += 100;
if (db->is_hull) {
int n, n_arcs = Random::next(1, 3); // Create 1-3 sparks
vec3d v1, v2, v3, v4;
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v1, &v2);
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v3, &v4);
vec3d v1 = submodel_get_random_point(db->model_num, db->submodel_num);
vec3d v2 = submodel_get_random_point(db->model_num, db->submodel_num);
vec3d v3 = submodel_get_random_point(db->model_num, db->submodel_num);
vec3d v4 = submodel_get_random_point(db->model_num, db->submodel_num);
n = 0;
@@ -256,9 +262,9 @@ void debris_process_post(object * obj, float frame_time)
// Create the spark effects
for (int i=0; i<MAX_DEBRIS_ARCS; ++i) {
if ( !timestamp_valid( db->arc_timestamp[i] ) ) {
if ( !db->arc_timestamp[i].isValid() ) {
db->arc_timestamp[i] = timestamp(lifetime); // live up to a second
db->arc_timestamp[i] = _timestamp(lifetime); // live up to a second
switch( n ) {
case 0:
@@ -313,19 +319,15 @@ void debris_process_post(object * obj, float frame_time)
}
for (int i=0; i<MAX_DEBRIS_ARCS; ++i) {
if ( timestamp_valid( db->arc_timestamp[i] ) ) {
if ( db->arc_timestamp[i].isValid() ) {
if ( timestamp_elapsed( db->arc_timestamp[i] ) ) {
// Kill off the spark
db->arc_timestamp[i] = timestamp(-1);
db->arc_timestamp[i] = TIMESTAMP::invalid();
} else {
// Maybe move a vertex.... 20% of the time maybe?
int mr = Random::next();
if ( mr < Random::MAX_VALUE/5 ) {
vec3d v1, v2;
submodel_get_two_random_points_better(db->model_num, db->submodel_num, &v1, &v2);
db->arc_pts[i][mr % 2] = v1;
db->arc_pts[i][mr % 2] = submodel_get_random_point(db->model_num, db->submodel_num);
}
}
}
@@ -357,7 +359,7 @@ int debris_find_oldest()
}
#define DEBRIS_ROTVEL_SCALE 5.0f
void calc_debris_physics_properties( physics_info *pi, vec3d *min, vec3d *max );
void calc_debris_physics_properties( physics_info *pi, vec3d *min, vec3d *max, float density );
MONITOR(NumSmallDebris)
MONITOR(NumHullDebris)
@@ -368,30 +370,45 @@ MONITOR(NumHullDebris)
* @param source_obj Source object
* @param model_num Model number
* @param submodel_num Sub-model number
* @param pos Position in vector space
* @param exp_center Explosion center in vector space
* @param hull_flag Hull flag settings
* @param pos Position in global coordinates
* @param exp_center Explosion center in global coordinates
* @param hull_flag Whether this debris is a chunk of a ship's hull (as opposed to shrapnel)
* @param exp_force Explosion force, used to assign velocity to pieces. 1.0f assigns velocity like before. 2.0f assigns twice as much to non-inherited part of velocity
* @param source_subsys The subsystem this debris came from, if any
*/
object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force)
object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, bool hull_flag, float exp_force, ship_subsys* source_subsys)
{
int objnum, parent_objnum;
object *obj;
ship *shipp;
debris *db;
polymodel *pm;
int vaporize;
physics_info *pi = NULL;
ship_info *sip = NULL;
int parent_objnum;
object *obj;
ship *shipp;
bool vaporize;
parent_objnum = OBJ_INDEX(source_obj);
Assert( (source_obj->type == OBJ_SHIP ) || (source_obj->type == OBJ_GHOST));
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
shipp = &Ships[source_obj->instance];
sip = &Ship_info[shipp->ship_info_index];
vaporize = (shipp->flags[Ship::Ship_Flags::Vaporize]);
obj = debris_create_only(parent_objnum, shipp->ship_info_index, shipp->alt_type_index, shipp->team, -1.0f, -1, model_num, submodel_num, pos, nullptr, hull_flag, vaporize, shipp->debris_damage_type_idx);
if (obj != nullptr)
{
debris_create_set_velocity(&Debris[obj->instance], shipp, exp_center, exp_force, source_subsys);
debris_create_fire_hook(obj, source_obj);
}
return obj;
}
object *debris_create_only(int parent_objnum, int parent_ship_class, int alt_type_index, int team, float hull_strength, int spark_timeout, int model_num, int submodel_num, vec3d *pos, matrix *orient, bool hull_flag, bool vaporize, int damage_type_idx)
{
int objnum;
object *obj;
debris *db;
ship_info *sip;
matrix orient_buf;
// try to maintain our soft limit
if (hull_flag && (Num_hull_pieces >= SOFT_LIMIT_DEBRIS_PIECES)) {
// cause oldest hull debris chunk to blow up
@@ -414,10 +431,73 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
db = &Debris[n];
// validate or deduce some parameters
if ( pos == nullptr ) {
if (parent_objnum >= 0) {
pos = &Objects[parent_objnum].pos;
} else {
pos = &vmd_zero_vector;
}
}
if ( orient == nullptr ) {
if (parent_objnum >= 0 && hull_flag) {
orient = &Objects[parent_objnum].orient;
} else {
// non-hull debris has no relation to its parent orientation
vec3d rand;
vm_vec_rand_vec(&rand);
vm_vector_2_matrix(&orient_buf, &rand);
orient = &orient_buf;
}
}
sip = (parent_ship_class < 0) ? nullptr : &Ship_info[parent_ship_class];
if (hull_flag && !sip)
{
Warning(LOCATION, "Cannot create hull debris without a ship class!");
return nullptr;
}
if (hull_strength < 0.0f)
{
if (parent_objnum >= 0 && Objects[parent_objnum].type == OBJ_SHIP)
hull_strength = Ships[Objects[parent_objnum].instance].ship_max_hull_strength / 8.0f;
else
hull_strength = 10.0f;
}
if (hull_flag && (model_num < 0 || submodel_num < 0))
{
Warning(LOCATION, "Model and submodel numbers must be specified for hull debris!");
return nullptr;
}
if (team < 0 && hull_flag)
{
if (parent_objnum >= 0 && Objects[parent_objnum].type == OBJ_SHIP)
team = Ships[Objects[parent_objnum].instance].team;
else if (Player_ship)
team = Player_ship->team;
else
team = 0;
}
if (damage_type_idx < 0)
{
if (parent_objnum >= 0 && Objects[parent_objnum].type == OBJ_SHIP)
damage_type_idx = Ships[Objects[parent_objnum].instance].debris_damage_type_idx;
}
// done validation
if (!hull_flag) {
if (model_num >= 0) {
db->model_num = model_num;
db->submodel_num = Random::next(sip->generic_debris_num_submodels);
db->submodel_num = (sip == nullptr || sip->generic_debris_num_submodels <= 0) ? 0 : Random::next(sip->generic_debris_num_submodels);
}
else if (vaporize) {
db->model_num = Debris_vaporize_model;
@@ -447,25 +527,18 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
}
}
if(hull_flag && sip->debris_min_lifetime >= 0.0f && sip->debris_max_lifetime >= 0.0f)
{
db->lifeleft = (( sip->debris_max_lifetime - sip->debris_min_lifetime ) * frand()) + sip->debris_min_lifetime;
}
else
{
// Create Debris piece n!
if ( hull_flag ) {
if (Random::next() < (Random::MAX_VALUE/6)) // Make some pieces blow up shortly after explosion.
db->lifeleft = 2.0f * (frand()) + 0.5f;
else {
db->flags.set(Debris_Flags::DoNotExpire);
db->lifeleft = -1.0f; // large hull pieces stay around forever
}
} else {
// small non-hull pieces should stick around longer the larger they are
// sqrtf should make sure its never too crazy long
db->lifeleft = (frand() * 2.0f + 0.1f) * sqrtf(radius);
// Create Debris piece n!
if ( hull_flag ) {
if (Random::next() < (Random::MAX_VALUE/6)) // Make some pieces blow up shortly after explosion.
db->lifeleft = 2.0f * (frand()) + 0.5f;
else {
db->flags.set(Debris_Flags::DoNotExpire);
db->lifeleft = -1.0f; // large hull pieces stay around forever
}
} else {
// small non-hull pieces should stick around longer the larger they are
// sqrtf should make sure its never too crazy long
db->lifeleft = (frand() * 2.0f + 0.1f) * sqrtf(radius);
}
//WMC - Oh noes, we may need to change lifeleft
@@ -494,18 +567,18 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
db->flags.set(Debris_Flags::Used);
db->is_hull = hull_flag;
db->source_objnum = parent_objnum;
db->damage_type_idx = shipp->debris_damage_type_idx;
db->ship_info_index = shipp->ship_info_index;
db->team = shipp->team;
db->ambient_sound = sip->debris_ambient_sound;
db->fire_timeout = 0; // if not changed, timestamp_elapsed() will return false
db->damage_type_idx = damage_type_idx;
db->ship_info_index = parent_ship_class;
db->team = team;
db->ambient_sound = (sip == nullptr) ? gamesnd_id(-1) : sip->debris_ambient_sound;
db->fire_timeout = TIMESTAMP::never(); // if not changed, timestamp_elapsed() will return false
db->time_started = Missiontime;
db->species = Ship_info[shipp->ship_info_index].species;
db->parent_alt_name = shipp->alt_type_index;
db->species = (sip == nullptr) ? -1 : sip->species;
db->parent_alt_name = alt_type_index;
db->damage_mult = 1.0f;
for (int i=0; i<MAX_DEBRIS_ARCS; ++i) { // NOLINT
db->arc_timestamp[i] = timestamp(-1);
db->arc_timestamp[i] = TIMESTAMP::invalid();
}
if ( db->is_hull ) {
@@ -519,36 +592,23 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
db->arc_frequency = 0;
}
db->next_fireball = timestamp_rand(500,2000); //start one 1/2 - 2 secs later
db->next_fireball = _timestamp_rand(500,2000); //start one 1/2 - 2 secs later
if ( pos == nullptr )
pos = &source_obj->pos;
flagset<Object::Object_Flags> default_flags;
default_flags.set(Object::Object_Flags::Renders);
default_flags.set(Object::Object_Flags::Physics);
default_flags.set(Object::Object_Flags::Collides, hull_flag != 0);
flagset<Object::Object_Flags> default_flags;
default_flags.set(Object::Object_Flags::Renders);
default_flags.set(Object::Object_Flags::Physics);
default_flags.set(Object::Object_Flags::Collides, hull_flag != 0);
matrix orient = source_obj->orient;
if (!db->is_hull) {
// non-hull debris has no relation to its parent orientation
vec3d rand;
vm_vec_rand_vec(&rand);
vm_vector_2_matrix(&orient, &rand);
}
objnum = obj_create(OBJ_DEBRIS, parent_objnum, n, &orient, pos, radius, default_flags, false);
objnum = obj_create(OBJ_DEBRIS, parent_objnum, n, orient, pos, radius, default_flags, false);
if ( objnum == -1 ) {
mprintf(("Couldn't create debris object -- out of object slots\n"));
return nullptr;
}
db->objnum = objnum;
obj = &Objects[objnum];
pi = &obj->phys_info;
db->model_instance_num = model_create_instance(objnum, db->model_num);
db->model_instance_num = hull_flag ? model_create_instance(objnum, db->model_num) : -1;
// assign the network signature. The signature will be 0 for non-hull pieces, but since that
// is our invalid signature, it should be okay.
@@ -558,10 +618,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
obj->net_signature = multi_get_next_network_signature( MULTI_SIG_DEBRIS );
}
if (source_obj->type == OBJ_SHIP) {
obj->hull_strength = Ships[source_obj->instance].ship_max_hull_strength/8.0f;
} else
obj->hull_strength = 10.0f;
obj->hull_strength = hull_strength;
if (hull_flag) {
if(sip->debris_min_hitpoints >= 0.0f && sip->debris_max_hitpoints >= 0.0f)
@@ -579,40 +636,59 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
obj->hull_strength = sip->debris_max_hitpoints;
}
db->damage_mult = sip->debris_damage_mult;
db->sound_delay = _timestamp(DEBRIS_SOUND_DELAY);
// limit the amount of time that fireballs appear
// let fireball length be linked to radius of ship. Range is .33 radius => 3.33 radius seconds.
if (spark_timeout >= 0) {
db->fire_timeout = _timestamp(spark_timeout);
} else if (parent_objnum >= 0) {
float t = 1000*Objects[parent_objnum].radius/3 + Random::next(fl2i(1000*3*Objects[parent_objnum].radius));
db->fire_timeout = _timestamp(fl2i(t)); // fireballs last from 5 - 30 seconds
} else {
db->fire_timeout = TIMESTAMP::immediate();
}
if (parent_objnum >= 0 && Objects[parent_objnum].radius >= MIN_RADIUS_FOR_PERSISTENT_DEBRIS) {
db->flags.set(Debris_Flags::DoNotExpire);
} else {
debris_add_to_hull_list(db);
}
}
if (hull_flag) {
MONITOR_INC(NumHullDebris,1);
} else {
MONITOR_INC(NumSmallDebris,1);
}
return obj;
}
void debris_create_set_velocity(debris *db, ship *source_shipp, vec3d *exp_center, float exp_force, ship_subsys* source_subsys)
{
auto obj = &Objects[db->objnum];
auto source_obj = (source_shipp == nullptr) ? nullptr : &Objects[source_shipp->objnum];
physics_info *pi = &obj->phys_info;
vec3d rotvel, radial_vel, to_center;
if ( exp_center )
vm_vec_sub( &to_center,pos, exp_center );
vm_vec_sub( &to_center, &obj->pos, exp_center );
else
vm_vec_zero(&to_center);
float scale;
if ( hull_flag ) {
float t;
if ( db->is_hull ) {
scale = exp_force * i2fl(Random::next(10, 29)); // for radial_vel away from location of blast center
db->sound_delay = timestamp(DEBRIS_SOUND_DELAY);
// set up physics mass and I_inv for hull debris pieces
pm = model_get(model_num);
auto pm = model_get(db->model_num);
vec3d *min, *max;
min = &pm->submodel[submodel_num].min;
max = &pm->submodel[submodel_num].max;
calc_debris_physics_properties( &obj->phys_info, min, max );
// limit the amount of time that fireballs appear
// let fireball length be linked to radius of ship. Range is .33 radius => 3.33 radius seconds.
t = 1000*Objects[db->source_objnum].radius/3 + Random::next(fl2i(1000*3*Objects[db->source_objnum].radius));
db->fire_timeout = timestamp(fl2i(t)); // fireballs last from 5 - 30 seconds
if ( Objects[db->source_objnum].radius < MIN_RADIUS_FOR_PERSISTANT_DEBRIS ) {
debris_add_to_hull_list(db);
} else {
db->flags.set(Debris_Flags::DoNotExpire);
nprintf(("Alan","A forever chunk of debris was created from ship with radius %f\n",Objects[db->source_objnum].radius));
}
min = &pm->submodel[db->submodel_num].min;
max = &pm->submodel[db->submodel_num].max;
float density = source_subsys != nullptr ? source_subsys->system_info->density : Ship_info[source_shipp->ship_info_index].debris_density;
calc_debris_physics_properties( &obj->phys_info, min, max, density);
}
else {
scale = exp_force * i2fl(Random::next(10, 29)); // for radial_vel away from blast center (non-hull)
@@ -627,15 +703,21 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
vm_vec_copy_scale(&radial_vel, &to_center, scale );
}
// DA: here we need to vel_from_rot = w x to_center, where w is world is unrotated to world coords and offset is the
// displacement fromt the center of the parent object to the center of the debris piece
vec3d world_rotvel, vel_from_rotvel;
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
vm_vec_cross ( &vel_from_rotvel, &world_rotvel, &to_center );
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
if (source_obj)
{
// DA: here we need to vel_from_rot = w x to_center, where w is world is unrotated to world coords and offset is the
// displacement fromt the center of the parent object to the center of the debris piece
vec3d world_rotvel, vel_from_rotvel;
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
vm_vec_cross ( &vel_from_rotvel, &world_rotvel, &to_center );
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
vm_vec_add2(&obj->phys_info.vel, &vel_from_rotvel);
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
vm_vec_add2(&obj->phys_info.vel, &vel_from_rotvel);
}
float radius = submodel_get_radius(db->model_num, db->submodel_num);
// make sure rotational velocity does not get too high
if (radius < 1.0) {
@@ -647,47 +729,49 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
vm_vec_rand_vec_quick(&rotvel);
vm_vec_scale(&rotvel, scale);
pi->flags |= PF_DEAD_DAMP;
pi->rotvel = rotvel;
pi->flags |= (PF_DEAD_DAMP | PF_BALLISTIC);
check_rotvel_limit( &obj->phys_info );
// check that debris is not created with too high a velocity
if (hull_flag)
if (db->is_hull)
{
shipfx_debris_limit_speed(db, shipp);
shipfx_debris_limit_speed(db, source_shipp);
}
// blow out his reverse thrusters. Or drag, same thing.
pi->rotdamp = 10000.0f;
pi->side_slip_time_const = 10000.0f;
pi->flags |= (PF_REDUCED_DAMP | PF_DEAD_DAMP); // set damping equal for all axis and not changable
if (source_shipp != nullptr) {
pi->gravity_const = Ship_info[source_shipp->ship_info_index].debris_gravity_const;
} else {
pi->gravity_const = 1.0f;
}
vm_vec_zero(&pi->max_vel); // make so he can't turn on his own VOLITION anymore.
vm_vec_zero(&pi->max_rotvel); // make so he can't change speed on his own VOLITION anymore.
// ensure vel is valid
Assert( !vm_is_vec_nan(&obj->phys_info.vel) );
}
if (OnDebrisCreatedHook->isActive()) {
OnDebrisCreatedHook->run(scripting::hook_param_list(
scripting::hook_param("Debris", 'o', obj),
scripting::hook_param("Source", 'o', source_obj)));
void debris_create_fire_hook(object *obj, object *source_obj)
{
if (scripting::hooks::OnDebrisCreated->isActive()) {
scripting::hooks::ShipSourceConditions conditions;
conditions.source_shipp = (source_obj != nullptr && source_obj->type == OBJ_SHIP) ? &Ships[source_obj->instance] : nullptr;
scripting::hooks::OnDebrisCreated->run(std::move(conditions),
scripting::hook_param_list(
scripting::hook_param("Debris", 'o', obj),
scripting::hook_param("Source", 'o', source_obj)));
}
if (db->is_hull) {
MONITOR_INC(NumHullDebris,1);
} else {
MONITOR_INC(NumSmallDebris,1);
}
return obj;
}
/**
* Alas, poor debris_obj got whacked. Fortunately, we know who did it, where and how hard, so we
* can do something about it.
*/
void debris_hit(object *debris_obj, object * /*other_obj*/, vec3d *hitpos, float damage)
void debris_hit(object *debris_obj, object * /*other_obj*/, vec3d *hitpos, float damage, vec3d* force)
{
debris *debris_p = &Debris[debris_obj->instance];
@@ -727,10 +811,15 @@ void debris_hit(object *debris_obj, object * /*other_obj*/, vec3d *hitpos, float
damage = 0.0f;
}
if (hitpos && force && The_mission.ai_profile->flags[AI::Profile_Flags::Whackable_debris]) {
vec3d rel_hit_pos = *hitpos - debris_obj->pos;
physics_calculate_and_apply_whack(force, &rel_hit_pos, &debris_obj->phys_info, &debris_obj->orient, &debris_obj->phys_info.I_body_inv);
}
debris_obj->hull_strength -= damage;
if (debris_obj->hull_strength < 0.0f) {
debris_start_death_roll(debris_obj, debris_p );
debris_start_death_roll(debris_obj, debris_p, hitpos);
} else {
// otherwise, give all the other players an update on the debris
if(MULTIPLAYER_MASTER){
@@ -747,7 +836,6 @@ void debris_hit(object *debris_obj, object * /*other_obj*/, vec3d *hitpos, float
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info, vec3d* hitNormal)
{
mc_info mc;
mc_info_init(&mc);
Assert( pdebris->type == OBJ_DEBRIS );
@@ -787,7 +875,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
weapon *wp = &Weapons[other_obj->instance];
wp->collisionInfo = new mc_info; // The weapon will free this memory later
memcpy(wp->collisionInfo, &mc, sizeof(mc_info));
*wp->collisionInfo = mc;
return mc.num_hits;
}
@@ -1029,7 +1117,7 @@ int debris_get_team(object *objp)
/**
* Fills in debris physics properties when created, specifically mass and moment of inertia
*/
void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs )
void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs, float density )
{
float dx, dy, dz, mass;
dx = maxs->xyz.x - mins->xyz.x;
@@ -1038,7 +1126,7 @@ void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs
// John, with new bspgen, just set pi->mass = mass
mass = 0.12f * dx * dy * dz;
pi->mass = (float) pow(mass, 0.6666667f) * 4.65f;
pi->mass = (float) pow(mass, 0.6666667f) * 4.65f * density;
pi->I_body_inv.vec.rvec.xyz.x = 12.0f / (pi->mass * (dy*dy + dz*dz));
pi->I_body_inv.vec.rvec.xyz.y = 0.0f;
@@ -1071,11 +1159,8 @@ void debris_render(object * obj, model_draw_list *scene)
texture_info *tbase = nullptr;
auto pmi = model_get_instance(db->model_instance_num);
auto pm = model_get(pmi->model_num);
auto pm = model_get(db->model_num);
model_clear_instance( db->model_num );
model_instance_clear_arcs(pm, pmi);
// Swap in a different texture depending on the species
if (db->species >= 0)
@@ -1088,11 +1173,18 @@ void debris_render(object * obj, model_draw_list *scene)
}
}
// Only render electrical arcs if within 500m of the eye (for a 10m piece)
if ( vm_vec_dist_quick( &obj->pos, &Eye_position ) < obj->radius*50.0f ) {
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
if ( timestamp_valid( db->arc_timestamp[i] ) ) {
model_instance_add_arc( pm, pmi, db->submodel_num, &db->arc_pts[i][0], &db->arc_pts[i][1], MARC_TYPE_DAMAGED );
polymodel_instance *pmi = nullptr;
if (db->model_instance_num >= 0)
{
pmi = model_get_instance(db->model_instance_num);
model_instance_clear_arcs(pm, pmi);
// Only render electrical arcs if within 500m of the eye (for a 10m piece)
if ( vm_vec_dist_quick( &obj->pos, &Eye_position ) < obj->radius*50.0f ) {
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
if ( db->arc_timestamp[i].isValid() ) {
model_instance_add_arc( pm, pmi, db->submodel_num, &db->arc_pts[i][0], &db->arc_pts[i][1], MARC_TYPE_DAMAGED );
}
}
}
}
+19 -7
View File
@@ -43,15 +43,15 @@ typedef struct debris {
int model_num; // What model this uses
int model_instance_num; // What model instance this uses - needed for arcs
int submodel_num; // What submodel this uses
int next_fireball; // When to start a fireball
int is_hull; // indicates whether this is a collideable, destructable piece of debris from the model, or just a generic debris fragment
TIMESTAMP next_fireball; // When to start a fireball
bool is_hull; // indicates whether this is a collideable, destructable piece of debris from the model, or just a generic debris fragment
int species; // What species this is from. -1 if don't care.
int fire_timeout; // timestamp that holds time for fireballs to stop appearing
int sound_delay; // timestamp to signal when sound should start
TIMESTAMP fire_timeout; // timestamp that holds time for fireballs to stop appearing
TIMESTAMP sound_delay; // timestamp to signal when sound should start
fix time_started; // time when debris was created
vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
TIMESTAMP arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. Invalid is not used
int arc_frequency; // Starts at 1000, gets bigger
int parent_alt_name;
@@ -69,9 +69,21 @@ void debris_init();
void debris_render(object * obj, model_draw_list *scene);
void debris_delete( object * obj );
void debris_process_post( object * obj, float frame_time);
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
// Create debris, set velocity, and fire scripting hook
object *debris_create( object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, bool hull_flag, float exp_force, ship_subsys* source_subsys = nullptr );
// Create debris but don't do anything else
object *debris_create_only(int parent_objnum, int parent_ship_class, int alt_type_index, int team, float hull_strength, int spark_timeout, int model_num, int submodel_num, vec3d *pos, matrix *orient, bool hull_flag, bool vaporize, int damage_type_idx);
// Set velocity after debris creation
void debris_create_set_velocity(debris *db, ship *source_shipp, vec3d *exp_center, float exp_force, ship_subsys* source_subsys = nullptr);
// Fire scripting hook after debris creation
void debris_create_fire_hook(object *obj, object *source_obj);
int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL, vec3d* hitnormal = NULL );
void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage );
void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage, vec3d* force );
int debris_get_team(object *objp);
void debris_add_to_hull_list(debris *db);
+37 -25
View File
@@ -161,6 +161,7 @@ SCP_vector<DecalDefinition> DecalDefinitions;
// Variable to indicate if the system is able to work correctly on the current system
bool Decal_system_active = true;
bool Decal_option_active = true;
void parse_decals_table(const char* filename) {
try {
@@ -186,7 +187,7 @@ void parse_decals_table(const char* filename) {
}
if (!gr_is_capable(CAPABILITY_DEFERRED_LIGHTING)) {
// we need deferred lighting
// We need deferred lighting
Decal_system_active = false;
mprintf(("Note: Decal system has been disabled due to lack of deferred lighting.\n"));
}
@@ -196,7 +197,7 @@ void parse_decals_table(const char* filename) {
mprintf(("Note: Decal system has been disabled due to lack of normal mapping.\n"));
}
if (!gr_is_capable(CAPABILITY_SEPARATE_BLEND_FUNCTIONS)) {
// WWe need separate blending functions for different color buffers
// We need separate blending functions for different color buffers
Decal_system_active = false;
mprintf(("Note: Decal system has been disabled due to lack of separate color buffer blend functions.\n"));
}
@@ -327,20 +328,18 @@ void parseDecalReference(creation_info& dest_info, bool is_new_entry) {
SCP_string name;
stuff_string(name, F_NAME);
auto decalRef = findDecalDefinition(name);
// decals are not initialized in FRED, so no decal definitions are known
if (!Fred_running) {
auto decalRef = findDecalDefinition(name);
if (decalRef < 0) {
error_display(0, "Decal definition '%s' is unknown!", name.c_str());
if (decalRef < 0) {
error_display(0, "Decal definition '%s' is unknown!", name.c_str());
}
dest_info.definition_handle = decalRef;
}
dest_info.definition_handle = decalRef;
if (required_string_if_new("+Radius:", is_new_entry)) {
stuff_float(&dest_info.radius);
if (dest_info.radius <= 0.0f) {
error_display(0, "Invalid radius of %f! Must be a positive number.", dest_info.radius);
dest_info.radius = 1.0f;
}
dest_info.radius = util::parseUniformRange(0.0001f);
}
if (required_string_if_new("+Lifetime:", is_new_entry)) {
@@ -351,10 +350,14 @@ void parseDecalReference(creation_info& dest_info, bool is_new_entry) {
dest_info.lifetime = util::parseUniformRange(0.0001f);
}
}
if (optional_string("+Use Random Rotation:")) {
stuff_boolean(&dest_info.random_rotation);
}
}
void loadBitmaps(const creation_info& info) {
if (!Decal_system_active) {
if (!Decal_system_active || !Decal_option_active) {
return;
}
// Silently ignore invalid definition handle since weapons use the default values if the decal option is not present
@@ -371,7 +374,7 @@ void loadBitmaps(const creation_info& info) {
}
void pageInDecal(const creation_info& info) {
if (!Decal_system_active) {
if (!Decal_system_active || !Decal_option_active) {
return;
}
// Silently ignore invalid definition handle since weapons use the default values if the decal option is not present
@@ -413,9 +416,12 @@ matrix4 getDecalTransform(Decal& decal) {
// this will lead to a situation where we would look at the decal texture "from behind" causing the texture to
// appear flipped. We fix that here for the graphics transform by inverting the Z scaling.
// ALSO for some reason the uvec needs to be flipped as well, otherwise the decals render upside-down. Without
// being sure of the root cause, this at least makes it appear correct for modders.
// Apply scaling
vm_vec_scale(&worldOrient.vec.rvec, decal.scale.xyz.x);
vm_vec_scale(&worldOrient.vec.uvec, decal.scale.xyz.y);
vm_vec_scale(&worldOrient.vec.uvec, -decal.scale.xyz.y);
vm_vec_scale(&worldOrient.vec.fvec, -decal.scale.xyz.z);
matrix4 mat4;
@@ -425,12 +431,12 @@ matrix4 getDecalTransform(Decal& decal) {
}
void renderAll() {
if (!Decal_system_active) {
if (!Decal_system_active || !Decal_option_active) {
return;
}
// Clear out any invalid decals
for (auto iter = active_decals.begin(); iter != active_decals.end(); ++iter) {
for (auto iter = active_decals.begin(); iter != active_decals.end();) {
if (!iter->isValid()) {
// if we're sitting on the very last element, popping-back will invalidate the iterator!
if (iter + 1 == active_decals.end()) {
@@ -442,6 +448,10 @@ void renderAll() {
active_decals.pop_back();
continue;
}
// next decal, only increment the iterator if we found a valid value so nothing gets skipped
// otherwise we may skip a decal which can then get through to the draw_list loop while being invalid
++iter;
}
if (active_decals.empty()) {
@@ -452,14 +462,15 @@ void renderAll() {
graphics::decal_draw_list draw_list(active_decals.size());
for (auto& decal : active_decals) {
Assertion(decal.definition_handle >= 0 && decal.definition_handle < (int)DecalDefinitions.size(),
"Invalid decal handle detected!");
auto& decalDef = DecalDefinitions[decal.definition_handle];
int diffuse_bm = -1;
int glow_bm = -1;
int normal_bm = -1;
Assertion(decal.definition_handle >= 0 && decal.definition_handle < (int) DecalDefinitions.size(),
"Invalid decal handle detected!");
auto& decalDef = DecalDefinitions[decal.definition_handle];
auto decal_time = mission_time - decal.creation_time;
auto progress = decal_time / decal.lifetime;
@@ -491,7 +502,7 @@ void renderAll() {
}
void addDecal(creation_info& info, object* host, int submodel, const vec3d& local_pos, const matrix& local_orient) {
if (!Decal_system_active) {
if (!Decal_system_active || !Decal_option_active) {
return;
}
// Silently ignore invalid definition handle since weapons use the default values if the decal option is not present
@@ -519,9 +530,10 @@ void addDecal(creation_info& info, object* host, int submodel, const vec3d& loca
newDecal.position = local_pos;
newDecal.orientation = local_orient;
if (info.width < 0.0f || info.height < 0.0f) {
newDecal.scale.xyz.x = info.radius;
newDecal.scale.xyz.y = info.radius;
newDecal.scale.xyz.z = info.radius;
float radius = info.radius.next();
newDecal.scale.xyz.x = radius;
newDecal.scale.xyz.y = radius;
newDecal.scale.xyz.z = radius;
} else {
newDecal.scale.xyz.x = info.width;
newDecal.scale.xyz.y = info.height;
+3 -1
View File
@@ -52,6 +52,7 @@ class DecalDefinition {
extern SCP_vector<DecalDefinition> DecalDefinitions;
extern bool Decal_system_active;
extern bool Decal_option_active;
/**
@@ -64,10 +65,11 @@ typedef int DecalReference;
*/
struct creation_info {
DecalReference definition_handle = -1;
float radius = -1.0f;
util::UniformFloatRange radius = ::util::UniformFloatRange(-1.0f);
float width = -1.0f;
float height = -1.0f;
util::UniformFloatRange lifetime = ::util::UniformFloatRange(-1.0f);
bool random_rotation = false;
};
/**
+4 -1
View File
@@ -72,7 +72,10 @@ $Player Damage Factor: 0.25, 0.5, 0.65, 0.85, 1
;; factor applied to subsystem damage suffered by the player
;; (in addition to Player Damage Factor)
$Player Subsys Damage Factor: 0.2, 0.4, 0.6, 0.8, 1
$Player Subsys Damage Factor: 0.2, 0.4, 0.6, 0.8, 1
;; factor applied to damage inflicted by the player
$Player Damage Inflicted Factor: 1, 1, 1, 1, 1
;; measure of time (in F1_0 units) after which the AI will recalculate
;; the position of its target
+2 -1
View File
@@ -15,7 +15,8 @@ layout (std140) uniform genericData {
void main()
{
vec4 baseColor = texture(baseMap, fragTexCoord.xyz);
float y = fragTexCoord.y / fragTexCoord.w;
vec4 baseColor = texture(baseMap, vec3(fragTexCoord.x, y, fragTexCoord.z));
baseColor.rgb = srgb_to_linear(baseColor.rgb);
vec4 blendColor = vec4(srgb_to_linear(fragColor.rgb), fragColor.a);
+1 -1
View File
@@ -17,7 +17,7 @@ layout (std140) uniform genericData {
void main()
{
fragTexCoord = vec4(vertTexCoord.xyz, 0.0);
fragColor = vertColor * color;
gl_Position = projMatrix * modelViewMatrix * vertPosition;
fragTexCoord = vertTexCoord;
}
+9
View File
@@ -0,0 +1,9 @@
in vec4 fragTexCoord;
out vec4 fragOut0;
uniform sampler2D tex;
void main()
{
fragOut0 = texture(tex, fragTexCoord.xy);
}
+2 -2
View File
@@ -118,7 +118,7 @@ void main() {
vec3 normal = getPixelNormal(frag_position, gl_FragCoord.xy, alpha, binormal, tangent);
vec4 diffuse_out = vec4(0.0);
vec4 emissive_out = vec4(0.0, 0.0, 0.0, 0.0);
vec4 emissive_out = vec4(0.0);
vec3 normal_out = vec3(0.0);
if (diffuse_index >= 0) {
@@ -147,7 +147,7 @@ void main() {
}
if (glow_index >= 0) {
// We have a valid diffuse map
// We have a valid glow map
vec4 color = texture(glowMap, vec3(tex_coord, float(glow_index)));
color.rgb = srgb_to_linear(color.rgb) * GLOW_MAP_SRGB_MULTIPLIER;
@@ -3,6 +3,7 @@ out vec4 fragOut1;
out vec4 fragOut2;
out vec4 fragOut3;
out vec4 fragOut4;
out vec4 fragOut5;
void main()
{
fragOut0 = vec4(0.0, 0.0, 0.0, 1.0); // color
@@ -10,4 +11,5 @@ void main()
fragOut2 = vec4(0.0, 0.0, 0.0, 1.0); // normal
fragOut3 = vec4(0.0, 0.0, 0.0, 0.0); // specular
fragOut4 = vec4(0.0, 0.0, 0.0, 1.0); // emissive
fragOut5 = vec4(0.0, 0.0, 0.0, 1.0); // composite
}
+103 -40
View File
@@ -1,10 +1,8 @@
//? #version 150
#include "lighting.sdr" //! #include "lighting.sdr"
#include "lighting.sdr"
#include "shadows.sdr" //! #include "shadows.sdr"
#include "shadows.sdr"
in vec3 beamVec;
in vec3 lightPosition;
out vec4 fragOut0;
uniform sampler2D ColorBuffer;
@@ -28,11 +26,16 @@ layout (std140) uniform globalDeferredData {
float invScreenHeight;
};
layout (std140) uniform matrixData {
mat4 modelViewMatrix;
mat4 projMatrix;
};
layout (std140) uniform lightData {
vec3 diffuseLightColor;
float coneAngle;
vec3 specLightColor;
vec3 lightDir;
float coneInnerAngle;
vec3 coneDir;
@@ -41,49 +44,106 @@ layout (std140) uniform lightData {
vec3 scale;
float lightRadius;
vec3 lightDir;
int lightType;
bool enable_shadows;
float sourceRadius;
};
void GetLightInfo(vec3 position, out vec3 lightDir, out float attenuation)
// Nearest point sphere and tube light calculations taken from
// "Real Shading in Unreal Engine 4" by Brian Karis, Epic Games
// Part of SIGGRAPH 2013 Course: Physically Based Shading in Theory and Practice
vec3 ExpandLightSize(in vec3 lightDir, in vec3 reflectDir) {
// There's an extra max(...,sourceRadius) call here vs the version in the paper.
// This prevents the centerToRay calculation from choosing a point behind
// the reflection ray's origin (i.e. underneath the surface).
// this is necessary for situations where the fragment being shaded lies inside
// the sourceRadius of the light.
// Instead, we choose a point suffciently far away from the reflection origin (hence max(...,sourceRadius))
// so that we have a gradual transition as the shaded fragments along the surface
// shift from being inside to outside the light.
vec3 centerToRay = max(dot(lightDir, reflectDir),sourceRadius) * reflectDir - lightDir;
return lightDir + centerToRay * clamp(sourceRadius/length(centerToRay), 0.0, 1.0);
}
void GetLightInfo(vec3 position, in float alpha, in vec3 reflectDir, out vec3 lightDirOut, out float attenuation, out float area_normalisation)
{
if (lightType == LT_DIRECTIONAL) {
lightDir = normalize(lightPosition);
lightDirOut = normalize(lightDir);
attenuation = 1.0;
area_normalisation = 1.0;
} else {
vec3 lightPosition = modelViewMatrix[3].xyz;
// Positional light source
lightDir = lightPosition - position.xyz;
float dist = length(lightDir);
attenuation = 1.0 - clamp(sqrt(dist / lightRadius), 0.0, 1.0);
if (lightType == LT_POINT) {
lightDirOut = lightPosition - position.xyz;
float dist = length(lightDirOut);
// this chunk is unneccessary if sourceRadius= 0.0, but let's avoid a branch.
// given a sphere of radius sourceRadius centered at lightDirOut,
// move lightDirOut towards the ray defined by reflectDir
lightDirOut = ExpandLightSize(lightDirOut, reflectDir);
dist = length(lightDirOut);
// Energy conservation term
float alpha_adjust = clamp(alpha + (sourceRadius/(2*dist)), 0.0, 1.0);
area_normalisation = alpha/alpha_adjust;
area_normalisation *= area_normalisation;
//end chunk
if(dist > lightRadius && lightType != LT_TUBE) {
discard;
}
if (lightType == LT_TUBE) { // Tube light
float beamLength = length(beamVec);
vec3 beamDir = beamVec / beamLength;
//The actual 'lighting element' is shorter than the light volume cylinder
//To compensate the light is moved forward along the beam one radius and the length shortened
//this allows room for clean falloff of the light past the ends of beams.
vec3 adjustedLightPos = lightPosition - (beamDir * lightRadius);
beamLength = beamLength - (lightRadius * 2.0);
//adjustments having been made, lightdir needs recalculating
lightDir = adjustedLightPos - position.xyz;
// Get nearest point on line
float neardist = clamp(dot(lightDir, beamDir), 0.0, beamLength);
// Move back from the endpoint of the beam along the beam by the distance we calculated
vec3 nearest = adjustedLightPos - beamDir * neardist;
lightDir = nearest - position.xyz;
dist = length(lightDir);
if(dist > lightRadius) {
discard;
}
attenuation = 1.0 - clamp(sqrt(dist / lightRadius), 0.0, 1.0);
} else if (lightType == LT_CONE) {
float coneDot = dot(normalize(-lightDir), coneDir);
}
else if (lightType == LT_TUBE) { // Tube light
vec3 beamVec = vec3(modelViewMatrix * vec4(0.0, 0.0, -scale.z, 0.0));
vec3 beamDir = normalize(beamVec);
//The actual 'lighting element' is shorter than the light volume cylinder
//To compensate the light is moved forward along the beam one radius and the length shortened
//this allows room for clean falloff of the light past the ends of beams.
vec3 adjustedLightPos = lightPosition - (beamDir * lightRadius);
vec3 adjustedbeamVec = beamVec - 2.0 * lightRadius * beamDir;
float beamLength = length(adjustedbeamVec);
//adjustments having been made, sourceDir needs recalculating
vec3 sourceDir = adjustedLightPos - position.xyz;
// Get point on beam nearest to the reflection ray.
vec3 a_t = reflectDir;
vec3 b_t = beamDir;
vec3 b_0 = sourceDir;
vec3 c = cross(a_t, b_t);
vec3 d = b_0;
vec3 r = d - a_t * dot(d, a_t) - c * dot(d,c);
float neardist = dot(r, r)/dot(b_t, r);
// Move along the beam by the distance we calculated
lightDirOut = sourceDir - beamDir * clamp(neardist, 0.0, beamLength);
// Somebody with a symbolic expression simplifier or a wrinklier brain than me
// should figure out how to optimise these calcs - qaz
// this chunk is unneccessary if sourceRadius = 0.0, but let's avoid a branch.
// Same principle as in LT_POINT, treat chosen location as a spherelight.
lightDirOut = ExpandLightSize(lightDirOut, reflectDir);
float dist = length(lightDirOut);
// Energy conservation term
float alpha_adjust = min(alpha + (sourceRadius/(2*dist)), 1.0);
area_normalisation = alpha/alpha_adjust;
// don't need to square as it's a line rather than a sphere.
//end chunk
if(dist > lightRadius) {
discard;
}
attenuation = 1.0 - clamp(sqrt(dist / lightRadius), 0.0, 1.0);
}
else if (lightType == LT_CONE) {
lightDirOut = lightPosition - position.xyz;
float coneDot = dot(normalize(-lightDirOut), coneDir);
float dist = length(lightDirOut);
attenuation = 1.0 - clamp(sqrt(dist / lightRadius), 0.0, 1.0);
area_normalisation = 1.0;
if(dualCone) {
if(abs(coneDot) < coneAngle) {
discard;
@@ -99,7 +159,7 @@ void GetLightInfo(vec3 position, out vec3 lightDir, out float attenuation)
}
}
attenuation *= attenuation;
lightDir = normalize(lightDir);
lightDirOut = normalize(lightDirOut);
}
}
@@ -111,19 +171,22 @@ void main()
if(abs(dot(position, position)) < 0.1)
discard;
vec3 color = texture(ColorBuffer, screenPos).rgb;
vec3 diffColor = texture(ColorBuffer, screenPos).rgb;
vec4 normalData = texture(NormalBuffer, screenPos);
vec4 specColor = texture(SpecBuffer, screenPos);
// The vector in the normal buffer could be longer than the unit vector since decal rendering only adds to the normal buffer
vec3 normal = normalize(normalData.xyz);
float gloss = normalData.a;
float roughness = clamp(1.0f - gloss, 0.0f, 1.0f);
float alpha = roughness * roughness;
float fresnel = specColor.a;
vec3 eyeDir = normalize(-position);
vec3 lightDir;
float attenuation;
GetLightInfo(position, lightDir, attenuation);
float area_normalisation;
vec3 reflectDir = reflect(-eyeDir, normal);
GetLightInfo(position, alpha, reflectDir, lightDir, attenuation, area_normalisation);
if (enable_shadows) {
vec4 fragShadowPos = shadow_mv_matrix * inv_view_matrix * vec4(position, 1.0);
@@ -139,7 +202,7 @@ void main()
vec3 halfVec = normalize(lightDir + eyeDir);
float NdotL = clamp(dot(normal, lightDir), 0.0, 1.0);
vec4 fragmentColor = vec4(color * (diffuseLightColor * NdotL * attenuation), 1.0);
fragmentColor.rgb += computeLighting(specColor.rgb, lightDir, normal.xyz, halfVec, eyeDir, gloss, fresnel, NdotL).rgb * specLightColor * attenuation;
vec4 fragmentColor = vec4(1.0);
fragmentColor.rgb = computeLighting(specColor.rgb, diffColor, lightDir, normal.xyz, halfVec, eyeDir, roughness, fresnel, NdotL).rgb * diffuseLightColor * attenuation * area_normalisation;
fragOut0 = max(fragmentColor, vec4(0.0));
}
+3 -9
View File
@@ -12,7 +12,7 @@ layout (std140) uniform lightData {
vec3 diffuseLightColor;
float coneAngle;
vec3 specLightColor;
vec3 lightDir;
float coneInnerAngle;
vec3 coneDir;
@@ -21,23 +21,17 @@ layout (std140) uniform lightData {
vec3 scale;
float lightRadius;
vec3 lightDir;
int lightType;
bool enable_shadows;
float sourceRadius;
};
out vec3 lightPosition;
out vec3 beamVec;
void main()
{
if (lightType == LT_DIRECTIONAL) {
gl_Position = vec4(vertPosition.xyz, 1.0);
lightPosition = lightDir;
} else {
gl_Position = projMatrix * modelViewMatrix * vec4(vertPosition.xyz * scale, 1.0);
lightPosition = modelViewMatrix[3].xyz;
if(lightType == LT_TUBE)
beamVec = vec3(modelViewMatrix * vec4(0.0, 0.0, -scale.z, 0.0));
}
}
+185
View File
@@ -0,0 +1,185 @@
//!#version 150
#include "gamma.sdr" //! #include "gamma.sdr"
#define PI 3.1415926535897932384626433832795
uniform samplerCube envmap;
layout (std140) uniform genericData {
int face;
};
in vec4 fragTexCoord;
out vec4 fragOut0;
// Iteratively optimised points to give low discrepancy distribution on arbritrary hemisphere.
const vec3 points[128] = vec3[128](
vec3(-0.2268, 0.6185, 0.7523),
vec3( 0.9958, -0.0871, -0.0277),
vec3( 0.7132, -0.6099, 0.3455),
vec3(-0.9243, -0.3644, 0.1137),
vec3( 0.4580, -0.3977, -0.7950),
vec3(-0.2989, -0.7422, -0.5998),
vec3(-0.7263, -0.5965, 0.3416),
vec3(-0.7906, 0.4955, 0.3597),
vec3(-0.5006, -0.5116, 0.6984),
vec3( 0.3924, 0.8514, 0.3479),
vec3(-0.5916, -0.8009, 0.0925),
vec3( 0.5076, 0.2359, -0.8287),
vec3(-0.6712, 0.5976, -0.4386),
vec3( 0.5255, -0.5998, -0.6034),
vec3( 0.2083, 0.7588, -0.6172),
vec3( 0.8282, 0.0486, 0.5584),
vec3( 0.2563, -0.6217, -0.7401),
vec3(-0.4601, 0.2289, -0.8579),
vec3( 0.6840, 0.5803, -0.4421),
vec3(-0.0167, 0.9512, -0.3080),
vec3( 0.2259, 0.3423, 0.9120),
vec3( 0.3726, -0.7409, 0.5587),
vec3( 0.0440, -0.4696, 0.8818),
vec3(-0.5011, -0.6169, -0.6069),
vec3( 0.2801, 0.8534, 0.4396),
vec3(-0.2464, -0.9090, 0.3360),
vec3(-0.7297, 0.1734, 0.6614),
vec3(-0.2619, 0.2954, 0.9188),
vec3( 0.1519, -0.5555, -0.8176),
vec3(-0.6161, -0.7542, 0.2274),
vec3( 0.3067, -0.8999, -0.3100),
vec3( 0.4223, -0.6110, 0.6696),
vec3(-0.7079, 0.5325, 0.4640),
vec3( 0.9522, -0.3022, 0.0443),
vec3(-0.3054, -0.5260, -0.7937),
vec3(-0.7502, 0.1605, -0.6414),
vec3( 0.9070, -0.0741, -0.4145),
vec3(-0.1592, 0.8002, -0.5783),
vec3( 0.7672, 0.4286, 0.4772),
vec3(-0.9340, 0.2468, -0.2584),
vec3( 0.9905, -0.1254, 0.0563),
vec3(-0.7776, -0.4144, -0.4729),
vec3(-0.7503, 0.6316, -0.1952),
vec3(-0.3313, -0.2916, -0.8973),
vec3( 0.1147, -0.7738, 0.6230),
vec3( 0.1481, 0.3008, -0.9421),
vec3(-0.8300, 0.0980, 0.5491),
vec3(-0.1374, 0.9904, 0.0163),
vec3( 0.0996, -0.9950, -0.0014),
vec3( 0.7040, 0.0177, -0.7100),
vec3(-0.3455, 0.8607, -0.3740),
vec3(-0.6005, 0.2897, 0.7453),
vec3( 0.3546, -0.8403, -0.4100),
vec3(-0.5317, 0.5463, -0.6472),
vec3( 0.4780, -0.1825, -0.8592),
vec3( 0.3033, -0.1953, 0.9327),
vec3(-0.8416, -0.1018, -0.5304),
vec3( 0.2834, -0.6792, -0.6771),
vec3( 0.9488, 0.1900, -0.2522),
vec3( 0.3215, 0.7569, -0.5690),
vec3(-0.7391, 0.5883, -0.3281),
vec3( 0.4351, -0.2649, 0.8605),
vec3( 0.0829, -0.8264, 0.5570),
vec3(-0.6900, 0.5097, 0.5139),
vec3( 0.6869, -0.5626, 0.4601),
vec3(-0.9385, -0.1405, -0.3153),
vec3(-0.2377, 0.7921, 0.5622),
vec3( 0.3259, -0.1633, -0.9312),
vec3( 0.4753, 0.8652, -0.1597),
vec3( 0.9267, 0.0849, -0.3661),
vec3(-0.8777, -0.4241, -0.2231),
vec3( 0.5195, -0.8463, -0.1177),
vec3(-0.2962, -0.5401, 0.7878),
vec3( 0.9439, 0.3300, -0.0130),
vec3(-0.9481, 0.2886, 0.1333),
vec3(-0.0272, -0.5312, 0.8468),
vec3(-0.3538, 0.6180, -0.7021),
vec3(-0.9996, 0.0160, -0.0217),
vec3( 0.2800, -0.3399, 0.8978),
vec3( 0.2090, 0.9773, 0.0338),
vec3( 0.5249, 0.0450, 0.8500),
vec3( 0.8165, 0.3275, -0.4755),
vec3( 0.1568, -0.6439, -0.7489),
vec3( 0.3034, 0.6192, -0.7243),
vec3(-0.7233, -0.6519, -0.2278),
vec3(-0.8259, -0.4757, 0.3027),
vec3( 0.2690, -0.7823, 0.5618),
vec3( 0.3309, 0.4864, -0.8087),
vec3(-0.3891, 0.4036, 0.8281),
vec3(-0.0919, 0.1208, 0.9884),
vec3(-0.2482, -0.5348, 0.8077),
vec3( 0.8195, 0.3333, 0.4661),
vec3( 0.7890, -0.6104, 0.0702),
vec3(-0.4653, 0.8046, 0.3688),
vec3(-0.0413, -0.2247, -0.9736),
vec3( 0.1926, 0.2839, -0.9393),
vec3( 0.9205, -0.2443, -0.3048),
vec3(-0.4891, 0.8229, 0.2891),
vec3(-0.9010, -0.4189, -0.1128),
vec3( 0.0706, 0.2715, 0.9598),
vec3(-0.2682, 0.4639, -0.8443),
vec3(-0.6389, -0.0442, 0.7680),
vec3(-0.2588, 0.9613, -0.0949),
vec3( 0.5469, -0.4194, 0.7246),
vec3( 0.8399, 0.3814, 0.3860),
vec3( 0.8060, -0.3544, -0.4741),
vec3(-0.7109, -0.4466, 0.5432),
vec3(-0.2986, -0.9381, -0.1753),
vec3( 0.3983, -0.3642, -0.8418),
vec3( 0.4518, 0.8744, 0.1770),
vec3( 0.8792, -0.4098, 0.2432),
vec3(-0.7904, 0.6106, -0.0494),
vec3( 0.1667, -0.2852, -0.9438),
vec3( 0.5566, 0.6694, 0.4920),
vec3( 0.1761, 0.9638, 0.2000),
vec3( 0.6951, 0.7188, 0.0090),
vec3(-0.2659, -0.0544, 0.9625),
vec3(-0.0370, 0.6667, 0.7444),
vec3( 0.1119, -0.5816, 0.8058),
vec3(-0.1706, -0.9310, -0.3226),
vec3( 0.5573, -0.8143, 0.1624),
vec3( 0.3899, -0.9183, 0.0682),
vec3(-0.2921, -0.7937, 0.5336),
vec3( 0.8488, 0.4895, 0.1997),
vec3(-0.6887, 0.1527, 0.7088),
vec3(-0.3092, 0.0011, -0.9510),
vec3( 0.3066, 0.6124, 0.7287),
vec3( 0.7305, 0.6698, 0.1333)
);
void main() {
float xpos = 2 * gl_FragCoord.x/16 - 1; // remap to (-1, 1)
float ypos = 2 * gl_FragCoord.y/16 - 1;
vec3 fragDir;
vec4 fragCol = vec4(0.0);
switch (face) {
case 0: // +X
fragDir = vec3(1.0, -ypos, -xpos);
break;
case 1: // -X
fragDir = vec3(-1.0, -ypos, xpos);
break;
case 2: // +Y
fragDir = vec3(xpos, 1.0, ypos);
break;
case 3: // -Y
fragDir = vec3(xpos, -1.0, -ypos);
break;
case 4: // +Z
fragDir = vec3(xpos, -ypos, 1.0);
break;
case 5: // -Z
fragDir = vec3(-xpos, -ypos, -1.0);
break;
}
fragDir = normalize(fragDir);
for(int i=0;i<128;++i)
{
// This precalcualted sampling method seems weird, but by having a set of fixed directions
// and mirroring the bad ones onto the correct side of the normal means that
// approximately 50% of envmap texture samples (the non-mirrored ones)
// are shared between adjacent fragments, improving texture cache hit rate.
float PdotD = dot(points[i], fragDir);
float aPdotD = abs(PdotD);
vec3 sampDir = points[i] + (aPdotD - PdotD) * fragDir;
fragCol += aPdotD * vec4(srgb_to_linear(texture(envmap, sampDir)).rgb, 1.0);
}
fragOut0 = linear_to_srgb(PI * fragCol * (1.0/128));
}
Loaded 100 of 1045 files, more files were not shown because too many files have changed in this diff. Show more