Compare commits

...
Author SHA1 Message Date
SirKnightly a520e810f2 Automated build commit 2017-08-22 12:56:27 -04:00
m!m b1b197cc9a Merge pull request #1440 from ln-zookeeper/asteroid_null_vec_fix
Fix for a null vector normalization
2017-08-21 09:54:09 +02:00
Lari Nieminen 941b7298cc Fix for a null vector normalization
If the asteroid split rules were used and the asteroid speed happened to be 0 (for example if the field has an average speed of 0), the code would try to normalize a null vector. Now, a random vector is chosen in those cases.
2017-08-21 10:09:18 +03:00
m!m 637a9621f1 Merge pull request #1436 from Goober5000/pr_922_followup
fix typo in AI flag conversion
2017-08-14 23:41:44 +02:00
Goober5000 70c5aa88f2 then again, we should really assert on both 2017-08-11 18:05:13 -04:00
Goober5000 1857f9b928 fix typo in AI flag conversion 2017-08-11 17:53:42 -04:00
Fabian Woltermann fb4169ba9f Merge pull request #1429 from asarium/fix/ffEffectStrength
Lower Afterburner force feedback effect strength to previous levels
2017-08-08 14:35:35 +02:00
Fabian Woltermann 1448256140 Merge pull request #1430 from asarium/fix/nightlyDeploy
Fix Travis CI nightly deploy
2017-08-03 18:02:11 +02:00
asarium 7de592bf9b Fix Travis CI nightly deploy
I have no idea why this doesn't work anymore. I didn't even touch that
line when I added the test build stuff...
2017-08-03 17:18:48 +02:00
asarium 783852a115 Lower Afterburner force feedback effect strength to previous levels
This was suggested by taylor on the forums and should match the previous
values more closely.
2017-08-03 08:55:50 +02:00
Fabian Woltermann 84fd7123a5 Merge pull request #1420 from asarium/fix/1417
Restart spring effect after stopping all FF effects
2017-08-02 08:23:26 +02:00
m!m ff9d06cfe1 Merge pull request #1427 from The-E/weaponloadout_fix
Fix error message for failure to load mask file in weaponloadout
2017-07-28 10:16:46 +02:00
Fabian Woltermann a158029120 When loading the mask file fails, correctly report which file we were trying to load. 2017-07-27 22:53:33 +02:00
m!m 96e8d5b66e Merge pull request #1426 from Goober5000/issue_1425_fix
for backwards compatibility, check both no-collide and no_collide
2017-07-26 15:41:47 +02:00
asarium 85fd0b0498 Restart spring effect after stopping all FF effects
SDL_HapticStopAll stops all effects, including the spring effect so the
joystick goes limp after one mission (joy_ff_stop_effects gets called at
the end of each mission).

This restarts the spring effect which should fix that issue.

This fixes #1417.
2017-07-26 11:00:50 +02:00
Fabian Woltermann 5d3e6789e6 Merge pull request #1422 from asarium/build/ciTestBuilds
Add support for building test builds on the CI servers
2017-07-26 10:59:56 +02:00
Goober5000 b8e5a395dd for backwards compatibility, check both no-collide and no_collide 2017-07-25 18:44:41 -04:00
asarium 1a1c3df379 Add support for building test builds on the CI servers
Any branch starting with "test/" will cause test builds to be compiled
and uploaded to fs2downloads. This will only work for the main
repository since the secure variables for the FTP credentials only work
for that repository.
2017-07-25 11:37:11 +02:00
Fabian Woltermann 0dc0d67c76 Merge pull request #1421 from asarium/build/releaseSources
Build a compressed package of the source as part of a release
2017-07-24 15:29:16 +02:00
asarium 0edb360fc2 Build a compressed package of the source as part of a release
This package will include the externals which are not present in the
default GitHub export.
2017-07-24 10:53:40 +02:00
Fabian Woltermann 1743e5f5d4 Merge pull request #1419 from ln-zookeeper/on_ship_arrive_wing_fix
Fixed $On Ship Arrive hooks not firing on wing arrivals
2017-07-23 17:09:21 +02:00
MageKing17 ed3f07284d Merge pull request #1418 from The-E/shader_normal_fix
Fix bug in normal map rendering
2017-07-23 06:07:55 -07:00
Fabian Woltermann c1b222ffd5 Old calculation apparently correct, just needs clamping applied. 2017-07-22 20:25:52 +02:00
Fabian Woltermann 3503b9214b Remove unnecessary punctuation 2017-07-21 20:06:53 +02:00
Lari Nieminen aff8cc8095 Fixed $On Ship Arrive hooks not firing on wing arrivals 2017-07-20 16:13:20 +03:00
Fabian Woltermann 884581a836 Reapply the fix from https://github.com/scp-fs2open/fs2open.github.com/commit/8e0304a5 2017-07-20 12:20:44 +02:00
Fabian Woltermann 98af9dd903 Merge pull request #1404 from Goober5000/debug_sexp_tweak
minor enhancements to the debug sexp
2017-07-13 18:05:34 +02:00
m!m ea37b3cb17 Merge pull request #1411 from Goober5000/issue_1400_followup
use IS_VEC_NULL for floating point safety, plus a few minor touchups
2017-07-11 14:45:03 +02:00
Fabian Woltermann 3035a868ab Merge pull request #1401 from asarium/fix/ttfSpecialCharacters
Correctly apply scaling to TTF rendered strings
2017-07-09 20:48:12 +02:00
Goober5000 a88c50b6f2 per comments, allow variable replacement in plain strings as well 2017-07-09 14:31:36 -04:00
Goober5000 ac24ca9fd3 use IS_VEC_NULL for floating point safety, plus a few minor touchups 2017-07-09 14:11:42 -04:00
MageKing17 d085951767 Merge pull request #1400 from asarium/fix/fredInvalidIndex
Fix invalid indexing in object orientation editor
2017-07-09 03:42:04 -07:00
MageKing17 c3f19631ce Merge pull request #1402 from asarium/fix/profilingAssert
Discard non-main thread events for the frame profiler
2017-07-09 03:41:10 -07:00
m!m ca9eff3bc5 Merge pull request #1405 from MageKing17/bugfix/ani-unloading
Fix unloading streaming ANI files.
2017-07-09 12:36:55 +02:00
MageKing17 0a19616bc9 Correct inconsistency in anim_load() regarding memory-mapped files.
In commit 735f5e199b randomtiger changed how anim_load() worked in seemingly-bizarre ways, for reasons unclear to me. In brief, a condition's logic was reversed, a three-value enum was created of which only one value was used, and as a result loose files passed to anim_load() (and only loose files) would be opened as "memory-mapped", one consequence of which is that they'd keep a cfile block open until the corresponding call to anim_free() (which means that, if a mission had enough different loose animations, the cfile block limit could be reached). Since files in packfiles behaved the same way they always had (namely, being loaded into memory and then closed, thereby not taking up a cfile block), apparently nobody noticed the difference, and this inconsistent code has stayed for the past 13-and-a-half years.

This commit changes the condition after the one changed in the older commit so that they both match, then changes the enum so that the seemingly-meaningless third value is removed, and the other two values are swapped (and the default value of the file_mapped parameter to anim_load() changed) so that the original Volition behavior is restored.
2017-07-09 02:39:40 -07:00
m!m 255e9aa21e Merge pull request #1406 from asarium/build/nightlySFTP
Fix SFTP path and mac upload
2017-07-07 23:31:09 +02:00
asarium 550f459747 Fix SFTP path and mac upload 2017-07-07 18:03:07 +02:00
MageKing17 6da72bb1a0 Fix inverted order of unloading streaming ANI files.
When streaming an ANI file, first anim_load() is called, then init_anim_instance(). The latter increments the animation's instance_count. If anim_free() is called on an animation that still has instances, it refuses to free the animation. generic_anim_unload() first called anim_free(), then free_anim_instance().

The fact that ANI files would ever unload at all seems to be because some code would unload twice. I can only assume that, combined with the fact that the bug only applies to ANI files, explains how this bug went undetected since November of 2009 (commit b43417882f seems to be when it was added, from a quick glance at git blame).
2017-07-07 01:23:20 -07:00
MageKing17 c7fbefeb58 Remove potentially-harmful condition in message_mission_free_avi()
If we tell it to free up the animation, I think it should happen regardless of whether or not the HUD_TALKING_HEAD gauge is currently active or not. Also, unloading an animation shouldn't crash even if one wasn't loaded in the first place... and if it does, we should probably fix that instead of slapping a band-aid on the calling function.
2017-07-07 01:18:09 -07:00
Goober5000 98e316bca6 minor enhancements to the debug sexp 2017-07-07 01:25:54 -04:00
Cliff Gordon 78a1e5baab Merge pull request #1403 from asarium/build/nightlySFTP
Compile curl with SSH support for nightly deploy
2017-07-06 15:17:48 -05:00
asarium 080ce8419a Compile curl with SSH support for nightly deploy 2017-07-06 17:58:48 +02:00
asarium 06e9248079 Discard non-main thread events for the frame profiler
The old code is not able to handle multi-threaded events so this change
simply filters out all the events that originated from another thread.

This fixes an Assertion caused by an invalid event.
2017-07-06 10:10:52 +02:00
asarium e04c60ed6f Align special characters to the base line of the rendered string 2017-07-05 18:13:45 +02:00
asarium 81d9ca8e4a Correctly apply scaling to TTF rendered strings
This fixes weird misplaced special characters since the TTF strings
weren't rendered at the right position. This should fix that.

This fixes an issue reported on the forums by Novachen.
2017-07-05 09:09:38 +02:00
asarium bf2ca61e5a Fix invalid indexing in object orientation editor
This could happen if the user enabled "Point to" and selected "Object"
without having an object selected. This can only happen when there is
only one object in the mission so it's only a minor bug but still
something worth fixing.
2017-07-03 20:11:06 +02:00
Fabian Woltermann ffe647be79 Merge pull request #1393 from asarium/build/gitHubPrebuilts
Use GitHub prebuilt URL
2017-07-01 14:09:02 +02:00
Fabian Woltermann fff2e6d1fc Merge pull request #1394 from Goober5000/issue_1381_followup
Use the already-determined sexp argument type
2017-07-01 14:08:22 +02:00
Fabian Woltermann 23e46ae7c4 Merge pull request #1395 from Goober5000/issue_1256_followup
Better handling of positive/negative discrepancy as well as finding sexp node arguments
2017-07-01 14:07:57 +02:00
MageKing17 74d270270e Merge pull request #1397 from ngld/fix_shockwave_load
Fix "Error: Can't open model file <shockwave.pof>" on second mission load
2017-06-29 14:36:00 -07:00
ngld df69d195fe Fix "Error: Can't open model file <shockwave.pof>" on second mission load 2017-06-29 21:10:56 +02:00
Goober5000 6c871ac339 better handling of positive/negative discrepancy as well as finding sexp node arguments 2017-06-29 01:56:55 -04:00
Goober5000 24afebb808 instead of manually checking the sexp operator and argument number, just use the already-determined argument type 2017-06-28 19:10:14 -04:00
Fabian Woltermann 6aac8c7bde Merge pull request #1391 from asarium/fix/specialCharacterFontAssertion
Fix Assertion when default Volition font could not be found
2017-06-27 16:00:11 +02:00
asarium a2da77e14c Fix Assertion when default Volition font could not be found
Instead, this will now cause a Warning when the issue is detected while
parsing the table and an Error when it still occurs at runtime.
2017-06-27 11:56:20 +02:00
Fabian Woltermann 7ca6b679b7 Merge pull request #1390 from asarium/fix/luaWhitespace
Ignore leading whitespace for gr.drawString
2017-06-27 09:36:46 +02:00
asarium 3d6bbb0b9b Ignore leading whitespace for gr.drawString
This was reported by @AxemP who wanted to have leading tabs in a text
line. However, split_str removed those characters by default since it
ignores leading whitespace. To fix that unexpected behavior of
gr.drawString I added a new paramter to split_str which disabled
whitespace removal and enabled that flag for the scripting function.

That should not be a problem for existing scripts since the expected
behavior would be that leading whitespace remains in place and since we
have not received any bug reports about missing white space I'm going to
assume that no one has used the function like this before removed those
characters by default since it ignores leading whitespace. To fix that
unexpected behavior of gr.drawString I added a new paramter to split_str
which disabled whitespace removal and enabled that flag for the
scripting function.

That should not be a problem for existing scripts since the expected
behavior would be that leading whitespace remains in place and since we
have not received any bug reports about missing white space I'm going to
assume that no one has used the function like this before.
2017-06-25 17:19:40 +02:00
asarium a912956601 Use GitHub prebuilt URL 2017-06-24 13:33:09 +02:00
m!m a769a7ef87 Merge pull request #1388 from Goober5000/sexp_targeted_fix
fix an old Volition bug in the targeted sexp
2017-06-24 09:20:43 +02:00
m!m 991e09006e Merge pull request #1387 from Goober5000/small_error_msg_fix
Small improvement in error messages in stuff_int_list and mark_int_list
2017-06-24 09:17:01 +02:00
Goober5000 3e6c3f6f62 this actually affects subsystems too 2017-06-24 01:05:08 -04:00
Goober5000 2ee3dd70ea fix an old Volition bug in the targeted sexp 2017-06-24 00:56:25 -04:00
Goober5000 c259dfb9cd improve error messages 2017-06-23 23:32:57 -04:00
m!m 2947c7972d Merge pull request #1386 from MageKing17/bugfix/opengl-framebuffer-warning
Get rid of OpenGL warnings about the framebuffer being unsupported.
2017-06-22 08:44:39 +02:00
MageKing17 eda8c65b58 Get rid of OpenGL warnings about the framebuffer being unsupported.
At least on NVidia drivers, the medium-severity warning "Framebuffer unsupported. Framebuffer object Scene framebuffer is unsupported because the depth and stencil attachments are mismatched." would get repeatedly output to the debug log. @SamuelCho suggested this change, which gets rid of the warnings and doesn't appear to have introduced any graphical glitches.

Fixes #1382.
2017-06-21 14:50:41 -07:00
m!m 186f8ff5b9 Merge pull request #1376 from z64555/cleanup/lua_reporting
Adds LUA versioning and copyright info to the scripting.html output
2017-06-21 08:45:40 +02:00
m!m c86c4c3822 Merge pull request #1385 from MageKing17/bugfix/message-shipnum-ship-vanish
Avoid faulty assumption in message bracket code.
2017-06-21 08:42:22 +02:00
m!m bea9d56feb Merge pull request #1384 from MageKing17/bugfix/collision-group-sexp
Fix removing a collision group via SEXP.
2017-06-21 08:41:41 +02:00
Goober5000 dc6d2be515 Merge pull request #1381 from Goober5000/fix_default_operator_for_modify_variable
Fix handling of arguments for sexps that use variables
2017-06-21 01:49:31 -04:00
Tyler Blount 298ec5519c Merge pull request #1383 from MageKing17/bugfix/profiling-category-duplicate
Fix duplicate tracing/profiling category.
2017-06-20 21:02:24 -06:00
MageKing17 7025e3443e Avoid faulty assumption in message bracket code.
This assertion could apparently be hit if a ship was vanished (e.g. with ship-vanish) in the middle of talking. Rather than making the vanishing code aware of (and responsible for) Message_shipnum, it seemed simpler to just make hud_show_message_sender() clear the invalid shipnum itself.
2017-06-20 19:20:41 -07:00
Tyler Blount 88b87b86fc Merge pull request #1378 from asarium/fix/fredHasShields
Fix inverted "Has shields" flag in initial status dialog
2017-06-20 19:54:05 -06:00
asarium b34ca3cfed Fix handling of inconsistent values in initial status editor
The flagset changes probably broke this behavior by not respecting the "inconsistent" value set by the OnInit function when ships have inconsistent values for a specific flag. This should fix that and restore the 3.7.4 behavior.
2017-06-20 20:01:57 +02:00
z64555 1b2eece53a Adds LUA versioning info to the scripting.html output
* Credits roll now grabs the LUA copyright info from liblua, instead of being hardcoded
* Credits roll now has LUA version info as well
2017-06-20 08:22:25 -05:00
Goober5000 e8313fa577 fix handling of arguments for sexps that use variables 2017-06-19 20:04:15 -04:00
asarium 5a8454e956 Fix inverted "Has shields" flag in initial status dialog 2017-06-17 18:18:12 +02:00
MageKing17 f6b1eaa846 Fix duplicate tracing/profiling category.
Cutscene audio decoding was accidentally named "FFmpeg decode video", causing some minor problems in the profiling code (because the same name is used for actual video decoding, resulting in an assertion firing).
2017-06-15 16:16:29 -07:00
MageKing17 d20ff9b367 Fix removing a collision group via SEXP.
sexp_manipulate_colgroup() was using logical NOT when it should've been using bitwise NOT, meaning that removing any collision group would remove all collision groups.
2017-06-15 15:49:51 -07:00
MageKing17 a3ab30cd96 Merge pull request #1374 from TRBlount/fix/lua_weapon_team
Make l_weapon use IFFs in Team var
2017-06-14 15:22:52 -07:00
TRBlount 48f76f7cd1 Fix l_weapon Team set var logic 2017-06-13 20:31:51 -06:00
MageKing17 eb165123ac Merge pull request #1371 from MageKing17/bugfix/3d-framebuffer-shockwaves
Fix combining 3D shockwaves with framebuffer shockwaves.
2017-06-10 14:33:13 -07:00
MageKing17 c30ce55942 Fix combining 3D shockwaves with framebuffer shockwaves.
If framebuffer shockwaves were enabled and a 3D shockwave was created, FSO would use a hardcoded reference to the second slot of the Shockwave_info vector to generate the framebuffer shockwave for it. This only makes sense if and only if:
- the 3D shockwave command-line flag is also enabled
- the default 3D shockwave and default 2D shockwave are both present and loaded
- its the first mission of the session (because after that any shockwave not in the 0th index got unloaded)

