Compare commits

..
1086 Commits
Author SHA1 Message Date
Lari Nieminen 2b53bde255 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into fotg 2015-05-04 02:32:51 +03:00
Lari Nieminen a4ac216d7a Ported all code from old zookeeper branch. 2015-05-04 02:10:01 +03: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
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
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
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 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
m_m 9ad5d09c0a From LotF and me: Fix for Mantis 3146: Crash when pressing enter key in empty region of main hall
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11296 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-31 18:58:28 +10:00
MageKing17 b61779e852 Fix mantis #3154.
Adds ON_CLBN_CHKCHANGE to the message map for the ships and weapons lists so that hitting spacebar to change the checked/unchecked status of a ship or weapon also updates the availability count.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11295 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-31 18:40:28 +10:00
m_m 2d82f7652d Fix "Callsigns still don't work when messages come from capships" issue
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11294 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-30 17:29:39 +10:00
The_E 9284264885 Patch to add MSVC2015 support. Also fixes a few warnings its compiler threw.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11292 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-29 11:05:02 +10:00
niffiwan 3e9c19c5c7 Fix mantis 3151
Implement case insensitive -mod dir search on *nix

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11291 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-28 11:12:25 +10:00
z64555 cd8595cf0f Fix for Mantis 3152: Moves the trail origin to the mathematical center of a laser bolt, if the weapon's render type is a laser.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11290 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-28 08:53:10 +10:00
The_E 1199555321 Adds a new debug output filter, "CFileDebug", which if enabled via debug_filter.cfg will print the absolute path to any file requested by the engine.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11289 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-22 13:04:55 +10:00
The_E 0808c3459f If a text file to be read by the engine is in Unicode, abort. Could be something important we're missing.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11288 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-22 13:04:55 +10:00
niffiwan b5fe481ab2 add script-eval-block sexp
This is a workaround to the sexp TOKEN_LENGTH limit
The script can be split across multiple arguments to allow scripts
longer than 32 chars (i.e. current TOKEN_LENGTH)
e.g.
( script-eval
  "ba.warning('foo"
  " more and more and more"
  " and the rest')"
)
Kudos to Axem for suggesting the idea
(And to zookeeper for reminding me to actually commit it!)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11286 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-21 11:41:49 +10:00
zookeeper 44b786c171 Fixed a mistake in $Model Point Shield Controls.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11285 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-19 16:40:17 +10:00
MageKing17 21cbf82196 Fix mantis 3147. From Admiral MS and myself.
From Admiral MS: Avoid bashing orientation if trying to avoid a collision.
From myself: Bash orientation if aspect seekers are equipped.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11284 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-18 18:21:21 +10:00
zookeeper ae32159408 Moved the fix in r11279 to a slightly more logical place.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11280 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-17 11:20:24 +10:00
zookeeper 56f694dc43 Check for and fix rare but possible discrepancy between sip->model_num and sip->subsystems[].model_num which can lead to model index collision errors.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11279 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-17 08:30:08 +10:00
zookeeper 95145a4f3f Slightly clarified variable use.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11276 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-07 09:39:26 +10:00
MageKing17 e0527d9bc7 Fix mantis #1929.
Makes the IDC_OLD_TEXTURE_LIST dropdown list use the same sorting as the old_texture_name[] array, and should also so that multiple old texture replacements for the same ship are properly erased.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11274 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-04 22:43:03 +10:00
MageKing17 4742378d50 Followup to r11266; let code use hardcoded defaults.
Presumably, the use of use_default_pos in load_gauge_radar_dradis() is the result of a copy&paste job, but removing it allows the default values to be used to compute coords.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11273 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-04 22:43:03 +10:00
zookeeper a2e15f4c61 Tweaks to the argument documentation of a bunch of scripting functions.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11272 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-03 16:22:51 +10:00
zookeeper 77b245eed2 Fixed shield handle not returning correct quads when indexing with the SHIELD_* enums.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11270 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-03 16:22:51 +10:00
niffiwan a1979e704e Coverity 1244962 Uninitialized scalar variable
Set default DRADIS coords to 0,0

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11266 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
niffiwan 23fbcb1a2f Add indentation for previous commit
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11265 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
niffiwan dc02e70716 Coverity 1093719 Negative array index read
Check current_bank is > -1 before using it
Note: did not alter indentation in this commit in order to make
relevant changes easier to see

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11264 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
niffiwan 170614f150 Coverity 1093718 Negative array index read
Create swip after checking that its index is > -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11263 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
niffiwan 5c8a6234a1 Coverity 1093705 Negative array index read
Probably not an issue, but to be safe removing the unused pointer anyway
i.e. the check that instance >= 0 suggests there's a possiblilty that the
pointer could contains a negative array index read

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11262 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
niffiwan aadc41a40a Coverity 1093495+1093498 Missing break in switch
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11261 387891d4-d844-0410-90c0-e4c51a9137d3
2015-03-01 11:02:15 +10:00
zookeeper 2203c1e9a8 Ported r11232 from zookeeper branch: Set the Sender hook variable to nil in On Message Received hooks if message not coming from a ship.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11257 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-21 11:34:30 +10:00
MageKing17 40a9025aeb Fixes hardpoint gauge not rendering outline.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11247 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-12 17:13:54 +10:00
MageKing17 14bd62147c Adding a "$Briefing Grid:" interface color to colors.tbl.
Requested by Axem.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11245 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-12 17:13:54 +10:00
m_m 70d735ceb4 Added "On HUD Message Received" scripting hook which is invoked when the HUD receives message text to display.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11242 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-09 17:22:03 +10:00
niffiwan 7d92b1cecf Fix mantis 3138: remove spurious warning
Don't warn about low rotational velocities disabling collisions for
no_collide ships

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11238 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-03 17:08:58 +10:00
zookeeper 8a50f844b0 Improved warnings text and clarified variable use in turret modelread code.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11236 387891d4-d844-0410-90c0-e4c51a9137d3
2015-02-02 17:21:53 +10:00
zookeeper 35d6a9654d Ported r11100 from zookeeper branch: Fix various issues with $Acceleration Time.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11234 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-27 18:27:41 +10:00
zookeeper c47233ca3c Ported r11085 from zookeeper branch: Fixed weapon particle spews not taking launch velocity properly into account if $Acceleration Time is used.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11233 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-27 18:27:40 +10:00
MageKing17 d01856d992 Fix a potential crash during ships.tbl parsing.
Makes parse_ship() use ship_info_lookup_sub() instead of ship_info_lookup() (shouldn't be jumping through those hoops during table parsing if they're for FS1 mission conversion), and more importantly, added an error check to ship_info_lookup() to avoid sprintf() exceeding the length of the char array.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11230 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-24 09:22:32 +10:00
chief1983 ec758aa108 Fix for Mantis 3036: This unifies the cf_exists function to behave like the other functions in the cf_exists* family, and simultaneously addresses the bug.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11222 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-23 18:35:55 +10:00
MageKing17 f5c1b6608d Reverting r4959 per discussion on #scp and the forums.
Adding every "#"-variant was causing spurious errors when switching from the MediaVPs to no mod. See http://www.hard-light.net/forums/index.php?topic=88982.0 for details.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11221 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-20 18:50:38 +10:00
chief1983 7df12ebd75 Experimental flag to apply lighting to briefing window model popups. Flag should be removed and behavior made default if no issues arise after next release.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11218 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-16 18:58:02 +10:00
zookeeper 4422aaa311 Fixed an issue with disabled binds getting matched in key translation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11215 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:44 +10:00
chief1983 9ebcc3e437 Added OpenBSD to what is now a multi-BSD check.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11214 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
Goober5000 4f53f07681 minor modifications to mission cutscenes: change cutscene_name field to filename, because it's actually the filename of the cutscene make struct a plain old data object (no constructor) make parsing a little tidier, and make the SEXP formula and closing #end tag optional
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11213 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
Goober5000 61df0f18b1 add warning if a cutscene is specified that isn't in cutscenes.tbl
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11212 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
Goober5000 87e8170268 add optional_string_one_of, which is useful to have
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11211 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
Goober5000 b9a6a9f23e instead of an Int3(), use a Warning that's only displayed once
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11210 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
MageKing17 6a77d128c9 Fixing weird problem with snd_update_3d_pos() that, honestly, baffles me as to how the code ever worked on any system.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11208 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
zookeeper 20218b0924 Added support for NONE as a value for $Key Default, for making a key unbound by default.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11206 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
zookeeper b1f1756dd1 Fixed breakage of $Category and $Type from r10843.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11205 387891d4-d844-0410-90c0-e4c51a9137d3
2015-01-14 17:29:43 +10:00
Goober5000 7250cd13a6 add ship class texture replacement using a simplified method that doesn't require the texture_set code
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11204 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-23 18:15:11 +10:00
MageKing17 b23aea5a41 Fix mantis #3068.
Make hitting the "delete" key in the pilot-selection menu do the same thing as clicking on the "remove" button.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11202 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-22 18:01:31 +10:00
niffiwan a49eb75c6e Add warning for very fast ship-rotation values
Otherwise rotational collision detection is disabled for the ship
(and an int3() triggers in debug)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11201 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-20 11:54:49 +10:00
MageKing17 c8b48e4a36 Change m_badge_earned into a vector.
This makes it so that getting enough kills to cross the threshold for more than one badge simultaneously grants all of them (with the debriefing showing only the last one) and backs out all of them if the scoring is backed out.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11198 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-16 19:57:49 +10:00
Goober5000 709f483617 PAUSE ALL THE STREAMS
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11197 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-12 16:12:16 +10:00
MageKing17 ffd74fa60b Adding "+Available From Start:" to Medals.tbl.
Requested by MjnMixael.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11196 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-12 16:12:16 +10:00
Goober5000 1c826d366e add the pauseMusic scripting function, requested by MjnMixael
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11195 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-11 18:15:36 +10:00
Goober5000 1c464864c3 fix Mantis #3132 (is-iff returns true when the target is destroyed)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11193 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-10 16:37:43 +10:00
MageKing17 a03f96ca01 Related to r11189: avoid calling factor_table::getNextSlots() if the ship doesn't have the dynamic linking flag.
Basically, hitting "o" on any ship with more than 6 slots in a bank could crash FSO, even without the flag. Reported by Spoon.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11192 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-10 16:37:43 +10:00
MageKing17 15fad7f58b Correct copy-paste error in check_sexp_syntax() from the armor types commit.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11191 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-09 14:09:29 +10:00
Goober5000 f01c4bf952 fix Mantis #3135: account for the case when the game is paused before being minimized
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11190 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-08 17:14:57 +10:00
MageKing17 1d7c01181e Fix mantis #3133. Fixes logic errors in factor_table not being sure if it's supposed to be 0-based or 1-based at different times.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11189 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-08 17:14:57 +10:00
Goober5000 0162cab8bd move this around for more logical flow
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11188 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-08 17:14:57 +10:00
Goober5000 b02af2ef6e a more future-proof way to keep track of explicitly paused audio
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11187 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-04 16:39:40 +10:00
Goober5000 4eb1726004 this should fix Mantis #2888 (allow for head.ani files without letter suffixes)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11186 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-04 16:39:40 +10:00
Goober5000 2f734daf0d when the game returns from a paused state, don't unpause the music paused by sexp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11185 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-03 20:31:32 +10:00
Goober5000 a516b88803 it's good to check whether the music is paused, for bulletproof-ness
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11184 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-03 20:31:31 +10:00
Goober5000 9f12e1f56b added a sexp to pause and unpause music that is currently playing
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11183 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-03 20:31:31 +10:00
Goober5000 255c2912cb minor reorganization
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11182 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-03 16:23:42 +10:00
Goober5000 ac25da1bd9 remove the Error (originally Assert) from r1675 and add back the comment removed in r8005
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11181 387891d4-d844-0410-90c0-e4c51a9137d3
2014-12-01 20:37:52 +10:00
Goober5000 872bbe2a11 improve sexp code for obtaining pitch/bank/heading with the following changes: 1) use an alternate algorithm for extracting angles from an orientation matrix 2) properly round floats to integers when converting to degrees
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11180 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-29 19:53:19 +10:00
Goober5000 f7353121e6 m!m's fix for Mantis #3131: contrary to the xt change from r11138, NULL is only returned on vm_malloc failure (so should never happen in normal execution)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11179 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-25 19:15:56 +10:00
MageKing17 f64afbecfb From The_E, niffiwan, m_m, and myself: Fix Mantis 2404.
Makes "$Weapon Model Draw Distance:" actually stop external weapon models from being drawn beyond that distance (modified by detail level).

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11178 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-22 08:47:11 +10:00
niffiwan c05845cb9d Fix mantis 3114
Change turret-tagged-only behaviour back to retail
Add AI profiles flag to allow use of newer behaviour (i.e. stricter)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11177 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-21 19:26:53 +10:00
niffiwan a73404dbd5 Error needs LOCATION :)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11176 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-21 19:26:53 +10:00
The_E fbd590cd77 Improvement for this error message
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11175 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-21 18:43:52 +10:00
MageKing17 e4072d6e51 Adding area-of-effect capability to Electronics weapons.
By adding an "+Area Of Effect" line after "+New Style:" or "+Old Style:", it causes every ship caught in the weapon's shockwave or blast to suffer electronics disruption. Requested by Black Wolf.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11173 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-21 18:43:52 +10:00
MageKing17 0417b4c335 Ensure that the debriefing code sets the font before wordwrapping.
Also, explicitly set the font instead of relying on Debrief_ui_window.draw() doing it implicitly.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11172 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-18 18:09:08 +10:00
MageKing17 b14b590ab1 Adding "interceptable", "turret interceptable", and "fighter interceptable" weapon flags.
These allow munitions to be attacked by the AI without needing to set the "bomb" flag; "turret interceptable" means it can be attacked by turrets, "fighter interceptable" means it can be shot down by fighters, and "interceptable" sets both flags simultaneously. Requested by Rheyah.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11171 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-10 17:45:58 +10:00
m_m de57f043da From MageKing17 and me: Fix for Mantis 3128: Docking related crash - dock_list isn't initialized This patch makes the copy constructor and the assignment operator of the object class private as it contains members that should not be copied.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11170 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-08 10:57:03 +10:00
niffiwan 487f764764 Redo Coverity 1215458 Uninitialized pointer field
Includes more robust checks of cmdline_parm data

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11169 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-02 19:52:04 +10:00
m_m 86510572bf With help from MageKing17: Fix for Mantis 3123: Virtual variables and indexers that return nil break the scripting system
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11168 387891d4-d844-0410-90c0-e4c51a9137d3
2014-11-02 11:22:29 +10:00
MageKing17 e604125e5d Minor followup to r11150.
The regular parsing code not using the same broken logic as parse_comments() is not the same thing as it "ignoring" too high versions, and searching for repetitions of the same token would result in just finding the first one over and over again (the likelihood of this actually mattering to anyone is minuscule, but I needed something to test commit access, and this code has been tested).

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11167 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-30 13:23:58 +10:00
Swifty 33776fc4be gr_opengl_string retooled to use glDrawArrays. Should be a bit faster now.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11165 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-29 18:47:04 +10:00
zookeeper c13c35ec25 Fixed a FRED crash when using $Flight controls follow eyepoint orientation (patch by MageKing17).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11163 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-29 18:47:04 +10:00
zookeeper 83d6456c6a Clarified how to set a new variable with mn.SEXPVariables.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11161 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-28 22:04:56 +10:00
zookeeper 1d55b98017 Added a little extra info to two bmpman errors.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11160 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-28 22:04:56 +10:00
m_m bd602cc1a3 Revert 11158 as it breaks FRED compilation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11159 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-27 18:23:02 +10:00
m_m 89cd36a242 Fix a crash reported by Axem related to freeing the dock list of an object. This was caused by freeing the dock list from the destructor of an object which meant that copies of an object would corrupt the original object instance. To make sure that doesn't happen again the copy constructor and assignment operator of object have been made private.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11158 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-27 18:23:02 +10:00
Goober5000 414daaaed8 Mantis #3127: fix the spatial check in the rewritten algorithm
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11157 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-27 18:23:02 +10:00
The_E 4295cd3edb Corrects an unwanted change in formatting
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11155 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-27 18:22:42 +10:00
The_E 6c48551fb3 From MageKing17: Make the lua doManeuver command behave the same way as the sexp.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11154 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-27 18:22:42 +10:00
niffiwan 866667a977 Fix mantis 3126 (from MageKing17)
Remove limit of 32 tbms being loaded for any given table type
2014-10-24 19:35:47 +10:00
niffiwan d1aa2e1c37 Set 1024x768 32bit as default res on *nix
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11153 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-24 19:06:22 +10:00
niffiwan 07e1679138 Partial revert of r11145
A fake subsystem used as the firing point for fighter beams. It's
re-used for every fire point so the turret is supposed to only have 1
firepoint. i.e. energy consumption was already correctly calculated

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11152 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-24 19:06:21 +10:00
niffiwan 16f0ff1959 Allow fonts to set/change special char indexes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11151 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-24 19:06:21 +10:00
Goober5000 6cc96ce0c5 MageKing17 has done yeoman's work in fixing the version-specific commenting system. Thanks, MageKing17!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11150 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:40 +10:00
Goober5000 9161158996 xt branch: load stuff from the correct location
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11149 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:35 +10:00
Goober5000 557ef07079 xt branch: memset a bunch of weapons strings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11148 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:33 +10:00
Goober5000 130165af9f xt branch: WIF_MFLASH is unnecessary because we can check whether there is a muzzle flash index
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11147 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:32 +10:00
Goober5000 6e56b2970f xt branch: minor tweaks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11146 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:31 +10:00
Goober5000 5a31e0b38e xt branch: 1) the number of beam firing points should be the same as the number of ship firing points, because that's how we're calculating the expenditure of weapon energy 2) clear out Ship_type information when we exit the game
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11145 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:29 +10:00
Goober5000 3234a8360c refine the calculation of effective_primary_banks... 1) optimization from xt branch: don't calculate if we only actually have one bank on our ship 2) make sure to count the current bank that we're firing, to avoid an edge case where we might have a negative fire penalty 3) make the condition logic a little clearer
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11144 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:26 +10:00
Goober5000 14dfb5e73d xt branch: minor ship.cpp fixes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11143 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:21 +10:00
Goober5000 d734f76369 xt branch: "Nothing major here, just added the same basic stuff from the nebula code to make beam glows fade out depending on how close to the eye they are. The primary reason for this was for beams on fighters, since the muzzle glows tend to block your view when they show up. Having them fade out still gives you the visual effect, but allows you to see through them as well."
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11142 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:16 +10:00
Goober5000 871bb0b19a xt branch: minor optimizations in beam.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11141 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-17 18:25:14 +10:00
Goober5000 4f06fd2435 additional string safety
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11140 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-15 18:22:57 +10:00
Goober5000 e9f5c531e0 heh... Microsoft's implementation of snprintf doesn't conform to the standard!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11139 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-15 06:23:18 +10:00
Goober5000 dff2156c18 xt branch: more string safety
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11138 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:41 +10:00
Goober5000 f23a3c5843 SCP_string is useful here too
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11137 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:40 +10:00
Goober5000 ff38449a46 string printing safety
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11136 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:39 +10:00
Goober5000 1318ccfa91 wut? defaulting to NULL here will cause these to never log anything...
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11135 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:38 +10:00
Goober5000 65265f8ab8 fix a compile error (d'oh) and use type safety
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11134 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:37 +10:00
Goober5000 a541a22239 xt branch: optimize objectsort.cpp by not calculating some things every loop iteration
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11133 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:35 +10:00
Goober5000 aee1305841 according to the C standard... "The functions snprintf() and vsnprintf() write at most size bytes (including the trailing null byte ('\0')) to str." ...so we have that going for us, which is nice
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11132 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:33 +10:00
Goober5000 e43dacdcc3 xt branch: use CLAMP here
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11131 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:32 +10:00
Goober5000 8e4d98bd4f xt branch: minor tweaks to glow_points
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11130 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 18:23:31 +10:00
Goober5000 f6e2f1d236 xt branch: optimizations in modelcollide.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11129 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:25 +10:00
Goober5000 e22a4b0b5b xt branch: add capability for custom identifiers in build names (e.g. Xt-0314)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11128 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:24 +10:00
Goober5000 11855ed3d8 xt branch: having a float version of gr_opengl_string makes text scrolling nice and smooth at high nonstandard resolutions (also, looks like quad rendering works just fine here; no need to convert to tris)
convert credits.cpp to use float version of gr_opengl_string; eventually Taylor wanted to make the float version standard

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11127 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:23 +10:00
Goober5000 fe775aeedf xt branch: optimizations in fvi.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11126 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:22 +10:00
Goober5000 5c0bc126bb xt branch: tweaks to vecmat.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11125 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:20 +10:00
Goober5000 c6364987b3 we don't need to cast because mod is a float
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11124 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-13 12:24:17 +10:00
Goober5000 b8a05e30a0 xt: sprintf length safety
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11123 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 18:22:14 +10:00
Goober5000 5f3600dc79 probably good to change the comment too
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11122 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 18:22:13 +10:00
Goober5000 f2d8277452 xt branch: additional optimizations using RAND_MAX_1f
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11121 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 18:22:12 +10:00
Goober5000 31562ba811 xt branch tweaks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11120 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 18:22:10 +10:00
Goober5000 4200bb55d7 from xt branch: remove unneeded parameters, tweak some assets, minor optimization
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11119 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 12:21:51 +10:00
Goober5000 bffdef1ce5 from xt branch: add some hysteresis to asteroid fields to prevent "popping" when an asteroid exceeds the bounds
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11118 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 06:22:25 +10:00
Goober5000 4dafc8ff5f this too
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11117 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 06:22:24 +10:00
Goober5000 d5e81757b0 some turret changes from the XT branch
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11116 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-12 06:22:22 +10:00
Goober5000 61c97871f0 technically, this is better
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11115 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-09 18:21:40 +10:00
Goober5000 50f16b7d02 better method of appending ellipsis (nb: strncpy pads with 0 if string is shorter than len)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11114 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-09 18:21:37 +10:00
Goober5000 8688b05c91 related to Mantis #3121, make SEXP parsing more robust, and remove some old debug/unused code in get_sexp_main()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11113 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-09 18:21:35 +10:00
chief1983 9a90a43801 Wrong variable type, may work in MSVC but not on clang or gcc.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11112 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-09 06:21:40 +10:00
Goober5000 15c6f18c74 remove unused debug function
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11111 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-08 18:22:27 +10:00
Goober5000 5552fbcbd9 related to Mantis #3121, add parentheses if the string passed to runSEXP doesn't have them
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11110 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-08 18:22:24 +10:00
Goober5000 a3b7eec214 make flag checking more efficient and prevent an Int3() on bad data
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11109 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-07 18:22:11 +10:00
Goober5000 2d14ca7539 Parias's patch for Mantis #3102 (make show-subtitle-text positioning consistent on MP clients)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11108 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-07 18:22:10 +10:00
Goober5000 88abaf6de4 I forget who requested this, but this change now causes FRED to allow numeric sexps to be used for OPF_WEAPON_BANK_NUMBER
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11107 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-07 18:22:08 +10:00
Goober5000 3b90b65547 allow sexps which reference sounds to use either the table index or the entry name as the reference (based on a patch by m!m, see http://www.hard-light.net/forums/index.php?topic=86293.0)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11106 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-07 18:22:07 +10:00
zookeeper 4e0beccfc9 Reverted r10944 and r10945 for now, with the exception of the GL_TRIANGLE_STRIP->GL_QUADS fix.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11105 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-07 12:21:56 +10:00
Goober5000 cc76884514 well ok, revert that
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11104 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-06 18:20:08 +10:00
Goober5000 c3bcfc6303 don't enable nav system always... that's not how this is supposed to work
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11103 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-06 18:20:06 +10:00
m_m 478bb022c7 Fixed a bug reported by Axem: The scripting API used the wrong functions to determine if a hud gauge is a custom hud gauge.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11102 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-06 12:20:50 +10:00
Goober5000 4037d3be68 tweaks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11101 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-05 18:20:10 +10:00
Goober5000 85872114ee related to Mantis #2971: properly reset shield info when we have a null objp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11099 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:44 +10:00
Goober5000 93c7775109 stupid missing parenthesis >.>
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11098 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:44 +10:00
Goober5000 e15cd38a88 Between the Ashes HPC request: extend ai-chase-same-team to ai-disarm, ai-disable, and ai-destroy-subsys too
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11097 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:44 +10:00
Goober5000 416af26244 and on the subject of Mantis #3110: fix the multi_sexp_deal_with_ship_flag issue that MageKing17 noticed, and tweak a sexp to be more clear
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11096 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:44 +10:00
Goober5000 cd2996f01d MageKing17's patch for Mantis #3110: Message Brackets not displayed with 'Invisible to Friendlies' flag
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11095 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:43 +10:00
Goober5000 f7e3bef9b7 Between the Ashes HPC request: allow ships to attack others on the same team
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11094 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:43 +10:00
Goober5000 31716a9348 use the OBJ_INDEX macro, because that's why we have it
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11093 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:43 +10:00
z64555 ec60984483 From MageKing17, Makes the $CD: token for cutscenes.tbl optional. Useful, since a majority of assets no longer require physical CD's.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11092 387891d4-d844-0410-90c0-e4c51a9137d3
2014-10-04 13:45:43 +10:00
chief1983 5e94b75354 Fix Mantis 3109: Revert r11079 and reopen #2888 since I didn't realize that Fred messages also often use built-in suffix appending. Need to either use FUBAR's original solution or re-engineer something else.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11090 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-29 06:19:41 +10:00
niffiwan 484b518760 Fix mantis 2804: beams can use damage factors
Add game_setting.tbl option that allows beams to use weapons table
Armor/Shield/Subsystem damage factors

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11089 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-27 18:20:18 +10:00
niffiwan df3435cadd Fix mantis 3108 (from Yarn)
Make parsing of DRADIS and custom hud gauges consistent with the rest
of the hud gauges

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11087 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-27 00:19:25 +10:00
Goober5000 7917b9885d fix Mantis #2987 (AddressSanitizer: global-buffer-overflow in message_queue_process())
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11084 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-25 16:40:34 +10:00
Goober5000 e0aaa83513 CommanderDJ's patch for Mantis #2899 (AddressSanitizer: heap-buffer-overflow in snd_play() sound.cpp)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11083 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-25 16:40:34 +10:00
Goober5000 435b078157 Yarn's patch for Mantis #3107 (Parts of the interface code assume a font size of 10)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11082 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-25 16:40:34 +10:00
Goober5000 a3e83aacfe CommanderDJ's patch for Mantis #3050 (Custom mainhall text is limited to 10 chars in the campaign editor)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11081 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-24 20:08:21 +10:00
Goober5000 62a2fb3c00 Yarn's patch for Mantis #3106 (Font parameter in hud_gauges.tbl not parsed correctly)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11080 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-24 20:08:21 +10:00
chief1983 946d7a45af Fix for Mantis 2888 - add Suffix support to disable suffixes for messages on a per message basis in messages.tbl. See the wiki.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11079 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-24 20:08:21 +10:00
niffiwan ab3ebebc9c Parts of mantis 3103 (From MageKing17)
Points 3-5 from the mantis ticket
i.e. use OPF_SSM_CLASS in appropriate places

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11078 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-22 20:17:36 +10:00
m_m 5b79ed3ea5 Fix for Mantis 3093: mn.getMissionFilenname() doesn't return a value if in GS_STATE_BRIEFING
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11077 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-22 19:59:03 +10:00
m_m dd4c91f8b6 From Parias: Fix for Mantis 3094: Request for new scripting function: ts.playCutscene()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11076 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-18 19:11:16 +10:00
niffiwan fc9f570374 Update .gitignore for new autoconf & libtool
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11075 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-13 14:03:50 +10:00
niffiwan fb2ce33802 Fix mantis 3105 (from MageKing17)
Use a pointer for reading radar IFF info, not an object copy

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11074 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-13 13:52:21 +10:00
niffiwan d9a4320dbb Add missing \n to mod_table mprintf
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11073 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-13 13:52:21 +10:00
niffiwan cd7b271b3b Tweak autotools
Use libtool, remove warnings about subdirs, DIE if autogen.sh pre-reqs
aren't met

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11072 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 1ac06f8b1c substitue main hall for displaying MjnMixael's main halls in fsport
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11046 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 7cd97633b6 Yarn's patch for Polish localization
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11044 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 603e96865f VC6 compatibility
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11043 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 5e2046c44b use class declarations since these contain SCP_string
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11042 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 d2a6beaacc that variable isn't actually a buffer, so change the misleading name
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11041 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 cd76a257c1 subtitles can now be as long as messages
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11040 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 6052d9c4a4 since we can replace variables in SCP_string, use that instead of an arbitrary char[256] buffer also const-correctness in the constructor
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11039 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 c866ff0061 Karajorma missed an Opps :p
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11038 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 dd353a74d8 add an Assertion about a buffer overflow vulnerability in split_str
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11037 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
karajorma b05303fa63 Opps. Only need that defined once!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11036 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
karajorma 23d5913e9d The previously committed version of multi-eval did not include the code to allow it to determine if client side scripts should also be executed on the server. This version does but will break any previously created missions.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11035 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
karajorma 04fe7fb64a Fix Mantis 3077 (Subtitles including a message will crash multiplayer games).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11034 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
niffiwan 3052565490 Revert "Silence GCC warning variable ‘max_size’ set but not used"
Based on chief1983's comment that this code is still used, I'll take
the safer route of just telling gcc to shaddupaboudit

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11029 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 b63fd9a86a Mantis #3101: check for presence of support dockpoints in all builds, not just release
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11028 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
Goober5000 a7d6891520 MageKing17's patch: add door keys and quick start region, and fix single player / multiplayer description toggling also fix two warnings regarding int and boolean conversions
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11027 387891d4-d844-0410-90c0-e4c51a9137d3
2014-09-09 20:37:02 +10:00
niffiwan 9b37d1e0f4 Fix gcc warnings in hudconfig.cpp
declaration of ‘color’ shadows a global declaration [-Wshadow] (x2)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11021 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 15:42:09 +10:00
niffiwan 0bebe6f98a Partial fix for mantis 2932 (cutscenes)
Convert campaign viewed cutscenes

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11020 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 15:42:09 +10:00
niffiwan 743a27b82f Partial fix for mantis 2932 (RA wep idx)
Ensure pilot conversion RA weapon indexes are always valid

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11019 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 15:42:09 +10:00
niffiwan 57faea2bef Fix mantis 3099 (from Yarn)
Make HCF parsing more flexible

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11018 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 15:42:09 +10:00
niffiwan 1a3336e9bd Silence GCC warning variable ‘max_size’ set but not used
Code seems redundant as dscap_get_raw_data checks for a max size
anyway. And AFAIK the entire voice capture code is non-functional anyway

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11017 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:06 +10:00
niffiwan b88edd53bc Followup fix for mantis 2883 (from Yarn)
Set Lcl_special_chars when changing fonts
Change some copyright chars to use Lcl_special_chars

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11016 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:06 +10:00
Echelon9 cba4cc9943 Fix cppcheck (performance) Prefer prefix ++/-- operators for non-primitive types.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11015 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:06 +10:00
Echelon9 aa4b76d990 Fix cppcheck (style) Consecutive return, break, continue, goto or throw statements are unnecessary.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11014 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
Echelon9 44dc398b19 Fix cppcheck (style) Same expression on both sides of ||.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11013 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
Echelon9 85427ec76a Fix cppcheck (warning) Logical conjunction always evaluates to false: logfile_type < 0 && logfile_type >= 2.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11012 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
niffiwan 75e8f8642c Fix mantis 3020 (pilot stats issue)
Reset pilot stats when we're creating a new CSG file. Otherwise stats
from the current pilot or campaign will be inherited by the new pilot /
campaign

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11011 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
niffiwan e6b8a433f1 Fix mantis 3097 (valgrind)
Don't read past the start of the string

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11009 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
niffiwan c603d42b61 Followup fix for mantis 3049 (from Yarn)
Revert an Error back to a Warning
Prevent an out-of-bounds read of the Lcl_ext_str array

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11008 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-23 13:05:05 +10:00
niffiwan 179c2ceb82 Fix mantis 3065 (clear RA data)
Clear red alert data when resetting campaign progress, changing
campaigns and switching pilots
In CSG read, move RA data clear from the read RA section to the data
reset function (i.e. clear if CSG is valid, not if section contains
data)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11007 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:12 +10:00
Echelon9 21cee81a2a Fix Coverity 1093622 Array compared against 0 in process_new_player_packet()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11006 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:12 +10:00
Echelon9 0f77e0aa34 Fix Coverity 1093621 Array compared against 0 in send_accept_packet()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11005 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:12 +10:00
Echelon9 f3a1589d42 Fix Coverity 1093619 Array compared against 0 in delete_player()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11004 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:12 +10:00
Echelon9 01df45e37e Fix Coverity 1093613 Negative array index read in stuff_loadout_list()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11003 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:11 +10:00
Echelon9 1484f93590 Fix Coverity 1093599 Negative array index read in hud_query_order_issued()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11002 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:11 +10:00
niffiwan b29868aea7 Followup fix for mantis 3016 (FRED Briefing window FOV)
Make FRED icons & labels respect the Briefing_window_FOV

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@11001 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-17 18:50:11 +10:00
niffiwan 2427c9cfe3 Fix mantis 3092 (from Yarn)
Fix certain key string parsing in German & French

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10995 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-16 12:31:57 +10:00
niffiwan bfa3397dbd Fix mantis 2985 (from Yarn)
Fix float-to-int rounding errors in gr_[re|un]size_screen_pos

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10990 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-16 12:31:57 +10:00
niffiwan 3d8554b41f Followup fix to mantis 2887 (from MageKing17)
no-collide ship classes would collide unless the no-collide flag was set
in the mission file

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10989 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-16 12:31:57 +10:00
niffiwan 3c81c02829 oops - recommit r10986
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10988 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-16 12:31:56 +10:00
niffiwan 167739ed95 Fix gcc warning
declaration of ‘brief_line’ shadows a global declaration [-Wshadow]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10987 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan 5bcbad1e3a Fix mantis 3091 (from Yarn)
Treat non-ASCII chars above unsigned index 127 as word separators when
ending retail style colorisation

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10986 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
Zacam 060bc97360 From Axem: adds isInCampaign() lua function to tell when a mission is being played in a campaign (as opposed to via Techroom)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10985 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan a2fd4aa519 Fix mantis 3088 (from Yarn)
Fix two German keys not displaying in controls config

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10984 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan 4b7a69f34e Fix mantis 3089 (From MageKing17)
Move 3D ship select model drawing earlier so that the help overlay is
drawn over the top, not underneath

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10983 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan ce8ed29326 From Coverity ID 1230636 Improper use of negative value
false positive; but add comment explaining why

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10982 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan 43f3b6ade9 Fix Coverity ID 1230635 Unchecked return value
Check return code from lua EvalString on mainhall doors

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10981 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
Echelon9 0ed6dee427 Fix Mantis 3090: Valgrind: Conditional jump or move depends on uninitialised value(s) in webserverApiRequest()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10980 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
niffiwan 335b05c82a Fix input lag with some ATI cards on Linux
From electrojustin; adds cmdline option to force a gl_finish call
prior to swapping buffers.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10979 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:05 +10:00
m_m f8ff3be1fe From MageKing17: Fix for Mantis 3085: Unhelpful error reporting in hud_gauges.tbl if an invalid gauge type is specified.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10978 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:04 +10:00
niffiwan 7defc6aeeb Fix mantis 3086 (from Yarn)
Add special case to avoid crash from mismatched quotes in
tstrings.tbl German text

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10977 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:04 +10:00
niffiwan b725ec527a Fix mantis 3087 (from Yarn)
Readd translation support for default escort gauge header text

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10976 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:04 +10:00
Goober5000 5cbb9d991b Additional tweak for Mantis #2887 and follow-up to r10181: when modifying OF_COLLIDE, need to call obj_set_flags for collision code support
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10974 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:04 +10:00
m_m 27e824c215 Revert accidentally committed project file changes.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10973 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-11 18:54:04 +10:00
niffiwan 8e7a936c08 Fix line-endings in fred2/fred.rc
(somehow these got messed up in the git repo)
2014-08-06 19:41:46 +10:00
Goober5000 439b2c8cad add additional lookup for GTSC Faustus for next version of FSPort
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10972 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-06 19:39:35 +10:00
m_m 3db76adf40 From karajorma: Adds the multi-eval SEXP WARNING: This SEXP is subject to change and will likely be removed or changed in a future version, use with caution. Also fixes Mantis 3079: Add multi-eval to list of available SEXPs (.patch included)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10971 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-06 19:39:35 +10:00
m_m 8e4235a86e From ngld and Parias: Fix for Mantis 3084: Bitmaps loaded with gr.loadTexture() are never released.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10970 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-06 19:39:35 +10:00
m_m 9689711149 From FUBAR-BDHR, chief1983, m!m and MageKing17: Fix for Mantis 2887: Additional workaround for mantis 2693
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10969 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-06 19:39:34 +10:00
Zacam b562ebe1f5 From Axem: adds getFrametimeOverall() lua function for timing purposes outside of gameplay
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10967 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:23 +10:00
Zacam c03fad72cd Since we updated libpng, might as well update zlib as well. Now v1.2.8.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10966 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:23 +10:00
niffiwan 1a813db618 Fix mantis 3078 (From Yarn)
Don't set / reset unscaled screen area when rendering to texture
Also fix a pre-10844 bug where scaling down a cockpit gauge would
cause the gauge to be improperly clipped if it was close enough to the
right or bottom edge of the texture.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10965 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:23 +10:00
niffiwan b39b23c3f6 "Fix" gcc warnings in Control_config[]
warning: missing initializer for member 'config_item::BLAH'
[-Wmissing-field-initializers]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10964 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:23 +10:00
Zacam e6f92ddcd9 Fix Mantis 3075 : Upgrades libpng from 1.5.7 to 1.6.12
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10963 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:23 +10:00
The_E 04f2c365f8 Fix for Mantis 3080 from MjnMixael: Fix for inadvertently changed parsing order for mainhall tables.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10962 387891d4-d844-0410-90c0-e4c51a9137d3
2014-08-05 18:47:22 +10:00
niffiwan 1291e0ad82 Fix mantis 3073: Additional Mainhall capabilities (from ngld)
Adds two new mainhall.tbl options:
1) "+Misc anim over doors:" (misc anim rendered after doors)
2) "+Cheat String:" (exchanges misc anim when cheat is entered)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10961 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-30 20:41:21 +10:00
zookeeper 774ec066a4 Fix a render target bug by disabling environment mapping when doing full-scene RTT.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10959 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-30 20:41:21 +10:00
niffiwan 9f768b8cff Doh! Assign, not equality!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10958 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-30 20:41:21 +10:00
niffiwan f730df6c1a Fix Coverity ID 1093805 Uninitialized scalar variable
1st use of fbfire_info.bfi_flags so assign instead of |=

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10957 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-30 20:41:21 +10:00
niffiwan 5daa8d87d2 Fix Coverity 1093822 Uninitialized scalar variable
Set sensible looking defaults for the elems added to the beam_collision
struct since retail

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10956 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-30 20:41:20 +10:00
niffiwan 9314dc89da Fix gcc warnings in hud/hudtarget.cpp
declaration of ‘gauge_object’ shadows a member of 'this'
declaration of ‘esct’ shadows a global declaration [-Wshadow]
variable ‘srange’ set but not used [-Wunused-but-set-variable]
variable ‘ship_is_ballistic’ set but not used

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10955 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 20:39:18 +10:00
niffiwan 3cccc7cb13 Fix gcc warnings in hud/hud.cpp
declaration of ‘render’ shadows a member of 'this'
declaration of ‘font’ shadows a global declaration [-Wshadow]
variable ‘flags’ set but not used [-Wunused-but-set-variable]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10954 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 20:39:18 +10:00
niffiwan 71faaf3137 From MageKing17: tweak team colors
While we're looking at the Team Color code, let's have a warning if
someone tries to name a team 'none', and avoid pushing duplicate teams
to the Team_Names vector.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10953 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 20:39:18 +10:00
niffiwan 1a0ef281ed Fix gcc warning in io/keycontrol.cpp
suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses]
This code previously worked only by fluke!

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10952 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 20:39:17 +10:00
z64555 021a0bd3a7 From MageKing17: Followup to r10914. Makes the name check ignore case.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10951 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
niffiwan e2eddea231 Fix gcc warnings in globalincs/alphacolors.cpp
warning: declaration of ‘i’ shadows a previous local [-Wshadow]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10950 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
niffiwan 2b191eef2d Fix Coverity 1228854 Copy-paste error
Check pof_file_hud for "$POF target file:" not pof_file ("$POF file:")

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10949 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
niffiwan e93c1e94b6 Fix Coverity ID 1228858 Missing varargs init or cleanup
In required_string_one_of(int arg_count, ...)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10948 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
zookeeper 751861c397 Fixed bits missing from r10946.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10947 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
zookeeper ae1c4435cf Turned the required SEXP variable arguments for add-background-bitmap and add-sun-bitmap into optional arguments.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10946 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
zookeeper a23438f590 Fixed inverted normals in RTT if post-processing is on.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10945 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
zookeeper 6b404f1daa Fixed RTT bugs: 1) inverted geometry, 2) the output being mirrored both ways and a quarter of the output missing if post-processing is off.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10944 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
niffiwan 2838afdd60 Fix several gcc warnings in code/graphics/gropengldraw.cpp
variable ‘clipped’ set but not used [-Wunused-but-set-variable]
variable ‘swapped’ set but not used [-Wunused-but-set-variable]
the address of ‘Distortion_texture’ will always evaluate as ‘true’
[-Waddress]
declaration of ‘vertex’ shadows a global declaration [-Wshadow]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10943 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
Goober5000 0bd67304c4 a tweaked version of ngld's patch for additional main hall capabilities (see Mantis #3071)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10941 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:04 +10:00
Goober5000 6249638c5a use static casts to make our intentions clear and prevent compiler warnings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10940 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:03 +10:00
Goober5000 5eeb6dd219 some const-correctness in preparation for the Mantis #3071 patch
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10939 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:03 +10:00
Goober5000 d04ae65f8b for Mantis #2064: remove ship template feature which never worked without crashing
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10938 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:03 +10:00
Goober5000 a30269bd3c for Mantis #2651: revert r10933, per forum discussion: http://www.hard-light.net/forums/index.php?topic=88047.0
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10937 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:03 +10:00
niffiwan 60bad89060 Fix gcc warning: ordered comparison of pointer with integer zero
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10935 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-27 13:03:03 +10:00
niffiwan ca31f9a402 Fix mantis 2651: from ZekeSulastin
Add support for up to 98 joystick buttons

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10933 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:29 +10:00
Goober5000 469e566b20 another localization patch by Yarn: disable character remapping when the game is running in Polish
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10932 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:29 +10:00
Goober5000 e13e37245e MageKing17's tweaks, with a couple of my own
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10931 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:29 +10:00
Goober5000 038ccffdaa Mantis #2999 - add docking log entries for support ships
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10930 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
niffiwan b19622cf96 Fix gcc warning in hud/hud.cpp
the address of ‘Hud_text_flash’ will always evaluate as ‘true’ [-Waddress]

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10929 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
The_E 96e8e77f4e Fix for Mantis 3064 from MageKing17: Followup fix.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10928 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
The_E b178fd0cbc Fix for Mantis 3076 from MageKing17: Fixes behaviour of animated textures on skyboxes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10927 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
The_E d3ef69848c Fix for Mantis 3064 from MageKing17: Adds more functionality to colors.tbl. * "#Start Colors" is now optional; no more need for a blank section at the start of a colors.tbl just to define some team colors. * "#Interface Colors" section added for redefining various colors used by the interface. * "#Color Tags" section added for redefining or adding your own text color tags. * "#Default Text Color" section for choosing what color tag is the baseline default for various different screens. * And the big one, support for *-clr.tbm modular table files.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10926 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
The_E a5a1a0ff3b Patch for Mantis 3069 by MageKing17: Fixes help.tbl error reporting
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10925 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:28 +10:00
Goober5000 6f80088695 for Mantis #2153: MageKing17's FRED support for error messages when wingmen have illegal weapons
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10924 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
Goober5000 905f0999c2 Yarn's patch which allows FreeSpace fonts to support all characters that exist in both Code Page 437 and Windows-1252
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10923 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
The_E 3eaf02c022 Fixes an unintended linebreak removal in previous commit
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10922 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
The_E 5bff2754c2 From MageKing17: Fixes for a couple of clang warnings.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10921 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
The_E 5e6746af43 From MageKing17: Improves sexp help text to clear up possible confusion about indexes that are zero-based.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10920 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
niffiwan d2cbf65e1e Fix mantis3054 (from ngld)
In weapon select screen check weapon model index is != -1 before drawing it

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10918 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-24 19:45:27 +10:00
m_m fca002ada8 From Axem: Add ba.getGameDifficulty() scripting function to get the current difficulty level.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10916 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:32 +10:00
The_E d3089bb406 Fix for Mantis 2882 by Mageking17 (change-team-color with None color results in error)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10914 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:32 +10:00
The_E b96b0e87d8 Removes nonfunctional debug code left over from the :V: days
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10911 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:32 +10:00
The_E 3d3fa6a749 Moving an assignment out of an if statement for better readability
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10910 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:32 +10:00
The_E 514a8c3557 PVS Studio fix: Make the logic responsible for sending the builtin rearm messages behave as intended.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10909 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:32 +10:00
Goober5000 fe4b949c06 fix Mantis #3072 (crashes when using different languages)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10908 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
chief1983 ae351d2924 Fix Mantis 2886 - Option to render External weapon models, besides Tech models, in Weapon lab, from FUBAR.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10907 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
chief1983 4854087a18 Fix Mantis 2885 - SEXP flag to enable/disable primitive sensors, from FUBAR.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10906 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 831e0f3be7 Address clang warning: parameter 'x,' not found in the function declaration [-Wdocumentation]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10904 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 307923e8dd Address clang warning: unknown command tag name 'brieft'; did you mean 'brief'? [-Wdocumentation]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10903 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 eacf4d4e6e Address clang warning: parameter [x] not found in the function declaration [-Wdocumentation]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10902 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 2859e74ac9 Address clang warning: extra ';' after member function definition [-Wextra-semi]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10901 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Goober5000 98a6166956 follow-up to r7163: this makes the text display properly in-game, no Unicode support needed (thanks to Yarn for the patch)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10900 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 07cad23aed Address clang warning: commas at the end of enumerator lists are a C++11 extension
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10899 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 255fef6e47 Address clang warning: unused variable
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10898 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Echelon9 fc1b587cb6 Address clang warning: declaration shadows a field of 'HudGaugeRadarDradis' [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10897 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Goober5000 8cdfb029d3 add mod_table option for red-alert for delayed ships (Mantis #3055)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10895 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
Goober5000 2fe0ec8ef0 Yarn's patch for Mantis #3049 (character remapping in tstrings.tbl)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10894 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:31 +10:00
The_E 75f533a6fe Fix for Mantis 2960: Actually make sure that we're not performing invalid operations on a vector.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10887 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
The_E d6e0a731db From MageKing17: Patch for Mantis 3074: Correct mismatch between mission write and mission parse
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10886 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
Echelon9 327c67ff1d Address clang warnings - hud/hud.cpp:1310:3: warning: delete called on 'HudGauge' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10885 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
Echelon9 80e1ecee69 Address clang warning - hud/hudtarget.cpp:7224:12: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10884 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
Echelon9 02aa18c260 Address clang warning - io/keycontrol.cpp:2504:7: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10883 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
The_E 53e78033c6 Fix unintended linebreak removal from 10880
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10882 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
Echelon9 bc568a9149 Address clang warning - lab/lab.cpp:912:8: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10881 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
The_E 0d9cc00ba8 From MageKing17: Removes redundant function call
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10880 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:30 +10:00
Echelon9 46288483c9 Address clang warning - menuui/mainhallmenu.cpp:2141:9: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10879 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
The_E 580330c224 From MageKing17: Patch for a small issue in briefing text color spans
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10878 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 3f645215ad Address clang warning - object/collideshipweapon.cpp:258:17: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10877 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 d3f914a404 Address clang warning - ./ui/ui.h:291:7: warning: private field 'ignore_escape' is not used [-Wunused-private-field]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10876 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 7f9d879d7b Address clang warning - ./ship/shipfx.h:202:6: warning: private field 'stage' is not used [-Wunused-private-field]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10875 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 54de592835 Address clang warning - debugconsole/console.cpp:169:13: warning: declaration shadows a local variable [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10874 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 03c32c1648 Further tweak fix for Coverity 1093783 Uninitialized scalar variable, and remove redundant variable in opengl_light structure
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10873 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
Echelon9 713e291bdc Partially re-add the secure coding aspects of 10806 (which was rolled back in 10857). Fundamentally, the code in theora_open is written in a non-secure manner prior to this fix. That the callers currently appear per Goober to use it correctly is not the issue. There is no way of enforcing that contract as to length of the string unless it is internally handled in the function. Also Goober's comment that all callers use string lengths of MAX_FILENAME_LEN is incorrect. Examples trivially found that use the separate define NAME_LENGTH, which could be changed in future.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10872 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-14 19:02:29 +10:00
chief1983 137eb7e4d4 Fix Mantis #2790, Easy options should be just that again.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10869 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
chief1983 f89d864756 Fix Mantis #3070, courtesy of Yarn.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10868 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Echelon9 7a56e7ff4a Fix Clang warnings about incorrect type given different pointer sizes for the architecture. Use the standard compliant ptrdiff_t
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10867 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Echelon9 a0ed86d6bc Remove a tautological Assert(), which cannot be triggered due to the type
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10866 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Goober5000 475e4d5d35 Yarn's fix for Mantis #2362 (scale images properly with show-subtitle-image)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10865 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Goober5000 3743449a42 from MageKing17: choose alt_names and callsigns by array index instead of substring; fixes Mantis #2934
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10864 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Goober5000 79b73f241b MageKing17's patch for callsigns not resetting when the mission is cleared (Mantis #2934)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10863 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Echelon9 2da2527207 Quieten a number of warnings related to UI_USERBOX without a declaration yet. Added TODO.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10862 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Echelon9 f8ef768bbf Address Clang warnings are overloaded virtual functions in UI_GADET. Also opportunity to simplify code by making the most of inherited polymorphism. Docs cleanup
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10861 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:09 +10:00
Echelon9 522eb962ff Fix a range of issue identified via clang warnings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10860 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Goober5000 ad761f980f fix a bug introduced by r10852: MAX_OBJECTS is not a valid object index
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10859 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Goober5000 41d7f2408c fix a bug introduced by r10837: 0 is a valid path index
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10858 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Goober5000 7c07151e26 roll back r10806 because 1) all callers to this function have names which are MAX_FILENAME_LEN in size; and 2) the memset already sets all characters to 0, so there's no need to add a null terminator
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10857 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Goober5000 05e0af6ebd the minimum macro is defined as MIN in FSO to avoid conflicts; no need to #undef (since rev 10796 uses MIN anyway)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10856 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 d37e4c567d Fix Coverity #1093706 Negative array index read in scoring_eval_kill_on_weapon()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10855 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 130ed7c7e3 Fix Coverity #1093707 Negative array index read in start_ship_animation()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10854 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 8d6e82c3bc Fix Coverity #1093711 Negative array index read in event_music_enemy_arrival()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10853 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 823c144ecc Fix Coverity #1093715 Negative array index read in maybe_weapon_detonate()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10852 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 abc0fd11b5 Fix Coverity #1093720 Negative array index read in ai_big_maybe_follow_subsys_path()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10851 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:08 +10:00
Echelon9 c3494516bd Fix Coverity #1093544 Negative array index read in multi_ts_handle_mouse()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10850 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
Echelon9 9cbd23d2e9 Fix Coverity #1093783 Uninitialized scalar variable in gr_opengl_set_center_alpha()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10849 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
Echelon9 8cbb46f40c Fix Coverity #1224006 Uninitialized scalar variable in nebl_generate_section()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10848 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
Echelon9 c85caef631 Fix Coverity #1224005 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10847 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
The_E 3545cacda0 From MageKing17: Patch for Mantis 761(!): Text color tags do not work in debriefings. Also allows color spans in text to cover line breaks.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10846 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
The_E 7be5b03c62 From MageKing17: Patch form Mantis 3067 (Nebula flashing not following player view point)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10845 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
niffiwan 027f218f7f Allow any resolution for mainhalls (From Yarn)
Also includes support for more than two mainhall resolutions, zooming
so one mainhall can adapt to multiple resolutions, setting new mainhall
fonts, help overlays for all resolutions and adjustable tooltip padding.
Also allows preload screens to be any resolution & aspect ratio.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10844 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:07 +10:00
z64555 cdb954f333 Fixes mantis 2877: $Type and $Category entries in controlconfigdefaults.tbl would not properly parse. #defines and enumerated names in the controls code (Such as TAB_SHIP and the various CC_TYPE's) may now be used in the .tbl
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10843 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:06 +10:00
The_E 8c1bef0415 From FUBAR: Patch for Mantis 2842 (Adds new section to game_settings.tbl called "#FRED SETTINGS". Also adds a parameter for it, "$Disable Hard Coded Message Head Ani Files:", a boolean value that controls whether FRED fills the head ani selection in the Event Editor with the retail head ani names)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10842 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:06 +10:00
The_E c07d792e4e From FUBAR: Patch for Mantis 2872 (Make FRED emit a warning for invalid ship classes in a mission file)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10841 387891d4-d844-0410-90c0-e4c51a9137d3
2014-07-05 10:38:06 +10:00
niffiwan 545fd5e6ac Fix mantis 3056
In redalert loadout, only store the current number of banks in use by
ships, not all banks where the weapon idx is -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10840 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 18:54:31 +10:00
Echelon9 c837a21f0d Now that standalone server is support on more than Windows, ensure its features are applied as consistently as possible
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10839 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
Echelon9 666f53e44b Fix Coverity #1093598 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10838 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
Echelon9 edad644595 Fix Coverity #1093597 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10837 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
Echelon9 82058a8c99 Fix Coverity #1093552 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10836 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
Echelon9 ae6365bc35 Fix Coverity #1093545 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10835 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
Echelon9 c2122f9767 Fix Coverity #1093544 Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10834 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
zookeeper 8e0304a58f Fixed a bug in normal maps caused by a redundant and float-inaccurate calculation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10833 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
niffiwan 2740cf5ea2 Allow missions to exit to mainhall on successful completion
Activate with either a mission flag, or the 3rd parameter to the
end-mission sexp. Covers ending via the debrief, skipped from dying
5x times or skipped training mission
Does NOT work for redalert missions or multi (yet)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10832 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-26 16:54:17 +10:00
niffiwan 322d1f39e0 Fix mantis 2945 (From MageKing17)
Don't set PF_PROJECTED in g3_transfer_vertex() as it's not projecting
the vertex
Note: displaying nebula emp/lightning used to depend on unitialised data!

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10828 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:54 +10:00
Zacam cc36ac9faf Follow-up to r10793, missed a spot of [more]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10827 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:54 +10:00
m_m a45e930047 Fix for Mantis 3063: Animation code-related sound entries doesn't use new sound format
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10826 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:54 +10:00
The_E 83ffa764b5 Fix for Mantis 3016 part 2 (Make FRED respect the Briefing Window FOV setting in game_settings.tbl
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10825 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:54 +10:00
The_E 54787e8402 Fix for Mantis 3016 (Briefing window FOV different from retail). Also adds a new setting to game_settings.tbl, "$Briefing Window FOV:" under Graphics, which takes a single float argument to set the FOV of the briefing window.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10824 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
The_E 8da0ac791e From MageKing17: Patch for Mantis 3060 (Beam particles not generated correctly in certain cases)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10823 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
The_E 971192ab30 From MageKing17: Patch for Mantis 3061 (Turrets can't have an initial rotation defined)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10822 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
The_E 505e1e77f5 From MageKing17: Patch for Mantis 3012 (Various issues with ships in nebula)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10821 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
The_E cba1eb07db Fix for Mantis 2982: Removes superfluous Assert.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10820 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
CommanderDJ 358e2ab4fc Fix Mantis 2773: Models turn black when full nebula enabled in FRED.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10819 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
niffiwan f5199ea122 Fix mantis 2929
Save shortcut rank to the csg flags & bump csg version
Add function to read the csg rank during pilotfile::verify()
Reorder 'find pilots' call so that Game_mode is valid for verify

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10818 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-19 20:12:53 +10:00
niffiwan 603a4086f5 Fix mantis 2920: prevent pilots switching languages
In other words, a pilot can only be used in the same language it was
created with. Checks both the initial selection screen and in the
barracks.
Also fixes issue with PLR version being ignored in pilotfile::verify()

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10817 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
niffiwan 05adea0e25 Fix mantis 2923
Backout all_time and multi_stats from the pilotfile stats as
required

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10816 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 3f752b9a40 Address Coverity 1093687 Resource leak in os_init_cmdline() that would occur when the -parse_cmdline_only flag was set. Refactored to improve readability at the same time. Order of precedence remains data/cmdline_fso.cfg, per-user cmdline_fso.cfg (on Linux and Mac), then actual commandline. The presence of -parse_cmdline_only will ignore all settings in on-disk cmdline_fso.cfg files
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10815 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 55f34b1b58 Address Coverity 1093378 and 1093379 Resource leaks in object ChttpGet::ChttpGet()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10814 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 a0f31e6dc5 Address Coverity 1093380 Resource leak in object CFtpGet::CFtpGet()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10813 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 f5a9d32d14 Address Coverity 1093781 and 1093782 Uninitialized scalar variables in cftp.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10812 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 d0b786fe87 Address Coverity 1093635 Out-of-bounds read in multi_team_report()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10811 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 d8e26c8e02 Address Coverity 1212011 Unchecked return value in DCF(multi oo)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10810 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 05991a9fbf Address Coverity 1107318 Logically dead code in outwnd_print(), check for NULL id has already occurred
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10809 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 55af81050d Fix Mantis 3059: Coverity 1204289 String not null terminated in cf_search_root_pack()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10808 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 27495abda6 Address Coverity 1093373 Copy-paste error in vm_find_bounding_sphere()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10807 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:36 +10:00
Echelon9 129a2d0d85 Address Coverity 1204290 Copy into fixed size buffer - strncpy() should be restricted by length to that of the target string, and does not guarantee null termination if the source string overran
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10806 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:35 +10:00
Echelon9 1883fcb8ae Address Coverity 1093663: Out-of-bounds access with memcpy() in multi_oo_pack_data() for clients only
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10805 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:35 +10:00
niffiwan 2ea048ee51 Fix mantis 3005: add arg so end-campaign sexp can ignore the death screen
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10804 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 20:29:35 +10:00
niffiwan c4978d3661 Fix r10801 (thanks to MageKing17 for noticing this)
Really avoid using -1 as an array index

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10803 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
chief1983 d2ffd40d67 Fix an assertion logic reversal in r10797, spotted by MageKing17.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10802 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
niffiwan e86d0c573d Fix pilot conversion issue (followup to r9630)
-1 is a valid weapon index, but avoid indexing the array with it

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10801 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
Zacam 1d6e173023 Fix for Mantis 3058: On warp out, glowpoints still stay "on" and in mission space without a ship; from MageKing17
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10799 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
Zacam 2db5a3b991 Fix for Mantis 2725: Beam sounds not panning correctly
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10798 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
Zacam 3e22cc0d54 Fix for Mantis 3057: Loadout (Ship/Weapon Select effect) rendering black models or no effect. Also corrects wireframe color for FS2 effect from black to blue. Committed on behalf of MageKing17.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10797 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
m_m 3390ba23a0 Fix for Mantis issue 2891: gr.drawString text box height irregular
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10796 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
niffiwan 1f246b7de1 Coverity ID 1093586 Negative array index read
Shouldn't be able to occur since when artillery_objnum is set to -1,
artillery_lock_time is also set to 0.0f. BUT, protect the array
access anyway in case the surrounding code changes in future.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10794 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
Goober5000 35096fd957 use the [more] color, per MageKing17's previous changes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10793 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:20 +10:00
niffiwan 1bd98325bd Coverity ID 1093722 Negative array index read
Move -1 check to before the convinience ptr is created & used

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10788 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-14 13:07:19 +10:00
niffiwan 06b0eb8d35 Fix mantis 3051 (From MageKing17)
Only store CPVs on accepting mission results
Add copy of CPVs to missioncampaign and pilot .csg so redalert missions
can rollback the CPVs if required

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10786 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:53 +10:00
niffiwan 5801bd47ea Coverity ID 1093538 Negative array index read
Change unknown +Default Ship index (-1) to 1st ship index (0)
Fix loop iteration
Change Assert to Assertion

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10774 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:53 +10:00
niffiwan a545580a5a Coverity ID 1093533 Negative array index read
This negative read occurs regularly, but it'd be very very rare for that
random read value to evaluate to OBJ_WEAPON and cause further issues.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10773 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:53 +10:00
niffiwan 3b77e65f5f Raise MAX_PATH_LEN to 256 so FSO can run in long paths
Specifically avoid one issue with running FSO in the default Steam dir
Converted some magic 128/127 numbers to MAX_PATH_LEN
Convert some Int3() into more friendly errors
Stopgap measure until proper fix added with compressed VP support
Fix mantis 3028

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10772 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:52 +10:00
zookeeper 3a3e8599df Removed an assert checking for a condition which can rarely be false (presumably due to inaccuracy in vector normalization) but which doesn't actually need to be true.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10766 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:52 +10:00
niffiwan 9da72db80e Coverity 1221482: Dereference after null check
Stop Ctrl-PgUp/PgDown crashing when a briefing icon is not in closeup mode

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10764 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:52 +10:00
niffiwan e3ebdd3ce9 Coverity ID 1221483: Missing break in switch
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10763 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-09 13:48:52 +10:00
niffiwan 8baa713ef8 Fix a few gcc compile errors introduced by r10756
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10760 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-07 12:37:26 +10:00
The_E 147bf23067 Catch a lua error that apparently can happen
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10759 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-07 12:37:26 +10:00
niffiwan fdd8666524 Fix mantis 3048 (From MageKing17)
Fix "more" & offsets in [cmd|de|]briefings

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10758 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-07 12:37:26 +10:00
m_m d84d9d31aa Added multiple scripting features related to messaging as requested by Axem.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10756 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:18 +10:00
m_m 6d5b5ddde1 Add support for voice acting in fiction viewer.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10755 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:18 +10:00
niffiwan f54429d49f Fix mantis 3041
Allow set-skybox-model to set skybox flags (with FRED support - thanks
m!m)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10754 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
Goober5000 8e1c4be1b6 quotes can span multiple lines as well, so let's keep track of that flag (fixes Mantis #3001)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10753 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
Goober5000 e10550cdbd fix a bug in the when-argument sexp that managed to escape detection from its original design! spotted by MageKing17, fixes Mantis #3052
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10748 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
Goober5000 a1e5d76c02 roll back r10741 pending further code review; see Mantis #3052
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10743 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
Goober5000 cf8c06f850 follow-up to r10734: in the event of any SND_F flags being added in the future, this is more future-proof
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10742 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
The_E c562e34516 From MageKing17: Fix for Mantis 3502 (Flush the sexp result tree after argument evaluation to avert accidental short-circuit results)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10741 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-06 16:51:17 +10:00
niffiwan 28c31c9ba2 Fix mantis 3053 (From MageKing17)
Check KEY_DEBUGGED1 to allow event.log snapshot to trigger when using
release+cheats

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10740 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:30:00 +10:00
niffiwan e926d6bad0 Fix mantis 2812 (From Yarn)
Add modular help tables and allow more than 2 help overlays

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10739 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:30:00 +10:00
The_E 52331f89a2 Stopgap fix to avert a crash in get_subsystem_world_pos later on
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10738 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 f995298abf Fix Coverity 1093663: Out-of-bounds access in multi_oo_pack_data()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10737 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 62b9833bf0 Fix Coverity 1093638, 1093640 and 1093667: Out-of-bounds access in tcp_client.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10736 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 0279040e80 Fix Coverity 1093799 Uninitialized scalar variable -- initialise array contents to zero
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10735 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 ff38404cac Fix Coverity 1093788 Uninitialized scalar variable - no need for bitwise AND when value is so far unset
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10734 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 a779ee3ed4 Fix Coverity 1093783 Uninitialized scalar variable with opengl_light structure in gr_opengl_set_center_alpha()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10733 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
Echelon9 4033465143 Fix Coverity reports of Uninitialized scalar variable with the vertex struct. Should vertex ever be converted to a class from a struct, these memsets as well as the pre-existing ones will need to be removed in favour of a proper constructor of the then vertex class.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10732 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:59 +10:00
niffiwan e7d041c332 Fix mantis 2940
Only reset pilotfile stats when the local Player is reset

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10722 387891d4-d844-0410-90c0-e4c51a9137d3
2014-06-02 18:29:58 +10:00
m_m c1b2d7c1ee Fix for Mantis 3045: gr.drawImage()'s UV arguments aren't working properly
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10721 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-25 19:03:50 +10:00
Goober5000 53e5ba5913 remove Import Weapon Loadouts feature, which was mainly used for versions of FSPort prior to 3.0 and was broken from r2768 to r10718 anyway
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10720 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-25 19:03:50 +10:00
The_E 154a1a6c76 Removing dead and potentially confusing code
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10719 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-25 19:03:50 +10:00
Goober5000 9fdfde9ae6 restore a strcpy that was accidentally removed in r2768 (fixes Mantis #3046)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10718 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-25 19:03:50 +10:00
The_E d5388ad4bf Fixes crash in the texture replacement editor: Erasing the end element of a size 0 vector is probably not a safe thing to do
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10717 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-25 19:03:50 +10:00
niffiwan c27079fb7a Fix Coverity ID 1215457 Out-of-bounds write
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10716 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-24 09:35:04 +10:00
niffiwan e037571170 Fix Coverity ID 1215458 Uninitialized pointer field
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10715 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-24 09:35:04 +10:00
z64555 d5e81f4561 Fixes 3039: C++ STL was having data race issues with instantiating the debug_commands and the vector that was supposed to reference them. Seems like ✌️ ran into this issue a few times before...
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10712 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-23 22:04:59 +10:00
The_E 003d5e5a2a Amendment to 10706: INT, FLOAT and STRING are already defined symbols on Windows, I've changed them to AT_INT etc so that compilation can happen.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10710 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-22 20:49:29 +10:00
niffiwan e31a8be138 Fix mantis 3026
Update Linux --help option to show all cmdline options
Added data/checks for expected args to cmdline options
Add extra const-ness per m!m review

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10706 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
m_m a6a41efa84 Add support for countermeasures that will pull aspect seekers away from their previous targets.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10705 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
The_E 3344f554f9 More ship flag/ship info flag confusion cleared up
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10704 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
The_E 2c59a39bf6 See 10701, same issue here
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10702 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
The_E 3e1d0082c4 Checking a ship_info flag against a ship flag isn't going to work
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10701 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
chief1983 b4785ea039 Add some lib locations for Solaris for software installed from OpenCSW.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10695 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-20 19:12:37 +10:00
asarium 6c16d0a890 Revert "Add support for countermeasures that will pull aspect seekers away from their previous targets."
This reverts commit 263ed7f05d.
2014-05-17 22:17:57 +02:00
asarium 263ed7f05d Add support for countermeasures that will pull aspect seekers away from their previous targets. 2014-05-17 22:12:37 +02:00
niffiwan 8da9a68d31 Fix assertion when entering barracks in debug
Assert that there's one more line free, not number-of-ships lines

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10689 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
The_E c22fd46f18 Change the "Report Bug" button's URL to scp.indiegames.us
In other news, did you know that FRED has a "Report Bug" button in its About dialog?

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10666 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
niffiwan bd64590ec1 Fix mantis 2981
Read & write pilot loop data in the same order

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10665 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
niffiwan ec90cae8d9 Fix Coverity ID 1212016 Copy into fixed size buffer
replace strcpy with strcpy_s

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10662 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
niffiwan e199a928c4 Fix Coverity ID 1212017 Copy into fixed size buffer
replace strcpy with strcpy_s

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10661 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
niffiwan 3890ca6928 Fix Coverity ID 1212013 Macro compares unsigned to 0
Use MAX instead of CLAMP

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10660 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:12 +10:00
niffiwan 6b955bb7b8 Fix Coverity ID 1212014. Unsigned compared against 0
Removed the >= 0 check

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10659 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:11 +10:00
niffiwan cc21af0d08 Fix Coverity ID 1212015.
Check the pointers value vs '\0', not the pointer

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10658 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:11 +10:00
z64555 153cb7dc79 Debug console. Now with more intuitive pagination from the help list!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10654 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-15 18:24:11 +10:00
niffiwan 5ccfbe1119 Remove GCC Warning (unused-variable)
Since token_str is only used in 1x .cpp, move the declaration from
the .h to the .cpp

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10653 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:38 +10:00
z64555 2903bbee1f Resolves complaints from VC6 about several instances of find_if that were not scoped properly. None of the other compilers seemed to have noticed...
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10647 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:38 +10:00
z64555 c6e9736c18 Resolves some warnings concerning signed/unsigned comparisons. Fixes a typo with a DCF_BOOL output message. Fixes compiling on MSVS 6.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10646 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:38 +10:00
zookeeper 9b822a3fa7 Fixed gr.drawOffscreenIndicator() returning wrongly scaled coordinates.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10645 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
The_E cc8f3d2b21 Fixes another C4800: Conversion from int to bool warning
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10632 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
The_E e3421897b9 fixes a bunch of C4800 warnings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10631 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
zookeeper 90c0e77250 Fixed missing closing tags.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10629 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
chief1983 5e21ff72b9 Revert some accidental solution file changes from the debug console commit.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10627 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
chief1983 f11188246b Fix debug console compiling error on Linux.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10626 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
chief1983 5b8728411f Add debugconsole files to makefile. Also, remove lingering reference to dbugfile.h which was deleted in r7857.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10625 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
chief1983 4dcf6a62ee Add debugconsole to Xcode 3 project.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10624 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
chief1983 92d9b8b308 Redo the LastUpgradeVersion part of r10558.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10623 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
z64555 8d5fbab768 z64555's debug console. Take 2. Includes changes to most (not Xcode) project files to include the added files of r10621
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10622 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:37 +10:00
z64555 f18f8a9ea7 debug console amendment, these files got ignored, somehow.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10621 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:36 +10:00
The_E 98355da7d5 Revert 10619: Missing files
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10620 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:36 +10:00
z64555 2b2ba832f8 z64555's debug console.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10619 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:36 +10:00
zookeeper edc515e681 Fixed Mantis #3037; surface shields will again check for a shield mesh collision before hull collision.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10618 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:35 +10:00
zookeeper c80484f890 Clarified documentation of gr.drawPolygon and gr.drawSphere.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10616 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-08 19:18:35 +10:00
niffiwan b42f468552 Fix issues added in r10587
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10611 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-04 20:52:23 +10:00
niffiwan a861372efc Add lua campaign lib & functions to retrieve mission filenames
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10602 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-04 20:52:23 +10:00
niffiwan 7c3631002b From Yarn: Fix mantis 3031
Use PF_USE_AFFIRMATIVE_ICON where necessary

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10601 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-04 20:52:23 +10:00
Echelon9 67ccdfb6d3 Fix Mantis Issue #2976: AddressSanitizer: global-buffer-overflow in firing_aspect_seeking_bomb()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10596 387891d4-d844-0410-90c0-e4c51a9137d3
2014-05-04 20:52:22 +10:00
karajorma bb7e894107 Output how much of the player's score comes from the currently displayed list of kills by ship type in the barracks.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10595 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-25 16:04:45 +10:00
Echelon9 8267319073 Resolve build errors reported on MSVC in beam_ok_to_fire()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10594 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-25 16:04:45 +10:00
Echelon9 c1fdd9a58c Correct the cast to size_t in buffer_data constructors
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10593 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-25 16:04:45 +10:00
Echelon9 a7e1390397 Fix Mantis Issue 3035: AddressSanitizer: double-free in interp_configure_vertex_buffers() of memory contained in buffer_data object. Add a copy-constructor and copy-assignment operator which are required as we manage our own memory in buffer_data
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10592 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-25 16:04:45 +10:00
Echelon9 ceeabbf805 Reverse commit in r10558. Given we regularly have users provide Debug logs, this will prevent that small subset with only 32bit Mac's from running a Debug build
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10588 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-25 16:04:44 +10:00
niffiwan b1ca9a33da Fix mantis 2950: make shields-on/shields-off multi compatible
Fix multi player for alter-ship-flag

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10587 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 974bf06237 Fix Coverity 1093381: Resource leak in object due to absence of destructor. Provided that release() has already been called, which would mean memory has been cleaned up on most paths, this destructor will be in essence a NOP (or close to it). If memory has typically not been cleaned up already, this addition will improve memory usage over time.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10581 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 b36f1c1709 Fix Coverity 1093306: Whilst the return value was not checked in beam.cpp, the correct fix is to convert the function to void given no location actually checks the return value.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10580 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 bdd192a17d Fix Coverity 1093302: Unchecked return value. This is the only occasion where the return value of ship_get_by_signature() is not checked. Likely oversight.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10579 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 5268ef1916 Related to Coverity 1093623: The self-assignment at present has no effect
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10578 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 26ee96a012 Fix Coverity 1093493: Missing break in switch statement. No logical reason why LE_ORDER_EVADE should fall through to LE_ORDER_STAY_NEAR. Only switch statement in block without a break statement further indicates an oversight.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10577 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 389f4b3dfb Fix Coverity 1093376: Copy-paste error in ade_table_entry::OutputMeta()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10576 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:26 +10:00
Echelon9 1205336fee Fix Coverity 1194949: Copy-paste error in gr_opengl_bitmap_ex()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10575 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
chief1983 0bb037bb85 Removes the DS_Store hidden files from the Xcode4 Frameworks archive.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10572 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
chief1983 46c61fcbcf Unify all the revision placeholders out to 6 digits for increased regex replacement reliablity.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10570 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
chief1983 f903da75e3 Increase Xcode and Xcode4 version and filename consistency with other platforms.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10569 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
Echelon9 3c155fd888 Fix Mantis Issue #3033: AddressSanitizer: global-buffer-overflow in shockwave_move()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10568 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
Echelon9 308179256a Fix Mantis Issue 3032: AddressSanitizer: SEGV on unknown address 0x00000000f000 in texture_info::LoadTexture()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10567 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:25 +10:00
zookeeper a20f54957c Ported r10282 from zookeeper branch: added a new #SOUND SETTINGS section to game_settings.tbl and in it overrides for the default sound, music and voice volume.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10563 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:24 +10:00
zookeeper 1f2f6d8d8e Ported r10395 from zookeeper branch: made the Shields handle support non-quadrant shields.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10562 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:24 +10:00
zookeeper 636f903f72 Ported r10442 from zookeeper branch: increased the arrival/departure paths restriction dialog's width by 100px so even longer path names will be fully visible.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10561 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-22 19:22:24 +10:00
Echelon9 01d718f8e9 Project files in Xcode4 folder adopt latest suggested project file settings from Xcode 5.1.1
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10558 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-14 19:40:17 +10:00
Echelon9 7e47598eb9 Fix issue 3030: Clang warning: semantic issue, '&&' within '||' in gr_[re|un]size_screen_pos() and gr_[re|un]size_screen_posf()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10557 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-14 19:40:17 +10:00
Echelon9 7aaa5fa4a1 Fix Mantis 3029: Clang warning: expression result unused in multi_pinfo_blit_squadron_logo()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10556 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-14 19:40:17 +10:00
m_m 77d7871266 Fix for Mantis 3027: Crash if ship AI is forced to change target
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10552 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-14 19:40:17 +10:00
m_m d3dde35341 Fix for an invalid index crash.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10550 387891d4-d844-0410-90c0-e4c51a9137d3
2014-04-14 19:40:17 +10:00
niffiwan 3a113e6176 Remove gcc warnings (unused)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10548 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-31 17:28:25 +10:00
The_E 6e91857745 From Yarn: Fixes interface graphics scaling issues. If, for some reason, you want to have the interface graphics stretched, use the -stretch_menu commandline flag.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10544 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
niffiwan c5417c1909 Fix mantis 3025: pass lua HookVar integer data as an integer, not a struct
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10543 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
Goober5000 d195c97056 Yarn's fix for Mantis #3024
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10531 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
Goober5000 c5a7223943 this will likely fix Mantis #3013
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10530 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
The_E 4f39ef2e07 Fix for Mantis 3023 by Yarn: Make sure the vasudan mainhall fun cheat works again
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10519 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
The_E 07980be92e Fix for Mantis 3015: Makes sure rotation values are always in the 0-359 degree range
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10518 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
niffiwan 08280e3d9e Remove gcc warnings (unused & shadow)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10517 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
niffiwan ca17188572 Fix mantis 2921: start mainhall music when leaving the credits state
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10507 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
Goober5000 d7b6a1ac6f add briefing icons for ship-with-cargo and wing-with-cargo
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10506 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
zookeeper 7099170497 Changed the label of the "Broadcast Locally" multiplayer option from "/multidata" to "Broadcast Locally".
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10498 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
niffiwan 7f1a2c734f From Axem: fix newly added hud gauge sexps
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10497 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
karajorma 2356f04f04 Yarn's fix for Mantis 3017 (Certain HUD elements don't work after the changes to strings.tbl). Not very happy with the way it fixes thing (it only solves problems for French, German and Polish, which kinda makes the changes to strings.tbl in r9761 somewhat pointless) but it makes sense to wait for SDL and truetype support and then fix everything properly then.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10496 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
niffiwan 55bec33861 From Axem & niffiwan: stop briefing/credits/mainhall music with scripting
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10495 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
m_m 626269d4a4 Fix for Mantis 3018: Setting a weapon's Target/HomingObject/HomingPosition etc doesn't work
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10494 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-30 12:39:54 +10:00
Fabian Woltermann 083905b4f8 Merge pull request #16 from asarium/fix/hudmessage
Fix a crash with invalid iterators
2014-03-16 22:57:45 +01:00
asarium 31d6ca5a0e Fix a crash with invalid iterators 2014-03-16 22:32:10 +01:00
niffiwan 3f349849d6 Fix mantis 3019: flush bitmap to prevent alpha-additive-blend shenanigans with lua drawRectangle
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10493 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:32 +10:00
Goober5000 ff675c3653 New method of handling quotes and comments that examines lines character by character like most languages do, instead of just searching for the start of a comment. If a comment character is inside a quoted string, it will not kick off a new comment. (This actually fixes the core design flaw that caused semicolons to truncate messages, so the $semicolon tag is technically no longer necessary. It will still be kept, of course.) Fixes Mantis #3001.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10492 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:32 +10:00
Goober5000 0eb5606527 the #define already has a (char)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10491 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:31 +10:00
niffiwan 2f22873e35 From Axem: add hud-set-custom-gauge-active and hud-set-retail-gauge active
Deprecates hud-set-active-gauge and hud-activate-gauge-type in favor of hud-set-custom-gauge-active and hud-set-retail-gauge active, which are clearer to understand and now accept INT_MAX number of gauges, instead of just 1.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10489 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:31 +10:00
Goober5000 03144d3846 going through old revisions, r8540 is wrong, since it was like that in trunk -- memsetting the whole struct to -1 sets all integers and floats to -1 (so let's go back to the old way in case some old retail code relied on model_instance_num, model_num, or submodel_num being set to -1)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10481 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:31 +10:00
m_m 638ad77a21 Add a scripting hook variable that specifies the mouse buttons. This variable is named MouseButton and is a bit field which uses the MOUSE_* defines (index 0 for right, 1 for left, 2 for middle).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10477 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:31 +10:00
niffiwan 4e98285d2a Followup to mantis 3009; missed the Lead Sight gauge in the 1st fix
Rechecked all other gauges that set slew=true in their contructors
(vs 1st pass which checked gauges that set slew=true in hudparse.cpp)
I think I got them all now...

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10476 387891d4-d844-0410-90c0-e4c51a9137d3
2014-03-14 19:50:31 +10:00
karajorma a7428c5a72 Bigger (and better?) Briefing and Debriefing editors courtesy of Axem.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10475 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-26 21:37:14 +10:00
zookeeper 6f906561bb Fixed oversight in r10430: the $Weapon class hook condition didn't work on $Weapon Collision hooks if the other object was an asteroid.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10474 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:02 +10:00
Zacam 3ef41e164c I think we can allow for 32bit Color Depth to be the default option now.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10473 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:02 +10:00
karajorma 159d8e7107 Fix a bug where you couldn't press g to start a mission in debug builds.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10471 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
karajorma b4dad30c77 Add a SEXP for checking the current state of ship flags.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10470 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
karajorma 64efaddaab Make the Mission Objectives editor a little larger. Cause why not?
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10469 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
karajorma ebfdf4e901 Fix a bug with the event.log where SEXPs which weren't in events would also write data to the log.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10467 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
karajorma 5dc4bfea97 Fix a bug with the multiplayer SEXP code. The callback functions write to the packet and thus can also make it go out of bounds.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10466 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
m_m 05702504c4 Fix for Coverity 1107332: Negative array index read
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10464 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
m_m 08dad5b3af Add -no_unfocused_pause option.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10463 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-23 13:41:01 +10:00
niffiwan a2b42bf5f1 Fix mantis 3009: set slew correctly for hud gauges
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10462 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:35 +10:00
m_m 3490ac3a9c Add lua function to get a handle of the current player
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10446 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
The_E 37ded5589d Adds set-motion-debris-override sexp. This can be used to control the presence of motion debris, and overrides any user choice made through the -nomotiondebris commandline flag.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10445 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
zookeeper cef02e7b9f Clarified which time units are expected by camera.setOrientation() and camera.setPosition().
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10431 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
zookeeper a72f0f9d62 Allowed the $Weapon class hook condition to work on $Weapon Collision hooks.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10430 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 6d5e026a3e Mantis #3004: don't remove subspace drives from support ships
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10429 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 df73bacb9e Mantis #3004: standardize checks for whether ships can depart to docking bays, and whether departure goals are achievable, and whether a ship can be commanded to depart; also fix the default behavior if a ship attempts to warp out but is unable to
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10428 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
m_m d97f31d034 Fix for Coverity Issue 1166829: Dereference before null check
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10411 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 a880bcb9c2 Mantis #3004: ship_get_ship_with_dock_bay was written in such a way that it allowed a negative array index to create all sorts of havoc
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10407 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 dbe5f61dd6 following up from r10000 and r10004, fix the hud squad message display for support ship aborts (and in the process optimize things slightly)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10406 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 0a9063a525 wing names with the hash at the beginning aren't subject to the name bashing
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10405 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:34 +10:00
Goober5000 827286ec95 only warn once, because old missions tended to have a *lot* of these broken +Team values
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10404 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:33 +10:00
karajorma aeb089b216 If we've already written the content of CTEXT(n) to a variable, we should use that, rather than calling CTEXT(n) 500+ times.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10403 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:33 +10:00
m_m 5fa9a5c946 Fix for Coverity 1147623: Out-of-bounds access
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10393 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:33 +10:00
m_m 0d54630e83 Fix for Coverity 1107329: Improper use of negative value
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10392 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-20 18:27:33 +10:00
Echelon9 f97e478c6d Fix Coverity 1093576 Improper use of negative value: In model_collide_flatpoly(unsigned char *): Negative value can be returned from function is not being checked before being used improperly (CWE-394). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10391 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 3b19fab1c1 Fix Coverity 1093446 Dereference after null check: In obj_snd_stop_all(): Pointer is checked against null but then dereferenced anyway (CWE-476). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10390 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 6d52a7c2b2 Fix Coverity 1093407 Logically dead code: In model_interp_sub(void *, polymodel *, bsp_info *, int): Code can never be reached because of a logical contradiction (CWE-561). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10389 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 0288075eb0 Fix Coverity 1093392 Logically dead code: In obj_snd_assign(int, int, vec3d *, int, int, ship_subsys *): Code can never be reached because of a logical contradiction (CWE-561). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10388 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 cf0928ab8c Fix Coverity 1129278 Uninitialized scalar field: In object::object(): A scalar field is not initialized by the constructor (CWE-457). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10387 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 b2231f28d1 Fix Coverity 1102734 Uninitialized scalar field: In collider_pair::collider_pair(): A scalar field is not initialized by the constructor (CWE-457). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10386 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 846cdad098 Fix Coverity 1107319 Copy-paste error: In collide_weapon_weapon(obj_pair *): A copied piece of code is inconsistent with the original (CWE-398). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10385 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:50 +10:00
Echelon9 64dad52741 Fix Coverity 1093455 Dereference after null check: In read_model_file(polymodel *, char *, int, model_subsystem *, int): Pointer is checked against null but then dereferenced anyway (CWE-476). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10384 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 2936dde64f Fix Coverity 1093728 Allocation size mismatch: In model_allocate_interp_data(int, int, int): Allocation size is not a multiple of the target pointer's pointed-to type (CWE-131). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10383 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 f02cba4090 Fix Coverity 1093413 Logically dead code: In model_collide_sub(void *): Code can never be reached because of a logical contradiction (CWE-561). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10382 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 7241a6b686 Fix Coverity 1093669 Out-of-bounds access: In triggered_rotation::add_queue(queued_animation *, int): Out-of-bounds access to a buffer (CWE-119). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10381 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 0572c25aa1 Fix Coverity 1093859: Uninitialized scalar field In mst_info::​mst_info(): A scalar field is not initialized by the constructor (CWE-457). From Flaming_Sword.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10380 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 d503d1d42e Expand the .gitignore exclusions to cover modern Xcode project local files. Based off StackOverflow suggestions as documented.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10379 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
Echelon9 0b494959e1 Fix Mantis 2997: Make +Bitmap a required table item if a weapon trail has been set
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10378 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
karajorma f9f2b1e8d7 There was some confusion about the old help text.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10377 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
The_E e4009799c6 Remove a pointless, ✌️ original assert (All ships should be able to send messages regardless of whether they're flyable; checking whether they are accomplishes literally nothing)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10376 387891d4-d844-0410-90c0-e4c51a9137d3
2014-02-02 10:52:49 +10:00
The_E d36fc2a88e Remove per-campaign detail settings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10351 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:26:00 +10:00
The_E 6b39db6b12 Remove a superfluous $ sign from gauge_load_common, which was messing up hud_gauges tables that defined differing fonts for hud gauges.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10350 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:26:00 +10:00
zookeeper 6e8a90fbbc Fixed targethit1 -> targhit1 in an error message.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10349 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:26:00 +10:00
zookeeper 0794dcded3 Another little Lua documentation fix.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10348 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:26:00 +10:00
zookeeper dc37d2e5de Two small Lua documentation fixes.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10347 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:26:00 +10:00
m_m 5050494c45 Fix for Coverity 1135848
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10311 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:25:59 +10:00
niffiwan c08aaf1ec2 Coverity ID 1093440: Evaluation order violation in weapon_create()
Related to weapon substitution code
Also a gcc warning (sequence point)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10301 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:25:59 +10:00
m_m 8fb2a7ffad Add -profile_write_file options to write frame times to a file. See Wiki for more information.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10299 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:25:59 +10:00
zookeeper 0cac254b04 Fixed Mantis #3000.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10298 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-31 17:25:59 +10:00
niffiwan 9f67d2e337 From Admiral MS: add scripting function to get the waypoint-list of a waypoint
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10297 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
niffiwan 2605583be6 From Admiral MS: add scripting function to get the wing of a ship
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10296 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
niffiwan e1711a326e From Admiral MS: scripting access to ship orders; also allows modifying some order values
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10295 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
zookeeper 270d3d9248 Fixed breakage from r10254: key tokens in messages weren't getting translated right.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10293 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
zookeeper 7f74ce48a6 Fixed +Spread From LOD not working.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10290 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
zookeeper 31ab1cff2c Ported "no homing speed ramp" weapon flag from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10289 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
zookeeper dbded13fa4 Ported $Acceleration Time weapons table option from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10288 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
zookeeper ef94f4bb04 Ported $Velocity Inherit weapons table option from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10287 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:46 +10:00
karajorma 1adabef7bd X3N0-Life-Form's Call-SSM-Strike SEXP.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10286 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
karajorma c27f75cd5a Add support for replaying briefing and command briefing cutscenes. The go back a stage and go to first stage buttons will now count these as a briefing stage.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10280 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
karajorma 7ef94f084b Allow training missions to also show mission goals.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10279 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
karajorma cd9c2f851b Make it easier to distinguish the events in the mission log
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10278 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
Goober5000 2c34ca0218 fix Mantis #2994: a model can have initial animation states even if it doesn't have animations
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10277 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
niffiwan cecc445e8b Move $Scale Gauges: token before $Reticle Style: to avoid breaking parsing when both are specified
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10275 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
niffiwan 7f05cca670 Ensure Offset & Origin are used together (hud gauges)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10274 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
niffiwan 4d7c218d59 Tweak HUD so that retail gauge scale/no-scale can be set in a minimalistic hud gauges table
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10273 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
niffiwan 770cd66755 Add scaling option to Yarns hud gauges
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10272 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
Goober5000 0b4f71c84d Mantis #2951: fix memory corruption issues by changing weapon substitution patterns to use C-style arrays rather than SCP_vectors
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10270 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
Goober5000 b090ea1f68 revert r10082 temporarily while substitute pattern feature is modified
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10269 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
niffiwan 84728de587 Add cmdline flag to disable use of pixel buffer objects
Workaround a bug/deficiency in recent linux intel video drivers

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10268 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
Goober5000 a04e83ab01 red-alert will now work with ships that appear at some point subsequent to mission start
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10267 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:45 +10:00
Goober5000 180115feba correct ammo for red-alerted ballistic primaries
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10257 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:44 +10:00
zookeeper e93e27fc0d Improved the calculation for how many segments to use for drawing circles and arcs.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10255 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:44 +10:00
zookeeper 61d9ce895b Ported the $On Action and $On Action Stopped scripting hooks from zookeeper branch. Also bumps the char limit for conditions from 32 to 64.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10254 387891d4-d844-0410-90c0-e4c51a9137d3
2014-01-14 20:24:44 +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 0115235de7 Add lua on-collision hooks for beams: from Axem & Wanderer
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10253 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
z64555 63ab561e59 Mantis 2977 - Fixes some scripting hooks and references broken by r9549
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10252 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
The_E 9ff8f21b1f Adds a check to see if the model actually has a defined viewpoint; We can't generate the firepoint display if it doesn't
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10251 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
karajorma 69749cdaee Add the was-destroyed-delay SEXP by the WCS team. Add support to alter-ship-flag for hiding ship names.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10250 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
m_m 9cd218a595 Fix Mantis 2978: Off by 1 error with getShipClassIndex()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10249 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
Echelon9 5875b4f3a3 Fix Coverity CID 1093619: Array compared against 0
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10247 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
Echelon9 08f36eb32c Fix Coverity CID 1109072: Copy into fixed size buffer
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10246 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
Echelon9 f834aa80a9 Fix Coverity CID 1093375: Copy-paste error
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10245 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
Echelon9 b35ba0e419 Fix Coverity CID 1093368 - Copy-paste error
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10244 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:16 +10:00
Echelon9 d753954bcb Fix Coverity CIDs 1107320, 1107321, 1107322, 1107323 - Copy paste coding corrected
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10243 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
chief1983 5664773a29 Allow game_settings.tbl to define the FS2NetD port, so TCs can work out of the box on *nix, etc.
http://www.hard-light.net/forums/index.php?topic=86317.0

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10242 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
niffiwan 8105d2a372 Fix Coverity ID 1093819: Uninitialized scalar variable in (template) class ade_obj::GetPtr()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10241 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
niffiwan 34b1f276f3 Fix Coverity ID 1093784Y: Uninitialized scalar variable in struct order_h
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10240 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
chief1983 975f94f207 USHRT_MAX is in limits.h on Linux.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10239 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
Goober5000 d9b45b0eb2 just minor tweaks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10237 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
Goober5000 1ff223687d when new subsystem entries are inserted, make sure the blank subsystem gets saved and inserted at the proper spot so that we don't use stale data (fixes Mantis #2979)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10236 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
chief1983 a45af2f019 Found the constant USHRT_MAX I was looking for just a little too late.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10235 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
chief1983 da4b191160 Saner parsing all around for webapi port number.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10233 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +10:00
chief1983 459e2bd469 Fix a warning when copying the webapi port token int into its destination ushort.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10232 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-22 19:05:15 +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
niffiwan 9e73870862 add wxfred2 execs to .gitignore
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10225 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan c5c7e58507 autotools: use autoreconf & m4 dir to make it easier to add/manage macros
add m4/wxwin.m4 macro file from wxWidgets 2.9.5 (previously pasted into acinclude.m4)
remove obsolete WX* macros from acinclude.m4
move acinclude to m4/fso.m4

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10224 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
zookeeper 6d3b183373 Ported parts of r9727 from zookeeper branch: Added support for multiple control presets.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10223 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan d904a4d516 Fix Coverity ID 1093569: Negative array index read in create_wings()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10222 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan def53398bc Fix Coverity ID 1093574: Negative array index read in sexp_change_player_score()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10221 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan 620f6aaf3d Fix Coverity ID 1093581: Negative array index read in sexp_clear_ship_goals()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10220 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan 3ffe479cca Fix Coverity ID 1093579: Negative array index write in sexp_damage_escort_list()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10219 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan 7d846defa5 Coverity 110733[01]: Negative array index read in get_string_or_variable()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10218 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan aa60c5acec Coverity ID 109381[456]: Uninitialized scalar variable in load_gauge_target_monitor()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10217 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan 336db15246 Coverity ID 1093808: Uninitialized scalar variable in init_ai_target_priorities()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10216 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:02 +10:00
niffiwan 6d402f43aa Coverity ID 1093550: Negative array index write in multi_voice_release_token()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10215 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:01 +10:00
niffiwan 9480b079ca Coverity ID 1093508: Negative array index write in observer_create()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10214 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:01 +10:00
niffiwan 7b9f485a34 Coverity ID 1135850: Out-of-bounds read in hud_target_change_check()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10213 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-15 12:23:01 +10:00
zookeeper d13236e0e4 Ported r9704 from zookeeper branch: Added scripting function for drawing filled and unfilled arcs and made drawCircle able to draw unfilled circles.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10211 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-11 18:52:14 +10:00
niffiwan a3256bbf88 Fix two issues found by Yarn
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10210 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-11 18:52:14 +10:00
niffiwan 0402e46f89 Merge Yarn adaptable hud with m!m common hud parse
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10209 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-11 18:52:14 +10:00
niffiwan 706152c7d5 Add common parsing function for hud tables (originally from m!m with updates from me)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10208 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-11 18:52:14 +10:00
niffiwan e6d4b83907 update .gitignore to ignore codeblocks layout files
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10207 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-11 18:52:13 +10:00
Echelon9 45d6f9be21 Fix Mantis 2975: AddressSanitizer: global-buffer-overflow in HudGaugeLeadSight::render()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10205 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:58 +10:00
Echelon9 ce41e56f46 Fix Mantis 2896: AddressSanitizer: global-buffer-overflow in hud_lock_reset() hudlock.cpp (v2)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10204 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:58 +10:00
Goober5000 3eedfc7853 don't freak out if we don't have a beam texture
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10203 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:58 +10:00
Goober5000 645ee9a2ba make warning messages friendlier
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10202 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:58 +10:00
Echelon9 be08468a81 Fix Mantis 2974: WebUI interface: Chat tab does not print messages sent from WebUI
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10201 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:58 +10:00
Goober5000 ab1b8912b7 Sushi (or maybe LPine) broke Shield_Hit_Ani for modular tables when coding a Diaspora feature
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10200 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Echelon9 e75a09d203 Update Jansson library to upstream v2.5 -- http://www.digip.org/blog/2013/09/jansson-2.5-released.html
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10199 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Goober5000 f3c902c39b add wing_bash_ship_name, which handles the hash symbol thing, accommodates Blue Planet's capship trick, and works in FRED and while we're at it, do a little bit of const'ing
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10198 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Goober5000 6804e5ae7d a spelling fix, and also clarify a sexp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10197 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
niffiwan 6443005f5c Tweak insignia limits again per Oddgrim's recommendations
http://www.hard-light.net/forums/index.php?topic=86195.msg1722757#msg1722757

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10196 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
niffiwan 07dbfed088 Fix compile issue on Linux re: INT_MAX / <limits.h>
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10195 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
zookeeper 7ff59d0559 Enabled fighterbay door animations to better define which bay path must be used or not used for the animation to trigger using +sub_type. Fixes the (undocumented) current numbering of fighterbay +sub_types to be 1-based instead of 0-based. Turns the SUBTYPE_CHECK macro to a proper function.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10194 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
zookeeper 9f65775702 Made +delay and +acceleration in animation code optional and default to 0.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10192 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Goober5000 1e78f8c6e1 fix hidden divide-by-zero
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10190 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
zookeeper 1c74472423 Added an $On Ship Arrive scripting hook.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10188 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:57 +10:00
Echelon9 49c56eea91 Fix Mantis 2970: AddressSanitizer: global-buffer-overflow in show_ship_subsys_count()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10187 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:56 +10:00
Echelon9 9d6fdb07ba Fix Mantis 2969: AddressSanitizer: global-buffer-overflow in ai_do_objects_repairing_stuff()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10186 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:56 +10:00
zookeeper 54a4f26146 Replaced shield_hit_info in escort_info with its own simple set of timer variables. Fixes Mantis #2966 and makes the code simpler and safer.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10185 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:56 +10:00
niffiwan 41fee37f3f Bump model insignia faces/vertexes limits
(so that newer more detailed ships can have proper insignia)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10184 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-08 19:52:56 +10:00
niffiwan 4c93092045 Add warning for model insignia specifying an invalid LOD
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10183 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Echelon9 14fc0cfd88 Fix Mantis 2800: Particles not removed on standalone
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10182 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Goober5000 c19ac5df9d when changing ship types, make sure the collision flags propagate
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10181 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Goober5000 1467b0ef16 for wing names with hash symbols, put the ship number before the hash
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10180 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Goober5000 3bc14442c5 just make this block similar to the other one
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10179 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
niffiwan 668e67c52d Fix Coverity 1093549: Negative array index write
(practically impossible to occur, but lets be safe in case multi_voice_get_stream() changes in future)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10178 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
zookeeper 4b7543361b Added initialization of render box and sphere offsets.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10177 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
niffiwan e58cbc159b Fix mantis 2967: use Medals array instead of Ranks (from Yarn)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10176 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Echelon9 da6c95b8c4 Fix Mantis 2968: AddressSanitizer: global-buffer-overflow in shield_info_reset() - relates to hud_target_change_check()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10175 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:50 +10:00
Goober5000 69c7ee68f5 don't Int3() because this can happen when a ship is missing from a mod (i.e. when it turns into the GTF Ulysses)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10174 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
Echelon9 af9b12e448 Resolve compilation failure introduced by r10170
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10171 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
zookeeper b7a7bb968e Fixed some improper initialization of escort list hit_infos.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10170 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
zookeeper 85e39497cd More fixes to potentially uninitialized shield_hit_infos.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10168 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
Echelon9 b6b3a24e05 General clean up of commented out #ifndef NDEBUG blocks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10166 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
Echelon9 cb446460e4 General cleanup of commented out code in beam.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10165 387891d4-d844-0410-90c0-e4c51a9137d3
2013-12-03 21:12:49 +10:00
Echelon9 396afcacf8 Ensure compliance with the usual form of test in the FS2_Open codebase for running in Debug mode
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10164 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 20:12:54 +10:00
niffiwan 7f20857796 Honour ships' "no lighting" flag in the techroom (from Axem)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10162 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:38 +10:00
zookeeper a59be2e7c7 Allowed shield_info_reset() to initialize shield_hit_info to empty values if it's not associated with a ship, as required by hudescort.cpp. Might fix Mantis #2961.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10161 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
niffiwan 1a3fc26bfe Move set-ets-values sexp to the correct category (thanks to Axem for finding this)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10160 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 ad1bef5344 some things don't need to be re-inited every time you pause the game
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10159 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 0fb563b241 set ballistic HUD gauge any time HUD is changed -- fixes Mantis #2962
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10158 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 9ec027641d add quotes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10157 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 92435f7217 fix some things that FreeBSD complained about
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10156 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Wanderer 141f6bc121 fix issue with burst firing secondaries - thanks to Goober for finding it
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10150 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Wanderer 96cc3c017d feature commit: excluding weapons from linked fire penalty (per request)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10147 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
chief1983 4e54350dcc Fix #2959. Framebuffer explosions need framebuffer objects, or it seems we assert later in the code.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10145 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
chief1983 04e7b4c288 Recommit the ship.h part of 10082 as the OBO fixes seem to have fixed #2958.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10144 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Echelon9 3bbd389420 LLVM/Clang warns that a dangling else can occur without one level of braces
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10143 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 4611a77dbd re-commit r10082, except for ship.h, because it's the size of the ship_weapon struct that's causing the mysterious crashes (Mantis #2958)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10141 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 9ca44d8ce4 fix an off-by-one error
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10140 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 40c4583792 fix Echelon9's fix >:( also add a judicious Assert for Mantis #2958
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10139 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
Goober5000 724e7816e4 Fix an actual Volition bug. This has AI balance implications, but it's already in the "pick a random weapon" section, so it will probably be all right.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10138 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:37 +10:00
zookeeper 204ebfca63 Remember to initialize shield_point_augment_ctrls.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10137 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 70d05d3815 scramble messages on a per-ship basis
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10136 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
zookeeper 8cd19aa588 Merged model point shields from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10135 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
chief1983 1cb031c190 Fix #2959 by reverting r10082. I can probably talk zookeeper into converting the troublesome SCP_vectors into static variables so this isn't causing memset issues.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10132 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 f6a92e0972 allow modder to specify countermeasure type on a per-species basis
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10131 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
karajorma bad6af8a3a Yarn's fix for Mantis 2941 (Strings.tbms without the current language crash the game).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10130 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
chief1983 b2167c61a3 Fix #2957 - FreeBSD RAND_MAX is 0x7ffffffd, not 0x7fffffff, so we can't always assume that it's the latter. Also move the check earlier in the code, if it's going to break at all, break immediately on any non-conforming platform so we can fine tune this some more.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10129 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 e8a7c8cf57 medal_stuff passes the duck test, so make it an official class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10128 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 6470f9043f make init_ship_entry actually init all the fields in ship_info make draw_weapon_models a ship flag instead of a boolean remove the MAX_SHIP_FLAGS #define because it didn't mean what everybody thought it meant
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10127 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
niffiwan da21b44d07 fix gcc warning: declaration of ‘ship_obj’ shadows a global declaration [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10125 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
niffiwan 4581ed9aa2 Persona-specific promotion debriefings (from Yarn)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10124 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
chief1983 5ceabf1e8b Add support for the framecap menu option.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10121 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
chief1983 5ebd06bb29 Fix WebUI server name changes updating in clients and FS2NetD.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10120 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 858afb0cef turns out gcc doesn't like the two angled brackets adjacent to one another
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10119 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 13c8f95046 let's not make expensive copies of all these SCP_strings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10118 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 8179453ffa fix Mantis #2955: crash when trying to join multiplayer server, caused by trying to memcpy an integer into a ushort (also add some sanity asserts)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10117 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Goober5000 389a2c6955 fix Mantis #2933: don't output alt ship class information using fout_version
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10116 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
Echelon9 9cdd329f11 Webui: Resolve bug that was causing standalone game name to not appear
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10115 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:36 +10:00
niffiwan da92a1a709 Add stub for std_init_os() so that *nix can compile
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10114 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
niffiwan f01eefe832 According to the medal_stuff class, some of these should be MAX_FILENAME_LEN, not NAME_LENGTH
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10113 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
karajorma f4a7a117e4 Fix Mantis 2954 (Standalone can't find default language)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10112 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
Goober5000 7585aed83b clarify help... OP_AND will actually evaluate all arguments
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10111 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
Goober5000 f8dcbffab8 rather than piggy-back the perform-actions sexp on top of the when sexp, it works better to make it its own operator (fixes Mantis #2956)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10110 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
Echelon9 e5115993bf AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) in hud_close()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10109 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
Echelon9 ea93153446 Remove this memory event, as clear() is called after loop, which will call the destructor of each item. Picked up by AddressSanitizer as this was attempting to free() memory allocated with new()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10108 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-25 19:29:35 +10:00
Goober5000 70f84212df we can just use the STL methods here
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10095 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:44 +10:00
Goober5000 a739c172f4 add an important note
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10094 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:44 +10:00
niffiwan b4ab0f3a44 fix gcc warning: declaration of ‘shipp’ shadows a previous local [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10092 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan 7a1b8d5be1 Coverity 1129269: Dereference after null check
add checks to deal with parent_objp == NULL

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10091 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan ed49e0786b Coverity 1129274: Negative array index read
weapon_create can return -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10090 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan e5260a381a Coverity 1129270: Negative array index read
weapon_create can return -1
(& oops, r10087 was 1129271, not 1129270)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10089 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan 95ab88de98 remove gcc warning: [-Wunused-but-set-variable]
(ret_val earmarked for future use)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10088 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan ae429e756e Coverity 1129270: Negative array index read
weapon_create can return -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10087 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan 442f3fb846 Coverity 1129272: Negative array index read
weapon_create can return -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10086 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan 1dad7f799e Coverity 1129273: Negative array index read
weapon_create can return -1

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10085 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
niffiwan b2958b5e4a Remove a magic number
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10084 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 fa7cf7a910 "new" shouldn't really ever fail
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10083 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 33b871d29d remove non-working and non-supported $substitute feature for weapons (Mantis #2951)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10082 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 6bc71834ec this exited_ship constructor is redundant and interferes with the POD-ness of the struct
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10081 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 35347262d4 make man_thruster a POD struct, and initialize maneuvering thrusters in ship_info initialization
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10080 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 de792bc0ca memset initialized the wrong level of pointer :-/
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10079 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 ed04c7788b these memsets aren't needed
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10078 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:43 +10:00
Goober5000 e9fc00df0c now that we have queued_animation_init, we can rewrite this properly
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10077 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 551ba6ba1a ugh, neither the constructor nor the memsets are actually needed here
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10076 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 fcb31d94c1 change p_dock_function_info to a class as well
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10075 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 b7db596f12 change dock_function_info to a class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10074 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 13513588df turn p_object into a class ensure that p_object dock instances are cleared between missions, not just when the game exits handle Player_start_pobject in a saner way the p_object Reset method is nice, but it turns out we don't need it
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10060 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 6b97f368e8 sync functions for freeing dock instances
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10059 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 d310647bfe clear dock lists when objects are deleted, and redundantly clear them between missions and when object instances are destroyed (Mantis #2952)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10058 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 ed06a01897 restore r10051, this time allocating triggered_rotation instances when we need them
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10057 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
Goober5000 7413a7a7d2 don't unnecessarily retime collision checks
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10056 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
niffiwan 0299c7e42b fix gcc warning: [-Wreorder]
‘game_snd::flags’ will be initialised after ‘uint game_snd::signature’

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10055 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:42 +10:00
The_E c0a3d69ed2 Revert revision 10051: If we're going to use a global vector to store animation info, we need to fill it (and the references to it) too.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10054 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
niffiwan 3b89290cd8 fix gcc warning: [-Wreorder]
‘campaign::variables’ will be initialised after ‘int campaign::num_missions’

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10052 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 d11c7ccc2f ship subsystems should reference an index in a global Triggered_rotations vector rather than maintaining their own class object, which wastes space
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10051 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 afe08580c0 make cmission and campaign into full-fledged classes since they contain non-POD types remove a memset which hoses the multi campaign class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10050 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 3aeee91f14 better assignment of vec3d and matrix (matrix should be set to identity, not all-0)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10049 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Goober5000 e0fa46a185 more memset refactoring... turn texture_replace back into a POD struct
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10048 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-17 20:24:41 +10:00
Echelon9 cc8310a491 Webui: Clarify the use of branching if statements, to be consistent with existing code
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10046 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 0e34a25207 Webui: Support setting an alternative port than 8080 to host the webui on
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10045 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 d9ac71740a Webui: Support the setting of a non-default username and password in multi.cfg. These settings are +webapi_username and +webapi_password
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10044 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 8009d34928 Webui: support writing to fs2_standalone.log on Unix or Mac OS X when running a standalone server
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10043 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 07e35d7bd1 LLVM warning: Initialization of pointer of type 'bool *' to null from a constant boolean expression
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10042 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 2d9dfebae3 Re-enable -Wno-shorten-64-to-32 for Xcode. There remains code in the project, including third party, that assumes implicit 64->32 casts are permitted, which the expectation of overflow. We'll need to re-enable this warning later and revisit specific cases in question, either adding an explicit cast, or handling any cases where overflow is theoretically possible and undersired.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10041 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 93e3461748 Xcode 4/5 project file cleanup. These are redundant settings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10040 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 5c8d8f6ded Xcode 4/5 project file cleanup. Further deprecated settings related to cfilearchiver
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10039 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 fa1403f9a9 Further Xcode 4/5 project file cleanup. Install setting not required as we build an .app bundle
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10038 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 af81604303 Further cleanup Xcode 4/5 project file. Promote settings to top level where possible, remove redundant GCC settings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10037 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
Echelon9 eefa00cb19 Clean up Xcode4/5 project file. Remove blank overrides at the lower level of specific projects
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10036 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
niffiwan 196bfa25d3 Revert "oops - using the right pointer helps (from r10032)" (too hasty)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10035 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
niffiwan a2fe09fe6c oops - using the right pointer helps (from r10032)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10034 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:59 +10:00
The_E 184df2fb9e Make sure is-facing does not blow up id OSWPT_TYPE_NONE is encountered
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10033 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
niffiwan 1f2005ab02 Fix mantis 2946 part C: when enabling sheields, only rebalance ETS if the shields were previously off
Also fix same issue in alter-ship-flag ( "no-shields" ... )

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10032 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Wanderer 6f3e773359 Fix for Mantis #2807 - not particularly elegant fix but enough to prevent the reported null vec issue
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10031 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Wanderer e4f63a227c Solution to issues mentioned in Mantis #2949
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10030 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
The_E 25d5cf17f0 Small performance improvement: Only call opengl_shader_t::uniforms::end() once, not every iteration.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10029 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Wanderer db183e021c Continued on Mantis #2806
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10028 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
The_E 521e31d766 ...aaand cleanup
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10027 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
The_E ec56e7771a Ooops, small buffer collision. Need to load the depth buffer to texture unit 2.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10026 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
The_E 551a539fe8 Adds depth buffer access to post processing shaders (via use of the depth_tex uniform)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10025 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Wanderer 0d4cc04cd6 Fix for Mantis #2352 - Turret reset when idle woes and other limited rotation turret woes.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10024 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
niffiwan 9525d19b89 Fix mantis 2946 part B: set defaults ets when calling shields-on
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10023 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Wanderer ca0bcd5dbf Fix for Mantis #2806 - added option to rotate the turrets according to 'initial' state animation code in the lab - option enabled by default but can be toggled via render options
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10022 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Goober5000 6836199eeb ship_subsys is now a class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10021 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:58 +10:00
Goober5000 f883a4bc09 make script_hook behave as a POD object, and fix some parameter passing
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10020 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Goober5000 90e7709da5 fix warning and mismatched line endings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10019 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Wanderer 8a8c338409 Fix for Mantis #2784
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10018 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Wanderer f571d2336f Assert to trap lua getSignature access to objects with invalid signature.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10017 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Wanderer 6cbc4f78c4 Fix to prevent invalid weapon bitmap references from being created in the lab.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10016 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
The_E e6a77d8a34 Moves game_settings.tbl parsing up a few lines so that it takes place before graphics are initialized (Necessary due to the table deciding whether to load external shaders or not)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10015 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
niffiwan 6e265e7e96 Fix mantis 2946: set ets shield index to zero when sexp shields-off is called
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10014 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Goober5000 39024965b8 promptly change the icon type when the wing checkbox is checked load icons.tbl earlier in FRED so that briefing icons work correctly
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10013 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Goober5000 5d73931b6d this should now allow wing icons to be specified too
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10012 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:57 +10:00
Goober5000 686088fa90 store briefing icons in a master list rather than in species_def allow ship classes to specify their own briefing icon to override normal icon
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10011 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 7e6cb331bf game_snd has a STL field, so it is properly a class and consequently species_info needs to be a class as well
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10010 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
The_E 45791f371d Make sure we only write to the event log if the buffer to do this actually exists
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10009 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
The_E b5e0647d54 Adds a check to the mn.Debris table in lua to check for invalid debris pieces
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10008 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
The_E 7b0f6b310b Make sure entries in the Debris[] array get cleared properly upon deletion
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10007 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
The_E d20df5b4c9 Adds a safety check to model_render_glow_points to stop it from blowing up when a glowpoint texture is for some reason not available
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10006 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 1ab4286a25 some calculations will be above 999999, so just do it this way; the end result doesn't matter anyway as we just need the minimum
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10005 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 80320485c1 fix some more loose ends in the revised support ship code
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10004 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 f8b3d75fa4 fail
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10003 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 4bf48943d4 oh come on
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10002 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:56 +10:00
Goober5000 c17fd1af7d fix somebody's spelling
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10001 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
Goober5000 6a8bc0a5ed make support ship deployment more robust, and prevent an edge case where too many support ships could be in the mission at one time
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10000 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
niffiwan f3318caef7 some updates to r9885 per discussion with Goober5000
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9999 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
niffiwan fa04b7c412 Fix mantis 2905: lead sight for secondaries uses subsys distance when targeting a subsys
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9998 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
Goober5000 941fcf34ef and that shouldn't have been committed in r9995
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9997 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
Goober5000 522299eadf the game doesn't like it when you do an Assertion while it's shutting down
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9996 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
Goober5000 5aa3bddf70 change object from a struct to a class, since it contains the objsnd_num field :-/
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9995 387891d4-d844-0410-90c0-e4c51a9137d3
2013-11-10 18:28:55 +10:00
niffiwan f301cefe2c redo r9978 with BUF-1 instead of x[BUF+1]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9994 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
zookeeper 3df8818635 Fixed subtle breakage I caused to surface shields in r9794.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9993 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
Goober5000 758bf662e7 valid timestamps are actually > 0
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9992 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
niffiwan 629ca0cdc0 Fix mantis 2938: ship.time_first_tagged should be initialised to 0
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9989 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
niffiwan aa3f9080d9 From X3N0-Life-Form: add custom sound for SSM strikes
(I updated the patch to use parse_sound instead of the missing stuff_sound)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9988 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
niffiwan 617e4472a2 Remove stuff_sound declaration - was never implemented
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9987 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
niffiwan 2c03139f97 Fix mantis 2889: add sexps's ets-get-value & ets-set-values
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9986 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
niffiwan 797ffdf0f4 Fix mantis 2883
update hud_num_make_mono (& callers) to handle the font number
add partial support for specifying special char indexes for individual fonts

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9985 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
Goober5000 7b3a2ddeb5 Mantis #2944: add a hack to remember the color we faded out to
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9984 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:03 +10:00
The_E 575bc3bcce From Axem: Allow secondaries to cause shudder effects through use of the Shudder flag
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9983 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-31 19:25:02 +10:00
niffiwan 7f7f857559 Add the Polish font01.vf checksum
Sourced from https://svn.icculus.org/freespace2/trunk

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9982 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:50 +10:00
niffiwan e39c972f3d Coverity 1112867: Buffer not null terminated
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9981 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:50 +10:00
niffiwan 24e7810b24 Coverity fixes from Flaming_Sword
Uninitialized scalar field 1093859 1093917 1093810
Out-of-bounds read/access 1093669 1093670
Logically dead code 1093413 1093396 1093407 1093408 1093409 1093410 1093423 1093427 1093390
Allocation size mismatch 1093729 1093728
Unused pointer value 1093921 1093922
Wrong sizeof argument 1093732 1093731
Operands don't affect result 1093365
Dereference after null check/return value 1093475 1093455 1093627

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9979 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:50 +10:00
niffiwan f5757f8591 Coverity 1093664: Out-of-bounds write
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9978 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 0e561c822a Coverity 1093500: Missing break in switch
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9977 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
The_E a43062a426 Makes the following changes to the FRED project for MSVC2013: -Set WINVER and _WIN32_WINNT to 0x501
In combination with this download: http://go.microsoft.com/?linkid=9832071 this will enable FRED building on that compiler.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9976 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
chief1983 aaab9f2f00 Fix FreeBSD since it doesn't have libdl and doesn't need to include it to build currently. May break Solaris but it doesn't work yet anyway.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9973 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
chief1983 eb1cfc9ef7 Fix Unix building on several platforms breaking from the new WebUI standalone code. See http://www.hard-light.net/forums/index.php?topic=85859
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9972 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 5f5d13f2b6 Remove 2 unused hudbrackets functions (only with "#if 0" for now)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9971 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 93992f55ff Coverity 1093668: Out-of-bounds access in fs2netd/tcp_client.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9970 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
zookeeper 5586cd14b0 Port r9959 from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9968 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
The_E 4a422d3398 Updated for released version of VS2013. Note that FRED building is currently not supported on this platform due to MS deprecating Multibyte Charset for MFC, and haven't provided a workaround at this time.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9967 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 2615ca9ab0 Coverity 1107315: Buffer not null terminated
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9966 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 6002874610 Coverity 1107314: Buffer not null terminated
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9965 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
chief1983 b790092b50 This will actually fix the webui code to support jansson 2.2.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9964 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
chief1983 63de4932f8 Ubuntu LTS still uses jansson 2.2.1 in their repo and the code does in fact support 2.2. The libs change was definitely my fault though, I forgot all about r7939.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9963 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan df6f8b5292 And tweak it again, for some reason 2.4 != 2.4.0 :rolleyes:
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9962 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
niffiwan 9df9586ef0 Fix new standalone builds
Bumped jansson required version to 2.4.0 since that's the version included with our source

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9960 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:49 +10:00
chief1983 8d371f9e94 From Eli2: WebUI-based standalone/dedicated server code for all supported non-Windows platforms. See WIP documentation at http://www.hard-light.net/wiki/index.php/FS2_WebUI_Standalone.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9957 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:48 +10:00
chief1983 22cfa72250 One more Solaris tweak. No malloc_size or malloc_usable_size on Sun kit. Still can't get it to link though.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9949 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-27 13:51:48 +10:00
Goober5000 c1aaefea08 patch for Mantis #2937
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9946 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
Goober5000 bce047db1e fix handling of multi-line comments, and add !* and *! as a possible option
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9945 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
zookeeper 92712f5579 Port 9940-9941 from zookeeper branch: Made the targeting box render the target relative to player's eyepoint orientation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9942 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
zookeeper 9ed68b129d Port r9936 from zookeeper branch: Fixed possible crashes related to the eyepoint orientation features.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9939 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
zookeeper 5312b47983 Typo fix.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9938 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
Goober5000 a81491161e allow setting of background and mask bitmaps for the medal case
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9935 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
zookeeper 81a40458c2 Fixed -misc maps being dependent on LOD and lighting levels.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9929 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
The_E ea6edd3f8c Catch a rare error condition where shield_hit_tri was -1 for some reason
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9927 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:02 +10:00
niffiwan 6b3c7bd83e more fixes for wxfred all-lowercase filenames
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9926 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
Goober5000 7343c92c23 spelling
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9925 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
niffiwan 7298f50b7a From Admiral MS: Add a scripting function to check if a ship is in the field of view of a turret.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9924 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
m_m 6021fb4bea Some new scripting functions as requested by Axem: Access to the CargoSize of a weapon class Access to the AltName of a ship class Access to the actual capacity of a weapon bank Access to the callsign of a ship Access to the alternate ship type of a ship Access to the maximum velocity of a ship with respect to its engine energy level
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9923 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
niffiwan 184cda8e58 remove gcc warnings [-Wunused-but-set-variable] in ship/shiphit.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9922 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
niffiwan e725bfc7a1 remove gcc warnings [-Wshadow] in ship/shiphit.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9921 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
niffiwan af56b43beb Coverity 1093367: logical vs bitwise operator in stars_draw_background()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9920 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
Goober5000 762045168a merp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9918 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
Goober5000 73ebcda173 additional memory management improvements
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9917 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
Goober5000 2359bd5c7a more clarification of structs vs. classes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9916 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:01 +10:00
chief1983 75148a3f76 Upgrade Xcode4 project file to...Xcode 5, turning on recommend compiler warnings. Feel free to disable them if they were off for a reason.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9915 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 a0c510e1c6 fix Mantis #2931: don't prematurely exit the model_interp_tmappoly method if we're drawing outlines
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9913 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 595a4c44c5 initialize this just to prevent loose ends
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9912 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 8dc043ae23 WMC has a screwy way of destroying his jumpnode class, so we need a screwy workaround to avoid hitting an Assert...
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9911 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 22d491e50b add copy-variable-from-index and copy-variable-between-indexes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9910 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 0a7409c7a8 better ranges are also good
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9909 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
Goober5000 f77dd3c219 change sexp operator names for clarity, make sure mprintfs have newlines, and fix typo
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9908 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
chief1983 ae169ebb39 Add .svn folders to .gitignore.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9907 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:46:00 +10:00
niffiwan 92e5d5bee3 Coverity 1093637: "fix" out of bounds read of Weapon_info[Weapons[other_obj->instance].weapon_info_index].subtype
(fix for release, at least, Assert probably handles this in debug)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9906 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-16 19:45:59 +10:00
niffiwan 01629bd946 Redo 9903 - this is a more robust solution
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9905 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:32 +10:00
niffiwan 7348b9b08d remove gcc warnings [-Wunused-but-set-variable] in network/psnet2.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9904 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:32 +10:00
niffiwan 2fe56e6780 Coverity 1093639: fix out of bounds access (ip_addr.sin_addr with proto TCP)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9903 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan e991f7b3ac remove gcc warnings [-Wshadow] in mission/missionlog.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9902 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan 14058b834d Coverity 1093641: fix out of bounds write (Log_line_timestamps[Num_log_lines])
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9901 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan a7c074e5c3 Coverity 1093645 (out of bounds read): fix 2nd case & correct previous "fix"
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9900 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Echelon9 d0d932fb43 Fix Coverity 1093773: Uninitialized scalar variable - hostaddr.sin_zero
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9899 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan a2b7935a15 remove gcc warnings [-Wunused-but-set-variable] in fs2netd/fs2netd_client.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9898 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan 02afed1d78 Coverity: more out-of-bounds fixes
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9897 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 2f573aeb29 fix ship sounds when in observer mode (bug was introduced in revision 7923)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9896 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 26f8b5fed1 make collider_pair an actual class since its constructor is called by hash_map
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9891 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 9e8356b72c setting to 0 is better because -1 triggers an Int3() on the first swarm entry
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9890 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan e68d8097cd Fix waaay too short char * var for hostname
(this was a buffer overrun for every fs2netd game until coverity complained)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9889 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 5531c0d6b4 resolve issues with ship-templates and memcpy by deprecating ship-copy
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9888 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
niffiwan 0c4c9ec9c9 Fix mantis 2906
reset stats in Pilot (i.e. .plr) on new pilot create/clone

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9887 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 3e3714fb8d fix declaration
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9886 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 0f1971c5aa change the ship struct to a class, and remove use of memcpy and memset for setting/copying the entire ship class
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9885 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:31 +10:00
Goober5000 bdc0767bb0 change strcpy to strcpy_s (left over from r9832)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9884 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
Goober5000 d3e0a2b904 improved error messaging for icons.tbl
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9883 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
Echelon9 96e2f96f1a Fix Coverity 1093931 and 1093932: Missing varargs init or cleanup
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9882 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
Echelon9 4d63d6ea05 Fix Coverity 1093734: Copy into fixed size buffer
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9881 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
z64555 ee1711ed0b Fixed spelling error with 2 filenames. Updated MSVC project and filters to reflect previous changes with filenames.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9880 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan b26ec341bd Coverity: more out-of-bounds errors (& fix mistakes in previous "fixes")
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9879 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan 1861195702 add .gitignore file :D
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9878 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan 576baed1d3 add Coverity modeling file
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9877 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan 019c18fab4 Coverity: fix some out-of-bounds access/read/write issues
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9876 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan d7cc54b324 Change Assert -> Assertion (plus removed some trailing whitespace)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9875 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan 910d4bd293 Coverity: fix some out-of-bounds access issues
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9874 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:30 +10:00
niffiwan 5f0351c72b Coverity: buffer not null terminated issues
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9873 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
niffiwan 7e1ad3dd5b Coverity: potential array out of bounds read in ade_set_object_with_breed
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9872 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
niffiwan a02b97b25a remove GCC warnings in lua.cpp [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9871 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
z64555 f44356a4c5 Looks like I missed 2 files for renaming.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9870 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
z64555 63df481478 Compliance modifications. EOL to Unix style (LF only), files renamed to only lowercase
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9869 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
zookeeper f1d0d36647 Port r9734 from zookeeper branch: Added scripting function to enable/disable tips of the day in mainhall.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9868 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
zookeeper 40af858593 Port r9823 from zookeeper branch: Added an option to make pitch and yaw axes be determined by eyepoint orientation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9867 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:29 +10:00
zookeeper ad1c2f0ecd Port r9738 from zookeeper branch: Forgot this from r9728; makes changing eyepoint orientation affect chase view as well.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9866 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
zookeeper e8a15e7b22 Port r9728 from zookeeper branch: Made eyepoints match the orientation of their parent submodel.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9865 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
zookeeper f164e30b0b Port r9725 from zookeeper branch: Added a Lua function for drawing offscreen indicators. Includes refactoring of some of HudGaugeOffscreen gauge code to separate the position finding and drawing logic.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9864 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
niffiwan a2ac3497b8 (redo 9781) remove GCC warnings in sexp.cpp [-Wunused-but-set-variable]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9863 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
niffiwan 5135771062 Update ChangeLog, 1st time since 2002...
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9862 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
CommanderDJ 5022356faa Fix a couple of typos.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9861 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
Goober5000 55c2f4b156 well crap, looks like I broke XSTR in r9809
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9859 387891d4-d844-0410-90c0-e4c51a9137d3
2013-10-07 20:02:28 +10:00
niffiwan 7adf66330d Coverity CID 1093820: read of uninitialised var in beam_render_muzzle_glow(beam *b)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9858 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:23 +10:00
niffiwan 8b78abd7a6 Coverity CID 1093930: read from pointer after free in GUIScreen::Add(GUIObject* new_gauge)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9857 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:23 +10:00
niffiwan 5ec75bdd06 Coverity CID 1093821: use of an uninitialised variable in ship_select_blit_ship_info()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9856 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:23 +10:00
z64555 79415c262a Fixes mantis 2925 and 2926. Errors with declaring wxFlexGridSizer item sizes in wxFormBuilder.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9855 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:23 +10:00
Goober5000 3e4eca4104 reintegrate Goober5000 branch into trunk: adds STLport support and fixes MSVC6 compatibility with SCP_hash_map (part 2)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9854 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:23 +10:00
Goober5000 82fbd9a7c1 reintegrate Goober5000 branch into trunk: adds STLport support and fixes MSVC6 compatibility with SCP_hash_map (part 1)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9853 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
Goober5000 67b171612d proper class/struct distinction and use of vector over list are A-1 SUPAR
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9851 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
Goober5000 69e1d4e36b the adjustment should be fixed this way, since most people don't count from 0 to n-1
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9846 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
The_E 52381d05db Small adjustment to the error message here to minimize confusion
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9844 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
The_E 16e60920cf Changes an Assert to an Assertion in order to provide better feedback in case stuff_int_list fails due to too many entries in the passed list of integers
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9843 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
niffiwan 62d06cfcd9 Coverity multiple CID: fix potential not null terminated strings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9842 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:22 +10:00
niffiwan ece9b2034b Coverity CID 1093804: init member raw8 of color struct
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9841 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-29 22:12:21 +10:00
niffiwan 05a298c68d Coverity CID 1099443: fix out of bounds access
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9840 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:24 +10:00
Goober5000 8a72823839 turn hud_anim back into an actual struct
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9834 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
Goober5000 c7f6394d6c polymodel code now has basic class management in place and no longer uses memset
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9833 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
Goober5000 8e096f5c15 remove bad use of memcpy by assigning player class using an actual assign() method (part 2)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9832 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
Goober5000 52edd5b112 remove bad use of memcpy by assigning player class using an actual assign() method
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9831 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
Goober5000 52e9c4a8e0 allow fade-in and fade-out with any color, not just black, white, and red
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9830 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
z64555 5c0a97db80 Allows compiling of wxFred2 on *Nix machines. Includes niffiwan's autocools, fixes some referencing issues with button graphics, and includes graphics for the program and application icons.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9829 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-28 11:47:23 +10:00
niffiwan cebded3acb Tweak autotools compilation
Add -pipe to potentially speed up compiles
Change -mtune to generic to clarify intent
(people compiling executables for their own use (i.e. not for distribution)
should set CXXFLAGS="-march=native" before running autogen.sh)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9824 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:36 +10:00
Goober5000 7e5b2aee52 turn mc_info into a plain data struct, part 2
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9822 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:36 +10:00
Goober5000 4a9d457154 turn mc_info back into a plain data struct, part 1
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9821 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 c46c0d1412 derp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9820 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 444d4b801a make engine_wash_info a struct again
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9819 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 2ee1b24b65 queued_animation uses a mess of memcpy and memset, so make sure it's a plain struct!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9818 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 fe934190ac clarify that some structs should now be treated as classes change shockwave_create_info back to being a struct fix some missing shockwave_create_info initialization
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9817 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 b4cc5d72f4 use an index rather than an iterator into the waypoint list so that ai_info is again a plain old data object
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9816 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Echelon9 e7cbe63a08 Resovle a few const char build errors for non-Windows platforms
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9815 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 f0830b6d64 scoring_level_init is only supposed to initialize a subset of the stats
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9814 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Goober5000 7248acc004 use a copy method rather than memcpy to clone stats (Mantis #2922)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9813 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:35 +10:00
Swifty 4a1e2cb4c5 From Kobrar: Make sure we normalize when normal mapping is off.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9812 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
Goober5000 fc191a40f2 whoops
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9811 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
Goober5000 97e18cd758 various fixes for pilotfile stats
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9810 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
Goober5000 4bd10888ff make localization more robust with additional checks on string length, more consting, and stronger typing and make XSTR const, since we don't want to modify the strings it translates and then CONST ALL THE THINGS
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9809 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
chief1983 d8e4b8de55 Add profiling.cpp to the Makefile.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9808 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
chief1983 d1ac95963f Add profiling file to Xcode projects, and remove the wxfred2 files from their code.lib targets.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9807 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:34 +10:00
The_E e2281c39cb Adds Swifty's frame profiling code. In order to activate it, use the -profile_frame_time commandline parameter. ATTENTION PLATFORM MAINTAINERS:
This adds a new file to the source tree named profiling.cpp, add this to the respective project files (I've already done it for the various MSVS projects)

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9806 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:33 +10:00
Goober5000 2e779e8bef MOAR const!
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9805 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:33 +10:00
Goober5000 38ae06e97d derp... apply consting to FRED
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9804 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:33 +10:00
The_E 3f6f498340 Fix a function call that got broken in all the consting.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9803 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-26 18:51:33 +10:00
Goober5000 8cf10e86f8 remove Bobboau's "better error messages" which were never fully implemented and are more distracting than helpful
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9802 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:46:41 +10:00
Goober5000 886018d28f here a const, there a const, everywhere a const const
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9801 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:46:41 +10:00
Goober5000 0dfcea3b22 make MAX_MEDALS dynamic (missed a file)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9800 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:27:08 +10:00
Goober5000 7f90f5c674 make MAX_MEDALS dynamic
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9799 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:27:03 +10:00
Goober5000 fcf6d56774 fix tech-add-intel-xstr to actually localize from tstrings.tbl (Mantis #2919)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9798 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
Goober5000 ebe1043a13 add tech-add-intel-xstr, and modify intel_info_lookup to properly translate intel entries (fixes Mantis #2919)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9797 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
chief1983 cc0caf5e55 The last remaining code change (I think) blocking Solaris compatibility.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9796 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
The_E c0919e0777 Admiral MS' AI flag to enable the AI to be smarter when using afterburners. flag name is "free-afterburner-use". See http://www.hard-light.net/forums/index.php?topic=83818.0 for reference
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9795 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
zookeeper d993c3e1f5 Merge auto spread shields from zookeeper branch.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9794 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
zookeeper 46ad62f831 Clarified a warning about missing glowpoint textures.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9791 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:19 +10:00
Goober5000 b3798527a0 allow medals.tbl to specify images for debriefing views of medals, not just medal case views
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9789 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:18 +10:00
The_E 81c5c06218 Experimental Configurations to make AVX builds
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9788 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-20 19:23:18 +10:00
Goober5000 6d6c82c652 make localization names consistent, and move medal localization into localize.cpp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9787 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:33 +10:00
niffiwan e19e9d1afd Allow the use of __attribute__ (GCC specific syntax) In particular, __attribute__((__unused__)) to shush compiler warning -Wunused-but-set-variable
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9786 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:33 +10:00
z64555 32bd62bc18 wxFred2: whoops, forgot some resource files
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9785 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:32 +10:00
z64555 ec02c3c972 wxFred progress: GUI elements designed, organized code/wxfred2, work begun on main fred viewport.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9784 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:32 +10:00
Goober5000 138e6b853f yeesh... a veritable cascade of const-correctness
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9783 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:32 +10:00
chief1983 0a1379159d Revert r9781 until it can be implemented without breaking MSVC.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9782 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:32 +10:00
niffiwan 809ee2483d remove GCC warnings in sexp.cpp [-Wunused-but-set-variable]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9781 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:32 +10:00
niffiwan 9a602777bd Fix mantis 2911: stop (de)activate-glow-point-bank sexp from processing the 1st arg twice
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9780 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
The_E 41af7e5ec0 Project files vor MSVS 2013. Please note that in order to build FRED, you need to install the Multibyte MFC library from http://www.microsoft.com/en-us/download/confirmation.aspx?id=39309
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9779 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
niffiwan 5a6493fa62 remove GCC warnings in sexp.cpp [-Wshadow]
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9778 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
zookeeper 143463b478 Port r9723 from zookeeper branch to trunk: Made is-facing able to check for target objects other than ships.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9777 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
zookeeper f98030b122 Port r9705 from zookeeper branch to trunk: Exposed a ship's autoaim FOV to Lua and allowed $Autoaim FOV to take floats rather than just ints.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9776 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
zookeeper fd21b9054b Port r9701 from zookeeper branch to trunk: Added a Lua function to check whether a ship is warp-capable.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9775 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 d5f03daa6b spelling, hehe
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9774 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 96587dd2ab allow specification of medal, callsign, and label coordinates
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9773 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 0debee3c51 pretty sure this needs to be 0, per line 325
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9772 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 3550b720cb remove requirement that game_settings.tbl should specify a campaign filename with an extension
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9771 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 42d096a3c2 allow a user-specified number of credit images
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9770 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 a921665872 add missing newline
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9769 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:31 +10:00
Goober5000 52413c944f what's this? a Volition bug?
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9768 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:30 +10:00
karajorma 602e608065 Fix Mantis 2883 (All the 1's have vanished since r9761)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9767 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-13 20:18:30 +10:00
The_E 06900df8df As requested by Axem, adds "player-is-cheating" sexp
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9766 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
chief1983 6c88f96cc0 Bump version to 3.7.1 for nightlies.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9765 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
niffiwan 7fad36e90c Fix for mantis 2907: In red alert missions that skip briefings, use the red alert "continue" button, not the ship/weapon select "commit" button.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9764 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
niffiwan 3d1edee29a Fix for mantis 2878: LUA playMusic uses players music volume, not the requested volume
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9763 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
karajorma 0b0b3fdf70 Allow event.log to snapshot all events that are checked this frame. Allow event.log to record the status of the event the previous time it was checked in addition to its status this frame.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9762 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
karajorma 2691085f9f Add support for other languages beyond French, German and Polish. Any non-unicode language should work now.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9761 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
karajorma 800602701a Add alter-ship-flag support for several more flags
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9760 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
karajorma 18ca1c08db Add the toggle-subsystem-scanning option to the alter-ship-flag SEXP
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9759 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:26 +10:00
Goober5000 8f7320119e show-subtitle-text will now display subtitles from a message
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9758 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
Goober5000 d7fc8372aa Number 3 from Axem's "A triplet of small patches", http://www.hard-light.net/forums/index.php?topic=82749.0
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9757 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
karajorma f38b90f431 Fix Mantis Mantis 2913 (Time Compression SEXPs do not work in multiplayer)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9756 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
karajorma c251c031f0 Fix Mantis 2903 (Spinners in the Object Editor point in the wrong direction).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9753 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
The_E 7b53a46e88 From m|m: Fix for Mantis 2914 (AmmoLeft and AmmoMax return strange things in scripting)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9752 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
chief1983 5b7c056cb1 Revert 9749 until after 3.7.0.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9751 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
karajorma 53d0129e8f Fix Mantis 2912 (Hud-set-max-targeting-range doesn't work on multiplayer clients).
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9750 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
The_E 6524a2140f As requested by Aesaar, raise the per-model debris limit to 48 (previously 32). Also increases the per-frame debris limit to 96 (previously 64)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9749 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
z64555 134b0dd757 fix for mantis 2874: Pilot conversion not preserving axis mappings. Also adds a warning that is activated whenever the pilot loading process has to skip bytes of "extra/unknown data" in a section.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9748 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
niffiwan 315373e952 Fix mantis 2908: finally get "richer" pilot conversion exceptions data working correctly THANK YOU Tony D @stackoverflow! http://stackoverflow.com/questions/6248404/c-exceptions-is-throwing-c-string-as-an-exception-bad
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9747 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
niffiwan 99ef01ff6d Fix 3 for 2901: remove long/short read warning by making mainhall(csg flags), cutscenes(csg flags) & is_multi(plr flags) consistent between pilot conversion and normal save/loads
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9746 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
niffiwan d619d86976 Fix 2 for mantis 2901: 7 weapon slots (not 12) for pilot conversions
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9745 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
niffiwan d60a930dc2 2808 accidentally clobbered 2810: change 3.6.18 last played pilot name before loading the pilot for the 1st time
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9744 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
The_E 4eb1787e4e Fix for Mantis 2898: Reverting r8627 to reinstate -img2dds
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9742 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
Echelon9 0f7d8ec579 Fix Mantis 2847: Assert: (team != -1) -- due to aicode issues tracking destroyed weapons
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9741 387891d4-d844-0410-90c0-e4c51a9137d3
2013-09-03 21:01:25 +10:00
niffiwan 878a7a1921 Fix for mantis 2904: redalert wingmen without RA data are treated as destroyed
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9740 387891d4-d844-0410-90c0-e4c51a9137d3
2013-08-06 22:55:15 +10:00
niffiwan 12de1de128 Fix MSVC warning (int to char conversion): thanks to zookeeper for noticing this
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9739 387891d4-d844-0410-90c0-e4c51a9137d3
2013-08-06 22:55:15 +10:00
zookeeper cf4fa30f0f Fixed bug in RotationalVelocityDesired documentation.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9737 387891d4-d844-0410-90c0-e4c51a9137d3
2013-08-06 22:55:14 +10:00
Echelon9 fb33fe020b Resolve a series of Xcode (LLVM compiler) warnings
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9735 387891d4-d844-0410-90c0-e4c51a9137d3
2013-08-06 22:55:14 +10:00
niffiwan 59762a4db7 add some red alert doco
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9733 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:31 +10:00
niffiwan d4d10dedd9 add more data to pilot (csg) conversion error messages
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9732 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:31 +10:00
Echelon9 e776f8e5dd Fix issue where switch statement would fall through for TS_MOVE_PLAYER, which would then not get pushed to other hosts
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9731 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
niffiwan f8a74ae5c9 Partial fix for 2901: pilot conversion needs to read the ubyte mainhall from <= 3.6.18
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9730 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
m_m f410440604 Fix for Mantis 2884: Team colors not displayed on player ship.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9720 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
The_E bccd0533bd Removes a console command that basically amounted to being a more elaborate way of causing an Int3()
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9719 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
The_E c6397750e0 Fix for Mantis 2861: Make sure we switch off shader-based effect rendering if the GPU can't handle it
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9718 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Goober5000 f5f42f65fa this is required for strict const-correctness
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9715 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Goober5000 ce118c232c add a missing #include
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9714 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Goober5000 509f509347 MSVC6 compatibility
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9710 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Goober5000 bda6c72d31 remove an unused function, per Echelon9's detective work (Mantis #2900)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9709 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Goober5000 b5f278c91c a modified version of Echelon9's fix for Mantis #2897 (heap corruption due to object indexes being too large for the object dock bitstring)
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9708 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
Echelon9 17c7d0be26 Documentation cleanup of object.cpp pursuant to Mantis 2897 bug-hunting.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9706 387891d4-d844-0410-90c0-e4c51a9137d3
2013-07-26 08:14:30 +10:00
83 changed files with 5762 additions and 5247 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
root = true
[*.{h,cpp}]
indent_style = tab
+18
View File
@@ -0,0 +1,18 @@
[![Coverity](https://scan.coverity.com/projects/870/badge.svg)](https://scan.coverity.com/projects/870)
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
+416 -413
View File
@@ -69,454 +69,457 @@ 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);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive start speed multiplier:")) {
stuff_float(&profile->bay_arrive_speed_mult);
}
if (optional_string("$bay depart end speed multiplier:")) {
stuff_float(&profile->bay_depart_speed_mult);
}
// ----------
// 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);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive start speed multiplier:")) {
stuff_float(&profile->bay_arrive_speed_mult);
}
if (optional_string("$bay depart end 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 -7
View File
@@ -826,13 +826,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;
+3 -2
View File
@@ -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]];
@@ -528,7 +528,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 +537,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;
+124 -119
View File
@@ -1887,143 +1887,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, 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((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 = %d*%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;
}
}
+58 -57
View File
@@ -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");
}
+24 -21
View File
@@ -1043,7 +1043,7 @@ int bm_load(const SCP_string& filename) {
}
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir) {
int frames = 0, fps = 30, keyframe = 0, rval;
int frames = 0, fps = 30, keyframe = 0;
bool subdir = false;
char ext[8];
ubyte c_type = BM_TYPE_NONE;
@@ -1057,28 +1057,31 @@ int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
// pause anything that may happen to be parsing right now
pause_parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("BMPMAN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
try
{
// now start parsing the EFF
read_file_text(filename, dir_type, file_text, file_text_raw);
reset_parse(file_text);
required_string("$Type:");
stuff_string(ext, F_NAME, sizeof(ext));
required_string("$Frames:");
stuff_int(&frames);
if (optional_string("$FPS:"))
stuff_int(&fps);
if (optional_string("$Keyframe:"))
stuff_int(&keyframe);
}
catch (const parse::ParseException& e)
{
mprintf(("BMPMAN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
unpause_parse();
return -1;
}
// now start parsing the EFF
read_file_text(filename, dir_type, file_text, file_text_raw);
reset_parse(file_text);
required_string("$Type:");
stuff_string(ext, F_NAME, sizeof(ext));
required_string("$Frames:");
stuff_int(&frames);
if (optional_string("$FPS:"))
stuff_int(&fps);
if (optional_string("$Keyframe:"))
stuff_int(&keyframe);
if (optional_string( "$Subdir:" )) {
stuff_boolean(&subdir);}
@@ -2170,10 +2173,10 @@ void bm_page_in_stop() {
if ((bm_bitmaps[i].type != BM_TYPE_NONE) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_DYNAMIC) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_STATIC)) {
if (bm_bitmaps[i].preloaded) {
if (bm_preloading) {
if (bm_bitmaps[i].type == BM_TYPE_EFF && bm_bitmaps[i].info.ani.eff.in_subdir) {
if (bm_bitmaps[i].type == BM_TYPE_EFF && bm_bitmaps[i].info.ani.eff.in_subdir) {
set_temp_subdir_pathtype(bm_bitmaps[i].filename);
}
if (!gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded == 2))) {
mprintf(("Out of VRAM. Done preloading.\n"));
bm_preloading = 0;
+8 -1
View File
@@ -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
+1 -1
View File
@@ -502,7 +502,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
+52 -50
View File
@@ -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
+82 -73
View File
@@ -159,84 +159,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()
+49 -46
View File
@@ -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()
+220 -220
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -1259,7 +1259,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 __attribute__((__unused__)) = game_busy_callback( NULL );
Mouse_hidden = 0;
Game_loading_callback_inited = 0;
@@ -1423,7 +1423,7 @@ int game_start_mission()
{
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
int s1 = timer_get_milliseconds();
int s1 __attribute__((__unused__)) = timer_get_milliseconds();
// clear post processing settings
gr_post_process_set_defaults();
@@ -1480,7 +1480,7 @@ int game_start_mission()
bm_print_bitmaps();
int e1 = timer_get_milliseconds();
int e1 __attribute__((__unused__)) = timer_get_milliseconds();
mprintf(("Level load took %f seconds.\n", (e1 - s1) / 1000.0f ));
@@ -1739,7 +1739,7 @@ char full_path[1024];
*/
void game_init()
{
int s1, e1;
int s1 __attribute__((__unused__)), e1 __attribute__((__unused__));
const char *ptr;
char whee[MAX_PATH_LEN];
+151 -145
View File
@@ -323,7 +323,7 @@ void parse_helptbl(const char *filename)
int overlay_id, currcount, vtxcount;
char name[HELP_MAX_NAME_LENGTH];
char buf[HELP_MAX_STRING_LENGTH + 1];
int i, j, rval;
int i, j;
SCP_vector<help_pline> pline_temp;
help_pline pline_temp2;
@@ -335,160 +335,166 @@ void parse_helptbl(const char *filename)
help_left_bracket lbracket_temp2;
vec3d vec3d_temp;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// for each overlay...
while (optional_string("$")) {
// for each overlay...
while (optional_string("$")) {
stuff_string(name, F_NAME, HELP_MAX_NAME_LENGTH);
stuff_string(name, F_NAME, HELP_MAX_NAME_LENGTH);
overlay_id = help_overlay_get_index(name);
overlay_id = help_overlay_get_index(name);
if (overlay_id < 0) {
if (num_help_overlays >= MAX_HELP_OVERLAYS) {
Warning(LOCATION, "Could not load help overlay after '%s' as maximum number of help overlays was reached (Max is %d)", help_overlaylist[overlay_id - 1].name, MAX_HELP_OVERLAYS);
if (overlay_id < 0) {
if (num_help_overlays >= MAX_HELP_OVERLAYS) {
Warning(LOCATION, "Could not load help overlay after '%s' as maximum number of help overlays was reached (Max is %d)", help_overlaylist[overlay_id - 1].name, MAX_HELP_OVERLAYS);
if (!skip_to_string("$end")) {
Error(LOCATION, "Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
}
continue;
} else {
overlay_id = num_help_overlays;
strcpy_s(help_overlaylist[overlay_id].name, name);
num_help_overlays++;
}
}
// clear out counters in the overlay struct
help_overlaylist[overlay_id].plinecount = 0;
help_overlaylist[overlay_id].textcount = 0;
help_overlaylist[overlay_id].rbracketcount = 0;
help_overlaylist[overlay_id].lbracketcount = 0;
help_overlaylist[overlay_id].fontlist.clear();
help_overlaylist[overlay_id].plinelist.clear();
help_overlaylist[overlay_id].textlist.clear();
help_overlaylist[overlay_id].rbracketlist.clear();
help_overlaylist[overlay_id].lbracketlist.clear();
if (optional_string("+resolutions")) {
stuff_int(&help_overlaylist[overlay_id].num_resolutions);
} else {
help_overlaylist[overlay_id].num_resolutions = 2;
}
if (help_overlaylist[overlay_id].num_resolutions < 1) {
Error(LOCATION, "+resolutions in %s is %d. (Must be 1 or greater)", filename, help_overlaylist[overlay_id].num_resolutions);
}
if (optional_string("+font")) {
int font;
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
stuff_int(&font);
help_overlaylist[overlay_id].fontlist.push_back(font);
}
} else {
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].fontlist.push_back(FONT1);
}
}
for (i=0; i<help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].plinelist.push_back(pline_temp);
help_overlaylist[overlay_id].textlist.push_back(text_temp);
help_overlaylist[overlay_id].rbracketlist.push_back(rbracket_temp);
help_overlaylist[overlay_id].lbracketlist.push_back(lbracket_temp);
}
int type;
// read in all elements for this overlay
while ((type = required_string_one_of(5, "+pline", "+text", "+right_bracket", "+left_bracket", "$end")) != 4) { // Doing it this way means an error lists "$end" at the end, which seems appropriate. -MageKing17
switch (type) {
case 0: // +pline
required_string("+pline");
currcount = help_overlaylist[overlay_id].plinecount;
int a, b; // temp vars to read in int before cast to float;
// read number of pline vertices
stuff_int(&vtxcount);
// get vertex coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].plinelist.at(i).push_back(pline_temp2);
for (j = 0; j < vtxcount; j++) {
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.push_back(vec3d_temp);
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtxcount = vtxcount;
stuff_int(&a);
stuff_int(&b);
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.x = (float)a;
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.y = (float)b;
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.z = 0.0f;
if (!skip_to_string("$end")) {
Error(LOCATION, "Couldn't find $end. Help.tbl or -hlp.tbm is invalid.\n");
}
continue;
}
help_overlaylist[overlay_id].plinecount++;
break;
case 1: // +text
required_string("+text");
currcount = help_overlaylist[overlay_id].textcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].textlist.at(i).push_back(text_temp2);
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).y_coord));
else {
overlay_id = num_help_overlays;
strcpy_s(help_overlaylist[overlay_id].name, name);
num_help_overlays++;
}
// get string (always use the first resolution)
stuff_string(buf, F_MESSAGE, sizeof(buf));
help_overlaylist[overlay_id].textlist.at(0).at(currcount).string = vm_strdup(buf);
help_overlaylist[overlay_id].textcount++;
break;
case 2: // +right_bracket
required_string("+right_bracket");
currcount = help_overlaylist[overlay_id].rbracketcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].rbracketlist.at(i).push_back(rbracket_temp2);
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).y_coord));
}
help_overlaylist[overlay_id].rbracketcount++;
break;
case 3: // +left_bracket
required_string("+left_bracket");
currcount = help_overlaylist[overlay_id].lbracketcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].lbracketlist.at(i).push_back(lbracket_temp2);
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).y_coord));
}
help_overlaylist[overlay_id].lbracketcount++;
break;
case -1:
// -noparseerrors is set
break;
case 4: // $end
default:
Assertion(false, "This should never happen.\n");
break;
}
// clear out counters in the overlay struct
help_overlaylist[overlay_id].plinecount = 0;
help_overlaylist[overlay_id].textcount = 0;
help_overlaylist[overlay_id].rbracketcount = 0;
help_overlaylist[overlay_id].lbracketcount = 0;
help_overlaylist[overlay_id].fontlist.clear();
help_overlaylist[overlay_id].plinelist.clear();
help_overlaylist[overlay_id].textlist.clear();
help_overlaylist[overlay_id].rbracketlist.clear();
help_overlaylist[overlay_id].lbracketlist.clear();
if (optional_string("+resolutions")) {
stuff_int(&help_overlaylist[overlay_id].num_resolutions);
}
else {
help_overlaylist[overlay_id].num_resolutions = 2;
}
if (help_overlaylist[overlay_id].num_resolutions < 1) {
Error(LOCATION, "+resolutions in %s is %d. (Must be 1 or greater)", filename, help_overlaylist[overlay_id].num_resolutions);
}
if (optional_string("+font")) {
int font;
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
stuff_int(&font);
help_overlaylist[overlay_id].fontlist.push_back(font);
}
}
else {
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].fontlist.push_back(FONT1);
}
}
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].plinelist.push_back(pline_temp);
help_overlaylist[overlay_id].textlist.push_back(text_temp);
help_overlaylist[overlay_id].rbracketlist.push_back(rbracket_temp);
help_overlaylist[overlay_id].lbracketlist.push_back(lbracket_temp);
}
int type;
// read in all elements for this overlay
while ((type = required_string_one_of(5, "+pline", "+text", "+right_bracket", "+left_bracket", "$end")) != 4) { // Doing it this way means an error lists "$end" at the end, which seems appropriate. -MageKing17
switch (type) {
case 0: // +pline
required_string("+pline");
currcount = help_overlaylist[overlay_id].plinecount;
int a, b; // temp vars to read in int before cast to float;
// read number of pline vertices
stuff_int(&vtxcount);
// get vertex coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].plinelist.at(i).push_back(pline_temp2);
for (j = 0; j < vtxcount; j++) {
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.push_back(vec3d_temp);
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtxcount = vtxcount;
stuff_int(&a);
stuff_int(&b);
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.x = (float)a;
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.y = (float)b;
help_overlaylist[overlay_id].plinelist.at(i).at(currcount).vtx.at(j).xyz.z = 0.0f;
}
}
help_overlaylist[overlay_id].plinecount++;
break;
case 1: // +text
required_string("+text");
currcount = help_overlaylist[overlay_id].textcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].textlist.at(i).push_back(text_temp2);
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].textlist.at(i).at(currcount).y_coord));
}
// get string (always use the first resolution)
stuff_string(buf, F_MESSAGE, sizeof(buf));
help_overlaylist[overlay_id].textlist.at(0).at(currcount).string = vm_strdup(buf);
help_overlaylist[overlay_id].textcount++;
break;
case 2: // +right_bracket
required_string("+right_bracket");
currcount = help_overlaylist[overlay_id].rbracketcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].rbracketlist.at(i).push_back(rbracket_temp2);
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].rbracketlist.at(i).at(currcount).y_coord));
}
help_overlaylist[overlay_id].rbracketcount++;
break;
case 3: // +left_bracket
required_string("+left_bracket");
currcount = help_overlaylist[overlay_id].lbracketcount;
// get coordinates for each resolution
for (i = 0; i < help_overlaylist[overlay_id].num_resolutions; i++) {
help_overlaylist[overlay_id].lbracketlist.at(i).push_back(lbracket_temp2);
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).x_coord));
stuff_int(&(help_overlaylist[overlay_id].lbracketlist.at(i).at(currcount).y_coord));
}
help_overlaylist[overlay_id].lbracketcount++;
break;
case -1:
// -noparseerrors is set
break;
case 4: // $end
default:
Assertion(false, "This should never happen.\n");
break;
}
} // end while
required_string("$end");
} // end while
required_string("$end");
} // end while
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
+8 -8
View File
@@ -593,7 +593,7 @@ void event_music_level_init(int force_soundtrack)
{
if (!strnicmp(strack->pattern_fnames[i], NOX("none.wav"), 4))
{
Patterns[i].handle = -1;
Patterns[i].handle = -1;
continue;
}
@@ -1373,14 +1373,10 @@ void parse_menumusic()
//
void event_music_parse_musictbl(const char *filename)
{
int rval;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
} else {
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
reset_parse();
while ( skip_to_start_of_string_either("#Soundtrack Start", "#Menu Music Start", NULL ) )
{
@@ -1398,6 +1394,10 @@ void event_music_parse_musictbl(const char *filename)
}
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
}
}
// -------------------------------------------------------------------------------------------------
+74 -74
View File
@@ -693,83 +693,83 @@ static SCP_vector<species_info> missingFlybySounds;
void parse_sound_table(const char* filename)
{
int rval;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// Parse the gameplay sounds section
if (optional_string("#Game Sounds Start"))
{
while (!check_for_string("#Game Sounds End"))
{
game_snd tempSound;
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds))
{
Snds.push_back(game_snd(tempSound));
}
}
required_string("#Game Sounds End");
}
// Parse the interface sounds section
if (optional_string("#Interface Sounds Start"))
{
while (!check_for_string("#Interface Sounds End"))
{
game_snd tempSound;
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds_iface))
{
Snds_iface.push_back(game_snd(tempSound));
Snds_iface_handle.push_back(-1);
}
}
required_string("#Interface Sounds End");
}
// parse flyby sound section
if (optional_string("#Flyby Sounds Start"))
{
char species_name_tag[NAME_LENGTH + 2];
int sanity_check = 0;
size_t i;
while (!check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()))
{
for (i = 0; i < Species_info.size(); i++)
{
species_info *species = &Species_info[i];
sprintf(species_name_tag, "$%s:", species->species_name);
if (check_for_string(species_name_tag))
{
gamesnd_parse_line(&species->snd_flyby_fighter, species_name_tag);
gamesnd_parse_line(&species->snd_flyby_bomber, species_name_tag);
sanity_check--;
}
else
{
sanity_check++;
}
}
}
required_string("#Flyby Sounds End");
}
if (optional_string("#Sound Environments Start"))
{
parse_sound_environments();
}
}
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();
// Parse the gameplay sounds section
if (optional_string("#Game Sounds Start"))
{
while (!check_for_string("#Game Sounds End"))
{
game_snd tempSound;
if (gamesnd_parse_line(&tempSound, "$Name:", &Snds))
{
Snds.push_back(game_snd(tempSound));
}
}
required_string("#Game Sounds End");
}
// Parse the interface sounds section
if (optional_string("#Interface Sounds Start"))
{
while (!check_for_string("#Interface Sounds End"))
{
game_snd tempSound;
if (gamesnd_parse_line( &tempSound, "$Name:", &Snds_iface))
{
Snds_iface.push_back(game_snd(tempSound));
Snds_iface_handle.push_back(-1);
}
}
required_string("#Interface Sounds End");
}
// parse flyby sound section
if (optional_string("#Flyby Sounds Start"))
{
char species_name_tag[NAME_LENGTH + 2];
int sanity_check = 0;
size_t i;
while (!check_for_string("#Flyby Sounds End") && (sanity_check <= (int)Species_info.size()))
{
for (i = 0; i < Species_info.size(); i++)
{
species_info *species = &Species_info[i];
sprintf(species_name_tag, "$%s:", species->species_name);
if (check_for_string(species_name_tag))
{
gamesnd_parse_line(&species->snd_flyby_fighter, species_name_tag);
gamesnd_parse_line(&species->snd_flyby_bomber, species_name_tag);
sanity_check--;
}
else
{
sanity_check++;
}
}
}
required_string("#Flyby Sounds End");
}
if (optional_string("#Sound Environments Start"))
{
parse_sound_environments();
}
}
/**
+320 -308
View File
@@ -273,71 +273,74 @@ void parse_colors(const char *filename)
{
Assertion(filename != NULL, "parse_colors() called on NULL; get a coder!\n");
read_file_text(filename, CF_TYPE_TABLES);
int err_code;
if ((err_code = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %d.\n", filename, err_code));
return;
}
reset_parse();
// we search for the colors based on their order of definition above
// if the color isn't found, we just use default values
if (optional_string("#Start Colors"))
try
{
// vars for holding rgba values
int rgba[4] = {0,0,0,0};
int i, j;
reset_parse();
char* color_names[TOTAL_COLORS] = {
"$Blue:",
"$Bright Blue:",
"$Green:",
"$Bright Green:",
"$Black:",
"$Grey:",
"$Silver:",
"$White:",
"$Bright White:",
"$Violet Gray:",
"$Violet:",
"$Dim Red:",
"$Red:",
"$Bright Red:",
"$Pink:",
"$Light Pink:",
"$Yellow:",
"$Bright Yellow:",
"$UI Light Green:",
"$UI Green:",
"$UI Light Pink:",
"$UI Pink:"
};
// we search for the colors based on their order of definition above
// if the color isn't found, we just use default values
if (optional_string("#Start Colors"))
{
// vars for holding rgba values
int rgba[4] = { 0, 0, 0, 0 };
int i, j;
// now for each color, check if it's corresponding string is there
for (i = 0; i < TOTAL_COLORS; i++) {
if (optional_string(color_names[i])) {
// if so, get its rgba values and initialise it using them
mprintf(("'%s' has been redefined.\n", color_names[i]));
//if (check_for_string("(")) {
char* color_names[TOTAL_COLORS] = {
"$Blue:",
"$Bright Blue:",
"$Green:",
"$Bright Green:",
"$Black:",
"$Grey:",
"$Silver:",
"$White:",
"$Bright White:",
"$Violet Gray:",
"$Violet:",
"$Dim Red:",
"$Red:",
"$Bright Red:",
"$Pink:",
"$Light Pink:",
"$Yellow:",
"$Bright Yellow:",
"$UI Light Green:",
"$UI Green:",
"$UI Light Pink:",
"$UI Pink:"
};
// now for each color, check if it's corresponding string is there
for (i = 0; i < TOTAL_COLORS; i++) {
if (optional_string(color_names[i])) {
// if so, get its rgba values and initialise it using them
mprintf(("'%s' has been redefined.\n", color_names[i]));
//if (check_for_string("(")) {
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
for (j = 0; j < 4; j++) {
if (rgba[j] < 0) {
Warning(LOCATION, "RGBA value for '%s' in %s too low (%d), capping to 0.\n", color_names[i], filename, rgba[j]);
rgba[j] = 0;
} else if (rgba[j] > 255) {
}
else if (rgba[j] > 255) {
Warning(LOCATION, "RGBA value for '%s' in %s too high (%d), capping to 255.\n", color_names[i], filename, rgba[j]);
rgba[j] = 255;
}
}
//} else {
// stuff_hex_list(rgba, 4);
//}
gr_init_alphacolor(COLOR_LIST[i], rgba[0], rgba[1], rgba[2], rgba[3]);
//} else {
// stuff_hex_list(rgba, 4);
//}
gr_init_alphacolor(COLOR_LIST[i], rgba[0], rgba[1], rgba[2], rgba[3]);
}
}
required_string("#End");
}
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
@@ -346,281 +349,290 @@ void parse_everything_else(const char *filename)
Assertion(filename != NULL, "parse_everything_else() called on NULL; get a coder!\n");
read_file_text(filename, CF_TYPE_TABLES);
int err_code;
if ((err_code = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %d.\n", filename, err_code));
return;
}
try
{
reset_parse();
reset_parse();
int rgba[4] = { 0, 0, 0, 0 };
int rgba[4] = {0,0,0,0};
// reusable temp vars
int i, j;
SCP_string temp;
// reusable temp vars
int i, j;
SCP_string temp;
if (optional_string("#Start Colors")) {
// Skip this section; we already parsed it in every file.
skip_to_string("#End", NULL);
}
//Team coloring
if (optional_string("#Team Colors")) {
while (required_string_either("#End", "$Team Name:")) {
required_string("$Team Name:"); // required to move the parse pointer forward
team_color temp_color;
char temp2[NAME_LENGTH];
stuff_string(temp2, F_NAME, NAME_LENGTH);
temp = temp2;
if (!stricmp(temp2, "none")) {
Warning(LOCATION, "Team color in '%s' defined with a name of '%s'; this won't be usable due to 'None' being used for a lack of a team color by the engine.\n", filename, temp2);
}
if (required_string("$Team Stripe Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
temp_color.stripe.r = rgb[0] / 255.0f;
temp_color.stripe.g = rgb[1] / 255.0f;
temp_color.stripe.b = rgb[2] / 255.0f;
}
if (required_string("$Team Base Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
temp_color.base.r = rgb[0] / 255.0f;
temp_color.base.g = rgb[1] / 255.0f;
temp_color.base.b = rgb[2] / 255.0f;
}
if (Team_Colors.find(temp) == Team_Colors.end()) { // Only push to the vector if the team isn't already defined.
Team_Names.push_back(temp);
}
Team_Colors[temp] = temp_color;
}
required_string("#End");
}
// Previously-hardcoded interface colors
if (optional_string("#Interface Colors")) {
char *color_names[INTERFACE_COLORS] = {
"$Text Normal:",
"$Text Subselected:",
"$Text Selected:",
"$Text Error:",
"$Text Error Highlighted:",
"$Text Active:",
"$Text Active Highlighted:",
"$Text Heading:",
"$More Indicator:",
"$Bright More Indicator:",
"$Bright:",
"$Normal:",
"$Briefing Grid:",
};
// now for each color, check if its corresponding string is there
for (i = 0; i < INTERFACE_COLORS; i++) {
if (optional_string(color_names[i])) {
// if so, get its rgba values and initialise it using them
mprintf(("'%s' has been redefined.\n", color_names[i]));
if ( check_for_string("(") ) {
// If we have a list of integers, use them.
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
for (j = 0; j < 4; j++) {
if (rgba[j] < 0)
{
Warning(LOCATION, "RGBA value for '%s' in %s too low (%d), capping to 0.\n", color_names[i], filename, rgba[j]);
rgba[j] = 0;
}
else if (rgba[j] > 255)
{
Warning(LOCATION, "RGBA value for '%s' in %s too high (%d), capping to 255.\n", color_names[i], filename, rgba[j]);
rgba[j] = 255;
}
}
gr_init_alphacolor(interface_colors[i], rgba[0], rgba[1], rgba[2], rgba[3]);
//} else if (check_for_string("#")) {
// stuff_hex_list(rgba, 4);
// gr_init_alphacolor(interface_colors[i], rgba[0], rgba[1], rgba[2], rgba[3]);
} else {
// We have a string; it should be the name of a color to use.
stuff_string(temp, F_NAME);
for (j = 0; j < TOTAL_COLORS; j++) {
if ( !temp.compare(COLOR_NAMES[j]) ) {
break;
}
}
if ( j == TOTAL_COLORS ) {
Warning(LOCATION, "Unknown color '%s' in %s, for definition of '%s'; using default ('%s').\n", temp.c_str(), filename, color_names[i], COLOR_NAMES[interface_defaults[i]]);
} else {
Assertion(j >= 0 && j < TOTAL_COLORS, "Attempting to copy nonexistant color (%d out of 0-%d)!\n", j, TOTAL_COLORS-1);
memcpy(interface_colors[i], COLOR_LIST[j], sizeof(color));
}
}
}
}
required_string("#End");
}
// Text color tags; for briefings, command briefings, debriefings, and the fiction viewer
if (optional_string("#Color Tags")) {
while (required_string_either("$Tag:", "#End") < 1) {
required_string("$Tag:");
color temp_color;
char tag;
stuff_string(temp, F_RAW);
if (temp[0] == '$') {
if (temp[1] == '\0') {
Error(LOCATION, "%s - found a '$Tag:' entry with a solitary '$'.\n", filename);
}
tag = temp[1];
if (temp[2] != '\0') {
Warning(LOCATION, "%s - tag '$%c' has extra text in its definition.\n", filename, tag);
}
} else if (temp[0] == '\0') {
Error(LOCATION, "%s - found a '$Tag:' entry with no tag.\n", filename);
} else {
tag = temp[0];
if (temp[1] != '\0') {
Warning(LOCATION, "%s - tag '$%c' has extra text in its definition.\n", filename, tag);
}
}
if (Tagged_Colors.find(tag) == Tagged_Colors.end()) { // Only push the tag to our list of tags if it's actually new, not just a redefinition.
Color_Tags.push_back(tag);
}
switch(required_string_one_of(4, "+Color:", "+Friendly", "+Hostile", "+Neutral")) {
case 0: // +Color
required_string("+Color:");
rgba[0] = rgba[1] = rgba[2] = 0;
rgba[3] = 255; // Odds are pretty high you want it to have full alpha...
if ( check_for_string("(") ) {
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
for (j = 0; j < 4; j++) {
if (rgba[j] < 0)
{
Warning(LOCATION, "RGBA value for '$%c' in %s too low (%d), capping to 0.\n", tag, filename, rgba[j]);
rgba[j] = 0;
}
else if (rgba[j] > 255)
{
Warning(LOCATION, "RGBA value for '$%c' in %s too high (%d), capping to 255.\n", tag, filename, rgba[j]);
rgba[j] = 255;
}
}
gr_init_alphacolor(&temp_color, rgba[0], rgba[1], rgba[2], rgba[3]);
Custom_Colors[tag] = temp_color;
Tagged_Colors[tag] = &Custom_Colors[tag];
//} else if ( check_for_string ("#") ) {
// stuff_hex_list(rgba, 4);
// gr_init_alphacolor(&temp_color, rgba[0], rgba[1], rgba[2], rgba[3]);
// Custom_Colors[tag] = temp_color;
// Tagged_Colors[tag] = &Custom_Colors[tag];
} else {
// We have a string; it should be the name of a color to use.
stuff_string(temp, F_NAME);
for (j = 0; j < TOTAL_COLORS; j++) {
if ( !temp.compare(COLOR_NAMES[j]) ) {
break;
}
}
if ( j == TOTAL_COLORS ) {
Error(LOCATION, "Unknown color '%s' in %s, for definition of tag '$%c'.\n", temp.c_str(), filename, tag);
}
Tagged_Colors[tag] = COLOR_LIST[j];
}
break;
case 1: // +Friendly
required_string("+Friendly");
Tagged_Colors[tag] = &Brief_color_green;
break;
case 2: // +Hostile
required_string("+Hostile");
Tagged_Colors[tag] = &Brief_color_red;
break;
case 3: // +Neutral
required_string("+Neutral");
Tagged_Colors[tag] = &Brief_color_legacy_neutral;
break;
case -1:
// -noparseerrors is set
if (Tagged_Colors.find(tag) == Tagged_Colors.end()) { // It was a new color, but since we haven't actually defined it...
Color_Tags.pop_back();
}
break;
default:
Assertion(false, "MageKing17 made a coding error somewhere, and you should laugh at him (and report this error).\n");
break;
}
if (optional_string("#Start Colors")) {
// Skip this section; we already parsed it in every file.
skip_to_string("#End", NULL);
}
required_string("#End");
}
Assertion(Color_Tags.size() == Tagged_Colors.size(), "Color_Tags and Tagged_Colors size mismatch; get a coder!\n");
//Team coloring
if (optional_string("#Team Colors")) {
if (optional_string("#Default Text Colors")) {
while (required_string_either("#End", "$Team Name:")) {
required_string("$Team Name:"); // required to move the parse pointer forward
team_color temp_color;
char* color_names[MAX_DEFAULT_TEXT_COLORS] = {
"$Fiction Viewer:",
"$Command Briefing:",
"$Briefing:",
"$Redalert Briefing:",
"$Debriefing:",
"$Recommendation:",
"$Loop Briefing:",
};
char temp2[NAME_LENGTH];
stuff_string(temp2, F_NAME, NAME_LENGTH);
temp = temp2;
char *color_value[MAX_DEFAULT_TEXT_COLORS] = {
&default_fiction_viewer_color,
&default_command_briefing_color,
&default_briefing_color,
&default_redalert_briefing_color,
&default_debriefing_color,
&default_recommendation_color,
&default_loop_briefing_color,
};
if (!stricmp(temp2, "none")) {
Warning(LOCATION, "Team color in '%s' defined with a name of '%s'; this won't be usable due to 'None' being used for a lack of a team color by the engine.\n", filename, temp2);
}
if (required_string("$Team Stripe Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
temp_color.stripe.r = rgb[0] / 255.0f;
temp_color.stripe.g = rgb[1] / 255.0f;
temp_color.stripe.b = rgb[2] / 255.0f;
}
if (required_string("$Team Base Color:")) {
int rgb[3];
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++) {
CLAMP(rgb[i], 0, 255);
}
temp_color.base.r = rgb[0] / 255.0f;
temp_color.base.g = rgb[1] / 255.0f;
temp_color.base.b = rgb[2] / 255.0f;
}
if (Team_Colors.find(temp) == Team_Colors.end()) { // Only push to the vector if the team isn't already defined.
Team_Names.push_back(temp);
}
Team_Colors[temp] = temp_color;
}
required_string("#End");
}
// Previously-hardcoded interface colors
if (optional_string("#Interface Colors")) {
char *color_names[INTERFACE_COLORS] = {
"$Text Normal:",
"$Text Subselected:",
"$Text Selected:",
"$Text Error:",
"$Text Error Highlighted:",
"$Text Active:",
"$Text Active Highlighted:",
"$Text Heading:",
"$More Indicator:",
"$Bright More Indicator:",
"$Bright:",
"$Normal:",
"$Briefing Grid:",
};
// now for each color, check if its corresponding string is there
for (i = 0; i < INTERFACE_COLORS; i++) {
if (optional_string(color_names[i])) {
// if so, get its rgba values and initialise it using them
mprintf(("'%s' has been redefined.\n", color_names[i]));
if (check_for_string("(")) {
// If we have a list of integers, use them.
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
for (j = 0; j < 4; j++) {
if (rgba[j] < 0)
{
Warning(LOCATION, "RGBA value for '%s' in %s too low (%d), capping to 0.\n", color_names[i], filename, rgba[j]);
rgba[j] = 0;
}
else if (rgba[j] > 255)
{
Warning(LOCATION, "RGBA value for '%s' in %s too high (%d), capping to 255.\n", color_names[i], filename, rgba[j]);
rgba[j] = 255;
}
}
gr_init_alphacolor(interface_colors[i], rgba[0], rgba[1], rgba[2], rgba[3]);
//} else if (check_for_string("#")) {
// stuff_hex_list(rgba, 4);
// gr_init_alphacolor(interface_colors[i], rgba[0], rgba[1], rgba[2], rgba[3]);
}
else {
// We have a string; it should be the name of a color to use.
stuff_string(temp, F_NAME);
for (j = 0; j < TOTAL_COLORS; j++) {
if (!temp.compare(COLOR_NAMES[j])) {
break;
}
}
if (j == TOTAL_COLORS) {
Warning(LOCATION, "Unknown color '%s' in %s, for definition of '%s'; using default ('%s').\n", temp.c_str(), filename, color_names[i], COLOR_NAMES[interface_defaults[i]]);
}
else {
Assertion(j >= 0 && j < TOTAL_COLORS, "Attempting to copy nonexistant color (%d out of 0-%d)!\n", j, TOTAL_COLORS - 1);
memcpy(interface_colors[i], COLOR_LIST[j], sizeof(color));
}
}
}
}
required_string("#End");
}
// Text color tags; for briefings, command briefings, debriefings, and the fiction viewer
if (optional_string("#Color Tags")) {
while (required_string_either("$Tag:", "#End") < 1) {
required_string("$Tag:");
color temp_color;
char tag;
for (i = 0; i < MAX_DEFAULT_TEXT_COLORS; i++) {
if ( optional_string(color_names[i]) ) {
stuff_string(temp, F_RAW);
if (temp[0] == '$') {
if (temp[1] == '\0') {
Error(LOCATION, "%s - default text color '%s' entry with a solitary '$'.\n", filename, color_names[i]);
Error(LOCATION, "%s - found a '$Tag:' entry with a solitary '$'.\n", filename);
}
*color_value[i] = temp[1];
tag = temp[1];
if (temp[2] != '\0') {
Warning(LOCATION, "%s - default text color '%s' has extra text after the tag '$%c'.\n", filename, color_names[i], *color_value[i]);
}
} else if (temp[0] == '\0') {
Error(LOCATION, "%s - default text color '%s' entry with no tag.\n", filename, color_names[i]);
} else {
*color_value[i] = temp[0];
if (temp[1] != '\0') {
Warning(LOCATION, "%s - default text color '%s' has extra text after the tag '$%c'.\n", filename, color_names[i], *color_value[i]);
Warning(LOCATION, "%s - tag '$%c' has extra text in its definition.\n", filename, tag);
}
}
if (Tagged_Colors.find(*color_value[i]) == Tagged_Colors.end()) {
// Just mprintf() this information instead of complaining with a Warning(); the tag might be defined in a later-loading TBM, and if it isn't, nothing too terrible will happen.
mprintf(("%s - default text color '%s' set to non-existant tag '$%c'.\n", filename, color_names[i], *color_value[i]));
else if (temp[0] == '\0') {
Error(LOCATION, "%s - found a '$Tag:' entry with no tag.\n", filename);
}
else {
tag = temp[0];
if (temp[1] != '\0') {
Warning(LOCATION, "%s - tag '$%c' has extra text in its definition.\n", filename, tag);
}
}
if (Tagged_Colors.find(tag) == Tagged_Colors.end()) { // Only push the tag to our list of tags if it's actually new, not just a redefinition.
Color_Tags.push_back(tag);
}
switch (required_string_one_of(4, "+Color:", "+Friendly", "+Hostile", "+Neutral")) {
case 0: // +Color
required_string("+Color:");
rgba[0] = rgba[1] = rgba[2] = 0;
rgba[3] = 255; // Odds are pretty high you want it to have full alpha...
if (check_for_string("(")) {
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
for (j = 0; j < 4; j++) {
if (rgba[j] < 0)
{
Warning(LOCATION, "RGBA value for '$%c' in %s too low (%d), capping to 0.\n", tag, filename, rgba[j]);
rgba[j] = 0;
}
else if (rgba[j] > 255)
{
Warning(LOCATION, "RGBA value for '$%c' in %s too high (%d), capping to 255.\n", tag, filename, rgba[j]);
rgba[j] = 255;
}
}
gr_init_alphacolor(&temp_color, rgba[0], rgba[1], rgba[2], rgba[3]);
Custom_Colors[tag] = temp_color;
Tagged_Colors[tag] = &Custom_Colors[tag];
//} else if ( check_for_string ("#") ) {
// stuff_hex_list(rgba, 4);
// gr_init_alphacolor(&temp_color, rgba[0], rgba[1], rgba[2], rgba[3]);
// Custom_Colors[tag] = temp_color;
// Tagged_Colors[tag] = &Custom_Colors[tag];
}
else {
// We have a string; it should be the name of a color to use.
stuff_string(temp, F_NAME);
for (j = 0; j < TOTAL_COLORS; j++) {
if (!temp.compare(COLOR_NAMES[j])) {
break;
}
}
if (j == TOTAL_COLORS) {
Error(LOCATION, "Unknown color '%s' in %s, for definition of tag '$%c'.\n", temp.c_str(), filename, tag);
}
Tagged_Colors[tag] = COLOR_LIST[j];
}
break;
case 1: // +Friendly
required_string("+Friendly");
Tagged_Colors[tag] = &Brief_color_green;
break;
case 2: // +Hostile
required_string("+Hostile");
Tagged_Colors[tag] = &Brief_color_red;
break;
case 3: // +Neutral
required_string("+Neutral");
Tagged_Colors[tag] = &Brief_color_legacy_neutral;
break;
case -1:
// -noparseerrors is set
if (Tagged_Colors.find(tag) == Tagged_Colors.end()) { // It was a new color, but since we haven't actually defined it...
Color_Tags.pop_back();
}
break;
default:
Assertion(false, "MageKing17 made a coding error somewhere, and you should laugh at him (and report this error).\n");
break;
}
}
required_string("#End");
}
required_string("#End");
Assertion(Color_Tags.size() == Tagged_Colors.size(), "Color_Tags and Tagged_Colors size mismatch; get a coder!\n");
if (optional_string("#Default Text Colors")) {
char* color_names[MAX_DEFAULT_TEXT_COLORS] = {
"$Fiction Viewer:",
"$Command Briefing:",
"$Briefing:",
"$Redalert Briefing:",
"$Debriefing:",
"$Recommendation:",
"$Loop Briefing:",
};
char *color_value[MAX_DEFAULT_TEXT_COLORS] = {
&default_fiction_viewer_color,
&default_command_briefing_color,
&default_briefing_color,
&default_redalert_briefing_color,
&default_debriefing_color,
&default_recommendation_color,
&default_loop_briefing_color,
};
for (i = 0; i < MAX_DEFAULT_TEXT_COLORS; i++) {
if (optional_string(color_names[i])) {
stuff_string(temp, F_RAW);
if (temp[0] == '$') {
if (temp[1] == '\0') {
Error(LOCATION, "%s - default text color '%s' entry with a solitary '$'.\n", filename, color_names[i]);
}
*color_value[i] = temp[1];
if (temp[2] != '\0') {
Warning(LOCATION, "%s - default text color '%s' has extra text after the tag '$%c'.\n", filename, color_names[i], *color_value[i]);
}
}
else if (temp[0] == '\0') {
Error(LOCATION, "%s - default text color '%s' entry with no tag.\n", filename, color_names[i]);
}
else {
*color_value[i] = temp[0];
if (temp[1] != '\0') {
Warning(LOCATION, "%s - default text color '%s' has extra text after the tag '$%c'.\n", filename, color_names[i], *color_value[i]);
}
}
if (Tagged_Colors.find(*color_value[i]) == Tagged_Colors.end()) {
// Just mprintf() this information instead of complaining with a Warning(); the tag might be defined in a later-loading TBM, and if it isn't, nothing too terrible will happen.
mprintf(("%s - default text color '%s' set to non-existant tag '$%c'.\n", filename, color_names[i], *color_value[i]));
}
}
}
required_string("#End");
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
+8
View File
@@ -3,7 +3,11 @@
// throw
#ifdef HAVE_CXX11
void * operator new (size_t size)
#else
void * operator new (size_t size) throw (std::bad_alloc)
#endif // CPP11_STD
{
void *p = vm_malloc_q(size);
@@ -19,7 +23,11 @@ void operator delete (void *p) throw()
vm_free(p);
}
#ifdef HAVE_CXX11
void * operator new [] (size_t size)
#else
void * operator new [] (size_t size) throw (std::bad_alloc)
#endif // CPP11_STD
{
void *p = vm_malloc_q(size);
+20
View File
@@ -4,6 +4,25 @@
#include <new>
#ifdef HAVE_CXX11
// throw
extern void * operator new (size_t size);
extern void operator delete (void *p) throw();
extern void * operator new [] (size_t size);
extern void operator delete [] (void *p) throw();
// no-throw
extern void * operator new (size_t size, const std::nothrow_t&) throw();
extern void operator delete (void *p, const std::nothrow_t&) throw();
extern void * operator new [] (size_t size, const std::nothrow_t&) throw();
extern void operator delete [] (void *p, const std::nothrow_t&) throw();
#else
// throw
extern void * operator new (size_t size) throw (std::bad_alloc);
@@ -21,5 +40,6 @@ extern void operator delete (void *p, const std::nothrow_t&) throw();
extern void * operator new [] (size_t size, const std::nothrow_t&) throw();
extern void operator delete [] (void *p, const std::nothrow_t&) throw();
#endif
#endif // _FSMEMORY_H
+109
View File
@@ -22,6 +22,7 @@
#define IAM_64BIT 1
#endif
#include "windows_stub/config.h"
// value to represent an uninitialized state in any int or uint
@@ -680,5 +681,113 @@ public:
#include "globalincs/vmallocator.h"
#include "globalincs/safe_strings.h"
// c++11 standard detection
// for GCC with autotools, see AX_CXX_COMPILE_STDCXX_11 macro in configure.ac
// this sets HAVE_CXX11 & -std=c++0x or -std=c++11 appropriately
// Use the visual studio version to detect C++11 support
#if _MSC_VER >= 1600
# define HAVE_CXX11
#endif
// clang doesn't seem to have a feature check for is_trivial
// oh well, assume it'll be covered by one of the other two checks...
// http://clang.llvm.org/docs/LanguageExtensions.html#feature_check
#if defined(__clang__)
#if __has_feature(cxx_static_assert)
#if __has_feature(cxx_auto_type)
#define HAVE_CXX11
#endif // __has_feature(cxx_auto_type)
#endif // __has_feature(cxx_static_assert)
#endif // defined(__clang__)
// TODO: sort out cmake/gcc
// DEBUG compile time catch for dangerous uses of memset/memcpy/memmove
// would prefer std::is_trivially_copyable but it's not supported by gcc yet
// ref: http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html
#ifndef NDEBUG
#if defined(HAVE_CXX11)
// feature support seems to be: gcc clang msvc
// auto 4.4 2.9 2010
// std::is_trivial 4.5 ? 2012 (2010 only duplicates std::is_pod)
// static_assert 4.3 2.9 2010
#include <type_traits>
#include <cstring>
// MEMSET!
const auto ptr_memset = std::memset;
#define memset memset_if_trivial_else_error
template<typename T>
void *memset_if_trivial_else_error(T *memset_data, int ch, size_t count)
{
static_assert(std::is_trivial<T>::value, "memset on non-trivial object");
return ptr_memset(memset_data, ch, count);
}
// assume memset on a void* is "safe"
// only used in cutscene/mveplayer.cpp:mve_video_createbuf()
inline void *memset_if_trivial_else_error(void *memset_data, int ch, size_t count)
{
return ptr_memset(memset_data, ch, count);
}
// MEMCPY!
const auto ptr_memcpy = std::memcpy;
#define memcpy memcpy_if_trivial_else_error
template<typename T, typename U>
void *memcpy_if_trivial_else_error(T *memcpy_dest, U *src, size_t count)
{
static_assert(std::is_trivial<T>::value, "memcpy on non-trivial object T");
static_assert(std::is_trivial<U>::value, "memcpy on non-trivial object U");
return ptr_memcpy(memcpy_dest, src, count);
}
// assume memcpy with void* is "safe"
// used in:
// globalincs/systemvars.cpp:insertion_sort()
// network/chat_api.cpp:AddChatCommandToQueue()
// network/multi_obj.cpp:multi_oo_sort_func()
// parse/lua.cpp:ade_get_args() && ade_set_args()
//
// probably should setup a static_assert on insertion_sort as well
template<typename U>
void *memcpy_if_trivial_else_error(void *memcpy_dest, U *memcpy_src, size_t count)
{
static_assert(std::is_trivial<U>::value, "memcpy on non-trivial object U");
return ptr_memcpy(memcpy_dest, memcpy_src, count);
}
template<typename T>
void *memcpy_if_trivial_else_error(T *memcpy_dest, void *memcpy_src, size_t count)
{
static_assert(std::is_trivial<T>::value, "memcpy on non-trivial object T");
return ptr_memcpy(memcpy_dest, memcpy_src, count);
}
template<typename T>
void *memcpy_if_trivial_else_error(T *memcpy_dest, const void *memcpy_src, size_t count)
{
static_assert(std::is_trivial<T>::value, "memcpy on non-trivial object T");
return ptr_memcpy(memcpy_dest, memcpy_src, count);
}
inline void *memcpy_if_trivial_else_error(void *memcpy_dest, void *memcpy_src, size_t count)
{
return ptr_memcpy(memcpy_dest, memcpy_src, count);
}
// MEMMOVE!
const auto ptr_memmove = std::memmove;
#define memmove memmove_if_trivial_else_error
template<typename T, typename U>
void *memmove_if_trivial_else_error(T *memmove_dest, U *memmove_src, size_t count)
{
static_assert(std::is_trivial<T>::value, "memmove on non-trivial object T");
static_assert(std::is_trivial<U>::value, "memmove on non-trivial object U");
return ptr_memmove(memmove_dest, memmove_src, count);
}
#endif // HAVE_CXX11
#endif // NDEBUG
#endif // PS_TYPES_H
+97 -92
View File
@@ -579,7 +579,7 @@ void gr_set_font(int fontnum)
void parse_fonts_tbl(char *only_parse_first_font, size_t only_parse_first_font_size)
{
int rval, i;
int i;
char *filename;
// choose file name
@@ -591,99 +591,104 @@ void parse_fonts_tbl(char *only_parse_first_font, size_t only_parse_first_font_s
filename = NULL;
}
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : NOX("<default fonts.tbl>"), rval));
try
{
if (filename != NULL) {
read_file_text(filename, CF_TYPE_TABLES);
}
else {
read_file_text_from_array(defaults_get_file("fonts.tbl"));
}
reset_parse();
// start parsing
required_string("#Fonts");
// read fonts
while (required_string_either("#End", "$Font:")) {
char font_filename[MAX_FILENAME_LEN];
// grab font
required_string("$Font:");
stuff_string(font_filename, F_NAME, MAX_FILENAME_LEN);
// if we only need the first font, copy it and bail
if (only_parse_first_font != NULL) {
strcpy_s(only_parse_first_font, only_parse_first_font_size, font_filename);
return;
}
// create font
int font_id = gr_create_font(font_filename);
if (font_id < 0) {
Warning(LOCATION, "Could not create font from typeface '%s'!", font_filename);
skip_to_start_of_string_either("#End", "$Font:");
}
else {
// max allowed special char index; i.e. 7 special chars in retail fonts 1 & 3
static const int MAX_SPECIAL_CHAR_IDX = UCHAR_MAX - 6;
// 'default' special char index for all languages using this font
int default_special_char_index = 0;
if (optional_string("+Default Special Character Index:")) {
stuff_int(&default_special_char_index);
if (default_special_char_index < 0 || default_special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Default special character index (%d) for font (%s), must be 0 - %u", default_special_char_index, font_filename, MAX_SPECIAL_CHAR_IDX);
}
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
Lcl_languages[i].special_char_indexes[font_id] = (ubyte)default_special_char_index;
}
}
while (optional_string("+Language:")) {
char lang_name[LCL_LANG_NAME_LEN + 1];
int special_char_index, lang_idx = -1;
stuff_string(lang_name, F_NAME, LCL_LANG_NAME_LEN + 1);
// find language and set the index, or if not found move to the next one
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
if (!strcmp(Lcl_languages[i].lang_name, lang_name)) {
lang_idx = i;
break;
}
}
if (lang_idx == -1) {
Warning(LOCATION, "Ignoring invalid language (%s) specified by font (%s); not built-in or in strings.tbl", lang_name, font_filename);
skip_to_start_of_string_either("+Language:", "$Font:", "#End");
continue;
}
if (optional_string("+Special Character Index:")) {
stuff_int(&special_char_index);
if (special_char_index < 0 || special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Special character index (%d) for font (%s), language (%s) is invalid, must be 0 - %u", special_char_index, font_filename, lang_name, MAX_SPECIAL_CHAR_IDX);
}
Lcl_languages[lang_idx].special_char_indexes[font_id] = (ubyte)special_char_index;
}
}
}
}
// done parsing
required_string("#End");
// double check
if (Num_fonts < 3) {
Error(LOCATION, "There must be at least three fonts in %s!", (filename) ? filename : NOX("<default fonts.tbl>"));
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : NOX("<default fonts.tbl>"), e.what()));
return;
}
if (filename != NULL) {
read_file_text(filename, CF_TYPE_TABLES);
} else {
read_file_text_from_array(defaults_get_file("fonts.tbl"));
}
reset_parse();
// start parsing
required_string("#Fonts");
// read fonts
while (required_string_either("#End","$Font:")) {
char font_filename[MAX_FILENAME_LEN];
// grab font
required_string("$Font:");
stuff_string(font_filename, F_NAME, MAX_FILENAME_LEN);
// if we only need the first font, copy it and bail
if (only_parse_first_font != NULL) {
strcpy_s(only_parse_first_font, only_parse_first_font_size, font_filename);
return;
}
// create font
int font_id = gr_create_font(font_filename);
if (font_id < 0) {
Warning(LOCATION, "Could not create font from typeface '%s'!", font_filename);
skip_to_start_of_string_either("#End","$Font:");
} else {
// max allowed special char index; i.e. 7 special chars in retail fonts 1 & 3
static const int MAX_SPECIAL_CHAR_IDX = UCHAR_MAX-6;
// 'default' special char index for all languages using this font
int default_special_char_index = 0;
if (optional_string("+Default Special Character Index:")) {
stuff_int(&default_special_char_index);
if (default_special_char_index < 0 || default_special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Default special character index (%d) for font (%s), must be 0 - %u", default_special_char_index, font_filename, MAX_SPECIAL_CHAR_IDX);
}
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
Lcl_languages[i].special_char_indexes[font_id] = (ubyte)default_special_char_index;
}
}
while (optional_string("+Language:")) {
char lang_name[LCL_LANG_NAME_LEN + 1];
int special_char_index, lang_idx = -1;
stuff_string(lang_name, F_NAME, LCL_LANG_NAME_LEN + 1);
// find language and set the index, or if not found move to the next one
for (i = 0; i < (int)Lcl_languages.size(); ++i) {
if (!strcmp(Lcl_languages[i].lang_name, lang_name)) {
lang_idx = i;
break;
}
}
if (lang_idx == -1) {
Warning(LOCATION, "Ignoring invalid language (%s) specified by font (%s); not built-in or in strings.tbl", lang_name, font_filename );
skip_to_start_of_string_either("+Language:","$Font:","#End");
continue;
}
if (optional_string("+Special Character Index:")) {
stuff_int(&special_char_index);
if (special_char_index < 0 || special_char_index >= MAX_SPECIAL_CHAR_IDX) {
Error(LOCATION, "Special character index (%d) for font (%s), language (%s) is invalid, must be 0 - %u", special_char_index, font_filename, lang_name, MAX_SPECIAL_CHAR_IDX);
}
Lcl_languages[lang_idx].special_char_indexes[font_id] = (ubyte)special_char_index;
}
}
}
}
// done parsing
required_string("#End");
// double check
if (Num_fonts < 3) {
Error(LOCATION, "There must be at least three fonts in %s!", (filename) ? filename : NOX("<default fonts.tbl>"));
}
}
void gr_stuff_first_font(char *first_font, size_t first_font_size )
+87 -84
View File
@@ -687,115 +687,118 @@ void gr_opengl_post_process_save_zbuffer()
static bool opengl_post_init_table()
{
int rval;
bool warned = false;
if ( (rval = setjmp(parse_abort)) != 0 ) {
mprintf(("Unable to parse 'post_processing.tbl'! Error code = %d.\n", rval));
return false;
}
try
{
if (cf_exists_full("post_processing.tbl", CF_TYPE_TABLES))
read_file_text("post_processing.tbl", CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("post_processing.tbl"));
if (cf_exists_full("post_processing.tbl", CF_TYPE_TABLES))
read_file_text("post_processing.tbl", CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("post_processing.tbl"));
reset_parse();
reset_parse();
if (optional_string("#Effects")) {
while ( !required_string_one_of(3, "$Name:", "#Ship Effects", "#End") ) {
char tbuf[NAME_LENGTH+1] = { 0 };
post_effect_t eff;
if (optional_string("#Effects")) {
while (!required_string_one_of(3, "$Name:", "#Ship Effects", "#End")) {
char tbuf[NAME_LENGTH + 1] = { 0 };
post_effect_t eff;
required_string("$Name:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.name = tbuf;
required_string("$Name:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.name = tbuf;
required_string("$Uniform:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.uniform_name = tbuf;
required_string("$Uniform:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.uniform_name = tbuf;
required_string("$Define:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.define_name = tbuf;
required_string("$Define:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
eff.define_name = tbuf;
required_string("$AlwaysOn:");
stuff_boolean(&eff.always_on);
required_string("$AlwaysOn:");
stuff_boolean(&eff.always_on);
required_string("$Default:");
stuff_float(&eff.default_intensity);
eff.intensity = eff.default_intensity;
required_string("$Default:");
stuff_float(&eff.default_intensity);
eff.intensity = eff.default_intensity;
required_string("$Div:");
stuff_float(&eff.div);
required_string("$Div:");
stuff_float(&eff.div);
required_string("$Add:");
stuff_float(&eff.add);
required_string("$Add:");
stuff_float(&eff.add);
// Post_effects index is used for flag checks, so we can't have more than 32
if (Post_effects.size() < 32) {
Post_effects.push_back( eff );
} else if ( !warned ) {
mprintf(("WARNING: post_processing.tbl can only have a max of 32 effects! Ignoring extra...\n"));
warned = true;
// Post_effects index is used for flag checks, so we can't have more than 32
if (Post_effects.size() < 32) {
Post_effects.push_back(eff);
}
else if (!warned) {
mprintf(("WARNING: post_processing.tbl can only have a max of 32 effects! Ignoring extra...\n"));
warned = true;
}
}
}
}
//Built-in per-ship effects
ship_effect se1;
strcpy_s(se1.name, "FS1 Ship select");
se1.shader_effect = 0;
se1.disables_rendering = false;
se1.invert_timer = false;
Ship_effects.push_back(se1);
//Built-in per-ship effects
ship_effect se1;
strcpy_s(se1.name, "FS1 Ship select");
se1.shader_effect = 0;
se1.disables_rendering = false;
se1.invert_timer = false;
Ship_effects.push_back(se1);
if (optional_string("#Ship Effects")) {
while ( !required_string_one_of(3, "$Name:", "#Light Shafts", "#End") ) {
ship_effect se;
char tbuf[NAME_LENGTH] = { 0 };
if (optional_string("#Ship Effects")) {
while (!required_string_one_of(3, "$Name:", "#Light Shafts", "#End")) {
ship_effect se;
char tbuf[NAME_LENGTH] = { 0 };
required_string("$Name:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
strcpy_s(se.name, tbuf);
required_string("$Name:");
stuff_string(tbuf, F_NAME, NAME_LENGTH);
strcpy_s(se.name, tbuf);
required_string("$Shader Effect:");
stuff_int(&se.shader_effect);
required_string("$Shader Effect:");
stuff_int(&se.shader_effect);
required_string("$Disables Rendering:");
stuff_boolean(&se.disables_rendering);
required_string("$Disables Rendering:");
stuff_boolean(&se.disables_rendering);
required_string("$Invert timer:");
stuff_boolean(&se.invert_timer);
required_string("$Invert timer:");
stuff_boolean(&se.invert_timer);
Ship_effects.push_back(se);
Ship_effects.push_back(se);
}
}
if (optional_string("#Light Shafts")) {
required_string("$AlwaysOn:");
stuff_boolean(&ls_on);
required_string("$Density:");
stuff_float(&ls_density);
required_string("$Falloff:");
stuff_float(&ls_falloff);
required_string("$Weight:");
stuff_float(&ls_weight);
required_string("$Intensity:");
stuff_float(&ls_intensity);
required_string("$Sample Number:");
stuff_int(&ls_samplenum);
ls_cpintensity = ls_weight;
for (int i = 1; i < ls_samplenum; i++)
ls_cpintensity += ls_weight * pow(ls_falloff, i);
ls_cpintensity *= ls_intensity;
}
required_string("#End");
return true;
}
if (optional_string("#Light Shafts")) {
required_string("$AlwaysOn:");
stuff_boolean(&ls_on);
required_string("$Density:");
stuff_float(&ls_density);
required_string("$Falloff:");
stuff_float(&ls_falloff);
required_string("$Weight:");
stuff_float(&ls_weight);
required_string("$Intensity:");
stuff_float(&ls_intensity);
required_string("$Sample Number:");
stuff_int(&ls_samplenum);
ls_cpintensity = ls_weight;
for(int i = 1; i < ls_samplenum; i++)
ls_cpintensity += ls_weight * pow(ls_falloff, i);
ls_cpintensity *= ls_intensity;
catch (const parse::ParseException& e)
{
mprintf(("Unable to parse 'post_processing.tbl'! Error message = %s.\n", e.what()));
return false;
}
required_string("#End");
return true;
}
static char *opengl_post_load_shader(char *filename, int flags, int flags2)
+59 -56
View File
@@ -62,72 +62,75 @@ int ssm_info_lookup(char *name)
// game init
void ssm_init()
{
int rval;
ssm_info bogus, *s;
char weapon_name[NAME_LENGTH];
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "ssm.tbl", rval));
return;
}
try
{
read_file_text("ssm.tbl", CF_TYPE_TABLES);
reset_parse();
read_file_text("ssm.tbl", CF_TYPE_TABLES);
reset_parse();
// parse the table
Ssm_info_count = 0;
while (!optional_string("#end")){
// another ssm definition
if (optional_string("$SSM:")){
// pointer to info struct
if (Ssm_info_count >= MAX_SSM_TYPES){
s = &bogus;
}
else {
s = &Ssm_info[Ssm_info_count];
}
// parse the table
Ssm_info_count = 0;
while(!optional_string("#end")){
// another ssm definition
if(optional_string("$SSM:")){
// pointer to info struct
if(Ssm_info_count >= MAX_SSM_TYPES){
s = &bogus;
} else {
s = &Ssm_info[Ssm_info_count];
}
// name
stuff_string(s->name, F_NAME, NAME_LENGTH);
// name
stuff_string(s->name, F_NAME, NAME_LENGTH);
// stuff data
required_string("+Weapon:");
stuff_string(weapon_name, F_NAME, NAME_LENGTH);
required_string("+Count:");
stuff_int(&s->count);
required_string("+WarpRadius:");
stuff_float(&s->warp_radius);
required_string("+WarpTime:");
stuff_float(&s->warp_time);
// According to fireballs.cpp, "Warp lifetime must be at least 4 seconds!"
if ((s->warp_time) < 4.0f) {
// So let's warn them before they try to use it, shall we?
Warning(LOCATION, "Expected a '+WarpTime:' value equal or greater than 4.0, found '%f' in weapon '%s'.\n Setting to 4.0, please check and set to a number 4.0 or greater!\n", s->warp_time, weapon_name);
// And then make the Assert obsolete -- Zacam
s->warp_time = 4.0f;
}
required_string("+Radius:");
stuff_float(&s->radius);
required_string("+Offset:");
stuff_float(&s->offset);
if (optional_string("+HUD Message:"))
stuff_boolean(&s->send_message);
else
s->send_message = true;
if (optional_string("+Custom Message:")) {
stuff_string(s->message, F_NAME, NAME_LENGTH);
s->use_custom_message = true;
}
parse_sound("+Alarm Sound:", &s->sound_index, s->name);
// stuff data
required_string("+Weapon:");
stuff_string(weapon_name, F_NAME, NAME_LENGTH);
required_string("+Count:");
stuff_int(&s->count);
required_string("+WarpRadius:");
stuff_float(&s->warp_radius);
required_string("+WarpTime:");
stuff_float(&s->warp_time);
// According to fireballs.cpp, "Warp lifetime must be at least 4 seconds!"
if ( (s->warp_time) < 4.0f) {
// So let's warn them before they try to use it, shall we?
Warning(LOCATION, "Expected a '+WarpTime:' value equal or greater than 4.0, found '%f' in weapon '%s'.\n Setting to 4.0, please check and set to a number 4.0 or greater!\n", s->warp_time, weapon_name);
// And then make the Assert obsolete -- Zacam
s->warp_time = 4.0f;
}
required_string("+Radius:");
stuff_float(&s->radius);
required_string("+Offset:");
stuff_float(&s->offset);
if (optional_string("+HUD Message:"))
stuff_boolean(&s->send_message);
else
s->send_message = true;
if (optional_string("+Custom Message:")) {
stuff_string(s->message, F_NAME, NAME_LENGTH);
s->use_custom_message = true;
}
parse_sound("+Alarm Sound:", &s->sound_index, s->name);
// see if we have a valid weapon
s->weapon_info_index = -1;
s->weapon_info_index = weapon_info_lookup(weapon_name);
if(s->weapon_info_index >= 0){
// valid
Ssm_info_count++;
// see if we have a valid weapon
s->weapon_info_index = -1;
s->weapon_info_index = weapon_info_lookup(weapon_name);
if (s->weapon_info_index >= 0){
// valid
Ssm_info_count++;
}
}
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "ssm.tbl", e.what()));
return;
}
}
void ssm_get_random_start_pos(vec3d *out, vec3d *start, matrix *orient, int ssm_index)
+26 -23
View File
@@ -1641,40 +1641,43 @@ void hud_config_color_save(char *name)
void hud_config_color_load(char *name)
{
int idx, rval;
int idx;
char str[1024];
char *fname;
fname = cf_add_ext(name, ".hcf");
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("HUDCONFIG: Unable to parse '%s'! Error code = %i.\n", fname, rval));
return;
}
try
{
read_file_text(fname);
reset_parse();
read_file_text(fname);
reset_parse();
// First, set all gauges to the current main color
for (idx = 0; idx < NUM_HUD_GAUGES; idx++){
gr_init_alphacolor(&HUD_config.clr[idx], HUD_color_red, HUD_color_green, HUD_color_blue, (HUD_color_alpha + 1) * 16);
}
// First, set all gauges to the current main color
for (idx=0; idx<NUM_HUD_GAUGES; idx++){
gr_init_alphacolor(&HUD_config.clr[idx], HUD_color_red, HUD_color_green, HUD_color_blue, (HUD_color_alpha+1)*16);
}
// Now read in the color values for the gauges
while (optional_string("+Gauge:")) {
stuff_string(str, F_NAME, sizeof(str));
// Now read in the color values for the gauges
while (optional_string("+Gauge:")) {
stuff_string(str, F_NAME, sizeof(str));
for (idx=0; idx<NUM_HUD_GAUGES; idx++) {
if (!stricmp(str, Hud_Gauge_Names[idx])) {
required_string("+RGBA:");
stuff_ubyte(&HUD_config.clr[idx].red);
stuff_ubyte(&HUD_config.clr[idx].green);
stuff_ubyte(&HUD_config.clr[idx].blue);
stuff_ubyte(&HUD_config.clr[idx].alpha);
break;
for (idx = 0; idx < NUM_HUD_GAUGES; idx++) {
if (!stricmp(str, Hud_Gauge_Names[idx])) {
required_string("+RGBA:");
stuff_ubyte(&HUD_config.clr[idx].red);
stuff_ubyte(&HUD_config.clr[idx].green);
stuff_ubyte(&HUD_config.clr[idx].blue);
stuff_ubyte(&HUD_config.clr[idx].alpha);
break;
}
}
}
}
catch (const parse::ParseException& e)
{
mprintf(("HUDCONFIG: Unable to parse '%s'! Error message = %s.\n", fname, e.what()));
return;
}
}
void hud_config_alpha_slider_up()
+197 -186
View File
@@ -165,7 +165,7 @@ int parse_ship_start()
void parse_hud_gauges_tbl(const char *filename)
{
int i, rval;
int i;
char *saved_Mp = NULL;
int colors[3] = {255, 255, 255};
@@ -175,114 +175,112 @@ void parse_hud_gauges_tbl(const char *filename)
color *ship_clr_p = NULL;
bool scale_gauge = true;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
if(optional_string("$Load Retail Configuration:")) {
stuff_boolean(&Hud_retail);
}
if ( optional_string("$Color:") ) {
stuff_int_list(colors, 3);
check_color(colors);
gr_init_alphacolor(&hud_color, colors[0], colors[1], colors[2], 255);
hud_clr_p = &hud_color;
}
if(optional_string("$Font:")) {
stuff_int(&Hud_font);
}
if(optional_string("$Max Directives:")) {
stuff_int(&Max_directives);
}
if(optional_string("$Max Escort Ships:")) {
stuff_int(&Max_escort_ships);
}
if(optional_string("$Length Unit Multiplier:")) {
stuff_float(&Hud_unit_multiplier);
if (Hud_unit_multiplier <= 0.0f) {
Warning(LOCATION, "\"$Length Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_unit_multiplier);
Hud_unit_multiplier = 1.0f;
if (optional_string("$Load Retail Configuration:")) {
stuff_boolean(&Hud_retail);
}
}
if(optional_string("$Speed Unit Multiplier:")) {
stuff_float(&Hud_speed_multiplier);
if (optional_string("$Color:")) {
stuff_int_list(colors, 3);
if (Hud_speed_multiplier <= 0.0f) {
Warning(LOCATION, "\"$Speed Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_speed_multiplier);
Hud_speed_multiplier = 1.0f;
check_color(colors);
gr_init_alphacolor(&hud_color, colors[0], colors[1], colors[2], 255);
hud_clr_p = &hud_color;
}
} else {
Hud_speed_multiplier = Hud_unit_multiplier;
}
if (optional_string("$Wireframe Targetbox:")) {
stuff_int(&Targetbox_wire);
if ((Targetbox_wire < 0) || (Targetbox_wire > 3)) {
Targetbox_wire = 0;
if (optional_string("$Font:")) {
stuff_int(&Hud_font);
}
}
if (optional_string("$Targetbox Shader Effect:")) {
stuff_int(&Targetbox_shader_effect);
if (Targetbox_shader_effect < 0) {
Targetbox_shader_effect = 0;
if (optional_string("$Max Directives:")) {
stuff_int(&Max_directives);
}
}
if (optional_string("$Lock Wireframe Mode:")) {
stuff_boolean(&Lock_targetbox_mode);
}
if (optional_string("$Max Escort Ships:")) {
stuff_int(&Max_escort_ships);
}
if (optional_string("$Scale Gauges:")) {
stuff_boolean(&scale_gauge);
Scale_retail_gauges = scale_gauge;
}
if (optional_string("$Length Unit Multiplier:")) {
stuff_float(&Hud_unit_multiplier);
if(optional_string("$Reticle Style:")) {
int temp = required_string_either("FS1", "FS2");
if (Hud_unit_multiplier <= 0.0f) {
Warning(LOCATION, "\"$Length Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_unit_multiplier);
Hud_unit_multiplier = 1.0f;
}
}
// using require_string_either won't advance the Mp pointer to the next token so force it instead
skip_to_start_of_string("#Gauge Config");
if (optional_string("$Speed Unit Multiplier:")) {
stuff_float(&Hud_speed_multiplier);
if (temp < 0)
Warning(LOCATION, "Undefined reticle style in hud_gauges.tbl!");
else
Hud_reticle_style = temp;
}
if (Hud_speed_multiplier <= 0.0f) {
Warning(LOCATION, "\"$Speed Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_speed_multiplier);
Hud_speed_multiplier = 1.0f;
}
}
else {
Hud_speed_multiplier = Hud_unit_multiplier;
}
if (optional_string("$Show disabled ETS gauges:")) {
stuff_boolean(&Show_disabled_ets_gauges);
}
if (optional_string("$Wireframe Targetbox:")) {
stuff_int(&Targetbox_wire);
if ((Targetbox_wire < 0) || (Targetbox_wire > 3)) {
Targetbox_wire = 0;
}
}
int base_res[2];
int ship_idx = -1;
int ship_font = -1;
int gauge_type = -1;
int use_font = -1;
color *use_clr_p = NULL;
SCP_vector<int> ship_classes;
bool retail_config = false;
int n_ships = 0;
if (optional_string("$Targetbox Shader Effect:")) {
stuff_int(&Targetbox_shader_effect);
if (Targetbox_shader_effect < 0) {
Targetbox_shader_effect = 0;
}
}
while(optional_string("#Gauge Config")) {
ship_classes.clear();
switch (optional_string_either("$Ship:", "$Ships:")) {
if (optional_string("$Lock Wireframe Mode:")) {
stuff_boolean(&Lock_targetbox_mode);
}
if (optional_string("$Scale Gauges:")) {
stuff_boolean(&scale_gauge);
Scale_retail_gauges = scale_gauge;
}
if (optional_string("$Reticle Style:")) {
int temp = required_string_either("FS1", "FS2");
// using require_string_either won't advance the Mp pointer to the next token so force it instead
skip_to_start_of_string("#Gauge Config");
if (temp < 0)
Warning(LOCATION, "Undefined reticle style in hud_gauges.tbl!");
else
Hud_reticle_style = temp;
}
if (optional_string("$Show disabled ETS gauges:")) {
stuff_boolean(&Show_disabled_ets_gauges);
}
int base_res[2];
int ship_idx = -1;
int ship_font = -1;
int gauge_type = -1;
int use_font = -1;
color *use_clr_p = NULL;
SCP_vector<int> ship_classes;
bool retail_config = false;
int n_ships = 0;
while (optional_string("#Gauge Config")) {
ship_classes.clear();
switch (optional_string_either("$Ship:", "$Ships:")) {
case 0:
mprintf(("$Ship in hud_gauges.tbl and -hdg.tbms is deprecated. Use \"$Ships: (\"Some ship class\") instead.\n"));
if(!ships_inited) {
if (!ships_inited) {
// just in case ship info has not been initialized.
skip_to_start_of_string("#Gauge Config");
continue;
@@ -292,15 +290,15 @@ void parse_hud_gauges_tbl(const char *filename)
ship_idx = parse_ship_start();
ship_classes.push_back(ship_idx);
if(ship_idx >= 0) {
if (ship_idx >= 0) {
Ship_info[ship_idx].hud_enabled = true;
// see if we need to load defaults for this configuration
if(optional_string("$Load Retail Configuration:")) {
if (optional_string("$Load Retail Configuration:")) {
stuff_boolean(&Ship_info[ship_idx].hud_retail);
}
if ( optional_string("$Color:") ) {
if (optional_string("$Color:")) {
stuff_int_list(colors, 3);
check_color(colors);
@@ -308,10 +306,11 @@ void parse_hud_gauges_tbl(const char *filename)
ship_clr_p = &ship_color;
}
if(optional_string("$Font:")) {
if (optional_string("$Font:")) {
stuff_int(&ship_font);
}
} else {
}
else {
// can't find ship class. move on.
ship_classes.push_back(-1);
skip_to_start_of_string("#Gauge Config");
@@ -324,7 +323,7 @@ void parse_hud_gauges_tbl(const char *filename)
n_ships = stuff_int_list(shiparray, 256, SHIP_INFO_TYPE);
if(optional_string("$Load Retail Configuration:")) {
if (optional_string("$Load Retail Configuration:")) {
stuff_boolean(&retail_config);
}
@@ -334,7 +333,7 @@ void parse_hud_gauges_tbl(const char *filename)
Ship_info[shiparray[i]].hud_retail = retail_config;
}
if ( optional_string("$Color:") ) {
if (optional_string("$Color:")) {
stuff_int_list(colors, 3);
check_color(colors);
@@ -342,119 +341,131 @@ void parse_hud_gauges_tbl(const char *filename)
ship_clr_p = &ship_color;
}
if(optional_string("$Font:")) {
if (optional_string("$Font:")) {
stuff_int(&ship_font);
}
break;
default:
// No particular ship. -1 for default HUD configuration.
ship_classes.push_back(-1);
ship_font = -1;
ship_clr_p = NULL;
break;
}
// No particular ship. -1 for default HUD configuration.
ship_classes.push_back(-1);
ship_font = -1;
ship_clr_p = NULL;
break;
}
if ( ship_clr_p != NULL ) {
use_clr_p = ship_clr_p;
} else {
use_clr_p = hud_clr_p;
}
if (ship_clr_p != NULL) {
use_clr_p = ship_clr_p;
}
else {
use_clr_p = hud_clr_p;
}
if(ship_font >= 0) {
use_font = ship_font;
} else {
use_font = Hud_font;
}
if (ship_font >= 0) {
use_font = ship_font;
}
else {
use_font = Hud_font;
}
// Now start going through resolution info for this HUD layout
required_string("$Base:");
// Now start going through resolution info for this HUD layout
required_string("$Base:");
// get the base width and height describing this HUD
stuff_int_list(base_res, 2, RAW_INTEGER_TYPE);
// get the base width and height describing this HUD
stuff_int_list(base_res, 2, RAW_INTEGER_TYPE);
// gauge scaling for this base res?
if (optional_string("$Scale Gauges:")) {
stuff_boolean(&scale_gauge);
}
// gauge scaling for this base res?
if (optional_string("$Scale Gauges:")) {
stuff_boolean(&scale_gauge);
}
// Pruning time. Let's see if the current resolution defined by the user matches the conditions set by this entry
if(optional_string("$Required Aspect:")) {
// filter aspect ratio.
if(optional_string("Full Screen")) {
if( (float)gr_screen.max_w / (float)gr_screen.max_h > 1.5) {
skip_to_start_of_string("#Gauge Config");
//skip_to_start_of_string_either("#Gauge Config", "#End");
continue;
// Pruning time. Let's see if the current resolution defined by the user matches the conditions set by this entry
if (optional_string("$Required Aspect:")) {
// filter aspect ratio.
if (optional_string("Full Screen")) {
if ((float)gr_screen.max_w / (float)gr_screen.max_h > 1.5) {
skip_to_start_of_string("#Gauge Config");
//skip_to_start_of_string_either("#Gauge Config", "#End");
continue;
}
}
} else if(optional_string("Wide Screen")) {
if( (float)gr_screen.max_w / (float)gr_screen.max_h <= 1.5) {
skip_to_start_of_string("#Gauge Config");
//skip_to_start_of_string_either("#Gauge Config", "#End");
continue;
else if (optional_string("Wide Screen")) {
if ((float)gr_screen.max_w / (float)gr_screen.max_h <= 1.5) {
skip_to_start_of_string("#Gauge Config");
//skip_to_start_of_string_either("#Gauge Config", "#End");
continue;
}
}
}
}
// check minimum resolution
if(optional_string("$Min:")) {
int min_res[2];
stuff_int_list(min_res, 2, RAW_INTEGER_TYPE);
if(min_res[0] > gr_screen.max_w) {
skip_to_start_of_string("#Gauge Config");
continue;
} else if (min_res[0] == gr_screen.max_w) {
if(min_res[1] > gr_screen.max_h) {
}
// check minimum resolution
if (optional_string("$Min:")) {
int min_res[2];
stuff_int_list(min_res, 2, RAW_INTEGER_TYPE);
if (min_res[0] > gr_screen.max_w) {
skip_to_start_of_string("#Gauge Config");
continue;
}
else if (min_res[0] == gr_screen.max_w) {
if (min_res[1] > gr_screen.max_h) {
skip_to_start_of_string("#Gauge Config");
continue;
}
}
}
}
// check maximum resolution
if(optional_string("$Max:")) {
int max_res[2];
stuff_int_list(max_res, 2, RAW_INTEGER_TYPE);
// check maximum resolution
if (optional_string("$Max:")) {
int max_res[2];
stuff_int_list(max_res, 2, RAW_INTEGER_TYPE);
if(max_res[0] < gr_screen.max_w) {
skip_to_start_of_string("#Gauge Config");
continue;
} else if (max_res[0] == gr_screen.max_w) {
if(max_res[1] < gr_screen.max_h) {
if (max_res[0] < gr_screen.max_w) {
skip_to_start_of_string("#Gauge Config");
continue;
}
else if (max_res[0] == gr_screen.max_w) {
if (max_res[1] < gr_screen.max_h) {
skip_to_start_of_string("#Gauge Config");
continue;
}
}
}
// let's start parsing for gauges.
required_string("$Gauges:");
while (!check_for_string("$Gauges:") && !check_for_string("$End Gauges")) {
// find out what type of gauge we're parsing.
gauge_type = parse_gauge_type();
// then call the specific gauge load handler function for this gauge type.
if (optional_string("default")) {
// sending -1 base width and height will indicate GR_640 or GR_1024 to the handlers
load_gauge(gauge_type, -1, -1, use_font, scale_gauge, &ship_classes, use_clr_p);
}
else {
load_gauge(gauge_type, base_res[0], base_res[1], use_font, scale_gauge, &ship_classes, use_clr_p);
}
if (saved_Mp && (saved_Mp == Mp)) {
Mp++;
}
skip_to_start_of_string_either("$", "+");
// stolened from AI_profiles
// if we've been through once already and are at the same place, force a move
saved_Mp = Mp;
}
required_string("$End Gauges");
required_string("#End");
}
// let's start parsing for gauges.
required_string("$Gauges:");
while (!check_for_string("$Gauges:") && !check_for_string("$End Gauges")) {
// find out what type of gauge we're parsing.
gauge_type = parse_gauge_type();
// then call the specific gauge load handler function for this gauge type.
if(optional_string("default")) {
// sending -1 base width and height will indicate GR_640 or GR_1024 to the handlers
load_gauge(gauge_type, -1, -1, use_font, scale_gauge, &ship_classes, use_clr_p);
} else {
load_gauge(gauge_type, base_res[0], base_res[1], use_font, scale_gauge, &ship_classes, use_clr_p);
}
if ( saved_Mp && (saved_Mp == Mp) ) {
Mp++;
}
skip_to_start_of_string_either("$", "+");
// stolened from AI_profiles
// if we've been through once already and are at the same place, force a move
saved_Mp = Mp;
}
required_string("$End Gauges");
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
+9
View File
@@ -545,6 +545,11 @@ void hud_shield_quadrant_hit(object *objp, int quadrant)
shield_hit_info *shi;
int num;
if (Game_mode & GM_STANDALONE_SERVER)
return;
Assertion(objp != NULL, "hud_shield_quadrant_hit() called with a NULL objp; get a coder!\n");
if ( objp->type != OBJ_SHIP )
return;
@@ -559,12 +564,16 @@ void hud_shield_quadrant_hit(object *objp, int quadrant)
return;
}
Assertion(shi->shield_hit_timers.size() > 0, "Shield hit info object for object '%s' has a size %d shield_hit_timers; get a coder!\n", Ships[objp->instance].ship_name, shi->shield_hit_timers.size());
Assertion(shi->hull_hit_index < shi->shield_hit_timers.size(), "Shield hit info object for object '%s' has a hull_hit_index of %d (should be between 0 and %d); get a coder!\n", Ships[objp->instance].ship_name, shi->hull_hit_index, shi->shield_hit_timers.size() - 1);
if ( quadrant >= 0 ) {
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags2 & SIF2_MODEL_POINT_SHIELDS) )
num = Quadrant_xlate[quadrant];
else
num = quadrant;
Assertion(num < shi->hull_hit_index, "Shield hit info object for object '%s' hit on quadrant #%d, despite having a hull_hit_index of %d; get a coder!\n", Ships[objp->instance].ship_name, num, shi->hull_hit_index);
shi->shield_hit_timers[num] = timestamp(SHIELD_HIT_DURATION_SHORT);
} else {
shi->shield_hit_timers[shi->hull_hit_index] = timestamp(SHIELD_HIT_DURATION_SHORT);
+4 -5
View File
@@ -1373,11 +1373,10 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message,
target_shipname = NULL;
target_team = -1;
if ( ainfo->target_objnum != -1) {
if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) {
target_shipname = Ships[Objects[ainfo->target_objnum].instance].ship_name; // I think this is right
target_team = Ships[Objects[ainfo->target_objnum].instance].team;
}
if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) {
target_shipname = Ships[Objects[ainfo->target_objnum].instance].ship_name; // I think this is right
target_team = Ships[Objects[ainfo->target_objnum].instance].team;
}
Assert ( ainfo->shipnum != -1 );
+398 -397
View File
@@ -128,406 +128,407 @@ void iff_init()
int i, j, k;
int string_idx;
int rval;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "iff_defs.tbl", rval));
// Goober5000 - if table doesn't exist, use the default table
if (cf_exists_full("iff_defs.tbl", CF_TYPE_TABLES))
read_file_text("iff_defs.tbl", CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("iff_defs.tbl"));
reset_parse();
// parse the table --------------------------------------------------------
required_string("#IFFs");
// get the traitor
required_string("$Traitor IFF:");
stuff_string(traitor_name, F_NAME, NAME_LENGTH);
int rgb[3];
// check if alternate colours are wanted to be used for these
// Marks various stuff... like asteroids
if ((optional_string("$Selection Color:")) || (optional_string("$Selection Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0xff, 0xff, 0xff);
// Marks the ship currently saying something
if ((optional_string("$Message Color:")) || (optional_string("$Message Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0x7f, 0x7f, 0x7f);
// Marks the tagged ships
if ((optional_string("$Tagged Color:")) || (optional_string("$Tagged Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0xff, 0xff, 0x00);
// init radar blips colour table
int a_bright, a_dim;
bool alternate_blip_color = false;
for (i = 0; i < 5; i++)
{
for (j = 0; j < 2; j++)
{
for (k = 0; k < 3; k++)
{
radar_iff_color[i][j][k] = -1;
}
}
}
// if the bright/dim scaling is wanted to be changed
if (optional_string("$Dimmed IFF brightness:"))
{
int dim_iff_brightness;
stuff_int(&dim_iff_brightness);
Assert(dim_iff_brightness >= 0 && dim_iff_brightness <= HUD_COLOR_ALPHA_MAX);
*iff_color_brightness = dim_iff_brightness;
}
else
*iff_color_brightness = 4;
// alternate = use same method as with ship blips
// retail = use 1/2 intensities
if (optional_string("$Use Alternate Blip Coloring:") || optional_string("$Use Alternate Blip Colouring:"))
{
stuff_boolean(&alternate_blip_color);
}
// Parse blip colours, their order is hardcoded.
if ((optional_string("$Missile Blip Color:")) || (optional_string("$Missile Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[0][1][i] = rgb[i];
radar_iff_color[0][0][i] = rgb[i] / 2;
}
}
if ((optional_string("$Navbuoy Blip Color:")) || (optional_string("$Navbuoy Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[1][1][i] = rgb[i];
radar_iff_color[1][0][i] = rgb[i] / 2;
}
}
if ((optional_string("$Warping Blip Color:")) || (optional_string("$Warping Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[2][1][i] = rgb[i];
radar_iff_color[2][0][i] = rgb[i] / 2;
}
}
if ((optional_string("$Node Blip Color:")) || (optional_string("$Node Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[3][1][i] = rgb[i];
radar_iff_color[3][0][i] = rgb[i] / 2;
}
}
if ((optional_string("$Tagged Blip Color:")) || (optional_string("$Tagged Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i = 0; i < 3; i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[4][1][i] = rgb[i];
radar_iff_color[4][0][i] = rgb[i] / 2;
}
}
if (alternate_blip_color == true)
{
a_bright = iff_get_alpha_value(true);
a_dim = iff_get_alpha_value(false);
for (i = 0; i < 5; i++)
{
if (radar_iff_color[i][0][0] >= 0)
{
for (j = 0; j < 3; j++)
{
radar_iff_color[i][0][j] = radar_iff_color[i][1][j];
}
radar_iff_color[i][1][3] = a_bright;
radar_iff_color[i][0][3] = a_dim;
}
}
}
else
{
for (i = 0; i < 5; i++)
{
if (radar_iff_color[i][0][0] >= 0)
{
radar_iff_color[i][0][3] = 255;
radar_iff_color[i][1][3] = 255;
}
}
}
if (optional_string("$Radar Target ID Flags:")) {
parse_string_flag_list((int*)&radar_target_id_flags, rti_flags, Num_rti_flags);
if (optional_string("+reset"))
radar_target_id_flags = 0;
}
// begin reading data
Num_iffs = 0;
while (required_string_either("#End", "$IFF Name:"))
{
iff_info *iff;
int cur_iff;
// make sure we're under the limit
if (Num_iffs >= MAX_IFFS)
{
Warning(LOCATION, "Too many iffs in iffs_defs.tbl! Max is %d.\n", MAX_IFFS);
skip_to_start_of_string("#End", NULL);
break;
}
// add new IFF
iff = &Iff_info[Num_iffs];
cur_iff = Num_iffs;
Num_iffs++;
// get required IFF info ----------------------------------------------
// get the iff name
required_string("$IFF Name:");
stuff_string(iff->iff_name, F_NAME, NAME_LENGTH);
// get the iff color
if (check_for_string("$Colour:"))
required_string("$Colour:");
else
required_string("$Color:");
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff->color_index = iff_init_color(rgb[0], rgb[1], rgb[2]);
// get relationships between IFFs -------------------------------------
// get the list of iffs attacked
if (optional_string("$Attacks:"))
num_attack_names[cur_iff] = stuff_string_list(attack_names[cur_iff], MAX_IFFS);
else
num_attack_names[cur_iff] = 0;
// get the list of observed colors
num_observed_colors[cur_iff] = 0;
while (optional_string("+Sees"))
{
// get iff observed
stuff_string_until(observed_color_table[cur_iff][num_observed_colors[cur_iff]].iff_name, "As:", NAME_LENGTH);
required_string("As:");
// get color observed
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
observed_color_table[cur_iff][num_observed_colors[cur_iff]].color_index = iff_init_color(rgb[0], rgb[1], rgb[2]);
// increment
num_observed_colors[cur_iff]++;
}
// get flags ----------------------------------------------------------
// get iff flags
iff->flags = 0;
if (optional_string("$Flags:"))
{
char flag_strings[MAX_IFF_FLAGS][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_IFF_FLAGS);
for (string_idx = 0; string_idx < num_strings; string_idx++)
{
if (!stricmp(NOX("support allowed"), flag_strings[string_idx]))
iff->flags |= IFFF_SUPPORT_ALLOWED;
else if (!stricmp(NOX("exempt from all teams at war"), flag_strings[string_idx]))
iff->flags |= IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR;
else if (!stricmp(NOX("orders hidden"), flag_strings[string_idx]))
iff->flags |= IFFF_ORDERS_HIDDEN;
else if (!stricmp(NOX("orders shown"), flag_strings[string_idx]))
iff->flags |= IFFF_ORDERS_SHOWN;
else if (!stricmp(NOX("wing name hidden"), flag_strings[string_idx]))
iff->flags |= IFFF_WING_NAME_HIDDEN;
else
Warning(LOCATION, "Bogus string in iff flags: %s\n", flag_strings[string_idx]);
}
}
// get default ship flags
iff->default_parse_flags = 0;
if (optional_string("$Default Ship Flags:"))
{
i = 0;
j = 0;
char flag_strings[MAX_PARSE_OBJECT_FLAGS][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS);
for (i = 0; i < num_strings; i++)
{
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS; j++)
{
if (!stricmp(flag_strings[i], Parse_object_flags[j]))
{
iff->default_parse_flags |= (1 << j);
break;
}
}
}
if (j == MAX_PARSE_OBJECT_FLAGS)
Warning(LOCATION, "Bogus string in iff default ship flags: %s\n", flag_strings[i]);
}
// again
iff->default_parse_flags2 = 0;
if (optional_string("$Default Ship Flags2:"))
{
i = 0;
j = 0;
char flag_strings[MAX_PARSE_OBJECT_FLAGS_2][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS_2);
for (i = 0; i < num_strings; i++)
{
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS_2; j++)
{
if (!stricmp(flag_strings[i], Parse_object_flags_2[j]))
{
iff->default_parse_flags2 |= (1 << j);
break;
}
}
}
if (j == MAX_PARSE_OBJECT_FLAGS_2)
Warning(LOCATION, "Bogus string in iff default ship flags2: %s\n", flag_strings[i]);
}
// this is cleared between each level but let's just set it here for thoroughness
iff->ai_rearm_timestamp = timestamp(-1);
}
required_string("#End");
// now resolve the relationships ------------------------------------------
// first get the traitor
Iff_traitor = iff_lookup(traitor_name);
if (Iff_traitor < 0)
{
Iff_traitor = 0;
Warning(LOCATION, "Traitor IFF %s not found in iff_defs.tbl! Defaulting to %s.\n", traitor_name, Iff_info[Iff_traitor].iff_name);
}
// next get the attackees and colors
for (int cur_iff = 0; cur_iff < Num_iffs; cur_iff++)
{
iff_info *iff = &Iff_info[cur_iff];
// clear the iffs to be attacked
iff->attackee_bitmask = 0;
iff->attackee_bitmask_all_teams_at_war = 0;
// clear the observed colors
for (j = 0; j < MAX_IFFS; j++)
iff->observed_color_index[j] = -1;
// resolve the list names
for (int list_index = 0; list_index < MAX_IFFS; list_index++)
{
// are we within the number of attackees listed?
if (list_index < num_attack_names[cur_iff])
{
// find out who
int target_iff = iff_lookup(attack_names[cur_iff][list_index]);
// valid?
if (target_iff >= 0)
iff->attackee_bitmask |= iff_get_mask(target_iff);
else
Warning(LOCATION, "Attack target IFF %s not found for IFF %s in iff_defs.tbl!\n", attack_names[cur_iff][list_index], iff->iff_name);
}
// are we within the number of colors listed?
if (list_index < num_observed_colors[cur_iff])
{
// find out who
int target_iff = iff_lookup(observed_color_table[cur_iff][list_index].iff_name);
// valid?
if (target_iff >= 0)
iff->observed_color_index[target_iff] = observed_color_table[cur_iff][list_index].color_index;
else
Warning(LOCATION, "Observed color IFF %s not found for IFF %s in iff_defs.tbl!\n", observed_color_table[cur_iff][list_index].iff_name, iff->iff_name);
}
}
// resolve the all teams at war relationships
if (iff->flags & IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR)
{
// exempt, so use standard attacks
iff->attackee_bitmask_all_teams_at_war = iff->attackee_bitmask;
}
else
{
// nonexempt, so build bitmask of all other nonexempt teams
for (int other_iff = 0; other_iff < Num_iffs; other_iff++)
{
// skip myself (unless I attack myself normally)
if ((other_iff == cur_iff) && !iff_x_attacks_y(cur_iff, cur_iff))
continue;
// skip anyone exempt
if (Iff_info[other_iff].flags & IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR)
continue;
// add everyone else
iff->attackee_bitmask_all_teams_at_war |= iff_get_mask(other_iff);
}
}
}
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation("iff_defs.tbl");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "iff_defs.tbl", e.what()));
return;
}
// Goober5000 - if table doesn't exist, use the default table
if (cf_exists_full("iff_defs.tbl", CF_TYPE_TABLES))
read_file_text("iff_defs.tbl", CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("iff_defs.tbl"));
reset_parse();
// parse the table --------------------------------------------------------
required_string("#IFFs");
// get the traitor
required_string("$Traitor IFF:");
stuff_string(traitor_name, F_NAME, NAME_LENGTH);
int rgb[3];
// check if alternate colours are wanted to be used for these
// Marks various stuff... like asteroids
if ((optional_string("$Selection Color:")) || (optional_string("$Selection Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0xff, 0xff, 0xff);
// Marks the ship currently saying something
if ((optional_string("$Message Color:")) || (optional_string("$Message Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0x7f, 0x7f, 0x7f);
// Marks the tagged ships
if ((optional_string("$Tagged Color:")) || (optional_string("$Tagged Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff_init_color(rgb[0], rgb[1], rgb[2]);
}
else
iff_init_color(0xff, 0xff, 0x00);
// init radar blips colour table
int a_bright,a_dim;
bool alternate_blip_color = false;
for (i=0;i<5;i++)
{
for (j=0;j<2;j++)
{
for (k=0;k<3;k++)
{
radar_iff_color[i][j][k] = -1;
}
}
}
// if the bright/dim scaling is wanted to be changed
if (optional_string("$Dimmed IFF brightness:"))
{
int dim_iff_brightness;
stuff_int(&dim_iff_brightness);
Assert(dim_iff_brightness >= 0 && dim_iff_brightness <= HUD_COLOR_ALPHA_MAX);
*iff_color_brightness = dim_iff_brightness;
}
else
*iff_color_brightness = 4;
// alternate = use same method as with ship blips
// retail = use 1/2 intensities
if (optional_string("$Use Alternate Blip Coloring:") || optional_string("$Use Alternate Blip Colouring:"))
{
stuff_boolean(&alternate_blip_color);
}
// Parse blip colours, their order is hardcoded.
if ((optional_string("$Missile Blip Color:")) || (optional_string("$Missile Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i=0;i<3;i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[0][1][i] = rgb[i];
radar_iff_color[0][0][i] = rgb[i]/2;
}
}
if ((optional_string("$Navbuoy Blip Color:")) || (optional_string("$Navbuoy Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i=0;i<3;i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[1][1][i] = rgb[i];
radar_iff_color[1][0][i] = rgb[i]/2;
}
}
if ((optional_string("$Warping Blip Color:")) || (optional_string("$Warping Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i=0;i<3;i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[2][1][i] = rgb[i];
radar_iff_color[2][0][i] = rgb[i]/2;
}
}
if ((optional_string("$Node Blip Color:")) || (optional_string("$Node Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i=0;i<3;i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[3][1][i] = rgb[i];
radar_iff_color[3][0][i] = rgb[i]/2;
}
}
if ((optional_string("$Tagged Blip Color:")) || (optional_string("$Tagged Blip Colour:")))
{
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
for (i=0;i<3;i++)
{
Assert(rgb[i] >= 0 && rgb[i] <= 255);
radar_iff_color[4][1][i] = rgb[i];
radar_iff_color[4][0][i] = rgb[i]/2;
}
}
if (alternate_blip_color == true)
{
a_bright = iff_get_alpha_value(true);
a_dim = iff_get_alpha_value(false);
for (i=0;i<5;i++)
{
if (radar_iff_color[i][0][0] >= 0)
{
for (j=0;j<3;j++)
{
radar_iff_color[i][0][j] = radar_iff_color[i][1][j];
}
radar_iff_color[i][1][3] = a_bright;
radar_iff_color[i][0][3] = a_dim;
}
}
}
else
{
for (i=0;i<5;i++)
{
if (radar_iff_color[i][0][0] >= 0)
{
radar_iff_color[i][0][3] = 255;
radar_iff_color[i][1][3] = 255;
}
}
}
if (optional_string("$Radar Target ID Flags:")) {
parse_string_flag_list((int*)&radar_target_id_flags, rti_flags, Num_rti_flags);
if (optional_string("+reset"))
radar_target_id_flags = 0;
}
// begin reading data
Num_iffs = 0;
while (required_string_either("#End", "$IFF Name:"))
{
iff_info *iff;
int cur_iff;
// make sure we're under the limit
if (Num_iffs >= MAX_IFFS)
{
Warning(LOCATION, "Too many iffs in iffs_defs.tbl! Max is %d.\n", MAX_IFFS);
skip_to_start_of_string("#End", NULL);
break;
}
// add new IFF
iff = &Iff_info[Num_iffs];
cur_iff = Num_iffs;
Num_iffs++;
// get required IFF info ----------------------------------------------
// get the iff name
required_string("$IFF Name:");
stuff_string(iff->iff_name, F_NAME, NAME_LENGTH);
// get the iff color
if (check_for_string("$Colour:"))
required_string("$Colour:");
else
required_string("$Color:");
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
iff->color_index = iff_init_color(rgb[0], rgb[1], rgb[2]);
// get relationships between IFFs -------------------------------------
// get the list of iffs attacked
if (optional_string("$Attacks:"))
num_attack_names[cur_iff] = stuff_string_list(attack_names[cur_iff], MAX_IFFS);
else
num_attack_names[cur_iff] = 0;
// get the list of observed colors
num_observed_colors[cur_iff] = 0;
while (optional_string("+Sees"))
{
// get iff observed
stuff_string_until(observed_color_table[cur_iff][num_observed_colors[cur_iff]].iff_name, "As:", NAME_LENGTH);
required_string("As:");
// get color observed
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
observed_color_table[cur_iff][num_observed_colors[cur_iff]].color_index = iff_init_color(rgb[0], rgb[1], rgb[2]);
// increment
num_observed_colors[cur_iff]++;
}
// get flags ----------------------------------------------------------
// get iff flags
iff->flags = 0;
if (optional_string("$Flags:"))
{
char flag_strings[MAX_IFF_FLAGS][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_IFF_FLAGS);
for (string_idx = 0; string_idx < num_strings; string_idx++)
{
if (!stricmp(NOX("support allowed"), flag_strings[string_idx]))
iff->flags |= IFFF_SUPPORT_ALLOWED;
else if (!stricmp(NOX("exempt from all teams at war"), flag_strings[string_idx]))
iff->flags |= IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR;
else if (!stricmp(NOX("orders hidden"), flag_strings[string_idx]))
iff->flags |= IFFF_ORDERS_HIDDEN;
else if (!stricmp(NOX("orders shown"), flag_strings[string_idx]))
iff->flags |= IFFF_ORDERS_SHOWN;
else if (!stricmp(NOX("wing name hidden"), flag_strings[string_idx]))
iff->flags |= IFFF_WING_NAME_HIDDEN;
else
Warning(LOCATION, "Bogus string in iff flags: %s\n", flag_strings[string_idx]);
}
}
// get default ship flags
iff->default_parse_flags = 0;
if (optional_string("$Default Ship Flags:"))
{
i = 0;
j = 0;
char flag_strings[MAX_PARSE_OBJECT_FLAGS][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS);
for (i = 0; i < num_strings; i++)
{
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS; j++)
{
if (!stricmp(flag_strings[i], Parse_object_flags[j]))
{
iff->default_parse_flags |= (1 << j);
break;
}
}
}
if (j == MAX_PARSE_OBJECT_FLAGS)
Warning(LOCATION, "Bogus string in iff default ship flags: %s\n", flag_strings[i]);
}
// again
iff->default_parse_flags2 = 0;
if (optional_string("$Default Ship Flags2:"))
{
i = 0;
j = 0;
char flag_strings[MAX_PARSE_OBJECT_FLAGS_2][NAME_LENGTH];
int num_strings = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS_2);
for (i = 0; i < num_strings; i++)
{
for (j = 0; j < MAX_PARSE_OBJECT_FLAGS_2; j++)
{
if (!stricmp(flag_strings[i], Parse_object_flags_2[j]))
{
iff->default_parse_flags2 |= (1 << j);
break;
}
}
}
if (j == MAX_PARSE_OBJECT_FLAGS_2)
Warning(LOCATION, "Bogus string in iff default ship flags2: %s\n", flag_strings[i]);
}
// this is cleared between each level but let's just set it here for thoroughness
iff->ai_rearm_timestamp = timestamp(-1);
}
required_string("#End");
// now resolve the relationships ------------------------------------------
// first get the traitor
Iff_traitor = iff_lookup(traitor_name);
if (Iff_traitor < 0)
{
Iff_traitor = 0;
Warning(LOCATION, "Traitor IFF %s not found in iff_defs.tbl! Defaulting to %s.\n", traitor_name, Iff_info[Iff_traitor].iff_name);
}
// next get the attackees and colors
for (int cur_iff = 0; cur_iff < Num_iffs; cur_iff++)
{
iff_info *iff = &Iff_info[cur_iff];
// clear the iffs to be attacked
iff->attackee_bitmask = 0;
iff->attackee_bitmask_all_teams_at_war = 0;
// clear the observed colors
for (j = 0; j < MAX_IFFS; j++)
iff->observed_color_index[j] = -1;
// resolve the list names
for (int list_index = 0; list_index < MAX_IFFS; list_index++)
{
// are we within the number of attackees listed?
if (list_index < num_attack_names[cur_iff])
{
// find out who
int target_iff = iff_lookup(attack_names[cur_iff][list_index]);
// valid?
if (target_iff >= 0)
iff->attackee_bitmask |= iff_get_mask(target_iff);
else
Warning(LOCATION, "Attack target IFF %s not found for IFF %s in iff_defs.tbl!\n", attack_names[cur_iff][list_index], iff->iff_name);
}
// are we within the number of colors listed?
if (list_index < num_observed_colors[cur_iff])
{
// find out who
int target_iff = iff_lookup(observed_color_table[cur_iff][list_index].iff_name);
// valid?
if (target_iff >= 0)
iff->observed_color_index[target_iff] = observed_color_table[cur_iff][list_index].color_index;
else
Warning(LOCATION, "Observed color IFF %s not found for IFF %s in iff_defs.tbl!\n", observed_color_table[cur_iff][list_index].iff_name, iff->iff_name);
}
}
// resolve the all teams at war relationships
if (iff->flags & IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR)
{
// exempt, so use standard attacks
iff->attackee_bitmask_all_teams_at_war = iff->attackee_bitmask;
}
else
{
// nonexempt, so build bitmask of all other nonexempt teams
for (int other_iff = 0; other_iff < Num_iffs; other_iff++)
{
// skip myself (unless I attack myself normally)
if ((other_iff == cur_iff) && !iff_x_attacks_y(cur_iff, cur_iff))
continue;
// skip anyone exempt
if (Iff_info[other_iff].flags & IFFF_EXEMPT_FROM_ALL_TEAMS_AT_WAR)
continue;
// add everyone else
iff->attackee_bitmask_all_teams_at_war |= iff_get_mask(other_iff);
}
}
}
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation("iff_defs.tbl");
}
/**
+1
View File
@@ -2243,6 +2243,7 @@ void labviewer_make_weap_window(Button* caller)
delete type_nodes[i];
}
}
delete[] type_nodes;
Lab_mode = LAB_MODE_WEAPON;
+22 -19
View File
@@ -142,32 +142,35 @@ bool ScreenClassInfoEntry::Parse()
void GUISystem::ParseClassInfo(char* filename)
{
int rval;
if (ClassInfoParsed) {
Warning(LOCATION, "Class info is being parsed twice");
DestroyClassInfo();
}
try
{
read_file_text(filename);
reset_parse();
ScreenClassInfo.Parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("WMCGUI: Unable to parse '%s'! Error code = %i.\n", filename, rval));
bool flag;
do {
ScreenClassInfoEntry* sciep = new ScreenClassInfoEntry;
flag = sciep->Parse();
if (flag) {
list_append(&ScreenClassInfo, sciep);
} else {
delete sciep;
}
} while (flag);
ClassInfoParsed = true;
}
catch (const parse::ParseException& e)
{
mprintf(("WMCGUI: Unable to parse '%s'! Error code = %s.\n", filename, e.what()));
return;
}
read_file_text(filename);
reset_parse();
ScreenClassInfo.Parse();
bool flag;
do {
ScreenClassInfoEntry* sciep = new ScreenClassInfoEntry;
flag = sciep->Parse();
if (flag) {
list_append(&ScreenClassInfo, sciep);
}
} while(flag);
ClassInfoParsed = true;
}
void ClassInfoEntry::Parse(char* tag, int in_type)
+24 -15
View File
@@ -112,7 +112,6 @@ void lcl_init(int lang_init)
char lang_string[128];
const char *ret;
int lang, idx, i;
int rval;
// initialize encryption
encrypt_init();
@@ -121,12 +120,14 @@ void lcl_init(int lang_init)
Lcl_languages.push_back(Lcl_builtin_languages[FS2_OPEN_DEFAULT_LANGUAGE]);
// check string.tbl to see which languages we support
if ( (rval = setjmp(parse_abort)) != 0 ) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "strings.tbl", rval));
}
else {
try
{
parse_stringstbl_quick("strings.tbl");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "strings.tbl", e.what()));
}
parse_modular_table(NOX("*-lcl.tbm"), parse_stringstbl_quick);
@@ -147,7 +148,7 @@ void lcl_init(int lang_init)
if(ret == NULL){
Error(LOCATION, "Default language not found.");
}
}
strcpy_s(lang_string, ret);
@@ -407,7 +408,7 @@ void parse_tstringstbl(const char *filename)
// initialize the xstr table
void lcl_xstr_init()
{
int i, rval;
int i;
for (i = 0; i < XSTR_SIZE; i++)
@@ -417,18 +418,26 @@ void lcl_xstr_init()
Lcl_ext_str[i] = NULL;
if ( (rval = setjmp(parse_abort)) != 0 )
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "strings.tbl", rval));
else
try
{
parse_stringstbl("strings.tbl");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "strings.tbl", e.what()));
}
parse_modular_table(NOX("*-lcl.tbm"), parse_stringstbl);
if ( (rval = setjmp(parse_abort)) != 0 )
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "tstrings.tbl", rval));
else
try
{
parse_tstringstbl("tstrings.tbl");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "tstrings.tbl", e.what()));
}
parse_modular_table(NOX("*-tlc.tbm"), parse_tstringstbl);
@@ -1209,7 +1218,7 @@ void lcl_translate_brief_icon_name_gr(char *name)
} else if ((pos = strstr(name, "Transport")) != NULL) {
pos += 9; // strlen of "transport"
strcpy_s(buf, "Transportowiec");
strcpy_s(buf, "Transporter");
strcat_s(buf, pos);
strcpy(name, buf);
@@ -1356,7 +1365,7 @@ char buf[128];
} else if ((pos = strstr(name, "Transport")) != NULL) {
pos += 9; // strlen of "transport"
strcpy_s(buf, "Transporter");
strcpy_s(buf, "Transportowiec");
strcat_s(buf, pos);
strcpy(name, buf);
+3 -3
View File
@@ -225,7 +225,7 @@ vec3d *vm_vec_avg4(vec3d *dest,vec3d *src0,vec3d *src1,vec3d *src2,vec3d *src3)
}
//scales a vector in place. returns ptr to vector
//scales a vector in place.
#ifndef _INLINE_VECMAT
void vm_vec_scale(vec3d *dest,float s)
{
@@ -236,7 +236,7 @@ void vm_vec_scale(vec3d *dest,float s)
#endif
//scales and copies a vector. returns ptr to dest
//scales and copies a vector.
#ifndef _INLINE_VECMAT
void vm_vec_copy_scale(vec3d *dest,vec3d *src,float s)
{
@@ -288,7 +288,7 @@ void vm_vec_scale_sub2(vec3d *dest,vec3d *src,float k)
}
#endif
//scales a vector in place, taking n/d for scale. returns ptr to vector
//scales a vector in place, taking n/d for scale.
//dest *= n/d
#ifndef _INLINE_VECMAT
void vm_vec_scale2(vec3d *dest,float n,float d)
+118 -118
View File
@@ -279,133 +279,133 @@ int credits_screen_button_pressed(int n)
}
void credits_parse_table(const char* filename)
{
int rval;
{
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
if ((rval = setjmp(parse_abort)) != 0)
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// any metadata?
if (optional_string("$Music:"))
{
stuff_string(Credits_music_name, F_NAME, NAME_LENGTH);
}
if (optional_string("$Number of Images:"))
{
int temp;
stuff_int(&temp);
if (temp > 0)
Credits_num_images = temp;
}
if (optional_string("$Start Image Index:"))
{
stuff_int(&Credits_artwork_index);
// bounds check
if (Credits_artwork_index < 0)
// any metadata?
if (optional_string("$Music:"))
{
Credits_artwork_index = 0;
stuff_string(Credits_music_name, F_NAME, NAME_LENGTH);
}
else if (Credits_artwork_index >= Credits_num_images)
if (optional_string("$Number of Images:"))
{
Credits_artwork_index = Credits_num_images - 1;
int temp;
stuff_int(&temp);
if (temp > 0)
Credits_num_images = temp;
}
}
if (optional_string("$Text scroll rate:"))
{
stuff_float(&Credits_scroll_rate);
if (Credits_scroll_rate < 0.01f)
Credits_scroll_rate = 0.01f;
}
if (optional_string("$Artworks display time:"))
{
stuff_float(&Credits_artwork_display_time);
if (Credits_artwork_display_time < 0.01f)
Credits_artwork_display_time = 0.01f;
}
if (optional_string("$Artworks fade time:"))
{
stuff_float(&Credits_artwork_fade_time);
if (Credits_artwork_fade_time < 0.01f)
Credits_artwork_fade_time = 0.01f;
}
if (optional_string("$SCP Credits position:"))
{
char mode[NAME_LENGTH];
stuff_string(mode, F_NAME, NAME_LENGTH);
if (!stricmp(mode, "Start"))
SCP_credits_position = START;
else if (!stricmp(mode, "End"))
SCP_credits_position = END;
else
Warning(LOCATION, "Unknown credits position mode \"%s\".", mode);
}
ignore_white_space();
SCP_string credits_text;
SCP_string line;
SCP_vector<int> charNum;
SCP_vector<const char*> lines;
int numLines = -1;
bool first_run = true;
while(!check_for_string_raw("#end"))
{
// Read in a line of text
stuff_string_line(line);
// This is a bit odd but it means if a total conversion uses different credits the
// Volition credit won't happen
// Also don't append the default credits anymore when there was already a parsed table
if(first_run && !Credits_parsed && !line.compare(mod_check))
if (optional_string("$Start Image Index:"))
{
credits_text.append(unmodified_credits);
}
stuff_int(&Credits_artwork_index);
first_run = false;
if (line.empty())
{
// If the line is empty then just append a newline, don't bother with splitting it first
credits_text.append("\n");
}
else
{
// split_str doesn't take care of this.
charNum.clear();
// Split the string into multiple lines if it's too long
numLines = split_str(line.c_str(), Credits_text_coords[gr_screen.res][2], charNum, lines, -1);
// Make sure that we have valid data
Assertion(lines.size() == (size_t) numLines, "split_str reported %d lines but vector contains %d entries!", numLines, lines.size());
Assertion(lines.size() <= charNum.size(),
"Something has gone wrong while splitting strings. Got %d lines but only %d chacter lengths.",
lines.size(), charNum.size());
// Now add all splitted lines to the credit text and append a newline to the end
for (int i = 0; i < numLines; i++)
// bounds check
if (Credits_artwork_index < 0)
{
credits_text.append(SCP_string(lines[i], charNum[i]));
credits_text.append("\n");
Credits_artwork_index = 0;
}
else if (Credits_artwork_index >= Credits_num_images)
{
Credits_artwork_index = Credits_num_images - 1;
}
}
if (optional_string("$Text scroll rate:"))
{
stuff_float(&Credits_scroll_rate);
if (Credits_scroll_rate < 0.01f)
Credits_scroll_rate = 0.01f;
}
if (optional_string("$Artworks display time:"))
{
stuff_float(&Credits_artwork_display_time);
if (Credits_artwork_display_time < 0.01f)
Credits_artwork_display_time = 0.01f;
}
if (optional_string("$Artworks fade time:"))
{
stuff_float(&Credits_artwork_fade_time);
if (Credits_artwork_fade_time < 0.01f)
Credits_artwork_fade_time = 0.01f;
}
if (optional_string("$SCP Credits position:"))
{
char mode[NAME_LENGTH];
stuff_string(mode, F_NAME, NAME_LENGTH);
if (!stricmp(mode, "Start"))
SCP_credits_position = START;
else if (!stricmp(mode, "End"))
SCP_credits_position = END;
else
Warning(LOCATION, "Unknown credits position mode \"%s\".", mode);
}
ignore_white_space();
SCP_string credits_text;
SCP_string line;
SCP_vector<int> charNum;
SCP_vector<const char*> lines;
int numLines = -1;
bool first_run = true;
while (!check_for_string_raw("#end"))
{
// Read in a line of text
stuff_string_line(line);
// This is a bit odd but it means if a total conversion uses different credits the
// Volition credit won't happen
// Also don't append the default credits anymore when there was already a parsed table
if (first_run && !Credits_parsed && !line.compare(mod_check))
{
credits_text.append(unmodified_credits);
}
first_run = false;
if (line.empty())
{
// If the line is empty then just append a newline, don't bother with splitting it first
credits_text.append("\n");
}
else
{
// split_str doesn't take care of this.
charNum.clear();
// Split the string into multiple lines if it's too long
numLines = split_str(line.c_str(), Credits_text_coords[gr_screen.res][2], charNum, lines, -1);
// Make sure that we have valid data
Assertion(lines.size() == (size_t)numLines, "split_str reported %d lines but vector contains %d entries!", numLines, lines.size());
Assertion(lines.size() <= charNum.size(),
"Something has gone wrong while splitting strings. Got %d lines but only %d chacter lengths.",
lines.size(), charNum.size());
// Now add all splitted lines to the credit text and append a newline to the end
for (int i = 0; i < numLines; i++)
{
credits_text.append(SCP_string(lines[i], charNum[i]));
credits_text.append("\n");
}
}
}
Credit_text_parts.push_back(credits_text);
Credits_parsed = true;
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
Credit_text_parts.push_back(credits_text);
Credits_parsed = true;
}
void credits_parse()
@@ -645,10 +645,10 @@ void credits_close()
int i;
for (i=0; i<Credits_num_images; i++) {
if (Credits_bmps[i] >= 0) {
if (Credits_bmps[i] >= 0){
bm_release(Credits_bmps[i]);
}
}
}
Credits_bmps.clear();
credits_stop_music(true);
+416 -399
View File
@@ -2079,415 +2079,432 @@ void parse_main_hall_table(const char* filename)
{
SCP_vector<main_hall_defines> temp_vector;
main_hall_defines *m, temp;
int idx, s_idx, m_idx, rval;
int idx, s_idx, m_idx;
int num_resolutions = 2;
unsigned int count;
char temp_string[MAX_FILENAME_LEN];
SCP_string temp_scp_string;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
try
{
read_file_text(filename, CF_TYPE_TABLES);
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
reset_parse();
if (optional_string("$Num Resolutions:")) {
stuff_int(&num_resolutions);
}
if (num_resolutions < 1) {
Error(LOCATION, "$Num Resolutions in %s is %d. (Must be 1 or greater)", filename, num_resolutions);
}
// go for it
count = Main_hall_defines.size();
while (!optional_string("#end")) {
Main_hall_defines.push_back(temp_vector);
// read in all resolutions
for (m_idx = 0; m_idx < num_resolutions; m_idx++) {
Main_hall_defines.at(count).push_back(temp);
m = &Main_hall_defines.at(count).at(m_idx);
// ready
required_string("$Main Hall");
// Parse the entry name for the first resolution, checking for duplicates and erroring if necessary
if (m_idx == 0) {
if (optional_string("+Name:")) {
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
// we can't have two mainhalls with the same name
if (main_hall_get_pointer(temp_string) == NULL) {
m->name = temp_string;
} else {
Error(LOCATION, "A mainhall with the name '%s' already exists. All mainhalls must have unique names.", temp_string);
}
} else {
snprintf(temp_string, MAX_FILENAME_LEN, "%d", count);
m->name = temp_string;
}
} else {
if (optional_string("+Name:")) {
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
/**
* the reason that this is an error is that even if we were to change the names to match
* it is very likely the user would get the wrong mainhall loaded since their campaign files
* may still refer to the entry with the incorrect name
*/
if (strcmp(temp_string, Main_hall_defines.at(count).at(0).name.c_str()) != 0) {
Error(LOCATION, "The mainhall '%s' has different names for different resolutions. All resolutions must have the same name. Either remove the hi-res entries' names entirely or set them to match the first resolution entry's name.", Main_hall_defines.at(0).at(count).name.c_str());
}
}
m->name = Main_hall_defines.at(count).at(0).name;
}
// add cheats
while (optional_string("+Cheat String:")) {
stuff_string(temp_scp_string, F_RAW);
m->cheat.push_back(temp_scp_string);
if(temp_scp_string.size() > MAIN_HALL_MAX_CHEAT_LEN) {
// Since the value is longer than the cheat buffer it will never match.
Warning(LOCATION, "The value '%s' for '+Cheat String:' is too long! It can be at most %d characters long.", temp_scp_string.size(), MAIN_HALL_MAX_CHEAT_LEN);
}
required_string("+Anim To Change:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_from.push_back(temp_scp_string);
required_string("+Anim To Change To:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_to.push_back(temp_scp_string);
}
// minimum resolution
if (optional_string("+Min Resolution:")) {
stuff_int(&m->min_width);
stuff_int(&m->min_height);
} else if (m_idx == 0) {
m->min_width = 0;
m->min_height = 0;
} else {
m->min_width = GR_1024_THRESHOLD_WIDTH;
m->min_height = GR_1024_THRESHOLD_HEIGHT;
}
// minimum aspect ratio
if (optional_string("+Min Aspect Ratio:")) {
stuff_float(&m->min_aspect_ratio);
} else {
m->min_aspect_ratio = 0.0f;
}
// bitmap and mask
required_string("+Bitmap:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->bitmap = temp_string;
required_string("+Mask:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->mask = temp_string;
required_string("+Music:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->music_name = temp_string;
// Goober5000
if (optional_string("+Substitute Music:")) {
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->substitute_music_name = temp_string;
}
if (optional_string("+Help Overlay:")) {
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->help_overlay_name = temp_string;
}
if (optional_string("+Help Overlay Resolution Index:")) {
stuff_int(&m->help_overlay_resolution_index);
} else {
m->help_overlay_resolution_index = m_idx;
}
// zoom area
if (optional_string("+Zoom To:")) {
stuff_int(&m->zoom_area_width);
stuff_int(&m->zoom_area_height);
} else {
m->zoom_area_width = -1;
m->zoom_area_height = -1;
}
// intercom sounds
required_string("+Num Intercom Sounds:");
stuff_int(&m->num_random_intercom_sounds);
// initialise intercom sounds vectors
intercom_sounds_init(*m);
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom delay
required_string("+Intercom delay:");
stuff_int(&m->intercom_delay.at(idx).at(0));
stuff_int(&m->intercom_delay.at(idx).at(1));
}
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom sound id
parse_sound("+Intercom sound:", &m->intercom_sounds.at(idx), "+Intercom sound:", PARSE_SOUND_INTERFACE_SOUND);
}
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom pan
required_string("+Intercom pan:");
stuff_float(&m->intercom_sound_pan.at(idx));
}
// misc animations
required_string("+Num Misc Animations:");
stuff_int(&m->num_misc_animations);
// initialise the misc anim vectors
misc_anim_init(*m);
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim names
required_string("+Misc anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->misc_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim groups, optionally
if (optional_string("+Misc anim group:")) {
stuff_int(&m->misc_anim_group.at(idx));
} else {
m->misc_anim_group.at(idx) = -1;
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim delay
required_string("+Misc anim delay:");
stuff_int(&m->misc_anim_delay.at(idx).at(0));
stuff_int(&m->misc_anim_delay.at(idx).at(1));
stuff_int(&m->misc_anim_delay.at(idx).at(2));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim coords
required_string("+Misc anim coords:");
stuff_int(&m->misc_anim_coords.at(idx).at(0));
stuff_int(&m->misc_anim_coords.at(idx).at(1));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim mode
required_string("+Misc anim mode:");
stuff_int(&m->misc_anim_modes.at(idx));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim pan
required_string("+Misc anim pan:");
stuff_float(&m->misc_anim_sound_pan.at(idx));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound id
parse_sound_list("+Misc anim sounds:", m->misc_anim_special_sounds.at(idx), "+Misc anim sounds:", PARSE_SOUND_INTERFACE_SOUND);
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound triggers
required_string("+Misc anim trigger:");
int temp_int = 0;
stuff_int(&temp_int);
for (s_idx = 0; s_idx < temp_int; s_idx++) {
m->misc_anim_special_trigger.at(idx).push_back(0);
stuff_int(&m->misc_anim_special_trigger.at(idx).at(s_idx));
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound handles - deprecated, but deal with it just in case
if (optional_string("+Misc anim handles:")) {
advance_to_eoln(NULL);
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound flags - table flag deprecated, so ignore user input
if (optional_string("+Misc anim flags:")) {
advance_to_eoln(NULL);
}
// we need one flag for each sound
Assert(m->misc_anim_special_sounds.at(idx).size() < INT_MAX);
for (s_idx = 0; s_idx < (int)m->misc_anim_special_sounds.at(idx).size(); s_idx++) {
m->misc_anim_sound_flag.at(idx).push_back(0);
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// render over doors - default to false
if (optional_string("+Misc anim over doors:")) {
bool temp_b;
stuff_boolean(&temp_b);
m->misc_anim_over_doors.push_back(temp_b);
} else {
m->misc_anim_over_doors.push_back(0);
}
}
region_info_init(*m);
// door animations
required_string("+Num Door Animations:");
stuff_int(&m->num_door_animations);
// initialise the door anim vectors
door_anim_init(*m);
for (idx = 0; idx < m->num_door_animations; idx++) {
// door name
required_string("+Door anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->door_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door coords
required_string("+Door coords:");
stuff_int(&m->door_anim_coords.at(idx).at(0));
stuff_int(&m->door_anim_coords.at(idx).at(1));
stuff_int(&m->door_anim_coords.at(idx).at(2));
stuff_int(&m->door_anim_coords.at(idx).at(3));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door open and close sounds
parse_sound_list("+Door sounds:", m->door_sounds.at(idx), "+Door sounds:", (parse_sound_flags)(PARSE_SOUND_INTERFACE_SOUND | PARSE_SOUND_SCP_SOUND_LIST));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door pan value
required_string("+Door pan:");
stuff_float(&m->door_sound_pan[idx]);
}
int mask;
for (idx = 0; optional_string("+Door mask value:"); idx++) {
// door mask
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
mask = (int) strtol(temp_string, NULL, 0);
mask = 255 - mask;
if(idx >= (int) m->regions.size()) {
m->regions.resize(idx + 1);
}
m->regions[idx].mask = mask;
}
for (idx = 0; optional_string("+Door action:"); idx++) {
// door action
if(idx >= (int) m->regions.size()) {
m->regions.resize(idx + 1);
}
if (optional_string("Script")) {
m->regions[idx].action = SCRIPT_REGION;
stuff_string(m->regions[idx].lua_action, F_RAW);
} else {
stuff_string(temp_scp_string, F_RAW);
int action = -1;
for (int i = 0; Main_hall_region_map[i].name != NULL; i++) {
if (temp_scp_string == Main_hall_region_map[i].name) {
action = Main_hall_region_map[i].mask;
break;
}
}
if (action == -1) {
SCP_string err_msg = "";
for (int i = 0; Main_hall_region_map[i].name != NULL; i++) {
if (i != 0) {
err_msg += ", ";
}
err_msg += Main_hall_region_map[i].name;
}
Error(LOCATION, "Unkown Door Region '%s'! Expected one of: %s", temp_scp_string.c_str(), err_msg.c_str());
}
m->regions[idx].action = action;
}
}
for (idx = 0; optional_string("+Door key:"); idx++) {
// door key
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
if ((int) m->regions.size() <= idx) {
m->regions.resize(idx + 1);
}
m->regions[idx].key = temp_string[0];
}
for (idx = 0; optional_string("+Door description:"); idx++) {
// region description (tooltip)
stuff_string(temp_scp_string, F_MESSAGE);
if (temp_scp_string != "default") {
if(idx >= (int) m->regions.size()) {
m->regions.resize(idx + 1);
}
m->regions[idx].description = temp_scp_string;
if (idx == 2) {
m->default_readyroom = false;
}
}
}
// font for tooltips and other text
if (optional_string("+Font:")) {
stuff_int(&m->font);
} else {
m->font = FONT1;
}
// tooltip padding
if (optional_string("+Tooltip Padding:")) {
stuff_int(&m->tooltip_padding);
} else {
m->tooltip_padding = -1; // we'll get the default value later
}
// tooltip y location
if (optional_string("+Tooltip Y:")) {
stuff_int(&m->region_yval);
} else {
m->region_yval = -1;
}
if (optional_string("$Num Resolutions:")) {
stuff_int(&num_resolutions);
}
count++;
}
if (num_resolutions < 1) {
Error(LOCATION, "$Num Resolutions in %s is %d. (Must be 1 or greater)", filename, num_resolutions);
}
// free up memory from parsing the mainhall tbl
stop_parse();
// go for it
count = Main_hall_defines.size();
while (!optional_string("#end")) {
Main_hall_defines.push_back(temp_vector);
// read in all resolutions
for (m_idx = 0; m_idx < num_resolutions; m_idx++) {
Main_hall_defines.at(count).push_back(temp);
m = &Main_hall_defines.at(count).at(m_idx);
// ready
required_string("$Main Hall");
// Parse the entry name for the first resolution, checking for duplicates and erroring if necessary
if (m_idx == 0) {
if (optional_string("+Name:")) {
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
// we can't have two mainhalls with the same name
if (main_hall_get_pointer(temp_string) == NULL) {
m->name = temp_string;
}
else {
Error(LOCATION, "A mainhall with the name '%s' already exists. All mainhalls must have unique names.", temp_string);
}
}
else {
snprintf(temp_string, MAX_FILENAME_LEN, "%d", count);
m->name = temp_string;
}
}
else {
if (optional_string("+Name:")) {
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
/**
* the reason that this is an error is that even if we were to change the names to match
* it is very likely the user would get the wrong mainhall loaded since their campaign files
* may still refer to the entry with the incorrect name
*/
if (strcmp(temp_string, Main_hall_defines.at(count).at(0).name.c_str()) != 0) {
Error(LOCATION, "The mainhall '%s' has different names for different resolutions. All resolutions must have the same name. Either remove the hi-res entries' names entirely or set them to match the first resolution entry's name.", Main_hall_defines.at(0).at(count).name.c_str());
}
}
m->name = Main_hall_defines.at(count).at(0).name;
}
// add cheats
while (optional_string("+Cheat String:")) {
stuff_string(temp_scp_string, F_RAW);
m->cheat.push_back(temp_scp_string);
if (temp_scp_string.size() > MAIN_HALL_MAX_CHEAT_LEN) {
// Since the value is longer than the cheat buffer it will never match.
Warning(LOCATION, "The value '%s' for '+Cheat String:' is too long! It can be at most %d characters long.", temp_scp_string.size(), MAIN_HALL_MAX_CHEAT_LEN);
}
required_string("+Anim To Change:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_from.push_back(temp_scp_string);
required_string("+Anim To Change To:");
stuff_string(temp_scp_string, F_NAME);
m->cheat_anim_to.push_back(temp_scp_string);
}
// minimum resolution
if (optional_string("+Min Resolution:")) {
stuff_int(&m->min_width);
stuff_int(&m->min_height);
}
else if (m_idx == 0) {
m->min_width = 0;
m->min_height = 0;
}
else {
m->min_width = GR_1024_THRESHOLD_WIDTH;
m->min_height = GR_1024_THRESHOLD_HEIGHT;
}
// minimum aspect ratio
if (optional_string("+Min Aspect Ratio:")) {
stuff_float(&m->min_aspect_ratio);
}
else {
m->min_aspect_ratio = 0.0f;
}
// bitmap and mask
required_string("+Bitmap:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->bitmap = temp_string;
required_string("+Mask:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->mask = temp_string;
required_string("+Music:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->music_name = temp_string;
// Goober5000
if (optional_string("+Substitute Music:")) {
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->substitute_music_name = temp_string;
}
if (optional_string("+Help Overlay:")) {
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->help_overlay_name = temp_string;
}
if (optional_string("+Help Overlay Resolution Index:")) {
stuff_int(&m->help_overlay_resolution_index);
}
else {
m->help_overlay_resolution_index = m_idx;
}
// zoom area
if (optional_string("+Zoom To:")) {
stuff_int(&m->zoom_area_width);
stuff_int(&m->zoom_area_height);
}
else {
m->zoom_area_width = -1;
m->zoom_area_height = -1;
}
// intercom sounds
required_string("+Num Intercom Sounds:");
stuff_int(&m->num_random_intercom_sounds);
// initialise intercom sounds vectors
intercom_sounds_init(*m);
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom delay
required_string("+Intercom delay:");
stuff_int(&m->intercom_delay.at(idx).at(0));
stuff_int(&m->intercom_delay.at(idx).at(1));
}
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom sound id
parse_sound("+Intercom sound:", &m->intercom_sounds.at(idx), "+Intercom sound:", PARSE_SOUND_INTERFACE_SOUND);
}
for (idx = 0; idx < m->num_random_intercom_sounds; idx++) {
// intercom pan
required_string("+Intercom pan:");
stuff_float(&m->intercom_sound_pan.at(idx));
}
// misc animations
required_string("+Num Misc Animations:");
stuff_int(&m->num_misc_animations);
// initialise the misc anim vectors
misc_anim_init(*m);
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim names
required_string("+Misc anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->misc_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim groups, optionally
if (optional_string("+Misc anim group:")) {
stuff_int(&m->misc_anim_group.at(idx));
}
else {
m->misc_anim_group.at(idx) = -1;
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim delay
required_string("+Misc anim delay:");
stuff_int(&m->misc_anim_delay.at(idx).at(0));
stuff_int(&m->misc_anim_delay.at(idx).at(1));
stuff_int(&m->misc_anim_delay.at(idx).at(2));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim coords
required_string("+Misc anim coords:");
stuff_int(&m->misc_anim_coords.at(idx).at(0));
stuff_int(&m->misc_anim_coords.at(idx).at(1));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim mode
required_string("+Misc anim mode:");
stuff_int(&m->misc_anim_modes.at(idx));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim pan
required_string("+Misc anim pan:");
stuff_float(&m->misc_anim_sound_pan.at(idx));
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound id
parse_sound_list("+Misc anim sounds:", m->misc_anim_special_sounds.at(idx), "+Misc anim sounds:", PARSE_SOUND_INTERFACE_SOUND);
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound triggers
required_string("+Misc anim trigger:");
int temp_int = 0;
stuff_int(&temp_int);
for (s_idx = 0; s_idx < temp_int; s_idx++) {
m->misc_anim_special_trigger.at(idx).push_back(0);
stuff_int(&m->misc_anim_special_trigger.at(idx).at(s_idx));
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound handles - deprecated, but deal with it just in case
if (optional_string("+Misc anim handles:")) {
advance_to_eoln(NULL);
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// anim sound flags - table flag deprecated, so ignore user input
if (optional_string("+Misc anim flags:")) {
advance_to_eoln(NULL);
}
// we need one flag for each sound
Assert(m->misc_anim_special_sounds.at(idx).size() < INT_MAX);
for (s_idx = 0; s_idx < (int)m->misc_anim_special_sounds.at(idx).size(); s_idx++) {
m->misc_anim_sound_flag.at(idx).push_back(0);
}
}
for (idx = 0; idx < m->num_misc_animations; idx++) {
// render over doors - default to false
if (optional_string("+Misc anim over doors:")) {
bool temp_b;
stuff_boolean(&temp_b);
m->misc_anim_over_doors.push_back(temp_b);
}
else {
m->misc_anim_over_doors.push_back(0);
}
}
region_info_init(*m);
// door animations
required_string("+Num Door Animations:");
stuff_int(&m->num_door_animations);
// initialise the door anim vectors
door_anim_init(*m);
for (idx = 0; idx < m->num_door_animations; idx++) {
// door name
required_string("+Door anim:");
stuff_string(temp_string, F_NAME, MAX_FILENAME_LEN);
m->door_anim_name.at(idx) = (SCP_string)temp_string;
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door coords
required_string("+Door coords:");
stuff_int(&m->door_anim_coords.at(idx).at(0));
stuff_int(&m->door_anim_coords.at(idx).at(1));
stuff_int(&m->door_anim_coords.at(idx).at(2));
stuff_int(&m->door_anim_coords.at(idx).at(3));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door open and close sounds
parse_sound_list("+Door sounds:", m->door_sounds.at(idx), "+Door sounds:", (parse_sound_flags)(PARSE_SOUND_INTERFACE_SOUND | PARSE_SOUND_SCP_SOUND_LIST));
}
for (idx = 0; idx < m->num_door_animations; idx++) {
// door pan value
required_string("+Door pan:");
stuff_float(&m->door_sound_pan[idx]);
}
int mask;
for (idx = 0; optional_string("+Door mask value:"); idx++) {
// door mask
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
mask = (int)strtol(temp_string, NULL, 0);
mask = 255 - mask;
if (idx >= (int)m->regions.size()) {
m->regions.resize(idx + 1);
}
m->regions[idx].mask = mask;
}
for (idx = 0; optional_string("+Door action:"); idx++) {
// door action
if (idx >= (int)m->regions.size()) {
m->regions.resize(idx + 1);
}
if (optional_string("Script")) {
m->regions[idx].action = SCRIPT_REGION;
stuff_string(m->regions[idx].lua_action, F_RAW);
}
else {
stuff_string(temp_scp_string, F_RAW);
int action = -1;
for (int i = 0; Main_hall_region_map[i].name != NULL; i++) {
if (temp_scp_string == Main_hall_region_map[i].name) {
action = Main_hall_region_map[i].mask;
break;
}
}
if (action == -1) {
SCP_string err_msg = "";
for (int i = 0; Main_hall_region_map[i].name != NULL; i++) {
if (i != 0) {
err_msg += ", ";
}
err_msg += Main_hall_region_map[i].name;
}
Error(LOCATION, "Unkown Door Region '%s'! Expected one of: %s", temp_scp_string.c_str(), err_msg.c_str());
}
m->regions[idx].action = action;
}
}
for (idx = 0; optional_string("+Door key:"); idx++) {
// door key
stuff_string(temp_string, F_RAW, MAX_FILENAME_LEN);
if ((int)m->regions.size() <= idx) {
m->regions.resize(idx + 1);
}
m->regions[idx].key = temp_string[0];
}
for (idx = 0; optional_string("+Door description:"); idx++) {
// region description (tooltip)
stuff_string(temp_scp_string, F_MESSAGE);
if (temp_scp_string != "default") {
if (idx >= (int)m->regions.size()) {
m->regions.resize(idx + 1);
}
m->regions[idx].description = temp_scp_string;
if (idx == 2) {
m->default_readyroom = false;
}
}
}
// font for tooltips and other text
if (optional_string("+Font:")) {
stuff_int(&m->font);
}
else {
m->font = FONT1;
}
// tooltip padding
if (optional_string("+Tooltip Padding:")) {
stuff_int(&m->tooltip_padding);
}
else {
m->tooltip_padding = -1; // we'll get the default value later
}
// tooltip y location
if (optional_string("+Tooltip Y:")) {
stuff_int(&m->region_yval);
}
else {
m->region_yval = -1;
}
}
count++;
}
// free up memory from parsing the mainhall tbl
stop_parse();
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
/**
+16 -15
View File
@@ -1292,25 +1292,26 @@ int Player_tips_shown = 0;
// tooltips
void player_tips_init()
{
int rval;
Num_player_tips = 0;
try
{
read_file_text("tips.tbl", CF_TYPE_TABLES);
reset_parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "tips.tbl", rval));
return;
}
while (!optional_string("#end")) {
required_string("+Tip:");
read_file_text("tips.tbl", CF_TYPE_TABLES);
reset_parse();
while(!optional_string("#end")) {
required_string("+Tip:");
if(Num_player_tips >= MAX_PLAYER_TIPS) {
break;
if (Num_player_tips >= MAX_PLAYER_TIPS) {
break;
}
Player_tips[Num_player_tips++] = stuff_and_malloc_string(F_NAME, NULL);
}
Player_tips[Num_player_tips++] = stuff_and_malloc_string(F_NAME, NULL);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "tips.tbl", e.what()));
return;
}
}
+41 -38
View File
@@ -1026,51 +1026,54 @@ int techroom_load_ani(anim **animpp, char *name)
void techroom_intel_init()
{
int rval, temp;
int temp;
static int inited = 0;
if (inited)
return;
try
{
read_file_text("species.tbl", CF_TYPE_TABLES);
reset_parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "species.tbl", rval));
Intel_info_size = 0;
while (optional_string("$Entry:")) {
Assert(Intel_info_size < MAX_INTEL_ENTRIES);
if (Intel_info_size >= MAX_INTEL_ENTRIES) {
mprintf(("TECHMENU: Too many intel entries!\n"));
break;
}
Intel_info[Intel_info_size].flags = IIF_DEFAULT_VALUE;
required_string("$Name:");
stuff_string(Intel_info[Intel_info_size].name, F_NAME, NAME_LENGTH);
required_string("$Anim:");
stuff_string(Intel_info[Intel_info_size].anim_filename, F_NAME, NAME_LENGTH);
required_string("$AlwaysInTechRoom:");
stuff_int(&temp);
if (temp) {
// set default to align with what we read - Goober5000
Intel_info[Intel_info_size].flags |= IIF_IN_TECH_DATABASE;
Intel_info[Intel_info_size].flags |= IIF_DEFAULT_IN_TECH_DATABASE;
}
required_string("$Description:");
stuff_string(Intel_info[Intel_info_size].desc, F_MULTITEXT, TECH_INTEL_DESC_LEN);
Intel_info_size++;
}
inited = 1;
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "species.tbl", e.what()));
return;
}
read_file_text("species.tbl", CF_TYPE_TABLES);
reset_parse();
Intel_info_size = 0;
while (optional_string("$Entry:")) {
Assert(Intel_info_size < MAX_INTEL_ENTRIES);
if (Intel_info_size >= MAX_INTEL_ENTRIES) {
mprintf(("TECHMENU: Too many intel entries!\n"));
break;
}
Intel_info[Intel_info_size].flags = IIF_DEFAULT_VALUE;
required_string("$Name:");
stuff_string(Intel_info[Intel_info_size].name, F_NAME, NAME_LENGTH);
required_string("$Anim:");
stuff_string(Intel_info[Intel_info_size].anim_filename, F_NAME, NAME_LENGTH);
required_string("$AlwaysInTechRoom:");
stuff_int(&temp);
if (temp) {
// set default to align with what we read - Goober5000
Intel_info[Intel_info_size].flags |= IIF_IN_TECH_DATABASE;
Intel_info[Intel_info_size].flags |= IIF_DEFAULT_IN_TECH_DATABASE;
}
required_string("$Description:");
stuff_string(Intel_info[Intel_info_size].desc, F_MULTITEXT, TECH_INTEL_DESC_LEN);
Intel_info_size++;
}
inited = 1;
}
void techroom_init()
+60 -59
View File
@@ -274,77 +274,78 @@ int brief_text_wipe_finished();
//
void brief_parse_icon_tbl()
{
int rval, icon;
int icon;
size_t species;
char name[MAX_FILENAME_LEN];
Assert(!Species_info.empty());
const size_t max_icons = Species_info.size() * MIN_BRIEF_ICONS;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "icons.tbl", rval));
return;
}
read_file_text("icons.tbl", CF_TYPE_TABLES);
reset_parse();
required_string("#Start");
Briefing_icon_info.clear();
while (required_string_either("#End","$Name:"))
try
{
if(Briefing_icon_info.size() >= max_icons) {
Warning(LOCATION, "Too many icons in icons.tbl; only the first %d will be used", max_icons);
skip_to_start_of_string("#End");
break;
}
read_file_text("icons.tbl", CF_TYPE_TABLES);
reset_parse();
briefing_icon_info bii;
required_string("#Start");
// parse regular frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
generic_anim_init(&bii.regular, name);
// parse fade frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
hud_anim_init(&bii.fade, 0, 0, name);
// parse highlighting frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
hud_anim_init(&bii.highlight, 0, 0, name);
// add it to the collection
Briefing_icon_info.push_back(bii);
}
required_string("#End");
// now assign the icons to their species
const size_t num_species_covered = Briefing_icon_info.size() / MIN_BRIEF_ICONS;
size_t bii_index = 0;
for (icon = 0; icon < MIN_BRIEF_ICONS; icon++)
{
for (species = 0; species < num_species_covered; species++)
Species_info[species].bii_index[icon] = bii_index++;
}
// error check
if (num_species_covered < Species_info.size())
{
SCP_string errormsg = "The following species are missing icon info in icons.tbl:\n";
for (species = num_species_covered; species < Species_info.size(); species++)
Briefing_icon_info.clear();
while (required_string_either("#End", "$Name:"))
{
errormsg += Species_info[species].species_name;
errormsg += "\n";
if (Briefing_icon_info.size() >= max_icons) {
Warning(LOCATION, "Too many icons in icons.tbl; only the first %d will be used", max_icons);
skip_to_start_of_string("#End");
break;
}
briefing_icon_info bii;
// parse regular frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
generic_anim_init(&bii.regular, name);
// parse fade frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
hud_anim_init(&bii.fade, 0, 0, name);
// parse highlighting frames
required_string("$Name:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
hud_anim_init(&bii.highlight, 0, 0, name);
// add it to the collection
Briefing_icon_info.push_back(bii);
}
required_string("#End");
// now assign the icons to their species
const size_t num_species_covered = Briefing_icon_info.size() / MIN_BRIEF_ICONS;
size_t bii_index = 0;
for (icon = 0; icon < MIN_BRIEF_ICONS; icon++)
{
for (species = 0; species < num_species_covered; species++)
Species_info[species].bii_index[icon] = bii_index++;
}
Error(LOCATION, errormsg.c_str());
// error check
if (num_species_covered < Species_info.size())
{
SCP_string errormsg = "The following species are missing icon info in icons.tbl:\n";
for (species = num_species_covered; species < Species_info.size(); species++)
{
errormsg += Species_info[species].species_name;
errormsg += "\n";
}
Error(LOCATION, errormsg.c_str());
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "icons.tbl", e.what()));
}
}
+215 -199
View File
@@ -100,7 +100,7 @@ bool campaign_is_ignored(const char *filename);
*/
int mission_campaign_get_info(const char *filename, char *name, int *type, int *max_players, char **desc)
{
int rval, i, success = 0;
int i, success = 0;
char campaign_type[NAME_LENGTH], fname[MAX_FILENAME_LEN];
Assert( name != NULL );
@@ -116,53 +116,57 @@ int mission_campaign_get_info(const char *filename, char *name, int *type, int *
*type = -1;
do {
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error code = %i.\n", fname, rval));
break;
}
try
{
read_file_text(fname);
reset_parse();
read_file_text(fname);
reset_parse();
required_string("$Name:");
stuff_string(name, F_NAME, NAME_LENGTH);
if (name == NULL) {
nprintf(("Warning", "No name found for campaign file %s\n", filename));
break;
}
required_string("$Name:");
stuff_string( name, F_NAME, NAME_LENGTH );
if (name == NULL) {
nprintf(("Warning", "No name found for campaign file %s\n", filename));
break;
}
required_string("$Type:");
stuff_string(campaign_type, F_NAME, NAME_LENGTH);
required_string("$Type:");
stuff_string( campaign_type, F_NAME, NAME_LENGTH );
for (i = 0; i < MAX_CAMPAIGN_TYPES; i++) {
if (!stricmp(campaign_type, campaign_types[i])) {
*type = i;
}
}
for (i=0; i<MAX_CAMPAIGN_TYPES; i++) {
if ( !stricmp(campaign_type, campaign_types[i]) ) {
*type = i;
if (name == NULL) {
Warning(LOCATION, "Invalid campaign type \"%s\"\n", campaign_type);
break;
}
if (desc) {
if (optional_string("+Description:")) {
*desc = stuff_and_malloc_string(F_MULTITEXT, NULL);
}
else {
*desc = NULL;
}
}
// if this is a multiplayer campaign, get the max players
if ((*type) != CAMPAIGN_TYPE_SINGLE) {
skip_to_string("+Num Players:");
stuff_int(max_players);
}
// if we found a valid campaign type
if ((*type) >= 0) {
success = 1;
}
}
if (name == NULL) {
Warning(LOCATION, "Invalid campaign type \"%s\"\n", campaign_type);
catch (const parse::ParseException& e)
{
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error message = %s.\n", fname, e.what()));
break;
}
if (desc) {
if (optional_string("+Description:")) {
*desc = stuff_and_malloc_string(F_MULTITEXT, NULL);
} else {
*desc = NULL;
}
}
// if this is a multiplayer campaign, get the max players
if ((*type) != CAMPAIGN_TYPE_SINGLE) {
skip_to_string("+Num Players:");
stuff_int(max_players);
}
// if we found a valid campaign type
if ((*type) >= 0) {
success = 1;
}
} while (0);
Assert(success);
@@ -176,22 +180,14 @@ int mission_campaign_get_info(const char *filename, char *name, int *type, int *
*/
int mission_campaign_get_mission_list(const char *filename, char **list, int max)
{
int rval, i, num = 0;
int i, num = 0;
char name[MAX_FILENAME_LEN];
filename = cf_add_ext(filename, FS_CAMPAIGN_FILE_EXT);
// read the campaign file and get the list of mission filenames
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
// since we can't return count of allocated elements, free them instead
for (i=0; i<num; i++)
vm_free(list[i]);
num = -1;
} else {
try
{
read_file_text(filename);
reset_parse();
@@ -203,6 +199,16 @@ int mission_campaign_get_mission_list(const char *filename, char **list, int max
Warning(LOCATION, "Maximum number of missions exceeded (%d)!", max);
}
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
// since we can't return count of allocated elements, free them instead
for (i = 0; i<num; i++)
vm_free(list[i]);
num = -1;
}
return num;
}
@@ -241,10 +247,10 @@ int mission_campaign_maybe_add(const char *filename)
char *desc = NULL;
int type, max_players;
// don't add ignored campaigns
if (campaign_is_ignored(filename)) {
return 0;
}
// don't add ignored campaigns
if (campaign_is_ignored(filename)) {
return 0;
}
if ( mission_campaign_get_info( filename, name, &type, &max_players, &desc) ) {
if ( !MC_multiplayer && (type == CAMPAIGN_TYPE_SINGLE) ) {
@@ -410,7 +416,7 @@ void mission_campaign_get_sw_info()
*/
int mission_campaign_load( char *filename, player *pl, int load_savefile, bool reset_stats )
{
int len, rval, i;
int len, i;
char name[NAME_LENGTH], type[NAME_LENGTH], temp[NAME_LENGTH];
if (campaign_is_ignored(filename)) {
@@ -429,21 +435,8 @@ int mission_campaign_load( char *filename, player *pl, int load_savefile, bool r
}
// read the mission file and get the list of mission filenames
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("Error parsing '%s'\r\nError code = %i.\r\n", filename, rval));
Campaign.filename[0] = 0;
Campaign.num_missions = 0;
if ( !Fred_running && !(Game_mode & GM_MULTIPLAYER) ) {
Campaign_file_missing = 1;
Campaign_load_failure = CAMPAIGN_ERROR_MISSING;
return CAMPAIGN_ERROR_MISSING;
}
return CAMPAIGN_ERROR_CORRUPT;
} else {
try
{
// be sure to remove all old malloced strings of Mission_names
// we must also free any goal stuff that was from a previous campaign
// this also frees sexpressions so the next call to init_sexp will be able to reclaim
@@ -643,6 +636,21 @@ int mission_campaign_load( char *filename, player *pl, int load_savefile, bool r
Campaign.num_missions++;
}
}
catch (const parse::ParseException& e)
{
mprintf(("Error parsing '%s'\r\nError message = %s.\r\n", filename, e.what()));
Campaign.filename[0] = 0;
Campaign.num_missions = 0;
if (!Fred_running && !(Game_mode & GM_MULTIPLAYER)) {
Campaign_file_missing = 1;
Campaign_load_failure = CAMPAIGN_ERROR_MISSING;
return CAMPAIGN_ERROR_MISSING;
}
return CAMPAIGN_ERROR_CORRUPT;
}
// set up the other variables for the campaign stuff. After initializing, we must try and load
// the campaign save file for this player. Since all campaign loads go through this routine, I
@@ -1406,14 +1414,9 @@ void mission_campaign_clear()
*/
int mission_campaign_get_filenames(char *filename, char dest[][NAME_LENGTH], int *num)
{
int rval;
// read the mission file and get the list of mission filenames
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return rval;
} else {
try
{
Assert( strlen(filename) < MAX_FILENAME_LEN ); // make sure no overflow
read_file_text(filename);
reset_parse();
@@ -1431,6 +1434,11 @@ int mission_campaign_get_filenames(char *filename, char dest[][NAME_LENGTH], int
(*num)++;
}
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return 1;
}
return 0;
}
@@ -1443,110 +1451,115 @@ void read_mission_goal_list(int num)
{
char *filename, notes[NOTES_LENGTH], goals[MAX_GOALS][NAME_LENGTH];
char events[MAX_MISSION_EVENTS][NAME_LENGTH];
int i, z, rval, event_count, count = 0;
int i, z, event_count, count = 0;
filename = Campaign.missions[num].name;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
try
{
read_file_text(filename);
reset_parse();
init_sexp();
// first, read the mission notes for this mission. Used in campaign editor
if (skip_to_string("#Mission Info")) {
if (skip_to_string("$Notes:")) {
stuff_string(notes, F_NOTES, NOTES_LENGTH);
if (Campaign.missions[num].notes){
vm_free(Campaign.missions[num].notes);
}
Campaign.missions[num].notes = (char *)vm_malloc(strlen(notes) + 1);
strcpy(Campaign.missions[num].notes, notes);
}
}
event_count = 0;
// skip to events section in the mission file. Events come before goals, so we process them first
if (skip_to_string("#Events")) {
while (1) {
if (skip_to_string("$Formula:", "#Goals") != 1){
break;
}
z = skip_to_string("+Name:", "$Formula:");
if (!z){
break;
}
if (z == 1){
stuff_string(events[event_count], F_NAME, NAME_LENGTH);
}
else {
sprintf(events[event_count], NOX("Event #%d"), event_count + 1);
}
event_count++;
if (event_count > MAX_MISSION_EVENTS) {
Warning(LOCATION, "Maximum number of events exceeded (%d)!", MAX_MISSION_EVENTS);
event_count = MAX_MISSION_EVENTS;
break;
}
}
}
count = 0;
if (skip_to_string("#Goals")) {
while (1) {
if (skip_to_string("$Type:", "#End") != 1){
break;
}
z = skip_to_string("+Name:", "$Type:");
if (!z){
break;
}
if (z == 1){
stuff_string(goals[count], F_NAME, NAME_LENGTH);
}
else {
sprintf(goals[count], NOX("Goal #%d"), count + 1);
}
count++;
if (count > MAX_GOALS) {
Warning(LOCATION, "Maximum number of goals exceeded (%d)!", MAX_GOALS);
count = MAX_GOALS;
break;
}
}
}
Campaign.missions[num].num_goals = count;
if (count) {
Campaign.missions[num].goals = (mgoal *)vm_malloc(count * sizeof(mgoal));
Assert(Campaign.missions[num].goals); // make sure we got the memory
memset(Campaign.missions[num].goals, 0, count * sizeof(mgoal));
for (i = 0; i < count; i++){
strcpy_s(Campaign.missions[num].goals[i].name, goals[i]);
}
}
// copy the events
Campaign.missions[num].num_events = event_count;
if (event_count) {
Campaign.missions[num].events = (mevent *)vm_malloc(event_count * sizeof(mevent));
Assert(Campaign.missions[num].events);
memset(Campaign.missions[num].events, 0, event_count * sizeof(mevent));
for (i = 0; i < event_count; i++){
strcpy_s(Campaign.missions[num].events[i].name, events[i]);
}
}
// Goober5000 - variables do not need to be read here
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
read_file_text(filename);
reset_parse();
init_sexp();
// first, read the mission notes for this mission. Used in campaign editor
if (skip_to_string("#Mission Info")) {
if (skip_to_string("$Notes:")) {
stuff_string(notes, F_NOTES, NOTES_LENGTH);
if (Campaign.missions[num].notes){
vm_free(Campaign.missions[num].notes);
}
Campaign.missions[num].notes = (char *) vm_malloc(strlen(notes) + 1);
strcpy(Campaign.missions[num].notes, notes);
}
}
event_count = 0;
// skip to events section in the mission file. Events come before goals, so we process them first
if ( skip_to_string("#Events") ) {
while (1) {
if (skip_to_string("$Formula:", "#Goals") != 1){
break;
}
z = skip_to_string("+Name:", "$Formula:");
if (!z){
break;
}
if (z == 1){
stuff_string(events[event_count], F_NAME, NAME_LENGTH);
} else {
sprintf(events[event_count], NOX("Event #%d"), event_count + 1);
}
event_count++;
if (event_count > MAX_MISSION_EVENTS) {
Warning(LOCATION, "Maximum number of events exceeded (%d)!", MAX_MISSION_EVENTS);
event_count = MAX_MISSION_EVENTS;
break;
}
}
}
count = 0;
if (skip_to_string("#Goals")) {
while (1) {
if (skip_to_string("$Type:", "#End") != 1){
break;
}
z = skip_to_string("+Name:", "$Type:");
if (!z){
break;
}
if (z == 1){
stuff_string(goals[count], F_NAME, NAME_LENGTH);
} else {
sprintf(goals[count], NOX("Goal #%d"), count + 1);
}
count++;
if (count > MAX_GOALS) {
Warning(LOCATION, "Maximum number of goals exceeded (%d)!", MAX_GOALS);
count = MAX_GOALS;
break;
}
}
}
Campaign.missions[num].num_goals = count;
if (count) {
Campaign.missions[num].goals = (mgoal *) vm_malloc(count * sizeof(mgoal));
Assert(Campaign.missions[num].goals); // make sure we got the memory
memset(Campaign.missions[num].goals, 0, count * sizeof(mgoal));
for (i=0; i<count; i++){
strcpy_s(Campaign.missions[num].goals[i].name, goals[i]);
}
}
// copy the events
Campaign.missions[num].num_events = event_count;
if (event_count) {
Campaign.missions[num].events = (mevent *)vm_malloc(event_count * sizeof(mevent));
Assert ( Campaign.missions[num].events );
memset(Campaign.missions[num].events, 0, event_count * sizeof(mevent));
for (i = 0; i < event_count; i++ ){
strcpy_s(Campaign.missions[num].events[i].name, events[i]);
}
}
// Goober5000 - variables do not need to be read here
}
/**
@@ -1622,33 +1635,36 @@ void mission_campaign_maybe_play_movie(int type)
*/
int mission_campaign_parse_is_multi(char *filename, char *name)
{
int i, rval;
int i;
char temp[NAME_LENGTH];
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error code = %i.\n", filename, rval));
try
{
read_file_text(filename);
reset_parse();
required_string("$Name:");
stuff_string(temp, F_NAME, NAME_LENGTH);
if (name)
strcpy(name, temp);
required_string("$Type:");
stuff_string(temp, F_NAME, NAME_LENGTH);
for (i = 0; i < MAX_CAMPAIGN_TYPES; i++) {
if (!stricmp(temp, campaign_types[i])) {
return i;
}
}
Error(LOCATION, "Unknown campaign type %s", temp);
return -1;
}
read_file_text( filename );
reset_parse();
required_string("$Name:");
stuff_string( temp, F_NAME, NAME_LENGTH );
if ( name )
strcpy( name, temp );
required_string( "$Type:" );
stuff_string( temp, F_NAME, NAME_LENGTH );
for (i = 0; i < MAX_CAMPAIGN_TYPES; i++ ) {
if ( !stricmp(temp, campaign_types[i]) ) {
return i;
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONCAMPAIGN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return -1;
}
Error(LOCATION, "Unknown campaign type %s", temp );
return -1;
}
/**
+1 -1
View File
@@ -93,7 +93,7 @@ extern int Num_goals; // number of goals for this mission
#define MLF_FIRST_REPEAT_ONLY (1 << 4)
#define MLF_LAST_REPEAT_ONLY (1 << 5)
#define MLF_FIRST_TRIGGER_ONLY (1 << 6)
#define MLF_LAST_TRIGGER_ONLY (1 << 7)
#define MLF_LAST_TRIGGER_ONLY (1 << 7)
#define MLF_STATE_CHANGE (1 << 8)
#define MLF_ALL_REPETITION_FLAGS (MLF_FIRST_REPEAT_ONLY | MLF_LAST_REPEAT_ONLY | MLF_FIRST_TRIGGER_ONLY | MLF_LAST_TRIGGER_ONLY)
+27 -21
View File
@@ -648,19 +648,22 @@ void parse_msgtbl()
// this is called at the start of each level
void messages_init()
{
int rval, i;
int i;
static int table_read = 0;
if ( !table_read ) {
Default_command_persona = -1;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "messages.tbl", rval));
try
{
parse_msgtbl();
table_read = 1;
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "messages.tbl", e.what()));
return;
}
parse_msgtbl();
table_read = 1;
}
Current_mission_mood = 0;
@@ -1531,6 +1534,9 @@ void message_queue_process()
// Don't play death scream unless a small ship.
if ( q->builtin_type == MESSAGE_WINGMAN_SCREAM ) {
if (Message_shipnum < 0) {
goto all_done;
}
if (!((Ship_info[Ships[Message_shipnum].ship_info_index].flags & SIF_SMALL_SHIP) || (Ships[Message_shipnum].flags2 & SF2_ALWAYS_DEATH_SCREAM)) ) {
goto all_done;
}
@@ -1914,7 +1920,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti
char *who_from;
int best_match = -1;
matching_builtin *current_builtin = new matching_builtin();
matching_builtin current_builtin;
SCP_vector <matching_builtin> matching_builtins;
@@ -1976,52 +1982,52 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti
// check the type of message
if ( !stricmp(Messages[i].name, name) ) {
// condition 1: we have a type match
current_builtin->message_index = i;
current_builtin->type_of_match = BUILTIN_MATCHES_TYPE;
current_builtin.message_index = i;
current_builtin.type_of_match = BUILTIN_MATCHES_TYPE;
// check the species of this persona (if required)
if ( (persona_species >= 0) && (Personas[Messages[i].persona_index].species == persona_species) ) {
// condition 2: we have a type + species match
current_builtin->type_of_match = BUILTIN_MATCHES_SPECIES;
current_builtin.type_of_match = BUILTIN_MATCHES_SPECIES;
}
// check the exact persona (if required)
// NOTE: doesn't need to be nested under the species condition above
if ( (persona_index >= 0) && (Messages[i].persona_index == persona_index) ) {
// condition 3: type + species + persona index match
current_builtin->type_of_match = BUILTIN_MATCHES_PERSONA_CHECK_MOOD;
current_builtin.type_of_match = BUILTIN_MATCHES_PERSONA_CHECK_MOOD;
}
// check if the personas mood suits this particular message, first check if it is excluded
if (!Messages[i].excluded_moods.empty() && (current_builtin->type_of_match == BUILTIN_MATCHES_PERSONA_CHECK_MOOD)) {
if (!Messages[i].excluded_moods.empty() && (current_builtin.type_of_match == BUILTIN_MATCHES_PERSONA_CHECK_MOOD)) {
for (SCP_vector<int>::iterator iter = Messages[i].excluded_moods.begin(); iter != Messages[i].excluded_moods.end(); ++iter) {
if (*iter == Current_mission_mood) {
current_builtin->type_of_match = BUILTIN_MATCHES_PERSONA_EXCLUDED;
current_builtin.type_of_match = BUILTIN_MATCHES_PERSONA_EXCLUDED;
break;
}
}
}
if (current_builtin->type_of_match == BUILTIN_MATCHES_PERSONA_CHECK_MOOD) {
if (current_builtin.type_of_match == BUILTIN_MATCHES_PERSONA_CHECK_MOOD) {
if (Current_mission_mood == Messages[i].mood) {
current_builtin->type_of_match = BUILTIN_MATCHES_PERSONA_MOOD;
current_builtin.type_of_match = BUILTIN_MATCHES_PERSONA_MOOD;
}
else {
current_builtin->type_of_match = BUILTIN_MATCHES_PERSONA;
current_builtin.type_of_match = BUILTIN_MATCHES_PERSONA;
}
}
if (current_builtin->type_of_match == best_match) {
if (current_builtin.type_of_match == best_match) {
num_matching_builtins++;
}
// otherwise check to see if the this is the best kind of match we've found so far
else if (current_builtin->type_of_match > best_match) {
best_match = current_builtin->type_of_match;
else if (current_builtin.type_of_match > best_match) {
best_match = current_builtin.type_of_match;
num_matching_builtins = 1;
}
// add the match to our list
matching_builtins.push_back(*current_builtin);
matching_builtins.push_back(current_builtin);
}
}
+61 -54
View File
@@ -5832,39 +5832,38 @@ int get_mission_info(const char *filename, mission *mission_p, bool basic)
if (p) *p = 0; // remove any extension
strcat_s(real_fname, FS_MISSION_FILE_EXT); // append mission extension
int rval, filelength;
int filelength;
// if mission_p is NULL, make it point to The_mission
if ( mission_p == NULL )
mission_p = &The_mission;
do {
CFILE *ftemp = cfopen(real_fname, "rt");
if (!ftemp) {
rval = -1;
break;
}
CFILE *ftemp = cfopen(real_fname, "rt");
if (!ftemp) {
return -1;
}
// 7/9/98 -- MWA -- check for 0 length file.
filelength = cfilelength(ftemp);
cfclose(ftemp);
if (filelength == 0) {
rval = -1;
break;
}
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONS: Unable to parse '%s'! Error code = %i.\n", real_fname, rval));
break;
}
// 7/9/98 -- MWA -- check for 0 length file.
filelength = cfilelength(ftemp);
cfclose(ftemp);
if (filelength == 0) {
return -1;
}
try
{
read_file_text(real_fname, CF_TYPE_MISSIONS);
mission_p->Reset( );
mission_p->Reset();
parse_init(basic);
parse_mission_info(mission_p, basic);
} while (0);
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONS: Unable to parse '%s'! Error message = %s.\n", real_fname, e.what()));
return -1;
}
return rval;
return 0;
}
/**
@@ -5926,22 +5925,27 @@ int parse_main(const char *mission_name, int flags)
cfclose(ftemp);
}
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONS: Unable to parse '%s'! Error code = %i.\n", mission_name, rval));
try
{
// import?
if (flags & MPF_IMPORT_FSM) {
read_file_text(mission_name, CF_TYPE_ANY);
convertFSMtoFS2();
}
else {
read_file_text(mission_name, CF_TYPE_MISSIONS);
}
The_mission.Reset();
rval = parse_mission(&The_mission, flags);
display_parse_diagnostics();
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONS: Unable to parse '%s'! Error message = %s.\n", mission_name, e.what()));
rval = 1;
break;
}
// import?
if (flags & MPF_IMPORT_FSM) {
read_file_text(mission_name, CF_TYPE_ANY);
convertFSMtoFS2();
} else {
read_file_text(mission_name, CF_TYPE_MISSIONS);
}
The_mission.Reset( );
rval = parse_mission(&The_mission, flags);
display_parse_diagnostics();
} while (0);
if (!Fred_running)
@@ -6283,7 +6287,7 @@ void mission_parse_set_up_initial_docks()
*/
int mission_parse_is_multi(const char *filename, char *mission_name)
{
int rval, game_type;
int game_type;
int filelength;
CFILE *ftemp;
@@ -6302,25 +6306,28 @@ int mission_parse_is_multi(const char *filename, char *mission_name)
game_type = 0;
do {
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("MISSIONS: Unable to parse '%s'! Error code = %i.\n", filename, rval));
try
{
read_file_text(filename, CF_TYPE_MISSIONS);
reset_parse();
if (skip_to_string("$Name:") != 1) {
nprintf(("Network", "Unable to process %s because we couldn't find $Name:", filename));
break;
}
stuff_string(mission_name, F_NAME, NAME_LENGTH);
if (skip_to_string("+Game Type Flags:") != 1) {
nprintf(("Network", "Unable to process %s because we couldn't find +Game Type Flags:\n", filename));
break;
}
stuff_int(&game_type);
}
catch (const parse::ParseException& e)
{
mprintf(("MISSIONS: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
break;
}
read_file_text(filename, CF_TYPE_MISSIONS);
reset_parse();
if ( skip_to_string("$Name:") != 1 ) {
nprintf(("Network", "Unable to process %s because we couldn't find $Name:", filename));
break;
}
stuff_string( mission_name, F_NAME, NAME_LENGTH );
if ( skip_to_string("+Game Type Flags:") != 1 ) {
nprintf(("Network", "Unable to process %s because we couldn't find +Game Type Flags:\n", filename));
break;
}
stuff_int(&game_type);
} while (0);
return (game_type & MISSION_TYPE_MULTI) ? game_type : 0;
+41 -39
View File
@@ -1058,49 +1058,51 @@ void debrief_traitor_init()
if ( !inited ) {
debriefing *debrief;
debrief_stage *stagep;
int rval;
int stage_num;
try
{
read_file_text("traitor.tbl", CF_TYPE_TABLES);
reset_parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "traitor.tbl", rval));
// simplied form of the debriefing stuff.
debrief = &Traitor_debriefing;
required_string("#Debriefing_info");
required_string("$Num stages:");
stuff_int(&debrief->num_stages);
Assert(debrief->num_stages == 1);
stage_num = 0;
stagep = &debrief->stages[stage_num++];
required_string("$Formula:");
stagep->formula = get_sexp_main();
required_string("$multi text");
stuff_string(stagep->text, F_MULTITEXT, NULL);
required_string("$Voice:");
char traitor_voice_file[MAX_FILENAME_LEN];
stuff_string(traitor_voice_file, F_FILESPEC, MAX_FILENAME_LEN);
// DKA 9/13/99 Only 1 traitor msg for FS2
// if ( Player->main_hall ) {
// strcpy_s(stagep->voice, NOX("3_"));
// } else {
// strcpy_s(stagep->voice, NOX("1_"));
// }
// Goober5000
debrief_choose_voice(stagep->voice, traitor_voice_file, debrief_find_persona_index(), 1);
required_string("$Recommendation text:");
stuff_string(stagep->recommendation_text, F_MULTITEXT, NULL);
inited = 1;
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "traitor.tbl", e.what()));
return;
}
read_file_text("traitor.tbl", CF_TYPE_TABLES);
reset_parse();
// simplied form of the debriefing stuff.
debrief = &Traitor_debriefing;
required_string("#Debriefing_info");
required_string("$Num stages:");
stuff_int(&debrief->num_stages);
Assert(debrief->num_stages == 1);
stage_num = 0;
stagep = &debrief->stages[stage_num++];
required_string("$Formula:");
stagep->formula = get_sexp_main();
required_string("$multi text");
stuff_string( stagep->text, F_MULTITEXT, NULL);
required_string("$Voice:");
char traitor_voice_file[MAX_FILENAME_LEN];
stuff_string(traitor_voice_file, F_FILESPEC, MAX_FILENAME_LEN);
// DKA 9/13/99 Only 1 traitor msg for FS2
// if ( Player->main_hall ) {
// strcpy_s(stagep->voice, NOX("3_"));
// } else {
// strcpy_s(stagep->voice, NOX("1_"));
// }
// Goober5000
debrief_choose_voice(stagep->voice, traitor_voice_file, debrief_find_persona_index(), 1);
required_string("$Recommendation text:");
stuff_string( stagep->recommendation_text, F_MULTITEXT, NULL);
inited = 1;
}
// disable the accept button if in single player and I am a traitor
+218 -211
View File
@@ -36,240 +36,247 @@ bool Beams_use_damage_factors = false;
void parse_mod_table(const 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 game_settings.tbl>", rval));
return;
}
if (filename == NULL)
read_file_text_from_array(defaults_get_file("game_settings.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
if (filename == NULL)
read_file_text_from_array(defaults_get_file("game_settings.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
reset_parse();
// start parsing
optional_string("#CAMPAIGN SETTINGS");
// start parsing
optional_string("#CAMPAIGN SETTINGS");
if (optional_string("$Default Campaign File Name:")) {
char temp[MAX_FILENAME_LEN];
stuff_string(temp, F_NAME, MAX_FILENAME_LEN);
// remove extension?
if (drop_extension(temp)) {
mprintf(("Game Settings Table: Removed extension on default campaign file name %s\n", temp));
}
// check length
int maxlen = (MAX_FILENAME_LEN - 4);
int len = strlen(temp);
if (len > maxlen) {
Warning(LOCATION, "Token too long: [%s]. Length = %i. Max is %i.\n", temp, len, maxlen);
temp[maxlen] = 0;
}
strcpy_s(Default_campaign_file_name, temp);
}
if (optional_string("#Ignored Campaign File Names")) {
SCP_string campaign_name;
while (optional_string("$Campaign File Name:")) {
stuff_string(campaign_name, F_NAME);
if (optional_string("$Default Campaign File Name:")) {
char temp[MAX_FILENAME_LEN];
stuff_string(temp, F_NAME, MAX_FILENAME_LEN);
// remove extension?
if (drop_extension(campaign_name)) {
mprintf(("Game Settings Table: Removed extension on ignored campaign file name %s\n", campaign_name.c_str()));
if (drop_extension(temp)) {
mprintf(("Game Settings Table: Removed extension on default campaign file name %s\n", temp));
}
Ignored_campaigns.push_back(campaign_name);
// check length
int maxlen = (MAX_FILENAME_LEN - 4);
int len = strlen(temp);
if (len > maxlen) {
Warning(LOCATION, "Token too long: [%s]. Length = %i. Max is %i.\n", temp, len, maxlen);
temp[maxlen] = 0;
}
strcpy_s(Default_campaign_file_name, temp);
}
}
if (optional_string("$Red-alert applies to delayed ships:")) {
stuff_boolean(&Red_alert_applies_to_delayed_ships);
if (Red_alert_applies_to_delayed_ships) {
mprintf(("Game Settings Table: Red-alert stats will be loaded for ships that arrive later in missions\n"));
} else {
mprintf(("Game Settings Table: Red-alert stats will NOT be loaded for ships that arrive later in missions (this is retail behavior)\n"));
if (optional_string("#Ignored Campaign File Names")) {
SCP_string campaign_name;
while (optional_string("$Campaign File Name:")) {
stuff_string(campaign_name, F_NAME);
// remove extension?
if (drop_extension(campaign_name)) {
mprintf(("Game Settings Table: Removed extension on ignored campaign file name %s\n", campaign_name.c_str()));
}
Ignored_campaigns.push_back(campaign_name);
}
}
}
optional_string("#HUD SETTINGS");
// how long should the game wait before displaying a directive?
if (optional_string("$Directive Wait Time:")) {
stuff_int(&Directive_wait_time);
}
if (optional_string("$Cutscene camera displays HUD:")) {
stuff_boolean(&Cutscene_camera_displays_hud);
}
// compatibility
if (optional_string("$Cutscene camera disables HUD:")) {
mprintf(("Game Settings Table: \"$$Cutscene camera disables HUD\" is deprecated in favor of \"$Cutscene camera displays HUD\"\n"));
bool temp;
stuff_boolean(&temp);
Cutscene_camera_displays_hud = !temp;
}
if (optional_string("$Full color head animations:")) {
stuff_boolean(&Full_color_head_anis);
}
// compatibility
if (optional_string("$Color head animations with hud colors:")) {
mprintf(("Game Settings Table: \"$Color head animations with hud colors\" is deprecated in favor of \"$Full color head animations\"\n"));
bool temp;
stuff_boolean(&temp);
Full_color_head_anis = !temp;
}
optional_string("#SEXP SETTINGS");
if (optional_string("$Loop SEXPs Then Arguments:")) {
stuff_boolean(&True_loop_argument_sexps);
if (True_loop_argument_sexps) {
mprintf(("Game Settings Table: Using Reversed Loops For SEXP Arguments\n"));
} else {
mprintf(("Game Settings Table: Using Standard Loops For SEXP Arguments\n"));
if (optional_string("$Red-alert applies to delayed ships:")) {
stuff_boolean(&Red_alert_applies_to_delayed_ships);
if (Red_alert_applies_to_delayed_ships) {
mprintf(("Game Settings Table: Red-alert stats will be loaded for ships that arrive later in missions\n"));
}
else {
mprintf(("Game Settings Table: Red-alert stats will NOT be loaded for ships that arrive later in missions (this is retail behavior)\n"));
}
}
}
if (optional_string("$Use Alternate Chaining Behavior:")) {
stuff_boolean(&Alternate_chaining_behavior);
if (Alternate_chaining_behavior) {
mprintf(("Game Settings Table: Using alternate event chaining behavior\n"));
} else {
mprintf(("Game Settings Table: Using standard event chaining behavior\n"));
optional_string("#HUD SETTINGS");
// how long should the game wait before displaying a directive?
if (optional_string("$Directive Wait Time:")) {
stuff_int(&Directive_wait_time);
}
}
optional_string("#GRAPHICS SETTINGS");
if (optional_string("$Enable External Shaders:")) {
stuff_boolean(&Enable_external_shaders);
if (Enable_external_shaders)
mprintf(("Game Settings Table: External shaders are enabled\n"));
else
mprintf(("Game Settings Table: External shaders are DISABLED\n"));
}
if (optional_string("$Default Detail Level:")) {
int detail_level;
stuff_int(&detail_level);
mprintf(("Game Settings Table: Setting default detail level to %i of %i-%i\n", detail_level, 0, NUM_DEFAULT_DETAIL_LEVELS-1));
if (detail_level < 0 || detail_level > NUM_DEFAULT_DETAIL_LEVELS-1) {
Warning(LOCATION, "Invalid detail level: %i, setting to %i\n", detail_level, Default_detail_level);
} else {
Default_detail_level = detail_level;
if (optional_string("$Cutscene camera displays HUD:")) {
stuff_boolean(&Cutscene_camera_displays_hud);
}
}
if (optional_string("$Briefing Window FOV:")) {
float fov;
stuff_float(&fov);
mprintf(("Game Settings Table: Setting briefing window FOV from %f to %f\n", Briefing_window_FOV, fov));
Briefing_window_FOV = fov;
}
optional_string("#NETWORK SETTINGS");
if (optional_string("$FS2NetD port:")) {
stuff_int(&FS2NetD_port);
if (FS2NetD_port)
mprintf(("Game Settings Table: FS2NetD connecting to port %i\n", FS2NetD_port));
}
optional_string("#SOUND SETTINGS");
if (optional_string("$Default Sound Volume:")) {
stuff_float(&Default_sound_volume);
}
if (optional_string("$Default Music Volume:")) {
stuff_float(&Default_music_volume);
}
if (optional_string("$Default Voice Volume:")) {
stuff_float(&Default_voice_volume);
}
optional_string("#FRED SETTINGS");
if (optional_string("$Disable Hard Coded Message Head Ani Files:")) {
stuff_boolean(&Disable_hc_message_ani);
if (Disable_hc_message_ani) {
mprintf(("Game Settings Table: FRED - Disabling Hard Coded Message Ani Files\n"));
} else {
mprintf(("Game Settings Table: FRED - Using Hard Coded Message Ani Files\n"));
// compatibility
if (optional_string("$Cutscene camera disables HUD:")) {
mprintf(("Game Settings Table: \"$$Cutscene camera disables HUD\" is deprecated in favor of \"$Cutscene camera displays HUD\"\n"));
bool temp;
stuff_boolean(&temp);
Cutscene_camera_displays_hud = !temp;
}
}
optional_string("#OTHER SETTINGS");
if (optional_string("$Fixed Turret Collisions:")) {
stuff_boolean(&Fixed_turret_collisions);
}
if (optional_string("$Damage Impacted Subsystem First:")) {
stuff_boolean(&Damage_impacted_subsystem_first);
}
if (optional_string("$Default ship select effect:")) {
char effect[NAME_LENGTH];
stuff_string(effect, F_NAME, NAME_LENGTH);
if (!stricmp(effect, "FS2"))
Default_ship_select_effect = 2;
else if (!stricmp(effect, "FS1"))
Default_ship_select_effect = 1;
else if (!stricmp(effect, "off"))
Default_ship_select_effect = 0;
}
if (optional_string("$Default weapon select effect:")) {
char effect[NAME_LENGTH];
stuff_string(effect, F_NAME, NAME_LENGTH);
if (!stricmp(effect, "FS2"))
Default_weapon_select_effect = 2;
else if (!stricmp(effect, "FS1"))
Default_weapon_select_effect = 1;
else if (!stricmp(effect, "off"))
Default_weapon_select_effect = 0;
}
if (optional_string("$Weapons inherit parent collision group:")) {
stuff_boolean(&Weapons_inherit_parent_collision_group);
if (Weapons_inherit_parent_collision_group)
mprintf(("Game Settings Table: Weapons inherit parent collision group\n"));
}
if (optional_string("$Flight controls follow eyepoint orientation:")) {
stuff_boolean(&Flight_controls_follow_eyepoint_orientation);
if (Flight_controls_follow_eyepoint_orientation)
mprintf(("Game Settings Table: Flight controls follow eyepoint orientation\n"));
}
if (optional_string("$Beams Use Damage Factors:")) {
stuff_boolean(&Beams_use_damage_factors);
if (Beams_use_damage_factors) {
mprintf(("Game Settings Table: Beams will use Damage Factors\n"));
} else {
mprintf(("Game Settings Table: Beams will ignore Damage Factors (retail behavior)\n"));
if (optional_string("$Full color head animations:")) {
stuff_boolean(&Full_color_head_anis);
}
// compatibility
if (optional_string("$Color head animations with hud colors:")) {
mprintf(("Game Settings Table: \"$Color head animations with hud colors\" is deprecated in favor of \"$Full color head animations\"\n"));
bool temp;
stuff_boolean(&temp);
Full_color_head_anis = !temp;
}
}
required_string("#END");
optional_string("#SEXP SETTINGS");
if (optional_string("$Loop SEXPs Then Arguments:")) {
stuff_boolean(&True_loop_argument_sexps);
if (True_loop_argument_sexps) {
mprintf(("Game Settings Table: Using Reversed Loops For SEXP Arguments\n"));
}
else {
mprintf(("Game Settings Table: Using Standard Loops For SEXP Arguments\n"));
}
}
if (optional_string("$Use Alternate Chaining Behavior:")) {
stuff_boolean(&Alternate_chaining_behavior);
if (Alternate_chaining_behavior) {
mprintf(("Game Settings Table: Using alternate event chaining behavior\n"));
}
else {
mprintf(("Game Settings Table: Using standard event chaining behavior\n"));
}
}
optional_string("#GRAPHICS SETTINGS");
if (optional_string("$Enable External Shaders:")) {
stuff_boolean(&Enable_external_shaders);
if (Enable_external_shaders)
mprintf(("Game Settings Table: External shaders are enabled\n"));
else
mprintf(("Game Settings Table: External shaders are DISABLED\n"));
}
if (optional_string("$Default Detail Level:")) {
int detail_level;
stuff_int(&detail_level);
mprintf(("Game Settings Table: Setting default detail level to %i of %i-%i\n", detail_level, 0, NUM_DEFAULT_DETAIL_LEVELS - 1));
if (detail_level < 0 || detail_level > NUM_DEFAULT_DETAIL_LEVELS - 1) {
Warning(LOCATION, "Invalid detail level: %i, setting to %i\n", detail_level, Default_detail_level);
}
else {
Default_detail_level = detail_level;
}
}
if (optional_string("$Briefing Window FOV:")) {
float fov;
stuff_float(&fov);
mprintf(("Game Settings Table: Setting briefing window FOV from %f to %f\n", Briefing_window_FOV, fov));
Briefing_window_FOV = fov;
}
optional_string("#NETWORK SETTINGS");
if (optional_string("$FS2NetD port:")) {
stuff_int(&FS2NetD_port);
if (FS2NetD_port)
mprintf(("Game Settings Table: FS2NetD connecting to port %i\n", FS2NetD_port));
}
optional_string("#SOUND SETTINGS");
if (optional_string("$Default Sound Volume:")) {
stuff_float(&Master_sound_volume);
}
if (optional_string("$Default Music Volume:")) {
stuff_float(&Master_event_music_volume);
}
if (optional_string("$Default Voice Volume:")) {
stuff_float(&Master_voice_volume);
}
optional_string("#FRED SETTINGS");
if (optional_string("$Disable Hard Coded Message Head Ani Files:")) {
stuff_boolean(&Disable_hc_message_ani);
if (Disable_hc_message_ani) {
mprintf(("Game Settings Table: FRED - Disabling Hard Coded Message Ani Files\n"));
}
else {
mprintf(("Game Settings Table: FRED - Using Hard Coded Message Ani Files\n"));
}
}
optional_string("#OTHER SETTINGS");
if (optional_string("$Fixed Turret Collisions:")) {
stuff_boolean(&Fixed_turret_collisions);
}
if (optional_string("$Damage Impacted Subsystem First:")) {
stuff_boolean(&Damage_impacted_subsystem_first);
}
if (optional_string("$Default ship select effect:")) {
char effect[NAME_LENGTH];
stuff_string(effect, F_NAME, NAME_LENGTH);
if (!stricmp(effect, "FS2"))
Default_ship_select_effect = 2;
else if (!stricmp(effect, "FS1"))
Default_ship_select_effect = 1;
else if (!stricmp(effect, "off"))
Default_ship_select_effect = 0;
}
if (optional_string("$Default weapon select effect:")) {
char effect[NAME_LENGTH];
stuff_string(effect, F_NAME, NAME_LENGTH);
if (!stricmp(effect, "FS2"))
Default_weapon_select_effect = 2;
else if (!stricmp(effect, "FS1"))
Default_weapon_select_effect = 1;
else if (!stricmp(effect, "off"))
Default_weapon_select_effect = 0;
}
if (optional_string("$Weapons inherit parent collision group:")) {
stuff_boolean(&Weapons_inherit_parent_collision_group);
if (Weapons_inherit_parent_collision_group)
mprintf(("Game Settings Table: Weapons inherit parent collision group\n"));
}
if (optional_string("$Flight controls follow eyepoint orientation:")) {
stuff_boolean(&Flight_controls_follow_eyepoint_orientation);
if (Flight_controls_follow_eyepoint_orientation)
mprintf(("Game Settings Table: Flight controls follow eyepoint orientation\n"));
}
if (optional_string("$Beams Use Damage Factors:")) {
stuff_boolean(&Beams_use_damage_factors);
if (Beams_use_damage_factors) {
mprintf(("Game Settings Table: Beams will use Damage Factors\n"));
}
else {
mprintf(("Game Settings Table: Beams will ignore Damage Factors (retail behavior)\n"));
}
}
required_string("#END");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : "<default game_settings.tbl>", e.what()));
return;
}
}
void mod_table_init()
+1 -1
View File
@@ -2480,7 +2480,7 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
pm = new polymodel;
Polygon_models[num] = pm;
pm->n_paths = 0;
pm->paths = NULL;
+42 -38
View File
@@ -249,48 +249,52 @@ void neb2_regen();
// initialize neb2 stuff at game startup
void neb2_init()
{
int rval;
char name[MAX_FILENAME_LEN];
if ( ( rval = setjmp(parse_abort) ) != 0 ) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "nebula.tbl", rval));
try
{
// read in the nebula.tbl
read_file_text("nebula.tbl", CF_TYPE_TABLES);
reset_parse();
// background bitmaps
Neb2_bitmap_count = 0;
while (!optional_string("#end")) {
// nebula
required_string("+Nebula:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Neb2_bitmap_count < MAX_NEB2_BITMAPS) {
strcpy_s(Neb2_bitmap_filenames[Neb2_bitmap_count++], name);
}
else {
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebulas (%d)!\nSkipping %s.", MAX_NEB2_BITMAPS, name);
}
}
// poofs
Neb2_poof_count = 0;
while (!optional_string("#end")) {
// nebula
required_string("+Poof:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Neb2_poof_count < MAX_NEB2_POOFS) {
strcpy_s(Neb2_poof_filenames[Neb2_poof_count++], name);
}
else {
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebula poofs (%d)!\nSkipping %s.", MAX_NEB2_POOFS, name);
}
}
// should always have 6 neb poofs
Assert(Neb2_poof_count == 6);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "nebula.tbl", e.what()));
return;
}
// read in the nebula.tbl
read_file_text("nebula.tbl", CF_TYPE_TABLES);
reset_parse();
// background bitmaps
Neb2_bitmap_count = 0;
while ( !optional_string("#end") ) {
// nebula
required_string("+Nebula:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if ( Neb2_bitmap_count < MAX_NEB2_BITMAPS ) {
strcpy_s(Neb2_bitmap_filenames[Neb2_bitmap_count++], name);
} else {
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebulas (%d)!\nSkipping %s.", MAX_NEB2_BITMAPS, name);
}
}
// poofs
Neb2_poof_count = 0;
while ( !optional_string("#end") ) {
// nebula
required_string("+Poof:");
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if ( Neb2_poof_count < MAX_NEB2_POOFS ) {
strcpy_s(Neb2_poof_filenames[Neb2_poof_count++], name);
} else {
WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebula poofs (%d)!\nSkipping %s.", MAX_NEB2_POOFS, name);
}
}
// should always have 6 neb poofs
Assert(Neb2_poof_count == 6);
}
// set detail level
+116 -114
View File
@@ -155,123 +155,125 @@ DCF(lightning_intensity, "Sets lightning intensity between 0.0 and 1.0 (Default
void nebl_init()
{
char name[MAX_FILENAME_LEN];
int rval;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "lightning.tbl", rval));
try
{
// parse the lightning table
read_file_text("lightning.tbl", CF_TYPE_TABLES);
reset_parse();
// parse the individual lightning bolt types
required_string("#Bolts begin");
while (!optional_string("#Bolts end")){
bolt_type new_bolt_type;
// bolt title
required_string("$Bolt:");
stuff_string(new_bolt_type.name, F_NAME, NAME_LENGTH);
// b_scale
required_string("+b_scale:");
stuff_float(&new_bolt_type.b_scale);
// b_shrink
required_string("+b_shrink:");
stuff_float(&new_bolt_type.b_shrink);
// b_poly_pct
required_string("+b_poly_pct:");
stuff_float(&new_bolt_type.b_poly_pct);
// child rand
required_string("+b_rand:");
stuff_float(&new_bolt_type.b_rand);
// z add
required_string("+b_add:");
stuff_float(&new_bolt_type.b_add);
// # strikes
required_string("+b_strikes:");
stuff_int(&new_bolt_type.num_strikes);
// lifetime
required_string("+b_lifetime:");
stuff_int(&new_bolt_type.lifetime);
// noise
required_string("+b_noise:");
stuff_float(&new_bolt_type.noise);
// emp effect
required_string("+b_emp:");
stuff_float(&new_bolt_type.emp_intensity);
stuff_float(&new_bolt_type.emp_time);
// texture
required_string("+b_texture:");
stuff_string(name, F_NAME, sizeof(name));
if (!Fred_running){
new_bolt_type.texture = bm_load(name);
}
// glow
required_string("+b_glow:");
stuff_string(name, F_NAME, sizeof(name));
if (!Fred_running){
new_bolt_type.glow = bm_load(name);
}
// brightness
required_string("+b_bright:");
stuff_float(&new_bolt_type.b_bright);
Bolt_types.push_back(new_bolt_type);
}
// parse lightning storm types
required_string("#Storms begin");
while (!optional_string("#Storms end")){
storm_type new_storm_type;
// bolt title
required_string("$Storm:");
stuff_string(new_storm_type.name, F_NAME, NAME_LENGTH);
// bolt types
while (optional_string("+bolt:")){
if (new_storm_type.num_bolt_types < MAX_BOLT_TYPES_PER_STORM){
stuff_string(name, F_NAME, sizeof(name));
new_storm_type.bolt_types[new_storm_type.num_bolt_types] = nebl_get_bolt_index(name);
Assert(new_storm_type.bolt_types[new_storm_type.num_bolt_types] != (size_t)-1);
new_storm_type.num_bolt_types++;
}
}
// flavor
required_string("+flavor:");
stuff_float(&new_storm_type.flavor.xyz.x);
stuff_float(&new_storm_type.flavor.xyz.y);
stuff_float(&new_storm_type.flavor.xyz.z);
// frequencies
required_string("+random_freq:");
stuff_int(&new_storm_type.min);
stuff_int(&new_storm_type.max);
// counts
required_string("+random_count:");
stuff_int(&new_storm_type.min_count);
stuff_int(&new_storm_type.max_count);
Storm_types.push_back(new_storm_type);
}
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "lightning.tbl", e.what()));
return;
}
// parse the lightning table
read_file_text("lightning.tbl", CF_TYPE_TABLES);
reset_parse();
// parse the individual lightning bolt types
required_string("#Bolts begin");
while(!optional_string("#Bolts end")){
bolt_type new_bolt_type;
// bolt title
required_string("$Bolt:");
stuff_string(new_bolt_type.name, F_NAME, NAME_LENGTH);
// b_scale
required_string("+b_scale:");
stuff_float(&new_bolt_type.b_scale);
// b_shrink
required_string("+b_shrink:");
stuff_float(&new_bolt_type.b_shrink);
// b_poly_pct
required_string("+b_poly_pct:");
stuff_float(&new_bolt_type.b_poly_pct);
// child rand
required_string("+b_rand:");
stuff_float(&new_bolt_type.b_rand);
// z add
required_string("+b_add:");
stuff_float(&new_bolt_type.b_add);
// # strikes
required_string("+b_strikes:");
stuff_int(&new_bolt_type.num_strikes);
// lifetime
required_string("+b_lifetime:");
stuff_int(&new_bolt_type.lifetime);
// noise
required_string("+b_noise:");
stuff_float(&new_bolt_type.noise);
// emp effect
required_string("+b_emp:");
stuff_float(&new_bolt_type.emp_intensity);
stuff_float(&new_bolt_type.emp_time);
// texture
required_string("+b_texture:");
stuff_string(name, F_NAME, sizeof(name));
if(!Fred_running){
new_bolt_type.texture = bm_load(name);
}
// glow
required_string("+b_glow:");
stuff_string(name, F_NAME, sizeof(name));
if(!Fred_running){
new_bolt_type.glow = bm_load(name);
}
// brightness
required_string("+b_bright:");
stuff_float(&new_bolt_type.b_bright);
Bolt_types.push_back(new_bolt_type);
}
// parse lightning storm types
required_string("#Storms begin");
while(!optional_string("#Storms end")){
storm_type new_storm_type;
// bolt title
required_string("$Storm:");
stuff_string(new_storm_type.name, F_NAME, NAME_LENGTH);
// bolt types
while(optional_string("+bolt:")){
if(new_storm_type.num_bolt_types < MAX_BOLT_TYPES_PER_STORM){
stuff_string(name, F_NAME, sizeof(name));
new_storm_type.bolt_types[new_storm_type.num_bolt_types] = nebl_get_bolt_index(name);
Assert(new_storm_type.bolt_types[new_storm_type.num_bolt_types] != (size_t)-1);
new_storm_type.num_bolt_types++;
}
}
// flavor
required_string("+flavor:");
stuff_float(&new_storm_type.flavor.xyz.x);
stuff_float(&new_storm_type.flavor.xyz.y);
stuff_float(&new_storm_type.flavor.xyz.z);
// frequencies
required_string("+random_freq:");
stuff_int(&new_storm_type.min);
stuff_int(&new_storm_type.max);
// counts
required_string("+random_count:");
stuff_int(&new_storm_type.min_count);
stuff_int(&new_storm_type.max_count);
Storm_types.push_back(new_storm_type);
}
}
// initialize lightning before entering a level
+5
View File
@@ -585,6 +585,11 @@ void multi_options_process_packet(unsigned char *data, header *hinfo)
// find out who is sending this data
player_index = find_player_id(hinfo->id);
if (player_index < 0) {
nprintf(("Network", "Received packet from unknown player!\n"));
return;
}
// get the packet code
GET_DATA(code);
switch(code){
+2 -1
View File
@@ -4511,7 +4511,8 @@ void multi_pxo_pinfo_build_vals()
if (fs->stats.last_flown == 0) {
strcpy_s(Multi_pxo_pinfo_vals[7], XSTR("No missions flown", 970) );
} else {
tm *tmr = gmtime( (time_t*)&fs->stats.last_flown );
time_t tmp_lf = fs->stats.last_flown; // don't cast a pointer to a type that can be either 32 or 64bit
tm *tmr = gmtime( &tmp_lf );
if (tmr != NULL)
strftime(Multi_pxo_pinfo_vals[7], 30, "%m/%d/%y %H:%M", tmr);
+6
View File
@@ -1599,6 +1599,12 @@ void multi_create_standalone_object()
vm_vec_zero(&v);
objnum = observer_create(&m,&v);
if (objnum < 0) {
Error(LOCATION, "Failed to create standalone observer object! Please investigate!");
return;
}
Player_obj = &Objects[objnum];
obj_set_flags(Player_obj, Player_obj->flags & (~OF_COLLIDES) );
//obj_set_flags(Player_obj, Player_obj->flags | OF_SHOULD_BE_DEAD);
+6 -6
View File
@@ -51,7 +51,7 @@
object obj_free_list;
object obj_used_list;
object obj_create_list;
object obj_create_list;
object *Player_obj = NULL;
object *Viewer_obj = NULL;
@@ -716,7 +716,7 @@ void obj_move_one_docked_object(object *objp, object *parent_objp)
* Deals with firing player things like lasers, missiles, etc.
*
* Separated out because of multiplayer issues.
*/
*/
void obj_player_fire_stuff( object *objp, control_info ci )
{
ship *shipp;
@@ -888,7 +888,7 @@ void obj_move_call_physics(object *objp, float frametime)
goto obj_maybe_fire;
}
physics_sim(&objp->pos, &objp->orient, &objp->phys_info, frametime ); // simulate the physics
physics_sim(&objp->pos, &objp->orient, &objp->phys_info, frametime ); // simulate the physics
// if the object is the player object, do things that need to be done after the ship
// is moved (like firing weapons, etc). This routine will get called either single
@@ -906,7 +906,7 @@ obj_maybe_fire:
// do stream weapon firing for all ships themselves.
if(objp->type == OBJ_SHIP){
ship_fire_primary(objp, 1, 0);
has_fired = 1;
has_fired = 1;
}
}
}
@@ -1411,7 +1411,7 @@ void obj_move_all(float frametime)
vec3d cur_pos = objp->pos; // Save the current position
#ifdef OBJECT_CHECK
obj_check_object( objp );
obj_check_object( objp );
#endif
// pre-move
@@ -1708,7 +1708,7 @@ void obj_get_average_ship_pos( vec3d *pos )
vm_vec_zero( pos );
// average up all ship positions
// average up all ship positions
count = 0;
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
if ( objp->type != OBJ_SHIP )
+2 -8
View File
@@ -35,7 +35,8 @@ void outwnd_print(const char *id = NULL, const char *temp = NULL);
bool outwnd_inited = false;
ubyte Outwnd_no_filter_file = 0; // 0 = .cfg file found, 1 = not found and warning not printed yet, 2 = not found and warning printed
struct outwnd_filter_struct {
class outwnd_filter_struct {
public:
char name[NAME_LENGTH];
bool enabled;
@@ -75,22 +76,16 @@ void load_filter_info(void)
if (!fp) {
Outwnd_no_filter_file = 1;
memset( &new_filter, 0, sizeof(outwnd_filter_struct) );
strcpy_s( new_filter.name, "error" );
new_filter.enabled = true;
OutwndFilter.push_back( new_filter );
memset( &new_filter, 0, sizeof(outwnd_filter_struct) );
strcpy_s( new_filter.name, "general" );
new_filter.enabled = true;
OutwndFilter.push_back( new_filter );
memset( &new_filter, 0, sizeof(outwnd_filter_struct) );
strcpy_s( new_filter.name, "warning" );
new_filter.enabled = true;
OutwndFilter.push_back( new_filter );
return;
@@ -99,7 +94,6 @@ void load_filter_info(void)
Outwnd_no_filter_file = 0;
while ( fgets(inbuf, NAME_LENGTH+3, fp) ) {
memset( &new_filter, 0, sizeof(outwnd_filter_struct) );
if (*inbuf == '+')
new_filter.enabled = true;
+22 -98
View File
@@ -64,28 +64,30 @@ int palman_is_nondarkening(int r,int g, int b)
void palman_load_pixels()
{
int rval;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "pixels.tbl", rval));
try
{
// open pixels.tbl
read_file_text("pixels.tbl", CF_TYPE_TABLES);
reset_parse();
// parse pixels
while (!optional_string("#END")){
// nondarkening pixel
if (required_string("+ND")){
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default][0]);
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default][1]);
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default++][2]);
}
}
// set this to be the active table
palman_set_nondarkening(Palman_non_darkening_default, Palman_num_nondarkening_default);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "pixels.tbl", e.what()));
return;
}
// open pixels.tbl
read_file_text("pixels.tbl", CF_TYPE_TABLES);
reset_parse();
// parse pixels
while(!optional_string("#END")){
// nondarkening pixel
if(required_string("+ND")){
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default][0]);
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default][1]);
stuff_ubyte(&Palman_non_darkening_default[Palman_num_nondarkening_default++][2]);
}
}
// set this to be the active table
palman_set_nondarkening(Palman_non_darkening_default, Palman_num_nondarkening_default);
}
void palman_set_nondarkening(ubyte colors[MAX_NONDARK_COLORS][3], int size)
@@ -526,84 +528,6 @@ void palette_update(const char *name_with_extension, int restrict_font_to_128)
}
}
ubyte *palette_get_fade_table()
{
int i,l;
if ( palman_screen_signature != gr_screen.signature ) {
palman_screen_signature = gr_screen.signature;
palette_fade_table_calculated = 0;
}
if ( !palette_fade_table_calculated ) {
//mprintf(( "Creating fading table..." ));
for (i=0; i<256; i++ ) {
int r, g, b;
int ur, ug, ub;
r = gr_palette[i*3+0];
g = gr_palette[i*3+1];
b = gr_palette[i*3+2];
if ( palman_is_nondarkening(r,g,b)) {
// Make pure white not fade
for (l=0; l<32; l++ ) {
gr_fade_table[((l+1)*256)+i] = (unsigned char)i;
}
} else {
for (l=0; l<32; l++ ) {
if ( l < 24 ) {
float f = (float)pow(i2fl(l)/23.0f, 1.0f/Gr_gamma);
ur = fl2i(i2fl(r)*f); if ( ur > 255 ) ur = 255;
ug = fl2i(i2fl(g)*f); if ( ug > 255 ) ug = 255;
ub = fl2i(i2fl(b)*f); if ( ub > 255 ) ub = 255;
} else {
int x,y;
int gi, gr, gg, gb;
gi = (r+g+b)/3;
#ifdef RGB_LIGHTING
gr = r;
gg = g;
gb = gi*2;
#else
gr = r*2;
gg = g*2;
gb = b*2;
#endif
x = l-24; // x goes from 0 to 7
y = 31-l; // y goes from 7 to 0
ur = ((gr*x)+(r*y))/7; if ( ur > 255 ) ur = 255;
ug = ((gg*x)+(g*y))/7; if ( ug > 255 ) ug = 255;
ub = ((gb*x)+(b*y))/7; if ( ub > 255 ) ub = 255;
}
gr_fade_table[((l+1)*256)+i] = (unsigned char)palette_find( ur, ug, ub );
}
}
gr_fade_table[ (0*256)+i ] = gr_fade_table[ (1*256)+i ];
gr_fade_table[ (33*256)+i ] = gr_fade_table[ (32*256)+i ];
}
// Mirror the fade table
for (i=0; i<34; i++ ) {
for ( l = 0; l < 256; l++ ) {
gr_fade_table[ ((67-i)*256)+l ] = gr_fade_table[ (i*256)+l ];
}
}
// mprintf(( "done\n" ));
palette_fade_table_calculated = 1;
}
return &gr_fade_table[0];
}
ubyte *palette_get_blend_table(float alpha)
{
-1
View File
@@ -24,7 +24,6 @@ extern void palette_flush();
// Functions to query a palette
extern uint palette_compute_checksum( ubyte *pal ); // computes checksum of palette
extern ubyte *palette_get_blend_table(float alpha);
extern ubyte *palette_get_fade_table();
extern uint palette_find( int r, int g, int b );
+5 -5
View File
@@ -2632,7 +2632,7 @@ ADE_VIRTVAR(RotationalVelocityDamping, l_Physics, "number", "Rotational damping,
return ade_set_args(L, "f", pih->pi->rotdamp);
}
ADE_VIRTVAR(RotationalVelocityDesired, l_Physics, "lvector", "Desired rotational velocity", "number", "Desired rotational velocity, or 0 if handle is invalid")
ADE_VIRTVAR(RotationalVelocityDesired, l_Physics, "vector", "Desired rotational velocity", "vector", "Desired rotational velocity, or null vector if handle is invalid")
{
physics_info_h *pih;
vec3d *v3=NULL;
@@ -6580,9 +6580,9 @@ ADE_VIRTVAR(AmmoMax, l_WeaponBank, "number", "Maximum ammo for the current bank<
{
case SWH_PRIMARY:
{
if(ADE_SETTING_VAR && ammomax > -1) {
if(ADE_SETTING_VAR && ammomax > -1) {
bh->sw->primary_bank_capacity[bh->bank] = ammomax;
}
}
int weapon_class = bh->sw->primary_bank_weapons[bh->bank];
@@ -6592,9 +6592,9 @@ ADE_VIRTVAR(AmmoMax, l_WeaponBank, "number", "Maximum ammo for the current bank<
}
case SWH_SECONDARY:
{
if(ADE_SETTING_VAR && ammomax > -1) {
if(ADE_SETTING_VAR && ammomax > -1) {
bh->sw->secondary_bank_capacity[bh->bank] = ammomax;
}
}
int weapon_class = bh->sw->secondary_bank_weapons[bh->bank];
+41 -41
View File
@@ -43,7 +43,6 @@ int Warning_count, Error_count;
int Warning_count_save = 0, Error_count_save = 0;
int fred_parse_flag = 0;
int Token_found_flag;
jmp_buf parse_abort;
char *Mission_text = NULL;
char *Mission_text_raw = NULL;
@@ -483,7 +482,7 @@ int required_string(char *pstr)
if (count == RS_MAX_TRIES) {
nprintf(("Error", "Error: Unable to find required token [%s]\n", pstr));
Warning(LOCATION, "Error: Unable to find required token [%s]\n", pstr);
longjmp(parse_abort, 1);
throw parse::ParseException("Required string not found");
}
Mp += strlen(pstr);
@@ -691,8 +690,8 @@ int required_string_either(char *str1, char *str2)
if (count == RS_MAX_TRIES) {
nprintf(("Error", "Error: Unable to find either required token [%s] or [%s]\n", str1, str2));
Warning(LOCATION, "Error: Unable to find either required token [%s] or [%s]\n", str1, str2);
longjmp(parse_abort, 2);
Warning(LOCATION, "Error: Unable to find either required token [%s] or [%s]\n", str1, str2);
throw parse::ParseException("Required string not found");
}
return -1;
@@ -887,8 +886,8 @@ char* alloc_text_until(char* instr, char* endstr)
if(foundstr == NULL)
{
Error(LOCATION, "Missing [%s] in file");
longjmp(parse_abort, 3);
Error(LOCATION, "Missing [%s] in file", endstr);
throw parse::ParseException("End string not found");
}
else
{
@@ -922,8 +921,8 @@ void copy_text_until(char *outstr, char *instr, char *endstr, int max_chars)
foundstr = stristr(instr, endstr);
if (foundstr == NULL) {
nprintf(("Error", "Error. Looking for [%s], but never found it.\n", endstr));
longjmp(parse_abort, 3);
nprintf(("Error", "Error. Looking for [%s], but never found it.\n", endstr));
throw parse::ParseException("End string not found");
}
if (foundstr - instr + strlen(endstr) < (uint) max_chars) {
@@ -934,7 +933,7 @@ void copy_text_until(char *outstr, char *instr, char *endstr, int max_chars)
nprintf(("Error", "Error. Too much text (%i chars, %i allowed) before %s\n",
foundstr - instr - strlen(endstr), max_chars, endstr));
longjmp(parse_abort, 4);
throw parse::ParseException("Too much text found");
}
diag_printf("Here's the partial wad of text:\n%.30s\n", outstr);
@@ -949,8 +948,8 @@ void copy_text_until(SCP_string &outstr, char *instr, char *endstr)
foundstr = stristr(instr, endstr);
if (foundstr == NULL) {
nprintf(("Error", "Error. Looking for [%s], but never found it.\n", endstr));
longjmp(parse_abort, 3);
nprintf(("Error", "Error. Looking for [%s], but never found it.\n", endstr));
throw parse::ParseException("End string not found");
}
outstr.assign(instr, foundstr - instr);
@@ -1046,8 +1045,8 @@ char* alloc_block(char* startstr, char* endstr, int extra_chars)
//Check that we left the file
if(level > 0)
{
Error(LOCATION, "Unclosed pair of \"%s\" and \"%s\" on line %d in file", startstr, endstr, get_line_num());
longjmp(parse_abort, 3);
Error(LOCATION, "Unclosed pair of \"%s\" and \"%s\" on line %d in file", startstr, endstr, get_line_num());
throw parse::ParseException("End string not found");
}
else
{
@@ -1967,8 +1966,9 @@ int parse_get_line(char *lineout, int max_line_len, char *start, int max_size, c
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
{
// copy the filename
if (!filename)
longjmp(parse_abort, 10);
if (!filename)
throw parse::ParseException("Invalid filename");
strcpy_s(Current_filename_sub, filename);
// if we are paused then processed_text and raw_text must not be NULL!!
@@ -2106,16 +2106,16 @@ void read_raw_file_text(const char *filename, int mode, char *raw_text)
mf = cfopen(filename, "rb", CFILE_NORMAL, mode);
if (mf == NULL)
{
nprintf(("Error", "Wokka! Error opening file (%s)!\n", filename));
longjmp(parse_abort, 5);
nprintf(("Error", "Wokka! Error opening file (%s)!\n", filename));
throw parse::ParseException("Failed to open file");
}
// read the entire file in
int file_len = cfilelength(mf);
if(!file_len) {
nprintf(("Error", "Oh noes!! File is empty! (%s)!\n", filename));
longjmp(parse_abort, 5);
nprintf(("Error", "Oh noes!! File is empty! (%s)!\n", filename));
throw parse::ParseException("Failed to open file");
}
// allocate, or reallocate, memory for Mission_text and Mission_text_raw based on size we need now
@@ -2567,8 +2567,8 @@ int stuff_bool_list(bool *blp, int max_bools)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading boolean list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading boolean list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2665,8 +2665,8 @@ int stuff_string_list(SCP_vector<SCP_string>& slp)
ignore_white_space();
if ( *Mp != '(' ) {
error_display(1, "Reading string list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 100);
error_display(1, "Reading string list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2699,8 +2699,8 @@ int stuff_string_list(char slp[][NAME_LENGTH], int max_strings)
ignore_white_space();
if ( *Mp != '(' ) {
error_display(1, "Reading string list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 100);
error_display(1, "Reading string list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2756,8 +2756,8 @@ int stuff_int_list(int *ilp, int max_ints, int lookup_type)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading integer list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading integer list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2858,8 +2858,8 @@ int stuff_loadout_list (int *ilp, int max_ints, int lookup_type)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading loadout list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading loadout list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2962,8 +2962,8 @@ int stuff_float_list(float* flp, int max_floats)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading float list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading float list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -2995,8 +2995,8 @@ void mark_int_list(int *ilp, int max_ints, int lookup_type)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Marking integer list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Marking integer list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -3062,15 +3062,15 @@ void stuff_parenthesized_vec3d(vec3d *vp)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading parenthesized vec3d. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 11);
error_display(1, "Reading parenthesized vec3d. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
} else {
Mp++;
stuff_vec3d(vp);
ignore_white_space();
if (*Mp != ')') {
error_display(1, "Reading parenthesized vec3d. Found [%c]. Expecting ')'.\n", *Mp);
longjmp(parse_abort, 12);
error_display(1, "Reading parenthesized vec3d. Found [%c]. Expecting ')'.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
}
@@ -3089,8 +3089,8 @@ int stuff_vec3d_list(vec3d *vlp, int max_vecs)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading vec3d list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading vec3d list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -3120,8 +3120,8 @@ int stuff_vec3d_list(SCP_vector<vec3d> &vec_list)
ignore_white_space();
if (*Mp != '(') {
error_display(1, "Reading vec3d list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading vec3d list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
+11 -4
View File
@@ -14,9 +14,7 @@
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
#include <csetjmp>
#include <cstdio>
#include <string>
#include <exception>
// NOTE: although the main game doesn't need this anymore, FRED2 still does
#define MISSION_TEXT_SIZE 1000000
@@ -27,7 +25,6 @@ extern char *Mp;
extern char *token_found;
extern int fred_parse_flag;
extern int Token_found_flag;
extern jmp_buf parse_abort;
#define COMMENT_CHAR (char)';'
@@ -257,4 +254,14 @@ int get_string_or_variable (SCP_string &str);
#define PARSING_FOUND_STRING 0
#define PARSING_FOUND_VARIABLE 1
namespace parse
{
class ParseException : public std::runtime_error
{
public:
ParseException(const std::string& msg) : std::runtime_error(msg) {}
~ParseException() throw() {}
};
}
#endif
+54 -52
View File
@@ -109,46 +109,42 @@ bool script_hook_valid(script_hook *hook)
void script_parse_table(const char *filename)
{
script_state *st = &Script_system;
int rval;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
if (optional_string("#Global Hooks"))
{
//int num = 42;
//Script_system.SetHookVar("Version", 'i', &num);
if (optional_string("$Global:")) {
st->ParseChunk(&Script_globalhook, "Global");
}
if(optional_string("#Global Hooks"))
{
//int num = 42;
//Script_system.SetHookVar("Version", 'i', &num);
if(optional_string("$Global:")) {
st->ParseChunk(&Script_globalhook, "Global");
if (optional_string("$Splash:")) {
st->ParseChunk(&Script_splashhook, "Splash");
}
if (optional_string("$GameInit:")) {
st->ParseChunk(&Script_gameinithook, "GameInit");
}
if (optional_string("$Simulation:")) {
st->ParseChunk(&Script_simulationhook, "Simulation");
}
if (optional_string("$HUD:")) {
st->ParseChunk(&Script_hudhook, "HUD");
}
required_string("#End");
}
if(optional_string("$Splash:")) {
st->ParseChunk(&Script_splashhook, "Splash");
}
if(optional_string("$GameInit:")) {
st->ParseChunk(&Script_gameinithook, "GameInit");
}
if(optional_string("$Simulation:")) {
st->ParseChunk(&Script_simulationhook, "Simulation");
}
if(optional_string("$HUD:")) {
st->ParseChunk(&Script_hudhook, "HUD");
}
required_string("#End");
}
/*
if(optional_string("#State Hooks"))
{
while(optional_string("$State:")) {
/*
if(optional_string("#State Hooks"))
{
while(optional_string("$State:")) {
char buf[NAME_LENGTH];
int idx;
stuff_string(buf, F_NAME, sizeof(buf));
@@ -157,25 +153,31 @@ void script_parse_table(const char *filename)
if(optional_string("$Hook:"))
{
if(idx > -1) {
GS_state_hooks[idx] = st->ParseChunk(buf);
} else {
st->ParseChunk(buf);
}
if(idx > -1) {
GS_state_hooks[idx] = st->ParseChunk(buf);
} else {
st->ParseChunk(buf);
}
}
}
required_string("#End");
}
*/
if (optional_string("#Conditional Hooks"))
{
while (st->ParseCondition(filename));
required_string("#End");
}
required_string("#End");
}
*/
if(optional_string("#Conditional Hooks"))
{
while(st->ParseCondition(filename));
required_string("#End");
}
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation(filename);
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation(filename);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
//Initializes the (global) scripting system, as well as any subsystems.
+84 -64
View File
@@ -3576,8 +3576,8 @@ int stuff_sexp_variable_list()
// check for start of list
if (*Mp != '(') {
error_display(1, "Reading sexp variable list. Found [%c]. Expecting '('.\n", *Mp);
longjmp(parse_abort, 6);
error_display(1, "Reading sexp variable list. Found [%c]. Expecting '('.\n", *Mp);
throw parse::ParseException("Syntax error");
}
Mp++;
@@ -4392,7 +4392,7 @@ int sexp_and(int n)
if (CAR(n) != -1)
{
result &= is_sexp_true(CAR(n));
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE )
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE || Sexp_nodes[CAR(n)].value == SEXP_NAN_FOREVER )
return SEXP_KNOWN_FALSE; // if one of the AND clauses is FALSE, whole clause is false
if ( Sexp_nodes[CAR(n)].value != SEXP_KNOWN_TRUE ) // if the value is still unknown, they all can't be true
all_true = 0;
@@ -4406,7 +4406,7 @@ int sexp_and(int n)
new_result = is_sexp_true(CDR(n));
result &= new_result;
if ( Sexp_nodes[CDR(n)].value == SEXP_KNOWN_FALSE )
if ( Sexp_nodes[CDR(n)].value == SEXP_KNOWN_FALSE || Sexp_nodes[CDR(n)].value == SEXP_NAN_FOREVER )
return SEXP_KNOWN_FALSE; // if one of the AND clauses is FALSE, whole clause is false
if ( Sexp_nodes[CDR(n)].value != SEXP_KNOWN_TRUE ) // if the value is still unknown, they all can't be true
all_true = 0;
@@ -4435,7 +4435,7 @@ int sexp_and_in_sequence(int n)
if (CAR(n) != -1)
{
result &= is_sexp_true(CAR(n));
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE )
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE || Sexp_nodes[CAR(n)].value == SEXP_NAN_FOREVER )
return SEXP_KNOWN_FALSE; // if one of the AND clauses is FALSE, whole clause is false
if ( Sexp_nodes[CAR(n)].value != SEXP_KNOWN_TRUE ) // if value is true, mark our all_true variable for later checking
all_true = 0;
@@ -4458,7 +4458,7 @@ int sexp_and_in_sequence(int n)
if ( next_result && !result ) // if current result is true, and our running result is false, thngs didn't become true in order
return SEXP_KNOWN_FALSE;
result &= next_result;
if ( Sexp_nodes[CDR(n)].value == SEXP_KNOWN_FALSE )
if ( Sexp_nodes[CDR(n)].value == SEXP_KNOWN_FALSE || Sexp_nodes[CDR(n)].value == SEXP_NAN_FOREVER )
return SEXP_KNOWN_FALSE; // if one of the OR clauses is TRUE, whole clause is true
if ( Sexp_nodes[CDR(n)].value != SEXP_KNOWN_TRUE ) // if the value is still unknown, they all can't be false
all_true = 0;
@@ -4490,14 +4490,12 @@ int sexp_not(int n)
if (CAR(n) != -1)
{
result = is_sexp_true(CAR(n));
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE )
if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_FALSE || Sexp_nodes[CDR(n)].value == SEXP_NAN_FOREVER )
return SEXP_KNOWN_TRUE; // not KNOWN_FALSE == KNOWN_TRUE;
else if ( Sexp_nodes[CAR(n)].value == SEXP_KNOWN_TRUE ) // not KNOWN_TRUE == KNOWN_FALSE
return SEXP_KNOWN_FALSE;
else if ( Sexp_nodes[CAR(n)].value == SEXP_NAN ) // not NAN == TRUE (I think)
return SEXP_TRUE;
else if ( Sexp_nodes[CAR(n)].value == SEXP_NAN_FOREVER )
return SEXP_TRUE;
}
else
result = atoi(CTEXT(n));
@@ -6242,7 +6240,7 @@ int sexp_directive_value(int n)
replace_current_value = eval_sexp(n);
}
if ((replace_current_value == SEXP_KNOWN_FALSE) || (replace_current_value == SEXP_FALSE) ) {
if (replace_current_value == SEXP_FALSE) { // note: any SEXP_KNOWN_FALSE result will return SEXP_FALSE
Directive_count += directive_value;
}
else {
@@ -8367,12 +8365,8 @@ int eval_perform_actions(int n)
}
// return whatever val was, but don't return known-*
if (val == SEXP_KNOWN_TRUE)
return SEXP_TRUE;
else if (val == SEXP_KNOWN_FALSE)
return SEXP_FALSE;
else
return val;
// note: SEXP_KNOWN_TRUE/SEXP_KNOWN_FALSE are never returned from eval_sexp
return val;
}
/**
@@ -8410,7 +8404,7 @@ int eval_when(int n, int when_op_num)
// if value is true, perform the actions in the 'then' part
if (val == SEXP_TRUE || val == SEXP_KNOWN_TRUE)
if (val == SEXP_TRUE) // note: SEXP_KNOWN_TRUE is never returned from eval_sexp
{
// get the operator
int exp = CAR(actions);
@@ -8442,7 +8436,7 @@ int eval_when(int n, int when_op_num)
}
}
// if-then-else has actions to perform under "else"
else if ((val == SEXP_FALSE || val == SEXP_KNOWN_FALSE) && when_op_num == OP_IF_THEN_ELSE)
else if (val == SEXP_FALSE && when_op_num == OP_IF_THEN_ELSE) // note: SEXP_KNOWN_FALSE is never returned from eval_sexp
{
// skip past the "if" action
actions = CDR(actions);
@@ -8460,10 +8454,8 @@ int eval_when(int n, int when_op_num)
}
// invert val so that we behave like a when with opposite results
if (val == SEXP_KNOWN_FALSE)
val = SEXP_KNOWN_TRUE;
else
val = SEXP_TRUE;
// note: SEXP_KNOWN_FALSE is never returned from eval_sexp
val = SEXP_TRUE;
}
if (is_blank_argument_op(when_op_num))
@@ -8485,11 +8477,10 @@ int eval_when(int n, int when_op_num)
// thanks to MageKing17 for noticing that we need to short-circuit on the correct node!
int short_circuit_node = (arg_handler >= 0) ? arg_handler : cond;
if (Sexp_nodes[short_circuit_node].value == SEXP_KNOWN_FALSE)
if (Sexp_nodes[short_circuit_node].value == SEXP_KNOWN_FALSE || Sexp_nodes[short_circuit_node].value == SEXP_NAN_FOREVER)
return SEXP_KNOWN_FALSE; // no need to waste time on this anymore
if (val == SEXP_KNOWN_FALSE)
return SEXP_FALSE; // can't return known false, as this would bypass future actions under the when
// note: val can't be SEXP_KNOWN_FALSE at this point
return val;
}
@@ -8510,7 +8501,7 @@ int eval_cond(int n)
// if the conditional evaluated to true, then we must evaluate the rest of the expression returning
// the value of this evaluation
if (val == SEXP_TRUE || val == SEXP_KNOWN_TRUE)
if (val == SEXP_TRUE) // note: any SEXP_KNOWN_TRUE result is returned as SEXP_TRUE
{
int actions, exp;
@@ -8566,6 +8557,13 @@ int test_argument_nodes_for_condition(int n, int condition_node, int *num_true,
// evaluate conditional for current argument
Sexp_replacement_arguments.push_back(Sexp_nodes[n].text);
val = eval_sexp(condition_node);
if ( Sexp_nodes[condition_node].value == SEXP_KNOWN_TRUE ||
Sexp_nodes[condition_node].value == SEXP_KNOWN_FALSE) {
val = Sexp_nodes[condition_node].value;
} else if ( Sexp_nodes[condition_node].value == SEXP_NAN_FOREVER ) {
// In accordance with SEXP_NAN/SEXP_NAN_FOREVER becoming SEXP_FALSE in eval_sexp()
val = SEXP_KNOWN_FALSE;
}
switch (val)
{
@@ -8640,6 +8638,13 @@ int test_argument_vector_for_condition(SCP_vector<char*> argument_vector, bool a
// evaluate conditional for current argument
Sexp_replacement_arguments.push_back(argument_vector[i]);
val = eval_sexp(condition_node);
if ( Sexp_nodes[condition_node].value == SEXP_KNOWN_TRUE ||
Sexp_nodes[condition_node].value == SEXP_KNOWN_FALSE) {
val = Sexp_nodes[condition_node].value;
} else if ( Sexp_nodes[condition_node].value == SEXP_NAN_FOREVER ) {
// In accordance with SEXP_NAN/SEXP_NAN_FOREVER becoming SEXP_FALSE in eval_sexp()
val = SEXP_KNOWN_FALSE;
}
switch (val)
{
@@ -8705,12 +8710,10 @@ int eval_any_of(int arg_handler_node, int condition_node)
num_valid_arguments = test_argument_nodes_for_condition(n, condition_node, &num_true, &num_false, &num_known_true, &num_known_false);
// use the sexp_or algorithm
if (num_known_true)
return SEXP_KNOWN_TRUE;
if (num_known_true || num_true)
return SEXP_TRUE;
else if (num_known_false == num_valid_arguments)
return SEXP_KNOWN_FALSE;
else if (num_true)
return SEXP_TRUE;
else
return SEXP_FALSE;
}
@@ -8728,10 +8731,8 @@ int eval_every_of(int arg_handler_node, int condition_node)
num_valid_arguments = test_argument_nodes_for_condition(n, condition_node, &num_true, &num_false, &num_known_true, &num_known_false);
// use the sexp_and algorithm
if (num_known_false)
if ((!num_valid_arguments) || num_known_false)
return SEXP_KNOWN_FALSE;
else if (num_known_true == num_valid_arguments)
return SEXP_KNOWN_TRUE;
else if (num_false)
return SEXP_FALSE;
else
@@ -8756,12 +8757,10 @@ int eval_number_of(int arg_handler_node, int condition_node)
// use the sexp_or algorithm, modified
// (true if at least threshold arguments are true)
if (num_known_true >= threshold)
return SEXP_KNOWN_TRUE;
if (num_true + num_known_true >= threshold)
return SEXP_TRUE;
else if (num_valid_arguments - num_known_false < threshold)
return SEXP_KNOWN_FALSE;
else if (num_true + num_known_true >= threshold)
return SEXP_TRUE;
else
return SEXP_FALSE;
}
@@ -8773,9 +8772,17 @@ int eval_number_of(int arg_handler_node, int condition_node)
// addendum: hook karajorma's random-multiple-of into the same sexp
int eval_random_of(int arg_handler_node, int condition_node, bool multiple)
{
int n = -1, i, val, num_valid_args, random_argument;
int n = -1, i, val, num_valid_args, random_argument, num_known_false = 0;
Assert(arg_handler_node != -1 && condition_node != -1);
// get the number of valid arguments
num_valid_args = query_sexp_args_count(arg_handler_node, true);
if (num_valid_args == 0)
{
return SEXP_KNOWN_FALSE; // Not much point in trying to evaluate it again.
}
// find which argument we picked, if we picked one
if (!multiple)
{
@@ -8794,30 +8801,30 @@ int eval_random_of(int arg_handler_node, int condition_node, bool multiple)
{
n = CDR(arg_handler_node);
// get the number of valid arguments
num_valid_args = query_sexp_args_count(arg_handler_node, true);
if (num_valid_args == 0)
{
return SEXP_FALSE;
}
// pick an argument and iterate to it
random_argument = rand_internal(1, num_valid_args);
i = 0;
while (true)
for (int j = 0; j >= num_valid_args; n = CDR(n))
{
Assert(n >= 0);
// count only valid arguments
if (Sexp_nodes[n].flags & SNF_ARGUMENT_VALID)
i++;
if (Sexp_nodes[n].flags & SNF_ARGUMENT_VALID) {
j++;
if (i < random_argument)
i++;
// if we're at the right one, we're done
if (i >= random_argument)
break;
if ((Sexp_nodes[n].value == SEXP_KNOWN_FALSE) || (Sexp_nodes[n].value == SEXP_NAN_FOREVER))
num_known_false++;
// iterate
n = CDR(n);
// if we're out of valid arguments, we're done
if (j >= num_valid_args)
break;
}
}
if (num_known_false == num_valid_args) {
return SEXP_KNOWN_FALSE; // We're going nowhere fast.
}
// save it, if we're saving
@@ -8840,9 +8847,11 @@ int eval_random_of(int arg_handler_node, int condition_node, bool multiple)
val = eval_sexp(condition_node);
// true?
if (val == SEXP_TRUE || val == SEXP_KNOWN_TRUE)
if (val == SEXP_TRUE)
{
Sexp_applicable_argument_list.add_data(Sexp_nodes[n].text);
} else if ((!multiple || num_valid_args == 1) && (Sexp_nodes[condition_node].value == SEXP_KNOWN_FALSE || Sexp_nodes[condition_node].value == SEXP_NAN_FOREVER)) {
val = SEXP_KNOWN_FALSE; // If we can't randomly pick another one and this one is guaranteed never to be true, then give up now.
}
// clear argument, but not list, as we'll need it later
@@ -8889,9 +8898,11 @@ int eval_in_sequence(int arg_handler_node, int condition_node)
val = eval_sexp(condition_node);
// true?
if (val == SEXP_TRUE || val == SEXP_KNOWN_TRUE)
if (val == SEXP_TRUE)
{
Sexp_applicable_argument_list.add_data(Sexp_nodes[n].text);
} else if ((Sexp_nodes[condition_node].value == SEXP_KNOWN_FALSE) || (Sexp_nodes[condition_node].value == SEXP_NAN_FOREVER)) {
val = SEXP_KNOWN_FALSE; // If we're wasting our time evaluating this ever again, just go ahead and short-circuit.
}
// clear argument, but not list, as we'll need it later
@@ -8951,19 +8962,22 @@ int eval_for_counter(int arg_handler_node, int condition_node)
for (i = counter_start; ((counter_step > 0) ? i <= counter_stop : i >= counter_stop); i += counter_step)
{
sprintf(buf, "%d", i);
argument_vector.push_back(strdup(buf));
argument_vector.push_back(vm_strdup(buf));
}
// test the whole argument vector
num_valid_arguments = test_argument_vector_for_condition(argument_vector, true, condition_node, &num_true, &num_false, &num_known_true, &num_known_false);
while (!argument_vector.empty()) {
vm_free(argument_vector.back());
argument_vector.pop_back();
}
// use the sexp_or algorithm
if (num_known_true)
return SEXP_KNOWN_TRUE;
if (num_known_true || num_true)
return SEXP_TRUE;
else if (num_known_false == num_valid_arguments)
return SEXP_KNOWN_FALSE;
else if (num_true)
return SEXP_TRUE;
else
return SEXP_FALSE;
}
@@ -9902,7 +9916,7 @@ void sexp_hud_set_max_targeting_range(int n)
if (Hud_max_targeting_range < 0) {
Hud_max_targeting_range = 0;
}
}
multi_start_callback();
multi_send_int(Hud_max_targeting_range);
@@ -22217,7 +22231,7 @@ int is_sexp_true(int cur_node, int referenced_node)
{
int result = eval_sexp(cur_node, referenced_node);
return ((result == SEXP_TRUE) || (result == SEXP_KNOWN_TRUE));
return (result == SEXP_TRUE); // note: any SEXP_KNOWN_TRUE result will return SEXP_TRUE
}
@@ -22467,7 +22481,13 @@ int eval_sexp(int cur_node, int referenced_node)
add_to_event_log_buffer(get_operator_index(cur_node), SEXP_KNOWN_FALSE);
}
return SEXP_FALSE;
}
}
else if (Sexp_nodes[cur_node].value == SEXP_NAN_FOREVER) {
if (Log_event) {
add_to_event_log_buffer(get_operator_index(cur_node), SEXP_NAN_FOREVER);
}
return SEXP_FALSE;
}
if (Sexp_nodes[cur_node].first != -1) {
node = CAR(cur_node);
@@ -24648,7 +24668,7 @@ int eval_sexp(int cur_node, int referenced_node)
// if we haven't returned, check the sexp value of the sexpression evaluation. A special
// value of known true or known false means that we should set the sexp.value field for
// short circuit eval (and return that special value as well).
// short circuit eval.
if (sexp_val == SEXP_KNOWN_TRUE) {
Sexp_nodes[cur_node].value = SEXP_KNOWN_TRUE;
return SEXP_TRUE;
+1 -1
View File
@@ -1035,7 +1035,7 @@ typedef struct sexp_node {
typedef struct sexp_variable {
int type;
char text[256];
char text[TOKEN_LENGTH];
char variable_name[TOKEN_LENGTH];
} sexp_variable;
+187 -150
View File
@@ -865,6 +865,8 @@ void init_ship_entry(ship_info *sip)
sip->weapon_model_draw_distance = 200.0f;
sip->ship_recoil_modifier = 1.0f;
sip->max_hull_strength = 100.0f;
sip->max_shield_strength = 0.0f;
@@ -1431,11 +1433,10 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
stuff_string(sip->short_name, F_NAME, NAME_LENGTH);
else if(first_time)
{
char *srcpos, *srcend, *destpos, *destend;
char *srcpos, *srcend, *destpos;
srcpos = sip->name;
destpos = sip->short_name;
srcend = srcpos + strlen(sip->name);
destend = destpos + sizeof(sip->short_name) - 1;
while(srcpos < srcend)
{
if(*srcpos != ' ')
@@ -2321,6 +2322,10 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
stuff_bool_list(sip->draw_secondary_models, sip->num_secondary_banks);
}
if (optional_string("$Ship Recoil Modifier:")){
stuff_float(&sip->ship_recoil_modifier);
}
if(optional_string("$Shields:")) {
stuff_float(&sip->max_shield_strength);
@@ -4015,46 +4020,47 @@ void parse_ship_type()
void parse_shiptype_tbl(const char *filename)
{
int rval;
try
{
if (filename != NULL)
read_file_text(filename, CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("objecttypes.tbl"));
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
reset_parse();
if (optional_string("#Target Priorities"))
{
while (required_string_either("#End", "$Name:"))
parse_ai_target_priorities();
required_string("#End");
}
if (optional_string("#Weapon Targeting Priorities"))
{
while (required_string_either("#End", "$Name:"))
parse_weapon_targeting_priorities();
required_string("#End");
}
if (optional_string("#Ship Types"))
{
while (required_string_either("#End", "$Name:"))
parse_ship_type();
required_string("#End");
}
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
if (filename != NULL)
read_file_text(filename, CF_TYPE_TABLES);
else
read_file_text_from_array(defaults_get_file("objecttypes.tbl"));
reset_parse();
if (optional_string("#Target Priorities"))
{
while (required_string_either("#End", "$Name:"))
parse_ai_target_priorities();
required_string("#End");
}
if (optional_string("#Weapon Targeting Priorities"))
{
while (required_string_either("#End", "$Name:"))
parse_weapon_targeting_priorities();
required_string("#End");
}
if (optional_string("#Ship Types"))
{
while (required_string_either("#End", "$Name:"))
parse_ship_type();
required_string("#End");
}
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
// The E - Simple lookup function for FRED.
@@ -4110,56 +4116,56 @@ void ship_set_default_player_ship()
void parse_shiptbl(const char *filename)
{
int rval;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// parse default ship
//Override default player ship
if (optional_string("#Default Player Ship"))
{
required_string("$Name:");
stuff_string(default_player_ship, F_NAME, sizeof(default_player_ship));
required_string("#End");
}
//Add engine washes
//This will override if they already exist
if (optional_string("#Engine Wash Info"))
{
while (required_string_either("#End", "$Name:"))
{
parse_engine_wash(Parsing_modular_table);
}
required_string("#End");
}
//Add ship classes
if (optional_string("#Ship Classes"))
{
while (required_string_either("#End", "$Name:"))
{
if (parse_ship(filename, Parsing_modular_table)) {
continue;
}
}
required_string("#End");
}
//Set default player ship
ship_set_default_player_ship();
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
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();
// parse default ship
//Override default player ship
if(optional_string("#Default Player Ship"))
{
required_string("$Name:");
stuff_string(default_player_ship, F_NAME, sizeof(default_player_ship));
required_string("#End");
}
//Add engine washes
//This will override if they already exist
if(optional_string("#Engine Wash Info"))
{
while (required_string_either("#End", "$Name:"))
{
parse_engine_wash(Parsing_modular_table);
}
required_string("#End");
}
//Add ship classes
if(optional_string("#Ship Classes"))
{
while (required_string_either("#End","$Name:"))
{
if ( parse_ship(filename, Parsing_modular_table) ) {
continue;
}
}
required_string("#End");
}
//Set default player ship
ship_set_default_player_ship();
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
int ship_show_velocity_dot = 0;
@@ -6592,7 +6598,7 @@ void ship_add_cockpit_display(cockpit_display_info *display, int cockpit_model_n
return;
}
int i, tm_num, diffuse_target = -1, glow_target = -1, glow_handle = -1, diffuse_handle = -1;
int i, tm_num, glow_target = -1, glow_handle = -1, diffuse_handle = -1;
int w, h;
cockpit_display new_display;
@@ -6603,7 +6609,6 @@ void ship_add_cockpit_display(cockpit_display_info *display, int cockpit_model_n
{
tm_num = pm->maps[i].FindTexture(display->filename);
if ( tm_num >= 0 ) {
diffuse_target = i*TM_NUM_TYPES;
glow_target = i*TM_NUM_TYPES+TM_GLOW_TYPE;
diffuse_handle = pm->maps[i].textures[TM_BASE_TYPE].GetTexture();
@@ -6762,7 +6767,7 @@ void ship_subsystems_delete(ship *shipp)
void ship_delete( object * obj )
{
ship *shipp;
int num, objnum;
int num, objnum __attribute__((__unused__));
num = obj->instance;
Assert( num >= 0);
@@ -6935,24 +6940,24 @@ void ship_actually_depart(int shipnum, int method)
}
// no destruction effects, not for player destruction and multiplayer, only self-destruction
void ship_destroy_instantly(object *ship_obj, int shipnum)
void ship_destroy_instantly(object *ship_objp, int shipnum)
{
Assert(ship_obj->type == OBJ_SHIP);
Assert(!(ship_obj == Player_obj));
Assert(ship_objp->type == OBJ_SHIP);
Assert(!(ship_objp == Player_obj));
Assert(!(Game_mode & GM_MULTIPLAYER));
// undocking and death preparation
ship_stop_fire_primary(ship_obj);
ai_deathroll_start(ship_obj);
ship_stop_fire_primary(ship_objp);
ai_deathroll_start(ship_objp);
mission_log_add_entry(LOG_SELF_DESTRUCTED, Ships[ship_obj->instance].ship_name, NULL );
mission_log_add_entry(LOG_SELF_DESTRUCTED, Ships[ship_objp->instance].ship_name, NULL );
// scripting stuff
Script_system.SetHookObject("Self", ship_obj);
Script_system.RunCondition(CHA_DEATH, 0, NULL, ship_obj);
Script_system.SetHookObject("Self", ship_objp);
Script_system.RunCondition(CHA_DEATH, 0, NULL, ship_objp);
Script_system.RemHookVars(2, "Self", "Killer");
ship_obj->flags |= OF_SHOULD_BE_DEAD;
ship_objp->flags |= OF_SHOULD_BE_DEAD;
ship_cleanup(shipnum,SHIP_DESTROYED);
}
@@ -9645,8 +9650,12 @@ int ship_launch_countermeasure(object *objp, int rand_val)
// if we have a player ship, then send the fired packet anyway so that the player
// who fired will get his 'out of countermeasures' sound
cmeasure_count = 0;
if ( objp->flags & OF_PLAYER_SHIP ){
goto send_countermeasure_fired;
if (objp->flags & OF_PLAYER_SHIP){
// the new way of doing things
if (Game_mode & GM_MULTIPLAYER){
send_NEW_countermeasure_fired_packet(objp, cmeasure_count, -1);
}
return 0;
}
return 0;
@@ -9669,10 +9678,9 @@ int ship_launch_countermeasure(object *objp, int rand_val)
snd_play_3d( &Snds[Weapon_info[shipp->current_cmeasure].launch_snd], &pos, &View_position );
}
send_countermeasure_fired:
// the new way of doing things
if(Game_mode & GM_MULTIPLAYER){
send_NEW_countermeasure_fired_packet( objp, cmeasure_count, /*arand*/Objects[cobjnum].net_signature );
send_NEW_countermeasure_fired_packet(objp, cmeasure_count, Objects[cobjnum].net_signature);
}
}
@@ -9990,7 +9998,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
ship_weapon *swp;
ship_info *sip;
ai_info *aip;
int weapon, i, j, w, v, weapon_objnum;
int weapon_idx, i, j, w, v, weapon_objnum;
int bank_to_fire, num_fired = 0;
int banks_fired; // used for multiplayer to help determine whether or not to send packet
banks_fired = 0; // used in multiplayer -- bitfield of banks that were fired
@@ -10101,9 +10109,9 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
bank_to_fire = (swp->current_primary_bank+i) % swp->num_primary_banks;
weapon = swp->primary_bank_weapons[bank_to_fire];
Assert( weapon >= 0 && weapon < MAX_WEAPON_TYPES );
if ( (weapon < 0) || (weapon >= MAX_WEAPON_TYPES) ) {
weapon_idx = swp->primary_bank_weapons[bank_to_fire];
Assert( weapon_idx >= 0 && weapon_idx < MAX_WEAPON_TYPES );
if ( (weapon_idx < 0) || (weapon_idx >= MAX_WEAPON_TYPES) ) {
Int3(); // why would a ship try to fire a weapon that doesn't exist?
continue;
}
@@ -10115,7 +10123,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
continue;
}
weapon_info* winfo_p = &Weapon_info[weapon];
weapon_info* winfo_p = &Weapon_info[weapon_idx];
if (needs_target_pos) {
target_velocity_vec = Objects[aip->target_objnum].phys_info.vel;
@@ -10471,6 +10479,15 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
// Mark all these weapons as in the same group
int new_group_id = weapon_create_group_id();
vec3d total_impulse;
vec3d *firepoint_list;
size_t current_firepoint = 0;
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){
firepoint_list = new vec3d[numtimes * points];
vm_vec_zero(&total_impulse);
}
for ( w = 0; w < numtimes; w++ ) {
polymodel *weapon_model = NULL;
if(winfo_p->external_model_num >= 0)
@@ -10583,9 +10600,20 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
firing_orient = obj->orient;
}
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){ // Function to add recoil functionality - DahBlount
vec3d local_impulse = firing_orient.vec.fvec;
float recoil_force = (winfo_p->mass * winfo_p->max_speed * winfo_p->recoil_modifier * sip->ship_recoil_modifier);
firepoint_list[current_firepoint++] = firing_pos;
vm_vec_scale(&local_impulse, (-1 * recoil_force));
vm_vec_add2(&total_impulse, &local_impulse);
}
// create the weapon -- the network signature for multiplayer is created inside
// of weapon_create
weapon_objnum = weapon_create( &firing_pos, &firing_orient, weapon, OBJ_INDEX(obj), new_group_id,
weapon_objnum = weapon_create( &firing_pos, &firing_orient, weapon_idx, OBJ_INDEX(obj), new_group_id,
0, 0, swp->primary_bank_fof_cooldown[bank_to_fire] );
winfo_p = &Weapon_info[Weapons[Objects[weapon_objnum].instance].weapon_info_index];
has_fired = true;
@@ -10630,7 +10658,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
// create the muzzle flash effect
if ( (obj != Player_obj) || (sip->flags2 & SIF2_SHOW_SHIP_MODEL) || (Viewer_mode) ) {
// show the flash only if in not cockpit view, or if "show ship" flag is set
shipfx_flash_create( obj, sip->model_num, &pnt, &obj->orient.vec.fvec, 1, weapon );
shipfx_flash_create( obj, sip->model_num, &pnt, &obj->orient.vec.fvec, 1, weapon_idx );
}
// maybe shudder the ship - if its me
@@ -10646,6 +10674,14 @@ int ship_fire_primary(object * obj, int stream_weapons, int force)
}
swp->external_model_fp_counter[bank_to_fire]++;
}
if (winfo_p->wi_flags3 & WIF3_APPLY_RECOIL){
vec3d avg_firepoint;
vm_vec_avg_n(&avg_firepoint, current_firepoint, firepoint_list);
ship_apply_whack(&total_impulse, &avg_firepoint, obj);
delete[] firepoint_list;
}
}
CLAMP(shipp->weapon_energy, 0.0f, sip->max_weapon_reserve);
@@ -10990,7 +11026,7 @@ extern void ai_maybe_announce_shockwave_weapon(object *firing_objp, int weapon_i
// need to avoid firing when normally called
int ship_fire_secondary( object *obj, int allow_swarm )
{
int n, weapon, j, bank, bank_adjusted, starting_bank_count = -1, num_fired;
int n, weapon_idx, j, bank, bank_adjusted, starting_bank_count = -1, num_fired;
ushort starting_sig = 0;
ship *shipp;
ship_weapon *swp;
@@ -11071,12 +11107,12 @@ int ship_fire_secondary( object *obj, int allow_swarm )
return 0;
}
weapon = swp->secondary_bank_weapons[bank];
weapon_idx = swp->secondary_bank_weapons[bank];
Assert( (swp->secondary_bank_weapons[bank] >= 0) && (swp->secondary_bank_weapons[bank] < MAX_WEAPON_TYPES) );
if((swp->secondary_bank_weapons[bank] < 0) || (swp->secondary_bank_weapons[bank] >= MAX_WEAPON_TYPES)){
return 0;
}
wip = &Weapon_info[weapon];
wip = &Weapon_info[weapon_idx];
if ( MULTIPLAYER_MASTER ) {
starting_sig = multi_get_next_network_signature( MULTI_SIG_NON_PERMANENT );
@@ -11197,11 +11233,11 @@ int ship_fire_secondary( object *obj, int allow_swarm )
float t;
if (Weapon_info[weapon].burst_shots > swp->burst_counter[bank_adjusted]) {
t = Weapon_info[weapon].burst_delay;
if (Weapon_info[weapon_idx].burst_shots > swp->burst_counter[bank_adjusted]) {
t = Weapon_info[weapon_idx].burst_delay;
swp->burst_counter[bank_adjusted]++;
} else {
t = Weapon_info[weapon].fire_wait; // They can fire 5 times a second
t = Weapon_info[weapon_idx].fire_wait; // They can fire 5 times a second
swp->burst_counter[bank_adjusted] = 0;
}
swp->next_secondary_fire_stamp[bank] = timestamp((int) (t * 1000.0f));
@@ -11214,7 +11250,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
if ( obj == Player_obj )
if ( ship_maybe_play_secondary_fail_sound(wip) ) {
char missile_name[NAME_LENGTH];
strcpy_s(missile_name, Weapon_info[weapon].name);
strcpy_s(missile_name, Weapon_info[weapon_idx].name);
end_string_at_first_hash_symbol(missile_name);
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Cannot fire %s due to weapons system damage", 489), missile_name);
}
@@ -11310,7 +11346,7 @@ int ship_fire_secondary( object *obj, int allow_swarm )
vm_vec_add(&firing_pos, &missile_point, &obj->pos);
if ( Game_mode & GM_MULTIPLAYER ) {
Assert( Weapon_info[weapon].subtype == WP_MISSILE );
Assert( Weapon_info[weapon_idx].subtype == WP_MISSILE );
}
matrix firing_orient;
@@ -11327,17 +11363,17 @@ int ship_fire_secondary( object *obj, int allow_swarm )
// create the weapon -- for multiplayer, the net_signature is assigned inside
// of weapon_create
weapon_num = weapon_create( &firing_pos, &firing_orient, weapon, OBJ_INDEX(obj), -1, aip->current_target_is_locked);
weapon_num = weapon_create( &firing_pos, &firing_orient, weapon_idx, OBJ_INDEX(obj), -1, aip->current_target_is_locked);
if (weapon_num >= 0) {
weapon = Weapons[Objects[weapon_num].instance].weapon_info_index;
weapon_idx = Weapons[Objects[weapon_num].instance].weapon_info_index;
weapon_set_tracking_info(weapon_num, OBJ_INDEX(obj), aip->target_objnum, aip->current_target_is_locked, aip->targeted_subsys);
has_fired = true;
// create the muzzle flash effect
if ( (obj != Player_obj) || (sip->flags2 & SIF2_SHOW_SHIP_MODEL) || (Viewer_mode) ) {
// show the flash only if in not cockpit view, or if "show ship" flag is set
shipfx_flash_create(obj, sip->model_num, &pnt, &obj->orient.vec.fvec, 0, weapon);
shipfx_flash_create(obj, sip->model_num, &pnt, &obj->orient.vec.fvec, 0, weapon_idx);
}
if((wip->wi_flags & WIF_SHUDDER) && (obj == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
@@ -11360,8 +11396,8 @@ int ship_fire_secondary( object *obj, int allow_swarm )
}
if ( obj == Player_obj ) {
if ( Weapon_info[weapon].launch_snd != -1 ) {
snd_play( &Snds[Weapon_info[weapon].launch_snd], 0.0f, 1.0f, SND_PRIORITY_MUST_PLAY );
if ( Weapon_info[weapon_idx].launch_snd != -1 ) {
snd_play( &Snds[Weapon_info[weapon_idx].launch_snd], 0.0f, 1.0f, SND_PRIORITY_MUST_PLAY );
swp = &Player_ship->weapons;
if (bank >= 0) {
wip = &Weapon_info[swp->secondary_bank_weapons[bank]];
@@ -11374,8 +11410,8 @@ int ship_fire_secondary( object *obj, int allow_swarm )
}
} else {
if ( Weapon_info[weapon].launch_snd != -1 ) {
snd_play_3d( &Snds[Weapon_info[weapon].launch_snd], &obj->pos, &View_position );
if ( Weapon_info[weapon_idx].launch_snd != -1 ) {
snd_play_3d( &Snds[Weapon_info[weapon_idx].launch_snd], &obj->pos, &View_position );
}
}
@@ -11410,7 +11446,7 @@ done_secondary:
}
// maybe announce a shockwave weapon
ai_maybe_announce_shockwave_weapon(obj, weapon);
ai_maybe_announce_shockwave_weapon(obj, weapon_idx);
}
// if we are out of ammo in this bank then don't carry over firing swarm/corkscrew
@@ -15698,7 +15734,7 @@ void ship_page_in()
// Page in all the ship classes that are used on this level
int num_ship_types_used = 0;
int test_id = -1;
int test_id __attribute__((__unused__)) = -1;
memset( fireball_used, 0, sizeof(int) * MAX_FIREBALL_TYPES );
@@ -17630,28 +17666,29 @@ void parse_armor_type()
void armor_parse_table(const char *filename)
{
int rval;
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
//Enumerate through all the armor types and add them.
while (optional_string("#Armor Type")) {
while (required_string_either("#End", "$Name:")) {
parse_armor_type();
continue;
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
//Enumerate through all the armor types and add them.
while ( optional_string("#Armor Type") ) {
while ( required_string_either("#End", "$Name:") ) {
parse_armor_type();
continue;
required_string("#End");
}
required_string("#End");
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
void armor_init()
@@ -17917,29 +17954,29 @@ bool ship_has_sound(object *objp, GameSoundsIndex id)
/**
* Given a ship with bounding box and a point, find the closest point on the bbox
*
* @param ship_obj Object that has the bounding box (should be a ship)
* @param ship_objp Object that has the bounding box (should be a ship)
* @param start World position of the point being compared
* @param box_pt OUTPUT PARAMETER: closest point on the bbox to start
*
* @return point is inside bbox, TRUE/1
* @return point is outside bbox, FALSE/0
*/
int get_nearest_bbox_point(object *ship_obj, vec3d *start, vec3d *box_pt)
int get_nearest_bbox_point(object *ship_objp, vec3d *start, vec3d *box_pt)
{
vec3d temp, rf_start;
polymodel *pm;
pm = model_get(Ship_info[Ships[ship_obj->instance].ship_info_index].model_num);
pm = model_get(Ship_info[Ships[ship_objp->instance].ship_info_index].model_num);
// get start in ship rf
vm_vec_sub(&temp, start, &ship_obj->pos);
vm_vec_rotate(&rf_start, &temp, &ship_obj->orient);
vm_vec_sub(&temp, start, &ship_objp->pos);
vm_vec_rotate(&rf_start, &temp, &ship_objp->orient);
// find box_pt
int inside = project_point_onto_bbox(&pm->mins, &pm->maxs, &rf_start, &temp);
// get box_pt in world rf
vm_vec_unrotate(box_pt, &temp, &ship_obj->orient);
vm_vec_add2(box_pt, &ship_obj->pos);
vm_vec_unrotate(box_pt, &temp, &ship_objp->orient);
vm_vec_add2(box_pt, &ship_objp->pos);
return inside;
}
+3
View File
@@ -1300,6 +1300,9 @@ public:
bool draw_secondary_models[MAX_SHIP_SECONDARY_BANKS];
float weapon_model_draw_distance;
// Recoil modifier for the ship
float ship_recoil_modifier;
float max_hull_strength; // Max hull strength of this class of ship.
float max_shield_strength;
float auto_shield_spread; // Thickness of the shield
+84 -84
View File
@@ -78,7 +78,7 @@ void shipfx_remove_submodel_ship_sparks(ship *shipp, int submodel_num)
*
* DKA: 5/26/99 make velocity of debris scale according to size of debris subobject (at least for large subobjects)
*/
void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, ship_subsys *subsys, vec3d *exp_center, float exp_mag)
void shipfx_subsystem_maybe_create_live_debris(object *ship_objp, ship *ship_p, ship_subsys *subsys, vec3d *exp_center, float exp_mag)
{
// initializations
polymodel *pm = model_get(Ship_info[ship_p->ship_info_index].model_num);
@@ -94,7 +94,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
return;
}
ship_model_start(ship_obj);
ship_model_start(ship_objp);
// copy angles
angles copy_angs = pm->submodel[submodel_num].angs;
@@ -111,10 +111,10 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
// get the rotvel
void model_get_rotating_submodel_axis(vec3d *model_axis, vec3d *world_axis, int modelnum, int submodel_num, object *obj);
model_get_rotating_submodel_axis(&model_axis, &world_axis, pm->id, submodel_num, ship_obj);
model_get_rotating_submodel_axis(&model_axis, &world_axis, pm->id, submodel_num, ship_objp);
vm_vec_copy_scale(&rotvel, &world_axis, sii->cur_turn_rate);
model_find_world_point(&world_axis_pt, &sii->pt_on_axis, pm->id, submodel_num, &ship_obj->orient, &ship_obj->pos);
model_find_world_point(&world_axis_pt, &sii->pt_on_axis, pm->id, submodel_num, &ship_objp->orient, &ship_objp->pos);
vm_quaternion_rotate(&m_rot, vm_vec_mag((vec3d*)&sii->angs), &model_axis);
} else {
@@ -131,27 +131,27 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
// get start world pos
vm_vec_zero(&start_world_pos);
model_find_world_point(&start_world_pos, &pm->submodel[live_debris_submodel].offset, pm->id, live_debris_submodel, &ship_obj->orient, &ship_obj->pos );
model_find_world_point(&start_world_pos, &pm->submodel[live_debris_submodel].offset, pm->id, live_debris_submodel, &ship_objp->orient, &ship_objp->pos );
// convert to model coord of underlying submodel
// set angle to zero
pm->submodel[submodel_num].angs = zero_angs;
world_find_model_point(&start_model_pos, &start_world_pos, pm, submodel_num, &ship_obj->orient, &ship_obj->pos);
world_find_model_point(&start_model_pos, &start_world_pos, pm, submodel_num, &ship_objp->orient, &ship_objp->pos);
// rotate from submodel coord to world coords
// reset angle to current angle
pm->submodel[submodel_num].angs = copy_angs;
model_find_world_point(&end_world_pos, &start_model_pos, pm->id, submodel_num, &ship_obj->orient, &ship_obj->pos);
model_find_world_point(&end_world_pos, &start_model_pos, pm->id, submodel_num, &ship_objp->orient, &ship_objp->pos);
int fireball_type = fireball_ship_explosion_type(&Ship_info[ship_p->ship_info_index]);
if(fireball_type < 0) {
fireball_type = FIREBALL_EXPLOSION_MEDIUM;
}
// create fireball here.
fireball_create(&end_world_pos, fireball_type, FIREBALL_MEDIUM_EXPLOSION, OBJ_INDEX(ship_obj), pm->submodel[live_debris_submodel].rad);
fireball_create(&end_world_pos, fireball_type, FIREBALL_MEDIUM_EXPLOSION, OBJ_INDEX(ship_objp), pm->submodel[live_debris_submodel].rad);
// create debris
live_debris_obj = debris_create(ship_obj, pm->id, live_debris_submodel, &end_world_pos, exp_center, 1, exp_mag);
live_debris_obj = debris_create(ship_objp, pm->id, live_debris_submodel, &end_world_pos, exp_center, 1, exp_mag);
// only do if debris is created
if (live_debris_obj) {
@@ -177,7 +177,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
// Add radial velocity (at least as large as exp velocity)
vec3d temp_vel; // explosion velocity with ship_obj velocity removed
vm_vec_sub(&temp_vel, &live_debris_obj->phys_info.vel, &ship_obj->phys_info.vel);
vm_vec_sub(&temp_vel, &live_debris_obj->phys_info.vel, &ship_objp->phys_info.vel);
// find magnitudes of radial and temp velocity
float vel_mag = vm_vec_mag(&temp_vel);
@@ -202,8 +202,8 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
}
// scale up speed of debris if ship_obj > 125, but not for knossos
if (ship_obj->radius > 250 && !(Ship_info[ship_p->ship_info_index].flags & SIF_KNOSSOS_DEVICE)) {
vm_vec_scale(&live_debris_obj->phys_info.vel, ship_obj->radius/250.0f);
if (ship_objp->radius > 250 && !(Ship_info[ship_p->ship_info_index].flags & SIF_KNOSSOS_DEVICE)) {
vm_vec_scale(&live_debris_obj->phys_info.vel, ship_objp->radius/250.0f);
}
}
@@ -211,7 +211,7 @@ void shipfx_subsystem_maybe_create_live_debris(object *ship_obj, ship *ship_p, s
}
}
ship_model_stop(ship_obj);
ship_model_stop(ship_objp);
}
void set_ship_submodel_as_blown_off(ship *shipp, char *name)
@@ -239,12 +239,12 @@ void set_ship_submodel_as_blown_off(ship *shipp, char *name)
* Create debris for ship submodel which has live debris (at ship death)
* when ship submodel has not already been blown off (and hence liberated live debris)
*/
void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj )
void shipfx_maybe_create_live_debris_at_ship_death( object *ship_objp )
{
// if ship has live debris, detonate that subsystem now
// search for any live debris
ship *shipp = &Ships[ship_obj->instance];
ship *shipp = &Ships[ship_objp->instance];
polymodel *pm = model_get(Ship_info[shipp->ship_info_index].model_num);
// no subsystems -> no live debris.
@@ -263,7 +263,7 @@ void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj )
Assert(parent != -1);
// set model values only once (esp blown off)
ship_model_start(ship_obj);
ship_model_start(ship_objp);
// check if already blown off (ship model set)
if ( !pm->submodel[parent].blown_off ) {
@@ -281,14 +281,14 @@ void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj )
if (pss != NULL) {
if (pss->system_info != NULL) {
vec3d exp_center, tmp = ZERO_VECTOR;
model_find_world_point(&exp_center, &tmp, pm->id, parent, &ship_obj->orient, &ship_obj->pos );
model_find_world_point(&exp_center, &tmp, pm->id, parent, &ship_objp->orient, &ship_objp->pos );
// if not blown off, blow it off
shipfx_subsystem_maybe_create_live_debris(ship_obj, shipp, pss, &exp_center, 3.0f);
shipfx_subsystem_maybe_create_live_debris(ship_objp, shipp, pss, &exp_center, 3.0f);
// now set subsystem as blown off, so we only get one copy
pm->submodel[parent].blown_off = 1;
set_ship_submodel_as_blown_off(&Ships[ship_obj->instance], pss->system_info->subobj_name);
set_ship_submodel_as_blown_off(&Ships[ship_objp->instance], pss->system_info->subobj_name);
}
}
}
@@ -296,36 +296,36 @@ void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj )
}
// clean up
ship_model_stop(ship_obj);
ship_model_stop(ship_objp);
}
void shipfx_blow_off_subsystem(object *ship_obj,ship *ship_p,ship_subsys *subsys, vec3d *exp_center, bool no_explosion)
void shipfx_blow_off_subsystem(object *ship_objp, ship *ship_p,ship_subsys *subsys, vec3d *exp_center, bool no_explosion)
{
vec3d subobj_pos;
int model_num = Ship_info[ship_p->ship_info_index].model_num;
model_subsystem *psub = subsys->system_info;
get_subsystem_world_pos(ship_obj, subsys, &subobj_pos);
get_subsystem_world_pos(ship_objp, subsys, &subobj_pos);
// get rid of sparks on submodel that is destroyed
shipfx_remove_submodel_ship_sparks(ship_p, psub->subobj_num);
// create debris shards
if (!(subsys->flags & SSF_VANISHED) && !no_explosion) {
shipfx_blow_up_model(ship_obj, model_num, psub->subobj_num, 50, &subobj_pos );
shipfx_blow_up_model(ship_objp, model_num, psub->subobj_num, 50, &subobj_pos );
// create live debris objects, if any
// TODO: some MULITPLAYER implcations here!!
shipfx_subsystem_maybe_create_live_debris(ship_obj, ship_p, subsys, exp_center, 1.0f);
shipfx_subsystem_maybe_create_live_debris(ship_objp, ship_p, subsys, exp_center, 1.0f);
int fireball_type = fireball_ship_explosion_type(&Ship_info[ship_p->ship_info_index]);
if(fireball_type < 0) {
fireball_type = FIREBALL_EXPLOSION_MEDIUM;
}
// create first fireball
fireball_create( &subobj_pos, fireball_type, FIREBALL_MEDIUM_EXPLOSION, OBJ_INDEX(ship_obj), psub->radius );
fireball_create( &subobj_pos, fireball_type, FIREBALL_MEDIUM_EXPLOSION, OBJ_INDEX(ship_objp), psub->radius );
}
}
@@ -1687,29 +1687,29 @@ static int get_split_ship()
}
static void maybe_fireball_wipe(clip_ship* half_ship, int* sound_handle);
static void split_ship_init( ship* shipp, split_ship* split_ship )
static void split_ship_init( ship* shipp, split_ship* split_shipp )
{
object* parent_ship_obj = &Objects[shipp->objnum];
matrix* orient = &parent_ship_obj->orient;
for (int ii=0; ii<NUM_SUB_EXPL_HANDLES; ++ii) {
split_ship->sound_handle[ii] = shipp->sub_expl_sound_handle[ii];
split_shipp->sound_handle[ii] = shipp->sub_expl_sound_handle[ii];
}
// play 3d sound for shockwave explosion
snd_play_3d( &Snds[SND_SHOCKWAVE_EXPLODE], &parent_ship_obj->pos, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_SINGLE_INSTANCE, NULL, 3.0f );
// initialize both ships
split_ship->front_ship.parent_obj = parent_ship_obj;
split_ship->back_ship.parent_obj = parent_ship_obj;
split_ship->explosion_flash_timestamp = timestamp((int)(0.00075f*parent_ship_obj->radius));
split_ship->explosion_flash_started = 0;
split_ship->front_ship.orient = *orient;
split_ship->back_ship.orient = *orient;
split_ship->front_ship.next_fireball = timestamp_rand(0, 100);
split_ship->back_ship.next_fireball = timestamp_rand(0, 100);
split_shipp->front_ship.parent_obj = parent_ship_obj;
split_shipp->back_ship.parent_obj = parent_ship_obj;
split_shipp->explosion_flash_timestamp = timestamp((int)(0.00075f*parent_ship_obj->radius));
split_shipp->explosion_flash_started = 0;
split_shipp->front_ship.orient = *orient;
split_shipp->back_ship.orient = *orient;
split_shipp->front_ship.next_fireball = timestamp_rand(0, 100);
split_shipp->back_ship.next_fireball = timestamp_rand(0, 100);
split_ship->front_ship.clip_plane_norm = vmd_z_vector;
vm_vec_copy_scale(&split_ship->back_ship.clip_plane_norm, &vmd_z_vector, -1.0f);
split_shipp->front_ship.clip_plane_norm = vmd_z_vector;
vm_vec_copy_scale(&split_shipp->back_ship.clip_plane_norm, &vmd_z_vector, -1.0f);
// find the point at which the ship splits (relative to its pivot)
polymodel* pm = model_get(Ship_info[shipp->ship_info_index].model_num);
@@ -1721,18 +1721,18 @@ static void split_ship_init( ship* shipp, split_ship* split_ship )
init_clip_plane_dist = 0.5f * (0.5f - frand())*pm->core_radius;
}
split_ship->back_ship.cur_clip_plane_pt = init_clip_plane_dist;
split_ship->front_ship.cur_clip_plane_pt = init_clip_plane_dist;
split_shipp->back_ship.cur_clip_plane_pt = init_clip_plane_dist;
split_shipp->front_ship.cur_clip_plane_pt = init_clip_plane_dist;
float dist;
dist = (split_ship->front_ship.cur_clip_plane_pt+pm->maxs.xyz.z)/2.0f;
vm_vec_copy_scale(&split_ship->front_ship.local_pivot, &orient->vec.fvec, dist);
vm_vec_make(&split_ship->front_ship.model_center_disp_to_orig_center, 0.0f, 0.0f, -dist);
dist = (split_ship->back_ship.cur_clip_plane_pt +pm->mins.xyz.z)/2.0f;
vm_vec_copy_scale(&split_ship->back_ship.local_pivot, &orient->vec.fvec, dist);
vm_vec_make(&split_ship->back_ship.model_center_disp_to_orig_center, 0.0f, 0.0f, -dist);
vm_vec_add2(&split_ship->front_ship.local_pivot, &parent_ship_obj->pos );
vm_vec_add2(&split_ship->back_ship.local_pivot, &parent_ship_obj->pos );
dist = (split_shipp->front_ship.cur_clip_plane_pt+pm->maxs.xyz.z)/2.0f;
vm_vec_copy_scale(&split_shipp->front_ship.local_pivot, &orient->vec.fvec, dist);
vm_vec_make(&split_shipp->front_ship.model_center_disp_to_orig_center, 0.0f, 0.0f, -dist);
dist = (split_shipp->back_ship.cur_clip_plane_pt +pm->mins.xyz.z)/2.0f;
vm_vec_copy_scale(&split_shipp->back_ship.local_pivot, &orient->vec.fvec, dist);
vm_vec_make(&split_shipp->back_ship.model_center_disp_to_orig_center, 0.0f, 0.0f, -dist);
vm_vec_add2(&split_shipp->front_ship.local_pivot, &parent_ship_obj->pos );
vm_vec_add2(&split_shipp->back_ship.local_pivot, &parent_ship_obj->pos );
// find which debris pieces are in the front and back split ships
for (int i=0; i<pm->num_debris_objects; i++ ) {
@@ -1742,30 +1742,30 @@ static void split_ship_init( ship* shipp, split_ship* split_ship )
// tmp is world position, temp_pos is world_pivot, tmp1 is offset from world_pivot (in ship local coord)
model_find_world_point(&tmp, &tmp1, pm->id, -1, &vmd_identity_matrix, &temp_pos );
if (tmp.xyz.z > init_clip_plane_dist) {
split_ship->front_ship.draw_debris[i] = DEBRIS_DRAW;
split_ship->back_ship.draw_debris[i] = DEBRIS_NONE;
split_shipp->front_ship.draw_debris[i] = DEBRIS_DRAW;
split_shipp->back_ship.draw_debris[i] = DEBRIS_NONE;
} else {
split_ship->front_ship.draw_debris[i] = DEBRIS_NONE;
split_ship->back_ship.draw_debris[i] = DEBRIS_DRAW;
split_shipp->front_ship.draw_debris[i] = DEBRIS_NONE;
split_shipp->back_ship.draw_debris[i] = DEBRIS_DRAW;
}
}
// set up physics
physics_init( &split_ship->front_ship.phys_info );
physics_init( &split_ship->back_ship.phys_info );
split_ship->front_ship.phys_info.flags |= (PF_ACCELERATES | PF_DEAD_DAMP);
split_ship->back_ship.phys_info.flags |= (PF_ACCELERATES | PF_DEAD_DAMP);
split_ship->front_ship.phys_info.side_slip_time_const = 10000.0f;
split_ship->back_ship.phys_info.side_slip_time_const = 10000.0f;
split_ship->front_ship.phys_info.rotdamp = 10000.0f;
split_ship->back_ship.phys_info.rotdamp = 10000.0f;
physics_init( &split_shipp->front_ship.phys_info );
physics_init( &split_shipp->back_ship.phys_info );
split_shipp->front_ship.phys_info.flags |= (PF_ACCELERATES | PF_DEAD_DAMP);
split_shipp->back_ship.phys_info.flags |= (PF_ACCELERATES | PF_DEAD_DAMP);
split_shipp->front_ship.phys_info.side_slip_time_const = 10000.0f;
split_shipp->back_ship.phys_info.side_slip_time_const = 10000.0f;
split_shipp->front_ship.phys_info.rotdamp = 10000.0f;
split_shipp->back_ship.phys_info.rotdamp = 10000.0f;
// set up explosion vel and relative velocities (assuming mass depends on length)
float front_length = pm->maxs.xyz.z - split_ship->front_ship.cur_clip_plane_pt;
float back_length = split_ship->back_ship.cur_clip_plane_pt - pm->mins.xyz.z;
float front_length = pm->maxs.xyz.z - split_shipp->front_ship.cur_clip_plane_pt;
float back_length = split_shipp->back_ship.cur_clip_plane_pt - pm->mins.xyz.z;
float ship_length = front_length + back_length;
split_ship->front_ship.length_left = front_length;
split_ship->back_ship.length_left = back_length;
split_shipp->front_ship.length_left = front_length;
split_shipp->back_ship.length_left = back_length;
float expl_length_scale = (ship_length - 200.0f) / 2000.0f;
// s_r_f effects speed of "wipe" and rotvel
@@ -1773,8 +1773,8 @@ static void split_ship_init( ship* shipp, split_ship* split_ship )
float explosion_time = (3.0f + expl_length_scale + (frand()-0.5f)) * speed_reduction_factor;
float long_length = MAX(front_length, back_length);
float expl_vel = long_length / explosion_time;
split_ship->front_ship.explosion_vel = expl_vel;
split_ship->back_ship.explosion_vel = -expl_vel;
split_shipp->front_ship.explosion_vel = expl_vel;
split_shipp->back_ship.explosion_vel = -expl_vel;
float rel_vel = (0.6f + 0.2f*frand()) * expl_vel * speed_reduction_factor;
float front_vel = rel_vel * back_length / ship_length;
@@ -1786,26 +1786,26 @@ static void split_ship_init( ship* shipp, split_ship* split_ship )
rotvel.xyz.z = 0.0f;
vm_vec_normalize(&rotvel);
vm_vec_scale(&rotvel, 0.15f / speed_reduction_factor);
split_ship->front_ship.phys_info.rotvel = rotvel;
vm_vec_copy_scale(&split_ship->back_ship.phys_info.rotvel, &rotvel, -(front_length*front_length)/(back_length*back_length));
split_ship->front_ship.phys_info.rotvel.xyz.z = parent_ship_obj->phys_info.rotvel.xyz.z;
split_ship->back_ship.phys_info.rotvel.xyz.z = parent_ship_obj->phys_info.rotvel.xyz.z;
split_shipp->front_ship.phys_info.rotvel = rotvel;
vm_vec_copy_scale(&split_shipp->back_ship.phys_info.rotvel, &rotvel, -(front_length*front_length)/(back_length*back_length));
split_shipp->front_ship.phys_info.rotvel.xyz.z = parent_ship_obj->phys_info.rotvel.xyz.z;
split_shipp->back_ship.phys_info.rotvel.xyz.z = parent_ship_obj->phys_info.rotvel.xyz.z;
// modify vel of each split ship based on rotvel of parent ship obj
vec3d temp_rotvel = parent_ship_obj->phys_info.rotvel;
temp_rotvel.xyz.z = 0.0f;
vec3d vel_from_rotvel;
vm_vec_crossprod(&vel_from_rotvel, &temp_rotvel, &split_ship->front_ship.local_pivot);
vm_vec_crossprod(&vel_from_rotvel, &temp_rotvel, &split_ship->back_ship.local_pivot);
vm_vec_crossprod(&vel_from_rotvel, &temp_rotvel, &split_shipp->front_ship.local_pivot);
vm_vec_crossprod(&vel_from_rotvel, &temp_rotvel, &split_shipp->back_ship.local_pivot);
// set up velocity and make initial fireballs and particles
split_ship->front_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
split_ship->back_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
maybe_fireball_wipe(&split_ship->front_ship, (int*)&split_ship->sound_handle);
maybe_fireball_wipe(&split_ship->back_ship, (int*)&split_ship->sound_handle);
vm_vec_scale_add2(&split_ship->front_ship.phys_info.vel, &orient->vec.fvec, front_vel);
vm_vec_scale_add2(&split_ship->back_ship.phys_info.vel, &orient->vec.fvec, back_vel);
split_shipp->front_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
split_shipp->back_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
maybe_fireball_wipe(&split_shipp->front_ship, (int*)&split_shipp->sound_handle);
maybe_fireball_wipe(&split_shipp->back_ship, (int*)&split_shipp->sound_handle);
vm_vec_scale_add2(&split_shipp->front_ship.phys_info.vel, &orient->vec.fvec, front_vel);
vm_vec_scale_add2(&split_shipp->back_ship.phys_info.vel, &orient->vec.fvec, back_vel);
// HANDLE LIVE DEBRIS - blow off if not already gone
shipfx_maybe_create_live_debris_at_ship_death( parent_ship_obj );
@@ -1930,7 +1930,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
if(db == NULL || shipp == NULL)
return;
object *ship_obj = &Objects[shipp->objnum];
object *ship_objp = &Objects[shipp->objnum];
physics_info *pi = &Objects[db->objnum].phys_info;
ship_info *sip = &Ship_info[shipp->ship_info_index];
@@ -1945,7 +1945,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->vel, &ship_obj->orient.vec.fvec, debris_speed);
vm_vec_copy_scale(&pi->vel, &ship_objp->orient.vec.fvec, debris_speed);
}
}
else if(sip->debris_min_speed >= 0.0f)
@@ -1959,7 +1959,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->vel, &ship_obj->orient.vec.fvec, sip->debris_min_speed);
vm_vec_copy_scale(&pi->vel, &ship_objp->orient.vec.fvec, sip->debris_min_speed);
}
}
}
@@ -1974,7 +1974,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->vel, &ship_obj->orient.vec.fvec, sip->debris_max_speed);
vm_vec_copy_scale(&pi->vel, &ship_objp->orient.vec.fvec, sip->debris_max_speed);
}
}
}
@@ -1991,7 +1991,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->rotvel, &ship_obj->orient.vec.uvec, debris_rotspeed);
vm_vec_copy_scale(&pi->rotvel, &ship_objp->orient.vec.uvec, debris_rotspeed);
}
}
else if(sip->debris_min_rotspeed >= 0.0f)
@@ -2005,7 +2005,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->rotvel, &ship_obj->orient.vec.uvec, sip->debris_min_rotspeed);
vm_vec_copy_scale(&pi->rotvel, &ship_objp->orient.vec.uvec, sip->debris_min_rotspeed);
}
}
}
@@ -2021,7 +2021,7 @@ void shipfx_debris_limit_speed(debris *db, ship *shipp)
}
else
{
vm_vec_copy_scale(&pi->rotvel, &ship_obj->orient.vec.uvec, sip->debris_max_rotspeed);
vm_vec_copy_scale(&pi->rotvel, &ship_objp->orient.vec.uvec, sip->debris_max_rotspeed);
}
}
}
+64 -64
View File
@@ -1660,12 +1660,12 @@ int ds_get_channel(int sig)
/**
* @todo Documentation
*/
int ds_is_channel_playing(int channel)
int ds_is_channel_playing(int channel_id)
{
if ( Channels[channel].source_id != 0 ) {
if ( Channels[channel_id].source_id != 0 ) {
ALint status;
OpenAL_ErrorPrint( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &status) );
OpenAL_ErrorPrint( alGetSourcei(Channels[channel_id].source_id, AL_SOURCE_STATE, &status) );
return (status == AL_PLAYING);
}
@@ -1676,10 +1676,10 @@ int ds_is_channel_playing(int channel)
/**
* @todo Documentation
*/
void ds_stop_channel(int channel)
void ds_stop_channel(int channel_id)
{
if ( Channels[channel].source_id != 0 ) {
OpenAL_ErrorPrint( alSourceStop(Channels[channel].source_id) );
if ( Channels[channel_id].source_id != 0 ) {
OpenAL_ErrorPrint( alSourceStop(Channels[channel_id].source_id) );
}
}
@@ -1701,13 +1701,13 @@ void ds_stop_channel_all()
* @brief Set the volume for a channel. The volume is expected to be in linear scale
* @details If the sound is a 3D sound buffer, this is like re-establishing the maximum volume.
*/
void ds_set_volume( int channel, float vol )
void ds_set_volume( int channel_id, float vol )
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return;
}
ALuint source_id = Channels[channel].source_id;
ALuint source_id = Channels[channel_id].source_id;
if (source_id != 0) {
CAP(vol, 0.0f, 1.0f);
@@ -1718,39 +1718,39 @@ void ds_set_volume( int channel, float vol )
/**
* Set the pan for a channel. The pan is expected to be in DirectSound units
*/
void ds_set_pan( int channel, float pan )
void ds_set_pan( int channel_id, float pan )
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return;
}
ALint state;
OpenAL_ErrorCheck( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &state), return );
OpenAL_ErrorCheck( alGetSourcei(Channels[channel_id].source_id, AL_SOURCE_STATE, &state), return );
if (state == AL_PLAYING) {
//OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_SOURCE_RELATIVE, AL_TRUE) );
OpenAL_ErrorPrint( alSource3f(Channels[channel].source_id, AL_POSITION, pan, 0.0f, 1.0f) );
//OpenAL_ErrorPrint( alSourcei(Channels[channel_id].source_id, AL_SOURCE_RELATIVE, AL_TRUE) );
OpenAL_ErrorPrint( alSource3f(Channels[channel_id].source_id, AL_POSITION, pan, 0.0f, 1.0f) );
}
}
/**
* Get the pitch of a channel
*/
int ds_get_pitch(int channel)
int ds_get_pitch(int channel_id)
{
ALint status;
ALfloat alpitch = 0;
int pitch;
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return -1;
}
OpenAL_ErrorCheck( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &status), return -1 );
OpenAL_ErrorCheck( alGetSourcei(Channels[channel_id].source_id, AL_SOURCE_STATE, &status), return -1 );
if (status == AL_PLAYING) {
OpenAL_ErrorPrint( alGetSourcef(Channels[channel].source_id, AL_PITCH, &alpitch) );
OpenAL_ErrorPrint( alGetSourcef(Channels[channel_id].source_id, AL_PITCH, &alpitch) );
}
// convert OpenAL values to DirectSound values and return
@@ -1762,11 +1762,11 @@ int ds_get_pitch(int channel)
/**
* Set the pitch of a channel
*/
void ds_set_pitch(int channel, int pitch)
void ds_set_pitch(int channel_id, int pitch)
{
ALint status;
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return;
}
@@ -1778,24 +1778,24 @@ void ds_set_pitch(int channel, int pitch)
pitch = MAX_PITCH;
}
OpenAL_ErrorCheck( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &status), return );
OpenAL_ErrorCheck( alGetSourcei(Channels[channel_id].source_id, AL_SOURCE_STATE, &status), return );
if (status == AL_PLAYING) {
ALfloat alpitch = log10f((float)pitch) - 2.0f;
OpenAL_ErrorPrint( alSourcef(Channels[channel].source_id, AL_PITCH, alpitch) );
OpenAL_ErrorPrint( alSourcef(Channels[channel_id].source_id, AL_PITCH, alpitch) );
}
}
/**
* @todo Documentation
*/
void ds_chg_loop_status(int channel, int loop)
void ds_chg_loop_status(int channel_id, int loop)
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return;
}
ALuint source_id = Channels[channel].source_id;
ALuint source_id = Channels[channel_id].source_id;
OpenAL_ErrorPrint( alSourcei(source_id, AL_LOOPING, loop ? AL_TRUE : AL_FALSE) );
}
@@ -1818,99 +1818,99 @@ void ds_chg_loop_status(int channel, int loop)
*/
int ds3d_play(int sid, int snd_id, vec3d *pos, vec3d *vel, float min, float max, int looping, float max_volume, float estimated_vol, int priority )
{
int channel;
int channel_id;
if (!ds_initialized) {
return -1;
}
channel = ds_get_free_channel(estimated_vol, snd_id, priority);
channel_id = ds_get_free_channel(estimated_vol, snd_id, priority);
if (channel < 0) {
if (channel_id < 0) {
return -1;
}
if ( Channels[channel].source_id == 0 ) {
if ( Channels[channel_id].source_id == 0 ) {
return -1;
}
// set up 3D sound data here
ds3d_update_buffer(channel, min, max, pos, vel);
ds3d_update_buffer(channel_id, min, max, pos, vel);
OpenAL_ErrorPrint( alSourcef(Channels[channel].source_id, AL_PITCH, 1.0f) );
OpenAL_ErrorPrint( alSourcef(Channels[channel_id].source_id, AL_PITCH, 1.0f) );
OpenAL_ErrorPrint( alSourcef(Channels[channel].source_id, AL_GAIN, max_volume) );
OpenAL_ErrorPrint( alSourcef(Channels[channel_id].source_id, AL_GAIN, max_volume) );
ALint status;
OpenAL_ErrorCheck( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &status), return -1 );
OpenAL_ErrorCheck( alGetSourcei(Channels[channel_id].source_id, AL_SOURCE_STATE, &status), return -1 );
if (status == AL_PLAYING) {
OpenAL_ErrorPrint( alSourceStop(Channels[channel].source_id) );
OpenAL_ErrorPrint( alSourceStop(Channels[channel_id].source_id) );
}
OpenAL_ErrorCheck( alSourcei(Channels[channel].source_id, AL_BUFFER, sound_buffers[sid].buf_id), return -1 );
OpenAL_ErrorCheck( alSourcei(Channels[channel_id].source_id, AL_BUFFER, sound_buffers[sid].buf_id), return -1 );
if (Ds_eax_inited) {
OpenAL_ErrorPrint( alSource3i(Channels[channel].source_id, AL_AUXILIARY_SEND_FILTER, AL_EFX_aux_id, 0, AL_FILTER_NULL) );
OpenAL_ErrorPrint( alSource3i(Channels[channel_id].source_id, AL_AUXILIARY_SEND_FILTER, AL_EFX_aux_id, 0, AL_FILTER_NULL) );
}
OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_SOURCE_RELATIVE, AL_FALSE) );
OpenAL_ErrorPrint( alSourcei(Channels[channel_id].source_id, AL_SOURCE_RELATIVE, AL_FALSE) );
OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_LOOPING, (looping) ? AL_TRUE : AL_FALSE) );
OpenAL_ErrorPrint( alSourcei(Channels[channel_id].source_id, AL_LOOPING, (looping) ? AL_TRUE : AL_FALSE) );
OpenAL_ErrorPrint( alSourcePlay(Channels[channel].source_id) );
OpenAL_ErrorPrint( alSourcePlay(Channels[channel_id].source_id) );
sound_buffers[sid].channel_id = channel;
sound_buffers[sid].channel_id = channel_id;
Channels[channel].sid = sid;
Channels[channel].snd_id = snd_id;
Channels[channel].sig = channel_next_sig++;
Channels[channel].last_position = 0;
Channels[channel].is_voice_msg = false;
Channels[channel].vol = max_volume;
Channels[channel].looping = looping;
Channels[channel].priority = priority;
Channels[channel_id].sid = sid;
Channels[channel_id].snd_id = snd_id;
Channels[channel_id].sig = channel_next_sig++;
Channels[channel_id].last_position = 0;
Channels[channel_id].is_voice_msg = false;
Channels[channel_id].vol = max_volume;
Channels[channel_id].looping = looping;
Channels[channel_id].priority = priority;
if (channel_next_sig < 0 ) {
channel_next_sig = 1;
}
return Channels[channel].sig;
return Channels[channel_id].sig;
}
/**
* @todo Documentation
*/
void ds_set_position(int channel, unsigned int offset)
void ds_set_position(int channel_id, unsigned int offset)
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return;
}
OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_BYTE_OFFSET, offset) );
OpenAL_ErrorPrint( alSourcei(Channels[channel_id].source_id, AL_BYTE_OFFSET, offset) );
}
/**
* @todo Documentation
*/
unsigned int ds_get_play_position(int channel)
unsigned int ds_get_play_position(int channel_id)
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return 0;
}
ALint pos = -1;
int sid = Channels[channel].sid;
int sid = Channels[channel_id].sid;
if ( (sid < 0) || ((size_t)sid >= sound_buffers.size()) ) {
return 0;
}
if (AL_play_position) {
OpenAL_ErrorPrint( alGetSourcei(Channels[channel].source_id, AL_BYTE_LOKI, &pos) );
OpenAL_ErrorPrint( alGetSourcei(Channels[channel_id].source_id, AL_BYTE_LOKI, &pos) );
if ( pos < 0 ) {
pos = 0;
@@ -1925,7 +1925,7 @@ unsigned int ds_get_play_position(int channel)
pos = (ALint)(pos * ((float)sound_buffers[sid].nbytes / size));
}
} else {
OpenAL_ErrorPrint( alGetSourcei(Channels[channel].source_id, AL_BYTE_OFFSET, &pos) );
OpenAL_ErrorPrint( alGetSourcei(Channels[channel_id].source_id, AL_BYTE_OFFSET, &pos) );
if (pos < 0) {
pos = 0;
@@ -1938,7 +1938,7 @@ unsigned int ds_get_play_position(int channel)
/**
* @todo Documentation
*/
unsigned int ds_get_write_position(int channel)
unsigned int ds_get_write_position(int channel_id)
{
return 0;
}
@@ -1946,13 +1946,13 @@ unsigned int ds_get_write_position(int channel)
/**
* @todo Documentation
*/
int ds_get_channel_size(int channel)
int ds_get_channel_size(int channel_id)
{
if ( (channel < 0) || (channel >= MAX_CHANNELS) ) {
if ( (channel_id < 0) || (channel_id >= MAX_CHANNELS) ) {
return 0;
}
int sid = Channels[channel].sid;
int sid = Channels[channel_id].sid;
if ( (sid < 0) || ((size_t)sid >= sound_buffers.size()) ) {
return 0;
@@ -2408,10 +2408,10 @@ void ds_do_frame()
/**
* Given a valid channel return the sound id
*/
int ds_get_sound_id(int channel)
int ds_get_sound_id(int channel_id)
{
Assert( channel >= 0 );
Assert( channel_id >= 0 );
return Channels[channel].snd_id;
return Channels[channel_id].snd_id;
}
+3 -3
View File
@@ -32,18 +32,18 @@
// -1 => failure
//
//
int ds3d_update_buffer(int channel, float min, float max, vec3d *pos, vec3d *vel)
int ds3d_update_buffer(int channel_id, float min, float max, vec3d *pos, vec3d *vel)
{
if (Cmdline_no_3d_sound) {
nprintf(("Sound", "Aborting ds3d_update_buffer due to Cmdline_no_3d_sound..."));
return -1;
}
if (channel < 0) {
if (channel_id < 0) {
return 0;
}
ALuint source_id = Channels[channel].source_id;
ALuint source_id = Channels[channel_id].source_id;
ALfloat rolloff = 1.0f;
if (pos) {
+33 -33
View File
@@ -1,6 +1,6 @@
<GRAMMAR>
<DEFINE>
<ID NAME="VID_Counter" VAL="80"/>
<ID NAME="VID_Counter" VAL="80"/>
<ID NAME="VID_DestroyTarget" VAL="10"/>
<ID NAME="VID_DisableTarget" VAL="11"/>
<ID NAME="VID_DisarmTarget" VAL="12"/>
@@ -35,30 +35,30 @@
<RULE ID="VID_WingName" TOPLEVEL="ACTIVE">
<L PROPID="VID_WingName">
<P VAL="0">Alpha</P>
<P VAL="1">Beta</P>
<P VAL="2">Gamma</P>
<P VAL="3">Delta</P>
<P VAL="4">Epsilon</P>
<P VAL="5">Zeta</P>
<P VAL="6">Eta</P>
<P VAL="7">Theta</P>
<P VAL="8">Iota</P>
<P VAL="9">Kappa</P>
<P VAL="10">Lambda</P>
<P VAL="11">Mu</P>
<P VAL="12">Nu</P>
<P VAL="13">Xi</P>
<P VAL="14">Omicron</P>
<P VAL="15">Pi</P>
<P VAL="16">Rho</P>
<P VAL="17">Sigma</P>
<P VAL="18">Tau</P>
<P VAL="19">Upsilon</P>
<P VAL="20">Phi</P>
<P VAL="21">Chi</P>
<P VAL="22">Psi</P>
<P VAL="23">Omega</P>
<P VALSTR="Alpha">Alpha</P>
<P VALSTR="Beta">Beta</P>
<P VALSTR="Gamma">Gamma</P>
<P VALSTR="Delta">Delta</P>
<P VALSTR="Epsilon">Epsilon</P>
<P VALSTR="Zeta">Zeta</P>
<P VALSTR="Eta">Eta</P>
<P VALSTR="Theta">Theta</P>
<P VALSTR="Iota">Iota</P>
<P VALSTR="Kappa">Kappa</P>
<P VALSTR="Lambda">Lambda</P>
<P VALSTR="Mu">Mu</P>
<P VALSTR="Nu">Nu</P>
<P VALSTR="Xi">Xi</P>
<P VALSTR="Omicron">Omicron</P>
<P VALSTR="Pi">Pi</P>
<P VALSTR="Rho">Rho</P>
<P VALSTR="Sigma">Sigma</P>
<P VALSTR="Tau">Tau</P>
<P VALSTR="Upsilon">Upsilon</P>
<P VALSTR="Phi">Phi</P>
<P VALSTR="Chi">Chi</P>
<P VALSTR="Psi">Psi</P>
<P VALSTR="Omega">Omega</P>
</L>
<L PROPID="VID_ShipName">
<P VAl="0">Wing</P>
@@ -87,26 +87,26 @@
<P VAL="VID_IgnoreTarget">Ignore my target</P>
<P VAL="VID_FormWing">Form on my wing</P>
<P VAL="VID_CoverMe">Cover me</P>
<P VAL="VID_EngageEnemy">Engage Enemy</P>
<P VAL="VID_EngageEnemy">Engage the Enemy</P>
<P VAL="VID_EngageEnemy">Attack</P>
<P VAL="VID_Depart">Depart</P>
</L>
</RULE>
<RULE ID="VID_TopMenu" TOPLEVEL="ACTIVE">
<L PROPID="VID_TopMenu">
<L PROPID="VID_TopMenu">
<P VAL="VID_Ships">Ships</P>
<P VAL="VID_Wings">Wings</P>
<P VAL="VID_AllFighters">All Fighters<O><RULEREF REFID="VID_Action"/></O></P>
<P VAL="VID_AllWings">All Wings<O><RULEREF REFID="VID_Action"/></O></P>
<P VAL="VID_Reinforcements">Reinforcements</P>
<P VAL="VID_SupportShip">Support ship</P>
<P VAL="VID_SupportShip">Rearm</P>
<P VAL="VID_SupportShip">Repair</P>
<P VAL="VID_AbortSupport">Abort</P>
<P VAL="VID_SupportShip">Rearm <O>and repair</O></P>
<P VAL="VID_SupportShip">Repair <O>and rearm</O></P>
<P VAL="VID_AbortSupport">Abort <L><P>support <O>ship</O></P><P>rearm <O>and repair</O></P><P>repair <O>and rearm</O></P></L></P>
<P VAL="VID_Cancel">Cancel</P>
<P VAL="VID_Command">Command</P>
<P VAL="VID_More">More</P>
<P VAL="VID_More">More</P>
</L>
</RULE>
@@ -144,9 +144,9 @@
<P VAL="91">Target previous uninspected</P>
<P VAL="92">Target newest</P>
<P VAL="93">Target next turret</P>
<P VAL="94">Target previous turrent</P>
<P VAL="94">Target previous turret</P>
<P VAL="95">Target next bomb</P>
<P VAL="96">Target previous bomb</P>
<P VAL="96">Target previous bomb</P>
</L>
</RULE>
+146 -143
View File
@@ -112,104 +112,118 @@ void doVid_Action(int action)
bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource)
{
HRESULT hr = S_OK;
CComPtr<ISpAudio> cpAudio;
HRESULT hr = S_OK;
CComPtr<ISpAudio> cpAudio;
while (true)
{
// create a recognition engine
hr = p_recogEngine.CoCreateInstance(CLSID_SpSharedRecognizer);
if (FAILED(hr))
{
while (true)
{
// create a recognition engine
hr = p_recogEngine.CoCreateInstance(CLSID_SpInprocRecognizer);
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to create a recognition engine\n","Error",MB_OK);
printf("Failed to create a recognition engine\n");
break;
}
// create the command recognition context
hr = p_recogEngine->CreateRecoContext( &p_recogContext );
if (FAILED(hr))
{
break;
}
// create the command recognition context
hr = p_recogEngine->CreateRecoContext( &p_recogContext );
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to create the command recognition context\n","Error",MB_OK);
printf("Failed to create the command recognition context\n");
break;
}
break;
}
// Let SR know that window we want it to send event information to, and using
// what message
hr = p_recogContext->SetNotifyWindowMessage( hWnd, event_id, 0, 0 );
if (FAILED(hr))
{
// Let SR know that window we want it to send event information to, and using
// what message
hr = p_recogContext->SetNotifyWindowMessage( hWnd, event_id, 0, 0 );
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to SetNotifyWindowMessage\n","Error",MB_OK);
break;
}
break;
}
// Tell SR what types of events interest us. Here we only care about command
// recognition.
hr = p_recogContext->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) );
if (FAILED(hr))
{
// Tell SR what types of events interest us. Here we only care about command
// recognition.
hr = p_recogContext->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) );
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to set events\n","Error",MB_OK);
break;
}
break;
}
// Create a grammar
hr = p_recogContext->CreateGrammar(grammar_id, &p_grammarObject);
if (FAILED(hr))
{
hr = p_recogContext->CreateGrammar(grammar_id, &p_grammarObject);
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to create grammar\n","Error",MB_OK);
break;
}
break;
}
// Load our grammar from data\phrases.xml, or if that doesn't exist, from the compiled in
// user defined ("SRGRAMMAR") resource type.
// Load our grammar from data\phrases.xml, or if that doesn't exist, from the compiled in
// user defined ("SRGRAMMAR") resource type.
hr = p_grammarObject->LoadCmdFromFile(L"data\\phrases.xml", SPLO_STATIC);
if (FAILED(hr))
{
if (FAILED(hr))
{
hr = p_grammarObject->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(command_resource),
L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
SPLO_DYNAMIC);
L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
SPLO_STATIC);
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to load resource\n","Error",MB_OK);
break;
break;
}
}
}
// Set rules to active, we are now listening for commands
hr = p_grammarObject->SetRuleState(NULL, NULL, SPRS_ACTIVE );
if (FAILED(hr))
{
hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &cpAudio);
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to get default audio input\n", "Error", MB_OK);
break;
}
// Set the audio input to our token.
hr = p_recogEngine->SetInput(cpAudio, TRUE);
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to set audio input\n", "Error", MB_OK);
}
// Set rules to active, we are now listening for commands
hr = p_grammarObject->SetRuleState(NULL, NULL, SPRS_ACTIVE );
if (FAILED(hr))
{
MessageBox(hWnd,"Failed to set listening for commands\n","Error",MB_OK);
break;
}
break;
}
break;
}
break;
}
// if we failed and have a partially setup SAPI, close it all down
if (FAILED(hr))
{
VOICEREC_deinit();
}
// if we failed and have a partially setup SAPI, close it all down
if (FAILED(hr))
{
VOICEREC_deinit();
}
return ( hr == S_OK);
return ( hr == S_OK);
}
void VOICEREC_deinit()
{
// Release grammar, if loaded
if ( p_grammarObject )
{
p_grammarObject.Release();
}
// Release recognition context, if created
if ( p_recogContext )
{
p_recogContext->SetNotifySink(NULL);
p_recogContext.Release();
}
// Release recognition engine instance, if created
// Release grammar, if loaded
if ( p_grammarObject )
{
p_grammarObject.Release();
}
// Release recognition context, if created
if ( p_recogContext )
{
p_recogContext->SetNotifySink(NULL);
p_recogContext.Release();
}
// Release recognition engine instance, if created
if ( p_recogEngine )
{
p_recogEngine.Release();
@@ -219,51 +233,22 @@ void VOICEREC_deinit()
void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd);
void VOICEREC_process_event(HWND hWnd)
{
CSpEvent event; // Event helper class
CSpEvent event; // Event helper class
// Loop processing events while there are any in the queue
while (event.GetFrom(p_recogContext) == S_OK)
{
// Look at recognition event only
switch (event.eEventId)
{
case SPEI_RECOGNITION:
VOICEREC_execute_command(event.RecoResult(), hWnd);
break;
// Loop processing events while there are any in the queue
while (event.GetFrom(p_recogContext) == S_OK)
{
// Look at recognition event only
switch (event.eEventId)
{
case SPEI_RECOGNITION:
VOICEREC_execute_command(event.RecoResult(), hWnd);
break;
}
}
}
}
}
// Its not enough to update this, phrases.xml must have this info as well
char *wing_names[] =
{
"Alpha",
"Beta",
"Gamma",
"Delta",
"Epsilon",
"Zeta",
"Eta",
"Theta",
"Iota",
"Kappa",
"Lambda",
"Mu",
"Nu",
"Xi",
"Omicron",
"Pi",
"Rho",
"Sigma",
"Tau",
"Upsilon",
"Phi",
"Chi",
"Psi",
"Omega",
};
/******************************************************************************
* ExecuteCommand *
*----------------*
@@ -276,12 +261,12 @@ char VOICEREC_lastCommand[30];
void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
{
SPPHRASE *pElements;
SPPHRASE *pElements;
// Get the phrase elements, one of which is the rule id we specified in
// the grammar. Switch on it to figure out which command was recognized.
if (SUCCEEDED(pPhrase->GetPhrase(&pElements)))
{
// Get the phrase elements, one of which is the rule id we specified in
// the grammar. Switch on it to figure out which command was recognized.
if (SUCCEEDED(pPhrase->GetPhrase(&pElements)))
{
#ifndef NDEBUG
if(DEBUG_ON)
{
@@ -304,13 +289,15 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
mprintf(( "recognized speech : %s \n", szText ));
mprintf(( "speech Rule.ulId : %d \n", pElements->Rule.ulId ));
//MessageBoxW(NULL,pwszText,NULL,MB_OK);
//MessageBoxW(NULL,pwszText,NULL,MB_OK);
::CoTaskMemFree(pwszText);
}
#endif
#endif
int part1, part2, part3;
part1 = part2 = part3 = -1;
switch ( pElements->Rule.ulId )
{
switch ( pElements->Rule.ulId )
{
case VID_WingName:
{
@@ -327,9 +314,24 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
if (part2 == -1)
break; // no ship number or wing
const wchar_t* valstr = pElements->pProperties->pszValue;
char* wing_name = new char[wcslen(valstr)+1];
size_t j = 0;
for (size_t i = 0; i < wcslen(valstr); i++) {
int c = wctob(valstr[i]);
if (c != EOF) {
wing_name[j++] = static_cast<char>(c);
}
}
wing_name[j] = '\0';
if (part2 == 0)
{
Msg_instance = wing_lookup(wing_names[part1]);
Msg_instance = wing_lookup(wing_name);
delete[] wing_name;
if (Msg_instance < 0)
break;
@@ -338,13 +340,14 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
hud_squadmsg_toggle();
}
hud_squadmsg_do_mode(SM_MODE_WING_COMMAND);
hud_squadmsg_do_mode(SM_MODE_WING_COMMAND);
}
else
else
{
char shipName[NAME_LENGTH];
wing_bash_ship_name(shipName, wing_names[part1], part2);
wing_bash_ship_name(shipName, wing_name, part2);
delete[] wing_name;
Msg_instance = ship_name_lookup(shipName);
// Can't issue commands to yourself or to nobody
@@ -358,20 +361,20 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
hud_squadmsg_toggle();
}
hud_squadmsg_do_mode(SM_MODE_SHIP_COMMAND);
hud_squadmsg_do_mode(SM_MODE_SHIP_COMMAND);
}
if (part3 == -1)
if (part3 == -1)
break;
}
case VID_Action:
{
int action;
if (part3 == -1)
if (part3 == -1)
{
action = pElements->pProperties->vValue.ulVal;
action = pElements->pProperties->vValue.ulVal;
}
else
{
@@ -401,7 +404,7 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
switch(action)
{
case VID_Ships:
case VID_Ships:
hud_squadmsg_do_mode( SM_MODE_SHIP_SELECT );
break;
@@ -409,22 +412,22 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
hud_squadmsg_do_mode( SM_MODE_WING_SELECT );
break;
case VID_AllFighters:
case VID_AllFighters:
case VID_AllWings:
// Msg_instance = MESSAGE_ALL_FIGHTERS;
// Squad_msg_mode == SM_MODE_ALL_FIGHTERS
hud_squadmsg_msg_all_fighters();
if (pElements->pProperties->pNextSibling) {
doVid_Action(pElements->pProperties->pNextSibling->vValue.ulVal);
if (pElements->pProperties->pFirstChild) {
doVid_Action(pElements->pProperties->pFirstChild->vValue.ulVal);
}
// if(Msg_shortcut_command == -1)
// {
// hud_squadmsg_do_mode( SM_MODE_ALL_FIGHTERS );
// hud_squadmsg_do_mode( SM_MODE_ALL_FIGHTERS );
// }
break;
case VID_Reinforcements:
case VID_Reinforcements:
hud_squadmsg_do_mode( SM_MODE_REINFORCEMENTS );
break;
@@ -466,7 +469,7 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
int action = pElements->pProperties->vValue.ulVal;
mprintf(("Targeting/speed %d \n", action));
if (action > -1)
if (action > -1)
{
button_function( action );
}
@@ -500,19 +503,19 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
}
/*
/*
hud_squadmsg_do_mode( SM_MODE_SHIP_COMMAND ); // and move to a new mode
hud_squadmsg_do_mode( SM_MODE_WING_COMMAND ); // and move to a new mode
hud_squadmsg_do_mode( SM_MODE_SHIP_COMMAND );
*/
}
// Free the pElements memory which was allocated for us
::CoTaskMemFree(pElements);
}
}
// Free the pElements memory which was allocated for us
::CoTaskMemFree(pElements);
}
}
+194 -192
View File
@@ -153,203 +153,205 @@ void parse_thrust_glows(species_info *species, bool no_create)
void parse_species_tbl(const char *filename)
{
int i, rval;
int i;
char species_name[NAME_LENGTH];
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : NOX("<default species_defs.tbl>"), rval));
if (filename == NULL)
read_file_text_from_array(defaults_get_file("species_defs.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// start parsing
required_string("#SPECIES DEFS");
// no longer required: counted automatically
if (optional_string("$NumSpecies:"))
{
int temp;
stuff_int(&temp);
}
// begin reading data
while (required_string_either("#END", "$Species_Name:"))
{
bool no_create = false;
species_info *species, new_species;
species = &new_species;
// Start Species - Get its name
required_string("$Species_Name:");
stuff_string(species_name, F_NAME, NAME_LENGTH);
if (optional_string("+nocreate"))
{
no_create = true;
for (i = 0; i < (int)Species_info.size(); i++)
{
if (!stricmp(Species_info[i].species_name, species_name))
{
species = &Species_info[i];
break;
}
}
}
else
{
strcpy_s(species->species_name, species_name);
}
// Goober5000 - IFF
if (optional_string("$Default IFF:"))
{
bool iff_found = false;
char temp_name[NAME_LENGTH];
stuff_string(temp_name, F_NAME, NAME_LENGTH);
// search for it in iffs
for (int iLoop = 0; iLoop < Num_iffs; iLoop++)
{
if (!stricmp(Iff_info[iLoop].iff_name, temp_name))
{
species->default_iff = iLoop;
iff_found = true;
}
}
if (!iff_found)
{
species->default_iff = 0;
Warning(LOCATION, "Species %s default IFF %s not found in iff_defs.tbl! Defaulting to %s.\n", species->species_name, temp_name, Iff_info[species->default_iff].iff_name);
}
}
else if (!no_create)
{
// we have no idea which it could be, so default to 0
species->default_iff = 0;
// let them know
Warning(LOCATION, "$Default IFF not specified for species %s in species_defs.tbl! Defaulting to %s.\n", species->species_name, Iff_info[species->default_iff].iff_name);
}
// Goober5000 - FRED color
if (optional_string("$FRED Color:") || optional_string("$FRED Colour:"))
{
stuff_int_list(species->fred_color.a1d, 3, RAW_INTEGER_TYPE);
}
else if (!no_create)
{
// set defaults to Volition's originals
if (!stricmp(species->species_name, "Terran"))
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 192;
}
else if (!stricmp(species->species_name, "Vasudan"))
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 128;
species->fred_color.rgb.b = 0;
}
else if (!stricmp(species->species_name, "Shivan"))
{
species->fred_color.rgb.r = 192;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 0;
}
else if (!stricmp(species->species_name, "Ancients") || !stricmp(species->species_name, "Ancient"))
{
species->fred_color.rgb.r = 192;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 192;
}
else
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 0;
}
// let them know
Warning(LOCATION, "$FRED Color not specified for species %s in species_defs.tbl! Defaulting to (%d, %d, %d).\n", species->species_name, species->fred_color.rgb.r, species->fred_color.rgb.g, species->fred_color.rgb.b);
}
// stuff
optional_string("$MiscAnims:");
// Get its Debris Texture
if ((!no_create && required_string("+Debris_Texture:")) || optional_string("+Debris_Texture:"))
{
generic_bitmap_init(&species->debris_texture, NULL);
stuff_string(species->debris_texture.filename, F_NAME, MAX_FILENAME_LEN);
}
// Shield Hit Animation
if (optional_string("+Shield_Hit_ani:")) // Shouldn't be required -- LPine
{
generic_anim_init(&species->shield_anim, NULL);
stuff_string(species->shield_anim.filename, F_NAME, MAX_FILENAME_LEN);
}
else if (!no_create)
{
species->shield_anim.filename[0] = '\0';
species->shield_anim.first_frame = -1; // Landmine to trip up anyone who does end up using this
}
// Thruster Anims
parse_thrust_anims(species, no_create);
// Thruster Glow Anims
parse_thrust_glows(species, no_create);
// Goober5000 - AWACS multiplier
if (optional_string("$AwacsMultiplier:"))
{
stuff_float(&species->awacs_multiplier);
}
else if (!no_create)
{
// set defaults to Volition's originals
if (!stricmp(species->species_name, "Vasudan"))
species->awacs_multiplier = 1.25f;
else if (!stricmp(species->species_name, "Shivan"))
species->awacs_multiplier = 1.50f;
else
species->awacs_multiplier = 1.0f;
// let them know
Warning(LOCATION, "$AwacsMultiplier not specified for species %s in species_defs.tbl! Defaulting to %.2d.\n", species->species_name, species->awacs_multiplier);
}
// Goober5000 - countermeasure type
// (we won't be able to resolve it until after we've parsed the weapons table)
if (optional_string("$Countermeasure type:"))
stuff_string(species->cmeasure_name, F_NAME, NAME_LENGTH);
// don't add new entry if this is just a modified one
if (!no_create)
Species_info.push_back(new_species);
}
required_string("#END");
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation(filename);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", (filename) ? filename : NOX("<default species_defs.tbl>"), e.what()));
return;
}
if (filename == NULL)
read_file_text_from_array(defaults_get_file("species_defs.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// start parsing
required_string("#SPECIES DEFS");
// no longer required: counted automatically
if (optional_string("$NumSpecies:"))
{
int temp;
stuff_int(&temp);
}
// begin reading data
while (required_string_either("#END","$Species_Name:"))
{
bool no_create = false;
species_info *species, new_species;
species = &new_species;
// Start Species - Get its name
required_string("$Species_Name:");
stuff_string(species_name, F_NAME, NAME_LENGTH);
if (optional_string("+nocreate"))
{
no_create = true;
for (i = 0; i < (int)Species_info.size(); i++)
{
if (!stricmp(Species_info[i].species_name, species_name))
{
species = &Species_info[i];
break;
}
}
}
else
{
strcpy_s(species->species_name, species_name);
}
// Goober5000 - IFF
if (optional_string("$Default IFF:"))
{
bool iff_found = false;
char temp_name[NAME_LENGTH];
stuff_string(temp_name, F_NAME, NAME_LENGTH);
// search for it in iffs
for (int iLoop = 0; iLoop < Num_iffs; iLoop++)
{
if (!stricmp(Iff_info[iLoop].iff_name, temp_name))
{
species->default_iff = iLoop;
iff_found = true;
}
}
if (!iff_found)
{
species->default_iff = 0;
Warning(LOCATION, "Species %s default IFF %s not found in iff_defs.tbl! Defaulting to %s.\n", species->species_name, temp_name, Iff_info[species->default_iff].iff_name);
}
}
else if (!no_create)
{
// we have no idea which it could be, so default to 0
species->default_iff = 0;
// let them know
Warning(LOCATION, "$Default IFF not specified for species %s in species_defs.tbl! Defaulting to %s.\n", species->species_name, Iff_info[species->default_iff].iff_name);
}
// Goober5000 - FRED color
if (optional_string("$FRED Color:") || optional_string("$FRED Colour:"))
{
stuff_int_list(species->fred_color.a1d, 3, RAW_INTEGER_TYPE);
}
else if (!no_create)
{
// set defaults to Volition's originals
if (!stricmp(species->species_name, "Terran"))
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 192;
}
else if (!stricmp(species->species_name, "Vasudan"))
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 128;
species->fred_color.rgb.b = 0;
}
else if (!stricmp(species->species_name, "Shivan"))
{
species->fred_color.rgb.r = 192;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 0;
}
else if (!stricmp(species->species_name, "Ancients") || !stricmp(species->species_name, "Ancient"))
{
species->fred_color.rgb.r = 192;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 192;
}
else
{
species->fred_color.rgb.r = 0;
species->fred_color.rgb.g = 0;
species->fred_color.rgb.b = 0;
}
// let them know
Warning(LOCATION, "$FRED Color not specified for species %s in species_defs.tbl! Defaulting to (%d, %d, %d).\n", species->species_name, species->fred_color.rgb.r, species->fred_color.rgb.g, species->fred_color.rgb.b);
}
// stuff
optional_string("$MiscAnims:");
// Get its Debris Texture
if ((!no_create && required_string("+Debris_Texture:")) || optional_string("+Debris_Texture:"))
{
generic_bitmap_init(&species->debris_texture, NULL);
stuff_string(species->debris_texture.filename, F_NAME, MAX_FILENAME_LEN);
}
// Shield Hit Animation
if (optional_string("+Shield_Hit_ani:")) // Shouldn't be required -- LPine
{
generic_anim_init(&species->shield_anim, NULL);
stuff_string(species->shield_anim.filename, F_NAME, MAX_FILENAME_LEN);
}
else if (!no_create)
{
species->shield_anim.filename[0] = '\0';
species->shield_anim.first_frame = -1; // Landmine to trip up anyone who does end up using this
}
// Thruster Anims
parse_thrust_anims(species, no_create);
// Thruster Glow Anims
parse_thrust_glows(species, no_create);
// Goober5000 - AWACS multiplier
if (optional_string("$AwacsMultiplier:"))
{
stuff_float(&species->awacs_multiplier);
}
else if (!no_create)
{
// set defaults to Volition's originals
if (!stricmp(species->species_name, "Vasudan"))
species->awacs_multiplier = 1.25f;
else if (!stricmp(species->species_name, "Shivan"))
species->awacs_multiplier = 1.50f;
else
species->awacs_multiplier = 1.0f;
// let them know
Warning(LOCATION, "$AwacsMultiplier not specified for species %s in species_defs.tbl! Defaulting to %.2d.\n", species->species_name, species->awacs_multiplier);
}
// Goober5000 - countermeasure type
// (we won't be able to resolve it until after we've parsed the weapons table)
if (optional_string("$Countermeasure type:"))
stuff_string(species->cmeasure_name, F_NAME, NAME_LENGTH);
// don't add new entry if this is just a modified one
if ( !no_create )
Species_info.push_back( new_species );
}
required_string("#END");
// add tbl/tbm to multiplayer validation list
extern void fs2netd_add_table_validation(const char *tblname);
fs2netd_add_table_validation(filename);
}
int Species_initted = 0;
+181 -172
View File
@@ -404,183 +404,192 @@ void parse_startbl(const char *filename)
{
char name[MAX_FILENAME_LEN], tempf[16];
starfield_bitmap sbm;
int idx, rval;
int idx;
bool in_check = false;
int rc = -1;
int run_count = 0;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
try
{
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// freaky! ;)
while (!check_for_eof()) {
while ((rc = optional_string_either("$Bitmap:", "$BitmapX:")) != -1) {
in_check = true;
starfield_bitmap_entry_init(&sbm);
stuff_string(sbm.filename, F_NAME, MAX_FILENAME_LEN);
sbm.xparent = rc; // 0 == intensity alpha bitmap, 1 == green xparency bitmap
if ((idx = stars_find_bitmap(sbm.filename)) >= 0) {
if (sbm.xparent == Starfield_bitmaps[idx].xparent) {
if (!Parsing_modular_table)
Warning(LOCATION, "Starfield bitmap '%s' listed more than once!! Only using the first entry!", sbm.filename);
}
else {
Warning(LOCATION, "Starfield bitmap '%s' already listed as a %sxparent bitmap!! Only using the xparent version!",
(rc) ? "xparent" : "non-xparent", (rc) ? "xparent" : "non-xparent", sbm.filename);
}
}
else {
Starfield_bitmaps.push_back(sbm);
}
}
CHECK_END();
while (optional_string("$Sun:")) {
in_check = true;
starfield_bitmap_entry_init(&sbm);
stuff_string(sbm.filename, F_NAME, MAX_FILENAME_LEN);
// associated glow
required_string("$Sunglow:");
stuff_string(sbm.glow_filename, F_NAME, MAX_FILENAME_LEN);
// associated lighting values
required_string("$SunRGBI:");
stuff_float(&sbm.r);
stuff_float(&sbm.g);
stuff_float(&sbm.b);
stuff_float(&sbm.i);
if (optional_string("$SunSpecularRGB:")) {
stuff_float(&sbm.spec_r);
stuff_float(&sbm.spec_g);
stuff_float(&sbm.spec_b);
}
else {
sbm.spec_r = sbm.r;
sbm.spec_g = sbm.g;
sbm.spec_b = sbm.b;
}
// lens flare stuff
if (optional_string("$Flare:")) {
sbm.flare = 1;
required_string("+FlareCount:");
stuff_int(&sbm.n_flares);
// if there's a flare, it has to have at least one texture
required_string("$FlareTexture1:");
stuff_string(sbm.flare_bitmaps[0].filename, F_NAME, MAX_FILENAME_LEN);
sbm.n_flare_bitmaps = 1;
for (idx = 1; idx < MAX_FLARE_BMP; idx++) {
// allow 9999 textures (theoretically speaking, that is)
sprintf(tempf, "$FlareTexture%d:", idx + 1);
if (optional_string(tempf)) {
sbm.n_flare_bitmaps++;
stuff_string(sbm.flare_bitmaps[idx].filename, F_NAME, MAX_FILENAME_LEN);
}
// else break; //don't allow flaretexture1 and then 3, etc.
}
required_string("$FlareGlow1:");
required_string("+FlareTexture:");
stuff_int(&sbm.flare_infos[0].tex_num);
required_string("+FlarePos:");
stuff_float(&sbm.flare_infos[0].pos);
required_string("+FlareScale:");
stuff_float(&sbm.flare_infos[0].scale);
sbm.n_flares = 1;
for (idx = 1; idx < MAX_FLARE_COUNT; idx++) {
// allow a lot of glows
sprintf(tempf, "$FlareGlow%d:", idx + 1);
if (optional_string(tempf)) {
sbm.n_flares++;
required_string("+FlareTexture:");
stuff_int(&sbm.flare_infos[idx].tex_num);
required_string("+FlarePos:");
stuff_float(&sbm.flare_infos[idx].pos);
required_string("+FlareScale:");
stuff_float(&sbm.flare_infos[idx].scale);
}
// else break; //don't allow "flare 1" and then "flare 3"
}
}
sbm.glare = !optional_string("$NoGlare:");
sbm.xparent = 1;
if ((idx = stars_find_sun(sbm.filename)) >= 0) {
if (Parsing_modular_table)
Sun_bitmaps[idx] = sbm;
else
Warning(LOCATION, "Sun bitmap '%s' listed more than once!! Only using the first entry!", sbm.filename);
}
else {
Sun_bitmaps.push_back(sbm);
}
}
CHECK_END();
// normal debris pieces
while (optional_string("$Debris:")) {
in_check = true;
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Num_debris_normal < MAX_DEBRIS_VCLIPS) {
strcpy_s(Debris_vclips_normal[Num_debris_normal++].name, name);
}
else {
Warning(LOCATION, "Could not load normal motion debris '%s'; maximum of %d exceeded.", name, MAX_DEBRIS_VCLIPS);
}
}
CHECK_END();
// nebula debris pieces
while (optional_string("$DebrisNeb:")) {
in_check = true;
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Num_debris_nebula < MAX_DEBRIS_VCLIPS) {
strcpy_s(Debris_vclips_nebula[Num_debris_nebula++].name, name);
}
else {
Warning(LOCATION, "Could not load nebula motion debris '%s'; maximum of %d exceeded.", name, MAX_DEBRIS_VCLIPS);
}
}
CHECK_END();
// since it's possible for some idiot to have a tbl screwed up enough
// that this ends up in an endless loop, give an opportunity to advance
// through the file no matter what, because even the retail tbl has an
// extra "#end" line in it.
if (optional_string("#end") || (run_count++ > 5)) {
run_count = 0;
advance_to_eoln(NULL);
}
}
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// freaky! ;)
while ( !check_for_eof() ) {
while ( (rc = optional_string_either("$Bitmap:", "$BitmapX:")) != -1 ) {
in_check = true;
starfield_bitmap_entry_init( &sbm );
stuff_string(sbm.filename, F_NAME, MAX_FILENAME_LEN);
sbm.xparent = rc; // 0 == intensity alpha bitmap, 1 == green xparency bitmap
if ( (idx = stars_find_bitmap(sbm.filename)) >= 0 ) {
if (sbm.xparent == Starfield_bitmaps[idx].xparent) {
if ( !Parsing_modular_table )
Warning(LOCATION, "Starfield bitmap '%s' listed more than once!! Only using the first entry!", sbm.filename);
} else {
Warning(LOCATION, "Starfield bitmap '%s' already listed as a %sxparent bitmap!! Only using the xparent version!",
(rc) ? "xparent" : "non-xparent", (rc) ? "xparent" : "non-xparent", sbm.filename);
}
} else {
Starfield_bitmaps.push_back(sbm);
}
}
CHECK_END();
while ( optional_string("$Sun:") ) {
in_check = true;
starfield_bitmap_entry_init( &sbm );
stuff_string(sbm.filename, F_NAME, MAX_FILENAME_LEN);
// associated glow
required_string("$Sunglow:");
stuff_string(sbm.glow_filename, F_NAME, MAX_FILENAME_LEN);
// associated lighting values
required_string("$SunRGBI:");
stuff_float(&sbm.r);
stuff_float(&sbm.g);
stuff_float(&sbm.b);
stuff_float(&sbm.i);
if ( optional_string("$SunSpecularRGB:") ) {
stuff_float(&sbm.spec_r);
stuff_float(&sbm.spec_g);
stuff_float(&sbm.spec_b);
} else {
sbm.spec_r = sbm.r;
sbm.spec_g = sbm.g;
sbm.spec_b = sbm.b;
}
// lens flare stuff
if ( optional_string("$Flare:") ) {
sbm.flare = 1;
required_string("+FlareCount:");
stuff_int(&sbm.n_flares);
// if there's a flare, it has to have at least one texture
required_string("$FlareTexture1:");
stuff_string(sbm.flare_bitmaps[0].filename, F_NAME, MAX_FILENAME_LEN);
sbm.n_flare_bitmaps = 1;
for (idx = 1; idx < MAX_FLARE_BMP; idx++) {
// allow 9999 textures (theoretically speaking, that is)
sprintf(tempf, "$FlareTexture%d:", idx+1);
if (optional_string(tempf)) {
sbm.n_flare_bitmaps++;
stuff_string(sbm.flare_bitmaps[idx].filename, F_NAME, MAX_FILENAME_LEN);
}
// else break; //don't allow flaretexture1 and then 3, etc.
}
required_string("$FlareGlow1:");
required_string("+FlareTexture:");
stuff_int(&sbm.flare_infos[0].tex_num);
required_string("+FlarePos:");
stuff_float(&sbm.flare_infos[0].pos);
required_string("+FlareScale:");
stuff_float(&sbm.flare_infos[0].scale);
sbm.n_flares = 1;
for (idx = 1; idx < MAX_FLARE_COUNT; idx++) {
// allow a lot of glows
sprintf(tempf, "$FlareGlow%d:", idx+1);
if (optional_string(tempf)) {
sbm.n_flares++;
required_string("+FlareTexture:");
stuff_int(&sbm.flare_infos[idx].tex_num);
required_string("+FlarePos:");
stuff_float(&sbm.flare_infos[idx].pos);
required_string("+FlareScale:");
stuff_float(&sbm.flare_infos[idx].scale);
}
// else break; //don't allow "flare 1" and then "flare 3"
}
}
sbm.glare = !optional_string("$NoGlare:");
sbm.xparent = 1;
if ( (idx = stars_find_sun(sbm.filename)) >= 0 ) {
if (Parsing_modular_table)
Sun_bitmaps[idx] = sbm;
else
Warning(LOCATION, "Sun bitmap '%s' listed more than once!! Only using the first entry!", sbm.filename);
} else {
Sun_bitmaps.push_back(sbm);
}
}
CHECK_END();
// normal debris pieces
while ( optional_string("$Debris:") ) {
in_check = true;
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Num_debris_normal < MAX_DEBRIS_VCLIPS) {
strcpy_s(Debris_vclips_normal[Num_debris_normal++].name, name);
} else {
Warning(LOCATION, "Could not load normal motion debris '%s'; maximum of %d exceeded.", name, MAX_DEBRIS_VCLIPS);
}
}
CHECK_END();
// nebula debris pieces
while ( optional_string("$DebrisNeb:") ) {
in_check = true;
stuff_string(name, F_NAME, MAX_FILENAME_LEN);
if (Num_debris_nebula < MAX_DEBRIS_VCLIPS) {
strcpy_s(Debris_vclips_nebula[Num_debris_nebula++].name, name);
} else {
Warning(LOCATION, "Could not load nebula motion debris '%s'; maximum of %d exceeded.", name, MAX_DEBRIS_VCLIPS);
}
}
CHECK_END();
// since it's possible for some idiot to have a tbl screwed up enough
// that this ends up in an endless loop, give an opportunity to advance
// through the file no matter what, because even the retail tbl has an
// extra "#end" line in it.
if ( optional_string("#end") || (run_count++ > 5) ) {
run_count = 0;
advance_to_eoln(NULL);
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
}
+175 -160
View File
@@ -245,190 +245,205 @@ const medal_stuff &medal_stuff::operator=(const medal_stuff &m)
void parse_medal_tbl()
{
int rval, i;
int i;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "medals.tbl", rval));
return;
}
read_file_text("medals.tbl", CF_TYPE_TABLES);
reset_parse();
required_string("#Medals");
// special background information
if (optional_string("+Background Bitmap:")) {
stuff_string(Medals_background_filename, F_NAME, NAME_LENGTH);
} else {
strcpy_s(Medals_background_filename, Default_medals_background_filename);
}
// special mask information
if (optional_string("+Mask Bitmap:")) {
stuff_string(Medals_mask_filename, F_NAME, NAME_LENGTH);
} else {
strcpy_s(Medals_mask_filename, Default_medals_mask_filename);
}
// special positioning for player callsign
if (optional_string("+Callsign Position 640:")) {
stuff_int(&Medals_callsign_coords[GR_640].x);
stuff_int(&Medals_callsign_coords[GR_640].y);
} else {
Medals_callsign_coords[GR_640].x = Default_medals_callsign_coords[GR_640][0];
Medals_callsign_coords[GR_640].y = Default_medals_callsign_coords[GR_640][1];
}
if (optional_string("+Callsign Position 1024:")) {
stuff_int(&Medals_callsign_coords[GR_1024].x);
stuff_int(&Medals_callsign_coords[GR_1024].y);
} else {
Medals_callsign_coords[GR_1024].x = Default_medals_callsign_coords[GR_1024][0];
Medals_callsign_coords[GR_1024].y = Default_medals_callsign_coords[GR_1024][1];
}
// special positioning for medal label
if (optional_string("+Label Position 640:")) {
stuff_int(&Medals_label_coords[GR_640].x);
stuff_int(&Medals_label_coords[GR_640].y);
stuff_int(&Medals_label_coords[GR_640].w);
} else {
Medals_label_coords[GR_640].x = Default_medals_label_coords[GR_640][0];
Medals_label_coords[GR_640].y = Default_medals_label_coords[GR_640][1];
Medals_label_coords[GR_640].w = Default_medals_label_coords[GR_640][2];
}
if (optional_string("+Label Position 1024:")) {
stuff_int(&Medals_label_coords[GR_1024].x);
stuff_int(&Medals_label_coords[GR_1024].y);
stuff_int(&Medals_label_coords[GR_1024].w);
} else {
Medals_label_coords[GR_1024].x = Default_medals_label_coords[GR_1024][0];
Medals_label_coords[GR_1024].y = Default_medals_label_coords[GR_1024][1];
Medals_label_coords[GR_1024].w = Default_medals_label_coords[GR_1024][2];
}
// parse in all the medal names
Num_medals = 0;
while ( required_string_either("#End", "$Name:") )
try
{
medal_stuff temp_medal;
medal_display_info temp_display;
read_file_text("medals.tbl", CF_TYPE_TABLES);
reset_parse();
required_string("$Name:");
stuff_string( temp_medal.name, F_NAME, NAME_LENGTH );
required_string("#Medals");
// is this rank? if so, save it
if (!stricmp(temp_medal.name, "Rank"))
Rank_medal_index = Num_medals;
required_string("$Bitmap:");
stuff_string( temp_medal.bitmap, F_NAME, MAX_FILENAME_LEN );
if (optional_string("+Position 640:")) {
stuff_int(&temp_display.coords[GR_640].x);
stuff_int(&temp_display.coords[GR_640].y);
} else if (Num_medals < NUM_MEDALS_FS2) {
temp_display.coords[GR_640].x = Default_medal_coords[GR_640][Num_medals][0];
temp_display.coords[GR_640].y = Default_medal_coords[GR_640][Num_medals][1];
} else {
Warning(LOCATION, "No default GR_640 position for medal '%s'!", temp_medal.name);
temp_display.coords[GR_640].x = 0;
temp_display.coords[GR_640].y = 0;
// special background information
if (optional_string("+Background Bitmap:")) {
stuff_string(Medals_background_filename, F_NAME, NAME_LENGTH);
}
if (optional_string("+Position 1024:")) {
stuff_int(&temp_display.coords[GR_1024].x);
stuff_int(&temp_display.coords[GR_1024].y);
} else if (Num_medals < NUM_MEDALS_FS2) {
temp_display.coords[GR_1024].x = Default_medal_coords[GR_1024][Num_medals][0];
temp_display.coords[GR_1024].y = Default_medal_coords[GR_1024][Num_medals][1];
} else {
Warning(LOCATION, "No default GR_1024 position for medal '%s'!", temp_medal.name);
temp_display.coords[GR_1024].x = 0;
temp_display.coords[GR_1024].y = 0;
else {
strcpy_s(Medals_background_filename, Default_medals_background_filename);
}
if (optional_string("+Debriefing Bitmap:")) {
stuff_string( temp_medal.debrief_bitmap, F_NAME, MAX_FILENAME_LEN );
} else if (Num_medals < NUM_MEDALS_FS2) {
strcpy_s(temp_medal.debrief_bitmap, Default_debriefing_bitmaps[Num_medals]);
} else {
Warning(LOCATION, "No default debriefing bitmap for medal '%s'!", temp_medal.name);
strcpy_s(temp_medal.debrief_bitmap, "");
// special mask information
if (optional_string("+Mask Bitmap:")) {
stuff_string(Medals_mask_filename, F_NAME, NAME_LENGTH);
}
else {
strcpy_s(Medals_mask_filename, Default_medals_mask_filename);
}
required_string("$Num mods:");
stuff_int( &temp_medal.num_versions );
// this is dumb
temp_medal.version_starts_at_1 = (Num_medals == Rank_medal_index);
if (optional_string("+Version starts at 1:")) {
stuff_boolean( &temp_medal.version_starts_at_1 );
// special positioning for player callsign
if (optional_string("+Callsign Position 640:")) {
stuff_int(&Medals_callsign_coords[GR_640].x);
stuff_int(&Medals_callsign_coords[GR_640].y);
}
else {
Medals_callsign_coords[GR_640].x = Default_medals_callsign_coords[GR_640][0];
Medals_callsign_coords[GR_640].y = Default_medals_callsign_coords[GR_640][1];
}
if (optional_string("+Callsign Position 1024:")) {
stuff_int(&Medals_callsign_coords[GR_1024].x);
stuff_int(&Medals_callsign_coords[GR_1024].y);
}
else {
Medals_callsign_coords[GR_1024].x = Default_medals_callsign_coords[GR_1024][0];
Medals_callsign_coords[GR_1024].y = Default_medals_callsign_coords[GR_1024][1];
}
if (optional_string("+Available From Start:")) {
stuff_boolean( &temp_medal.available_from_start );
// special positioning for medal label
if (optional_string("+Label Position 640:")) {
stuff_int(&Medals_label_coords[GR_640].x);
stuff_int(&Medals_label_coords[GR_640].y);
stuff_int(&Medals_label_coords[GR_640].w);
}
else {
Medals_label_coords[GR_640].x = Default_medals_label_coords[GR_640][0];
Medals_label_coords[GR_640].y = Default_medals_label_coords[GR_640][1];
Medals_label_coords[GR_640].w = Default_medals_label_coords[GR_640][2];
}
if (optional_string("+Label Position 1024:")) {
stuff_int(&Medals_label_coords[GR_1024].x);
stuff_int(&Medals_label_coords[GR_1024].y);
stuff_int(&Medals_label_coords[GR_1024].w);
}
else {
Medals_label_coords[GR_1024].x = Default_medals_label_coords[GR_1024][0];
Medals_label_coords[GR_1024].y = Default_medals_label_coords[GR_1024][1];
Medals_label_coords[GR_1024].w = Default_medals_label_coords[GR_1024][2];
}
// some medals are based on kill counts. When string +Num Kills: is present, we know that
// this medal is a badge and should be treated specially
if ( optional_string("+Num Kills:") ) {
char buf[MULTITEXT_LENGTH];
int persona;
stuff_int( &temp_medal.kills_needed );
// parse in all the medal names
Num_medals = 0;
while (required_string_either("#End", "$Name:"))
{
medal_stuff temp_medal;
medal_display_info temp_display;
if (optional_string("$Wavefile 1:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
required_string("$Name:");
stuff_string(temp_medal.name, F_NAME, NAME_LENGTH);
if (optional_string("$Wavefile 2:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
// is this rank? if so, save it
if (!stricmp(temp_medal.name, "Rank"))
Rank_medal_index = Num_medals;
if (optional_string("$Wavefile Base:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
required_string("$Bitmap:");
stuff_string(temp_medal.bitmap, F_NAME, MAX_FILENAME_LEN);
while (check_for_string("$Promotion Text:")) {
required_string("$Promotion Text:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
persona = -1;
if (optional_string("+Persona:")) {
stuff_int(&persona);
if (persona < 0) {
Warning(LOCATION, "Debriefing text for %s is assigned to an invalid persona: %i (must be 0 or greater).\n", temp_medal.name, persona);
continue;
if (optional_string("+Position 640:")) {
stuff_int(&temp_display.coords[GR_640].x);
stuff_int(&temp_display.coords[GR_640].y);
}
else if (Num_medals < NUM_MEDALS_FS2) {
temp_display.coords[GR_640].x = Default_medal_coords[GR_640][Num_medals][0];
temp_display.coords[GR_640].y = Default_medal_coords[GR_640][Num_medals][1];
}
else {
Warning(LOCATION, "No default GR_640 position for medal '%s'!", temp_medal.name);
temp_display.coords[GR_640].x = 0;
temp_display.coords[GR_640].y = 0;
}
if (optional_string("+Position 1024:")) {
stuff_int(&temp_display.coords[GR_1024].x);
stuff_int(&temp_display.coords[GR_1024].y);
}
else if (Num_medals < NUM_MEDALS_FS2) {
temp_display.coords[GR_1024].x = Default_medal_coords[GR_1024][Num_medals][0];
temp_display.coords[GR_1024].y = Default_medal_coords[GR_1024][Num_medals][1];
}
else {
Warning(LOCATION, "No default GR_1024 position for medal '%s'!", temp_medal.name);
temp_display.coords[GR_1024].x = 0;
temp_display.coords[GR_1024].y = 0;
}
if (optional_string("+Debriefing Bitmap:")) {
stuff_string(temp_medal.debrief_bitmap, F_NAME, MAX_FILENAME_LEN);
}
else if (Num_medals < NUM_MEDALS_FS2) {
strcpy_s(temp_medal.debrief_bitmap, Default_debriefing_bitmaps[Num_medals]);
}
else {
Warning(LOCATION, "No default debriefing bitmap for medal '%s'!", temp_medal.name);
strcpy_s(temp_medal.debrief_bitmap, "");
}
required_string("$Num mods:");
stuff_int(&temp_medal.num_versions);
// this is dumb
temp_medal.version_starts_at_1 = (Num_medals == Rank_medal_index);
if (optional_string("+Version starts at 1:")) {
stuff_boolean(&temp_medal.version_starts_at_1);
}
if (optional_string("+Available From Start:")) {
stuff_boolean(&temp_medal.available_from_start);
}
// some medals are based on kill counts. When string +Num Kills: is present, we know that
// this medal is a badge and should be treated specially
if (optional_string("+Num Kills:")) {
char buf[MULTITEXT_LENGTH];
int persona;
stuff_int(&temp_medal.kills_needed);
if (optional_string("$Wavefile 1:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
if (optional_string("$Wavefile 2:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
if (optional_string("$Wavefile Base:"))
stuff_string(temp_medal.voice_base, F_NAME, MAX_FILENAME_LEN);
while (check_for_string("$Promotion Text:")) {
required_string("$Promotion Text:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
persona = -1;
if (optional_string("+Persona:")) {
stuff_int(&persona);
if (persona < 0) {
Warning(LOCATION, "Debriefing text for %s is assigned to an invalid persona: %i (must be 0 or greater).\n", temp_medal.name, persona);
continue;
}
}
temp_medal.promotion_text[persona] = vm_strdup(buf);
}
if (temp_medal.promotion_text.find(-1) == temp_medal.promotion_text.end()) {
Warning(LOCATION, "%s medal is missing default debriefing text.\n", temp_medal.name);
temp_medal.promotion_text[-1] = "";
}
temp_medal.promotion_text[persona] = vm_strdup(buf);
}
if (temp_medal.promotion_text.find(-1) == temp_medal.promotion_text.end()) {
Warning(LOCATION, "%s medal is missing default debriefing text.\n", temp_medal.name);
temp_medal.promotion_text[-1] = "";
}
Medals.push_back(temp_medal);
Medal_display_info.push_back(temp_display);
Num_medals++;
}
Medals.push_back(temp_medal);
Medal_display_info.push_back(temp_display);
Num_medals++;
required_string("#End");
// be sure that we know where the rank is
if (Rank_medal_index < 0)
{
Warning(LOCATION, "Could not find the 'Rank' medal!");
Rank_medal_index = 0;
}
// be sure that the badges kill numbers show up in order
//WMC - I don't think this is needed anymore due to my changes to post-mission functions
//but I'm keeping it here to be sure.
int prev_badge_kills = 0;
for (i = 0; i < Num_medals; i++)
{
if (Medals[i].kills_needed < prev_badge_kills && Medals[i].kills_needed != 0)
Error(LOCATION, "Badges must appear sorted by lowest kill # first in medals.tbl\nFind Allender for most information.");
if (Medals[i].kills_needed > 0)
prev_badge_kills = Medals[i].kills_needed;
}
}
required_string("#End");
// be sure that we know where the rank is
if (Rank_medal_index < 0)
catch (const parse::ParseException& e)
{
Warning(LOCATION, "Could not find the 'Rank' medal!");
Rank_medal_index = 0;
}
// be sure that the badges kill numbers show up in order
//WMC - I don't think this is needed anymore due to my changes to post-mission functions
//but I'm keeping it here to be sure.
int prev_badge_kills = 0;
for (i = 0; i < Num_medals; i++ )
{
if ( Medals[i].kills_needed < prev_badge_kills && Medals[i].kills_needed != 0)
Error(LOCATION, "Badges must appear sorted by lowest kill # first in medals.tbl\nFind Allender for most information.");
if (Medals[i].kills_needed > 0)
prev_badge_kills = Medals[i].kills_needed;
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "medals.tbl", e.what()));
return;
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ extern void parse_medal_tbl();
#define MM_POPUP 1 // called from within some other tight loop (don't use gameseq_ functions)
// main medals screen
void medal_main_init(player *pl, int mode = MM_NORMAL);
void medal_main_init(player *pl,int mode = MM_NORMAL);
// return 0 if the screen should close (used for MM_POPUP mode)
int medal_main_do();
+49 -46
View File
@@ -59,61 +59,64 @@ void parse_rank_tbl()
{
atexit(scoreing_close);
char buf[MULTITEXT_LENGTH];
int rval, idx, persona;
int idx, persona;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", "rank.tbl", rval));
return;
}
try
{
read_file_text("rank.tbl", CF_TYPE_TABLES);
reset_parse();
read_file_text("rank.tbl", CF_TYPE_TABLES);
reset_parse();
// parse in all the rank names
idx = 0;
skip_to_string("[RANK NAMES]");
ignore_white_space();
while ( required_string_either("#End", "$Name:") ) {
Assert ( idx < NUM_RANKS );
required_string("$Name:");
stuff_string( Ranks[idx].name, F_NAME, NAME_LENGTH );
required_string("$Points:");
stuff_int( &Ranks[idx].points );
required_string("$Bitmap:");
stuff_string( Ranks[idx].bitmap, F_NAME, MAX_FILENAME_LEN );
required_string("$Promotion Voice Base:");
stuff_string( Ranks[idx].promotion_voice_base, F_NAME, MAX_FILENAME_LEN );
while (check_for_string("$Promotion Text:")) {
required_string("$Promotion Text:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
persona = -1;
if (optional_string("+Persona:")) {
stuff_int(&persona);
if (persona < 0) {
Warning(LOCATION, "Debriefing text for %s rank is assigned to an invalid persona: %i (must be 0 or greater).\n", Ranks[idx].name, persona);
continue;
// parse in all the rank names
idx = 0;
skip_to_string("[RANK NAMES]");
ignore_white_space();
while (required_string_either("#End", "$Name:")) {
Assert(idx < NUM_RANKS);
required_string("$Name:");
stuff_string(Ranks[idx].name, F_NAME, NAME_LENGTH);
required_string("$Points:");
stuff_int(&Ranks[idx].points);
required_string("$Bitmap:");
stuff_string(Ranks[idx].bitmap, F_NAME, MAX_FILENAME_LEN);
required_string("$Promotion Voice Base:");
stuff_string(Ranks[idx].promotion_voice_base, F_NAME, MAX_FILENAME_LEN);
while (check_for_string("$Promotion Text:")) {
required_string("$Promotion Text:");
stuff_string(buf, F_MULTITEXT, sizeof(buf));
drop_white_space(buf);
compact_multitext_string(buf);
persona = -1;
if (optional_string("+Persona:")) {
stuff_int(&persona);
if (persona < 0) {
Warning(LOCATION, "Debriefing text for %s rank is assigned to an invalid persona: %i (must be 0 or greater).\n", Ranks[idx].name, persona);
continue;
}
}
Ranks[idx].promotion_text[persona] = vm_strdup(buf);
}
Ranks[idx].promotion_text[persona] = vm_strdup(buf);
if (Ranks[idx].promotion_text.find(-1) == Ranks[idx].promotion_text.end()) {
Warning(LOCATION, "%s rank is missing default debriefing text.\n", Ranks[idx].name);
Ranks[idx].promotion_text[-1] = "";
}
idx++;
}
if (Ranks[idx].promotion_text.find(-1) == Ranks[idx].promotion_text.end()) {
Warning(LOCATION, "%s rank is missing default debriefing text.\n", Ranks[idx].name);
Ranks[idx].promotion_text[-1] = "";
}
idx++;
}
required_string("#End");
required_string("#End");
// be sure that all rank points are in order
// be sure that all rank points are in order
#ifndef NDEBUG
for ( idx = 0; idx < NUM_RANKS-1; idx++ ) {
if ( Ranks[idx].points >= Ranks[idx+1].points )
Int3();
}
for (idx = 0; idx < NUM_RANKS - 1; idx++) {
if (Ranks[idx].points >= Ranks[idx + 1].points)
Int3();
}
#endif
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "rank.tbl", e.what()));
return;
}
}
// initialize a nice blank scoring element
+60 -58
View File
@@ -87,68 +87,70 @@ SCP_vector<mflash_info> Mflash_info;
void parse_mflash_tbl(const char *filename)
{
int rval;
uint i;
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();
// header
required_string("#Muzzle flash types");
while (optional_string("$Mflash:")) {
mflash_info mflash;
bool override_mflash = false;
required_string("+name:");
stuff_string(mflash.name, F_NAME, MAX_FILENAME_LEN);
if (optional_string("+override"))
override_mflash = true;
// read in all blobs
while (optional_string("+blob_name:")) {
mflash_blob_info mblob;
stuff_string(mblob.name, F_NAME, MAX_FILENAME_LEN);
required_string("+blob_offset:");
stuff_float(&mblob.offset);
required_string("+blob_radius:");
stuff_float(&mblob.radius);
mflash.blobs.push_back(mblob);
}
for (i = 0; i < Mflash_info.size(); i++) {
if (!stricmp(mflash.name, Mflash_info[i].name)) {
if (override_mflash) {
Mflash_info[i] = mflash;
}
break;
}
}
// no matching name exists so add as new
if (i == Mflash_info.size()) {
Mflash_info.push_back(mflash);
}
// a mflash of the same name exists, don't add it again
else {
if (!override_mflash) {
Warning(LOCATION, "Muzzle flash \"%s\" already exists! Using existing entry instead.", mflash.name);
}
}
}
// close
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();
// header
required_string("#Muzzle flash types");
while ( optional_string("$Mflash:") ) {
mflash_info mflash;
bool override_mflash = false;
required_string("+name:");
stuff_string(mflash.name, F_NAME, MAX_FILENAME_LEN);
if (optional_string("+override"))
override_mflash = true;
// read in all blobs
while ( optional_string("+blob_name:") ) {
mflash_blob_info mblob;
stuff_string(mblob.name, F_NAME, MAX_FILENAME_LEN);
required_string("+blob_offset:");
stuff_float(&mblob.offset);
required_string("+blob_radius:");
stuff_float(&mblob.radius);
mflash.blobs.push_back(mblob);
}
for (i = 0; i < Mflash_info.size(); i++) {
if ( !stricmp(mflash.name, Mflash_info[i].name) ) {
if (override_mflash) {
Mflash_info[i] = mflash;
}
break;
}
}
// no matching name exists so add as new
if (i == Mflash_info.size()) {
Mflash_info.push_back(mflash);
}
// a mflash of the same name exists, don't add it again
else {
if (!override_mflash) {
Warning(LOCATION, "Muzzle flash \"%s\" already exists! Using existing entry instead.", mflash.name);
}
}
}
// close
required_string("#end");
}
// initialize muzzle flash stuff for the whole game
+1 -1
View File
@@ -729,7 +729,7 @@ void shockwave_page_in()
} else if (Shockwave_info[i].model_id >= 0) {
// for a model we have to run model_load() on it again to make sure
// that it's ref_count is sane for this mission
int idx = model_load( Shockwave_info[i].filename, 0, NULL );
int idx __attribute__((__unused__)) = model_load( Shockwave_info[i].filename, 0, NULL );
Assert( idx == Shockwave_info[i].model_id );
model_page_in_textures( Shockwave_info[i].model_id );
+4 -1
View File
@@ -122,7 +122,7 @@ extern int Num_weapon_subtypes;
#define WIF3_TURRET_INTERCEPTABLE (1 << 5) // These two flags mark a weapon as being interceptable by the AI
#define WIF3_FIGHTER_INTERCEPTABLE (1 << 6) // (like WIF_BOMB), without forcing it to be tagetable -MageKing17
#define WIF3_AOE_ELECTRONICS (1 << 7) // Apply electronics effect across the weapon's entire area of effect instead of just on the impacted ship -MageKing17
#define WIF3_APPLY_RECOIL (1 << 8) // Apply recoil using weapon and ship info
#define WIF_HOMING (WIF_HOMING_HEAT | WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
#define WIF_LOCKED_HOMING (WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
@@ -437,6 +437,9 @@ typedef struct weapon_info {
float emp_intensity; // intensity of the EMP effect
float emp_time; // time of the EMP effect
// Recoil effect
float recoil_modifier;
// Energy suck effect
float weapon_reduce; // how much energy removed from weapons systems
float afterburner_reduce; // how much energy removed from weapons systems
+133 -113
View File
@@ -320,50 +320,52 @@ int weapon_explosions::GetAnim(int weapon_expl_index, vec3d *pos, float size)
void parse_weapon_expl_tbl(const char *filename)
{
int rval;
uint i;
lod_checker lod_check;
if ((rval = setjmp(parse_abort)) != 0) {
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
return;
}
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
required_string("#Start");
while (required_string_either("#End","$Name:"))
try
{
memset( &lod_check, 0, sizeof(lod_checker) );
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
// base filename
required_string("$Name:");
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
//Do we have an LOD num
if (optional_string("$LOD:"))
required_string("#Start");
while (required_string_either("#End", "$Name:"))
{
stuff_int(&lod_check.num_lods);
}
memset(&lod_check, 0, sizeof(lod_checker));
// only bother with this if we have 1 or more lods and less than max lods,
// otherwise the stardard level loading will take care of the different effects
if ( (lod_check.num_lods > 0) || (lod_check.num_lods < MAX_WEAPON_EXPL_LOD) ) {
// name check, update lod count if it already exists
for (i = 0; i < LOD_checker.size(); i++) {
if ( !stricmp(LOD_checker[i].filename, lod_check.filename) ) {
LOD_checker[i].num_lods = lod_check.num_lods;
// base filename
required_string("$Name:");
stuff_string(lod_check.filename, F_NAME, MAX_FILENAME_LEN);
//Do we have an LOD num
if (optional_string("$LOD:"))
{
stuff_int(&lod_check.num_lods);
}
// only bother with this if we have 1 or more lods and less than max lods,
// otherwise the stardard level loading will take care of the different effects
if ((lod_check.num_lods > 0) || (lod_check.num_lods < MAX_WEAPON_EXPL_LOD)) {
// name check, update lod count if it already exists
for (i = 0; i < LOD_checker.size(); i++) {
if (!stricmp(LOD_checker[i].filename, lod_check.filename)) {
LOD_checker[i].num_lods = lod_check.num_lods;
}
}
// old entry not found, add new entry
if (i == LOD_checker.size()) {
LOD_checker.push_back(lod_check);
}
}
// old entry not found, add new entry
if ( i == LOD_checker.size() ) {
LOD_checker.push_back(lod_check);
}
}
required_string("#End");
}
catch (const parse::ParseException& e)
{
mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
return;
}
required_string("#End");
}
/**
@@ -663,6 +665,8 @@ void parse_wi_flags(weapon_info *weaponp, int wi_flags, int wi_flags2, int wi_fl
weaponp->wi_flags3 |= WIF3_TURRET_INTERCEPTABLE;
else if (!stricmp(NOX("fighter interceptable"), weapon_strings[i]))
weaponp->wi_flags3 |= WIF3_FIGHTER_INTERCEPTABLE;
else if (!stricmp(NOX("apply recoil"), weapon_strings[i]))
weaponp->wi_flags3 |= WIF3_APPLY_RECOIL;
else
Warning(LOCATION, "Bogus string in weapon flags: %s\n", weapon_strings[i]);
}
@@ -958,6 +962,7 @@ void init_weapon_entry(int weap_info_index)
wip->emp_intensity = EMP_DEFAULT_INTENSITY;
wip->emp_time = EMP_DEFAULT_TIME; // Goober5000: <-- Look! I fixed a Volition bug! Gimme $5, Dave!
wip->recoil_modifier = 1.0f;
wip->weapon_reduce = ESUCK_DEFAULT_WEAPON_REDUCE;
wip->afterburner_reduce = ESUCK_DEFAULT_AFTERBURNER_REDUCE;
@@ -1065,7 +1070,6 @@ void init_weapon_entry(int weap_info_index)
wip->burst_delay = 1.0f; // 1 second, just incase its not defined
wip->burst_shots = 0;
wip->burst_flags = 0;
generic_anim_init( &wip->thruster_flame );
@@ -1974,6 +1978,15 @@ int parse_weapon(int subtype, bool replace)
stuff_float(&wip->emp_time);
}
// This is an optional modifier for a weapon that uses the "apply recoil" flag. recoil_force in ship.cpp line 10445 is multiplied by this if defined.
if (optional_string("$Recoil Modifier:")){
if (!(wip->wi_flags3 & WIF3_APPLY_RECOIL)){
Warning(LOCATION, "$Recoil Modifier specified for weapon %s but this weapon does not have the \"apply recoil\" weapon flag set. Automatically setting the flag", wip->name);
wip->wi_flags3 |= WIF3_APPLY_RECOIL;
}
stuff_float(&wip->recoil_modifier);
}
// Energy suck optional stuff (if WIF_ENERGY_SUCK is not set, none of this matters anyway)
if( optional_string("$Leech Weapon:") ){
stuff_float(&wip->weapon_reduce);
@@ -2803,83 +2816,83 @@ static char Default_cmeasure_name[NAME_LENGTH] = "";
void parse_weaponstbl(const char *filename)
{
int rval;
if ((rval = setjmp(parse_abort)) != 0)
try
{
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", filename, rval));
read_file_text(filename, CF_TYPE_TABLES);
reset_parse();
if (optional_string("#Primary Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if (parse_weapon(WP_LASER, Parsing_modular_table) < 0) {
continue;
}
}
required_string("#End");
}
if (optional_string("#Secondary Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if (parse_weapon(WP_MISSILE, Parsing_modular_table) < 0) {
continue;
}
}
required_string("#End");
}
if (optional_string("#Beam Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if (parse_weapon(WP_BEAM, Parsing_modular_table) < 0) {
continue;
}
}
required_string("#End");
}
if (optional_string("#Countermeasures"))
{
while (required_string_either("#End", "$Name:"))
{
int idx = parse_weapon(WP_MISSILE, Parsing_modular_table);
if (idx < 0) {
continue;
}
//Make sure cmeasure flag is set
Weapon_info[idx].wi_flags |= WIF_CMEASURE;
//Set cmeasure index
if (!strlen(Default_cmeasure_name)) {
//We can't be sure that index will be the same after sorting, so save the name
strcpy_s(Default_cmeasure_name, Weapon_info[idx].name);
}
}
required_string("#End");
}
// Read in a list of weapon_info indicies that are an ordering of the player weapon precedence.
// This list is used to select an alternate weapon when a particular weapon is not available
// during weapon selection.
if ((!Parsing_modular_table && required_string("$Player Weapon Precedence:")) || optional_string("$Player Weapon Precedence:"))
{
Num_player_weapon_precedence = stuff_int_list(Player_weapon_precedence, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
}
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
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();
if(optional_string("#Primary Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if ( parse_weapon(WP_LASER, Parsing_modular_table) < 0 ) {
continue;
}
}
required_string("#End");
}
if(optional_string("#Secondary Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if ( parse_weapon(WP_MISSILE, Parsing_modular_table) < 0) {
continue;
}
}
required_string("#End");
}
if(optional_string("#Beam Weapons"))
{
while (required_string_either("#End", "$Name:")) {
// AL 28-3-98: If parse_weapon() fails, try next .tbl weapon
if ( parse_weapon(WP_BEAM, Parsing_modular_table) < 0) {
continue;
}
}
required_string("#End");
}
if(optional_string("#Countermeasures"))
{
while (required_string_either("#End", "$Name:"))
{
int idx = parse_weapon(WP_MISSILE, Parsing_modular_table);
if(idx < 0) {
continue;
}
//Make sure cmeasure flag is set
Weapon_info[idx].wi_flags |= WIF_CMEASURE;
//Set cmeasure index
if(!strlen(Default_cmeasure_name)) {
//We can't be sure that index will be the same after sorting, so save the name
strcpy_s(Default_cmeasure_name, Weapon_info[idx].name);
}
}
required_string("#End");
}
// Read in a list of weapon_info indicies that are an ordering of the player weapon precedence.
// This list is used to select an alternate weapon when a particular weapon is not available
// during weapon selection.
if ( (!Parsing_modular_table && required_string("$Player Weapon Precedence:")) || optional_string("$Player Weapon Precedence:") )
{
Num_player_weapon_precedence = stuff_int_list(Player_weapon_precedence, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
}
// add tbl/tbm to multiplayer validation list
fs2netd_add_table_validation(filename);
}
//uses a simple bucket sort to sort weapons, order of importance is:
@@ -4832,7 +4845,14 @@ void weapon_process_post(object * obj, float frame_time)
//create the warphole
vm_vec_add2(&warpout,&obj->pos);
wp->lssm_warp_idx=fireball_create(&warpout, FIREBALL_WARP, FIREBALL_WARP_EFFECT, -1,obj->radius*1.5f,1,&vmd_zero_vector,wp->lssm_warp_time,0,&obj->orient);
wp->lssm_stage=2;
if (wp->lssm_warp_idx < 0) {
mprintf(("LSSM: Failed to create warp effect! Please report if this happens frequently.\n"));
// Abort warping
wp->lssm_stage = 0;
} else {
wp->lssm_stage = 2;
}
}
//its just entered subspace subspace. don't collide or render
@@ -6065,9 +6085,9 @@ void weapon_hit( object * weapon_obj, object * other_obj, vec3d * hitpos, int qu
int weapon_type = Weapons[num].weapon_info_index;
int expl_ani_handle;
weapon_info *wip;
weapon *wp;
weapon *wp;
bool hit_target = false;
object *other_objp;
ship_obj *so;
ship *shipp;
@@ -6167,7 +6187,7 @@ void weapon_hit( object * weapon_obj, object * other_obj, vec3d * hitpos, int qu
}
}
}
// For all objects that had this weapon as a target, wipe it out, forcing find of a new enemy
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
other_objp = &Objects[so->objnum];
+2 -2
View File
@@ -64,8 +64,8 @@
// don't verbose stub funtions unless we're debugging
#define STUB_FUNCTION nprintf(( "Warning", "STUB: %s in "__FILE__" at line %d, thread %d\n", __FUNCTION__, __LINE__, getpid() ))
#define DEBUGME(d1) nprintf(( "Warning", "DEBUGME: %s in "__FILE__" at line %d, msg \"%s\", thread %d\n", __FUNCTION__, __LINE__, d1, getpid() ))
#define STUB_FUNCTION nprintf(( "Warning", "STUB: %s in " __FILE__ " at line %d, thread %d\n", __FUNCTION__, __LINE__, getpid() ))
#define DEBUGME(d1) nprintf(( "Warning", "DEBUGME: %s in " __FILE__ " at line %d, msg \"%s\", thread %d\n", __FUNCTION__, __LINE__, d1, getpid() ))
#define _cdecl
+2 -2
View File
@@ -15,7 +15,7 @@
#include <wx/image.h>
#include <wx/string.h>
//#include <wx/xrc/xmlres.h>
#include <wx/wx.h>
#include <wx/wx.h>
IMPLEMENT_APP(wxFRED2)
@@ -32,4 +32,4 @@ bool wxFRED2::OnInit()
frame->Show(TRUE);
return true;
}
}
+2 -2
View File
@@ -4,7 +4,7 @@
* Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
*/
#include <wx/wx.h>
@@ -20,4 +20,4 @@ class wxFRED2 : public wxApp
DECLARE_APP(wxFRED2)
#endif
#endif
+4 -2
View File
@@ -39,6 +39,8 @@ AC_SUBST(LDFLAGS)
PKG_PROG_PKG_CONFIG()
dnl lets see if we support c++11
AX_CXX_COMPILE_STDCXX_11([noext], [optional])
dnl The configuration options
dnl -------------------------
@@ -151,7 +153,7 @@ case "$target" in
CPPFLAGS="$CPPFLAGS -I/opt/csw/include"
;;
*freebsd* | *openbsd*)
# FreeBSD 9.1
# FreeBSD 10.1
echo "Using Unix defines (for $host_os $host_cpu)"
echo "************************************************************"
echo "************************ NOTE ******************************"
@@ -163,7 +165,7 @@ case "$target" in
fs2_os_bsd="yes"
if test "$host_cpu" = "amd64"
then
D_CFLAGS="$D_CFLAGS -m64 -march=athlon64 -ansi"
D_CFLAGS="$D_CFLAGS -m64 -march=athlon64"
fi
D_CFLAGS="$D_CFLAGS -DLUA_USE_LINUX"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
+133
View File
@@ -0,0 +1,133 @@
# ============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# ============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXXFLAGS to enable support.
#
# The first argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The second argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline C++11 support is required and that the macro
# should error out if no mode with that support is found. If specified
# 'optional', then configuration proceeds regardless, after defining
# HAVE_CXX11 if and only if a supporting mode is found.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <[email protected]>
# Copyright (c) 2012 Zack Weinberg <[email protected]>
# Copyright (c) 2013 Roy Stogner <[email protected]>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 3
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
typedef check<check<bool>> right_angle_brackets;
int a;
decltype(a) b;
typedef check<int> check_type;
check_type c;
check_type&& cr = static_cast<check_type&&>(c);
auto d = a;
])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
m4_if([$1], [], [],
[$1], [ext], [],
[$1], [noext], [],
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
AC_LANG_PUSH([C++])dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
ax_cv_cxx_compile_cxx11,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[ax_cv_cxx_compile_cxx11=yes],
[ax_cv_cxx_compile_cxx11=no])])
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
ac_success=yes
fi
m4_if([$1], [noext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=gnu++11 -std=gnu++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
m4_if([$1], [ext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=c++11 -std=c++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx11_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
fi
else
if test x$ac_success = xno; then
HAVE_CXX11=0
AC_MSG_NOTICE([No compiler with C++11 support was found])
else
HAVE_CXX11=1
AC_DEFINE(HAVE_CXX11,1,
[define if the compiler supports basic C++11 syntax])
fi
AC_SUBST(HAVE_CXX11)
fi
])
+1 -1
View File
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Freespace2", "Freespace2.vcxproj", "{A8030FA3-CEAB-4297-99E3-CD2CFB89830B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libjpeg.vcxproj", "{42A241F2-7996-4AAF-8491-FB885E2DC37D}"