Compare commits

...
Author SHA1 Message Date
Cliff Gordon 81a2e93e54 Automated 3.7.4 RC1 versioning commit 2016-03-07 13:48:11 -06:00
Fabian Woltermann dc708ccbbb Merge pull request #547 from Goober5000/game_level_seed
improve RNG seeding
2016-02-28 22:09:57 +01:00
Goober5000 5206220f5a simplify the random number seeding; don't seed the RNG for every mission in single player 2016-02-27 13:25:48 -05:00
Fabian Woltermann c049e7335b Merge pull request #535 from jg18/remove_ipx
Remove IPX support.
2016-02-27 00:18:39 +01:00
jg18 a05d19db6b Re-enable TCP/IPX selector buttons.
Re-enable the TCP selector button and unhide the IPX selector button.
Attempting to select IPX brings up a pop-up that IPX is no longer supported.
2016-02-25 10:28:50 -08:00
jg18 cb65ca8655 Revert changes to net_addr struct format.
Revert changes that were made to net_addr struct format in commit 220fa18.
The net_addr struct is now the same as it was in retail.
2016-02-25 10:28:49 -08:00
jg18 1adb64e39d Remove IPX support.
Remove support for the IPX protocol. The IPX selector button in the multi
options menu is now hidden, and the TCP button is disabled since there is no other option.
2016-02-25 10:28:49 -08:00
Fabian Woltermann 6c308037e8 Merge pull request #546 from SamuelCho/fred_outline_fix
Fixes ships in FRED only rendering wireframe instead of both wireframe and model when selected.
2016-02-25 09:25:39 +01:00
SamuelCho 706b3a7f5e Fixes ships in FRED only rendering wireframe instead of both wireframe and model when selected. 2016-02-24 23:32:57 -08:00
niffiwan 4c23cd0d00 Merge pull request #545 from asarium/fix/iamstupid
Fix some issues from my previous PRs
2016-02-22 21:40:10 +10:00
m!m 1fbeccd61e Merge pull request #544 from niffiwan/feature/bm_used
Add debug console command: bm_used
2016-02-22 12:24:49 +01:00
asarium 564fc9a680 Update commend to match updated code 2016-02-22 12:11:44 +01:00
asarium 688c514352 Actually dump opened files to log file 2016-02-22 12:10:46 +01:00
niffiwan acc57397e5 Add debug console command: bm_used
Reports how many bmpman slots are used, with subtotals for each image
type and EFFs broken down by sub-type
2016-02-22 18:49:57 +10:00
Fabian Woltermann e47884e0fb Merge pull request #543 from asarium/cleanup/graphics
Clean up the renderer interface
2016-02-22 09:12:41 +01:00
Fabian Woltermann 81bd363d6d Merge pull request #542 from asarium/feature/cfile_debugging
Add source tracking for cfiles
2016-02-21 23:34:51 +01:00
asarium 108d60330f Clean up the renderer interface 2016-02-21 23:24:01 +01:00
asarium 58575399f5 Add source tracking for cfiles 2016-02-21 22:34:37 +01:00
Fabian Woltermann 1253575a68 Merge pull request #540 from asarium/bmpman/loading
Move texture loading out of graphics code
2016-02-21 17:26:17 +01:00
asarium a1d46479d7 Remove -img2dds 2016-02-21 15:57:52 +01:00
asarium a4043fbf21 Improve Assertion message a bit 2016-02-21 15:40:18 +01:00
asarium 83b8361dcd Move texture loading out of graphics code
Currently the graphics code handles loading texture information and data
but that should be done by bmpman itself. I removed two graphics API
functions and added a new one which is called to notify the graphics
code that a texture has been loaded.
2016-02-21 15:40:18 +01:00
Fabian Woltermann be677937ae Merge pull request #541 from asarium/ci/unused_function
Disable unused function warnings in release mode
2016-02-21 15:39:24 +01:00
asarium aebdc6328b Disable unused function warnings in release mode 2016-02-21 12:10:30 +01:00
m!m 801b808764 Merge pull request #529 from MageKing17/bugfix/objcollide-speed-check
Don't assume non-turning weapons have a fixed velocity.
2016-02-14 15:04:08 +01:00
m!m 73d12d15a3 Merge pull request #532 from Goober5000/function_parameter_tweak
modify function headers as suggested in PR #530
2016-02-11 10:46:51 +01:00
Goober5000 c9a45c9fbd come on, Travis, stop halting after a single warning 2016-02-11 01:13:00 -05:00
Goober5000 ddd3a7d6fe resolve Travis warning 2016-02-11 00:50:20 -05:00
Goober5000 e302f0e456 convert the rest of the model instance functions to have model_instance_num parameters instead of object parameters 2016-02-10 23:23:44 -05:00
Fabian Woltermann 0ed147fb45 Merge pull request #533 from Yarn366/scale_gauges_fix
$Scale Gauges fix
2016-02-07 12:18:22 +01:00
Goober5000 da812f9433 modify the actual function calls 2016-02-06 18:05:33 -05:00
Yarn366 5e623d10b0 Moved the check for negative values in $Force Scaling Above so that $Scale Gauges can work properly 2016-02-06 16:40:08 -05:00
Goober5000 471c898df5 modify function headers as suggested in PR #530 2016-02-06 15:46:06 -05:00
MageKing17 4e9f5dc754 Merge pull request #531 from Goober5000/intrinsic_rotation_refactor
refactor of dumb_rotation to intrinsic_rotation
2016-02-05 11:00:28 -08:00
Goober5000 df41bbe172 refactor of dumb_rotation to intrinsic_rotation
This is a renaming of the Dumb_rotation infrastructure, which is now called Intrinsic_rotation.  Intrinsic rotations are automatically applied to submodels without the need for an associated subsystem.  Dumb rotations are now a type of intrinsic rotation, and look_at rotations will be added in a future PR.  The same code will handle both; the only difference is in how the intrinsic rotation is calculated.  (In the case of dumb-rotation, it is calculated the same way as normal rotation; in the case of look-at, it will be calculated using submodel_look_at.)
2016-02-05 12:40:55 -05:00
Cliff Gordon 617fd6a977 Merge pull request #519 from chief1983/project_removal_201601
Project removal 2016-01
2016-02-03 10:38:44 -06:00
MageKing17 54e052bc2f Don't assume non-turning weapons have a fixed velocity.
Somewhat related to PR #528, this changes the branch that assumes constant velocity from checking for an absence of the WIF_TURNS flag to checking for the presence of the PF_CONST_VEL flag (because non-turning weapons can be given an acceleration time).
2016-01-31 18:54:41 -08:00
Goober5000 17c6b7cd58 Merge pull request #528 from ln-zookeeper/master
Fixed $Acceleration Time not working right on non-homing secondaries
2016-01-31 16:45:29 -05:00
Lari Nieminen f12d2395dc Fixed $Acceleration Time not working right on non-homing secondaries 2016-01-31 23:27:52 +02:00
Goober5000 746fe56b32 Merge pull request #525 from asarium/cleanup/timer
Remove some unused code from timer.h/.cpp
2016-01-31 16:12:04 -05:00
MageKing17 a87af22357 Merge pull request #523 from asarium/fix/time
Change timestamp integer handling again
2016-01-29 16:34:15 -08:00
MageKing17 4179d95975 Merge pull request #524 from Goober5000/small_fixes
one small bugfix, one small comment tweak
2016-01-29 16:33:31 -08:00
asarium fc6bc3a1c6 Remove some unused code from timer.h/.cpp
The removed code has been replaced by the profiling subsystem.
2016-01-29 22:00:58 +01:00
Goober5000 5bcc89be3a one small bugfix, one small comment tweak
This fixes a bug where, when the skybox is changed after loading a new mission, it tries to delete its model instance which was already deleted in model_instance_free_all.  Setting the instance reference to -1 when the instance is freed fixes this.  (This is something that would typically be handled by the object_delete function, as it is for ship_delete, asteroid_delete, and weapon_delete, but there is no such equivalent for skyboxes.)

Since this is such a small PR, I decided to also include a stash where I restored a comment that was inadvertently deleted by Swifty's hud_lock variable scope fix PR.
2016-01-29 12:37:14 -05:00
asarium 54b2eddc14 Change timestamp integer handling again 2016-01-28 16:39:10 +01:00
Fabian Woltermann 7a7abe1b3b Merge pull request #522 from asarium/fix/time
Use integer math instead of floats for timestamps
2016-01-27 20:32:05 +01:00
Fabian Woltermann 75c69271a9 Merge pull request #520 from MageKing17/bugfix/object-recycling-errors
Fix object recycling errors
2016-01-27 20:31:20 +01:00
asarium 64c4e4d7b4 Use integer math instead of floats for timestamps 2016-01-27 15:34:37 +01:00
MageKing17 1159e66168 Avoid checking for combat music if the projectile's parent was recycled. 2016-01-27 01:25:46 -08:00
MageKing17 37a98b8cf8 Check B->parent_sig before checking B->parent in objcollide.cpp.
Could cause problems with recycled objects (specifically, I had a crash once because "Objects[B->parent].instance" was well over MAX_SHIPS due to being a weapon instead of a ship, causing the "Ships[Objects[B->parent].instance].team" reference to fail hard).
2016-01-26 23:59:23 -08:00
MageKing17 a5b705b2c1 Store debris damage type on the debris object itself.
If the Object that had been assigned to that particular debris's parent wound up getting recycled and used for something else, the code in shiphit.cpp would cause a crash as soon as that debris hit something. This would happen fairly reliably in cluttered missions like BP massive battle.
2016-01-26 23:36:24 -08:00
Goober5000 76b98684cc Merge pull request #512 from Goober5000/dumb_rotation_refactor
Dumb rotation refactor
2016-01-26 22:04:08 -05:00
Cliff Gordon aa0de45ddb Part C: Update references to these projects in the CI configs and other areas. 2016-01-26 16:51:28 -06:00
Cliff Gordon e6855a4153 Part B: Move Xcode4 project to Xcode. 2016-01-26 16:35:26 -06:00
Cliff Gordon f61b869c7f Part A: Remove 5 old crusty projects. 2016-01-26 16:34:57 -06:00
Goober5000 59d6a44db3 colons are redundant 2016-01-25 19:31:52 -05:00
MageKing17 8dc4030dbc Merge pull request #518 from Yarn366/hud_scale_limit
Hud scale limit (part 2)
2016-01-25 16:31:41 -08:00
Yarn366 882467cb5a Merge branch 'master' into hud_scale_limit 2016-01-25 17:14:59 -05:00
Yarn366 5b8410de98 Values of "Force Scaling Above" that are <= 0 are now handled in adjust_base_res rather than in gauge_load_common. (This fixes a bug that prevented this parameter from working properly under certain conditions.)
Also removed an erroneous plus sign in adjust_base_res.
2016-01-25 17:00:08 -05:00
m!m 79f3f08543 Merge pull request #500 from Yarn366/hud_scale_limit
Hud scale limit
2016-01-25 22:20:16 +01:00
Yarn366 1bd7160461 Remove parameters from gauge_settings constructor and change values after struct creation. 2016-01-25 15:13:17 -05:00
Yarn366 8464e1769f Use a constructor rather than a define to create a gauge settings struct. 2016-01-25 04:41:24 -05:00
Goober5000 975e108841 further accommodation of the dumb-rotation movement type, including, finally, proper collision detection! 2016-01-25 01:29:51 -05:00
Goober5000 6d60bb1511 add some additional clarifying comments 2016-01-25 00:49:21 -05:00
Goober5000 28faa9e588 warn for dumb-rotation as well as regular rotation 2016-01-25 00:26:26 -05:00
Yarn366 3ccfbb6aac Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into hud_scale_limit 2016-01-24 23:26:19 -05:00
Goober5000 78ff02501b improve debug warning handling 2016-01-24 21:41:31 -05:00
Goober5000 165124267a Add model_instance handling for weapons, asteroids, and skyboxes 2016-01-24 21:28:43 -05:00
Goober5000 b9033ab2a2 fix Travis error 2016-01-24 19:00:04 -05:00
Goober5000 102efb192c some additional error handling 2016-01-24 17:55:13 -05:00
MageKing17 da7ec6db4d Merge pull request #463 from niffiwan/feature/cm_decoy_once_alt
Allow countermeasures to decoy missiles once only (alternate solution)
2016-01-24 14:08:02 -08:00
Cliff Gordon e36b5398ef Merge pull request #516 from asarium/ci/generic
Use generic architecture for Travis CI
2016-01-24 12:29:14 -06:00
asarium 335cc4a114 Use generic architecture by default 2016-01-24 14:31:13 +01:00
Goober5000 4b05468f3c update comment with a small clarification, add an assertion that the function contract is being followed, and fix an incipient bug by adding a necessary is_ship flag 2016-01-20 14:44:45 -05:00
Goober5000 26a500bf7c address warnings flagged by Travis 2016-01-19 22:18:09 -05:00
Goober5000 81ad6dc1b5 remove a field that is now redundant 2016-01-05 01:04:46 -05:00
Goober5000 025c58c679 fix const-correctness due to Swifty's change 2016-01-05 00:56:51 -05:00
Goober5000 bb93319871 small update due to changed API 2016-01-04 23:34:30 -05:00
Goober5000 8f224a76a4 incorporate turning rate 2016-01-04 23:34:30 -05:00
Goober5000 a640015afc tweak the creation of dumb_rotate instances; move the check for can_move below look_at and dumb_rotate 2016-01-04 23:34:29 -05:00
Goober5000 82807f2760 delete dumb rotations when we delete the associated instance 2016-01-04 23:34:29 -05:00
Goober5000 97924c0628 Add data structures and the hook to create the dumb rotations when model instances are created. This might be sufficient to get dumb rotations working for ships. 2016-01-04 23:34:28 -05:00
Goober5000 680ac9175f move the two dumb_rotation iterations into one function (which calls a subfunction) in modelread.cpp, and add some descriptive commenting 2016-01-04 23:34:28 -05:00
Goober5000 e3c4f90287 first chunk of work to reimplementing dumb_rotate in a way that syncs with the rest of the model code 2016-01-04 23:34:27 -05:00
Goober5000 ed2bbc35eb Merge pull request #501 from SamuelCho/kill_ship_model_start
Killed the last vestiges of ship_model_start/stop.
2016-01-04 22:45:03 -05:00
Fabian Woltermann 23aa8cb18d Merge pull request #504 from niffiwan/fix/shield_hit_anim_duration
Allow shield hit animations to play to the end
2016-01-04 15:40:03 +01:00
Yarn366 af2725b2b7 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into hud_scale_limit 2016-01-04 03:58:12 -05:00
Yarn366 ca95a3c25d Changed default gauge settings from a function to a define 2016-01-04 03:57:13 -05:00
m!m a9b4be5928 Merge pull request #425 from Echelon9/fix/SHADER_MODEL-concept-removal
OpenGL: Refactor GLSL setup and remove DirectX Shader Model concept
2016-01-03 23:56:46 +01:00
Echelon9 7691c4905e Correct comment regarding glGetString(GL_SHADING_LANGUAGE_VERSION) 2016-01-03 16:33:05 -05:00
Echelon9 9bd4fb3ac7 Lift up FXAA shader GLSL version check to opengl_post_load_shader(), out of the GLSL shader compiler preprocessor stage. 2016-01-03 16:33:05 -05:00
Echelon9 49b5d9a3b7 Fix up the revert of 0345d09a513082d15b53b045471f3fe1e3621b9b 2016-01-03 16:33:04 -05:00
Echelon9 22f14d56ea Revert "GLSL: Provide a dynamic #version directive to the shaders, in line with OpenGL standards"
This reverts commit 0345d09a513082d15b53b045471f3fe1e3621b9b.
2016-01-03 16:33:04 -05:00
Echelon9 5f4568cc0e OpenGL: Correct typo in one use of the __VERSION__ predefined macro 2016-01-03 16:33:04 -05:00
Echelon9 39842e7115 OpenGL: Rely on predefined macro __VERSION__ in GLSL language specification, rather than rolling our own. This predefined macro has been a language feature in all GLSL versions we support. See Section 3.3 Preprocessor. 2016-01-03 16:33:04 -05:00
Echelon9 cb90d286e5 GLSL: Provide a dynamic #version directive to the shaders, in line with OpenGL standards 2016-01-03 16:33:04 -05:00
Echelon9 e4c98e8527 Remove final DirectX Shader Model concepts. OpenGL GLSL version supported by the driver can be directly queried, rather than a layer of abstraction through SM2, SM3 and SM4. Allows Use_GLSL to be removed following refactoring. 2016-01-03 16:33:04 -05:00
Echelon9 5d593f0df0 Plumb through is_minimum_GLSL_version() 2016-01-03 16:33:04 -05:00
Echelon9 a045e5d266 Refactor out -disable_glsl_model command line option, which is encoded in Use_GLSL internally 2016-01-03 16:33:04 -05:00
Echelon9 21b8e3bb52 Add helper function is_minimum_GLSL_version() 2016-01-03 16:33:04 -05:00
Echelon9 3aa671a211 Replace SHADER_MODEL with GLSL_VERSION 2016-01-03 16:33:04 -05:00
Echelon9 d3ce9874a7 DirectX Shader Model 4.0 is equivalent to GLSL version 3.30. Source: https://www.opengl.org/wiki/Detecting_the_Shader_Model 2016-01-03 16:33:04 -05:00
SamuelCho 1cfbc24fb9 Merge branch 'master' into kill_ship_model_start 2016-01-03 13:04:03 -08:00
SamuelCho 4a4486c9be Merge branch 'master' into kill_ship_model_start 2016-01-03 13:02:47 -08:00
Yarn366 a1caca08ab Merge branch 'master' into hud_scale_limit 2016-01-03 14:18:18 -05:00
niffiwan e32e21bcd0 Merge pull request #509 from SamuelCho/team_glow_alpha_channel
Only enable team glow colors if team color texture mask has an alpha channel.
2016-01-03 20:16:24 +10:00
Yarn366 3fd9b8f802 Fix the errors reported by AppVeyor and Travis CI (take 2) 2016-01-03 04:29:59 -05:00
Yarn366 890c607ad2 Fix the errors reported by AppVeyor and Travis CI (hopefully) 2016-01-03 03:56:13 -05:00
Yarn366 e2dac4b7b4 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into hud_scale_limit 2016-01-03 03:12:29 -05:00
Yarn366 3512fcc18e Changed the gauge loaders to accept a pointer to the new gauge_settings struct instead of a bunch of values. 2016-01-03 03:12:00 -05:00
SamuelCho f57e346eff Only enable team glow colors if team color texture mask has an alpha channel. 2016-01-02 16:47:28 -08:00
niffiwan 768e097c73 Merge pull request #508 from MageKing17/cleanup/stop-exporting-no_fps_capping
Stop exporting -no_fps_capping to the launcher.
2016-01-03 09:20:28 +10:00
MageKing17 b0115a5f80 Stop exporting -no_fps_capping to the launcher.
Given the number of unintended consequences that can result from use of this command-line flag, we should return to the pre-137eb7e4d4cb0f9c153d15bbcce847347aa3d716 behavior of not including it in the exe_params[] array; anyone who knows what it does and why we don't advertise it can still use it for testing purposes, but it should prevent the typical user from turning it on without knowing exactly what can go wrong.
2016-01-02 12:19:13 -08:00
niffiwan a23630346b Merge pull request #505 from DahBlount/Fix-for-Coverity-#1343617
Fix for coverity 1343617
2015-12-31 17:40:29 +10:00
DahBlount d4d805d6ca Move turret_enemy_objnum check further up in block and change to Assertion 2015-12-30 23:44:04 -07:00
niffiwan b147ea0a21 Merge pull request #506 from Karajorma/BUGFIX-RepeatCounts
Fix the issue with repeat counts first discovered on this thread http…
2015-12-30 21:47:27 +10:00
Karajorma 8a2eec5b4a Fix the issue with repeat counts first discovered on this thread http://www.hard-light.net/forums/index.php?topic=90763.msg1801379#msg1801379 2015-12-30 16:56:50 +08:00
niffiwan ee64b83aec Allow shield hit animations to play to the end
Previously they'd always stop at 75% complete, and it's probably just
luck that it worked correctly for ✌️
2015-12-28 14:55:54 +10:00
MageKing17 24b58db67f Merge pull request #479 from SamuelCho/hud_lock_fix_for_issue_456
My attempt to fix the HUD lock scoping issues raised by issue #456.
2015-12-25 22:52:40 -08:00
Samuel Cho 2ddee36007 Cleaned up HudGaugeLock::render() and removed hud_draw_diamond() since that's not being used. 2015-12-25 19:34:39 -08:00
Goober5000 7e9a798101 Merge pull request #503 from Goober5000/sf2_no_disabled_self_destruct
add no-disabled-self-destruct ship flag
2015-12-21 11:08:38 -05:00
Goober5000 542dc68df2 add to Ship_flag_names array 2015-12-21 00:56:51 -05:00
Goober5000 b1ac0876d4 add no-disabled-self-destruct ship flag
Normally, ships whose weapons or engines subsystems are destroyed will
self-destruct after 90 seconds if they are part of a wing (see
ai_maybe_self_destruct).  This adds a ship flag to prevent that from
happening.
2015-12-20 23:12:59 -05:00
Goober5000 7badc4dfd9 Merge pull request #476 from MageKing17/feature/weapon-bank-modular-compatibility
Modular tables now clear allowed weapons if +noreplace isn't specified.
2015-12-17 00:47:28 -05:00
niffiwan 036aae0ee2 Merge pull request #502 from SamuelCho/team_color_glows
Team color glows
2015-12-17 12:50:53 +10:00
SamuelCho 9cc70790c9 Save all the channels of the team mask, not just the red and green channels. 2015-12-16 00:57:12 -08:00
SamuelCho 7d392bd61c Adjust the blended glow color value by how much the team mask contributes to this fragment. 2015-12-16 00:44:58 -08:00
SamuelCho 1552e02a51 Added support for glowing team color textures. 2015-12-16 00:20:15 -08:00
Fabian Woltermann 175640d60a Merge pull request #492 from SamuelCho/faster_bmp_lookup
Changed bitmap_lookup to use ubyte instead of floats.
2015-12-16 06:39:50 +01:00
SamuelCho 6583066936 Don't reset lock rendering timers and switches unless we really need to. 2015-12-15 20:39:38 -08:00
MageKing17 3c564b3210 Merge pull request #494 from DahBlount/Share-Fire-Direction-Turret-Flag
Share fire direction turret flag
2015-12-15 12:48:53 -08:00
DahBlount 9b7ebff53a Change NULL to nullptr and change fighter beam flag comparison from > to != 2015-12-15 09:54:34 -07:00
DahBlount 1491d4a79a Create "share fire direction" subsystem flag 2015-12-15 09:54:32 -07:00
Fabian Woltermann d603c463af Merge pull request #499 from DahBlount/Final-Attempt-at-Fixing-Environment-Reflections
Fix environment reflection rotation issue
2015-12-15 15:12:27 +01:00
SamuelCho 3eb47c1867 ship_render() still needs to clear out miscellaneous per-draw model data. 2015-12-14 23:19:08 -08:00
SamuelCho 2db4bc37f2 Removed unused variable sii. 2015-12-14 00:06:16 -08:00
SamuelCho 0f0f6377d0 Killed the last vestiges of ship_model_start/stop. 2015-12-13 23:51:24 -08:00
Yarn366 8e7ad5f651 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into hud_scale_limit 2015-12-14 01:41:13 -05:00
DahBlount bade3c58eb Normalize the position vector used in environmental reflections 2015-12-13 15:03:31 -07:00
m!m 85a36e6fd8 Merge pull request #496 from SamuelCho/missing_destroyed_subsys
Fixes missing destroyed submodels from the polymodel_instance rendering commit.
2015-12-09 22:26:42 +01:00
Samuel Cho 2deffc1156 Removed comment from model_set_instance that no longer describes SSF_NO_DISAPPEAR functionality. 2015-12-09 10:32:36 -08:00
Fabian Woltermann 82ae54a6e8 Merge pull request #495 from SamuelCho/no_lighting_fix
Restore SIF2_NO_LIGHTING functionality for ship_render().
2015-12-09 09:02:11 +01:00
SamuelCho 0062d2567a Fixes missing destroyed submodels from the polymodel_instance rendering commit. 2015-12-08 23:53:53 -08:00
SamuelCho 7972cad563 Restore SIF2_NO_LIGHTING functionality for ship_render(). 2015-12-08 20:06:27 -08:00
niffiwan c9cff48b95 Merge pull request #493 from ln-zookeeper/master
Fix a small glitch in shield icon alpha range
2015-12-08 22:49:09 +10:00
Lari Nieminen 8d0624b064 Fix a small glitch in shield icon alpha range
Calculates the alpha range using the actual number of shield segments instead of 4.
2015-12-08 14:08:34 +02:00
SamuelCho 236857ed37 Changed bitmap_lookup to use ubyte instead of floats for the color channels. Should make reading bitmaps faster. 2015-12-07 22:59:28 -08:00
MageKing17 fa57ea358a Merge pull request #444 from asarium/feature/benchmark
Add benchmark command line option
2015-12-07 02:28:15 -08:00
MageKing17 a7bf7c63de Merge pull request #490 from Goober5000/shipfx_little_explosions_fix
for model vertices, use the entire range of RAND_MAX, not the range divided by 32
2015-12-05 15:45:52 -08:00
Goober5000 81676b7d3f a few tweaks from the PR...
a) remove redundant (shadowing) polymodel *pm declaration
	b) end Warnings with \n
	c) remove no-longer-needed Asserts (they are handled by the Error check above)
2015-12-05 14:25:28 -05:00
Goober5000 e1e188a43c use the entire range of RAND_MAX, not the range divided by 32 2015-12-05 13:02:27 -05:00
Goober5000 47286d1af2 Merge pull request #483 from chief1983/fix/292_unused_functions
Wrap some unused functions in a diagnostic protection pragma
2015-12-04 21:08:55 -05:00
Yarn366 fa10977e77 Added parameters that allow HUD scaling to be disabled at lower resolutions and enabled at higher resolutions. 2015-12-03 20:06:06 -05:00
Fabian Woltermann aaa80dfa6f Merge pull request #486 from SamuelCho/model_instance_rendering
Allow model rendering code to use polymodel_instance.
2015-12-03 06:34:09 +01:00
SamuelCho 59fa7bd544 Remove superfluous line. 2015-12-02 19:08:59 -08:00
m!m 3c8b47ccfc Merge pull request #460 from MageKing17/feature/subsys-autorepair-when-disabled
Adds the ability for subsystems to repair themselves when disabled.
2015-12-02 21:37:20 +01:00
MageKing17 81d8d063c2 Un-cluttering the autorepair conditional by spreading it out a little.
Should hopefully be a bit more readable this way.
2015-12-02 12:11:20 -08:00
MageKing17 75471276fc Adds "don't autorepair if disabled" to blacklist a specific subsystem.
Obviously won't do anything if "repair disabled subsystems" ship flag isn't set. If both subsystem-specific flags get set at the same time, whichever one would be default behavior (based on the presence or absence of the ship-wide flag) gets removed and a Warning generated.
2015-12-02 08:29:04 -08:00
MageKing17 89d6031c79 Adds the ability for subsystems to repair themselves when disabled.
Can either be set for individual subsystems via the "autorepair if disabled" flag, or set for an entire ship via the "repair disabled subsystems" flag. It will, by necessity, only have an effect if the ship's "$Subsystem Repair Rate:" is a positive number.
2015-12-02 08:29:03 -08:00
MageKing17 551d64192c Merge pull request #481 from The-E/vm_vec_cleanup2
Cleanup in vecmat, aile 2
2015-12-02 08:18:37 -08:00
asarium 661678f693 Fix an issue identified by MageKing17 2015-12-02 17:07:53 +01:00
asarium 94ca29735c Quit when the end of the mission is reached 2015-12-02 17:03:54 +01:00
asarium 20f84c179a When benchmarking automatically accept pilot screen 2015-12-02 17:03:54 +01:00
asarium 5f622094af Add commandline option for benchmarking 2015-12-02 17:03:54 +01:00
SamuelCho 64ad950a80 Allow model rendering code to use polymodel_instance. Removes the reliance on ship_model_start/stop for rendering models. Also fix a bunch of oversights involving blown off models in the polymodel_instance code. 2015-12-01 23:53:24 -08:00
niffiwan a30937b041 Merge pull request #484 from chief1983/asan_flag
AddressSanitizer toggle flag for configure.ac
2015-12-02 13:17:18 +10:00
Cliff Gordon 764e1772b0 Remove the -Wno-unused-function hider. Should be able to fix these with this method if any more crop up on Linux. 2015-12-01 20:56:10 -06:00
Cliff Gordon ea549ab5a0 [fix/292_unused_functions] Mark rotate_z and accurate_square_root as unused. Last part of the issues in #292. 2015-12-01 20:56:06 -06:00
niffiwan af22ab34d3 Merge pull request #482 from chief1983/fix/187_debugging
Enhance an Assert to help track down how issue 187 could happen
2015-12-02 08:35:53 +10:00
chief1983 c8785dc093 [asan_flag] AddressSanitizer toggle flag for configure.ac. 2015-12-01 16:32:32 -06:00
Cliff Gordon 870ad9e3ae [fix/187_debugging] Enhance an Assert to help track down how issue 187 could happen. 2015-12-01 14:54:57 -06:00
The E 487f769064 Renaming vm_copy_transpose_matrix to vm_copy_transpose 2015-12-01 20:38:30 +01:00
The E 7604e82f05 Renaming vm_transpose_matrix to vm_transpose 2015-12-01 20:37:33 +01:00
The E e0defd287a Renaming vm_vec_crossprod to vm_vec_cross 2015-12-01 20:36:34 +01:00
The E a413255728 Renaming vm_vec_dotprod to vm_vec_dot 2015-12-01 20:35:47 +01:00
MageKing17 d6b0e9f566 Merge pull request #480 from The-E/mat_inverse_cleanup
Addressing a few small issues with PR 468
2015-12-01 07:35:31 -08:00
Fabian Woltermann 22e6de42a4 Remove comment here 2015-12-01 13:04:22 +01:00
Fabian Woltermann 9548002890 Removing code that has no place here 2015-12-01 11:39:28 +01:00
Fabian Woltermann 0334bd0c3b Addressing a few small issues with PR 468 2015-12-01 11:34:00 +01:00
Fabian Woltermann 12b98063fb Merge pull request #474 from Goober5000/hull_hit_soundfx_fix
retail sounds 36 and 37 should actually be converted to 3D
2015-12-01 11:06:37 +01:00
Fabian Woltermann 854bd5ba21 Merge pull request #468 from DahBlount/Fix-reflections-for-real
Final fix for reflections
2015-12-01 11:04:06 +01:00
DahBlount 096029a88d Add Doxygen comments and additional changes 2015-12-01 00:55:30 -07:00
SamuelCho d8ab39e261 This line in the HUD lock gauge wasn't supposed to be deleted. 2015-11-30 23:48:57 -08:00
DahBlount 02d15f36b7 Change a1d to a2d 2015-12-01 00:34:55 -07:00
SamuelCho 66c9e0c136 My attempt to fix the HUD lock scoping issues raised by issue #456. 2015-11-30 23:16:43 -08:00
DahBlount fb29b28113 Add function to invert matrix4 and change mview to GL_env_texture_matrix to properly setup environment maps. 2015-11-30 09:36:30 -07:00
DahBlount 3fa03fcda0 Fix ENVMAP vertex shader to use the inverse of gl_ModelViewMatrix 2015-11-30 09:36:29 -07:00
Goober5000 cb8154a993 Merge pull request #478 from Yarn366/mantis/3096
Fix for Mantis 3096
2015-11-29 18:16:50 -05:00
Yarn366 a4f793e6dc Use the same FOV for everything in the main view, and apply the pi*(4/9) correction for ships to the briefing view. 2015-11-29 17:22:48 -05:00
m!m e36e9ff879 Merge pull request #473 from rtoijala/unix_modlist
Unix modlist
2015-11-28 19:43:47 +01:00
Risto Toijala 3287ff6b3a unix mods: change error to warning
Ignore failure to open directories that the filesystem gave us.
There's nothing we can do about it.

Also improve missing mod warning.

Tiny style improvement.
2015-11-28 18:20:56 +02:00
Risto Toijala 81092417bd unix mods: use "." instead of full cwd path to avoid error condition 2015-11-28 18:19:50 +02:00
Risto Toijala 947deb8e12 unix mods: switch parent and dir for readability 2015-11-28 18:18:26 +02:00
MageKing17 bd1aa5e455 Modular tables now clear allowed weapons if +noreplace isn't specified.
This makes them behave more like ship flags and should bring them around towards how modders intuitively expect using a modular table to override a ship's allowed weapons to work.

Fixes Mantis 3176.
2015-11-28 06:53:23 -08:00
Goober5000 01e4741da6 Merge pull request #475 from Yarn366/background_editor_spinner_fix
Fix for spinners in background editor
2015-11-28 02:22:18 -05:00
Yarn366 37f4587230 Apply rounding to orientation values so that the spinners in the background editor work properly 2015-11-28 01:56:09 -05:00
Goober5000 e11f6904b4 retail sounds 36 and 37 should actually be converted to 3D 2015-11-28 00:27:27 -05:00
MageKing17 d74981b700 Merge pull request #471 from MageKing17/feature/escort-gauge-right-aligned-names
Add "Right-Align Ship Names:" option to HudGaugeEscort.
2015-11-27 18:24:24 -08:00
MageKing17 6df0a704f2 Add "Right-Align Ship Names:" option to HudGaugeEscort.
It allows the escort gauge to render with ship names right-aligned, as the name would suggest. Changed gr_force_fit_string() to return the width instead redundantly returning the (already modified in-place) string; nothing else actually cares about the return value, so secondary impact should be nonexistent.
2015-11-27 18:22:45 -08:00
Risto Toijala 0b84c18686 also accept backslashes as path separators on unix 2015-11-27 20:16:45 +02:00
Risto Toijala 7523669819 allow subfolders in mod paths 2015-11-27 20:16:45 +02:00
Risto Toijala b1b8ae9668 move unix modlist handling to function 2015-11-27 20:16:45 +02:00
Risto Toijala bddf438fb6 clean up unix mod handling 2015-11-27 20:16:45 +02:00
MageKing17 87d07c9597 Merge pull request #472 from ln-zookeeper/bm_unlock_unload_fixes
Fixes to some bm_unlock and bm_unload calls
2015-11-26 23:53:09 -08:00
Lari Nieminen 407a2356eb Fixed silly syntax error 2015-11-26 18:06:41 +02:00
Lari Nieminen 0c5e6c7281 Fixes to some bm_unlock and bm_unload calls
As requested in https://github.com/scp-fs2open/fs2open.github.com/pull/449/files#r45241401

Note that I also included the ref_count >= 1 check.
2015-11-26 16:35:23 +02:00
m!m 2bd78eee74 Merge pull request #464 from The-E/inline_vecmat_removal
Removing the _INLINE_VECMAT preprocessor define
2015-11-26 13:49:01 +01:00
niffiwan 256ba6f9f2 Remove proposed AI profiles flag
Make the new behaviour the default, the change to gameplay should be
minimal due to the 2-frame feature being by far the largest factor in
current countermeasure effectiveness
2015-11-26 18:57:36 +10:00
niffiwan 040c1f39da Merge pull request #469 from Yarn366/more_hud_table_options
Shivan Hunter's requested HUD table features
2015-11-25 21:07:28 +10:00
Yarn366 8f6bdcddeb Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into more_hud_table_options 2015-11-24 16:32:45 -05:00
m!m ed855e6e1c Merge pull request #467 from PeterMitsis/toolchain
Abstract toolchain capabilities
2015-11-24 09:57:32 +01:00
Yarn366 33c7c4eae9 Added "Radar Center Offsets:" and "Radar Size:" to the 2D and 3D radar gauges 2015-11-23 19:48:04 -05:00
Yarn366 962261421e Added "Dock Max Width:" and "Order Max Width:" to extra target data gauge 2015-11-23 18:29:40 -05:00
Yarn366 5144dba6b4 Added "Fixed Header Position:" to wingman gauge 2015-11-23 18:22:37 -05:00
Peter Mitsis 9bbebfc55e [fix] toolchain: Abstract compiler capabilities
Fixes various typos from the commit titled
    'toolchain: Abstract compiler capabilities'

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-23 06:54:41 -05:00
MageKing17 02fc2b29ca Revert "Fix envmap orientation"
This reverts commit a033f653d0.
2015-11-23 00:20:55 -08:00
Fabian Woltermann b097d3e7c2 Merge pull request #466 from DahBlount/fix/mantis_0003014
Fix Mantis 0003014
2015-11-23 07:40:59 +01:00
DahBlount a033f653d0 Fix envmap orientation 2015-11-22 17:02:06 -07:00
The E 4b37433c4f Removing the _INLINE_VECMAT preprocessor define. This is something the compiler is better equipped to decide. 2015-11-22 21:00:24 +01:00
Peter Mitsis 002dc3a965 toolchain: Introduce __ALIGNED(x) macro
The __ALIGNED(x) macro may be used to tell the compiler to align the
symbol's address to an 'x' byte boundary.  Note that 'x' must be a
power of two.

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-22 11:32:07 -05:00
Peter Mitsis 7da81210ea toolchain: Introduce likely() and unlikely() macros
The likely() and unlikely() macros may be used as hints to the compiler to
indicate whether a branch is likely or unlikely to be taken so that it may
generate code accordingly.

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-22 11:32:07 -05:00
Peter Mitsis 57c16bd58a toolchain: Replace __attribute__((__unused__)) with __UNUSED
Abstracting this allows for the possibility of other compilers to have their
own implementation of marking a variable as potentially unused without using
the __attribute__ keyword (which is not supported on all compilers).

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-22 11:32:07 -05:00
Peter Mitsis 13c86d9540 toolchain: Abstract compiler capabilities
Abstract compiler capabilities to help simplify support for various
toolchains.

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-22 11:32:04 -05:00
niffiwan 338d6c9aaf Allow countermeasures to decoy missiles once only
Adds ai_profiles flag
    $countermeasures decoy a missile once:
Also (re)adds logging to make it easier to figure out what the
countermeasures are doing. Try adding "+countermeasures" to your
debug_filter.cfg file.
2015-11-22 20:36:03 +10:00
Goober5000 d59c4d44cc Merge pull request #461 from niffiwan/fix/cm_float_int
CMEASURE_DETONATE_DISTANCE should be a float
2015-11-21 14:32:05 -05:00
niffiwan 0e07f4414e CMEASURE_DETONATE_DISTANCE should be a float
Thanks to Goober5000 for noticing this
2015-11-21 21:18:08 +10:00
Fabian Woltermann 71cf169a0a Merge pull request #457 from asarium/feature/versionCheck
Add "$Minimum version" to game settings table
2015-11-21 11:08:13 +01:00
Fabian Woltermann 184a583a32 Merge pull request #459 from MageKing17/bugfix/support-subsystem-repair
Fix support subsystem repair rate (for real this time).
2015-11-20 17:24:47 +01:00
Fabian Woltermann fd66a432f5 Merge pull request #458 from MageKing17/cleanup/version-specific-comment-consistency
Improve consistency/flexibility of version-specific comments.
2015-11-20 17:23:47 +01:00
MageKing17 039359e7f2 Fix support subsystem repair rate (for real this time).
PR #445 was unfortunately incomplete; it fixed the time estimate for repairs, but not the actual repair part. I think I've identified which piece of code was preventing the actual repairs from working. This "repair_allocated > 0" conditional is actively preventing the "sip->sup_hull_repair_rate == 0.0f" branch from executing (so repair_allocated remains 0 and subsystems can't actually repair).
2015-11-20 06:50:49 -08:00
asarium 0bb6002f0a Fix compilation error
Apparently multi_update.cpp isn't used anywhere in the code. That file
could be removed in the future.
2015-11-20 12:24:10 +01:00
MageKing17 91dbf8b751 Improve consistency/flexibility of version-specific comments.
matches_version_specific_tag() now uses the previously-FRED-only scan_fso_version_string() function, meaning it now supports version-specific comments with as few numbers as ;;FSO 3;; to as many numbers as ;;FSO 3.7.3.20151106;;, instead of you being required to supply exactly 3 numbers.
2015-11-20 03:22:45 -08:00
Fabian Woltermann 0c6bada5d5 Merge pull request #455 from Goober5000/set_arrival_info_sexp_help_tweak
improve sexp help regarding bitmasks on ship-arrival-info and ship-departure-info
2015-11-20 12:10:59 +01:00
asarium 519e89b6fa Add "$Minimum version" to game settings table
This allows a modder to specify a minimum FSO version that is needed
for the mod.
2015-11-20 11:51:51 +01:00
Goober5000 ce7c7eb3f5 Merge pull request #454 from MageKing17/bugfix/lua-wing-indexer-crash
Fix various issues with wings in the Lua interface
2015-11-20 01:31:39 -05:00
Goober5000 8f3342f05e improve sexp help regarding bitmasks on ship-arrival-info and ship-departure-info 2015-11-20 00:41:46 -05:00
MageKing17 6dd3158570 Make l_Wing functions handle invalid handles.
Indexing an invalid wing handle now returns invalid ship handles, getting its length returns 0, and getting its name returns an empty string.
2015-11-19 20:27:32 -08:00
MageKing17 004fdae08f Clean up a couple minor issues in lua.cpp
A few comparisons weren't excluding their upper bounds properly, and the documentation for the l_Wing length function was the documentation for the l_Mission_Wings length function.
2015-11-19 20:20:47 -08:00
MageKing17 8fcb1ee789 Add isValid() function to l_Wing objects.
The l_Mission_Wings indexer will return an invalid wing if supplied an invalid name/index. However, you had no way of telling that this was the case because there was no isValid() function to test its validity.
2015-11-19 20:18:31 -08:00
MageKing17 9630d80827 Change wing_name_lookup() to wing_lookup() in l_Mission_Wings indexer.
Avoids inconsistency whereby some wings could be looked up by index but not by name.
2015-11-19 20:16:37 -08:00
niffiwan e49159bd91 Merge pull request #418 from asarium/build/native
Use -march=native for linux builds
2015-11-20 14:10:44 +10:00
niffiwan a13542616d Merge pull request #452 from MageKing17/bugfix/too-many-classes-error
Change warning from too many ship/weapon classes to an error.
2015-11-20 14:09:28 +10:00
Fabian Woltermann 1960723f88 Merge pull request #453 from Yarn366/target_font_height_fix
Target bracket line height fix
2015-11-19 22:54:17 +01:00
asarium 206fbabaa5 Use -march=native for linux builds 2015-11-19 22:38:19 +01:00
MageKing17 5394b4943d Change warning from too many ship/weapon classes to an error.
If a modular table broke the weapons limit, it would warn about too many weapon classes, and then not actually skip the entry, because of the "if(!replace)" conditional around it, resulting in nonsensical parsing errors. Rather than just fix this error, it was suggested on IRC (by The_E) that these problems should instead cause immediate errors. Upon reflection, this makes more sense: if the mod exceeds the limits, there's little point in loading it anyway and having things be missing.

Hopefully, eventually, these limits will be removed altogether, but until then, exceeding them should not just be a dismissible warning.
2015-11-19 12:37:45 -08:00
Yarn366 69f9d9f090 Make the target bracket gauge account for the sizes of the font and the attacker blip 2015-11-19 15:35:31 -05:00
niffiwan 1cb08e0262 Merge pull request #450 from asarium/fix/subModelRange
Make this Assert a little more informative
2015-11-19 07:07:09 +10:00
asarium 154a50028b Make this Assert a little more informative 2015-11-18 18:43:19 +01:00
niffiwan e11771980e Merge pull request #447 from MageKing17/bugfix/fred-message-delete-assert
Fix incorrect assertion in FRED's Event Editor when deleting a message.
2015-11-18 09:39:35 +10:00
MageKing17 edbec0fca9 Fix incorrect assertion in FRED's Event Editor when deleting a message.
The function can get called with an m_cur_msg of -1 if there are no messages defined by the mission; since this is apparently intended behavior (and causes no problems thanks to the immediately-following if-statement), may as well change this assertion.
2015-11-17 14:08:38 -08:00
m!m 2c268e4ec6 Merge pull request #437 from niffiwan/feature/aspect_lost_lock_det
Allow aspect missiles to die when have lost lock
2015-11-16 20:10:42 +01:00
m!m 2a9cff4f46 Merge pull request #443 from DahBlount/InBriefMissionChange
Add jumpToMission LUA function and a jump to hub function
2015-11-16 19:58:34 +01:00
DahBlount 9050c08bec Add jumpToMission LUA function and a jump to hub function
The purpose of this function is to provide modders the capability to jump to a mission using LUA scripts. There is an optional argument for jumping to a hub mission, a good example is the JAD campaign map.
2015-11-16 10:45:59 -07:00
Goober5000 799ebe01ce Merge pull request #445 from DahBlount/Subsys-Repair-Fix
Fix support subsystem repair rate
2015-11-15 20:26:18 -05:00
DahBlount 248c398ba9 Fix support subsystem repair rate 2015-11-15 17:44:26 -07:00
Goober5000 96ede6f68b Merge pull request #433 from Yarn366/multiple_background_adjustment
Change criteria for using second mission background
2015-11-15 01:07:53 -05:00
Goober5000 8177c03f3f Merge pull request #423 from niffiwan/feature/customise_cm_det_rad
Add two small countermeasure features
2015-11-15 01:01:39 -05:00
m!m 546339c53a Merge pull request #440 from The-E/no_persona_defaulting
small error correction
2015-11-14 23:20:14 +01:00
The E f790b3b0c6 small error correction 2015-11-14 23:13:32 +01:00
m!m bbcfe162da Merge pull request #439 from The-E/no_persona_defaulting
Adds Persona flag "$Allow substitution of missing messages:"
2015-11-14 15:54:44 +01:00
m!m 51efc000ab Merge pull request #435 from PeterMitsis/lighting-apply-keywords
Lighting apply keywords
2015-11-14 14:35:57 +01:00
The E cbad1cf10f Addressing style comments 2015-11-14 13:30:51 +01:00
Peter Mitsis 56343f0d03 lighting: remove void keyword from empty argument list
Routines in the lighting module that do not have any arguments do not
need the 'void' keyword in either their definitions or declarations.

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-14 07:08:52 -05:00
The E 67d51037ff Adds Persona flag "$Allow substitution of missing messages:" 2015-11-14 12:55:41 +01:00
Goober5000 47d82a007f Merge pull request #434 from asarium/multi/staticAssert
Check the size of data in multi packets
2015-11-13 21:20:44 -05:00
m!m 036000f79c Merge pull request #438 from DahBlount/Damage-Attenuation-Update
Deprecate +Min Damage and +Max Damage, add +Attenuation Damage:
2015-11-13 21:51:58 +01:00
DahBlount 3e6fb113ee Deprecate +Min Damage and +Max Damage, add +Attenuation Damage: 2015-11-13 12:26:04 -07:00
MageKing17 515f9fffb5 Merge pull request #431 from The-E/more_ship_classes
Upped MAX_SHIP_CLASSES to 500
2015-11-13 07:13:21 -08:00
asarium 28c9512727 Fix compilation
Now the static_asserts use the types from cstdint
2015-11-13 11:52:52 +01:00
Fabian Woltermann e9a3e457cc Merge pull request #426 from Yarn366/events_editor_filename_fix
Fix for crash in events editor
2015-11-12 19:27:17 +01:00
Fabian Woltermann 3637a9717c Merge pull request #427 from DahBlount/Directional-Beam-Glows
Directional beam glows
2015-11-12 19:26:27 +01:00
niffiwan ed6637031d Allow aspect missiles to die when have lost lock
Note that aspect missiles don't lose lock when their target dies, I'll
see about adding that later
2015-11-12 19:09:59 +10:00
Peter Mitsis f5ccad9619 lighting: Apply keywords
Applies the following keywords to the lighting module:
   const
   static
   void
   extern

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-11 11:20:01 -05:00
Peter Mitsis b10de88cf0 lighting: Remove unused global variables
The following global variables from the lighting module were unused
and are being removed:
	int cell_shaded_lightmap = -1;
	int spec = 0;

Signed-off-by: Peter Mitsis <[email protected]>
2015-11-11 11:20:01 -05:00
asarium 34a7f7d60f Check the size of data in multi packets
This will make sure that compiler changes that affect the size of a
type are noticed early.
2015-11-11 14:56:14 +01:00
Yarn366 9d6b373781 Undid the function name changes 2015-11-10 23:22:34 -05:00
Yarn366 05eb4c0617 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into multiple_background_adjustment 2015-11-10 19:51:08 -05:00
Yarn366 320fd33431 If even one element in the first mission background is missing, fall back to the second background if it exists 2015-11-10 19:48:54 -05:00
niffiwan 22832957f3 Merge pull request #432 from MageKing17/bugfix/ship-turret-target-order
Fix ship-turret-target-order.
2015-11-11 09:26:38 +10:00
MageKing17 dba2d28265 Fix ship-turret-target-order.
We were declaring an array of NUM_TURRET_ORDER_TYPES ints, and then only specifying the first oindex of them; the memcpy() could've been changed to multiply by oindex instead, but it seemed cleaner to just reset new_target_order to -1 in all values and get rid of the redundant per-ship reset.

Discovered by triggering an Int3() in aiturret.cpp (line 1167 as of this writing) and finding uninitialized values in the turret_targeting_order array.
2015-11-10 14:55:55 -08:00
The E 647f6a867b Upped MAX_SHIP_CLASSES to 500 2015-11-10 15:55:46 +01:00
DahBlount 89d072e18c Add +Directonal Glow:
This goes directly below +Muzzleglow: in $Beam Info: and causes the muzzle glow to be rendered along a projected poly instead of a bitmap.
Takes a float argument that is the length of the glow.
2015-11-09 14:28:40 -07:00
Yarn366 b1e7a2a1bf Don't add an extension to a sound's file name if the extension is supposed to be present already 2015-11-09 00:31:40 -05:00
niffiwan 4849f443aa Missed two places to use killer_infop 2015-11-08 14:51:04 +10:00
niffiwan aff81fe471 Countermeasures can detonate a single missile
As opposed to detonating all missiles within a radius. Is more
efficient than previous code that traversed the entire missile object
list to find all the missiles to detonate

Add to weapons tbl/tbm
$Countermeasure:
    +Single Missile Kill:   False
2015-11-08 14:42:29 +10:00
niffiwan 26d40553b2 Allow countermeasure kill-distance to be moddable
Trivial efficiency improvement by calculating a pointer once & reusing
it. Add more countermeasure nprintf messages

Add to weapons tbl/tbm
$Countermeasure:
    +Missile Detonation Radius: 40
2015-11-08 14:41:40 +10:00
MageKing17 f876b89c24 Merge pull request #422 from niffiwan/cleanup/subsys_path_assert
Change Assert to Error
2015-11-07 20:20:40 -08:00
niffiwan 2c8d921d64 Change Assert to Error
This seems to be a data error rather than a coding error. Also provide
the user with more info to assist with tracking down the source of the
problem.
2015-11-08 13:04:13 +10:00
Fabian Woltermann fc52668f30 Merge pull request #421 from Echelon9/fix/gr_opengl_init
Small tweaks to gr_opengl_init()
2015-11-07 14:35:13 +01:00
Echelon9 97c5a29b76 Better wrap to 80 character lines where sensible in gr_opengl_init() 2015-11-07 23:17:42 +11:00
Echelon9 fa9bd1c446 Whitespace clean up 2015-11-07 23:17:42 +11:00
Echelon9 04352920ee Export opengl_tnl_init(), so that it doesn't need to be extern'd. Consistent with opengl_tnl_shutdown() 2015-11-07 23:17:42 +11:00
Echelon9 8111924f9b OpenGL: Use the Core rather than older Extension form of GL_MAX_TEXTURE_IMAGE_UNITS 2015-11-07 23:17:42 +11:00
Echelon9 a11c69673e Const correctness for ver in gr_opengl_init() 2015-11-07 23:17:42 +11:00
MageKing17 ee730d23c9 Merge pull request #420 from Echelon9/fix/GL_SHADING_LANGUAGE_VERSION
Use the Core rather than older Extension form of GL_SHADING_LANGUAGE_VERSION
2015-11-07 04:07:29 -08:00
Echelon9 0b61d0bd8e OpenGL: Use the Core rather than older Extension form of GL_SHADING_LANGUAGE_VERSION. 2015-11-07 21:52:43 +11:00
Fabian Woltermann 0fcde305ec Merge pull request #419 from Echelon9/fix/GLSL4-sample-keyword
OpenGL: As of GLSL 4.00 'sample' is a keyword
2015-11-07 08:21:42 +01:00
Echelon9 697c900a25 OpenGL: As of GLSL 4.00 'sample' is a keyword. See further Section 3.6 Keywords https://www.opengl.org/registry/doc/GLSLangSpec.4.00.7.pdf 2015-11-07 14:44:06 +11:00
m!m fbc9ede423 Merge pull request #398 from Goober5000/g3_const
const-correctness inspired by #392, because why not be masochistic
2015-11-06 16:51:32 +01:00
m!m 0f36c6905d Merge pull request #417 from niffiwan/shadows_default_off
Disable shadows by default
2015-11-05 23:15:19 +01:00
niffiwan 1d66596bfb Disable shadows by default
Enable shadows with -enable_shadows
-shadow_quality should still work
2015-11-06 07:59:03 +10:00
Fabian Woltermann 444874b110 Merge pull request #416 from Goober5000/shipfx_shadow_function_retval_tweaks
change these functions to return bool rather than int; fixes a minor warning
2015-11-05 17:35:02 +01:00
Goober5000 b704050c21 change these functions to return bool rather than int; fixes a minor warning 2015-11-05 00:36:06 -05:00
MageKing17 5676dbf9bd Merge pull request #414 from Goober5000/issue_412_fix
properly close the fiction viewer when returning to the main menu
2015-11-04 03:04:09 -08:00
Goober5000 564f31aeab properly close the fiction viewer when returning to the main menu 2015-11-04 00:54:02 -05:00
niffiwan 0ea25e79a9 Merge pull request #411 from The-E/sexp_profiling
Profiling support for mission events and scripts
2015-11-03 22:32:51 +10:00
The E 5a37992d3d Adds profiling for sexp events and lua On Frame scripts. 2015-11-03 13:10:07 +01:00
Fabian Woltermann 3ade9ae1de Merge pull request #389 from Goober5000/shipfx_eye_in_shadow_alt_pr
Alternative suggested PR to #384
2015-11-02 09:51:17 +01:00
Fabian Woltermann f2aea8e69d Merge pull request #410 from niffiwan/valgrind/ds_load_buffer
Fix memory leak in ds_load_buffer
2015-11-02 09:50:08 +01:00
niffiwan 5c74720265 Fix memory leak in ds_load_buffer 2015-11-01 19:33:10 +10:00
niffiwan 556e9a4447 Merge pull request #404 from Yarn366/scalable_head_anis
Scalable head ANIs
2015-11-01 15:41:42 +10:00
Goober5000 1bd8e11194 Merge pull request #401 from niffiwan/fix/missionparse_ammo_II
Guard against negative array index reads
2015-10-31 15:08:49 -04:00
m!m bfc34953eb Merge pull request #408 from niffiwan/coverity/modeling_update
Model Assert/Assertion as Coverity killpaths
2015-10-31 11:46:11 +01:00
niffiwan 1c84c54e4f Model Assert/Assertion as Coverity killpaths 2015-10-31 20:17:12 +10:00
Goober5000 d790301fab Merge pull request #407 from niffiwan/valgrind/control_configs
Fix memory leak from Control_config_presets
2015-10-31 00:31:09 -04:00
niffiwan 253d8a7eb1 Fix memory leak from Control_config_presets 2015-10-31 14:06:56 +10:00
Goober5000 dc3c5fb561 Merge pull request #406 from niffiwan/travis/fix_cov_scan_builds
Fix coverity_scan builds
2015-10-30 23:39:59 -04:00
niffiwan eb1ff0f433 Fix coverity_scan builds
i.e. they should be building debug, not release
2015-10-31 12:51:33 +10:00
Fabian Woltermann 30564248a6 Merge pull request #405 from niffiwan/valgrind/camera_leak
Fix memory leak in cam_create/cam_close
2015-10-30 16:45:06 +01:00
niffiwan 9dfa67b64d Correctly compare vector .end() 2015-10-30 22:01:06 +10:00
Yarn366 c3c7477114 Made head animations scale to the size of the gauge window. Also deprecated "Animation Background Size" parameter and added the more accurately named "Animation Size" parameter, which sets how large animations should be. 2015-10-29 14:35:08 -04:00
Goober5000 bbad1c2159 more const-correctness per PR comments 2015-10-29 09:34:18 -04:00
niffiwan bb6e01caaf Merge pull request #403 from Yarn366/sparky_hi_fallback_fix
Sparky hi fallback fix
2015-10-29 19:05:07 +10:00
Yarn366 fc941e9ca8 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into sparky_hi_fallback_fix 2015-10-28 18:26:49 -04:00
Yarn366 93e8e3ab6f Resolutions below 1024x600 are no longer changed to 800x600 if sparky_hi_fs2.vp is missing.
In addition, the gr_get_resolution_class function has been added to avoid duplication of its code.
2015-10-28 18:21:31 -04:00
Goober5000 14eec21c68 Merge pull request #384 from The-E/mc_info_constructor
Better handling for mc_info
2015-10-28 08:48:57 -04:00
niffiwan 1ceae13be2 Guard against negative array index reads
Also convert Assert to Assertion to provide more info
2015-10-28 21:53:57 +10:00
niffiwan fb20632b18 Fix memory leak in cam_create/cam_close 2015-10-28 21:26:00 +10:00
niffiwan 62fcbeaae8 Merge pull request #380 from Goober5000/wf_never_existed_removal
remove WF_NEVER_EXISTED
2015-10-28 19:35:46 +10:00
niffiwan 4250751ccc Merge pull request #393 from Goober5000/convert_qsort_to_std_sort
convert qsort to std::sort
2015-10-28 19:33:12 +10:00
Fabian Woltermann 0a08b6348b Revert "Removes inline keyword from mc_info_init declaration"
This reverts commit c789b117cf.
2015-10-28 09:19:21 +01:00
Fabian Woltermann c789b117cf Removes inline keyword from mc_info_init declaration 2015-10-28 08:54:03 +01:00
niffiwan cc84210ac4 Merge pull request #399 from Goober5000/const_cast_trimming
remove obsolete const_casts
2015-10-28 17:13:36 +10:00
Goober5000 8a125ab019 remove obsolete const_casts 2015-10-28 00:18:31 -04:00
Goober5000 a7dcda9000 wip to avoid const_cast 2015-10-28 00:02:35 -04:00
Goober5000 bfc0948f1c let's change this antipattern here too 2015-10-27 22:52:03 -04:00
Goober5000 75411d92bb const-correctness inspired by 392, because why not be masochistic 2015-10-27 22:46:35 -04:00
MageKing17 afe29c60fe Merge pull request #392 from DahBlount/CLoseup-zoom-testing
Fix Closeup_Pos and Closeup_Zoom
2015-10-27 17:16:50 -07:00
m!m b0befdc1ba Merge pull request #397 from MageKing17/bugfix/issue-396
Restore local SSM behavior.
2015-10-27 22:55:39 +01:00
DahBlount 51c61b5144 Change closeup_pos in draw_model_icon() to a pointer 2015-10-27 15:51:45 -06:00
DahBlount 6cf105b768 Fix Closeup_Pos and Closeup_Zoom
The draw_model_rotating() and draw_model_icon() functions were receiving
the whole Weapon_Info array instead of a single weapon_info object (wip
in this case).
2015-10-27 15:51:44 -06:00
MageKing17 5fd09f8557 Restore local SSM behavior broken by 88e7c83. Fixes issue #396.
Not sure how I missed that when reviewing the PR, but there you go.
2015-10-27 14:48:21 -07:00
Fabian Woltermann 630ab5a3cc Makes sure mc_info_init sets everything to safe data. 2015-10-27 08:24:06 +01:00
Fabian Woltermann e28640ded0 Revert "Introduces a proper constructor for mc_info and removes the mc_info_init function on grounds of grave misuse of memset."
This reverts commit 35e34ac97c.
2015-10-27 08:15:45 +01:00
m!m 3708f101b4 Merge pull request #394 from niffiwan/valgrind/csg_read_missions
Fix memory leaks in mission_campaign_load
2015-10-26 23:15:24 +01:00
m!m 332b9fa4a4 Merge pull request #395 from The-E/debug_sexp_fix
Fix the debug sexp
2015-10-26 23:07:03 +01:00
The E e6aa565b42 Name change as suggested by m|m 2015-10-26 20:31:24 +01:00
The E 788e28c646 Creates a new variant of Warning that is not #ifdefed out on release to make the debug sexp work as its description implies 2015-10-26 19:47:51 +01:00
Goober5000 6ccf4116fc Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into wf_never_existed_removal 2015-10-26 02:27:10 -04:00
Goober5000 c4240324fb the comment really shouldn't have changed from the original retail '// if the current wave is zero, it never existed', because it illuminates the thought process behind the code 2015-10-26 02:26:51 -04:00
niffiwan 4fc2d9c610 Fix memory leaks in mission_campaign_load 2015-10-26 13:49:21 +10:00
Goober5000 ccc71a8e8b looks like we'll need them in these three other files too 2015-10-25 21:20:57 -04:00
Goober5000 7dde0a79a7 that was just dumb 2015-10-25 21:14:08 -04:00
Goober5000 e895f86e44 come on, Travis 2015-10-25 20:48:02 -04:00
Goober5000 31e9a0dd7d more linux compatibility 2015-10-25 20:23:26 -04:00
Goober5000 505de1b905 linux compatibility 2015-10-25 19:51:50 -04:00
Goober5000 b82d0c579d convert qsort to std::sort 2015-10-25 19:16:36 -04:00
niffiwan 68d2e5f0eb Merge pull request #391 from Goober5000/fred_completion_music_text_tweak
tweak the FRED and wxFRED dialog text to match the action
2015-10-26 08:46:33 +10:00
Goober5000 3c4861859b tweak the FRED and wxFRED dialog text to match the action 2015-10-25 16:33:28 -04:00
Fabian Woltermann 8ab5cd3085 Merge pull request #390 from Goober5000/game_sunspot_process_tweak
small optimization of shadow checks
2015-10-24 21:51:18 +02:00
Goober5000 eaa09dd862 small optimization of shadow checks 2015-10-24 15:42:06 -04:00
Goober5000 45c8ed8926 Merge pull request #383 from niffiwan/valgrind/generic_anim_stream
Fix memory leaks in generic_anim_stream
2015-10-24 15:18:50 -04:00
Goober5000 1f6fc358f8 just a tweak to avoid comparing whitespace 2015-10-24 15:07:58 -04:00
Goober5000 5b8584b892 clarify the use of mc_info_init, and make sure that model_instance_num and submodel_num have the proper values 2015-10-24 15:06:58 -04:00
MageKing17 0cdac667a3 Merge pull request #385 from asarium/coverity/1093606
Fix Coverity 1093606 for real this time
2015-10-24 05:41:26 -07:00
MageKing17 5137787a99 Merge pull request #388 from asarium/coverity/1093600
Revert "Fix for Coverity 1093600: Negative array index read"
2015-10-24 05:40:56 -07:00
asarium ddacb8cf32 Revert "Fix for Coverity 1093600: Negative array index read"
This reverts commit 2aa569c1e7.

As discussed in #386 hud_squadmsg_is_target_order_valid actually doesn't properly catch cases where the target_objnum may be -1.
2015-10-24 14:16:31 +02:00
asarium 88e7c83a8e Fix Coverity 1093606 for real this time 2015-10-24 12:53:03 +02:00
niffiwan 5b489da8a8 Merge pull request #376 from asarium/ci/fatalWarnings
Travis CI: Make warnings fatal errors
2015-10-24 20:08:53 +10:00
The E 35e34ac97c Introduces a proper constructor for mc_info and removes the mc_info_init function on grounds of grave misuse of memset. 2015-10-24 09:58:38 +02:00
MageKing17 1ba35d42ae Merge pull request #369 from The-E/player-fighterbays
Allow ships to arrive from hangars on player ships
2015-10-24 00:36:02 -07:00
niffiwan 409ba384b0 Fix memory leaks in generic_anim_stream 2015-10-24 15:04:13 +10:00
niffiwan 51c2a61d76 Merge pull request #382 from asarium/valgrind/1
Fix memory leak in bm_load_animation
2015-10-24 08:42:36 +10:00
asarium f1fd9f9a3d Fix memory leak in bm_load_animation 2015-10-23 22:35:56 +02:00
Goober5000 96d32b5031 remove WF_NEVER_EXISTED 2015-10-22 23:27:43 -04:00
Fabian Woltermann 21a16fbf15 Change this line back to what it was, with more accurate comment 2015-10-16 11:27:40 +02:00
Fabian Woltermann 76b6f954da Merge pull request #377 from MageKing17/bugfix/sexps-accessing-wrong-nodes
Fixes numerous SEXPs accessing the wrong nodes.
2015-10-16 06:06:58 +02:00
MageKing17 064a07349f Fixes numerous SEXPs accessing the wrong nodes.
Affected SEXPs include turret-set-target-order, turret-set-direction-preference, turret-set-rate-of-fire, turret-set-optimum-range, ship-turret-target-order, turret-get-primary-ammo, turret-set-primary-ammo, turret-get-secondary-ammo, and turret-set-secondary-ammo.

It's worth noting that while turret-set-direction-preference, turret-set-rate-of-fire, and turret-set-optimum-range were wrong, they were wrong in a way that wouldn't actually affect the outcome most of the time (thanks to the "if(turret == NULL)" checks simply skipping invalid subsystem names).
2015-10-15 18:58:27 -07:00
asarium bcedaee793 Fix "uninitialized variable warning" 2015-10-14 18:54:14 +02:00
asarium a020095b07 Disable array bounds checks in a Travis build 2015-10-14 18:44:57 +02:00
asarium a5f918a811 Remove -ansi option as it's not supported by clang 2015-10-14 18:20:44 +02:00
asarium 4e21d9ee79 Make error fatal when doing a CI build 2015-10-14 18:09:16 +02:00
asarium 7efd107bfa Fix format warning and syntax error 2015-10-14 18:07:45 +02:00
asarium 9f4589df65 Fix unitialized variable warning
GCC was complaining about an uninitialized warning but that was probably a false positive.
2015-10-14 17:51:21 +02:00
asarium 1d2153794c Fix an overflow warning
Signed overflow is not well defined in the standard but unsinged it so now that is used to determine if the model index counter has overflown.
2015-10-14 17:45:46 +02:00
asarium 4a40aad107 Fix invalid index warning
The new version now prints the name of the help overlay that could not be added.
2015-10-14 17:44:03 +02:00
asarium 14f1ceec4d Fix "unused return" warnings 2015-10-14 17:41:31 +02:00
Fabian Woltermann 2f78ae308b Consistency for the doxygen comments 2015-10-13 10:17:35 +02:00
Fabian Woltermann bc788d6cb7 More comment cleanup 2015-10-13 09:29:07 +02:00
Fabian Woltermann f1b9c15618 More comment tweaks 2015-10-13 09:15:52 +02:00
Fabian Woltermann eab9fab9ca Further, non-multi-breaking changes as suggested by MageKing17. 2015-10-13 09:11:36 +02:00
Fabian Woltermann a6d3982c7c Merge pull request #375 from MageKing17/bugfix/homing_pos-null-check
Check IS_VEC_NULL(&wp->homing_pos) for det_radius and arm_radius.
2015-10-13 08:01:48 +02:00
MageKing17 7852d13ce5 Check IS_VEC_NULL(&wp->homing_pos) for det_radius and arm_radius.
"$Detonation Radius:" and "$Arm radius:" would both rely on wp->homing_pos being set if wp->homing_object was; however, during free flight time, wp->homing_pos remains uninitialized (a null vector). As a result, their vm_vec_dist() calls would be comparing with the distance from the mission origin (coordinates 0,0,0) instead of the actual location of whatever they were homing in on. In the case of detonation radius, this would result in instant detonation on launch if you fired within det_radius of the mission origin. In the case of arm radius, this would result in the weapon being armed during free flight if launched within the arm_radius of the origin (and yes, you could theoretically experience the effects of both of these bugs simultaneously).

Theoretically, this solution is still less than ideal (a target sitting exactly on the mission origin could cause wonkiness), but it's consistent with the IS_VEC_NULL() checks elsewhere in weapons.cpp. A "proper" solution would basically require rewriting the entire homing code... which, obviously, if somebody would like to volunteer for, I wouldn't stop you ;). In the meantime, firing a homing weapon at a target sitting on the mission origin is even less likely than firing a weapon with one of the affected attributes within a certain distance of the mission origin, which was already pretty uncommon (it took a weapon with an abnormally large detonation radius of 1 kilometer to even realize this bug existed).
2015-10-12 22:48:15 -07:00
Fabian Woltermann ad62f1d342 Merge pull request #374 from MageKing17/bugfix/homing-object-NULL-confusion
Stop comparing/setting homing_object to NULL.
2015-10-13 07:23:34 +02:00
MageKing17 75ae511ae6 Stop comparing/setting homing_object to NULL.
The rest of the codebase uses &obj_used_list to mean "no homing target", and the inconsistency could cause all kinds of issues.
2015-10-12 16:10:05 -07:00
niffiwan 89ebdd9bc1 Merge pull request #373 from MageKing17/bugfix/turret-ammo-bank-3-typo
Fix a typo in the weapon editor dialogue for turret bank 3 ammo.
2015-10-13 08:27:41 +10:00
MageKing17 ccd6d1e619 Fix a typo in the weapon editor dialogue for turret bank 3 ammo. 2015-10-12 15:12:13 -07:00
Fabian Woltermann 92ace8e983 Further comment tweaks 2015-10-08 09:49:48 +02:00
MageKing17 61f2e78515 Merge pull request #370 from Goober5000/memset_bugfix
fix a memset typo identified by Echelon9
2015-10-05 12:38:59 -07:00
Goober5000 ebd81d9539 fix a memset typo identified by Echelon9 2015-10-05 11:49:54 -04:00
Fabian Woltermann d3df7ef2b1 Adds explanatory comments and applies the same logic to the net signature overload. 2015-10-05 08:08:46 +02:00
The E 99306be6cf Amendment based on Kara's feedback. Should allow same behaviour in both SP and MP. 2015-10-04 12:23:35 +02:00
The E 6835d2bf9f Only remove the player ship from the arrival list in singleplayer 2015-10-03 22:15:57 +02:00
Goober5000 3f9ce3b6a5 Merge pull request #368 from asarium/fix/configureType
Fix typo in configure.ac
2015-10-03 14:12:27 -04:00
asarium 08067bc871 Fix typo in configure.ac 2015-10-03 19:18:52 +02:00
MageKing17 415f113f4d Merge pull request #366 from The-E/ciws
Fixes the logic surrounding the ciws flag
2015-10-02 13:54:52 -07:00
MageKing17 a5b504bb85 Merge pull request #367 from The-E/longer-descriptions
Slightly increases the length limit for tech descriptions.
2015-10-02 13:54:09 -07:00
The E 9f94568d2f Slightly increases the length limit for tech descriptions. 2015-10-02 20:37:04 +02:00
The E ad4fed744e Normalizes the logic to work the same way in both cases 2015-10-02 20:22:51 +02:00
The E 0a081fb292 Fixes the logic surrounding the ciws flag 2015-10-02 19:33:09 +02:00
Fabian Woltermann efa5dc9620 Merge pull request #364 from Goober5000/background_bitmaps_tweak
made background sexp errors less fatal
2015-10-01 18:18:24 +02:00
Goober5000 bfb4db1dd4 made background sexp errors less fatal 2015-09-30 23:36:47 -04:00
MageKing17 2d56358755 Merge pull request #363 from DahBlount/Fix-debug-warning-in-Min/Max-Damage-definition-code
Additional debub warning move
2015-09-30 14:41:00 -07:00
DahBlount d52e27dcc4 Move debug warnings to optional_string()
Only check if we actually set a value for min or max damage.
2015-09-30 13:54:18 -06:00
Fabian Woltermann 12acacbba8 Merge pull request #362 from DahBlount/Fix-debug-warning-in-Min/Max-Damage-definition-code
Fix debug warning in min max damage definition code
2015-09-30 21:43:13 +02:00
DahBlount 3bbabea978 Add additional checks to min/max damage code
This checks the damage attenuation code for have a parameter being set
to 0.0f before hand to prevent debug warnings.
2015-09-30 13:19:10 -06:00
m!m cdc43731af Merge pull request #361 from Goober5000/cfile_null_bugfix
cfclose() will hit an assertion if we try to close a null pointer
2015-09-30 21:08:03 +02:00
Goober5000 edc806897f cfclose() will hit an assertion if we try to close a null pointer 2015-09-30 15:03:00 -04:00
MageKing17 f32a6e7ab9 Merge pull request #359 from ln-zookeeper/fotg_to_master
Make the array bounds check actually work
2015-09-25 12:30:14 -07:00
Lari Nieminen 2e9b2de40a Make the array bounds check actually work 2015-09-24 09:25:59 +03:00
MageKing17 69ab8c179d Merge pull request #357 from Goober5000/fiction_viewer_conditional_support
Fiction viewer conditional support
2015-09-23 16:14:46 -07:00
Goober5000 37657fc537 oh rubbish 2015-09-23 18:39:51 -04:00
Goober5000 1a5a0d6a7f change an Error to an Assertion, and made Fiction_viewer_text use nullptr instead of NULL 2015-09-23 18:38:34 -04:00
m!m 1a196cbd7a Merge pull request #356 from MageKing17/cleanup/voice-recognition-mantis-2373
Voice recognition cleanup based on Mantis #2373 patch.
2015-09-23 23:32:46 +02:00
MageKing17 89a6d69e08 Voice recognition cleanup based on Mantis #2373 patch.
* Frees cpAudio pointer in VOICEREC_deinit()
* Validates that the ship/wing can actually take orders, and validates that it can take the specific order in question before trying to send it.
* Reports the confidence of the voice match if DEBUG_ON is set.
* Various commenting changes based on the patch.

Not included: using confidence to discard voice matches that fall below a certain confidence level. I haven't noticed a tendency towards spurious matches, and I didn't want to introduce this without additional data, especially when it might cause problems for people with different accents (and ESPECIALLY without a setting to tweak the threshold value, which the original patch did not have; it was hardcoded at 90%).
2015-09-23 14:10:02 -07:00
Goober5000 b59c015df2 fix a subtle bug caught by Travis 2015-09-22 21:32:19 -04:00
Goober5000 c90db8c498 Merge pull request #314 from MageKing17/cleanup/fred-save-refactor
Refactor mission saving to avoid duplicate code.
2015-09-22 21:19:23 -04:00
Goober5000 cc79554f7a keep track of the active stage via index rather than via pointer because the vector may be resized 2015-09-22 20:39:37 -04:00
Goober5000 3df6bb82db add basic conditional support to fiction viewer stages 2015-09-22 20:17:31 -04:00
Goober5000 56a9391e31 some const-correctness 2015-09-22 19:02:10 -04:00
niffiwan bc5b7e6906 Merge pull request #355 from ln-zookeeper/l_cf_get_path_id_buf_fix
Fix possible out of bounds array access
2015-09-22 19:13:01 +10:00
Lari Nieminen 6dc3d67905 Fix possible out of bounds array access
If the input string is "/", then buf[-1] would get accessed and in rare cases also modified.
2015-09-22 11:43:20 +03:00
Goober5000 0d1764d42e Merge pull request #353 from Yarn366/per_mission_ui_backgrounds
Per-mission UI backgrounds
2015-09-21 17:02:03 -04:00
MageKing17 f4f31084fa Merge pull request #354 from Goober5000/no_move_collision_tweak
collision optimization: two objects which do not move will never coll…
2015-09-21 13:56:38 -07:00
Goober5000 5fb98551c9 collision optimization: two objects which do not move will never collide with one another 2015-09-21 16:30:19 -04:00
Yarn366 5f58aaa392 Merge branch 'master' into per_mission_ui_backgrounds 2015-09-20 21:05:46 -04:00
Yarn366 484be09275 Added support for custom fiction viewer backgrounds. Also moved the $UI parameter so it occurs just before the $File parameter. 2015-09-20 15:59:29 -04:00
m!m 26e65cc9e5 Merge pull request #350 from niffiwan/headzlessIII
Reduce bmpslot usage by headz
2015-09-19 12:49:11 +02:00
Fabian Woltermann 26bca473e2 Merge pull request #352 from niffiwan/headz_comment_fix
Fix comment for HudGaugeTalkingHead::render
2015-09-19 11:00:32 +02:00
niffiwan 0132e2a320 Fix comment for HudGaugeTalkingHead::render 2015-09-19 18:55:30 +10:00
Yarn366 873694eae2 Added unified functions for loading and saving custom UI backgrounds 2015-09-19 04:47:11 -04:00
niffiwan 0b1c916352 Merge pull request #351 from MageKing17/cleanup/scripting-call-bm_release-instead-of-bm_unload
Make script_state::UnloadImages() call bm_release instead of bm_unload.
2015-09-19 15:09:50 +10:00
MageKing17 835c4a7d0e Make script_state::UnloadImages() call bm_release instead of bm_unload.
Should result in reduced BMPMAN slot usage with certain scripts as bm_unload() unloads the image data but holds on to the slot, while bm_release() releases the slot.
2015-09-18 21:22:07 -07:00
Yarn366 f0c0d60a11 Fiction viewer UI can now be set in mission files and game_settings.tbl 2015-09-18 21:51:24 -04:00
niffiwan 12f4bcfd9b Reduce bmpslot usage by headz
As headani's (both ANI & EFF) are streamed there's no need to have
the anim data in bmpman, the streaming code does that with only two
slots, rather than one slot per ani frame
Also fix a "leak" in the streaming code use of bmpman slots. i.e. each
time a message was played another slot would be used & not released
2015-09-18 19:34:28 +10:00
niffiwan 30c8d09c55 Merge pull request #349 from MageKing17/bugfix/for-counter-double-free
Fix double-free with for-counter (introduced by myself).
2015-09-17 13:06:06 +10:00
MageKing17 53f7f493cf Merge pull request #335 from ln-zookeeper/fotg_to_master
Fixed the $On Ship Arrive hook code as per issue #334 and PR #333
2015-09-16 19:58:01 -07:00
MageKing17 24b0b28f6a Fix double-free with for-counter (introduced by myself).
In 9ec10dd I thought I was fixing a memory leak, but the actual scenario was that the freeing was just delayed until later. This removes the freeing added by 9ec10dd and changes the free() calls into vm_free() calls.
2015-09-16 19:55:24 -07:00
Yarn366 0af93bcceb Fixed attempts to access current debriefing as an array when saving the debriefing background 2015-09-16 14:24:59 -04:00
Yarn366 9cb1af00aa Added support for custom command briefing backgrounds 2015-09-16 14:06:15 -04:00
Yarn366 4ef212157a Briefing backgrounds are now set with $briefing_background_xxx instead of $background_xxx 2015-09-16 02:17:53 -04:00
Yarn366 3bb9b0068c Added support for custom debriefing backgrounds 2015-09-16 01:32:57 -04:00
Yarn366 09aa01db6b Added support for custom weapon select backgrounds 2015-09-16 00:14:54 -04:00
Yarn366 36cc228527 Added support for custom ship select backgrounds 2015-09-15 23:49:43 -04:00
niffiwan 022e3324ce Merge pull request #348 from MageKing17/bugfix/dont-call-popup-during-gr_init
Stop calling popup() during gr_init().
2015-09-16 11:15:25 +10:00
Yarn366 f41c5a2a65 Added support for custom red-alert backgrounds 2015-09-15 21:08:25 -04:00
MageKing17 d672ee885f Stop calling popup() during gr_init().
While investigating issue #345, it was discovered that `popup()` is getting called during `gr_init()` (and since this is before `gamesnd_parse_soundstbl()` gets called, the eventual call to `gamesnd_play_iface()` results in reading invalid memory). Given that this is basically relying on a feature in the middle of the function initializing it, and given that both lines are preceded by `mprintf()` calls saying basically the same thing, it seems the best solution is to just remove the troublesome lines altogether.
2015-09-15 17:59:16 -07:00
MageKing17 3329285192 Refactor mission saving to avoid duplicate code.
Makes save_mission_file() and autosave_mission_file() delegate to a new save_mission_internal() function. Tested and works with both manual and automatic saves.

As an aside, this fixes a slight inconsistency between manual and automatic saving (which inspired this refactor in the first place): when the order of save_fiction() and save_cutscenes() was swapped (in r10886 a.k.a. d6e0a73), autosave_mission_file() wasn't also changed, so autosaves of missions with "#Cutscenes" sections can't actually be loaded.
2015-09-10 13:34:57 -07:00
z64555 9df07cda5e Merge pull request #343 from Echelon9/fix/bm_load_and_parse_eff-return-type
Refactor bm_load_and_parse_eff() return type to bool
2015-09-08 09:48:53 -05:00
Echelon9 d7eca39338 Refactor bm_load_and_parse_eff() return type to bool, thereby removing a TODO 2015-09-08 22:14:43 +08:00
z64555 d1e6aa2b4f Merge pull request #344 from Echelon9/fix/bm_set_render_target-return-type
Refactor bm_set_render_target() return type to bool
2015-09-08 09:02:14 -05:00
Echelon9 b7aaf2e885 Refactor bm_set_render_target() return type to bool, thereby removing a TODO 2015-09-07 17:07:24 +10:00
m!m 0339f1ba62 Merge pull request #341 from MageKing17/bugfix/mantis-3173
Fix Mantis #3173.
2015-09-06 14:45:28 +02:00
MageKing17 1a0f2cf0e0 Fix Mantis #3173.
So in PR #294, I made 0-damage beams call the damage-applying code so they could be used to TAG things. The way I did this was I removed the do_damage check from the conditional before the switch block that handles beams damaging things.

This was a horrible mistake.

do_damage was set to 0 if a beam dealt <= 0 damage, but before that, it would only be set to 1 if the damage timestamp had elapsed. Removing the do_damage check caused damaging beams to deal damage every frame, which obviously will cause a substantial damage increase (well, unless your framerate was so low that beams would deal less than their full damage anyway).

This commit restores the do_damage check, and simply avoids setting do_damage to 0 if the beam isn't a damaging one (the <= 0 check is moved to beam_get_ship_damage() instead, so we can skip the attenuation calculation if we're not going to deal damage in the first place).
2015-09-06 05:33:30 -07:00
Lari Nieminen 473090e9e0 Made $On Ship Arrive cope with generic anchors (e.g. "<any hostile>")
This changes the interface of mission_set_arrival_location() to return the objnum of the anchor (if any; -1 otherwise).
2015-09-04 01:23:32 +03:00
Fabian Woltermann d5a2238225 Merge pull request #340 from asarium/fix/unneededWarnings
Re-enable two gcc warnings
2015-09-03 18:10:32 +02:00
m!m cbec552c19 Merge pull request #338 from Goober5000/sound_index_tweak2
Sound index tweak2
2015-09-03 17:02:38 +02:00
asarium 032aa154de Re-enable two warnings
The unknown pragmas have been fixed by wrapping them in a visual studio ifdef
2015-09-03 15:38:33 +02:00
Goober5000 3b5ba969cc change the Warning to an mprintf since technically SSM entries do not need a name 2015-09-02 22:49:31 -04:00
Goober5000 be5fdd0308 sprintf_s only works in Visual Studio; change to regular sprintf 2015-09-02 22:45:46 -04:00
Goober5000 abd31038e7 a bit of code cleanup with some robustness for SSM entry names 2015-09-02 22:45:38 -04:00
Goober5000 902fd5efbc fix a VS2013 warning 2015-09-02 22:45:24 -04:00
Goober5000 7db9adae00 since Alarm Sound is optional, it's possible the sound index won't get assigned 2015-09-02 22:45:04 -04:00
m!m f82a730f7e Merge pull request #337 from Yarn366/mantis/3172
Fixed language autodetection
2015-09-02 23:44:08 +02:00
Yarn366 932a5230e9 Fixed language autodetection 2015-09-02 17:13:33 -04:00
Lari Nieminen 81d18573aa Fixed the $On Ship Arrive hook code as per issue #334 and PR #333 2015-09-02 10:53:21 +03:00
Fabian Woltermann fadd4e6d18 Merge pull request #327 from Goober5000/per_mission_briefing_backgrounds
mjn.mixael's request for per-mission briefing backgrounds
2015-08-31 09:03:05 +02:00
Fabian Woltermann 6484a19094 Merge pull request #331 from AxemP/NoBeamFlashImpact
Removes the beam flash impact from appearing when viewing from the hit object's cockpit
2015-08-31 09:00:01 +02:00
z64555 98fba0c00b Merge pull request #328 from niffiwan/bmpslots
Add debug console command to log bmpman slot info
2015-08-30 18:47:57 -05:00
MageKing17 f95db90cc0 Merge pull request #332 from niffiwan/bmp_eff_cleanup
Minor bmpman/generic anim cleanup
2015-08-30 10:19:37 -07:00
niffiwan 2199863587 Minor bmpman/generic anim cleanup
Remove redundant Assert from bm_load_animation
Replace magic numbers in EFF streaming animations
2015-08-30 14:50:21 +10:00
MageKing17 df8317f3ed Merge pull request #311 from ln-zookeeper/fotg_to_master
Added Lua functions to read mouse/joystick sensitivity and deadzone
2015-08-29 09:38:21 -07:00
Axem cc08e986a2 Don't need that 2015-08-29 11:19:48 -05:00
Axem 65cce032d3 Merge branch 'NoBeamFlashImpact' of https://github.com/AxemP/fs2open.github.com.git 2015-08-29 11:15:36 -05:00
Axem b8479fba88 I am comitting this! 2015-08-29 11:15:32 -05:00
Axem 7f22a80af6 Prelim work 2015-08-29 11:14:38 -05:00
Lari Nieminen 58b8f2a33c Added Lua functions to read mouse/joystick sensitivity and deadzone 2015-08-29 16:54:19 +03:00
Fabian Woltermann 0aec74ae29 Merge pull request #320 from asarium/ci/container
Travis CI: Switch to container infrastructure
2015-08-27 21:49:36 +02:00
asarium 4e6a1ae716 Switch to container infrastructure 2015-08-27 21:39:23 +02:00
niffiwan ebca85531c Add debug console command to log bmpman slot info 2015-08-27 20:06:35 +10:00
m!m 0954d4e4ee Merge pull request #326 from MageKing17/bugfix/mantis-3144
Fix Mantis #3144.
2015-08-27 11:46:12 +02:00
MageKing17 ddace0c233 Add clarifying comment per m!m's note on GitHub. 2015-08-27 02:43:18 -07:00
m!m 7a38519a83 Merge pull request #302 from niffiwan/coverity+travis
Integrate Coverity with Travis CI
2015-08-27 10:49:12 +02:00
Goober5000 05d4e44c97 mjn.mixael's request for per-mission briefing backgrounds; see http://www.hard-light.net/forums/index.php?topic=90337.0 2015-08-27 01:22:14 -04:00
MageKing17 d4d6ab3fd7 Fix Mantis #3144.
Stops stripping newlines from ship descriptions, and resizes the text width according to Yarn's findings.
2015-08-26 20:36:43 -07:00
niffiwan 3754bfbfdf Merge branch 'master' into coverity+travis
Conflicts:
	.travis.yml
2015-08-27 12:40:33 +10:00
MageKing17 3a5f7143a2 Merge pull request #321 from Goober5000/subsystem_mprintf_fix
the model filename is useful to have in the debug message
2015-08-24 10:15:47 -07:00
Goober5000 b2215ddf7d the model filename is useful to have in the debug message 2015-08-24 12:59:15 -04:00
m!m 50feb3ed08 Merge pull request #315 from niffiwan/eff_streaming_is_done
Remove obsolete comments
2015-08-23 12:31:44 +02:00
niffiwan a6f2cc5937 Remove obsolete comments
EFF streaming was implemented in 48e0517e (svn r9109)
2015-08-23 20:26:01 +10:00
niffiwan 545287cebf Merge pull request #307 from asarium/ci/macosx
Add CI support for MacOSX
2015-08-23 19:52:15 +10:00
m!m 84a315d1db Merge pull request #8 from niffiwan/asarium-ci_macosx
We need sudo; force it on
2015-08-23 10:11:43 +02:00
niffiwan 00c3733670 Merge pull request #313 from MageKing17/bugfix/fred-ship-loadout-invalid-memory
Replaces a reference to MAX_SHIP_CLASSES with Ship_info.size().
2015-08-23 14:10:00 +10:00
niffiwan 7fdfdc6134 We need sudo; force it on 2015-08-23 13:53:13 +10:00
MageKing17 6a69b02bbb Replaces a reference to MAX_SHIP_CLASSES with Ship_info.size().
This would cause FRED to treat essentially unspecified pieces of memory as ship classes and then see if this nonsense class had the SIF_DEFAULT_PLAYER_SHIP flag set... and if so, put it in the default list of available ships. With a debug build (where the memory past the end of Ship_info is all identical for quite a ways), this could result in the default, empty mission saving as 60 megabytes.
2015-08-22 18:33:22 -07:00
Goober5000 886deddf99 Merge pull request #306 from MageKing17/bugfix/call-ssm-strike-warning
Fixes call-ssm-strike resulting in a Warning about a null vec3d.
2015-08-22 18:36:14 -04:00
MageKing17 360a55be63 Merge pull request #312 from MageKing17/bugfix/on-turret-fired-swarm-fix
Fix null pointer dereference with swarm turrets and "$On Turret Fired:".
2015-08-22 15:12:30 -07:00
MageKing17 91d25a8744 Fix null pointer dereference with swarm turrets and "$On Turret Fired:".
Forgot to set last_fired_turret and its last_fired_weapon_info_index, causing CHA_ONTURRETFIRED to crash as soon as a swarm turret fired.

Oops.
2015-08-22 14:29:27 -07:00
MageKing17 c990f44f82 Merge pull request #310 from ln-zookeeper/fotg_to_master
Supplement +Disable with +Disable: <bool>, to allow the table to enab…
2015-08-22 12:32:58 -07:00
Lari Nieminen 0d8f6f26ce Supplement +Disable with +Disable: <bool>, to allow the table to enable binds disabled by default 2015-08-22 22:18:07 +03:00
MageKing17 55b857f269 Merge pull request #260 from ln-zookeeper/fotg_to_master
Whitespace and commenting tweaks
2015-08-22 11:58:19 -07:00
Lari Nieminen 00fa839d1d Added a few comments and fixed typos in some others 2015-08-22 21:55:37 +03:00
Goober5000 ef3bb65d63 Merge pull request #305 from MageKing17/bugfix/fred-glowpoint-init
Makes FRED call glowpoint_init().
2015-08-22 14:17:26 -04:00
m!m 56ab9e02c8 Merge pull request #304 from MageKing17/bugfix/parselo-char-fix
Makes vsprintf() stop chopping off the last character. Fixes issue #298.
2015-08-22 19:21:30 +02:00
MageKing17 cbcb053fbc Merge pull request #309 from asarium/fix/drawSubsystem
Fix gr.drawSubsystemTargetingBrackets
2015-08-22 10:16:07 -07:00
asarium b76bccb9ef Actually set the bounds of the drawn subsystem 2015-08-22 17:16:42 +02:00
Axem a535d66fc8 Prelim work 2015-08-22 08:36:58 -05:00
m!m be4cac366b Merge pull request #308 from niffiwan/gcc-warn
Fix gcc warning in ship/ship.cpp
2015-08-22 13:06:56 +02:00
m!m a691e81e14 Merge pull request #303 from MageKing17/bugfix/lua-null-pointer-checks
Add null pointer checks throughout lua.cpp.
2015-08-22 13:06:23 +02:00
asarium 07fcd05fff Add CI support for MacOSX
Requires enabling the multi-os feature of travis CI
2015-08-22 12:59:49 +02:00
niffiwan 9737994de5 Fix gcc warning in ship/ship.cpp
Use SIZE_T_ARG in Warning
2015-08-22 20:45:45 +10:00
MageKing17 fe1db37902 Makes FRED call glowpoint_init().
Avoids a constant stream of warnings when using "$Glowpoint overrides:".
2015-08-22 03:40:27 -07:00
MageKing17 238dbc5749 Makes vsprintf() stop chopping off the last character. Fixes issue #298.
Also fixes saving missions in FRED, since it uses the same function.
2015-08-22 03:38:16 -07:00
MageKing17 cd3b543e56 Add null pointer checks throughout lua.cpp.
Previously, the "this != NULL" checks in the isValid() methods were covering most of these cases, but they were removed as part of PR #274 because clang was generating warnings because calling a method on a null pointer is undefined behavior (so the condition *should* be tautological). This performs the checks outside of isValid(), which should avoid (at least this variety of) undefined behavior while fixing the crashes that dereferencing null pointers was causing.
2015-08-22 03:36:26 -07:00
niffiwan b3c1441d06 Integrate Coverity with Travis CI
This should let Coverity run a scan via Travis whenever commits
are pushed to the "coverity_scan" branch.
Some hackery is required to avoid submitting too many builds to
Coverity. See travis-ci/travis-ci#1975 for details.
2015-08-22 18:39:55 +10:00
MageKing17 fb8ffcacfd Fixes call-ssm-strike resulting in a Warning about a null vec3d.
ssm_create() subtracts the start coordinates from the position of the target, and then normalizes that. Since call-ssm-strike was using the position of the target as the start coordinates, this was obviously resulting in normalizing a null vec3d, generating the spurious warning. This just makes call-ssm-strike use a point immediately behind the target's position (using the target's orientation) as the starting coordinate, thereby avoiding the warning.
2015-08-21 21:12:03 -07:00
niffiwan 0061718de4 Merge pull request #301 from MageKing17/bugfix/check-sexp-syntax
Fix check_sexp_syntax() so it works properly with OPF_SSM_CLASS.
2015-08-22 13:57:59 +10:00
MageKing17 d7ff43a1d1 Fix check_sexp_syntax() so it works properly with OPF_SSM_CLASS.
Also makes OP_BEAM_FLOATING_FIRE grab the correct ship_index for the subsystem check.
2015-08-21 13:41:45 -07:00
MageKing17 a748be2315 Merge pull request #300 from z64555/enhancement/nojoypoll
Removes joystick polling. Joy axes are now queried every frame.
2015-08-21 12:42:01 -07:00
z64555 f56f0c471d Removes joystick polling. Joy axes are now queried every frame. 2015-08-21 14:32:07 -05:00
MageKing17 b610b9b246 Merge pull request #299 from niffiwan/bmp_overflow
Fix Coverity 1093366: Operands don't affect result
2015-08-21 09:47:02 -07:00
niffiwan 00a0b1bae7 Fix Coverity 1093366: Operands don't affect result
The previous check was always false, replace with something that should
safely detect uint overflow
2015-08-21 22:49:28 +10:00
Fabian Woltermann 509bd8c010 Merge pull request #294 from MageKing17/feature/beam-tagging-with-no-damage
Remove do_damage check before calling hit functions in beam collisions.
2015-08-21 09:32:29 +02:00
Fabian Woltermann 9afae0b64d Merge pull request #287 from MageKing17/feature/on-turret-fired-for-all
Add CHA_ONTURRETFIRED support to beam and swarm turrets.
2015-08-21 09:31:32 +02:00
Cliff Gordon 0a2b97c3bc Merge pull request #41 from MageKing17/ship_info
Ship_info vectorization, ship templates.
2015-08-20 21:51:18 -05:00
MageKing17 52a2ac542e Merge pull request #296 from asarium/fix/vsprintf
Fix SCP_string version of vsprintf
2015-08-20 19:47:47 -07:00
Cliff Gordon 9bc635e098 Merge pull request #288 from MageKing17/feature/glide-decay-ai-profile-flag
Makes glide decay work even when not thrusting.
2015-08-20 21:46:42 -05:00
Cliff Gordon f824df070b Merge pull request #290 from MageKing17/cleanup/move-voice-recognition-grammar-files
Move the temporary grammar files into the build directory.
2015-08-20 21:34:10 -05:00
z64555 afe2f2dac6 Merge pull request #297 from MageKing17/bugfix/mantis-2436
Fix Mantis #2436. Does the mouse mapping within player_control_read_stick vs. trying to remap later on.
2015-08-20 16:57:54 -05:00
MageKing17 72af3059e9 Fix Mantis #2436.
Instead of the mouse's axes being automatically bound to heading/pitch/throttle, it finds what the axes are bound to (by looking through Axis_map_to[]) and modifies the corresponding values.
2015-08-20 14:53:01 -07:00
asarium 51832fd563 Fix SCP_string version of vsprintf
The previous version didn't use the c-library which would cause incompatibilities with formats that assume all format specified to be supported.
2015-08-20 22:52:49 +02:00
MageKing17 059af731a7 Merge pull request #295 from ln-zookeeper/master
Revert "Fixes Mantis #2436: Mouse controls ignore the axis binds." du…
2015-08-20 13:50:01 -07:00
Lari Nieminen b4c625c51a Revert "Fixes Mantis #2436: Mouse controls ignore the axis binds." due to the joystick axis problems it caused
This reverts commit da71e629b4.
2015-08-20 22:07:56 +03:00
MageKing17 27d85189ea Remove do_damage check before calling hit functions in beam collisions.
This should allow 0-damage beams to be used to apply TAG effects.
2015-08-19 22:17:05 -07:00
MageKing17 b296300365 Simplify some references to Weapon_info[b->weapon_info_index].
These were all referenced when there was already a weapon_info pointer to that element; it makes more sense to use that pointer instead of re-indexing Weapon_info[].
2015-08-19 22:15:23 -07:00
MageKing17 a5bff0c192 Merge pull request #293 from chief1983/fix/292_warnings_part_b
Fix/292 warnings part b
2015-08-19 16:47:17 -07:00
MageKing17 20279838bf Move the temporary grammar files into the build directory.
These are only used for voice recognition on Windows. In addition, the gc.exe shouldn't be needed locally since it should be included with SAPI, which Visual Studio 2010 and later should already include.

I also tried to backport some of the changes from the 2013/2015 project files to the 2010/2012 project files, but lack of certain compiler flags made me tend to err on the conservative side in that regard.
2015-08-19 16:33:13 -07:00
Cliff Gordon f0c4bf2e3a [fix/292_warnings_part_b] Cast Frametime (of type fix) to int for printf specifier to avoid a warning. 2015-08-19 17:01:07 -05:00
Cliff Gordon 38e48bec16 [fix/292_warnings_part_b] Remove deprecated register type hint. 2015-08-19 17:01:07 -05:00
MageKing17 e5b7d48989 Add a couple more static_cast<int>()s to get rid of warnings. 2015-08-19 14:52:15 -07:00
Cliff Gordon 6850ac6fe0 Merge pull request #291 from asarium/fix/ssm-warnings
Fix warning introduced by #289
2015-08-19 16:05:42 -05:00
asarium 0c80c8d8c0 Fix warning introduced by #289 2015-08-19 22:34:08 +02:00
MageKing17 64c9b272e7 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/pilotfile/pilotfile.cpp
2015-08-19 11:53:25 -07:00
m!m 42ddd2fe5f Merge pull request #289 from MageKing17/feature/variable-ssm-strikes
Allow SSM(/SSB) strikes to be more variable.
2015-08-19 20:39:29 +02:00
MageKing17 692c86c8e6 Allow SSM(/SSB) strikes to be more variable.
Allows specifying a min/max for count, radius, and/or offset. To make them variable, instead of e.g. "+Count:", specify "+Min Count:", which adds a requirement for "+Max Count:". Each time the strike is activated, it will pick a different random count, and each projectile in the strike will have a different random radius and offset.
2015-08-19 11:36:50 -07:00
MageKing17 ba2fe6603c Merge pull request #274 from asarium/fix/printf
Fix remaining gcc/clang warnings
2015-08-19 10:37:13 -07:00
asarium 71d3139d14 Remove commented line 2015-08-19 11:26:32 +02:00
asarium 8d564da80c Fix for loop 2015-08-19 11:26:32 +02:00
asarium e037b08e2e Add doxygen documentation for format macros 2015-08-19 11:26:32 +02:00
asarium 1d65102292 Fix alignment in tcp_client.cpp 2015-08-19 11:26:32 +02:00
asarium 3a69db26eb Fix unneded checks for this != nullptr in lua.cpp 2015-08-19 11:26:31 +02:00
asarium e075241e54 Fix unneded check for this != nullptr in object.h 2015-08-19 11:26:31 +02:00
asarium 191194dfa7 Remove part of condition that is always true
Fixes a clang compiler warning
2015-08-19 11:26:31 +02:00
asarium 733b020bf5 Fix unneded check for this != nullptr in wmcgui.h 2015-08-19 11:26:31 +02:00
asarium 9ec178f116 Use the right version of abs 2015-08-19 11:26:31 +02:00
asarium fb068f6037 Fix invalid pointer comparision warning
This should match what the code is actually supposed to do
2015-08-19 11:26:31 +02:00
asarium bb6045d762 Check if the compiler supports the -Wno-unused-but-set-variable flag 2015-08-19 11:26:31 +02:00
asarium e8bb02bed3 Disable a few warnings in release mode
These will happen if debug builds use variables for debug checks
2015-08-19 11:26:31 +02:00
asarium a6e93c7d46 Fix another braces warning 2015-08-19 11:26:30 +02:00
asarium 1cd7744d34 Fix "operator '?:' has lower precedence" warning
I think the ?: expression was meant to take precedence
2015-08-19 11:26:30 +02:00
asarium fc3166ac52 Fix suggest braces around initialization of subobject warning 2015-08-19 11:26:30 +02:00
asarium 3826e24da2 Fix format warning in stubs.cpp 2015-08-19 11:26:30 +02:00
asarium 3ece769330 Fix format warnings in weapons.cpp 2015-08-19 11:26:30 +02:00
asarium 6ac1326dc8 Fix format warning in species_defs.cpp 2015-08-19 11:26:30 +02:00
asarium 03b26baf55 Fix format warning in ds.cpp 2015-08-19 11:26:30 +02:00
asarium 4b25b49432 Fix format warning in plr.cpp 2015-08-19 11:26:30 +02:00
asarium 721422f951 Fix format warning in pilotfile.cpp
Also fixes a logic error in the code (I think...)
2015-08-19 11:26:29 +02:00
asarium 509d11c29d Fix format warning in csg.cpp 2015-08-19 11:26:29 +02:00
asarium eb765b0c99 Fir format warnings in parselo.cpp 2015-08-19 11:26:29 +02:00
asarium 3d06468e2a Fix format warnings in lua.cpp 2015-08-19 11:26:29 +02:00
asarium 1de9ad1ace Fix format warnings in object.cpp 2015-08-19 11:26:29 +02:00
asarium 559198a2e4 Fix format warning in collideshipweapon.cpp 2015-08-19 11:26:29 +02:00
asarium 6b093f2ee9 Fix set but unused variable warning in multiutil.cpp 2015-08-19 11:26:29 +02:00
asarium 280ceabb45 Fix format warning in multi_options.cpp 2015-08-19 11:26:28 +02:00
asarium ff51e79531 Fix set but unused variable warning in chat_api.cpp 2015-08-19 11:26:28 +02:00
asarium 9cbf944dee Fix format warning in modelread.cpp 2015-08-19 11:26:28 +02:00
asarium 1ded65c3d0 Fix invalid usage of mprintf 2015-08-19 11:26:28 +02:00
asarium c26bd197dc Fix format warning in mainhallmenu.cpp 2015-08-19 11:26:28 +02:00
asarium 32b35ba62c Fix format warnings in credits.cpp 2015-08-19 11:26:28 +02:00
asarium 8d5273b3c0 Fix set but unused variable warning in vecmat.cpp
I kept the code in comments as it may be usedful at some point.
2015-08-19 11:26:28 +02:00
asarium 6a5e660ff3 Fix format warnings in lighting.cpp 2015-08-19 11:26:28 +02:00
asarium aaf470f49b Fix format warning in keycontrol.cpp 2015-08-19 11:26:28 +02:00
asarium 077dc61660 Fix format warnings in hudshield.cpp 2015-08-19 11:26:27 +02:00
asarium 116df2e2c3 Fix set but unused variable warning in grstub.cpp 2015-08-19 11:26:27 +02:00
asarium 4670d5f87f Fix set but unused variable warning in gropengltnl.cpp 2015-08-19 11:26:27 +02:00
asarium f986d28c56 Fix format warnings in safe_string.h 2015-08-19 11:26:27 +02:00
asarium dba0e8b458 Fix format warnings in gamesnd.cpp 2015-08-19 11:26:27 +02:00
asarium cf68c5970e Fix unused but set variable warnings in tcp_client.cpp 2015-08-19 11:26:27 +02:00
asarium fc140194d3 Fix set but unused variable warning in ddsutils.cpp 2015-08-19 11:26:27 +02:00
asarium a0b040c597 Fix unused but set variable error
I removed some function calls but all of them didn't have any side effects so it should be fine.
2015-08-19 11:26:27 +02:00
asarium 89e63d60b8 Fix warnings in decoder16.cpp 2015-08-19 11:26:26 +02:00
asarium 24a0b05b39 Fix unused but defined variable warning in controlsconfig.cpp
It's weird that shift and alt aren't used in this function but I couldn't find any reference to that in the structure for the controls config.
2015-08-19 11:26:26 +02:00
asarium 89f6794a13 Fix C++11 warning in aicode.cpp 2015-08-19 11:26:26 +02:00
asarium f625df5c38 Fix format warning in aicode.cpp 2015-08-19 11:26:26 +02:00
asarium 37eadf4d16 Disable unreferenced function warning 2015-08-19 11:26:26 +02:00
asarium a232a646dc Fix size_t format warnings 2015-08-19 11:26:26 +02:00
asarium 40c81134ac Fix "format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’" warning 2015-08-19 11:26:26 +02:00
asarium a63e1a2ba1 Fix invalid usage of mprintf 2015-08-19 11:26:26 +02:00
asarium f00af4d89f Fix "declaration of ‘i’ shadows a previous local" warning 2015-08-19 11:26:25 +02:00
asarium c697dcb926 Fix "comparison between signed and unsigned integer expressions" warning 2015-08-19 11:26:25 +02:00
asarium 29afbe8ef5 Use new macro for size_t printf arguments 2015-08-19 11:26:25 +02:00
asarium 6f01adfb2e Add portable format macros for size_t and ptrdiff_t 2015-08-19 11:26:25 +02:00
asarium 6a578b3fcd Fix non-sensical comparision
std::string::find_* returns std::string::npos if the token couldn't be found.
2015-08-19 11:26:25 +02:00
MageKing17 048d65d3ca Makes glide decay work even when not thrusting.
For any mods that might want to keep the old behavior, adds "$glide decay requires thrust:" AI profile flag.
2015-08-19 00:50:18 -07:00
MageKing17 e94511b7aa Add CHA_ONTURRETFIRED support to beam and swarm turrets. 2015-08-19 00:06:11 -07:00
Fabian Woltermann 8b4f7dde77 Merge pull request #277 from MageKing17/bugfix/infinite-trigger-count
Fix infinite trigger count not interacting correctly with "+Interval:"
2015-08-19 08:33:12 +02:00
MageKing17 990411fd0b Merge pull request #286 from Goober5000/woutersmits_fix
fix an obscure edge-case sexp crash
2015-08-18 23:30:26 -07:00
Goober5000 bd3cd7eb18 Merge pull request #195 from Echelon9/fix/sort-uniq-includes
Review and refactor #include's
2015-08-19 00:05:02 -04:00
Goober5000 17851dcc56 fix an obscure edge-case sexp crash
This bug was found by, of all people, woutersmits, while FREDding his happynewyear campaign.  See http://www.hard-light.net/forums/index.php?topic=90069.0 for discussion.  The crash was triggered by the use of ( validate-all-arguments ) as the entire sexp tree for one of his mission events.

This was a two-part fix.  The first part was to ensure that every *-argument sexp (of which validate-all-arguments is but one) is actually used within a when-argument or every-time-argument tree.  More specifically, every sexp operation that expects an argument handler should first check that the arg_handler node actually exists.

The second part was to partially revert one of Taylor's old commits:

Revision: 3644
Author: taylor
Date: Tuesday, October 24, 2006 9:17:24 AM
Message:
various bits of cleanup (warning messages, things that Valgrind complained about, etc.)
fix an out-of-bounds issue on Sexp_nodes[] which was leading to stack corruption

----
Modified : /branches/fs2_open_3_6_9/fs2_open/code/parse/sexp.cpp

This was intended to prevent a -1 array reference into Sexp_nodes[].  What Taylor did was to cause repeated calls of the parent_operator function to loop endlessly at the topmost parent.  But there are certain edge cases (such as the one woutersmits discovered) where you need to know whether a parent is the topmost one.  What Taylor should have done, and what this change does, is to keep the -1 as a valid return value but check for it in the places where it may cause an issue.
2015-08-18 21:32:14 -04:00
MageKing17 062929b8bd Merge pull request #284 from Goober5000/sexp_assertions
various assertions to improve the sexp code
2015-08-18 17:56:39 -07:00
Goober5000 efce7de00d fix syntax error, add node reference 2015-08-18 19:58:34 -04:00
Goober5000 2b032a1dbc tweaks per MageKing17's suggestions 2015-08-18 13:27:57 -04:00
m!m c8053d06b7 Merge pull request #285 from MageKing17/cleanup/hook-variable-removal
Cleanup hook variable removal
2015-08-18 17:52:10 +02:00
MageKing17 ce3755b333 Further hook variables cleanup.
Consolidated a few sequential calls, corrected a few instances of "ObjectB" being removed when "Object" was set, and removed a couple instances of hook variables that weren't set being removed.
2015-08-18 08:11:11 -07:00
MageKing17 313787effb Add RemHookVars() calls to aiturret.cpp, object.cpp, and ship.cpp.
CHA_ONTURRETFIRED wasn't clearing its hook variables. Neither was CHA_ONWPEQUIPPED or CHA_ONWPFIRED, CHA_PRIMARYFIRE, CHA_SECONDARYFIRE, CHA_ONWPSELECTED, or CHA_ONWPDESELECTED.
2015-08-18 07:58:03 -07:00
niffiwan 578083367d Merge pull request #283 from Goober5000/comment-fix
* remove an incorrect comment (the *= multiplies the variable by the …
2015-08-18 18:34:59 +10:00
Goober5000 e1d3838b2e various assertions to improve the sexp code 2015-08-18 01:00:43 -04:00
Goober5000 1bf6f822ae * remove an incorrect comment (the *= multiplies the variable by the entire RHS; it doesn't multiply and then add) 2015-08-18 00:35:51 -04:00
m!m 081eba90e5 Merge pull request #281 from Echelon9/fix/doc-cfile-init
Document cfile_init() function.
2015-08-16 18:15:48 +02:00
Echelon9 9487688edb Document cfile_init() function. 2015-08-17 01:41:37 +10:00
m!m 2240e17413 Merge pull request #278 from Echelon9/fix/doxygen
Fix doxygen documentation
2015-08-15 13:29:03 +02:00
Echelon9 bd0fb590ca Fix incorrect Doxygen comment for bm_lock(). 2015-08-15 13:56:54 +10:00
Echelon9 420558d623 Fix incorrect Doxygen comment, there is no type @ret. 2015-08-15 13:55:05 +10:00
Echelon9 6061df4e65 Fix incorrect Doxygen comment for dc_draw_cursor(). 2015-08-15 13:53:23 +10:00
Echelon9 830e523408 Fix incorrect Doxygen comment for opengl_shader_link_object() and keep line lengths below recommended 80 characters. 2015-08-15 13:51:23 +10:00
Echelon9 a21dd67d85 Fix incorrect Doxygen comment for opengl_shader_create() and keep line lengths below recommended 80 characters. 2015-08-15 13:49:20 +10:00
Echelon9 0319816539 Fix incorrect Doxygen comment for hud_anim_render(). 2015-08-15 13:46:53 +10:00
Echelon9 9bccc64705 Fix incorrect Doxygen comment for free_object_slots(). 2015-08-15 13:45:20 +10:00
m!m 81fe1e3952 Merge pull request #276 from MageKing17/bugfix/beam-create-with-coords
Fix beam-create with targeting coordinates instead of a ship/subsystem.
2015-08-14 21:27:32 +02:00
MageKing17 488a0f1da2 Fix infinite trigger count not interacting correctly with "+Interval:"
There's an undocumented feature whereby negative trigger counts are treated as infinite. However, since it doesn't use the bump_timestamp system of positive trigger counts, it'll behave more like an infinite repeat count (e.g. with "+Interval: 5" it will only check every 5 seconds instead of becoming active again after 5 seconds have passed). This just makes negative values set bump_timestamp and excludes them from resetting the timestamp if the event didn't trigger that frame (checking MEF_USING_TRIGGER_COUNT so that the other behavior is still possible if you set a negative repeat_count and don't specify a trigger_count).
2015-08-14 11:24:47 -07:00
MageKing17 d0cde03a69 Fix beam-create with targeting coordinates instead of a ship/subsystem.
If the subsystem was <none>, sexp_beam_floating_fire() wasn't consuming the node, resulting in it also being parsed as the X coordinate (making it always zero, because atoi("<none>") == 0).
2015-08-14 11:20:33 -07:00
Fabian Woltermann 76f67edb36 Merge pull request #275 from MageKing17/bugfix/actually-call-beam-create
Make beam-create actually call sexp_beam_floating_fire().
2015-08-14 19:51:29 +02:00
MageKing17 cbeb03b2d5 Make beam-create actually call sexp_beam_floating_fire().
Somehow, this got missed during the creation of the pull request, and I guess nobody (not even me) actually tried using it since then.
2015-08-14 10:32:27 -07:00
MageKing17 ef34e5e39e Merge pull request #272 from MageKing17/bugfix/actually-fix-cargo-size-check
Actually fix the `cargo_size` check for turrets.
2015-08-13 18:08:29 -07:00
MageKing17 7b15fe0786 Do a couple more MAX_SHIP_*_BANKS to num_*_banks replacements. 2015-08-13 15:03:31 -07:00
MageKing17 fada4f514e Make primary weapon cargo_size check first check the WIF2_BALLISTIC flag. 2015-08-13 03:59:52 -07:00
Fabian Woltermann 64f046c388 Merge pull request #273 from MageKing17/bugfix/ammo-sexp-multi-fix
Fix writing to undefined memory in multiplayer SEXP code for turret a…
2015-08-13 07:32:14 +02:00
MageKing17 d74d09554e Fix writing to undefined memory in multiplayer SEXP code for turret ammo.
`multi_sexp_set_turret_primary_ammo()` and `multi_sexp_set_turret_secondary_ammo()` were using an uninitialized pointer instead of an uninitialized array, like every other instance of multi_get_string(). This is just begging to write to invalid memory.
2015-08-12 22:02:29 -07:00
MageKing17 d07673cbe1 Actually fix the cargo_size check for turrets.
So it turns out it actually was the secondary code triggering the Assertion, because `ship_system->weapons.secondary_bank_weapons[]` was full of 0s. Subach HL-7 is weapon type 0, and obviously doesn't have a `cargo_size`. I see no reason to iterate through `MAX_SHIP_PRIMARY_BANKS`/`MAX_SHIP_SECONDARY_BANKS` if there aren't that many banks being used anyway.
2015-08-12 21:18:37 -07:00
MageKing17 1684b7f85e Make a few more changes to ship_info based on m!m's notes.
Copy constructor and copy-assignment are made private and unimplemented (may cause problems on VS 2010/2013? I have a vague memory of something similar needing to be removed for 2010 to work; we could always wrap 'em in an _MSC_VER check, of course). Speaking of an _MSC_VER check, adds a define for `NOEXCEPT` to `noexcept`, but only if we're not using a version of Visual Studio prior to 2015 (when `noexcept` support was added). It *should* allow the move constructor for ship_info to be used whenever the vector resizes both pre- and post-VS 2015 (and on non-MS compilers), but it could use some testing. ship_info::clone() made public (and used for ship templates instead of copy-assignment), and ship_info::move() now takes a ship_info&& object (and move-assignment/constructor use std::move() to keep it an rvalue).
2015-08-12 20:52:56 -07:00
MageKing17 4fb6f3d459 Changing a Ship_info.size() to !Ship_info.empty() as pointed out by m!m. 2015-08-12 14:39:42 -07:00
MageKing17 439ea76475 Adding static_cast<int>() to locations pointed out by m!m. 2015-08-12 14:39:12 -07:00
MageKing17 529fd197d8 Revert unintended missiongoals.cpp changes from vectorization commit.
I may make a separate pull request for this at some point, but it definitely doesn't belong here.
2015-08-12 14:23:36 -07:00
MageKing17 389a1a1a3d Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info 2015-08-12 14:10:10 -07:00
m!m b3aec16833 Merge pull request #271 from MageKing17/bugfix/fix-primary-cargo-size-check
Fix cargo size check for primary weapons I screwed up in PR 269.
2015-08-12 23:07:37 +02:00
MageKing17 28d04bfee4 Fix cargo size check for primary weapons I screwed up in PR 269.
Should've checked more than just that FRED was working... d'oh.
2015-08-12 14:03:33 -07:00
MageKing17 6985b198ec Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/ship/ship.cpp
2015-08-12 13:25:34 -07:00
MageKing17 1aa7af5167 Merge pull request #263 from Echelon9/fix/printf-issues
Resolve numerous format string issues
2015-08-12 13:05:17 -07:00
MageKing17 d953b2e668 Fix the Num_ship_classes reference added by PR #269 to Ship_info.size(). 2015-08-11 14:42:21 -07:00
MageKing17 4fc84e61c6 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/ship/ship.cpp
2015-08-11 14:27:48 -07:00
MageKing17 92a5839bb1 Merge pull request #270 from DahBlount/Turret_Ammo_Fix
Turret Ammo Fix: Default Bank and Ammo Removal location
2015-08-11 14:20:10 -07:00
MageKing17 b15dfcb906 Merge pull request #269 from MageKing17/bugfix/turret-ammo-FRED-support
Hopefully fix FRED and turret ammo.
2015-08-11 14:15:55 -07:00
MageKing17 cd5824073c Fix another copy-paste error, this time in the assertions. 2015-08-10 10:05:44 -07:00
MageKing17 36f7ac9ee3 Fix another copy-paste error.
Well, two copy-paste errors.
2015-08-09 18:12:09 -07:00
DahBlount 5c3d7b0f64 Turret bank fix and ammo removal
A turret's current_primary_bank/current_secondary_bank is always
initialized to -1, this is set to 0 if it is still -1 when a turret
tries to fire. Ammo removal for swarm and corkscrew weapons is now done
using a single flag check instead of the original two.
2015-08-09 19:29:16 -05:00
MageKing17 51be6aee77 Fix copy-paste error.
Whoops!
2015-08-09 17:21:22 -07:00
MageKing17 d59ee5953d Make subsys_set() use cargo_size for ammo. 2015-08-09 17:13:19 -07:00
MageKing17 3b43614ae9 Hopefully fix FRED and turret ammo.
Adds a get_max_ammo_count_for_turret_bank() function that the weapon editor can use for turrets instead of trying to hack the behavior into get_max_ammo_count_for_bank somehow. Adjusts weaponeditordlg.cpp to use it, and also fixes missionparse.cpp so that ammo values get correctly converted from a percentage to the number of actual missiles (but only when FRED isn't running).
2015-08-09 16:53:50 -07:00
Echelon9 930f386064 Generalise warning string if we can't provide callback operator information. 2015-08-08 18:10:26 +10:00
m!m 4a154e630f Merge pull request #267 from DahBlount/Turret-ammo-sexp-desc
Fix Turret Ammo Setter SEXP Descriptions
2015-08-07 18:05:10 +02:00
DahBlount 5412f16352 Fix the descriptions of the turret ammo setter sexps
The setter Sexps incorrectly had the same descriptions as the getter
sexps.
2015-08-07 09:02:43 -07:00
Echelon9 efc4d62bd0 Change s/Error code/Error message/ in GUISystem::ParseClassInfo() 2015-08-06 17:56:53 +10:00
Echelon9 8160cd40dc Change s/Error code/Error message/ in parse_glowpoint_table() 2015-08-06 17:54:41 +10:00
Fabian Woltermann 3f4861271b Merge pull request #264 from MageKing17/update/2015-project-files
Update the VS 2015 project files.
2015-08-06 09:34:39 +02:00
MageKing17 1ffe2629cf Add collision_lod and auto_shield_spread_mid_span to clone() and move(). 2015-08-06 00:28:04 -07:00
MageKing17 dc80ae0c9a Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/ship/ship.cpp
2015-08-06 00:25:42 -07:00
MageKing17 87ce8a47fc Update the VS 2015 project files.
These are basically just the 2013 project files updated to use the v140_xp toolset, but this gives the MSVC_2015 folder the same improvements that the MSVC_2013 folder got in commit 66bddb9.
2015-08-06 00:13:41 -07:00
Echelon9 c15e7ec28c Fix: warning: format not a string literal and no format arguments [-Wformat-security] 2015-08-05 21:07:05 +10:00
Echelon9 aee7ee6322 Fix: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘const char*’ [-Wformat=] 2015-08-05 20:57:21 +10:00
Echelon9 6dd45acb45 Fix: warning: format not a string literal and no format arguments [-Wformat-security] 2015-08-05 20:44:37 +10:00
Echelon9 3385a0a6a3 Fix: warning: format not a string literal and no format arguments [-Wformat-security] 2015-08-05 20:38:10 +10:00
Echelon9 8f9fd97902 Fix: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] 2015-08-05 20:29:41 +10:00
Echelon9 85c8c718bf Fix missing format string specifier. 2015-08-05 20:20:15 +10:00
Echelon9 4f4449958b Fix: warning: format ‘%s’ expects a matching ‘char*’ argument [-Wformat=] 2015-08-05 20:14:48 +10:00
Echelon9 cffdbe932f Fix: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] 2015-08-05 20:12:41 +10:00
Echelon9 81fa44472d Fix: warning: too many arguments for format [-Wformat-extra-args] 2015-08-05 20:08:02 +10:00
Echelon9 0388fb065c Fix: warning: format ‘%s’ expects a matching ‘char*’ argument [-Wformat=] 2015-08-05 20:05:19 +10:00
Echelon9 4328134c82 Fix: warning: format not a string literal and no format arguments [-Wformat-security] 2015-08-05 20:00:07 +10:00
Echelon9 e1c38230af Fix: warning: format not a string literal and no format arguments [-Wformat-security] 2015-08-05 19:59:09 +10:00
Echelon9 9f2a2dd4ed Ensure sufficient format string specifiers. 2015-08-05 19:57:58 +10:00
Echelon9 13837b07f7 Ensure sufficient format string specifiers are present. 2015-08-05 19:55:03 +10:00
Echelon9 c4ce711171 Ensure sufficient format string specifiers are present. 2015-08-05 19:51:06 +10:00
Echelon9 d686d28053 Ensure sufficient format string specifier. 2015-08-05 19:48:58 +10:00
Echelon9 b260d92898 Fix too many variables for format string. 2015-08-05 19:45:42 +10:00
Echelon9 d14b8b9a79 Fix Error() with two few format string specifiers. 2015-08-05 19:44:21 +10:00
MageKing17 33cd9c6233 Merge pull request #262 from Echelon9/fix/issue261
Correct Warning() in parse_startbl
2015-08-05 01:28:39 -07:00
Echelon9 c829808dd7 Correct Warning() in parse_startbl 2015-08-05 16:48:49 +10:00
Fabian Woltermann aed2b60bcf Merge pull request #256 from Echelon9/fix/issue255
Resolve Coverity-reported incorrect for() loops.
2015-08-03 12:58:13 +02:00
Fabian Woltermann 5b91bee129 Merge pull request #259 from ln-zookeeper/fotg_to_master
Added $Collision LOD ship table property, for using a LOD for collisi…
2015-08-03 12:57:47 +02:00
Lari Nieminen 1bf86532fe Added $Collision LOD ship table property, for using a LOD for collision detection 2015-08-03 13:20:14 +03:00
MageKing17 f5259eb6be Merge pull request #258 from Echelon9/fix/issue257
Add correct argument to printf format string.
2015-08-03 02:22:35 -07:00
Echelon9 bdc90c007b Ensure grammar works as a whole. 2015-08-03 19:04:10 +10:00
Echelon9 88ca967d3f Improve the warning documentation associated with a faulty ship copy flag. 2015-08-03 19:03:17 +10:00
Echelon9 9ea2ae4299 Add correct argument to printf format string. 2015-08-03 18:01:13 +10:00
Echelon9 3b26eb85ae Resolve Coverity-reported incorrect for() loops. 2015-08-02 20:02:44 +10:00
Fabian Woltermann 4aab4a969a Merge pull request #249 from asarium/printf_checks
Add format specifying macros
2015-08-01 07:47:22 +02:00
m!m 0f2562a29c Merge pull request #254 from The-E/better_assertions
Make this assertion in modelanim a bit more useful.
2015-07-31 22:43:36 +02:00
The E 0450ce7621 Make this assertion in modelanim a bit more useful. 2015-07-31 22:25:25 +02:00
Fabian Woltermann 44c4c7de76 Merge pull request #251 from DahBlount/turret_ammo
Turret Ammo Implementation
2015-07-31 11:45:01 +02:00
Fabian Woltermann aff0328b4f Merge pull request #253 from jg18/fix_openal_log
Log OpenAL info for selected device.
2015-07-31 11:44:11 +02:00
jg18 b50bd7586c Log OpenAL info for selected device.
Fix the issue pointed out by Yarn where the OpenAL info for the default
device was being logged instead of the info for the selected
device. http://www.hard-light.net/forums/index.php?topic=90070.0.
2015-07-30 15:27:36 -07:00
DahBlount d973c9e147 Add cases for turret ammo setter multi_sexps
Can't believe I forgot this part. This just ensures the sexps actually
work.
2015-07-30 15:22:31 -05:00
DahBlount 9e3cb6baa3 Multi_SEXP Turret Ammo Functions
This adds multiplayer functionality to the Turret getter and setter
SEXPs.
2015-07-30 15:06:04 -05:00
DahBlount 0fd43dad75 Turret Ammo SEXPs
This adds getter and setter SEXPs for turret ammo.
"turret-get-primary-ammo"
"turret-get-secondary-ammo"
"turret-set-primary-ammo"
"turret-set-secondary-ammo"

I also forgot to make turrets that don't have the "use multiple guns"
flag set switch banks if their first bank is empty, so that has been
fixed as well.
2015-07-29 12:25:24 -05:00
DahBlount 688baa2bb6 Turret Ammo Implementation
This creates the foundation of turret ammo through the "turret use ammo" subsystem flag. Turret ammo works in the same manner as ship ammo, where the ammo is equal to bank capacity divided by the cargo size of the weapon. This was tested using the Blue Planet: War in Heaven mod.
Test case: UEFg Narayana turrets 19 through 21, all of which contain Apocalypse torpedos with a $Cargo Size: of 2.5, were changed to use ammo with a $SBank Capacity of 20, resulting in a total ammo capacity of 8 torpedos. The Narayana was ordered to attack a GTCv Diomedes; it fired 8 torpedos each from turrets 19 through 21 before stopping. The mission was left to proceed for an additional 2 minutes, in which time the Narayana did not fire any more torpedos. Note: The Apocalypse takes 20 seconds to fire each 4 torpedo burst.
Conclusion: Success
2015-07-28 12:32:08 -05:00
Cliff Gordon 1b3af6fea6 Merge pull request #245 from ln-zookeeper/fotg_to_master
Added a +Minimum Weapon Span auto spread shield option to control the…
2015-07-27 09:12:02 -05:00
asarium d93f2e9d26 Add format specifying macros 2015-07-26 14:08:31 +02:00
Lari Nieminen cacad0ba70 Fixed possibility of +Minimum Weapon Span breaking with modular tables. 2015-07-25 01:14:03 +03:00
MageKing17 1b514de28e Merge pull request #247 from chief1983/fix/cid_1204285_divide_by_zero
[fix/cid_1204285_divide_by_zero] Fix CID 1204285: Division by zero
2015-07-24 13:49:05 -07:00
Cliff Gordon f47bbed3ef [fix/cid_1204285_divide_by_zero] Fix CID 1204285: Division by zero in set_currentItem() 2015-07-24 11:59:02 -05:00
MageKing17 33d83fe4fe Merge pull request #246 from ln-zookeeper/master
Fixed bug with ship-ship collisions incorrectly choosing which quadra…
2015-07-24 00:32:35 -07:00
Lari Nieminen 202a4077a4 Fixed bug with ship-ship collisions incorrectly flashing a shield quadrant on the light ship. 2015-07-24 10:08:59 +03:00
Lari Nieminen 7b2c992380 Added a +Minimum Weapon Span auto spread shield option to control the minimum distance weapons must have traveled before being allowed to hit the shield. 2015-07-21 21:59:31 +03:00
Cliff Gordon ce69e7179e Merge pull request #243 from chief1983/fix/sse_fred_name
Fix the output Fred SSE target name.
2015-07-18 18:46:48 -05:00
Cliff Gordon (chief1983) fc6765144d Fix the output Fred SSE target name. Edited in VS2013 which fixed the file's line endings to CRLF. 2015-07-18 11:02:01 -05:00
Fabian Woltermann ce22e3a0d4 Merge pull request #239 from PeterMitsis/math-refactoring
Math refactoring
2015-07-17 13:35:42 +02:00
Fabian Woltermann be628af117 Merge pull request #223 from ln-zookeeper/master
Fixes Mantis #2436: Mouse controls ignore the axis binds.
2015-07-17 13:16:58 +02:00
Peter Mitsis 83d00839ed fvi: Refactor solution to quadratic formula
The classic solution to the quadratic equation ...
     a*x*x + b*x + c = 0
is ...
         -b +- sqrt(b*b - 4*ac)
     x = ----------------------
                 2*a

This can be optimized by substituting b = 2*B.
         -2*B +- sqrt((2*B)*(2*B) - 4*a*c)
     x = ---------------------------------
                       2*a

This expands to ...
         -2*B +- sqrt(4*B*B - 4*a*c)
     x = ---------------------------
                    2*a

And simplifies to ...
         -2*B +- 2*sqrt(B*B - 4*a*c)
     x = ---------------------------
                    2*a

         -B +- sqrt(B*B - a*c)
     x = ---------------------
                  a

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-15 09:18:47 -04:00
Peter Mitsis b72cf669b8 Refactor bez_fact()
Uses an array of precalculated factorials that are accessed as a lookup table
instead of computing the factorials at runtime.  This cuts down on compiled
code bloat (compiler was both unrolling and inlining the computation's loop)
everywhere it was used.

NOTE: The original implementation returned an 'int'.  As a result, the largest
uncorrupted factorial it could compute was 12!.  For this reason, the lookup
table only goes up to 12!.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-15 09:08:19 -04:00
Peter Mitsis 9d3dd5c322 Refactor macros fl_radians() and fl_degrees()
Rejiggers the macros fl_radians() and fl_degrees() to avoid unnecessary
operations.  The new placement of the parentheses permit the compiler to
evaluate (PI / 180.f) and (180.f / PI) at compile time rather than run time.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-15 09:08:19 -04:00
Fabian Woltermann 5f39c386ef Merge pull request #234 from Echelon9/fix/clean-build
Clean up GCC build warnings
2015-07-12 09:54:30 +02:00
Echelon9 3e8278d698 Fix: model/modelread.cpp: warning: variable ‘flags’ set but not used [-Wunused-but-set-variable] 2015-07-11 22:47:25 +10:00
Echelon9 37cf848f51 Fix: model/modelrender.cpp:2898:9: warning: declaration of ‘view_pos’ shadows a previous local [-Wshadow] 2015-07-11 22:36:42 +10:00
Echelon9 95f615a894 Fix: bmpman/bmpman.cpp: warning: enumeration value ‘x’ not handled in switch [-Wswitch] 2015-07-11 22:30:12 +10:00
Echelon9 bae2d3116b Fix: controlconfig/controlsconfig.cpp:2116:13: warning: declaration of ‘j’ shadows a previous local [-Wshadow] 2015-07-11 22:15:49 +10:00
Echelon9 542c794e72 Fix: object/collideshipship.cpp:1159:12: warning: variable ‘q’ set but not used [-Wunused-but-set-variable] 2015-07-11 22:08:52 +10:00
Echelon9 d029b82d98 Fix: ai/aicode.cpp:11855:9: warning: variable ‘dist_to_f2’ set but not used [-Wunused-but-set-variable] 2015-07-11 22:04:41 +10:00
Echelon9 ad8064ef81 Fix warning: variable ‘dist’ set but not used [-Wunused-but-set-variable] 2015-07-11 21:58:07 +10:00
Echelon9 a4e12d135b Fix: ai/aibig.cpp:1266:10: warning: variable ‘box_dist’ set but not used [-Wunused-but-set-variable] 2015-07-11 21:39:49 +10:00
Echelon9 053ae6d287 Fix: modelrender.h:86:7: warning: ‘model_render_params::Replacement_textures’ will be initialized after [-Wreorder] 2015-07-11 21:28:01 +10:00
Fabian Woltermann 15bceee125 Merge pull request #232 from asarium/fix/snd_cfile
Fixes Mantis 3168: snd_load leaks cfile handles if it can't parse a file.
2015-07-11 12:29:42 +02:00
Echelon9 08e50885cb Fix: warning: ‘opengl_vertex_buffer::ibo_size’ will be initialized after [-Wreorder] 2015-07-11 20:18:34 +10:00
asarium e6dbb28b48 Fix for Mantis 3168: snd_load leaks cfile handles if it can't parse a file. 2015-07-11 11:36:21 +02:00
Echelon9 1e151865d4 Fix: object/collideshipweapon.cpp:67:185: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:45:38 +10:00
Echelon9 c2a2ef5682 Fix: object/collideshipweapon.cpp:39:63: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:42:15 +10:00
Echelon9 3acc777afe Fix: model/modelread.cpp: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:40:12 +10:00
Echelon9 aa7bd5bf2c Fix: asteroid/asteroid.cpp:1614:99: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:32:36 +10:00
Echelon9 ca2cd63a95 Fix: asteroid/asteroid.cpp:949:10: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:30:55 +10:00
Echelon9 1787b95498 Fix: ai/aicode.cpp:14896:75: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:28:59 +10:00
Echelon9 2586198e0e Fix: asteroid/asteroid.cpp:1653:68: warning: declaration of ‘asteroid_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:14:38 +10:00
Echelon9 b7e76de184 Fix: asteroid/asteroid.cpp:1614:98: warning: declaration of ‘asteroid_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:12:27 +10:00
Echelon9 f656232030 Fix: asteroid/asteroid.cpp:1477:50: warning: declaration of ‘asteroid_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:10:02 +10:00
Echelon9 e4e3064bea Fix: asteroid/asteroid.cpp:1363:92: warning: declaration of ‘asteroid_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:07:37 +10:00
Echelon9 f804539a15 Fix: debris/debris.cpp:846:10: warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow] 2015-07-06 23:04:25 +10:00
Echelon9 ca9ae8bb8e Fix: nebula/neb.cpp:1422:37: warning: declaration of ‘eye’ shadows a global declaration [-Wshadow] 2015-07-06 23:01:21 +10:00
Echelon9 767b39fbbc Fix: nebula/neb.cpp:1416:33: warning: declaration of ‘eye’ shadows a global declaration [-Wshadow] 2015-07-06 22:59:55 +10:00
Echelon9 6d0996d90c Fix: graphics/grstub.cpp:736:71: warning: declaration of ‘shader’ shadows a global declaration [-Wshadow] 2015-07-06 22:57:12 +10:00
Echelon9 294cf79e04 Fix: graphics/gropenglshader.cpp: warning: declaration of ‘shader’ shadows a global declaration [-Wshadow] 2015-07-06 22:54:10 +10:00
Echelon9 b7864cd2aa Fix: graphics/gropenglshader.cpp:231:73: warning: declaration of ‘shader’ shadows a global declaration [-Wshadow] 2015-07-06 22:52:01 +10:00
Echelon9 4bf5f15f72 Fix: graphics/gropenglpostprocessing.cpp:682:79: warning: declaration of ‘shader’ shadows a global declaration [-Wshadow] 2015-07-06 22:49:38 +10:00
Echelon9 4a0e3b4c40 Fix: graphics/generic.cpp:35:117: warning: declaration of ‘anim’ shadows a global declaration [-Wshadow] 2015-07-06 22:46:23 +10:00
Echelon9 3860951b6c Fix: graphics/*.cpp warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-06 22:36:10 +10:00
Echelon9 54003a2622 Fix: debris/debris.cpp:850:10: warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-06 22:30:50 +10:00
Echelon9 b7bc60708c Fix: asteroid/asteroid.cpp:953:10: warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-06 22:29:04 +10:00
Echelon9 dc5651ab70 Fix: object/collideshipship.cpp:539:10: warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-06 22:26:31 +10:00
Echelon9 f12dc5478b Fix: ai/aicode.cpp: warning: declaration of ‘color’ shadows a global declaration [-Wshadow] 2015-07-06 22:19:28 +10:00
Echelon9 8051bac868 Fix: ai/aigoals.cpp:203:48: warning: declaration of ‘ai_goal’ shadows a global declaration [-Wshadow] 2015-07-06 22:15:18 +10:00
Echelon9 d94823ef77 Fix: graphics/gropenglbmpman.cpp:561:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 2015-07-06 21:47:01 +10:00
Echelon9 eda6f33d77 Fix: graphics/gropenglbmpman.cpp:561:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 2015-07-06 21:41:31 +10:00
Echelon9 9db610ef2c Fix: network/multiutil.cpp:692:76: warning: declaration of ‘net_player’ shadows a global declaration [-Wshadow] 2015-07-06 21:30:27 +10:00
Echelon9 2b8ef9e1fd Fix: graphics/2d.cpp:2142:1: warning: declaration of ‘team_color’ shadows a global declaration [-Wshadow] 2015-07-06 21:19:56 +10:00
Echelon9 1aa858a164 Fix: graphics/2d.cpp:1874:7: warning: variable ‘t0’ set but not used [-Wunused-but-set-variable] 2015-07-06 21:17:48 +10:00
Echelon9 aae7c47748 Fix: lab/lab.cpp:943:9: warning: declaration of ‘j’ shadows a previous local [-Wshadow] 2015-07-06 21:14:45 +10:00
Echelon9 53164a169c Fix: mission/missioncampaign.cpp:1200:12: warning: declaration of ‘mission’ shadows a global declaration [-Wshadow] 2015-07-06 21:12:11 +10:00
Echelon9 fe1b607214 Fix: mission/missioncampaign.cpp:1012:12: warning: declaration of ‘mission’ shadows a global declaration [-Wshadow] 2015-07-06 21:08:00 +10:00
Echelon9 040d157644 Fix: mission/missioncampaign.cpp:1088:12: warning: declaration of ‘mission’ shadows a global declaration [-Wshadow] 2015-07-06 21:03:30 +10:00
Echelon9 475155d62f Fix: mission/missioncampaign.cpp:1600:6: warning: declaration of ‘mission’ shadows a global declaration [-Wshadow] 2015-07-06 20:58:53 +10:00
Echelon9 85a0bda946 Fix: model/modelanim.cpp:536:78: warning: declaration of ‘anim’ shadows a global declaration [-Wshadow] 2015-07-06 20:54:14 +10:00
Echelon9 f2c8aa665f Fix: missionui/missionshipchoice.cpp:923:9: warning: declaration of ‘header’ shadows a global declaration [-Wshadow] 2015-07-06 19:51:45 +10:00
Fabian Woltermann 181098e1e4 Merge pull request #230 from PeterMitsis/math-optimizations
math/vecmat optimizations
2015-07-06 02:42:14 -07:00
Echelon9 66257146b7 Fix: model/modelcollide.cpp:1215:36: warning: declaration of ‘mc_info’ shadows a global declaration [-Wshadow] 2015-07-06 19:40:21 +10:00
Echelon9 60d1234abd Fix: model/modelread.cpp:270:12: warning: declaration of ‘i’ shadows a previous local [-Wshadow] 2015-07-05 17:13:01 +10:00
Echelon9 2bac9ba5fa Fix: model/modelrender.cpp:780:55: warning: declaration of ‘color’ shadows a global declaration [-Wshadow] 2015-07-05 17:07:39 +10:00
Echelon9 6e273ccd7f Fix: gamehelp/contexthelp.cpp:391:9: warning: declaration of ‘font’ shadows a global declaration [-Wshadow] 2015-07-05 17:01:37 +10:00
Echelon9 4885807d82 Fix: iff_defs/iff_defs.cpp:68:4: warning: declaration of ‘temp_color_t’ shadows a previous local [-Wshadow] 2015-07-05 16:57:35 +10:00
Echelon9 444f830fdc Fix: network/multi_voice.cpp: warning: parameter set but not used [-Wunused-but-set-parameter] 2015-07-05 16:51:16 +10:00
Echelon9 e98d84314a Fix: network/multimsgs.cpp:8473:70: warning: declaration of ‘bolt_type’ shadows a global declaration [-Wshadow] 2015-07-05 16:44:48 +10:00
Echelon9 5e9fd26028 Fix: network/multimsgs.cpp:8493:7: warning: declaration of ‘bolt_type’ shadows a global declaration [-Wshadow] 2015-07-05 16:42:24 +10:00
Echelon9 3a3e901249 Fix: network/multiteamselect.cpp:1720:7: warning: declaration of ‘wing’ shadows a global declaration [-Wshadow] 2015-07-05 16:40:04 +10:00
Echelon9 1f8c1dccde Fix: object/collidedebrisweapon.cpp:100:10: warning: declaration of ‘weapon’ shadows a global declaration [-Wshadow] 2015-07-05 16:35:11 +10:00
Echelon9 0dc48f8470 Fix: object/collidedebrisweapon.cpp:45:10: warning: declaration of ‘weapon’ shadows a global declaration [-Wshadow] 2015-07-05 16:32:57 +10:00
Echelon9 83a8b2bee5 Fix: object/collideshipship.cpp:457:115: warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-05 16:27:21 +10:00
Echelon9 2c4fb4286c Fix: object/collideshipweapon.cpp:470:10: warning: declaration of ‘weapon’ shadows a global declaration [-Wshadow] 2015-07-05 16:19:20 +10:00
Echelon9 570f6dd581 Fix: object/collideshipship.cpp:1316:138: warning: declaration of ‘mc_info’ shadows a global declaration [-Wshadow] 2015-07-05 16:14:24 +10:00
Echelon9 b326e77574 Fix: object/collideshipweapon.cpp:543:85: warning: declaration of ‘weapon’ shadows a global declaration [-Wshadow] 2015-07-05 15:55:15 +10:00
Echelon9 6d6d3e99e5 Fix: object/collideweaponweapon.cpp:168:10: warning: variable ‘dist’ set but not used [-Wunused-but-set-variable] 2015-07-05 14:25:53 +10:00
Echelon9 c7045147f3 Fix: object/collideshipship.cpp:1316:126: warning: declaration of ‘light’ shadows a global declaration [-Wshadow] 2015-07-05 14:17:53 +10:00
Peter Mitsis 3495b190d4 Streamline vm_quaternion_rotate()
Calculates sinf(theta * 0.5) once only instead of three times.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:31 -04:00
Peter Mitsis 62a7865f94 Streamline vm_angle_2_matrix()
The values of sin(0) and cos(0) are well known and do not need to be calculated
at run time.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:31 -04:00
Peter Mitsis 8193dbb316 Streamline vm_vec_avg_n()
Instead of performing three consecutive divisions, vm_vec_avg_n() now performs
one division at the start and three multiplications at the end.  Recall that
multiplication is faster than division.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:31 -04:00
Peter Mitsis 95d1701794 Remove unnecessary checking before atan2_safe()
The routine atan2_safe() already contains a test that checks if both parameters
are zero--that is the point of the routine.  Thus, there is no need for the
caller of atan2_safe() to perform that same check.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:31 -04:00
Peter Mitsis 945f655e0e Remove unnecessary vm_vec_normalize() checks
The routine vm_vec_normalize() always returns a value greater than zero.
Thus, there is no need to test its return value for values that are less
than or equal to zero.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:31 -04:00
Peter Mitsis 11b65fe0bf Remove unnecessary vm_vec_copy_normalize() checks
The routine vm_vec_copy_normalize() always returns a value greater than zero.
Thus, there is no need to test its return value for values that are less than
or equal to zero.

Signed-off-by: Peter Mitsis <[email protected]>
2015-07-05 00:03:27 -04:00
Echelon9 6618165926 Fix: model/modelinterp.cpp:4342:14: warning: declaration of ‘j’ shadows a previous local [-Wshadow] 2015-07-05 00:59:13 +10:00
Echelon9 6950c69ebb Fix: model/modelinterp.cpp:2034:44: warning: declaration of ‘gpoi’ shadows a previous local [-Wshadow] 2015-07-05 00:54:29 +10:00
Echelon9 b8ff93dad2 Fix: model/modelinterp.cpp:2603:43: warning: declaration of ‘gpoi’ shadows a previous local [-Wshadow] 2015-07-05 00:52:39 +10:00
Echelon9 c220480075 Fix: lab/lab.cpp:2497:45: warning: declaration of ‘color’ shadows a global declaration [-Wshadow] 2015-07-05 00:40:13 +10:00
Echelon9 182b297af4 Fix: model/modelrender.cpp:2560:10: warning: variable ‘objp’ set but not used [-Wunused-but-set-variable] 2015-07-05 00:30:34 +10:00
Echelon9 a0527afd55 Fix: ship/ship.cpp:3132:14: warning: declaration of ‘i’ shadows a previous local [-Wshadow] 2015-07-05 00:04:05 +10:00
Echelon9 9283ff8227 Fix: controlconfig/controlsconfig.cpp:669:9: warning: variable ‘k’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:51:24 +10:00
Echelon9 769e98fe4c Fix: controlconfig/controlsconfig.cpp:669:9: warning: variable ‘j’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:46:38 +10:00
Echelon9 3c48d81a52 Fix: controlconfig/controlsconfig.cpp:1443:27: warning: variable ‘len’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:41:59 +10:00
Echelon9 7f100c439a Fix: controlconfig/controlsconfig.cpp:1442:18: warning: variable ‘jptr’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:34:40 +10:00
Echelon9 481ec12450 Fix: bmpman/bmpman.cpp:2671:12: warning: variable ‘bmp’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:29:00 +10:00
Echelon9 312648668c Fix: anim/animplay.cpp:257:25: warning: variable ‘render_time’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:20:18 +10:00
Echelon9 f4aa493f59 Fix: anim/animplay.cpp:257:25: warning: variable ‘decompress_time’ set but not used [-Wunused-but-set-variable] 2015-07-04 23:16:08 +10:00
Echelon9 039ad64a33 Fix: ai/aicode.cpp:10715:9: warning: variable ‘dist’ set but not used [-Wunused-but-set-variable] 2015-07-04 19:03:09 +10:00
Echelon9 c83a2ea2e8 Fix: ai/aicode.cpp:8169:24: warning: variable ‘time_to_enemy’ set but not used [-Wunused-but-set-variable] 2015-07-04 18:58:10 +10:00
Echelon9 edbedeb84a Fix: ai/aicode.cpp:8017:10: warning: variable ‘eshipp’ set but not used [-Wunused-but-set-variable] 2015-07-04 17:39:44 +10:00
Echelon9 d855154fa9 Fix: graphics/gropenglshader.cpp:387:7: warning: variable ‘in_error’ set but not used [-Wunused-but-set-variable] 2015-07-04 17:33:22 +10:00
Echelon9 7fea629121 Fix: graphics/gropengltnl.cpp:696:8: warning: variable ‘rval’ set but not used [-Wunused-but-set-variable] 2015-07-04 17:10:17 +10:00
Echelon9 183f0615e2 Fix: graphics/gropengltnl.cpp:812:6: warning: variable ‘render_pass’ set but not used [-Wunused-but-set-variable] 2015-07-04 17:08:41 +10:00
Echelon9 e9330b4f5f Fix: graphics/gropengltnl.cpp:1378:6: warning: variable ‘zbuff’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:52:50 +10:00
Echelon9 785398657c Fix: menuui/readyroom.cpp:1175:15: warning: variable ‘z’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:22:59 +10:00
Echelon9 fff2d5280c Fix: model/modelrender.cpp:2560:8: warning: variable ‘shipp’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:18:38 +10:00
Echelon9 cd503fd2e4 Fix: object/objcollide.cpp:1247:8: warning: variable ‘max’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:10:15 +10:00
Echelon9 e7e046f949 Fix: object/objcollide.cpp:1248:8: warning: variable ‘overlap_min’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:08:40 +10:00
Echelon9 6e6ff3c7c0 Fix: object/objectsort.cpp: warning: variable ‘wp’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:06:13 +10:00
Echelon9 4f4fe00b97 Fix: ship/ship.cpp:18381:6: warning: variable ‘clip_started’ set but not used [-Wunused-but-set-variable] 2015-07-04 16:01:36 +10:00
Echelon9 98d6b6ce8b Fix: weapons.cpp:7374:8: warning: variable ‘clip_plane’ set but not used [-Wunused-but-set-variable] 2015-07-04 15:55:15 +10:00
Goober5000 a47ac6c5ee Merge pull request #211 from Echelon9/fix/janitorial-changes
Janitorial changes
2015-07-02 14:47:55 -04:00
Goober5000 da79469606 Merge pull request #224 from Echelon9/fix/issue196
Passing value 2.0 to asin() leads to implementation-defined result
2015-07-02 14:40:29 -04:00
Echelon9 a93215f781 Ensure input domain to asin() does not lead to irrational results (implementation defined behaviour) 2015-07-01 23:15:36 +10:00
Echelon9 58f7fb247b Document ai_update_aim() after touching the function 2015-07-01 23:07:17 +10:00
Echelon9 aa1feb0799 Refrain from unnecessarily passing a pointer to global object to ai_update_aim() 2015-07-01 23:07:17 +10:00
Echelon9 833e7b1d7a Ensure consistent capitalisation of ai_update_aim() parameter. 2015-07-01 23:07:17 +10:00
Echelon9 b2a07f19c2 Remove redundant parameter to compute_time_to_enemy(). Function doesn't need a pointer to the enemy objp, where it uses distance directly instead. 2015-07-01 23:07:17 +10:00
Echelon9 b38e153861 Remove redundant parameter to prioritize_goals(). 2015-07-01 23:07:17 +10:00
Echelon9 39188f7926 Remove redundant parameter to ai_ignore_wing(). 2015-07-01 23:07:17 +10:00
Echelon9 29fa74fd63 Remove redundant parameter to draw_brackets_diamond_quick(). 2015-07-01 23:07:17 +10:00
Echelon9 8e018c5338 Clean up load_animating_pointer(). 2015-07-01 23:07:17 +10:00
Echelon9 0810ae08de Clean up definition of asteroid_process_pre(). 2015-07-01 23:07:16 +10:00
Echelon9 366d409da4 Clean up definition of asteroid_process_post(). 2015-07-01 23:07:16 +10:00
Goober5000 2434365103 Merge pull request #219 from PeterMitsis/fvi_apply_const_and_static_keywords
math/fvi: apply const and static keywords
2015-06-30 11:11:17 -04:00
Goober5000 bd18c88198 Merge pull request #77 from chief1983/fix/nat_multiplayer
[fix/nat_multiplayer] Fix for multiple users behind a NAT
2015-06-29 21:33:10 -04:00
Cliff Gordon 6e0f9c1cd2 [fix/nat_multiplayer] Simplify the new psnet check. 2015-06-29 16:51:49 -05:00
Cliff Gordon 5311ea4f7a [fix/nat_multiplayer] Vestigare's submitted patch for allowing multiple users behind a NAT to connect to a remote standalone. 2015-06-29 16:50:06 -05:00
Lari Nieminen 09dfcf559e Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-06-28 18:13:51 +03:00
Cliff Gordon 0a9ae3eb46 Merge pull request #222 from scp-fs2open/revert-113-coverity/1298257
Revert "Fix Coverity 1298257: Uninitialized scalar var"
2015-06-28 10:00:42 -05:00
Peter Mitsis 7a59192bbb More application of static and const keywords
Applies the const and static keywords to the recently restored routines.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-28 09:09:26 -04:00
Fabian Woltermann 6a0e550aac Revert "Fix Coverity 1298257: Uninitialized scalar var" 2015-06-28 13:59:13 +02:00
Lari Nieminen da71e629b4 Fixes Mantis #2436: Mouse controls ignore the axis binds. 2015-06-28 14:42:17 +03:00
Peter Mitsis ca07a428e3 Revert "Remove nine unused routines from math/fvi module"
This reverts commit 8cdabf6a23.

Conflicts:

	code/math/fvi.cpp
2015-06-28 07:20:34 -04:00
Fabian Woltermann 150a00a17a Merge pull request #209 from ln-zookeeper/master
Fixes and enhancements for detail boxes and spheres
2015-06-27 11:43:56 +02:00
Fabian Woltermann bdf844fc83 Merge pull request #113 from niffiwan/coverity/1298257
Fix Coverity 1298257: Uninitialized scalar var
2015-06-27 11:28:19 +02:00
Fabian Woltermann 464d49d182 Merge pull request #212 from Echelon9/fix/mantis3137
Fix Mantis 3137
2015-06-26 13:43:55 +02:00
Fabian Woltermann 3386dc6f20 Merge pull request #218 from asarium/fix/hudmessageIterator
Fix usage of invalid iterator in hudmessage.cpp
2015-06-26 13:42:14 +02:00
Fabian Woltermann ff76a32508 Merge pull request #216 from Echelon9/fix/color-struct-alignment
Improve alignment of color struct
2015-06-26 13:41:31 +02:00
asarium 6b95037dcc Fix usage of invalid iterator. 2015-06-25 18:22:51 +02:00
Peter Mitsis 3cb0c72ced Apply static and const keywords to math/fvi module
Improves readability.  It also has the potential to help the compiler make
better decisions.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-25 07:51:53 -04:00
Echelon9 2cf8d0cc98 Improve alignment of color struct (28 bytes -> 24 bytes, c.14%). 2015-06-25 23:39:17 +12:00
Peter Mitsis 8cdabf6a23 Remove nine unused routines from math/fvi module
Removes the following unused routines ...
 1. accurate_square_root()
 2. fvi_point_dist_plane()
 3. fvi_segment_plane()
 4. fvi_sphere_perp_edge()
 5. check_sphere_point()
 6. fvi_check_sphere_sphere()
 7. fvi_cull_polyface_sphere()
 8. fvi_closest_point_on_line_segment()
 9. fvi_closest_line_line()
2015-06-25 07:03:59 -04:00
Lari Nieminen e0605f125c Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-06-25 13:07:41 +03:00
Fabian Woltermann 911f3d647f Merge pull request #214 from Echelon9/fix/issue213
Avoid shadowed declaration of previous local 'gpoi'
2015-06-25 10:09:23 +02:00
Echelon9 2ca1f40d98 Avoid shadowed declaration of previous local 'gpoi' 2015-06-25 17:20:10 +12:00
Echelon9 b5610a5005 Proposed refactor of #Cutscenes in mission files, per wiki documentation. 2015-06-25 16:56:24 +12:00
Goober5000 341fdd3589 Merge pull request #207 from Echelon9/fix/issue206
Resolve order of precedence compiler warning.
2015-06-25 00:43:10 -04:00
Echelon9 7f673c8ab6 Goober5000 code review: consistency change. 2015-06-25 16:25:35 +12:00
Echelon9 ce6179a58f Resolve order of precedence compiler warning. 2015-06-25 14:27:31 +12:00
Fabian Woltermann 83fc90c74b Merge pull request #210 from chief1983/fix/205_cleanup
Fix/205 cleanup
2015-06-24 15:11:59 +02:00
Cliff Gordon (chief1983) 8c73f39e6e Remove the files from PR 205 via IDE. 2015-06-24 00:06:29 -05:00
Cliff Gordon (chief1983) 8efaf28a8a Revert "Fixed project files for all MSVS versions that support vcxproj"
This reverts commit 610f8a2ff3.
2015-06-23 22:37:35 -05:00
Cliff Gordon (chief1983) 8a3cc22605 Revert "Remove references to AVX from VS2010 project"
This reverts commit 3205f42dc2.
2015-06-23 22:37:15 -05:00
Lari Nieminen fc9acb3a4d Added support for detail box $box_offset. 2015-06-24 00:48:07 +03:00
Lari Nieminen 2e012969e7 Fixed detail sphere $offset not working right. 2015-06-24 00:44:13 +03:00
Lari Nieminen 84b7a06a44 Restored ability to combine detail boxes and spheres. 2015-06-23 19:53:18 +03:00
Lari Nieminen 8fd09be8a0 Replaced the static Interp_render_* variables with normal local ones. 2015-06-23 19:50:17 +03:00
Fabian Woltermann 83a7e862ae Merge pull request #205 from Echelon9/fix/cleanup-empty-files
Cleanup empty files
2015-06-23 11:32:48 +02:00
Echelon9 85428f5eb4 Remove added <MinimalRebuild> option to MSVC_2012. 2015-06-23 18:44:31 +10:00
Fabian Woltermann e73dbd1647 Merge pull request #170 from z64555/parselo
Organizes required_string(); Doxy's required_string() and required_st…
2015-06-23 10:16:59 +02:00
Fabian Woltermann b11497d075 Merge pull request #183 from ln-zookeeper/master
Added a "no-secondary-lock-on" ship flag to disable secondary homing.
2015-06-23 10:16:24 +02:00
Fabian Woltermann 14ed049331 Merge pull request #198 from Echelon9/fix/issue197
Update format string specifier to unsigned int (mainhallmenu.cpp)
2015-06-23 10:14:38 +02:00
Rhys Kidd 00d4271550 Merge pull request #1 from The-E/fix/cleanup-empty-files
Fixed project files for all MSVS versions that support vcxproj
2015-06-23 18:14:20 +10:00
Fabian Woltermann ff22d7b9a6 Merge pull request #200 from Echelon9/fix/issue199
Retval of bm_get_size (int handle) should be a size_t
2015-06-23 10:14:18 +02:00
Fabian Woltermann ce3bb0a6a9 Merge pull request #202 from Echelon9/fix/issue201
Retval of bm_page_out(int handle) should be a bool
2015-06-23 10:14:00 +02:00
Fabian Woltermann 4c55ad45a0 Merge pull request #204 from Echelon9/fix/issue203
Retval of bm_has_alpha_channel(int handle) should be a bool
2015-06-23 10:13:34 +02:00
The_E 3205f42dc2 Remove references to AVX from VS2010 project 2015-06-23 10:11:24 +02:00
The_E 610f8a2ff3 Fixed project files for all MSVS versions that support vcxproj 2015-06-23 10:03:08 +02:00
Echelon9 0fde8c3925 Update Xcode 4+ project file for removal of empty files. 2015-06-23 16:05:01 +10:00
Echelon9 8ba1ddbbc2 Makefile removal of references to missionui/missionstats.[cpp|h]. 2015-06-23 14:52:58 +10:00
Echelon9 3af13b603d Remove empty missionui/missionstats.[cpp|h]. 2015-06-23 14:46:42 +10:00
Echelon9 54508b6429 Makefile and source code removal of references to ai/ailocal.h 2015-06-23 14:39:43 +10:00
Echelon9 b62196dc0d Remove empty ai/ailocal.h 2015-06-23 14:32:02 +10:00
Echelon9 8eeff0e06c Remove missionrecommend.[cpp|h] from Makefile. 2015-06-23 14:30:01 +10:00
Echelon9 da9d363230 Remove empty missionrecommend.[cpp|h] files. 2015-06-23 14:23:28 +10:00
Echelon9 cb617b5e9f Modify usage of bm_has_alpha_channel that needs to pass int to the OpenGL driver. Use ternary operator. 2015-06-23 14:05:58 +10:00
Echelon9 130a148816 Remove TODO doxygen comment. 2015-06-23 13:59:10 +10:00
Echelon9 33cae6930c Amend retval in declaration and definition to bool. 2015-06-23 13:57:58 +10:00
Echelon9 6abba98455 Increase consistency with adjacent code style, and avoid >80 character line wrap. 2015-06-23 11:49:48 +10:00
Echelon9 0437f81999 Ensure paramater name matches between declaration and definition. 2015-06-23 11:44:47 +10:00
Echelon9 4f649f1cdb Remove TODO doxygen comment. 2015-06-23 11:40:27 +10:00
Echelon9 e33f2e1d38 Amend retval in declaration and definition to bool. 2015-06-23 11:39:44 +10:00
Echelon9 df1c50bc47 Convert internal mem_taken type to size_t. 2015-06-23 11:07:29 +10:00
Echelon9 79597e9757 Ensure parameter name matches between declaration and definition. 2015-06-23 10:59:43 +10:00
Echelon9 6447208960 Remove TODO doxygen comment. 2015-06-23 10:48:47 +10:00
Echelon9 c061ee6324 Amend retval in declaration and definition to size_t. 2015-06-23 10:48:11 +10:00
Echelon9 57c9e1ae6a Address putative requirement for mm/mmreg.h to have <windows.h> included first. 2015-06-23 10:16:59 +10:00
Echelon9 60aec6f6cb Update format string specifier to unsigned int. 2015-06-22 21:40:43 +10:00
Echelon9 418b9e06d7 Simplify duplicative weapon/ includes, which are in weapon/weapon.h 2015-06-22 20:24:31 +10:00
Echelon9 d2f5575e20 Simplify duplicative ui/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 8c12affa23 Simplify duplicative species_def/ includes, which are in species_def/species_def.h 2015-06-22 20:24:31 +10:00
Echelon9 ca552b45f5 Simplify duplicative ship/ includes, which are in ship/shipfx.h 2015-06-22 20:24:31 +10:00
Echelon9 00bfe37cb4 Simplify duplicative radar/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 2964132f7d Properly guard inclusion of playerman/managepilot.h 2015-06-22 20:24:31 +10:00
Echelon9 eb739e2a9b Simplify duplicative pilotfile/ includes, which are in pilotfile/pilotfile.h 2015-06-22 20:24:31 +10:00
Echelon9 8c2c451e8e Simplify duplicative parse/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 29faabdfb3 Simplify duplicative object/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 2b251e3cb3 Simplify duplicative model/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 ed2170b2ea Simplify duplicative mod_table/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 493d9a4280 Simplify duplicative missionui/ includes. 2015-06-22 20:24:31 +10:00
Echelon9 a7e6be3368 Simplify duplicative mission/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 dd3a6c2e50 Simplify duplicative menuui/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 97a134e51f Simplify duplicative math/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 e613f4db7d Simplify duplicative lab/ includes, which are in lab/wmcgui.h 2015-06-22 20:24:30 +10:00
Echelon9 47af1ff851 Simplify duplicative hud/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 4e6f525f7c Simplify duplicative graphics/ includes. 2015-06-22 20:24:30 +10:00
Echelon9 b25feb69aa Simplify duplicative gamesnd/ includes, which are in gamesnd/gamesnd.h 2015-06-22 20:24:30 +10:00
Echelon9 90bb4e3a7b Simplify duplicative freespace2/ includes, which are in freespace2/freespace.h 2015-06-22 20:24:30 +10:00
Echelon9 39e1ed3403 Simplify fireball/ include logic. 2015-06-22 20:24:30 +10:00
Echelon9 45664465be Simplify debugconsole/ include logic. 2015-06-22 20:24:30 +10:00
Echelon9 1601f83a05 Guard extraneous inclusion of globalincs/pstypes.h 2015-06-22 20:24:30 +10:00
Echelon9 ae8a310e97 Simplify duplicative camera/ includes, which are in camera/camera.h 2015-06-22 20:24:30 +10:00
Echelon9 0d35f901b3 Simplify duplicative autopilot/ includes, which are in autopilot/autopilot.h 2015-06-22 20:24:30 +10:00
Echelon9 726036b91e Simplify duplicative bmpman/ includes, which are in bmpman/bmpman.h 2015-06-22 20:24:30 +10:00
Echelon9 c5493bb480 Scripted sort and uniq on (internal) project includes. Improves search time and as a by product removed a number of duplicative includes. 2015-06-22 20:24:30 +10:00
Fabian Woltermann fda36a1476 Merge pull request #193 from PeterMitsis/vecmat_apply_const_and_static_keywords
vecmat: apply const and static keywords
2015-06-22 12:13:46 +02:00
Fabian Woltermann e176132106 Merge pull request #194 from Echelon9/feature/make-cppcheck
Add 'make cppcheck' command line option.
2015-06-22 12:10:54 +02:00
Echelon9 2c36ce39af Add 'make cppcheck' command line option. 2015-06-21 15:37:25 +10:00
Peter Mitsis fc6f7cbbb6 Add static and const keywords to vector math routines
Improves readability.  It also has the potential to help the compiler make
better decisions.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-20 08:01:25 -04:00
Peter Mitsis 7c2eb53e62 Remove unused routine vm_fvec_matrix_interpolate()
Not only is the routine vm_fvec_matrix_interpolate() unused, it does not appear
to have been used for the duration of the project.  The only reference to it
found in the history was in a removed comment.  That comment indicated that it
was implemented in 1997.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-20 07:59:34 -04:00
MageKing17 bcf19f1256 Merge pull request #192 from jg18/log_enhanced_sound
Log usage status of enhanced sound.
2015-06-20 01:54:59 -07:00
jg18 4d6d679c7b Log usage status of enhanced sound. 2015-06-19 23:50:14 -07:00
Fabian Woltermann feb6d188f7 Merge pull request #188 from chief1983/fix/standalone_name_hang
[fix/standalone_name_hang] Prevent the standalone from hanging
2015-06-19 21:24:47 +02:00
MageKing17 179229fa81 Add max_shield_recharge and shield_impact_explosion_anim to copy/move functions. 2015-06-18 14:45:43 -07:00
MageKing17 ab9d2e20fb Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/ship/ship.cpp
2015-06-18 14:40:53 -07:00
MageKing17 35813b5e0f Merge pull request #120 from chief1983/mp_for_2012
Add /MP to all projects and configs in VS 2012 project files.
2015-06-18 14:14:49 -07:00
MageKing17 eff6d402f3 Merge pull request #76 from chief1983/fix/triplemon_hud
[fix/triplemon_hud] Yarn's triple-monitor fix
2015-06-18 14:11:51 -07:00
Cliff Gordon 3e8b62999b [fix/standalone_name_hang] Prevent the standalone from hanging when attempting to set a name that is too long. 2015-06-17 14:14:06 -05:00
Cliff Gordon (chief1983) c56925a830 Disable the minimal rebuilds that were enabled for debug configurations. Also contains some whitespace cleanup that VS applied automatically. 2015-06-17 10:38:15 -05:00
Cliff Gordon 28c1286c4d Merge remote-tracking branch 'origin/master' into mp_for_2012 2015-06-17 10:15:44 -05:00
Cliff Gordon 2d662075c3 Merge remote-tracking branch 'origin/master' into fix/triplemon_hud 2015-06-17 10:11:57 -05:00
Cliff Gordon 3247fb08d0 Merge pull request #185 from FSCyborg/patch-1
Resolve CID 1093395 - Unnecessary sanity check
2015-06-17 10:02:17 -05:00
FSCyborg 916fce023d Resolve CID 1093395 - Unnecessary sanity check
Pretty sure this is just a paranoid check.  If it's negative it should get changed to at least 2 in the following line.  Let me know if I have any misconceptions.
2015-06-15 16:12:22 -04:00
Fabian Woltermann b9f9afe26a Revert "Merge pull request #181 from PeterMitsis/math-cleanup"
This reverts commit 1192c1dafc, reversing
changes made to 8643fa7327.
2015-06-15 08:58:59 +02:00
Goober5000 335f1be322 Merge pull request #177 from FSCyborg/patch-1
Resolve CID 1093428 & 1093429
2015-06-14 20:43:39 -04:00
MageKing17 1cc452c13e Merge pull request #182 from DahBlount/feature/dont_spawn_if_shot
Create "don't spawn if shot" flag
2015-06-14 15:32:09 -07:00
Lari Nieminen 4acad3b126 Added a "no-secondary-lock-on" ship flag to disable secondary homing. 2015-06-14 22:25:54 +03:00
DahBlount 923d9851b9 Create "don't spawn if shot" flag
This flag prevents submunitions from being created if a parent weapon is
shot down.
2015-06-14 10:51:09 -07:00
Fabian Woltermann 1192c1dafc Merge pull request #181 from PeterMitsis/math-cleanup
Math cleanup
2015-06-14 11:40:31 +02:00
Peter Mitsis 85f50d9c94 Streamline vm_quaternion_rotate()
Calculates sinf(theta * 0.5) once only instead of three times.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:31 -04:00
Peter Mitsis 1af0f814c9 Refactor bez_fact()
Uses an array of precalculated factorials that are accessed as a lookup table
instead of computing the factorials at runtime.  This cuts down on compiled
code bloat (compiler was both unrolling and inlining the computation's loop)
everywhere it was used.

NOTE: The original implementation returned an 'int'.  As a result, the largest
uncorrupted factorial it could compute was 12!.  For this reason, the lookup
table only goes up to 12!.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:31 -04:00
Peter Mitsis 42dc0fcc74 Streamline fl_radians() and fl_degrees() macros
Rewrites the macros to avoid unnecessary divisions.  The compiler is now free
to precalculate the scaling ratio and perform it in a single multiply.  Note
that the previous placement of the parentheses meant that the compiler (at
least GCC) was performing a multiply followed by a divide.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:31 -04:00
Peter Mitsis 93639e967c Cosmetic: Do not check for negative vector magnitudes
Mathematically, the magnitude of a vector can not be negative.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:31 -04:00
Peter Mitsis 3f0476a880 Streamline vm_angle_2_matrix()
The values of sin(0) and cos(0) are well known and do not need to be calculated
at run time.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:31 -04:00
Peter Mitsis a92ebdc08a Remove commented out from vm_vec_copy_normalize()
The commented out code was cluttering things up.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis ee40ac7089 Streamline vm_vec_avg_n()
Instead of perform three consecutive divisions, vm_vec_avg_n() now performs one
division at the start and three multiplications at the end.  Recall that
multiplication is faster than division.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis b883078ce8 Remove unnecessary checking before atan2_safe()
The routine atan2_safe() already contains a test that checks if both parameters
are zero--that is the point of the routine.  Thus, there is no need for the
caller of atan2_safe() to perform that same check.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis 748fe8e5dd Remove unnecessary vm_vec_normalize() checks
The routine vm_vec_normalize() always returns a non-zero value.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis c9003f0c9d Remove unnecessary vm_vec_copy_normalize() checks
The routine vm_vec_copy_normalize() always returns a non-zero value.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis 391be952f5 Add static and const keywords to vector math routines
Improves readability.  It also has the potential to help the compiler make
better decisions.

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
Peter Mitsis 49d6474237 Update vecmat.h and vecmat.cpp file mode bits
Changes the file mode bits of vecmat.h and vecmat.cpp to make them consistent
with the other files under "code/math".

Signed-off-by: Peter Mitsis <[email protected]>
2015-06-13 23:14:30 -04:00
m!m 8643fa7327 Merge pull request #178 from FSCyborg/patch-2
Resolve CID 1093431 & 1093432
2015-06-13 20:20:06 +02:00
m!m a71e527e04 Merge pull request #179 from FSCyborg/patch-3
Resolve CID 1093435 & 1093437
2015-06-13 20:16:25 +02:00
FSCyborg 8515b68c0c Resolve CID 1093435 & 1093437
Should resolve issues 1093435 and 1093437. These issues cannot cause crashes because the denominator is indirectly checked, but it's good to change to get coverity and other future diagnosing programs to stop yelling at us.
2015-06-13 13:35:10 -04:00
FSCyborg 6393189c19 Resolve CID 1093431 & 1093432
Should resolve issues 1093431 and 1093432. These issues cannot cause crashes because the denominator is indirectly checked, but it's good to change to get coverity and other future diagnosing programs to stop yelling at us.
2015-06-13 13:26:25 -04:00
FSCyborg 418d17b4da Resolve CID 1093428 & 1093429
Should resolve issues 1093428 and 1093429.  These issues cannot cause crashes because the denominator is indirectly checked, but it's good to change to get coverity and other future diagnosing programs to stop yelling at us.
2015-06-13 13:16:56 -04:00
Fabian Woltermann f6d0e7d97a Merge pull request #126 from AxemP/PainFlash
Adding customizable pain flash and shield pain flash settings
2015-06-13 15:22:40 +02:00
MageKing17 3cb6cc305b Merge pull request #172 from DahBlount/feature/weapon_dmg_decay
Weapon Damage Decay
2015-06-12 11:39:31 -07:00
DahBlount 5f63e86dde Add sanity checks and an extra parameter
This adds extra sanity checks to the Weapon Damage Decay code and also
adds a new parameter for weapons that can GAIN damage is they approach
the end of their lifetime.
2015-06-12 09:56:13 -07:00
DahBlount e8f58f5947 Create Weapon Damage Decay framework
This adds the $Daamge Time: and +Min Damage: entries to weapons.tbl.
These parameters are used to create damage attenuation for non-beam primary weapon.
2015-06-12 05:01:21 -07:00
Axem 27e81df523 Commit cause reasons 2015-06-11 19:50:35 -05:00
z64555 5bd09cfac5 Merge pull request #171 from DahBlount/feature/random_fire_delay
Add Max delay and Min Delay
2015-06-11 13:47:10 -05:00
DahBlount 58f38c2e1e Add Max delay and Min Delay
This adds two weapons.tbl entries that allow a weapon to have a range of
possible fire delay times which results in random firing time. simulates
real life firing time error for the most part.
2015-06-11 08:15:22 -07:00
z64555 99a06b4839 Organizes required_string(); Doxy's required_string() and required_string_one_of() 2015-06-10 09:00:33 -05:00
Fabian Woltermann f162db5e48 Merge pull request #161 from ln-zookeeper/master
Added a $Max Shield Recharge ship table entry for limiting how full t…
2015-06-10 15:18:44 +02:00
Zacam 1e6455c393 Merge pull request #166 from The-E/master
Sets AVX instruction sets for all projects
2015-06-07 01:33:44 -07:00
The E 66c5dff14a Sets AVX instruction sets for all projects 2015-06-07 10:30:33 +02:00
m!m 2190fccc66 Merge pull request #165 from The-E/master
Sets AVX output for VS2015
2015-06-07 10:25:11 +02:00
The E 6204241b7d Sets AVX output for VS2015 2015-06-07 10:22:11 +02:00
Lari Nieminen 26e31a4cf0 Added a $Max Shield Recharge ship table entry for limiting how full the shields may recharge. 2015-06-04 15:35:41 +03:00
Fabian Woltermann 421d8be977 Merge pull request #153 from Echelon9/fix/Xcode4-project-file
Update Xcode4+ project files for the removal of timerbar.cpp|h
2015-06-04 13:35:09 +02:00
Fabian Woltermann 7a505887ff Merge pull request #135 from ln-zookeeper/master
Added customizable shield impact explosion effects, originally adapte…
2015-06-04 13:33:40 +02:00
m!m 3c229a9c81 Merge pull request #157 from AxemP/LuaOnBeamFire
Adds On Beam Fire scripting hook
2015-06-04 10:05:56 +02:00
Axem 4b20b46509 Commit because reasons? (Why git, why) 2015-06-03 17:44:37 -05:00
Axem 7e8557d564 Merging with new updated master 2015-06-03 17:38:52 -05:00
m!m 8c3e9dcdd7 Merge pull request #154 from AxemP/LuaAfterburn+BeamFire
Adds Afterburner Engage/Ending scripting hooks
2015-06-03 16:26:36 +02:00
m!m 91ea6b83cf Merge pull request #155 from AxemP/LuaApplyWhack
Adds applyWhack() scripting function for ship objects
2015-06-03 16:24:30 +02:00
Fabian Woltermann d7f54dd703 Merge pull request #151 from jg18/enhanced_sound
Add support for enhanced sound.
2015-06-02 08:13:42 +02:00
jg18 7fe5ba8db8 Make enhanced sound on by default. 2015-06-01 11:18:07 -07:00
jg18 faa0c5e9ee Make minor corrections to enhanced sound. 2015-06-01 10:24:07 -07:00
Axem 61e4f739ce Adds On Beam Fire scripting hook 2015-05-31 18:02:36 -05:00
Axem 852a4eb3fa Tweaking formatting... 2015-05-31 17:26:03 -05:00
Axem 7975300304 Cutting out the beam fire 2015-05-31 17:20:39 -05:00
Axem 58e8c23665 Adds on Afterburner Engage, Afterburner End, and On Beam Fire scripting hooks 2015-05-31 11:51:22 -05:00
Axem 2fa7e8f096 Adds applyWhack() scripting function for ship objects 2015-05-31 11:18:45 -05:00
Lari Nieminen 037c5a06aa Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-05-31 14:28:52 +03:00
MageKing17 859405b62e Merge pull request #149 from SamuelCho/mantis3163
Refactored how color setting is done for model rendering. Fixes Mantis 3163
2015-05-30 19:24:15 -07:00
Echelon9 2943d3f1a4 Address Xcode issue with quotes and version strings. 2015-05-31 12:07:57 +10:00
Echelon9 f2fb83801c Update Xcode4+ project files for the removal of timerbar.cpp|h 2015-05-31 10:54:46 +10:00
Goober5000 74ae0a9395 Merge pull request #148 from SamuelCho/mantis3161
Fix for Mantis 3161. Corrected model debug rendering when calling the immediate version of model rendering.
2015-05-30 18:13:05 -04:00
Goober5000 aa0d424699 Merge pull request #150 from SamuelCho/skybox_render_order
Eliminate sorting of draw calls for skyboxes for correctness.
2015-05-30 13:03:33 -04:00
Goober5000 4fe9668fa3 Merge pull request #152 from SamuelCho/mantis3162
Rectified jump nodes not rendering in FRED. Fixes Mantis 3162.
2015-05-30 13:00:44 -04:00
SamuelCho 0c9996c32b Rectified jump nodes not rendering in FRED. Fixes Mantis 3162. 2015-05-29 23:37:50 -07:00
jg18 ad910280e7 Add support for enhanced sound.
Add support for enhanced in-mission sound, with 128 audio channels and a
new system for specifying per-sound priorities and concurrent playback
limits using modular extensions of soudns.tbl.
2015-05-29 23:05:30 -07:00
SamuelCho a7c1e29bf6 Eliminate sorting of draw calls for skyboxes for correctness. 2015-05-29 22:58:28 -07:00
SamuelCho 2ba39e6b6d Refactored how color setting is done for model rendering. Fixes Mantis 3163. 2015-05-29 21:54:33 -07:00
SamuelCho 44de943a99 Fix for Mantis 3161. Corrected model debug rendering when calling the immediate version of model rendering. 2015-05-29 19:47:23 -07:00
m!m 661b650911 Merge pull request #145 from asarium/fix/timerbar
Remove unused timerbar files
2015-05-29 17:45:10 +02:00
asarium badbe4a239 Remove unused timerbar files 2015-05-29 16:31:41 +02:00
MageKing17 db781c1a7f Hopefully fix VS 2010 compilation.
Apparently VS 2010 doesn't like vector::emplace_back() with 0 arguments. A push_back() of a generic ship_info object should provide basically the same effect.
2015-05-29 02:06:04 -07:00
MageKing17 8fb0436b42 Add new variables to clone() and move().
Also add model_icon_angles to the constructor (let's just make absolutely sure it's zeroed out on initialization).
2015-05-28 23:56:22 -07:00
MageKing17 7e696a55d2 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Also added model_icon_angles to the ship_info() constructor, and model_icon_angles, thruster_glow_noise_mult, and min_engine_vol to ship_info::clone() and and ship_info::move().

Conflicts:
	code/ship/ship.cpp
	code/ship/ship.h
2015-05-28 23:49:33 -07:00
m!m 3030e20121 Merge pull request #140 from scp-fs2open/possible-appveyor-fix
Remove AppVeyor logger.
2015-05-28 11:03:00 +02:00
MageKing17 9f65ab39d0 Remove AppVeyor logger.
Apparently it's causing the nonsensical failures for builds of the 2013 project.
2015-05-28 00:28:11 -07:00
Lari Nieminen 3e4cfa361d Added customizable shield impact explosion effects, originally adapted from Wanderer branch. 2015-05-27 13:41:50 +03:00
Fabian Woltermann a127a8cad6 Merge pull request #133 from ln-zookeeper/master
Added a $Model Icon Direction ship table entry for overriding the ang…
2015-05-27 11:31:31 +02:00
Lari Nieminen 8fd0bf3f7f Added a $Model Icon Direction ship table entry for overriding the angle from which ship icons are rendered from. 2015-05-27 12:19:06 +03:00
z64555 56f9f608be Merge pull request #119 from The-E/dedicated_gpu
Use high-performance GPU by default.
2015-05-27 03:13:49 -05:00
Fabian Woltermann 258662ff4c Merge pull request #104 from MageKing17/feature/subspace-beams
Subspace Beams
2015-05-27 10:00:44 +02:00
Fabian Woltermann a0ed1ac897 Merge pull request #125 from ln-zookeeper/master
Added a $Thruster Glow Noise Mult ship table entry for decreasing/inc…
2015-05-27 09:56:45 +02:00
Fabian Woltermann 136091fc68 Merge pull request #131 from asarium/mantis/3160
Mantis 3160: Only set processor affinity if a commandline flag is present
2015-05-27 09:32:50 +02:00
asarium c5cf337365 Only set processor affinity if a commandline flag is present 2015-05-27 00:31:08 +02:00
Axem e396686570 Adding customizable pain flash and shield pain flash settings 2015-05-24 09:00:30 -05:00
Lari Nieminen 72a082c9eb Added a $Thruster Glow Noise Mult ship table entry for decreasing/increasing the effect of noise applied to the glow radius. 2015-05-23 00:11:43 +03:00
MageKing17 67a87a33f3 Change if-elseif chain to switch statement.
Somewhat easier to read this way.
2015-05-22 12:38:13 -07:00
MageKing17 b2cff0788a Make these assertions more clear. 2015-05-22 12:37:19 -07:00
MageKing17 fa61278c10 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into feature/subspace-beams 2015-05-22 12:32:34 -07:00
m!m 585a5fe64d Merge pull request #112 from ln-zookeeper/master
Added $Minimum Engine Volume to ships.tbl, with which to customize ho…
2015-05-21 19:44:26 +02:00
Lari Nieminen 81f7d272fd Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-05-21 18:35:32 +03:00
Goober5000 ee6cd1d204 Merge pull request #121 from MageKing17/bugfix/fred-warnings
Fix a couple FRED warnings.
2015-05-21 00:06:48 -04:00
Cliff Gordon a4c1f89720 Merge remote-tracking branch 'origin/master' into fix/triplemon_hud
Conflicts:
	code/freespace2/freespace.cpp
2015-05-20 17:15:15 -05:00
Cliff Gordon (chief1983) 9429770f3d Add /MP to all projects and configs in VS 2012 project files. 2015-05-20 12:19:43 -05:00
m!m 2c5999b1d0 Merge pull request #114 from chief1983/rename_2011
[rename_2011] Rename MSVC_2011 to MSVC_2012
2015-05-20 17:32:38 +02:00
Cliff Gordon 2f152ce085 [rename_2011] Fix the appveyor config to handle the renamed project. 2015-05-20 09:27:40 -05:00
Cliff Gordon (chief1983) 3163319217 Merge remote-tracking branch 'origin/master' into rename_2011 2015-05-19 21:33:53 -05:00
Cliff Gordon (chief1983) 8e4f6afddd Add the shadows files to the VS 2012 project. The diff looks like a lot changed, but most is apparently just whitespace. diff -w shows a clean set of file additions. 2015-05-19 21:30:32 -05:00
The E ef9ae017b5 Make sure we use the same calling convention both times 2015-05-19 21:21:54 +02:00
The E 2c626b4eec According to AMD and NV, these _should_ force their drivers into high-performance mode 2015-05-19 20:48:01 +02:00
MageKing17 cac6737541 Fix a couple FRED warnings.
Change a couple instances of setting a DWORD_PTR to -1 by explicitly casting it to a DWORD_PTR.
2015-05-19 11:39:36 -07:00
MageKing17 ab900aad1c Avoid calling ssm_create() from ship_apply_tag() if ssm_index < 0.
This would happen if a TAG level 3 weapon had no specified SSM (or an invalid one). Since nothing can call ssm_create() with a negative ssm_index now, changed it to a size_t and simplified one of the verification conditionals.
2015-05-19 10:55:17 -07:00
Fabian Woltermann a69566f8bd Merge pull request #116 from asarium/ci/appveyor
Add AppVeyor configuration
2015-05-19 08:03:07 +02:00
MageKing17 67c75304e7 Merge pull request #115 from asarium/fix/luacpp
Fix scripting function ad.playMusic
2015-05-18 17:30:10 -07:00
niffiwan 6a88616f9b Merge pull request #96 from asarium/fix/unordered_map
Change SCP_hash_map to SCP_unordered_map
2015-05-19 07:48:23 +10:00
asarium 57f709fcec Add AppVeyor configuration 2015-05-18 23:26:38 +02:00
asarium 6c24aaae77 Actually get the loop variable from the lua stack 2015-05-18 21:57:44 +02:00
MageKing17 764c1ab03f Fix F3 lab using old idx value.
This was causing everything to use the Ship_info index of the size of the species vector; for FS2, that meant 3, which meant GTF Ares.
2015-05-18 10:09:29 -07:00
MageKing17 cde82a9093 Get rid of erroneous assertion. 2015-05-18 10:08:12 -07:00
MageKing17 16229a9950 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info 2015-05-18 10:04:21 -07:00
Fabian Woltermann 7bf700f173 Merge pull request #105 from MageKing17/mantis/3139
Fix Mantis #3139.
2015-05-18 18:21:49 +02:00
Lari Nieminen 742925e0d9 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-05-18 19:07:31 +03:00
Cliff Gordon 761de4a671 [rename_2011] Rename MSVC_2011 to MSVC_2012 since that's what the IDE actually released as. 2015-05-18 10:53:15 -05:00
m!m 8502c66e7c Merge pull request #108 from niffiwan/coverity/1298258
Fix Coverity 1298258: Uninitialized scalar var
2015-05-18 11:46:56 +02:00
m!m dcebc4aa50 Merge pull request #110 from niffiwan/coverity/1298255
Fix Coverity 1298255: Uninitialized scalar var
2015-05-18 11:45:10 +02:00
Lari Nieminen 54a2a3ea5b Fixed stupid syntax error. 2015-05-18 00:49:31 +03:00
Lari Nieminen 56273906b7 Fixed incorrect volume ramping. 2015-05-17 17:04:57 +03:00
niffiwan 9df5407dfb I think this should resolve the Travis issue 2015-05-17 19:48:18 +10:00
niffiwan 51b8e83d89 Fix Coverity 1298257: Uninitialized scalar var
Add all struct members to constructor (esp thrust_scale which was read
uninitialised). Remove some var sets that the constructor now sets as
defaults. Also fixes 1298248
2015-05-17 13:25:00 +10:00
Lari Nieminen a44daaba35 Added $Minimum Engine Volume to ships.tbl, with which to customize how the ship's speed affects engine sound volume. 2015-05-17 03:33:46 +03:00
niffiwan 2d832dd11e Fix Coverity 1298255: Uninitialized scalar var
Copy particle min/max life values from modelinterp
Also avoid double->float conversion
2015-05-16 21:51:39 +10:00
niffiwan 1784e880ae Merge pull request #50 from asarium/coverity/1093690
Fix for Coverity 1093690: Resource leak
2015-05-16 20:05:43 +10:00
asarium 189f23a341 Change SCP_hash_map to SCP_unordered_map
Also uses std::unordered_map on every platform now
2015-05-16 11:40:10 +02:00
asarium cc9109843a Fix for Coverity 1093690: Resource leak
This introduces a move constructor for CJumpNode to handle freeing resources.
2015-05-16 11:20:20 +02:00
niffiwan 1deb837973 Merge pull request #102 from asarium/fix/noallocator
Remove SCP_vm_allocator
2015-05-16 14:13:44 +10:00
niffiwan 3859d16640 Fix Coverity 1298258: Uninitialized scalar var
Also fixes 1298256, 1298254, 1298253

For vertex vars use default value-initialisation to zero the struct
http://en.cppreference.com/w/cpp/language/value_initialization

Note that parts of vertex don't seem used in relevant codepaths, e.g.
the colours. A zero init approach should be safer should code change in
future.
2015-05-16 12:44:56 +10:00
MageKing17 e68261bbf3 Merge pull request #107 from niffiwan/coverity/1298268
Fix Coverity 1298268: Division by float zero
2015-05-15 19:01:37 -07:00
MageKing17 e2a350940a Merge pull request #106 from niffiwan/coverity/1298261
Fix Coverity 1298261 Missing break in switch
2015-05-15 19:00:07 -07:00
niffiwan 6512edec77 Fix Coverity 1298268: Division by float zero
The div-by-zero won't be triggered by this code because the
secondaryteam is "none". Play it safe and protect the div anyway
2015-05-16 10:59:15 +10:00
niffiwan 2910a7a6eb Fix Coverity 1298261 Missing break in switch 2015-05-16 10:36:30 +10:00
MageKing17 8efbd74cf0 Fix Mantis #3139.
This make ship explosion shockwaves use the tabled damage type. The code was creating a new shockwave_create_info object, initializing it, and then only copying some of the attributes of the ship's "shockwave" shockwave_create_info member (not including damage type). It makes more sense to use copy-assignment and then specifically override the attributes that should be overridden.
2015-05-15 16:40:25 -07:00
MageKing17 05b79a41fb Allow beams to be spawned weapons. 2015-05-15 16:28:42 -07:00
niffiwan e24f459eaf Merge pull request #103 from asarium/travis/badge
Add Travis CI badge to Readme.md
2015-05-16 09:23:02 +10:00
MageKing17 9a5fa95c54 Add subspace beam strikes.
Overhaul hudartillery.cpp to use STL containers (removes hardcoded limits on maximum number of strike types, simultaneously active strikes, and projectiles per strike), use modular tables, allow for different shape options, and allow beams as the weapon.
2015-05-15 16:19:44 -07:00
MageKing17 abfba82d48 Add beam-create SEXP.
Fires a floating beam from a given set of coordinates (like fire-beam and fire-beam-at-coordinates).
2015-05-15 16:11:36 -07:00
MageKing17 0609d3919f Allow floating beams.
Makes it possible for a beam to fire from a point in space instead of a turret.
2015-05-15 16:09:35 -07:00
MageKing17 f8954cc941 Fix typo of "section" as "secion". 2015-05-15 15:28:27 -07:00
asarium 794a7f5bd1 Add coverity badge to Readme.md 2015-05-16 00:02:56 +02:00
asarium 762e7c3e24 Remove SCP_vm_allocator 2015-05-15 23:39:15 +02:00
MageKing17 165fc95411 Merge pull request #100 from ln-zookeeper/master
Fixed a bug with the next/prev subsystem targeting keys not working i…
2015-05-15 14:29:34 -07:00
Lari Nieminen 268c2558d5 Fixed a bug with the next/prev subsystem targeting keys not working if the target only has one subsystem. 2015-05-15 15:16:58 +03:00
niffiwan 34170b1cd2 Merge pull request #97 from asarium/travis/master
Add Travis CI config file
2015-05-15 20:39:20 +10:00
niffiwan 9147fc483f Merge pull request #52 from asarium/fix/warnings
Fix compilation warnings
2015-05-15 20:37:58 +10:00
Fabian Woltermann 450bc83068 Merge pull request #99 from SamuelCho/fog_shader_fix
Fix errors when model shader variants use fog but don't use diffuse maps.
2015-05-15 08:11:42 +02:00
SamuelCho 65d3d59c0f Fix errors when model shader variants use fog but don't use diffuse maps. 2015-05-14 22:40:43 -07:00
asarium e50555c4ae Add Travis CI config file 2015-05-14 22:20:30 +02:00
asarium e677ed7657 Fix warning 'allocate_poly_list' : unreferenced local function has been removed 2015-05-14 17:37:41 +02:00
niffiwan 82c2805b36 Merge branch 'ln-zookeeper-master' 2015-05-14 19:44:27 +10:00
niffiwan bf13e5053e Merge branch 'master' into ln-zookeeper-master
Conflicts:
	code/ai/ai_profiles.cpp
2015-05-14 19:38:19 +10:00
Fabian Woltermann f6093feceb Merge pull request #94 from MageKing17/bugfix/bomb-invulnerability
Make an AI profile flag for the aspect bomb invulnerability fix.
2015-05-14 10:54:56 +02:00
Fabian Woltermann 2ae6216c93 Merge pull request #95 from SamuelCho/bracket_trans_fix
Fixed ship select bracket rendering and lighting on transparent geometry.
2015-05-14 10:54:28 +02:00
asarium a237d7faad Fix compilation on OS X 2015-05-14 10:45:32 +02:00
asarium 77283e9c7a Fix conversion warnings 2015-05-14 10:45:32 +02:00
asarium f7a22d7ed0 Fix BM_TYPE to ubyte conversion warnings 2015-05-14 10:45:31 +02:00
asarium ab1b12fdd6 Fix "conversion from 'SPPHRASERNG' to 'ULONG'" warning 2015-05-14 10:45:30 +02:00
asarium d5938614c1 Fix "forcing value to bool 'true' or 'false'" warning 2015-05-14 10:45:29 +02:00
asarium 83bb7e144f Fix unused function warning 2015-05-14 10:45:29 +02:00
asarium 65b1569df2 Fix macro redefinition warning 2015-05-14 10:45:28 +02:00
asarium b849eec785 Fix "conversion from 'BM_TYPE' to 'ubyte'" warning 2015-05-14 10:45:27 +02:00
asarium b883ebc038 Fix usage of uninitialized variable warning 2015-05-14 10:45:26 +02:00
asarium 3cfbcbe363 Fix signed < unsigned warning 2015-05-14 10:45:25 +02:00
SamuelCho 5255f129dc Fixed gradient brackets in ship select screen. Fixed lighting for transparent meshes when using deferred lighting. 2015-05-13 20:38:17 -07:00
MageKing17 9555602823 Make an AI profile flag for the aspect bomb invulnerability fix.
Originally introduced in r8696 back in 2012 (hash d7d6009ea1), this fix changes retail balance and should be behind a flag.
2015-05-13 20:15:27 -07:00
MageKing17 9db390b553 Avoid bug in older clang versions.
Avoids calling std::swap() on multidimensional arrays.
2015-05-12 19:45:55 -07:00
MageKing17 48095d34e6 Fix a few typos. 2015-05-12 19:45:11 -07:00
MageKing17 51a8932f7f Add glowpoint_bank_override_map to the ship_info operations. 2015-05-12 19:44:26 -07:00
MageKing17 274a32e1ac Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/model/modelread.cpp
	code/ship/ship.h
2015-05-12 19:22:58 -07:00
Lari Nieminen 2c1d1b12cc Allowed bay path speed modifiers to function in both pathing modes. 2015-05-13 00:35:40 +03:00
Lari Nieminen 133f059b8d Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-05-13 00:21:04 +03:00
Cliff Gordon fbbfef9ae2 Missing project file additions for shadows to compile on OS X. 2015-05-12 15:37:44 -05:00
The E 556550fbde Updated project files for MSVC 2015 2015-05-12 20:27:34 +02:00
Fabian Woltermann 5dfbc6d292 Merge pull request #88 from SamuelCho/soft_shadows_deferred_lighting
Soft shadows, deferred lighting, and various graphics improvements and optimizations
2015-05-12 20:06:33 +02:00
Lari Nieminen 4fbf65ae8b Warn about bay path speed multipliers currently only working with the 'alt1' pathing type. 2015-05-11 19:50:13 +03:00
Lari Nieminen c9ec754eb6 Fixed $bay arrive/depart speed multiplier not working correctly. 2015-05-11 19:09:55 +03:00
niffiwan 1fe476a9e2 Merge pull request #79 from asarium/mantis/3134
From LotF: Fix for Mantis 3134
2015-05-10 21:45:25 +10:00
Lari Nieminen ffed62372f Added ai_profiles and path metadata options to force AI ships flying bay paths to gradually accelerate/decelerate instead of flying the path at max speed. 2015-05-10 11:52:09 +03:00
MageKing17 367c060749 Merge pull request #91 from ln-zookeeper/master
Avoid loading the anchor ship model multiple times when resolving pat…
2015-05-09 17:13:31 -07:00
Lari Nieminen 24d16213a6 Avoid loading the anchor ship model multiple times when resolving path masks. 2015-05-10 02:23:44 +03:00
MageKing17 be57943a52 Merge pull request #90 from ln-zookeeper/master
Revert a part of f6e2f1d2 / r11129 which causes collision problems in…
2015-05-09 16:03:09 -07:00
Lari Nieminen 7a8c7cc6c2 Revert a part of f6e2f1d2 / r11129 which causes collision problems in some corner cases. 2015-05-09 13:42:12 +03:00
niffiwan c85904b3c5 Merge pull request #85 from MageKing17/bugfix/random-multiple-of
Fix random-multiple-of.
2015-05-09 19:47:23 +10:00
MageKing17 08a1434b71 Merge pull request #89 from niffiwan/coverity/1093714_mk2
Fix Coverity 1093714: Negative array index read
2015-05-09 01:42:50 -07:00
niffiwan d69b7d7e0d Add newline to Assertion msg 2015-05-09 18:27:20 +10:00
niffiwan 93a5d82ca8 Fix Coverity 1093714: Negative array index read
This is very unlikely, but add an assertion anyway just in case someone
in future messes us keeping num_primary_banks & primary_bank_weapons in
sync.
2015-05-09 17:08:21 +10:00
SamuelCho 90c8025588 Code cleanup before the big soft shadows and deferred lighting merge into master. 2015-05-08 21:55:28 -07:00
SamuelCho 520b89408e Fixed warnings related to graphics code additions. 2015-05-08 21:21:20 -07:00
SamuelCho 094c5fe302 Resolve faster ibx and improved profiling merges. 2015-05-08 20:53:59 -07:00
niffiwan 27cdf337fb Merge pull request #74 from SamuelCho/faster_ibx
Greatly increase the generation speed of index buffers.
2015-05-09 13:35:54 +10:00
niffiwan f2d3763bdd Merge pull request #86 from MageKing17/bugfix/sexp-not-segfault
Fix typo in eval_not.
2015-05-09 13:30:29 +10:00
SamuelCho 96cbfb1fdf #include <algorithm> to get faster index buffer generation working on Linux. 2015-05-08 20:20:29 -07:00
MageKing17 290d25d6ae Fix typo in eval_not.
Can cause serious problems by accessing Sexp_nodes[-1].value. Caused chief1986 to segfault on OS X.
2015-05-08 16:13:35 -07:00
MageKing17 9ef7aa2432 Fix random-multiple-of.
I don't know if I was just tired when I wrote this originally or what, but there were two problems here; one, the for-loop condition was inverted (and since I made it a for-loop instead of a while-loop, I'm not sure why I didn't take out the "break" condition), so its contents would never actually evaluate. Two, the node matching random_argument wasn't being stored anywhere so even if the for-loop condition hadn't been wrong, it would've just used the last valid argument instead of the first argument every time. Fixes GitHub issue #84.
2015-05-08 16:09:37 -07:00
niffiwan a39a7530f8 Merge pull request #82 from ln-zookeeper/master
Added a "Show Destroyed Subsystems" flag to ship lab for viewing -des…
2015-05-08 20:32:13 +10:00
Fabian Woltermann 77ee6f100b Merge pull request #83 from asarium/feature/betterGamesndParsing
Improve gamesnd modular parsing
2015-05-08 10:32:26 +02:00
asarium 88a85e4024 Improve gamesnd modular parsing
As requested by jg18, this improves the sound.tbl parser to properly handle +nocreate. If the file name of an entry should not be changed you have to specify <same>.
2015-05-08 08:48:17 +02:00
Lari Nieminen ce853a5f07 Added a "Show Destroyed Subsystems" flag to ship lab for viewing -destroyed submodels. 2015-05-08 01:20:58 +03:00
MageKing17 87b79774d1 Merge pull request #80 from asarium/fix/gitignore
Update .gitignore to include voice recognition files
2015-05-07 13:46:32 -07:00
asarium 48206c3ef8 Update .gitignore to include voice recognition files 2015-05-07 22:41:22 +02:00
Fabian Woltermann 0349240a33 Merge pull request #75 from SamuelCho/profiling_microseconds
Improved profiling code to have a timing resolution of microseconds instead of milliseconds
2015-05-07 21:03:44 +02:00
Samuel Cho 135620dcf9 Merge branch 'faster_ibx' of https://github.com/SamuelCho/fs2open.github.com into faster_ibx 2015-05-07 09:47:41 -07:00
Swifty 60a5a6bd7c Removal of IBX file code and related command-line options. 2015-05-07 09:46:58 -07:00
Swifty 5a68f6d830 Greatly increase the generation speed of index buffers. 2015-05-07 09:46:57 -07:00
asarium aa6936a2a5 From LotF: Fix for Mantis 3134
dynamic weapon point firing causes a crash when used on a fighter with more than 6 firing points
2015-05-07 18:27:48 +02:00
niffiwan 935af40c87 Merge pull request #78 from ln-zookeeper/master
Make firepoint HUD gauge light up only firepoints that'll fire next
2015-05-07 20:32:28 +10:00
Lari Nieminen 42d830e62f * Made the firepoint HUD gauge light up only the firepoints which will fire next, if "dynamic primary linking" ship flag or "cycle" weapon flag is used. 2015-05-06 23:40:40 +03:00
Swifty 7cf5a3e085 Removal of IBX file code and related command-line options. 2015-05-06 12:27:50 -07:00
Cliff Gordon 0ce31bf471 [fix/triplemon_hud] Yarn's triple-monitor fix, see http://www.hard-light.net/forums/index.php?topic=89262.0. Patch tweaked to work around changes in 9aed627. 2015-05-06 10:40:45 -05:00
Fabian Woltermann 4d90765185 Merge pull request #48 from MageKing17/bugfix/fred-ship-editor-persona
Fix persona selection in FRED's ship editor.
2015-05-06 12:27:05 +02:00
niffiwan 7b82acb327 Merge pull request #73 from MageKing17/mantis/3140
Fix Mantis 3140.
2015-05-06 20:17:26 +10:00
niffiwan 666e1ddeeb Merge pull request #70 from ln-zookeeper/master
Add optional control preset names

Also display the name in the control config page (F2)
2015-05-06 19:11:51 +10:00
Swifty dd9f9ed921 Improved profiling code to have a timing resolution of microseconds instead of milliseconds. 2015-05-05 20:41:05 -07:00
Swifty 47c2aa0bbc Greatly increase the generation speed of index buffers. 2015-05-05 19:08:41 -07:00
MageKing17 e59bb76f72 Get rid of warning on 64-bit compilers.
If size_t is bigger than an int, this line generates warnings.
2015-05-05 14:43:20 -07:00
MageKing17 202bd3a5dc Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info 2015-05-05 14:39:01 -07:00
MageKing17 5f43e78be2 Fix Mantis 3140.
Changes the "virtual frame" used for aspect locks to be 640x480 so as to correct different lock behavior due to both different aspect ratios and different resolutions. Applies a scaling factor to the drawing of the lock indicator on the HUD so that it traverses roughly the same portion of the screen regardless of resolution.
2015-05-05 12:54:07 -07:00
Cliff Gordon e3ca0ec5b1 Merge pull request #59 from Echelon9/fix/doxygen
Fix doxygen documentation
2015-05-05 09:41:41 -05:00
Echelon9 464a25b457 Fix empty documentation/doxygen using .gitkeep and global .gitignore trick. Otherwise, Git does not index empty folders. 2015-05-06 00:18:28 +10:00
Echelon9 819f53721d Revert "Fix empty documentation/doxygen using .gitignore trick. Otherwise, Git does not index empty folders."
This reverts commit 550998e827.
2015-05-05 23:59:39 +10:00
niffiwan 4e68213569 Merge pull request #72 from chief1983/mantis/3158b
Fix for Mantis #3158: prevent narrowing that breaks compilation in stricter compilers
2015-05-05 11:37:09 +10:00
Cliff Gordon 6b080df736 Fix for Mantis #3158 (take 2): change the size of the token used for released but active streams to fit into an int without narrowing. 2015-05-04 20:33:02 -05:00
Lari Nieminen 0bb972b141 Made it possible to name control presets, and made controls config display the current preset's name if there are multiple to choose from. 2015-05-05 00:38:24 +03:00
niffiwan 93d88650e1 Merge pull request #68 from chief1983/fix/HAVE_CXX11-freebsd
Fix for a 'HAVE_CXX11 already defined' warning

(related to clang on non-OSX OS's)
2015-05-05 07:34:08 +10:00
Cliff Gordon cd399f90a1 Fix for a 'HAVE_CXX11 already defined' warning on almost every compiled object on FreeBSD. 2015-05-04 14:42:41 -05:00
Fabian Woltermann 189275da56 Merge pull request #56 from asarium/coverity/1093600
Fix for Coverity 1093600: Negative array index read
2015-05-03 21:57:23 +02:00
Fabian Woltermann 4c7d80cba8 Merge pull request #63 from asarium/coverity/1093530
Fix for Coverity 1093530: Negative array index read
2015-05-03 21:56:16 +02:00
Fabian Woltermann 4a14e26256 Merge pull request #64 from asarium/coverity/1093515
Fix for Coverity 1093515: Negative array index read
2015-05-03 21:55:50 +02:00
Fabian Woltermann 0fc8e53f5f Merge pull request #65 from asarium/coverity/1237276
Fix for Coverity 1237276: Uninitialized scalar field
2015-05-03 21:55:04 +02:00
Fabian Woltermann ba2a1c9e7d Merge pull request #62 from asarium/coverity/1093555
Fix for Coverity 1093555: Negative array index read
2015-05-03 21:53:56 +02:00
Fabian Woltermann 115a2979b1 Merge pull request #67 from asarium/fix/aigoals
Fix usage of negative index
2015-05-03 21:53:01 +02:00
asarium e9b9797b6e Fix usage of negative index
I have no idea why this didn't cause any issues earlier...
2015-05-03 21:27:23 +02:00
asarium da0ef89ac5 Fix for Coverity 1237276: Uninitialized scalar field
The field will contain an arbitrary value left over from earlier computations.
In subtitle::​subtitle(int, int, char const*, char const*, float, float, color const*, int, bool, bool, int, int, bool): A scalar field is not initialized by the constructor
2015-05-03 14:55:06 +02:00
asarium fe49ef63aa Fix for Coverity 1093515: Negative array index read
A memory location at a negative offset from the beginning of the array will be read, resulting in incorrect values.
In multi_options_process_packet(unsigned char *, header *): Negative value used to index an array in a read operation
2015-05-03 14:44:26 +02:00
asarium f51bc78126 Fix for Coverity 1093530: Negative array index read
A memory location at a negative offset from the beginning of the array will be read, resulting in incorrect values.
In message_queue_process(): Negative value used to index an array in a read operation
2015-05-03 14:34:06 +02:00
m!m 711c7a7bf8 Merge pull request #61 from niffiwan/coverity-1093565
Fix Coverity 1093565: Negative array index read
2015-05-03 04:27:22 -07:00
asarium ca16b4710d Fix for Coverity 1093555: Negative array index read
A memory location at a negative offset from the beginning of the array will be read, resulting in incorrect values.
In multi_create_standalone_object(): Negative value used to index an array in a read operation

observer_create() will only fail in exceptional circumstances so a showing an error dialog should be acceptable
2015-05-03 13:12:23 +02:00
niffiwan 471cf4c988 Fix Coverity 1093565: Negative array index read
Add an assertion to catch any callers that haven't correctly set
the target_name. Also fix a minor typo in the comments
2015-05-03 20:31:16 +10:00
Goober5000 d734a36940 Merge pull request #60 from niffiwan/coverity-1093484
Fix Coverity 1093484
2015-05-03 02:14:34 -04:00
niffiwan 25079f5ed2 Fix Coverity 1093484
time_t is 64bit on 64bit systems; casting a pointer to a larger type is
dangerous, but assigning to a larger type should be fine
2015-05-03 15:42:25 +10:00
Goober5000 f0a0632d9d Merge pull request #51 from asarium/coverity/1093689
Fix for Coverity 1093689: Resource leak
2015-05-02 23:47:28 -04:00
Echelon9 b8ba7f1466 Address obsolete Doxyfile sections, per Doxygen 1.8.9.1 automatic Doxyfile updater. 2015-05-03 11:39:36 +10:00
Echelon9 550998e827 Fix empty documentation/doxygen using .gitignore trick. Otherwise, Git does not index empty folders. 2015-05-03 11:23:19 +10:00
Swifty 6da0d162b8 Fixed compilation issues. 2015-05-02 17:18:51 -07:00
asarium 3528dffabd Fix for Coverity 1093587: Negative array index read
The random value shouldn't be used if there are no countermeasures so this shouldn't cause any issues.
2015-05-02 23:53:39 +02:00
Swifty c620372357 Soft shadows, deferred lighting, and various major graphics optimizations. 2015-05-02 14:35:37 -07:00
asarium 2aa569c1e7 Fix for Coverity 1093600: Negative array index read
hud_squadmsg_is_target_order_valid already checks if ainfo->target_objnum is less than zero so that check is not needed
2015-05-02 23:14:59 +02:00
Goober5000 584ec36f62 Merge pull request #53 from asarium/coverity/1093688
Fix for Coverity 1093688: Resource leak
2015-05-02 15:45:50 -04:00
Goober5000 93c46bd1f9 Merge pull request #55 from asarium/coverity/1093606
Fix for Coverity 1093606: Negative array index read
2015-05-02 15:45:17 -04:00
Goober5000 b6cc62c435 Merge pull request #54 from asarium/coverity/1093683
Fix for Coverity 1093683: Resource leak
2015-05-02 15:44:26 -04:00
asarium 00a288d53e Fix for Coverity 1093606: Negative array index read 2015-05-02 19:41:55 +02:00
asarium 4bfea90a17 Fix for Coverity 1093683: Resource leak 2015-05-02 19:32:39 +02:00
asarium aef3e3ac36 Fix for Coverity 1093688: Resource leak 2015-05-02 19:24:57 +02:00
asarium a7398d7f5c Fix for Coverity 1093689: Resource leak 2015-05-02 18:19:28 +02:00
MageKing17 0a6ab7d1f7 Fix persona selection in FRED's ship editor.
The old code operated under the assumption that all wingman personas would be at the start of the persona list. Since this assumption was neither checked for nor warned if violated anywhere else, I've made FRED work regardless of how they might be distributed throughout the Personas[] array.
2015-05-01 16:23:29 -07:00
MageKing17 e8bed8f892 Merge branch 'master' of ssh://github.com/scp-fs2open/fs2open.github.com into ship_info
Conflicts:
	code/ship/ship.cpp
2015-05-01 13:09:32 -07:00
Fabian Woltermann e2d740513a Merge pull request #47 from MageKing17/mantis/2971
Fix for 2971 from MageKing17: Stop executing HUD code when running as standalone.
2015-05-01 08:27:01 +02:00
MageKing17 1a29b395ab Stop standalones from executing hud_shield_quadrant_hit().
Also add some assertions to avoid (or at least help detect) similar errors in the future. Should fix Mantis 2971.
2015-04-30 22:10:17 -07:00
Goober5000 b2e01d6173 Merge pull request #42 from MageKing17/argument_sexps
*-argument sexp short-circuiting
2015-04-30 22:46:38 -04:00
Me bc17966b08 Merge pull request #46 from DahBlount/recoil
Feature: add primary weapon recoil
2015-05-01 08:02:53 +10:00
MageKing17 be9990f6a5 Fix cf_file_exists().
Was passing the pointer to *size instead of *offset, so instead of seeing if the file didn't have an offset, we were checking if it didn't have a size.
2015-04-29 23:21:49 -07:00
niffiwan c5bddac8fb Merge pull request #43 from niffiwan/cpp11_mk2
Cpp11 support for GCC
2015-04-30 14:36:20 +10:00
DahBlount 3de25b7e3a modifier value changes
We don't want to change things at run time so initialize them to
non-zero values.
2015-04-29 18:11:16 -07:00
DahBlount 2768863c36 Add ship_recoil_modifier 2015-04-29 18:01:52 -07:00
DahBlount 7b78df2363 Add "apply recoil" flag and modifier
This adds the "apply recoil" weapon flag and $Recoil Modifier:
weapons.tbl entry.
2015-04-29 17:26:33 -07:00
MageKing17 d84736be1c Revert "Made the firepoint HUD gauge light up only the firepoints which will fire next, if "dynamic primary linking" ship flag or "cycle" weapon flag is used."
This reverts commit 5042c44904.

(Apparently, "git revert" on a range is only inclusive of the end commit, not the starting commit.)
2015-04-29 16:35:41 -07:00
MageKing17 1591237acf Reverting recent string of commits.
Since they didn't go through code review (and break compilation), reverting the recent string of commits (just used "git revert -n 5042c44..05b4635").
2015-04-29 16:19:59 -07:00
zookeeper 05b4635048 Added bay arrive/depart speed multipliers to +Path Metadata.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@11271 387891d4-d844-0410-90c0-e4c51a9137d3

Conflicts:
	code/ai/ai_profiles.cpp
2015-04-29 23:19:02 +03:00
zookeeper eef1041323 Initialize bay_arrive_speed_mult and bay_depart_speed_mult.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10731 387891d4-d844-0410-90c0-e4c51a9137d3

Conflicts:
	code/ai/ai_profiles.cpp
2015-04-29 23:17:51 +03:00
zookeeper 18058a45f7 Added ai_profiles.tbl options to force AI ships flying bay paths to gradually accelerate/decelerate instead of flying the path at max speed.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10422 387891d4-d844-0410-90c0-e4c51a9137d3

Conflicts:
	code/ai/ai_profiles.cpp
2015-04-29 23:16:55 +03:00
zookeeper fbb76863fd Probably fixed a bug with the next/prev subsystem targeting keys not working if the target only has one subsystem.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@11209 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 23:12:42 +03:00
zookeeper 400fd0f9a8 Fixed $Thruster Glow Noise Mult not having effect in the ship lab.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10789 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 23:07:41 +03:00
zookeeper b18337754d Added a $Model Icon Direction ship table entry for overriding the angle from which ship icons are rendered from.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10612 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 23:04:25 +03:00
zookeeper 92a28b71cb Added a $Thruster Glow Noise Mult ship table entry for decreasing/increasing the effect of noise applied to the glow radius.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10610 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 23:04:24 +03:00
zookeeper 0656175a72 Added a $Minimum Engine Volume ship table entry for specifying the minimum engine sound volume used when ship is stationary.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@10609 387891d4-d844-0410-90c0-e4c51a9137d3

Conflicts:
	code/object/objectsnd.cpp
2015-04-29 23:04:23 +03:00
zookeeper dc820fdfc1 Avoid loading the anchor ship model multiple times when resolving path masks.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@11235 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 22:45:57 +03:00
zookeeper 5042c44904 Made the firepoint HUD gauge light up only the firepoints which will fire next, if "dynamic primary linking" ship flag or "cycle" weapon flag is used.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@11256 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 22:42:58 +03:00
Lari Nieminen 91000b4468 Revert "Fixed +Spread From LOD not working right."
This reverts commit 4b15ec4e75.
2015-04-29 22:41:17 +03:00
Lari Nieminen 91614162f2 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-04-29 22:38:05 +03:00
zookeeper 4b15ec4e75 Fixed +Spread From LOD not working right.
git-svn-id: svn://svn.icculus.org/fs2open/branches/zookeeper@11268 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-29 22:36:43 +03:00
MageKing17 e84a6e8d33 Fix tech room mission lists.
get_mission_info() was returning an uninitialized int due to rval no longer being initialized to 0 by setjmp(). Since rval isn't actually needed anymore, I went ahead and removed it. The only bits of code that actually check the return value of get_mission_info() are the tech room's mission simulator and some of the multiplayer code, so this bug wasn't actually preventing missions from being played through the ready room.
2015-04-29 12:34:11 -07:00
niffiwan 763601033b Remove unused function from palman.[cpp|h] 2015-04-29 21:00:19 +10:00
niffiwan 0ff8c8191f Remove gcc -Wshadow warnings 2015-04-29 20:55:56 +10:00
niffiwan b0bb0ee3be Remove gcc -Wunused-but-set-variable warnings 2015-04-29 20:27:49 +10:00
MageKing17 31140ab533 Make FRED use the new try-catch logic.
Missed during the recent parseExceptions merge; there was a usage of setjmp() during the background import dialogue.
2015-04-28 19:09:19 -07:00
niffiwan e3d1428e35 From Yarn: fix mantis 3157
Switch German and Polish translations of "Transport"
2015-04-28 19:36:30 +10:00
Fabian Woltermann 1d332d693d Merge pull request #38 from asarium/feature/parseExceptions
Replace longjmp with exceptions
2015-04-28 07:47:53 +02:00
niffiwan 36c656c389 bah, lrn2markdown 2015-04-27 20:46:37 +10:00
niffiwan 43b8cf2221 Resolve github issue #34 (add Coverity Badge)
Also freshen up the new README.md contents
2015-04-27 20:43:51 +10:00
MageKing17 ad91ba61b5 Short-circuit eval_sexp() on SEXP_NAN_FOREVER.
Since SEXP_NAN_FOREVER is supposed to indicate that the node will always evaluate to SEXP_NAN_FOREVER, we should short-circuit the process like we do for SEXP_KNOWN_TRUE and SEXP_KNOWN_FALSE.
2015-04-27 03:11:33 -07:00
MageKing17 7dea7075e7 Clean up eval_sexp() return value comparisons.
From niffiwan and myself (almost entirely niffiwan). Since eval_sexp() can't actually (and shouldn't) return certain special values, remove conditions checking for them and remove the erroneous comment claiming they should be returned.
2015-04-27 03:09:45 -07:00
MageKing17 9ec10dd3e6 Fix memory leak in for-counter.
Switch from strdup() to vm_strdup(), and make sure the allocated strings get freed after usage.
2015-04-27 03:06:28 -07:00
MageKing17 83b59fb76c Make *-argument SEXPs possible to short-circuit.
Fixes Mantis 3136. Written by niffiwan and myself. Allows the *-of SEXPs to return SEXP_KNOWN_FALSE when they can't evaluate ever again, allowing the when-argument or every-time-argument SEXP containing them to itself return SEXP_KNOWN_FALSE.
2015-04-27 03:05:18 -07:00
Lari Nieminen 418d53f169 Removed false "returns ptr to vector" comments. 2015-04-27 11:57:39 +03:00
MageKing17 15f6549087 Ship templates!
Restores ship templates, only working, thanks to ship_info now having a proper copy-assignment operator.
2015-04-27 00:05:57 -07:00
MageKing17 3a7307d0ce Somewhat-related followup to Ship_info vectorization.
There were some references to MAX_WEAPON_TYPES in missionscreencommon.cpp that really looked like they should've been referring to Num_weapon_types (formatted similarly to some references to MAX_SHIP_CLASSES which were changed to Ship_info.size() references). Figured I might as well fix them at the same time.
2015-04-27 00:03:20 -07:00
MageKing17 bc0c7cf4c5 Vectorization of Ship_info.
Converts Ship_info from a ship_info[] to an SCP_vector<ship_info>. ship_info now has proper constructors, assignment operators, and a destructor. Num_ship_classes removed; various references to Num_ship_classes and/or MAX_SHIP_CLASSES (which remains for various other structures which need it) changed to Ship_info.size() instead.

This doesn't make the ship class limit dynamic, but it is a preparatory step to get there.
2015-04-27 00:01:22 -07:00
MageKing17 5daf294f25 Remove irrelevant assertion.
Removes assertion in ship_model_update_instance() about turrets having the ability to rotate. Matches previous change to ship_model_start() (done in r10822; see also Mantis 3061).
2015-04-26 15:51:37 -07:00
MageKing17 0bcb3f24e6 Fix automatic "$Short name:" generation.
Made it include srcend (i.e. the null terminator) so that treating short_name as a null-terminated string (which it should be) doesn't access invalid memory. Also removed unused "destend" pointer.
2015-04-26 13:48:11 -07:00
MageKing17 9e66027e8b Remove unused "tspecies_names" pointer array. 2015-04-26 13:38:20 -07:00
MageKing17 d1444b45ac Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com 2015-04-26 10:04:57 -07:00
MageKing17 26553f1327 Voice recognition upgrades.
Switches to an in-process recognizer, removes the hard-coded wing list (which could in accessing invalid memory, when used with a custom grammar file), and fixes up the grammar file a bit.
2015-04-26 10:03:44 -07:00
Cliff Gordon (chief1983) 18ef1f77d4 FreeBSD 10 is on Clang now, -ansi doesn't mean anything here. 2015-04-26 10:27:12 -05:00
asarium 9aed627ce7 Replace longjmp with exceptions
Also added a EditorConfig file
2015-04-24 15:03:59 +02:00
chief1983 f187522238 File exists wrappers for bitmaps and animations; eliminates worrying about extensions, only need the base filename and it'll tell you if it's available.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11328 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:19 +10:00
chief1983 26adf935f7 Globalize various file extension lists littered throughout the code so they can be referenced from other classes as needed, instead of being hardcoded multiple times.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11327 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:18 +10:00
chief1983 d68baac787 Eliminate some redundancy with ship allowed weapon parsing.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11326 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:17 +10:00
chief1983 c3d3f4d4dd Update OS X project to work with updated Jansson.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11325 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:17 +10:00
chief1983 cc037e3259 Upgrade Jansson to 2.7.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11324 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:16 +10:00
MageKing17 0c60515662 Record mission loading time in the debug log.
(Just changes a printf into an mprintf.)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11323 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:15 +10:00
MageKing17 ec88fdbae1 Minor objectsnd.cpp cleanup.
Should be all nonfunctional changes (yes, even those "else" branches that look like they change behavior; functionally speaking, those branches shouldn't get hit because FSO will delete the sounds when they shouldn't apply).

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11322 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:10 +10:00
MageKing17 83414b238d Remove required_string_3() and required_string_4().
Replaced with usage of required_string_one_of(). (required_string_either() not removed due to different behavior.)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11321 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:09:06 +10:00
MageKing17 a233f62afb Remove some redundant code in parselo.cpp.
7 cases in stuff_string() (both versions) were using identical code. Consolidated into one branch for clarity.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11320 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:08:31 +10:00
MageKing17 8ef442205c Fix minor problem with weapons.cpp.
If "@Laser Color2:" is defined for a weapon and you override that weapon with a modular table (even if that override entry doesn't actually contain any data), the weapon's laser_color_2 value would get defaulted to its laser_color_1 value. Now, only do that if changing laser_color_1 and the RGB values of the two colors matched before.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11319 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:08:31 +10:00
MageKing17 66bddb970c Commit various updates to the MSVS 2013 project files, following discussion in #scp.
Fixes Mantis 3104, amongst other minor issues. Given the existence of the Community Edition, decided to make FS2_SPEECH and FS2_VOICER defined by default. Setup release builds for debugging symbols. Corrected a few inconsistencies between configurations.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11318 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:08:30 +10:00
chief1983 4ecc546e34 Backport (?) r3727 and 3733 from fs2_open-unstable_old, the old CVS unstable branch.
3727: added MadProf's voice recognition enhancements
3733: fix spelling, and synch with voicerec.cpp

See http://www.hard-light.net/forums/index.php?topic=37643.msg880793#msg880793 for more information.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11317 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-23 12:08:29 +10:00
MageKing17 aaec401c8f Removing unused code from hud.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11315 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-19 00:10:27 +10:00
MageKing17 6f1e33938c Fix a possible crash with -reparse_mainhall.
Left over pointer towards a structure that had been cleared and rebuilt could cause a crash. Found (and fix tested) by Axem. Also thanks to z64555 for bouncing ideas back and forth until this solution was found.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11314 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-18 18:12:07 +10:00
chief1983 c4d1ed526c Other half of version bump to 3.7.3, I will probably have that automated by the next release cycle.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11310 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-18 18:12:06 +10:00
chief1983 161e7498c4 git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11309 387891d4-d844-0410-90c0-e4c51a9137d3 2015-04-18 18:12:04 +10:00
m_m e3311f36ac Fix for Mantis 3156: Fighter beam range depends on target radius
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11307 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-18 00:09:10 +10:00
MageKing17 ed11f9a1c1 Fix objnum/instance confusion in comm menu.
Could cause orders to be grayed out for the wrong ship, due to it happening to have an objnum matching the instance of the ship you were ordering.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11305 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-17 06:07:54 +10:00
niffiwan e0e3cffab6 Update credits for 3.7.2
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11304 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-16 00:08:49 +10:00
z64555 b6d48faf4d BMPMAN doxy effort. Also defines EXAMPLE_PATH in the doxyfile to enable use of the @example command, which references code snippets as examples.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11303 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-14 00:06:58 +10:00
zookeeper 73d6483df6 Typo-fixed and clarified some SEXP argument descriptions.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11302 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-12 12:07:23 +10:00
zookeeper 3952713eba Fixed "get-ets-values" to "get-ets-value" in the help string.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11301 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-12 12:07:22 +10:00
z64555 617c530a3b From Echelon9 and myself. Resolves some typos with the debug console parser.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11300 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-11 18:11:42 +10:00
niffiwan 8c0f95ced8 Fix mantis 3150
Use and set music volume changes requested by sexp_adjust_audio_volume()

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11299 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-11 12:12:06 +10:00
Goober5000 78f9c8f82c related to Mantis #3130 - don't create a VBO if we're not supposed to
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11298 387891d4-d844-0410-90c0-e4c51a9137d3
2015-04-11 12:12:03 +10:00
niffiwan e3715cc420 change var names to avoid warnings re shadowing 2014-01-01 19:58:36 +10:00
niffiwan 366f4d5642 set HAVE_CXX11 for clang 2014-01-01 19:30:05 +10:00
niffiwan 547d615552 set HAVE_CXX11 for MSVC 2014-01-01 18:56:32 +10:00
niffiwan 4f074d94d1 Add compile time catch for memmove used on non-trivial objects 2013-12-22 20:09:44 +10:00
niffiwan a4ac843d5b Add compile time catch for memcpy used on non-trivial objects 2013-12-22 19:53:52 +10:00
niffiwan 359a98410a Add compile time catch for memset used on non-trivial objects
Fix one instance of this problem in osapi/outwnd_unix.cpp
2013-12-16 19:44:23 +10:00
niffiwan 1acfc1c326 Allow gcc on Linux to compile with -std=c++11
Tested with 4.6.3, 4.7.2 & 4.8.0
2013-12-16 19:37:02 +10:00
541 changed files with 43935 additions and 63092 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
root = true
[*.{h,cpp}]
indent_style = tab
+9 -4
View File
@@ -24,7 +24,6 @@ install-sh
missing
.svn
*.layout
projects/Xcode4/Frameworks/
projects/Xcode/Frameworks/
#========
@@ -137,7 +136,7 @@ packages/
*.swp
# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV
*.lock
@@ -149,7 +148,7 @@ packages/
####
# Xcode temporary files that should never be committed
#
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
*~.nib
@@ -263,6 +262,12 @@ xcuserdata
# .xccheckout
#
# Per http://stackoverflow.com/questions/18340453/should-xccheckout-files-in-xcode5-be-ignored-under-vcs
#
#
*.xccheckout
####
# Documentation
#
documentation/doxygen/*
!documentation/doxygen/.gitkeep
+75
View File
@@ -0,0 +1,75 @@
language: cpp
sudo: false
addons:
apt:
packages:
- libopenal-dev
- libogg-dev
- libvorbis-dev
- build-essential
- automake
- autoconf
- libsdl1.2-dev
- libtheora-dev
- libreadline6-dev
- libpng12-dev
- libjpeg62-dev
- liblua5.1-0-dev
- libjansson-dev
- libtool
coverity_scan:
project:
name: "scp-fs2open/fs2open.github.com"
description: "Coverity via Travis CI"
notification_email: [email protected]
build_command_prepend: "./autogen.sh --enable-debug"
build_command: "make -j2"
# 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
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
matrix:
include:
# note that gcc Debug MUST be 1st for Coverity
- os: linux
compiler: gcc
env: CONFIGURATION="Debug"
- os: linux
compiler: clang
env: CONFIGURATION="Debug"
- os: osx
compiler: clang
env: CONFIGURATION="Debug" MACOSX_ARCH=i386
- os: osx
compiler: clang
env: CONFIGURATION="Debug" MACOSX_ARCH=x86_64
- os: linux
compiler: gcc
env: CONFIGURATION="Release"
- os: linux
compiler: clang
env: CONFIGURATION="Release"
- os: osx
compiler: clang
env: CONFIGURATION="Release" MACOSX_ARCH=i386
- os: osx
compiler: clang
env: CONFIGURATION="Release" MACOSX_ARCH=x86_64
before_install:
# ugly hack; if running a coverity scan abort all except the 1st build
# see note re gcc compiler above needing to be 1st
# also note that branch_pattern & the TRAVIS_BRANCH check must match
# unfortunately COVERITY_SCAN_BRANCH isn't defined until later in the
# build process
- if ([[ "${TRAVIS_JOB_NUMBER##*.}" != "1" ]] && [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]); then false ; fi
- ./ci/travis/before_install.sh
install:
- ./ci/travis/install.sh
before_script:
- ./ci/travis/before_script.sh
script:
- ./ci/travis/script.sh
+7 -10
View File
@@ -9,16 +9,6 @@ SUBDIRS = mongoose code
EXTRA_DIST = \
FS2OpenSCPReadMe.doc \
projects/MSVC_2005/Freespace2.sln \
projects/MSVC_2005/Freespace2.vcproj \
projects/MSVC_2005/code.vcproj \
projects/MSVC_6/Fred2.dsp \
projects/MSVC_6/Freespace2.dsp \
projects/MSVC_6/Freespace2.dsw \
projects/MSVC_6/code.dsp \
projects/MSVC_6/libjpeg.dsp \
projects/MSVC_6/liblua.dsp \
projects/MSVC_6/wxFRED2.dsp \
projects/Xcode/English.lproj/InfoPlist.strings \
projects/Xcode/FS2_Open.icns \
projects/Xcode/FS2_Open.xcodeproj/project.pbxproj \
@@ -41,6 +31,8 @@ EXTRA_PROGRAMS = cfilearchiver cfileextractor
## Begin utilitites
##
CPPSOURCES=$(wildcard code/*/*.cpp code/*/*.h)
# cfilearchiver -- to create VPs
cfilearchiver_SOURCES = \
code/cfilearchiver/cfilearchiver.cpp
@@ -56,6 +48,11 @@ tools: cfilearchiver cfileextractor
clean-tools:
-test -z "$(EXTRA_PROGRAMS)" || rm -f $(EXTRA_PROGRAMS)
## cppcheck : check for many code issues
cppcheck: ${CPPSOURCES}
cppcheck ${CPPSOURCES} --enable=all --platform=unix64 \
--std=c99 --inline-suppr --quiet
##
## End utilitites
##
+19
View File
@@ -0,0 +1,19 @@
[![Coverity](https://scan.coverity.com/projects/870/badge.svg)](https://scan.coverity.com/projects/870)
[![Build Status](https://travis-ci.org/scp-fs2open/fs2open.github.com.svg?branch=master)](https://travis-ci.org/scp-fs2open/fs2open.github.com)
Welcome to Freespace Open!
In 2002 Volition released the source code for Freespace2. In the years since dedicated individuals have added countless new features to create a flexible and powerful space combat simulation engine. More info can be found on our [wiki](http://www.hard-light.net/wiki/index.php/Source_Code_Project)
People interested in contributing are encouraged to read [this thread](http://www.hard-light.net/forums/index.php?topic=82688.0)
The "projects" directory contains ready projects for:
* Microsoft Visual C++ 6, 2005, 2008, 2010, 2011, 2013, 2015
* Apple Xcode
* Code::Blocks
* Eclipse
Review the commit logs to see what's new.
See the INSTALL file for instructions on how to build fs2_open, or open the relevant MSVC project
+16
View File
@@ -0,0 +1,16 @@
version: 3.7.3.{build}
shallow_clone: true
environment:
matrix:
- VisualStudioVersion: 10.0
PlatformToolset: v100
ProjectPath: projects/MSVC_2010/Freespace2.vcxproj
- VisualStudioVersion: 12.0
PlatformToolset: v120
ProjectPath: projects/MSVC_2013/Freespace2.vcxproj
- VisualStudioVersion: 14.0
PlatformToolset: v140
ProjectPath: projects/MSVC_2015/Freespace2.vcxproj
build_script:
- msbuild "%ProjectPath%" /p:Configuration="Debug SSE2" /m /p:PlatformToolset="%PlatformToolset%" /verbosity:minimal
test: off
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Nothing to do here
:
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
# Nothing to do here
:
fi
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env sh
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Due to a bug in gcc the array bounds check isn't working correctly
# This can be removed when gcc is updated
AUTOGEN_CONFIG="CXXFLAGS=-Wno-array-bounds --enable-fatal-warnings --enable-generic-architecture"
if [ "$CONFIGURATION" = "Debug" ]; then
AUTOGEN_CONFIG="$AUTOGEN_CONFIG --enable-debug"
fi
./autogen.sh $AUTOGEN_CONFIG
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd projects/Xcode
tar -xvzf Frameworks.tgz
fi
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Nothing to do here
:
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
gem install xcpretty
fi
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
make -j 4
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd projects/Xcode
xcodebuild ARCHS=$MACOSX_ARCH ONLY_ACTIVE_ARCH=NO -configuration "$CONFIGURATION" | xcpretty -c
fi
+3 -8
View File
@@ -199,7 +199,7 @@ bin_PROGRAMS = @FS2_BINARY@
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ \
fs2_open_@PACKAGE_VERSION@_DEBUG \
wxFRED2_@PACKAGE_VERSION@ \
wxFRED2_@PACKAGE_VERSION@_DEBUG
wxFRED2_@PACKAGE_VERSION@_DEBUG
###############################################################################
##
@@ -215,7 +215,6 @@ FS2_SOURCES = \
ai/aigoals.cpp \
ai/aigoals.h \
ai/aiinternal.h \
ai/ailocal.h \
ai/aiturret.cpp \
ai/ai_profiles.cpp \
ai/ai_profiles.h \
@@ -267,8 +266,6 @@ FS2_SOURCES = \
debugconsole/consolecmds.cpp \
debugconsole/consoleparse.cpp \
debugconsole/consoleparse.h \
debugconsole/timerbar.cpp \
debugconsole/timerbar.h \
exceptionhandler/exceptionhandler.cpp \
exceptionhandler/exceptionhandler.h \
external_dll/externalcode.h \
@@ -343,6 +340,7 @@ FS2_SOURCES = \
graphics/grstub.cpp \
graphics/grstub.h \
graphics/line.h \
graphics/shadows.cpp \
graphics/tmapper.h \
hud/hud.cpp \
hud/hud.h \
@@ -479,14 +477,10 @@ FS2_SOURCES = \
missionui/missionloopbrief.h \
missionui/missionpause.cpp \
missionui/missionpause.h \
missionui/missionrecommend.cpp \
missionui/missionrecommend.h \
missionui/missionscreencommon.cpp \
missionui/missionscreencommon.h \
missionui/missionshipchoice.cpp \
missionui/missionshipchoice.h \
missionui/missionstats.cpp \
missionui/missionstats.h \
missionui/missionweaponchoice.cpp \
missionui/missionweaponchoice.h \
missionui/redalert.cpp \
@@ -501,6 +495,7 @@ FS2_SOURCES = \
model/modelsinc.h \
model/modeloctant.cpp \
model/modelread.cpp \
model/modelrender.cpp \
nebula/neb.cpp \
nebula/neb.h \
nebula/neblightning.cpp \
+6 -7
View File
@@ -12,12 +12,12 @@
#ifndef _AI_H
#define _AI_H
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "globalincs/systemvars.h"
#include "ai/ai_profiles.h"
#include "physics/physics.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "object/waypoint.h"
#include "physics/physics.h"
struct ship_weapon;
class ship_subsys;
@@ -622,7 +622,7 @@ extern void init_ai_system(void);
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp);
extern void ai_evade_object(object *evader, object *evaded);
extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
extern void ai_ignore_wing(object *ignorer, int wingnum, int priority);
extern void ai_ignore_wing(object *ignorer, int wingnum);
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int dock_type);
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
extern void ai_do_default_behavior(object *obj);
@@ -726,8 +726,7 @@ void process_subobjects(int objnum);
//SUSHI: Setting ai_info stuff from both ai class and ai profile
void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t *profile);
//SUSHI: Updating AI aim
void ai_update_aim(ai_info *aip, object* En_Objp);
void ai_update_aim(ai_info *aip);
//SUSHI: Random evasive sidethrust
void do_random_sidethrust(ai_info *aip, ship_info *sip);
+424 -408
View File
@@ -7,13 +7,13 @@
#include "globalincs/pstypes.h"
#include "globalincs/def_files.h"
#include "ai/ai_profiles.h"
#include "parse/parselo.h"
#include "globalincs/def_files.h"
#include "globalincs/pstypes.h"
#include "localization/localize.h"
#include "weapon/weapon.h"
#include "parse/parselo.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
// global stuff
@@ -69,445 +69,461 @@ int ai_path_type_match(char *p)
void parse_ai_profiles_tbl(const char *filename)
{
int i, rval;
int i;
char profile_name[NAME_LENGTH];
ai_profile_t dummy_profile;
char *saved_Mp = NULL;
char buf[NAME_LENGTH];
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default ai_profiles.tbl>", rval));
return;
}
if (filename == NULL)
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// start parsing
required_string("#AI Profiles");
// new default?
if (optional_string("$Default Profile:"))
stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
// begin reading data
while (required_string_either("#End","$Profile Name:"))
{
ai_profile_t *profile = &dummy_profile;
ai_profile_t *previous_profile = NULL;
bool no_create = false;
// get the name
required_string("$Profile Name:");
stuff_string(profile_name, F_NAME, NAME_LENGTH);
// see if it exists
for (i = 0; i < Num_ai_profiles; i++)
{
if (!stricmp(Ai_profiles[i].profile_name, profile_name))
{
previous_profile = &Ai_profiles[i];
break;
}
}
// modular table stuff
if (optional_string("+nocreate"))
{
no_create = true;
// use the previous one if possible,
// otherwise continue to use the dummy one
if (previous_profile != NULL)
profile = previous_profile;
}
if (filename == NULL)
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// start parsing
required_string("#AI Profiles");
// new default?
if (optional_string("$Default Profile:"))
stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
// begin reading data
while (required_string_either("#End", "$Profile Name:"))
{
// don't create multiple profiles with the same name
if (previous_profile != NULL)
ai_profile_t *profile = &dummy_profile;
ai_profile_t *previous_profile = NULL;
bool no_create = false;
// get the name
required_string("$Profile Name:");
stuff_string(profile_name, F_NAME, NAME_LENGTH);
// see if it exists
for (i = 0; i < Num_ai_profiles; i++)
{
Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
}
else
{
// make sure we're under the limit
if (Num_ai_profiles >= MAX_AI_PROFILES)
if (!stricmp(Ai_profiles[i].profile_name, profile_name))
{
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES-1); // -1 because one is built-in
skip_to_string("#End", NULL);
previous_profile = &Ai_profiles[i];
break;
}
profile = &Ai_profiles[Num_ai_profiles];
Num_ai_profiles++;
}
}
// initialize profile if we're not building from a previously parsed one
if (!no_create)
{
// base profile, so zero it out
if (profile == &Ai_profiles[0])
// modular table stuff
if (optional_string("+nocreate"))
{
memset(profile, 0, sizeof(ai_profile_t));
no_create = true;
// use the previous one if possible,
// otherwise continue to use the dummy one
if (previous_profile != NULL)
profile = previous_profile;
}
// brand new profile, so set it to the base defaults
else
{
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
}
}
// set the name
strcpy_s(profile->profile_name, profile_name);
// fill in any and all settings; they're all optional and can be in any order
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
{
if (optional_string("$Player Afterburner Recharge Scale:"))
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Beam Friendly Fire Damage:"))
parse_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
if (optional_string("$Player Countermeasure Life Scale:"))
parse_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
if (optional_string("$AI Countermeasure Firing Chance:"))
parse_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
if (optional_string("$AI In Range Time:"))
parse_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Ammo Weapons:"))
parse_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Ammo Weapons:"))
parse_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$Primary Ammo Burst Multiplier:"))
parse_float_list(profile->primary_ammo_burst_mult, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Energy Weapons:"))
parse_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Energy Weapons:"))
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
if (optional_string("$Max Player Attackers:"))
parse_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
if (optional_string("$Max Incoming Asteroids:"))
parse_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
parse_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
// represented in fractions of F1_0
if (optional_string("$Predict Position Delay:"))
{
int iLoop;
float temp_list[NUM_SKILL_LEVELS];
parse_float_list(temp_list, NUM_SKILL_LEVELS);
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
}
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
if (optional_string("$Friendly AI Fire Delay Scale:"))
parse_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
if (optional_string("$Hostile AI Fire Delay Scale:"))
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
if (optional_string("$AI Turn Time Scale:"))
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
if (optional_string("$Glide Attack Percent:")) {
parse_float_list(profile->glide_attack_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
profile->glide_attack_percent[i] = 0.0f;
}
profile->glide_attack_percent[i] /= 100.0;
}
}
if (optional_string("$Circle Strafe Percent:")) {
parse_float_list(profile->circle_strafe_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
profile->circle_strafe_percent[i] = 0.0f;
}
profile->circle_strafe_percent[i] /= 100.0;
}
}
if (optional_string("$Glide Strafe Percent:")) {
parse_float_list(profile->glide_strafe_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
profile->glide_strafe_percent[i] = 0.0f;
}
profile->glide_strafe_percent[i] /= 100.0;
}
}
if (optional_string("$Random Sidethrust Percent:")) {
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
profile->random_sidethrust_percent[i] = 0.0f;
}
profile->random_sidethrust_percent[i] /= 100.0;
}
}
if (optional_string("$Stalemate Time Threshold:"))
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
if (optional_string("$Stalemate Distance Threshold:"))
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
if (optional_string("$Player Shield Recharge Scale:"))
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Weapon Recharge Scale:"))
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Target Ownage:"))
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Player Ownage:"))
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Required For Kill Scale:"))
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Required For Assist Scale:"))
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Awarded For Capship Assist:"))
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Repair Penalty:"))
parse_int_list(profile->repair_penalty, NUM_SKILL_LEVELS);
if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
parse_float_list(profile->delay_bomb_arm_timer, NUM_SKILL_LEVELS);
if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
parse_int_list(profile->chance_to_use_missiles_on_plr, NUM_SKILL_LEVELS);
if (optional_string("$Max Aim Update Delay:"))
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Turret Max Aim Update Delay:"))
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Player Autoaim FOV:"))
{
float fov_list[NUM_SKILL_LEVELS];
parse_float_list(fov_list, NUM_SKILL_LEVELS);
for (i = 0; i < NUM_SKILL_LEVELS; i++)
// don't create multiple profiles with the same name
if (previous_profile != NULL)
{
//Enforce range
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
}
else
{
// make sure we're under the limit
if (Num_ai_profiles >= MAX_AI_PROFILES)
{
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
fov_list[i] = 0.0f;
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES - 1); // -1 because one is built-in
skip_to_string("#End", NULL);
break;
}
//Convert units
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
profile = &Ai_profiles[Num_ai_profiles];
Num_ai_profiles++;
}
}
if (optional_string("$Detail Distance Multiplier:"))
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
if(optional_string("$ai path mode:"))
// initialize profile if we're not building from a previously parsed one
if (!no_create)
{
stuff_string(buf, F_NAME, NAME_LENGTH);
int j = ai_path_type_match(buf);
if(j >= 0) {
profile->ai_path_mode = j;
} else {
Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
// base profile, so zero it out
if (profile == &Ai_profiles[0])
{
memset(profile, 0, sizeof(ai_profile_t));
}
// brand new profile, so set it to the base defaults
else
{
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
}
}
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
// set the name
strcpy_s(profile->profile_name, profile_name);
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
// ----------
// compatibility
if (optional_string("$perform less checks for death screams:"))
// fill in any and all settings; they're all optional and can be in any order
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
{
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
bool temp;
stuff_boolean(&temp);
if (temp)
profile->flags2 |= AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
else
profile->flags2 &= ~AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
if (optional_string("$Player Afterburner Recharge Scale:"))
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Beam Friendly Fire Damage:"))
parse_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
if (optional_string("$Player Countermeasure Life Scale:"))
parse_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
if (optional_string("$AI Countermeasure Firing Chance:"))
parse_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
if (optional_string("$AI In Range Time:"))
parse_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Ammo Weapons:"))
parse_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Ammo Weapons:"))
parse_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$Primary Ammo Burst Multiplier:"))
parse_float_list(profile->primary_ammo_burst_mult, NUM_SKILL_LEVELS);
if (optional_string("$AI Always Links Energy Weapons:"))
parse_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
if (optional_string("$AI Maybe Links Energy Weapons:"))
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
if (optional_string("$Max Missles Locked on Player:") || optional_string("$Max Missiles Locked on Player:"))
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
if (optional_string("$Max Player Attackers:"))
parse_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
if (optional_string("$Max Incoming Asteroids:"))
parse_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
parse_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
// represented in fractions of F1_0
if (optional_string("$Predict Position Delay:"))
{
int iLoop;
float temp_list[NUM_SKILL_LEVELS];
parse_float_list(temp_list, NUM_SKILL_LEVELS);
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
}
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
if (optional_string("$Friendly AI Fire Delay Scale:"))
parse_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
if (optional_string("$Hostile AI Fire Delay Scale:"))
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
if (optional_string("$AI Turn Time Scale:"))
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
if (optional_string("$Glide Attack Percent:")) {
parse_float_list(profile->glide_attack_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
profile->glide_attack_percent[i] = 0.0f;
}
profile->glide_attack_percent[i] /= 100.0;
}
}
if (optional_string("$Circle Strafe Percent:")) {
parse_float_list(profile->circle_strafe_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
profile->circle_strafe_percent[i] = 0.0f;
}
profile->circle_strafe_percent[i] /= 100.0;
}
}
if (optional_string("$Glide Strafe Percent:")) {
parse_float_list(profile->glide_strafe_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
profile->glide_strafe_percent[i] = 0.0f;
}
profile->glide_strafe_percent[i] /= 100.0;
}
}
if (optional_string("$Random Sidethrust Percent:")) {
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
//While we're at it, verify the range
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
profile->random_sidethrust_percent[i] = 0.0f;
}
profile->random_sidethrust_percent[i] /= 100.0;
}
}
if (optional_string("$Stalemate Time Threshold:"))
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
if (optional_string("$Stalemate Distance Threshold:"))
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
if (optional_string("$Player Shield Recharge Scale:"))
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$Player Weapon Recharge Scale:"))
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Target Ownage:"))
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Player Ownage:"))
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Required For Kill Scale:"))
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Required For Assist Scale:"))
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Percentage Awarded For Capship Assist:"))
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
if (optional_string("$Repair Penalty:"))
parse_int_list(profile->repair_penalty, NUM_SKILL_LEVELS);
if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
parse_float_list(profile->delay_bomb_arm_timer, NUM_SKILL_LEVELS);
if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
parse_int_list(profile->chance_to_use_missiles_on_plr, NUM_SKILL_LEVELS);
if (optional_string("$Max Aim Update Delay:"))
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Turret Max Aim Update Delay:"))
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
if (optional_string("$Player Autoaim FOV:"))
{
float fov_list[NUM_SKILL_LEVELS];
parse_float_list(fov_list, NUM_SKILL_LEVELS);
for (i = 0; i < NUM_SKILL_LEVELS; i++)
{
//Enforce range
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
{
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
fov_list[i] = 0.0f;
}
//Convert units
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
}
}
if (optional_string("$Detail Distance Multiplier:"))
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
set_flag(profile, "$perform fewer checks for death screams:", AIPF2_PERFORM_FEWER_SCREAM_CHECKS, AIP_FLAG2);
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
set_flag(profile, "$allow primary link at mission start:", AIPF2_ALLOW_PRIMARY_LINK_AT_START, AIP_FLAG2);
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
set_flag(profile, "$countermeasures affect aspect seekers:", AIPF2_ASPECT_LOCK_COUNTERMEASURE, AIP_FLAG2);
set_flag(profile, "$ai guards specific ship in wing:", AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING, AIP_FLAG2);
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
if (optional_string("$ai path mode:"))
{
stuff_string(buf, F_NAME, NAME_LENGTH);
int j = ai_path_type_match(buf);
if (j >= 0) {
profile->ai_path_mode = j;
}
else {
Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
}
}
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
set_flag(profile, "$fix ai path order bug:", AIPF2_FIX_AI_PATH_ORDER_BUG, AIP_FLAG2);
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
set_flag(profile, "$aspect bomb invulnerability fix:", AIPF2_ASPECT_INVULNERABILITY_FIX, AIP_FLAG2);
set_flag(profile, "$glide decay requires thrust:", AIPF2_GLIDE_DECAY_REQUIRES_THRUST, AIP_FLAG2);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive speed multiplier:")) {
stuff_float(&profile->bay_arrive_speed_mult);
}
if (optional_string("$bay depart speed multiplier:")) {
stuff_float(&profile->bay_depart_speed_mult);
}
// ----------
// compatibility
if (optional_string("$perform less checks for death screams:"))
{
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
bool temp;
stuff_boolean(&temp);
if (temp)
profile->flags2 |= AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
else
profile->flags2 &= ~AIPF2_PERFORM_FEWER_SCREAM_CHECKS;
}
if (optional_string("$allow primary link delay:"))
{
mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
bool temp;
stuff_boolean(&temp);
if (temp)
profile->flags2 &= ~AIPF2_ALLOW_PRIMARY_LINK_AT_START;
else
profile->flags2 |= AIPF2_ALLOW_PRIMARY_LINK_AT_START;
}
// if we've been through once already and are at the same place, force a move
if (saved_Mp && (saved_Mp == Mp))
{
char tmp[60];
memset(tmp, 0, 60);
strncpy(tmp, Mp, 59);
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
Mp++;
}
// find next valid option
skip_to_start_of_string_either("$", "#");
saved_Mp = Mp;
}
if (optional_string("$allow primary link delay:"))
{
mprintf(("Warning: \"$allow primary link delay\" flag is deprecated in favor of \"$allow primary link at mission start\"\n"));
bool temp;
stuff_boolean(&temp);
if (temp)
profile->flags2 &= ~AIPF2_ALLOW_PRIMARY_LINK_AT_START;
else
profile->flags2 |= AIPF2_ALLOW_PRIMARY_LINK_AT_START;
}
// if we've been through once already and are at the same place, force a move
if ( saved_Mp && (saved_Mp == Mp) )
{
char tmp[60];
memset(tmp, 0, 60);
strncpy(tmp, Mp, 59);
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", tmp));
Mp++;
}
// find next valid option
skip_to_start_of_string_either("$", "#");
saved_Mp = Mp;
}
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default ai_profiles.tbl>", e.what()));
return;
}
required_string("#End");
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
+8 -1
View File
@@ -9,8 +9,8 @@
#ifndef _AI_PROFILES_H_
#define _AI_PROFILES_H_
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
// flag int defines
@@ -66,6 +66,8 @@
#define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING (1 << 12)
#define AIPF2_FIX_AI_PATH_ORDER_BUG (1 << 13)
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING (1 << 14)
#define AIPF2_ASPECT_INVULNERABILITY_FIX (1 << 15)
#define AIPF2_GLIDE_DECAY_REQUIRES_THRUST (1 << 16)
// AI Path types
#define AI_PATH_MODE_NORMAL 0
@@ -151,6 +153,11 @@ typedef struct ai_profile_t {
int ai_path_mode;
// Ships flying bay paths will gradually accelerate/decelerate instead of
// flying the whole path at max speed
float bay_arrive_speed_mult;
float bay_depart_speed_mult;
} ai_profile_t;
+14 -14
View File
@@ -10,22 +10,23 @@
#include "ai/aibig.h"
#include "globalincs/linklist.h"
#include "object/object.h"
#include "ship/ship.h"
#include "ship/afterburner.h"
#include "freespace2/freespace.h"
#include "weapon/weapon.h"
#include "io/timer.h"
#include "mission/missionparse.h"
#include "iff_defs/iff_defs.h"
#include "math/staticrand.h"
#include "ai/aigoals.h"
#include "freespace2/freespace.h"
#include "globalincs/linklist.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "math/staticrand.h"
#include "mission/missionparse.h"
#include "object/object.h"
#include "ship/afterburner.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
#ifdef _MSC_VER
#pragma optimize("", off)
#pragma auto_inline(off)
#endif
#define SCAN_FIGHTERS_INTERVAL 2000 // how often an AI fighter/bomber should scan for enemy fighter/bombers
// if sitting still and pounding on a big ship. If enemy fighters are
@@ -1238,7 +1239,7 @@ int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
float dist_to_target, dist_normal_to_target, time_to_target;
dist_to_target = vm_vec_mag_quick(&vec_to_target);
if (vm_vec_mag_quick(&aip->big_attack_surface_normal) > 0.9) {
dist_normal_to_target = -vm_vec_dotprod(&vec_to_target, &aip->big_attack_surface_normal);
dist_normal_to_target = -vm_vec_dot(&vec_to_target, &aip->big_attack_surface_normal);
} else {
dist_normal_to_target = 0.2f * vm_vec_mag_quick(&vec_to_target);
}
@@ -1263,10 +1264,9 @@ int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
aip->submode = AIS_STRAFE_RETREAT1;
aip->submode_start_time = Missiontime;
float box_dist;
int is_inside;
vec3d goal_point;
box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
// set goal point
aip->goal_point = goal_point;
+199 -184
View File
@@ -18,61 +18,63 @@
#include "ai/ai.h"
#include "debugconsole/console.h"
#include "globalincs/linklist.h"
#include "object/object.h"
#include "physics/physics.h"
#include "ship/ship.h"
#include "model/model.h"
#include "render/3d.h"
#include "playerman/player.h"
#include "freespace2/freespace.h"
#include "mission/missiongoals.h"
#include "mission/missionlog.h"
#include "io/timer.h"
#include "ai/aigoals.h"
#include "gamesnd/gamesnd.h"
#include "mission/missionmessage.h"
#include "mission/missionparse.h"
#include "cmeasure/cmeasure.h"
#include "math/staticrand.h"
#include "ship/afterburner.h"
#include "ship/shipfx.h"
#include "ship/shiphit.h"
#include "ai/ai_profiles.h"
#include "ai/aibig.h"
#include "ai/aigoals.h"
#include "ai/aiinternal.h"
#include "asteroid/asteroid.h"
#include "autopilot/autopilot.h"
#include "cmeasure/cmeasure.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "hud/hud.h"
#include "hud/hudets.h"
#include "object/objcollide.h"
#include "object/objectshield.h"
#include "asteroid/asteroid.h"
#include "hud/hudlock.h"
#include "mission/missiontraining.h"
#include "gamesequence/gamesequence.h"
#include "io/joy_ff.h"
#include "localization/localize.h"
#include "weapon/weapon.h"
#include "weapon/flak.h"
#include "weapon/beam.h"
#include "weapon/swarm.h"
#include "ship/awacs.h"
#include "math/fvi.h"
#include "parse/parselo.h"
#include "object/objectdock.h"
#include "object/deadobjectdock.h"
#include "object/waypoint.h"
#include "ai/aiinternal.h"
#include "iff_defs/iff_defs.h"
#include "io/joy_ff.h"
#include "io/timer.h"
#include "localization/localize.h"
#include "math/fvi.h"
#include "math/staticrand.h"
#include "mission/missiongoals.h"
#include "mission/missionlog.h"
#include "mission/missionmessage.h"
#include "mission/missionparse.h"
#include "mission/missiontraining.h"
#include "model/model.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "network/multi.h"
#include "ai/ai_profiles.h"
#include "autopilot/autopilot.h"
#include "object/deadobjectdock.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/objectshield.h"
#include "object/waypoint.h"
#include "parse/parselo.h"
#include "physics/physics.h"
#include "playerman/player.h"
#include "render/3d.h"
#include "ship/afterburner.h"
#include "ship/awacs.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "ship/shiphit.h"
#include "weapon/beam.h"
#include "weapon/flak.h"
#include "weapon/swarm.h"
#include "weapon/weapon.h"
#include <map>
#include <limits.h>
#ifdef _MSC_VER
#pragma optimize("", off)
#pragma auto_inline(off)
#endif
#define UNINITIALIZED_VALUE -99999.9f
@@ -826,13 +828,14 @@ LOCAL int ai_inited = 0;
void ai_init()
{
if ( !ai_inited ) {
// Do the first time initialization stuff here
int rval;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "ai.tbl", rval));
} else {
parse_aitbl();
// Do the first time initialization stuff here
try
{
parse_aitbl();
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "ai.tbl", e.what()));
}
ai_inited = 1;
@@ -977,7 +980,7 @@ int ai_is_stealth_visible(object *viewer_objp, object *stealth_objp)
if ( !ship_is_visible_by_team(stealth_objp, &Ships[viewer_objp->instance]) ) {
vm_vec_sub(&vec_to_stealth, &stealth_objp->pos, &viewer_objp->pos);
dist_to_stealth = vm_vec_mag_quick(&vec_to_stealth);
dot_to_stealth = vm_vec_dotprod(&viewer_objp->orient.vec.fvec, &vec_to_stealth) / dist_to_stealth;
dot_to_stealth = vm_vec_dot(&viewer_objp->orient.vec.fvec, &vec_to_stealth) / dist_to_stealth;
// get max dist at which stealth is visible
max_stealth_dist = get_skill_stealth_dist_scaler() * STEALTH_MAX_VIEW_DIST;
@@ -1536,8 +1539,8 @@ float turn_towards_tangent(object *objp, vec3d *point, float radius)
vec3d v2g;
vm_vec_normalized_dir(&vec_to_point, point, &objp->pos);
vm_vec_crossprod(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
vm_vec_crossprod(&perp_vec, &vec_to_point, &up_vec);
vm_vec_cross(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
vm_vec_cross(&perp_vec, &vec_to_point, &up_vec);
vm_vec_scale_add(&perp_point, point, &vec_to_point, -radius);
if (vm_vec_dot(&objp->orient.vec.fvec, &perp_vec) > 0.0f) {
@@ -1560,7 +1563,7 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
// find closest z of center objp
vm_vec_sub(&sph_r_vec, &objp->pos, &center_objp->pos);
center_obj_z = vm_vec_dotprod(&sph_r_vec, &center_objp->orient.vec.fvec);
center_obj_z = vm_vec_dot(&sph_r_vec, &center_objp->orient.vec.fvec);
// find pt on axis with closest z
vm_vec_scale_add(&center_vec, &center_objp->pos, &center_objp->orient.vec.fvec, center_obj_z);
@@ -1568,10 +1571,10 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
// get r_vec
vm_vec_sub(&r_vec, &objp->pos, &center_vec);
Assert( (vm_vec_dotprod(&r_vec, &center_objp->orient.vec.fvec) < 0.0001));
Assert( (vm_vec_dot(&r_vec, &center_objp->orient.vec.fvec) < 0.0001));
// get theta vec - perp to r_vec and z_vec
vm_vec_crossprod(&theta_vec, &center_objp->orient.vec.fvec, &r_vec);
vm_vec_cross(&theta_vec, &center_objp->orient.vec.fvec, &r_vec);
#ifndef NDEBUG
float mag;
@@ -1580,11 +1583,11 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad
#endif
vec3d temp;
vm_vec_crossprod(&temp, &r_vec, &theta_vec);
vm_vec_cross(&temp, &r_vec, &theta_vec);
#ifndef NDEBUG
float dot;
dot = vm_vec_dotprod(&temp, &center_objp->orient.vec.fvec);
dot = vm_vec_dot(&temp, &center_objp->orient.vec.fvec);
Assert( dot >0.9999 && dot < 1.0001);
#endif
@@ -1610,17 +1613,17 @@ void get_tangent_point(vec3d *goal_point, object *objp, vec3d *point, float radi
vec3d up_vec, perp_vec;
vm_vec_normalized_dir(&vec_to_point, point, &objp->pos);
vm_vec_crossprod(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
vm_vec_cross(&up_vec, &vec_to_point, &objp->orient.vec.fvec);
while (IS_VEC_NULL(&up_vec)) {
vec3d rnd_vec;
vm_vec_rand_vec_quick(&rnd_vec);
vm_vec_add2(&rnd_vec, &objp->orient.vec.fvec);
vm_vec_crossprod(&up_vec, &vec_to_point, &rnd_vec);
vm_vec_cross(&up_vec, &vec_to_point, &rnd_vec);
}
vm_vec_crossprod(&perp_vec, &vec_to_point, &up_vec);
vm_vec_cross(&perp_vec, &vec_to_point, &up_vec);
vm_vec_normalize(&perp_vec);
vm_vec_scale_add(&perp_point, point, &vec_to_point, -radius);
@@ -1998,11 +2001,6 @@ void evaluate_object_as_nearest_objnum(eval_nearest_objnum *eno)
}
if (eno->trial_objp->flags & OF_PLAYER_SHIP){
// Goober5000: oh dear, it looks like this was originally meant to scale
// the distance according to skill, but as it is, the effect appears negligible.
// I could fix it with parentheses, but we all know how quickly AI pilots
// die usually, so the overall effect would probably be worse. So I left
// this unchanged.
dist *= 1.0f + (NUM_SKILL_LEVELS - Game_skill_level - 1)/NUM_SKILL_LEVELS; // Favor attacking non-players based on skill level.
}
@@ -2484,7 +2482,7 @@ void ai_ignore_object(object *ignorer, object *ignored, int ignore_new)
/**
* Ignore some object without changing mode.
*/
void ai_ignore_wing(object *ignorer, int wingnum, int priority)
void ai_ignore_wing(object *ignorer, int wingnum)
{
ai_info *aip;
@@ -2623,7 +2621,7 @@ void create_path_to_point(vec3d *curpos, vec3d *goalpos, object *curobjp, object
void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int count, int path_num, pnode *pnp, int randomize_pnt)
{
polymodel *pm;
int i, modelnum;
int i, modelnum, model_instance_num;
vec3d v1;
int pp_index; // index in Path_points at which to store point, if this is a modify-in-place (pnp ! NULL)
int start_index, finish_index;
@@ -2648,14 +2646,12 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
// Goober5000 - check for rotating submodels
modelnum = Ship_info[Ships[objp->instance].ship_info_index].model_num;
model_instance_num = Ships[objp->instance].model_instance_num;
pm = model_get(modelnum);
if ((mp->parent_submodel >= 0) && (pm->submodel[mp->parent_submodel].movement_type >= 0))
{
rotating_submodel = true;
// start submodel calculation
ship_model_start(objp);
model_find_submodel_offset(&submodel_offset, modelnum, mp->parent_submodel);
}
else
@@ -2672,7 +2668,7 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
{
// movement... find location of point like with docking code and spark generation
vm_vec_sub(&local_vert, &mp->verts[i].pos, &submodel_offset);
model_find_world_point(&v1, &local_vert, modelnum, mp->parent_submodel, &objp->orient, &objp->pos);
model_instance_find_world_point(&v1, &local_vert, model_instance_num, mp->parent_submodel, &objp->orient, &objp->pos);
}
else
{
@@ -2694,12 +2690,6 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou
add_path_point(&v1, path_num, i, pp_index);
offset++;
}
// stop submodel calculation
if (!rotating_submodel)
{
ship_model_stop(objp);
}
}
@@ -2968,8 +2958,8 @@ int maybe_avoid_player(object *objp, vec3d *goal_pos)
} else {
vec3d tvec1;
vm_vec_normalize(&avoid_vec);
vm_vec_crossprod(&tvec1, &n_vec_to_goal, &avoid_vec);
vm_vec_crossprod(&avoid_vec, &tvec1, &n_vec_to_player);
vm_vec_cross(&tvec1, &n_vec_to_goal, &avoid_vec);
vm_vec_cross(&avoid_vec, &tvec1, &n_vec_to_player);
}
// Now, avoid_vec is a vector perpendicular to the vector to the player and the direction *objp
@@ -3410,7 +3400,7 @@ float compute_collision_time(vec3d *targpos, vec3d *targvel, vec3d *attackpos, f
// This function doesn't account for the fact that by the time the player
// (or his laser) gets to the current enemy position, the enemy will have moved.
// This is dealt with in polish_predicted_enemy_pos.
float compute_time_to_enemy(float dist_to_enemy, object *pobjp, object *eobjp)
float compute_time_to_enemy(float dist_to_enemy, object *pobjp)
{
float time_to_enemy;
float pl_speed = pobjp->phys_info.speed;
@@ -3492,8 +3482,12 @@ void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *pla
}
// --------------------------------------------------------------------------
void ai_update_aim(ai_info *aip, object* En_Objp)
/**
* Updates AI aim automatically based on targetted enemy.
*
* @param aip Pointer to AI info
*/
void ai_update_aim(ai_info *aip)
{
if (Missiontime >= aip->next_aim_pos_time)
{
@@ -3646,7 +3640,7 @@ float maybe_recreate_path(object *objp, ai_info *aip, int force_recreate_flag, i
/**
* Set acceleration for ai_dock().
*/
void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_next, float dist_to_next, float dist_to_goal, ship_info *sip, float max_allowed_speed)
void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_next, float dist_to_next, float dist_to_goal, ship_info *sip, float max_allowed_speed, object *gobjp)
{
float prev_dot_to_goal = aip->prev_dot_to_goal;
@@ -3661,9 +3655,55 @@ void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_n
change_acceleration(aip, -1.0f); // -1.0f means subtract off flFrametime from acceleration value in 0.0..1.0
}
} else {
// If max_allowed_speed isn't set, use the ship max speed
float max_bay_speed = sip->max_speed;
// Maybe gradually ramp up/down the speed of a ship flying a fighterbay path
if (aip->mode == AIM_BAY_EMERGE || (aip->mode == AIM_BAY_DEPART && aip->path_cur != aip->path_start)) {
ship_info *gsip = &Ship_info[Ships[gobjp->instance].ship_info_index];
polymodel *pm = model_get(gsip->model_num);
SCP_string pathName(pm->paths[Path_points[aip->path_start].path_num].name);
float speed_mult = FLT_MIN;
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
speed_mult = gsip->pathMetadata[pathName].arrive_speed_mult;
}
if (speed_mult == FLT_MIN) {
speed_mult = The_mission.ai_profile->bay_arrive_speed_mult;
}
} else { // Departing
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
speed_mult = gsip->pathMetadata[pathName].depart_speed_mult;
}
if (speed_mult == FLT_MIN) {
speed_mult = The_mission.ai_profile->bay_depart_speed_mult;
}
}
if (speed_mult != FLT_MIN && speed_mult != 1.0f) {
// We use the distance between the first and last point on the path here; it's not accurate
// if the path is not straight, but should be good enough usually; can be changed if necessary.
float total_path_length = vm_vec_dist_quick(&Path_points[aip->path_start].pos, &Path_points[aip->path_start + aip->path_length - 1].pos);
float dist_to_end;
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start].pos);
} else { // Departing
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start + aip->path_length - 1].pos);
}
// Calculate max speed, but respect the waypoint speed cap if it's lower
max_bay_speed = sip->max_speed * (speed_mult + (1.0f - speed_mult) * (dist_to_end / total_path_length));
}
}
// Cap speed to max_allowed_speed, if it's set
if (max_allowed_speed <= 0)
max_allowed_speed = sip->max_speed;
max_allowed_speed = max_bay_speed;
else
max_allowed_speed = MIN(max_allowed_speed, max_bay_speed);
if ((aip->mode == AIM_DOCK) && (dist_to_next < 150.0f) && (aip->path_start + aip->path_length - 2 == aip->path_cur)) {
set_accel_for_target_speed(objp, max_allowed_speed * MAX(dist_to_next/500.0f, 1.0f));
@@ -3739,8 +3779,7 @@ void set_accel_for_docking(object *objp, ai_info *aip, float dot, float dot_to_n
// Returns distance to goal point.
float ai_path_0()
{
polymodel *pm;
int num_paths, num_points;
int num_points;
float dot, dist_to_goal, dist_to_next, dot_to_next;
ship *shipp = &Ships[Pl_objp->instance];
ship_info *sip = &Ship_info[shipp->ship_info_index];
@@ -3749,7 +3788,6 @@ float ai_path_0()
float mag;
vec3d temp_vec, *slop_vec;
object *gobjp;
ship *gshipp;
vec3d *cvp, *nvp, next_vec, gcvp, gnvp; // current and next vertices in global coordinates.
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
@@ -3758,11 +3796,6 @@ float ai_path_0()
Assert(Objects[aip->goal_objnum].type == OBJ_SHIP);
gobjp = &Objects[aip->goal_objnum];
gshipp = &Ships[gobjp->instance];
pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
num_paths = pm->n_paths;
Assert(num_paths > 0);
if (aip->path_start == -1) {
Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
@@ -3854,7 +3887,7 @@ float ai_path_0()
dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gcvp);
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, 0);
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, 0, gobjp);
aip->prev_dot_to_goal = dot;
// If moving at a non-tiny velocity, detect attaining path point by its being close to
@@ -3890,8 +3923,7 @@ float ai_path_0()
// 1.
float ai_path_1()
{
polymodel *pm;
int num_paths, num_points;
int num_points;
float dot, dist_to_goal, dist_to_next, dot_to_next;
ship *shipp = &Ships[Pl_objp->instance];
ship_info *sip = &Ship_info[shipp->ship_info_index];
@@ -3899,7 +3931,6 @@ float ai_path_1()
vec3d nvel_vec;
float mag;
object *gobjp;
ship *gshipp;
vec3d *pvp, *cvp, *nvp, next_vec, gpvp, gcvp, gnvp; // previous, current and next vertices in global coordinates.
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
@@ -3908,12 +3939,6 @@ float ai_path_1()
Assert(Objects[aip->goal_objnum].type == OBJ_SHIP);
gobjp = &Objects[aip->goal_objnum];
gshipp = &Ships[gobjp->instance];
// Get path data
pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
num_paths = pm->n_paths;
Assert(num_paths > 0);
if (aip->path_start == -1) {
Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
@@ -4010,12 +4035,12 @@ float ai_path_1()
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
// This path mode respects the "cap-waypoint-speed" SEXP
float max_allowed_speed = 0;
float max_allowed_speed = 0.0f;
if ( aip->waypoint_speed_cap > 0) {
max_allowed_speed = (float) aip->waypoint_speed_cap;
}
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, max_allowed_speed);
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, max_allowed_speed, gobjp);
aip->prev_dot_to_goal = dot;
// If moving at a non-tiny velocity, detect attaining path point by its being close to
@@ -5200,7 +5225,7 @@ int ai_select_primary_weapon_OLD(object *objp, object *other_objp, int flags)
ship *shipp = &Ships[objp->instance];
ship_weapon *swp = &shipp->weapons;
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
if (flags & WIF_PUNCTURE) {
if (swp->current_primary_bank >= 0) {
@@ -5289,7 +5314,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags)
return ai_select_primary_weapon_OLD(objp, other_objp, flags);
}
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
//made it so it only selects puncture weapons if the active goal is to disable something -Bobboau
if ((flags & WIF_PUNCTURE) && (Ai_info[shipp->ai_index].goals[0].ai_mode & (AI_GOAL_DISARM_SHIP | AI_GOAL_DISABLE_SHIP)))
@@ -5606,7 +5631,7 @@ int ai_fire_primary_weapon(object *objp)
ai_info *aip;
object *enemy_objp;
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
aip = &Ai_info[shipp->ai_index];
@@ -6039,7 +6064,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2)
shipp = &Ships[objp->instance];
swp = &shipp->weapons;
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < Num_ship_classes);
Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < static_cast<int>(Ship_info.size()));
// Select secondary weapon.
current_bank = swp->current_secondary_bank; //ai_select_secondary_weapon(objp, swp, priority1, priority2);
@@ -6119,7 +6144,7 @@ int might_hit_teammate(object *firing_objp)
void render_all_ship_bay_paths(object *objp)
{
int i,j,color;
int i,j,clr;
polymodel *pm;
model_path *mp;
@@ -6132,17 +6157,17 @@ void render_all_ship_bay_paths(object *objp)
memset(&v, 0, sizeof(v));
for ( i = 0; i < pm->ship_bay->num_paths; i++ ) {
for ( i = 0; i < pm->ship_bay->num_paths; i++ ) {
mp = &pm->paths[pm->ship_bay->path_indexes[i]];
for ( j = 0; j < mp->nverts; j++ ) {
vm_vec_unrotate(&global_path_point, &mp->verts[j].pos, &objp->orient);
vm_vec_add2(&global_path_point, &objp->pos);
g3_rotate_vertex(&v, &global_path_point);
color = 255 - j*50;
if ( color < 50 )
color = 100;
gr_set_color(0, color, 0);
clr = 255 - j*50;
if ( clr < 50 )
clr = 100;
gr_set_color(0, clr, 0);
if ( j == mp->nverts-1 ) {
gr_set_color(255, 0, 0);
@@ -6164,7 +6189,7 @@ void render_all_ship_bay_paths(object *objp)
*/
void render_all_subsys_paths(object *objp)
{
int i,j,color;
int i,j,clr;
polymodel *pm;
model_path *mp;
@@ -6175,7 +6200,7 @@ void render_all_subsys_paths(object *objp)
if ( pm->ship_bay == NULL )
return;
memset(&v, 0, sizeof(v));
memset(&v, 0, sizeof(v));
for ( i = 0; i < pm->n_paths; i++ ) {
mp = &pm->paths[i];
@@ -6183,10 +6208,10 @@ void render_all_subsys_paths(object *objp)
vm_vec_unrotate(&global_path_point, &mp->verts[j].pos, &objp->orient);
vm_vec_add2(&global_path_point, &objp->pos);
g3_rotate_vertex(&v, &global_path_point);
color = 255 - j*50;
if ( color < 50 )
color = 100;
gr_set_color(0, color, 0);
clr = 255 - j*50;
if ( clr < 50 )
clr = 100;
gr_set_color(0, clr, 0);
if ( j == mp->nverts-1 ) {
gr_set_color(255, 0, 0);
@@ -6220,10 +6245,9 @@ void render_path_points(object *objp)
vec3d dock_point, global_dock_point;
vertex v;
ship_model_start(&Objects[aip->goal_objnum]);
if (pm->n_docks) {
dock_point = pm->docking_bays[0].pnt[0];
model_find_world_point(&global_dock_point, &dock_point, pm->id, 0, &dobjp->orient, &dobjp->pos );
model_instance_find_world_point(&global_dock_point, &dock_point, shipp->model_instance_num, 0, &dobjp->orient, &dobjp->pos );
g3_rotate_vertex(&v, &global_dock_point);
gr_set_color(255, 255, 255);
g3_draw_sphere( &v, 1.5f);
@@ -6256,8 +6280,6 @@ void render_path_points(object *objp)
pp++;
}
}
ship_model_stop(&Objects[aip->goal_objnum]);
}
/**
@@ -6463,7 +6485,7 @@ void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *e
vec3d temp;
vm_vec_sub(&temp, enemy_pos, &pobjp->pos);
vm_vec_normalize_quick(&temp);
float dot = vm_vec_dotprod(&temp, &pobjp->orient.vec.fvec);
float dot = vm_vec_dot(&temp, &pobjp->orient.vec.fvec);
float st_err = 3.0f * (1.4f - dot) * (1.0f + dist / (get_skill_stealth_dist_scaler() * STEALTH_MAX_VIEW_DIST)) * (1 - aip->ai_accuracy);
scale += st_err;
}
@@ -6730,11 +6752,10 @@ void attack_set_accel(ai_info *aip, ship_info *sip, float dist_to_enemy, float d
void get_behind_ship(ai_info *aip, ship_info *sip, float dist_to_enemy)
{
vec3d new_pos;
float dot;
float dot;
vec3d vec_from_enemy;
float dist;
dist = vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
vm_vec_scale_add(&new_pos, &En_objp->pos, &En_objp->orient.vec.fvec, -100.0f); // Pick point 100 units behind.
ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
@@ -7024,7 +7045,7 @@ void ai_stealth_find()
// if dist is near max and dot is close to 1, accel, afterburn
vm_vec_sub(&vec_to_enemy, &new_pos, &Pl_objp->pos);
dist_to_enemy = vm_vec_normalize_quick(&vec_to_enemy);
dot_to_enemy = vm_vec_dotprod(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
// if i think i should see him ahead and i don't, set goal pos and turn around, but only if I haven't seen him for a while
if ( (delta_time > 800) && (aip->submode_parm0 == SM_SF_AHEAD) && (dot_to_enemy > .94) && (dist_to_enemy < get_skill_stealth_dist_scaler()*STEALTH_MAX_VIEW_DIST + 50) ) {
@@ -7033,7 +7054,7 @@ void ai_stealth_find()
aip->submode_parm0 = SM_SF_BEHIND;
vm_vec_sub(&vec_to_enemy, &new_pos, &Pl_objp->pos);
dist_to_enemy = vm_vec_normalize_quick(&vec_to_enemy);
dot_to_enemy = vm_vec_dotprod(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
}
if ( (dist_to_enemy > get_skill_stealth_dist_scaler()*STEALTH_MAX_VIEW_DIST) && (dot_to_enemy > 0.94f) ) { // 20 degree half angle
@@ -7063,7 +7084,7 @@ void ai_stealth_find()
ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
}
dot_from_enemy = -vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec);
dot_from_enemy = -vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec);
attack_set_accel(aip, sip, dist_to_enemy, dot_to_enemy, dot_from_enemy);
}
@@ -7112,10 +7133,10 @@ void ai_stealth_sweep()
}
// get "right" vector for box
vm_vec_crossprod(&right, &aip->stealth_velocity, &vmd_y_vector);
vm_vec_cross(&right, &aip->stealth_velocity, &vmd_y_vector);
if ( vm_vec_mag_quick(&right) < 0.01 ) {
vm_vec_crossprod(&right, &aip->stealth_velocity, &vmd_z_vector);
vm_vec_cross(&right, &aip->stealth_velocity, &vmd_z_vector);
}
vm_vec_normalize_quick(&right);
@@ -7124,7 +7145,7 @@ void ai_stealth_sweep()
vm_vec_copy_normalize_quick(&forward, &aip->stealth_velocity);
// get "up" for box
vm_vec_crossprod(&up, &forward, &right);
vm_vec_cross(&up, &forward, &right);
// lost far away ahead (do box)
switch(aip->submode_parm0) {
@@ -7194,7 +7215,7 @@ void ai_stealth_sweep()
if (dist_to_goal < 100) {
vec3d vec_to_goal;
vm_vec_normalized_dir(&vec_to_goal, &goal_pt, &Pl_objp->pos);
dot = vm_vec_dotprod(&vec_to_goal, &Pl_objp->orient.vec.fvec);
dot = vm_vec_dot(&vec_to_goal, &Pl_objp->orient.vec.fvec);
}
accelerate_ship(aip, 0.8f*dot);
@@ -7582,7 +7603,7 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
if (num_weapon_types && (wip->wi_flags & WIF_LOCKED_HOMING)) {
if (num_weapon_types && (wip->wi_flags & WIF_LOCKED_HOMING) && !(shipp->flags2 & SF2_NO_SECONDARY_LOCKON)) {
if (dist_to_enemy > 300.0f - MIN(enemy_radius, 100.0f))
aip->ai_flags |= AIF_SEEK_LOCK;
else
@@ -7840,7 +7861,7 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vec3
vm_vec_sub(&vec_to_target, &attack_objp->pos, &target_objp->pos);
// find the distance between centers along forward direction of ships
perp_dist = vm_vec_dotprod(&vec_to_target, &target_objp->orient.vec.fvec);
perp_dist = vm_vec_dot(&vec_to_target, &target_objp->orient.vec.fvec);
// subtract off perp component to get "horizontal" separation vector between cylinders [ASSUMING parallel]
vm_vec_scale_add(horz_vec_to_target, &vec_to_target, &target_objp->orient.vec.fvec, -perp_dist);
@@ -7871,7 +7892,7 @@ void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object
r_target = MAX(temp, r_target);
// are we opposing (only when other ship is not moving)
opposing = ( vm_vec_dotprod(&attack_objp->orient.vec.fvec, &target_objp->orient.vec.fvec) < 0 );
opposing = ( vm_vec_dot(&attack_objp->orient.vec.fvec, &target_objp->orient.vec.fvec) < 0 );
ai_chase_big_get_separations(attack_objp, target_objp, &horz_vec_to_target, &optimal_separation, &separation);
@@ -7889,7 +7910,7 @@ void ai_chase_big_parallel_set_goal(vec3d *goal_pos, object *attack_objp, object
// find the distance between centers along forward direction of ships
vec3d vec_to_target;
vm_vec_sub(&vec_to_target, &target_objp->pos, &attack_objp->pos);
float perp_dist = vm_vec_dotprod(&vec_to_target, &target_objp->orient.vec.fvec);
float perp_dist = vm_vec_dot(&vec_to_target, &target_objp->orient.vec.fvec);
float match_accel = 0.0f;
float length_scale = attack_objp->radius;
@@ -7978,10 +7999,6 @@ void ai_cruiser_chase()
return;
}
ship *eshipp;
eshipp = &Ships[En_objp->instance];
vec3d goal_pos;
float turn_time = Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time;
@@ -8043,7 +8060,7 @@ void ai_cruiser_chase()
// moving
if (moving) {
// if within 90 degrees of en forward, go into parallel, otherwise circle
if ( vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0 ) {
if ( vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0 ) {
aip->submode = SM_BIG_PARALLEL;
aip->submode_start_time = Missiontime;
}
@@ -8063,9 +8080,9 @@ void ai_cruiser_chase()
vec3d temp;
float desired_sep, cur_sep;
// we're behind the enemy ship
if (vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
if (vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
// and we're turning toward the enemy
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
// get separation
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
// and the separation is > 0.9 desired
@@ -8080,9 +8097,9 @@ void ai_cruiser_chase()
vec3d temp;
float desired_sep, cur_sep;
// we're behind the enemy ship
if (vm_vec_dotprod(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
if (vm_vec_dot(&vec_to_enemy, &En_objp->orient.vec.fvec) > 0) {
// and we're turning toward the enemy
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) > 0) {
// get separation
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
// and the separation is > 0.9 desired
@@ -8095,7 +8112,7 @@ void ai_cruiser_chase()
// in front of ship
else {
// and we're turning toward the enemy
if (vm_vec_dotprod(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) < 0) {
if (vm_vec_dot(&En_objp->orient.vec.fvec, &Pl_objp->orient.vec.fvec) < 0) {
// get separation
ai_chase_big_get_separations(Pl_objp, En_objp, &temp, &desired_sep, &cur_sep);
// and the separation is > 0.9 desired
@@ -8110,7 +8127,7 @@ void ai_cruiser_chase()
case SM_BIG_PARALLEL:
// we're opposing
if ( vm_vec_dotprod(&Pl_objp->orient.vec.fvec, &En_objp->orient.vec.fvec) < 0 ) {
if ( vm_vec_dot(&Pl_objp->orient.vec.fvec, &En_objp->orient.vec.fvec) < 0 ) {
// and the other ship is moving
if (moving) {
// and we no longer overlap
@@ -8130,7 +8147,7 @@ void ai_cruiser_chase()
*/
void ai_chase()
{
float dist_to_enemy, time_to_enemy;
float dist_to_enemy;
float dot_to_enemy, dot_from_enemy, real_dot_to_enemy;
vec3d player_pos, enemy_pos, predicted_enemy_pos, real_vec_to_enemy, predicted_vec_to_enemy;
ship *shipp = &Ships[Pl_objp->instance];
@@ -8211,11 +8228,10 @@ void ai_chase()
ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos);
dist_to_enemy = vm_vec_dist_quick(&player_pos, &enemy_pos);
time_to_enemy = compute_time_to_enemy(dist_to_enemy, Pl_objp, En_objp);
vm_vec_sub(&real_vec_to_enemy, &enemy_pos, &player_pos);
//Enemy position for the purpose of aiming is already calculated differently, do it explicitly here
ai_update_aim(aip, En_objp);
ai_update_aim(aip);
vm_vec_normalize(&real_vec_to_enemy);
@@ -8969,7 +8985,7 @@ void set_goal_dock_orient(matrix *dom, vec3d *docker_p0, vec3d *docker_p1, vec3d
// Pre-multiply the orientation of the source object (docker_orient) by the transpose
// of the docking bay's orientation, ie unrotate the source object's matrix.
vm_transpose_matrix(&m2);
vm_transpose(&m2);
vm_matrix_x_matrix(dom, &m3, &m2);
}
@@ -9013,8 +9029,9 @@ void find_adjusted_dockpoint_info(vec3d *global_p0, vec3d *global_p1, vec3d *glo
{
vec3d submodel_offset;
vec3d local_p0, local_p1;
ship *shipp;
ship_model_start(objp);
shipp = &Ships[objp->instance];
// calculate the dockpoint locations relative to the unrotated submodel
model_find_submodel_offset(&submodel_offset, modelnum, submodel);
@@ -9022,13 +9039,11 @@ void find_adjusted_dockpoint_info(vec3d *global_p0, vec3d *global_p1, vec3d *glo
vm_vec_sub(&local_p1, &pm->docking_bays[dock_index].pnt[1], &submodel_offset);
// find the dynamic positions of the dockpoints
model_find_world_point(global_p0, &local_p0, modelnum, submodel, &objp->orient, &objp->pos);
model_find_world_point(global_p1, &local_p1, modelnum, submodel, &objp->orient, &objp->pos);
model_instance_find_world_point(global_p0, &local_p0, shipp->model_instance_num, submodel, &objp->orient, &objp->pos);
model_instance_find_world_point(global_p1, &local_p1, shipp->model_instance_num, submodel, &objp->orient, &objp->pos);
// find the normal of the first dockpoint
model_find_world_dir(global_p0_norm, &pm->docking_bays[dock_index].norm[0], modelnum, submodel, &objp->orient, &objp->pos);
ship_model_stop(objp);
model_instance_find_world_dir(global_p0_norm, &pm->docking_bays[dock_index].norm[0], shipp->model_instance_num, submodel, &objp->orient);
}
// use the static dockpoints
else
@@ -9110,23 +9125,21 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
vec3d submodel_offset;
vec3d dockpoint_temp;
ship_model_start(dockee_objp);
// get submodel center
model_find_submodel_offset(&submodel_offset, sip1->model_num, dockee_rotating_submodel);
vm_vec_add(&submodel_pos, &dockee_objp->pos, &submodel_offset);
polymodel_instance *pmi1 = model_get_instance(Ships[dockee_objp->instance].model_instance_num);
// get angular velocity of dockpoint
//WMC - hack(?) to fix bug where sii might not exist
if(pm1->submodel[dockee_rotating_submodel].sii != NULL) {
submodel_omega = pm1->submodel[dockee_rotating_submodel].sii->cur_turn_rate;
if ( pmi1->submodel[dockee_rotating_submodel].sii != NULL ) {
submodel_omega = pmi1->submodel[dockee_rotating_submodel].sii->cur_turn_rate;
}
// get radius to dockpoint
vm_vec_avg(&dockpoint_temp, &dockee_p0, &dockee_p1);
submodel_radius = vm_vec_dist(&submodel_pos, &dockpoint_temp);
ship_model_stop(dockee_objp);
}
// Goober5000
@@ -9234,7 +9247,7 @@ float dock_orient_and_approach(object *docker_objp, int docker_index, object *do
vec3d origin_docker_point, adjusted_docker_point, v_offset;
// find out the rotation matrix that will get us from the old to the new rotation
vm_copy_transpose_matrix(&temp, &docker_objp->orient);
vm_copy_transpose(&temp, &docker_objp->orient);
vm_matrix_x_matrix(&m_offset, &temp, &dom);
// now find out the new docker point after being adjusted for the new orientation
@@ -9774,7 +9787,7 @@ float get_cylinder_points(object *other_objp, object *cyl_objp, vec3d *axis_pt,
// get point on axis and on cylinder
// extended_cylinder_z is along extended cylinder
// cylinder_z is capped within cylinder
float extended_cylinder_z = vm_vec_dotprod(&r_sph, &cyl_objp->orient.vec.fvec);
float extended_cylinder_z = vm_vec_dot(&r_sph, &cyl_objp->orient.vec.fvec);
// get pt on axis of extended cylinder
vm_vec_scale_add(axis_pt, &cyl_objp->pos, &cyl_objp->orient.vec.fvec, extended_cylinder_z);
@@ -9810,7 +9823,7 @@ void ai_big_guard()
// get position relative to cylinder of guard_objp
extended_z = get_cylinder_points(Pl_objp, guard_objp, &axis_pt, &r_vec, &radius);
vm_vec_crossprod(&theta_vec, &guard_objp->orient.vec.fvec, &r_vec);
vm_vec_cross(&theta_vec, &guard_objp->orient.vec.fvec, &r_vec);
// half ships circle each way
if (objval > 0.5f) {
@@ -10681,7 +10694,6 @@ void ai_dock()
// This mode means to follow the path until just before the end.
case AIS_DOCK_1:
{
float dist;
int r;
if ((r = maybe_dock_obstructed(Pl_objp, goal_objp, 1)) != -1) {
@@ -10692,7 +10704,7 @@ void ai_dock()
}
} //else {
{
dist = ai_path();
ai_path();
if (aip->path_cur-aip->path_start >= aip->path_length-1) { // If got this far, advance no matter what.
aip->submode = AIS_DOCK_2;
@@ -11823,9 +11835,8 @@ int ai_formation()
} else {
vec3d v2f2;
float dot_to_f2;
float dist_to_f2;
dist_to_f2 = vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
dot_to_f2 = vm_vec_dot(&v2f2, &Pl_objp->orient.vec.fvec);
// Leader flying like a maniac. Don't try hard to form on wing.
@@ -13637,7 +13648,7 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos)
vec3d vec_from_exp;
float dir = 1.0f;
vm_vec_sub(&vec_from_exp, &objp->pos, &expected_pos);
float dot = vm_vec_dotprod(&vec_from_exp, &weapon_objp->orient.vec.fvec);
float dot = vm_vec_dot(&vec_from_exp, &weapon_objp->orient.vec.fvec);
if (dot > -30) {
// if we're already on the other side of the explosion, don't try to fly behind it
dir = -1.0f;
@@ -13801,18 +13812,22 @@ int ai_await_repair_frame(object *objp, ai_info *aip)
// Maybe should only do this if they are preventing their wing from re-entering.
void ai_maybe_self_destruct(object *objp, ai_info *aip)
{
Assertion(objp->type == OBJ_SHIP, "ai_maybe_self_destruct() can only be called with objects that are ships!");
ship *shipp = &Ships[objp->instance];
// Some IFFs can be repaired, so no self-destruct.
// In multiplayer, just don't self-destruct. I figured there would be a problem. -- MK, 3/19/98.
if ((Iff_info[Ships[objp->instance].team].flags & IFFF_SUPPORT_ALLOWED) || (Game_mode & GM_MULTIPLAYER))
if ((Iff_info[shipp->team].flags & IFFF_SUPPORT_ALLOWED) || (Game_mode & GM_MULTIPLAYER))
return;
// Small ships in a wing blow themselves up after awhile if engine or weapons system has been destroyed.
// Reason: Don't want them to prevent a re-emergence of the wing.
// Note: Don't blow up if not in a wing for two reasons: One, won't affect re-emergence of waves and (1) disable the Dragon
// mission would be broken.
if ((Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP) && (Ships[objp->instance].wingnum != -1)) {
if ((ship_get_subsystem_strength(&Ships[objp->instance], SUBSYSTEM_ENGINE) <= 0.0f) ||
(ship_get_subsystem_strength(&Ships[objp->instance], SUBSYSTEM_WEAPONS) <= 0.0f)) {
// Also, don't blow up the ship if it has a ship flag preventing this - Goober5000
if ((Ship_info[shipp->ship_info_index].flags & SIF_SMALL_SHIP) && (shipp->wingnum >= 0) && !(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)) {
if ((ship_get_subsystem_strength(shipp, SUBSYSTEM_ENGINE) <= 0.0f) ||
(ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS) <= 0.0f)) {
if (aip->self_destruct_timestamp < 0)
aip->self_destruct_timestamp = timestamp(90 * 1000); // seconds until self-destruct
} else {
@@ -14084,7 +14099,7 @@ void ai_frame(int objnum)
}
if ((En_objp != NULL) && (En_objp->pos.xyz.x == Pl_objp->pos.xyz.x) && (En_objp->pos.xyz.y == Pl_objp->pos.xyz.y) && (En_objp->pos.xyz.z == Pl_objp->pos.xyz.z)) {
mprintf(("Warning: Object and its enemy have same position. Object #%i\n", OBJ_INDEX(Pl_objp)));
mprintf(("Warning: Object and its enemy have same position. Object #" PTRDIFF_T_ARG "\n", OBJ_INDEX(Pl_objp)));
En_objp = NULL;
}
@@ -14863,7 +14878,7 @@ void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *colli
float max_lethality = 0.0f;
void ai_update_lethality(object *ship_obj, object *other_obj, float damage)
void ai_update_lethality(object *pship_obj, object *other_obj, float damage)
{
// Goober5000 - stop any trickle-down errors from ship_do_damage
Assert(other_obj);
@@ -14872,8 +14887,8 @@ void ai_update_lethality(object *ship_obj, object *other_obj, float damage)
return;
}
Assert(ship_obj); // Goober5000
Assert(ship_obj->type == OBJ_SHIP);
Assert(pship_obj); // Goober5000
Assert(pship_obj->type == OBJ_SHIP);
Assert(other_obj->type == OBJ_WEAPON || other_obj->type == OBJ_SHOCKWAVE);
int dont_count = FALSE;
@@ -14882,7 +14897,7 @@ void ai_update_lethality(object *ship_obj, object *other_obj, float damage)
if (Objects[parent].signature == other_obj->parent_sig) {
// check damage done to enemy team
if (iff_x_attacks_y(Ships[ship_obj->instance].team, Ships[Objects[parent].instance].team)) {
if (iff_x_attacks_y(Ships[pship_obj->instance].team, Ships[Objects[parent].instance].team)) {
// other is weapon
if (other_obj->type == OBJ_WEAPON) {
+21 -16
View File
@@ -11,18 +11,18 @@
#include "ai/aigoals.h"
#include "parse/sexp.h"
#include "globalincs/linklist.h"
#include "mission/missionlog.h"
#include "mission/missionparse.h"
#include "object/object.h"
#include "globalincs/linklist.h"
#include "playerman/player.h"
#include "network/multimsgs.h"
#include "network/multi.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
#include "network/multimsgs.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "object/waypoint.h"
#include "parse/sexp.h"
#include "playerman/player.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
// all ai goals dealt with in this code are goals that are specified through
@@ -171,7 +171,7 @@ void ai_post_process_mission()
// Goober5000 - MK originally iterated on only the first wing; now we iterate on only the player wing
// because the player wing may not be first
for ( i = 0; i < MAX_STARTING_WINGS; i++ ) {
if ( Starting_wings[i] == Player_ship->wingnum ) {
if (Starting_wings[i] >= 0 && Starting_wings[i] == Player_ship->wingnum) {
wing *wingp;
wingp = &Wings[Starting_wings[i]];
@@ -199,12 +199,17 @@ void ai_post_process_mission()
return;
}
// function which determines is a goal is valid for a particular type of ship
int ai_query_goal_valid( int ship, int ai_goal )
/**
* Determines if a goal is valid for a particular type of ship
*
* @param ship Ship type to test
* @param ai_goal_type Goal type to test
*/
int ai_query_goal_valid( int ship, int ai_goal_type )
{
int accepted;
if (ai_goal == AI_GOAL_NONE)
if (ai_goal_type == AI_GOAL_NONE)
return 1; // anything can have no orders.
accepted = 0;
@@ -214,7 +219,7 @@ int ai_query_goal_valid( int ship, int ai_goal )
int ship_type = Ship_info[Ships[ship].ship_info_index].class_type;
if(ship_type > -1)
{
if(ai_goal & Ship_types[ship_type].ai_valid_goals) {
if(ai_goal_type & Ship_types[ship_type].ai_valid_goals) {
accepted = 1;
}
}
@@ -528,7 +533,7 @@ int ai_goal_find_dockpoint(int shipnum, int dock_type)
}
// function to fix up dock point references for objects.
// passed are the pointer to goal we are working with. aip if the ai_info pointer
// passed are the pointer to goal we are working with. aip is the ai_info pointer
// of the ship with the order. aigp is a pointer to the goal (of aip) of which we are
// fixing up the docking points
void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
@@ -537,6 +542,7 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
Assert ( aip->shipnum != -1 );
shipnum = ship_name_lookup( aigp->target_name );
Assertion ( shipnum != -1, "Couldn't find ai goal's target_name (%s); get a coder!\n", aigp->target_name );
docker_index = -1;
dockee_index = -1;
@@ -1882,9 +1888,8 @@ int ai_goal_priority_compare(const void *a, const void *b)
// Prioritize goal list.
// First sort on priority.
// Then sort on time for goals of equivalent priority.
// objnum The object number to act upon. Redundant with *aip.
// *aip The AI info to act upon. Goals are stored at aip->goals
void prioritize_goals(int objnum, ai_info *aip)
void prioritize_goals(ai_info *aip)
{
// First sort based on priority field.
insertion_sort(aip->goals, MAX_AI_GOALS, sizeof(ai_goal), ai_goal_priority_compare);
@@ -2000,7 +2005,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
validate_mission_goals(objnum, aip);
// Sort the goal array by priority and other factors.
prioritize_goals(objnum, aip);
prioritize_goals(aip);
// Make sure there's a goal to pursue, else return.
if (aip->goals[0].signature == -1) {
+1 -1
View File
@@ -121,7 +121,7 @@ extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name);
extern char *ai_add_dock_name(const char *str);
extern int ai_query_goal_valid( int ship, int ai_goal );
extern int ai_query_goal_valid( int ship, int ai_goal_type );
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
+3
View File
@@ -10,6 +10,9 @@
#ifndef _AIINTERNAL_H
#define _AIINTERNAL_H
#include "ship/ship.h"
#include "weapon/weapon.h"
//Returns true if the specified object is a stealth ship, false if not
bool is_object_stealth_ship(object* objp);
-16
View File
@@ -1,16 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _AILOCAL_H
#define _AILOCAL_H
// -- Don't put anything in here --
// Put it in ai.h!
#endif
+190 -27
View File
@@ -1,28 +1,28 @@
#include "globalincs/systemvars.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
#include "freespace2/freespace.h"
#include "ai/aibig.h"
#include "ai/aiinternal.h"
#include "asteroid/asteroid.h"
#include "globalincs/linklist.h"
#include "weapon/beam.h"
#include "weapon/swarm.h"
#include "io/timer.h"
#include "render/3d.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "ship/shipfx.h"
#include "network/multimsgs.h"
#include "weapon/flak.h"
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "math/staticrand.h"
#include "network/multi.h"
#include "ai/aibig.h"
#include "network/multimsgs.h"
#include "object/objectdock.h"
#include "ai/aiinternal.h" //Included last, so less includes are needed
#include "iff_defs/iff_defs.h"
#include "weapon/muzzleflash.h"
#include "parse/scripting.h"
#include "debugconsole/console.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "weapon/beam.h"
#include "weapon/flak.h"
#include "weapon/muzzleflash.h"
#include "weapon/swarm.h"
#include "weapon/weapon.h"
#include <limits.h>
@@ -1332,11 +1332,58 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
gun_pos = &tp->turret_firing_point[ssp->turret_next_fire_pos % tp->turret_num_firing_points];
//model_find_world_point(gpos, gun_pos, tp->model_num, tp->turret_gun_sobj, &objp->orient, &objp->pos );
model_instance_find_world_point(gpos, gun_pos, tp->model_num, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
model_instance_find_world_point(gpos, gun_pos, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
if (use_angles)
model_instance_find_world_dir(gvec, &tp->turret_norm, tp->model_num, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos );
else {
if (use_angles) {
model_instance_find_world_dir(gvec, &tp->turret_norm, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient);
} else if (tp->flags2 & MSS_FLAG2_SHARE_FIRE_DIRECTION) {
vec3d shared_dir, avg, tmp_pos, tmp_target, enemy_point;
vm_vec_avg_n(&avg, tp->turret_num_firing_points, tp->turret_firing_point);
model_instance_find_world_point(&tmp_pos, &avg, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient, &objp->pos);
if (targetp == nullptr) {
Assertion(ssp->turret_enemy_objnum >= 0, "The turret enemy object number %d for %s on ship number %d is invalid.", ssp->turret_enemy_objnum, ssp->sub_name, ssp->parent_objnum);
object *lep = &Objects[ssp->turret_enemy_objnum];
int best_weapon_tidx = turret_select_best_weapon(ssp, lep);
//This turret doesn't have any good weapons
if (best_weapon_tidx < 0)
return;
weapon_info *wip = get_turret_weapon_wip(&ssp->weapons, best_weapon_tidx);
float weapon_system_strength = ship_get_subsystem_strength(&Ships[ssp->parent_objnum], SUBSYSTEM_WEAPONS);
if ((ssp->targeted_subsys != nullptr) && !(ssp->flags & SSF_NO_SS_TARGETING)) {
vm_vec_unrotate(&enemy_point, &ssp->targeted_subsys->system_info->pnt, &Objects[ssp->turret_enemy_objnum].orient);
vm_vec_add2(&enemy_point, &ssp->last_aim_enemy_pos);
} else {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
ai_big_pick_attack_point_turret(lep, ssp, &tmp_pos, &tp->turret_norm, &enemy_point, tp->turret_fov, MIN(wip->max_speed * wip->lifetime, wip->weapon_range));
}
else {
enemy_point = ssp->last_aim_enemy_pos;
}
}
vec3d target_moving_direction = ssp->last_aim_enemy_vel;
//Try to guess where the enemy will be, and store that spot in predicted_enemy_pos
if (The_mission.ai_profile->flags & AIPF_USE_ADDITIVE_WEAPON_VELOCITY) {
vm_vec_scale_sub2(&target_moving_direction, &objp->phys_info.vel, wip->vel_inherit_amount);
}
set_predicted_enemy_pos_turret(&tmp_target, &tmp_pos, objp, &enemy_point, &target_moving_direction, wip->max_speed, ssp->turret_time_enemy_in_range * (weapon_system_strength + 1.0f) / 2.0f);
} else {
tmp_target = *targetp;
}
vm_vec_normalized_dir(&shared_dir, &tmp_target, &tmp_pos);
model_instance_find_world_dir(gvec, &shared_dir, Ships[objp->instance].model_instance_num, tp->turret_gun_sobj, &objp->orient);
} else {
//vector gun_pos2;
//vm_vec_add(&gun_pos2, gpos, gun_pos);
vm_vec_normalized_dir(gvec, targetp, gpos);
@@ -1377,7 +1424,7 @@ void turret_ai_update_aim(ai_info *aip, object *En_Objp, ship_subsys *ss)
*/
int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object *objp, object *lep, vec3d *predicted_enemy_pos, vec3d *gvec)
{
int ret_val __attribute__((__unused__)) = 0; // to be used in future, see comment @ end of function
int ret_val __UNUSED = 0; // to be used in future, see comment @ end of function
if (ss->turret_enemy_objnum != -1) {
model_subsystem *tp = ss->system_info;
@@ -1870,21 +1917,129 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
fire_info.turret = turret;
// fire a beam weapon
beam_fire(&fire_info);
weapon_objnum = beam_fire(&fire_info);
if (weapon_objnum != -1) {
objp = &Objects[weapon_objnum];
parent_ship->last_fired_turret = turret;
turret->last_fired_weapon_info_index = turret_weapon_class;
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", nullptr, "Beam", objp, "Target", &Objects[turret->turret_enemy_objnum]);
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
}
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
return true;
}
// don't fire swam, but set up swarm info instead
else if ((wip->wi_flags & WIF_SWARM) || (wip->wi_flags & WIF_CORKSCREW)) {
turret_swarm_set_up_info(parent_objnum, turret, wip, turret->turret_next_fire_pos);
ship_weapon *swp = &turret->weapons;
if (swp->current_secondary_bank < 0) {
swp->current_secondary_bank = 0;
}
int bank_to_fire = swp->current_secondary_bank;
if ((turret->system_info->flags2 & MSS_FLAG2_TURRET_USE_AMMO) && (swp->secondary_bank_ammo[bank_to_fire] < 0)) {
if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS)) {
swp->current_secondary_bank++;
if (swp->current_secondary_bank >= swp->num_secondary_banks) {
swp->current_secondary_bank = 0;
}
return false;
} else {
return false;
}
} else {
turret_swarm_set_up_info(parent_objnum, turret, wip, turret->turret_next_fire_pos);
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
return true;
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
return true;
}
}
// now do anything else
else {
for (int i = 0; i < wip->shots; i++) {
if (turret->system_info->flags2 & MSS_FLAG2_TURRET_USE_AMMO) {
ship_weapon *swp;
swp = &turret->weapons;
int bank_to_fire, num_slots = turret->system_info->turret_num_firing_points;
if (wip->subtype == WP_LASER) {
int points;
if (swp->num_primary_banks <= 0) {
return false;
}
if (swp->current_primary_bank < 0){
swp->current_primary_bank = 0;
return false;
}
int num_primary_banks = swp->num_primary_banks;
Assert(num_primary_banks > 0);
if (num_primary_banks < 1){
return false;
}
bank_to_fire = swp->current_primary_bank;
if (turret->system_info->flags & MSS_FLAG_TURRET_SALVO) {
points = num_slots;
} else {
points = 1;
}
if (swp->primary_bank_ammo[bank_to_fire] >= 0) {
swp->primary_bank_ammo[bank_to_fire] -= points;
} else if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS) && (swp->primary_bank_ammo[bank_to_fire] < 0)) {
swp->current_primary_bank++;
if (swp->current_primary_bank >= swp->num_primary_banks) {
swp->current_primary_bank = 0;
}
return false;
} else {
return false;
}
}
else if (wip->subtype == WP_MISSILE) {
if (swp->num_secondary_banks <= 0) {
return false;
}
if (swp->current_secondary_bank < 0){
swp->current_secondary_bank = 0;
return false;
}
bank_to_fire = swp->current_secondary_bank;
int start_slot, end_slot;
start_slot = swp->secondary_next_slot[bank_to_fire];
end_slot = start_slot;
for (int j = start_slot; j <= end_slot; j++) {
swp->secondary_next_slot[bank_to_fire]++;
if (swp->secondary_next_slot[bank_to_fire] > (num_slots - 1)){
swp->secondary_next_slot[bank_to_fire] = 0;
}
if (swp->secondary_bank_ammo[bank_to_fire] >= 0) {
swp->secondary_bank_ammo[bank_to_fire]--;
} else if (!(turret->system_info->flags & MSS_FLAG_USE_MULTIPLE_GUNS) && (swp->secondary_bank_ammo[bank_to_fire] < 0)) {
swp->current_secondary_bank++;
if (swp->current_secondary_bank >= swp->num_secondary_banks) {
swp->current_secondary_bank = 0;
}
return false;
} else {
return false;
}
}
}
}
// zookeeper - Firepoints should cycle normally between shots,
// so we need to get the position info separately for each shot
ship_get_global_turret_gun_info(&Objects[parent_objnum], turret, turret_pos, turret_fvec, 1, NULL);
@@ -1905,8 +2060,9 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
// AL 1-6-97: Store pointer to turret subsystem
wp->turret_subsys = turret;
Script_system.SetHookObjects(3, "Ship", &Objects[parent_objnum], "Weapon", objp, "Target", &Objects[turret->turret_enemy_objnum]);
Script_system.SetHookObjects(4, "Ship", &Objects[parent_objnum], "Weapon", objp, "Beam", nullptr, "Target", &Objects[turret->turret_enemy_objnum]);
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[parent_objnum]);
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
// if the gun is a flak gun
if (wip->wi_flags & WIF_FLAK) {
@@ -2018,6 +2174,13 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
Ships[Objects[tsi->parent_objnum].instance].last_fired_turret = tsi->turret;
tsi->turret->last_fired_weapon_info_index = tsi->weapon_class;
Script_system.SetHookObjects(4, "Ship", &Objects[tsi->parent_objnum], "Weapon", &Objects[weapon_objnum], "Beam", nullptr, "Target", &Objects[tsi->turret->turret_enemy_objnum]);
Script_system.RunCondition(CHA_ONTURRETFIRED, 0, NULL, &Objects[tsi->parent_objnum]);
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
// muzzle flash?
if (Weapon_info[tsi->weapon_class].muzzle_flash >= 0) {
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
+7 -10
View File
@@ -10,15 +10,15 @@
#include "anim/animplay.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
#include "render/3d.h"
#include "pcxutils/pcxutils.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "globalincs/linklist.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "pcxutils/pcxutils.h"
#include "render/3d.h"
@@ -254,7 +254,7 @@ anim_instance *anim_play(anim_play_struct *aps)
int anim_show_next_frame(anim_instance *instance, float frametime)
{
int bitmap_id, bitmap_flags=0, new_frame_num, frame_diff=0, i, n_frames=0,frame_save;
float percent_through, decompress_time, render_time, time;
float percent_through, time;
vertex image_vertex;
int aabitmap = 0;
int bpp = 16;
@@ -461,8 +461,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
instance->file_offset = instance->parent->file_offset;
instance->loop_count++;
}
decompress_time = f2fl(t2-t1);
t1 = timer_get_fixed_seconds();
if ( frame_diff == 0 && instance->last_bitmap != -1 ) {
@@ -514,7 +512,6 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
}
t2 = timer_get_fixed_seconds();
render_time = f2fl(t2-t1);
return 0;
}
+1 -1
View File
@@ -12,8 +12,8 @@
#ifndef __ANIMPLAY_H__
#define __ANIMPLAY_H__
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
struct anim;
struct anim_info;
+1 -1
View File
@@ -9,10 +9,10 @@
#include "anim/animplay.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
#include "anim/animplay.h"
const int packer_code = PACKER_CODE;
+251 -213
View File
@@ -10,39 +10,39 @@
#include "asteroid/asteroid.h"
#include "object/object.h"
#include "object/objcollide.h"
#include "freespace2/freespace.h"
#include "io/timer.h"
#include "render/3d.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "particle/particle.h"
#include "globalincs/compatibility.h"
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h"
#include "hud/hud.h"
#include "hud/hudescort.h"
#include "hud/hudgauges.h"
#include "ship/shiphit.h"
#include "math/staticrand.h"
#include "globalincs/systemvars.h"
#include "localization/localize.h"
#include "stats/scoring.h"
#include "hud/hudtarget.h"
#include "weapon/weapon.h"
#include "ship/ship.h"
#include "parse/parselo.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "localization/localize.h"
#include "math/staticrand.h"
#include "math/vecmat.h"
#include "model/model.h"
#include "species_defs/species_defs.h"
#include "iff_defs/iff_defs.h"
#include "network/multiutil.h"
#include "network/multimsgs.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/objcollide.h"
#include "object/object.h"
#include "parse/parselo.h"
#include "parse/scripting.h"
#include "debugconsole/console.h"
#include "particle/particle.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shiphit.h"
#include "species_defs/species_defs.h"
#include "stats/scoring.h"
#include "weapon/weapon.h"
#include <algorithm>
#include "globalincs/compatibility.h"
#define ASTEROID_OBJ_USED (1<<0) // flag used in asteroid_obj struct
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS // max number of asteroids tracked in asteroid list
@@ -329,6 +329,11 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
}
asp->objnum = objnum;
asp->model_instance_num = -1;
if (model_get(asip->model_num[asteroid_subtype])->flags & PM_FLAG_HAS_INTRINSIC_ROTATE) {
asp->model_instance_num = model_create_instance(false, asip->model_num[asteroid_subtype]);
}
// Add to Asteroid_used_list
asteroid_obj_list_add(objnum);
@@ -828,10 +833,12 @@ void asteroid_delete( object * obj )
asp = &Asteroids[num];
Assert( Num_asteroids >= 0 );
if (asp->model_instance_num >= 0)
model_delete_instance(asp->model_instance_num);
asp->flags = 0;
Num_asteroids--;
Assert(Num_asteroids >= 0);
asteroid_obj_list_remove( obj );
}
@@ -898,7 +905,7 @@ void lerp(float *goal, float f1, float f2, float scale)
*goal = (f2 - f1) * scale + f1;
}
void asteroid_process_pre( object *objp, float frame_time)
void asteroid_process_pre( object *objp )
{
if (Asteroids_enabled) {
// Make vel chase desired_vel
@@ -930,7 +937,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
if ( asteroid_hit_info == NULL ) {
// asteroid weapon collision
Assert( other_obj->type == OBJ_WEAPON );
mc.model_instance_num = -1;
mc.model_instance_num = Asteroids[num].model_instance_num;
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
model_clear_instance( mc.model_num );
mc.orient = &pasteroid->orient; // The object's orient
@@ -946,18 +953,18 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
}
// asteroid ship collision -- use asteroid_hit_info to calculate physics
object *ship_obj = other_obj;
Assert( ship_obj->type == OBJ_SHIP );
object *pship_obj = other_obj;
Assert( pship_obj->type == OBJ_SHIP );
object* heavy = asteroid_hit_info->heavy;
object* light = asteroid_hit_info->light;
object* lighter = asteroid_hit_info->light;
object *heavy_obj = heavy;
object *light_obj = light;
object *light_obj = lighter;
vec3d zero, p0, p1;
vm_vec_zero( &zero );
vm_vec_sub( &p0, &light->last_pos, &heavy->last_pos );
vm_vec_sub( &p1, &light->pos, &heavy->pos );
vm_vec_sub( &p0, &lighter->last_pos, &heavy->last_pos );
vm_vec_sub( &p1, &lighter->pos, &heavy->pos );
mc.pos = &zero; // The object's position
mc.p0 = &p0; // Point 1 of ray to check
@@ -979,19 +986,19 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// HACK - this applies to big ships warping in/out of asteroid fields - not sure what it does
if (vm_vec_mag(&asteroid_hit_info->light_rel_vel) > 300) {
asteroid_hit_info->collide_rotate = 0;
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel );
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel );
}
} else {
asteroid_hit_info->collide_rotate = 0;
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel );
vm_vec_sub( &asteroid_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel );
}
int mc_ret_val = 0;
if ( asteroid_hit_info->heavy == ship_obj ) { // ship is heavier, so asteroid is sphere. Check sphere collision against ship poly model
mc.model_instance_num = Ships[ship_obj->instance].model_instance_num;
mc.model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc.orient = &ship_obj->orient; // The object's orient
if ( asteroid_hit_info->heavy == pship_obj ) { // ship is heavier, so asteroid is sphere. Check sphere collision against ship poly model
mc.model_instance_num = Ships[pship_obj->instance].model_instance_num;
mc.model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc.orient = &pship_obj->orient; // The object's orient
mc.radius = pasteroid->radius;
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
@@ -1005,7 +1012,6 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
mc.flags = MC_ONLY_SPHERE | MC_CHECK_SPHERELINE;
SCP_vector<int> submodel_vector;
polymodel *pm;
polymodel_instance *pmi;
if (model_collide(&mc)) {
@@ -1019,8 +1025,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
model_get_rotating_submodel_list(&submodel_vector, heavy_obj);
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
pm = model_get(Ship_info[Ships[heavy_obj->instance].ship_info_index].model_num);
pmi = model_get_instance(Ships[ship_obj->instance].model_instance_num);
pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
// turn off all rotating submodels and test for collision
for (size_t j=0; j<submodel_vector.size(); j++) {
@@ -1041,10 +1046,10 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// find the start and end positions of the sphere in submodel RF
pmi->submodel[submodel_vector[i]].angs = pmi->submodel[submodel_vector[i]].prev_angs;
world_find_model_instance_point(&p0, &light_obj->last_pos, pm, pmi, submodel_vector[i], &heavy_obj->last_orient, &heavy_obj->last_pos);
world_find_model_instance_point(&p0, &light_obj->last_pos, pmi, submodel_vector[i], &heavy_obj->last_orient, &heavy_obj->last_pos);
pmi->submodel[submodel_vector[i]].angs = copy_angles;
world_find_model_instance_point(&p1, &light_obj->pos, pm, pmi, submodel_vector[i], &heavy_obj->orient, &heavy_obj->pos);
world_find_model_instance_point(&p1, &light_obj->pos, pmi, submodel_vector[i], &heavy_obj->orient, &heavy_obj->pos);
mc.p0 = &p0;
mc.p1 = &p1;
@@ -1061,14 +1066,14 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// set up asteroid_hit_info for rotating submodel
if (asteroid_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
vec3d int_light_pos, diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
model_instance_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
}
}
// Don't look at this submodel again
@@ -1093,7 +1098,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
// get collision normal if not edge hit
if (asteroid_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
model_instance_find_obj_dir(&asteroid_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
@@ -1107,11 +1112,11 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
} else {
// Asteroid is heavier obj
mc.model_instance_num = -1;
mc.model_instance_num = Asteroids[num].model_instance_num;
mc.model_num = Asteroid_info[Asteroids[num].asteroid_type].model_num[asteroid_subtype]; // Fill in the model to check
model_clear_instance( mc.model_num );
mc.orient = &pasteroid->orient; // The object's orient
mc.radius = model_get_core_radius(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
mc.radius = model_get_core_radius(Ship_info[Ships[pship_obj->instance].ship_info_index].model_num);
// check for collision between asteroid model and ship sphere
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
@@ -1162,7 +1167,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
}
}
void asteroid_render(object * obj)
void asteroid_render_DEPRECATED(object * obj)
{
if (Asteroids_enabled) {
int num;
@@ -1176,7 +1181,32 @@ void asteroid_render(object * obj)
Assert( asp->flags & AF_USED );
model_clear_instance( Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype]);
model_render(Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos, MR_NORMAL|MR_IS_ASTEROID, OBJ_INDEX(obj) ); // Replace MR_NORMAL with 0x07 for big yellow blobs
model_render_DEPRECATED(Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos, MR_DEPRECATED_NORMAL|MR_DEPRECATED_IS_ASTEROID, OBJ_INDEX(obj) ); // Replace MR_NORMAL with 0x07 for big yellow blobs
}
}
void asteroid_render(object * obj, draw_list *scene)
{
if (Asteroids_enabled) {
int num;
asteroid *asp;
num = obj->instance;
Assert((num >= 0) && (num < MAX_ASTEROIDS));
asp = &Asteroids[num];
Assert( asp->flags & AF_USED );
model_clear_instance( Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype]);
model_render_params render_info;
render_info.set_object_number( OBJ_INDEX(obj) );
render_info.set_flags(MR_IS_ASTEROID);
model_render_queue(&render_info, scene, Asteroid_info[asp->asteroid_type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos); // Replace MR_NORMAL with 0x07 for big yellow blobs
}
}
@@ -1330,42 +1360,42 @@ void asteroid_do_area_effect(object *asteroid_objp)
/**
* Upon asteroid asteroid_obj being hit. Apply damage and maybe make it break into smaller asteroids.
*
* @param asteroid_obj pointer to asteroid object getting hit
* @param pasteroid_obj pointer to asteroid object getting hit
* @param other_obj object that hit asteroid, can be NULL if asteroid hit by area effect
* @param hitpos world position asteroid was hit, can be NULL if hit by area effect
* @param damage amount of damage to apply to asteroid
*/
void asteroid_hit( object * asteroid_obj, object * other_obj, vec3d * hitpos, float damage )
void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, float damage )
{
float explosion_life;
asteroid *asp;
asp = &Asteroids[asteroid_obj->instance];
asp = &Asteroids[pasteroid_obj->instance];
if (asteroid_obj->flags & OF_SHOULD_BE_DEAD){
if (pasteroid_obj->flags & OF_SHOULD_BE_DEAD){
return;
}
if ( MULTIPLAYER_MASTER ){
send_asteroid_hit( asteroid_obj, other_obj, hitpos, damage );
send_asteroid_hit( pasteroid_obj, other_obj, hitpos, damage );
}
asteroid_obj->hull_strength -= damage;
pasteroid_obj->hull_strength -= damage;
if (asteroid_obj->hull_strength < 0.0f) {
if (pasteroid_obj->hull_strength < 0.0f) {
if ( asp->final_death_time <= 0 ) {
int play_loud_collision = 0;
explosion_life = asteroid_create_explosion(asteroid_obj);
explosion_life = asteroid_create_explosion(pasteroid_obj);
asteriod_explode_sound(asteroid_obj, asp->asteroid_type, play_loud_collision);
asteroid_do_area_effect(asteroid_obj);
asteriod_explode_sound(pasteroid_obj, asp->asteroid_type, play_loud_collision);
asteroid_do_area_effect(pasteroid_obj);
asp->final_death_time = timestamp( fl2i(explosion_life*1000.0f)/5 ); // Wait till 30% of vclip time before breaking the asteroid up.
if ( hitpos ) {
asp->death_hit_pos = *hitpos;
} else {
asp->death_hit_pos = asteroid_obj->pos;
asp->death_hit_pos = pasteroid_obj->pos;
// randomize hit pos a bit, otherwise we will get a NULL vector when trying to find direction to toss child asteroids
vec3d rand_vec;
vm_vec_rand_vec_quick(&rand_vec);
@@ -1384,7 +1414,7 @@ void asteroid_hit( object * asteroid_obj, object * other_obj, vec3d * hitpos, fl
}
// evaluate any relevant player scoring implications
scoring_eval_hit(asteroid_obj,other_obj);
scoring_eval_hit(pasteroid_obj,other_obj);
}
/**
@@ -1449,21 +1479,21 @@ int asteroid_count()
* See if asteroid should split up.
* We delay splitting up to allow the explosion animation to play for a bit.
*/
void asteroid_maybe_break_up(object *asteroid_obj)
void asteroid_maybe_break_up(object *pasteroid_obj)
{
asteroid *asp;
asteroid_info *asip;
asp = &Asteroids[asteroid_obj->instance];
asp = &Asteroids[pasteroid_obj->instance];
asip = &Asteroid_info[asp->asteroid_type];
if ( timestamp_elapsed(asp->final_death_time) ) {
vec3d relvec, vfh, tvec;
Script_system.SetHookObject("Self", asteroid_obj);
if(!Script_system.IsConditionOverride(CHA_DEATH, asteroid_obj))
Script_system.SetHookObject("Self", pasteroid_obj);
if(!Script_system.IsConditionOverride(CHA_DEATH, pasteroid_obj))
{
asteroid_obj->flags |= OF_SHOULD_BE_DEAD;
pasteroid_obj->flags |= OF_SHOULD_BE_DEAD;
// multiplayer clients won't go through the following code. asteroid_sub_create will send
// a create packet to the client in the above named function
@@ -1474,29 +1504,29 @@ void asteroid_maybe_break_up(object *asteroid_obj)
case ASTEROID_TYPE_SMALL:
break;
case ASTEROID_TYPE_MEDIUM:
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
asc_get_relvec(&relvec, pasteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_normalized_dir(&vfh, &pasteroid_obj->pos, &asp->death_hit_pos);
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
vm_vec_sub2(&tvec, &relvec);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
break;
case ASTEROID_TYPE_LARGE:
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
asc_get_relvec(&relvec, pasteroid_obj, &asp->death_hit_pos);
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_normalized_dir(&vfh, &pasteroid_obj->pos, &asp->death_hit_pos);
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
vm_vec_sub2(&tvec, &relvec);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
while (frand() > 0.6f) {
vec3d rvec, tvec2;
vm_vec_rand_vec_quick(&rvec);
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
asteroid_sub_create(pasteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
}
break;
@@ -1545,24 +1575,24 @@ void asteroid_maybe_break_up(object *asteroid_obj)
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, &asteroid_obj->phys_info.vel);
vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
vm_vec_scale(&parent_vel, 0.5f);
// Make the hit position affect the direction, but only a little
vm_vec_sub(&hit_rel_vec, &asteroid_obj->pos, &asp->death_hit_pos);
vm_vec_sub(&hit_rel_vec, &pasteroid_obj->pos, &asp->death_hit_pos);
vm_vec_normalize(&hit_rel_vec);
vm_vec_scale(&hit_rel_vec, 0.25f);
vm_vec_avg3(&final_vec, &parent_vel, &hit_rel_vec, &dir_vec);
vm_vec_normalize(&final_vec);
asteroid_sub_create(asteroid_obj, roids_to_create[i], &final_vec);
asteroid_sub_create(pasteroid_obj, roids_to_create[i], &final_vec);
}
}
}
asp->final_death_time = timestamp(-1);
}
Script_system.RunCondition(CHA_DEATH, '\0', NULL, asteroid_obj);
Script_system.RunCondition(CHA_DEATH, '\0', NULL, pasteroid_obj);
Script_system.RemHookVar("Self");
}
}
@@ -1586,36 +1616,36 @@ int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger)
return -1;
}
void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc, bool lazy = false)
void asteroid_test_collide(object *pasteroid_obj, object *pship_obj, mc_info *mc, bool lazy = false)
{
float asteroid_ray_dist;
vec3d asteroid_fvec, terminus;
// See if ray from asteroid intersects bounding box of escort ship
asteroid_ray_dist = vm_vec_mag_quick(&asteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
asteroid_fvec = asteroid_obj->phys_info.desired_vel;
asteroid_ray_dist = vm_vec_mag_quick(&pasteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
asteroid_fvec = pasteroid_obj->phys_info.desired_vel;
if(IS_VEC_NULL_SQ_SAFE(&asteroid_fvec)){
terminus = asteroid_obj->pos;
terminus = pasteroid_obj->pos;
} else {
vm_vec_normalize(&asteroid_fvec);
vm_vec_scale_add(&terminus, &asteroid_obj->pos, &asteroid_fvec, asteroid_ray_dist);
vm_vec_scale_add(&terminus, &pasteroid_obj->pos, &asteroid_fvec, asteroid_ray_dist);
}
Assert(ship_obj->type == OBJ_SHIP);
Assert(pship_obj->type == OBJ_SHIP);
mc->model_instance_num = Ships[ship_obj->instance].model_instance_num;
mc->model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc->orient = &ship_obj->orient; // The object's orientation
mc->pos = &ship_obj->pos; // The object's position
mc->p0 = &asteroid_obj->pos; // Point 1 of ray to check
mc->model_instance_num = Ships[pship_obj->instance].model_instance_num;
mc->model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc->orient = &pship_obj->orient; // The object's orientation
mc->pos = &pship_obj->pos; // The object's position
mc->p0 = &pasteroid_obj->pos; // Point 1 of ray to check
mc->p1 = &terminus; // Point 2 of ray to check
if (lazy) {
mc->flags = MC_CHECK_MODEL | MC_ONLY_BOUND_BOX;
} else {
mc->flags = MC_CHECK_MODEL | MC_CHECK_SPHERELINE;
}
mc->radius = asteroid_obj->radius;
mc->radius = pasteroid_obj->radius;
model_collide(mc);
@@ -1623,14 +1653,17 @@ void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc,
mc->p1 = NULL;
}
// Return !0 is the asteroid will collide with the escort ship within ASTEROID_MIN_COLLIDE_TIME
// seconds
int asteroid_will_collide(object *asteroid_obj, object *escort_objp)
/**
* Test if asteroid will collide with escort ship within ASTEROID_MIN_COLLIDE_TIME seconds
*
* @return !0 if the asteroid will collide with the escort
*/
int asteroid_will_collide(object *pasteroid_obj, object *escort_objp)
{
mc_info mc;
mc_info_init(&mc);
asteroid_test_collide(asteroid_obj, escort_objp, &mc);
asteroid_test_collide(pasteroid_obj, escort_objp, &mc);
if ( !mc.num_hits ) {
return 0;
@@ -1714,7 +1747,7 @@ void asteroid_verify_collide_objnum(asteroid *asp)
}
}
void asteroid_process_post(object * obj, float frame_time)
void asteroid_process_post(object * obj)
{
if (Asteroids_enabled) {
int num;
@@ -1887,143 +1920,148 @@ that is being protected.
void asteroid_parse_tbl()
{
char impact_ani_file[MAX_FILENAME_LEN];
int rval;
// How did we get here without having any species defined?
Assertion(Species_info.size() > 0,
"Cannot parse asteroids/debris if there "
"are no species for them to belong to."
);
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "asteroid.tbl", rval));
return;
}
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
reset_parse();
required_string("#Asteroid Types");
int tally = 0;
int max_asteroids =
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
#ifndef NDEBUG
SCP_vector<SCP_string> parsed_asteroids;
#endif
// parse and tally each asteroid
while (required_string_either("#End","$Name:"))
try
{
asteroid_info new_asteroid;
read_file_text("asteroid.tbl", CF_TYPE_TABLES);
reset_parse();
asteroid_parse_section( &new_asteroid );
required_string("#Asteroid Types");
int tally = 0;
int max_asteroids =
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
int species = tally / NUM_DEBRIS_SIZES;
if (tally >= max_asteroids)
{
#ifdef NDEBUG
// Bump the warning count in release so they get something
// even if the message never gets displayed.
Warning(LOCATION, "Ignoring extra asteroid/debris");
#else
SCP_string msg("Ignoring extra asteroid/debris '");
msg.append(new_asteroid.name);
msg.append("'\n");
Warning(LOCATION,msg.c_str());
parsed_asteroids.push_back(msg);
#endif
}
else
{
#ifndef NDEBUG
SCP_string msg;
msg.append("Parsing asteroid: '");
msg.append(new_asteroid.name);
msg.append("' as a '");
msg.append((species == 0)?"generic":Species_info[species-1].species_name);
msg.append("'");
switch(tally % NUM_DEBRIS_SIZES) {
case ASTEROID_TYPE_SMALL:
msg.append(" small\n");
break;
case ASTEROID_TYPE_MEDIUM:
msg.append(" medium\n");
break;
case ASTEROID_TYPE_LARGE:
msg.append(" large\n");
break;
default:
Error(LOCATION, "Get a coder! Math has broken!\n"
"Important numbers:\n"
"\ttally: %d\n"
"\tNUM_DEBRIS_SIZES: %d\n",
tally, NUM_DEBRIS_SIZES
);
msg.append(" unknown\n");
SCP_vector<SCP_string> parsed_asteroids;
#endif
// parse and tally each asteroid
while (required_string_either("#End", "$Name:"))
{
asteroid_info new_asteroid;
asteroid_parse_section(&new_asteroid);
int species = tally / NUM_DEBRIS_SIZES;
if (tally >= max_asteroids)
{
#ifdef NDEBUG
// Bump the warning count in release so they get something
// even if the message never gets displayed.
Warning(LOCATION, "Ignoring extra asteroid/debris");
#else
SCP_string msg("Ignoring extra asteroid/debris '");
msg.append(new_asteroid.name);
msg.append("'\n");
Warning(LOCATION, "%s", msg.c_str());
parsed_asteroids.push_back(msg);
#endif
}
parsed_asteroids.push_back(msg);
#endif
Asteroid_info.push_back(new_asteroid);
}
tally++;
}
required_string("#End");
if (tally != max_asteroids)
{
else
{
#ifndef NDEBUG
for(SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
iter != parsed_asteroids.end(); ++iter)
{
mprintf(("Asteroid.tbl as parsed:\n"));
mprintf((iter->c_str()));
SCP_string msg;
msg.append("Parsing asteroid: '");
msg.append(new_asteroid.name);
msg.append("' as a '");
msg.append((species == 0) ? "generic" : Species_info[species - 1].species_name);
msg.append("'");
switch (tally % NUM_DEBRIS_SIZES) {
case ASTEROID_TYPE_SMALL:
msg.append(" small\n");
break;
case ASTEROID_TYPE_MEDIUM:
msg.append(" medium\n");
break;
case ASTEROID_TYPE_LARGE:
msg.append(" large\n");
break;
default:
Error(LOCATION, "Get a coder! Math has broken!\n"
"Important numbers:\n"
"\ttally: %d\n"
"\tNUM_DEBRIS_SIZES: %d\n",
tally, NUM_DEBRIS_SIZES
);
msg.append(" unknown\n");
}
parsed_asteroids.push_back(msg);
#endif
Asteroid_info.push_back(new_asteroid);
}
tally++;
}
required_string("#End");
if (tally != max_asteroids)
{
#ifndef NDEBUG
for (SCP_vector<SCP_string>::iterator iter = parsed_asteroids.begin();
iter != parsed_asteroids.end(); ++iter)
{
mprintf(("Asteroid.tbl as parsed:\n"));
mprintf(("%s", iter->c_str()));
}
#endif
Error(LOCATION,
"Found %d asteroids/debris when %d expected\n\n"
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
"%d = %d*%d + %d\n\n"
Error(LOCATION,
"Found %d asteroids/debris when %d expected\n\n"
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
"%d = " SIZE_T_ARG "*%d + %d\n\n"
#ifdef NDEBUG
"Run a debug build to see a list of all parsed asteroids\n",
"Run a debug build to see a list of all parsed asteroids\n",
#else
"See the debug.log for a listing of all parsed asteroids\n",
"See the debug.log for a listing of all parsed asteroids\n",
#endif
tally, max_asteroids,
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
);
tally, max_asteroids,
NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES,
max_asteroids, Species_info.size(), NUM_DEBRIS_SIZES, NUM_DEBRIS_SIZES
);
}
Asteroid_impact_explosion_ani = -1;
required_string("$Impact Explosion:");
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
if (VALID_FNAME(impact_ani_file)) {
int num_frames;
Asteroid_impact_explosion_ani = bm_load_animation(impact_ani_file, &num_frames, NULL, NULL, 1);
}
required_string("$Impact Explosion Radius:");
stuff_float(&Asteroid_impact_explosion_radius);
if (optional_string("$Briefing Icon Closeup Model:")) {
stuff_string(Asteroid_icon_closeup_model, F_NAME, NAME_LENGTH);
}
else {
strcpy_s(Asteroid_icon_closeup_model, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]); // magic file from retail
}
if (optional_string("$Briefing Icon Closeup Position:")) {
stuff_vec3d(&Asteroid_icon_closeup_position);
}
else {
vm_vec_make(&Asteroid_icon_closeup_position, 0.0f, 0.0f, -334.0f); // magic numbers from retail
}
if (optional_string("$Briefing Icon Closeup Zoom:")) {
stuff_float(&Asteroid_icon_closeup_zoom);
}
else {
Asteroid_icon_closeup_zoom = 0.5f; // magic number from retail
}
}
Asteroid_impact_explosion_ani = -1;
required_string("$Impact Explosion:");
stuff_string(impact_ani_file, F_NAME, MAX_FILENAME_LEN);
if ( VALID_FNAME(impact_ani_file) ) {
int num_frames;
Asteroid_impact_explosion_ani = bm_load_animation( impact_ani_file, &num_frames, NULL, NULL, 1);
}
required_string("$Impact Explosion Radius:");
stuff_float(&Asteroid_impact_explosion_radius);
if (optional_string("$Briefing Icon Closeup Model:")) {
stuff_string(Asteroid_icon_closeup_model, F_NAME, NAME_LENGTH);
} else {
strcpy_s(Asteroid_icon_closeup_model, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]); // magic file from retail
}
if (optional_string("$Briefing Icon Closeup Position:")) {
stuff_vec3d(&Asteroid_icon_closeup_position);
} else {
vm_vec_make(&Asteroid_icon_closeup_position, 0.0f, 0.0f, -334.0f); // magic numbers from retail
}
if (optional_string("$Briefing Icon Closeup Zoom:")) {
stuff_float(&Asteroid_icon_closeup_zoom);
} else {
Asteroid_icon_closeup_zoom = 0.5f; // magic number from retail
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "asteroid.tbl", e.what()));
return;
}
}
+8 -5
View File
@@ -12,13 +12,14 @@
#ifndef __ASTEROID_H__
#define __ASTEROID_H__
#include "globalincs/pstypes.h"
#include "globalincs/globals.h" // for NAME_LENGTH
#include "globalincs/pstypes.h"
class object;
class polymodel;
struct collision_info_struct;
class draw_list;
#define MAX_ASTEROIDS 512
@@ -97,6 +98,7 @@ public:
typedef struct asteroid {
int flags;
int objnum;
int model_instance_num;
int asteroid_type; // 0..MAX_DEBRIS_TYPES
int asteroid_subtype; // Index in asteroid_info for modelnum and modelp
int check_for_wrap; // timestamp to check for asteroid wrapping around field
@@ -150,12 +152,13 @@ void asteroid_init();
void asteroid_level_init();
void asteroid_level_close();
void asteroid_create_all();
void asteroid_render( object *asteroid_objp );
void asteroid_render_DEPRECATED( object *asteroid_objp );
void asteroid_render(object * obj, draw_list *scene);
void asteroid_delete( object *asteroid_objp );
void asteroid_process_pre( object *asteroid_objp, float frame_time);
void asteroid_process_post( object *asteroid_objp, float frame_time);
void asteroid_process_pre( object *asteroid_objp );
void asteroid_process_post( object *asteroid_objp);
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL );
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage );
void asteroid_hit( object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage );
int asteroid_count();
int asteroid_collide_objnum(object *asteroid_objp);
float asteroid_time_to_impact(object *asteroid_objp);
+75 -74
View File
@@ -5,28 +5,28 @@
#include "autopilot/autopilot.h"
#include "ai/ai.h"
#include "ai/aigoals.h"
#include "ship/ship.h"
#include "object/object.h"
#include "object/objcollide.h"
#include "object/waypoint.h"
#include "parse/sexp.h"
#include "asteroid/asteroid.h"
#include "autopilot/autopilot.h"
#include "camera/camera.h"
#include "cfile/cfile.h"
#include "freespace2/freespace.h"
#include "gamesnd/eventmusic.h"
#include "globalincs/def_files.h"
#include "globalincs/linklist.h"
#include "iff_defs/iff_defs.h"
#include "sound/audiostr.h"
#include "mission/missiontraining.h"
#include "mission/missionmessage.h"
#include "io/timer.h"
#include "gamesnd/eventmusic.h"
#include "cfile/cfile.h"
#include "parse/parselo.h"
#include "globalincs/def_files.h"
#include "localization/localize.h"
#include "camera/camera.h"
#include "asteroid/asteroid.h"
#include "mission/missionmessage.h"
#include "mission/missiontraining.h"
#include "object/objcollide.h"
#include "object/waypoint.h"
#include "parse/parselo.h"
#include "parse/sexp.h"
#include "ship/ship.h"
#include "sound/audiostr.h"
#include <map>
// Extern functions/variables
@@ -243,9 +243,9 @@ bool StartAutopilot()
if (shipp->team != Player_ship->team)
continue;
Assertion((shipp->ship_info_index >= 0) && (shipp->ship_info_index < MAX_SHIP_CLASSES),
Assertion((shipp->ship_info_index >= 0) && (shipp->ship_info_index < static_cast<int>(Ship_info.size())),
"Ship '%s' does not have a valid pointer to a ship class. Pointer is %d, which is smaller than 0 or bigger than %d",
shipp->ship_name, shipp->ship_info_index, MAX_SHIP_CLASSES);
shipp->ship_name, shipp->ship_info_index, static_cast<int>(Ship_info.size()));
ship_info *sip = &Ship_info[shipp->ship_info_index];
if ( !(sip->flags & SIF_SUPPORT) )
@@ -1271,68 +1271,69 @@ void NavSystem_Init()
void parse_autopilot_table(char *filename)
{
int rval;
SCP_vector<SCP_string> lines;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default autopilot.tbl>", rval));
if (filename == NULL)
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
required_string("#Autopilot");
// autopilot link distance
required_string("$Link Distance:");
stuff_int(&NavLinkDistance);
if (optional_string("$Interrupt autopilot if enemy within distance:"))
stuff_int(&AutopilotMinEnemyDistance);
else
AutopilotMinEnemyDistance = 5000;
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
stuff_int(&AutopilotMinAsteroidDistance);
else
AutopilotMinAsteroidDistance = 1000;
if (optional_string("$Lock Weapons During Autopilot:"))
stuff_boolean(&LockWeaponsDuringAutopilot);
else
LockWeaponsDuringAutopilot = false;
// optional no cutscene bars
if (optional_string("+No_Cutscene_Bars"))
UseCutsceneBars = false;
// optional no cutscene bars
if (optional_string("+No_Autopilot_Interrupt"))
Cmdline_autopilot_interruptable = 0;
// No Nav selected message
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:",
"$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:",
"$Support Present:", "$Support Working:" };
for (int i = 0; i < NP_NUM_MESSAGES; i++)
{
required_string(msg_tags[i]);
required_string("+Msg:");
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
required_string("+Snd File:");
stuff_string(NavMsgs[i].filename, F_NAME, 256);
}
required_string("#END");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default autopilot.tbl>", e.what()));
return;
}
if (filename == NULL)
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
required_string("#Autopilot");
// autopilot link distance
required_string("$Link Distance:");
stuff_int(&NavLinkDistance);
if (optional_string("$Interrupt autopilot if enemy within distance:"))
stuff_int(&AutopilotMinEnemyDistance);
else
AutopilotMinEnemyDistance = 5000;
if (optional_string("$Interrupt autopilot if asteroid within distance:"))
stuff_int(&AutopilotMinAsteroidDistance);
else
AutopilotMinAsteroidDistance = 1000;
if (optional_string("$Lock Weapons During Autopilot:"))
stuff_boolean(&LockWeaponsDuringAutopilot);
else
LockWeaponsDuringAutopilot = false;
// optional no cutscene bars
if (optional_string("+No_Cutscene_Bars"))
UseCutsceneBars = false;
// optional no cutscene bars
if (optional_string("+No_Autopilot_Interrupt"))
Cmdline_autopilot_interruptable = 0;
// No Nav selected message
char *msg_tags[] = { "$No Nav Selected:", "$Gliding:",
"$Too Close:", "$Hostiles:", "$Linked:", "$Hazard:",
"$Support Present:", "$Support Working:" };
for (int i = 0; i < NP_NUM_MESSAGES; i++)
{
required_string(msg_tags[i]);
required_string("+Msg:");
stuff_string(NavMsgs[i].message, F_MESSAGE, 256);
required_string("+Snd File:");
stuff_string(NavMsgs[i].filename, F_NAME, 256);
}
required_string("#END");
}
+1
View File
@@ -9,6 +9,7 @@
#include "globalincs/pstypes.h"
#include "object/object.h"
#include <map>
// milliseconds between updates
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/**
* @file bm_examples.cpp
* This file contains example code for using bmpman.
*/
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
void bm_create_example() {
static int test_inited = 0;
static int test_bmp;
static uint test_bmp_data[128 * 64];
if (!test_inited) {
test_inited = 1;
// Create the new bitmap and fill in its data.
// When you're done with it completely, call
// bm_release to free up the bitmap handle
test_bmp = bm_create(32, 128, 64, test_bmp_data);
int i, j;
for (i = 0; i < 64; i++) {
for (j = 0; j < 64; j++) {
uint r = i * 4;
test_bmp_data[j + i * 128] = r;
}
}
}
// page out the data, so that the next bm_lock will convert the new data to
// the correct bpp
bm_unload(test_bmp);
// put in new data
int x, y;
gr_reset_clip();
for (y = 0; y < 64; y++) {
for (x = 0; x < 128; x++) {
test_bmp_data[y * 128 + x] = 15;
}
}
// Draw the bitmap, the upper left corner is the origin (0, 0)
gr_set_bitmap(test_bmp);
gr_bitmap(0, 0);
}
+52 -84
View File
@@ -1,121 +1,91 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef __BM_INTERNAL_H__
#define __BM_INTERNAL_H__
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/**
* @file bm_internal.h
* These are functions and types used by bmpman and a few others.
*
* @details It is a "protected" header that requires BMPMAN_INTERNAL to be defined before it can be included. This is to
* provide a small measure of safety since this functions can cause problems if not used correctly
*/
// extra check to make sure this stuff doesn't end up in normal files
// don't use any of this unless BMPMAN_INTERNAL is defined
#ifdef BMPMAN_INTERNAL
#ifndef BMPMAN_INTERNAL
#error The file header "bmpman/bm_internal.h" is protected. Make sure you know what you are doing!
#endif
#include "globalincs/pstypes.h"
#include "bmpman/bmpman.h"
// no-type ( used in: bm_bitmaps[i].type )
#define BM_TYPE_NONE 0
// in-memory type ( used in: bm_bitmaps[i].type )
#define BM_TYPE_USER 1
// file-type types ( used in: bm_bitmaps[i].type )
#define BM_TYPE_PCX 2
#define BM_TYPE_TGA 3 // 16 or 32 bit targa
#define BM_TYPE_DDS 4 // generic identifier for DDS
#define BM_TYPE_PNG 5 // PNG
#define BM_TYPE_JPG 6 // 32 bit jpeg
#define BM_TYPE_ANI 7 // in-house ANI format
#define BM_TYPE_EFF 8 // specifies any type of animated image, the EFF itself is just text
// c-type types ( used in: bm_bitmaps[i].c_type )
#define BM_TYPE_DXT1 9 // 24 bit with switchable alpha (compressed)
#define BM_TYPE_DXT3 10 // 32 bit with 4 bit alpha (compressed)
#define BM_TYPE_DXT5 11 // 32 bit with 8 bit alpha (compressed)
#define BM_TYPE_CUBEMAP_DDS 12 // generic DDS cubemap (uncompressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT1 13 // 24-bit cubemap (compressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT3 14 // 32-bit cubemap (compressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT5 15 // 32-bit cubemap (compressed cubemap surface)
// special types ( used in: bm_bitmaps[i].type )
#define BM_TYPE_RENDER_TARGET_STATIC 16 // 24/32 bit setup internally as a static render target
#define BM_TYPE_RENDER_TARGET_DYNAMIC 17 // 24/32 bit setup internally as a dynamic render target
/// Moved from cpp file ///////////////////
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
typedef union bm_extra_info {
union bm_extra_info {
struct {
// Stuff needed for animations
int first_frame; // used for animations -- points to index of first frame
int num_frames; // used for animation -- number of frames in the animation
int keyframe; // used for animation -- keyframe info
ubyte fps; // used for animation -- frames per second
int first_frame; //!< used for animations -- points to index of first frame
int num_frames; //!< used for animations -- number of frames in the animation
int keyframe; //!< used for animations -- keyframe info
ubyte fps; //!< used for animations -- frames per second
struct {
// stuff for static animations
ubyte type; // type for individual images
char filename[MAX_FILENAME_LEN]; // filename for individual images
BM_TYPE type; //!< type for individual images
char filename[MAX_FILENAME_LEN]; //!< filename for individual images
} eff;
} ani;
struct {
// Stuff needed for user bitmaps
void *data; // For user bitmaps, this is where the data comes from
ubyte bpp; // For user bitmaps, this is what format the data is
ubyte flags; // Flags passed to bm_create
void* data; //!< For user bitmaps, this is where the data comes from
ubyte bpp; //!< For user bitmaps, this is what format the data is
ubyte flags; //!< For user bitmaps, Flags passed to bm_create
} user;
} bm_extra_info;
};
typedef struct bitmap_entry {
struct bitmap_entry {
// identification
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
char filename[MAX_FILENAME_LEN]; //!< filename for this bitmap
uint signature; // a unique signature identifying the data
uint palette_checksum; // checksum used to be sure bitmap is in current palette
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
int last_used; // When this bitmap was last used
uint signature; //!< a unique signature identifying the data
uint palette_checksum; //!< checksum used to be sure bitmap is in current palette
int handle; //!< Handle = id*MAX_BITMAPS + bitmapnum
int last_used; //!< When this bitmap was last used
ubyte type; // PCX, USER, ANI, etc
ubyte comp_type; // What sort of compressed type, BM_TYPE_NONE if not compressed
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
BM_TYPE type; //!< PCX, USER, ANI, etc
BM_TYPE comp_type; //!< What sort of compressed type, BM_TYPE_NONE if not compressed
signed char ref_count; //!< Number of locks on bitmap. Can't unload unless ref_count is 0.
int dir_type; // which directory this was loaded from (to skip other locations with same name)
int dir_type; //!< which directory this was loaded from (to skip other locations with same name)
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; // number of mipmap levels, we need to read all of them
size_t mem_taken; //!< How much memory does this bitmap use? - UnknownPlayer
int num_mipmaps; //!< number of mipmap levels, we need to read all of them
// Stuff to keep track of usage
ubyte preloaded; // If set, then this was loaded from the lst file
int preload_count; // how many times this gets used in game, for unlocking
ubyte used_flags; // What flags it was accessed thru
int load_count;
ubyte preloaded; //!< If set, then this was loaded from the lst file
int preload_count; //!< how many times this gets used in game, for unlocking
ubyte used_flags; //!< What flags it was accessed thru
int load_count;
// Bitmap info
bitmap bm;
bitmap bm; //!< Bitmap info
// Data for animations and user bitmaps
bm_extra_info info;
bm_extra_info info; //!< Data for animations and user bitmaps
#ifdef BMPMAN_NDEBUG
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
#endif
} bitmap_entry;
};
extern bitmap_entry bm_bitmaps[MAX_BITMAPS];
// image specific lock functions
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
@@ -126,6 +96,4 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
#endif // BMPMAN_INTERNAL
#endif // __BM_INTERNAL_H__
+2726 -2577
View File
File diff suppressed because it is too large. Load diff
+590 -204
View File
@@ -1,288 +1,674 @@
#ifndef _BMPMAN_H
#define _BMPMAN_H
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
*/
/**
* @file bmpman.h
* Header file for the bitmap manager (bmpman)
*/
/**
* @example bm_examples.cpp
* @brief This containes examples of bmpman usage
*/
#ifndef _BMPMAN_H
#define _BMPMAN_H
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
#ifndef NDEBUG
#define BMPMAN_NDEBUG
#define BMPMAN_NDEBUG //!< Enables BMPMAN debugging code
#endif
#define MAX_BITMAPS 4750 // How many bitmaps the game can handle
// NOTE: MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's
// proper use even the largest missions should stay under this number. With the largest retail
// missions and wasteful content we should still have about 20% of the slots free. If it still
// goes over then it's something the artists need to fix. For instance the Terran Mara fighter,
// with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone. 111 of those is
// just for the glowmaps. This number can be greatly reduced if the number of ani frames for
// another LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little
// more than a waste of resources. Future reports of texture corruption should be initially
// approached with content as the cause and not code. If anything we could/should reduce
// MAX_BITMAPS in the future. Where it's at now should accomidate even the largest mods.
// -- Taylor
/**
* @defgroup BMPMAN_CONSTANTS Macro constants used in/with bmpman.h
*
* @{
*/
/**
* @brief How many bitmaps the game can handle
*
* @attention MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's proper use even the
* largest missions should stay under this number. With the largest retail missions and wasteful content we should
* still have about 20% of the slots free. If it still goes over then it's something the artists need to fix.
* For instance the Terran Mara fighter, with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone.
* 111 of those is just for the glowmaps. This number can be greatly reduced if the number of ani frames for another
* LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little more than a waste of resources.
* Future reports of texture corruption should be initially approached with content as the cause and not code.
* If anything we could/should reduce MAX_BITMAPS in the future. Where it's at now should accomidate even the
* largest mods. -- Taylor
*/
#define MAX_BITMAPS 4750
#define BMP_AABITMAP (1<<0) // antialiased bitmap
#define BMP_TEX_XPARENT (1<<1) // transparent texture
#define BMP_TEX_OTHER (1<<2) // so we can identify all "normal" textures
#define BMP_TEX_DXT1 (1<<3) // dxt1 compressed 8r8g8b1a (24bit)
#define BMP_TEX_DXT3 (1<<4) // dxt3 compressed 8r8g8b4a (32bit)
#define BMP_TEX_DXT5 (1<<5) // dxt5 compressed 8r8g8b8a (32bit)
#define BMP_TEX_CUBEMAP (1<<6) // a texture made for cubic environment map
// Flag positions for bitmap.flags
// ***** NOTE: bitmap.flags is an 8-bit value, no more BMP_TEX_* flags can be added unless the type is changed!! ******
#define BMP_AABITMAP (1<<0) //!< antialiased bitmap
#define BMP_TEX_XPARENT (1<<1) //!< transparent texture
#define BMP_TEX_OTHER (1<<2) //!< so we can identify all "normal" textures
#define BMP_TEX_DXT1 (1<<3) //!< dxt1 compressed 8r8g8b1a (24bit)
#define BMP_TEX_DXT3 (1<<4) //!< dxt3 compressed 8r8g8b4a (32bit)
#define BMP_TEX_DXT5 (1<<5) //!< dxt5 compressed 8r8g8b8a (32bit)
#define BMP_TEX_CUBEMAP (1<<6) //!< a texture made for cubic environment map
//compressed texture types
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
// Combined flags
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 ) //!< Compressed textures
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER ) //!< Non-compressed textures
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP ) //!< Any texture
//non compressed textures
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER )
// Flag positions for bitmap.type
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0) //!< Texture is a static type
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1) //!< Texture is a dynamic type (animation)
#define BMP_FLAG_CUBEMAP (1<<2) //!< Texture is a cubemap
// any texture type
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
// Bitmap types
enum BM_TYPE
{
BM_TYPE_NONE = 0, //!< No type
BM_TYPE_USER, //!< in-memory
BM_TYPE_PCX, //!< PCX
BM_TYPE_TGA, //!< 16 or 32 bit targa
BM_TYPE_DDS, //!< generic identifier for DDS
BM_TYPE_PNG, //!< PNG
BM_TYPE_JPG, //!< 32 bit jpeg
BM_TYPE_ANI, //!< in-house ANI format
BM_TYPE_EFF, //!< specifies any type of animated image, the EFF itself is just text
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0)
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1)
#define BMP_FLAG_CUBEMAP (1<<2)
// special types
BM_TYPE_RENDER_TARGET_STATIC, //!< 24/32 bit setup internally as a static render target
BM_TYPE_RENDER_TARGET_DYNAMIC, //!< 24/32 bit setup internally as a dynamic render target
typedef struct bitmap {
short w, h; // Width and height
short rowsize; // What you need to add to go to next row
ubyte bpp; // How many bits per pixel it is. (7,8,15,16,24,32) (what is requested)
ubyte true_bpp; // How many bits per pixel the image actually is.
ubyte flags; // See the BMP_???? defines for values (this isn't for the BMP_FLAG_* stuff)
ptr_u data; // Pointer to data, or maybe offset into VRAM.
ubyte *palette; // If bpp==8, this is pointer to palette. If the BMP_NO_PALETTE_MAP flag
// is not set, this palette just points to the screen palette. (gr_palette)
} bitmap;
// Compressed types (bitmap.c_type)
BM_TYPE_DXT1, //!< 24 bit with switchable alpha
BM_TYPE_DXT3, //!< 32 bit with 4 bit alpha
BM_TYPE_DXT5, //!< 32 bit with 8 bit alpha
BM_TYPE_CUBEMAP_DDS, //!< generic DDS cubemap (uncompressed cubemap surface)
BM_TYPE_CUBEMAP_DXT1, //!< 24-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT3, //!< 32-bit cubemap (compressed cubemap surface)
BM_TYPE_CUBEMAP_DXT5 //!< 32-bit cubemap (compressed cubemap surface)
};
/**
* @}
*/
extern int Bm_paging;
struct bitmap
{
short w; //!< Width, in number of pixels
short h; //!< Height, in number of pixels
short rowsize; //!< What you need to add to go to next row
ubyte bpp; //!< Requested bitdepth of each pixel. ( 7, 8, 15, 16, 24, 32)
ubyte true_bpp; //!< The image's actual bitdepth
ubyte flags; //!< Various texture type flags. @see BMPMAN_CONSTANTS
ptr_u data; //!< Pointer to data, or maybe offset into VRAM.
ubyte *palette; /**< @brief Pointer to this bitmap's palette (if it has one).
* @details If BMP_NO_PALETTE_MAP flag is cleared, this palette just points to the screen palette. (gr_palette)
*/
};
extern int bm_texture_ram; //!< how many bytes of textures are used.
extern int Bm_paging; //!< Bool type that indicates if BMPMAN is currently paging.
extern const BM_TYPE bm_type_list[]; //!< List of valid bitmap types
extern const char *bm_ext_list[]; //!< List of extensions for those types
extern const int BM_NUM_TYPES; //!< Calculated number of bitmap types
extern const BM_TYPE bm_ani_type_list[]; //!< List of valid bitmap animation types
extern const char *bm_ani_ext_list[]; //!< List of extensions for those types
extern const int BM_ANI_NUM_TYPES; //!< Calculated number of bitmap animation types
extern int GLOWMAP; //!< References a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; //!< References a map that is for specular mapping -Bobboau
extern int ENVMAP; //!< References a map that is for environment mapping -Bobboau
extern int NORMMAP; //!< Normal mapping
extern int HEIGHTMAP; //!< Height map for normal mapping
extern int MISCMAP; //!< Utility map, to be utilized for various things shader authors can come up with
/**
* @brief Initilizes the bitmap manager
*/
void bm_init();
/**
* @brief Closes the bitmap manager, freeing any allocated memory used by bitmaps. Is called at program close.
*/
void bm_close();
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
/**
* Gets the cache slot of the bitmap indexed by handle.
*
* @details if the bitmap is an ani, gets the first frame
*
* @returns The cache slot index of the bitmap if handle is valid
*
* @note If the handle is invalid, an Assert() fails
*/
int bm_get_cache_slot(int bitmap_id, int separate_ani_frames);
/**
* @brief Gets the next available bitmap slot.
*/
int bm_get_next_handle();
void *bm_malloc(int n, int size);
/**
* @brief Allocates memory for the given handle.
*
* @returns A pointer to the allocated vm if successful,
* @returns Null, if unsuccessful
*
* @note z64 - This function looks fishy. Not only is handle not used in release builds, but bm_bitmaps[handle].size
* and bm_texture_size aren't modified unless this is a debug build
*/
void *bm_malloc(int handle, int size);
/**
* @brief (DEBUG) Similar to bm_malloc, but only updates how much memory is used
*
* @note z64 - Also fishy (see bm_malloc)
*/
void bm_update_memory_used(int n, int size);
// how many bytes of textures are used.
extern int bm_texture_ram;
class bitmap_lookup {
ubyte *Bitmap_data;
// This loads a bitmap so we can draw with it later.
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number.
int Width;
int Height;
int Num_channels;
float map_texture_address(float address);
public:
bitmap_lookup(int bitmap_num);
~bitmap_lookup();
bool valid();
float get_channel_red(float u, float v);
float get_channel_green(float u, float v);
float get_channel_blue(float u, float v);
float get_channel_alpha(float u, float v);
};
/**
* @brief Loads a bitmap so we can draw with it later.
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
int bm_load(const char* filename);
/**
* @brief Loads a bitmap so we can draw with it later. (Preferred version)
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
int bm_load(const SCP_string& filename);
// special load function. basically allows you to load a bitmap which already exists (by filename).
// this is useful because in some cases we need to have a bitmap which is locked in screen format
// _and_ texture format, such as pilot pics and squad logos
/**
* @brief Reloads a bitmap as a duplicate.
*
* @details This function basically allows you to load a bitmap which already exists (by filename). This is useful
* because in some cases we need to have a bitmap which is locked in screen format _and_ texture format, such as
* the pilot pics and squad logos
*
* @param filename
*
* @returns The bitmap number if successful, else
* @returns a negative value if not
*/
int bm_load_duplicate(const char *filename);
// Creates a bitmap that exists in RAM somewhere, instead
// of coming from a disk file. You pass in a pointer to a
// block of data. The data can be in the following formats:
// 8 bpp (mapped into game palette)
// 32 bpp
// On success, it returns the bitmap number. You cannot
// free that RAM until bm_release is called on that bitmap.
// See example at bottom of this file
int bm_create( int bpp, int w, int h, void *data = NULL, int flags = 0);
/**
* Loads a bitmap which exists somewhere in the RAM.
*
* @param bpp The bitdepth of the bitmap
* @param w The width of the bitmap
* @param h The height of the bitmap
* @param[in] data The bitmap's data glob
* @param flags
*
* @note The used RAM cannot be freed until bm_release is called on the created bitmap
*/
int bm_create(int bpp, int w, int h, void *data = NULL, int flags = 0);
// Frees up a bitmap's data, but bitmap number 'n' can
// still be used, it will just have to be paged in next
// time it is locked.
int bm_unload( int n, int clear_render_targets = 0, bool nodebug = false);
/**
* @brief Unloads a bitmap's data, but not the bitmap info
*
* @details The bm number (n) may be reused once this function has been called on it. However, it will have to be paged
* in the next time it is locked.
// like bm_unload() except that it's safe to use to free data without worrying about
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
int bm_unload_fast( int n, int clear_render_targets = 0 );
* @param handle The index number of the bitmap to free
* @param clear_render_targets If true, release a render target
* @param nodebug If true, exclude certain debug messages
*
* @returns 0 if not successful,
* @returns 1 if successful
*/
int bm_unload(int handle, int clear_render_targets = 0, bool nodebug = false);
// Frees up a bitmap's data, and it's slot, so bitmap
// number 'n' cannot be used anymore, and bm_load or
// bm_create might reuse the slot.
int bm_release( int n, int clear_render_targets = 0 );
/**
* @brief Quickly unloads a bitmap's data, ignoring the load_count
*
* @details Similar to bm_unload(), except that it can be safely used to free data without worrying about load_count.
* It's safe to use in relation to bm_release() and in gr_*_texture functions
*
* @param handle The bm number of the bitmap to free
* @param clear_render_targets If true, release a render target
*
* @note bm_free_data_fast() is used here and NOT bm_free_data()
*/
int bm_unload_fast(int handle, int clear_render_targets = 0);
// This loads a bitmap sequence so we can draw with it later.
// It returns a negative number if it couldn't load
// the bitmap. On success, it returns the bitmap
// number of the first frame and nframes is set.
extern int bm_load_animation( const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
/**
* @brief Frees both a bitmap's data and it's associated slot.
*
* @details Once called, the bm number 'n' cannot be used until bm_load or bm_create is re-inits the slot.
*
* @param handle The index number of the bitmap to release
* @param clear_render_targets If nonzero, also release render targets
*
* @returns 1 on success,
* @returns 0 otherwise
*
* @note If the passed handle is that of an ANI, it frees EVERY frame. Be sure to only pass the handle of the first frame!
*
* @todo upgrade return type and clear_render_targets type to bools
*/
int bm_release(int handle, int clear_render_targets = 0);
//Loads either animation (bm_load_animation) or still image (bm_load)
extern int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
/**
* @brief Loads a bitmap sequance so we can draw with it.
*
* @param[in] filename
* @param[out] nframes If non-null, set to the number of frames the animation has
* @param[out] fps If non-null, set to the fps of this animation
* @param[out] keyframe if non null, set to the keyframe index of this animation
* @param[in] can_drop_frames If set, allows dropped frames
* @param[in] dir_type Directory type
*
* @returns The bm number of the first bitmap in the sequence if successful, or
* @returns A negative value if unsuccessful
*/
int bm_load_animation(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
// This locks down a bitmap and returns a pointer to a bitmap
// that can be accessed until you call bm_unlock. Only lock
// a bitmap when you need it! This will convert it into the
// appropriate format also.
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags, bool nodebug = false);
/**
* @brief Loads either animation (bm_load_animation) or still image (bm_load)
*
* @param[in] filename
* @param[out] nframes If non-null and loading was successful, set to the number of frames the animation has
* @param[out] fps If non-null and loading was successful, set to the fps of this animation
* @param[out] keyframe if non null and loading was successful, set to the keyframe index of this animation
* @param[in] can_drop_frames
* @param[in] dir_type
*
* @returns The bm number of the first bitmap in the sequence if successful, or
* @returns A negative value if unsuccessful
*/
int bm_load_either(const char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY);
// The signature is a field that gets filled in with
// a unique signature for each bitmap. The signature for each bitmap
// will also change when the bitmap's data changes.
extern uint bm_get_signature( int bitmapnum);
/**
* @brief Locks down the bitmap indexed by bitmapnum.
*
* @details Also converts the bitmap to the appropriate format specified by bpp and flags. Only lock a bitmap when you
* need it!
*
* @param handle The number indexing the desired bitmap
* @param bpp The desired bpp of the bitmep
* @param flags The desired bitmap format
* @param nodebug
//gets the image type
ubyte bm_get_type(int handle);
* @returns A pointer to the bitmap that's valid until bm_unlock is called if successful, or
* @returns NULL if unsuccessful
*/
bitmap* bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug = false);
// Unlocks a bitmap
extern void bm_unlock( int bitmapnum );
/**
* @brief Returns a unique signiature for the bitmap indexed by handle
*
* @details A signature will change when the bitmap's data changes
*/
uint bm_get_signature(int handle);
//WMC - Returns 0 if invalid, nonzero if valid
extern int bm_is_valid(int handle);
/**
* @brief Returns the image type of the given bitmap handle
*/
BM_TYPE bm_get_type(int handle);
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
//WMC - Returns -1 on failure, handle or first frame handle on success.
int bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL );
/**
* @brief Unlocks a bitmap
*
* @details Decrements the ref_count member of the bitmap_entry struct, A bitmap can only be unloaded when the
* ref_count is 0
*/
void bm_unlock(int handle);
// get filename
extern void bm_get_filename(int bitmapnum, char *filename);
/**
* @brief Checks if the bitmap indexed by handle is valid
*
* @details Some early known false or out of range handles (such as negative) are checked within
* an initial routine pass, followed by a more thorough check routine to ensure the
* series of bitmaps within the bm_bitmaps[] structure have not become invalid.
*
* @returns Nonzero if valid, else
* @returns Zero otherwise
*
* @todo z64 - Returned value is essentially a bool type, need to check all caller functions to see if it can safely
* be updated to reflect this
*/
int bm_is_valid(int handle);
// call to load all data for all bitmaps that have been requested to be loaded
extern void bm_gfx_load_all();
extern void bm_unload_all();
/**
* @brief Gets info on the bitmap indexed by handle.
*
* @param[out] w If non-null, gets the width
* @param[out] h If non-null, gets the heigth
* @param[out] flags If non-null, gets the flags
* @param[out] nframs If non-null, gets the nframes
* @param[out] fps If non-null, gets the fps
*
* @returns The handle on success, or
* @returns The handle to the first frame on success, or
* @returns -1 on failure
*/
int bm_get_info(int handle, int *w = NULL, int * h = NULL, ubyte * flags = NULL, int *nframes = NULL, int *fps = NULL);
// call to get the palette for a bitmap
void bm_get_palette(int n, ubyte *pal, char *name);
/**
* @brief Gets the filename of the bitmap indexed by handle
*
* @param[out] filename The filename of the bitmap, if successful. Is set to an empty string if unseccessful
*
* @todo z64 - maybe deprecate this in favor of an SCP_string version
*/
void bm_get_filename(int bitmapnum, char *filename);
// Hacked function to get a pixel from a bitmap.
// Only works good in 8bpp mode.
void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b );
/**
* @brief Gets the filename of the bitmap indexed by handle, which must exist.
*
* @details If the bitmap does not exist (i.e. the handle is invalid), then an Assertion halts program execution.
*
* @returns A const char* to the filename of the bitmap
*
* @todo z64 - maybe deprecate this in favor of an SCP_string version.
* @todo z64 - maybe combine this with the other bm_get_filename function like so:
* void bm_get_filename(int handle, SCP_string *filename, bool must_exist = false);
*/
const char *bm_get_filename(int handle);
// Returns number of bytes of bitmaps locked this frame
// ntotal = number of bytes of bitmaps locked this frame
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
/**
* @brief Loads all data for all bitmaps that have been requested to be loaded
*
* @note This function is not defined.
*/
void bm_gfx_load_all();
/**
* @brief Unloads all used bitmaps, should only ever be called by game_shutdown()
*
* @todo Maybe move this declaration into bmpman.cpp and then extern this function within game_shutdown() to
* ensure it only ever gets called there.
*/
void bm_unload_all();
/**
* @brief Gets the palette for a given bitmap indexed by handle, and optionally the filename
*
* @param[out] pal Is set to reference the bitmap's palette
* @param[out] name (optional) Is set to the bitmap's filename
*
* @todo Maybe get rid of the optional filename and have the callers call bm_get_filename. Less efficient, however.
*/
void bm_get_palette(int handle, ubyte *pal, char *name);
/**
* @brief Hack to get a pixel from a bitmap
*
* @details only works good in 8bpp mode
*
* @note This function is not defined.
*/
void bm_gfx_get_pixel(int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b);
/**
* @brief (DEBUG) Gets memory size, in bytes, of the locked bitmaps
*
* @details Both params are non-optional, and must be non-null. There's currently no safety checks on either.
*
* @param ntotal[out] Memory size, in bytes, of the locked bitmaps
* @param nnew[out] Memory size, in bytes, of the bitmaps that were locked since the last frame
*
* @note This is a debug function, and is undefined within release builds
*/
void bm_get_frame_usage(int *ntotal, int *nnew);
// Reload a different image into an existing bmpman slot
/**
* @brief Reloads an existing bmpman slot with different bitmap
*
* @param[in] filename The filename of the image to load
*
* @returns The bitmap handle on success, or
* @returns A negative value on failure
*
* @note This should only be used if you are certain the new picture is the same type, has same dimensions, etc.
*/
int bm_reload(int bitmap_handle, const char* filename);
/*
* Example on using bm_create
*
{
static int test_inited = 0;
static int test_bmp;
static uint test_bmp_data[128*64];
if ( !test_inited ) {
test_inited = 1;
// Create the new bitmap and fill in its data.
// When you're done with it completely, call
// bm_release to free up the bitmap handle
test_bmp = bm_create( 32, 128, 64, test_bmp_data );
int i,j;
for (i=0; i<64; i++ ) {
for (j=0; j<64; j++ ) {
uint r=i*4;
test_bmp_data[j+i*128] = r;
}
}
}
bm_unload(test_bmp); // this pages out the data, so that the
// next bm_lock will convert the new data to the
// correct bpp
// put in new data
int x,y;
gr_reset_clip();
for (y=0; y<64; y++)
for (x=0; x<128; x++ )
test_bmp_data[y*128+x] = 15;
// Draw the bitmap to upper left corner
gr_set_bitmap(test_bmp);
gr_bitmap( 0,0 );
}
*/
//============================================================================
// Paging stuff
//============================================================================
/**
* @brief Tells bmpman to start keeping track of what bitmaps are used where
*/
void bm_page_in_start();
/**
* @brief Tells bmpman to stop paging (?)
*/
void bm_page_in_stop();
// Paging code in a library should call these functions
// in its page in function.
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_texture( int bitmapnum, int num_frames = 0 );
/**
* @brief Marks a texture as being used for this level
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_texture(int bitmapnum, int num_frames = 0);
// marks a texture as being a transparent textyre used for this level
// Marks a texture as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
/**
* @brief Marks a textures as being used for level and is transparant
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_xparent_texture(int bitmapnum, int num_frames = 1);
// Marks an aabitmap as being used for this level
// If num_frames is passed, assume this is an animation
void bm_page_in_aabitmap( int bitmapnum, int num_frames=1 );
/**
* @brief Marks a texture as being used for this level, and is anti-aliased
*
* @param[in] num_frames If specified, assumes this is an animated texture
*/
void bm_page_in_aabitmap(int bitmapnum, int num_frames = 1);
// unload a texture that was paged in
int bm_page_out( int handle );
/**
* @brief Unloads the bitmap indexed by handle that was previously paged-in
*
* @returns 0 If the bitmap had already been released, or
* @returns 0 If the handle is invalid, or
* @returns 1 If successful
*/
bool bm_page_out(int handle);
//
// Mode: 0 = High memory
// 1 = Low memory ( every other frame of ani's)
// 2 = Debug low memory ( only use first frame of each ani )
void bm_set_low_mem( int mode );
const char *bm_get_filename(int handle);
/**
* @brief Sets BMPMAN's memory mode
*
* @details 0 = High memory;
* 1 = Low memory (loads every other frame of ani's);
* 2 = Debug low memory (only use first frame of each ani)
*
* @todo This should use an enum, or instead allow an arbitrary number to drop frames (like 1/2, 1/3, etc.)
*/
void bm_set_low_mem(int mode);
/**
* @brief Sets bm_set_components and bm_get_components to reference screen format functions
*/
void BM_SELECT_SCREEN_FORMAT();
/**
* @brief Sets bm_set_components and bm_get_components to reference texture format functions
*/
void BM_SELECT_TEX_FORMAT();
/**
* @brief Sets bm_set_components and bm_get_components to reference texture format functions (with alpha)
*/
void BM_SELECT_ALPHA_TEX_FORMAT();
// set the rgba components of a pixel, any of the parameters can be NULL
extern void (*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern void (*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Functional pointer that references any of the bm_set_components functions.
*
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
*
* @param[out] pixel The pixel to set
* @param[in] r Red value (may not be NULL)
* @param[in] g Green value (may not be NULL)
* @param[in] b Blue value (may not be NULL)
* @param[in] a Alpha value (currently ignored)
*
* @note z64 - These functions were made predating the introduction of C++ classes, and are basically the equivalent
* of Pixel::set(ubyte *r, ubyte *b, ubyte *g). The original comment mentions that any of the rgba params may be
* NULL, but this is by far _NOT_ the case, as a NULL value will cause undefined behavior (really really bad chroma
* corruption)
*
* @note These functions assume the incoming bitdepth will always be >= to the outgoing bitdepth of the pixel. Should
* the incoming bitdepth be lower, the outgoing values will appear darker than they should be
*/
extern void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
// get the rgba components of a pixel, any of the parameters can be NULL
/**
* @brief Functional pointer that references any of the bm_set_components_32 functions.
*
* @details The bm_set_components functions packs the RGBA values into the ubyte array referenced by pixel, whose
* format differs according to its bpp value and presence of an alpha channel. The RGBA values are scaled accordingly.
*
* @see bm_set_components
*/
extern void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 16bpp screen pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 32bpp screen pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 16bpp texture pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Sets the 32bpp texture pixel to the specified RGBA value
*
* @see bm_set_components
*/
void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
/**
* @brief Gets the RGBA components of a pixel according to the selected mode
*
* @see BM_SELECT_SCREEN_FORMAT() BM_SELECT_TEX_FORMAT() BM_SELECT_ALPHA_TEX_FORMAT()
*/
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
extern int NORMMAP; // normal mapping
extern int HEIGHTMAP; // height map for normal mapping
extern int MISCMAP; // Utility map, to be utilized for various things shader authors can come up with
/**
* @brief Returns the compression type of the bitmap indexed by handle
*/
int bm_is_compressed(int handle);
int bm_is_compressed(int num);
int bm_get_tcache_type(int num);
int bm_get_size(int num);
int bm_get_num_mipmaps(int num);
int bm_has_alpha_channel(int handle);
/**
* @brief Gets the correct TCACHE_TYPE for compressed graphics (uncompressed are assumed TCACHE_TYPE_NORMAL)
*/
int bm_get_tcache_type(int handle);
/**
* @brief Gets the size, in bytes, taken up by the bitmap indexed by handle
*/
size_t bm_get_size(int handle);
/**
* @brief Gets the number of mipmaps of the indexed texture
*/
int bm_get_num_mipmaps(int handle);
/**
* @brief Checks to see if the indexed bitmap has an alpha channel
*
* @note Currently just checks if the bitmap is 32bpp and is not a .PCX
*/
bool bm_has_alpha_channel(int handle);
/**
* @brief (DEBUG) Prints all loaded bitmaps to an outwindow
*/
void bm_print_bitmaps();
int bm_make_render_target( int width, int height, int flags );
int bm_is_render_target(int bitmap_id);
int bm_set_render_target(int handle, int face = -1);
/**
* @brief Creates a render target as close to the desired resolution as possible.
*
* @returns the handle of an avilable render target if successful, or
* @returns -1 if not successful
*
* @note BM_FLAG_RENDER_TARGET_STATIC are drawn once/infrequently, while BM_FLAG_RENDER_TARGET_DYNAMIC are drawn roughly once every frame
*/
int bm_make_render_target(int width, int height, int flags);
/**
* @brief Checks to see if the given bitmap indexed by handle is a render target
*
* @returns The render type (BM_TYPE) if it is a render target, or
* @returns 0 if it is not
*/
int bm_is_render_target(int handle);
/**
* @brief (GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle
*
* @returns true if successful, or
* @returns false if unsuccessful
*/
bool bm_set_render_target(int handle, int face = -1);
/**
* @brief Loads and parses an .EFF
*
* @param[in] filename The filename of the .EFF
* @param[in] dir_type
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
*
* @returns true If successful
* @returns false If not successful
*/
bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, BM_TYPE *type);
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
#endif
+27 -17
View File
@@ -1,17 +1,15 @@
#include "camera/camera.h"
#include "math/vecmat.h"
#include "graphics/2d.h"
#include "globalincs/alphacolors.h"
#include "parse/parselo.h"
#include "physics/physics.h" //apply_physics
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h" //VM_FREECAMERA etc
#include "graphics/font.h"
#include "hud/hud.h" //hud_get_draw
#include "math/vecmat.h"
#include "mod_table/mod_table.h"
#include "model/model.h" //polymodel, model_get
#include "parse/parselo.h"
#include "playerman/player.h" //player_get_padlock_orient
#include "ship/ship.h" //compute_slew_matrix
#include "graphics/font.h"
#include "mod_table/mod_table.h"
#include "globalincs/linklist.h"
//*************************IMPORTANT GLOBALS*************************
float VIEWER_ZOOM_DEFAULT = 0.75f; // Default viewer zoom, 0.625 as per multi-lateral agreement on 3/24/97
@@ -82,7 +80,7 @@ void camera::reset()
void camera::set_name(char *in_name)
{
if(name != NULL)
if(in_name != NULL)
strncpy(name, in_name, NAME_LENGTH-1);
}
@@ -332,8 +330,10 @@ void camera::get_info(vec3d *position, matrix *orientation)
eyep = get_submodel_eye(pm, object_host_submodel);
if(eyep)
{
Assertion(objp->type == OBJ_SHIP, "This part of the code expects the object to be a ship");
vec3d c_pos_in;
find_submodel_instance_point_normal( &c_pos_in, &host_normal, objp, eyep->parent, &eyep->pnt, &eyep->norm);
find_submodel_instance_point_normal(&c_pos_in, &host_normal, Ships[objp->instance].model_instance_num, eyep->parent, &eyep->pnt, &eyep->norm);
vm_vec_unrotate(&c_pos, &c_pos_in, &objp->orient);
vm_vec_add2(&c_pos, &objp->pos);
}
@@ -540,8 +540,15 @@ void warp_camera::get_info(vec3d *position, matrix *orientation)
//*************************subtitle*************************
#define MAX_SUBTITLE_LINES 64
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time, float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char* in_imageanim, float in_display_time,
float in_fade_time, const color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width,
int in_height, bool in_post_shaded)
:display_time(-1.0f), fade_time(-1.0f), text_fontnum(-1), time_displayed(-1.0f), time_displayed_end(-1.0f),
post_shaded(false)
{
// Initialize color
gr_init_color(&text_color, 0, 0, 0);
SCP_string text_buf;
// basic init, this always has to be done
@@ -646,20 +653,20 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
//Center it?
if(center_x)
image_pos.x = (gr_screen.max_w - tw)/2;
image_pos.x = (gr_screen.center_w - tw)/2 + gr_screen.center_offset_x;
if(center_y)
image_pos.y = (gr_screen.max_h - th)/2;
image_pos.y = (gr_screen.center_h - th)/2 + gr_screen.center_offset_y;
}
if(in_x_pos < 0 && !center_x)
image_pos.x += gr_screen.max_w + in_x_pos;
image_pos.x += gr_screen.center_offset_x + gr_screen.center_w + in_x_pos;
else if(!center_x)
image_pos.x += in_x_pos;
image_pos.x += gr_screen.center_offset_x + in_x_pos;
if(in_y_pos < 0 && !center_y)
image_pos.y += gr_screen.max_h + in_y_pos;
image_pos.y += gr_screen.center_offset_y + gr_screen.center_h + in_y_pos;
else if(!center_y)
image_pos.y += in_y_pos;
image_pos.y += gr_screen.center_offset_y + in_y_pos;
image_pos.w = in_width;
image_pos.h = in_height;
@@ -866,6 +873,9 @@ void cam_close()
{
//Set Current_camera to nothing
Current_camera = camid();
for (auto ii = Cameras.begin(); ii != Cameras.end(); ++ii) {
delete * ii;
}
Cameras.clear();
}
@@ -1078,4 +1088,4 @@ eye* get_submodel_eye(polymodel *pm, int submodel_num)
}
}
return NULL;
}
}
+3 -3
View File
@@ -2,11 +2,11 @@
#ifndef _CAMERA_H
#define _CAMERA_H
#include "graphics/2d.h"
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "physics/physics.h" //for avd
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "object/object.h"
#include "physics/physics.h" //for avd
#include <string>
+59 -27
View File
@@ -29,10 +29,10 @@
#endif
#include "cfile/cfile.h"
#include "parse/encrypt.h"
#include "cfile/cfilesystem.h"
#include "cfile/cfilearchive.h"
#include "cfile/cfilesystem.h"
#include "osapi/osapi.h"
#include "parse/encrypt.h"
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
@@ -105,19 +105,32 @@ const char *Cfile_cdrom_dir = NULL;
// Function prototypes for internally-called functions
//
int cfget_cfile_block();
CFILE *cf_open_fill_cfblock(FILE * fp, int type);
CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size);
CFILE *cf_open_fill_cfblock(const char* source, int line, FILE * fp, int type);
CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size);
#if defined _WIN32
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type);
CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, HANDLE hFile, int type);
#elif defined SCP_UNIX
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type);
CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, FILE *fp, int type);
#endif
void cf_chksum_long_init();
static void dump_opened_files()
{
for (int i = 0; i < MAX_CFILE_BLOCKS; i++) {
auto cb = &Cfile_block_list[i];
if (cb->type != CFILE_BLOCK_UNUSED) {
mprintf((" %s:%d\n", cb->source_file, cb->line_num));
}
}
}
void cfile_close()
{
mprintf(("Still opened files:\n"));
dump_opened_files();
cf_free_secondary_filelist();
}
@@ -161,11 +174,15 @@ int cfile_in_root_dir(const char *exe_path)
return 0;
}
// cfile_init() initializes the cfile system. Called once at application start.
//
// returns: success ==> 0
// error ==> non-zero
//
/**
* Initializes the cfile system. Called once at application start.
*
* @param exe_dir Path to a file (not a directory)
* @param cdrom_dir Path to a CD drive mount point (may be NULL)
*
* @return 0 On success
* @return 1 On error
*/
int cfile_init(const char *exe_dir, const char *cdrom_dir)
{
int i;
@@ -501,7 +518,7 @@ int cf_exists(const char *filename, int dir_type)
if ( (filename == NULL) || !strlen(filename) )
return 0;
return (cf_find_file_location(filename, dir_type, 0, NULL, &offset, NULL) && !offset);
return (cf_find_file_location(filename, dir_type, 0, NULL, NULL, &offset) && !offset);
}
// Goober5000
@@ -627,7 +644,7 @@ extern int game_cd_changed();
// error ==> NULL
//
CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, bool localize)
CFILE *_cfopen(const char* source, int line, const char *file_path, const char *mode, int type, int dir_type, bool localize)
{
/* Bobboau, what is this doing here? 31 is way too short... - Goober5000
if( strlen(file_path) > 31 )
@@ -712,7 +729,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
FILE *fp = fopen(longname, happy_mode);
if (fp) {
return cf_open_fill_cfblock(fp, dir_type);
return cf_open_fill_cfblock(source, line, fp, dir_type);
}
return NULL;
}
@@ -741,12 +758,12 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
hFile = CreateFile(longname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
return cf_open_mapped_fill_cfblock(hFile, dir_type);
return cf_open_mapped_fill_cfblock(source, line, hFile, dir_type);
}
#elif defined SCP_UNIX
FILE *fp = fopen( longname, "rb" );
if (fp) {
return cf_open_mapped_fill_cfblock(fp, dir_type);
return cf_open_mapped_fill_cfblock(source, line, fp, dir_type);
}
#endif
}
@@ -758,10 +775,10 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
if ( fp ) {
if ( offset ) {
// Found it in a pack file
return cf_open_packed_cfblock(fp, dir_type, offset, size );
return cf_open_packed_cfblock(source, line, fp, dir_type, offset, size );
} else {
// Found it in a normal file
return cf_open_fill_cfblock(fp, dir_type);
return cf_open_fill_cfblock(source, line, fp, dir_type);
}
}
}
@@ -782,7 +799,7 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b
// returns: success ==> address of CFILE structure
// error ==> NULL
//
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type)
CFILE *_cfopen_special(const char* source, int line, const char *file_path, const char *mode, const int size, const int offset, int dir_type)
{
if ( !cfile_inited) {
Int3();
@@ -807,10 +824,10 @@ CFILE *cfopen_special(const char *file_path, const char *mode, const int size, c
if ( offset ) {
// it's in a pack file
return cf_open_packed_cfblock(fp, dir_type, offset, size);
return cf_open_packed_cfblock(source, line, fp, dir_type, offset, size);
} else {
// it's a normal file
return cf_open_fill_cfblock(fp, dir_type);
return cf_open_fill_cfblock(source, line, fp, dir_type);
}
}
@@ -829,7 +846,7 @@ CFILE *ctmpfile()
FILE *fp;
fp = tmpfile();
if ( fp )
return cf_open_fill_cfblock(fp, 0);
return cf_open_fill_cfblock(LOCATION, fp, 0);
else
return NULL;
}
@@ -859,7 +876,13 @@ int cfget_cfile_block()
// If we've reached this point, a free Cfile_block could not be found
nprintf(("Warning","A free Cfile_block could not be found.\n"));
Assert(0); // out of free cfile blocks
// Dump a list of all opened files
mprintf(("Out of cfile blocks! Currently opened files:\n"));
dump_opened_files();
Assertion(false, "There are no more free cfile blocks. This means that there are too many files opened by FSO.\n"
"This is probably caused by a programming or scripting error where a file does not get closed."); // out of free cfile blocks
return -1;
}
@@ -937,7 +960,7 @@ int cf_is_valid(CFILE *cfile)
// returns: success ==> ptr to CFILE structure.
// error ==> NULL
//
CFILE *cf_open_fill_cfblock(FILE *fp, int type)
CFILE *cf_open_fill_cfblock(const char* source, int line, FILE *fp, int type)
{
int cfile_block_index;
@@ -956,6 +979,9 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
cfbp->fp = fp;
cfbp->dir_type = type;
cfbp->max_read_len = 0;
cfbp->source_file = source;
cfbp->line_num = line;
int pos = ftell(fp);
if(pos == -1L)
@@ -973,7 +999,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
// returns: success ==> ptr to CFILE structure.
// error ==> NULL
//
CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size)
{
// Found it in a pack file
int cfile_block_index;
@@ -995,6 +1021,9 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
cfbp->dir_type = type;
cfbp->max_read_len = 0;
cfbp->source_file = source;
cfbp->line_num = line;
cf_init_lowlevel_read_code(cfp,offset, size, 0 );
return cfp;
@@ -1010,9 +1039,9 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
// returns: ptr CFILE structure.
//
#if defined _WIN32
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type)
CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, HANDLE hFile, int type)
#elif defined SCP_UNIX
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, FILE *fp, int type)
#endif
{
int cfile_block_index;
@@ -1039,6 +1068,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
#endif
cfbp->dir_type = type;
cfbp->source_file = source;
cfbp->line_num = line;
cf_init_lowlevel_read_code(cfp, 0, 0, 0 );
#if defined _WIN32
cfbp->hMapFile = CreateFileMapping(cfbp->hInFile, NULL, PAGE_READONLY, 0, 0, NULL);
+6 -3
View File
@@ -114,7 +114,6 @@ extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
#endif
//================= LOW-LEVEL FUNCTIONS ==================
// Call this once at the beginning of the program
int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL);
// Call this if pack files got added or removed or the
@@ -130,11 +129,15 @@ int cf_get_dir_type(CFILE *cfile);
// Opens the file. If no path is given, use the extension to look into the
// default path. If mode is NULL, delete the file.
CFILE *cfopen(const char *filename, const char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
CFILE *_cfopen(const char* source_file, int line, const char *filename, const char *mode,
int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
#define cfopen(...) _cfopen(LOCATION, __VA_ARGS__) // Pass source location to the function
// like cfopen(), but it accepts a fully qualified path only (ie, the result of a cf_find_file_location() call)
// NOTE: only supports reading files!!
CFILE *cfopen_special(const char *file_path, const char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
CFILE *_cfopen_special(const char* source_file, int line, const char *file_path, const char *mode,
const int size, const int offset, int dir_type = CF_TYPE_ANY);
#define cfopen_special(...) _cfopen_special(LOCATION, __VA_ARGS__) // Pass source location to the function
// Flush the open file buffer
int cflush(CFILE *cfile);
+3
View File
@@ -39,6 +39,9 @@ typedef struct Cfile_block {
int size; // for packed files
size_t max_read_len; // max read offset, for special error handling
const char* source_file;
int line_num;
} Cfile_block;
#define MAX_CFILE_BLOCKS 64
+1 -1
View File
@@ -22,8 +22,8 @@
#include <winbase.h> /* needed for memory mapping of file functions */
#endif
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_list_info> *info )
+17 -15
View File
@@ -9,13 +9,12 @@
#include "globalincs/pstypes.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sstream>
#include <algorithm>
#ifdef _WIN32
#include <io.h>
@@ -33,13 +32,13 @@
#include <unistd.h>
#endif
#include "cmdline/cmdline.h"
#include "cfile/cfile.h"
#include "cfile/cfilesystem.h"
#include "cmdline/cmdline.h"
#include "globalincs/pstypes.h"
#include "localization/localize.h"
#define CF_ROOTTYPE_PATH 0
#define CF_ROOTTYPE_PACK 1
@@ -220,19 +219,15 @@ int cf_get_packfile_count(cf_root *root)
}
// packfile sort function
int cf_packfile_sort_func(const void *elem1, const void *elem2)
bool cf_packfile_sort_func(const cf_root_sort &r1, const cf_root_sort &r2)
{
cf_root_sort *r1, *r2;
r1 = (cf_root_sort*)elem1;
r2 = (cf_root_sort*)elem2;
// if the 2 directory types are the same, do a string compare
if(r1->cf_type == r2->cf_type){
return stricmp(r1->path, r2->path);
if (r1.cf_type == r2.cf_type) {
return (stricmp(r1.path, r2.path) < 0);
}
// otherwise return them in order of CF_TYPE_* precedence
return (r1->cf_type < r2->cf_type) ? -1 : 1;
return (r1.cf_type < r2.cf_type);
}
// Go through a root and look for pack files
@@ -341,7 +336,7 @@ void cf_build_pack_list( cf_root *root )
Assert(root_index == temp_root_count);
// sort the roots
qsort(temp_roots_sort, temp_root_count, sizeof(cf_root_sort), cf_packfile_sort_func);
std::sort(temp_roots_sort, temp_roots_sort + temp_root_count, cf_packfile_sort_func);
// now insert them all into the real root list properly
cf_root *new_root;
@@ -670,7 +665,11 @@ void cf_search_root_pack(int root_index)
VP_FILE_HEADER VP_header;
Assert( sizeof(VP_header) == 16 );
fread(&VP_header, 1, sizeof(VP_header), fp);
if (fread(&VP_header, sizeof(VP_header), 1, fp) != 1) {
mprintf(("Skipping VP file ('%s') because the header could not be read...\n", root->path));
fclose(fp);
return;
}
VP_header.version = INTEL_INT( VP_header.version ); //-V570
VP_header.index_offset = INTEL_INT( VP_header.index_offset ); //-V570
@@ -690,7 +689,10 @@ void cf_search_root_pack(int root_index)
for (i=0; i<VP_header.num_files; i++ ) {
VP_FILE find;
fread( &find, sizeof(VP_FILE), 1, fp );
if (fread( &find, sizeof(VP_FILE), 1, fp ) != 1) {
mprintf(("Failed to read file entry (currently in directory %s)!\n", search_path));
break;
}
find.offset = INTEL_INT( find.offset ); //-V570
find.size = INTEL_INT( find.size ); //-V570
+190 -86
View File
@@ -12,13 +12,13 @@
#include "camera/camera.h" //VIEWER_ZOOM_DEFAULT
#include "cmdline/cmdline.h"
#include "globalincs/linklist.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "network/multi.h"
#include "globalincs/version.h"
#include "hud/hudconfig.h"
#include "network/multi.h"
#include "parse/scripting.h"
#include "parse/sexp.h"
#include "globalincs/version.h"
#include "globalincs/pstypes.h"
#ifdef _WIN32
#include <io.h>
@@ -141,13 +141,12 @@ Flag exe_params[] =
{ "-3dshockwave", "Enable 3D shockwaves", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
{ "-post_process", "Enable post processing", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
{ "-soft_particles", "Enable soft particles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
{ "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
{ "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_explosions", },
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
{ "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT_MEM, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
{ "-enable_shadows", "Enable Shadows", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_shadows"},
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
{ "-no_fps_capping", "Don't limit frames-per-second", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_fps_capping", },
{ "-cache_bitmaps", "Cache bitmaps between missions", true, 0, EASY_DEFAULT_MEM, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-cache_bitmaps", },
{ "-dualscanlines", "Add another pair of scanning lines", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines", },
@@ -166,6 +165,7 @@ Flag exe_params[] =
{ "-snd_preload", "Preload mission game sounds", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-snd_preload", },
{ "-nosound", "Disable all sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound", },
{ "-nomusic", "Disable music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomusic", },
{ "-no_enhanced_sound", "Disable enhanced sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_enhanced_sound", },
{ "-standalone", "Run as standalone server", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone", },
{ "-startgame", "Skip mainhall and start hosting", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame", },
@@ -181,7 +181,6 @@ Flag exe_params[] =
{ "-noparseerrors", "Disable parsing errors", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noparseerrors", },
{ "-query_speech", "Check if this build has speech", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-query_speech", },
{ "-novbo", "Disable OpenGL VBO", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-novbo", },
{ "-noibx", "Don't use cached index buffers (IBX)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noibx", },
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_fbo", },
{ "-disable_pbo", "Disable OpenGL Pixel Buffer Objects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_pbo", },
@@ -196,6 +195,9 @@ Flag exe_params[] =
{ "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-use_gldrawelements", },
{ "-old_collision", "Use old collision detection system", true, EASY_DEFAULT, EASY_ALL_ON, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-old_collision", },
{ "-gl_finish", "Fix input lag on some ATI+Linux systems", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gl_finish", },
{ "-no_batching", "Disable batched model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-no_geo_effects", "Disable geometry shader for effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-set_cpu_affinity", "Sets processor affinity to config value", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
{ "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
@@ -227,6 +229,7 @@ Flag exe_params[] =
{ "-profile_frame_time", "Profile engine subsystems", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_frame_timings", },
{ "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
{ "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
{ "-benchmark_mode", "Puts the game into benchmark mode", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode", },
};
// forward declaration
@@ -243,6 +246,7 @@ cmdline_parm allowbelow_arg("-allowbelow", "Ranks below this can join multi", AT
cmdline_parm standalone_arg("-standalone", NULL, AT_NONE);
cmdline_parm nosound_arg("-nosound", NULL, AT_NONE); // Cmdline_freespace_no_sound
cmdline_parm nomusic_arg("-nomusic", NULL, AT_NONE); // Cmdline_freespace_no_music
cmdline_parm noenhancedsound_arg("-no_enhanced_sound", NULL, AT_NONE); // Cmdline_no_enhanced_sound
cmdline_parm startgame_arg("-startgame", NULL, AT_NONE); // Cmdline_start_netgame
cmdline_parm gameclosed_arg("-closed", NULL, AT_NONE); // Cmdline_closed_game
cmdline_parm gamerestricted_arg("-restricted", NULL, AT_NONE); // Cmdline_restricted_game
@@ -305,6 +309,10 @@ cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
cmdline_parm brieflighting_arg("-brief_lighting", NULL, AT_NONE);
cmdline_parm no_batching("-no_batching", NULL, AT_NONE);
cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT);
cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE);
cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE); // Cmdline_no_deferred
float Cmdline_clip_dist = Default_min_draw_distance;
float Cmdline_fov = 0.75f;
@@ -328,17 +336,18 @@ bool Cmdline_fxaa = false;
int Cmdline_fxaa_preset = 6;
extern int Fxaa_preset_last_frame;
bool Cmdline_fb_explosions = 0;
bool Cmdline_no_batching = false;
extern bool ls_force_off;
bool Cmdline_brief_lighting = 0;
int Cmdline_shadow_quality = 0;
int Cmdline_no_deferred_lighting = 0;
// Game Speed related
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
cmdline_parm img2dds_arg("-img2dds", NULL, AT_NONE); // Cmdline_img2dds
cmdline_parm no_fpscap("-no_fps_capping", "Don't limit frames-per-second", AT_NONE); // Cmdline_NoFPSCap
cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE); // Cmdline_no_vsync
int Cmdline_cache_bitmaps = 0; // caching of bitmaps between missions (faster loads, can hit swap on reload with <512 Meg RAM though) - taylor
int Cmdline_img2dds = 0;
int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
int Cmdline_no_vsync = 0;
@@ -378,6 +387,7 @@ cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE); // Cmdline_voice_r
int Cmdline_query_speech = 0;
int Cmdline_snd_preload = 0; // preload game sounds during mission load
int Cmdline_voice_recognition = 0;
int Cmdline_no_enhanced_sound = 0;
// MOD related
cmdline_parm mod_arg("-mod", "List of folders to overwrite/add-to the default data", AT_STRING, true); // Cmdline_mod -- DTP modsupport
@@ -402,7 +412,6 @@ int Cmdline_objupd = 3; // client object updates on LAN by default
// Troubleshooting
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE); // Cmdline_load_all_weapons
cmdline_parm htl_arg("-nohtl", NULL, AT_NONE); // Cmdline_nohtl -- don't use HT&L
cmdline_parm noibx_arg("-noibx", NULL, AT_NONE); // Cmdline_noibx
cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE); // Cmdline_nomovies -- Allows video streaming
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE); // Cmdline_no_set_gamma
cmdline_parm no_vbo_arg("-novbo", NULL, AT_NONE); // Cmdline_novbo
@@ -412,16 +421,16 @@ cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE); // Cmdline_noglsl -- disa
cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE); // Cmdline_mipmap
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
cmdline_parm no_glsl_models_arg("-disable_glsl_model", NULL, AT_NONE); // Cmdline_no_glsl_model_rendering -- switches model rendering to fixed pipeline
cmdline_parm no_di_mouse_arg("-disable_di_mouse", "Disable DirectInput mouse code (Windows only)", AT_NONE); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
cmdline_parm keyboard_layout("-keyboard_layout", "Specify keyboard layout (qwertz or azerty)", AT_STRING);
cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE); // Cmdline_old_collision_sys
cmdline_parm gl_finish ("-gl_finish", NULL, AT_NONE);
cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE);
cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE);
int Cmdline_load_all_weapons = 0;
int Cmdline_nohtl = 0;
int Cmdline_noibx = 0;
int Cmdline_nomovies = 0;
int Cmdline_no_set_gamma = 0;
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
@@ -430,11 +439,12 @@ int Cmdline_no_pbo = 0;
int Cmdline_noglsl = 0;
int Cmdline_ati_color_swap = 0;
int Cmdline_no_3d_sound = 0;
int Cmdline_no_glsl_model_rendering = 0;
int Cmdline_no_di_mouse = 0;
int Cmdline_drawelements = 0;
char* Cmdline_keyboard_layout = NULL;
bool Cmdline_gl_finish = false;
bool Cmdline_no_geo_sdr_effects = false;
bool Cmdline_set_cpu_affinity = false;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
@@ -454,6 +464,7 @@ cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_
cmdline_parm window_arg("-window", NULL, AT_NONE); // Cmdline_window
cmdline_parm fullscreen_window_arg("-fullscreen_window", "Fullscreen/borderless window (Windows only)", AT_NONE);
cmdline_parm res_arg("-res", "Resolution, formatted like 1600x900", AT_STRING);
cmdline_parm center_res_arg("-center_res", "Resolution of center monitor, formatted like 1600x900", AT_STRING);
cmdline_parm verify_vps_arg("-verify_vps", NULL, AT_NONE); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, "Ignore any cmdline_fso.cfg files", AT_NONE);
#ifdef SCP_UNIX
@@ -463,6 +474,8 @@ cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE); //Cmdline
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_frame_profile
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE); //Cmdline_benchmark_mode
char *Cmdline_start_mission = NULL;
int Cmdline_old_collision_sys = 0;
@@ -481,6 +494,7 @@ int Cmdline_debug_window = 0;
int Cmdline_window = 0;
int Cmdline_fullscreen_window = 0;
char *Cmdline_res = 0;
char *Cmdline_center_res = 0;
int Cmdline_verify_vps = 0;
#ifdef SCP_UNIX
int Cmdline_no_grab = 0;
@@ -489,6 +503,7 @@ int Cmdline_reparse_mainhall = 0;
bool Cmdline_frame_profile = false;
bool Cmdline_profile_write_file = false;
bool Cmdline_no_unfocus_pause = false;
bool Cmdline_benchmark_mode = false;
// Other
cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
@@ -832,20 +847,21 @@ void os_init_cmdline(char *cmdline)
size_t len = filelength( fileno(fp) ) + 2;
buf = new char [len];
fgets(buf, len-1, fp);
// 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';
}
#ifdef SCP_UNIX
// append a space for the os_parse_parms() check
strcat_s(buf, len, " ");
// append a space for the os_parse_parms() check
strcat_s(buf, len, " ");
#endif
os_parse_parms(buf);
os_validate_parms(buf);
os_parse_parms(buf);
os_validate_parms(buf);
}
delete [] buf;
fclose(fp);
}
@@ -870,18 +886,20 @@ void os_init_cmdline(char *cmdline)
size_t len = filelength( fileno(fp) ) + 2;
buf = new char [len];
fgets(buf, len-1, fp);
if (fgets(buf, len-1, fp) != nullptr)
{
// replace the newline character with a NULL
if ( (p = strrchr(buf, '\n')) != NULL ) {
*p = '\0';
}
// 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_parse_parms(buf);
os_validate_parms(buf);
}
// append a space for the os_parse_parms() check
strcat_s(buf, len, " ");
os_parse_parms(buf);
os_validate_parms(buf);
delete [] buf;
fclose(fp);
}
@@ -1016,6 +1034,100 @@ char *cmdline_parm::str()
return args;
}
#ifdef SCP_UNIX
// Return a vector with all filesystem names of "parent/dir" relative to parent.
// dir must not contain a slash.
static SCP_vector<SCP_string> unix_get_single_dir_names(SCP_string parent, SCP_string dir)
{
SCP_vector<SCP_string> ret;
DIR *dp;
if ((dp = opendir(parent.c_str())) == NULL) {
Warning(LOCATION, "Can't open directory '%s' when searching mod paths. Ignoring. errno=%d", parent.c_str(), errno);
return ret;
}
dirent *dirp;
while ((dirp = readdir(dp)) != NULL) {
if (!stricmp(dirp->d_name, dir.c_str())) {
ret.push_back(dirp->d_name);
}
}
(void)closedir(dp);
return ret;
}
// Return a vector with all filesystem names of "parent/dir" relative to parent.
// Recurses to deal with slashes in dir.
static SCP_vector<SCP_string> unix_get_dir_names(SCP_string parent, SCP_string dir)
{
size_t slash = dir.find_first_of("/\\");
// no subdirectories, no need to recurse
if (slash == std::string::npos) {
return unix_get_single_dir_names(parent, dir);
}
// get the names of the first component of dir
SCP_vector<SCP_string> this_dir_names = unix_get_single_dir_names(parent, dir.substr(0, slash));
SCP_string rest = dir.substr(slash + 1);
SCP_vector<SCP_string> ret;
// search for the rest of dir in each of these
SCP_vector<SCP_string>::iterator ii, end = this_dir_names.end();
for (ii = this_dir_names.begin(); ii != end; ++ii) {
SCP_string this_dir_path = parent + "/" + *ii;
SCP_vector<SCP_string> mod_path = unix_get_dir_names(this_dir_path, rest);
// add all found paths relative to parent
SCP_vector<SCP_string>::iterator ii2, end2 = mod_path.end();
for (ii2 = mod_path.begin(); ii2 != end2; ++ii2) {
ret.push_back(*ii + "/" + *ii2);
}
}
return ret;
}
// For case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches.
static void handle_unix_modlist(char **modlist, int *len)
{
// search filesystem for given paths
SCP_vector<SCP_string> mod_paths;
for (char *cur_mod = strtok(*modlist, ","); cur_mod != NULL; cur_mod = strtok(NULL, ","))
{
SCP_vector<SCP_string> this_mod_paths = unix_get_dir_names(".", cur_mod);
if (this_mod_paths.empty()) {
ReleaseWarning(LOCATION, "Can't find mod '%s'. Ignoring.", cur_mod);
}
mod_paths.insert(mod_paths.end(), this_mod_paths.begin(), this_mod_paths.end());
}
// create new char[] to replace modlist
size_t total_len = 0;
SCP_vector<SCP_string>::iterator ii, end = mod_paths.end();
for (ii = mod_paths.begin(); ii != end; ++ii) {
total_len += ii->length() + 1;
}
char *new_modlist = new char[total_len + 1];
memset(new_modlist, 0, total_len + 1);
end = mod_paths.end();
for (ii = mod_paths.begin(); ii != end; ++ii) {
strcat_s(new_modlist, total_len + 1, ii->c_str());
strcat_s(new_modlist, total_len + 1, ","); // replace later with NUL
}
// make the rest of the modlist manipulation unaware that anything happened here
delete [] *modlist;
*modlist = new_modlist;
*len = total_len;
}
#endif /* SCP_UNIX */
// external entry point into this modules
bool SetCmdlineParams()
@@ -1150,6 +1262,11 @@ bool SetCmdlineParams()
Cmdline_freespace_no_music = 1;
}
// Disable enhanced sound
if (noenhancedsound_arg.found()) {
Cmdline_no_enhanced_sound = 1;
}
// should we start a network game
if ( startgame_arg.found() ) {
Cmdline_use_last_pilot = 1;
@@ -1247,6 +1364,9 @@ bool SetCmdlineParams()
if(res_arg.found()){
Cmdline_res = res_arg.str();
}
if(center_res_arg.found()){
Cmdline_center_res = center_res_arg.str();
}
if(almission_arg.found()){//DTP for autoload mission // developer oritentated
Cmdline_almission = almission_arg.str();
Cmdline_use_last_pilot = 1;
@@ -1290,47 +1410,8 @@ bool SetCmdlineParams()
strcpy_s(modlist, len+2, Cmdline_mod);
#ifdef SCP_UNIX
// for case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches
DIR *dp;
dirent *dirp;
char *cur_pos, *temp;
char cur_dir[CF_MAX_PATHNAME_LENGTH], delim[] = ",";
SCP_vector<SCP_string> temp_modlist;
size_t total_len = 0;
if ( !_getcwd(cur_dir, CF_MAX_PATHNAME_LENGTH ) ) {
Error(LOCATION, "Can't get current working directory -- %d", errno );
}
for (cur_pos = strtok(modlist, delim); cur_pos != NULL; cur_pos = strtok(NULL, delim))
{
if ((dp = opendir(cur_dir)) == NULL) {
Error(LOCATION, "Can't open directory '%s' -- %d", cur_dir, errno );
}
while ((dirp = readdir(dp)) != NULL) {
if (!stricmp(dirp->d_name, cur_pos)) {
temp_modlist.push_back(dirp->d_name);
total_len += (strlen(dirp->d_name) + 1);
}
}
(void)closedir(dp);
}
// create new char[] to replace modlist
char *new_modlist = new char[total_len+1];
memset( new_modlist, 0, total_len + 1 );
SCP_vector<SCP_string>::iterator ii, end = temp_modlist.end();
for (ii = temp_modlist.begin(); ii != end; ++ii) {
strcat_s(new_modlist, total_len+1, ii->c_str());
strcat_s(new_modlist, total_len+1, ","); // replace later with NUL
}
// make the rest of the function unaware that anything happened here
temp = modlist;
modlist = new_modlist;
delete [] temp;
len = total_len;
// handle case-insensitive searching
handle_unix_modlist(&modlist, &len);
#endif
// null terminate each individual
@@ -1456,10 +1537,6 @@ bool SetCmdlineParams()
Cmdline_noglsl = 1;
}
if (no_glsl_models_arg.found() ) {
Cmdline_no_glsl_model_rendering = 1;
}
if (fxaa_arg.found() ) {
Cmdline_fxaa = true;
@@ -1474,9 +1551,6 @@ bool SetCmdlineParams()
Cmdline_no_di_mouse = 1;
}
if ( img2dds_arg.found() )
Cmdline_img2dds = 1;
if ( glow_arg.found() )
Cmdline_glow = 0;
@@ -1534,6 +1608,16 @@ bool SetCmdlineParams()
Cmdline_gl_finish = true;
}
if ( no_geo_sdr_effects.found() )
{
Cmdline_no_geo_sdr_effects = true;
}
if (set_cpu_affinity.found())
{
Cmdline_set_cpu_affinity = true;
}
if ( snd_preload_arg.found() )
{
Cmdline_snd_preload = 1;
@@ -1560,10 +1644,6 @@ bool SetCmdlineParams()
if(dis_weapons.found())
Cmdline_dis_weapons = 1;
if ( noibx_arg.found() ) {
Cmdline_noibx = 1;
}
if ( no_fbo_arg.found() ) {
Cmdline_no_fbo = 1;
}
@@ -1616,6 +1696,11 @@ bool SetCmdlineParams()
Cmdline_fb_explosions = 1;
}
if ( no_batching.found() )
{
Cmdline_no_batching = true;
}
if ( brieflighting_arg.found() )
{
Cmdline_brief_lighting = 1;
@@ -1641,6 +1726,20 @@ bool SetCmdlineParams()
Cmdline_reparse_mainhall = 1;
}
if( enable_shadows_arg.found() )
{
Cmdline_shadow_quality = 2;
if( shadow_quality_arg.found() )
{
Cmdline_shadow_quality = shadow_quality_arg.get_int();
}
}
if( no_deferred_lighting_arg.found() )
{
Cmdline_no_deferred_lighting = 1;
}
if (frame_profile_arg.found() )
{
Cmdline_frame_profile = true;
@@ -1656,6 +1755,11 @@ bool SetCmdlineParams()
{
Cmdline_no_unfocus_pause = true;
}
if (benchmark_mode_arg.found())
{
Cmdline_benchmark_mode = true;
}
//Deprecated flags - CommanderDJ
if( deprecated_spec_arg.found() )
+8 -3
View File
@@ -48,6 +48,7 @@ extern int Cmdline_use_last_pilot;
extern int Cmdline_window;
extern int Cmdline_fullscreen_window;
extern char *Cmdline_res;
extern char *Cmdline_center_res;
// FSO OPTIONS -------------------------------------------------
@@ -76,10 +77,12 @@ extern int Cmdline_bloom_intensity;
extern bool Cmdline_fxaa;
extern int Cmdline_fxaa_preset;
extern bool Cmdline_fb_explosions;
extern bool Cmdline_no_batching;
extern int Cmdline_shadow_quality;
extern int Cmdline_no_deferred_lighting;
// Game Speed related
extern int Cmdline_cache_bitmaps;
extern int Cmdline_img2dds;
extern int Cmdline_NoFPSCap;
extern int Cmdline_no_vsync;
@@ -102,6 +105,7 @@ extern int Cmdline_stretch_menu;
extern int Cmdline_query_speech;
extern int Cmdline_snd_preload;
extern int Cmdline_voice_recognition;
extern int Cmdline_no_enhanced_sound;
// MOD related
extern char *Cmdline_mod; // DTP for mod support
@@ -116,7 +120,6 @@ extern int Cmdline_objupd;
// Troubleshooting
extern int Cmdline_load_all_weapons;
extern int Cmdline_nohtl;
extern int Cmdline_noibx;
extern int Cmdline_nomovies; // WMC Toggles movie playing support
extern int Cmdline_no_set_gamma;
extern int Cmdline_novbo;
@@ -126,11 +129,12 @@ extern int Cmdline_noglsl;
extern int Cmdline_mipmap;
extern int Cmdline_ati_color_swap;
extern int Cmdline_no_3d_sound;
extern int Cmdline_no_glsl_model_rendering;
extern int Cmdline_no_di_mouse;
extern int Cmdline_drawelements;
extern char* Cmdline_keyboard_layout;
extern bool Cmdline_gl_finish;
extern bool Cmdline_no_geo_sdr_effects;
extern bool Cmdline_set_cpu_affinity;
// Developer/Testing related
extern char *Cmdline_start_mission;
@@ -155,5 +159,6 @@ extern int Cmdline_reparse_mainhall;
extern bool Cmdline_frame_profile;
extern bool Cmdline_profile_write_file;
extern bool Cmdline_no_unfocus_pause;
extern bool Cmdline_benchmark_mode;
#endif
+7 -6
View File
@@ -10,17 +10,18 @@
#include "cmeasure/cmeasure.h"
#include "ship/ship.h"
#include "math/staticrand.h"
#include "object/object.h"
#include "weapon/weapon.h"
#include "hud/hud.h"
#include "gamesnd/gamesnd.h"
#include "network/multimsgs.h"
#include "hud/hud.h"
#include "math/staticrand.h"
#include "mission/missionparse.h"
#include "network/multimsgs.h"
#include "object/object.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
int Cmeasures_homing_check = 0;
int Countermeasures_enabled = 1; // Debug, set to 0 means no one can fire countermeasures.
const float CMEASURE_DETONATE_DISTANCE = 40.0f;
//Used to set a countermeasure velocity after being launched from a ship as a countermeasure
//ie not as a primary or secondary.
+1
View File
@@ -22,6 +22,7 @@ class object;
// Maximum distance at which a countermeasure can be tracked
// If this value is too large, missiles will always be tracking countermeasures.
#define MAX_CMEASURE_TRACK_DIST 300.0f
extern const float CMEASURE_DETONATE_DISTANCE;
extern int Cmeasures_homing_check;
extern int Countermeasures_enabled;
+57 -35
View File
@@ -10,26 +10,26 @@
#include "freespace2/freespace.h"
#include "controlconfig/controlsconfig.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "gamehelp/contexthelp.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "graphics/font.h"
#include "hud/hudsquadmsg.h"
#include "io/joy.h"
#include "io/key.h"
#include "io/timer.h"
#include "ui/ui.h"
#include "io/joy.h"
#include "gamesnd/gamesnd.h"
#include "missionui/missionscreencommon.h"
#include "graphics/font.h"
#include "pilotfile/pilotfile.h"
#include "gamehelp/contexthelp.h"
#include "popup/popup.h"
#include "ui/uidefs.h"
#include "globalincs/alphacolors.h"
#include "network/multi_pmsg.h"
#include "network/multiutil.h"
#include "parse/scripting.h"
#include "debugconsole/console.h"
#include "pilotfile/pilotfile.h"
#include "popup/popup.h"
#include "ui/ui.h"
#include "ui/uidefs.h"
#ifndef NDEBUG
@@ -393,21 +393,10 @@ int control_config_detect_axis()
void control_config_conflict_check()
{
int i, j, shift = -1, alt = -1;
int i, j;
for (i=0; i<CCFG_MAX; i++) {
Conflicts[i].key = Conflicts[i].joy = -1;
switch (Control_config[i].key_id) {
case KEY_LSHIFT:
case KEY_RSHIFT:
shift = i;
break;
case KEY_LALT:
case KEY_RALT:
alt = i;
break;
}
}
for (i=0; i<NUM_TABS; i++) {
@@ -468,15 +457,12 @@ void control_config_conflict_check()
// do list setup required prior to rendering and checking for the controls listing. Called when list changes
void control_config_list_prepare()
{
int j, k, y, z;
int j, y, z;
int font_height = gr_get_font_height();
Num_cc_lines = y = z = 0;
while (z < CCFG_MAX) {
if (Control_config[z].tab == Tab && !Control_config[z].disabled) {
k = Control_config[z].key_id;
j = Control_config[z].joy_id;
if (Control_config[z].hasXSTR) {
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
} else {
@@ -666,7 +652,7 @@ void control_config_bind_axis(int i, int axis)
int control_config_remove_binding()
{
int z, j, k;
int z;
config_item_undo *ptr;
if (Selected_line < 0) {
@@ -696,7 +682,6 @@ int control_config_remove_binding()
return -1;
}
j = k = -1;
ptr = get_undo_block(1);
ptr->index[0] = z;
ptr->list[0] = Control_config[z];
@@ -1439,8 +1424,8 @@ void control_config_close()
void control_config_do_frame(float frametime)
{
const char *str;
char buf[256], *jptr;
int i, j, k, w, x, y, z, len, line, conflict;
char buf[256];
int i, j, k, w, x, y, z, line, conflict;
int font_height = gr_get_font_height();
int select_tease_line = -1; // line mouse is down on, but won't be selected until button released
static float timer = 0.0f;
@@ -1999,7 +1984,6 @@ void control_config_do_frame(float frametime)
k = Control_config[z].key_id;
j = Control_config[z].joy_id;
x = Control_list_key_x[gr_screen.res];
jptr = NULL;
*buf = 0;
if ((k < 0) && (j < 0)) {
@@ -2026,7 +2010,6 @@ void control_config_do_frame(float frametime)
gr_printf_menu(x, y, buf);
len = strlen(buf);
Cc_lines[line].kx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
gr_get_string_size(&w, NULL, buf);
Cc_lines[line].kw = w;
@@ -2107,6 +2090,45 @@ void control_config_do_frame(float frametime)
List_buttons[i++].disable();
}
// If multiple controls presets are provided, display which one is in use
if (Control_config_presets.size() > 1) {
SCP_string preset_str;
int matching_preset = -1;
for (i=0; i<(int)Control_config_presets.size(); i++) {
bool this_preset_matches = true;
config_item *this_preset = Control_config_presets[i];
for (j=0; j<CCFG_MAX; j++) {
if (!Control_config[j].disabled && Control_config[j].key_id != this_preset[j].key_default) {
this_preset_matches = false;
break;
}
}
if (this_preset_matches) {
matching_preset = i;
break;
}
}
if (matching_preset >= 0) {
sprintf(preset_str, "Controls: %s", Control_config_preset_names[matching_preset].c_str());
} else {
sprintf(preset_str, "Controls: custom");
}
gr_get_string_size(&w, NULL, preset_str.c_str());
gr_set_color_fast(&Color_text_normal);
if (gr_screen.res == GR_640) {
gr_string(16, (24 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
} else {
gr_string(24, (40 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
}
}
// blit help overlay if active
help_overlay_maybe_blit(Control_config_overlay_id, gr_screen.res);
@@ -2165,7 +2187,7 @@ void control_check_indicate()
#ifndef NDEBUG
if (Show_controls_info) {
gr_set_color_fast(&HUD_color_debug);
gr_printf_no_resize(gr_screen.max_w - 154, 5, NOX("Ctrls checked: %d"), Control_check_count);
gr_printf_no_resize(gr_screen.center_offset_x + gr_screen.center_w - 154, gr_screen.center_offset_y + 5, NOX("Ctrls checked: %d"), Control_check_count);
}
#endif
+4 -2
View File
@@ -8,11 +8,11 @@
*/
#include "globalincs/pstypes.h"
#ifndef CONTROLS_CONFIG_H
#define CONTROLS_CONFIG_H
#include "globalincs/pstypes.h"
#define CONTROL_CONFIG_XSTR 507
/*!
@@ -292,10 +292,12 @@ extern int Control_config_overlay_id;
extern config_item Control_config[]; //!< Stores the keyboard configuration
extern SCP_vector<config_item*> Control_config_presets; // tabled control presets; pointers to config_item arrays
extern SCP_vector<SCP_string> Control_config_preset_names; // names for Control_config_presets (identical order of items)
extern char **Scan_code_text;
extern char **Joy_button_text;
void control_config_common_init(); //!< initialize common control config stuff - call at game startup after localization has been initialized
void control_config_common_close(); //!< close common control config stuff - call at game shutdown
void control_config_init();
void control_config_do_frame(float frametime);
+25 -3
View File
@@ -12,12 +12,12 @@
#include "cfile/cfile.h"
#include "controlconfig/controlsconfig.h"
#include "io/key.h"
#include "globalincs/def_files.h"
#include "globalincs/systemvars.h"
#include "io/joy.h"
#include "io/key.h"
#include "localization/localize.h"
#include "parse/parselo.h"
#include "globalincs/systemvars.h"
#include "globalincs/def_files.h"
// z64: These enumerations MUST equal to those in controlsconfig.cpp...
// z64: Really need a better way than this.
@@ -404,6 +404,7 @@ char **Scan_code_text = Scan_code_text_english;
char **Joy_button_text = Joy_button_text_english;
SCP_vector<config_item*> Control_config_presets;
SCP_vector<SCP_string> Control_config_preset_names;
void set_modifier_status()
{
@@ -609,6 +610,16 @@ void control_config_common_init()
}
}
/*
* @brief close any common control config stuff, called at game_shutdown()
*/
void control_config_common_close()
{
// only need to worry control presets for now
for (auto ii = Control_config_presets.cbegin(); ii != Control_config_presets.cend(); ++ii) {
delete * ii;
}
}
#include <map>
@@ -811,6 +822,14 @@ void control_config_common_load_overrides()
std::copy(Control_config, Control_config + CCFG_MAX + 1, cfg_preset);
Control_config_presets.push_back(cfg_preset);
SCP_string preset_name;
if (optional_string("$Name:")) {
stuff_string_line(preset_name);
} else {
preset_name = "<unnamed preset>";
}
Control_config_preset_names.push_back(preset_name);
while (required_string_either("#End","$Bind Name:")) {
const int iBufferLength = 64;
char szTempBuffer[iBufferLength];
@@ -880,6 +899,9 @@ void control_config_common_load_overrides()
if (optional_string("+Disable")) {
r_ccConfig.disabled = true;
}
if (optional_string("$Disable:")) {
stuff_boolean(&r_ccConfig.disabled);
}
// Nerf the buffer now.
szTempBuffer[0] = '\0';
+59 -57
View File
@@ -10,17 +10,17 @@
#include "cutscene/cutscenes.h"
#include "ui/ui.h"
#include "gamesnd/gamesnd.h"
#include "gamesequence/gamesequence.h"
#include "freespace2/freespace.h"
#include "io/key.h"
#include "movie.h"
#include "popup/popup.h"
#include "menuui/mainhallmenu.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "io/key.h"
#include "localization/localize.h"
#include "menuui/mainhallmenu.h"
#include "movie.h"
#include "parse/parselo.h"
#include "popup/popup.h"
#include "ui/ui.h"
extern int Cmdline_nomovies;
@@ -52,59 +52,61 @@ void cutscene_init()
{
atexit(cutscene_close);
char buf[MULTITEXT_LENGTH];
int rval;
cutscene_info cutinfo;
cutscene_info cutinfo;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "cutscenes.tbl", rval));
try
{
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
reset_parse();
// parse in all the cutscenes
Cutscenes.clear();
skip_to_string("#Cutscenes");
ignore_white_space();
bool isFirstCutscene = true;
while (required_string_either("#End", "$Filename:"))
{
required_string("$Filename:");
stuff_string(cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN);
required_string("$Name:");
stuff_string(cutinfo.name, F_NAME, NAME_LENGTH);
required_string("$Description:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
cutinfo.description = vm_strdup(buf);
if (optional_string("$cd:"))
stuff_int(&cutinfo.cd);
else
cutinfo.cd = 0;
cutinfo.viewable = false;
if (isFirstCutscene) {
isFirstCutscene = false;
// The original code assumes the first movie is the intro, so always viewable
cutinfo.viewable = true;
}
if (optional_string("$Always Viewable:")) {
stuff_boolean(&cutinfo.viewable);
}
Cutscenes.push_back(cutinfo);
}
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "cutscenes.tbl", e.what()));
return;
}
read_file_text("cutscenes.tbl", CF_TYPE_TABLES);
reset_parse();
// parse in all the cutscenes
Cutscenes.clear();
skip_to_string("#Cutscenes");
ignore_white_space();
bool isFirstCutscene = true;
while ( required_string_either("#End", "$Filename:") )
{
required_string("$Filename:");
stuff_string( cutinfo.filename, F_PATHNAME, MAX_FILENAME_LEN );
required_string("$Name:");
stuff_string( cutinfo.name, F_NAME, NAME_LENGTH );
required_string("$Description:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
cutinfo.description = vm_strdup(buf);
if (optional_string("$cd:"))
stuff_int( &cutinfo.cd );
else
cutinfo.cd = 0;
cutinfo.viewable = false;
if (isFirstCutscene) {
isFirstCutscene = false;
// The original code assumes the first movie is the intro, so always viewable
cutinfo.viewable = true;
}
if (optional_string("$Always Viewable:")) {
stuff_boolean(&cutinfo.viewable);
}
Cutscenes.push_back(cutinfo);
}
required_string("#End");
}
// function to return 0 based index of which CD a particular movie is on
+3 -3
View File
@@ -15,7 +15,7 @@ static void genLoopkupTable();
void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pData, int dataRemain)
{
ubyte *pOrig, *pOffData, *pEnd, op;
ubyte *pOrig, *pOffData, op;
ushort offset;
int length = 0, i, j, xb, yb;
@@ -32,7 +32,6 @@ void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pDa
offset = pData[0]|(pData[1]<<8);
pOffData = pData + offset;
pEnd = pData + offset;
pData += 2;
@@ -55,7 +54,8 @@ void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pDa
}
if ((length-(pData-pOrig)) != 0) {
nprintf(("MVE", "DEBUG: junk left over: %d,%d,%d\n", (pData-pOrig), length, (length-(pData-pOrig))));
nprintf(("MVE", "DEBUG: junk left over: " PTRDIFF_T_ARG ",%d," PTRDIFF_T_ARG "\n",
(pData-pOrig), length, (length-(pData-pOrig))));
}
}
+9 -8
View File
@@ -13,18 +13,21 @@
#include <windows.h>
#endif
#include "graphics/2d.h"
#include "globalincs/systemvars.h"
#include "cutscene/movie.h"
#include "osapi/osapi.h"
#include "cmdline/cmdline.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
#include "cutscene/movie.h"
#include "cutscene/mvelib.h"
#include "cutscene/oggplayer.h"
#include "globalincs/systemvars.h"
#include "graphics/2d.h"
#include "osapi/osapi.h"
extern int Game_mode;
const char *movie_ext_list[] = { ".ogg", ".mve" };
const int NUM_MOVIE_EXT = sizeof(movie_ext_list) / sizeof(char*);
#define MOVIE_NONE -1
#define MOVIE_OGG 0
@@ -42,8 +45,6 @@ int movie_find(char *filename, char *out_name)
char full_path[MAX_PATH];
char tmp_name[MAX_PATH];
int size, offset = 0;
const int NUM_EXT = 2;
const char *movie_ext[NUM_EXT] = { ".ogg", ".mve" };
if (out_name == NULL)
return MOVIE_NONE;
@@ -57,7 +58,7 @@ int movie_find(char *filename, char *out_name)
char *p = strrchr(tmp_name, '.');
if ( p ) *p = 0;
int rc = cf_find_file_location_ext(tmp_name, NUM_EXT, movie_ext, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
int rc = cf_find_file_location_ext(tmp_name, NUM_MOVIE_EXT, movie_ext_list, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
if (rc == MOVIE_NONE)
return MOVIE_NONE;
+3
View File
@@ -12,6 +12,9 @@
#ifndef _MOVIE_HEADER_FILE
#define _MOVIE_HEADER_FILE
extern const char *movie_ext_list[];
extern const int NUM_MOVIE_EXT;
bool movie_play(char *name);
void movie_play_two(char *name1, char *name2);
+2 -2
View File
@@ -1,8 +1,8 @@
#include "globalincs/pstypes.h"
#include "cutscene/mvelib.h"
#include "cfile/cfile.h"
#include "cutscene/mvelib.h"
#include "globalincs/pstypes.h"
static const char MVE_HEADER[] = "Interplay MVE File\x1A";
+23 -42
View File
@@ -6,21 +6,21 @@
#include <sys/time.h>
#endif
#include "bmpman/bmpman.h"
#include "cutscene/movie.h"
#include "cutscene/mvelib.h"
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "graphics/gropengl.h"
#include "graphics/gropengltexture.h"
#include "graphics/gropengldraw.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglstate.h"
#include "globalincs/pstypes.h"
#include "cutscene/mvelib.h"
#include "cutscene/movie.h"
#include "graphics/2d.h"
#include "graphics/gropengltexture.h"
#include "io/key.h"
#include "osapi/osapi.h"
#include "io/timer.h"
#include "sound/sound.h"
#include "osapi/osapi.h"
#include "sound/openal.h"
#include "bmpman/bmpman.h"
#include "sound/sound.h"
extern int Cmdline_noscalevid;
@@ -228,7 +228,7 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
return;
}
int flags, desired_buffer, sample_rate;
int flags, sample_rate;
mas = (mve_audio_t *) vm_malloc ( sizeof(mve_audio_t) );
memset(mas, 0, sizeof(mve_audio_t));
@@ -237,7 +237,6 @@ void mve_audio_createbuf(ubyte minor, ubyte *data)
flags = mve_get_ushort(data + 2);
sample_rate = mve_get_ushort(data + 4);
desired_buffer = mve_get_int(data + 6);
mas->channels = (flags & 0x0001) ? 2 : 1;
mas->bitsize = (flags & 0x0002) ? 16 : 8;
@@ -419,16 +418,10 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
}
short w, h;
short count, truecolor;
short truecolor;
w = mve_get_short(data);
h = mve_get_short(data+2);
if (minor > 0) {
count = mve_get_short(data+4);
} else {
count = 1;
}
if (minor > 1) {
truecolor = mve_get_short(data+6);
} else {
@@ -459,13 +452,13 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
if (gr_screen.mode == GR_OPENGL) {
GLfloat scale_by = 1.0f;
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
float screen_ratio = (float)gr_screen.center_w / (float)gr_screen.center_h;
float movie_ratio = (float)g_width / (float)g_height;
if (screen_ratio > movie_ratio) {
scale_by = (float)gr_screen.max_h / (float)g_height;
scale_by = (float)gr_screen.center_h / (float)g_height;
} else {
scale_by = (float)gr_screen.max_w / (float)g_width;
scale_by = (float)gr_screen.center_w / (float)g_width;
}
// don't bother setting anything if we aren't going to need it
@@ -479,12 +472,12 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
}
if (mve_scale_video) {
g_screenX = ((ceil((gr_screen.max_w / scale_by) - 0.5f) - g_width) / 2);
g_screenY = ((ceil((gr_screen.max_h / scale_by) - 0.5f) - g_height) / 2);
g_screenX = ((ceil((gr_screen.center_w / scale_by) - 0.5f) - g_width) / 2) + ceil((gr_screen.center_offset_x / scale_by) - 0.5f);
g_screenY = ((ceil((gr_screen.center_h / scale_by) - 0.5f) - g_height) / 2) + ceil((gr_screen.center_offset_y / scale_by) - 0.5f);
} else {
// centers on 1024x768, fills on 640x480
g_screenX = ((float)(gr_screen.max_w - g_width) / 2.0f);
g_screenY = ((float)(gr_screen.max_h - g_height) / 2.0f);
g_screenX = ((float)(gr_screen.center_w - g_width) / 2.0f) + gr_screen.center_offset_x;
g_screenY = ((float)(gr_screen.center_h - g_height) / 2.0f) + gr_screen.center_offset_y;
}
// set additional values for screen width/height and UV coords
@@ -518,12 +511,12 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
GL_state.Array.BindArrayBuffer(0);
GL_state.Array.EnableClientVertex();
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
vertex_layout vertex_def;
GL_state.Array.SetActiveClientUnit(0);
GL_state.Array.EnableClientTexture();
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
vertex_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
vertex_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
opengl_bind_vertex_layout(vertex_def);
}
return 1;
@@ -725,18 +718,9 @@ void mve_video_codemap(ubyte *data, int len)
void mve_video_data(ubyte *data, int len)
{
short nFrameHot, nFrameCold;
short nXoffset, nYoffset;
short nXsize, nYsize;
ushort nFlags;
ubyte *temp;
nFrameHot = mve_get_short(data);
nFrameCold = mve_get_short(data+2);
nXoffset = mve_get_short(data+4);
nYoffset = mve_get_short(data+6);
nXsize = mve_get_short(data+8);
nYsize = mve_get_short(data+10);
nFlags = mve_get_ushort(data+12);
if (nFlags & 1) {
@@ -797,9 +781,6 @@ void mve_play(MVESTREAM *mve)
void mve_shutdown()
{
if (gr_screen.mode == GR_OPENGL) {
GL_state.Array.DisableClientVertex();
GL_state.Array.DisableClientTexture();
if (mve_scale_video) {
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
+31 -76
View File
@@ -9,22 +9,23 @@
#include <errno.h>
#endif
#include "globalincs/pstypes.h"
#include "globalincs/def_files.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cutscene/oggplayer.h"
#include "globalincs/def_files.h"
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "graphics/gropengl.h"
#include "graphics/gropengltexture.h"
#include "graphics/gropengldraw.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglstate.h"
#include "graphics/2d.h"
#include "graphics/gropengltexture.h"
#include "io/key.h"
#include "osapi/osapi.h"
#include "sound/sound.h"
#include "sound/openal.h"
#include "bmpman/bmpman.h"
#include "cutscene/oggplayer.h"
#include "io/timer.h"
#include "osapi/osapi.h"
#include "sound/openal.h"
#include "sound/sound.h"
#include "theora/theora.h"
#include "vorbis/codec.h"
@@ -331,8 +332,6 @@ static void OGG_video_init(theora_info *tinfo)
{
float scale_by = 0.0f;
GLhandleARB shader_id = 0;
if (video_inited)
return;
@@ -346,7 +345,7 @@ static void OGG_video_init(theora_info *tinfo)
opengl_set_texture_target(GL_TEXTURE_2D);
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
if(!Use_GLSL)
if(!is_minimum_GLSL_version())
use_shaders = false;
if(use_shaders) {
@@ -365,52 +364,11 @@ static void OGG_video_init(theora_info *tinfo)
return;
}
char *vert = NULL, *frag = NULL;
opengl_shader_t new_shader;
// choose appropriate files
char *vert_name = "video-v.sdr";
char *frag_name = "video-f.sdr";
int sdr_handle = gr_maybe_create_shader(SDR_TYPE_VIDEO_PROCESS, 0);
mprintf(("Compiling video-processing shader ... \n"));
// read vertex shader
CFILE *cf_shader = cfopen(vert_name, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
if (cf_shader != NULL) {
int len = cfilelength(cf_shader);
vert = (char*) vm_malloc(len + 1);
cfread(vert, len + 1, 1, cf_shader);
cfclose(cf_shader);
} else {
mprintf((" Loading built-in default shader for: %s\n", vert_name));
vert = defaults_get_file(vert_name);
}
if(!vert)
use_shaders = false;
// read fragment shader
cf_shader = cfopen(frag_name, "rt", CFILE_NORMAL, CF_TYPE_EFFECTS);
if (cf_shader != NULL) {
int len = cfilelength(cf_shader);
frag = (char*) vm_malloc(len + 1);
cfread(frag, len + 1, 1, cf_shader);
cfclose(cf_shader);
} else {
mprintf((" Loading built-in default shader for: %s\n", frag_name));
frag = defaults_get_file(frag_name);
}
if(!vert)
use_shaders = false;
Verify( vert != NULL );
Verify( frag != NULL );
shader_id = opengl_shader_create(vert, frag);
vglUseProgramObjectARB(shader_id);
if (!shader_id)
if ( sdr_handle >= 0)
opengl_shader_set_current(sdr_handle);
else
use_shaders = false;
}
@@ -477,13 +435,13 @@ static void OGG_video_init(theora_info *tinfo)
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_LUMINANCE8, 1024, 1024, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
}
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
float screen_ratio = (float)gr_screen.center_w / (float)gr_screen.center_h;
float movie_ratio = (float)g_screenWidth / (float)g_screenHeight;
if (screen_ratio > movie_ratio)
scale_by = (float)gr_screen.max_h / (float)g_screenHeight;
scale_by = (float)gr_screen.center_h / (float)g_screenHeight;
else
scale_by = (float)gr_screen.max_w / (float)g_screenWidth;
scale_by = (float)gr_screen.center_w / (float)g_screenWidth;
// don't bother setting anything if we aren't going to need it
if (!Cmdline_noscalevid && (scale_by != 1.0f)) {
@@ -512,12 +470,12 @@ static void OGG_video_init(theora_info *tinfo)
if (scale_video) {
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_screenWidth) / 2);
g_screenY = ((fl2i(gr_screen.max_h / scale_by + 0.5f) - g_screenHeight) / 2);
g_screenX = ((fl2i(gr_screen.center_w / scale_by + 0.5f) - g_screenWidth) / 2) + fl2i(gr_screen.center_offset_x / scale_by + 0.5f);
g_screenY = ((fl2i(gr_screen.center_h / scale_by + 0.5f) - g_screenHeight) / 2) + fl2i(gr_screen.center_offset_y / scale_by + 0.5f);
} else {
// centers on 1024x768, fills on 640x480
g_screenX = ((gr_screen.max_w - g_screenWidth) / 2);
g_screenY = ((gr_screen.max_h - g_screenHeight) / 2);
g_screenX = ((gr_screen.center_w - g_screenWidth) / 2) + gr_screen.center_offset_x;
g_screenY = ((gr_screen.center_h - g_screenHeight) / 2) + gr_screen.center_offset_y;
}
// set additional values for screen width/height and UV coords
@@ -532,9 +490,9 @@ static void OGG_video_init(theora_info *tinfo)
gl_screenU = i2fl(tinfo->frame_width-1) / i2fl(2048) ;
gl_screenV = i2fl(tinfo->frame_height-1) / i2fl(2048);
GL_state.Texture.SetShaderMode(GL_TRUE);
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "ytex"), 0 );
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "utex"), 1 );
vglUniform1iARB( vglGetUniformLocationARB(shader_id, "vtex"), 2 );
GL_state.Uniform.setUniformi("ytex", 0);
GL_state.Uniform.setUniformi("utex", 1);
GL_state.Uniform.setUniformi("vtex", 2);
}
glVertices[0][0] = (GLfloat)g_screenX;
@@ -559,12 +517,12 @@ static void OGG_video_init(theora_info *tinfo)
GL_state.Array.BindArrayBuffer(0);
GL_state.Array.EnableClientVertex();
GL_state.Array.VertexPointer(2, GL_FLOAT, sizeof(glVertices[0]), glVertices);
vertex_layout vert_def;
GL_state.Array.SetActiveClientUnit(0);
GL_state.Array.EnableClientTexture();
GL_state.Array.TexPointer(2, GL_FLOAT, sizeof(glVertices[0]), &(glVertices[0][2]));
vert_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
vert_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
opengl_bind_vertex_layout(vert_def);
}
if(!use_shaders && tinfo->frame_height > 450) {
mprintf(("VIDEO: No shader support and hd video is beeing played this can get choppy."));
@@ -579,9 +537,6 @@ static void OGG_video_close()
}
if (gr_screen.mode == GR_OPENGL) {
GL_state.Array.DisableClientVertex();
GL_state.Array.DisableClientTexture();
if (scale_video) {
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
@@ -604,7 +559,7 @@ static void OGG_video_close()
ytex = utex = vtex = 0;
GLtex = 0;
GL_state.Texture.SetShaderMode(GL_FALSE);
opengl_shader_set_current( 0 );
opengl_shader_set_current();
}
if (pixelbuf != NULL) {
+2 -2
View File
@@ -36,7 +36,7 @@ int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *heigh
int retval = DDS_ERROR_NONE;
int ct = DDS_UNCOMPRESSED;
int bits = 0;
int i, trash, is_cubemap = 0;
int i, is_cubemap = 0;
int d_width = 0, d_height = 0, d_depth = 0, d_size = 0;
@@ -80,7 +80,7 @@ int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *heigh
// skip over the crap we don't care about
for (i = 0; i < 11; i++)
trash = cfread_uint(ddsfile);
cfread_uint(ddsfile);
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile);
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile);
+95 -38
View File
@@ -9,26 +9,26 @@
#include "cmdline/cmdline.h"
#include "debris/debris.h"
#include "render/3d.h"
#include "fireball/fireballs.h"
#include "radar/radar.h"
#include "gamesnd/gamesnd.h"
#include "object/objectsnd.h"
#include "globalincs/linklist.h"
#include "particle/particle.h"
#include "freespace2/freespace.h"
#include "object/objcollide.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
#include "species_defs/species_defs.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "radar/radarsetup.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multiutil.h"
#include "object/objcollide.h"
#include "object/objectsnd.h"
#include "particle/particle.h"
#include "radar/radar.h"
#include "radar/radarsetup.h"
#include "render/3d.h"
#include "ship/ship.h"
#include "ship/shipfx.h"
#include "species_defs/species_defs.h"
#include "weapon/weapon.h"
#include "cmdline/cmdline.h"
#define MAX_LIFE 10.0f
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
@@ -147,7 +147,7 @@ MONITOR(NumHullDebrisRend)
/**
* Render debris
*/
void debris_render(object * obj)
void debris_render_DEPRECATED(object * obj)
{
int i, num, swapped;
polymodel *pm;
@@ -191,10 +191,10 @@ void debris_render(object * obj)
if ( db->is_hull ) {
MONITOR_INC(NumHullDebrisRend,1);
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos );
submodel_render_DEPRECATED( db->model_num, db->submodel_num, &obj->orient, &obj->pos );
} else {
MONITOR_INC(NumSmallDebrisRend,1);
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
submodel_render_DEPRECATED( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
}
if (tbase != NULL && (swapped!=-1) && pm) {
@@ -563,6 +563,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
db->is_hull = hull_flag;
db->source_objnum = parent_objnum;
db->source_sig = source_obj->signature;
db->damage_type_idx = shipp->debris_damage_type_idx;
db->ship_info_index = shipp->ship_info_index;
db->team = shipp->team;
db->fire_timeout = 0; // if not changed, timestamp_elapsed() will return false
@@ -703,7 +704,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
// displacement fromt the center of the parent object to the center of the debris piece
vec3d world_rotvel, vel_from_rotvel;
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
vm_vec_crossprod ( &vel_from_rotvel, &world_rotvel, &to_center );
vm_vec_cross ( &vel_from_rotvel, &world_rotvel, &to_center );
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
vm_vec_add (&obj->phys_info.vel, &radial_vel, &source_obj->phys_info.vel);
@@ -843,18 +844,18 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
}
// debris ship collision -- use debris_hit_info to calculate physics
object *ship_obj = other_obj;
Assert( ship_obj->type == OBJ_SHIP );
object *pship_obj = other_obj;
Assert( pship_obj->type == OBJ_SHIP );
object *heavy = debris_hit_info->heavy;
object *light = debris_hit_info->light;
object *lighter = debris_hit_info->light;
object *heavy_obj = heavy;
object *light_obj = light;
object *light_obj = lighter;
vec3d zero, p0, p1;
vm_vec_zero(&zero);
vm_vec_sub(&p0, &light->last_pos, &heavy->last_pos);
vm_vec_sub(&p1, &light->pos, &heavy->pos);
vm_vec_sub(&p0, &lighter->last_pos, &heavy->last_pos);
vm_vec_sub(&p1, &lighter->pos, &heavy->pos);
mc.pos = &zero; // The object's position
mc.p0 = &p0; // Point 1 of ray to check
@@ -875,15 +876,15 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
vm_vec_scale(&debris_hit_info->light_rel_vel, 1/flFrametime);
} else {
debris_hit_info->collide_rotate = 0;
vm_vec_sub(&debris_hit_info->light_rel_vel, &light->phys_info.vel, &heavy->phys_info.vel);
vm_vec_sub(&debris_hit_info->light_rel_vel, &lighter->phys_info.vel, &heavy->phys_info.vel);
}
int mc_ret_val = 0;
if ( debris_hit_info->heavy == ship_obj ) { // ship is heavier, so debris is sphere. Check sphere collision against ship poly model
mc.model_instance_num = Ships[ship_obj->instance].model_instance_num;
mc.model_num = Ship_info[Ships[ship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc.orient = &ship_obj->orient; // The object's orient
if ( debris_hit_info->heavy == pship_obj ) { // ship is heavier, so debris is sphere. Check sphere collision against ship poly model
mc.model_instance_num = Ships[pship_obj->instance].model_instance_num;
mc.model_num = Ship_info[Ships[pship_obj->instance].ship_info_index].model_num; // Fill in the model to check
mc.orient = &pship_obj->orient; // The object's orient
mc.radius = pdebris->radius;
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE);
@@ -897,11 +898,8 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
mc.flags = MC_ONLY_SPHERE | MC_CHECK_SPHERELINE;
SCP_vector<int> submodel_vector;
polymodel *pm;
polymodel_instance *pmi;
ship_model_start(ship_obj);
if (model_collide(&mc)) {
// Set earliest hit time
@@ -915,7 +913,6 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
model_get_rotating_submodel_list(&submodel_vector, heavy_obj);
// Get polymodel and turn off all rotating submodels, collide against only 1 at a time.
pm = model_get(Ship_info[Ships[heavy_obj->instance].ship_info_index].model_num);
pmi = model_get_instance(Ships[heavy_obj->instance].model_instance_num);
// turn off all rotating submodels and test for collision
@@ -926,6 +923,10 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
// reset flags to check MC_CHECK_MODEL | MC_CHECK_SPHERELINE and maybe MC_CHECK_INVISIBLE_FACES and MC_SUBMODEL_INSTANCE
mc.flags = copy_flags | MC_SUBMODEL_INSTANCE;
if (Ship_info[Ships[pship_obj->instance].ship_info_index].collision_lod > -1) {
mc.lod = Ship_info[Ships[pship_obj->instance].ship_info_index].collision_lod;
}
// check each submodel in turn
for (smv = submodel_vector.begin(); smv != submodel_vector.end(); ++smv) {
// turn on submodel for collision test
@@ -936,10 +937,10 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
// find the start and end positions of the sphere in submodel RF
pmi->submodel[*smv].angs = pmi->submodel[*smv].prev_angs;
world_find_model_instance_point(&p0, &light_obj->last_pos, pm, pmi, *smv, &heavy_obj->last_orient, &heavy_obj->last_pos);
world_find_model_instance_point(&p0, &light_obj->last_pos, pmi, *smv, &heavy_obj->last_orient, &heavy_obj->last_pos);
pmi->submodel[*smv].angs = copy_angles;
world_find_model_instance_point(&p1, &light_obj->pos, pm, pmi, *smv, &heavy_obj->orient, &heavy_obj->pos);
world_find_model_instance_point(&p1, &light_obj->pos, pmi, *smv, &heavy_obj->orient, &heavy_obj->pos);
mc.p0 = &p0;
mc.p1 = &p1;
@@ -953,18 +954,18 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
// set up debris_hit_info common
set_hit_struct_info(debris_hit_info, &mc, SUBMODEL_ROT_HIT);
model_instance_find_world_point(&debris_hit_info->hit_pos, &mc.hit_point, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
model_instance_find_world_point(&debris_hit_info->hit_pos, &mc.hit_point, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
// set up debris_hit_info for rotating submodel
if (debris_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
vec3d int_light_pos, diff;
vm_vec_sub(&diff, mc.p1, mc.p0);
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
model_instance_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
model_instance_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_instance_num, mc.hit_submodel, &heavy_obj->orient, &zero);
}
}
// Don't look at this submodel again
@@ -988,7 +989,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
// get collision normal if not edge hit
if (debris_hit_info->edge_hit == 0) {
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, heavy_obj, mc.hit_submodel);
model_instance_find_obj_dir(&debris_hit_info->collision_normal, &mc.hit_normal, Ships[heavy_obj->instance].model_instance_num, mc.hit_submodel, &heavy_obj->orient);
}
// find position in submodel RF of light object at collison
@@ -1007,7 +1008,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
mc.submodel_num = Debris[num].submodel_num;
model_clear_instance( mc.model_num );
mc.orient = &pdebris->orient; // The object's orient
mc.radius = model_get_core_radius(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
mc.radius = model_get_core_radius(Ship_info[Ships[pship_obj->instance].ship_info_index].model_num);
// check for collision between debris model and ship sphere
mc.flags = (MC_CHECK_MODEL | MC_SUBMODEL | MC_CHECK_SPHERELINE);
@@ -1094,3 +1095,59 @@ void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs
pi->I_body_inv.vec.fvec.xyz.y = 0.0f;
pi->I_body_inv.vec.fvec.xyz.z = 12.0f / (pi->mass * (dx*dx + dy*dy));
}
void debris_render(object * obj, draw_list *scene)
{
int i, num, swapped;
polymodel *pm;
debris *db;
swapped = -1;
pm = NULL;
num = obj->instance;
Assert(num >= 0 && num < MAX_DEBRIS_PIECES);
db = &Debris[num];
Assert(db->flags & DEBRIS_USED);
texture_info *tbase = NULL;
model_clear_instance( db->model_num );
// Swap in a different texture depending on the species
if (db->species >= 0)
{
pm = model_get( db->model_num );
//WMC - Someday, we should have glowing debris.
if ( pm != NULL && (pm->n_textures == 1) ) {
tbase = &pm->maps[0].textures[TM_BASE_TYPE];
swapped = tbase->GetTexture();
tbase->SetTexture(Species_info[db->species].debris_texture.bitmap_id);
}
}
// Only render electrical arcs if within 500m of the eye (for a 10m piece)
if ( vm_vec_dist_quick( &obj->pos, &Eye_position ) < obj->radius*50.0f ) {
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
if ( timestamp_valid( db->arc_timestamp[i] ) ) {
model_add_arc( db->model_num, db->submodel_num, &db->arc_pts[i][0], &db->arc_pts[i][1], MARC_TYPE_NORMAL );
}
}
}
model_render_params render_info;
if ( !db->is_hull ) {
render_info.set_flags(MR_NO_LIGHTING);
}
MONITOR_INC(NumHullDebrisRend,1);
submodel_render_queue( &render_info, scene, db->model_num, db->submodel_num, &obj->orient, &obj->pos );
if (tbase != NULL && (swapped!=-1) && pm) {
tbase->SetTexture(swapped);
}
}
+4 -1
View File
@@ -16,6 +16,7 @@
class object;
struct CFILE;
class draw_list;
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
@@ -24,6 +25,7 @@ typedef struct debris {
int flags; // See DEBRIS_??? defines
int source_objnum; // What object this came from
int source_sig; // Signature of the source object
int damage_type_idx; // Damage type of this debris
int ship_info_index; // Ship info index of the ship type debris came from
int team; // Team of the ship where the debris came from
int objnum; // What object this is linked to
@@ -61,7 +63,8 @@ extern int Num_debris_pieces;
struct collision_info_struct;
void debris_init();
void debris_render( object * obj );
void debris_render_DEPRECATED( object * obj );
void debris_render(object * obj, draw_list *scene);
void debris_delete( object * obj );
void debris_process_post( object * obj, float frame_time);
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
+12 -14
View File
@@ -9,15 +9,12 @@
#include "debugconsole/console.h"
#include "debugconsole/consoleparse.h"
#include "globalincs/alphacolors.h"
#include "globalincs/pstypes.h"
#include "globalincs/version.h"
#include "globalincs/vmallocator.h"
#include "graphics/2d.h"
#include "graphics/font.h"
#include "io/timer.h"
#include "io/key.h"
#include "io/timer.h"
#include "osapi/osapi.h"
#include <algorithm>
@@ -104,7 +101,8 @@ void dc_draw(bool show_prompt);
/**
* Draws the cursor
* @param [in] cmd_string The formatted command string displayed by dc_draw_window
* @param [in] x y The x and y screen position of the command string
* @param [in] x The x screen position of the command string
* @param [in] y The y screen position of the command string
*/
void dc_draw_cursor( SCP_string &cmd_string, int x, int y );
@@ -189,7 +187,7 @@ void dc_draw(bool show_prompt = FALSE)
gr_clear();
gr_set_font(dc_font);
gr_set_color_fast( &Color_bright );
gr_string( 0x8000, 3, dc_title.c_str(), GR_RESIZE_NONE );
gr_string( 0x8000, gr_screen.center_offset_y + 3, dc_title.c_str(), GR_RESIZE_NONE );
gr_set_color_fast( &Color_normal );
@@ -209,7 +207,7 @@ void dc_draw_cursor( SCP_string &cmd_string, int x, int y )
w %= (DCOLS * Current_font->w);
//gr_string( w, debug_y*16, "_" );
gr_rect((x + (w + 1)), (y + (h + 1)), 2, Current_font->h, GR_RESIZE_NONE);
gr_rect(gr_screen.center_offset_x + (x + (w + 1)), gr_screen.center_offset_y + (y + (h + 1)), 2, Current_font->h, GR_RESIZE_NONE);
}
}
@@ -245,7 +243,7 @@ void dc_draw_window(bool show_prompt)
// Draw the buffer strings
for (i = 0; i < buffer_lines; ++i) {
if ((i + dc_scroll_y) < dc_buffer.size()) {
gr_string(0, ((i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
}
}
@@ -263,7 +261,7 @@ void dc_draw_window(bool show_prompt)
++j;
}
}
gr_string(0, ((i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
dc_draw_cursor(out_str, 0, ((i * row_height)));
gr_set_color_fast(&Color_normal);
@@ -284,8 +282,8 @@ void dc_init(void)
col_width = Current_font->w; // Col/Character width, in pixels
dc_scroll_x = 0;
dc_scroll_y = 0;
DCOLS = (gr_screen.max_w / col_width) - 1; // Subtract as needed. Windowed mode has some quirks with the resolution
DROWS = (gr_screen.max_h / row_height) - 2;
DCOLS = (gr_screen.center_w / col_width) - 1; // Subtract as needed. Windowed mode has some quirks with the resolution
DROWS = (gr_screen.center_h / row_height) - 2;
DBCOLS = DCOLS;
DBROWS = 2 * DROWS;
@@ -391,7 +389,7 @@ void dc_putc(char c)
temp_str.push_back(c);
gr_get_string_size(&w, NULL, temp_str.c_str());
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
c = '\n';
} else {
@@ -415,7 +413,7 @@ void dc_putc(char c)
temp_str.append(i, ' ');
gr_get_string_size(&w, NULL, temp_str.c_str());
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
c = '\n';
} else {
@@ -458,7 +456,7 @@ void dc_putc(char c)
temp_str.push_back(c);
gr_get_string_size(&w, NULL, temp_str.c_str());
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.max_w)) {
if ((temp_str.size() >= DBCOLS) || (w > gr_screen.center_w)) {
/**
* Word wrapping
* Save the word, clear the line of the word, push new line with the word on it
-2
View File
@@ -19,8 +19,6 @@
#include "debugconsole/console.h"
#include "debugconsole/consoleparse.h"
#include "globalincs/pstypes.h"
#include "globalincs/vmallocator.h"
#include "io/key.h"
#include <algorithm>
+9 -13
View File
@@ -9,15 +9,11 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////
// Testing Goals
// Breakpoints are set at places that need testing:
// * the value of endptr strtol and strtoul needs to investigated, according to cplusplus.com, *endptr = end of the string that was successfully converted
// TODO: Make a fast version of the parse_long, parse_ulong, etc. That just checks the first 1-3 characters. The fast version will be used in retail builds while the slow/safe version will be in debug's
// @todo Make a fast version of the parse_long, parse_ulong, etc. That just checks the first 1-3 characters. The fast version will be used in retail builds while the slow/safe version will be in debug's
// @todo Maybe make parser functions case-insensitive
////////////////
#include "debugconsole/consoleparse.h"
#include "debugconsole/console.h"
#include "globalincs/pstypes.h"
#include "debugconsole/consoleparse.h"
#include "parse/parselo.h"
#include <algorithm>
@@ -92,7 +88,7 @@ void dc_get_token_no_advance(SCP_string &out_str);
* @param[in] ch Points to the start of the string to parse
* @param[in] type The expected type. is thrown along with ch when an unexpected/malformed float is found
*
* @ret The value of the parsed token
* @return The value of the parsed token
* @details
* The returned double may be cast to a single-precision float, but be sure to check it before doing so!
*/
@@ -466,7 +462,7 @@ void dc_required_string(char *pstr)
dc_ignore_gray_space();
if (strnicmp(pstr, Cp, strlen(pstr))) {
if (strncmp(pstr, Cp, strlen(pstr)) == 0) {
str_found = pstr;
}
@@ -492,10 +488,10 @@ int dc_required_string_either(char *str1, char *str2)
dc_ignore_gray_space();
if (strncmp(str1, Cp, strlen(str1) == 0)) {
if (strncmp(str1, Cp, strlen(str1)) == 0) {
str_found = str1;
i = 0;
} else if (strncmp(str2, Cp, strlen(str2) == 0)) {
} else if (strncmp(str2, Cp, strlen(str2)) == 0) {
str_found = str2;
i = 1;
}
@@ -563,7 +559,7 @@ bool dc_optional_string(const char *pstr)
{
dc_ignore_gray_space();
if (strncmp(pstr, Cp, strlen(pstr) != 0)) {
if (strncmp(pstr, Cp, strlen(pstr)) != 0) {
return false;
} // Else, optional string was found
@@ -1069,7 +1065,7 @@ void dc_stuff_float(float *f)
value_d = dc_parse_double(token.c_str(), DCT_FLOAT); // Parse and convert
// Stuff value if within bounds
if ((abs(value_d) < FLT_MAX) && (abs(value_d) > FLT_MIN)) {
if ((std::abs(value_d) < FLT_MAX) && (std::abs(value_d) > FLT_MIN)) {
*f = static_cast<float>(value_d);
} else {
throw errParse(token.c_str(), DCT_FLOAT);
+1
View File
@@ -14,6 +14,7 @@
* @details A lot of functions here are blatently copied from parselo.h :D
*/
#include "debugconsole/console.h"
#include "globalincs/pstypes.h"
#include <cstdarg>
-239
View File
@@ -1,239 +0,0 @@
/*
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
*
* You may not sell or otherwise commercially exploit the source or things you
* created based on the source.
*
*/
/*
* This module is intended as a debug tool to measure the speed of blocks of code and display
* that information as coloured bars across the top of the screen.
*
* This allows interactive measuring of components of the code, very useful for optimisztion.
*/
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#endif
#include "timerbar.h"
#include "globalincs/pstypes.h"
// Internal structure for handling frame data
typedef struct
{
LARGE_INTEGER start_value;
LARGE_INTEGER total_value;
LARGE_INTEGER average;
LARGE_INTEGER frame_total;
} timerbar_profile;
timerbar_profile profiles[MAX_NUM_TIMERBARS];
int timerbar_current_profile = 0;
LARGE_INTEGER timerbar_ultimate_start_value;
LARGE_INTEGER timerbar_last_start_value;
// Data needed for push and pop functionality
const int MAX_TB_STACK_SIZE = 100;
int timerbar_stack[MAX_TB_STACK_SIZE];
int timerbar_current_stack_layer = 0;
/**
* Pssst, hey, you. Ya wanna timerbar? Real cheap.
*
* @param value Index count value (?)
*/
void timerbar_push(int value)
{
if(timerbar_current_stack_layer >= MAX_TB_STACK_SIZE)
{
// To many pushs, this must be a bug
// Someone is letting code miss the pops, check for early retuns
Assert(!(timerbar_current_stack_layer >= MAX_TB_STACK_SIZE));
return;
}
timerbar_stack[timerbar_current_stack_layer] = timerbar_current_profile;
timerbar_current_stack_layer++;
timerbar_switch_type(value);
}
/*
*/
void timerbar_pop()
{
timerbar_current_stack_layer--;
if(timerbar_current_stack_layer < 0)
{
Assert(!(timerbar_current_stack_layer < 0));
timerbar_current_stack_layer = 0;
return;
}
timerbar_switch_type(timerbar_stack[timerbar_current_stack_layer]);
}
/**
* This pointer holds the draw function to use or NULL
*
* @param colour Colour index (>=0)
* @param x Coordinate position
* @param y Coordinate position
* @param w element width
* @param h element height
*/
void (*draw_func_ptr)(int colour, float x, float y, float w, float h) = NULL;
/*
*/
void timerbar_start_frame()
{
timerbar_current_stack_layer = 0;
timerbar_current_profile = 0;
if(QueryPerformanceCounter(&timerbar_ultimate_start_value) == FALSE)
{
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
draw_func_ptr = NULL;
}
timerbar_last_start_value = timerbar_ultimate_start_value;
}
// Constants need for timerbar_conv_and_draw calculations
const int WIDTH = 480;
const float WIDTHF = ((float) WIDTH) * 1.01f;
/**
* Internal conversion function to convert draw data into bars for the screen
*
* @param colour Colour index (>=0)
* @param xpos X position to start bar on
* @param xwidth Width of bar
* @param yrow Index of row bar belongs to
*/
void timerbar_conv_and_draw(int colour, int xpos, int xwidth, int yrow)
{
float fxpos = (float) xpos;
float fxwidth = (float) xwidth;
draw_func_ptr(colour,
fxpos / WIDTHF,
yrow * 0.01f,
fxwidth / WIDTHF,
0.005f);
}
/*
*/
void timerbar_end_frame()
{
// Now we want to draw the bars
if(draw_func_ptr == NULL)
{
// we have not been given a draw function so we are going to have to quit
return;
}
timerbar_switch_type(-1);
int last_xpos = 0;
int y_pos = 0;
for(int i = 0; i < MAX_NUM_TIMERBARS; i++)
{
// Nothing to render this frame
if(profiles[i].frame_total.QuadPart == 0)
{
continue;
}
int xsize = (int) profiles[i].frame_total.QuadPart / 90;
// break condition in else
while(1)
{
// if bar runs over
if(last_xpos + xsize > WIDTH)
{
int rem_len = WIDTH - last_xpos;
// Draw from current position to the end of the bar
timerbar_conv_and_draw(i, last_xpos, rem_len, y_pos);
xsize -= rem_len;
last_xpos = 0;
y_pos++;
}
else
{
// Draw whats left and break for the next bar
timerbar_conv_and_draw(i,last_xpos, xsize, y_pos);
last_xpos += xsize;
break;
}
}
// reset for next frame
profiles[i].frame_total.QuadPart = 0;
}
}
/**
* Not entirely sure what this does.
*
* @param num Probably a pretend boolean
*/
void timerbar_switch_type(int num)
{
if(num >= MAX_NUM_TIMERBARS)
{
return;
}
// Calculate old profile's total
LARGE_INTEGER now;
if(QueryPerformanceCounter(&now) == FALSE)
{
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
}
profiles[timerbar_current_profile].frame_total.QuadPart +=
(now.QuadPart - timerbar_last_start_value.QuadPart);
if(num != -1)
{
// Switch to new profile
timerbar_current_profile = num;
}
// Update time to count from
if(QueryPerformanceCounter(&timerbar_last_start_value) == FALSE)
{
// DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
}
}
/**
* Clears the instance of the timer bar
*
* Look at the parameters for "void (*draw_func_ptr)"
* They directly equate the new_draw_func_ptr, but we can't
* place params for a double stuffed function like this.
*/
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h))
{
draw_func_ptr = new_draw_func_ptr;
}
-30
View File
@@ -1,30 +0,0 @@
/*
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
*
* You may not sell or otherwise commercially exploit the source or things you
* created based on the source.
*
*/
#ifndef _TIMERBAR_HEADER_
#define _TIMERBAR_HEADER_
const int MAX_NUM_TIMERBARS = 20;
#include "cmdline/cmdline.h"
// These functions should never be used directly, always use macros below
void timerbar_start_frame();
void timerbar_end_frame();
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h));
void timerbar_push(int value);
void timerbar_pop();
// This function shouldnt not be used any more or it will break push and pop calls
void timerbar_switch_type(int num);
#endif
+161 -82
View File
@@ -9,18 +9,17 @@
#include "asteroid/asteroid.h"
#include "cmdline/cmdline.h"
#include "fireball/fireballs.h"
#include "gamesnd/gamesnd.h"
#include "graphics/tmapper.h"
#include "render/3d.h"
#include "localization/localize.h"
#include "model/model.h"
#include "object/object.h"
#include "ship/ship.h"
#include "gamesnd/gamesnd.h"
#include "localization/localize.h"
#include "cmdline/cmdline.h"
#include "parse/parselo.h"
#include "globalincs/pstypes.h"
#include "asteroid/asteroid.h"
#include "render/3d.h"
#include "ship/ship.h"
#include <stdlib.h>
@@ -76,7 +75,7 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb)
if(fb->warp_open_sound_index > -1) {
sound_index = fb->warp_open_sound_index;
} else if((ship_class >= 0) && (ship_class < Num_ship_classes)){
} else if ((ship_class >= 0) && (ship_class < static_cast<int>(Ship_info.size()))) {
if ( Ship_info[ship_class].flags & SIF_HUGE_SHIP ) {
sound_index = SND_CAPITAL_WARP_IN;
fb->flags |= FBF_WARP_CAPITAL_SIZE;
@@ -159,84 +158,93 @@ static void fireball_set_default_color(int idx)
*/
void parse_fireball_tbl(const char *filename)
{
int rval;
lod_checker lod_check;
color fb_color;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
required_string("#Start");
while (required_string_either("#End", "$Name:")) {
memset(&lod_check, 0, sizeof(lod_checker));
// base filename
required_string("$Name:");
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
lod_check.override = -1;
// these entries should only be in TBMs, and it has to include at least one
if (Parsing_modular_table) {
if (optional_string("+Explosion_Medium")) {
lod_check.override = FIREBALL_EXPLOSION_MEDIUM;
}
else if (optional_string("+Warp_Effect")) {
lod_check.override = FIREBALL_WARP;
}
else if (optional_string("+Knossos_Effect")) {
lod_check.override = FIREBALL_KNOSSOS;
}
else if (optional_string("+Asteroid")) {
lod_check.override = FIREBALL_ASTEROID;
}
else if (optional_string("+Explosion_Large1")) {
lod_check.override = FIREBALL_EXPLOSION_LARGE1;
}
else if (optional_string("+Explosion_Large2")){
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
}
else {
required_string("+Custom_Fireball");
stuff_int(&lod_check.override);
}
}
lod_check.num_lods = 1;
// Do we have an LOD num
if (optional_string("$LOD:")) {
stuff_int(&lod_check.num_lods);
}
if (lod_check.num_lods > MAX_FIREBALL_LOD) {
lod_check.num_lods = MAX_FIREBALL_LOD;
}
// check for particular lighting color
if (optional_string("$Light color:")) {
int r, g, b;
stuff_int(&r);
stuff_int(&g);
stuff_int(&b);
CLAMP(r, 0, 255);
CLAMP(g, 0, 255);
CLAMP(b, 0, 255);
gr_init_color(&fb_color, r, g, b);
}
else {
// to keep things simple, we just use 0 alpha to indicate that a default value should be used
memset(&fb_color, 0, sizeof(color));
}
// we may use one filename for multiple entries so we'll have to handle dupes post parse
LOD_checker.push_back(lod_check);
LOD_color.push_back(fb_color);
}
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
required_string("#Start");
while (required_string_either("#End", "$Name:")) {
memset( &lod_check, 0, sizeof(lod_checker) );
// base filename
required_string("$Name:");
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
lod_check.override = -1;
// these entries should only be in TBMs, and it has to include at least one
if ( Parsing_modular_table ) {
if (optional_string("+Explosion_Medium")) {
lod_check.override = FIREBALL_EXPLOSION_MEDIUM;
} else if (optional_string("+Warp_Effect")) {
lod_check.override = FIREBALL_WARP;
} else if (optional_string("+Knossos_Effect")) {
lod_check.override = FIREBALL_KNOSSOS;
} else if (optional_string("+Asteroid")) {
lod_check.override = FIREBALL_ASTEROID;
} else if (optional_string("+Explosion_Large1")) {
lod_check.override = FIREBALL_EXPLOSION_LARGE1;
} else if (optional_string("+Explosion_Large2")){
lod_check.override = FIREBALL_EXPLOSION_LARGE2;
} else {
required_string("+Custom_Fireball");
stuff_int(&lod_check.override);
}
}
lod_check.num_lods = 1;
// Do we have an LOD num
if (optional_string("$LOD:")) {
stuff_int(&lod_check.num_lods);
}
if (lod_check.num_lods > MAX_FIREBALL_LOD) {
lod_check.num_lods = MAX_FIREBALL_LOD;
}
// check for particular lighting color
if ( optional_string("$Light color:") ) {
int r, g, b;
stuff_int(&r);
stuff_int(&g);
stuff_int(&b);
CLAMP(r, 0, 255);
CLAMP(g, 0, 255);
CLAMP(b, 0, 255);
gr_init_color(&fb_color, r, g, b);
} else {
// to keep things simple, we just use 0 alpha to indicate that a default value should be used
memset( &fb_color, 0, sizeof(color) );
}
// we may use one filename for multiple entries so we'll have to handle dupes post parse
LOD_checker.push_back(lod_check);
LOD_color.push_back(fb_color);
}
required_string("#End");
}
void fireball_parse_tbl()
@@ -366,7 +374,7 @@ void fireball_init()
MONITOR( NumFireballsRend )
void fireball_render(object * obj)
void fireball_render_DEPRECATED(object * obj)
{
int num;
vertex p;
@@ -1043,3 +1051,74 @@ float fireball_wormhole_intensity( object *obj )
}
return rad;
}
void fireball_render(object* obj, draw_list *scene)
{
int num;
vertex p;
fireball *fb;
MONITOR_INC( NumFireballsRend, 1 );
num = obj->instance;
fb = &Fireballs[num];
if ( Fireballs[num].current_bitmap < 0 )
return;
if ( Cmdline_nohtl ) {
g3_rotate_vertex(&p, &obj->pos );
} else {
g3_transfer_vertex(&p, &obj->pos);
}
switch ( fb->fireball_render_type ) {
case FIREBALL_MEDIUM_EXPLOSION: {
batch_add_bitmap (
Fireballs[num].current_bitmap,
TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
&p,
fb->orient,
obj->radius
);
}
break;
case FIREBALL_LARGE_EXPLOSION: {
// Make the big explosions rotate with the viewer.
batch_add_bitmap_rotated (
Fireballs[num].current_bitmap,
TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT | TMAP_FLAG_SOFT_QUAD,
&p,
(i2fl(fb->orient)*PI)/180.0f,
obj->radius
);
}
break;
case FIREBALL_WARP_EFFECT: {
float percent_life = fb->time_elapsed / fb->total_time;
float rad;
// Code to make effect grow/shrink.
float t = fb->time_elapsed;
if ( t < WARPHOLE_GROW_TIME ) {
rad = (float)pow(t/WARPHOLE_GROW_TIME,0.4f)*obj->radius;
} else if ( t < fb->total_time - WARPHOLE_GROW_TIME ) {
rad = obj->radius;
} else {
rad = (float)pow((fb->total_time - t)/WARPHOLE_GROW_TIME,0.4f)*obj->radius;
}
warpin_queue_render(scene, obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_3D) );
}
break;
default:
Int3();
}
}
+5 -1
View File
@@ -13,6 +13,7 @@
#define _FIREBALLS_H
#include "globalincs/pstypes.h"
#include "model/modelrender.h"
class object;
class ship_info;
@@ -76,7 +77,8 @@ typedef struct fireball {
// end move
void fireball_init();
void fireball_render(object * obj);
void fireball_render_DEPRECATED(object * obj);
void fireball_render(object* obj, draw_list *scene);
void fireball_delete( object * obj );
void fireball_process_post(object * obj, float frame_time);
@@ -114,6 +116,8 @@ float fireball_wormhole_intensity( object *obj );
// internal function to draw warp grid.
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
extern void warpin_queue_render(draw_list *scene, object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d);
extern int Warp_model;
// Goober5000
+179 -15
View File
@@ -10,17 +10,15 @@
#include "math/vecmat.h"
#include "graphics/tmapper.h"
#include "render/3d.h"
#include "fireball/fireballs.h"
#include "mission/missionparse.h"
#include "nebula/neb.h"
#include "globalincs/pstypes.h"
#include "model/model.h"
#include "ship/ship.h"
#include "cmdline/cmdline.h"
#include "globalincs/pstypes.h"
#include "graphics/tmapper.h"
#include "math/vecmat.h"
#include "mission/missionparse.h"
#include "model/model.h"
#include "nebula/neb.h"
#include "render/3d.h"
#include "ship/ship.h"
extern int Warp_model;
extern int Warp_glow_bitmap;
@@ -47,6 +45,25 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
}
void warpin_batch_draw_face( int texture, vertex *v1, vertex *v2, vertex *v3 )
{
vec3d norm;
vertex vertlist[3];
vm_vec_perp(&norm,&v1->world, &v2->world, &v3->world);
if ( vm_vec_dot(&norm, &v1->world ) >= 0.0 ) {
vertlist[0] = *v3;
vertlist[1] = *v2;
vertlist[2] = *v1;
} else {
vertlist[0] = *v1;
vertlist[1] = *v2;
vertlist[2] = *v3;
}
batch_add_tri(texture, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, vertlist, 1.0f);
}
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
{
vec3d center;
@@ -109,15 +126,18 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
}
if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) {
float scale = radius / 25.0f;
model_set_warp_globals(scale, scale, scale, texture_bitmap_num, (radius/max_radius) );
model_render_params render_info;
vec3d scale;
scale.xyz.z = scale.xyz.y = scale.xyz.x = radius / 25.0f;
render_info.set_warp_params(texture_bitmap_num, radius/max_radius, scale);
float dist = vm_vec_dist_quick( pos, &Eye_position );
model_set_detail_level((int)(dist / (radius * 10.0f)));
render_info.set_detail_level_lock((int)(dist / (radius * 10.0f)));
model_render( Warp_model, orient, pos, MR_LOCK_DETAIL | MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL );
render_info.set_flags(MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL | MR_NO_BATCH);
model_set_warp_globals();
model_render_immediate( &render_info, Warp_model, orient, pos );
} else {
float Grid_depth = radius/2.5f;
@@ -197,3 +217,147 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
gr_zbuffer_set( saved_gr_zbuffering );
}
void warpin_queue_render(draw_list *scene, object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
{
vec3d center;
vec3d vecs[5];
vertex verts[5];
vm_vec_scale_add( &center, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
if (Warp_glow_bitmap >= 0) {
float r = radius;
bool render_it = true;
#define OUT_PERCENT1 0.80f
#define OUT_PERCENT2 0.90f
#define IN_PERCENT1 0.10f
#define IN_PERCENT2 0.20f
if (Cmdline_warp_flash)
{
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
//render_it = true;
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
//render_it = true;
}
}
if (render_it) {
// Add in noise
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
r *= (0.40f + Noise[noise_frame] * 0.30f);
// Bobboau's warp thingie, toggled by cmdline
if (Cmdline_warp_flash) {
r += powf((2.0f * life_percent) - 1.0f, 24.0f) * max_radius * 1.5f;
}
vecs[4] = center;
verts[4].texture_position.u = 0.5f; verts[4].texture_position.v = 0.5f;
if (Cmdline_nohtl) {
g3_rotate_vertex( &verts[4], &vecs[4] );
} else {
g3_transfer_vertex( &verts[4], &vecs[4] );
}
float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
batch_add_bitmap(Warp_glow_bitmap, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, &verts[4], 0, r, alpha);
}
}
if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) {
model_render_params render_info;
float scale = radius / 25.0f;
vec3d warp_scale;
warp_scale.xyz.x = warp_scale.xyz.y = warp_scale.xyz.z = scale;
float dist = vm_vec_dist_quick( pos, &Eye_position );
render_info.set_warp_params(texture_bitmap_num, radius/max_radius, warp_scale);
render_info.set_detail_level_lock((int)(dist / (radius * 10.0f)));
render_info.set_flags(MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL | MR_NO_BATCH);
model_render_queue( &render_info, scene, Warp_model, orient, pos);
} else {
float Grid_depth = radius/2.5f;
// gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
vm_vec_scale_add( &vecs[0], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[1], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[2], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[3], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
vecs[4] = center;
verts[0].texture_position.u = 0.01f;
verts[0].texture_position.v = 0.01f;
verts[1].texture_position.u = 0.99f;
verts[1].texture_position.v = 0.01f;
verts[2].texture_position.u = 0.99f;
verts[2].texture_position.v = 0.99f;
verts[3].texture_position.u = 0.01f;
verts[3].texture_position.v = 0.99f;
verts[4].texture_position.u = 0.5f;
verts[4].texture_position.v = 0.5f;
if (Cmdline_nohtl) {
g3_rotate_vertex( &verts[0], &vecs[0] );
g3_rotate_vertex( &verts[1], &vecs[1] );
g3_rotate_vertex( &verts[2], &vecs[2] );
g3_rotate_vertex( &verts[3], &vecs[3] );
g3_rotate_vertex( &verts[4], &vecs[4] );
} else {
g3_transfer_vertex( &verts[0], &vecs[0] );
g3_transfer_vertex( &verts[1], &vecs[1] );
g3_transfer_vertex( &verts[2], &vecs[2] );
g3_transfer_vertex( &verts[3], &vecs[3] );
g3_transfer_vertex( &verts[4], &vecs[4] );
}
warpin_batch_draw_face( texture_bitmap_num, &verts[0], &verts[4], &verts[1] );
warpin_batch_draw_face( texture_bitmap_num, &verts[1], &verts[4], &verts[2] );
warpin_batch_draw_face( texture_bitmap_num, &verts[4], &verts[3], &verts[2] );
warpin_batch_draw_face( texture_bitmap_num, &verts[0], &verts[3], &verts[4] );
}
if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) {
//flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
flash_ball warp_ball(20, .1f,.25f, &orient->vec.fvec, pos, 4.0f, 0.5f);
float adg = (2.0f * life_percent) - 1.0f;
float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f;
if (pct > 0.00001f) {
warp_ball.render(Warp_ball_bitmap, max_radius * pct * 0.5f, adg * adg, adg * adg * 6.0f);
}
}
}
+4 -4
View File
@@ -124,14 +124,14 @@ BOOL AltShipClassDlg::OnInitDialog()
m_set_from_ship_class.AddString("Set From Variable");
}
count = 0;
for (i=0; i<Num_ship_classes; i++)
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
{
if (player_ships_only && !(Ship_info[i].flags & SIF_PLAYER_SHIP)) {
if (player_ships_only && !(it->flags & SIF_PLAYER_SHIP)) {
continue;
}
ship_class_indices[count++] = i;
m_set_from_ship_class.AddString(Ship_info[i].name);
ship_class_indices[count++] = std::distance(Ship_info.cbegin(), it);
m_set_from_ship_class.AddString(it->name);
}
m_set_from_ship_class.SetCurSel(num_string_variables?1:0); // Set to the first ship class
+34 -9
View File
@@ -59,10 +59,27 @@ BOOL FictionViewerDlg::OnInitDialog()
box->AddString(Spooled_music[i].name);
}
// init variables
m_story_file = _T(fiction_file());
m_font_file = _T(fiction_font());
m_voice_file = _T(fiction_voice());
// make sure we have at least one stage
if (Fiction_viewer_stages.empty())
{
fiction_viewer_stage stage;
memset(&stage, 0, sizeof(fiction_viewer_stage));
stage.formula = Locked_sexp_true;
Fiction_viewer_stages.push_back(stage);
}
else if (Fiction_viewer_stages.size() > 1)
{
MessageBox("You have multiple fiction viewer stages defined for this mission. At present, FRED will only allow you to edit the first stage.");
}
// init fields based on first fiction viewer stage
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
m_story_file = _T(stagep->story_filename);
m_font_file = _T(stagep->font_filename);
m_voice_file = _T(stagep->voice_filename);
// music is managed through the mission
m_fiction_music = Mission_music[SCORE_FICTION_VIEWER] + 1;
CDialog::OnInitDialog();
@@ -74,9 +91,15 @@ void FictionViewerDlg::OnOK()
{
UpdateData(TRUE);
// load it up
fiction_viewer_reset();
fiction_viewer_load((const char *)(LPCSTR)m_story_file, (const char *)(LPCSTR)m_font_file, (const char *)(LPCSTR)m_voice_file);
// store the fields in the data structure
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
strcpy_s(stagep->story_filename, (LPCSTR)m_story_file);
strcpy_s(stagep->font_filename, (LPCSTR)m_font_file);
strcpy_s(stagep->voice_filename, (LPCSTR)m_voice_file);
// if we don't have a story file, remove this stage (stage 0)
if (strlen(stagep->story_filename) == 0)
Fiction_viewer_stages.erase(Fiction_viewer_stages.begin());
// set music
Mission_music[SCORE_FICTION_VIEWER] = m_fiction_music - 1;
@@ -114,6 +137,8 @@ void FictionViewerDlg::OnClose()
int FictionViewerDlg::query_modified()
{
return strcmp(m_story_file, fiction_file()) || strcmp(m_font_file, fiction_font()) ||
strcmp(m_voice_file, fiction_voice()) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
fiction_viewer_stage *stagep = &Fiction_viewer_stages.at(0);
return strcmp(m_story_file, stagep->story_filename) || strcmp(m_font_file, stagep->font_filename) ||
strcmp(m_voice_file, stagep->voice_filename) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
}
+3
View File
@@ -22,6 +22,9 @@ public:
// Dialog Data
//{{AFX_DATA(FictionViewerDlg)
enum { IDD = IDD_FICTION_VIEWER };
CString m_fiction_background_640;
CString m_fiction_background_1024;
int m_fiction_ui;
CString m_story_file;
CString m_font_file;
CString m_voice_file;
+1 -1
View File
@@ -440,7 +440,7 @@ void asteroid_editor::update_init()
for (k = 0; k < MAX_ACTIVE_DEBRIS_TYPES; k++)
{
box_index = ((CComboBox*)GetDlgItem(Dlg_id[k]))->AddString("None");
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, -1);
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, static_cast<DWORD_PTR>(-1));
}
// now add each kind of debris to each box
+61 -58
View File
@@ -229,17 +229,17 @@ void bg_bitmap_dlg::create()
angles skybox_angles;
vm_extract_angles_matrix(&skybox_angles, &The_mission.skybox_orientation);
m_skybox_pitch = (int) fl_degrees(skybox_angles.p);
m_skybox_bank = (int) fl_degrees(skybox_angles.b);
m_skybox_heading = (int) fl_degrees(skybox_angles.h);
m_skybox_pitch = fl2ir(fl_degrees(skybox_angles.p));
m_skybox_bank = fl2ir(fl_degrees(skybox_angles.b));
m_skybox_heading = fl2ir(fl_degrees(skybox_angles.h));
//make sure angle values are in the 0-359 degree range
if (m_skybox_pitch < 0)
m_skybox_pitch = m_skybox_pitch + 359;
m_skybox_pitch = m_skybox_pitch + 360;
if (m_skybox_bank < 0)
m_skybox_bank = m_skybox_bank + 359;
m_skybox_bank = m_skybox_bank + 360;
if (m_skybox_heading < 0)
m_skybox_heading = m_skybox_heading + 359;
m_skybox_heading = m_skybox_heading + 360;
for(i=0; i<MAX_NEB2_BITMAPS; i++){
@@ -730,9 +730,9 @@ void bg_bitmap_dlg::OnSunChange()
starfield_list_entry *sle = &background->suns[s_index];
s_name = CString(sle->filename);
s_pitch = (int) (fl_degrees(sle->ang.p) + delta);
s_bank = (int) (fl_degrees(sle->ang.b) + delta);
s_heading = (int) (fl_degrees(sle->ang.h) + delta);
s_pitch = fl2ir(fl_degrees(sle->ang.p) + delta);
s_bank = fl2ir(fl_degrees(sle->ang.b) + delta);
s_heading = fl2ir(fl_degrees(sle->ang.h) + delta);
s_scale = sle->scale_x;
// stuff back into the controls
@@ -894,9 +894,9 @@ void bg_bitmap_dlg::OnBitmapChange()
starfield_list_entry *sle = &background->bitmaps[b_index];
b_name = CString(sle->filename);
b_pitch = (int) (fl_degrees(sle->ang.p) + delta);
b_bank = (int) (fl_degrees(sle->ang.b) + delta);
b_heading = (int) (fl_degrees(sle->ang.h) + delta);
b_pitch = fl2ir(fl_degrees(sle->ang.p) + delta);
b_bank = fl2ir(fl_degrees(sle->ang.b) + delta);
b_heading = fl2ir(fl_degrees(sle->ang.h) + delta);
b_scale_x = sle->scale_x;
b_scale_y = sle->scale_y;
b_div_x = sle->div_x;
@@ -1267,7 +1267,7 @@ void bg_bitmap_dlg::OnImportBackground()
{
CFileDialog cfd(TRUE, ".fs2", NULL, 0, "FreeSpace2 Missions (*.fs2)|*.fs2||\0");
char filename[256], error_str[1024];
int rval, temp, count;
int temp, count;
char *saved_mp;
//warn on pressing the button
@@ -1280,59 +1280,62 @@ void bg_bitmap_dlg::OnImportBackground()
strcpy_s(filename, cfd.GetPathName());
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("BGBITMAPDLG: Unable to parse '%s'! Error code = %i.\n", filename, rval));
sprintf(error_str, "Could not parse file: %s", filename);
MessageBox((LPCTSTR) error_str, (LPCTSTR) "Unable to import mission background!", MB_ICONERROR | MB_OK);
return;
}
// parse in the new file
read_file_text(filename);
reset_parse();
if (!skip_to_start_of_string("#Background bitmaps"))
return;
// skip beginning stuff
required_string("#Background bitmaps");
required_string("$Num stars:");
stuff_int(&temp);
required_string("$Ambient light level:");
stuff_int(&temp);
saved_mp = Mp;
// see if we have more than one background in this mission
count = 0;
while(skip_to_string("$Bitmap List:"))
count++;
Mp = saved_mp;
// pick one (if count is 0, it's retail with just one background)
if (count > 0)
try
{
int i, which = 0;
// parse in the new file
read_file_text(filename);
reset_parse();
if (count > 1)
if (!skip_to_start_of_string("#Background bitmaps"))
return;
// skip beginning stuff
required_string("#Background bitmaps");
required_string("$Num stars:");
stuff_int(&temp);
required_string("$Ambient light level:");
stuff_int(&temp);
saved_mp = Mp;
// see if we have more than one background in this mission
count = 0;
while (skip_to_string("$Bitmap List:"))
count++;
Mp = saved_mp;
// pick one (if count is 0, it's retail with just one background)
if (count > 0)
{
BackgroundChooser dlg(count);
if (dlg.DoModal() == IDCANCEL)
return;
int i, which = 0;
which = dlg.GetChosenBackground();
if (count > 1)
{
BackgroundChooser dlg(count);
if (dlg.DoModal() == IDCANCEL)
return;
which = dlg.GetChosenBackground();
}
for (i = 0; i < which + 1; i++)
skip_to_string("$Bitmap List:");
}
for (i = 0; i < which + 1; i++)
skip_to_string("$Bitmap List:");
// now parse the background we've selected
parse_one_background(&Backgrounds[get_active_background()]);
reinitialize_lists();
}
catch (const parse::ParseException& e)
{
mprintf(("BGBITMAPDLG: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
sprintf(error_str, "Could not parse file: %s\n\nError message: %s", filename, e.what());
// now parse the background we've selected
parse_one_background(&Backgrounds[get_active_background()]);
reinitialize_lists();
MessageBox((LPCTSTR)error_str, (LPCTSTR) "Unable to import mission background!", MB_ICONERROR | MB_OK);
return;
}
}
void bg_bitmap_dlg::reinitialize_lists()
+8 -8
View File
@@ -196,8 +196,8 @@ void briefing_editor_dlg::create()
box->AddString(Iff_info[i].iff_name);
box = (CComboBox *) GetDlgItem(IDC_SHIP_TYPE);
for (i=0; i<Num_ship_classes; i++)
box->AddString(Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
box->AddString(it->name);
box = (CComboBox *) GetDlgItem(IDC_BRIEFING_MUSIC);
box->AddString("None");
@@ -1127,11 +1127,11 @@ void briefing_editor_dlg::OnMakeIcon()
else if(jnp != Jump_nodes.end()){
// find the first navbuoy
iconp->ship_class = -1;
for (int i = 0; i < Num_ship_classes; i++)
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
{
if (Ship_info[i].flags & SIF_NAVBUOY)
if (it->flags & SIF_NAVBUOY)
{
iconp->ship_class = i;
iconp->ship_class = std::distance(Ship_info.cbegin(), it);
break;
}
}
@@ -1141,11 +1141,11 @@ void briefing_editor_dlg::OnMakeIcon()
else {
// find the first navbuoy
iconp->ship_class = -1;
for (int i = 0; i < Num_ship_classes; i++)
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
{
if (Ship_info[i].flags & SIF_NAVBUOY)
if (it->flags & SIF_NAVBUOY)
{
iconp->ship_class = i;
iconp->ship_class = std::distance(Ship_info.cbegin(), it);
break;
}
}
+12 -1
View File
@@ -672,6 +672,10 @@ void event_editor::OnButtonNewEvent()
return;
}
// before we do anything, we must check and save off any data from the current event (e.g
// the repeat count and interval count)
save();
reset_event(m_num_events++, TVI_LAST);
}
@@ -685,6 +689,11 @@ void event_editor::OnInsert()
return;
}
// before we do anything, we must check and save off any data from the current event (e.g
// the repeat count and interval count)
save();
if(cur_event < 0 || m_num_events == 0)
{
//There are no events yet, so just create one
@@ -750,6 +759,8 @@ void event_editor::reset_event(int num, HTREEITEM after)
m_event_tree.item_index = index;
m_event_tree.add_operator("do-nothing");
update_cur_event();
m_event_tree.SelectItem(h);
// GetDlgItem(IDC_CHAIN_DELAY) -> EnableWindow(FALSE);
if (num >= MAX_MISSION_EVENTS){
@@ -1299,7 +1310,7 @@ void event_editor::OnDeleteMsg()
char buf[256];
// handle this case somewhat gracefully
Assert((m_cur_msg >= 0) && (m_cur_msg < m_num_messages));
Assertion((m_cur_msg >= -1) && (m_cur_msg < m_num_messages), "Unexpected m_cur_msg value (%d); expected either -1, or between 0-%d. Get a coder!\n", m_cur_msg, m_num_messages - 1);
if((m_cur_msg < 0) || (m_cur_msg >= m_num_messages)){
return;
}
+95 -97
View File
@@ -18,13 +18,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -116,7 +114,7 @@ IDB_DATA_95 BITMAP "res\\data95.bmp"
// Toolbar
//
IDR_MAINFRAME TOOLBAR 23, 23
IDR_MAINFRAME TOOLBAR 23, 23
BEGIN
BUTTON ID_SELECT
BUTTON ID_SELECT_AND_MOVE
@@ -152,7 +150,7 @@ END
// Menu
//
IDR_MAINMENU MENU
IDR_MAINMENU MENU
BEGIN
POPUP "&File"
BEGIN
@@ -334,7 +332,7 @@ BEGIN
END
END
IDR_MENU_SHIP_POPUP MENU
IDR_MENU_SHIP_POPUP MENU
BEGIN
POPUP "Properties"
BEGIN
@@ -344,7 +342,7 @@ BEGIN
END
END
IDR_MENU_EDIT_POPUP MENU
IDR_MENU_EDIT_POPUP MENU
BEGIN
POPUP "EDIT"
BEGIN
@@ -369,7 +367,7 @@ BEGIN
END
END
IDR_MENU_CAMPAIGN MENU
IDR_MENU_CAMPAIGN MENU
BEGIN
POPUP "&File"
BEGIN
@@ -391,7 +389,7 @@ BEGIN
END
END
IDR_MENU_EDIT_SEXP_TREE MENU
IDR_MENU_EDIT_SEXP_TREE MENU
BEGIN
POPUP "Edit sexp tree"
BEGIN
@@ -441,7 +439,7 @@ BEGIN
END
END
IDR_WING_EDIT_MENU MENU
IDR_WING_EDIT_MENU MENU
BEGIN
POPUP "&Select Wing"
BEGIN
@@ -449,7 +447,7 @@ BEGIN
END
END
IDR_SHIP_EDIT_MENU MENU
IDR_SHIP_EDIT_MENU MENU
BEGIN
POPUP "&Select Ship"
BEGIN
@@ -457,7 +455,7 @@ BEGIN
END
END
IDR_PLAYER_EDIT_MENU MENU
IDR_PLAYER_EDIT_MENU MENU
BEGIN
POPUP "Select Team"
BEGIN
@@ -470,7 +468,7 @@ BEGIN
END
END
IDR_WAYPOINT_PATH_EDIT_MENU MENU
IDR_WAYPOINT_PATH_EDIT_MENU MENU
BEGIN
POPUP "&Select Waypoint Path"
BEGIN
@@ -478,7 +476,7 @@ BEGIN
END
END
IDR_ASTEROID_FIELD_MENU MENU
IDR_ASTEROID_FIELD_MENU MENU
BEGIN
POPUP "Select Field"
BEGIN
@@ -486,7 +484,7 @@ BEGIN
END
END
IDR_CPGN_VIEW_OFF MENU
IDR_CPGN_VIEW_OFF MENU
BEGIN
POPUP "Blah"
BEGIN
@@ -495,7 +493,7 @@ BEGIN
END
END
IDR_CPGN_VIEW_ON MENU
IDR_CPGN_VIEW_ON MENU
BEGIN
POPUP "Blah"
BEGIN
@@ -511,7 +509,7 @@ END
// Accelerator
//
IDR_MAINFRAME ACCELERATORS
IDR_MAINFRAME ACCELERATORS
BEGIN
"1", ID_SPEED1, VIRTKEY, NOINVERT
"1", ID_GROUP1, VIRTKEY, CONTROL, NOINVERT
@@ -602,7 +600,7 @@ BEGIN
"Z", ID_ZOOM_EXTENTS, VIRTKEY, SHIFT, NOINVERT
END
IDR_ACC_CAMPAIGN ACCELERATORS
IDR_ACC_CAMPAIGN ACCELERATORS
BEGIN
"H", ID_ERROR_CHECKER, VIRTKEY, ALT, NOINVERT
"N", ID_CPGN_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
@@ -617,13 +615,13 @@ END
// Dialog
//
IDD_ABOUTBOX DIALOG 0, 0, 284, 89
IDD_ABOUTBOX DIALOG 0, 0, 284, 89
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About FRED2"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,10,17,20,20,SS_REALSIZEIMAGE
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.1 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.4 RC1 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
LTEXT "Copyright © 1999 Volition, Inc. All Rights Reserved",IDC_STATIC,39,17,164,8
DEFPUSHBUTTON "OK",IDOK,229,7,48,14,WS_GROUP
LTEXT """Fred2 is the omega of all giant unwieldy pieces of code. Its big, its horrifying, and it just doesn't care. View it at your own risk."" - Dave Baranec",IDC_STATIC,39,62,238,20
@@ -698,7 +696,7 @@ BEGIN
GROUPBOX "Message Properties",IDC_STATIC,7,184,184,60
END
IDD_SHIP_GOALS_EDITOR DIALOG 0, 0, 412, 221
IDD_SHIP_GOALS_EDITOR DIALOG 0, 0, 412, 221
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Initial Orders"
FONT 8, "MS Sans Serif"
@@ -882,7 +880,7 @@ BEGIN
CONTROL "Mission End to Mainhall",IDC_END_TO_MAINHALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,190,142,10
END
IDD_PREFERENCES DIALOG 0, 0, 333, 81
IDD_PREFERENCES DIALOG 0, 0, 333, 81
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Preferences"
FONT 8, "MS Sans Serif"
@@ -1017,7 +1015,7 @@ BEGIN
LTEXT "Missile bank 4",IDC_STATIC,232,64,46,8
END
IDD_SHIP_MARKINGS DIALOG 0, 0, 252, 140
IDD_SHIP_MARKINGS DIALOG 0, 0, 252, 140
STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION
CAPTION "Ship Markings"
FONT 8, "MS Sans Serif"
@@ -1042,7 +1040,7 @@ BEGIN
EDITTEXT IDC_GOAL_SCORE,293,82,73,14,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_OBJ_TEAM,293,98,73,71,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Objective Invalid",IDC_GOAL_INVALID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,117,69,10
CONTROL "Don't Play Completion Sound",IDC_NO_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,127,107,10
CONTROL "Don't Play Completion Music",IDC_NO_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,127,107,10
PUSHBUTTON "New Obj.",IDC_BUTTON_NEW_GOAL,233,146,44,14,0,WS_EX_STATICEDGE,HIDC_BUTTON_NEW_GOAL
PUSHBUTTON "OK",ID_OK,281,146,44,14
PUSHBUTTON "Cancel",IDCANCEL,329,146,44,14
@@ -1150,7 +1148,7 @@ BEGIN
PUSHBUTTON "Restrict Departure Paths",IDC_RESTRICT_DEPARTURE,160,223,121,14,0,WS_EX_STATICEDGE
END
IDD_OPERATOR_ARGUMENT_TYPES DIALOG 0, 0, 235, 50
IDD_OPERATOR_ARGUMENT_TYPES DIALOG 0, 0, 235, 50
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Argument Types"
FONT 8, "MS Sans Serif"
@@ -1199,7 +1197,7 @@ BEGIN
LTEXT "Set Amount From Variable",IDC_STATIC,179,234,93,10
END
IDD_ORIENT_EDITOR DIALOG 0, 0, 229, 119
IDD_ORIENT_EDITOR DIALOG 0, 0, 229, 119
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Object Orientation Editor"
FONT 8, "MS Sans Serif"
@@ -1421,7 +1419,7 @@ BEGIN
LTEXT "Delay After Arrival",IDC_STATIC,7,99,57,8
END
IDD_REINFORCEMENT_SELECT DIALOG 0, 0, 156, 132
IDD_REINFORCEMENT_SELECT DIALOG 0, 0, 156, 132
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select Reinforcement Unit"
FONT 8, "MS Sans Serif"
@@ -1431,7 +1429,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,99,111,50,14
END
IDD_WAYPOINT_PATH_EDITOR DIALOG 0, 0, 145, 29
IDD_WAYPOINT_PATH_EDITOR DIALOG 0, 0, 145, 29
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Waypoint Path/Jump Node Editor"
MENU IDR_WAYPOINT_PATH_EDIT_MENU
@@ -1441,7 +1439,7 @@ BEGIN
EDITTEXT IDC_NAME,32,7,106,14,ES_AUTOHSCROLL
END
IDD_WING_CREATE DIALOG 0, 0, 119, 68
IDD_WING_CREATE DIALOG 0, 0, 119, 68
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Wing"
FONT 8, "MS Sans Serif"
@@ -1492,7 +1490,7 @@ BEGIN
LTEXT "Team Color Setting:",IDC_STATIC,16,308,66,8
END
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
IDD_ASTEROID_EDITOR DIALOG 0, 0, 376, 210
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debris Field Editor"
FONT 8, "MS Sans Serif"
@@ -1590,7 +1588,7 @@ BEGIN
LTEXT "Debriefing persona index",IDC_STATIC,148,176,79,8
END
IDD_TEXT_VIEW DIALOG 0, 0, 324, 285
IDD_TEXT_VIEW DIALOG 0, 0, 324, 285
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ship TBL Data"
FONT 8, "MS Sans Serif"
@@ -1655,7 +1653,7 @@ BEGIN
CONTROL "Use Cargo Icon",IDC_USE_CARGO_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,394,65,10
END
IDD_IGNORE_ORDERS DIALOG 0, 0, 120, 217
IDD_IGNORE_ORDERS DIALOG 0, 0, 120, 217
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ignore Orders"
FONT 8, "MS Sans Serif"
@@ -1705,7 +1703,7 @@ BEGIN
COMBOBOX IDC_FAILED_MISSION_TRACK,445,294,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Adjust Grid"
FONT 8, "MS Sans Serif"
@@ -1727,7 +1725,7 @@ BEGIN
LTEXT "X Level",IDC_STATIC,69,50,25,8
END
IDD_SHIELD_SYS DIALOG 0, 0, 192, 106
IDD_SHIELD_SYS DIALOG 0, 0, 192, 106
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Shield System Editor"
FONT 8, "MS Sans Serif"
@@ -1744,7 +1742,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,134,86,50,14
END
IDD_INITIAL_SHIPS DIALOG 0, 0, 127, 210
IDD_INITIAL_SHIPS DIALOG 0, 0, 127, 210
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Initial Ships Allowed"
FONT 8, "MS Sans Serif"
@@ -1834,13 +1832,15 @@ BEGIN
CONTROL "Laser Protect Ship",IDC_LASER_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,110,80,8
CONTROL "Missile Protect Ship",IDC_MISSILE_PROTECT_SHIP,"Button",BS_3STATE | WS_TABSTOP,12,118,80,8
GROUPBOX "Turret Threats",IDC_STATIC,7,83,102,48
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10
CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10
END
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10
CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10
CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10
CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10
CONTROL "No Disabled Self-Destruct",IDC_NO_DISABLED_SELF_DESTRUCT,
"Button",BS_3STATE | WS_TABSTOP,165,199,114,10
END
IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Variable"
FONT 8, "MS Sans Serif"
@@ -1860,7 +1860,7 @@ BEGIN
CONTROL "Network-Variable",IDC_TYPE_NETWORK_VARIABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,137,71,84,11
END
IDD_MODIFY_VARIABLE DIALOG 0, 0, 422, 102
IDD_MODIFY_VARIABLE DIALOG 0, 0, 422, 102
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Modify Variable"
FONT 8, "MS Sans Serif"
@@ -1882,7 +1882,7 @@ BEGIN
CONTROL "Network-Variable",IDC_TYPE_NETWORK_VARIABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,72,84,11
END
IDD_SPECIAL_DAMAGE DIALOG 0, 0, 234, 129
IDD_SPECIAL_DAMAGE DIALOG 0, 0, 234, 129
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Special Explosion"
FONT 8, "MS Sans Serif"
@@ -1908,7 +1908,7 @@ BEGIN
LTEXT "Duration (msecs):",IDC_STATIC,30,111,56,8
END
IDD_DUMP_STATS DIALOG 0, 0, 577, 375
IDD_DUMP_STATS DIALOG 0, 0, 577, 375
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Stats"
FONT 8, "MS Sans Serif"
@@ -1918,7 +1918,7 @@ BEGIN
EDITTEXT IDC_STATS_TEXT,7,7,563,333,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | ES_NUMBER | WS_VSCROLL
END
IDD_SHIP_TEXTURES DIALOG 0, 0, 296, 56
IDD_SHIP_TEXTURES DIALOG 0, 0, 296, 56
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ship Texture Replace"
FONT 8, "MS Sans Serif"
@@ -1928,10 +1928,10 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,239,35,50,14
LTEXT "Old texture:",IDC_LABEL1,7,7,44,9
LTEXT "New texture:",IDC_LABEL2,152,7,44,9
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_SPECIAL_HITPOINTS DIALOG 0, 0, 234, 85
IDD_SPECIAL_HITPOINTS DIALOG 0, 0, 234, 85
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Special Hitpoints"
FONT 8, "MS Sans Serif"
@@ -1948,7 +1948,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,106,10
END
IDD_SET_GLOBAL_SHIP_FLAGS DIALOG 0, 0, 114, 79
IDD_SET_GLOBAL_SHIP_FLAGS DIALOG 0, 0, 114, 79
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Set Global Ship Flags"
FONT 8, "MS Sans Serif"
@@ -1959,7 +1959,7 @@ BEGIN
PUSHBUTTON "Global Affected-By-Gravity",IDC_AFFECTED_BY_GRAVITY,7,58,100,14
END
IDD_VOICE_MANAGER DIALOG 0, 0, 407, 218
IDD_VOICE_MANAGER DIALOG 0, 0, 407, 218
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Voice Acting Manager"
FONT 8, "MS Sans Serif"
@@ -2004,7 +2004,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,166,159,100,19
END
IDD_BRIEFING_PERSONAS DIALOG 0, 0, 320, 201
IDD_BRIEFING_PERSONAS DIALOG 0, 0, 320, 201
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
@@ -2013,7 +2013,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,263,24,50,14
END
IDD_CUSTOM_WING_NAMES DIALOG 0, 0, 390, 54
IDD_CUSTOM_WING_NAMES DIALOG 0, 0, 390, 54
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Custom Wing Names"
FONT 8, "MS Sans Serif"
@@ -2035,7 +2035,7 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,333,24,50,14
END
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
IDD_RESTRICT_PATHS DIALOG 0, 0, 241, 87
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Restrict Paths"
FONT 8, "MS Sans Serif"
@@ -2046,7 +2046,7 @@ BEGIN
LTEXT "Restrict departure paths to the following:",IDC_RESTRICT_PATHS_LABEL,7,7,127,11
END
IDD_BACKGROUND_CHOOSER DIALOG 0, 0, 152, 45
IDD_BACKGROUND_CHOOSER DIALOG 0, 0, 152, 45
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Choose a background"
FONT 8, "MS Sans Serif"
@@ -2103,8 +2103,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,1,000000
PRODUCTVERSION 3,7,1,000000
FILEVERSION 3,7,1,0
PRODUCTVERSION 3,7,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -2121,12 +2121,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "Fred 2 Open"
VALUE "FileVersion", "3.7.1.000000"
VALUE "FileVersion", "3.7.4.20160307"
VALUE "InternalName", "Fred 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fred2.exe"
VALUE "ProductName", "Fred 2 Open"
VALUE "ProductVersion", "3.7.1"
VALUE "ProductVersion", "3.7.4 RC1"
END
END
BLOCK "VarFileInfo"
@@ -2142,7 +2142,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
@@ -2696,19 +2696,19 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
// String Table
//
STRINGTABLE
STRINGTABLE
BEGIN
IDR_MAINFRAME "FRED2_OPEN 3.7.1 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
IDR_MAINFRAME "FRED2_OPEN 3.7.4 RC1 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
END
STRINGTABLE
STRINGTABLE
BEGIN
AFX_IDS_APP_TITLE "FRED2"
AFX_IDS_IDLEMESSAGE "For Help, press F1"
AFX_IDS_HELPMODEMESSAGE "Select an object on which to get Help"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_FILE_NEW "Create a new campaign\nNew"
ID_FILE_OPEN "Open an existing campaign\nOpen"
@@ -2721,7 +2721,7 @@ BEGIN
ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Exit the campaign editor\nExit"
@@ -2732,7 +2732,7 @@ BEGIN
ID_HELP "Display help for current task or command\nHelp"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
@@ -2752,18 +2752,18 @@ BEGIN
ID_FILE_MRU_FILE16 "Open this document"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
@@ -2778,13 +2778,13 @@ BEGIN
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE
STRINGTABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
@@ -2795,24 +2795,24 @@ BEGIN
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE
STRINGTABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE
STRINGTABLE
BEGIN
AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_FILE_MISSIONNOTES "Displays designer notes and mission properties\nMission Specs"
ID_SELECT "Select objects mode\nSelect (S)"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_VIEW_FIGHTERS "Show/Hide Fighter objects"
ID_VIEW_CAPITALSHIPS "Show/Hide Capital Ship objects"
@@ -2830,7 +2830,7 @@ BEGIN
ID_EDITORS_SHIPS "Open ship editor dialog window to edit ship"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_EDITORS_GOALS "Activates Mission Goal Editor\nMission Goal Editor"
ID_EDITORS_WAYPOINTS "Activates Waypoint Editor\nWaypoint Editor"
@@ -2841,7 +2841,7 @@ BEGIN
ID_PROPERTIES_ONE "This is Mike's prompt!"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
@@ -2855,7 +2855,7 @@ BEGIN
ID_INDICATOR_MODIFIED "MODIFIED"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_MISCSTUFF_SHOWSHIPSASICONS "This is the (help?) prompt!"
ID_EDIT_POPUP_SHOW_SHIP_MODELS
@@ -2864,7 +2864,7 @@ BEGIN
"Display ship names and ship types for visible ships"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_ADD_MISSION_TIME "Evaluates to elapsed time into mission in seconds"
ID_ADD_EQUALS "Evaluates to true if numbers or objects are the same"
@@ -2879,7 +2879,7 @@ BEGIN
ID_ADD_FALSE "Evaluates to a boolean value of false"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_EDIT_POPUP_SHOW_COMPASS
"Display a 3 dimentional compass in the upper right corner of window"
@@ -2893,7 +2893,7 @@ BEGIN
ID_ADD_MINUS "Evaluates to difference between first subexpression and remaining subexpressions"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_SHOW_GRID_POSITIONS "Show position on grid for all visible objects"
ID_SHOW_COORDINATES "Display the coordinates of objects/waypoints."
@@ -2908,7 +2908,7 @@ BEGIN
ID_DISSOLVE_WING "Remove selected ships from Wing(s)\nRemove from Wing"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_SELECT_AND_MOVE "Select and Move objects\nSelect and Move (M)"
ID_SELECT_AND_ROTATE "Select and Rotate objects\nSelect and Rotate (R)"
@@ -2923,7 +2923,7 @@ BEGIN
ID_FIND_DISTANCE "Find Distance between two objects\nFind Distance"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_BUTTON32944 "Constrain to YZ axis\nYZ Constraint"
ID_BUTTON32945 "Constrain to XY axis\nXY Constraint"
@@ -2938,27 +2938,27 @@ BEGIN
ID_SHOW_HORIZON "Show the horizon line"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_EDITORS_PLAYER "Edit loadout information for all teams"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_REVERT "Revert changes by reloading mission from last save\nRevert"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_ERROR_CHECKER "Checks campaign for errors"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_LOOKAT_OBJ "Rotate camera around selected object\nRotate around object (Ctrl+V)"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_EDITORS_ADJUST_GRID "Adjust the orientation and level of the grid."
ID_EDITORS_SHIELD_SYS "Editor for availability of shield system for ships."
@@ -2966,7 +2966,7 @@ BEGIN
ID_MARK_WING "Mark entire wing selected object is a member of."
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_CONTROL_OBJ "Movement keys control marked objects instead of camera."
ID_CHECKOUT "Checks out the mission from Source Safe"
@@ -2974,37 +2974,35 @@ BEGIN
ID_AA_GRIDLINES "Toggle Gridlines being drawn anti-aliased or not."
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_FORMAT_FS2_OPEN "Save missions with SCP features"
ID_FORMAT_FS2_RETAIL "Save missions compatible with FS2 retail"
ID_FORMAT_FS1 "Save missions compatible with FS1 retail"
END
STRINGTABLE
STRINGTABLE
BEGIN
ID_FORMAT_FS1_RETAIL "Save missions compatible with FS1 retail"
END
#endif // English (U.S.) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ALT_SHIP_CLASS DIALOG 0, 0, 312, 212
IDD_ALT_SHIP_CLASS DIALOG 0, 0, 312, 212
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Alternate Ship Class Editor"
FONT 8, "MS Sans Serif"
@@ -3031,7 +3029,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
IDD_ALT_SHIP_CLASS, DIALOG
BEGIN
@@ -3043,7 +3041,7 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
-1
View File
@@ -25,7 +25,6 @@
#include "object/object.h"
#include "editor.h"
#include "ai/ai.h"
#include "ai/ailocal.h"
#include "cfile/cfile.h"
#include "cfile/cfilesystem.h"
-1
View File
@@ -12,7 +12,6 @@
#ifndef _FREDDOC_H
#define _FREDDOC_H
#include "ai/ailocal.h"
#include "MissionSave.h"
#define MISSION_BACKUP_NAME "Backup"
+43 -37
View File
@@ -34,7 +34,6 @@
#include "model/model.h"
#include "palman/palman.h"
#include "editor.h"
#include "ai/ailocal.h"
#include "ship/ship.h"
#include "cfile/cfile.h"
#include "mission/missionparse.h"
@@ -141,8 +140,7 @@ color colour_yellow;
void fred_enable_htl()
{
if (!Briefing_dialog) gr_set_proj_matrix( (4.0f/9.0f) * PI * FRED_DEFAULT_HTL_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
if (Briefing_dialog) gr_set_proj_matrix( Briefing_window_FOV, gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
gr_set_proj_matrix((4.0f/9.0f) * PI * (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV), gr_screen.aspect*(float)gr_screen.clip_width/(float)gr_screen.clip_height, 1.0f, FRED_DEAFULT_HTL_DRAW_DIST);
gr_set_view_matrix(&Eye_position, &Eye_matrix);
}
@@ -702,6 +700,7 @@ void render_one_model_briefing_screen(object *objp)
void render_one_model_nohtl(object *objp)
{
int j, z;
uint debug_flags = 0;
object *o2;
Assert(objp->type != OBJ_NONE);
@@ -755,11 +754,11 @@ void render_one_model_nohtl(object *objp)
}
if(Show_dock_points){
j |= MR_BAY_PATHS;
debug_flags |= MR_DEBUG_BAY_PATHS;
}
if(Show_paths_fred){
j |= MR_SHOW_PATHS;
debug_flags |= MR_DEBUG_PATHS;
}
z = objp->instance;
@@ -768,12 +767,19 @@ void render_one_model_nohtl(object *objp)
// if (!viewpoint || OBJ_INDEX(objp) != cur_object_index)
{
model_render_params render_info;
if (Fred_outline) {
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j | MR_SHOW_OUTLINE, -1, -1, Ships[z].ship_replacement_textures);
render_info.set_flags(j | MR_SHOW_OUTLINE | MR_NO_TEXTURING | MR_NO_LIGHTING);
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
} else {
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
render_info.set_flags(j);
}
render_info.set_debug_flags(debug_flags);
render_info.set_replacement_textures(Ships[z].ship_replacement_textures);
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
}
} else {
@@ -831,6 +837,7 @@ void render_one_model_nohtl(object *objp)
void render_one_model_htl(object *objp)
{
int j, z;
uint debug_flags = 0;
object *o2;
Assert(objp->type != OBJ_NONE);
@@ -878,18 +885,15 @@ void render_one_model_htl(object *objp)
// build flags
if ((Show_ship_models || Show_outlines) && ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START))){
g3_start_instance_matrix(&Eye_position, &Eye_matrix, 0);
if (Show_ship_models){
j = MR_NORMAL;
} else {
j = MR_NO_POLYS;
}
j = MR_NORMAL;
if(Show_dock_points){
j |= MR_BAY_PATHS;
debug_flags |= MR_DEBUG_BAY_PATHS;
}
if(Show_paths_fred){
j |= MR_SHOW_PATHS;
debug_flags |= MR_DEBUG_PATHS;
}
z = objp->instance;
@@ -905,13 +909,23 @@ void render_one_model_htl(object *objp)
j |= MR_FULL_DETAIL;
}
model_render_params render_info;
render_info.set_debug_flags(debug_flags);
render_info.set_replacement_textures(Ships[z].ship_replacement_textures);
if (Fred_outline) {
model_set_outline_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
j |= MR_SHOW_OUTLINE_HTL;
render_info.set_color(Fred_outline >> 16, (Fred_outline >> 8) & 0xff, Fred_outline & 0xff);
render_info.set_flags(j | MR_SHOW_OUTLINE_HTL | MR_NO_LIGHTING | MR_NO_POLYS | MR_NO_TEXTURING);
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
}
g3_done_instance(0);
model_render(Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos, j, -1, -1, Ships[z].ship_replacement_textures);
if ( Show_ship_models ) {
render_info.set_flags(j);
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, &objp->orient, &objp->pos);
}
} else {
int r = 0, g = 0, b = 0;
@@ -1126,7 +1140,7 @@ void draw_orient_sphere(object *obj, int r, int g, int b)
if ((obj->type != OBJ_WAYPOINT) && (obj->type != OBJ_POINT))
{
flag = (vm_vec_dotprod(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
flag = (vm_vec_dot(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
v1 = v2 = obj->pos;
vm_vec_scale_add2(&v1, &obj->orient.vec.fvec, size);
vm_vec_scale_add2(&v2, &obj->orient.vec.fvec, size * 1.5f);
@@ -1162,7 +1176,7 @@ void draw_orient_sphere2(int col, object *obj, int r, int g, int b)
if ((obj->type != OBJ_WAYPOINT) && (obj->type != OBJ_POINT))
{
flag = (vm_vec_dotprod(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
flag = (vm_vec_dot(&eye_orient.vec.fvec, &obj->orient.vec.fvec) < 0.0f);
v1 = v2 = obj->pos;
vm_vec_scale_add2(&v1, &obj->orient.vec.fvec, size);
@@ -1359,11 +1373,11 @@ void process_controls(vec3d *pos, matrix *orient, float frametime, int key, int
vm_angles_2_matrix(&rotmat, &rotangs);
if (rotangs.h && Universal_heading)
vm_transpose_matrix(orient);
vm_transpose(orient);
vm_matrix_x_matrix(&newmat, orient, &rotmat);
*orient = newmat;
if (rotangs.h && Universal_heading)
vm_transpose_matrix(orient);
vm_transpose(orient);
}
}
@@ -1489,11 +1503,7 @@ void render_frame()
gr_set_font(FONT1);
light_reset();
if (Briefing_dialog) {
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
} else {
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
}
g3_set_view_matrix(&eye_pos, &eye_orient, (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV));
Viewer_pos = eye_pos; // for starfield code
fred_enable_htl();
@@ -1598,11 +1608,7 @@ void render_frame()
gr_set_clip(0, 0, True_rw, True_rh);
g3_start_frame(0); // ** Accounted for
if (Briefing_dialog) {
g3_set_view_matrix(&eye_pos, &eye_orient, Briefing_window_FOV);
} else {
g3_set_view_matrix(&eye_pos, &eye_orient, 0.5f);
}
g3_set_view_matrix(&eye_pos, &eye_orient, (Briefing_dialog ? Briefing_window_FOV : FRED_DEFAULT_HTL_FOV));
}
void game_do_frame()
@@ -1653,7 +1659,7 @@ void game_do_frame()
leader = &Objects[cur_object_index];
leader_old_pos = leader->pos; // save original position
leader_orient = leader->orient; // save original orientation
vm_copy_transpose_matrix(&leader_transpose, &leader_orient);
vm_copy_transpose(&leader_transpose, &leader_orient);
process_controls(&leader->pos, &leader->orient, f2fl(Frametime), key);
vm_vec_sub(&delta_pos, &leader->pos, &leader_old_pos); // get position change
@@ -1670,7 +1676,7 @@ void game_do_frame()
// change rotation matrix to rotate in opposite direction. This rotation
// matrix is what the leader ship has rotated by.
vm_copy_transpose_matrix(&rot_trans, &view_physics.last_rotmat);
vm_copy_transpose(&rot_trans, &view_physics.last_rotmat);
// get point relative to our point of rotation (make POR the origin). Since
// only the leader has been moved yet, and not the objects, we have to use
@@ -2021,7 +2027,7 @@ void render_compass(void)
v.xyz.x = 1.0f;
v.xyz.y = v.xyz.z = 0.0f;
if (vm_vec_dotprod(&eye, &v) < 0.0f)
if (vm_vec_dot(&eye, &v) < 0.0f)
gr_set_color(159, 20, 20);
else
gr_set_color(255, 32, 32);
@@ -2029,7 +2035,7 @@ void render_compass(void)
v.xyz.y = 1.0f;
v.xyz.x = v.xyz.z = 0.0f;
if (vm_vec_dotprod(&eye, &v) < 0.0f)
if (vm_vec_dot(&eye, &v) < 0.0f)
gr_set_color(20, 159, 20);
else
gr_set_color(32, 255, 32);
@@ -2037,7 +2043,7 @@ void render_compass(void)
v.xyz.z = 1.0f;
v.xyz.x = v.xyz.y = 0.0f;
if (vm_vec_dotprod(&eye, &v) < 0.0f)
if (vm_vec_dot(&eye, &v) < 0.0f)
gr_set_color(20, 20, 159);
else
gr_set_color(32, 32, 255);
+1 -1
View File
@@ -230,7 +230,7 @@ void set_time_compression(float multiplier, float change_time){}
fix game_get_overall_frametime() { return 0; }
//WMC
void game_level_init(int seed){}
void game_level_init(){}
void game_post_level_init(){}
camid game_render_frame_setup(){return camid();}
void game_render_frame(camid cid){}
+7 -8
View File
@@ -27,7 +27,6 @@
#include "math/fvi.h" // For find_plane_line_intersection
#include "math/vecmat.h"
#include "io/key.h"
#include "ai/ailocal.h"
#include "ai/ai.h"
#include "ai/aigoals.h"
#include "ship/ship.h" // for ship names
@@ -774,7 +773,7 @@ int drag_rotate_objects()
leader = &Objects[cur_object_index];
leader_orient = leader->orient; // save original orientation
vm_copy_transpose_matrix(&leader_transpose, &leader_orient);
vm_copy_transpose(&leader_transpose, &leader_orient);
vm_angles_2_matrix(&rotmat, &a);
vm_matrix_x_matrix(&newmat, &leader->orient, &rotmat);
@@ -790,7 +789,7 @@ int drag_rotate_objects()
// change rotation matrix to rotate in opposite direction. This rotation
// matrix is what the leader ship has rotated by.
vm_copy_transpose_matrix(&rot_trans, &rotmat);
vm_copy_transpose(&rot_trans, &rotmat);
// get point relative to our point of rotation (make POR the origin).
vm_vec_sub(&tmpv1, &objp->pos, &leader->pos);
@@ -1468,9 +1467,9 @@ void CFREDView::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
(UINT) species_submenu[i].m_hMenu, Species_info[i].species_name);
}
for (i=0; i<Num_ship_classes; i++)
species_submenu[Ship_info[i].species].AppendMenu(MF_STRING |
MF_ENABLED, SHIP_TYPES + i, Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
species_submenu[it->species].AppendMenu(MF_STRING |
MF_ENABLED, SHIP_TYPES + i, it->name);
pPopup->AppendMenu(MF_STRING | MF_POPUP | MF_ENABLED,
(UINT) shipPopup.m_hMenu, "New Object Type");
@@ -1620,7 +1619,7 @@ BOOL CFREDView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO*
int id = (int) nID;
if (!pHandlerInfo) {
if ((id >= SHIP_TYPES) && (id < SHIP_TYPES + Num_ship_classes + 3)) {
if ((id >= SHIP_TYPES) && (id < SHIP_TYPES + static_cast<int>(Ship_info.size()) + 3)) {
if (nCode == CN_COMMAND) {
cur_model_index = id - SHIP_TYPES;
m_new_ship_type_combo_box.SetCurSelNEW(cur_model_index);
@@ -2454,7 +2453,7 @@ int CFREDView::global_error_check()
}
z = Ships[i].ship_info_index;
if ((z < 0) || (z >= Num_ship_classes)){
if ((z < 0) || (z >= static_cast<int>(Ship_info.size()))){
return internal_error("A ship has an illegal class");
}
+11 -10
View File
@@ -55,7 +55,7 @@ END_MESSAGE_MAP()
BOOL InitialShips::OnInitDialog()
{
int i, j;
int i;
CDialog::OnInitDialog();
@@ -63,12 +63,13 @@ BOOL InitialShips::OnInitDialog()
// change the window text, get the index into the array, and check the box for either the ships
// or weapons
if ( m_initial_items == INITIAL_SHIPS ) {
for ( i = 0; i < Num_ship_classes; i++ ) {
if ( Ship_info[i].flags & SIF_PLAYER_SHIP ) {
m_initial_list.AddString( Ship_info[i].name );
for ( auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it ) {
if ( it->flags & SIF_PLAYER_SHIP ) {
i = std::distance(Ship_info.cbegin(), it);
m_initial_list.AddString( it->name );
if ( Campaign.ships_allowed[i] ) {
m_initial_list.SetCheck(m_list_count, 1);
} else if ( (strlen(Campaign.filename) == 0) && strstr(Ship_info[i].name, "Myrmidon") ) { //-V805
} else if ( (strlen(Campaign.filename) == 0) && strstr(it->name, "Myrmidon") ) { //-V805
m_initial_list.SetCheck(m_list_count, 1);
} else {
m_initial_list.SetCheck(m_list_count, 0);
@@ -86,11 +87,11 @@ BOOL InitialShips::OnInitDialog()
int allowed_weapons[MAX_WEAPON_TYPES];
memset( allowed_weapons, 0, sizeof(allowed_weapons) );
for (i = 0; i < Num_ship_classes; i++ ) {
if ( Ship_info[i].flags & SIF_PLAYER_SHIP ) {
for ( j = 0; j < MAX_WEAPON_TYPES; j++ ) {
if ( Ship_info[i].allowed_weapons[j] )
allowed_weapons[j] = 1;
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
if ( it->flags & SIF_PLAYER_SHIP ) {
for ( i = 0; i < MAX_WEAPON_TYPES; i++ ) {
if ( it->allowed_weapons[i] )
allowed_weapons[i] = 1;
}
}
}
+1 -1
View File
@@ -848,7 +848,7 @@ void initial_status::list_dockees(int dock_types)
// add "nothing"
z = cboDockees->AddString("Nothing");
cboDockees->SetItemData(z, -1);
cboDockees->SetItemData(z, static_cast<DWORD_PTR>(-1));
// add ships
for (object *objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp))
+9 -10
View File
@@ -344,7 +344,6 @@ void CMainFrame::OnClose()
void CMainFrame::init_tools()
{
int i;
//int highest_terran_index;
//char ship_name[256];
//int ship_index;
@@ -359,14 +358,14 @@ void CMainFrame::init_tools()
return;
}
for (i=0; i<Num_ship_classes; i++){
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it){
// don't add the pirate ship
if(Ship_info[i].flags & SIF_NO_FRED){
if(it->flags & SIF_NO_FRED){
m_new_ship_type_combo_box.AddString("");
continue;
}
m_new_ship_type_combo_box.AddString(Ship_info[i].name);
m_new_ship_type_combo_box.AddString(it->name);
}
// m_new_ship_type_combo_box.AddString("Player Start");
@@ -407,7 +406,7 @@ void color_combo_box::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
// I think we need to do a lookup by ship name here
if(lpDrawItemStruct->itemID >= (uint)Num_ship_classes){
if(lpDrawItemStruct->itemID >= Ship_info.size()){
z = lpDrawItemStruct->itemID;
} else {
memset(ship_name, 0, 256);
@@ -423,7 +422,7 @@ void color_combo_box::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
COLORREF newTextColor = RGB(0x80, 0x80, 0x80); // light gray
if (!fDisabled)
{
if (z >= Num_ship_classes)
if (z >= static_cast<int>(Ship_info.size()))
newTextColor = RGB(0, 0, 0);
else
{
@@ -498,7 +497,7 @@ void color_combo_box::MeasureItem(LPMEASUREITEMSTRUCT)
int color_combo_box::SetCurSelNEW(int model_index)
{
if((model_index < 0) || (model_index >= Num_ship_classes)){
if((model_index < 0) || (model_index >= static_cast<int>(Ship_info.size()))){
return SetCurSel(model_index);
}
@@ -513,9 +512,9 @@ int color_combo_box::GetCurSelNEW()
char ship_name[256];
char *hmmm = ship_name;
// see if we have a special item (>= Num_ship_classes)
// see if we have a special item (>= Ship_info.size())
cur_sel = GetCurSel();
if(cur_sel >= Num_ship_classes){
if(cur_sel >= static_cast<int>(Ship_info.size())){
return cur_sel;
}
@@ -525,7 +524,7 @@ int color_combo_box::GetCurSelNEW()
return CB_ERR;
}
ship_info = ship_info_lookup(ship_name);
if((ship_info < 0) || (ship_info >= Num_ship_classes)){
if((ship_info < 0) || (ship_info >= static_cast<int>(Ship_info.size()))){
return CB_ERR;
}
return ship_info;
+10 -8
View File
@@ -15,7 +15,6 @@
#include "FREDDoc.h"
#include "FREDView.h"
#include "FredRender.h"
#include "ai/ailocal.h"
#include "ai/aigoals.h"
#include "ship/ship.h"
#include "globalincs/linklist.h"
@@ -136,6 +135,7 @@ int query_ship_name_duplicate(int ship);
char *reg_read_string( char *section, char *name, char *default_value );
extern int Nmodel_num;
extern int Nmodel_instance_num;
extern matrix Nmodel_orient;
extern int Nmodel_bitmap;
@@ -410,6 +410,7 @@ bool fred_init()
armor_init();
weapon_init();
parse_medal_tbl(); // get medal names for sexpression usage
glowpoint_init();
ship_init();
parse_init();
techroom_intel_init();
@@ -443,9 +444,9 @@ bool fred_init()
// Get the default player ship
Default_player_model = cur_model_index = get_default_player_ship_index();
Id_select_type_start = Num_ship_classes + 2;
Id_select_type_jump_node = Num_ship_classes + 1;
Id_select_type_waypoint = Num_ship_classes;
Id_select_type_start = Ship_info.size() + 2;
Id_select_type_jump_node = Ship_info.size() + 1;
Id_select_type_waypoint = Ship_info.size();
Fred_main_wnd -> init_tools();
return true;
}
@@ -718,9 +719,9 @@ int create_object(vec3d *pos, int waypoint_instance)
obj = create_player(Player_starts, pos, NULL, Default_player_model);
} else if (cur_model_index == Id_select_type_jump_node) {
CJumpNode* jnp = new CJumpNode(pos);
obj = jnp->GetSCPObjectNumber();
Jump_nodes.push_back(*jnp);
CJumpNode jnp(pos);
obj = jnp.GetSCPObjectNumber();
Jump_nodes.push_back(std::move(jnp));
} else if(Ship_info[cur_model_index].flags & SIF_NO_FRED){
obj = -1;
} else { // creating a ship
@@ -885,7 +886,7 @@ void clear_mission()
// of ships for all teams
for (i=0; i<MAX_TVT_TEAMS; i++) {
count = 0;
for ( j = 0; j < MAX_SHIP_CLASSES; j++ ) {
for ( j = 0; j < static_cast<int>(Ship_info.size()); j++ ) {
if (Ship_info[j].flags & SIF_DEFAULT_PLAYER_SHIP) {
Team_data[i].ship_list[count] = j;
strcpy_s(Team_data[i].ship_list_variables[count], "");
@@ -955,6 +956,7 @@ void clear_mission()
Nmodel_flags = DEFAULT_NMODEL_FLAGS;
Nmodel_num = -1;
Nmodel_instance_num = -1;
vm_set_identity(&Nmodel_orient);
Nmodel_bitmap = -1;
+2
View File
@@ -297,6 +297,8 @@ int CMessageEditorDlg::find_event()
for (i=0; i<Num_mission_events; i++) {
node = Mission_events[i].formula;
Assertion(node >= 0, "Can't have a formula point to sexp node -1!");
if ( get_operator_const(CTEXT(node)) == OP_WHEN || get_operator_const(CTEXT(node)) == OP_EVERY_TIME
|| get_operator_const(CTEXT(node)) == OP_WHEN_ARGUMENT || get_operator_const(CTEXT(node)) == OP_EVERY_TIME_ARGUMENT
|| get_operator_const(CTEXT(node)) == OP_IF_THEN_ELSE || get_operator_const(CTEXT(node)) == OP_PERFORM_ACTIONS )
+126 -129
View File
@@ -96,30 +96,20 @@ void CFred_mission_save::convert_special_tags_to_retail()
}
}
int CFred_mission_save::save_mission_file(char *pathname)
void CFred_mission_save::save_mission_internal(const char *pathname)
{
char backup_name[256], savepath[MAX_PATH_LEN], *p;
CTime t;
t = CTime::GetCurrentTime();
strcpy_s(The_mission.modified, t.Format("%x at %X"));
strcpy_s(savepath, "");
p = strrchr(pathname, '\\');
if ( p ) {
*p = '\0';
strcpy_s(savepath, pathname);
*p = '\\';
strcat_s(savepath, "\\");
}
strcat_s(savepath, "saving.xxx");
reset_parse();
fred_parse_flag = 0;
fp = cfopen(savepath, "wt", CFILE_NORMAL);
fp = cfopen(pathname, "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
if (!fp) {
nprintf(("Error", "Can't open mission file to save.\n"));
return -1;
err = -1;
return;
}
// Goober5000
@@ -174,10 +164,27 @@ int CFred_mission_save::save_mission_file(char *pathname)
}
cfclose(fp);
if (err) {
if (err)
mprintf(("Mission saving error code #%d\n", err));
}
} else {
int CFred_mission_save::save_mission_file(char *pathname)
{
char backup_name[256], savepath[MAX_PATH_LEN], *p;
strcpy_s(savepath, "");
p = strrchr(pathname, '\\');
if ( p ) {
*p = '\0';
strcpy_s(savepath, pathname);
*p = '\\';
strcat_s(savepath, "\\");
}
strcat_s(savepath, "saving.xxx");
save_mission_internal(savepath);
if (!err) {
strcpy_s(backup_name, pathname);
if (backup_name[strlen(backup_name) - 4] == '.')
backup_name[strlen(backup_name) - 4] = 0;
@@ -196,10 +203,6 @@ int CFred_mission_save::autosave_mission_file(char *pathname)
{
char backup_name[256], name2[256];
int i, len;
CTime t;
t = CTime::GetCurrentTime();
strcpy_s(The_mission.modified, t.Format("%x at %X"));
len = strlen(pathname);
strcpy_s(backup_name, pathname);
@@ -213,68 +216,8 @@ int CFred_mission_save::autosave_mission_file(char *pathname)
}
strcpy(backup_name + len, ".001");
reset_parse();
fred_parse_flag = 0;
fp = cfopen(backup_name, "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
if (!fp) {
nprintf(("Error", "Can't open mission file to save.\n"));
return -1;
}
// Goober5000
convert_special_tags_to_retail();
if (save_mission_info())
err = -2;
else if (save_plot_info())
err = -3;
else if (save_variables())
err = -3;
// else if (save_briefing_info())
// err = -4;
else if (save_fiction())
err = -3;
else if (save_cutscenes())
err = -4;
else if (save_cmd_briefs())
err = -4;
else if (save_briefing())
err = -4;
else if (save_debriefing())
err = -5;
else if (save_players())
err = -6;
else if (save_objects())
err = -7;
else if (save_wings())
err = -8;
else if (save_events())
err = -9;
else if (save_goals())
err = -10;
else if (save_waypoints())
err = -11;
else if (save_messages())
err = -12;
else if (save_reinforcements())
err = -13;
else if (save_bitmaps())
err = -14;
else if (save_asteroid_fields())
err = -15;
else if (save_music())
err = -16;
else {
required_string_fred("#End");
parse_comments(2);
token_found = NULL;
parse_comments();
fout("\n");
}
cfclose(fp);
if (err)
mprintf(("Mission saving error code #%d\n", err));
save_mission_internal(backup_name);
return err;
}
@@ -535,19 +478,7 @@ int CFred_mission_save::save_mission_info()
}
}
// Phreak's loading screen stuff
if (Format_fs2_open != FSO_FORMAT_RETAIL) //-V581
{
if (strlen(The_mission.loading_screen[GR_640]) > 0) //-V805
{
fout("\n\n$Load Screen 640:\t%s",The_mission.loading_screen[GR_640]);
}
if (strlen(The_mission.loading_screen[GR_1024]) > 0) //-V805
{
fout("\n$Load Screen 1024:\t%s",The_mission.loading_screen[GR_1024]);
}
}
save_custom_bitmap("$Load Screen 640:", "$Load Screen 1024:", The_mission.loading_screen[GR_640], The_mission.loading_screen[GR_1024], 1);
// Phreak's skybox stuff
if (strlen(The_mission.skybox_model) > 0) //-V805
@@ -773,40 +704,74 @@ int CFred_mission_save::save_fiction()
if (Format_fs2_open != FSO_FORMAT_RETAIL)
{
if (optional_string_fred("#Fiction Viewer"))
parse_comments();
parse_comments(2);
else
fout("\n\n#Fiction Viewer");
fout("\n");
// save file
required_string_fred("$File:");
parse_comments();
fout(" %s", fiction_file());
// save font
if (strlen(fiction_font()) > 0) //-V805
// we have multiple stages now, so save them all
for (SCP_vector<fiction_viewer_stage>::iterator stage = Fiction_viewer_stages.begin(); stage != Fiction_viewer_stages.end(); ++stage)
{
if (optional_string_fred("$Font:"))
parse_comments();
else
fout("\n$Font:");
fout(" %s", fiction_font());
}
else
optional_string_fred("$Font:");
fout("\n");
// save voice
if (strlen(fiction_voice()) > 0) //-V805
{
if (optional_string_fred("$Voice:"))
parse_comments();
// save file
required_string_fred("$File:");
parse_comments();
fout(" %s", stage->story_filename);
// save font
if (strlen(stage->font_filename) > 0) //-V805
{
if (optional_string_fred("$Font:"))
parse_comments();
else
fout("\n$Font:");
fout(" %s", stage->font_filename);
}
else
fout("\n$Voice:");
fout(" %s", fiction_voice());
optional_string_fred("$Font:");
// save voice
if (strlen(stage->voice_filename) > 0) //-V805
{
if (optional_string_fred("$Voice:"))
parse_comments();
else
fout("\n$Voice:");
fout(" %s", stage->voice_filename);
}
else
optional_string_fred("$Voice:");
// save UI
if (strlen(stage->ui_name) > 0)
{
if (optional_string_fred("$UI:"))
parse_comments();
else
fout("\n$UI:");
fout(" %s", stage->ui_name);
}
else
optional_string_fred("$UI:");
// save background
save_custom_bitmap("$Background 640:", "$Background 1024:", stage->background[GR_640], stage->background[GR_1024]);
// save sexp formula if we have one
if (stage->formula >= 0 && stage->formula != Locked_sexp_true)
{
SCP_string sexp_out;
convert_sexp_to_string(sexp_out, stage->formula, SEXP_SAVE_MODE);
if (optional_string_fred("$Formula:"))
parse_comments();
else
fout("\n$Formula:");
fout(" %s", sexp_out.c_str());
}
else
optional_string_fred("$Formula:");
}
else
optional_string_fred("$Voice:");
}
else
{
@@ -830,6 +795,8 @@ int CFred_mission_save::save_cmd_brief()
if (The_mission.game_type & MISSION_TYPE_MULTI)
return err; // no command briefings allowed in multiplayer missions.
save_custom_bitmap("$Background 640:", "$Background 1024:", Cur_cmd_brief->background[GR_640], Cur_cmd_brief->background[GR_1024], 1);
for (stage=0; stage<Cur_cmd_brief->num_stages; stage++) {
required_string_fred("$Stage Text:");
parse_comments(2);
@@ -883,6 +850,10 @@ int CFred_mission_save::save_briefing()
required_string_fred("$start_briefing");
parse_comments();
save_custom_bitmap("$briefing_background_640:", "$briefing_background_1024:", Briefings[nb].background[GR_640], Briefings[nb].background[GR_1024]);
save_custom_bitmap("$ship_select_background_640:", "$ship_select_background_1024:", Briefings[nb].ship_select_background[GR_640], Briefings[nb].ship_select_background[GR_1024]);
save_custom_bitmap("$weapon_select_background_640:", "$weapon_select_background_1024:", Briefings[nb].weapon_select_background[GR_640], Briefings[nb].weapon_select_background[GR_1024]);
Assert(Briefings[nb].num_stages <= MAX_BRIEF_STAGES);
required_string_fred("$num_stages:");
parse_comments();
@@ -1055,6 +1026,8 @@ int CFred_mission_save::save_debriefing()
required_string_fred("#Debriefing_info");
parse_comments(2);
save_custom_bitmap("$Background 640:", "$Background 1024:", Debriefing->background[GR_640], Debriefing->background[GR_1024], 1);
required_string_fred("$Num stages:");
parse_comments(2);
fout(" %d", Debriefing->num_stages);
@@ -1751,6 +1724,8 @@ int CFred_mission_save::save_objects()
fout(" \"scramble-messages\"");
if (!(objp->flags & OF_COLLIDES))
fout(" \"no-collide\"");
if (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)
fout(" \"no-disabled-self-destruct\"");
fout(" )");
}
// -----------------------------------------------------------
@@ -3002,7 +2977,7 @@ int CFred_mission_save::fout_version(char *format, ...)
str_scp.append(fso_ver_comment.back().c_str());
str_scp.append(" ");
cfputs(const_cast<char*>(str_scp.c_str()), fp);
cfputs(str_scp.c_str(), fp);
str_scp = "";
}
@@ -3029,7 +3004,7 @@ int CFred_mission_save::fout_version(char *format, ...)
if (first_line) {
first_line = false;
} else {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
}
@@ -3041,7 +3016,7 @@ int CFred_mission_save::fout_version(char *format, ...)
if (first_line) {
first_line = false;
} else {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
}
@@ -3055,7 +3030,7 @@ int CFred_mission_save::fout_version(char *format, ...)
// be sure to account for any ending elements too
if ( strlen(str_p) ) {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
cfputs(str_p, fp);
}
@@ -3084,7 +3059,7 @@ int CFred_mission_save::fout(char *format, ...)
vsprintf(str, format, args);
va_end(args);
cfputs(const_cast<char*>(str.c_str()), fp);
cfputs(str.c_str(), fp);
return 0;
}
@@ -3149,7 +3124,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
if (first_line) {
first_line = false;
} else {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
}
@@ -3161,7 +3136,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
if (first_line) {
first_line = false;
} else {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
}
@@ -3175,7 +3150,7 @@ int CFred_mission_save::fout_ext(char *pre_str, char *format, ...)
// be sure to account for any ending elements too
if ( strlen(str_p) ) {
cfputs(const_cast<char*>(fso_ver_comment.back().c_str()), fp);
cfputs(fso_ver_comment.back().c_str(), fp);
cfputs(" ", fp);
cfputs(str_p, fp);
}
@@ -3883,6 +3858,28 @@ int CFred_mission_save::save_music()
return err;
}
void CFred_mission_save::save_custom_bitmap(const char *expected_string_640, const char *expected_string_1024, const char *string_field_640, const char *string_field_1024, int blank_lines)
{
if (Format_fs2_open != FSO_FORMAT_RETAIL)
{
if ((*string_field_640 != '\0') || (*string_field_1024 != '\0'))
{
while (blank_lines-- > 0)
fout("\n");
}
if (*string_field_640 != '\0')
{
fout("\n%s %s", expected_string_640, string_field_640);
}
if (*string_field_1024 != '\0')
{
fout("\n%s %s", expected_string_1024, string_field_1024);
}
}
}
void CFred_mission_save::save_turret_info(ship_subsys *ptr, int ship)
{
int i, z;
+4 -1
View File
@@ -15,7 +15,6 @@
#include <stdio.h>
#include "mission/missionparse.h"
#include "parse/parselo.h"
#include "ai/ailocal.h"
#include "ai/ai.h"
#include "cfile/cfile.h"
#include "ship/ship.h"
@@ -57,11 +56,15 @@ private:
int save_music();
void save_campaign_sexp(int node, int link);
void save_single_dock_instance(ship *shipp, dock_instance *dock_ptr);
void save_custom_bitmap(const char *expected_string_640, const char *expected_string_1024, const char *string_field_640, const char *string_field_1024, int blank_lines = 0);
void convert_special_tags_to_retail(char *text, int max_len);
void convert_special_tags_to_retail(SCP_string &text);
void convert_special_tags_to_retail();
void save_mission_internal(const char *pathname);
public:
void save_turret_info(ship_subsys *ptr, int ship);
int save_bitmaps();
+5 -4
View File
@@ -283,9 +283,10 @@ void player_start_editor::reset_controls()
// create a checklistbox for each "player" ship type
m_ship_list.ResetContent();
ct = 0;
for (i=0; i<Num_ship_classes; i++) {
if (Ship_info[i].flags & SIF_PLAYER_SHIP) {
m_ship_list.AddString(Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
if (it->flags & SIF_PLAYER_SHIP) {
i = std::distance(Ship_info.cbegin(), it);
m_ship_list.AddString(it->name);
// if the ship currently has pool entries or was set by a variable, check it
if((static_ship_pool[selected_team][i] > 0) || (static_ship_variable_pool[selected_team][i] != -1)) {
@@ -808,7 +809,7 @@ void player_start_editor::OnOK()
// Now we deal with the loadout ships that are statically assigned by class
for(idx=0; idx<Num_ship_classes; idx++) {
for (idx = 0; idx < static_cast<int>(Ship_info.size()); idx++) {
// if we have ships here
if(static_ship_pool[i][idx] > 0 || static_ship_variable_pool[i][idx] > -1) {
Team_data[i].ship_list[num_choices] = idx;
+1
View File
@@ -1180,6 +1180,7 @@
#define IDC_MISSION_LOG_1ST_TRIGGER 1641
#define IDC_MISSION_LOG_LAST_TRIGGER 1642
#define IDC_NO_COLLIDE 1643
#define IDC_NO_DISABLED_SELF_DESTRUCT 1644
#define ID_FILE_MISSIONNOTES 32771
#define ID_DUPLICATE 32774
#define ID_VIEW_ROTATE 32775
Regular → Executable
+8 -11
View File
@@ -2797,7 +2797,7 @@ int sexp_tree::query_default_argument_available(int op, int i)
return (sexp_variable_count() > 0) ? 1 : 0;
case OPF_SSM_CLASS:
return (Ssm_info_count > 0) ? 1 : 0;
return (Ssm_info.size() > 0) ? 1 : 0;
case OPF_MISSION_MOOD:
return Builtin_moods.empty() ? 0 : 1;
@@ -5040,16 +5040,15 @@ sexp_list_item *sexp_tree::get_listing_opf_ai_class()
sexp_list_item *sexp_tree::get_listing_opf_support_ship_class()
{
int i;
sexp_list_item head;
head.add_data("<species support ship class>");
for (i=0; i<Num_ship_classes; i++)
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
{
if (Ship_info[i].flags & SIF_SUPPORT)
if (it->flags & SIF_SUPPORT)
{
head.add_data(Ship_info[i].name);
head.add_data(it->name);
}
}
@@ -5058,12 +5057,11 @@ sexp_list_item *sexp_tree::get_listing_opf_support_ship_class()
sexp_list_item *sexp_tree::get_listing_opf_ssm_class()
{
int i;
sexp_list_item head;
for (i=0; i<Ssm_info_count; i++)
for (auto it = Ssm_info.cbegin(); it != Ssm_info.cend(); ++it)
{
head.add_data(Ssm_info[i].name);
head.add_data(it->name);
}
return head.next;
@@ -5698,11 +5696,10 @@ sexp_list_item *sexp_tree::get_listing_opf_intel_name()
sexp_list_item *sexp_tree::get_listing_opf_ship_class_name()
{
int i;
sexp_list_item head;
for (i=0; i<Num_ship_classes; i++)
head.add_data(Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
head.add_data(it->name);
return head.next;
}
+2 -2
View File
@@ -87,8 +87,8 @@ BOOL shield_sys_dlg::OnInitDialog()
box = (CComboBox *) GetDlgItem(IDC_TYPE);
box->ResetContent();
for (i=0; i<Num_ship_classes; i++)
box->AddString(Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it)
box->AddString(it->name);
box = (CComboBox *) GetDlgItem(IDC_TEAM);
box->ResetContent();
+15 -6
View File
@@ -17,7 +17,6 @@
#include "render/3d.h"
#include "physics/physics.h"
#include "editor.h"
#include "ai/ailocal.h"
#include "ai/aigoals.h"
#include "parse/parselo.h"
#include "Management.h"
@@ -264,8 +263,8 @@ BOOL CShipEditorDlg::Create()
ptr = (CComboBox *) GetDlgItem(IDC_SHIP_CLASS);
ptr->ResetContent();
for (i=0; i<Num_ship_classes; i++){
ptr->AddString(Ship_info[i].name);
for (auto it = Ship_info.cbegin(); it != Ship_info.end(); ++it){
ptr->AddString(it->name);
}
ptr = (CComboBox *) GetDlgItem(IDC_AI_CLASS);
@@ -587,7 +586,7 @@ void CShipEditorDlg::initialize_data(int full_update)
m_score.init(Ships[i].score);
m_assist_score.init((int)(Ships[i].assist_score_pct*100));
m_persona = Ships[i].persona_index + 1;
m_persona = Ships[i].persona_index;
// we use final_death_time member of ship structure for holding the amount of time before a mission
// to destroy this ship
@@ -625,8 +624,8 @@ void CShipEditorDlg::initialize_data(int full_update)
m_hotkey = -1;
}
if ( Ships[i].persona_index != (m_persona-1) ){
m_persona = -1;
if ( Ships[i].persona_index != m_persona ){
m_persona = -2;
}
if (Ships[i].wingnum != wing){
@@ -678,6 +677,16 @@ void CShipEditorDlg::initialize_data(int full_update)
}
}
m_persona++;
if (m_persona > 0) {
int persona_index = 0;
for (int i = 0; i < m_persona; i++) {
if (Personas[i].flags & PERSONA_FLAG_WINGMAN)
persona_index++;
}
m_persona = persona_index;
}
} else { // no ships selected, 0 or more player ships selected
if (player_count > 1) { // multiple player ships selected
Assert(base_player >= 0);
+48 -18
View File
@@ -74,9 +74,10 @@ void ship_flags_dlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name);
DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets);
DDX_Control(pDX, IDC_CLOAKED, m_cloaked);
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically);
DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages);
DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide);
DDX_Control(pDX, IDC_NO_DISABLED_SELF_DESTRUCT, m_no_disabled_self_destruct);
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate) { // get dialog control values
@@ -142,6 +143,7 @@ BEGIN_MESSAGE_MAP(ship_flags_dlg, CDialog)
ON_BN_CLICKED(IDC_CLOAKED, OnCloaked)
ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages)
ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide)
ON_BN_CLICKED(IDC_NO_DISABLED_SELF_DESTRUCT, OnNoDisabledSelfDestruct)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -162,7 +164,7 @@ BOOL ship_flags_dlg::OnInitDialog()
int hidden_from_sensors = 0, primitive_sensors = 0, no_subspace_drive = 0, affected_by_gravity = 0;
int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0;
int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0;
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0;
int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0, no_disabled_self_destruct = 0;
int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0;
object *objp;
@@ -213,6 +215,7 @@ BOOL ship_flags_dlg::OnInitDialog()
cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0;
scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0;
no_collide = (objp->flags & OF_COLLIDES) ? 0 : 1;
no_disabled_self_destruct = (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT) ? 1 : 0;
destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0;
m_destroy_value.init(shipp->final_death_time);
@@ -274,6 +277,7 @@ BOOL ship_flags_dlg::OnInitDialog()
cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked);
scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages);
no_collide = tristate_set(!(objp->flags & OF_COLLIDES), no_collide);
no_disabled_self_destruct = tristate_set(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT, no_disabled_self_destruct);
// check the final death time and set the internal variable according to whether or not
// the final_death_time is set. Also, the value in the edit box must be set if all the
@@ -349,6 +353,7 @@ BOOL ship_flags_dlg::OnInitDialog()
m_cloaked.SetCheck(cloaked);
m_scramble_messages.SetCheck(scramble_messages);
m_no_collide.SetCheck(no_collide);
m_no_disabled_self_destruct.SetCheck(no_disabled_self_destruct);
m_kdamage.setup(IDC_KDAMAGE, this);
m_destroy_value.setup(IDC_DESTROY_VALUE, this);
@@ -966,22 +971,6 @@ void ship_flags_dlg::update_ship(int shipnum)
break;
}
switch (m_no_collide.GetCheck()) {
case 1:
if ( objp->flags & OF_COLLIDES )
set_modified();
objp->flags &= ~OF_COLLIDES;
break;
case 0:
if (!(objp->flags & OF_COLLIDES))
set_modified();
objp->flags |= OF_COLLIDES;
break;
}
switch (m_guardian.GetCheck()) {
case 1:
if ( !(shipp->ship_guardian_threshold) )
@@ -1062,6 +1051,38 @@ void ship_flags_dlg::update_ship(int shipnum)
break;
}
switch (m_no_collide.GetCheck()) {
case 1:
if (objp->flags & OF_COLLIDES)
set_modified();
objp->flags &= ~OF_COLLIDES;
break;
case 0:
if (!(objp->flags & OF_COLLIDES))
set_modified();
objp->flags |= OF_COLLIDES;
break;
}
switch (m_no_disabled_self_destruct.GetCheck()) {
case 1:
if (!(shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT))
set_modified();
shipp->flags2 |= SF2_NO_DISABLED_SELF_DESTRUCT;
break;
case 0:
if (shipp->flags2 & SF2_NO_DISABLED_SELF_DESTRUCT)
set_modified();
shipp->flags2 &= ~SF2_NO_DISABLED_SELF_DESTRUCT;
break;
}
shipp->respawn_priority = 0;
if(The_mission.game_type & MISSION_TYPE_MULTI) {
@@ -1440,3 +1461,12 @@ void ship_flags_dlg::OnNoCollide()
m_no_collide.SetCheck(1);
}
}
void ship_flags_dlg::OnNoDisabledSelfDestruct()
{
if (m_no_disabled_self_destruct.GetCheck() == 1) {
m_no_disabled_self_destruct.SetCheck(0);
} else {
m_no_disabled_self_destruct.SetCheck(1);
}
}
+3 -1
View File
@@ -65,9 +65,10 @@ public:
CButton m_hide_ship_name;
CButton m_disable_ets;
CButton m_cloaked;
CButton m_no_collide;
CButton m_set_class_dynamically;
CButton m_scramble_messages;
CButton m_no_collide;
CButton m_no_disabled_self_destruct;
CSpinButtonCtrl m_destroy_spin;
numeric_edit_control m_kdamage;
@@ -128,6 +129,7 @@ protected:
afx_msg void OnCloaked();
afx_msg void OnScrambleMessages();
afx_msg void OnNoCollide();
afx_msg void OnNoDisabledSelfDestruct();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
+1 -1
View File
@@ -718,7 +718,7 @@ int VoiceActingManager::fout(char *format, ...)
vsprintf(str, format, args);
va_end(args);
cfputs(const_cast<char*>(str.c_str()), fp);
cfputs(str.c_str(), fp);
return 0;
}
+60 -12
View File
@@ -87,7 +87,11 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
if (pDX->m_bSaveAndValidate) {
GetDlgItem(IDC_AMMO1)->GetWindowText(str);
if (save_number((char *) (LPCSTR) str, &m_ammo1)) {
m_ammo_max1 = (m_missile1 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
if (m_missile1 <= 0) {
m_ammo_max1 = 0;
} else {
m_ammo_max1 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 + First_secondary_index - 1);
}
if (m_ammo1 < 0)
m_ammo1 = 0;
if (m_ammo1 > m_ammo_max1)
@@ -96,7 +100,11 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
GetDlgItem(IDC_AMMO2)->GetWindowText(str);
if (save_number((char *) (LPCSTR) str, &m_ammo2)) {
m_ammo_max2 = (m_missile2 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
if (m_missile2 <= 0) {
m_ammo_max2 = 0;
} else {
m_ammo_max2 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 + First_secondary_index - 1);
}
if (m_ammo2 < 0)
m_ammo2 = 0;
if (m_ammo2 > m_ammo_max2)
@@ -105,7 +113,11 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
GetDlgItem(IDC_AMMO3)->GetWindowText(str);
if (save_number((char *) (LPCSTR) str, &m_ammo3)) {
m_ammo_max3 = (m_missile3 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
if (m_missile3 <= 0) {
m_ammo_max3 = 0;
} else {
m_ammo_max3 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 + First_secondary_index - 1);
}
if (m_ammo3 < 0)
m_ammo3 = 0;
if (m_ammo3 > m_ammo_max3)
@@ -114,7 +126,11 @@ void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
GetDlgItem(IDC_AMMO4)->GetWindowText(str);
if (save_number((char *) (LPCSTR) str, &m_ammo4)) {
m_ammo_max4 = (m_missile4 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
if (m_missile4 <= 0) {
m_ammo_max4 = 0;
} else {
m_ammo_max4 = (m_cur_item == 0) ? get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1) : get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 + First_secondary_index - 1);
}
if (m_ammo4 < 0)
m_ammo4 = 0;
if (m_ammo4 > m_ammo_max4)
@@ -403,7 +419,11 @@ void WeaponEditorDlg::change_selection()
if (cur_weapon->num_secondary_banks > 0) {
m_missile1 = cur_weapon->secondary_bank_weapons[0] + 1;
if (m_missile1 > 0) {
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
if (m_cur_item == 0) {
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
} else {
m_ammo_max1 = get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 - 1);
}
if (cur_weapon->secondary_bank_ammo[0] != BLANK_FIELD)
m_ammo1 = cur_weapon->secondary_bank_ammo[0] * m_ammo_max1 / 100;
m_missile1 -= First_secondary_index;
@@ -422,7 +442,11 @@ void WeaponEditorDlg::change_selection()
if (cur_weapon->num_secondary_banks > 1) {
m_missile2 = cur_weapon->secondary_bank_weapons[1] + 1;
if (m_missile2 > 0) {
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
if (m_cur_item == 0) {
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
} else {
m_ammo_max2 = get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 - 1);
}
if (cur_weapon->secondary_bank_ammo[1] != BLANK_FIELD)
m_ammo2 = cur_weapon->secondary_bank_ammo[1] * m_ammo_max2 / 100;
m_missile2 -= First_secondary_index;
@@ -441,7 +465,11 @@ void WeaponEditorDlg::change_selection()
if (cur_weapon->num_secondary_banks > 2) {
m_missile3 = cur_weapon->secondary_bank_weapons[2] + 1;
if (m_missile3 > 0) {
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
if (m_cur_item == 0) {
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
} else {
m_ammo_max3 = get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 - 1);
}
if (cur_weapon->secondary_bank_ammo[2] != BLANK_FIELD)
m_ammo3 = cur_weapon->secondary_bank_ammo[2] * m_ammo_max3 / 100;
m_missile3 -= First_secondary_index;
@@ -460,7 +488,11 @@ void WeaponEditorDlg::change_selection()
if (cur_weapon->num_secondary_banks > 3) {
m_missile4 = cur_weapon->secondary_bank_weapons[3] + 1;
if (m_missile4 > 0) {
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
if (m_cur_item == 0) {
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
} else {
m_ammo_max4 = get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 - 1);
}
if (cur_weapon->secondary_bank_ammo[3] != BLANK_FIELD)
m_ammo4 = cur_weapon->secondary_bank_ammo[3] * m_ammo_max4 / 100;
m_missile4 -= First_secondary_index;
@@ -553,7 +585,11 @@ void WeaponEditorDlg::OnSelchangeMissile1()
{
UpdateData(TRUE);
UpdateData(TRUE);
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
if (m_cur_item == 0) {
m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
} else {
m_ammo_max1 = get_max_ammo_count_for_turret_bank(cur_weapon, 0, m_missile1 + First_secondary_index - 1);
}
m_ammo1 = m_ammo_max1 ? (m_ammo_max1) : 0;
change_selection();
}
@@ -562,7 +598,11 @@ void WeaponEditorDlg::OnSelchangeMissile2()
{
UpdateData(TRUE);
UpdateData(TRUE);
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile2 + First_secondary_index - 1);
if (m_cur_item == 0) {
m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
} else {
m_ammo_max2 = get_max_ammo_count_for_turret_bank(cur_weapon, 1, m_missile2 + First_secondary_index - 1);
}
m_ammo2 = m_ammo_max2 ? (m_ammo_max2) : 0;
change_selection();
}
@@ -571,7 +611,11 @@ void WeaponEditorDlg::OnSelchangeMissile3()
{
UpdateData(TRUE);
UpdateData(TRUE);
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile3 + First_secondary_index - 1);
if (m_cur_item == 0) {
m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
} else {
m_ammo_max3 = get_max_ammo_count_for_turret_bank(cur_weapon, 2, m_missile3 + First_secondary_index - 1);
}
m_ammo3 = m_ammo_max3 ? (m_ammo_max3) : 0;
change_selection();
}
@@ -580,7 +624,11 @@ void WeaponEditorDlg::OnSelchangeMissile4()
{
UpdateData(TRUE);
UpdateData(TRUE);
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile4 + First_secondary_index - 1);
if (m_cur_item == 0) {
m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
} else {
m_ammo_max4 = get_max_ammo_count_for_turret_bank(cur_weapon, 3, m_missile4 + First_secondary_index - 1);
}
m_ammo4 = m_ammo_max4 ? (m_ammo_max4) : 0;
change_selection();
}
-1
View File
@@ -17,7 +17,6 @@
#include "physics/physics.h"
#include "object/object.h"
#include "editor.h"
#include "ai/ailocal.h"
#include "ship/ship.h"
#include "math/vecmat.h"
#include "Management.h"
+132 -215
View File
@@ -26,7 +26,6 @@
#include "asteroid/asteroid.h"
#include "autopilot/autopilot.h"
#include "bmpman/bmpman.h"
#include "camera/camera.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "cmeasure/cmeasure.h"
@@ -40,24 +39,26 @@
#include "freespace2/freespace.h"
#include "freespace2/freespaceresource.h"
#include "freespace2/levelpaging.h"
#include "fs2netd/fs2netd_client.h"
#include "gamehelp/contexthelp.h"
#include "gamehelp/gameplayhelp.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/eventmusic.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "globalincs/version.h"
#include "globalincs/mspdb_callstack.h"
#include "globalincs/version.h"
#include "graphics/font.h"
#include "graphics/shadows.h"
#include "hud/hud.h"
#include "hud/hudconfig.h"
#include "hud/hudescort.h"
#include "hud/hudlock.h"
#include "hud/hudmessage.h"
#include "hud/hudshield.h"
#include "hud/hudtargetbox.h"
#include "hud/hudparse.h"
#include "hud/hudshield.h"
#include "hud/hudsquadmsg.h"
#include "hud/hudtargetbox.h"
#include "iff_defs/iff_defs.h"
#include "io/joy.h"
#include "io/joy_ff.h"
@@ -129,6 +130,7 @@
#include "parse/scripting.h"
#include "parse/sexp.h"
#include "particle/particle.h"
#include "pilotfile/pilotfile.h"
#include "playerman/managepilot.h"
#include "playerman/player.h"
#include "popup/popup.h"
@@ -157,16 +159,18 @@
#include "weapon/muzzleflash.h"
#include "weapon/shockwave.h"
#include "weapon/weapon.h"
#include "fs2netd/fs2netd_client.h"
#include "pilotfile/pilotfile.h"
#include "globalincs/pstypes.h"
#include <stdexcept>
extern int Om_tracker_flag; // needed for FS2OpenPXO config
#ifdef WIN32
// According to AMD and NV, these _should_ force their drivers into high-performance mode
extern "C" {
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
#ifdef NDEBUG
#ifdef FRED
@@ -307,8 +311,6 @@ int last_single_step=0;
int game_zbuffer = 1;
static int Game_paused;
int Game_level_seed;
#define EXPIRE_BAD_CHECKSUM 1
#define EXPIRE_BAD_TIME 2
@@ -458,7 +460,7 @@ fs_builtin_mission Game_builtin_mission_list[MAX_BUILTIN_MISSIONS] = {
// Internal function prototypes
void game_maybe_draw_mouse(float frametime);
void init_animating_pointer();
void load_animating_pointer(char *filename, int dx, int dy);
void load_animating_pointer(char *filename);
void unload_animating_pointer();
void game_do_training_checks();
void game_shutdown(void);
@@ -574,7 +576,7 @@ void game_framerate_check_init()
extern float Framerate;
void game_framerate_check()
{
int y_start = 100;
int y_start = gr_screen.center_offset_y + 100;
// if the current framerate is above the critical level, add frametime
if(Framerate >= Gf_critical){
@@ -588,7 +590,7 @@ void game_framerate_check()
// display if we're above the critical framerate
if(Framerate < Gf_critical){
gr_set_color_fast(&Color_bright_red);
gr_string(200, y_start, "Framerate warning", GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x + 200, y_start, "Framerate warning", GR_RESIZE_NONE);
y_start += 10;
}
@@ -603,7 +605,7 @@ void game_framerate_check()
gr_set_color_fast(&Color_bright_red);
}
gr_printf_no_resize(200, y_start, "%d%%", (int)pct);
gr_printf_no_resize(gr_screen.center_offset_x + 200, y_start, "%d%%", (int)pct);
y_start += 10;
}
@@ -748,7 +750,9 @@ void game_sunspot_process(float frametime)
// check
for(idx=0; idx<n_lights; idx++) {
if ( (ls_on && !ls_force_off) || !shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
bool in_shadow = shipfx_eye_in_shadow(&Eye_position, Viewer_obj, idx);
if ( (ls_on && !ls_force_off) || !in_shadow ) {
vec3d light_dir;
light_get_global_dir(&light_dir, idx);
@@ -758,10 +762,10 @@ void game_sunspot_process(float frametime)
Sun_spot_goal += (float)pow(dot,85.0f);
}
}
if (!shipfx_eye_in_shadow( &Eye_position, Viewer_obj, idx ) ) {
// draw the glow for this sun
stars_draw_sun_glow(idx);
}
if ( !in_shadow ) {
// draw the glow for this sun
stars_draw_sun_glow(idx);
}
}
Sun_drew = 0;
@@ -943,28 +947,18 @@ uint load_post_level_init;
*
* @return 0 on failure, 1 on success
*/
void game_level_init(int seed)
void game_level_init()
{
game_busy( NOX("** starting game_level_init() **") );
load_gl_init = (uint) time(NULL);
// seed the random number generator
if ( seed == -1 ) {
// if no seed was passed, seed the generator either from the time value, or from the
// netgame security flags -- ensures that all players in multiplayer game will have the
// same randon number sequence (with static rand functions)
if ( Game_mode & GM_NORMAL ) {
Game_level_seed = (int) time(NULL);
} else {
Game_level_seed = Netgame.security;
}
} else {
Assert( !(Game_mode & GM_MULTIPLAYER) );
Game_level_seed = seed;
}
srand( Game_level_seed );
// semirand function needs to get re-initted every time in multiplayer
if ( Game_mode & GM_MULTIPLAYER ){
// seed the random number generator in multiplayer
if ( Game_mode & GM_MULTIPLAYER ) {
// seed the generator from the netgame security flags -- ensures that all players in
// multiplayer will have the same random number sequence (with static rand functions)
srand( Netgame.security );
// semirand function needs to get re-initted every time in multiplayer
init_semirand();
}
@@ -1259,7 +1253,7 @@ void game_loading_callback_close()
// Make sure bar shows all the way over.
game_loading_callback(COUNT_ESTIMATE);
int real_count = game_busy_callback( NULL );
int real_count __UNUSED = game_busy_callback( NULL );
Mouse_hidden = 0;
Game_loading_callback_inited = 0;
@@ -1423,7 +1417,7 @@ int game_start_mission()
{
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
int s1 = timer_get_milliseconds();
int s1 __UNUSED = timer_get_milliseconds();
// clear post processing settings
gr_post_process_set_defaults();
@@ -1480,9 +1474,9 @@ int game_start_mission()
bm_print_bitmaps();
int e1 = timer_get_milliseconds();
int e1 __UNUSED = timer_get_milliseconds();
printf("Level load took %f seconds.\n", (e1 - s1) / 1000.0f );
mprintf(("Level load took %f seconds.\n", (e1 - s1) / 1000.0f ));
return 1;
}
@@ -1610,8 +1604,6 @@ DCF(show_cpu,"Toggles showing cpu usage")
#endif
int Game_init_seed;
DCF(use_joy_mouse,"Makes joystick move mouse cursor")
{
bool process = true;
@@ -1739,7 +1731,7 @@ char full_path[1024];
*/
void game_init()
{
int s1, e1;
int s1 __UNUSED, e1 __UNUSED;
const char *ptr;
char whee[MAX_PATH_LEN];
@@ -1748,8 +1740,8 @@ void game_init()
// Moved from rand32, if we're gonna break, break immediately.
Assert(RAND_MAX == 0x7fff || RAND_MAX >= 0x7ffffffd);
// seed the random number generator
Game_init_seed = (int) time(NULL);
srand( Game_init_seed );
int game_init_seed = (int) time(NULL);
srand( game_init_seed );
Framerate_delay = 0;
@@ -2020,7 +2012,8 @@ void game_init()
armor_init();
ai_init();
ai_profiles_init(); // Goober5000
weapon_init();
weapon_init();
glowpoint_init();
ship_init(); // read in ships.tbl
player_init();
@@ -2048,7 +2041,7 @@ void game_init()
pilot_load_pic_list();
pilot_load_squad_pic_list();
load_animating_pointer(NOX("cursor"), 0, 0);
load_animating_pointer(NOX("cursor"));
if(!Cmdline_reparse_mainhall)
{
@@ -2158,11 +2151,11 @@ void game_show_framerate()
for ( pss = GET_FIRST(&shipp->subsys_list); pss !=END_OF_LIST(&shipp->subsys_list); pss = GET_NEXT(pss) ) {
if (pss->system_info->type == SUBSYSTEM_TURRET) {
if(pss->turret_enemy_objnum == -1)
gr_printf_no_resize(10, t*line_height, "Turret %d: <None>", t);
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: <None>", t);
else if (Objects[pss->turret_enemy_objnum].type == OBJ_SHIP)
gr_printf_no_resize(10, t*line_height, "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: %s", t, Ships[Objects[pss->turret_enemy_objnum].instance].ship_name);
else
gr_printf_no_resize(10, t*line_height, "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
gr_printf_no_resize(gr_screen.center_offset_x + 10, gr_screen.center_offset_y + (t*line_height), "Turret %d: <Object %d>", t, pss->turret_enemy_objnum);
t++;
}
@@ -2175,14 +2168,14 @@ void game_show_framerate()
gr_set_color_fast(&HUD_color_debug);
if (Cmdline_frame_profile) {
gr_string(20, 100 + line_height, profile_output, GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + line_height, profile_output.c_str(), GR_RESIZE_NONE);
}
if (Show_framerate) {
if (frametotal != 0.0f)
gr_printf_no_resize( 20, 100, "FPS: %0.1f", Framerate );
gr_printf_no_resize( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100, "FPS: %0.1f", Framerate );
else
gr_string( 20, 100, "FPS: ?", GR_RESIZE_NONE );
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100, "FPS: ?", GR_RESIZE_NONE );
}
}
@@ -2196,6 +2189,10 @@ void game_show_framerate()
#ifdef _WIN32
if (Cmdline_show_stats && HUD_draw) {
int sx,sy;
sx = gr_screen.center_offset_x + 20;
sy = gr_screen.center_offset_y + 100 + (line_height * 2);
char mem_buffer[50];
MEMORYSTATUS mem_stats;
@@ -2207,22 +2204,27 @@ void game_show_framerate()
else
sprintf(mem_buffer,"Using Physical: %d Meg",(Mem_starttime_phys - mem_stats.dwAvailPhys)/1024/1024);
gr_string( 20, 100 + (line_height * 2), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
sy += line_height;
sprintf(mem_buffer,"Using Pagefile: %d Meg",(Mem_starttime_pagefile - mem_stats.dwAvailPageFile)/1024/1024);
gr_string( 20, 100 + (line_height * 3), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
sy += line_height;
sprintf(mem_buffer,"Using Virtual: %d Meg",(Mem_starttime_virtual - mem_stats.dwAvailVirtual)/1024/1024);
gr_string( 20, 100 + (line_height * 4), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
sy += line_height * 2;
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) )
sprintf(mem_buffer, "Physical Free: *** / *** (>4G)");
else
sprintf(mem_buffer,"Physical Free: %d / %d Meg",mem_stats.dwAvailPhys/1024/1024, mem_stats.dwTotalPhys/1024/1024);
gr_string( 20, 100 + (line_height * 6), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
sy += line_height;
sprintf(mem_buffer,"Pagefile Free: %d / %d Meg",mem_stats.dwAvailPageFile/1024/1024, mem_stats.dwTotalPageFile/1024/1024);
gr_string( 20, 100 + (line_height * 7), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
sy += line_height;
sprintf(mem_buffer,"Virtual Free: %d / %d Meg",mem_stats.dwAvailVirtual/1024/1024, mem_stats.dwTotalVirtual/1024/1024);
gr_string( 20, 100 + (line_height * 8), mem_buffer, GR_RESIZE_NONE);
gr_string( sx, sy, mem_buffer, GR_RESIZE_NONE);
}
#endif
@@ -2230,8 +2232,8 @@ void game_show_framerate()
if ( Show_cpu == 1 ) {
int sx,sy;
sx = gr_screen.max_w - 154;
sy = 15;
sx = gr_screen.center_offset_x + gr_screen.center_w - 154;
sy = gr_screen.center_offset_y + 15;
gr_set_color_fast(&HUD_color_debug);
@@ -2277,8 +2279,8 @@ void game_show_framerate()
if ( Show_mem ) {
int sx,sy;
sx = gr_screen.max_w - 154;
sy = 15;
sx = gr_screen.center_offset_x + gr_screen.center_w - 154;
sy = gr_screen.center_offset_y + 15;
gr_set_color_fast(&HUD_color_debug);
@@ -2311,8 +2313,8 @@ void game_show_framerate()
if ( Show_player_pos ) {
int sx, sy;
sx = 320;
sy = 100;
sx = gr_screen.center_offset_x + 320;
sy = gr_screen.center_offset_y + 100;
gr_printf_no_resize(sx, sy, NOX("Player Pos: (%d,%d,%d)"), fl2i(Player_obj->pos.xyz.x), fl2i(Player_obj->pos.xyz.y), fl2i(Player_obj->pos.xyz.z));
}
@@ -2344,11 +2346,11 @@ void game_show_framerate()
short_name++;
sprintf(mem_buffer,"%s:\t%d K", short_name, size);
gr_string( 20, 100 + (line_height * 12) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + (line_height * 12) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
}
sprintf(mem_buffer,"Total RAM:\t%d K", TotalRam / 1024);
gr_string( 20, 100 + (line_height * 13) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
gr_string( gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 + (line_height * 13) + (mi*line_height), mem_buffer, GR_RESIZE_NONE);
}
#endif
@@ -2383,7 +2385,7 @@ void game_show_eye_pos(camid cid)
gr_set_color_fast(&HUD_color_debug);
//Position
gr_printf_no_resize(20, 100 - font_height, "X:%f Y:%f Z:%f", cam_pos.xyz.x, cam_pos.xyz.y, cam_pos.xyz.z);
gr_printf_no_resize(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 - font_height, "X:%f Y:%f Z:%f", cam_pos.xyz.x, cam_pos.xyz.y, cam_pos.xyz.z);
font_height -= font_height/2;
//Orientation
@@ -2391,7 +2393,7 @@ void game_show_eye_pos(camid cid)
rot_angles.p *= (180/PI);
rot_angles.b *= (180/PI);
rot_angles.h *= (180/PI);
gr_printf_no_resize(20, 100 - font_height, "Xr:%f Yr:%f Zr:%f", rot_angles.p, rot_angles.b, rot_angles.h);
gr_printf_no_resize(gr_screen.center_offset_x + 20, gr_screen.center_offset_y + 100 - font_height, "Xr:%f Yr:%f Zr:%f", rot_angles.p, rot_angles.b, rot_angles.h);
}
void game_show_standalone_framerate()
@@ -2441,7 +2443,7 @@ void game_show_time_left()
diff = 0;
hud_set_default_color();
gr_printf_no_resize( 5, 40, XSTR( "Mission time remaining: %d seconds", 179), diff );
gr_printf_no_resize( gr_screen.center_offset_x + 5, gr_screen.center_offset_y + 40, XSTR( "Mission time remaining: %d seconds", 179), diff );
}
//========================================================================================
@@ -2809,7 +2811,7 @@ void game_tst_mark(object *objp, ship *shipp)
}
// bogus
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= Num_ship_classes)){
if((objp == NULL) || (shipp == NULL) || (shipp->ship_info_index < 0) || (shipp->ship_info_index >= static_cast<int>(Ship_info.size()))){
return;
}
sip = &Ship_info[shipp->ship_info_index];
@@ -3261,16 +3263,16 @@ void setup_environment_mapping(camid cid)
// face 3 (py / up)
memset( &new_orient, 0, sizeof(matrix) );
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
new_orient.vec.rvec.xyz.x = 1.0f;
render_environment(i, &cam_pos, &new_orient, new_zoom);
i++; // bump!
// face 4 (ny / down)
memset( &new_orient, 0, sizeof(matrix) );
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
new_orient.vec.fvec.xyz.y = (gr_screen.mode == GR_OPENGL) ? -1.0f : 1.0f;
new_orient.vec.uvec.xyz.z = (gr_screen.mode == GR_OPENGL) ? 1.0f : -1.0f;
new_orient.vec.rvec.xyz.x = 1.0f;
render_environment(i, &cam_pos, &new_orient, new_zoom);
i++; // bump!
@@ -3666,7 +3668,8 @@ DCF_BOOL( subspace, Game_subspace_effect )
void clip_frame_view();
// Does everything needed to render a frame
extern SCP_vector<object*> effect_ships;
extern SCP_vector<object*> effect_ships;
extern SCP_vector<object*> transparent_objects;
void game_render_frame( camid cid )
{
@@ -3715,7 +3718,7 @@ void game_render_frame( camid cid )
// Note: environment mapping gets disabled when rendering to texture; if you change
// this, make sure that the current render target gets restored right afterwards!
if ( Cmdline_env && !Env_cubemap_drawn && gr_screen.rendering_to_texture == -1 ) {
setup_environment_mapping(cid);
PROFILE("Environment Mapping", setup_environment_mapping(cid));
if ( !Dynamic_environment ) {
Env_cubemap_drawn = true;
@@ -3740,15 +3743,13 @@ void game_render_frame( camid cid )
stars_draw(1,1,1,0,0);
}
bool draw_viewer_last = false;
obj_render_all(obj_render, &draw_viewer_last);
// Why do we not show the shield effect in these modes? Seems ok.
//if (!(Viewer_mode & (VM_EXTERNAL | VM_SLEWED | VM_CHASE | VM_DEAD_VIEW))) {
render_shields();
//}
PROFILE("Build Shadow Map", shadows_render_all(Proj_fov, &Eye_matrix, &Eye_position));
PROFILE("Render Scene", obj_render_queue_all());
PROFILE("Particles", particle_render_all()); // render particles after everything else.
render_shields();
PROFILE("Trails", trail_render_all()); // render missilie trails after everything else.
PROFILE("Particles", particle_render_all()); // render particles after everything else.
#ifdef DYN_CLIP_DIST
if(!Cmdline_nohtl)
@@ -3761,8 +3762,6 @@ void game_render_frame( camid cid )
#endif
beam_render_all(); // render all beam weapons
PROFILE("Trails", trail_render_all()); // render missilie trails after everything else.
// render nebula lightning
nebl_render_all();
@@ -3770,14 +3769,25 @@ void game_render_frame( camid cid )
// render local player nebula
neb2_render_player();
gr_copy_effect_texture();
// render all ships with shader effects on them
SCP_vector<object*>::iterator obji = effect_ships.begin();
for(;obji != effect_ships.end();++obji)
ship_render(*obji);
{
obj_render(*obji);
}
effect_ships.clear();
batch_render_distortion_map_bitmaps();
Shadow_override = true;
//Draw the viewer 'cause we didn't before.
//This is so we can change the minimum clipping distance without messing everything up.
if(draw_viewer_last && Viewer_obj)
if ( Viewer_obj
&& (Viewer_obj->type == OBJ_SHIP)
&& (Ship_info[Ships[Viewer_obj->instance].ship_info_index].flags2 & SIF2_SHOW_SHIP_MODEL)
&& (!Viewer_mode || (Viewer_mode & VM_PADLOCK_ANY) || (Viewer_mode & VM_OTHER_SHIP) || (Viewer_mode & VM_TRACK)) )
{
gr_post_process_save_zbuffer();
ship_render_show_ship_cockpit(Viewer_obj);
@@ -3813,10 +3823,10 @@ void game_render_frame( camid cid )
gr_end_proj_matrix();
gr_end_view_matrix();
}
Shadow_override = false;
//================ END OF 3D RENDERING STUFF ====================
gr_scene_texture_end();
PROFILE("Post Process", gr_scene_texture_end());
extern int Multi_display_netinfo;
if(Multi_display_netinfo){
@@ -3830,7 +3840,7 @@ void game_render_frame( camid cid )
do_timing_test(flFrametime);
extern int OO_update_index;
multi_rate_display(OO_update_index, 375, 0);
multi_rate_display(OO_update_index, gr_screen.center_offset_x + 375, gr_screen.center_offset_y);
// test
extern void oo_display();
@@ -3873,97 +3883,6 @@ void john_debug_stuff(vec3d *eye_pos, matrix *eye_orient)
}
#endif
// following function for dumping frames for purposes of building trailers.
#ifndef NDEBUG
// function to toggle state of dumping every frame into PCX when playing the game
DCF(dump_frames, "Toggles On/off frame dumping at 15 hz")
{
if ( Debug_dump_frames == 0 ) {
// Turn it on
Debug_dump_frames = 15;
Debug_dump_trigger = 0;
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
dc_printf( "Frame dumping at 15 hz is now ON\n" );
} else {
// Turn it off
Debug_dump_frames = 0;
Debug_dump_trigger = 0;
gr_dump_frame_stop();
dc_printf( "Frame dumping is now OFF\n" );
}
}
DCF(dump_frames_trigger, "Starts/stop frame dumping at 15 hz")
{
if ( Debug_dump_frames == 0 ) {
// Turn it on
Debug_dump_frames = 15;
Debug_dump_trigger = 1;
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
dc_printf( "Frame dumping at 15 hz is now ON\n" );
} else {
// Turn it off
Debug_dump_frames = 0;
Debug_dump_trigger = 0;
gr_dump_frame_stop();
dc_printf( "Frame dumping is now OFF\n" );
}
}
DCF(dump_frames30, "Starts/stop frame dumping at 30 hz")
{
if ( Debug_dump_frames == 0 ) {
// Turn it on
Debug_dump_frames = 30;
Debug_dump_trigger = 0;
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
dc_printf( "Frame dumping at 30 hz is now ON\n" );
} else {
// Turn it off
Debug_dump_frames = 0;
Debug_dump_trigger = 0;
gr_dump_frame_stop();
dc_printf( "Frame dumping is now OFF\n" );
}
}
DCF(dump_frames30_trigger, "Starts/stop frame dumping at 30 hz")
{
if ( Debug_dump_frames == 0 ) {
// Turn it on
Debug_dump_frames = 30;
Debug_dump_trigger = 1;
gr_dump_frame_start( Debug_dump_frame_num, DUMP_BUFFER_NUM_FRAMES );
dc_printf( "Triggered frame dumping at 30 hz is now ON\n" );
} else {
// Turn it off
Debug_dump_frames = 0;
Debug_dump_trigger = 0;
gr_dump_frame_stop();
dc_printf( "Triggered frame dumping is now OFF\n" );
}
}
void game_maybe_dump_frame()
{
if ( !Debug_dump_frames ){
return;
}
if( Debug_dump_trigger && !keyd_pressed[KEY_Q] ){
return;
}
game_stop_time();
gr_dump_frame();
Debug_dump_frame_num++;
game_start_time();
}
#endif
extern int Player_dead_state;
// Flip the page and time how long it took.
@@ -4004,7 +3923,7 @@ void game_simulation_frame()
ship_info *sip;
while((moveup != END_OF_LIST(&Ship_obj_list)) && (moveup != NULL)){
// bogus
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= Num_ship_classes)){
if((moveup->objnum < 0) || (moveup->objnum >= MAX_OBJECTS) || (Objects[moveup->objnum].type != OBJ_SHIP) || (Objects[moveup->objnum].instance < 0) || (Objects[moveup->objnum].instance >= MAX_SHIPS) || (Ships[Objects[moveup->objnum].instance].ship_info_index < 0) || (Ships[Objects[moveup->objnum].instance].ship_info_index >= static_cast<int>(Ship_info.size()))){
moveup = GET_NEXT(moveup);
continue;
}
@@ -4424,7 +4343,6 @@ void game_frame(bool paused)
}
#endif
// start timing frame
timing_frame_start();
profile_begin("Main Frame");
DEBUG_GET_TIME( total_time1 )
@@ -4589,11 +4507,7 @@ void game_frame(bool paused)
// maybe render and process the dead popup
game_maybe_do_dead_popup(flFrametime);
// start timing frame
timing_frame_stop();
// timing_display(30, 10);
// If a regular popup is active, don't flip (popup code flips)
if( !popup_running_state() ){
DEBUG_GET_TIME( flip_time1 )
@@ -4601,9 +4515,6 @@ void game_frame(bool paused)
DEBUG_GET_TIME( flip_time2 )
}
#ifndef NDEBUG
game_maybe_dump_frame(); // used to dump pcx files for building trailers
#endif
} else {
game_show_standalone_framerate();
}
@@ -4773,7 +4684,7 @@ void game_set_frametime(int state)
fix frame_speed = F1_0 / Debug_dump_frames;
if (Frametime > frame_speed ){
nprintf(("warning","slow frame: %x\n",Frametime));
nprintf(("warning","slow frame: %x\n",(int)Frametime));
} else {
do {
thistime = timer_get_fixed_seconds();
@@ -4847,7 +4758,9 @@ void game_set_frametime(int state)
Last_frame_timestamp = timestamp();
flFrametime = f2fl(Frametime);
timestamp_inc(flFrametime);
auto frametime_ms = f2i(fixmul(Frametime, F1_0 * TIMESTAMP_FREQUENCY));
timestamp_inc(frametime_ms);
// wrap overall frametime if needed
if ( FrametimeOverall > (INT_MAX - F1_0) )
@@ -5740,6 +5653,10 @@ void game_leave_state( int old_state, int new_state )
snd_aav_init();
freespace_stop_mission();
if (Cmdline_benchmark_mode) {
gameseq_post_event( GS_EVENT_QUIT_GAME );
}
}
break;
@@ -5942,6 +5859,10 @@ void game_leave_state( int old_state, int new_state )
case GS_STATE_FICTION_VIEWER:
fiction_viewer_close();
common_select_close();
if (new_state == GS_STATE_MAIN_MENU) {
freespace_stop_mission();
}
break;
case GS_STATE_LAB:
@@ -7025,7 +6946,7 @@ int game_main(char *cmdline)
// check if networking should be disabled, this could probably be done later but the sooner the better
// TODO: remove this when multi is fixed to handle more than MAX_SHIP_CLASSES_MULTI
if ( Num_ship_classes > MAX_SHIP_CLASSES_MULTI ) {
if ( Ship_info.size() > MAX_SHIP_CLASSES_MULTI ) {
Networking_disabled = 1;
}
@@ -7413,6 +7334,7 @@ void game_shutdown(void)
// free left over memory from table parsing
player_tips_close();
control_config_common_close();
joy_close();
audiostream_close();
@@ -7505,17 +7427,15 @@ void init_animating_pointer()
//
// input: filename => filename of animation file that holds the animation
//
void load_animating_pointer(char *filename, int dx, int dy)
void load_animating_pointer(char *filename)
{
int fps;
animating_obj *am;
init_animating_pointer();
//TEMP
mprintf(("loading animated cursor \"%s\"\n", filename));
am = &Animating_mouse;
am->first_frame = bm_load_animation(filename, &am->num_frames, &fps);
if ( am->first_frame == -1 )
@@ -7754,13 +7674,13 @@ void game_show_event_debug(float frametime)
gr_clear();
gr_set_color_fast(&Color_bright);
gr_set_font(FONT1);
gr_printf_no_resize(0x8000, 15, NOX("EVENT DEBUG VIEW"));
gr_printf_no_resize(0x8000, gr_screen.center_offset_y + 15, NOX("EVENT DEBUG VIEW"));
gr_set_color_fast(&Color_normal);
gr_set_font(FONT1);
gr_get_string_size(&font_width, &font_height, NOX("test"));
y_max = gr_screen.max_h - font_height - 5;
y_index = 45;
y_max = gr_screen.center_offset_y + gr_screen.center_h - font_height - 5;
y_index = gr_screen.center_offset_y + 45;
k = scroll_offset;
while (k < ED_count) {
@@ -7810,7 +7730,7 @@ void game_show_event_debug(float frametime)
}
}
gr_printf_no_resize(10, y_index, buf);
gr_printf_no_resize(gr_screen.center_offset_x + 10, y_index, buf);
y_index += font_height;
k++;
}
@@ -7919,8 +7839,11 @@ void Time_model( int modelnum )
g3_set_view_matrix( &eye_pos, &eye_orient, VIEWER_ZOOM_DEFAULT );
model_clear_instance( modelnum );
model_render_params render_info;
render_info.set_detail_level_lock(0);
model_set_detail_level(0); // use highest detail level
model_render( modelnum, &model_orient, &model_pos, MR_LOCK_DETAIL); //|MR_NO_POLYS );
model_render_immediate( &render_info, modelnum, &model_orient, &model_pos ); //|MR_NO_POLYS );
g3_end_frame();
// gr_flip();
@@ -7968,9 +7891,7 @@ void Do_model_timings_test()
}
// Load them all
for (i=0; i<Num_ship_classes; i++ ) {
ship_info *sip = &Ship_info[i];
for (auto sip = Ship_info.begin(); sip != Ship_info.end(); ++sip ) {
sip->model_num = model_load(sip->pof_file, 0, NULL);
model_used[sip->model_num % MAX_POLYGON_MODELS]++;
@@ -8536,8 +8457,8 @@ int detect_lang()
detect = NULL;
// now compare the checksum/filesize against known #'s
for (idx=0; idx < (int)Lcl_languages.size(); idx++) {
if (Lcl_languages[idx].checksum == (int)file_checksum) {
for (idx=0; idx < NUM_BUILTIN_LANGUAGES; idx++) {
if (Lcl_builtin_languages[idx].checksum == (int)file_checksum) {
mprintf(( "AutoLang: Language auto-detection successful...\n" ));
return idx;
}
@@ -8767,8 +8688,6 @@ void game_title_screen_display()
}
*/
//Script_system.SetHookVar("SplashScreenImage", 's', Game_title_screen_fname[gr_screen.res]);
//Script_system.SetHookVar("SplashScreenLogo", 's', Game_logo_screen_fname[gr_screen.res]);
bool globalhook_override = Script_system.IsOverride(Script_splashhook);
bool condhook_override = Script_system.IsConditionOverride(CHA_SPLASHSCREEN);
mprintf(("SCRIPTING: Splash screen overrides checked\n"));
@@ -8813,8 +8732,6 @@ void game_title_screen_display()
Script_system.RunCondition(CHA_SPLASHSCREEN);
mprintf(("SCRIPTING: Splash screen conditional hook has been run\n"));
Script_system.RemHookVars(2, "SplashScreenImage", "SplashScreenLogo");
// flip
gr_flip();
+1 -1
View File
@@ -219,7 +219,7 @@ void game_unpause();
//WMC - Stuff for scripting, these make the game go
extern camid Main_camera;
extern void game_level_init(int seed = -1);
extern void game_level_init();
extern void game_post_level_init();
extern camid game_render_frame_setup();
extern void game_render_frame(camid cid);
+5 -5
View File
@@ -336,8 +336,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,1,000000
PRODUCTVERSION 3,7,1,000000
FILEVERSION 3,7,4,20160307
PRODUCTVERSION 3,7,4,20160307
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -354,12 +354,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Volition Inc."
VALUE "FileDescription", "FreeSpace 2 Open"
VALUE "FileVersion", "3.7.1.000000"
VALUE "FileVersion", "3.7.4.20160307"
VALUE "InternalName", "FreeSpace 2 Open"
VALUE "LegalCopyright", "Copyright © 1998"
VALUE "OriginalFilename", "fs2.exe"
VALUE "ProductName", "FreeSpace 2 Open"
VALUE "ProductVersion", "3.7.1"
VALUE "ProductVersion", "3.7.4 RC1"
END
END
BLOCK "VarFileInfo"
@@ -448,5 +448,5 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//
#ifdef FS2_VOICER
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "..\..\code\sound\phrases.cfg"
IDR_CMD_CFG SRGRAMMAR DISCARDABLE "phrases.cfg"
#endif
+20 -20
View File
@@ -9,30 +9,30 @@
#include "globalincs/pstypes.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cfile/cfilesystem.h"
#include "cmdline/cmdline.h"
#include "fs2netd/fs2netd_client.h"
#include "fs2netd/tcp_client.h"
#include "cfile/cfile.h"
#include "network/multi_log.h"
#include "osapi/osregistry.h"
#include "popup/popup.h"
#include "gamesnd/gamesnd.h"
#include "network/multi.h"
#include "playerman/player.h"
#include "io/timer.h"
#include "network/multiutil.h"
#include "network/multiui.h"
#include "network/stand_gui.h"
#include "network/multi_pxo.h"
#include "bmpman/bmpman.h"
#include "globalincs/alphacolors.h"
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "graphics/font.h"
#include "globalincs/alphacolors.h"
#include "network/multi_options.h"
#include "cmdline/cmdline.h"
#include "cfile/cfilesystem.h"
#include "network/multimsgs.h"
#include "io/timer.h"
#include "mod_table/mod_table.h"
#include "network/multi.h"
#include "network/multi_log.h"
#include "network/multi_options.h"
#include "network/multi_pxo.h"
#include "network/multimsgs.h"
#include "network/multiui.h"
#include "network/multiutil.h"
#include "network/stand_gui.h"
#include "osapi/osregistry.h"
#include "playerman/player.h"
#include "popup/popup.h"
#ifndef WIN32
#include <cstdio>
@@ -737,7 +737,7 @@ static void fs2netd_handle_messages()
case PCKT_SLIST_REPLY: {
int numServers = 0;
int svr_flags __attribute__((__unused__)); // gcc [-Wunused-but-set-variable] doesn't like MACROs
int svr_flags __UNUSED; // gcc [-Wunused-but-set-variable] doesn't like MACROs
ushort svr_port;
char svr_ip[16];
active_game ag;
@@ -1207,7 +1207,7 @@ void fs2netd_update_ban_list()
if (banlist_cfg != NULL) {
for (SCP_vector<SCP_string>::iterator bl = FS2NetD_ban_list.begin(); bl != FS2NetD_ban_list.end(); ++bl) {
cfputs( const_cast<char*>(bl->c_str()), banlist_cfg );
cfputs( bl->c_str(), banlist_cfg );
}
cfclose(banlist_cfg);
+1 -1
View File
@@ -14,8 +14,8 @@
#define __pxo_protocol_h_
#include "globalincs/pstypes.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#define PXO_PROTO_VER "2.0"
Loaded 100 of 541 files, more files were not shown because too many files have changed in this diff. Show more