I've changed the code so that which index the default 2D shockwave got loaded into gets tracked and used instead of a hardcoded index... and if both default shockwaves are loaded, the first two Shockwave_info indices are both kept between missions instead of just the first. This should allow framebuffer shockwaves to work with 3D shockwaves, regardless of whether or not it's the first mission of the session and whether or not a custom 2D shockwave was loaded (and happened to wind up at index 1). Slight downside in that missing the default 2D shockwave file, but having a custom 2D shockwave loaded, will now result in framebuffer shockwaves not being drawn at all, rather than using the custom 2D shockwave by accident; not sure that's really all that much of a problem, though.
2017-06-10 10:38:02 -07:00
m!m 9447d74da8 Merge pull request #1367 from Goober5000/invisible_beam_section_fix
Invisible beam section fix
2017-06-09 23:51:31 +02:00
Goober5000 043e6a79a8 remove debug conditions when we are not in debug mode 2017-06-09 12:55:32 -04:00
Goober5000 97416feb2a Merge pull request #1368 from asarium/fix/1366
Remove abort call from debug_int3
2017-06-09 12:48:27 -04:00
asarium aac3bbde8e Remove abort call from debug_int3
This fixes #1366.
2017-06-09 10:19:48 +02:00
Goober5000 8f3ef45fc9 don't remove invisible beam sections 2017-06-08 22:18:02 -04:00
Goober5000 762997fc7d copy over more verbose assertions from light_add_cone 2017-06-08 22:17:24 -04:00
MageKing17 43a46641eb Merge pull request #1364 from The-E/UnknownShips
Handle ships removed from play via ship-vanish correctly in ai goal processing
2017-06-05 20:58:40 -07:00
Fabian Woltermann 47bd990bca Handle ships removed from play via ship-vanish correctly in ai goal processing. 2017-06-05 15:00:10 +02:00
m!m ec3313ffea Merge pull request #1363 from MageKing17/bugfix/generic-anim-static-png
Reset generic animation type to BM_TYPE_NONE if APNG processing fails.
2017-06-04 09:40:27 +02:00
MageKing17 f2c099a7a9 Reset generic animation type to BM_TYPE_NONE if APNG processing fails.
Prior to APNG support, a regular non-animated PNG could be used as a still-frame command briefing animation. This started causing a crash when APNG support was added because any PNGs sent through generic_anim_stream() would get ga->type set to BM_TYPE_PNG, then sent through the APNG code... which would determine that they weren't APNGs, throw an ApngException, and generic_anim_stream() would return -1... except that BM_TYPE_PNG would still be set, so that when it later came time to render the still frame in generic_frame_render(), it would be sent through generic_anim_render_variable_frame_delay()... which expected a fully-formed APNG, tried to dereference ga->png.anim, and crashed.

This commit is a simple fix to reset ga->type to BM_TYPE_NONE if APNG processing fails, allowing the still-frame PNG to go through generic_anim_render_fixed_frame_delay(), the code path it used to take, and allowing it to display properly instead of crashing.
2017-06-03 22:07:52 -07:00
Fabian Woltermann e6c6cc3864 Merge pull request #1352 from asarium/feature/trackIr64bit
Use TrackIR DLL with 64 suffix when compiling a 64-bit build
2017-06-02 11:10:42 +02:00
m!m 5ee1b6d243 Merge pull request #1362 from MageKing17/cleanup/shockwave-vector-usage
Cleaning up the shockwave code's use of vectors and assertions.
2017-06-01 21:24:28 +02:00
MageKing17 3577c005e2 Merge pull request #1357 from asarium/fix/openglIncludes
Remove include of OpenGL header in non-OpenGL code
2017-06-01 12:11:09 -07:00
MageKing17 b2891bfe21 Merge pull request #1361 from MageKing17/bugfix/auto-convergence-min-distance
Allow "+Minimum Distance:" to actually work with automatic convergence.
2017-06-01 12:10:32 -07:00
MageKing17 82aa027d0d Cleaning up the shockwave code's use of vectors and assertions.
After someone tripped an assertion in the shockwave code which provided no details, I found some... questionable vector-related code. I changed all the code I could find that looped through the vector with iterator-based code, converted most Asserts into Assertions for more informative debugging, and added a couple Assertions to check previously-unchecked assumptions (which theoretically should never be tripped, but we'll see). A test build with the vector fixes resulted in the assertion no longer tripping so I'm fairly sure the improper erasure of the vector was causing problems (leftover data from a previous mission with a model number that no longer made sense because the model was unloaded).
2017-06-01 11:38:44 -07:00
MageKing17 902d40f3df Allow "+Minimum Distance:" to actually work with automatic convergence.
The gun convergence code would detect if the target was within the minimum distance and move the predicted target point farther away if so, but wouldn't also alter the dist_to_aim variable to match; since predicted_target_pos is used by the autoaim code while dist_to_aim is what automatic convergence uses, this meant automatic convergence didn't respect the minimum distance at all.

Looks like this was broken in 7bb10d8408.
2017-05-30 09:52:27 -07:00
m!m e82fc4ac2f Merge pull request #1359 from MageKing17/bugfix/rearm-loading-start-sounds
Allow rearm start sound effects to actually play.
2017-05-29 11:41:51 +02:00
MageKing17 71673241fd Allow rearm start sound effects to actually play.
SND_MISSILE_START_LOAD and SND_BALLISTIC_START_LOAD (indices 33 and 200, respectively) could never actually play due to a logic error (they checked that a variable was true and the loop was on the last bank, when those conditions being met earlier in the function set that same variable to false). As far as I can tell, this broke back in 2006 with commit f300716e93.
2017-05-29 01:40:13 -07:00
Fabian Woltermann f93cb23d43 Merge pull request #1358 from asarium/fix/fastDebugDebugging
Use correct variable when copying linker flags to fast debug
2017-05-29 09:48:36 +02:00
asarium 0415b69407 Use correct variable when copying linker flags to fast debug
This broke the release debugging flag for fast debug which should be
fixed by these changes.
2017-05-29 09:19:18 +02:00
asarium e4775948d7 Remove include of OpenGL header in non-OpenGL code 2017-05-28 10:35:33 +02:00
asarium 8958de35bc Use TrackIR DLL with 64 suffix when compiling a 64-bit build
This should make it possible to have both DLL version installed at the
same time without causing conflicts.

Combined with the new DLL, this will finally fix #974.
2017-05-18 10:52:25 +02:00
m!m c03dbea7ea Merge pull request #1349 from MageKing17/bugfix/avoid-rank-int3
Avoid Int3() when finding a rank with an out-of-order points value.
2017-05-18 09:11:12 +02:00
MageKing17 9107da8c9c Merge pull request #1351 from asarium/fix/1350
Readd warning dialog counting
2017-05-17 09:55:06 -07:00
MageKing17 1abb1833aa Avoid Int3() when finding a rank with an out-of-order points value.
There's a bit of debug code that checks to make sure all ranks are in ascending point order; if this check fails, FSO calls Int3() instead of trying to describe the problem. I've changed it to a Warning that actually explains the problem, so the modder can fix it.
2017-05-17 09:03:32 -07:00
asarium a2e70b8c5c Readd warning dialog counting
This fixes #1350.
2017-05-17 17:14:12 +02:00
Fabian Woltermann 1029de8073 Merge pull request #1348 from asarium/fix/hudReticleInt3
Remove unneded Int3 in hudreticle.cpp
2017-05-07 17:57:32 +02:00
asarium 3abcb24815 Remove unneded Int3 in hudreticle.cpp
The code works perfectly find without it and it causes issues with a
release campaign so there is no reason to keep it.
2017-05-07 17:20:48 +02:00
m!m 13d68bdfc6 Merge pull request #1347 from MageKing17/bugfix/cmdline-double-parse
Stop parsing cmdline_fso.cfg twice in legacy mode.
2017-05-06 12:05:19 +02:00
Fabian Woltermann de0bbaa4f6 Merge pull request #1339 from asarium/fix/mantis3195
Revert bad fix for Coverity issue
2017-05-06 11:35:39 +02:00
MageKing17 ce569d400e Stop parsing cmdline_fso.cfg twice in legacy mode.
os_init_cmdline() contains the legacy-mode codepath in a conditional, but then doesn't put the non-legacy mode code in an else branch, resulting in cmdline_fso.cfg getting processed twice, leading to e.g. every mod getting loaded twice (which can cause all kinds of issues). This just wraps the non-legacy code in an else branch so that FSO running in legacy mode won't do both.
2017-05-05 17:23:02 -07:00
MageKing17 adb94dc4d2 Merge pull request #1346 from The-E/anim_load_fix
Adds a small sanity check after reading an ani header
2017-05-05 01:17:36 -07:00
MageKing17 916082d910 Merge pull request #1345 from asarium/fix/1344
Save mission flags using correct format specifier
2017-05-05 01:16:36 -07:00
Fabian Woltermann e52f23d45d Adds a small sanity check after reading an ani header 2017-05-04 19:18:06 +02:00
asarium 2dfc086c94 Add unit test for checking numeric conversions 2017-05-02 11:47:21 +02:00
asarium 0a53aff061 Clean up flagset handling of numeric values
This renames the functions exposed by flagset so that it's clear that
64-bit values are returned. This also cleans up usages of wrong format
specified when that value is printed which caused some issues in the
past.

This should also fix #1336.
2017-05-02 10:28:29 +02:00
asarium 2dab381e88 Save mission flags using correct format specifier
The current version simply writes the flagset object as an integer to
the mission file which surely will cause issues.

This fixes #1344.
2017-05-02 09:57:19 +02:00
MageKing17 83514409f3 Merge pull request #1334 from asarium/fix/laserParticleEffect
Fix assertion when applying particle effect to laser
2017-04-26 09:57:08 -07:00
Cliff Gordon 340f39f44d Merge pull request #1343 from asarium/build/appveyorFTPKeys
Fix encrypted login data for appveyor FTP upload
2017-04-26 07:40:24 -05:00
m!m 418a944127 Merge pull request #1341 from chief1983/fix/solaris_math_h
Fix several issues blocking a Solaris compile
2017-04-26 10:19:33 +02:00
asarium 22180c0b45 Fix encrypted login data for appveyor FTP upload
I encrypted those values using my user instead of our SirKnightly
account which meant that the values failed to decrypt. These new values
were encrypted using the SirKnightly user which should allow Appveyor to
upload the nightly builds to our FTP servers.
2017-04-26 10:15:11 +02:00
Cliff Gordon 2949ca2628 Merge pull request #1342 from asarium/build/ftpNightlies
Upload nightly builds to FTP instead of BinTray
2017-04-25 13:54:43 -05:00
asarium dbf952e031 Upload nightly builds to FTP instead of BinTray
Since BinTray may be unreliable as our nightly host @chief1983 and I
decided that it would be best to return hosting to our dedeicated FTP
servers. These changes implement that together with a pending pull
request for the nightly script.
2017-04-25 19:55:34 +02:00
m!m 21cc93ffd6 Merge pull request #1340 from asarium/fix/bintrayKeys
Update BinTray API keys
2017-04-24 20:32:38 +02:00
m!m c06ed08e74 Merge pull request #1338 from MageKing17/bugfix/duplicate-percent-signs
Get rid of duplicate percent signs in the statistics screen.
2017-04-24 20:02:47 +02:00
asarium 89a9932ac5 Update BinTray API keys
While searching for the cause of the rate-limiting of our BinTray
organization, I revoked the API key used by the CI servers in case the
key got compromised somehow. These are the updated keys which should
allow us to upload nightly builds again.

@chief1983 and I are working on a nightly solution which does not
require BinTray but until that works we need these updated keys.
2017-04-24 19:49:22 +02:00
asarium 5b1285e608 Revert bad fix for Coverity issue
fa60c666bc tried to fix an issue reported
by Coverity which was an intentional "issue". This restores the original
behavior which will cause a new coverity issue which can be ignored.

This fixes Mantis 3195.
2017-04-24 11:16:11 +02:00
MageKing17 d5d33379a3 Get rid of duplicate percent signs in the statistics screen.
The problem was caused by an oversight in 07107ce9b2 (namely, that changing some strings from being passed directly to string-formatting to being passed as arguments to a "%s" format-specifier meant that "%%" was no longer needed to get a plain "%" out the other side).
2017-04-23 10:42:25 -07:00
Cliff Gordon accbc1d25d See if this helps with the linking errors for libsocket and libnsl symbols. 2017-04-21 15:12:15 -05:00
Cliff Gordon 8acff8e02c Add the INTEL_LONG define that was added to the other two blocks last year but not to Solaris. 2017-04-21 14:26:13 -05:00
Cliff Gordon 89d13ab774 fix/solaris_math_h: Attempt to work around the version symbol conflict. 2017-04-21 14:08:54 -05:00
m!m 8850efce7f Merge pull request #1333 from oldlaptop/openbsd
Fix the build on OpenBSD
2017-04-16 10:34:56 +02:00
oldlaptop 4b36e3c379 add platform check for std::is_trivially_copyable
Yes, the template instantiation appears necessary for cmake to
 detect the type. If there's a better type for it than int, I'm
 open to suggestions.
2017-04-15 22:06:47 -04:00
asarium c008dfc303 Fix assertion when applying particle effect to laser
The weapon state value of the weapon was updated after the particle
source was created so the source was always invalid which caused an
assertion.
2017-04-14 23:50:12 +02:00
oldlaptop 8f76537b02 s/_L/L_State
The iterator known as _L, besides having an absurdly poor name,
 clashes with standard headers on OpenBSD -current at the time
 of writing. This commit is the minimum needed to build on
 OpenBSD with an updated C++ standard library.
2017-04-13 09:06:48 -04:00
m!m 36ae38a532 Merge pull request #1330 from niffiwan/fix/1329
Tweak autodraw shield bar positions
2017-04-04 09:47:25 +02:00
niffiwan bcf49b9630 Fix const var names & style 2017-04-04 17:10:03 +10:00
niffiwan 654f3545fc Tweak autodraw shield bar positions
See #1329, this makes the rear shields slightly further away from the
front, so that the model clip area matches the area where the shields
are drawn.
2017-04-03 20:10:05 +10:00
74 changed files with 841 additions and 458 deletions

No files matched your search

+23 -14
View File
@@ -23,6 +23,19 @@ addons:
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 FS2DOWNLOADS_USER and FS2DOWNLOADS_PASSWORD
- secure: "h6GbMX2jLsW1bS9fCM9fthOSJ1nfQQIRWi6EUH2p8u4NFLD5Bfi/C8JhQPKHUzyo3wvKkSHl+PsW7bgr1oXLusRwAur/dtv2N3imqvtbfIz305b00hZlsvbcYmQmUzQFSAdOGShK57JJ5aKQKccaUBP25KqB7Q+JaqBRdaMBS54="
- secure: "fUDAPAUUaaYZy8I4zU3SJ0JcK7aw4eb6eTdaEr7LyNyTMSfPgwY6P1MrbSQC0lJNQIUQ5ffjdxE5g7D7OYpoJF9L14ni4UY8t2QASt7kmpgcYihmjeuYy8FQXgmFG8CTxiWBPKTybZJ7voQcvIvRaNG7b2wM9PMfc5lRIondB6c="
deploy:
- provider: releases
api_key:
@@ -34,21 +47,19 @@ deploy:
condition: '"$RELEASE_BUILD" == true'
tags: true
- provider: bintray
user: sirknightly
key:
secure: "CZtvDW/zPf1Nxru21i8Wd+9hgiBRA8VowWBX0gmCOGgRq9WHISttKQQmBWGHuyVZ3rYvtE4Va2bR+2qRN+TFNkUUuOCOQkdBJTCal9nS3G/LprEmsOashG0Q5PTfMMBnlKzKxaxGJW6UhFj2GySmHEAjsFLVpuNWGJeeZgZQ3UE="
file: ci/bintray.json
- provider: script
script: bash ci/travis/ftp_deploy.sh
on:
condition: '"$NIGHTLY_BUILD" == true'
tags: true
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="
- 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
@@ -111,5 +122,3 @@ before_script:
- "./ci/travis/before_script.sh"
script:
- if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi
before_deploy:
- "./ci/travis/before_deploy.sh"
+32 -10
View File
@@ -25,15 +25,37 @@ deploy:
on:
ReleaseBuild: true # deploy on release push only
- provider: BinTray
username: sirknightly
api_key:
secure: pYWqfiZhIWvFYdjVWPXNaHobmnkXIWa4+LwoiyMTEiu4Z0CiCAW0ZrMfTKVkORKz
subject: scp-fs2open
repo: FSO
package: nightly
version: $(VersionName)
publish: true
override: true
- 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: ftp
host: swc.fs2downloads.com
username:
secure: EXg2ADoKzMduZF90ip2Q0g==
password:
secure: x0LL0uY9yBAQ7JTARhQ6AA==
folder: swc.fs2downloads.com/builds/nightly/$(VersionName)
beta: true
on:
NightlyBuild: true # deploy on nightly push only
- provider: FTP
protocol: ftp
host: swc.fs2downloads.com
username:
secure: EXg2ADoKzMduZF90ip2Q0g==
password:
secure: x0LL0uY9yBAQ7JTARhQ6AA==
folder: swc.fs2downloads.com/builds/test/$(VersionName)
beta: true
on:
TestBuild: true # deploy on test build push only
+34 -5
View File
@@ -4,6 +4,7 @@ class BuildConfig {
[string]$PackageType
[string]$Toolset
[string]$SimdType
[Bool]$SourcePackage
}
$NightlyConfigurations = @(
@@ -12,12 +13,14 @@ $NightlyConfigurations = @(
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
SourcePackage=$false;
},
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
SourcePackage=$false;
}
)
$ReleaseConfigurations = @(
@@ -26,24 +29,28 @@ $ReleaseConfigurations = @(
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
SourcePackage=$true;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32-AVX";
Toolset="v140_xp";
SimdType="AVX";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64-AVX";
Toolset="v140_xp";
SimdType="AVX";
SourcePackage=$false;
}
)
@@ -52,16 +59,21 @@ $BuildConfigurations = $null
# Default values
$ReleaseBuild = $false
$NightlyBuild = $false
$DeployBuild = $false
$TestBuild = $false
if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)")) {
# 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 ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)")) {
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])"
@@ -69,19 +81,31 @@ if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REP
$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
}
Write-Host "$buildID"
if ($ReleaseBuild -Or $NightlyBuild) {
$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
@@ -94,6 +118,11 @@ if ($DeployBuild) {
}
$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)" `
+1 -1
View File
@@ -1,5 +1,5 @@
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild)) {
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 {
+20 -1
View File
@@ -2,6 +2,8 @@
RELEASE_BUILD=false
NIGHTLY_BUILD=false
TEST_BUILD=false
BUILD_DEPLOYMENT=false
BUILD_CONFIGS="Release FastDebug"
VERSION_NAME=""
@@ -9,10 +11,12 @@ 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!";
@@ -25,8 +29,22 @@ if [ "$NIGHTLY_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $NIGHTLY_PATTERN ]]; then
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
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ]); then
# 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
@@ -44,6 +62,7 @@ fi
export RELEASE_BUILD
export NIGHTLY_BUILD
export TEST_BUILD
export BUILD_DEPLOYMENT
export BUILD_CONFIGS
export VERSION_NAME
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -e
set -u
if [[ ! "$(curl -V)" == *"sftp"* ]]; then
# Before
echo "Before:"
curl -V
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# 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
sudo dpkg -i curl*.deb
sudo dpkg -i libcurl3*.deb
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew install curl --with-libssh2
export PATH="/usr/local/opt/curl/bin:$PATH"
fi
# After
echo "After:"
curl -V
fi
cd /tmp/builds
for file in *; do
if [ "$TEST_BUILD" = true ]; then
# Upload to fs2downloads
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/test/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_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 fs2downloads
curl -k "ftp://swc.fs2downloads.com/swc.fs2downloads.com/builds/nightly/$VERSION_NAME/" --user "$FS2DOWNLOADS_USER:$FS2DOWNLOADS_PASSWORD" -T "$file" --ftp-create-dirs
fi
done
+5
View File
@@ -4,6 +4,11 @@ set -ex
mkdir -p /tmp/builds
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ "$RELEASE_BUILD" = true ]; then
PARENT_DIR="$(basename $PWD)"
(cd .. && tar cvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
fi
cd build
for config in $BUILD_CONFIGS
do
+16
View File
@@ -1,2 +1,18 @@
target_compile_definitions(platform INTERFACE SCP_SOLARIS)
find_library(SOCKET_LIB socket)
if (NOT SOCKET_LIB)
message(FATAL_ERROR "Couldn't find libsocket! Please install it and rerun the configuration.")
else()
target_link_libraries(platform INTERFACE "${SOCKET_LIB}")
endif()
find_library(NSL_LIB nsl)
if (NOT NSL_LIB)
message(FATAL_ERROR "Couldn't find libnsl! Please install it and rerun the configuration.")
else()
target_link_libraries(platform INTERFACE "${NSL_LIB}")
endif()
+10
View File
@@ -7,6 +7,7 @@ include(CheckLibraryExists)
include(CheckPrototypeDefinition)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckCXXSymbolExists)
include(CheckTypeSize)
CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
@@ -14,10 +15,19 @@ CHECK_INCLUDE_FILE_CXX("cxxabi.h" HAVE_CXXAPI_H)
CHECK_TYPE_SIZE("max_align_t" MAX_ALIGN_T)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_REQUIRED_FLAGS "-std=c++11") # required for g++ <= 5
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_EXTRA_INCLUDE_FILES "cstddef")
CHECK_TYPE_SIZE("std::max_align_t" STD_MAX_ALIGN_T LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES "type_traits")
CHECK_TYPE_SIZE("std::is_trivially_copyable<int>" STD_IS_TRIVIALLY_COPYABLE LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_REQUIRED_FLAGS)
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
+2
View File
@@ -8,6 +8,8 @@
#cmakedefine HAVE_MAX_ALIGN_T
#cmakedefine HAVE_STD_MAX_ALIGN_T
#cmakedefine HAVE_STD_IS_TRIVIALLY_COPYABLE
#cmakedefine01 IS_64BIT
#cmakedefine01 HAVE_STRCASECMP
+1 -1
View File
@@ -20,7 +20,7 @@ ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Copy release settings to FastDebug
set(CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_FASTDEBUG "${CMAKE_EXE_LINKER_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_FASTDEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_STATIC_LINKER_FLAGS_FASTDEBUG "${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
if (MSVC)
+3 -3
View File
@@ -3814,7 +3814,7 @@ float ai_path_0()
int path_num;
Assert(aip->active_goal >= 0);
ai_goal *aigp = &aip->goals[aip->active_goal];
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aigp->dockee.index);
ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0);
@@ -3957,7 +3957,7 @@ float ai_path_1()
int path_num;
Assert(aip->active_goal >= 0);
ai_goal *aigp = &aip->goals[aip->active_goal];
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aigp->dockee.index);
ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0);
@@ -10399,7 +10399,7 @@ void ai_get_dock_goal_indexes(object *objp, ai_info *aip, ai_goal *aigp, object
{
// get them from the active goal
Assert(aigp != NULL);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
docker_index = aigp->docker.index;
dockee_index = aigp->dockee.index;
Assert(docker_index >= 0);
+1 -1
View File
@@ -1640,7 +1640,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
else
{
Int3(); // get ALLENDER
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n", Ships[objp->instance].ship_name, aigp->target_name));
status = SHIP_STATUS_UNKNOWN;
}
}
+10 -1
View File
@@ -733,6 +733,10 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
anim_read_header(ptr, fp);
if (ptr->width < 0 || ptr->height < 0) {
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", name);
}
if(ptr->num_keys > 0){
ptr->keys = (key_frame*)vm_malloc(sizeof(key_frame) * ptr->num_keys);
Assert(ptr->keys != NULL);
@@ -761,7 +765,7 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
}
// couldn't memory-map file... must be in a packfile, so stream manually
if ( file_mapped && !ptr->cfile_ptr ) {
if ( file_mapped == PAGE_FROM_MEM && !ptr->cfile_ptr ) {
ptr->flags &= ~ANF_MEM_MAPPED;
ptr->flags |= ANF_STREAMED;
ptr->cfile_ptr = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
@@ -969,6 +973,11 @@ void anim_display_info(char *real_filename)
}
anim_read_header(&A, fp);
if (A.width < 0 || A.height < 0) {
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", filename);
}
// read the keyframe frame nums and offsets
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
Assert(key_frame_nums != NULL);
+3 -4
View File
@@ -40,9 +40,8 @@ typedef struct {
enum
{
PAGE_FROM_MEM = 0,
PAGE_FROM_DISK = 1,
PAGE_FROM_DISK_FORCED = 2
PAGE_FROM_DISK = 0,
PAGE_FROM_MEM = 1
};
extern int Anim_paused;
@@ -59,7 +58,7 @@ int anim_stop_playing(anim_instance* anim_instance);
int anim_show_next_frame(anim_instance *instance, float frametime);
void anim_release_all_instances(int screen_id = 0);
void anim_release_render_instance(anim_instance* instance);
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_MEM);
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
int anim_free(anim *ptr);
int anim_playing(anim_instance *ai);
int anim_write_frames_out(char *filename);
+6 -2
View File
@@ -1568,8 +1568,12 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
vec3d tempv = dir_vec;
vm_vec_random_cone(&dir_vec, &tempv, (360.0f / total_roids / 2));
// Make the roid inherit half of the parent's velocity
vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
// Make the roid inherit half of parent's directional movement
if (!IS_VEC_NULL(&pasteroid_obj->phys_info.vel)) {
vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
} else {
vm_vec_rand_vec_quick(&parent_vel);
}
vm_vec_scale(&parent_vel, 0.5f);
// Make the hit position affect the direction, but only a little
+4
View File
@@ -1619,6 +1619,10 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
#endif
anim_read_header(&the_anim, img_cfp);
if (the_anim.width < 0 || the_anim.height < 0) {
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", real_filename);
}
anim_frames = the_anim.total_frames;
anim_fps = the_anim.fps;
if (anim_fps == 0) {
+20 -20
View File
@@ -987,32 +987,32 @@ void os_init_cmdline(int argc, char *argv[])
delete[] buf;
fclose(fp);
}
}
} else {
// parse user specific cmdline_fso config file (will supersede options in global file)
fp = fopen(os_get_config_path("data/cmdline_fso.cfg").c_str(), "rt");
// parse user specific cmdline_fso config file (will supersede options in global file)
fp = fopen(os_get_config_path("data/cmdline_fso.cfg").c_str(), "rt");
// if the file exists, get a single line, and deal with it
if ( fp ) {
char *buf, *p;
// if the file exists, get a single line, and deal with it
if ( fp ) {
char *buf, *p;
auto len = static_cast<int>(filelength( fileno(fp) )) + 2;
buf = new char [len];
auto len = static_cast<int>(filelength( fileno(fp) )) + 2;
buf = new char [len];
if (fgets(buf, len-1, fp) != nullptr)
{
// replace the newline character with a NULL
if ( (p = strrchr(buf, '\n')) != NULL ) {
*p = '\0';
}
if (fgets(buf, len-1, fp) != nullptr)
{
// replace the newline character with a NULL
if ( (p = strrchr(buf, '\n')) != NULL ) {
*p = '\0';
// append a space for the os_parse_parms() check
strcat_s(buf, len, " ");
os_process_cmdline(buf);
}
// append a space for the os_parse_parms() check
strcat_s(buf, len, " ");
os_process_cmdline(buf);
delete [] buf;
fclose(fp);
}
delete [] buf;
fclose(fp);
}
} // If cmdline included PARSE_COMMAND_LINE_STRING
+1 -1
View File
@@ -291,7 +291,7 @@ void main()
// Normal map - convert from DXT5nm
vec2 normalSample;
normal.rg = normalSample = (texture(sNormalmap, texCoord).ag * 2.0) - 1.0;
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
normal.b = clamp(sqrt(1.0 - dot(normal.rg, normal.rg)), 0.0001, 1.0);
normal = fragTangentMatrix * normal;
float norm = length(normal);
// prevent breaking of normal maps
+2 -2
View File
@@ -123,8 +123,8 @@ class flagset {
bool any_set() { return values.any(); }
bool none_set() { return values.none(); }
void from_long(std::uint64_t num) { values = num; }
std::uint64_t to_long() const { return values.to_ulong(); }
void from_u64(std::uint64_t num) { values = (unsigned long) num; }
std::uint64_t to_u64() const { return (std::uint64_t) values.to_ulong(); }
};
#define FLAG_LIST(Type) enum class Type : size_t
+1
View File
@@ -318,6 +318,7 @@ const size_t INVALID_SIZE = static_cast<size_t>(-1);
#ifdef SCP_SOLARIS // Solaris
#define INTEL_INT(x) x
#define INTEL_LONG(x) x
#define INTEL_SHORT(x) x
#define INTEL_FLOAT(x) (*x)
#elif BYTE_ORDER == BIG_ENDIAN
+1 -1
View File
@@ -10,7 +10,7 @@
#include "globalincs/pstypes.h"
#include "globalincs/version.h"
namespace version
namespace gameversion
{
bool check_at_least(int major, int minor, int build, int revision)
{
+1 -1
View File
@@ -36,7 +36,7 @@
#include "project.h"
namespace version
namespace gameversion
{
/**
* @brief Checks if the current version is at least the given version
+2 -1
View File
@@ -226,6 +226,7 @@ int generic_anim_stream(generic_anim *ga, const bool cache)
mprintf(("Failed to load apng: %s\n", e.what() ));
delete ga->png.anim;
ga->png.anim = nullptr;
ga->type = BM_TYPE_NONE;
return -1;
}
nprintf(("apng", "apng read OK (%ix%i@%i) duration (%f)\n", ga->png.anim->w, ga->png.anim->h,
@@ -322,8 +323,8 @@ void generic_anim_unload(generic_anim *ga)
if(ga->num_frames > 0) {
if(ga->streaming) {
if(ga->type == BM_TYPE_ANI) {
anim_free(ga->ani.animation);
free_anim_instance(ga->ani.instance);
anim_free(ga->ani.animation);
}
if(ga->type == BM_TYPE_EFF) {
if(ga->eff.next_frame >= 0)
+14 -11
View File
@@ -553,7 +553,7 @@ void gr_opengl_string_old(float sx, float sy, const char* s, const char* end, fo
break;
}
letter = font::get_char_width_old(fontData, s[0], s[1], &width, &spacing);
letter = font::get_char_width_old(fontData, (ubyte)s[0], (ubyte)s[1], &width, &spacing);
s++;
// not in font, draw as space
@@ -781,8 +781,14 @@ void gr_opengl_string(float sx, float sy, const char *s, int resize_mode, int in
if (specialChar) {
if (pass == 1) {
// We compute the top offset of the special character by aligning it to the base line of the string
// This is done by moving to the base line of the string by adding the ascender value and then
// accounting for the height of the text with the height of the special font
auto yOffset = nvgFont->getTopOffset() +
(nvgFont->getAscender() - nvgFont->getSpecialCharacterFont()->h);
gr_opengl_string_old(sx + x * scaleX,
sy + (y + nvgFont->getTopOffset()) * scaleY,
sy + (y + yOffset) * scaleY,
text,
text + 1,
nvgFont->getSpecialCharacterFont(),
@@ -793,24 +799,21 @@ void gr_opengl_string(float sx, float sy, const char *s, int resize_mode, int in
int width;
int spacing;
get_char_width_old(nvgFont->getSpecialCharacterFont(), *text, '\0', &width, &spacing);
get_char_width_old(nvgFont->getSpecialCharacterFont(), (ubyte)*text, (ubyte)*(text + 1), &width, &spacing);
x += spacing;
x += i2fl(spacing) * invscaleX;
}
else if (doRender) {
if (doRender && tokenLength > 0) {
float advance;
float currentX = x;
float currentX = x * scaleX;
float currentY = y + nvgFont->getTopOffset();
if (pass == 0) {
advance = path->text(currentX, currentY, text, text + tokenLength) - currentX;
}
else {
advance =
path->textBounds(currentX, currentY, text, text + tokenLength, nullptr) - currentX;
path->text(currentX, currentY, text, text + tokenLength);
}
advance = path->textBounds(0.f, 0.f, text, text + tokenLength, nullptr);
x += advance * invscaleX;
}
}
@@ -2198,8 +2201,8 @@ void gr_opengl_deferred_lighting_finish()
}
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, Scene_color_texture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, Scene_depth_texture, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
gr_end_view_matrix();
gr_end_proj_matrix();
+18 -5
View File
@@ -37,7 +37,7 @@ namespace font
float FSFont::getHeight() const
{
return this->getTextHeight() + this->offsetTop + this->offsetBottom;
return _height;
}
const SCP_string &FSFont::getName() const
@@ -45,13 +45,26 @@ namespace font
return this->name;
}
void FSFont::checkHeight() {
float height = this->getTextHeight() + this->offsetTop + this->offsetBottom;
void FSFont::computeFontMetrics() {
_height = this->getTextHeight() + this->offsetTop + this->offsetBottom;
if (height <= 1.0f)
// By default the base line of the font is also the lowest point of the font
_ascender = _height;
_descender = 0.0f;
checkFontMetrics();
}
void FSFont::checkFontMetrics() {
if (_height <= 1.0f)
{
Warning(LOCATION, "The height of font %s has an invalid height of %f, must be greater than one!",
getName().c_str(), height);
getName().c_str(), _height);
}
}
float FSFont::getAscender() {
return _ascender;
}
float FSFont::getDescender() {
return _descender;
}
}
+23 -2
View File
@@ -37,6 +37,12 @@ namespace font
float offsetTop; //!< The offset at the top of a line of text
float offsetBottom; //!< The offset at the bottom of a line of text
float _height;
float _ascender;
float _descender;
void checkFontMetrics();
public:
/**
@@ -92,7 +98,7 @@ namespace font
*
* @return The height.
*/
virtual float getHeight() const;
float getHeight() const;
/**
* @brief Gets the height of this font in pixels without the top and bottom offsets.
@@ -155,6 +161,21 @@ namespace font
*/
void setBottomOffset(float newOffset);
void checkHeight();
/**
* @brief Recomputes the font metrics
*/
virtual void computeFontMetrics();
/**
* @brief Gets the ascender value of this font
* @return The ascender value
*/
float getAscender();
/**
* @breif Gets the descender value of this font
* @return The descender value
*/
float getDescender();
};
}
+26 -15
View File
@@ -108,21 +108,7 @@ namespace font
float NVGFont::getTextHeight() const
{
auto path = graphics::paths::PathRenderer::instance();
path->saveState();
path->resetState();
path->fontFaceId(m_handle);
path->fontSize(m_size);
path->textLetterSpacing(m_letterSpacing);
float lineh;
path->textMetrics(nullptr, nullptr, &lineh);
path->restoreState();
return lineh;
return m_lineHeight;
}
extern int get_char_width_old(font* fnt, ubyte c1, ubyte c2, int *width, int* spacing);
@@ -189,6 +175,13 @@ namespace font
int charWidth;
int spacing;
if (m_specialCharacters == nullptr) {
Error(LOCATION,
"Font %s has no special characters font! This is usually caused by ignoring a font table parsing warning.",
getName().c_str());
}
get_char_width_old(m_specialCharacters, static_cast<ubyte>(*s), '\0', &charWidth, &spacing);
lineWidth += i2fl(spacing);
@@ -225,4 +218,22 @@ namespace font
path->restoreState();
}
void NVGFont::computeFontMetrics() {
auto path = graphics::paths::PathRenderer::instance();
path->saveState();
path->resetState();
path->fontFaceId(m_handle);
path->fontSize(m_size);
path->textLetterSpacing(m_letterSpacing);
path->textMetrics(&_ascender, &_descender, &m_lineHeight);
path->restoreState();
_height = m_lineHeight + this->offsetTop + this->offsetBottom;
checkFontMetrics();
}
}
+4
View File
@@ -16,6 +16,8 @@ namespace font
font* m_specialCharacters;
float m_lineHeight = 0.0f;
public:
NVGFont();
virtual ~NVGFont();
@@ -39,6 +41,8 @@ namespace font
virtual void getStringSize(const char *text, size_t textLen, int resize_mode,
float *width, float *height) const SCP_OVERRIDE;
void computeFontMetrics() override;
static size_t getTokenLength(const char *string, size_t maxLength);
};
}
+12 -3
View File
@@ -188,13 +188,22 @@ namespace
else
{
fo::font* fontData = FontManager::loadFontOld("font01.vf");
nvgFont->setSpecialCharacterFont(fontData);
if (fontData == nullptr) {
error_display(0,
"Failed to load default font \"%s\" for special characters of font \"%s\"! "
"This font is required for rendering special characters and will cause an error later.",
"font01.vf",
fontFilename.c_str());
} else {
nvgFont->setSpecialCharacterFont(fontData);
}
}
nvgFont->setName(fontStr);
// Make sure that the height is not invalid
nvgFont->checkHeight();
nvgFont->computeFontMetrics();
}
void parse_vfnt_font(const SCP_string& fontFilename)
@@ -291,7 +300,7 @@ namespace
font->setBottomOffset(temp);
}
// Make sure that the height is not invalid
font->checkHeight();
font->computeFontMetrics();
}
void font_parse_setup(const char *fileName)
+4
View File
@@ -7,7 +7,11 @@
#include <SDL_syswm.h>
#ifdef _WIN64
#define TRACKIRBRIDGEDLLNAME "scptrackir64.dll"
#else
#define TRACKIRBRIDGEDLLNAME "scptrackir.dll"
#endif
#define SCP_INITRESULT_SUCCESS 0
#define SCP_INITRESULT_BADKEY 1
-1
View File
@@ -950,7 +950,6 @@ void HudGaugeWeaponLinking::render(float frametime)
switch( num_banks ) {
case 0:
Int3();
gauge_index = -1;
break;
+6 -4
View File
@@ -590,14 +590,16 @@ void HudGaugeShield::showShields(object *objp, int mode)
vm_angles_2_matrix(&object_orient, &rot_angles);
gr_screen.clip_width = 112;
gr_screen.clip_height = 93;
const int CLIP_WIDTH = 112;
const int CLIP_HEIGHT = 93;
gr_screen.clip_width = CLIP_WIDTH;
gr_screen.clip_height = CLIP_HEIGHT;
//Fire it up
if(g3_yourself)
g3_start_frame(1);
hud_save_restore_camera_data(1);
setClip(sx, sy, 112, 93);
setClip(sx, sy, CLIP_WIDTH, CLIP_HEIGHT);
//if(!digitus_improbus)
g3_set_view_matrix( &sip->closeup_pos, &vmd_identity_matrix, sip->closeup_zoom * 2.5f);
@@ -707,7 +709,7 @@ void HudGaugeShield::showShields(object *objp, int mode)
//Ugh, draw four shield quadrants
static const int TRI_EDGE = 6;
static const int BAR_LENGTH = 112;
static const int BAR_HEIGHT = 54;
static const int BAR_HEIGHT = 63;
static const int BAR_WIDTH = 6;
static const int SHIELD_OFFSET = BAR_WIDTH + TRI_EDGE + 3;
+5 -1
View File
@@ -3289,7 +3289,11 @@ void hud_show_message_sender()
targetp = &Objects[Ships[Message_shipnum].objnum];
Assert ( targetp != NULL );
Assert ( targetp->type == OBJ_SHIP );
if (targetp->type != OBJ_SHIP) {
// if it's not a ship (maybe it got ship-vanished in the middle of talking) then clear Message_shipnum
Message_shipnum = -1;
return;
}
// Don't do this for the ship you're flying!
if ( targetp == Player_obj ) {
+49 -7
View File
@@ -52,6 +52,34 @@ static int joy_ff_has_valid_effects();
static int joy_ff_effect_playing(haptic_effect_t *eff);
static void joy_ff_start_effect(haptic_effect_t *eff, const char *name);
static void check_and_print_haptic_feature(uint32_t flags, uint32_t check_flag, const char* description) {
auto has_flag = (flags & check_flag) == check_flag;
mprintf((" Supports %s: %s\n", description, has_flag ? "true" : "false"));
}
static void print_haptic_support() {
mprintf((" Haptic feature support:\n"));
auto supported = SDL_HapticQuery(haptic);
check_and_print_haptic_feature(supported, SDL_HAPTIC_CONSTANT, "Constant effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_SINE, "Sine effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_LEFTRIGHT, "Left right effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_TRIANGLE, "Triangle effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_SAWTOOTHUP, "Sawtooth up effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_SAWTOOTHDOWN, "Sawtooth down effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_RAMP, "Ramp effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_SPRING, "Spring effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_DAMPER, "Damper effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_INERTIA, "Inertia effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_FRICTION, "Friction effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_CUSTOM, "Custom effect");
check_and_print_haptic_feature(supported, SDL_HAPTIC_GAIN, "global gain");
check_and_print_haptic_feature(supported, SDL_HAPTIC_AUTOCENTER, "Autocenter");
check_and_print_haptic_feature(supported, SDL_HAPTIC_STATUS, "Status query");
check_and_print_haptic_feature(supported, SDL_HAPTIC_PAUSE, "Pause effects");
}
int joy_ff_init()
{
int ff_enabled = 0;
@@ -118,6 +146,7 @@ int joy_ff_init()
mprintf((" Number of haptic axes: %d\n", SDL_HapticNumAxes(haptic)));
mprintf((" Number of effects supported: %d\n", SDL_HapticNumEffects(haptic)));
mprintf((" Number of simultaneous effects: %d\n", SDL_HapticNumEffectsPlaying(haptic)));
print_haptic_support();
mprintf((" ... Haptic successfully initialized!\n"));
@@ -130,6 +159,11 @@ void joy_ff_shutdown()
return;
}
if (pSpring.loaded) {
SDL_HapticStopEffect(haptic, pSpring.id);
}
joy_ff_stop_effects();
SDL_HapticClose(haptic);
haptic = NULL;
@@ -292,7 +326,7 @@ static int joy_ff_create_effects()
pAfterburn1.eff.periodic.direction.dir[0] = 0;
pAfterburn1.eff.periodic.length = SDL_HAPTIC_INFINITY;
pAfterburn1.eff.periodic.period = 20;
pAfterburn1.eff.periodic.magnitude = 0x6665;
pAfterburn1.eff.periodic.magnitude = 0x3332;
pAfterburn1.id = SDL_HapticNewEffect(haptic, &pAfterburn1.eff);
@@ -310,7 +344,7 @@ static int joy_ff_create_effects()
pAfterburn2.eff.periodic.direction.dir[0] = 9000;
pAfterburn2.eff.periodic.length = 125;
pAfterburn2.eff.periodic.period = 100;
pAfterburn2.eff.periodic.magnitude = 0x3332;
pAfterburn2.eff.periodic.magnitude = 0x1999;
pAfterburn2.id = SDL_HapticNewEffect(haptic, &pAfterburn2.eff);
@@ -416,7 +450,15 @@ void joy_ff_stop_effects()
return;
}
SDL_HapticStopAll(haptic);
joy_ff_afterburn_off();
if (pDeathroll1.loaded) {
SDL_HapticStopEffect(haptic, pDeathroll1.id);
}
if (pDeathroll2.loaded) {
SDL_HapticStopEffect(haptic, pDeathroll2.id);
}
}
void joy_ff_mission_init(vec3d v)
@@ -632,7 +674,7 @@ void joy_ff_docked()
SDL_HapticStopEffect(haptic, pDock.id);
pDock.eff.periodic.magnitude = 0x7fff;
pDock.eff.periodic.magnitude = 0x3332;
if ( SDL_HapticUpdateEffect(haptic, pDock.id, &pDock.eff) < 0 ) {
mprintf(("HapticERROR: Unable to update pDock:\n %s\n", SDL_GetError()));
@@ -653,7 +695,7 @@ void joy_ff_play_reload_effect()
SDL_HapticStopEffect(haptic, pDock.id);
pDock.eff.periodic.magnitude = 0x3fff;
pDock.eff.periodic.magnitude = 0x1999;
if ( SDL_HapticUpdateEffect(haptic, pDock.id, &pDock.eff) < 0 ) {
mprintf(("HapticERROR: Unable to update pDock:\n %s\n", SDL_GetError()));
@@ -674,7 +716,7 @@ void joy_ff_afterburn_on()
SDL_HapticStopEffect(haptic, pAfterburn1.id);
pAfterburn1.eff.periodic.length = SDL_HAPTIC_INFINITY;
pAfterburn1.eff.periodic.magnitude = 0x3fff;
pAfterburn1.eff.periodic.magnitude = 0x3332;
if ( SDL_HapticUpdateEffect(haptic, pAfterburn1.id, &pAfterburn1.eff) < 0 ) {
mprintf(("HapticERROR: Unable to update pAfterburn1:\n %s\n", SDL_GetError()));
@@ -685,7 +727,7 @@ void joy_ff_afterburn_on()
SDL_HapticStopEffect(haptic, pAfterburn2.id);
pAfterburn2.eff.periodic.length = SDL_HAPTIC_INFINITY;
pAfterburn2.eff.periodic.magnitude = 0x3fff;
pAfterburn2.eff.periodic.magnitude = 0x1999;
if ( SDL_HapticUpdateEffect(haptic, pAfterburn2.id, &pAfterburn2.eff) < 0 ) {
mprintf(("HapticERROR: Unable to update pAfterburn2:\n %s\n", SDL_GetError()));
+6 -10
View File
@@ -254,9 +254,6 @@ void light_add_point(const vec3d *pos, float r1, float r2, float intensity, floa
Assertion( r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1 );
Assertion( r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2 );
if (r1 < 0.0001f || r2 < 0.0001f)
return;
if(!specular){
spec_r = r;
spec_g = g;
@@ -298,8 +295,9 @@ void light_add_point(const vec3d *pos, float r1, float r2, float intensity, floa
void light_add_point_unique(const vec3d *pos, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
{
Assert(r1 >0);
Assert(r2 >0);
Assertion(r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1);
Assertion(r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2);
if(!specular){
spec_r = r;
spec_g = g;
@@ -341,8 +339,9 @@ void light_add_point_unique(const vec3d *pos, float r1, float r2, float intensit
// beams affect every ship except the firing ship
void light_add_tube(const vec3d *p0, const vec3d *p1, float r1, float r2, float intensity, float r, float g, float b, int affected_objnum, float spec_r, float spec_g, float spec_b, bool specular)
{
Assert(r1 >0);
Assert(r2 >0);
Assertion(r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1);
Assertion(r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2);
if(!specular){
spec_r = r;
spec_g = g;
@@ -1044,9 +1043,6 @@ void light_add_cone(const vec3d *pos, const vec3d *dir, float angle, float inner
Assertion( r1 > 0.0f, "Invalid radius r1 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r1 );
Assertion( r2 > 0.0f, "Invalid radius r2 specified for light: %f. Radius must be > 0.0f. Examine stack trace to determine culprit.\n", r2 );
if (r1 < 0.0001f || r2 < 0.0001f)
return;
if(!specular){
spec_r = r;
spec_g = g;
+2 -1
View File
@@ -28,6 +28,7 @@
#include "sound/audiostr.h"
#include "ui/ui.h"
#include <lua.h>
// This is the fs2_open credit list, please only add yourself if you have actually contributed code
@@ -97,7 +98,7 @@ const char *fs2_open_credit_text =
"Ogg Vorbis - (C) 2005, Xiph.Org Foundation\n"
"JPEG - Independent JPEG Group, (C) 1991-1998, Thomas G. Lane\n"
"libpng - Copyright (C) 1998-2010 Glenn Randers-Pehrson\n"
"liblua - Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
"liblua (" LUA_RELEASE ") - " LUA_COPYRIGHT "\n"
"zlib - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler\n"
"FXAA - Copyright (c) 2010 NVIDIA Corporation. All rights reserved.\n"
"This software uses libraries from the FFmpeg project under the LGPLv2.1\n"
+5 -4
View File
@@ -997,10 +997,11 @@ void options_menu_init()
// create slider
for ( i = 0; i < NUM_OPTIONS_SLIDERS; i++ ) {
Options_sliders[gr_screen.res][i].slider.create(&Ui_window, Options_sliders[gr_screen.res][i].x, Options_sliders[gr_screen.res][i].y,
Options_sliders[gr_screen.res][i].dots, Options_sliders[gr_screen.res][i].filename,
Options_sliders[gr_screen.res][i].hotspot, Options_sliders[gr_screen.res][i].left_filename, Options_sliders[gr_screen.res][i].left_mask, Options_sliders[gr_screen.res][i].left_x, Options_sliders[gr_screen.res][i].left_y,
Options_sliders[gr_screen.res][i].right_filename, Options_sliders[gr_screen.res][i].right_mask, Options_sliders[gr_screen.res][i].right_x, Options_sliders[gr_screen.res][i].right_y,
Options_sliders[gr_screen.res][i].dot_w);
Options_sliders[gr_screen.res][i].dots, Options_sliders[gr_screen.res][i].filename,
Options_sliders[gr_screen.res][i].hotspot,
Options_sliders[gr_screen.res][i].right_filename, Options_sliders[gr_screen.res][i].right_mask, Options_sliders[gr_screen.res][i].right_x, Options_sliders[gr_screen.res][i].right_y,
Options_sliders[gr_screen.res][i].left_filename, Options_sliders[gr_screen.res][i].left_mask, Options_sliders[gr_screen.res][i].left_x, Options_sliders[gr_screen.res][i].left_y,
Options_sliders[gr_screen.res][i].dot_w);
}
// maybe disable the skill slider
+1
View File
@@ -17,6 +17,7 @@
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "graphics/font.h"
#include "graphics/shadows.h"
#include "io/key.h"
#include "io/mouse.h"
#include "lighting/lighting.h"
-5
View File
@@ -748,11 +748,6 @@ void message_mission_free_avi(int m_index)
if ( (m_index < 0) || (m_index >= Num_message_avis) )
return;
// Make sure this code doesn't get run if the talking head guage is off
// helps prevent a crash on jump out if this code doesn't work right
if ( !hud_gauge_active(HUD_TALKING_HEAD) )
return;
generic_anim_unload(&Message_avis[m_index].anim_data);
}
+27 -7
View File
@@ -2409,7 +2409,8 @@ int parse_create_object_sub(p_object *p_objp)
}
}
if (Game_mode & GM_IN_MISSION) {
// If the ship is in a wing, this will be done in mission_set_wing_arrival_location() instead
if (Game_mode & GM_IN_MISSION && shipp->wingnum == -1) {
if (anchor_objnum >= 0)
Script_system.SetHookObjects(2, "Ship", &Objects[objnum], "Parent", &Objects[anchor_objnum]);
else
@@ -3035,7 +3036,13 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
parse_string_flag_list(p_objp->flags, Parse_object_flags, num_parse_object_flags, &unparsed);
if (!unparsed.empty()) {
for (size_t k = 0; k < unparsed.size(); ++k) {
WarningEx(LOCATION, "Unknown flag in parse object flags: %s", unparsed[k].c_str());
// catch typos or deprecations
if (!stricmp(unparsed[k].c_str(), "no-collide") || !stricmp(unparsed[k].c_str(), "no_collide")) {
p_objp->flags.set(Mission::Parse_Object_Flags::OF_No_collide);
}
else {
WarningEx(LOCATION, "Unknown flag in parse object flags: %s", unparsed[k].c_str());
}
}
}
}
@@ -6026,6 +6033,7 @@ void mission_parse_close()
void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
{
int index;
int anchor_objnum = -1;
// get the starting index into the ship_index array of the first ship whose location we need set.
@@ -6035,7 +6043,7 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
object *objp;
objp = &Objects[Ships[wingp->ship_index[index]].objnum];
mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(objp), wingp->arrival_path_mask, NULL, NULL);
anchor_objnum = mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(objp), wingp->arrival_path_mask, NULL, NULL);
index++;
}
@@ -6049,7 +6057,8 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
// or in front of some other ship.
index = wingp->current_count - num_to_set;
leader_objp = &Objects[Ships[wingp->ship_index[index]].objnum];
if (mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(leader_objp), wingp->arrival_path_mask, &pos, &orient) != -1) {
anchor_objnum = mission_set_arrival_location(wingp->arrival_anchor, wingp->arrival_location, wingp->arrival_distance, OBJ_INDEX(leader_objp), wingp->arrival_path_mask, &pos, &orient);
if (anchor_objnum != -1) {
// modify the remaining ships created
index++;
wing_index = 1;
@@ -6068,10 +6077,21 @@ void mission_set_wing_arrival_location( wing *wingp, int num_to_set )
}
}
// create warp effect if in mission and not arriving from docking bay
if ( (Game_mode & GM_IN_MISSION) && (wingp->arrival_location != ARRIVE_FROM_DOCK_BAY) ) {
if (Game_mode & GM_IN_MISSION) {
for ( index = wingp->current_count - num_to_set; index < wingp->current_count; index ++ ) {
shipfx_warpin_start( &Objects[Ships[wingp->ship_index[index]].objnum] );
object *objp = &Objects[Ships[wingp->ship_index[index]].objnum];
if (anchor_objnum >= 0)
Script_system.SetHookObjects(2, "Ship", objp, "Parent", &Objects[anchor_objnum]);
else
Script_system.SetHookObjects(2, "Ship", objp, "Parent", NULL);
Script_system.RunCondition(CHA_ONSHIPARRIVE, 0, NULL, objp);
Script_system.RemHookVars(2, "Ship", "Parent");
if (wingp->arrival_location != ARRIVE_FROM_DOCK_BAY) {
shipfx_warpin_start(objp);
}
}
}
}
+1
View File
@@ -23,6 +23,7 @@
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "graphics/2d.h"
#include "graphics/shadows.h"
#include "graphics/opengl/gropenglshader.h"
#include "hud/hudwingmanstatus.h"
#include "io/key.h"
+2 -7
View File
@@ -16,6 +16,7 @@
#include "gamehelp/contexthelp.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "graphics/shadows.h"
#include "hud/hudbrackets.h"
#include "io/mouse.h"
#include "io/timer.h"
@@ -2009,13 +2010,7 @@ void weapon_select_init()
WeaponSelectMaskBitmap = bm_load(Wl_loadout_select_mask[Uses_apply_all_button][gr_screen.res]);
if (WeaponSelectMaskBitmap < 0) {
if (gr_screen.res == GR_640) {
Error(LOCATION,"Could not load in 'weaponloadout-m'!");
} else if (gr_screen.res == GR_1024) {
Error(LOCATION,"Could not load in '2_weaponloadout-m'!");
} else {
Error(LOCATION,"Could not load in 'weaponloadout-m'!");
}
Error(LOCATION,"Could not load in '%s'!", Wl_loadout_select_mask[Uses_apply_all_button][gr_screen.res]);
}
Weaponselect_mask_w = -1;
+16 -19
View File
@@ -53,35 +53,35 @@ void parse_mod_table(const char *filename)
// start parsing
optional_string("#GAME SETTINGS");
if (optional_string("$Minimum version:")) {
int major = 0;
int minor = 0;
int build = 0;
int revision = 0;
required_string("+Major:");
stuff_int(&major);
required_string("+Minor:");
stuff_int(&minor);
required_string("+Build:");
stuff_int(&build);
if (optional_string("+Revision:")) {
stuff_int(&revision);
}
mprintf(("Game Settings Table: Parsed minimum version of %s\n", version::format_version(major, minor, build, revision).c_str()));
if (!version::check_at_least(major, minor, build, revision)) {
mprintf(("Game Settings Table: Parsed minimum version of %s\n", gameversion::format_version(major, minor, build, revision).c_str()));
if (!gameversion::check_at_least(major, minor, build, revision)) {
Error(LOCATION, "This modification needs at least version %s of FreeSpace Open. However, the current is only %s!",
version::format_version(major, minor, build, revision).c_str(),
version::format_version(FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_REVIS).c_str());
gameversion::format_version(major, minor, build, revision).c_str(),
gameversion::format_version(FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_REVIS).c_str());
}
}
optional_string("#CAMPAIGN SETTINGS");
if (optional_string("$Default Campaign File Name:")) {
@@ -215,19 +215,16 @@ void parse_mod_table(const char *filename)
Briefing_window_FOV = fov;
}
if (optional_string("$Generic Pain Flash Factor:")) {
if (optional_string("$Generic Pain Flash Factor:")) {
stuff_float(&Generic_pain_flash_factor);
if (Generic_pain_flash_factor != 1.0f)
mprintf(("Game Settings Table: Setting generic pain flash factor to %.2f\n", Generic_pain_flash_factor));
}
if (optional_string("$Shield Pain Flash Factor:")) {
if (optional_string("$Shield Pain Flash Factor:")) {
stuff_float(&Shield_pain_flash_factor);
if (Shield_pain_flash_factor != 0.0f)
mprintf(("Game Settings Table: Setting shield pain flash factor to %.2f\n", Shield_pain_flash_factor));
}
optional_string("#NETWORK SETTINGS");
@@ -343,7 +340,7 @@ void parse_mod_table(const char *filename)
}
void mod_table_init()
{
{
// first parse the default table
parse_mod_table(NULL);
-1
View File
@@ -10,7 +10,6 @@
#ifndef _MODELRENDER_H
#define _MODELRENDER_H
#include "graphics/opengl/gropengltnl.h"
#include "graphics/material.h"
#include "lighting/lighting.h"
#include "math/vecmat.h"
+7 -7
View File
@@ -972,7 +972,7 @@ void multi_ingame_handle_timeout()
void process_ingame_ships_packet( ubyte *data, header *hinfo )
{
int offset, team, j;
uint64_t oflags, sflags;
std::uint64_t oflags, sflags;
ubyte p_type;
ushort net_signature;
short wing_data;
@@ -1039,12 +1039,12 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
multi_set_network_signature( net_signature, MULTI_SIG_SHIP );
objnum = parse_create_object( p_objp );
ship_num = Objects[objnum].instance;
Objects[objnum].flags.from_long(oflags);
Objects[objnum].flags.from_u64(oflags);
Objects[objnum].net_signature = net_signature;
// assign any common data
strcpy_s(Ships[ship_num].ship_name, ship_name);
Ships[ship_num].flags.from_long(sflags);
Ships[ship_num].flags.from_u64(sflags);
Ships[ship_num].team = team;
Ships[ship_num].wingnum = (int)wing_data;
@@ -1132,8 +1132,8 @@ void send_ingame_ships_packet(net_player *player)
ADD_DATA( p_type );
ADD_STRING( shipp->ship_name );
ADD_USHORT( Objects[so->objnum].net_signature );
ADD_ULONG( shipp->flags.to_long() );
ADD_ULONG( Objects[so->objnum].flags.to_long() );
ADD_ULONG( shipp->flags.to_u64() );
ADD_ULONG( Objects[so->objnum].flags.to_u64() );
ADD_INT( shipp->team );
wing_data = (short)shipp->wingnum;
ADD_SHORT(wing_data);
@@ -1809,7 +1809,7 @@ void send_ingame_ship_update_packet(net_player *p,ship *sp)
// just send net signature, shield and hull percentages
objp = &Objects[sp->objnum];
ADD_USHORT(objp->net_signature);
ADD_ULONG(objp->flags.to_long());
ADD_ULONG(objp->flags.to_u64());
ADD_INT(objp->n_quadrants);
ADD_FLOAT(objp->hull_strength);
@@ -1853,7 +1853,7 @@ void process_ingame_ship_update_packet(ubyte *data, header *hinfo)
return;
}
// otherwise read in the ship values
lookup->flags.from_long(flags);
lookup->flags.from_u64(flags);
lookup->n_quadrants = n_quadrants;
GET_FLOAT(lookup->hull_strength);
for(idx=0;idx<n_quadrants;idx++){
+3 -3
View File
@@ -526,7 +526,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data
// flag
support_extra = 1;
PACK_BYTE( support_extra );
PACK_ULONG( Ai_info[shipp->ai_index].ai_flags.to_long() );
PACK_ULONG( Ai_info[shipp->ai_index].ai_flags.to_u64() );
PACK_INT( Ai_info[shipp->ai_index].mode );
PACK_INT( Ai_info[shipp->ai_index].submode );
@@ -940,7 +940,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
if(support_extra){
ushort dock_sig;
int ai_mode, ai_submode;
std::int64_t ai_flags;
std::uint64_t ai_flags;
// flag
GET_ULONG(ai_flags);
@@ -950,7 +950,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data)
// valid ship?
if((shipp != NULL) && (shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)){
Ai_info[shipp->ai_index].ai_flags.from_long(ai_flags);
Ai_info[shipp->ai_index].ai_flags.from_u64(ai_flags);
Ai_info[shipp->ai_index].mode = ai_mode;
Ai_info[shipp->ai_index].submode = ai_submode;
+2 -2
View File
@@ -4902,7 +4902,7 @@ void process_repair_info_packet(ubyte *data, header *hinfo)
ai_info *aip = &Ai_info[Ships[repair_objp->instance].ai_index];
Assert(aip->active_goal >= 0);
ai_goal *aigp = &aip->goals[aip->active_goal];
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid, AI::Goal_Flags::Docker_index_valid]);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
int docker_index = aigp->docker.index;
int dockee_index = aigp->dockee.index;
@@ -5020,7 +5020,7 @@ void send_ai_info_update_packet( object *objp, char what, object * other_objp )
// for docking, add the dock and dockee index
if (aigp->ai_mode & (AI_GOAL_DOCK | AI_GOAL_REARM_REPAIR)) {
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] || aigp->flags[AI::Goal_Flags::Docker_index_valid]);
Assert(aigp->flags[AI::Goal_Flags::Dockee_index_valid] && aigp->flags[AI::Goal_Flags::Docker_index_valid]);
Assert( (aigp->docker.index >= 0) && (aigp->docker.index < UCHAR_MAX) );
Assert( (aigp->dockee.index >= 0) && (aigp->dockee.index < UCHAR_MAX) );
docker_index = (ubyte) aigp->docker.index;
+22 -14
View File
@@ -357,23 +357,15 @@ namespace os
}
gr_activate(1);
}
void ReleaseWarning(const char* filename, int line, const char* format, ...)
{
Global_warning_count++;
// Actual implementation of the warning function. Used by the various warning functions
void WarningImpl(const char* filename, int line, const SCP_string& text)
{
filename = clean_filename(filename);
// output to the debug log before anything else (so that we have a complete record)
SCP_string formatMessage;
va_list args;
va_start(args, format);
vsprintf(formatMessage, format, args);
va_end(args);
SCP_string printfString = formatMessage;
SCP_string printfString = text;
std::transform(printfString.begin(), printfString.end(), printfString.begin(), replaceNewline);
mprintf(("WARNING: \"%s\" at %s:%d\n", printfString.c_str(), filename, line));
@@ -388,7 +380,7 @@ namespace os
}
SCP_stringstream boxMsgStream;
boxMsgStream << "Warning: " << formatMessage << "\n";
boxMsgStream << "Warning: " << text << "\n";
boxMsgStream << "File: " << filename << "\n";
boxMsgStream << "Line: " << line << "\n";
@@ -442,9 +434,25 @@ namespace os
gr_activate(1);
}
void ReleaseWarning(const char* filename, int line, const char* format, ...) {
Global_warning_count++;
SCP_string msg;
va_list args;
va_start(args, format);
vsprintf(msg, format, args);
va_end(args);
WarningImpl(filename, line, msg);
}
void Warning(const char* filename, int line, const char* format, ...)
{
Global_warning_count++;
#ifndef NDEBUG
SCP_string msg;
va_list args;
@@ -453,7 +461,7 @@ namespace os
vsprintf(msg, format, args);
va_end(args);
ReleaseWarning(filename, line, "%s", msg.c_str());
WarningImpl(filename, line, msg);
#endif
}
-5
View File
@@ -391,11 +391,6 @@ void debug_int3(const char *file, int line)
#endif
gr_activate(1);
// we have to call os_deinit() before abort() so we make sure that SDL gets
// closed out and we don't lose video/input control
os_deinit();
abort();
}
namespace os
+8 -8
View File
@@ -2857,7 +2857,7 @@ int stuff_int_list(int *ilp, int max_ints, int lookup_type)
break;
default:
Error(LOCATION,"Unknown lookup_type in stuff_int_list");
Error(LOCATION,"Unknown lookup_type %d in stuff_int_list", lookup_type);
break;
}
@@ -3079,7 +3079,7 @@ void mark_int_list(int *ilp, int max_ints, int lookup_type)
break;
default:
Error(LOCATION,"Unknown lookup_type in stuff_int_list");
Error(LOCATION,"Unknown lookup_type %d in mark_int_list", lookup_type);
break;
}
@@ -3438,7 +3438,7 @@ char *split_str_once(char *src, int max_pixel_w)
// returns: number of lines src is broken into
// -1 is returned when an error occurs
//
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char)
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char, bool strip_leading_whitespace)
{
char buffer[SPLIT_STR_BUFFER_SIZE];
const char *breakpoint = NULL;
@@ -3457,7 +3457,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
ignore_until_whitespace = 0;
// get rid of any leading whitespace
while (is_white_space(*src))
while (strip_leading_whitespace && is_white_space(*src))
src++;
new_line = 1;
@@ -3472,7 +3472,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
// starting a new line of text, init stuff for that
if (new_line) {
p_str[line_num] = NULL;
if (is_gray_space(*src))
if (strip_leading_whitespace && is_gray_space(*src))
continue;
p_str[line_num] = src;
@@ -3560,7 +3560,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str
return line_num;
}
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char)
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char, bool strip_leading_whitespace)
{
char buffer[SPLIT_STR_BUFFER_SIZE];
const char *breakpoint = NULL;
@@ -3574,7 +3574,7 @@ int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_ve
memset(buffer, 0, SPLIT_STR_BUFFER_SIZE);
// get rid of any leading whitespace
while (is_white_space(*src))
while (strip_leading_whitespace && is_white_space(*src))
src++;
p_str.clear();
@@ -3585,7 +3585,7 @@ int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_ve
// starting a new line of text, init stuff for that
if (new_line) {
if (is_gray_space(*src))
if (strip_leading_whitespace && is_gray_space(*src))
continue;
p_str.push_back(src);
+9 -4
View File
@@ -186,7 +186,12 @@ template<class T>
void stuff_flagset(T *dest) {
long l;
bool success = atol2(&l);
dest->from_long(l);
if (l < 0) {
error_display(0, "Expected flagset value but got negative value %lu!\n", l);
l = 0;
}
dest->from_u64((std::uint64_t) l);
if (!success)
skip_token();
@@ -196,7 +201,7 @@ void stuff_flagset(T *dest) {
if (*Mp == ',')
Mp++;
diag_printf("Stuffed flagset: %ld\n", dest->to_long());
diag_printf("Stuffed flagset: %" PRIu64 "\n", dest->to_u64());
}
extern int stuff_int_list(int *ilp, int max_ints, int lookup_type = RAW_INTEGER_TYPE);
@@ -262,8 +267,8 @@ extern void maybe_convert_foreign_characters(SCP_string &text);
extern size_t get_converted_string_length(const char *text);
extern size_t get_converted_string_length(const SCP_string &text);
char *split_str_once(char *src, int max_pixel_w);
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char = -1);
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char = -1);
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char = -1, bool strip_leading_whitespace = true);
int split_str(const char *src, int max_pixel_w, SCP_vector<int> &n_chars, SCP_vector<const char*> &p_str, char ignore_char = -1, bool strip_leading_whitespace = true);
// fred
extern int required_string_fred(char *pstr, char *end = NULL);
+41 -38
View File
@@ -1538,23 +1538,27 @@ int is_sexp_top_level( int node )
/**
* Find argument number
*/
int find_argnum(int parent, int arg)
int find_argnum(int parent_node, int arg_node)
{
int n, tally;
Assertion((parent_node >= 0) && (parent_node < Num_sexp_nodes), "find_argnum was passed an invalid parent!");
Assertion((arg_node >= 0) && (arg_node < Num_sexp_nodes), "find_argnum was passed an invalid child!");
n = CDR(parent);
n = CDR(parent_node);
tally = 0;
while (CAR(n) != arg)
while (n >= 0)
{
if (n == -1)
return -1;
// check if there is an operator node at this position which matches our expected node
if (CAR(n) == arg_node)
return tally;
tally++;
n = CDR(n);
}
return tally;
// argument node not found
return -1;
}
/**
@@ -15020,7 +15024,7 @@ int sexp_targeted(int node)
}
z = ship_name_lookup(CTEXT(node), 1);
if ((z < 0) || !Player_ai || (Ships[z].objnum != Player_ai->target_objnum)){
if ((z < 0) || !Player_ai || (Ships[z].objnum != Players_target)){
return SEXP_FALSE;
}
@@ -15031,7 +15035,7 @@ int sexp_targeted(int node)
}
if (CDR(CDR(node)) >= 0) {
ptr = Player_ai->targeted_subsys;
ptr = Players_targeted_subsys;
if (!ptr || subsystem_stricmp(ptr->system_info->subobj_name, CTEXT(CDR(CDR(node))))){
return SEXP_FALSE;
}
@@ -15047,7 +15051,7 @@ int sexp_node_targeted(int node)
CJumpNode *jnp = jumpnode_get_by_name(CTEXT(node));
if (jnp==NULL || !Player_ai || (jnp->GetSCPObjectNumber() != Player_ai->target_objnum)){
if (jnp==NULL || !Player_ai || (jnp->GetSCPObjectNumber() != Players_target)){
return SEXP_FALSE;
}
@@ -20433,8 +20437,7 @@ void sexp_string_set_substring(int node)
void sexp_debug(int node)
{
int i;
char *id;
char temp_buf[MESSAGE_LENGTH] = {""};
SCP_string warning_message;
#ifdef NDEBUG
int no_release_message;
@@ -20442,25 +20445,29 @@ void sexp_debug(int node)
#endif
node = CDR(node);
Assertion (node >= 0, "No message defined in debug SEXP");
id = CTEXT(node);
Assertion (node >= 0, "No message defined in debug SEXP");
// we'll suppose it's the string for now
warning_message = CTEXT(node);
// but use an actual message if one exists
for (i=0; i<Num_messages; i++) {
// find the message
if ( !stricmp(id, Messages[i].name) ) {
//replace variables if necessary
strcpy_s(temp_buf, Messages[i].message);
sexp_replace_variable_names_with_values(temp_buf, MESSAGE_LENGTH);
if ( !stricmp(Messages[i].name, warning_message.c_str()) ) {
warning_message = Messages[i].message;
break;
}
}
// replace variables if necessary
sexp_replace_variable_names_with_values(warning_message);
//send the message
#ifndef NDEBUG
Warning(LOCATION, "%s", temp_buf);
Warning(LOCATION, "%s", warning_message.c_str());
#else
if (!no_release_message) {
ReleaseWarning(LOCATION, "%s", temp_buf);
ReleaseWarning(LOCATION, "%s", warning_message.c_str());
}
#endif
}
@@ -22294,7 +22301,7 @@ void sexp_manipulate_colgroup(int node, bool add_to_group) {
if (add_to_group) {
colgroup_id |= (1<<group);
} else {
colgroup_id &= !(1<<group);
colgroup_id &= ~(1<<group);
}
}
@@ -25028,20 +25035,18 @@ int eval_sexp(int cur_node, int referenced_node)
if (sexp_val < 0)
{
int parent_node = find_parent_operator(cur_node);
int arg_num = find_argnum(parent_node, cur_node);
// make sure everything works okay
if (arg_num == -1)
// if the SEXP has no parent, the point is moot
if (parent_node >= 0)
{
SCP_string sexp_text;
convert_sexp_to_string(sexp_text, cur_node, SEXP_ERROR_CHECK_MODE);
Error(LOCATION, "Error finding sexp argument. Received value %d for sexp:\n%s", sexp_val, sexp_text.c_str());
}
int arg_num = find_argnum(parent_node, cur_node);
Assertion(arg_num >= 0, "Error finding sexp argument. The SEXP is not listed among its parent's children.");
// if we need a positive value, make it positive
if (query_operator_argument_type(get_operator_index(parent_node), arg_num) == OPF_POSITIVE)
{
sexp_val *= -1;
// if we need a positive value, make it positive
if (query_operator_argument_type(get_operator_index(parent_node), arg_num) == OPF_POSITIVE)
{
sexp_val *= -1;
}
}
}
@@ -26182,10 +26187,8 @@ int query_operator_argument_type(int op, int argnum)
case OP_DEBUG:
if (argnum == 0) {
return OPF_BOOL;
}else if (argnum == 1) {
return OPF_MESSAGE;
}else {
return OPF_STRING;
} else {
return OPF_MESSAGE_OR_STRING;
}
case OP_HAS_TIME_ELAPSED:
@@ -31660,8 +31663,8 @@ sexp_help_struct Sexp_help[] = {
{ OP_DEBUG, "debug\r\n"
"\tPops up a warning on debug builds (and optionally on release builds)\r\n"
"Takes 1 or more arguments...\r\n"
"\t1:\t If false, popup messages in release builds too. Defaults to true.\r\n"
"\t2:\tName of a message which will appear in the warning (optional)\r\n"},
"\t1:\tLimit warning to debug builds. If false, display warning in release builds too. Defaults to true.\r\n"
"\t2:\tA short string which will appear in the warning, or a message if the string matches a message name.\r\n"},
{ OP_GRANT_PROMOTION, "Grant promotion (Action operator)\r\n"
"\tIn a single player game, this function grants a player an automatic promotion to the "
@@ -31730,7 +31733,7 @@ sexp_help_struct Sexp_help[] = {
"have scanned each one.\r\n\r\n"
"Returns a boolean value after <delay> seconds when all cargo is known. Takes 2 or more arguments...\r\n"
"\t1:\tDelay in seconds after which sexpression will return true when all cargo scanned."
"\tRest:\tNames of ships/cargo to check for cargo known.." },
"\tRest:\tNames of ships/cargo to check for cargo known." },
{ OP_WAS_PROMOTION_GRANTED, "Was promotion granted (Boolean operator)\r\n"
"\tReturns true if a promotion was granted via the 'Grant promotion' operator in the mission.\r\n\r\n"
+3 -1
View File
@@ -5,6 +5,7 @@
#define FS2_OPEN_ADE_H
#include "globalincs/pstypes.h"
#include "platformChecks.h"
extern "C" {
#include <lauxlib.h>
@@ -226,8 +227,9 @@ template<class StoreType>
class ade_obj: public ade_lib_handle {
public:
// Make sure that the stored type is compatible with our requirements
#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<StoreType>::value, "ADE object types must be trivially copyable!");
#endif
ade_obj(const char* in_name, const char* in_desc, const ade_lib_handle* in_deriv = NULL) {
ade_table_entry ate;
+3 -3
View File
@@ -1084,8 +1084,8 @@ ADE_FUNC(drawString, l_Graphics, "string Message, [number X1, number Y1, number
}
else
{
int linelengths[MAX_TEXT_LINES];
const char *linestarts[MAX_TEXT_LINES];
SCP_vector<int> linelengths;
SCP_vector<const char*> linestarts;
if (y2 >= 0 && y2 < y)
{
@@ -1097,7 +1097,7 @@ ADE_FUNC(drawString, l_Graphics, "string Message, [number X1, number Y1, number
y2 = temp;
}
num_lines = split_str(s, x2-x, linelengths, linestarts, MAX_TEXT_LINES);
num_lines = split_str(s, x2-x, linelengths, linestarts, -1, false);
//Make sure we don't go over size
int line_ht = gr_get_font_height();
+2 -1
View File
@@ -9,6 +9,7 @@
#include "vecmath.h"
#include "team.h"
#include "mc_info.h"
#include "iff_defs/iff_defs.h"
namespace scripting {
namespace api {
@@ -285,7 +286,7 @@ ADE_VIRTVAR(Team, l_Weapon, "team", "Weapon's team", "team", "Weapon team, or in
weapon *wp = &Weapons[oh->objp->instance];
if(ADE_SETTING_VAR && nt > -1 && nt < Num_teams) {
if(ADE_SETTING_VAR && nt > -1 && nt < Num_iffs) {
wp->team = nt;
}
+3
View File
@@ -271,6 +271,9 @@ void script_state::OutputLuaMeta(FILE *fp)
ade_table_entry *ate;
fputs("<dl>\n", fp);
//***Version info
fprintf(fp, "<dd>Version: %s</dd>\n", LUA_RELEASE);
SCP_vector<ade_table_entry*> table_entries;
//***TOC: Libraries
+9 -9
View File
@@ -97,39 +97,39 @@ LuaTable::iterator LuaTable::end() {
return iterator(); // Empty iterator
}
LuaTableIterator::LuaTableIterator(const LuaTable& t) : _L(t.getLuaState()) {
_stackTop = lua_gettop(_L);
LuaTableIterator::LuaTableIterator(const LuaTable& t) : _luaState(t.getLuaState()) {
_stackTop = lua_gettop(_luaState);
t.pushValue();
lua_pushnil(_L);
lua_pushnil(_luaState);
toNextElement();
}
LuaTableIterator::~LuaTableIterator() {
lua_settop(_L, _stackTop);
lua_settop(_luaState, _stackTop);
}
bool LuaTableIterator::hasElement() {
return _hasElement;
}
void LuaTableIterator::toNextElement() {
auto ret = lua_next(_L, -2);
auto ret = lua_next(_luaState, -2);
_hasElement = ret != 0;
if (_hasElement) {
LuaValue key;
key.setReference(UniqueLuaReference::create(_L, -2));
key.setReference(UniqueLuaReference::create(_luaState, -2));
LuaValue value;
value.setReference(UniqueLuaReference::create(_L, -1));
value.setReference(UniqueLuaReference::create(_luaState, -1));
_currentVal = std::make_pair(key, value);
// Remove value from stack
lua_pop(_L, 1);
lua_pop(_luaState, 1);
}
}
std::pair<LuaValue, LuaValue> LuaTableIterator::getElement() {
return _currentVal;
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ class LuaTable;
* be in the exact same state when you call the next method of this class.
*/
class LuaTableIterator {
lua_State* _L = nullptr;
lua_State* _luaState = nullptr;
int _stackTop = 0;
+29 -17
View File
@@ -3430,9 +3430,17 @@ int parse_ship_values(ship_info* sip, const bool is_template, const bool first_t
Warning(LOCATION, "Use of '%s' flag for %s '%s' - this flag is no longer needed.", Ship_flags[idx].name, info_type_name, sip->name);
else
sip->flags.set(Ship_flags[idx].def);
break;
}
}
// catch typos or deprecations
if (!stricmp(ship_strings[i], "no-collide") || !stricmp(ship_strings[i], "no_collide")) {
flag_found = true;
sip->flags.set(Ship::Info_Flags::No_collide);
}
if ( !flag_found && (ship_type_index < 0) )
Warning(LOCATION, "Bogus string in ship flags: %s\n", ship_strings[i]);
}
@@ -10910,6 +10918,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
float dist_mult;
dist_mult = sip->minimum_convergence_distance / dist_to_aim;
vm_vec_scale_add(&predicted_target_pos, &obj->pos, &plr_to_target_vec, dist_mult);
dist_to_aim = sip->minimum_convergence_distance;
}
}
@@ -13612,10 +13621,7 @@ int ship_do_rearm_frame( object *objp, float frametime )
// loading equipment moving into place
if ( aip->rearm_first_missile == TRUE )
{
swp->secondary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[SND_MISSILE_START_LOAD].id));
if (i == swp->num_secondary_banks - 1)
aip->rearm_first_missile = FALSE;
swp->secondary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[SND_MISSILE_START_LOAD].id));
}
if ( swp->secondary_bank_ammo[i] < swp->secondary_bank_start_ammo[i] )
@@ -13651,8 +13657,13 @@ int ship_do_rearm_frame( object *objp, float frametime )
banks_full++;
}
if ((aip->rearm_first_missile == TRUE) && (i == swp->num_secondary_banks - 1) && (banks_full != swp->num_secondary_banks))
if ((aip->rearm_first_missile == TRUE) && (i == swp->num_secondary_banks - 1))
{
if ((banks_full != swp->num_secondary_banks))
snd_play_3d( &Snds[SND_MISSILE_START_LOAD], &objp->pos, &View_position );
aip->rearm_first_missile = FALSE;
}
} // end for
// rearm ballistic primaries - Goober5000
@@ -13680,10 +13691,7 @@ int ship_do_rearm_frame( object *objp, float frametime )
else
sound_index = SND_MISSILE_START_LOAD;
swp->primary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[sound_index].id));
if (i == last_ballistic_idx)
aip->rearm_first_ballistic_primary = FALSE;
swp->primary_bank_rearm_time[i] = timestamp(snd_get_duration(Snds[sound_index].id));
}
if ( swp->primary_bank_ammo[i] < swp->primary_bank_start_ammo[i] )
@@ -13727,16 +13735,20 @@ int ship_do_rearm_frame( object *objp, float frametime )
primary_banks_full++;
}
if ((aip->rearm_first_ballistic_primary == TRUE) && (i == last_ballistic_idx) && (primary_banks_full != swp->num_primary_banks))
if ((aip->rearm_first_ballistic_primary == TRUE) && (i == last_ballistic_idx))
{
// Goober5000
int sound_index;
if (Snds[SND_BALLISTIC_START_LOAD].id >= 0)
sound_index = SND_BALLISTIC_START_LOAD;
else
sound_index = SND_MISSILE_START_LOAD;
if (primary_banks_full != swp->num_primary_banks) {
// Goober5000
int sound_index;
if (Snds[SND_BALLISTIC_START_LOAD].id >= 0)
sound_index = SND_BALLISTIC_START_LOAD;
else
sound_index = SND_MISSILE_START_LOAD;
snd_play_3d( &Snds[sound_index], &objp->pos, &View_position );
snd_play_3d( &Snds[sound_index], &objp->pos, &View_position );
}
aip->rearm_first_ballistic_primary = FALSE;
}
} // end for
} // end if (subsys_all_ok)
+1 -3
View File
@@ -105,12 +105,10 @@ void parse_rank_tbl()
required_string("#End");
// be sure that all rank points are in order
#ifndef NDEBUG
for (idx = 0; idx < NUM_RANKS - 1; idx++) {
if (Ranks[idx].points >= Ranks[idx + 1].points)
Int3();
Warning(LOCATION, "Rank #%d (%s) has a higher \"$Points:\" value (%d) than the following rank (%s, %d points). This shouldn't actually crash FSO, but it might result in unexpected or incorrect behavior.\n", idx + 1, Ranks[idx].name, Ranks[idx].points, Ranks[idx+1].name, Ranks[idx+1].points);
}
#endif
}
catch (const parse::ParseException& e)
{
+16 -16
View File
@@ -53,9 +53,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hits", 118));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %%", 119));
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %", 119));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %%", 120));
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %", 120));
sy += 2*dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary weapon shots", 121));
@@ -64,9 +64,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hits", 123));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %%", 124));
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %", 124));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %%", 125));
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %", 125));
sy += 2*dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Assists", 126));
@@ -93,9 +93,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hits", 118));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %%", 119));
gr_printf_menu(sx,sy,"%s", XSTR( "Primary hit %", 119));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %%", 120));
gr_printf_menu(sx,sy,"%s", XSTR( "Primary friendly hit %", 120));
sy += 2*dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary weapon shots", 121));
@@ -104,9 +104,9 @@ void show_stats_label(int stage, int sx, int sy, int dy)
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hits", 123));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %%", 124));
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary hit %", 124));
sy += dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %%", 125));
gr_printf_menu(sx,sy,"%s", XSTR( "Secondary friendly hit %", 125));
sy += 2*dy;
gr_printf_menu(sx,sy,"%s", XSTR( "Assists", 126));
@@ -153,13 +153,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
if(Active_player->stats.mp_shots_fired>0)
pct=(float)100.0*((float)Active_player->stats.mp_shots_hit/(float)Active_player->stats.mp_shots_fired);
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += dy;
if(Active_player->stats.mp_shots_fired>0)
pct=(float)100.0*((float)Active_player->stats.mp_bonehead_hits/(float)Active_player->stats.mp_shots_fired);
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += 2*dy;
@@ -176,13 +176,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
if(Active_player->stats.ms_shots_fired>0)
pct=(float)100.0*((float)Active_player->stats.ms_shots_hit/(float)Active_player->stats.ms_shots_fired);
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += dy;
if(Active_player->stats.ms_shots_fired>0)
pct=(float)100.0*((float)Active_player->stats.ms_bonehead_hits/(float)Active_player->stats.ms_shots_fired);
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += 2*dy;
@@ -237,13 +237,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
if((Active_player->stats.p_shots_fired + add.p_shots_fired)>0)
pct=(float)100.0*((float)(Active_player->stats.p_shots_hit+add.p_shots_hit)/(float)(Active_player->stats.p_shots_fired + add.p_shots_fired));
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += dy;
if((Active_player->stats.p_bonehead_hits + add.p_bonehead_hits)>0)
pct=(float)100.0*((float)(Active_player->stats.p_bonehead_hits+add.p_bonehead_hits)/(float)(Active_player->stats.p_shots_fired + add.p_shots_fired));
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += 2*dy;
@@ -260,13 +260,13 @@ void show_stats_numbers(int stage, int sx, int sy, int dy,int add_mission)
if((Active_player->stats.s_shots_fired+add.s_shots_fired)>0)
pct=(float)100.0*((float)(Active_player->stats.s_shots_hit + add.s_shots_hit)/(float)(Active_player->stats.s_shots_fired + add.s_shots_fired));
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += dy;
if((Active_player->stats.s_bonehead_hits + add.s_bonehead_hits)>0)
pct=(float)100.0*((float)(Active_player->stats.s_bonehead_hits+add.s_bonehead_hits)/(float)(Active_player->stats.s_shots_fired+add.s_shots_fired));
else pct=(float)0.0;
sprintf(text,"%d",(int)pct); strcat_s(text," %%");
sprintf(text,"%d",(int)pct); strcat_s(text," %");
gr_printf_menu(sx,sy,"%s", text);
sy += 2*dy;
+11
View File
@@ -136,6 +136,17 @@ void FrameProfiler::processEvent(const trace_event* event) {
return;
}
if (_mainThreadID == -1) {
// We need the ID of the main thread to filter out multi threaded events. We just assume that the first event
// of the main process we see is from the main thread. That should be a safe assumption.
_mainThreadID = event->tid;
}
if (event->tid != _mainThreadID) {
// Multithreaded events don't have a deterministic sequence and that confuses the old profiling system
return;
}
if (event->duration == 0) {
// Discard events with no duration
return;
+2
View File
@@ -41,6 +41,8 @@ class FrameProfiler {
SCP_vector<profile_sample_history> history;
std::int64_t _mainThreadID = -1;
SCP_string content;
/**
+1 -1
View File
@@ -89,7 +89,7 @@ Category CutsceneProcessVideoData("Process video data", true);
Category CutsceneProcessAudioData("Process audio data", false);
Category CutsceneFFmpegVideoDecoder("FFmpeg decode video", false);
Category CutsceneFFmpegAudioDecoder("FFmpeg decode video", false);
Category CutsceneFFmpegAudioDecoder("FFmpeg decode audio", false);
Category LoadMissionLoad("Load mission", false);
Category LoadPostMissionLoad("Mission load post processing", false);
+57 -48
View File
@@ -28,6 +28,7 @@
static const char *Default_shockwave_2D_filename = "shockwave01";
static const char *Default_shockwave_3D_filename = "shockwave.pof";
static int Default_2D_shockwave_index = -1;
static int Default_shockwave_loaded = 0;
SCP_vector<shockwave_info> Shockwave_info;
@@ -158,8 +159,8 @@ int shockwave_create(int parent_objnum, vec3d *pos, shockwave_create_info *sci,
*/
void shockwave_delete(object *objp)
{
Assert(objp->type == OBJ_SHOCKWAVE);
Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES);
Assertion(objp->type == OBJ_SHOCKWAVE, "shockwave_delete() called on an object with a type of %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", objp->type, OBJ_SHOCKWAVE);
Assertion(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES, "shockwave_delete() called on an object with an invalid instance of %d (should be 0-%d); get a coder!\n", objp->instance, MAX_SHOCKWAVES - 1);
Shockwaves[objp->instance].flags = 0;
Shockwaves[objp->instance].objnum = -1;
@@ -190,7 +191,7 @@ void shockwave_set_framenum(int index)
shockwave *sw;
shockwave_info *si;
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_set_framenum called with an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
sw = &Shockwaves[index];
si = &Shockwave_info[sw->shockwave_info_index];
@@ -236,8 +237,8 @@ void shockwave_move(object *shockwave_objp, float frametime)
float blast,damage;
int i;
Assert(shockwave_objp->type == OBJ_SHOCKWAVE);
Assert(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES);
Assertion(shockwave_objp->type == OBJ_SHOCKWAVE, "shockwave_move() called on an object of type %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", shockwave_objp->type, OBJ_SHOCKWAVE);
Assertion(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES, "shockwave_move() called on an object with an instance of %d (should be 0-%d); get a coder!\n", shockwave_objp->instance, MAX_SHOCKWAVES - 1);
sw = &Shockwaves[shockwave_objp->instance];
// if the shockwave has a delay on it
@@ -367,8 +368,8 @@ void shockwave_render(object *objp, model_draw_list *scene)
shockwave *sw;
vertex p;
Assert(objp->type == OBJ_SHOCKWAVE);
Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES);
Assertion(objp->type == OBJ_SHOCKWAVE, "shockwave_render() called on an object of type %d instead of OBJ_SHOCKWAVE (%d); get a coder!\n", objp->type, OBJ_SHOCKWAVE);
Assertion(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES, "shockwave_render() called on an object with an instance of %d (should be 0-%d); get a coder!\n", objp->instance, MAX_SHOCKWAVES - 1);
sw = &Shockwaves[objp->instance];
@@ -395,11 +396,11 @@ void shockwave_render(object *objp, model_draw_list *scene)
model_render_queue( &render_info, scene, sw->model_id, &Objects[sw->objnum].orient, &sw->pos);
if ( Cmdline_fb_explosions ) {
if ( Cmdline_fb_explosions && Default_2D_shockwave_index > -1) {
g3_transfer_vertex(&p, &sw->pos);
float intensity = ((sw->time_elapsed / sw->total_time) > 0.9f) ? (1.0f - (sw->time_elapsed / sw->total_time))*10.0f : 1.0f;
batching_add_distortion_bitmap_rotated(Shockwave_info[1].bitmap_id + shockwave_get_framenum(objp->instance, Shockwave_info[1].bitmap_id), &p, fl_radians(sw->rot_angles.p), sw->radius, intensity);
batching_add_distortion_bitmap_rotated(Shockwave_info[Default_2D_shockwave_index].bitmap_id + shockwave_get_framenum(objp->instance, Shockwave_info[Default_2D_shockwave_index].bitmap_id), &p, fl_radians(sw->rot_angles.p), sw->radius, intensity);
}
} else {
g3_transfer_vertex(&p, &sw->pos);
@@ -418,7 +419,6 @@ void shockwave_render(object *objp, model_draw_list *scene)
*/
int shockwave_load(const char *s_name, bool shock_3D)
{
size_t i;
int s_index = -1;
shockwave_info *si = NULL;
@@ -428,9 +428,9 @@ int shockwave_load(const char *s_name, bool shock_3D)
if ( !VALID_FNAME(s_name) )
return -1;
for (i = 0; i < Shockwave_info.size(); i++) {
if ( !stricmp(Shockwave_info[i].filename, s_name) ) {
s_index = (int)i;
for (auto it = Shockwave_info.cbegin(); it != Shockwave_info.cend(); ++it) {
if ( !stricmp(it->filename, s_name) ) {
s_index = (int)std::distance(Shockwave_info.cbegin(), it);
break;
}
}
@@ -494,6 +494,7 @@ void shockwave_level_init()
mprintf(("SHOCKWAVE => Default model load: SUCCEEDED!!\n"));
else
mprintf(("SHOCKWAVE => Default model load: FAILED!! Falling back to 2D effect...\n"));
Assertion(i <= 0, "Default 3D shockwave should be the first shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
}
// next, try the 2d shockwave effect, unless the 3d effect was loaded
@@ -507,6 +508,8 @@ void shockwave_level_init()
mprintf(("SHOCKWAVE => Default animation load: SUCCEEDED!!\n"));
else
mprintf(("SHOCKWAVE => Default animation load: FAILED!! Checking if 3d effect was already tried...\n"));
Assertion(i <= 1, "Default 2D shockwave should be either the first or second shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
Default_2D_shockwave_index = i;
}
// chief1983 - The first patch broke mods that don't provide a 2d shockwave or define a specific shockwave for each model/weapon (shame on them)
@@ -521,6 +524,7 @@ void shockwave_level_init()
mprintf(("SHOCKWAVE => Default model load: SUCCEEDED!!\n"));
else
mprintf(("SHOCKWAVE => Default model load: FAILED!! No effect loaded...\n"));
Assertion(i <= 0, "Default 3D shockwave should be the first shockwave loaded, but instead got loaded into index %d; get a coder!\n", i);
}
if (i < 0)
@@ -530,11 +534,14 @@ void shockwave_level_init()
} else {
// have to make sure that the default 3D model is still valid and usable
// the 2D shockwave shouldn't need anything like this
if (Shockwave_info[0].model_id >= 0)
if (Shockwave_info[0].model_id >= 0) {
Assertion(!strcmp(Shockwave_info[0].filename, Default_shockwave_3D_filename), "Shockwave_info[0] should be the default shockwave, but somehow isn't.\nShockwave_info[0].filename = \"%s\"\nDefault_shockwave_3D_filename = \"%s\"\nGet a coder!\n", Shockwave_info[0].filename, Default_shockwave_3D_filename);
Shockwave_info[0].model_id = model_load( Default_shockwave_3D_filename, 0, NULL );
}
}
Assert( ((Shockwave_info[0].bitmap_id >= 0) || (Shockwave_info[0].model_id >= 0)) );
Assertion( !Shockwave_info.empty(), "Default shockwave claims to be loaded, but Shockwave_info vector is empty!");
Assertion( ((Shockwave_info[0].bitmap_id >= 0) || (Shockwave_info[0].model_id >= 0)), "Default shockwave claims to be loaded, but has no bitmap or model; get a coder!\n" );
list_init(&Shockwave_list);
@@ -557,28 +564,32 @@ void shockwave_level_close()
shockwave_delete_all();
size_t i;
Assertion( !Shockwave_info.empty(), "Shockwave_info is empty in shockwave_level_close() despite theoretically having been initialized correctly; get a coder!\n");
// unload default shockwave, and erase all others
for (i = 0; i < Shockwave_info.size(); i++) {
if ( !i ) {
if (Shockwave_info[i].bitmap_id >= 0)
bm_unload( Shockwave_info[i].bitmap_id );
else if (Shockwave_info[i].model_id >= 0)
model_page_out_textures( Shockwave_info[i].model_id );
continue;
}
if (Shockwave_info[i].bitmap_id >= 0)
bm_release( Shockwave_info[i].bitmap_id );
if (Shockwave_info[i].model_id >= 0)
model_unload( Shockwave_info[i].model_id );
Shockwave_info.erase( Shockwave_info.begin() + i );
auto it = Shockwave_info.begin();
if (it->bitmap_id >= 0)
bm_unload( it->bitmap_id );
else if (it->model_id >= 0)
model_page_out_textures( it->model_id );
if (Default_2D_shockwave_index == 1) {
// 3D shockwaves and framebuffer shockwaves are both enabled and the default 2D shockwave is in the next slot of the vector
++it;
Assertion(it->bitmap_id >= 0, "Default 2D shockwave was loaded but is somehow missing its bitmap; get a coder!\n");
bm_unload(it->bitmap_id);
}
for (++it; it != Shockwave_info.end(); ++it) {
if (it->bitmap_id >= 0)
bm_release( it->bitmap_id );
if (it->model_id >= 0)
model_unload( it->model_id );
}
// if there's no extra shockwaves, this is still fine (erasing from end() to end() is both valid and a no-op)
Shockwave_info.erase( Shockwave_info.begin() + (Default_2D_shockwave_index == 1 ? 2 : 1), Shockwave_info.end() );
Shockwave_inited = 0;
}
@@ -605,7 +616,7 @@ void shockwave_move_all(float frametime)
*/
int shockwave_get_weapon_index(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_weapon_index() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].weapon_info_index;
}
@@ -614,7 +625,7 @@ int shockwave_get_weapon_index(int index)
*/
float shockwave_get_max_radius(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_max_radius() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].outer_radius;
}
@@ -623,7 +634,7 @@ float shockwave_get_max_radius(int index)
*/
float shockwave_get_min_radius(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_min_radius() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].inner_radius;
}
@@ -632,7 +643,7 @@ float shockwave_get_min_radius(int index)
*/
float shockwave_get_damage(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_damage() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].damage;
}
@@ -641,7 +652,7 @@ float shockwave_get_damage(int index)
*/
int shockwave_get_damage_type_idx(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_damage_type_idx() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].damage_type_idx;
}
@@ -650,25 +661,23 @@ int shockwave_get_damage_type_idx(int index)
*/
int shockwave_get_flags(int index)
{
Assert( (index >= 0) && (index < MAX_SHOCKWAVES) );
Assertion( (index >= 0) && (index < MAX_SHOCKWAVES), "shockwave_get_flags() called on an index of %d (should be 0-%d); get a coder!\n", index, MAX_SHOCKWAVES - 1 );
return Shockwaves[index].flags;
}
void shockwave_page_in()
{
size_t i;
// load in shockwaves
for (i = 0; i < Shockwave_info.size(); i++) {
if (Shockwave_info[i].bitmap_id >= 0) {
bm_page_in_texture( Shockwave_info[i].bitmap_id, Shockwave_info[i].num_frames );
} else if (Shockwave_info[i].model_id >= 0) {
for (auto it = Shockwave_info.begin(); it != Shockwave_info.end(); ++it) {
if (it->bitmap_id >= 0) {
bm_page_in_texture( it->bitmap_id, it->num_frames );
} else if (it->model_id >= 0) {
// for a model we have to run model_load() on it again to make sure
// that it's ref_count is sane for this mission
int idx __UNUSED = model_load( Shockwave_info[i].filename, 0, NULL );
Assert( idx == Shockwave_info[i].model_id );
int idx __UNUSED = model_load( it->filename, 0, NULL );
Assertion( idx == it->model_id , "Shockwave_info[" SIZE_T_ARG "] got two different model_ids: %d and %d. Filename is \"%s\". Get a coder!\n", std::distance(Shockwave_info.begin(), it), idx, it->model_id, it->filename);
model_page_in_textures( Shockwave_info[i].model_id );
model_page_in_textures( it->model_id );
}
}
}
+20 -10
View File
@@ -2337,12 +2337,8 @@ int parse_weapon(int subtype, bool replace, const char *filename)
if ( optional_string("+Texture:") ) {
stuff_string(fname, F_NAME, NAME_LENGTH);
// invisible textures are okay
if (!stricmp(fname, "invisible")) {
generic_anim_init(&bsip->texture);
} else {
generic_anim_init(&bsip->texture, fname);
}
// invisible textures are okay - see weapon_clean_entries()
generic_anim_init(&bsip->texture, fname);
}
// The E -- Dummied out due to not being used anywhere
@@ -3081,7 +3077,15 @@ void weapon_clean_entries()
int removed = 0;
for (int s_idx = 0; s_idx < wip->b_info.beam_num_sections; s_idx++) {
if ( !strlen(wip->b_info.sections[s_idx].texture.filename) ) {
beam_weapon_section_info *bsip = &wip->b_info.sections[s_idx];
// If this is an invisible beam section, we want to keep it. Originally invisible sections were initialized as they were parsed,
// but then they were inadvertently cleaned up in this function. So let's properly set the filename here while not removing the section.
if ( !stricmp(bsip->texture.filename, "invisible") ) {
memset(bsip->texture.filename, 0, MAX_FILENAME_LEN);
}
// Now remove empty beam sections as before
else if ( !strlen(bsip->texture.filename) ) {
int new_idx = s_idx + 1;
while (new_idx < MAX_BEAM_SECTIONS) {
@@ -3097,6 +3101,10 @@ void weapon_clean_entries()
mprintf(("NOTE: weapon-cleanup is removing %i stale beam sections, out of %i original, from '%s'.\n", removed, wip->b_info.beam_num_sections, wip->name));
wip->b_info.beam_num_sections -= removed;
}
if (wip->b_info.beam_num_sections == 0) {
Warning(LOCATION, "The beam '%s' has 0 usable sections!", wip->name);
}
}
}
}
@@ -4518,7 +4526,11 @@ static void weapon_set_state(weapon_info* wip, weapon* wp, WeaponState state)
return;
}
if (wp->weapon_state == WeaponState::INVALID)
auto current_state = wp->weapon_state;
wp->weapon_state = state;
if (current_state == WeaponState::INVALID)
{
// First weapon state, create the in-flight effect
auto map_entry = wip->state_effects.find(WeaponState::NORMAL);
@@ -4534,8 +4546,6 @@ static void weapon_set_state(weapon_info* wip, weapon* wp, WeaponState state)
}
}
wp->weapon_state = state;
auto map_entry = wip->state_effects.find(wp->weapon_state);
if (map_entry != wip->state_effects.end())
+36 -16
View File
@@ -30,6 +30,21 @@ void initial_status_mark_dock_leader_helper(object *objp, dock_function_info *in
void initial_status_unmark_dock_handled_flag(object *objp, dock_function_info *infop);
void reset_arrival_to_false(int shipnum, bool reset_wing);
/**
* @brief Handles setting a flag on a flagset when the value is inconsistent
*
* This is necessary in case multiple ships with inconsistent object flags have been selected in which case
* that flag may not be edited since it would corrupt the value of that flag. This function simplifies handling
* that case.
*/
template<typename T>
static void handle_inconsistent_flag(flagset<T>& flags, T flag, int value) {
if (value == 1) {
flags.set(flag);
} else if (value == 0) {
flags.remove(flag);
}
}
/////////////////////////////////////////////////////////////////////////////
// initial_status dialog
@@ -438,17 +453,21 @@ void initial_status::OnOK()
if (hflag)
MODIFY(objp->hull_strength, (float) m_hull);
objp->flags.set(Object::Object_Flags::No_shields, m_has_shields == 0);
if (m_has_shields == 1)
objp->flags.remove(Object::Object_Flags::No_shields);
else if (m_has_shields == 0)
objp->flags.set(Object::Object_Flags::No_shields);
auto shipp = &Ships[get_ship_from_obj(objp)];
shipp->flags.set(Ship::Ship_Flags::Force_shields_on, m_force_shields == 1);
shipp->flags.set(Ship::Ship_Flags::Ship_locked, m_ship_locked == 1);
shipp->flags.set(Ship::Ship_Flags::Weapons_locked, m_weapons_locked == 1);
shipp->flags.set(Ship::Ship_Flags::Primaries_locked, m_primaries_locked == 1);
shipp->flags.set(Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked == 1);
shipp->flags.set(Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked == 1);
shipp->flags.set(Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked == 1);
// We need to ensure that we handle the inconsistent "boolean" value correctly
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Force_shields_on, m_force_shields);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Ship_locked, m_ship_locked);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Weapons_locked, m_weapons_locked);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Primaries_locked, m_primaries_locked);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked);
handle_inconsistent_flag(shipp->flags, Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked);
}
objp = GET_NEXT(objp);
@@ -459,15 +478,16 @@ void initial_status::OnOK()
MODIFY(Objects[cur_object_index].shield_quadrant[0], (float) m_shields);
MODIFY(Objects[cur_object_index].hull_strength, (float) m_hull);
Objects[cur_object_index].flags.set(Object::Object_Flags::No_shields, m_has_shields != 0);
Objects[cur_object_index].flags.set(Object::Object_Flags::No_shields, m_has_shields == 0);
Ships[m_ship].flags.set(Ship::Ship_Flags::Force_shields_on, m_force_shields == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Ship_locked, m_ship_locked == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Weapons_locked, m_weapons_locked == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Primaries_locked, m_primaries_locked == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked == 1);
Ships[m_ship].flags.set(Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked == 1);
// We need to ensure that we handle the inconsistent "boolean" value correctly. Not strictly needed here but just to be safe...
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Force_shields_on, m_force_shields);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Ship_locked, m_ship_locked);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Weapons_locked, m_weapons_locked);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Primaries_locked, m_primaries_locked);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Secondaries_locked, m_secondaries_locked);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Lock_all_turrets_initially, m_turrets_locked);
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked);
}
if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
+1 -1
View File
@@ -2201,7 +2201,7 @@ int CFred_mission_save::save_mission_info() {
fout("\n+Flags:");
}
fout(" %d", The_mission.flags);
fout(" %" PRIu64, The_mission.flags.to_u64());
// maybe write out Nebula intensity
if (The_mission.flags[Mission::Mission_Flags::Fullneb]) {
+8 -6
View File
@@ -210,22 +210,24 @@ void orient_editor::update_object(object *ptr)
vec3d v, loc;
matrix m;
memset(&v, 0, sizeof(vec3d));
vm_vec_zero(&v);
loc.xyz.x = convert(m_location_x);
loc.xyz.y = convert(m_location_y);
loc.xyz.z = convert(m_location_z);
if (((CButton *) GetDlgItem(IDC_POINT_TO_OBJECT))->GetCheck() == 1) {
v = Objects[index[m_object_index]].pos;
vm_vec_sub2(&v, &ptr->pos);
if (m_object_index >= 0) {
v = Objects[index[m_object_index]].pos;
vm_vec_sub2(&v, &ptr->pos);
}
} else if (((CButton *) GetDlgItem(IDC_POINT_TO_LOCATION))->GetCheck() == 1) {
vm_vec_sub(&v, &loc, &ptr->pos);
} else {
Assert(0); // neither radio button is checked.
Assertion(0, "neither radio button is checked!");
return;
}
if (!v.xyz.x && !v.xyz.y && !v.xyz.z){
if (IS_VEC_NULL(&v)) {
return; // can't point to itself.
}
+48 -65
View File
@@ -2187,7 +2187,7 @@ void sexp_list_item::destroy()
}
}
int sexp_tree::add_default_operator(int op, int argnum)
int sexp_tree::add_default_operator(int op_index, int argnum)
{
char buf[256];
int index;
@@ -2196,7 +2196,7 @@ int sexp_tree::add_default_operator(int op, int argnum)
h = item_handle;
index = item_index;
if (get_default_value(&item, buf, op, argnum))
if (get_default_value(&item, buf, op_index, argnum))
return -1;
if (item.type & SEXPT_OPERATOR) {
@@ -2206,57 +2206,48 @@ int sexp_tree::add_default_operator(int op, int argnum)
item_handle = h;
} else {
// special case for modify-variable (data added 1st arg is variable)
//if ( !stricmp(Operators[op].text, "modify-variable") ) {
if ( query_operator_argument_type(op, argnum) == OPF_VARIABLE_NAME)
{
if ((argnum == 0 && Operators[op].value == OP_MODIFY_VARIABLE) ||
(argnum == 8 && Operators[op].value == OP_ADD_BACKGROUND_BITMAP) ||
(argnum == 5 && Operators[op].value == OP_ADD_SUN_BITMAP) ||
(argnum == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
(argnum == 1 && Operators[op].value == OP_INT_TO_STRING) ||
(argnum == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
(argnum == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
(argnum == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX) ||
(argnum == 1 && Operators[op].value == OP_SCRIPT_EVAL_STRING))
{
int sexp_var_index = get_index_sexp_variable_name(item.text);
Assert(sexp_var_index != -1);
int type = SEXPT_VALID | SEXPT_VARIABLE;
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
type |= SEXPT_STRING;
} else if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
type |= SEXPT_NUMBER;
} else {
Int3();
}
char node_text[2*TOKEN_LENGTH + 2];
sprintf(node_text, "%s(%s)", item.text, Sexp_variables[sexp_var_index].text);
add_variable_data(node_text, type);
// special case for sexps that take variables
if (query_operator_argument_type(op_index, argnum) == OPF_VARIABLE_NAME) {
int sexp_var_index = get_index_sexp_variable_name(item.text);
Assert(sexp_var_index != -1);
int type = SEXPT_VALID | SEXPT_VARIABLE;
if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) {
type |= SEXPT_STRING;
} else if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) {
type |= SEXPT_NUMBER;
} else {
// the the variable name
char buf2[256];
Assert(argnum == 1);
sexp_list_item temp_item;
get_default_value(&temp_item, buf2, op, 0);
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
Assert(sexp_var_index != -1);
// from name get type
int temp_type = Sexp_variables[sexp_var_index].type;
int type = 0;
if (temp_type & SEXP_VARIABLE_NUMBER) {
type = SEXPT_VALID | SEXPT_NUMBER;
} else if (temp_type & SEXP_VARIABLE_STRING) {
type = SEXPT_VALID | SEXPT_STRING;
} else {
Int3();
}
add_data(item.text, type);
Int3();
}
} else {
char node_text[2*TOKEN_LENGTH + 2];
sprintf(node_text, "%s(%s)", item.text, Sexp_variables[sexp_var_index].text);
add_variable_data(node_text, type);
}
// modify-variable data type depends on type of variable being modified
// (we know this block is handling the second argument since it's not OPF_VARIABLE_NAME)
else if (Operators[op_index].value == OP_MODIFY_VARIABLE) {
// the the variable name
char buf2[256];
Assert(argnum == 1);
sexp_list_item temp_item;
get_default_value(&temp_item, buf2, op_index, 0);
int sexp_var_index = get_index_sexp_variable_name(temp_item.text);
Assert(sexp_var_index != -1);
// from name get type
int temp_type = Sexp_variables[sexp_var_index].type;
int type = 0;
if (temp_type & SEXP_VARIABLE_NUMBER) {
type = SEXPT_VALID | SEXPT_NUMBER;
} else if (temp_type & SEXP_VARIABLE_STRING) {
type = SEXPT_VALID | SEXPT_STRING;
} else {
Int3();
}
add_data(item.text, type);
}
// all other sexps and parameters
else {
add_data(item.text, item.type);
}
}
@@ -3233,7 +3224,7 @@ int sexp_tree::get_modify_variable_type(int parent)
void sexp_tree::verify_and_fix_arguments(int node)
{
int op, arg_num, type, tmp;
int op_index, arg_num, type, tmp;
sexp_list_item *list, *ptr;
bool is_variable_arg = false;
@@ -3242,8 +3233,8 @@ void sexp_tree::verify_and_fix_arguments(int node)
return;
was_here = true;
op = get_operator_index(tree_nodes[node].text);
if (op < 0)
op_index = get_operator_index(tree_nodes[node].text);
if (op_index < 0)
return;
tmp = item_index;
@@ -3252,7 +3243,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
item_index = tree_nodes[node].child;
while (item_index >= 0) {
// get listing of valid argument values for node item_index
type = query_operator_argument_type(op, arg_num);
type = query_operator_argument_type(op_index, arg_num);
// special case for modify-variable
if (type == OPF_AMBIGUOUS) {
is_variable_arg = true;
@@ -3260,7 +3251,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
}
if (query_restricted_opf_range(type)) {
list = get_listing_opf(type, node, arg_num);
if (!list && (arg_num >= Operators[op].min)) {
if (!list && (arg_num >= Operators[op_index].min)) {
free_node(item_index, 1);
item_index = tmp;
flag--;
@@ -3274,15 +3265,7 @@ void sexp_tree::verify_and_fix_arguments(int node)
char default_variable_text[TOKEN_LENGTH];
if (tree_nodes[item_index].type & SEXPT_VARIABLE) {
// special case for SEXPs which can modify a variable
if ((arg_num == 0 && Operators[op].value == OP_MODIFY_VARIABLE) ||
(arg_num == 8 && Operators[op].value == OP_ADD_BACKGROUND_BITMAP) ||
(arg_num == 5 && Operators[op].value == OP_ADD_SUN_BITMAP) ||
(arg_num == 2 && Operators[op].value == OP_STRING_CONCATENATE) ||
(arg_num == 1 && Operators[op].value == OP_INT_TO_STRING) ||
(arg_num == 3 && Operators[op].value == OP_STRING_GET_SUBSTRING) ||
(arg_num == 4 && Operators[op].value == OP_STRING_SET_SUBSTRING) ||
(arg_num == 1 && Operators[op].value == OP_COPY_VARIABLE_FROM_INDEX))
{
if (type == OPF_VARIABLE_NAME) {
// make text_ptr to start - before '('
get_variable_name_from_sexp_tree_node_text(tree_nodes[item_index].text, default_variable_text);
text_ptr = default_variable_text;
+7 -7
View File
@@ -1,5 +1,5 @@
set(PREBUILT_VERSION_NAME "7775d50e9b162b9668160c4c0e7c8b9b4abeeb3c")
set(PREBUILT_VERSION_NAME "d08440c3a886e1cd24357ee42cfbc7d25f035336")
set(FSO_PREBUILT_OVERRIDE "" CACHE PATH "Path to the prebuilt binaries, if empty the binaries will be downloaded.")
set(PREBUILT_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/prebuilt")
@@ -20,20 +20,20 @@ function(get_prebuilt_path OUT_VAR)
endif()
set(PREBUILT_PATH)
set(FILENAME "bin-${PREBUILT_VERSION_NAME}")
set(TAG_NAME "bin-${PREBUILT_VERSION_NAME}")
if(PLATFORM_WINDOWS)
if (IS_64BIT)
set(FILENAME "${FILENAME}-win64.zip")
set(FILENAME "bin-win64.zip")
else()
set(FILENAME "${FILENAME}-win32.zip")
set(FILENAME "bin-win32.zip")
endif()
elseif(PLATFORM_MAC)
set(FILENAME "${FILENAME}-mac.tar.gz")
set(FILENAME "bin-mac.tar.gz")
else()
# Use Linux binaries...
set(FILENAME "${FILENAME}-linux.tar.gz")
set(FILENAME "bin-linux.tar.gz")
endif()
set(DOWNLOAD_URL "https://bintray.com/scp-fs2open/FSO/download_file?file_path=${FILENAME}")
set(DOWNLOAD_URL "https://github.com/scp-fs2open/scp-prebuilt/releases/download/${TAG_NAME}/${FILENAME}")
set(DOWNLOAD_FILE "${CURRENT_ROOT}/${FILENAME}")
message(STATUS "Downloading prebuilt libraries from \"${DOWNLOAD_URL}\"")
+12
View File
@@ -53,3 +53,15 @@ TEST(FlagsetTests, three_flags) {
}
}
TEST(FlagsetTests, numeric_conversion) {
{
flagset<TestFlags> base{ TestFlags::First, TestFlags::Second, TestFlags::Another };
flagset<TestFlags> converted;
converted.from_u64(base.to_u64());
ASSERT_TRUE(base == converted);
}
}
+5
View File
@@ -0,0 +1,5 @@
set(FSO_VERSION_MAJOR 3)
set(FSO_VERSION_MINOR 8)
set(FSO_VERSION_BUILD 0)
set(FSO_VERSION_REVISION 0)
set(FSO_VERSION_REVISION_STR )