Compare commits

..
Author SHA1 Message Date
bobboau 3b92333b16 fixed the bug with fighter beams not giveing you kills 2003-02-26 02:56:55 +00:00
bobboau 7238ae9025 fixing my bug fix for the warp model, and not being able to find it 2003-02-25 16:46:01 +00:00
bobboau f6634e882c doh... forgot something in the beam rendering code 2003-02-25 07:15:07 +00:00
bobboau f99a3916de fixed a bunch of fighter beam bugs,
most notabley the sound now works corectly,
and they have limeted range with atenuated damage (table option)
added bank specific compatabilities
2003-02-25 06:22:50 +00:00
inquisitor cc9f972e80 added dxguid, ddraw, and strmiids.lib 2003-02-24 02:01:49 +00:00
inquisitor 609da60af3 added dxguid, ddraw, and strmiids.lib 2003-02-24 01:25:11 +00:00
wmcoolmon 7b794ea056 Refixed the splash screen loading code so that it still works with the demo VPs (Loading "2_PreLoad" and "PreLoad") and put logo support back in. Logo support does nothing unless "PreLoadLogo" and/or"2_PreLoadLogo" exist within the search path. 2003-02-23 20:55:57 +00:00
wmcoolmon 3f66617c68 Uncommented the sections of code that actually played a movie for a given mission. (Removed when daveb cleaned out the movie code for the release) 2003-02-23 03:13:03 +00:00
wmcoolmon f8f60965a9 Added cutscenes/movie.cpp(.h) and directx/dx8show.cpp(.h), which contain movie playing code. Don't compile these if you don't have the DX8 SDK. 2003-02-22 04:24:59 +00:00
wmcoolmon 6f0832c6d8 DirectX-specific code for movie-playing functions in cutscenes/movie.cpp. Ask RT if you have any questions about it; I just commited it :). 2003-02-22 04:20:47 +00:00
wmcoolmon 33c321d328 Movie playing code; use movie_play and movie_play_two to play movies using Directshow. Depends on directx/dx8show.cpp 2003-02-22 04:17:58 +00:00
wmcoolmon 16fdb53870 Added "os_app_activate_set" 2003-02-22 04:14:21 +00:00
wmcoolmon b5ab80797d Added "-dshowvid" command-line option, which must be set in order for movies to play. 2003-02-22 04:13:17 +00:00
phreak 1385a9c6ac stupid typo -- my bad 2003-02-16 19:00:56 +00:00
phreak a11c390fd5 fixed typecasting warnings 2003-02-16 18:55:59 +00:00
phreak a498b79b2d fixed around splash screen
2_splash.pcx is loaded in 1024x768
splash.pcx is loaded in 640x480 or 2_splash.pcx isn't found
2003-02-16 18:53:59 +00:00
phreak 6a22f2443e tweaked some more stuff 2003-02-16 18:43:13 +00:00
bobboau cd2597f3a2 added glow map nebula bug fix for d3d, someone should add a fix for glide too
more importantly I (think I) have fixed all major bugs with fighter beams, and added a bit of new functionality
2003-02-16 05:14:29 +00:00
Goober5000 d32a38c267 fixed version bumpage... the version is 3.5.0, not 3.50.0 ;)
--Goober5000
2003-02-05 07:04:31 +00:00
Goober5000 64bcc9942e made my fighterbay code more forgiving of eccentric modeling hacks...
ships can now use the Faustus hangar again :)
--Goober5000
2003-02-05 06:57:56 +00:00
phreak cf750429cb started to finalize before 3.50 release.
added support for GL_EXT_texture_filter_ansiotropic
2003-02-01 02:57:42 +00:00
phreak 32843f18f8 bumped to 3.50 2003-01-30 23:24:34 +00:00
phreak d7bd110ffe cleaned up debug output 2003-01-30 23:19:33 +00:00
phreak 36176b8eb4 enabled RGB lighting for OpenGL 2003-01-30 23:19:14 +00:00
Goober5000 8c94fbd199 finished up my fighterbay code - ships will not be able to arrive from or depart into
fighterbays that have been destroyed (but you have to explicitly say in the tables
that the fighterbay takes damage in order to enable this)
--Goober5000
2003-01-27 07:46:33 +00:00
DTP d9e1e01afc Part of bumping MAX_SHIPS to 250 max_ship_types. Server now no more Crashes on kill, when max_shiptypes is above 200. Note Client still cant join. narrowing it down. 2003-01-27 01:12:15 +00:00
DTP 8edec19426 Part of bumping MAX_SHIPS to 250 max_ship_types. Server now no more Crashes on kill, when max_shiptypes is above 200. Note Client still cant join. narrowing it down. 2003-01-27 00:51:46 +00:00
DTP 5419f3b5de temporary fix, added some // so that we can do debug builds. i expect Goober5000 will fix it soon. 2003-01-26 23:30:53 +00:00
wmcoolmon 6df0403964 Minor mod to preload screen code, added separate 1024x768 logo
-C
2003-01-26 20:04:32 +00:00
Goober5000 2bef522bfc changed change-music to change-soundtrack
--Goober5000
2003-01-26 18:37:19 +00:00
wmcoolmon 4e86a928b3 Added title screen support to retail version. When FS2 loads, it will build a list of PCX files in the current directory, then attempt to display one. If no PCX files exist, it will try to display one of the title screens defined in the code. Freespace 2 will then attempt to superimpose a logo in the upper-left hand corner of the screen. If neither can be displayed, FS2 will function normally. 2003-01-26 02:58:33 +00:00
Goober5000 254b4f6603 oops - fixed the nebula bug that wasn't completely fixed :)
--Goober5000
2003-01-26 00:20:01 +00:00
Goober5000 7373203236 added preloader to change-ship-model and change-ship-class so that the game
doesn't hesitate when switching models in the middle of missions
--Goober5000
2003-01-25 04:54:36 +00:00
Goober5000 55a4c34bab added change-music sexp and bumped MAX_SOUNDTRACKS from 10 to 25
--Ian Warfield
2003-01-25 04:17:39 +00:00
Goober5000 b060ac5928 aw, nuts - fixed a dumb bug with my new don't-collide-invisible code :p
--Goober5000
2003-01-24 03:48:11 +00:00
Goober5000 ab27958761 fixed a small nebula ship trail bug
--Goober5000
2003-01-24 03:15:11 +00:00
Goober5000 dca1600f46 fixed a few bugs in Bobboau's implementation of the glow sexps; also added
help for the sexps in sexp_tree
--Goober5000
2003-01-21 17:24:16 +00:00
bobboau 218ac8a0d7 added several sExps for turning glow points and glow maps on and off 2003-01-20 05:40:50 +00:00
Goober5000 cac96f1a44 cleaned up build output a bit
--Goober5000
2003-01-19 22:45:35 +00:00
Goober5000 55948f0db1 removed unreferenced variable
--Goober5000
2003-01-19 22:25:10 +00:00
Goober5000 c80033de55 fixed a bunch of bugs -- the support ship sexp, the "no-subspace-drive" flag,
and departure into hangars should now all work properly
--Goober5000
2003-01-19 22:20:23 +00:00
Goober5000 dd378506ee fixed fiddly code
--Goober5000
2003-01-19 09:14:05 +00:00
Goober5000 9e890d8df5 more tweaky bug fixes
--Goober5000
2003-01-19 09:10:40 +00:00
Goober5000 f4030700dc fixed two dumb bugs in the set-support-ship code
--Goober5000
2003-01-19 08:37:52 +00:00
Goober5000 b7f924ea6b actually added the set-support-ship sexp; much of the other commit was
groundwork (data types and stuff)
--Goober5000
2003-01-19 07:45:38 +00:00
Goober5000 c5c4fd08e9 oops - forgot a bit of departure code :)
--Goober5000
2003-01-19 07:13:05 +00:00
Goober5000 bf7871905e fixed a bunch of bugs - "no-subspace-drive" should now work properly for
all ships, and all ships who have their departure anchor set to a capital ship
should exit to that ship when told to depart
--Goober5000
2003-01-19 07:02:16 +00:00
Goober5000 28ef47c26f got rid of nameplate stuff (superceded by texture replacement)
--Goober5000
2003-01-19 06:44:39 +00:00
bobboau 7a6e12df06 redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it 2003-01-19 01:07:43 +00:00
Goober5000 97130623dc made "no-subspace-drive" applicable to all ships and fixed a really *STUPID*
bug that made FRED keep crashing (missing comma, bleagh!)
--Goober5000
2003-01-18 23:25:39 +00:00
phreak a1ad295557 added 'ddsutils' folder to project 2003-01-18 20:00:49 +00:00
phreak ecc552eda8 fixed around the bmpman system to now accept compressed textures 2003-01-18 19:55:16 +00:00
phreak 56d7afd8a0 texture mapper now supports DXTC compressed textures 2003-01-18 19:49:45 +00:00
phreak 46e465b1d2 added tcache flag TCACHE_FLAG_COMPRESSED 2003-01-18 19:49:02 +00:00
phreak 4c52cb0441 added some defines that deal with mages using DXTC 2003-01-18 19:48:19 +00:00
phreak 4da09ccefc these files deal with reading .dds files which use DXTC texture compression 2003-01-18 19:45:20 +00:00
Goober5000 389921bd48 added "no-subspace-drive" flag for ships
--Goober5000
2003-01-18 10:00:43 +00:00
Goober5000 e9f6827211 fixed bug I inadvertently introduced by modifying SIF_ flags with sexps rather
than SF_ flags
--Goober5000
2003-01-18 09:25:42 +00:00
Goober5000 042d935a80 fixed some really strange behavior with strings not being truncated at the
# symbol
--Goober5000
2003-01-17 07:59:09 +00:00
Goober5000 1f7fee5baa Allowed selection of either $Texture Replace, which keeps track of individual
replacement textures for a ship, or $Duplicate Model Texture Replace, which
duplicates a model and reskins it.  Use $Duplicate Model Texture Replace
if you want to substitute an animated texture or a transparent texture.
--Goober5000
2003-01-17 04:57:17 +00:00
Goober5000 ff33077291 added capability to the $Texture replace code to substitute the textures
without needing and extra model, however, this way you can't substitute
transparent or animated textures
--Goober5000
2003-01-17 01:48:50 +00:00
Goober5000 70c909302c yay! got texture replacement to work!!!
--Goober5000
2003-01-16 06:49:11 +00:00
Goober5000 900f57bc94 NOW the model duplicates work! :p
still gotta do the textures, but it shouldn't be hard now
--Goober5000
2003-01-15 23:23:30 +00:00
anonymous 41fabe25bd fixed the demo compilation. Define FS2_DEMO globally to compile as a demo. Make sure warp.pof is in your data/models directory. 2003-01-15 21:29:05 +00:00
inquisitor 1e634da6dd Test commit, ignore 2003-01-15 20:49:50 +00:00
Goober5000 a4386862f5 did the XSTR for the turret thing
--Goober5000
2003-01-15 20:49:10 +00:00
Goober5000 7435ddd89b oops, that'll introduce a bug - naming it just plain "Turret" instead
--Goober5000
2003-01-15 16:52:27 +00:00
Goober5000 f1e5508023 capship ballistic weapon displays "Cannon" on HUD instead of "Laser Turret"
--Goober5000
2003-01-15 16:48:59 +00:00
Goober5000 0fd8e46ea2 assigning duplicate models to ships now works; committing so I have a base
to fall back to as I work on texture replacement
--Goober5000
2003-01-15 08:57:23 +00:00
Goober5000 cb4764e8d0 changed most references to modelnum to use ship instead of ship_info --
this will help with the change-model sexp and any other instances of model
changing
--Goober5000
2003-01-15 07:09:09 +00:00
Goober5000 0c55ff682b added texture replacement parse - will be implemented later
--Goober5000
2003-01-15 05:24:23 +00:00
Goober5000 8659222b82 bumped main halls down to 10
--Goober5000
2003-01-15 05:19:07 +00:00
Goober5000 64b2332534 moved texture loading around a bit; added Texture_replace in preparation
for some cool stuff
--Goober5000
2003-01-15 05:18:13 +00:00
Goober5000 303278228a argh - fixed the stupid message persona bug with <any wingman>
Bobboau, please check your code!
--Goober5000
2003-01-14 06:13:23 +00:00
Goober5000 16baec8877 commented out some mprintfs that were clogging up the debug spew
--Goober5000
2003-01-14 05:53:58 +00:00
Goober5000 0b7cc9aa9d fixed minor potential bug
--Goober5000
2003-01-14 04:01:33 +00:00
Goober5000 77bc1ed93b allowed for up to 256 main halls
--Goober5000
2003-01-14 04:00:16 +00:00
Goober5000 d2969046d4 bug hunting; fixed the beam whack effect bug
--Goober5000
2003-01-13 23:20:01 +00:00
wmcoolmon b3c67343e5 Added MISSION_FLAG_NO_NEB_TRAILS and removed MISSION_FLAG_ST_OVERRIDE_NEB. Also changed code to set flags as necessary 2003-01-13 02:09:12 +00:00
wmcoolmon f26624902f Very slightly optimized code 2003-01-12 03:26:41 +00:00
wmcoolmon f96196c271 It turns out the version in the CVS did not toggle the ship trails with the flag...fixed this. 2003-01-12 00:19:55 +00:00
wmcoolmon f47b3c0fd0 Added code for "Ship Trails override Nebula" 2003-01-11 01:00:25 +00:00
Goober5000 170ac43ebe I found these two beautiful functions in ship.cpp - ship_change_model
and change_ship_type - so I made them into sexps :)
--Goober5000
2003-01-10 04:14:19 +00:00
inquisitor 93e0b43b03 Rollback to 2.7 to fix glow code issue that phreak noticed.
-Quiz
2003-01-09 22:23:38 +00:00
phreak b9c9069c5a fixed a small error in bob's glowmap code 2003-01-09 21:22:36 +00:00
phreak fdc9b42d14 fixed a small error in bob's code 2003-01-09 21:20:21 +00:00
phreak 6cb690996d glowmaps in OpenGL, yay! 2003-01-09 21:19:54 +00:00
phreak eb63396934 glowmaps unloaded if their parent is 2003-01-09 21:19:25 +00:00
Goober5000 f1aa394d29 fixed the giant thruster glow bug
--Goober5000
2003-01-09 05:55:55 +00:00
Goober5000 415969fca0 snagged a potential bug
--Goober5000
2003-01-09 05:52:25 +00:00
Goober5000 dfbd9ad9d0 fixed debriefing music in non-campaign missions
--Goober5000
2003-01-08 19:49:15 +00:00
Goober5000 a50424930b added ai-chase-any-except sexp
--Goober5000
2003-01-07 20:06:44 +00:00
phreak 9843ff7b49 fixed problem in win32_create_window() that disabled OpenGL from running in windowed mode 2003-01-07 00:02:08 +00:00
Goober5000 7ea79b3ed4 implemented keep-safe-distance
--Goober5000
2003-01-06 22:57:23 +00:00
Goober5000 b783b7e364 allowed fighters and bombers to accept the stay-near-ship and
keep-safe-distance orders
--Goober5000
2003-01-06 21:52:58 +00:00
Goober5000 60d0011159 nasssty bugs, we hates them, yesss we do, preciousssss
:)
--Goober5000
2003-01-06 20:29:28 +00:00
Goober5000 e730044cc1 cleaned up some stuff with model_set_thrust and a commented Assert that
shouldn't have been
--Goober5000
2003-01-06 19:33:22 +00:00
Goober5000 60ea566ecc a wee failsafe added
--Goober5000
2003-01-06 18:50:37 +00:00
Goober5000 fd797419dd hmm... moved +Squad Logo to immediately beneath $Name
--Goober5000
2003-01-06 17:19:14 +00:00
Goober5000 3a5a785f51 added wing configurable squad logos - put +Squad Logo: filename.pcx as
the last entry in each wing that you want (but the player's squad logo will
still be the squad logo for the player's wing)
--Goober5000
2003-01-06 17:14:52 +00:00
bobboau 65564198ef disabled decals (for now), removed the warp ray thingys,
made some better error mesages while parseing weapons and ships tbls,
and... oh ya, added glow mapping
2003-01-05 23:41:51 +00:00
Goober5000 def0b0ceb0 added capability of is-iff and change-iff to have wings as well as ships
as their arguments; also allowed a bunch of sexps to accept the player
as an argument where they would previously display a parse error
--Goober5000
2003-01-05 01:26:35 +00:00
Goober5000 01776721ab fixed the order sexp
--Goober5000
2003-01-04 23:15:39 +00:00
Goober5000 6f7d012184 Fixed some minor bugs, and added a primitive-sensors flag, where if a ship
has primitive sensors it can't target anything and objects don't appear
on radar if they're outside a certain range.  This range can be modified
via the sexp primitive-sensors-set-range.
--Goober5000
2003-01-03 21:58:08 +00:00
Goober5000 7d4d468e58 this is the way we squash the bugs, squash the bugs, squash the bugs
this is the way we squash the bugs, so early in the morning :p
--Goober5000
2003-01-02 03:09:01 +00:00
Goober5000 d1a870b372 added don't-collide-invisible and collide-invisible sexps
--Goober5000
2003-01-02 00:35:21 +00:00
Goober5000 680e55e493 added ship-vaporize and ship-no-vaporize sexps
--Goober5000
2003-01-01 23:33:34 +00:00
Goober5000 c779bae39a bumped to 3.4
--Goober5000
2002-12-31 20:09:14 +00:00
Goober5000 5a4fafec31 tweaked stuff
--Goober5000
2002-12-31 19:35:14 +00:00
Goober5000 cfcc94c2bb if it ain't broke, don't fix it
--Goober5000
2002-12-31 19:18:41 +00:00
Goober5000 8d1c8fad7c if it ain't broke, don't fix it
--Goober5000
2002-12-31 18:59:43 +00:00
Goober5000 c6cc437092 simplified end-user implementation of ballistic primaries
--Goober5000
2002-12-31 08:20:31 +00:00
Goober5000 6a30e96439 added damaged-escort-priority-all sexp
--Goober5000
2002-12-31 07:26:40 +00:00
Goober5000 95d7869aa6 fixed escort list behavior for stealthy ships
--Goober5000
2002-12-31 05:17:13 +00:00
Goober5000 95a26b87ce made force feedback stronger when firing ballistic primaries
--Goober5000
2002-12-30 06:16:09 +00:00
phreak 6c0bfdd0b7 added damage-escort-list as a new sexp 2002-12-27 20:16:18 +00:00
Goober5000 0e19a3a614 the insidious beam bug is now squashed AND committed!
--Goober5000
2002-12-27 17:58:11 +00:00
Goober5000 35350315b7 removed the existing stealth sexps and replaced them with the following...
ship-stealthy
ship-unstealthy
is-ship-stealthy
friendly-stealth-invisible
friendly-stealth-visible
is-friendly-stealth-visible
--Goober5000
2002-12-27 02:57:51 +00:00
Goober5000 8f97380d75 meh - changed is-cargo-x to is-cargo
--Goober5000
2002-12-25 01:22:23 +00:00
Goober5000 fe6bac98c7 added change-ai-class and is-ai-class, and I think I may also have nailed the
is-iff bug; did some other bug hunting as well
--Goober5000
2002-12-24 07:42:29 +00:00
Goober5000 77c5502b19 added a wee cautionary note
--Goober5000
2002-12-24 07:38:59 +00:00
Goober5000 065eb6f1d5 added set-cargo and is-cargo-x sexps
--Goober5000
2002-12-23 23:01:27 +00:00
phreak 103e4b2b22 defined USE_OPENGL for debug and release builds 2002-12-23 21:13:41 +00:00
phreak cb4e5b551f dumb typo 2002-12-23 19:25:39 +00:00
phreak c22d9a7e99 added code that displays an error if user's OGL version is less than 1.2 2002-12-23 17:52:51 +00:00
Goober5000 2b52cf3896 Bah - Andsager is a moron. :) I see no reason why rand shouldn't work
multiple times.  It's been fixed thus.
--Goober5000
2002-12-23 05:41:08 +00:00
Goober5000 5b16bd3748 Squashed some Volition bugs! :O Some of the sexps for dealing with more than
one ship would return after only dealing with the first ship.

Also added the following sexps:
is-ship-stealthed
ship-force-stealth
ship-force-nostealth
ship-remove-stealth-forcing

They toggle the stealth flag on and off.  If a ship is forced stealthy, it won't even
show up for friendly ships.
--Goober5000
2002-12-23 05:18:52 +00:00
Goober5000 40bbe0cd39 removed stipulation that "Instructor" be present for training-msg sexp to work
--Goober5000

(This is fun! :))
2002-12-23 01:47:17 +00:00
Goober5000 661dc39d9c hack: turn on ship trails if in nebula - restores backward compatibility
--Goober5000
2002-12-22 22:59:04 +00:00
Goober5000 07c240e9a1 tweaked positioning of the new HUD graphics
--Goober5000
2002-12-22 21:31:01 +00:00
Goober5000 93f20cb8e4 added primaries-depleted and primary-ammo-pct sexps -- useful for ships with
ballistic primaries
--Goober5000
2002-12-22 21:12:22 +00:00
Goober5000 e512f60386 Subcategories implemented. :) So far all that's been done is the Change menu, but other
subcategorizations are possible.  Here are the instructions from sexp.h...
"Adding more subcategories is possible with the new code.  All that needs to be done is
to add a #define here (a number from 0x0000 to 0x00ff ORred with the category that it
goes under), some appropriate case statements in get_subcategory() (in sexp.cpp) that
will return the subcategory for each sexp that uses it, and the submenu name in the
op_submenu[] array in sexp_tree.cpp."

Please note that I rearranged a whole bunch of sexps in the Operators[] array in sexp.cpp
in order to make the subcategories work better, so if you get a whole bunch of differences
or even conflicts, just ignore them. :)
--Goober5000
2002-12-22 17:22:47 +00:00
Goober5000 59442ea786 commented out the warning if you don't have the new ballistic HUD graphics - it would probably get annoying (just use the old ones without comment)
--Goober5000
2002-12-21 18:03:49 +00:00
Goober5000 ee8a7f67a7 rearranged the sexp list and got the preliminary subcategories working - still need to work on the actual submenu
--Goober5000
2002-12-21 17:58:11 +00:00
DTP c2c24787da did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe 2002-12-21 13:39:25 +00:00
Goober5000 60f69cb79b Updated the cargo-known-delay and cap-subsys-cargo-known-delay sexps to work correctly if set-scanned and set-unscanned are used repeatedly with the same ship or ship subsystem. In most cases, this functionality will never be needed, but it's nice to know that it's here. :) However, I should point out that cap-subsys-cargo-known-delay will recognize only the first instance of a subsystem being revealed once the ship is no longer in the mission. Here is the relevant bit I put into the sexp handling routine...
"Since there is no way to keep track of subsystem status once a ship has departed or has been destroyed, check the mission log.  This will work in 99.9999999% of all cases; however, if the mission designer repeatedly sets and resets the scanned status of the subsystem, the mission log will only return the first occurrence of the subsystem cargo being revealed (regardless of whether it was first hidden using set-unscanned).  Normally, ships keep track of cargo data in the subsystem struct, but once/ the ship has left the mission, the subsystem linked list is purged, causing the loss of this information.  I judged the significant rework of the subsystem code not worth the rare instance that this sexp may be required to work in this way, especially since this problem only occurs after the ship departs.  If the mission designer really needs this functionality, he or she can achieve the same result with creative combinations of event chaining and is-event-true."

Please note that this problem only occurs with cap-subsys-cargo-known-delay, only if the subsystem scanned status is revealed more than once, and then only after the ship is no longer in the mission.  Sufficiently rare, I figured, that I could afford to not worry about it.
--Goober5000
2002-12-20 07:17:23 +00:00
Goober5000 3bc70fc2c2 added capability of storing time_subsys_cargo_revealed
--Goober5000
2002-12-20 07:09:03 +00:00
DTP f09a3c0a09 DTP FIX, fast fix to the beam/shield bug problem. will maybe commit later when i find out why this is getting triggered when it should not 2002-12-20 00:50:41 +00:00
Goober5000 f15a879898 oops - squashed a bug :)
--Goober5000
2002-12-19 10:54:37 +00:00
Goober5000 984f3f0aa7 implemented the revised HUD weapon display for ballistic primaries
--Goober5000
2002-12-19 10:46:14 +00:00
phreak 1559d18757 tidied up game_init() a bit.. took out a bunch of unneeded ifdefs like E3_BUILD
Added option to access OpenGL from the registry keys.  searches for "OpenGL-"
whoever is in charge of the launcher might want to know this.
2002-12-18 22:21:23 +00:00
Goober5000 c2c0ca0eeb added set-scanned and set-unscanned sexps
PLEASE NOTE: These sexps will cause cargo-known-delay and cap-subsys-cargo-known-delay to not work correctly if set-scanned and set-unscanned are used more than once.  I'll fix this later.

--Goober5000
2002-12-17 03:25:30 +00:00
DTP 754c35f2f5 fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED. 2002-12-17 03:08:18 +00:00
DTP 2bbd5a806b wrong name :) 2002-12-17 02:22:34 +00:00
Goober5000 5891192fda cosmetic fixed; also OP_SET_SCANNED and OP_SET_UNSCANNED added in preparation for the set-scanned and set-unscanned sexp commit
--Goober5000
2002-12-17 02:21:42 +00:00
DTP 5effb36530 cleaned up after Goober5000 :). it will make a mess in debug builds. added a couple of ifndef _debugs. 2002-12-17 02:21:06 +00:00
Goober5000 bc72cea911 added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
--Goober5000
2002-12-17 02:18:40 +00:00
DTP ec8886cf09 Bumped MAX JUMP-nodes to 50. if anybody wants a Jump-node forest 2002-12-17 01:56:36 +00:00
phreak bce0cc4ca0 optimized fullscreen/minimized functions.. alot faster 2002-12-16 23:28:52 +00:00
DTP 66eaf28ac8 fixed a minor glitch, replaced <> with ", so that it takes project glXXX.h, and not compilers glXXX.h 2002-12-15 18:59:57 +00:00
phreak d728b3d745 opengl headers 2002-12-15 16:57:15 +00:00
DTP 11426ed5a2 FIX; player can now have all ships set in FRED2 as allowed playerships in singleplayer 2002-12-15 06:50:49 +00:00
DTP 386abb7000 Bumped fire_dealy on_empty_secondary to 1000 2002-12-15 06:29:24 +00:00
Goober5000 476fb7bbfc removed mission flag for fighterbay damage; instead made damage display contingent on whether the fighterbay subsystem is assigned a damage percentage in ships.tbl
--Goober5000
2002-12-14 17:09:28 +00:00
phreak c825720ae0 added a command line that displays frames per second when enabled.
use "-fps"
2002-12-14 17:09:08 +00:00
phreak 6e407fff7b copied from grgpenglw32x.cpp. 2002-12-14 16:14:52 +00:00
Goober5000 11b24d23aa added mission flag to show subsystem damage for fighterbays
~Goober5000~
2002-12-14 01:55:04 +00:00
Goober5000 2135e20299 small tweaks and bug fixes for the ballistic primary conversion
~Goober5000~
2002-12-13 08:13:30 +00:00
Goober5000 123277167b added distance-ship-subsystem sexp
~Goober5000~
2002-12-12 08:01:57 +00:00
Goober5000 4a9f85674f Full-fledged ballistic primary support added! Try it and see! :) 2002-12-10 05:43:35 +00:00
Goober5000 719579177e Full-fledged ballistic primary support added! Try it and see! :)
Fixed lead indicator behavior; Phreak's version didn't work properly.
2002-12-10 05:42:42 +00:00
Goober5000 3f6a1f33d4 Full-fledged ballistic primary support added! Try it and see! :)
Preliminary support added for selecting additional primaries (more than 2) and secondaries (more than 3) if this is implemented later.
Transports can now dock with fighters, bombers, & stealth ships.
2002-12-10 05:41:38 +00:00
DTP 688dee73c2 DTP; added decals.h and decals.cpp to the project, aswell as the directory 2002-12-10 00:44:38 +00:00
Goober5000 5fa10d82f4 fixed misspelling 2002-12-09 08:37:31 +00:00
Goober5000 4cde77929f fixed misspelling 2002-12-09 08:26:24 +00:00
bobboau 41f66ee2f3 inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
it needs a better renderer, but is in prety good shape for now,
I also (think) I squashed a bug in the warpmodel code
2002-12-07 01:37:43 +00:00
phreak 2ee9db9479 extension framework implemented(no extensions work YET) -phreak 2002-12-05 00:49:25 +00:00
DTP f87883712e lowered MAX_POLYGON_MODELS FROM 198 to 128 for safety reasons since we bumped back MAX_SHIP_TYPES to 130 2002-12-04 09:44:34 +00:00
Goober5000 ea22ebfe09 implemented beam-free-all-by-default mission flag 2002-12-03 23:05:13 +00:00
Goober5000 0edd905be5 added myself to the credits list :)
~Goober5000
2002-12-03 22:14:06 +00:00
Goober5000 47e2ff7500 fixed player-entry-delay bug 2002-12-03 00:00:52 +00:00
Goober5000 c011621363 fixed misspelling 2002-12-02 23:56:12 +00:00
Goober5000 8c47d95901 fixed misspelling 2002-12-02 23:26:08 +00:00
Goober5000 e08be40462 fixed misspelling of "category" as "catagory" 2002-12-02 23:24:35 +00:00
Goober5000 d7022ad67b commented out an unneeded variable (int ret) in psnet_socket_options 2002-12-02 23:18:53 +00:00
Goober5000 38f435eba8 commented out an unneeded variable (ship *shipp) in model_really_render 2002-12-02 23:16:45 +00:00
Goober5000 6f429c16ee fixed mispelling of "category" as "catagory" 2002-12-02 23:14:17 +00:00
Goober5000 dfaebd0908 fixed mispelling of "category" as "catagory" 2002-12-02 20:49:14 +00:00
Goober5000 d6abb06544 fixed mispelling of "category" as "catagory" 2002-12-02 20:37:26 +00:00
sesquipedalian d950369202 end-mission sexp added 2002-11-28 00:00:37 +00:00
sesquipedalian 745fc385e9 Added Phreak's fix for the weapons room bug. Can now view a modified weapons.tbl in the tech room without crashing 2002-11-27 01:20:51 +00:00
phreak f02a1caced added OGL_inited global. Sets to 0 even if OGL isn't defined by preproccessor
-phreak
2002-11-22 20:56:15 +00:00
phreak e547962d31 changed around some page-in functions to work with opengl
changed bm_set_components_opengl
-phreak
2002-11-22 20:55:27 +00:00
phreak 31fe8e2a4c finished off all remaining problems with 32 bit mode, fullscreen mode
and colors.  Still needs some tweaking, but works near perfect
2002-11-22 20:54:16 +00:00
phreak 1b1dc86fb6 added some opengl defines for shield detail -phreak 2002-11-22 20:52:29 +00:00
DTP 7539390fc3 DTP; fix at line 6785 in parse/SEXP.cpp, a forgotten "{", when the is tagged thing was Fixed 2002-11-20 21:22:31 +00:00
sesquipedalian ad7b508184 Adding in EdrickV's fix to the is-tagged sexp. 2002-11-19 02:15:50 +00:00
phreak 0fa37a5b62 made ogl be used if "NDEBUG" is not defined and "USE_OPENGL" is defined - phreak 2002-11-18 21:34:16 +00:00
phreak 1cbfc73384 added some lines that makes ogl work in windowed mode for fullneb - phreak 2002-11-18 21:32:48 +00:00
phreak c58ae29dd5 added some ogl functionality - phreak 2002-11-18 21:32:11 +00:00
phreak 96e442b564 complete overhaul, works in 16 bit mode -phreak 2002-11-18 21:31:36 +00:00
phreak e817f867af added bm_select_components functions for OpenGL -phreak 2002-11-18 21:27:13 +00:00
bobboau 8c8c96bb89 added nameplate code 2002-11-14 06:15:03 +00:00
bobboau f0e7af10bb added warp model and type 1 glow points
and well as made the new glow file type,
some general improvement to fighter beams,
2002-11-14 04:18:17 +00:00
phreak 4e44bcfdef updated parse_weapon to parse custom corkscrew missiles 2002-11-11 20:18:30 +00:00
phreak d4cea3a9ff changed around the 'weapon_info' struct to allow for custom corkscrew missiles 2002-11-11 20:11:02 +00:00
phreak f06b7dfd20 changed cscrew_create and cscrew_process_post
to allow for custom corkscrew properties
2002-11-11 20:09:12 +00:00
phreak 6dd4f692e2 changed a line in ship_fire_secondary to allow for custom
amounts of corkscrew missiles fired
2002-11-11 20:05:52 +00:00
inquisitor d860dc0011 Bumped to 3.3 2002-11-10 20:40:02 +00:00
DTP d5d8e66dee DTP bumped back MAX_SHIP_TYPES to 130 2002-11-10 19:57:36 +00:00
DTP ad4843b8ea -DTP reworked mod support, 2002-11-10 16:32:42 +00:00
DTP 3162ede091 -DTP reworked mod support, 2002-11-10 16:30:53 +00:00
phreak f9e3871b3e Parser error handling for fighter flak, it didn't want flak on player weapons, now it doesn't care 2002-11-06 23:22:05 +00:00
phreak 53abc32182 Fighter flak code, it doesn't blow up in your face anymore! 2002-11-06 23:21:06 +00:00
DTP 39267bcb05 Made sure, that VP and Plain files dont get added twice to the search order. Side-effect of Mod support. 2002-11-04 08:32:38 +00:00
DTP 7398df34ec DOh,uhmm, define error again, this is getting to me. 2002-11-02 23:06:59 +00:00
DTP 62c8792c2a DOh, fixed that define, learn to count DTP :) 2002-11-02 23:04:46 +00:00
inquisitor e561a547a7 Cleaned up the presentation a little, added HLP and VW, and, no offense to Kazan, removed Kazan. 2002-11-02 22:25:26 +00:00
DTP 5128907c07 DOH forgot \n 2002-11-02 22:11:35 +00:00
DTP 5ddef96ccc shameless self promotion 2002-11-02 22:10:48 +00:00
DTP e75251141a DTP Bumped Max_exited_ships from 200 to double that of MAX_SHIPS = 800 . make sense ehh. for logging effect. 2002-10-31 21:56:44 +00:00
DTP 4f419025fe DTP Quickly added something needed to cmdline.h, since otherwise we can not compile the code as it misses some externals. Thought a rollback rolled all back. 2002-10-31 21:14:16 +00:00
penguin c6cf69e4a3 Hopelessly out of date, and only applied to Linux anyhow 2002-10-31 03:49:35 +00:00
penguin 10e444df95 updated 2002-10-31 03:46:27 +00:00
inquisitor eeab39d62d Bad Committ, Rolling back 2002-10-30 20:22:30 +00:00
DTP 28e46d411b doh!, used upper case in include, dont know how much it matters for *nix systems, but here it is 2002-10-30 06:31:05 +00:00
DTP 1195eb3ada DTP Implemented basic VP files handling. mission and campaign files inside VP files found in mod dir still not supported, cheking / creating directories not implented either 2002-10-30 06:26:11 +00:00
sesquipedalian 5f779fae4c no message 2002-10-29 22:41:48 +00:00
DTP cdb274654e Crap, somebody may restore cmdline.h to 2 version before this. 2002-10-28 02:28:52 +00:00
DTP b486c02ac8 DTP; started basic implementation of mod-support
plain files only for now. fs2_open.exe -mod X will look for files in fs2/ X /all-legal-subdirectories. no checking/creating dirs yet. directories must be there.
2002-10-27 23:59:28 +00:00
randomtiger 9bcb08776c Made Phreaks alternative scanning style optional under the command line tag "-phreak"
Fixed bug that changes HUD colour when targetting debris in a full nebula. - RT
2002-10-22 23:02:40 +00:00
randomtiger d36c788e00 Fixed lighting bug that caused special pause to crash on debug build.
Also added TAB functionality for special pause that toggles HUD. - RT
2002-10-22 17:42:09 +00:00
bobboau 00bbac6ae1 inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry 2002-10-19 19:29:29 +00:00
randomtiger 40db1ce831 Added special pause mode for easier action screenshots.
Added new command line parameter for accessing all single missions in tech room. - RT
2002-10-19 03:50:29 +00:00
randomtiger bbf18d5667 Added ability to remove HUD ingame on keypress shift O
So I've added a new key to the bind list and made use of already existing hud removal code.
2002-10-17 20:40:51 +00:00
phreak 377f78db0f screenshots, yay! 2002-10-14 19:49:08 +00:00
phreak ad96da3537 further optimizations 2002-10-13 21:43:24 +00:00
phreak db8cf9134f fixed text 2002-10-12 17:48:11 +00:00
phreak 0d65873a0b dont use this one 2002-10-11 21:35:51 +00:00
phreak c38ff6302d first run at opengl for w32, only useful in main hall, barracks and campaign room 2002-10-11 21:31:17 +00:00
randomtiger abc9a3ddb1 Added us fs2_open people to the credits. Worth looking at just for that.
Added timer bar code, by default its not compiled in.
Use TIMEBAR_ACTIVE in project and dependancy code settings to activate.
Added the new timebar files with the new code.
2002-10-05 16:46:10 +00:00
phreak 650c4dea46 did glare stuff in game_sunspot_process() 2002-09-20 20:09:01 +00:00
phreak a2d1cf8f37 glare parser stuff in stars_init() 2002-09-20 20:05:29 +00:00
phreak 23c449af6c added glare variable for ambient suns
if glare is 0 then the sun glare whiteout is not shown when looking at the sun
2002-09-20 20:04:54 +00:00
phreak 2d548f46bf lead indicator for dumbfire missiles 2002-09-20 20:02:00 +00:00
phreak c3c4ce064c extra effects during cargo scan 2002-09-20 20:01:30 +00:00
randomtiger fb7a0d5257 Tiny change to DX branch to keep movie code optional (default off) 2002-08-28 21:47:02 +00:00
randomtiger f8351a9818 Woh! I sure as hell didnt modify all these files it says I did.
I will put this down to the branch! Note: I did start from a fresh checkout!
2002-08-28 10:51:04 +00:00
penguin 5aefddd246 Moved DirectX8 stuff to directx8 branch; reverted to previous 2002-08-27 13:38:58 +00:00
randomtiger facefe5872 Added new lib files: strmiids and ddraw to get dshow working
Added new command line parameter to active direct show movie play: -dshowvid
Uncommented movie_play calls and includes
2002-08-18 19:48:29 +00:00
penguin ef794efbb3 Added #include, needed for FRED 2002-08-15 04:41:17 +00:00
penguin 573a1f2fa3 updated 2002-08-13 04:31:25 +00:00
penguin a763d84b56 1. Disable CD checking
2. Add CVS tag to version string
2002-08-13 03:34:00 +00:00
penguin c06ccbb602 Bumped to version 3.2 2002-08-13 03:32:25 +00:00
drevil ffd8a5ae2a Rebuilding admin files 2002-08-11 23:08:20 +00:00
drevil aa753d5d6e Trash syncmail, it's worthless, use logaccum stuff instead 2002-08-11 23:05:15 +00:00
drevil 1cf042064f Yet more updates for syncmail 2002-08-11 22:36:01 +00:00
drevil a4e14a94d2 Correct arguments to syncmail 2002-08-11 22:22:35 +00:00
drevil 5871d644cc Change which module syncinfo "hooks" to 2002-08-11 22:20:56 +00:00
drevil 145a149873 Updated syncmail to current CVS version 2002-08-11 22:17:16 +00:00
drevil 7492c51ee6 corrected path to syncmail 2002-08-11 22:04:47 +00:00
drevil be4954a69e Adding syncmail cvs commit notification 2002-08-11 22:02:45 +00:00
DTP 875a95b82e Implented -GF4FIX commandline switch & #include "cmdline/cmdline.h" 2002-08-07 00:45:25 +00:00
DTP f6b129577b Implented -GF4FIX commandline switch 2002-08-07 00:44:13 +00:00
penguin 4d30bbba3e Updated 2002-08-06 21:21:42 +00:00
phreak 8823dc67eb added wireframe targetbox feature 2002-08-06 16:50:44 +00:00
phreak 8690c9d7f6 added Targetbox_wire variable to check what mode the
hud targetbox uses
2002-08-06 16:50:13 +00:00
phreak f70d242903 added keybing for wireframe hud,
fixed previous missile cheat
2002-08-06 16:49:22 +00:00
penguin 5b4306dbd6 Use text strings for wingmen names instead of ANI 2002-08-06 04:39:26 +00:00
penguin 013870fc6a inserted "class" keyword on "friend" definitions (ANSI C++ ) 2002-08-06 03:50:48 +00:00
penguin 0e3d4e562f Fixed problem w/ compile options for Debug mode 2002-08-06 02:43:02 +00:00
penguin 48d1ec4575 Removed a couple more include dirs I missed 2002-08-06 01:49:47 +00:00
penguin 32ad077676 Renamed ccode members to cc_or and cc_and 2002-08-06 01:49:08 +00:00
penguin 9942308fc8 Moved ChangeLog to top-level directory 2002-08-04 05:43:13 +00:00
penguin af3b97aae5 Change version display 2002-08-04 05:13:00 +00:00
penguin c3c0b0e1f4 Display fs2_open version instead of "Freespace 2" 2002-08-04 05:12:42 +00:00
penguin 9d5863bc76 Change version display location 2002-08-04 05:12:10 +00:00
penguin 4b2d436b04 Update version number to 3.1 2002-08-04 05:11:36 +00:00
penguin 404195d389 Don't write version to registry; change way version string is formatted 2002-08-04 05:11:05 +00:00
randomtiger df29aad213 Fixed Geforce 4 bug that caused font and hall video distortion.
Very small change in 'gr_d3d_aabitmap_ex_internal'

Tested and works on the following systems

OUTSIDER Voodoo 3 win98
OUTSIDER Geforce 2 win2000
Me Geforce 4 PNY 4600 XP
JBX-Phoenix Geforce 4 PNY XP
Mehrunes GeForce 3 XP
WMCoolmon nVidia TNT2 M64 win2000
Orange GeForce 4 4200 XP
ShadowWolf_IH Monster2 win98
ShadowWolf_IH voodoo 2 win98
2002-08-03 19:42:17 +00:00
wmcoolmon 026601e350 Fixed Win32 debug configuration 2002-08-03 18:35:21 +00:00
wmcoolmon 05a48addc6 Sync with makefile 1.4 2002-08-03 17:42:40 +00:00
penguin a1e9e62b6e updated 2002-08-01 04:04:01 +00:00
penguin 64ea61c93a The big include file move 2002-08-01 02:00:46 +00:00
penguin a0bbf8fd54 The big include file move 2002-08-01 01:41:11 +00:00
wmcoolmon 15e9872bb5 Fixed a bug I added in ship_do_rearm_frame 2002-07-30 18:11:25 +00:00
wmcoolmon a1f592ffef Modified to add hull repair capabilities and toggling of them via a mission flag, MISSION_FLAG_SUPPORT_REPAIRS_HULL 2002-07-30 17:57:40 +00:00
wmcoolmon 07de43ffc4 Added mission flag "MISSION_FLAG_SUPPORT_REPAIRS_HULL" for toggling Support Ship hull repair on and off 2002-07-30 17:35:22 +00:00
unknownplayer 522fa4c906 Started work on DX8.1 implementation. Updated the project files to encompass
the new files. Disable the compiler tag to use old DX code (THERE IS NO
NEW CODE YET!)
2002-07-30 14:29:15 +00:00
penguin 7611e0a2d2 Added Network/fs2ox.cpp 2002-07-29 22:24:57 +00:00
penguin 9290659edf First attempt at "fs2_open exchange" (PXO substitute) screen 2002-07-29 22:24:26 +00:00
penguin 3a88c2f9e3 We finally have a ChangeLog 2002-07-29 22:14:48 +00:00
penguin a732686bf6 Moved extern declaration of ssm_create outside of block (it wouldn't compile w/ gcc) 2002-07-29 20:48:51 +00:00
penguin 2ede27a557 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 20:12:31 +00:00
penguin 8300b018f0 removed bogus #include windows.h 2002-07-29 20:12:02 +00:00
penguin 93aed25251 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:52:48 +00:00
penguin 591563118c added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:37:21 +00:00
penguin b59b5dd5d8 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:17:21 +00:00
penguin bb0bde6409 added #ifdef _WIN32 around windows-specific system headers 2002-07-29 19:04:48 +00:00
DTP 66a392ddae Forgot to Bump MAX_MODEL_SUBSYSTEMS from 128 to 200 2002-07-29 08:31:52 +00:00
DTP 8bfc9fa709 BUMPED MAX_POLYGON_MODELS TO 198 , MAX_SHIP_TYPES - 2 = 198 2002-07-29 08:28:00 +00:00
DTP ccbdeeff67 Bumped all MAX_SHIPS, and SHIP_LIMIT to 400.(let the mission designers decide what is good, and what is bad 2002-07-29 08:24:42 +00:00
DTP 0f1176adaf Bumped MAX_SHIP_SUBOBJECTS to 2100(2100 /(average fighter has 7 subsystems) = 400 fighters 2002-07-29 08:22:42 +00:00
DTP b75fce3d5c Bumped MAX_SUBSYS_LIST from 32 to 200 2002-07-29 08:19:41 +00:00
DTP ab68ad4855 -almission(autoload mission) commandline arguement handling implemented 2002-07-29 08:05:20 +00:00
DTP 426cf0b969 FIX; Startgame arguement dont go ahead when a singleplayer pilot is selected 2002-07-29 07:56:10 +00:00
DTP 2d1f7ba50f added -almission commandline arguement, will autoload mission i.e fs2_open.exe -almission kickass will autoload kickass.fs2 which should be a multiplayer mission. 2002-07-29 06:35:15 +00:00
DTP 69145e65f1 FIX -stargame commandline arguement will now let you quit, a thing not possible before when using the startgame arguement 2002-07-28 15:07:43 +00:00
penguin 3dcb4b380a Testing commit as penguin 2002-07-26 18:02:33 +00:00
drevil 8e996fdf67 Updated password file 2002-07-26 17:59:31 +00:00
penguin 7367d8a31f renamed 'big' and 'small' (conflict w/ MS include file) 2002-07-26 16:17:46 +00:00
penguin d5fcfc773c fixed bug where winsock.h wasn't defined 2002-07-26 16:12:05 +00:00
wmcoolmon 5cdd3a676d Added Bobboau's beam tiling code 2002-07-26 03:11:24 +00:00
wmcoolmon fd95da4c0a Added Bobboau's fighter-beam code. 2002-07-25 04:50:48 +00:00
penguin 1aa613e0f5 Added ifndef NO_STANDALONE 2002-07-22 01:39:24 +00:00
penguin 7d91a35878 Stub defines for NO_SOUND 2002-07-22 01:37:24 +00:00
penguin fa2c566b3f Linux port -- added NO_STANDALONE ifdefs 2002-07-22 01:22:26 +00:00
penguin f2b7f9718a Made more compatible w/ Win32; defines for NO_SOUND, NO_JOYSTICK, NO_NETWORK 2002-07-22 01:14:09 +00:00
penguin 08c0bd3aee Moved the dummy "sound" definitions to main program (freespace.cpp) 2002-07-22 01:10:10 +00:00
penguin 3a39133e04 More defines for winsock compatibility 2002-07-22 01:06:04 +00:00
penguin c3ec5825a4 took out GAME_CD_CHECK define 2002-07-22 01:04:37 +00:00
DTP baddd6703d Bumped Max Shield Icons to 80 2002-07-20 23:51:59 +00:00
DTP 0c3733d2cd Fixed multiplayer music. succes music on all Primary goals complete, fail music
if otherwise
2002-07-20 23:50:53 +00:00
DTP c536d49afd Fixed Secondary bank bug, where next valid secondary bank inherits current
valid banks FULL fire delay
2002-07-20 23:49:46 +00:00
DTP b031aee73a bumped MAX_MISSION_TEXT to 1000000 in code/parse/parselo.h 2002-07-20 19:21:13 +00:00
penguin c480e2c944 Fixed bug (potential access of unitialized pointer) in hud_config_render_gauges() -- thanks to DTP for finding it! 2002-07-18 20:07:49 +00:00
unknownplayer c7cd913df4 no message 2002-07-18 14:36:53 +00:00
unknownplayer 58a465e805 Revised AI primary selection code again to be more intelligent. 2002-07-18 09:55:26 +00:00
unknownplayer cf08ff0cd5 Rewrote my original algorithm to search by proportional hull damage.
Does the same thing a little better.
2002-07-18 05:38:28 +00:00
unknownplayer c839e8168a Fixed AI problems with using the maxim on fighters. 2002-07-18 03:27:38 +00:00
unknownplayer 3257777c18 Added some commentry to the low detail shield function. 2002-07-18 03:26:35 +00:00
unknownplayer 1028e14398 no message 2002-07-18 03:25:10 +00:00
unknownplayer b733679875 Altered project files to properly build debug info. Should save you all some time. 2002-07-17 23:59:56 +00:00
unknownplayer 723cbd5938 Minor commenting added to two functions. 2002-07-17 23:58:46 +00:00
wmcoolmon 0e48ea11ac Added SSM code for Tag C from Bobboau. Note that strings.tbl may need to be updated. 2002-07-17 20:04:00 +00:00
unknownplayer 57ab92645c Added a custom build step to copy to c:\games\freespace2\fs2_open.exe
when you build.
2002-07-17 12:52:01 +00:00
unknownplayer 2431f5db2c Updated to enable compilation under MSVC++ - all changes are marked
with my name ##UnknownPlayer##
2002-07-16 14:39:16 +00:00
unknownplayer 34d960638a This is the code project file. Use the workspace file I included to get at this. 2002-07-16 14:37:51 +00:00
unknownplayer 3bb26b10a3 This is the workspace for freespace2.dsp - it contains everything needed to
compile fs2_open.exe
2002-07-16 14:37:09 +00:00
unknownplayer 3cdc511b2d This is the project file to compile fs2_open. It's a real project file - use the
workspace though
2002-07-16 14:36:30 +00:00
penguin 4543d0c80c Changed so that debug make debug and release makes release :) 2002-07-16 01:15:59 +00:00
penguin 2a740ad2c8 Commented out "fs2_open.dep" stuff 2002-07-16 01:15:15 +00:00
inquisitor 7187da0233 Visual Studio files
compiles fs2_open.exe - 0 error(s), 7 warning(s)
2002-07-15 22:36:08 +00:00
wmcoolmon ab43e4d987 Added support for toggling ship trails 2002-07-15 02:11:00 +00:00
wmcoolmon 8056476db1 Added initial code for "ship-lights-on" and "ship-lights-off" SEXPs 2002-07-13 09:16:18 +00:00
penguin 4b471d6045 Added flags2 (ran out of bits in flags!) to ship struct; bit 0 will be used
to toggle Bobboau's lights.
2002-07-12 16:59:04 +00:00
penguin 8b19d7c8eb Removed dummy include file 2002-07-12 02:56:07 +00:00
penguin 90c6679f03 Fixed endian-ness of new "GLOW" IDs 2002-07-12 02:44:18 +00:00
wmcoolmon 4c73e5fe20 Added Bobboau's glow code; all comments include "-Bobboau" 2002-07-10 18:42:14 +00:00
penguin dd3a3138a7 Back-port to MSVC 2002-07-07 19:56:00 +00:00
penguin 9e8a091172 Makefile for Microsoft Visual C++ 2002-07-07 19:49:42 +00:00
drevil 5d72560a30 Adding mysterial and penguin to CVS's admin files 2002-06-08 19:21:16 +00:00
drevil 2a9c65bd3f Changing my password 2002-06-08 19:10:16 +00:00
drevil 6b4cca55be Changing my password 2002-06-08 19:04:53 +00:00
penguin c18139e73f Added machine-independent version of MulDiv (in case we don't know
the processor type)
2002-06-04 06:38:21 +00:00
penguin be6ee814c2 Minor changes 2002-06-03 05:03:45 +00:00
penguin ea6130e542 Initial revision 2002-06-03 04:34:38 +00:00
penguin 48a566a2d5 Warpcore CVS sync 2002-06-03 04:10:40 +00:00
penguin dab5b293d4 Dummy include file 2002-06-03 04:08:13 +00:00
penguin 2a2cd3c873 Warpcore CVS sync 2002-06-03 03:55:40 +00:00
penguin 51ffb56b16 Volition sources -- warpcore CVS import 2002-06-03 03:26:03 +00:00
fs2source 211e7a4284 Commited initial passwd/writers files,
inquisitor
drevil
anonymous

added

anonymous has no write access
2002-06-02 00:39:17 +00:00
fs2source 24643586f1 initial checkin 2002-06-01 21:21:20 +00:00
fs2source 08986cb47e initial checkin 2002-06-01 21:21:19 +00:00
(no author) c3d878b1b3 New repository initialized by cvs2svn. 2002-06-01 21:21:19 +00:00
2664 changed files with 411598 additions and 934593 deletions

No files matched your search

-182
View File
@@ -1,182 +0,0 @@
version: 2
references:
container_config: &container_config
docker:
- image: "debian:stretch"
working_directory: /root/build
restore_repo: &restore_repo
restore_cache:
keys:
- source-repo-{{ .Branch }}-{{ .Revision }}
- source-repo-{{ .Branch }}
- source-repo
cmake_configure: &cmake_configure
run:
name: Creating Build Files
command: |
mkdir build
cd build
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
if [[ "$CC" =~ ^clang.*$ ]]; then
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
fi
eval $CC --version
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON ..
compile: &compile
run:
name: Compiling Source code
command: |
cd build
ninja -k 20 all
run_tests: &run_tests
run:
name: Run unit tests
command: |
./build/bin/unittests --gtest_shuffle
compile_steps: &compile_steps
steps:
- *restore_repo
- *cmake_configure
- *compile
- *run_tests
jobs:
checkout_code:
<<: *container_config
steps:
- run:
name: Installing Git
command: 'apt-get update && apt-get -yq install git'
- *restore_repo
- checkout
- run:
name: Updating submodules
command: 'git submodule update --init --recursive'
- save_cache:
key: source-repo-{{ .Branch }}-{{ .Revision }}
paths:
- .
build_gcc_lowest_debug:
docker:
- image: asarium/fso_compile:gcc-lowest
working_directory: /root/build
environment:
CC: gcc
CXX: g++
CONFIGURATION: Debug
<<: *compile_steps
build_gcc_lowest_release:
docker:
- image: asarium/fso_compile:gcc-lowest
working_directory: /root/build
environment:
CC: gcc
CXX: g++
CONFIGURATION: Release
<<: *compile_steps
build_gcc_latest_debug:
docker:
- image: asarium/fso_compile:gcc-latest
working_directory: /root/build
environment:
CC: gcc
CXX: g++
CONFIGURATION: Debug
<<: *compile_steps
build_gcc_latest_release:
docker:
- image: asarium/fso_compile:gcc-latest
working_directory: /root/build
environment:
CC: gcc
CXX: g++
CONFIGURATION: Release
<<: *compile_steps
build_clang_latest_debug:
docker:
- image: asarium/fso_compile:clang-latest
working_directory: /root/build
environment:
CC: clang-8
CXX: clang++-8
CONFIGURATION: Debug
<<: *compile_steps
build_clang_latest_release:
docker:
- image: asarium/fso_compile:clang-latest
working_directory: /root/build
environment:
CC: clang-8
CXX: clang++-8
CONFIGURATION: Release
<<: *compile_steps
build_clang_lowest_debug:
docker:
- image: asarium/fso_compile:clang-lowest
working_directory: /root/build
environment:
CC: clang
CXX: clang++
CONFIGURATION: Debug
<<: *compile_steps
build_clang_lowest_release:
docker:
- image: asarium/fso_compile:clang-lowest
working_directory: /root/build
environment:
CC: clang
CXX: clang++
CONFIGURATION: Release
<<: *compile_steps
workflows:
version: 2
build_test:
jobs:
- checkout_code
- build_gcc_lowest_debug:
requires:
- checkout_code
- build_gcc_lowest_release:
requires:
- checkout_code
- build_gcc_latest_debug:
requires:
- checkout_code
- build_gcc_latest_release:
requires:
- checkout_code
- build_clang_latest_debug:
requires:
- checkout_code
- build_clang_latest_release:
requires:
- checkout_code
- build_clang_lowest_debug:
requires:
- checkout_code
- build_clang_lowest_release:
requires:
- checkout_code
-103
View File
@@ -1,103 +0,0 @@
---
Language: Cpp
Standard: Cpp11
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllArgumentsOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^(<.*\.(h|hh|hpp)>)$' # Includes of external libraries
Priority: 5
- Regex: '^(<.*>)$' # standard library includes (won't match deprecated C headers)
Priority: 6
- Regex: '^"globalincs\/.*\.h"$' # globalincs always come first
Priority: 1
- Regex: '^"[^/]*\.(h)"$' # Local includes
Priority: 2
- Regex: '^".*\.(h)"$' # standard engine includes
Priority: 3
- Regex: '.*' # Catch all in case something is unhandled above
Priority: 4
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
...
-40
View File
@@ -1,40 +0,0 @@
---
Checks: "-*,\
modernize-*,\
-modernize-raw-string-literal,\
-modernize-use-using,\
-modernize-make-unique,\
-modernize-use-trailing-return-type,\
-modernize-avoid-c-arrays,\
performance-*,\
-performance-type-promotion-in-math-fn,\
misc-*,\
-misc-macro-parentheses,\
-misc-misplaced-widening-cast,\
-misc-static-assert,\
-misc-unused-parameters,\
-misc-non-private-member-variables-in-classes,\
readability-*,\
-readability-function-size,\
-readability-identifier-naming,\
-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
-readability-isolate-declaration,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-qualified-auto,\
-readability-uppercase-literal-suffix,\
-readability-else-after-return,\
"
WarningsAsErrors: ''
HeaderFilterRegex: 'code/.*$|freespace2/.*$|qtfred/.*$|test/src/.*$|build/.*$'
AnalyzeTemporaryDtors: false
CheckOptions:
- key: 'misc-assert-side-effect.AssertMacros'
value: 'assert,Assert,Assertion'
- key: 'modernize-use-emplace.ContainersWithPushBack'
value: 'std::vector;std::deque;std::list;SCP_vector;SCP_deque;SCP_list'
- key: 'readability-braces-around-statements.ShortStatementLines'
value: '4' # Avoid flagging simple if (...) return false; statements
...
-2
View File
@@ -1,2 +0,0 @@
/build
/.git
-21
View File
@@ -1,21 +0,0 @@
build:
image: teaci/msys$$arch
pull: true
shell: mingw$$arch
commands:
- git submodule update --init --recursive
- if [ $$arch = 32 ]; then target=i686; fi
- if [ $$arch = 64 ]; then target=x86_64; fi
- pacman -S --needed --noconfirm --noprogressbar mingw-w64-${target}-pkg-config mingw-w64-${target}-cmake
- mkdir build && cd build
- cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=$$CONFIGURATION -DFSO_USE_SPEECH=OFF -DFSO_USE_VOICEREC=OFF -DFSO_FATAL_WARNINGS=ON -DFSO_BUILD_FRED2=OFF ..
- make -j$(nproc) all
matrix:
arch:
- 64
- 32
CONFIGURATION:
- Debug
- Release
-11
View File
@@ -1,11 +0,0 @@
root = true
[*.{h,cpp}]
indent_style = tab
[*.sdr]
indent_style = tab
[*.{yml,yaml}]
indent_style = space
indent_size = 2
-7
View File
@@ -1,7 +0,0 @@
# Default for everything
# * text=auto
# For the test data and built-in files to make them consistent on all platforms
*.tbl text eol=lf
*.tbm text eol=lf
*.sdr text eol=lf
-130
View File
@@ -1,130 +0,0 @@
name: Check a pull request
on: [pull_request]
jobs:
build_linux:
strategy:
matrix:
configuration: [Debug, Release]
compiler: [gcc-5, gcc-9, clang-4.0]
name: Linux
runs-on: ubuntu-16.04
steps:
- name: Prepare Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:beineri/opt-qt571-xenial
sudo add-apt-repository ppa:msulikowski/valgrind # For fixing a bug with valgrind 3.11 which does not recognize the rdrand instruction
sudo apt-get -yq update
sudo apt-get -yq install cmake ninja-build libopenal-dev libreadline6-dev libpng12-dev libjpeg62-dev liblua5.1-0-dev libjansson-dev libsdl2-dev libfreetype6-dev valgrind qt57base g++-5 g++-9 clang-4.0 clang-tidy-4.0 libc++-dev libc++abi-dev
# Fix a header bug present in ubuntu...
sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
run: |
if [ "$COMPILER" = "gcc-5" ]; then
export CC=gcc-5
export CXX=g++-5
fi
if [ "$COMPILER" = "gcc-9" ]; then
export CC=gcc-9
export CXX=g++-9
fi
if [ "$COMPILER" = "clang-4.0" ]; then
export CC=clang-4.0
export CXX=clang++-4.0
fi
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
if [[ "$CC" =~ ^clang.*$ ]]; then
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
fi
mkdir build
cd build
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON ..
- name: Compile
working-directory: ./build
run: ninja -k 20 all
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
run: |
if [ "$CONFIGURATION" = "Debug" ]; then
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$GITHUB_WORKSPACE/ci/travis/valgrind.supp" ./bin/unittests --gtest_shuffle
else
./bin/unittests --gtest_shuffle
fi
build_windows:
strategy:
matrix:
configuration: [Debug, Release]
compiler: [MSVC]
arch: [Win32, x64]
name: Windows
runs-on: windows-2019
steps:
- name: Prepare Environment
run: choco install ninja
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Configure CMake
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
ARCHITECTURE: ${{ matrix.arch }}
shell: bash
run: |
mkdir build
cd build
if [ "$COMPILER" = "MinGW" ]; then
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -DCMAKE_BUILD_TYPE=$CONFIGURATION -G "Ninja" ..
else
cmake -DFSO_USE_SPEECH="ON" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DMSVC_SIMD_INSTRUCTIONS=SSE2 -DFSO_BUILD_FRED2="ON" -G "Visual Studio 16 2019" -T "v142" -A "$ARCHITECTURE" ..
fi
- name: Compile
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
shell: bash
run: |
if [ "$COMPILER" = "MinGW" ]; then
cmake --build . --config "$CONFIGURATION"
else
cmake --build . --config "$CONFIGURATION" -- /verbosity:minimal
fi
- name: Run Tests
working-directory: ./build
env:
CONFIGURATION: ${{ matrix.configuration }}
COMPILER: ${{ matrix.compiler }}
shell: bash
run: |
if [ "$COMPILER" = "MinGW" ]; then
./bin/unittests --gtest_shuffle
else
"./bin/$CONFIGURATION/unittests" --gtest_shuffle
fi
@@ -1,48 +0,0 @@
name: Publish Standalone docker image
on:
push:
tags:
- '*'
jobs:
build_images:
strategy:
matrix:
configuration: [FastDebug, Release]
include:
- configuration: FastDebug
latest_tag: latest_debug
nightly_tag: nightly_debug
release_tag: release_debug
- configuration: Release
latest_tag: latest
nightly_tag: nightly
release_tag: release
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
name: Checkout
with:
submodules: true
- name: Docker login
run: echo ${{ secrets.DOCKER_ACCESSTOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Docker build
run: docker build --build-arg build_type=${{ matrix.configuration }} -f docker/standalone/Dockerfile -t ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} .
- name: Push latest tag
run: |
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }}
- name: Push nightly tag
if: contains(github.ref, 'refs/tags/nightly_')
run: |
docker tag ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.nightly_tag }}
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.nightly_tag }}
- name: Push release tag
if: contains(github.ref, 'refs/tags/release_')
run: |
docker tag ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.latest_tag }} ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.release_tag }}
docker push ${{ secrets.DOCKER_REPOSITORY }}:${{ matrix.release_tag }}
-260
View File
@@ -1,260 +0,0 @@
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.unsuccessfulbuild
ipch/
[Oo]bj/
Ankh.NoLoad
*.VC.db
*.VC.VC.opendb
#MonoDevelop
*.pidb
*.userprefs
#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache
#Project files
[Bb]uild/
#Subversion files
.svn
# Office Temp Files
~$*
# vim Temp Files
*~
#NuGet
packages/
*.nupkg
#ncrunch
*ncrunch*
*crunch*.local.xml
# visual studio database projects
*.dbmdl
#Test files
*.testsettings
#===========
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.1
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
# - added line-by-line explanations for EVERYTHING (some were missing)
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
#########################
#####
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.DS_Store
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.Trashes
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
*.swp
# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV
*.lock
#
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
#profile
####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
*~.nib
####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
DerivedData/
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
build/
#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"
# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
*.pbxuser
# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
*.mode1v3
# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
*.mode2v3
# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
*.perspectivev3
# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
####
# Xcode 4 - semi-personal settings
#
#
# OPTION 1: ---------------------------------
# throw away ALL personal settings (including custom schemes!
# - unless they are "shared")
#
# NB: this is exclusive with OPTION 2 below
xcuserdata
# OPTION 2: ---------------------------------
# get rid of ALL personal settings, but KEEP SOME OF THEM
# - NB: you must manually uncomment the bits you want to keep
#
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
# or manually install git over the top of the OS X version
# NB: this is exclusive with OPTION 1 above
#
#xcuserdata/**/*
# (requires option 2 above): Personal Schemes
#
#!xcuserdata/**/xcschemes/*
####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# /(root)/
# /(project-name).xcodeproj/
# project.pbxproj
# /project.xcworkspace/
# contents.xcworkspacedata
# /xcuserdata/
# /(your name)/xcuserdatad/
# UserInterfaceState.xcuserstate
# /xcsshareddata/
# /xcschemes/
# (shared scheme name).xcscheme
# /xcuserdata/
# /(your name)/xcuserdatad/
# (private scheme).xcscheme
# xcschememanagement.plist
#
#
####
# Xcode 4 - Deprecated classes
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!
*.moved-aside
# .xccheckout
#
# Per http://stackoverflow.com/questions/18340453/should-xccheckout-files-in-xcode5-be-ignored-under-vcs
#
*.xccheckout
####
# Visual Studio Code
.vscode
####
# Documentation
#
documentation/doxygen/*
!documentation/doxygen/.gitkeep
.idea/*
projects/*
/.vs
CMakeSettings.json
# Weird files created by Linux
.fuse_hidden*
# This gets ignored by one of the rules above for some reason...
!/code/scripting/lua/LuaConvert.h
!/code/debugconsole/
!/docker/build
-6
View File
@@ -1,6 +0,0 @@
[submodule "cmake/external/rpavlik-cmake-modules"]
path = cmake/external/rpavlik-cmake-modules
url = https://github.com/asarium/cmake-modules.git
[submodule "lib/libRocket"]
path = lib/libRocket
url = https://github.com/asarium/libRocket.git
-201
View File
@@ -1,201 +0,0 @@
language: bash
sudo: required
dist: xenial
cache:
directories:
- $HOME/cmake-3.8
- $HOME/.ccache
- $HOME/curl_cache
addons:
apt:
packages: &global_deps
- ninja-build
- libopenal-dev
- libreadline6-dev
- libpng12-dev
- libjpeg62-dev
- liblua5.1-0-dev
- libjansson-dev
- libsdl2-dev
- libfreetype6-dev
- qt57base
coverity_scan:
project:
name: "scp-fs2open/fs2open.github.com"
notification_email: [email protected]
build_command: "ci/travis/script.sh"
# must match TRAVIS_BRANCH check below
branch_pattern: coverity_scan
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
# also note that fork's don't get access to secure keys
# you have to test using a branch in the main repo
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
# These declarations set INDIEGAMES_USER and INDIEGAMES_PASSWORD for uploading nightly builds to the indiegames server
- secure: "lUuRu8XIi8MKNf1ebOfyC4iVEpPyASojJIDWXRo2bNqEF4ILAljXdkVeXeN6H5yKCHD52cxCNTtyePIG/o3p3QEuGSVud9bDS3D7LaQicLETGGrsw3l07U49gF2OKHXGopg0MzBbZUU9QmhoFTAe8t6PV9NDuEayYCheqvTqjZg="
- secure: "E/DHLYcPK/hBUqxBYYlUqp5sjgvIqY5A0qRHyQ4bmjsB+WB/Xx71bGCSiF7hk6lTxar1ZI1i5RAXXh9AIvNVaYAIdEOlCP+q3gvwCYuc5naZEKmkxlUCf0oEL4O9Fye93A/3VkFHuBdC1TGPYYf69m4W5r4367wWO9dPRIdWpJA="
# These declarations set DATACORDER_USER and DATACORDER_PASSWORD
- secure: "dpBH/dDN3bmU/NFlh+2v9isNx9wX0ocoRy+W+kBXRH32sosUGp26REhMqgVRpBNP5oxPBU8ic5bEogxAYWCB+0xUygBbkxAwyMPgoA34s0OXdTCY/ofw14ni8qqV2Ffy7fQJbP/jkMURyiMHx3kBTxNv3YjxKJqLnOuOMlQLpT8="
- secure: "tLMRBD1Ufp5iKNwlqPDVbbuczgusaXNoBJyAnPATpJq2YwlkW4j3PqP9rW5vd85+52xam2EOP20w9PoBR5J6FLdiXRu4Lf7yCEhSHFAgowVqQj8QcJpPlyXr90bM4emFGrGqpdxVwxyQ5AFhKwLuEZKsI14GYLN+UMEwpNCMing="
deploy:
- provider: releases
api_key:
secure: "q619+eQTe7lv8UVphK4OIzU8Jw84KBbVkuprN2sWIubRcV3IbZr2+WahJoUMt+nyhiy3YjDYtstO2ZgkxupwnZgwGUBVIiD1c4SPuyy+HTjNMOtiVsEUHT2hf+xPAemWpTlK5HcwhMmHAOh6rt6dEj57QOg0gcmGiwD/tCbEriA="
skip_cleanup: true
file_glob: true
file: "/tmp/builds/*"
on:
condition: '"$RELEASE_BUILD" == true'
tags: true
- provider: script
script: bash ci/travis/ftp_deploy.sh
on:
condition: '"$NIGHTLY_BUILD" == true'
tags: true
- provider: script
skip_cleanup: true
script: bash ci/travis/ftp_deploy.sh
on:
condition: $TEST_BUILD = true
all_branches: true
matrix:
include:
# note that gcc Debug MUST be 1st for Coverity
- os: linux
env: CONFIGURATION="Debug" CC=gcc-5 CXX=g++-5
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-5
- os: linux
env: CONFIGURATION="Debug" CC=gcc-9 CXX=g++-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Debug" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DCLANG_USE_LIBCXX=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- clang-4.0
- libc++-dev
- libc++abi-dev
- os: linux
env: CONFIGURATION="Debug" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-9
script:
- ./ci/travis/script.sh
- ./ci/travis/clang_tidy.sh
- os: osx
env: CONFIGURATION="Debug"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET=v141_xp CMAKE_GENERATOR="Visual Studio 15 2017"
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
- os: linux
env: CONFIGURATION="Release" CC=gcc-5 CXX=g++-5
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-5
- os: linux
env: CONFIGURATION="Release" CC=gcc-9 CXX=g++-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- g++-9
- *global_deps
- os: linux
env: CONFIGURATION="Release" CC=clang-4.0 CXX=clang++-4.0 CMAKE_OPTIONS="-DCLANG_USE_LIBCXX=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial-8
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- clang-4.0
- libc++-dev
- libc++abi-dev
- os: linux
env: CONFIGURATION="Release" CC=clang-9 CXX=clang++-9 CMAKE_OPTIONS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt571-xenial'
packages:
- *global_deps
- g++-9
script:
- ./ci/travis/script.sh
- ./ci/travis/clang_tidy.sh
- os: osx
env: CONFIGURATION="Release"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET=v141_xp CMAKE_GENERATOR="Visual Studio 15 2017"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
# There is a GCC compiler bug with MinGW that causes compilation failures on Windows at the moment
allow_failures:
- os: windows
env: CONFIGURATION="Debug" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
- os: windows
env: CONFIGURATION="Release" CMAKE_TOOLSET="" CMAKE_GENERATOR="Ninja"
fast_finish: true
before_install:
# ugly hack; if running a coverity scan abort all except the 1st build
# see note re gcc compiler above needing to be 1st
# also note that branch_pattern & the TRAVIS_BRANCH check must match
# unfortunately COVERITY_SCAN_BRANCH isn't defined until later in the
# build process
- if ([[ "${TRAVIS_JOB_NUMBER##*.}" != "1" ]] && [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]); then false ; fi
- source "./ci/travis/check_release.sh"
- "./ci/travis/before_install.sh"
install:
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then export PATH="/c/Program Files/CMake/bin":$PATH; fi
- "./ci/travis/install.sh"
- export PATH=$HOME/cmake-3.6/bin:$PATH
before_script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then QT_ENV_SCRIPT=$(find /opt -name 'qt*-env.sh'); source $QT_ENV_SCRIPT; fi
- "./ci/travis/before_script.sh"
script:
- if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi
-41
View File
@@ -1,41 +0,0 @@
## FreeSpace
FreeSpace: The Great War (Released 1998) and FreeSpace 2 (1999) are mission-based space combat simulators, like X-Wing/TIE Fighter and Wing Commander. Among the greatest games of the genre, they were also effectively the last.
The FreeSpace series follows humanity and their Vasudan allies as they fight to withstand the xenocidal, enigmatic Shivans, a species of unknown origin, vast technological capability, and seemingly limitless malice.
## FreeSpace Open
Thanks to Volition's generosity, we've continued development of FreeSpace 2 as FreeSpace Open, building graphical enhancements to bring the original games up to modern standards, telling new stories set in the FreeSpace universe and original worlds, and creating spectacular total conversions that let players fly in the beloved universes of Babylon 5, Battlestar Galactica, Wing Commander, and Star Wars.
## Hard-Light Productions
HLP is a fan community built on love and open-source code. We're dedicated to bringing modders together and giving them a place to share their own hard work and draw inspiration from the work of others. Thanks to Volition's generosity, we've continued development of FreeSpace 2 as FreeSpace Open, building graphical enhancements to bring the original games up to modern standards, telling new stories set in the FreeSpace universe and original worlds, and creating spectacular total conversions that let players fly in the beloved universes of Babylon 5, Battlestar Galactica, Wing Commander, and Star Wars.
Find us at:
- Our [website](http://www.hard-light.net/) and [forums](http://www.hard-light.net/forums/)
- [Discord](https://discord.gg/YNVP3WR)
- [Facebook](https://www.facebook.com/groups/Hardlightproductions/)
- [Youtube](https://www.youtube.com/channel/UCxKkd609hDtY6yNetR1iT4w)
- [Reddit](https://www.reddit.com/r/freespace/)
- [Twitter](https://twitter.com/hardlightpro)
- [IRC](irc://irc.esper.net/hard-light)
## How to get the game
FreeSpace Open requires a retail installation of FreeSpace 2, which is available at the following stores:
- [GOG.com](https://www.gog.com/game/freespace_2)
- [Steam](https://store.steampowered.com/app/273620/Freespace_2/)
After installing retail FS2, use [Knossos](https://fsnebula.org/knossos/) to upgrade to the most recent release of FSO. Knossos is an advanced mod manager and launcher for FSO.
## Improvements
The new open source game engine has several distingushing features including:
- Linux and Mac OS X support
- OpenGL support
- OpenAL audio support
- Easy mod installation
- OGG support
- Hardware transform, clipping, and lighting
## The FreeSpace Upgrade Project
While the SCP improves the code of the game engine to enable new and exciting features, the FreeSpace Upgrade Project (FSU) creates material that takes advantage of the improved game engine.
The FSU improves the ships, effects, and background elements of FreeSpace 2. Every now and then these improvements are released as a pack called MediaVPs. These assorted improvements enhance the graphics of the game.
While the best way to experience the FSU is by playing the game with it, you can watch this [comparison video](https://www.youtube.com/watch?v=RM1YC_gK-qo) between 1999 and 2019 to have an idea of how much more beautiful FSU makes the game.
^(Much of this content was pulled from existing sources, such as InsaneBaron's "What Is Hard Light Productions" [thread](https://www.hard-light.net/forums/index.php?topic=86650.0), the Wiki's [Getting Started article](https://wiki.hard-light.net/index.php/Getting_started) and more.)
-8
View File
@@ -1,8 +0,0 @@
Original source (Freespace 2) by Volition, Inc.; see "`credits.tbl`"
Modifications by the FreeSpace 2 Source Code Project [(FSO SCP)](https://www.hard-light.net/forums/index.php?board=50.0)
[Project Contributors](https://github.com/scp-fs2open/fs2open.github.com/graphs/contributors)
Special thanks to:
Volition for making FS2 such a great game
Dave Baranec for giving us the code and keeping us sanity checked
-207
View File
@@ -1,207 +0,0 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Make sure the source and binary directory are not the sample
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
message(FATAL_ERROR "Binary and source directory can not be the same! Choose another build directory.")
endif()
include(cmake/util.cmake)
# Set a few policies
set_policy(CMP0051 NEW)
set_policy(CMP0053 NEW)
set_policy(CMP0054 NEW)
SET(FSO_PROJECT_DESCRIPTION "Open source project based on the original FreeSpace 2 source code.")
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Executable output path")
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE PATH "Library output path")
# CMAKE_INSTALL_PREFIX is defined but also overwritten by the PROJECT command so we need to set it later
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(RESET_INSTALL_PREFIX TRUE)
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
# Reset this variable
SET(TARGET_COPY_FILES "" CACHE INTERNAL "" FORCE)
SET(TARGET_COPY_DIRS "" CACHE INTERNAL "" FORCE)
### Define options and editable variables in the section below:
# This is only needed for single configuration generators so don't annoy others
if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default build configuration used." FORCE)
message(WARNING "CMAKE_BUILD_TYPE was not specified, defaulting to Release configuration.")
endif(NOT CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
# Override standard CMake configurations
set(CMAKE_CONFIGURATION_TYPES Debug Release FastDebug CACHE STRING "Available configurations" FORCE)
PROJECT(FS2_Open)
find_program(CCACHE_PROGRAM ccache)
# Currently only GCC support ccache properly without generating additional warnings
if(CCACHE_PROGRAM AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Using ccache for compilation: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()
IF(CMAKE_CROSSCOMPILING)
SET(IMPORT_EXE_DIR "IMPORT_EXE_DIR-NOTFOUND" CACHE FILEPATH "Required for a cross compiling build, point to binary directory of a cmake build for the real OS")
INCLUDE(${IMPORT_EXE_DIR}/ImportExecutables.cmake)
ENDIF(CMAKE_CROSSCOMPILING)
# Check if the external modules exists
IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/external/rpavlik-cmake-modules/launcher-templates")
message(FATAL_ERROR "External submodules could not be found. Please make sure you have updated your submodules.")
endif()
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/finder")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/external/rpavlik-cmake-modules")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/external/cotire")
IF(RESET_INSTALL_PREFIX)
IF(NOT $ENV{FS2PATH} STREQUAL "")
IF(NOT IS_DIRECTORY $ENV{FS2PATH})
MESSAGE(WARNING "The path '$ENV{FS2PATH}' of the environment variable FS2PATH does not point to a directory! Install prefix wasn't set.")
ELSE(NOT IS_DIRECTORY $ENV{FS2PATH})
SET(CMAKE_INSTALL_PREFIX "$ENV{FS2PATH}" CACHE FILEPATH "Install path" FORCE)
FILE(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} CMAKE_INSTALL_PREFIX)
ENDIF(NOT IS_DIRECTORY $ENV{FS2PATH})
ELSE(NOT $ENV{FS2PATH} STREQUAL "")
MESSAGE(STATUS "NO FS2PATH environment variable found, you can define this to point to your freespace install but it is not required.")
ENDIF(NOT $ENV{FS2PATH} STREQUAL "")
ENDIF(RESET_INSTALL_PREFIX)
IF (WIN32)
OPTION(FSO_USE_SPEECH "Use Windows specific text-to-speach libraries" ON)
OPTION(FSO_USE_VOICEREC "Enable voice recognition support" ON)
OPTION(FSO_BUILD_FRED2 "Build FRED2 binary" ON)
elseif(UNIX)
option(FSO_BUILD_APPIMAGE "Build an AppImage package" OFF)
ENDIF(WIN32)
OPTION(FSO_BUILD_TOOLS "Build tools related to FSO" OFF)
OPTION(FSO_BUILD_TESTS "Build unit tests" OFF)
OPTION(FSO_DEVELOPMENT_MODE "Generate binaries in development mode, only use if you know what you're doing!" OFF)
OPTION(FSO_BUILD_QTFRED "Build qtFRED2 binary" OFF)
IF(WIN32 OR APPLE)
# On windows and mac the default should be to always build the included libraries
SET(FSO_BUILD_INCLUDED_LIBS_DEFAULT ON)
ELSE()
SET(FSO_BUILD_INCLUDED_LIBS_DEFAULT OFF)
ENDIF()
OPTION(FSO_BUILD_INCLUDED_LIBS "Build and use the included libraries istead of using the system headers and libraries" ${FSO_BUILD_INCLUDED_LIBS_DEFAULT})
OPTION(FSO_USE_LUAJIT "Use LuaJIT for Lua scripting, needs a working internet connection!" OFF)
OPTION(FSO_USE_OPENALSOFT "Download and build OpenAL Soft instead of using the system libraries" OFF)
OPTION(FSO_FATAL_WARNINGS "Determines if warnings in the build are considered fatal errors, primarily used for CI" OFF)
SET(FSO_FREESPACE_PATH "${CMAKE_INSTALL_PREFIX}" CACHE FILEPATH "The path of the FreeSpace directory you want to use. Please note that you will have to change CMAKE_INSTALL_PREFIX if you change this at some point.")
SET(FSO_RUN_ARGUMENTS "" CACHE STRING "Additional arguments passed to a generated executable when run with the generated build files.")
option(FSO_INSTALL_DEBUG_FILES "Install some debug files (currently only PDB files on windows)" OFF)
option(ENABLE_COTIRE "Enable cotire for faster compilation. Enabled by default." ON)
option(FSO_RELEASE_LOGGING "Enable logging output for release builds" OFF)
OPTION(FSO_BUILD_WITH_FFMPEG "Enable the usage of FFmpeg for sound and custscenes" ON)
MARK_AS_ADVANCED(FORCE FSO_CMAKE_DEBUG)
MARK_AS_ADVANCED(FORCE FSO_BUILD_INCLUDED_LIBS)
MARK_AS_ADVANCED(FORCE FSO_USE_OPENALSOFT)
MARK_AS_ADVANCED(FORCE FSO_USE_LUAJIT)
MARK_AS_ADVANCED(FORCE FSO_DEVELOPMENT_MODE)
MARK_AS_ADVANCED(FORCE FSO_FATAL_WARNINGS)
mark_as_advanced(FORCE FSO_INSTALL_DEBUG_FILES)
mark_as_advanced(FORCE ENABLE_COTIRE)
mark_as_advanced(FORCE FSO_RELEASE_LOGGING)
mark_as_advanced(FORCE FSO_BUILD_WITH_FFMPEG)
# Include cotire file from https://github.com/sakra/cotire/
include(cotire)
INCLUDE(globals)
INCLUDE(toolchain)
INCLUDE(platforms)
include(version)
INCLUDE(headers)
SET(GENERATED_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated_source)
include(generateHeaders)
if(FSO_BUILD_APPIMAGE)
include(appimage)
endif()
include(clang-tidy)
# This includes source code for some tools, either used in the build or also for something else
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(code)
ADD_SUBDIRECTORY(freespace2)
IF(FSO_BUILD_FRED2)
ADD_SUBDIRECTORY(fred2)
ENDIF(FSO_BUILD_FRED2)
IF(FSO_BUILD_QTFRED)
ADD_SUBDIRECTORY(qtfred)
ENDIF()
if(FSO_BUILD_TESTS)
add_subdirectory(test)
endif()
if ("${CMAKE_VERSION}" VERSION_GREATER "3.5")
# Default to using Freespace2 as startup project if CMake supports it.
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Freespace2)
endif()
IF(MSVC_USE_RUNTIME_DLL)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BINARY_DESTINATION}")
IF(FSO_BUILD_FRED2)
SET(CMAKE_INSTALL_MFC_LIBRARIES ON)
ENDIF(FSO_BUILD_FRED2)
INCLUDE(InstallRequiredSystemLibraries)
ENDIF(MSVC_USE_RUNTIME_DLL)
include(package)
include(doxygen)
# Print used options to log
IF (WIN32)
message(STATUS "Using text to speech: ${FSO_USE_SPEECH}")
message(STATUS "Using voice recogition: ${FSO_USE_VOICEREC}")
message(STATUS "Building FRED2: ${FSO_BUILD_FRED2}")
elseif(UNIX)
message(STATUS "Building AppImage: ${FSO_BUILD_APPIMAGE}")
ENDIF()
message(STATUS "Building FSO tools: ${FSO_BUILD_TOOLS}")
message(STATUS "Building qtFRED: ${FSO_BUILD_QTFRED}")
message(STATUS "Fatal warnings: ${FSO_FATAL_WARNINGS}")
message(STATUS "Release logging: ${FSO_RELEASE_LOGGING}")
message(STATUS "With FFmpeg: ${FSO_BUILD_WITH_FFMPEG}")
+15
View File
@@ -0,0 +1,15 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
new_commit_prep Error checking out/updating CVSROOT/new_commit_prep
new_log_accum Error checking out/updating CVSROOT/new_log_accum
+17
View File
@@ -0,0 +1,17 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
DEFAULT $CVSROOT/CVSROOT/new_commit_prep
CVSROOT $CVSROOT/CVSROOT/new_commit_prep
+14
View File
@@ -0,0 +1,14 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
#LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOFEWGCMAR
+23
View File
@@ -0,0 +1,23 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
+21
View File
@@ -0,0 +1,21 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
+30
View File
@@ -0,0 +1,30 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
DEFAULT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
CVSROOT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
+26
View File
@@ -0,0 +1,26 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
+104
View File
@@ -0,0 +1,104 @@
#!/usr/bin/perl -w
#
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Script to store the last visited directory for newlogaccum.pl.
#
# $Id: new_commit_prep,v 1.1 2002-08-11 23:05:15 drevil Exp $
use strict;
# This routine removes everything in a directory
sub clear_dir {
my ($dir) = @_;
my ($file);
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
while ($file = readdir(DIR)) {
next
if ($file eq "." || $file eq "..");
$file = "$dir/$file";
if (-d $file) {
# It's a directory, recurse into it, then delete it.
clear_dir($file);
rmdir($file);
} else {
# It's a file, delete it.
unlink($file);
}
}
closedir(DIR);
}
# This routine prepares a temporary directory, hopefully in a secure
# fashion; it uses the process group to make secondary programs be able
# to find it.
sub tmpdir (;$) {
my ($clear) = @_;
my ($pgrp, $own, $mode, $tmpdir);
$pgrp = getpgrp();
die "Don't run $0 setuid!"
unless ($< == $>);
# Decide on the directory name, using various environment variables
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
"/.#cvs.$pgrp";
# Doesn't exist, but we can't create it...
die "Can't create temporary directory $tmpdir: $!"
unless (-e $tmpdir || mkdir($tmpdir, 0700));
die "Temporary directory $tmpdir is not a directory"
unless (-d $tmpdir);
# Check ownership and permissions
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
unless ($own == $<);
die "Temporary directory $tmpdir group-writable"
if ($mode & 0020);
die "Temporary directory $tmpdir other-writable"
if ($mode & 0002);
# If we're supposed to clear the directory, do so...
clear_dir($tmpdir)
if ($clear);
return $tmpdir;
}
# This routine writes a single line to a file
sub write_line ($$) {
my ($fname, $line) = @_;
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
print FILE "$line\n";
close(FILE);
}
# Create and empty the temporary directory
my ($tmpdir) = (tmpdir(1));
# Store the directory name
write_line("$tmpdir/lastdir", shift(@ARGV));
+757
View File
@@ -0,0 +1,757 @@
#!/usr/bin/perl -w
#
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Script to accumulate log messages for an entire tree and send them along
# with the diffs; deals correctly with all manner of branching (I hope)
#
# $Id: new_log_accum,v 1.1 2002-08-11 23:05:15 drevil Exp $
#
use strict;
use vars qw($MAILER $CVS $debug $boundary);
use MD5;
# Set this to the full path of a mailer that takes a list
# of email addresses as arguments...
$MAILER = "/usr/sbin/sendmail -oi -oeq";
# Set this to the path of the CVS binary responsible for this tree...
$CVS = "/usr/bin/cvs";
# Don't touch this; use the -d command line option
$debug = 0;
# This is initialized by build_mailheader()
$boundary = '';
use POSIX qw(setsid);
# We have to dissociate from our parent, so that the CVS commit can
# complete, before we try to extract the diffs
sub daemonize {
defined(my $pid = fork()) || die "Can't fork: $!";
exit(0)
if $pid;
setsid() || die "Can't start a new session: $!";
}
# Debugging output
sub debug (@) {
print STDERR @_
if ($debug);
}
# Constants used in the FSM below for parsing the log message
sub STATE_NONE { 0 }
sub STATE_MODIFIED { 1 }
sub STATE_ADDED { 2 }
sub STATE_REMOVED { 3 }
sub STATE_LOG1 { 4 }
sub STATE_LOG2 { 5 }
# This routine removes everything in a directory
sub clear_dir {
my ($dir) = @_;
my ($file);
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
while ($file = readdir(DIR)) {
next
if ($file eq "." || $file eq "..");
$file = "$dir/$file";
if (-d $file) {
# It's a directory, recurse into it, then delete it.
clear_dir($file);
rmdir($file);
} else {
# It's a file, delete it.
unlink($file);
}
}
closedir(DIR);
}
# This routine prepares a temporary directory, hopefully in a secure
# fashion; it uses the process group to make secondary programs be able
# to find it.
sub tmpdir (;$) {
my ($clear) = @_;
my ($pgrp, $own, $mode, $tmpdir);
$pgrp = getpgrp();
die "Don't run $0 setuid!"
unless ($< == $>);
# Decide on the directory name, using various environment variables
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
"/.#cvs.$pgrp";
# Doesn't exist, but we can't create it...
die "Can't create temporary directory $tmpdir: $!"
unless (-e $tmpdir || mkdir($tmpdir, 0700));
die "Temporary directory $tmpdir is not a directory"
unless (-d $tmpdir);
# Check ownership and permissions
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
unless ($own == $<);
die "Temporary directory $tmpdir group-writable"
if ($mode & 0020);
die "Temporary directory $tmpdir other-writable"
if ($mode & 0002);
# If we're supposed to clear the directory, do so...
clear_dir($tmpdir)
if ($clear);
return $tmpdir;
}
# Routine to remove the temporary directory when done
sub cleanup_dir ($) {
# If we're debugging, we may want to look at the contents...
return
if ($debug);
clear_dir($_[0]);
rmdir($_[0]);
}
# Retrieve a single line from a specified file
sub get_line ($) {
my ($fname) = @_;
open(FILE, "<$fname") || die "Cannot open file $fname for reading";
my $line = <FILE>;
close(FILE);
# Chomp off the \n
chomp $line;
return $line;
}
# Routine that only allows one value to be pushed on the array;
# implemented by making the first element of the array a hash-reference.
# When we add a new value, we also increment the count of an element in
# the hash with the key being the array value...
sub push_once (\@@) {
my ($array, @values) = @_;
# If the array is empty, create our hash ref
push @{$array}, {}
if (@{$array} == 0);
foreach my $value (@values) {
push @{$array}, $value
if (!exists($array->[0]{$value}));
$array->[0]{$value}++;
}
return @{$array} - 1;
}
# Filter //, /./, and remove leading ./ or / from filenames
sub fname_filter ($) {
my ($fname) = @_;
$fname =~ s,//,/,g;
$fname =~ s,/\./,/,g;
$fname =~ s,^\.?/,,g;
return $fname;
}
# Store file data in a temporary file
sub names_to_file ($$@) {
my ($fname, $dir, @names) = @_;
if (@names > 0) {
open(FILE, ">>$fname") || die "Cannot open file $fname for appending";
# Store the directory data
print FILE "D $dir\n";
foreach my $name (@names) {
# Mark record as a file...
print FILE "F ";
# Store the tag, if there is one...
print FILE "$name->{tag}"
if (defined($name->{tag}));
# Then store old revision, new revision, and file name
print FILE ":$name->{old}:$name->{new}:$name->{file}\n";
}
close(FILE);
}
}
# Retrieve file data from temporary file; updates branch tags with what it
# reads
sub file_to_names (\@$) {
my ($btags, $fname) = @_;
my ($dir) = (undef);
my (@names) = ();
debug "Reading file names from $fname...\n";
# We may not have, say, added a file in this subdirectory...
return ()
if (!-e $fname);
open(FILE, "<$fname");
while(<FILE>) {
chomp;
# Get record type...
my ($type, $data) = split(' ', $_, 2);
# ok, it's a directory, remember that...
if ($type eq "D") {
$dir = $data;
debug "Read directory $dir\n";
next;
}
debug "Read file $data\n";
# Get all the information about the file
my ($tag, $old, $new, $file) = split(':', $data);
# and store it all
push(@names, { tag => $tag, old => $old, new => $new, file => $file,
dir => $dir, name => fname_filter("$dir/$file") });
# Remember the tags...
push_once(@{$btags}, $tag)
if (defined($tag) && $tag ne "");
}
close(FILE);
return @names;
}
# Create a text-formatted list of names
sub name_to_list (\@@) {
my ($btags, @names) = @_;
my (@nlist, @nline) = ();
debug "Tags:", join(':', @{$btags}), "\n";
# We group them by tag
foreach my $tag ("", @{$btags}[1..$#{$btags}]) {
debug "Processing tag $tag...\n";
@nlist = ();
# Get a list of files by the tag...
foreach my $name (@names) {
debug "Processing $name->{file}...\n";
next
if ($name->{tag} ne $tag);
debug "Pushing $name->{name} on \@nlist...\n";
push(@nlist, $name->{name});
}
# If the tag is not the empty string, list the tag...
push(@nline, " Tag: $tag", " ")
if ($tag ne "");
# Now list each file name
foreach my $name (@nlist) {
# indent if we run past the end of line limit
push(@nline, " ")
if (@nline == 0 || ($nline[$#nline] ne " " &&
length($nline[$#nline]) + length($name) + 1 > 70));
# add the file name to the list
debug "Adding $name to \@nline...\n";
$nline[$#nline] .= " $name";
}
}
return @nline;
}
# write the log message to a temporary file
sub write_log ($@) {
my ($fname, @text) = @_;
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
print FILE join("\n", @text), "\n";
close(FILE);
}
# Build the header of the commit message: CVSROOT, module name, any
# branch tags, and the commit time
sub build_header ($@) {
my ($module, $subject, $mailto, @branch_tags) = @_;
my (@text, @mailto);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
my ($user, $dummy);
my ($digest);
($user, $dummy, $dummy, $dummy, $dummy, $dummy, $dummy) = getpwuid($<);
@mailto = @{$mailto};
# generate a unique boundary by calculating the md5sum of the
# current time
$digest = new MD5;
$digest->reset();
$digest->add(time() . rand());
$boundary = "----=MIME." . unpack("H*", $digest->digest());
# Build the mail header
push(@text, "From: $user");
push(@text, "To: " . join(' ', @mailto));
push(@text, "Subject: $subject");
push(@text, "MIME-Version: 1.0");
push(@text, "Content-Type: multipart/mixed; boundary=\"$boundary\"");
push(@text, "");
push(@text, "This is a multipart message as defined by RFC2049 (MIME)");
push(@text, "");
push(@text, "--$boundary");
push(@text, "Content-Type: text/plain; charset=us-ascii");
push(@text, "Content-Disposition: inline");
push(@text, "");
# Build the commit message header
push(@text, "Commiter : $user");
push(@text, "CVSROOT : $ENV{CVSROOT}");
push(@text, "Module : $module");
push(@text, "Branch tags: " . join(' ', @branch_tags[1..$#branch_tags]))
if (@branch_tags > 0);
push(@text, sprintf("Commit time: %04d-%02d-%02d %02d:%02d:%02d UTC",
$year + 1900, $mon + 1, $mday, $hour, $min, $sec));
return @text, "";
}
# Send the mail message
sub send_mail {
my ($mailto, $text) = @_;
my (@mailto, @text);
# I <heart> perl
@mailto = @{$mailto};
@text = @{$text};
open(MAIL, "|$MAILER " . join(' ', @mailto));
push(@text, "--$boundary--", "");
print MAIL join("\n", @text), "\n";
close(MAIL);
}
# Find the tmp directory
my ($tmpdir) = (tmpdir());
my (@mailto) = ();
my (@files) = ();
my (@path) = ();
my ($modname, $repdir, $dir) = (undef, undef, undef);
# Process command line arguments
while (@ARGV > 0) {
my ($arg) = (shift(@ARGV));
if ($arg eq '-d') {
# Turn on debugging
$debug++;
} elsif ($arg eq '-M') {
# Module name explicitly set -- XXX Not tested, use at your own risk
die "Argument for -M missing"
unless (@ARGV > 0);
$modname = shift(@ARGV);
} elsif ($arg eq '-m') {
# An address to mail the notification to
die "Argument for -m missing"
unless (@ARGV > 0);
push(@mailto, shift(@ARGV));
} else {
# the list of filenames passed by CVS--you *must* use %{sVv}!
die "Too many arguments!"
unless (@files == 0);
@files = split(" ", $arg);
}
}
die "Nobody to mail to"
unless (@mailto > 0);
die "No files to process"
unless (@files > 1);
# The repository directory
$repdir = shift(@files);
# break it appart...
@path = split("/", $repdir);
# Now we know the module name, if it wasn't explicitly set
$modname = $path[0]
unless (defined($modname));
# Figure out what our directory is
if (@path == 1) {
$dir = ".";
} else {
$dir = join("/", @path[1..$#path]);
}
# append a / to it...
$dir .= "/";
debug "module = $modname\n";
debug "dir = $dir\n";
debug "path = ", join(":", @path), "\n";
debug "files = ", join(":", @files), "\n";
debug "tmpdir = $tmpdir\n";
my (%fversions);
# Unless its a new directory or imported sources, create file records
unless (defined($files[1]) && defined($files[2]) &&
(($files[1] eq "New" && $files[2] eq "directory") ||
($files[1] eq "Imported" && $files[2] eq "sources"))) {
foreach my $fname (@files) {
# You *must* use %{sVv} in the call in loginfo!
die "Invalid filenames"
unless ($fname =~ /^(.*),([0-9.]+|NONE),([0-9.]+|NONE)$/);
$fversions{$1} = {
old => ($2 eq "NONE" ? "0" : $2),
new => ($3 eq "NONE" ? "0" : $3),
};
}
}
# process log message
my ($state, $tag) = (STATE_NONE, undef);
my (@modified, @added, @removed, @log, @branch_tags) = ();
while (<STDIN>) {
chomp;
debug "State $state, line:$_\n";
# Ignore empty space at the beginning of the log message
next
if ($state == STATE_LOG1 && /^\s*$/);
# We're done ignoring empty space
if ($state == STATE_LOG1) {
$state = STATE_LOG2;
}
if ($state == STATE_LOG2) {
# Don't modify the lines at all if we're processing the log message
push(@log, $_);
next;
} else {
# Strip out leading and trailing space
s/^\s*(.*?)\s*$/$1/;
}
if (/^Modified Files/) {
# Collect list of modified files
debug "State switching to STATE_MODIFIED\n";
$state = STATE_MODIFIED;
$tag = undef;
next;
} elsif (/^Added Files/) {
# Collect list of added files
debug "State switching to STATE_ADDED\n";
$state = STATE_ADDED;
$tag = undef;
next;
} elsif (/^Removed Files/) {
# Collect list of removed files
debug "State switching to STATE_REMOVED\n";
$state = STATE_REMOVED;
$tag = undef;
next;
} elsif (/^Log Message/) {
# Collect log message
debug "State switching to STATE_LOG1\n";
$state = STATE_LOG1;
$tag = undef;
next;
} elsif (/^Revision\/Branch/) {
# Parse old-style Revision/Branch field
debug "Found a branch tag\n";
/^[^:]+:\s*(.*)/;
push_once(@branch_tags, $1);
warn "Tag == $tag"
if (defined($tag));
next;
}
# Ignore the stuff at the top of the commit report
next
if ($state == STATE_NONE);
if (/^Tag:\s*(.*)$/) {
# Remember the tag
debug "Setting tag to $1\n";
$tag = $1;
next;
}
my (@tfiles) = ();
# Find the file in our command line list of files
foreach my $file (split) {
die "Nothing known about file $file!"
unless (exists($fversions{$file}));
push @tfiles, {
file => $file,
tag => $tag,
old => $fversions{$file}{old},
new => $fversions{$file}{new},
};
}
# Store the file list in the correct array
push(@modified, @tfiles)
if ($state == STATE_MODIFIED);
push(@added, @tfiles)
if ($state == STATE_ADDED);
push(@removed, @tfiles)
if ($state == STATE_REMOVED);
}
# Remove trailing blank lines from the log message
while (@log > 0 && $log[$#log] =~ /^\s*$/) {
pop(@log);
}
# If a new directory was added, we're done...
if (defined($files[1]) && defined($files[2]) &&
$files[1] eq "New" && $files[2] eq "directory") {
my (@text) = ();
# If there was a sticky tag for the directory, make it a branch tag
if ($log[$#log] =~ /^--> Using per-directory sticky tag \`(.*)\'$/) {
push_once(@branch_tags, $1);
pop(@log);
}
# Build the message...
push(@text, build_header($modname, "Module $modname: New directory $dir",
\@mailto, @branch_tags));
push(@text, "Log message:", "", @log);
# and send it (synchronously)
send_mail(\@mailto, \@text);
# Clean up after ourselves and exit.
cleanup_dir($tmpdir);
exit(0);
}
# If an import was done, we're done...
if (defined($files[1]) && defined($files[2]) &&
$files[1] eq "Imported" && $files[2] eq "sources") {
my (@text) = ();
# Build the message...
push(@text, build_header($modname, "Module $modname: Imported $dir",
\@mailto, @branch_tags));
push(@text, "Log message:", "", @log);
# and send it (synchronously)
send_mail(\@mailto, \@text);
# Clean up after ourselves and exit.
cleanup_dir($tmpdir);
exit(0);
}
debug "Searching for log file index...";
my ($i);
# Look for an empty log file or one that matches our current log message
for ($i = 0; ; $i++) {
my (@text);
# found one that doesn't exist...
last
if (!-e "$tmpdir/logfile.$i");
# read in the log file
open(FILE, "<$tmpdir/logfile.$i");
while (<FILE>) {
chomp;
push(@text, $_);
}
close(FILE);
# If the log file was empty, use it
last
if (@text == 0);
# If the log messages are identical, use that
last
if (join(' ', @log) eq join(' ', @text));
}
debug "$tmpdir/logfile.$i\n";
# Store modified, added, and removed file lists, along with the log message
names_to_file("$tmpdir/modified.$i", $dir, @modified);
names_to_file("$tmpdir/added.$i", $dir, @added);
names_to_file("$tmpdir/removed.$i", $dir, @removed);
write_log("$tmpdir/logfile.$i", @log);
# Now check to see if we're at the end of our rope
my ($lastdir) = (get_line("$tmpdir/lastdir"));
debug "Checking $ENV{CVSROOT}/$repdir against lastdir $lastdir\n";
# Nope, exit instead of sending a message
exit(0)
if ($lastdir ne "$ENV{CVSROOT}/$repdir");
debug "At last, we've reached the end\n";
# We have to daemonize and sleep so that there isn't any lock hanging
# around when we get to the cvs rdiff below...
daemonize();
sleep(10);
# Build the mail message...
my (@text) = ();
@files = ();
@branch_tags = ();
for ($i = 0; ; $i++) {
# No more log files
last
if (!-e "$tmpdir/logfile.$i");
# read and insert the log message
open(FILE, "<$tmpdir/logfile.$i");
push(@text, "Log message:", "");
while (<FILE>) {
chomp;
push(@text, $_);
}
push(@text, "");
close(FILE);
# read modified list and list all modified files if non-empty
@modified = file_to_names(@branch_tags, "$tmpdir/modified.$i");
push(@text, "Modified files:", name_to_list(@branch_tags, @modified), "")
if (@modified > 0);
# read added list and list all added files if non-empty
@added = file_to_names(@branch_tags, "$tmpdir/added.$i");
push(@text, "Added files:", name_to_list(@branch_tags, @added), "")
if (@added > 0);
# read removed list and list all removed files if non-empty
@removed = file_to_names(@branch_tags, "$tmpdir/removed.$i");
push(@text, "Removed files:", name_to_list(@branch_tags, @removed), "")
if (@removed > 0);
# remember all the files we looked at
push(@files, @modified, @added, @removed);
}
# Now that name_to_list has rebuilt our list of branch tags, we can build the
# header and prepend it to the message
unshift(@text, build_header($modname, "Module $modname: Change committed",
\@mailto, @branch_tags));
# sort the files out for our diff
@files = sort { $a->{name} cmp $b->{name} } @files;
my ($user, $filename);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
$user = getpwuid($<);
$filename = sprintf("%s.%04d%02d%02d.%02d%02d%02d.%s.diff", $modname,
$year + 1900, $mon + 1, $mday, $hour, $min, $sec, $user);
push(@text, "--$boundary");
push(@text, "Content-Type: text/plain; name=\"$filename\"");
push(@text, "Content-Disposition: attachment; filename=\"$filename\"");
push(@text, "Content-Transfer-Encoding: 8bit");
push(@text, "");
foreach my $file (@files) {
debug "Diffing file $file->{name}...\n";
# Run cvs rdiff, extracting a diff between the old version and the new
open(DIFF, "$CVS -Q rdiff -u -r $file->{old} -r $file->{new} " .
"$modname/$file->{name}|");
while (<DIFF>) {
chomp;
push(@text, $_);
}
close(DIFF);
}
# send the mail...
send_mail(\@mailto, \@text);
# and clean up after ourselves
cleanup_dir($tmpdir);
+12
View File
@@ -0,0 +1,12 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"
+9
View File
@@ -0,0 +1,9 @@
drevil:f76FWdDTUBG5c:fs2source
mysterial:f7nJUwoIhmSrg:fs2source
wmcoolmon:f7JRB.js9Q1sE:fs2source
inquisitor:f7BVkOvwjDlWk:fs2source
penguin:Jh.dOjaiO2jHk:fs2source
DTP:f7M92Z/6/uep.:fs2source
unknownplayer:f79BgAn.IzJs6:fs2source
phreak:f7WQyGiT/jzlM:fs2source
anonymous:oIKtWP1q6GDt6:fs2source
+13
View File
@@ -0,0 +1,13 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
+20
View File
@@ -0,0 +1,20 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
+21
View File
@@ -0,0 +1,21 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
+4
View File
@@ -0,0 +1,4 @@
drevil
inquisitor
mysterial
penguin
-1997
View File
File diff suppressed because it is too large. Load diff
-15
View File
@@ -1,15 +0,0 @@
Volition Copyright (applies to original FreeSpace2 source code
developed and released by Volition):
>Copyright (C) Volition, Inc. 1999. All rights reserved.
>
>All source code herein is the property of Volition, Inc. You may not
sell or otherwise commercially exploit the source or things you
created based on the source.
Modifications by members of the FreeSpace Source Code Project are
released under whatever terms the individual authors choose, but the
above notice continues to apply to all fs2_open code.
See [**Licensing**](https://github.com/scp-fs2open/fs2open.github.com/wiki/Licensing) for more information.
-3
View File
@@ -1,3 +0,0 @@
This file is required to keep autoconf/automake from complaining.
See the ChangeLog for what's new.
-11
View File
@@ -1,11 +0,0 @@
FreeSpace2 *S*ource *C*ode *P*roject
==
[![Travis-CI Build Status](https://travis-ci.org/scp-fs2open/fs2open.github.com.svg?branch=master)](https://travis-ci.org/scp-fs2open/fs2open.github.com)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/scp-fs2open/fs2open.github.com?branch=master&svg=true)](https://ci.appveyor.com/project/SirKnightly/fs2open-github-com/branch/master)
[![Coverity](https://img.shields.io/coverity/scan/870.svg)](https://scan.coverity.com/projects/870)
Building
--
Before you do anything, make sure you have updated your git submodules, either by running `git submodule update --init --recursive` or by cloning the repository with the `--recursive` flag.<br/>
The main instructions for building can be found at our github wiki, on the [Building](https://github.com/scp-fs2open/fs2open.github.com/wiki/Building) page.
-18
View File
@@ -1,18 +0,0 @@
#Updating Documentation
####The goal of this file is simply to offer a comprehensive checklist of things we must check when updating the documentation.
1. Changelog:
- Is [Changelog.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Changelog.md) up-to-date with the latest release?
- Is it in the proper [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format?
2. Build instructions:
- If a programmer who never built FSO before read the build instruction at [Readme.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Readme.md), would they manage to build FSO?
- Is the information in the file up-to-date regarding other matters (such as versions of tools mentioned, links to other guides, etc.)?
- Is the information in the [Building](https://github.com/scp-fs2open/fs2open.github.com/wiki/Building) article, and its sub-articles, still up-to-date?
3. Forums:
- Does the [Forum](https://www.hard-light.net/forums/index.php?board=50.0) contain enough clear information to help a new developer find their way into the up-to-date instructions?
- Is there anything that might mislead a new developer to stumble onto old tools, dead links and/or old versions of the project?
4. General documentation files:
- Is the information in the following files up-to-date?
- [About.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/About.md) (Should contain general information about FS, FS2, HLP, FSO and FSU)
- [Authors.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Authors.md) (Should contain information about the original developers, a way to see FSO's contributors, and special thanks to Volition and Dave Baranec)
- [Copying.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Copying.md) (Should contain Volition's Copyright terms and a way to check FSO's Licensing info)
-62
View File
@@ -1,62 +0,0 @@
version: 1.0.0.{build}
image: Visual Studio 2015
configuration:
- Debug
- Release
clone_depth: 10
environment:
matrix:
- BuildID: 0
CMAKE_GENERATOR: Visual Studio 14 2015
PlatformToolset: v140_xp
QT_DIR: C:\Qt\5.9\msvc2015
- BuildID: 1
CMAKE_GENERATOR: Visual Studio 14 2015 Win64
PlatformToolset: v140_xp
QT_DIR: C:\Qt\5.9\msvc2015_64
before_build:
- git submodule update --init --recursive
build_script:
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/build.ps1
test_script:
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/test.ps1
deploy:
- provider: GitHub
auth_token:
secure: h55Scpy+3vmo1Yb7WlSIGA4d9DRnsbzUYc2LYsQdByQHZHbqrqjBpicH0D2FFLEO
on:
ReleaseBuild: true # deploy on release push only
- provider: FTP
protocol: sftp
host: scp.indiegames.us
username:
secure: SFivQZfatqWHXK1ijYK3GQ==
password:
secure: q6Zk/412o1ri+NEya1dl1Q==
folder: public_html/builds/nightly/$(VersionName)
on:
NightlyBuild: true # deploy on nightly push only
- provider: FTP
protocol: sftp
host: porphyrion.feralhosting.com
username:
secure: 36+bVD8eJgI0BVbi7TZ4zQ==
password:
secure: CrzmDVca8AGG08iWPA1gOD4Ge06+wJ3rcBagBGclwYQ=
folder: www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly/$(VersionName)
on:
NightlyBuild: true # deploy on nightly push only
- provider: FTP
protocol: sftp
host: porphyrion.feralhosting.com
username:
secure: 36+bVD8eJgI0BVbi7TZ4zQ==
password:
secure: CrzmDVca8AGG08iWPA1gOD4Ge06+wJ3rcBagBGclwYQ=
folder: www/datacorder.porphyrion.feralhosting.com/public_html/builds/test/$(VersionName)
on:
TestBuild: true # deploy on test build push only
-164
View File
@@ -1,164 +0,0 @@
class BuildConfig {
[string]$Generator
[string]$PackageType
[string]$Toolset
[string]$SimdType
[string]$QtDir
[Bool]$SourcePackage
}
$NightlyConfigurations = @(
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
},
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$false;
}
)
$ReleaseConfigurations = @(
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$true;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015";
PackageType="Win32-AVX";
Toolset="v140_xp";
SimdType="AVX";
QtDir="C:\Qt\5.9\msvc2015";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64";
Toolset="v140_xp";
SimdType="SSE2";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
}
[BuildConfig]@{
Generator="Visual Studio 14 2015 Win64";
PackageType="Win64-AVX";
Toolset="v140_xp";
SimdType="AVX";
QtDir="C:\Qt\5.9\msvc2015_64";
SourcePackage=$false;
}
)
$BuildConfigurations = $null
# Default values
$ReleaseBuild = $false
$NightlyBuild = $false
$TestBuild = $false
# Set to true to test either the release or the nightly part of this script
$ReleaseTest = $false
$NightlyTest = $false
$TestBuildTest = $false
if ($ReleaseTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)"))) {
# Tag matches
$ReleaseBuild = $true
$PackageName = "fs2_open_$($matches[1])"
$BuildConfigurations = $ReleaseConfigurations
}
if ($NightlyTest -Or ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)"))) {
# Tag matches
$NightlyBuild = $true
$PackageName = "nightly_$($matches[1])"
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
$BuildConfigurations = $NightlyConfigurations
}
if ($TestBuildTest -Or ([System.Convert]::ToInt32($env:APPVEYOR_PULL_REQUEST_NUMBER) -le 0 -And ("$env:APPVEYOR_REPO_BRANCH" -match "^test\/(.*)"))) {
# Tag matches
$TestBuild = $true
$PackageName = "test_$($matches[1])"
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
$BuildConfigurations = $NightlyConfigurations
# Override the revision string so that the builds are named correctly
[System.IO.File]::WriteAllLines("$env:APPVEYOR_BUILD_FOLDER/version_override.cmake", "set(FSO_VERSION_REVISION_STR $env:VersionName)")
}
# Multiply by 2 so that we can add 0 or 1 for debug or release Configs
$buildID = [convert]::ToInt32($env:BuildID) * 2
if ($Env:Configuration -eq "Release") {
$buildID = $buildID + 1
}
$DeployBuild = $false
if ($ReleaseBuild -Or $NightlyBuild -Or $TestBuild) {
$DeployBuild = $true
}
Set-AppveyorBuildVariable 'ReleaseBuild' "$ReleaseBuild"
Set-AppveyorBuildVariable 'NightlyBuild' "$NightlyBuild"
Set-AppveyorBuildVariable 'TestBuild' "$TestBuild"
New-Item build -type directory
Set-Location -Path build
if ($DeployBuild) {
# Release build
if ($buildID -ge $BuildConfigurations.Length) {
# Not needed
exit 0
}
$buildConfig = $BuildConfigurations[$buildID]
if ($buildConfig.SourcePackage -eq $True) {
7z a -xr'!.git' "$($PackageName)-source-Win.zip" "$env:APPVEYOR_BUILD_FOLDER"
Push-AppveyorArtifact "$($PackageName)-source-Win.zip"
}
cmake -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER/../install" -DFSO_USE_SPEECH="ON" `
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS="$($buildConfig.SimdType)" `
-DQT5_INSTALL_ROOT="$($buildConfig.QtDir)" -DFSO_BUILD_QTFRED=ON `
-DFSO_INSTALL_DEBUG_FILES="ON" `
-G "$($buildConfig.Generator)" -T "$($buildConfig.Toolset)" ..
$Configs = @("Release", "FastDebug")
foreach ($config in $Configs) {
cmake --build . --config "$config" --target INSTALL -- /verbosity:minimal
if (! ($?)) {
Add-AppveyorMessage "A release build failed!"
exit 1
}
}
7z a -xr'!*.pdb' "$($PackageName)-builds-$($buildConfig.PackageType).zip" "$env:APPVEYOR_BUILD_FOLDER/../install/*"
Push-AppveyorArtifact "$($PackageName)-builds-$($buildConfig.PackageType).zip"
7z a "$($PackageName)-debug-$($buildConfig.PackageType).7z" "$env:APPVEYOR_BUILD_FOLDER/../install/*.pdb"
Push-AppveyorArtifact "$($PackageName)-debug-$($buildConfig.PackageType).7z"
} else {
cmake -DFSO_USE_SPEECH="ON" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="ON" -DFSO_BUILD_TESTS="ON" -DMSVC_SIMD_INSTRUCTIONS=SSE2 `
-DFSO_BUILD_QTFRED=ON -DQT5_INSTALL_ROOT="$env:QT_DIR" -DFSO_BUILD_FRED2="ON" `
-G "$Env:CMAKE_GENERATOR" -T "$Env:PlatformToolset" ..
cmake --build . --config "$Env:CONFIGURATION" -- /verbosity:minimal
if (! ($?)) {
exit 1
}
}
-13
View File
@@ -1,13 +0,0 @@
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild) -Or [System.Convert]::ToBoolean($env:TestBuild)) {
# Skip tests for deployment
exit 0
} else {
write "Running unit tests..."
# Run unit tests
&"$pwd\bin\$Env:CONFIGURATION\unittests.exe" --gtest_shuffle 2>&1
if (! ($?)) {
exit 1
}
}
-19
View File
@@ -1,19 +0,0 @@
{
"package": {
"subject": "scp-fs2open",
"repo": "FSO",
"name": "nightly"
},
"version": {
"name": "$VERSION_NAME"
},
"files": [
{
"includePattern": "/tmp/builds/(.*)",
"uploadPattern": "$1"
}
],
"publish": true
}
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env sh
set -ex
if [ "$NIGHTLY_BUILD" = true ]; then
echo "Generating bintray config..."
sed -e "s/\$VERSION_NAME/$VERSION_NAME/" ci/bintray.template.json > ci/bintray.json
fi
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env sh
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository -y "ppa:msulikowski/valgrind" # For fixing a bug with valgrind 3.11 which does not recognize the rdrand instruction
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository -y 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
sudo apt-get -yq update
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
# Nothing to do here
:
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
# Nothing to do here
:
fi
-50
View File
@@ -1,50 +0,0 @@
#!/usr/bin/env bash
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
mkdir -p /tmp/builds
if [ "$RELEASE_BUILD" = true ]; then
# Package the source code in release builds
PARENT_DIR="$(basename "$PWD")"
(cd .. && tar -czvf /tmp/builds/$PACKAGE_NAME-source-Unix.tar.gz --exclude-vcs "$PARENT_DIR")
fi
fi
mkdir -p build
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
export CXXFLAGS
export CFLAGS
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON $CMAKE_OPTIONS"
if [ "$BUILD_DEPLOYMENT" = true ]; then
for config in $BUILD_CONFIGS
do
mkdir -p $config
cd $config
eval $CMAKE -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX="/tmp/release/$config" \
-DFSO_BUILD_APPIMAGE=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_QTFRED=OFF ../..
cd ..
done
else
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=ON ..
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
if [ "$BUILD_DEPLOYMENT" = true ]; then
cmake -G "Xcode" -DFSO_FATAL_WARNINGS=ON -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_INSTALL_PREFIX="/tmp/release" ..
else
cmake -G "Xcode" $CMAKE_OPTIONS ..
fi
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
if [ "$CMAKE_GENERATOR" = "Ninja" ]; then
cmake -DFSO_USE_SPEECH="OFF" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DFSO_BUILD_FRED2="OFF" -G "$CMAKE_GENERATOR" ..
else
cmake -DFSO_USE_SPEECH="ON" -DFSO_FATAL_WARNINGS="ON" -DFSO_USE_VOICEREC="OFF" -DFSO_BUILD_TESTS="ON" \
-DMSVC_SIMD_INSTRUCTIONS=SSE2 -DFSO_BUILD_FRED2="ON" -G "$CMAKE_GENERATOR" -T "$CMAKE_TOOLSET" ..
fi
fi
-74
View File
@@ -1,74 +0,0 @@
#!/usr/bin/env sh
RELEASE_BUILD=false
NIGHTLY_BUILD=false
TEST_BUILD=false
BUILD_DEPLOYMENT=false
BUILD_CONFIGS="Release FastDebug"
VERSION_NAME=""
PACKAGE_NAME=""
RELEASE_PATTERN="^release_(.*)$"
NIGHTLY_PATTERN="^nightly_(.*)$"
TEST_BUILD_PATTERN="^test\/(.*)$"
# These are for testing
NIGHTLY_TEST=false
RELEASE_TEST=false
TEST_BUILD_TEST=false
if [ "$RELEASE_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $RELEASE_PATTERN ]]; then
echo "This is a release tag!";
RELEASE_BUILD=true;
PACKAGE_NAME="fs2_open_${BASH_REMATCH[1]}";
fi
if [ "$NIGHTLY_TEST" = true ] || [[ "$TRAVIS_TAG" =~ $NIGHTLY_PATTERN ]]; then
echo "This is a nightly tag!";
NIGHTLY_BUILD=true;
VERSION_NAME="${BASH_REMATCH[1]}";
PACKAGE_NAME="nightly_${BASH_REMATCH[1]}";
fi
if [ "$TEST_BUILD_TEST" = true ] || [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" =~ $TEST_BUILD_PATTERN ]]; then
echo "This is a test build branch!";
TEST_BUILD=true;
if [ "$TEST_BUILD_TEST" = true ]; then
VERSION_NAME="test";
PACKAGE_NAME="test_test";
else
VERSION_NAME="${BASH_REMATCH[1]}";
PACKAGE_NAME="test_${BASH_REMATCH[1]}";
fi
# Override the revision string so that the builds are named correctly
echo "set(FSO_VERSION_REVISION_STR $VERSION_NAME)" > "$TRAVIS_BUILD_DIR/version_override.cmake"
fi
if ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ] || [ "$TEST_BUILD" = true ]); then
BUILD_DEPLOYMENT=true;
fi
if [ "$BUILD_DEPLOYMENT" = true ]; then
if ([ "$TRAVIS_OS_NAME" = "linux" ] && (! [[ "$CC" =~ ^gcc-5.*$ ]])); then
echo "Skipping non-release compiler";
exit 0;
fi
if ([[ "$CONFIGURATION" == "Debug" ]]); then
echo "Skipping non-release configuration";
exit 0;
fi
if [ "$TRAVIS_OS_NAME" = "windows" ]; then
echo "Skipping non-release platform"
exit 0
fi
fi
export RELEASE_BUILD
export NIGHTLY_BUILD
export TEST_BUILD
export BUILD_DEPLOYMENT
export BUILD_CONFIGS
export VERSION_NAME
export PACKAGE_NAME
-268
View File
@@ -1,268 +0,0 @@
#!/usr/bin/env python
#
#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
r"""
ClangTidy Diff Checker
======================
This script reads input from a unified diff, runs clang-tidy on all changed
files and outputs clang-tidy warnings in changed lines only. This is useful to
detect clang-tidy regressions in the lines touched by a specific patch.
Example usage for git/svn users:
git diff -U0 HEAD^ | clang-tidy-diff.py -p1
svn diff --diff-cmd=diff -x-U0 | \
clang-tidy-diff.py -fix -checks=-*,modernize-use-override
"""
import argparse
import glob
import json
import multiprocessing
import os
import re
import shutil
import subprocess
import sys
import tempfile
import threading
import traceback
try:
import yaml
except ImportError:
yaml = None
is_py2 = sys.version[0] == '2'
if is_py2:
import Queue as queue
else:
import queue as queue
def run_tidy(task_queue, lock, timeout):
watchdog = None
while True:
command = task_queue.get()
try:
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if timeout is not None:
watchdog = threading.Timer(timeout, proc.kill)
watchdog.start()
stdout, stderr = proc.communicate()
with lock:
sys.stdout.write(stdout.decode('utf-8'))
sys.stdout.flush()
if stderr:
sys.stderr.write(stderr.decode('utf-8'))
sys.stderr.flush()
except Exception as e:
with lock:
sys.stderr.write('Failed: ' + str(e) + ': '.join(command) + '\n')
finally:
with lock:
if (not timeout is None) and (not watchdog is None):
if not watchdog.is_alive():
sys.stderr.write('Terminated by timeout: ' +
' '.join(command) + '\n')
watchdog.cancel()
task_queue.task_done()
def start_workers(max_tasks, tidy_caller, task_queue, lock, timeout):
for _ in range(max_tasks):
t = threading.Thread(target=tidy_caller, args=(task_queue, lock, timeout))
t.daemon = True
t.start()
def merge_replacement_files(tmpdir, mergefile):
"""Merge all replacement files in a directory into a single file"""
# The fixes suggested by clang-tidy >= 4.0.0 are given under
# the top level key 'Diagnostics' in the output yaml files
mergekey = "Diagnostics"
merged = []
for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')):
content = yaml.safe_load(open(replacefile, 'r'))
if not content:
continue # Skip empty files.
merged.extend(content.get(mergekey, []))
if merged:
# MainSourceFile: The key is required by the definition inside
# include/clang/Tooling/ReplacementsYaml.h, but the value
# is actually never used inside clang-apply-replacements,
# so we set it to '' here.
output = { 'MainSourceFile': '', mergekey: merged }
with open(mergefile, 'w') as out:
yaml.safe_dump(output, out)
else:
# Empty the file:
open(mergefile, 'w').close()
def main():
parser = argparse.ArgumentParser(description=
'Run clang-tidy against changed files, and '
'output diagnostics only for modified '
'lines.')
parser.add_argument('-clang-tidy-binary', metavar='PATH',
default='clang-tidy',
help='path to clang-tidy binary')
parser.add_argument('-p', metavar='NUM', default=0,
help='strip the smallest prefix containing P slashes')
parser.add_argument('-regex', metavar='PATTERN', default=None,
help='custom pattern selecting file paths to check '
'(case sensitive, overrides -iregex)')
parser.add_argument('-iregex', metavar='PATTERN', default=
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)',
help='custom pattern selecting file paths to check '
'(case insensitive, overridden by -regex)')
parser.add_argument('-j', type=int, default=1,
help='number of tidy instances to be run in parallel.')
parser.add_argument('-timeout', type=int, default=None,
help='timeout per each file in seconds.')
parser.add_argument('-fix', action='store_true', default=False,
help='apply suggested fixes')
parser.add_argument('-checks',
help='checks filter, when not specified, use clang-tidy '
'default',
default='')
parser.add_argument('-path', dest='build_path',
help='Path used to read a compile command database.')
if yaml:
parser.add_argument('-export-fixes', metavar='FILE', dest='export_fixes',
help='Create a yaml file to store suggested fixes in, '
'which can be applied with clang-apply-replacements.')
parser.add_argument('-extra-arg', dest='extra_arg',
action='append', default=[],
help='Additional argument to append to the compiler '
'command line.')
parser.add_argument('-extra-arg-before', dest='extra_arg_before',
action='append', default=[],
help='Additional argument to prepend to the compiler '
'command line.')
parser.add_argument('-quiet', action='store_true', default=False,
help='Run clang-tidy in quiet mode')
clang_tidy_args = []
argv = sys.argv[1:]
if '--' in argv:
clang_tidy_args.extend(argv[argv.index('--'):])
argv = argv[:argv.index('--')]
args = parser.parse_args(argv)
# Extract changed lines for each file.
filename = None
lines_by_file = {}
for line in sys.stdin:
match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\n\"]*)' % args.p, line)
if match:
filename = match.group(2)
if filename is None:
continue
if args.regex is not None:
if not re.match('^%s$' % args.regex, filename):
continue
else:
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
continue
match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
if match:
start_line = int(match.group(1))
line_count = 1
if match.group(3):
line_count = int(match.group(3))
if line_count == 0:
continue
end_line = start_line + line_count - 1
lines_by_file.setdefault(filename, []).append([start_line, end_line])
if not any(lines_by_file):
print("No relevant changes found.")
sys.exit(0)
max_task_count = args.j
if max_task_count == 0:
max_task_count = multiprocessing.cpu_count()
max_task_count = min(len(lines_by_file), max_task_count)
tmpdir = None
if yaml and args.export_fixes:
tmpdir = tempfile.mkdtemp()
# Tasks for clang-tidy.
task_queue = queue.Queue(max_task_count)
# A lock for console output.
lock = threading.Lock()
# Run a pool of clang-tidy workers.
start_workers(max_task_count, run_tidy, task_queue, lock, args.timeout)
# Form the common args list.
common_clang_tidy_args = []
if args.fix:
common_clang_tidy_args.append('-fix')
if args.checks != '':
common_clang_tidy_args.append('-checks=' + args.checks)
if args.quiet:
common_clang_tidy_args.append('-quiet')
if args.build_path is not None:
common_clang_tidy_args.append('-p=%s' % args.build_path)
for arg in args.extra_arg:
common_clang_tidy_args.append('-extra-arg=%s' % arg)
for arg in args.extra_arg_before:
common_clang_tidy_args.append('-extra-arg-before=%s' % arg)
for name in lines_by_file:
line_filter_json = json.dumps(
[{"name": name, "lines": lines_by_file[name]}],
separators=(',', ':'))
# Run clang-tidy on files containing changes.
command = [args.clang_tidy_binary]
command.append('-line-filter=' + line_filter_json)
if yaml and args.export_fixes:
# Get a temporary file. We immediately close the handle so clang-tidy can
# overwrite it.
(handle, tmp_name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir)
os.close(handle)
command.append('-export-fixes=' + tmp_name)
command.extend(common_clang_tidy_args)
command.append(name)
command.extend(clang_tidy_args)
task_queue.put(command)
# Wait for all threads to be done.
task_queue.join()
if yaml and args.export_fixes:
print('Writing fixes to ' + args.export_fixes + ' ...')
try:
merge_replacement_files(tmpdir, args.export_fixes)
except:
sys.stderr.write('Error exporting fixes.\n')
traceback.print_exc()
if tmpdir:
shutil.rmtree(tmpdir)
if __name__ == '__main__':
main()
-24
View File
@@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -e
if ! git rev-list $TRAVIS_COMMIT_RANGE 2>1 >/dev/null; then
echo "\$TRAVIS_COMMIT_RANGE ($TRAVIS_COMMIT_RANGE) is not valid for this build (probably caused by a rebase)."
exit 0
fi
cd "$TRAVIS_BUILD_DIR"
echo "Running clang-tidy on changed files"
git diff -U0 --no-color $TRAVIS_COMMIT_RANGE | \
$TRAVIS_BUILD_DIR/ci/travis/clang-tidy-diff.py -path "$TRAVIS_BUILD_DIR/build" -p1 \
-regex '(code|freespace2|qtfred|testsrc|build|tools)\/.*\.(cpp|h)' \
-clang-tidy-binary /usr/bin/clang-tidy-9 -j$(nproc) -quiet 2>/dev/null | \
tee clang-tidy-output.txt
if [[ -n $(grep "warning: " clang-tidy-output.txt) ]] || [[ -n $(grep "error: " clang-tidy-output.txt) ]]; then
echo "Errors or warnings were detected in the clang-tidy output!"
exit 1
else
echo -e "\033[1;32m\xE2\x9C\x93 passed:\033[0m clang-tidy test succeeded";
fi
-89
View File
@@ -1,89 +0,0 @@
#!/usr/bin/env bash
set -e
set -u
if [[ ! "$(curl -V)" == *"sftp"* ]]; then
# Before
echo "Before:"
curl -V
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -f ~/curl_cache/curl*.deb ]; then
cd ~/curl_cache
sudo dpkg -i libcurl3*.deb
sudo dpkg -i curl*.deb
else
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
mkdir /tmp/curl
cd /tmp/curl
sudo apt-get update
sudo apt-get install build-essential debhelper libssh2-1-dev libgnutls-dev libidn11-dev libkrb5-dev libldap2-dev libnss3-dev librtmp-dev libtool openssh-server quilt
apt-get source curl
sudo apt-get build-dep curl
cd curl-*
export DEB_BUILD_OPTIONS="nocheck"
sudo dpkg-buildpackage -uc -us -j"$(grep -c ^processor /proc/cpuinfo)"
cd ..
dpkg -l | grep curl
ls -al
if [ ! -d ~/curl_cache ]; then
mkdir ~/curl_cache
fi
cp libcurl3*.deb curl*.deb ~/curl_cache
sudo dpkg -i libcurl3*.deb
sudo dpkg -i curl*.deb
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew install libssh2
if [ -d ~/curl_cache/curl ]; then
cd ~/curl_cache/curl
sudo make install
else
mkdir /tmp/curl
cd /tmp/curl
curl -LO "https://curl.haxx.se/download/curl-7.64.0.tar.bz2"
tar -xjf curl-7.64.0.tar.bz2
cd curl-7.64.0
./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --with-libssh2 --with-darwinssl --without-ca-bundle --without-ca-path
make -j"$(sysctl hw.logicalcpu | cut -d " " -f 2)"
if [ ! -d ~/curl_cache ]; then
mkdir ~/curl_cache
fi
cp -a . ~/curl_cache/curl
sudo make install
fi
export PATH=/usr/local/bin:$PATH
fi
# After
echo "After:"
curl -V
fi
cd /tmp/builds
for file in *; do
if [ "$TEST_BUILD" = true ]; then
# Upload to datacorder
curl -k "sftp://porphyrion.feralhosting.com/www/datacorder.porphyrion.feralhosting.com/public_html/builds/test/$VERSION_NAME/" --user "$DATACORDER_USER:$DATACORDER_PASSWORD" -T "$file" --ftp-create-dirs
else
# Upload to indiegames
curl -k "sftp://scp.indiegames.us/~/public_html/builds/nightly/$VERSION_NAME/" --user "$INDIEGAMES_USER:$INDIEGAMES_PASSWORD" -T "$file" --ftp-create-dirs
# Upload to datacorder
curl -k "sftp://porphyrion.feralhosting.com/~/www/datacorder.porphyrion.feralhosting.com/public_html/builds/nightly/$VERSION_NAME/" --user "$DATACORDER_USER:$DATACORDER_PASSWORD" -T "$file" --ftp-create-dirs
fi
done
-47
View File
@@ -1,47 +0,0 @@
#!/usr/bin/env bash
set -ex
FILENAME=
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
if [ ! -d "$HOME/cmake-3.8/bin" ]; then
# If the cache does not currently contain CMake then download and install it
mkdir -p $HOME/cmake-3.8/
wget -O /tmp/cmake.tar.gz --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz
tar -xzf /tmp/cmake.tar.gz -C $HOME/cmake-3.8/ --strip-components=1
fi
export PATH=$HOME/cmake-3.8/bin:$PATH
cd $HOME
if [ "${BUILD_DEPLOYMENT}" = true ]; then
wget -O appimagetool -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" # (64-bit)
chmod a+x ./appimagetool
wget -O linuxdeployqt -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" # (64-bit)
chmod a+x ./linuxdeployqt
fi
sudo apt-get -yq install valgrind
if [[ "$CC" = "clang-9" ]]; then
sudo apt-get -yq install clang-9 clang-tidy-9
fi
if [[ "$CC" = "clang-4.0" ]]; then
# Fix a header bug present in ubuntu...
sudo ln -s /usr/include/libcxxabi/__cxxabi_config.h /usr/include/c++/v1/__cxxabi_config.h
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
gem install xcpretty
brew update
brew outdated cmake || brew upgrade cmake
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
choco install mingw ninja
fi
cmake --version
-68
View File
@@ -1,68 +0,0 @@
#!/usr/bin/env sh
set -ex
mkdir -p /tmp/builds
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
cd build
for config in $BUILD_CONFIGS
do
cd "$config"
# Compile all targets
ninja all
# Install Freespace2 targets
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/fso -DCOMPONENT=Unspecified -P cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/fso -DCOMPONENT=Freespace2 -P cmake_install.cmake
# We need to be a bit creative for determining the AppImage name since we don't want to hard-code the name
FILENAME="$(find /tmp/release/$config/fso/bin -name 'fs2_open_*' -type f -printf "%f\n").AppImage"
$HOME/appimagetool -n /tmp/release/$config/fso "/tmp/release/$config/fso/$FILENAME"
: <<'END'
# Install qtFRED targets
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/qtfred/usr -DCOMPONENT=Unspecified -P cmake_install.cmake
cmake -DCMAKE_INSTALL_PREFIX=/tmp/release/$config/qtfred/usr -DCOMPONENT=qtFRED -P cmake_install.cmake
PREV="$(pwd)"
cd /tmp/release/$config/qtfred
unset QTDIR; unset QT_PLUGIN_PATH; unset LD_LIBRARY_PATH
$HOME/linuxdeployqt usr/qtfred.desktop -bundle-non-qt-libs
# Move our AppRun script to the right location
mv usr/AppRun AppRun
echo "Embed newer libstdc++ for distros that don't come with it (ubuntu 14.04)";
mkdir -p usr/optional/; mkdir -p usr/optional/libstdc++/;
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./usr/optional/libstdc++/;
$HOME/appimagetool -n . "$(find /tmp/release/$config/qtfred/usr/bin -name 'qtfred_*' -type f -printf "%f\n").AppImage"
cd "$PREV"
END
cd ..
done
cp `find /tmp/release -name '*.AppImage' -print` /tmp/release
(cd /tmp/release && tar -cvzf /tmp/builds/$PACKAGE_NAME-builds-Linux.tar.gz *.AppImage)
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd build
for config in $BUILD_CONFIGS
do
cmake --build . --config "$config" --target install | tee build.log \
| xcpretty
XCODE_RET=${PIPESTATUS[0]}
if [ "$XCODE_RET" -ne "0" ]; then
tar -cvzf build.log.tar.gz build.log
curl --upload-file build.log.tar.gz "https://transfer.sh/build.log.tar.gz"
exit $XCODE_RET
fi
done
ls -al /tmp/release
(cd /tmp/release && tar -cvzf /tmp/builds/$PACKAGE_NAME-builds-MacOSX.tar.gz *)
fi
-30
View File
@@ -1,30 +0,0 @@
#!/usr/bin/env sh
set -e
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
ninja -k 20 all
if [ "$CONFIGURATION" = "Debug" ]; then
valgrind --leak-check=full --error-exitcode=1 --gen-suppressions=all \
--suppressions="$TRAVIS_BUILD_DIR/ci/travis/valgrind.supp" ./bin/unittests --gtest_shuffle
else
./bin/unittests --gtest_shuffle
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cmake --build . --config "$CONFIGURATION" | tee build.log | xcpretty
XCODE_RET=${PIPESTATUS[0]}
if [ "$XCODE_RET" -ne "0" ]; then
tar -cvzf build.log.tar.gz build.log
curl --upload-file build.log.tar.gz "https://transfer.sh/build.log.tar.gz"
exit $XCODE_RET
fi
elif [ "$TRAVIS_OS_NAME" = "windows" ]; then
if [ "$CMAKE_GENERATOR" = "Ninja" ]; then
cmake --build . --config "$CONFIGURATION"
else
cmake --build . --config "$CONFIGURATION" -- /verbosity:minimal
fi
fi
-164
View File
@@ -1,164 +0,0 @@
{
liblsan Invalid read
Memcheck:Addr8
obj:/usr/lib64/liblsan.so.0.0.0
obj:/usr/lib64/liblsan.so.0.0.0
obj:/usr/lib64/liblsan.so.0.0.0
obj:*
obj:*
obj:*
}
{
Travis memleak
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_dl_signal_error
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
obj:/usr/lib/x86_64-linux-gnu/libmirclient.so.7
fun:call_init.part.0
fun:call_init
fun:_dl_init
fun:dl_open_worker
fun:_dl_catch_error
}
{
CLang Lua unitialized value error
Memcheck:Cond
...
fun:luaH_get
fun:lua_rawget
fun:_ZN12_GLOBAL__N_117ade_index_handlerEP9lua_State
}
{
False-positive uninitialized variable warning
Memcheck:Cond
fun:_Z23cf_check_location_flagsjj
fun:_Z29cf_create_default_path_stringPcjiPKcbj
...
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:_Znwm
obj:*
obj:*
obj:*
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
fun:_Z7gr_initOSt10unique_ptrIN2os18GraphicsOperationsESt14default_deleteIS1_EEiiii
fun:_ZN4test13FSTestFixture5SetUpEv
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
fun:_ZN7testing4Test3RunEv
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:_Znwm
obj:*
obj:*
obj:*
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
fun:_Z7gr_initOSt10unique_ptrIN2os18GraphicsOperationsESt14default_deleteIS1_EEiiii
fun:_ZN4test13FSTestFixture5SetUpEv
fun:_ZN8FontTest5SetUpEv
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_Znwm
obj:*
obj:*
obj:*
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
fun:_Z7gr_initONSt3__110unique_ptrIN2os18GraphicsOperationsENS_14default_deleteIS2_EEEEiiii
fun:_ZN4test13FSTestFixture5SetUpEv
fun:_ZN8FontTest5SetUpEv
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_Znwm
obj:*
obj:*
obj:*
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
fun:_Z7gr_initONSt3__110unique_ptrIN2os18GraphicsOperationsENS_14default_deleteIS2_EEEEiiii
fun:_ZN4test13FSTestFixture5SetUpEv
fun:_ZN8FontTest5SetUpEv
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_Znwm
obj:*
obj:*
obj:*
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
obj:/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0
fun:_Z7gr_initONSt3__110unique_ptrIN2os18GraphicsOperationsENS_14default_deleteIS2_EEEEiiii
fun:_ZN4test13FSTestFixture5SetUpEv
fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_dl_signal_error
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
obj:*
obj:*
fun:call_init.part.0
fun:call_init
fun:_dl_init
fun:dl_open_worker
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_dl_signal_error
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
obj:*
obj:*
fun:call_init.part.0
fun:call_init
fun:_dl_init
fun:dl_open_worker
}
-6
View File
@@ -1,6 +0,0 @@
[Desktop Entry]
Type=Application
Name=FreeSpace Open
Exec=$<TARGET_FILE_NAME:Freespace2>
Icon=app_icon
Categories=Game;
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}"/lib:"$LD_LIBRARY_PATH"
exec "${HERE}"/bin/$<TARGET_FILE_NAME:Freespace2> $@
-17
View File
@@ -1,17 +0,0 @@
include(WriteCompilerDetectionHeader)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
set(CMAKE_CXX_STANDARD 11)
set(REQUIRED_CXX_FEATURES cxx_rvalue_references cxx_nullptr)
get_property(CMAKE_CXX_KNOWN_FEATURES GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
write_compiler_detection_header(
FILE "${GENERATED_SOURCE_DIR}/scp_compiler_detection.h"
PREFIX SCP
COMPILERS AppleClang Clang GNU MSVC
FEATURES ${CMAKE_CXX_KNOWN_FEATURES}
VERSION 3.2
)
-21
View File
@@ -1,21 +0,0 @@
SET(BINARY_DESTINATION "bin")
SET(LIBRAY_DESTINATION "lib")
configure_file("${CMAKE_CURRENT_LIST_DIR}/AppRun.in" "${CMAKE_CURRENT_BINARY_DIR}/AppRun.gen" @ONLY)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AppRun-$<CONFIG>"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/AppRun.gen")
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/AppRun-$<CONFIG>" DESTINATION "." RENAME "AppRun"
COMPONENT "Freespace2")
configure_file("${CMAKE_CURRENT_LIST_DIR}/AppImage.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/AppImage.desktop.gen" @ONLY)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AppImage-$<CONFIG>.desktop"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/AppImage.desktop.gen")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AppImage-$<CONFIG>.desktop" DESTINATION "." RENAME "fso.desktop"
COMPONENT "Freespace2")
install(FILES "${CMAKE_SOURCE_DIR}/freespace2/resources/app_icon.png" DESTINATION "."
COMPONENT "Freespace2")
-37
View File
@@ -1,37 +0,0 @@
option(ENABLE_CLANG_TIDY "Enable source code checking using clang-tidy" OFF)
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy"
DOC "Path to clang-tidy executable"
)
function(enable_clang_tidy target)
# Not enabled in this configuration
endfunction()
if(NOT ENABLE_CLANG_TIDY)
return()
endif()
if(NOT EXISTS "${CLANG_TIDY_EXE}")
message(SEND_ERROR "clang-tidy: Could not find clang-tidy executable (value of variable is \"${CLANG_TIDY_EXE}\".")
return()
endif()
if(CMAKE_VERSION VERSION_LESS "3.6.0")
message(SEND_ERROR "Clang-tidy support requires CMake 3.6")
return()
endif()
message(STATUS "clang-tidy: Using \"${CLANG_TIDY_EXE}\"")
function(enable_clang_tidy target)
SET(TIDY_OPTIONS "${CLANG_TIDY_EXE}")
if(FSO_FATAL_WARNINGS)
set(TIDY_OPTIONS "${TIDY_OPTIONS};-warnings-as-errors=*")
endif()
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY "${TIDY_OPTIONS}")
endfunction()
-59
View File
@@ -1,59 +0,0 @@
// Code snippet from http://stackoverflow.com/a/7495023
#ifdef _WIN32
#include <intrin.h>
// Windows
#define cpuid __cpuid
#else
// GCC Inline Assembly
void cpuid(int CPUInfo[4],int InfoType){
__asm__ __volatile__ (
"cpuid":
"=a" (CPUInfo[0]),
"=b" (CPUInfo[1]),
"=c" (CPUInfo[2]),
"=d" (CPUInfo[3]) :
"a" (InfoType)
);
}
#endif
#include <iostream>
int main( int argc, char* argv[] )
{
int SSE = false;
int SSE2 = false;
int AVX = false;
int AVX2 = false;
int info[4];
cpuid(info, 0);
int nIds = info[0];
// Detect Instruction Set
if (nIds >= 1){
cpuid(info,0x00000001);
SSE = (info[3] & ((int)1 << 25)) != 0;
SSE2 = (info[3] & ((int)1 << 26)) != 0;
AVX = (info[2] & ((int)1 << 28)) != 0;
}
if (nIds >= 7){
cpuid(info,0x00000007);
AVX2 = (info[1] & ((int)1 << 5)) != 0;
}
if (AVX2)
std::cout << "AVX2";
else if(AVX)
std::cout << "AVX";
else if(SSE2)
std::cout << "SSE2";
else if(SSE)
std::cout << "SSE";
return 0;
}
-26
View File
@@ -1,26 +0,0 @@
# Sample toolchain file for building for Windows from a Linux system.
#
# Typical usage:
# *) install cross compiler: `sudo apt-get install mingw-w64 g++-mingw-w64`
# *) cd build
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-Ubuntu-mingw64.cmake ..
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
# cross compilers to use for C and C++
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
# target environment on the build host system
# set 1st to dir with the cross compiler's C/C++ headers/libs
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
# modify default behavior of FIND_XXX() commands to
# search for headers/libs in the target environment and
# don't search for programs in the build host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-154
View File
@@ -1,154 +0,0 @@
# ------------------------- Begin Generic CMake Variable Logging ------------------
# /* C++ comment style not allowed */
# if you are building in-source, this is the same as CMAKE_SOURCE_DIR, otherwise
# this is the top level directory of your build tree
MESSAGE( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
# if you are building in-source, this is the same as CMAKE_CURRENT_SOURCE_DIR, otherwise this
# is the directory where the compiled or generated files from the current CMakeLists.txt will go to
MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} )
# this is the directory, from which cmake was started, i.e. the top level source directory
MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
# this is the directory where the currently processed CMakeLists.txt is located in
MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
# contains the full path to the top level directory of your build tree
MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} )
MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} )
# contains the full path to the root of your project source directory,
# i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
# set this variable to specify a common place where CMake should put all executable files
# (instead of CMAKE_CURRENT_BINARY_DIR)
MESSAGE( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )
# set this variable to specify a common place where CMake should put all libraries
# (instead of CMAKE_CURRENT_BINARY_DIR)
MESSAGE( STATUS "LIBRARY_OUTPUT_PATH: " ${LIBRARY_OUTPUT_PATH} )
# tell CMake to search first in directories listed in CMAKE_MODULE_PATH
# when you use FIND_PACKAGE() or INCLUDE()
MESSAGE( STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH} )
# this is the complete path of the cmake which runs currently (e.g. /usr/local/bin/cmake)
MESSAGE( STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND} )
# this is the CMake installation directory
MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} )
# this is the filename including the complete path of the file where this variable is used.
MESSAGE( STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE} )
# this is linenumber where the variable is used
MESSAGE( STATUS "CMAKE_CURRENT_LIST_LINE: " ${CMAKE_CURRENT_LIST_LINE} )
# this is used when searching for include files e.g. using the FIND_PATH() command.
MESSAGE( STATUS "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} )
# this is used when searching for libraries e.g. using the FIND_LIBRARY() command.
MESSAGE( STATUS "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} )
# the complete system name, e.g. "Linux-2.4.22", "FreeBSD-5.4-RELEASE" or "Windows 5.1"
MESSAGE( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )
# the short system name, e.g. "Linux", "FreeBSD" or "Windows"
MESSAGE( STATUS "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME} )
# only the version part of CMAKE_SYSTEM
MESSAGE( STATUS "CMAKE_SYSTEM_VERSION: " ${CMAKE_SYSTEM_VERSION} )
# the processor name (e.g. "Intel(R) Pentium(R) M processor 2.00GHz")
MESSAGE( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
# is TRUE on all UNIX-like OS's, including Apple OS X and CygWin
MESSAGE( STATUS "UNIX: " ${UNIX} )
# is TRUE on Windows, including CygWin
MESSAGE( STATUS "WIN32: " ${WIN32} )
# is TRUE on Apple OS X
MESSAGE( STATUS "APPLE: " ${APPLE} )
# is TRUE when using the MinGW compiler in Windows
MESSAGE( STATUS "MINGW: " ${MINGW} )
# is TRUE on Windows when using the CygWin version of cmake
MESSAGE( STATUS "CYGWIN: " ${CYGWIN} )
# is TRUE on Windows when using a Borland compiler
MESSAGE( STATUS "BORLAND: " ${BORLAND} )
# Microsoft compiler
MESSAGE( STATUS "MSVC: " ${MSVC} )
MESSAGE( STATUS "MSVC_IDE: " ${MSVC_IDE} )
MESSAGE( STATUS "MSVC60: " ${MSVC60} )
MESSAGE( STATUS "MSVC70: " ${MSVC70} )
MESSAGE( STATUS "MSVC71: " ${MSVC71} )
MESSAGE( STATUS "MSVC80: " ${MSVC80} )
MESSAGE( STATUS "CMAKE_COMPILER_2005: " ${CMAKE_COMPILER_2005} )
# set this to true if you don't want to rebuild the object files if the rules have changed,
# but not the actual source files or headers (e.g. if you changed the some compiler switches)
MESSAGE( STATUS "CMAKE_SKIP_RULE_DEPENDENCY: " ${CMAKE_SKIP_RULE_DEPENDENCY} )
# since CMake 2.1 the install rule depends on all, i.e. everything will be built before installing.
# If you don't like this, set this one to true.
MESSAGE( STATUS "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY: " ${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY} )
# If set, runtime paths are not added when using shared libraries. Default it is set to OFF
MESSAGE( STATUS "CMAKE_SKIP_RPATH: " ${CMAKE_SKIP_RPATH} )
# set this to true if you are using makefiles and want to see the full compile and link
# commands instead of only the shortened ones
MESSAGE( STATUS "CMAKE_VERBOSE_MAKEFILE: " ${CMAKE_VERBOSE_MAKEFILE} )
# this will cause CMake to not put in the rules that re-run CMake. This might be useful if
# you want to use the generated build files on another machine.
MESSAGE( STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION} )
# A simple way to get switches to the compiler is to use ADD_DEFINITIONS().
# But there are also two variables exactly for this purpose:
# the compiler flags for compiling C sources
MESSAGE( STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS} )
# the compiler flags for compiling C++ sources
MESSAGE( STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS} )
# Choose the type of build. Example: SET(CMAKE_BUILD_TYPE Debug)
MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
# if this is set to ON, then all libraries are built as shared libraries by default.
MESSAGE( STATUS "BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS} )
# the compiler used for C files
MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
# the compiler used for C++ files
MESSAGE( STATUS "CMAKE_CXX_COMPILER: " ${CMAKE_CXX_COMPILER} )
# if the compiler is a variant of gcc, this should be set to 1
MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCC: " ${CMAKE_COMPILER_IS_GNUCC} )
# if the compiler is a variant of g++, this should be set to 1
MESSAGE( STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX} )
# the tools for creating libraries
MESSAGE( STATUS "CMAKE_AR: " ${CMAKE_AR} )
MESSAGE( STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB} )
#
#MESSAGE( STATUS ": " ${} )
# ------------------------- End of Generic CMake Variable Logging ------------------
-37
View File
@@ -1,37 +0,0 @@
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
SET(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/documentation/doxygen")
FILE(MAKE_DIRECTORY "${OUTPUT_DIR}")
FILE(TO_NATIVE_PATH ${OUTPUT_DIR} OUTPUT_DIR)
SET(OUTPUT_DIR \"${OUTPUT_DIR}\")
SET(INPUTS "${CMAKE_CURRENT_SOURCE_DIR}/code" "${CMAKE_CURRENT_SOURCE_DIR}/freespace2" "${CMAKE_CURRENT_SOURCE_DIR}/fred2" "${CMAKE_CURRENT_SOURCE_DIR}/wxfred2")
SET(INPUT_DIRS)
FOREACH(DIR IN LISTS INPUTS)
FILE(TO_NATIVE_PATH ${DIR} native_dir)
LIST(APPEND INPUT_DIRS \"${native_dir}\")
ENDFOREACH(DIR)
STRING(REPLACE ";" " " INPUT_DIRS "${INPUT_DIRS}")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/fs2open.Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/fs2open.Doxyfile
@ONLY)
add_custom_target(doxygen
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/fs2open.Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
set_target_properties(doxygen
PROPERTIES
FOLDER "Documentation"
EXCLUDE_FROM_ALL ON
EXCLUDE_FROM_DEFAULT_BUILD ON
)
endif(DOXYGEN_FOUND)
-4054
View File
File diff suppressed because it is too large. Load diff
-16
View File
@@ -1,16 +0,0 @@
include(CheckIncludeFile)
add_library(speech INTERFACE)
if (WIN32)
CHECK_INCLUDE_FILE_CXX("sapi.h" HAVE_SAPI_H)
if (NOT HAVE_SAPI_H)
message(SEND_ERROR "sapi.h could not be found on your platform. Please disable speech support.")
endif()
else()
message(SEND_ERROR "Text to Speech is not supported on this platform!")
endif()
target_compile_definitions(speech INTERFACE -DFS2_SPEECH)
-9
View File
@@ -1,9 +0,0 @@
#ifndef __FREDRC_H
#define __FREDRC_H
#define ABOUT_LINE_1 "FRED2_OPEN - FreeSpace Editor, Version @FSO_PRODUCT_VERSION_STRING@ OpenGL"
#define MAINFRAME_CONTENTS "FRED2_OPEN @FSO_PRODUCT_VERSION_STRING@ - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
#endif // __FREDRC_H
-7
View File
@@ -1,7 +0,0 @@
include(Cxx11)
include(platformChecks)
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/project.h.in ${GENERATED_SOURCE_DIR}/project.h)
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/fred_rc.h.in ${GENERATED_SOURCE_DIR}/fred_rc.h)
-9
View File
@@ -1,9 +0,0 @@
SET(BINARY_DESTINATION ".")
SET(LIBRAY_DESTINATION "${BINARY_DESTINATION}")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(IS_64BIT TRUE)
else()
set(IS_64BIT FALSE)
endif()
-8
View File
@@ -1,8 +0,0 @@
SET(CODE_HEADERS ${CMAKE_SOURCE_DIR}/code)
SET(FREESPACE_HEADERS ${CMAKE_SOURCE_DIR}/freespace2)
SET(FRED_HEADERS ${CMAKE_SOURCE_DIR}/fred2)
SET(WXFRED_HEADERS ${CMAKE_SOURCE_DIR}/wxfred2)
-14
View File
@@ -1,14 +0,0 @@
SET(CPACK_PACKAGE_VERSION_MAJOR ${FSO_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${FSO_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${FSO_VERSION_BUILD})
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${FSO_PROJECT_DESCRIPTION})
IF(WIN32)
SET(CPACK_NSIS_MUI_ICON ${FSO_INSTALLER_ICON})
set(CPACK_NSIS_MENU_LINKS "http://www.hard-light.net/" "FreeSpace Community")
ENDIF(WIN32)
include(CPack)
-34
View File
@@ -1,34 +0,0 @@
MESSAGE(STATUS "Doing Mac OSX specific things...")
target_compile_definitions(platform INTERFACE APPLE_APP)
SET(EXE_GUI_TYPE MACOSX_BUNDLE)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
if (NOT COCOA_LIBRARY)
message(FATAL_ERROR "Couldn't find Cocoa!")
endif()
target_link_libraries(platform INTERFACE ${COCOA_LIBRARY})
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
SET(CMAKE_SKIP_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH @loader_path/../Frameworks/)
# Set the path where library dependencies are copied to
SET(LIBRAY_DESTINATION "../Frameworks")
set(PLATFORM_MAC TRUE CACHE INTERNAL "" FORCE)
# Generate and don't strip debug symbols
# These settings don't seem to generate debug symbols for code and Freespace2
# so those settings are set manually in code and Freespace2's CMakeLists.txt files
set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES")
set(CMAKE_XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO")
set(CMAKE_XCODE_ATTRIBUTE_STRIP_INSTALLED_PRODUCT "NO")
set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "NO")
# Generate .dSYM file
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")
-10
View File
@@ -1,10 +0,0 @@
target_compile_definitions(platform INTERFACE SCP_BSD)
find_library(EXECINFO_LIB execinfo)
if (NOT EXECINFO_LIB)
message(FATAL_ERROR "Couldn't find libexecinfo! Please install it and rerun the configuration.")
else()
target_link_libraries(platform INTERFACE "${EXECINFO_LIB}")
endif()
-18
View File
@@ -1,18 +0,0 @@
target_compile_definitions(platform INTERFACE SCP_SOLARIS)
find_library(SOCKET_LIB socket)
if (NOT SOCKET_LIB)
message(FATAL_ERROR "Couldn't find libsocket! Please install it and rerun the configuration.")
else()
target_link_libraries(platform INTERFACE "${SOCKET_LIB}")
endif()
find_library(NSL_LIB nsl)
if (NOT NSL_LIB)
message(FATAL_ERROR "Couldn't find libnsl! Please install it and rerun the configuration.")
else()
target_link_libraries(platform INTERFACE "${NSL_LIB}")
endif()
-13
View File
@@ -1,13 +0,0 @@
INCLUDE(util)
MESSAGE(STATUS "Configuring UNIX specific things and stuff...")
target_compile_definitions(platform INTERFACE SCP_UNIX USE_OPENAL _REENTRANT)
# Set RPATH
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
set(PLATFORM_UNIX TRUE CACHE INTERNAL "" FORCE)
-27
View File
@@ -1,27 +0,0 @@
MESSAGE(STATUS "Configuring Windows specific things and stuff...")
SET(WIN32_LIBS
comctl32
msacm32
odbc32
odbccp32
vfw32
winmm
ws2_32
psapi
)
IF (MINGW)
SET(WIN32_LIBS ${WIN32_LIBS} mingw32)
ENDIF (MINGW)
target_link_libraries(platform INTERFACE ${WIN32_LIBS})
target_compile_definitions(platform INTERFACE WIN32 USE_OPENAL _WINDOWS)
# Specify minimum Windows version for the headers (currently this is XP)
target_compile_definitions(platform INTERFACE NTDDI_VERSION=0x05010000 _WIN32_WINNT=0x0501)
SET(EXE_GUI_TYPE WIN32)
set(PLATFORM_WINDOWS TRUE CACHE INTERNAL "" FORCE)
-48
View File
@@ -1,48 +0,0 @@
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckLibraryExists)
include(CheckPrototypeDefinition)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckCXXSymbolExists)
include(CheckTypeSize)
CHECK_INCLUDE_FILE("execinfo.h" SCP_HAVE_EXECINFO_H)
CHECK_INCLUDE_FILE_CXX("cxxabi.h" SCP_HAVE_CXXAPI_H)
CHECK_TYPE_SIZE("max_align_t" MAX_ALIGN_T)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_REQUIRED_FLAGS "-std=c++11") # required for g++ <= 5
endif()
set(CMAKE_EXTRA_INCLUDE_FILES "cstddef")
CHECK_TYPE_SIZE("std::max_align_t" STD_MAX_ALIGN_T LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES "type_traits")
CHECK_TYPE_SIZE("std::is_trivially_copyable<int>" STD_IS_TRIVIALLY_COPYABLE LANGUAGE CXX)
set(CMAKE_EXTRA_INCLUDE_FILES)
CHECK_TYPE_SIZE("char32_t" CHAR32_T LANGUAGE CXX)
CHECK_TYPE_SIZE("U'b'" UNICODE_CHAR_LITERAL LANGUAGE CXX)
set(CMAKE_REQUIRED_FLAGS)
CHECK_FUNCTION_EXISTS(strcasecmp SCP_HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS(strncasecmp SCP_HAVE_STRNCASECMP)
CHECK_FUNCTION_EXISTS(_stricmp SCP_HAVE__STRICMP)
CHECK_FUNCTION_EXISTS(_strnicmp SCP_HAVE__STRNICMP)
CHECK_FUNCTION_EXISTS(strlwr SCP_HAVE_STRLWR)
CHECK_INCLUDE_FILE("strings.h" SCP_HAVE_STRINGS_H)
check_symbol_exists(snprintf "stdio.h" SCP_HAVE_SNPRINTF)
check_symbol_exists(_snprintf "stdio.h" SCP_HAVE__SNPRINTF)
set(PLATFORM_CHECK_HEADER "${GENERATED_SOURCE_DIR}/platformChecks.h")
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/platformChecks.h.in "${PLATFORM_CHECK_HEADER}")
-30
View File
@@ -1,30 +0,0 @@
#ifndef __PLATFORM_CHECKS_H__
#define __PLATFORM_CHECKS_H__
#pragma once
#cmakedefine SCP_HAVE_EXECINFO_H
#cmakedefine SCP_HAVE_CXXAPI_H
#cmakedefine SCP_HAVE_MAX_ALIGN_T
#cmakedefine SCP_HAVE_STD_MAX_ALIGN_T
#cmakedefine01 HAVE_STD_IS_TRIVIALLY_COPYABLE
#cmakedefine01 IS_64BIT
#cmakedefine01 SCP_HAVE_STRCASECMP
#cmakedefine01 SCP_HAVE_STRNCASECMP
#cmakedefine01 SCP_HAVE__STRICMP
#cmakedefine01 SCP_HAVE__STRNICMP
#cmakedefine01 SCP_HAVE_STRLWR
#cmakedefine01 SCP_HAVE_STRINGS_H
#cmakedefine01 HAVE_CHAR32_T
#cmakedefine01 HAVE_UNICODE_CHAR_LITERAL
#cmakedefine01 SCP_HAVE_SNPRINTF
#cmakedefine01 SCP_HAVE__SNPRINTF
#endif // __PLATFORM_CHECKS_H__
-29
View File
@@ -1,29 +0,0 @@
add_library(platform INTERFACE)
IF(FSO_CMAKE_DEBUG)
INCLUDE(debug-vars)
ENDIF(FSO_CMAKE_DEBUG)
set(PLATFORM_WINDOWS FALSE CACHE INTERNAL "" FORCE)
set(PLATFORM_UNIX FALSE CACHE INTERNAL "" FORCE)
set(PLATFORM_LINUX FALSE CACHE INTERNAL "" FORCE)
set(PLATFORM_MAC FALSE CACHE INTERNAL "" FORCE)
IF(WIN32)
INCLUDE(platform-win32)
ELSEIF(UNIX)
INCLUDE(platform-unix)
IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
INCLUDE(platform-freebsd)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
INCLUDE(platform-solaris)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(platform-darwin)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(PLATFORM_LINUX TRUE CACHE INTERNAL "" FORCE)
ENDIF()
ELSE(WIN32)
MESSAGE(STATUS "This platform is not supported, good luck!")
ENDIF(WIN32)
-17
View File
@@ -1,17 +0,0 @@
#ifndef __PROJECT_H
#define __PROJECT_H
#define FS_VERSION_MAJOR @FSO_VERSION_MAJOR@
#define FS_VERSION_MINOR @FSO_VERSION_MINOR@
#define FS_VERSION_BUILD @FSO_VERSION_BUILD@
#define FS_VERSION_REVIS @FSO_VERSION_REVISION@
#define FS_VERSION_REVIS_STR "@FSO_VERSION_REVISION_STR@"
#define FS_VERSION_HAS_REVIS @FSO_VERSION_HAS_REVISION@
#define FS_VERSION_FULL "@FSO_FULL_VERSION_STRING@"
#define FS_PRODUCT_VERSION "@FSO_PRODUCT_VERSION_STRING@"
#endif // __PROJECT_H
-18
View File
@@ -1,18 +0,0 @@
MESSAGE(STATUS "Doing configuration specific to Apple Clang...")
# TODO: Actually add Mac specific flags here...
# Suppress specific warning
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops -fsigned-char -Wno-unknown-pragmas")
# Omit "conversion from string literal to 'char *' is deprecated" warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-char-subscripts")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
set(CMAKE_CXX_FLAGS_RELEASE "-Wno-unused-variable")
set(CMAKE_CXX_FLAGS_DEBUG "-Wextra -Wshadow -Wno-unused-parameter")
-119
View File
@@ -1,119 +0,0 @@
# Clang
include(EnableExtraCompilerWarnings)
include(CheckCXXCompilerFlag)
MESSAGE(STATUS "Doing configuration specific to clang...")
option(CLANG_ENABLE_LEAK_CHECK "Enable -fsanitize=leak" OFF)
option(CLANG_ENABLE_ADDRESS_SANITIZER "Enable -fsanitize=address" OFF)
option(CLANG_USE_LIBCXX "Use libc++" OFF)
# These are the default values
set(C_BASE_FLAGS "-march=native -pipe")
set(CXX_BASE_FLAGS "-march=native -pipe")
# For C and C++, the values can be overwritten independently
if(DEFINED ENV{CXXFLAGS})
set(CXX_BASE_FLAGS $ENV{CXXFLAGS})
endif()
if(DEFINED ENV{CFLAGS})
set(C_BASE_FLAGS $ENV{CFLAGS})
endif()
if (CLANG_USE_LIBCXX)
set(CXX_BASE_FLAGS "${CXX_BASE_FLAGS} -stdlib=libc++")
endif()
# Initialize with an empty string to make sure we always get a clean start
set(COMPILER_FLAGS "")
# This is a slight hack since our flag setup is a bit more complicated
_enable_extra_compiler_warnings_flags()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
# Omit "argument unused during compilation" when clang is used with ccache.
if(${CMAKE_CXX_COMPILER} MATCHES "ccache")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Qunused-arguments")
endif()
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# Force color diagnostics for Ninja generator
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-color")
endif()
# Start with an empty list
set(SANITIZE_FLAGS)
if(CLANG_ENABLE_ADDRESS_SANITIZER)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=address")
CHECK_C_COMPILER_FLAG("-fsanitize=address" SUPPORTS_SANITIZE_ADDRESS)
if (SUPPORTS_SANITIZE_ADDRESS)
set(SANITIZE_FLAGS ${SANITIZE_FLAGS} "address")
endif()
endif()
if (CLANG_ENABLE_LEAK_CHECK)
check_linker_flag("-fsanitize=leak" SUPPORTS_FSANITIZE_LEAK)
if (SUPPORTS_FSANITIZE_LEAK)
set(SANITIZE_FLAGS ${SANITIZE_FLAGS} "leak")
endif()
endif()
string(REPLACE ";" "," SANITIZE_FLAGS "${SANITIZE_FLAGS}")
if (NOT "${SANITIZE_FLAGS}" STREQUAL "")
set(SANITIZE_FLAGS "-fsanitize=${SANITIZE_FLAGS}")
endif()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${SANITIZE_FLAGS}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wformat-security")
# Dear Clang, please tell us if a function does not return a value since that part of the standard is stupid!
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wreturn-type")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-char-subscripts")
check_cxx_compiler_flag(-Wshift-negative-value SUPPORTS_SHIFT_NEGATIVE_VALUE)
if(SUPPORTS_SHIFT_NEGATIVE_VALUE)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-shift-negative-value")
endif()
set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-parameter")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
# Always use the base flags and add our compiler flags at the bacl
set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_C_FLAGS "${C_BASE_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
set(CMAKE_C_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_EXE_LINKER_FLAGS "")
if (CLANG_USE_LIBCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
endif()
if (SANITIZE_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZE_FLAGS}")
endif()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -rdynamic")
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
target_compile_options(compiler INTERFACE "-Werror")
endif()
# Always define this to make sure that the fixed width format macros are available
target_compile_definitions(compiler INTERFACE __STDC_FORMAT_MACROS)
-142
View File
@@ -1,142 +0,0 @@
include(EnableExtraCompilerWarnings)
include(CheckCCompilerFlag)
include(util)
MESSAGE(STATUS "Doing configuration specific to gcc...")
option(GCC_ENABLE_LEAK_CHECK "Enable -fsanitize=leak" OFF)
option(GCC_ENABLE_ADDRESS_SANITIZER "Enable -fsanitize=address" OFF)
option(GCC_ENABLE_SANITIZE_UNDEFINED "Enable -fsanitize=undefined" OFF)
# These are the default values
set(C_BASE_FLAGS "-march=native -pipe")
set(CXX_BASE_FLAGS "-march=native -pipe")
# For C and C++, the values can be overwritten independently
if(DEFINED ENV{CFLAGS})
set(C_BASE_FLAGS $ENV{CFLAGS})
endif()
if(DEFINED ENV{CXXFLAGS})
set(CXX_BASE_FLAGS $ENV{CXXFLAGS})
endif()
# Initialize with an empty string to make sure we always get a clean start
set(COMPILER_FLAGS "")
# This is a slight hack since our flag setup is a bit more complicated
_enable_extra_compiler_warnings_flags()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
# Place each function and data in its own section so the linker can
# perform dead code elimination
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdata-sections -ffunction-sections")
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# Force color diagnostics for Ninja generator
CHECK_C_COMPILER_FLAG(-fdiagnostics-color SUPPORTS_DIAGNOSTIC_COLOR)
if(SUPPORTS_DIAGNOSTIC_COLOR)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-color")
endif()
endif()
# Start with an empty list
set(SANITIZE_FLAGS)
if(GCC_ENABLE_ADDRESS_SANITIZER)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=address")
CHECK_C_COMPILER_FLAG("-fsanitize=address" SUPPORTS_SANITIZE_ADDRESS)
if (SUPPORTS_SANITIZE_ADDRESS)
set(SANITIZE_FLAGS ${SANITIZE_FLAGS} "address")
endif()
endif()
if (GCC_ENABLE_LEAK_CHECK)
check_linker_flag("-fsanitize=leak" SUPPORTS_FSANITIZE_LEAK)
if (SUPPORTS_FSANITIZE_LEAK)
set(SANITIZE_FLAGS ${SANITIZE_FLAGS} "leak")
endif()
endif()
if (GCC_ENABLE_SANITIZE_UNDEFINED)
check_linker_flag("-fsanitize=undefined" SUPPORTS_SANITIZE_UNDEFINED)
if (SUPPORTS_SANITIZE_UNDEFINED)
set(SANITIZE_FLAGS ${SANITIZE_FLAGS} "undefined")
endif()
endif()
string(REPLACE ";" "," SANITIZE_FLAGS "${SANITIZE_FLAGS}")
if (NOT "${SANITIZE_FLAGS}" STREQUAL "")
set(SANITIZE_FLAGS "-fsanitize=${SANITIZE_FLAGS}")
endif()
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${SANITIZE_FLAGS}")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wformat-security")
# Dear GCC, please tell us if a function does not return a value since that part of the standard is stupid!
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wreturn-type")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-deprecated -Wno-char-subscripts")
# These two warnings cause a lot of false-positives in the FSO code base
check_cxx_compiler_flag(-Wstringop-truncation SUPPORTS_STRINGOP_TRUNCATION)
if(SUPPORTS_STRINGOP_TRUNCATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-stringop-truncation")
endif()
check_cxx_compiler_flag(-Wstringop-overflow SUPPORTS_STRINGOP_OVERFLOW)
if(SUPPORTS_STRINGOP_TRUNCATION)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-stringop-overflow")
endif()
set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered -Wno-unused-parameter")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
# Always use the base flags and add our compiler flags at the bacl
set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_C_FLAGS "${C_BASE_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
set(CMAKE_C_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
set(CMAKE_EXE_LINKER_FLAGS "")
IF (MINGW)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++ -Wl,--enable-auto-import")
target_compile_definitions(compiler INTERFACE __USE_MINGW_ANSI_STDIO=1)
ENDIF(MINGW)
if (SANITIZE_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZE_FLAGS}")
endif()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g")
IF(NOT MINGW)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
# Allow the linker to perform dead code elimination; this is considered
# experimental for COFF and PE formats and thus disabled for Windows builds
# (https://sourceware.org/binutils/docs/ld/Options.html)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
ENDIF(NOT MINGW)
IF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-zignore")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
target_compile_options(compiler INTERFACE "-Werror")
endif()
# Always define this to make sure that the fixed width format macros are available
target_compile_definitions(compiler INTERFACE __STDC_FORMAT_MACROS=1)
-145
View File
@@ -1,145 +0,0 @@
include(EnableExtraCompilerWarnings)
include(CheckCXXCompilerFlag)
include(util)
MESSAGE(STATUS "Doing configuration specific to visual studio...")
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug)
option(MSVC_USE_RUNTIME_DLL "Use the dynamically linked version of the runtime" OFF)
option(MSVC_RELEASE_DEBUGGING "Set options that allow to debug release builds" OFF)
MARK_AS_ADVANCED(FORCE MSVC_USE_RUNTIME_DLL)
MARK_AS_ADVANCED(FORCE MSVC_RELEASE_DEBUGGING)
# These are the warnings we disable
set(WARNING_FLAGS
/wd4100 # unreferenced formal parameters
/wd4127 # constant conditional (assert)
/wd4201 # nonstandard extension used: nameless struct/union (happens a lot in Windows include headers)
/wd4290 # C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
/wd4390 # empty control statement (triggered by nprintf and mprintf's inside of one-line if's, etc)
/wd4410 # illegal size for operand... ie... fxch st(1)
/wd4511 # copy constructor could not be generated (happens a lot in Windows include headers)
/wd4512 # assignment operator could not be generated (happens a lot in Windows include headers)
/wd4514 # unreferenced inline function removed
/wd4611 # _setjmp warning. Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us.
/wd4663 # C++ language change (template specification)
/wd4710 # is inline function not expanded (who cares?)
/wd4711 # tells us an inline function was expanded (who cares?)
/wd4786 # is identifier truncated to 255 characters (happens all the time in Microsoft #includes) -- Goober5000"
/wd4996 # deprecated strcpy, strcat, sprintf, etc. (from MSVC 2005) - taylor
/wd4311 # Disables warnings about casting pointer types to ints. The funny thing is these warnings can't be resolved, just disabled... - m!m
/wd4302 # Same as above - m!m
/wd4366 # The result of the unary '&' operator may be unaligned - m!m
/wd4592 # "symbol will be dynamically initialized" is being generated by a compiler bug, see https://stackoverflow.com/a/34027257 for an explanation - m!m
$<$<CONFIG:Release>:/wd4101> # In release mode there are unreferenced variables because debug needs them
/wd4995 # "'vsprintf': name was marked as #pragma deprecated" is being caused by our custom definition of vsprintf. I have no idea what causes this or how to fix it - m!m
/wd4723 # "potential divide by 0" is caused by some code that definitely will not divide by zero - m!m
/wd4121 # "alignment of a member was sensitive to packing" happens in a Windows header - m!m
)
target_compile_options(compiler INTERFACE ${WARNING_FLAGS})
# Base
set(CMAKE_C_FLAGS "/MP /GS- /analyze- /Zc:wchar_t /errorReport:prompt /Zc:forScope /Gd /EHsc /nologo /Zm200")
set(CMAKE_CXX_FLAGS "/MP /GS- /analyze- /Zc:wchar_t /errorReport:prompt /Zc:forScope /Gd /EHsc /nologo /Zm200")
set(CMAKE_EXE_LINKER_FLAGS "/MANIFEST /DYNAMICBASE:NO /SAFESEH:NO /ERRORREPORT:PROMPT /NOLOGO")
set(CMAKE_STATIC_LINKER_FLAGS "")
# Release
set(CMAKE_C_FLAGS_RELEASE "/GL /Gy- /Ox /Ot /Ob2 /fp:precise /GF /Oy /Oi /Zi /W3")
set(CMAKE_CXX_FLAGS_RELEASE "/GL /Gy- /Ox /Ot /Ob2 /fp:precise /GF /Oy /Oi /Zi /W3")
# /DEBUG:FULL so that we get PDBs which is needed for debugging crashdumps
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /LTCG /INCREMENTAL:NO /DEBUG:FULL")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
globally_enable_extra_compiler_warnings()
if (MSVC_RELEASE_DEBUGGING)
CHECK_CXX_COMPILER_FLAG("/Zo" MSVC_COMPILER_SUPPORTS_ARCH_ZO)
if (MSVC_COMPILER_SUPPORTS_ARCH_ZO)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zo")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zo")
endif()
endif()
IF(MSVC_USE_RUNTIME_DLL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
ELSE(MSVC_USE_RUNTIME_DLL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
ENDIF(MSVC_USE_RUNTIME_DLL)
# Debug
set(CMAKE_C_FLAGS_DEBUG "/W4 /Gy /Zi /Od /RTC1 /Gd /Oy-")
set(CMAKE_CXX_FLAGS_DEBUG "/W4 /Gy /Zi /Od /RTC1 /Gd /Oy-")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /INCREMENTAL:NO /MAPINFO:EXPORTS /NODEFAULTLIB:libcmt.lib")
IF(MSVC_USE_RUNTIME_DLL)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
ELSE(MSVC_USE_RUNTIME_DLL)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
ENDIF(MSVC_USE_RUNTIME_DLL)
INCLUDE(MSVCMultipleProcessCompile)
# Visual Studio supports compiling for multiple vector instruction sets
SET(POSSIBLE_INSTUCTION_SETS "" SSE SSE2 AVX AVX2)
if (NOT DEFINED MSVC_SIMD_INSTRUCTIONS)
detect_simd_instructions(MSVC_DETECTED_SIMD_INSTRUCTIONS)
SET(MSVC_SIMD_INSTRUCTIONS "${MSVC_DETECTED_SIMD_INSTRUCTIONS}" CACHE FILEPATH "The SIMD instructions which will be used, possible values are ${POSSIBLE_INSTUCTION_SETS}")
MARK_AS_ADVANCED(FORCE MSVC_SIMD_INSTRUCTIONS)
endif()
set(FSO_INSTRUCTION_SET ${MSVC_SIMD_INSTRUCTIONS})
LIST(FIND POSSIBLE_INSTUCTION_SETS "${MSVC_SIMD_INSTRUCTIONS}" SET_INDEX)
if (SET_INDEX LESS 0)
MESSAGE(STATUS "An invalid instruction set was specified, defaulting to no special compiler options.")
else()
IF (NOT SET_INDEX EQUAL 0)
SET(FOUND)
FOREACH(list_index RANGE ${SET_INDEX} 1)
list(GET POSSIBLE_INSTUCTION_SETS ${list_index} _simd_set)
CHECK_CXX_COMPILER_FLAG("/arch:${_simd_set}" COMPILER_SUPPORTS_ARCH_${_simd_set})
IF(COMPILER_SUPPORTS_ARCH_${_simd_set})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:${_simd_set}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:${_simd_set}")
SET(FOUND TRUE)
BREAK()
ENDIF()
ENDFOREACH(list_index)
IF(NOT FOUND)
# Don't set anything, it will likely not work
MESSAGE(STATUS "Your compiler does not support any optimization flags, defaulting to none")
ENDIF(NOT FOUND)
ELSE()
CHECK_CXX_COMPILER_FLAG("/arch:IA32" COMPILER_SUPPORTS_ARCH_IA32)
IF(COMPILER_SUPPORTS_ARCH_IA32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:IA32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:IA32")
ENDIF(COMPILER_SUPPORTS_ARCH_IA32)
ENDIF()
endif()
target_compile_definitions(compiler INTERFACE _CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS _SECURE_SCL=0 NOMINMAX
"$<$<CONFIG:FastDebug>:_ITERATOR_DEBUG_LEVEL=0>" _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
target_compile_options(compiler INTERFACE "/WX")
endif()
-33
View File
@@ -1,33 +0,0 @@
# File to execute compiler specific commands
add_library(compiler INTERFACE)
target_compile_definitions(compiler INTERFACE "$<$<CONFIG:Release>:NDEBUG>;$<$<CONFIG:Debug>:_DEBUG>;$<$<CONFIG:FastDebug>:_DEBUG>")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(toolchain-gcc)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
include(toolchain-msvc)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
include(toolchain-clang)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
include(toolchain-apple-clang)
ELSE("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
MESSAGE(STATUS "No special handling for this compiler present, good luck!")
ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Copy release settings to FastDebug
set(CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_FASTDEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_STATIC_LINKER_FLAGS_FASTDEBUG "${CMAKE_STATIC_LINKER_FLAGS_RELEASE}")
if (MSVC)
# Adjust runtime library
string(REPLACE "/MD" "/MDd" CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_FASTDEBUG}")
string(REPLACE "/MT" "/MTd" CMAKE_C_FLAGS_FASTDEBUG "${CMAKE_C_FLAGS_FASTDEBUG}")
string(REPLACE "/MD" "/MDd" CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_FASTDEBUG}")
string(REPLACE "/MT" "/MTd" CMAKE_CXX_FLAGS_FASTDEBUG "${CMAKE_CXX_FLAGS_FASTDEBUG}")
endif()
-237
View File
@@ -1,237 +0,0 @@
include(CheckCCompilerFlag)
FUNCTION(MAKE_CACHE_INTERNAL VARIABLE)
SET(${VARIABLE} ${${VARIABLE}} CACHE INTERNAL "Internal cache variable")
ENDFUNCTION(MAKE_CACHE_INTERNAL)
FUNCTION(ADD_IMPORTED_LIB NAME INCLUDES LIBS)
ADD_LIBRARY(${NAME} INTERFACE)
target_link_libraries(${NAME} INTERFACE "${LIBS}")
target_include_directories(${NAME} SYSTEM INTERFACE "${INCLUDES}")
ENDFUNCTION(ADD_IMPORTED_LIB)
MACRO(PKG_CONFIG_LIB_RESOLVE NAME OUTVAR)
SET(${OUTVAR} "")
foreach(lib ${${NAME}_LIBRARIES})
find_library(${lib}_LIBRARY
NAMES ${lib}
HINTS ${${NAME}_LIBDIR} ${${NAME}_LIBRARY_DIRS}
)
if (NOT ${${lib}_LIBRARY} MATCHES ".*NOTFOUND.*")
SET(${OUTVAR} ${${OUTVAR}} ${${lib}_LIBRARY})
endif (NOT ${${lib}_LIBRARY} MATCHES ".*NOTFOUND.*")
endforeach(lib)
ENDMACRO(PKG_CONFIG_LIB_RESOLVE)
# Copy from http://cmake.3232098.n2.nabble.com/RFC-cmake-analog-to-AC-SEARCH-LIBS-td7585423.html
INCLUDE (CheckFunctionExists)
INCLUDE (CheckLibraryExists)
MACRO (CMAKE_SEARCH_LIBS v_func v_lib func)
CHECK_FUNCTION_EXISTS (${func} ${v_func})
IF (NOT ${v_func})
FOREACH (lib ${ARGN})
CHECK_LIBRARY_EXISTS (${lib} ${func} "" "HAVE_${func}_IN_${lib}")
IF (${HAVE_${func}_IN_${lib}})
SET (${v_func} TRUE)
SET (${v_lib} "${lib}" CACHE INTERNAL "Library providing ${func}")
BREAK()
ENDIF (${HAVE_${func}_IN_${lib}})
ENDFOREACH (lib)
ENDIF (NOT ${v_func})
ENDMACRO (CMAKE_SEARCH_LIBS)
# End copy
FUNCTION(EP_CHECK_FILE_EXISTS FILE OUTVAR TARGET NAME COMMAND WORKING_DIR)
string (REPLACE ";" " " COMMAND_STR "${COMMAND}")
IF(WIN32)
# Do something special for windows...
SET(COMMAND "cmd /C \"${COMMAND_STR}\"")
ELSE(WIN32)
SET(COMMAND "${COMMAND_STR}")
ENDIF(WIN32)
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${NAME}" "
IF(EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${FILE}\")
MESSAGE(\"'${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${FILE}' already exists, nothing to be done.\")
ELSE(EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${FILE}\")
execute_process(COMMAND ${COMMAND} WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${WORKING_DIR}\")
ENDIF(EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${FILE}\")
")
SET(${OUTVAR} "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}/${NAME} PARENT_SCOPE)
ENDFUNCTION(EP_CHECK_FILE_EXISTS)
MACRO(COPY_FILE_TO_TARGET _target _file)
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND cp -a "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "copying '${_file}'..."
)
else()
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_file}" "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "copying '${_file}'..."
)
endif()
endmacro(COPY_FILE_TO_TARGET)
MACRO(COPY_FILES_TO_TARGET _target)
if(UNIX)
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND mkdir -p "$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/"
COMMENT "Creating '$<TARGET_FILE_DIR:${_target}>/${LIBRAY_DESTINATION}/'..."
)
endif()
FOREACH(file IN LISTS TARGET_COPY_FILES)
COPY_FILE_TO_TARGET("${_target}" "${file}")
ENDFOREACH(file)
ENDMACRO(COPY_FILES_TO_TARGET)
macro(_clear_old_libraries_state)
set(is_debug FALSE)
set(is_optimized FALSE)
endmacro(_clear_old_libraries_state)
function(CONVERT_OLD_LIBRARIES)
_clear_old_libraries_state()
set(out_list)
foreach(lib ${ARGV})
if ("${lib}" STREQUAL "debug")
_clear_old_libraries_state()
set(is_debug TRUE)
elseif("${lib}" STREQUAL "optimized")
_clear_old_libraries_state()
set(is_optimized TRUE)
elseif("${lib}" STREQUAL "general")
_clear_old_libraries_state()
else("${lib}" STREQUAL "debug")
# Expecting normal library
if(is_debug)
list(APPEND out_list "$<$<CONFIG:Debug>:${lib}>" "$<$<CONFIG:FastDebug>:${lib}>")
elseif(is_optimized)
list(APPEND out_list "$<$<CONFIG:Release>:${lib}>")
else(is_debug)
list(APPEND out_list "${lib}")
endif(is_debug)
endif("${lib}" STREQUAL "debug")
endforeach(lib)
set(CONVERTED_LIBRARIES ${out_list} PARENT_SCOPE)
endfunction(CONVERT_OLD_LIBRARIES)
macro(set_policy policy value)
if (POLICY ${policy})
cmake_policy(SET ${policy} ${value})
endif ()
endmacro(set_policy)
macro(set_if_not_defined VAR VALUE)
if (NOT DEFINED ${VAR})
set(${VAR} ${VALUE})
endif()
endmacro(set_if_not_defined)
macro(configure_cotire target)
if(ENABLE_COTIRE)
# Disable unity build as it doesn't work well for us
set_target_properties(${target} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(${target})
endif()
endmacro(configure_cotire)
macro(add_target_copy_files)
foreach(file ${ARGN})
if (IS_DIRECTORY "${file}")
INSTALL(DIRECTORY ${file}
DESTINATION ${LIBRAY_DESTINATION}
)
else()
INSTALL(FILES ${file}
DESTINATION ${LIBRAY_DESTINATION}
)
endif()
SET(TARGET_COPY_FILES ${TARGET_COPY_FILES} ${file} CACHE INTERNAL "" FORCE)
endforeach()
endmacro(add_target_copy_files)
function(detect_simd_instructions _out_var)
if(CMAKE_CROSSCOMPILING)
set(${_out_var} "" PARENT_SCOPE)
else()
message(STATUS "Detecting SIMD features of current CPU...")
TRY_RUN(RUN_RESULT COMPILE_RESULT "${CMAKE_BINARY_DIR}/temp" "${CMAKE_SOURCE_DIR}/cmake/cpufeatures.cpp"
RUN_OUTPUT_VARIABLE FEATURE_OUTPUT)
IF(COMPILE_RESULT)
MESSAGE(STATUS "Detected compatibility for the ${FEATURE_OUTPUT} feature set.")
SET(${_out_var} ${FEATURE_OUTPUT} PARENT_SCOPE)
ELSE(COMPILE_RESULT)
MESSAGE("Compilation of CPU feature detector failed, please set the instruction set manually.")
set(${_out_var} "" PARENT_SCOPE)
ENDIF(COMPILE_RESULT)
endif()
endfunction()
function (check_linker_flag _flag _out_var)
SET(CMAKE_REQUIRED_FLAGS "${_flag}")
CHECK_C_COMPILER_FLAG("" ${_out_var})
endfunction(check_linker_flag)
# Suppresses warnings for the specified target
function(suppress_warnings _target)
if (MSVC)
target_compile_options(${_target} PRIVATE "/W0")
else()
# Assume everything else uses GCC style options
target_compile_options(${_target} PRIVATE "-w")
endif()
endfunction(suppress_warnings)
function(list_target_dependencies _target _out_var)
set(out_list)
set(work_libs ${_target})
list(LENGTH work_libs libs_length)
while(libs_length GREATER 0)
list(GET work_libs 0 current)
list(REMOVE_AT work_libs 0)
list(APPEND out_list ${current})
get_target_property(current_libs ${current} INTERFACE_LINK_LIBRARIES)
if(current_libs)
foreach(lib ${current_libs})
if (TARGET ${lib})
list(APPEND work_libs ${lib})
endif (TARGET ${lib})
endforeach(lib)
endif(current_libs)
list(LENGTH work_libs libs_length)
endwhile(libs_length GREATER 0)
list(REMOVE_DUPLICATES out_list)
set(${_out_var} ${out_list} PARENT_SCOPE)
endfunction(list_target_dependencies)
macro(add_file_folder FOLDER_NAME)
string(MAKE_C_IDENTIFIER "${FOLDER_NAME}" VARIABLE_NAME)
set(files_${VARIABLE_NAME} ${files_${VARIABLE_NAME}} ${ARGN})
string(REPLACE "/" "\\" FIXED_FOLDER_FILE "${FOLDER_NAME}")
source_group("${FIXED_FOLDER_FILE}" FILES ${ARGN})
set(source_files ${source_files} ${ARGN})
endmacro(add_file_folder)
-52
View File
@@ -1,52 +0,0 @@
include(util)
if (EXISTS "${PROJECT_SOURCE_DIR}/version_override.cmake")
# This allows to override the values by using a special file
include("${PROJECT_SOURCE_DIR}/version_override.cmake")
endif()
set_if_not_defined(FSO_VERSION_MAJOR 20)
set_if_not_defined(FSO_VERSION_MINOR 1)
set_if_not_defined(FSO_VERSION_BUILD 0)
# A numeric revision e.g. the CI build number
set_if_not_defined(FSO_VERSION_REVISION 0)
# A generic revision string, can be anything
set_if_not_defined(FSO_VERSION_REVISION_STR "${FSO_VERSION_REVISION}")
if("${FSO_VERSION_REVISION}" STREQUAL "0" AND "${FSO_VERSION_REVISION_STR}" STREQUAL "${FSO_VERSION_REVISION}")
set(FSO_VERSION_HAS_REVISION 0)
else()
set(FSO_VERSION_HAS_REVISION 1)
endif()
set(FSO_FULL_VERSION_STRING "${FSO_VERSION_MAJOR}.${FSO_VERSION_MINOR}.${FSO_VERSION_BUILD}")
set(FSO_PRODUCT_VERSION_STRING "${FSO_FULL_VERSION_STRING}")
if (FSO_VERSION_HAS_REVISION)
set(FSO_FULL_VERSION_STRING "${FSO_FULL_VERSION_STRING}.${FSO_VERSION_REVISION_STR}")
endif()
IF(NOT FSO_VERSION_HAS_REVISION)
SET(FSO_BINARY_SUFFIX "${FSO_VERSION_MAJOR}_${FSO_VERSION_MINOR}_${FSO_VERSION_BUILD}")
ELSE()
SET(FSO_BINARY_SUFFIX "${FSO_VERSION_MAJOR}_${FSO_VERSION_MINOR}_${FSO_VERSION_BUILD}_${FSO_VERSION_REVISION_STR}")
ENDIF()
IF(IS_64BIT)
# This is a 64-bit builds
SET(FSO_BINARY_SUFFIX "${FSO_BINARY_SUFFIX}_x64")
ENDIF()
IF (NOT "${FSO_INSTRUCTION_SET}" STREQUAL "")
SET(FSO_BINARY_SUFFIX "${FSO_BINARY_SUFFIX}_${FSO_INSTRUCTION_SET}")
ENDIF()
IF (NOT "${FSO_BUILD_POSTFIX}" STREQUAL "")
SET(FSO_BINARY_SUFFIX "${FSO_BINARY_SUFFIX}_${FSO_BUILD_POSTFIX}")
ENDIF()
set(CONFIG_POSTFIX "$<$<CONFIG:Release>:>$<$<CONFIG:Debug>:-DEBUG>$<$<CONFIG:FastDebug>:-FASTDBG>")
set(FSO_BINARY_SUFFIX "${FSO_BINARY_SUFFIX}${CONFIG_POSTFIX}")
-101
View File
@@ -1,101 +0,0 @@
INCLUDE(source_groups.cmake)
INCLUDE(voice_rec.cmake)
ADD_LIBRARY(code STATIC ${source_files} ${VOICE_REC_FILES})
target_compile_features(code PUBLIC ${REQUIRED_CXX_FEATURES})
INCLUDE(default_files.cmake)
if (MSVC)
target_compile_definitions(code PUBLIC "PDB_DEBUGGING=1")
endif(MSVC)
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${CODE_HEADERS})
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${FREESPACE_HEADERS})
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${GENERATED_SOURCE_DIR})
TARGET_INCLUDE_DIRECTORIES(code PUBLIC ${GENERATED_SOURCE_DIR}/code)
target_link_libraries(code PUBLIC OpenGL)
TARGET_LINK_LIBRARIES(code PUBLIC openal)
TARGET_LINK_LIBRARIES(code PUBLIC ${LUA_LIBS})
TARGET_LINK_LIBRARIES(code PUBLIC ${PNG_LIBS})
TARGET_LINK_LIBRARIES(code PUBLIC ${JPEG_LIBS})
TARGET_LINK_LIBRARIES(code PUBLIC sdl2)
if (FSO_BUILD_WITH_FFMPEG)
TARGET_LINK_LIBRARIES(code PUBLIC ffmpeg)
endif()
TARGET_LINK_LIBRARIES(code PUBLIC utfcpp)
TARGET_LINK_LIBRARIES(code PUBLIC platform)
TARGET_LINK_LIBRARIES(code PUBLIC compiler)
target_link_libraries(code PUBLIC md5)
target_link_libraries(code PUBLIC discord-rpc)
target_link_libraries(code PUBLIC libRocket)
target_link_libraries(code PUBLIC pcp)
target_link_libraries(code PUBLIC vulkan-hpp)
enable_clang_tidy(code)
IF (FSO_USE_SPEECH)
find_package(Speech REQUIRED)
target_link_libraries(code PUBLIC speech)
ENDIF(FSO_USE_SPEECH)
TARGET_LINK_LIBRARIES(code PUBLIC jansson)
# Headers for standalone "gui" on UNIX
IF(UNIX)
TARGET_LINK_LIBRARIES(code PUBLIC ${MONGOOSE_LIBS})
ENDIF(UNIX)
IF(FSO_BUILD_TOOLS)
ADD_SUBDIRECTORY(cfilearchiver)
ADD_SUBDIRECTORY(cfileextractor)
ENDIF(FSO_BUILD_TOOLS)
if (ENABLE_COTIRE)
set_target_properties(code PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h")
else()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/FI ${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
target_compile_options(code PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-include${CMAKE_CURRENT_SOURCE_DIR}/prefix_header.h>")
ELSE()
MESSAGE("Unknown compiler for global includes. This will probably break the build.")
ENDIF()
endif()
if (FSO_RELEASE_LOGGING)
target_compile_definitions(code PUBLIC SCP_RELEASE_LOGGING)
endif()
if (FSO_BUILD_WITH_FFMPEG)
target_compile_definitions(code PUBLIC WITH_FFMPEG)
endif()
include(util)
configure_cotire(code)
# Ensure that Xcode generates debug symbols on macOS for Debug builds
set_target_properties(code PROPERTIES XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES")
set_target_properties(code PROPERTIES XCODE_ATTRIBUTE_COPY_PHASE_STRIP[variant=Debug] "NO")
set_target_properties(code PROPERTIES XCODE_ATTRIBUTE_STRIP_INSTALLED_PRODUCT[variant=Debug] "NO")
set_target_properties(code PROPERTIES XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN[variant=Debug] "NO")
-105
View File
@@ -1,105 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/**
* @file
* The code in here is just for bookeeping, allocating AI slots and linking them to ships.
* See AiCode.cpp for the actual AI code.
*/
#include "ai/ai.h"
#include "object/object.h"
#include "ship/ship.h"
SCP_vector<char *> Goal_target_names;
ai_info Ai_info[MAX_AI_INFO];
ai_info *Player_ai;
/**
* @brief Returns index of free AI slot.
* @return Return -1 if no free slot.
*/
int ai_get_slot(int shipnum)
{
int i;
for (i=0; i<MAX_AI_INFO ; i++)
if (Ai_info[i].shipnum == -1) {
Ai_info[i].shipnum = shipnum;
return i;
}
Warning( LOCATION, "Couldn't get AI slot" );
Int3();
return -1;
}
/**
* @brief Frees a currently used AI slot.
* @details Only modifies in ::Ai_info struct. Does not modify hook in ship.
*/
void ai_free_slot(int ai_index)
{
Assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) );
Ai_info[ai_index].shipnum = -1;
}
int get_wingnum(int objnum)
{
int shipnum, ai_index;
shipnum = Objects[objnum].instance;
ai_index = Ships[shipnum].ai_index;
return Ai_info[ai_index].wing;
}
void set_wingnum(int objnum, int wingnum)
{
int shipnum, ai_index;
Assert(Objects[objnum].type == OBJ_SHIP);
shipnum = Objects[objnum].instance;
Assert((shipnum >= 0) && (shipnum < MAX_SHIPS));
ai_index = Ships[shipnum].ai_index;
Assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) );
Ai_info[ai_index].wing = wingnum;
}
const char *ai_get_goal_target_name(const char *name, int *index)
{
Assertion(name != nullptr && index != nullptr, "Arguments cannot be null!");
for (int i = 0; i < static_cast<int>(Goal_target_names.size()); ++i) {
if (!stricmp(name, Goal_target_names[i])) {
*index = i;
return Goal_target_names[i];
}
}
*index = static_cast<int>(Goal_target_names.size());
Goal_target_names.push_back(vm_strdup(name));
return Goal_target_names[*index];
}
void ai_clear_goal_target_names()
{
for (auto ptr : Goal_target_names)
vm_free(ptr);
Goal_target_names.clear();
}
-666
View File
@@ -1,666 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _AI_H
#define _AI_H
#include "ai/ai_profiles.h"
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "object/waypoint.h"
#include "physics/physics.h"
#include "ship/ship_flags.h"
class ship_weapon;
class ship_subsys;
class object;
class ship_info;
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
typedef struct ai_flag_name {
AI::AI_Flags flag;
char flag_name[TOKEN_LENGTH];
} ai_flag_name;
#define MAX_AI_FLAG_NAMES 2
extern ai_flag_name Ai_flag_names[];
// dock_orient_and_approach() modes.
#define DOA_APPROACH 1 // Approach the current point on the path (aip->path_cur)
#define DOA_DOCK 2 // Dock with goal object.
#define DOA_UNDOCK_1 3 // Begin undocking with goal object. Just move away.
#define DOA_UNDOCK_2 4 // Secondary undocking. Move away.
#define DOA_UNDOCK_3 5 // Tertiary undocking. Move away and orient away.
#define DOA_DOCK_STAY 6 // Rigidly maintain position in dock bay.
// Type values for ai_dock_with_object() dock_type parameter.
#define AIDO_DOCK 1 // Set goal of docking with object.
#define AIDO_DOCK_NOW 2 // Immediately move into dock position. For ships that start mission docked.
#define AIDO_UNDOCK 3 // Set goal of undocking with object.
// Submodes for seeking safety.
#define AISS_1 41 // Pick a spot to fly to.
#define AISS_2 42 // Flying to spot.
#define AISS_3 43 // Gotten near spot, fly about there.
#define AISS_1a 44 // Pick a new nearby spot because we are endangered, then go to AISS_2
#define MAX_AI_GOALS 5
// types of ai goals -- tyese types will help us to determination on which goals should
// have priority over others (i.e. when a player issues a goal to a wing, then a seperate
// goal to a ship in that wing). We would probably use this type in conjunction with
// goal priority to establish which goal to follow
#define AIG_TYPE_EVENT_SHIP 1 // from mission event direct to ship
#define AIG_TYPE_EVENT_WING 2 // from mission event direct to wing
#define AIG_TYPE_PLAYER_SHIP 3 // from player direct to ship
#define AIG_TYPE_PLAYER_WING 4 // from player direct to wing
#define AIG_TYPE_DYNAMIC 5 // created on the fly
// Flags to ai_turn_towards_vector().
#define AITTV_FAST (1<<0) // Turn fast, not slowed down based on skill level.
#define AITTV_VIA_SEXP (1<<1) // Goober5000 - via sexp
#define AITTV_IGNORE_BANK (1<<2) // Goober5000 - ignore bank when turning
#define KAMIKAZE_HULL_ON_DEATH -1000.0f // Hull strength ship gets set to if it crash-dies.
// structure for AI goals
typedef struct ai_goal {
int signature; // Unique identifier. All goals ever created (per mission) have a unique signature.
int ai_mode; // one of the AIM_* modes for this goal
int ai_submode; // maybe need a submode
int type; // one of the AIG_TYPE_* values above
flagset<AI::Goal_Flags> flags; // one of the AIGF_* values above
fix time; // time at which this goal was issued.
int priority; // how important is this goal -- number 0 - 100
const char *target_name; // name of the thing that this goal acts upon
int target_name_index; // index of goal_target_name in Goal_target_names[][]
waypoint_list *wp_list; // waypoints that this ship might fly.
int target_instance; // instance of thing this ship might be chasing (currently only used for weapons; note, not the same as objnum!)
int target_signature; // signature of object this ship might be chasing (currently only used for weapons; paired with above value to confirm target)
// unions for docking stuff.
// (AIGF_DOCKER_INDEX_VALID and AIGF_DOCKEE_INDEX_VALID tell us to use indexes; otherwise we use names)
// these are the dockpoints used on the docker and dockee ships, not the ships themselves
union {
const char *name;
int index;
} docker;
union {
const char *name;
int index;
} dockee;
} ai_goal;
#define AIM_CHASE 0
#define AIM_EVADE 1
#define AIM_GET_BEHIND 2
#define AIM_STAY_NEAR 3 // Stay near another ship.
#define AIM_STILL 4 // Sit still. Don't move. Hold your breath. Don't blink.
#define AIM_GUARD 5 // Guard an object
#define AIM_AVOID 6 // Avoid an object
#define AIM_WAYPOINTS 7 // Fly waypoints
#define AIM_DOCK 8 // Dock with ship.
#define AIM_NONE 9 // Uh, do nothing.
#define AIM_BIGSHIP 10 // Like a capital ship, doesn't focus on one ship.
#define AIM_PATH 11 // Follow path on ship
#define AIM_BE_REARMED 12 // Allow self to be rearmed
#define AIM_SAFETY 13 // Seek safety at periphery of battle
#define AIM_EVADE_WEAPON 14 // Evade a weapon.
#define AIM_STRAFE 15 // Attack a big ship by strafing it
#define AIM_PLAY_DEAD 16 // Play dead. Get it? Don't move, fire, etc.
#define AIM_BAY_EMERGE 17 // Emerging from a fighter bay, following path to do so
#define AIM_BAY_DEPART 18 // Departing to a fighter bay, following path to do so
#define AIM_SENTRYGUN 19 // AI mode for sentry guns only (floating turrets)
#define AIM_WARP_OUT 20 // Commence warp out sequence. Point in legal direction. Then call John's code.
#define AIM_FLY_TO_SHIP 21 // [Kazan] Fly to a ship, doesn't matter if it's hostile or friendly -- for Autopilot usage
#define MAX_AI_BEHAVIORS 22 // Number of AIM_xxxx types
#define MAX_WAYPOINTS_PER_LIST 20
#define MAX_ENEMY_DISTANCE 2500.0f // Maximum distance from which a ship will pursue an enemy.
#define AI_GOAL_NONE -1
#define AI_ACTIVE_GOAL_DYNAMIC 999
typedef struct ai_class {
char name[NAME_LENGTH];
float ai_accuracy[NUM_SKILL_LEVELS];
float ai_evasion[NUM_SKILL_LEVELS];
float ai_courage[NUM_SKILL_LEVELS];
float ai_patience[NUM_SKILL_LEVELS];
//SUSHI: These were originally in AI_Profiles, adding the option to override in AI.tbl
//INT_MIN and FLT_MIN represent the "not set" state for which defaults are used instead.
float ai_cmeasure_fire_chance[NUM_SKILL_LEVELS];
float ai_in_range_time[NUM_SKILL_LEVELS];
float ai_link_ammo_levels_maybe[NUM_SKILL_LEVELS];
float ai_link_ammo_levels_always[NUM_SKILL_LEVELS];
float ai_primary_ammo_burst_mult[NUM_SKILL_LEVELS];
float ai_link_energy_levels_maybe[NUM_SKILL_LEVELS];
float ai_link_energy_levels_always[NUM_SKILL_LEVELS];
fix ai_predict_position_delay[NUM_SKILL_LEVELS];
float ai_shield_manage_delay[NUM_SKILL_LEVELS];
float ai_ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
float ai_ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
float ai_ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS];
float ai_ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS];
float ai_turn_time_scale[NUM_SKILL_LEVELS];
float ai_glide_attack_percent[NUM_SKILL_LEVELS];
float ai_circle_strafe_percent[NUM_SKILL_LEVELS];
float ai_glide_strafe_percent[NUM_SKILL_LEVELS];
float ai_random_sidethrust_percent[NUM_SKILL_LEVELS];
float ai_stalemate_time_thresh[NUM_SKILL_LEVELS];
float ai_stalemate_dist_thresh[NUM_SKILL_LEVELS];
int ai_chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
float ai_max_aim_update_delay[NUM_SKILL_LEVELS];
float ai_turret_max_aim_update_delay[NUM_SKILL_LEVELS];
flagset<AI::Profile_Flags> ai_profile_flags; //Holds the state of flags that are set
flagset<AI::Profile_Flags> ai_profile_flags_set; //Holds which flags are set and which are just left alone
//SUSHI: These are optional overrides to an AI class to prevent the automatic scaling based on AI class index
int ai_aburn_use_factor[NUM_SKILL_LEVELS];
float ai_shockwave_evade_chance[NUM_SKILL_LEVELS];
float ai_get_away_chance[NUM_SKILL_LEVELS];
float ai_secondary_range_mult[NUM_SKILL_LEVELS];
bool ai_class_autoscale; //Defaults to true, but can be turned off in order to disable extra scaling of some AI behaviors
//based on AI class index
} ai_class;
// Submode definitions.
// Note: These need to be renamed to be of the form: AIS_mode_xxxx
#define SM_CONTINUOUS_TURN 1 // takes parm: vector_id {0..3 = right, -right, up, -up}
#define SM_ATTACK 2
#define SM_EVADE_SQUIGGLE 3
#define SM_EVADE_BRAKE 4
#define SM_EVADE 5
#define SM_SUPER_ATTACK 6
#define SM_AVOID 7
#define SM_GET_BEHIND 8
#define SM_GET_AWAY 9
#define SM_EVADE_WEAPON 10 // Evade incoming weapon
#define SM_FLY_AWAY 11 // Fly away from target_objnum
#define SM_ATTACK_FOREVER 12 // Engine subsystem destroyed, so attack, never evading, avoiding, etc.
#define SM_STEALTH_FIND 13 // Stealth ship is "targeted", but not visible, so try to find based on predicted pos
#define SM_STEALTH_SWEEP 14 // General sweep, looking for stealth after not visible for some time.
#define SM_BIG_APPROACH 15 // Big ship approaches another
#define SM_BIG_CIRCLE 16 // Big ship flies circle around other big ship to get good angle to go parallel
#define SM_BIG_PARALLEL 17 // Big ship flies parallel to another
//SUSHI: Attack submodes (besides those implicitly listed above)
#define AIS_CHASE_GLIDEATTACK 18 // Ship uses glide to move in a constant direction while pointing and shooting at target
#define AIS_CHASE_CIRCLESTRAFE 19 // Attempt a circle-strafe on the target
// Submodes for docking behavior
#define AIS_DOCK_0 20
#define AIS_DOCK_1 21
#define AIS_DOCK_2 22
#define AIS_DOCK_3 23
#define AIS_DOCK_4 24 // Only for rearm/repair.
#define AIS_DOCK_4A 25 // Only for not rearm/repair. MK, 7/15/97
#define AIS_UNDOCK_0 30
#define AIS_UNDOCK_1 31
#define AIS_UNDOCK_2 32
#define AIS_UNDOCK_3 33
#define AIS_UNDOCK_4 34
// Submodes for Guard behavior
#define AIS_GUARD_PATROL 101
#define AIS_GUARD_ATTACK 102
#define AIS_GUARD_2 103
#define AIS_GUARD_STATIC 104 // maintain current relative position to guard object, if possible
// Submodes for strafing big ships behavior (AIM_STRAFE)
#define AIS_STRAFE_ATTACK 201 // fly towards target and attack
#define AIS_STRAFE_AVOID 202 // fly evasive vector to avoid incoming fire
#define AIS_STRAFE_RETREAT1 203 // fly away from attack point
#define AIS_STRAFE_RETREAT2 204
#define AIS_STRAFE_POSITION 205 // re-position to resume strafing attack
#define AIS_STRAFE_GLIDE_ATTACK 206 // SUSHI: Glide strafe atack
#define WPF_REPEAT (1 << 0)
#define WPF_BACKTRACK (1 << 1)
#define PD_FORWARD 1
#define PD_BACKWARD -1
#define MIN_TRACKABLE_ASPECT_DOT 0.992f // dot of fvec and vec_to_enemy to progress towards aspect lock
// Submodes for warping out.
#define AIS_WARP_1 300 // Make sure there is no obstruction to warping out.
#define AIS_WARP_2 301
#define AIS_WARP_3 302
#define AIS_WARP_4 303
#define AIS_WARP_5 304
#define AIS_DEPART_TO_BAY 305
// A node on a path.
// Contains global location of point.
// Contains hooks back to original path information.
// This hook is used to extract information on the point such as whether it is
// protected by turrets.
typedef struct pnode {
vec3d pos;
int path_num; // path number from polymodel, ie in polymodel, paths[path_num]
int path_index; // index in original model path of point, ie in model_path, use verts[path_index]
} pnode;
#define MAX_PATH_POINTS 1000
extern pnode Path_points[MAX_PATH_POINTS];
extern pnode *Ppfp; // Free pointer in path points.
// Goober5000 (based on the "you can only remember 7 things in short-term memory" assumption)
#define MAX_IGNORE_NEW_OBJECTS 7
typedef struct ai_info {
flagset<AI::AI_Flags> ai_flags; // Special flags for AI behavior.
int shipnum; // Ship using this slot, -1 means none.
int type; //
int wing; // Member of what wing? -1 means none.
int behavior; // AI behavior; vestigial field from early development of FS1
int mode;
int previous_mode;
int mode_time; // timestamp at which current mode elapses.
int target_objnum; // object index of current target.
int target_signature; // Signature of current target.
int previous_target_objnum; // On 5/19/97, only used for player.
int stealth_last_cheat_visible_stamp; // when within 100m, always update pos and velocity, with error increasing for increasing time from last legal visible
int stealth_last_visible_stamp;
float stealth_sweep_box_size;
vec3d stealth_last_pos;
vec3d stealth_velocity;
float previous_dot_to_enemy; // dot(fvec, vec_to_enemy) last frame
float target_time; // Amount of time continuously targeting this ship.
int enemy_wing; // When picking an enemy wing, only allow to be in enemy_wing, unless == -1, in which case don't care.
int attacker_objnum;
int goal_objnum; // mode specific goal. In DOCK, ship to dock with.
int goal_signature;
int guard_objnum; // Ship to guard.
int guard_signature; // Signature of ship to guard.
int guard_wingnum; // Wing to guard. guard_objnum set to leader.
int ignore_objnum; // ship to be ignored, based on player order. UNUSED_OBJNUM if none. -(wing_num+1) if ignoring wing.
int ignore_signature; // signature of ship to be ignored
// Goober5000
int ignore_new_objnums[MAX_IGNORE_NEW_OBJECTS];
int ignore_new_signatures[MAX_IGNORE_NEW_OBJECTS];
int ai_class; // Class. Might be override of default.
// Probably become obsolete, to be replaced by path_start, path_cur, etc.
waypoint_list *wp_list; // waypoint list being followed
size_t wp_index; // waypoint index in list
int wp_flags; // waypoint flags, see WPF_xxxx
int waypoint_speed_cap; // -1 no cap, otherwise cap - changed to int by Goober5000
// Path following information
int path_start; // Index into global array, start of path.
int path_cur; // Index into global array, current location in path.
int path_length; // Number of links in this path.
int path_dir; // PD_FORWARD, PD_BACKWARD
int path_flags; // loop, backtrack, whatever else.
int path_objnum; // Object of interest. It's model contains the path.
int path_goal_obj_hash; // Hash value of goal object when global path created.
fix path_next_create_time; // Next time at which we'll create a global path.
vec3d path_create_pos; // Object's position at time of global path creation.
matrix path_create_orient; // Object's orientation at time of global path creation.
int mp_index; // Model path index. Index in polymodel:model_paths
fix path_next_check_time; // Last time checked to see if would collide with model.
int path_goal_dist; // minimum distance to first path point to consider path reached
int path_subsystem_next_check; // timestamp to next check if subsystem is still visible
vec3d path_depart_orient; //Rotational orientation associated with the path
int submode;
int previous_submode; // previous submode, get it?
float best_dot_to_enemy; // best dot product to enemy in last BEST_DOT_TIME seconds
float best_dot_from_enemy; // best dot product for enemy to player in last BEST_DOT_TIME seconds
fix best_dot_to_time; // time at which best dot occurred
fix best_dot_from_time; // time at which best dot occurred
fix submode_start_time; // time at which we entered the current submode
int submode_parm0; // parameter specific to current submode
int submode_parm1; // SUSHI: Another optional parameter
fix next_predict_pos_time; // Next time to predict position.
//SUSHI: like last_predicted_enemy_pos, but for aiming (which currently ignores predicted position)
//Unlike the predicted position stuff, also takes into account velocity
//Only used against small ships
fix next_aim_pos_time;
vec3d last_aim_enemy_pos;
vec3d last_aim_enemy_vel;
ai_goal goals[MAX_AI_GOALS];
int active_goal; // index of active goal, -1 if none, AI_ACTIVE_GOAL_DYNAMIC if dynamic (runtime-created) goal
int goal_check_time; // timer used for processing goals for this ai object
vec3d last_predicted_enemy_pos; // Where he thought enemy was last time.
float time_enemy_in_range; // Amount of time enemy continuously in "sight", near crosshair.
float time_enemy_near; // SUSHI: amount of time enemy continuously "near" the player
fix last_attack_time; // Missiontime of last time this ship attacked its enemy.
fix last_hit_time; // Missiontime of last time this ship was hit by anyone.
int last_hit_quadrant; // Shield section of last hit.
fix last_hit_target_time; // Missiontime of last time this ship successfully hit target.
int hitter_objnum; // Object index of ship that hit this ship last time.
int hitter_signature; // Signature of hitter. Prevents stupidity if hitter gets killed.
fix resume_goal_time; // Time at which to resume interrupted goal, if nothing else intervenes.
float prev_accel; // Acceleration last frame.
float prev_dot_to_goal; // dot of fvec to goal last frame, used to see if making progress towards goal.
vec3d goal_point; // Used in AIM_SAFETY, AIM_STILL and in circling.
vec3d prev_goal_point; // Previous location of goal point, used at least for evading.
//Values copied from the AI class
float ai_accuracy, ai_evasion, ai_courage, ai_patience;
int ai_aburn_use_factor;
float ai_shockwave_evade_chance;
float ai_get_away_chance;
float ai_secondary_range_mult;
bool ai_class_autoscale;
//SUSHI: These were originally in AI_Profiles, adding the option to override in AI.tbl
float ai_cmeasure_fire_chance;
float ai_in_range_time;
float ai_link_ammo_levels_maybe;
float ai_link_ammo_levels_always;
float ai_primary_ammo_burst_mult;
float ai_link_energy_levels_maybe;
float ai_link_energy_levels_always;
fix ai_predict_position_delay;
float ai_shield_manage_delay;
float ai_ship_fire_delay_scale_friendly;
float ai_ship_fire_delay_scale_hostile;
float ai_ship_fire_secondary_delay_scale_friendly;
float ai_ship_fire_secondary_delay_scale_hostile;
float ai_turn_time_scale;
float ai_glide_attack_percent;
float ai_circle_strafe_percent;
float ai_glide_strafe_percent;
float ai_random_sidethrust_percent;
float ai_stalemate_time_thresh;
float ai_stalemate_dist_thresh;
int ai_chance_to_use_missiles_on_plr;
float ai_max_aim_update_delay;
float ai_turret_max_aim_update_delay;
flagset<AI::Profile_Flags> ai_profile_flags; //Holds AI_Profiles flags (possibly overriden by AI class) that actually apply to AI
union {
float lead_scale; // Amount to lead current opponent by.
float stay_near_distance; // Distance to stay within for AIM_STAY_NEAR mode.
};
ship_subsys* targeted_subsys; // Targeted subobject on current target. NULL if none;
ship_subsys* last_subsys_target; // last known subsystem target
int targeted_subsys_parent; // Parent objnum of subobject, not necessarily targeted
float aspect_locked_time; // Time towards acquiring lock for current_target
// Goober5000
int support_ship_objnum; // objnum of support ship docking with us, or (if we're a support ship) object we're docking to
int support_ship_signature; // signature of the same
int danger_weapon_objnum; // Closest objnum of weapon fired at this ship.
int danger_weapon_signature; // Signature of object danger_weapon_objnum.
vec3d guard_vec; // vector to object being guarded, only used in AIS_GUARD_STATIC submode
int nearest_locked_object; // Nearest locked object.
float nearest_locked_distance; // Distance to nearest locked object.
float current_target_distance; // Distance of current target from player
int current_target_is_locked; // Flag to indicate whether the current target is locked for missile fire
int current_target_dist_trend; // Tracks whether distance to target is increasing or decreasing
int current_target_speed_trend; // Tracks whether speed of target is increasing or decreasing
float last_dist; // last frame's distance between player and target
float last_speed; // last frame's target speed
int last_secondary_index; // needed for secondary weapon change check
int last_target;
int rearm_first_missile; // flag to show that reloading of missilies hasn't begun yet
int rearm_first_ballistic_primary; // flag to show that reloading of ballistic primaries hasn't begun yet
int rearm_release_delay; // timestamp used to delay separation of ships after rearm complete
fix afterburner_stop_time; // Missiontime to turn off afterburner
int last_objsig_hit; // The object number signature of the ship last hit by this ship
int ignore_expire_timestamp; // Timestamp at which temporary ignore (AIF_TEMPORARY_IGNORE) expires.
int warp_out_timestamp; // Timestamp at which this ship is to warp out.
int next_rearm_request_timestamp; // Timestamp at which ship might next request rearm.
int primary_select_timestamp; // When to next select a primary weapon.
int secondary_select_timestamp; // When to next select a secondary weapon.
int scan_for_enemy_timestamp; // When to next look for enemy fighters if sitting still while pounding
// on a bigship. SCAN_FIGHTERS_INTERVAL is defined in AiBig.h
int choose_enemy_timestamp; // Time at which it is next legal to choose a new enemy (does not apply
// to special situations, like getting hit by a weapon)
int force_warp_time; // time at which to give up avoiding a ship and just warp out
int shockwave_object; // Object index of missile that will generate a shockwave. We will try to avoid.
int shield_manage_timestamp; // Time at which to next manage shield.
int self_destruct_timestamp; // Time at which to self-destruct, probably due to being disabled.
int ok_to_target_timestamp; // Time at which this ship can dynamically target.
int kamikaze_damage; // some damage value used to produce a shockwave from a kamikaze ship
vec3d big_attack_point; // Global point this ship is attacking on a big ship.
vec3d big_attack_surface_normal; // Surface normal at ship at big_attack_point;
int pick_big_attack_point_timestamp; // timestamp at which to pick a new point to attack on a big ship.
// Note: These three avoid_XX terms are shared between the code that avoids small (only player now) and large ships
// The bits in ai_flags determine which is occurring. AIF_AVOID_SMALL_SHIP, AIF_AVOID_BIG_SHIP
int avoid_ship_num; // object index of small ship to avoid
vec3d avoid_goal_point; // point to aim at when avoiding a ship
fix avoid_check_timestamp; // timestamp at which to next check for having to avoid ship
vec3d big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
vec3d big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
vec3d big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
int big_recover_timestamp; // timestamp at which it's OK to re-enter stage 1.
int abort_rearm_timestamp; // time at which this rearm should be aborted in a multiplayer game.
// artillery targeting info
int artillery_objnum; // object currently being targeted for artillery lock/attack
int artillery_sig; // artillery object signature
float artillery_lock_time; // how long we've been locked onto this guy
vec3d artillery_lock_pos; // base position of the lock point on (in model's frame of reference)
float lethality; // measure of how dangerous ship is to enemy BIG|HUGE ships (likelyhood of targeting)
flagset<AI::Maneuver_Override_Flags> ai_override_flags; // flags for marking ai overrides from sexp or lua systems
control_info ai_override_ci; // ai override control info
int ai_override_timestamp; // mark for when to end the current override
} ai_info;
// Goober5000
typedef struct {
vec3d docker_point;
vec3d dockee_point;
int dock_mode;
int submodel;
vec3d submodel_pos;
float submodel_r;
float submodel_w;
} rotating_dockpoint_info;
#define MAX_AI_INFO MAX_SHIPS
// SUBSYS_PATH_DIST is used as the distance that a subsystem path should terminate from the actual
// subsystem. We don't want to rely on the model path points for this, since we may need to be
// changed.
#define SUBSYS_PATH_DIST 500.0f
// Friendly damage defines
#define MAX_BURST_DAMAGE 20 // max damage that can be done in BURST_DURATION
#define BURST_DURATION 500 // decay time over which Player->damage_this_burst falls from MAX_BURST_DAMAGE to 0
extern int Mission_all_attack; // !0 means all teams attack all teams.
extern void update_ai_info_for_hit(int hitter_obj, int hit_obj);
extern void ai_frame_all(void);
extern int find_guard_obj(void);
extern ai_info Ai_info[];
extern ai_info *Player_ai;
extern ai_class *Ai_classes;
extern char** Ai_class_names;
extern int Num_ai_classes;
extern int Ai_firing_enabled;
extern const char *Skill_level_names(int skill_level, int translate = 1);
extern int Ai_goal_signature;
// need access to following data in AiBig.cpp
extern object *Pl_objp;
extern object *En_objp;
extern float AI_frametime;
// Return index of free AI slot.
// Return 0 if no free slot.
int ai_get_slot(int shipnum);
// Releases an AI slot to be used by someone else.
void ai_free_slot(int ai_index);
// call to init one ai object.. you can pass all sorts of
// stuff by adding new paramters.
void ai_object_init(object * obj, int ai_index);
// Called once a frame
void ai_process( object * obj, int ai_index, float frametime );
int get_wingnum(int objnum);
void set_wingnum(int objnum, int wingnum);
const char *ai_get_goal_target_name(const char *name, int *index);
void ai_clear_goal_target_names();
extern void init_ai_system(void);
extern void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp, int ship_info_index = -1);
extern void ai_evade_object(object *evader, object *evaded);
extern void ai_ignore_object(object *ignorer, object *ignored, int ignore_new);
extern void ai_ignore_wing(object *ignorer, int wingnum);
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int dock_type);
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
extern void ai_do_default_behavior(object *obj);
extern void ai_start_waypoints(object *objp, waypoint_list *wp_list, int wp_flags);
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hit_normal);
extern void ai_ship_destroy(int shipnum);
extern void ai_turn_towards_vector(vec3d *dest, object *objp, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec = nullptr, int sexp_flags = 0);
extern void init_ai_object(int objnum);
extern void ai_init(void); // Call this one to parse ai.tbl.
extern void ai_level_init(void); // Call before each level to reset AI
extern int ai_set_attack_subsystem(object *objp, int subnum);
extern int ai_issue_rearm_request(object *requester_objp); // Object requests rearm/repair.
extern int ai_abort_rearm_request(object *requester_objp); // Object aborts rearm/repair.
extern void ai_do_repair_frame(object *objp, ai_info *aip, float frametime); // Repair a ship object, player or AI.
extern void ai_update_danger_weapon(int objnum, int weapon_objnum);
// called externally from MissionParse.cpp to position ships in wings upon arrival into the
// mission.
extern void get_absolute_wing_pos( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
extern void get_absolute_wing_pos_autopilot( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
// Interface from goals code to AI. Set ship to guard. *objp guards *other_objp
extern void ai_set_guard_object(object *objp, object *other_objp);
extern void ai_set_guard_wing(object *objp, int wingnum);
extern void ai_warp_out(object *objp, vec3d *vp);
extern void ai_attack_wing(object *attacker, int wingnum);
extern void ai_deathroll_start(object *ship_obj);
extern int set_target_objnum(ai_info *aip, int objnum);
extern void ai_form_on_wing(object *objp, object *goal_objp);
extern void ai_do_stay_near(object *objp, object *other_obj, float dist);
extern ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum);
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index );
extern void ai_add_rearm_goal( object *requester_objp, object *support_objp );
extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_path=0);
extern int ai_find_goal_index( ai_goal* aigp, int mode, int submode = -1, int priority = -1 );
// Goober5000
extern void ai_do_safety(object *objp);
// used to get path info for fighter bay emerging and departing
int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, int path_mask, vec3d *pos, vec3d *fvec);
int ai_acquire_depart_path(object *pl_objp, int parent_objnum, int path_mask);
// used by AiBig.cpp
extern void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *player_pos, vec3d *enemy_pos);
extern void accelerate_ship(ai_info *aip, float accel);
extern void turn_away_from_point(object *objp, vec3d *point, float bank_override);
extern float ai_endangered_by_weapon(ai_info *aip);
extern void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dist_to_enemy, float enemy_radius);
extern void ai_chase_ct();
extern void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int subsys_path=0);
extern float ai_path();
extern void evade_weapon();
extern int might_collide_with_ship(object *obj1, object *obj2, float dot_to_enemy, float dist_to_enemy, float duration);
extern int ai_fire_primary_weapon(object *objp); //changed to return weather it fired-Bobboau
extern int ai_fire_secondary_weapon(object *objp);
extern float ai_get_weapon_dist(ship_weapon *swp);
extern void turn_towards_point(object *objp, vec3d *point, vec3d *slide_vec, float bank_override);
extern int ai_maybe_fire_afterburner(object *objp, ai_info *aip);
extern void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, ai_info *aip);
extern int is_instructor(object *objp);
extern int find_enemy(int objnum, float range, int max_attackers, int ship_info_index = -1);
float ai_get_weapon_speed(ship_weapon *swp);
void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, float weapon_speed, float time_enemy_in_range);
// function to change rearm status for ai ships (called from sexpression code)
extern void ai_set_rearm_status( int team, int new_status );
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, char *shipname );
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point, bool update_clients = true);
extern void ai_do_objects_undocked_stuff( object *docker, object *dockee );
extern void ai_do_objects_repairing_stuff( object *repaired_obj, object *repair_obj, int how );
// Goober5000
// Move to a position relative to a dock bay using thrusters.
extern float dock_orient_and_approach(object *docker_objp, int docker_index, object *dockee_objp, int dockee_index, int dock_mode, rotating_dockpoint_info *rdinfo = NULL);
void ai_set_mode_warp_out(object *objp, ai_info *aip);
// prototyped by Goober5000
int get_nearest_objnum(int objnum, int enemy_team_mask, int enemy_wing, float range, int max_attackers, int ship_info_index);
// moved to header file by Goober5000
void ai_announce_ship_dying(object *dying_objp);
// added by kazan
void ai_start_fly_to_ship(object *objp, int shipnum);
void ai_fly_to_ship();
//Moved declaration here for player ship -WMC
void process_subobjects(int objnum);
//SUSHI: Setting ai_info stuff from both ai class and ai profile
void init_aip_from_class_and_profile(ai_info *aip, ai_class *aicp, ai_profile_t *profile);
void ai_update_aim(ai_info *aip);
//SUSHI: Random evasive sidethrust
void do_random_sidethrust(ai_info *aip, ship_info *sip);
#endif
-133
View File
@@ -1,133 +0,0 @@
#ifndef AI_FLAGS_H
#define AI_FLAGS_H
#include "globalincs/flagset.h"
namespace AI {
FLAG_LIST(AI_Flags) {
Formation_wing, // Fly in formation as part of wing.
Awaiting_repair, // Awaiting a repair ship.
Being_repaired, // Currently docked with repair ship.
Repairing, // Repairing a ship (or going to repair a ship)
Seek_lock, // set if should focus on gaining aspect lock, not hitting with lasers
Formation_object, // Fly in formation off a specific object.
Temporary_ignore, // Means current ignore_objnum is only temporary, not an order from the player.
Use_exit_path, // Used by path code, to flag path as an exit path
Use_static_path, // Used by path code, use fixed path, don't try to recreate
Target_collision, // Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
Unload_secondaries, // Fire secondaries as fast as possible!
On_subsys_path, // Current path leads to a subsystem
Avoid_shockwave_ship, // Avoid an existing shockwave from a ship.
Avoid_shockwave_weapon, // Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
Avoid_shockwave_started, // Already started avoiding shockwave, don't keep deciding whether to avoid.
Attack_slowly, // Move slowly while attacking.
Repair_obstructed, // Ship wants to be repaired, but path is obstructed.
Kamikaze, // Crash into target
No_dynamic, // Not allowed to get dynamic goals
Avoiding_small_ship, // Avoiding a player ship.
Avoiding_big_ship, // Avoiding a large ship.
Big_ship_collide_recover_1, // Collided into a big ship. Recovering by flying away.
Big_ship_collide_recover_2, // Collided into a big ship. Fly towards big ship sphere perimeter.
Stealth_pursuit, // AI is trying to fight stealth ship
Unload_primaries, // Fire primaries as fast as possible!
Trying_unsuccessfully_to_warp, // Trying to warp, but can't warp at the moment
Free_afterburner_use, // Use afterburners while following waypoints or flying towards objects
NUM_VALUES
};
FLAG_LIST(Goal_Flags) {
Docker_index_valid, // when set, index field for docker is valid
Dockee_index_valid, // when set, index field for dockee is valid
Goal_on_hold, // when set, this goal cannot currently be satisfied, although it could be in the future
Subsys_needs_fixup, // when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
Goal_override, // paired with AIG_TYPE_DYNAMIC to mean this goal overrides any other goal
Purge, // purge this goal next time we process
Goals_purged, // this goal has already caused other goals to get purged
Depart_sound_played,// Goober5000 - replacement for AL's hack ;)
Target_own_team,
NUM_VALUES
};
FLAG_LIST(Maneuver_Override_Flags) {
Full_rot, // full sexp control over pitch/bank/heading rotation
Roll, // Sexp forced roll maneuver
Pitch, // Sexp forced pitch change
Heading, // Sexp forced heading change
Full_lat, // full control over up/side/forward movement
Up, // Sexp forced vertical movement
Sideways, // Sexp forced horizontal movement
Forward, // Sexp forced forward movement
Dont_bank_when_turning, // maps to CIF_DONT_BANK_WHEN_TURNING
Dont_clamp_max_velocity, // maps to CIF_DONT_CLAMP_MAX_VELOCITY
Instantaneous_acceleration, // maps to CIF_INSTANTANEOUS_ACCELERATION
Never_expire, // don't clear the maneuver when the timestamp is up
NUM_VALUES
};
FLAG_LIST(Profile_Flags) {
Advanced_turret_fov_edge_checks,
Ai_aims_from_ship_center,
Ai_can_slow_down_attacking_big_ships,
Ai_guards_specific_ship_in_wing,
All_ships_manage_shields,
Allow_multi_event_scoring,
Allow_primary_link_at_start,
Allow_rapid_secondary_dumbfire,
Allow_turrets_target_weapons_freely,
Allow_vertical_dodge,
Aspect_invulnerability_fix,
Aspect_lock_countermeasure,
Assist_scoring_scales_with_damage,
Beams_damage_weapons,
Big_ships_can_attack_beam_turrets_on_untargeted_ships,
Check_comms_for_non_player_ships,
Disable_linked_fire_penalty,
Disable_player_secondary_doublefire,
Disable_ai_secondary_doublefire,
Disable_weapon_damage_scaling,
Dont_insert_random_turret_fire_delay,
Fix_ai_class_bug,
Fix_ai_path_order_bug,
Fix_heat_seeker_stealth_bug,
Fix_linked_primary_bug,
Fix_ramming_stationary_targets_bug,
Force_beam_turret_fov,
Free_afterburner_use,
Glide_decay_requires_thrust,
Hack_improve_non_homing_swarm_turret_fire_accuracy,
Huge_turret_weapons_ignore_bombs,
Include_beams_in_stat_calcs,
Kill_scoring_scales_with_damage,
Multi_allow_empty_primaries,
Multi_allow_empty_secondaries,
Navigation_subsys_governs_warp,
No_min_dock_speed_cap,
No_special_player_avoid,
No_warp_camera,
Perform_fewer_scream_checks,
Player_weapon_scale_fix,
Prevent_targeting_bombs_beyond_range,
Require_turret_to_have_target_in_fov,
Shockwaves_damage_small_ship_subsystems,
Smart_afterburner_management,
Smart_primary_weapon_selection,
Smart_secondary_weapon_selection,
Smart_shield_management,
Smart_subsystem_targeting_for_turrets,
Strict_turred_tagged_only_targeting,
Support_dont_add_primaries, //Prevents support ship from equipping new primary as requested in http://scp.indiegames.us/mantis/view.php?id=3198
Turrets_ignore_target_radius,
Use_actual_primary_range,
Use_additive_weapon_velocity,
Use_newtonian_dampening,
Use_only_single_fov_for_turrets,
NUM_VALUES
};
}
#endif
-653
View File
@@ -1,653 +0,0 @@
/*
* 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 "ai/ai_profiles.h"
#include "def_files/def_files.h"
#include "globalincs/pstypes.h"
#include "localization/localize.h"
#include "mod_table/mod_table.h"
#include "parse/parselo.h"
#include "ship/ship.h"
#include "weapon/weapon.h"
// global stuff
int Num_ai_profiles;
int Default_ai_profile;
ai_profile_t Ai_profiles[MAX_AI_PROFILES];
// local to this file
static int Ai_profiles_initted = 0;
static char Default_profile_name[NAME_LENGTH];
// utility
void set_flag(ai_profile_t *profile, const char *name, AI::Profile_Flags flag)
{
if (optional_string(name))
{
bool val;
stuff_boolean(&val);
profile->flags.set(flag, val);
}
}
const char *AI_path_types[] = {
"normal",
"alt1",
};
int Num_ai_path_types = sizeof(AI_path_types)/sizeof(char*);
int ai_path_type_match(char *p)
{
int i;
for(i = 0; i < Num_ai_path_types; i++)
{
if(!stricmp(AI_path_types[i], p))
return i;
}
return -1;
}
void parse_ai_profiles_tbl(const char *filename)
{
int i;
char profile_name[NAME_LENGTH];
ai_profile_t dummy_profile;
char *saved_Mp = NULL;
char buf[NAME_LENGTH];
try
{
if (filename == NULL)
read_file_text_from_default(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;
}
else
{
// don't create multiple profiles with the same name
if (previous_profile != NULL)
{
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, "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;
}
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])
{
profile->reset();
}
// brand new profile, so set it to the base defaults
else
{
*profile = Ai_profiles[0];
}
}
// 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++)
{
//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, MAX_DETAIL_LEVEL + 1);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AI::Profile_Flags::Big_ships_can_attack_beam_turrets_on_untargeted_ships);
set_flag(profile, "$smart primary weapon selection:", AI::Profile_Flags::Smart_primary_weapon_selection);
set_flag(profile, "$smart secondary weapon selection:", AI::Profile_Flags::Smart_secondary_weapon_selection);
set_flag(profile, "$smart shield management:", AI::Profile_Flags::Smart_shield_management);
set_flag(profile, "$smart afterburner management:", AI::Profile_Flags::Smart_afterburner_management);
set_flag(profile, "$free afterburner use:", AI::Profile_Flags::Free_afterburner_use);
set_flag(profile, "$allow rapid secondary dumbfire:", AI::Profile_Flags::Allow_rapid_secondary_dumbfire);
set_flag(profile, "$huge turret weapons ignore bombs:", AI::Profile_Flags::Huge_turret_weapons_ignore_bombs);
set_flag(profile, "$don't insert random turret fire delay:", AI::Profile_Flags::Dont_insert_random_turret_fire_delay);
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AI::Profile_Flags::Hack_improve_non_homing_swarm_turret_fire_accuracy);
set_flag(profile, "$shockwaves damage small ship subsystems:", AI::Profile_Flags::Shockwaves_damage_small_ship_subsystems);
set_flag(profile, "$navigation subsystem governs warpout capability:", AI::Profile_Flags::Navigation_subsys_governs_warp);
set_flag(profile, "$check communications for non-player ships:", AI::Profile_Flags::Check_comms_for_non_player_ships);
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AI::Profile_Flags::No_min_dock_speed_cap);
set_flag(profile, "$disable linked fire penalty:", AI::Profile_Flags::Disable_linked_fire_penalty);
set_flag(profile, "$disable player secondary doublefire:", AI::Profile_Flags::Disable_player_secondary_doublefire);
set_flag(profile, "$disable ai secondary doublefire:", AI::Profile_Flags::Disable_ai_secondary_doublefire);
set_flag(profile, "$disable weapon damage scaling:", AI::Profile_Flags::Disable_weapon_damage_scaling);
set_flag(profile, "$use additive weapon velocity:", AI::Profile_Flags::Use_additive_weapon_velocity);
set_flag(profile, "$use newtonian dampening:", AI::Profile_Flags::Use_newtonian_dampening);
set_flag(profile, "$include beams for kills and assists:", AI::Profile_Flags::Include_beams_in_stat_calcs);
set_flag(profile, "$score kills based on damage caused:", AI::Profile_Flags::Kill_scoring_scales_with_damage);
set_flag(profile, "$score assists based on damage caused:", AI::Profile_Flags::Assist_scoring_scales_with_damage);
set_flag(profile, "$allow event and goal scoring in multiplayer:", AI::Profile_Flags::Allow_multi_event_scoring);
set_flag(profile, "$fix linked primary weapon decision bug:", AI::Profile_Flags::Fix_linked_primary_bug);
set_flag(profile, "$fix ramming stationary targets bug:", AI::Profile_Flags::Fix_ramming_stationary_targets_bug);
set_flag(profile, "$prevent turrets targeting too distant bombs:", AI::Profile_Flags::Prevent_targeting_bombs_beyond_range);
set_flag(profile, "$smart subsystem targeting for turrets:", AI::Profile_Flags::Smart_subsystem_targeting_for_turrets);
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AI::Profile_Flags::Fix_heat_seeker_stealth_bug);
set_flag(profile, "$multi allow empty primaries:", AI::Profile_Flags::Multi_allow_empty_primaries);
set_flag(profile, "$multi allow empty secondaries:", AI::Profile_Flags::Multi_allow_empty_secondaries);
set_flag(profile, "$allow turrets target weapons freely:", AI::Profile_Flags::Allow_turrets_target_weapons_freely);
set_flag(profile, "$use only single fov for turrets:", AI::Profile_Flags::Use_only_single_fov_for_turrets);
set_flag(profile, "$allow vertical dodge:", AI::Profile_Flags::Allow_vertical_dodge);
set_flag(profile, "$force beam turrets to use normal fov:", AI::Profile_Flags::Force_beam_turret_fov);
set_flag(profile, "$fix ai class bug:", AI::Profile_Flags::Fix_ai_class_bug);
set_flag(profile, "$turrets ignore targets radius in range checks:", AI::Profile_Flags::Turrets_ignore_target_radius);
set_flag(profile, "$no extra collision avoidance vs player:", AI::Profile_Flags::No_special_player_avoid);
set_flag(profile, "$perform fewer checks for death screams:", AI::Profile_Flags::Perform_fewer_scream_checks);
set_flag(profile, "$advanced turret fov edge checks:", AI::Profile_Flags::Advanced_turret_fov_edge_checks);
set_flag(profile, "$require turrets to have target in fov:", AI::Profile_Flags::Require_turret_to_have_target_in_fov);
set_flag(profile, "$all ships manage shields:", AI::Profile_Flags::All_ships_manage_shields);
set_flag(profile, "$ai aims from ship center:", AI::Profile_Flags::Ai_aims_from_ship_center);
set_flag(profile, "$allow primary link at mission start:", AI::Profile_Flags::Allow_primary_link_at_start);
set_flag(profile, "$allow beams to damage bombs:", AI::Profile_Flags::Beams_damage_weapons);
set_flag(profile, "$disable weapon damage scaling for player:", AI::Profile_Flags::Player_weapon_scale_fix);
set_flag(profile, "$countermeasures affect aspect seekers:", AI::Profile_Flags::Aspect_lock_countermeasure);
set_flag(profile, "$ai guards specific ship in wing:", AI::Profile_Flags::Ai_guards_specific_ship_in_wing);
set_flag(profile, "$support don't add primaries:", AI::Profile_Flags::Support_dont_add_primaries);
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:", AI::Profile_Flags::No_warp_camera);
set_flag(profile, "$fix ai path order bug:", AI::Profile_Flags::Fix_ai_path_order_bug);
set_flag(profile, "$strict turret-tagged-only targeting:", AI::Profile_Flags::Strict_turred_tagged_only_targeting);
set_flag(profile, "$aspect bomb invulnerability fix:", AI::Profile_Flags::Aspect_invulnerability_fix);
set_flag(profile, "$glide decay requires thrust:", AI::Profile_Flags::Glide_decay_requires_thrust);
set_flag(profile, "$ai can slow down when attacking big ships:", AI::Profile_Flags::Ai_can_slow_down_attacking_big_ships);
set_flag(profile, "$use actual primary range:", AI::Profile_Flags::Use_actual_primary_range);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive speed multiplier:")) {
stuff_float(&profile->bay_arrive_speed_mult);
}
if (optional_string("$bay depart speed multiplier:")) {
stuff_float(&profile->bay_depart_speed_mult);
}
// ----------
// compatibility
if (optional_string("$perform less checks for death screams:"))
{
mprintf(("Warning: \"$perform less checks for death screams\" flag is deprecated in favor of \"$perform fewer checks for death screams\"\n"));
bool temp;
stuff_boolean(&temp);
profile->flags.set(AI::Profile_Flags::Perform_fewer_scream_checks, temp);
}
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);
profile->flags.set(AI::Profile_Flags::Allow_primary_link_at_start, !temp);
}
// 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
if (!skip_to_start_of_string_either("$", "#"))
break;
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;
}
}
void ai_profiles_init()
{
int temp;
if (Ai_profiles_initted)
return;
Num_ai_profiles = 0;
Default_ai_profile = 0;
Default_profile_name[0] = '\0';
// init retail entry first
parse_ai_profiles_tbl(NULL);
// now parse the supplied table (if any)
if (cf_exists_full("ai_profiles.tbl", CF_TYPE_TABLES))
parse_ai_profiles_tbl("ai_profiles.tbl");
// parse any modular tables
parse_modular_table("*-aip.tbm", parse_ai_profiles_tbl);
// set default if specified
temp = ai_profile_lookup(Default_profile_name);
if (temp >= 0)
Default_ai_profile = temp;
Ai_profiles_initted = 1;
}
int ai_profile_lookup(char *name)
{
for (int i = 0; i < Num_ai_profiles; i++)
if (!stricmp(name, Ai_profiles[i].profile_name))
return i;
return -1;
}
void ai_profile_t::reset()
{
memset(profile_name, 0, sizeof(profile_name));
flags.reset();
ai_path_mode = 0;
bay_arrive_speed_mult = 0;
bay_depart_speed_mult = 0;
for (int i = 0; i < NUM_SKILL_LEVELS; ++i) {
max_incoming_asteroids[i] = 0;
max_allowed_player_homers[i] = 0;
max_attackers[i] = 0;
predict_position_delay[i] = 0;
in_range_time[i] = 0;
shield_manage_delay[i] = 0;
link_energy_levels_always[i] = 0;
link_energy_levels_maybe[i] = 0;
link_ammo_levels_always[i] = 0;
link_ammo_levels_maybe[i] = 0;
primary_ammo_burst_mult[i] = 0;
cmeasure_life_scale[i] = 0;
cmeasure_fire_chance[i] = 0;
weapon_energy_scale[i] = 0;
shield_energy_scale[i] = 0;
afterburner_recharge_scale[i] = 0;
player_damage_scale[i] = 0;
subsys_damage_scale[i] = 0;
beam_friendly_damage_cap[i] = 0;
turn_time_scale[i] = 0;
glide_attack_percent[i] = 0;
circle_strafe_percent[i] = 0;
glide_strafe_percent[i] = 0;
random_sidethrust_percent[i] = 0;
stalemate_time_thresh[i] = 0;
stalemate_dist_thresh[i] = 0;
max_aim_update_delay[i] = 0;
turret_max_aim_update_delay[i] = 0;
ship_fire_delay_scale_hostile[i] = 0;
ship_fire_delay_scale_friendly[i] = 0;
ship_fire_secondary_delay_scale_hostile[i] = 0;
ship_fire_secondary_delay_scale_friendly[i] = 0;
max_turret_ownage_target[i] = 0;
max_turret_ownage_player[i] = 0;
kill_percentage_scale[i] = 0;
assist_percentage_scale[i] = 0;
assist_award_percentage_scale[i] = 0;
repair_penalty[i] = 0;
delay_bomb_arm_timer[i] = 0;
chance_to_use_missiles_on_plr[i] = 0;
player_autoaim_fov[i] = 0;
}
for (int i = 0; i <= MAX_DETAIL_LEVEL; ++i) {
detail_distance_mult[i] = 0;
}
// via Github #2332, enable bugfixes if we are targeting version 20 and up
if (mod_supports_version(20, 0, 0)) {
flags.set(AI::Profile_Flags::Huge_turret_weapons_ignore_bombs);
flags.set(AI::Profile_Flags::Fix_linked_primary_bug);
flags.set(AI::Profile_Flags::Prevent_targeting_bombs_beyond_range);
flags.set(AI::Profile_Flags::Fix_heat_seeker_stealth_bug);
flags.set(AI::Profile_Flags::Allow_vertical_dodge);
flags.set(AI::Profile_Flags::Fix_ai_class_bug);
flags.set(AI::Profile_Flags::Ai_guards_specific_ship_in_wing);
flags.set(AI::Profile_Flags::Fix_ai_path_order_bug);
flags.set(AI::Profile_Flags::Aspect_invulnerability_fix);
flags.set(AI::Profile_Flags::Use_actual_primary_range);
}
// this flag has been enabled ever since 3.7.2
if (mod_supports_version(3, 7, 2)) {
flags.set(AI::Profile_Flags::Fix_ramming_stationary_targets_bug);
}
}
-119
View File
@@ -1,119 +0,0 @@
/*
* 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.
*/
#ifndef _AI_PROFILES_H_
#define _AI_PROFILES_H_
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "ai/ai_flags.h"
// AI Path types
#define AI_PATH_MODE_NORMAL 0
#define AI_PATH_MODE_ALT1 1
#define MAX_AI_PROFILES 5
class ai_profile_t {
public:
char profile_name[NAME_LENGTH];
flagset<AI::Profile_Flags> flags;
// difficulty-related values
int max_incoming_asteroids[NUM_SKILL_LEVELS]; // max number of asteroids thrown at friendlies
int max_allowed_player_homers[NUM_SKILL_LEVELS]; // max number of simultaneous homing weapons on player
int max_attackers[NUM_SKILL_LEVELS]; // max number of ships that can attack a ship
fix predict_position_delay[NUM_SKILL_LEVELS]; // how long until AI predicts a ship position
float in_range_time[NUM_SKILL_LEVELS]; // seconds to add to time it takes to get enemy in range (only for player's enemies)
float shield_manage_delay[NUM_SKILL_LEVELS]; // how long before AI manages shields (note that the player's team always uses the average skill's delay)
// AI ships link primaries if energy levels greater than these percents
float link_energy_levels_always[NUM_SKILL_LEVELS]; // always link
float link_energy_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
// AI ships link primaries if ammunition levels greater than these percents
float link_ammo_levels_always[NUM_SKILL_LEVELS]; // always link
float link_ammo_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
float primary_ammo_burst_mult[NUM_SKILL_LEVELS]; // SUSHI: Multiplier adjusting burst frequency for ballistic primary weapons
// difficulty-related scales
float cmeasure_life_scale[NUM_SKILL_LEVELS]; // life of countermeasures
float cmeasure_fire_chance[NUM_SKILL_LEVELS]; // chance a countermeasure will be fired based on skill level (also scaled by ai_class)
float weapon_energy_scale[NUM_SKILL_LEVELS]; // weapon energy available
float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available
float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge
float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player
float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire
float turn_time_scale[NUM_SKILL_LEVELS]; // speed at which enemy ships turn
float glide_attack_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "glide attack" move
float circle_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "circle strafe" move
float glide_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use glide when strafing capships
float random_sidethrust_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to randomly use sidethrust while dogfihthing
float stalemate_time_thresh[NUM_SKILL_LEVELS]; // SUSHI: The amount of time required for the AI to detect (and try to break) dogfight stalemate
float stalemate_dist_thresh[NUM_SKILL_LEVELS]; // SUSHI: The maximum distance the AI and target must be within for a stalemate
float max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: The maximum delay before the AI updates their aim against small ships
float turret_max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: As above, but for turrets updating their aim
// Multiplicative delay factors for increasing skill levels.
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
// Multiplicative secondary delay factors for increasing skill levels.
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS];
float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS];
// Maximum turrets of one ship allowed to shoot the same target
int max_turret_ownage_target[NUM_SKILL_LEVELS];
int max_turret_ownage_player[NUM_SKILL_LEVELS];
// percentage of damage caused required for a kill/assist
float kill_percentage_scale[NUM_SKILL_LEVELS];
float assist_percentage_scale[NUM_SKILL_LEVELS];
// percentage of the capships score given to other team mates on a kill
float assist_award_percentage_scale[NUM_SKILL_LEVELS];
// the number of points subtracted from score for a rearm started on a player
int repair_penalty[NUM_SKILL_LEVELS];
float delay_bomb_arm_timer[NUM_SKILL_LEVELS];
// the chance (x/7) that ship is allowed to fire missiles at player ship.
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
// Player-specific autoaim FOV override
float player_autoaim_fov[NUM_SKILL_LEVELS];
float detail_distance_mult[MAX_DETAIL_LEVEL + 1]; //MAX_DETAIL_LEVEL really needs to be 4
int ai_path_mode;
// Ships flying bay paths will gradually accelerate/decelerate instead of
// flying the whole path at max speed
float bay_arrive_speed_mult;
float bay_depart_speed_mult;
void reset();
};
extern int Num_ai_profiles;
extern int Default_ai_profile;
extern ai_profile_t Ai_profiles[MAX_AI_PROFILES];
#define AI_PROFILES_INDEX(ai_p) ((int)((ai_p) - Ai_profiles))
void ai_profiles_init();
int ai_profile_lookup(char *name);
#endif
-1823
View File
File diff suppressed because it is too large. Load diff
-32
View File
@@ -1,32 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef __AIBIG_H__
#define __AIBIG_H__
class object;
struct ai_info;
struct vec3d;
class ship_subsys;
void ai_big_chase();
void ai_big_subsys_path_cleanup(ai_info *aip);
// strafe functions
void ai_big_strafe();
int ai_big_maybe_enter_strafe_mode(const object *objp, int weapon_objnum);
void ai_big_strafe_maybe_attack_turret(const object *ship_objp, const object *weapon_objp);
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov=1.0f);
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float weapon_travel_dist, float fov=1.0f);
#endif
-15533
View File
File diff suppressed because it is too large. Load diff
-2525
View File
File diff suppressed because it is too large. Load diff
-132
View File
@@ -1,132 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _AIGOALS_H
#define _AIGOALS_H
#include "globalincs/globals.h"
#include "globalincs/pstypes.h"
struct wing;
struct ai_info;
struct ai_goal;
// macros for goals which get set via sexpressions in the mission code
// IMPORTANT! If you add a new AI_GOAL_x define, be sure to update the functions
// ai_update_goal_references() and query_referenced_in_ai_goals() or else risk breaking
// Fred. If the goal you add doesn't have a target (such as chase_any), then you don't have
// to worry about doing this. Also add it to list in Fred\Management.cpp, and let Hoffoss know!
// WMC - Oh and add them to Ai_goal_names plz. TY! :)
// Goober5000 - As well as Ai_goal_text and Ai_goal_list, if appropriate
#define AI_GOAL_CHASE (1<<1) // 0x00000002
#define AI_GOAL_DOCK (1<<2) // 0x00000004 // used for undocking as well
#define AI_GOAL_WAYPOINTS (1<<3) // 0x00000008
#define AI_GOAL_WAYPOINTS_ONCE (1<<4) // 0x00000010
#define AI_GOAL_WARP (1<<5) // 0x00000020
#define AI_GOAL_DESTROY_SUBSYSTEM (1<<6) // 0x00000040
#define AI_GOAL_FORM_ON_WING (1<<7) // 0x00000080
#define AI_GOAL_UNDOCK (1<<8) // 0x00000100
#define AI_GOAL_CHASE_WING (1<<9) // 0x00000200
#define AI_GOAL_GUARD (1<<10) // 0x00000400
#define AI_GOAL_DISABLE_SHIP (1<<11) // 0x00000800
#define AI_GOAL_DISARM_SHIP (1<<12) // 0x00001000
#define AI_GOAL_CHASE_ANY (1<<13) // 0x00002000
#define AI_GOAL_IGNORE (1<<14) // 0x00004000
#define AI_GOAL_GUARD_WING (1<<15) // 0x00008000
#define AI_GOAL_EVADE_SHIP (1<<16) // 0x00010000
// the next goals are for support ships only
#define AI_GOAL_STAY_NEAR_SHIP (1<<17) // 0x00020000
#define AI_GOAL_KEEP_SAFE_DISTANCE (1<<18) // 0x00040000
#define AI_GOAL_REARM_REPAIR (1<<19) // 0x00080000
// resume regular goals
#define AI_GOAL_STAY_STILL (1<<20) // 0x00100000
#define AI_GOAL_PLAY_DEAD (1<<21) // 0x00200000
// added by SCP
#define AI_GOAL_CHASE_WEAPON (1<<22) // 0x00400000
#define AI_GOAL_FLY_TO_SHIP (1<<23) // 0x00800000
#define AI_GOAL_IGNORE_NEW (1<<24) // 0x01000000
#define AI_GOAL_CHASE_SHIP_CLASS (1<<25) // 0x02000000
#define AI_GOAL_PLAY_DEAD_PERSISTENT (1<<26) // 0x03000000
// now the masks for ship types
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
//WMC - Don't need these anymore. Whee!
/*
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_IGNORE_NEW | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE )
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FREIGHTER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_PLAY_DEAD_PERSISTENT )
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
*/
#define MAX_AI_DOCK_NAMES 25
typedef flag_def_list ai_goal_list;
extern ai_goal_list Ai_goal_names[];
extern int Num_ai_goals;
extern int Num_ai_dock_names;
extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
extern const char *Ai_goal_text(int goal);
// extern function definitions
extern void ai_post_process_mission();
extern void ai_maybe_add_form_goal( wing *wingp );
extern void ai_process_mission_orders( int objnum, ai_info *aip );
extern int ai_goal_num(ai_goal *goals);
// adds goals to ships/wing through sexpressions
extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name );
extern int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp );
extern void ai_remove_wing_goal_sexp(int sexp, int wingnum);
// adds goals to ships/sings through player orders
extern void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
extern void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum );
extern void ai_remove_ship_goal( ai_info *aip, int index );
extern void ai_clear_ship_goals( ai_info *aip );
extern void ai_clear_wing_goals( int wingnum );
extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
extern void ai_mission_goal_complete( ai_info *aip );
extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
extern void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, const char *new_name);
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name);
extern char *ai_add_dock_name(const char *str);
extern int ai_query_goal_valid( int ship, int ai_goal_type );
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
#endif
-34
View File
@@ -1,34 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _AIINTERNAL_H
#define _AIINTERNAL_H
#include "ship/ship.h"
#include "weapon/weapon.h"
//Returns true if the specified object is a stealth ship, false if not
bool is_object_stealth_ship(object* objp);
//Number of live turrets on the object attacking
int num_turrets_attacking(object *turret_parent, int target_objnum);
//Determine whether an object is targetable within a nebula (checks for stealth)
int object_is_targetable(object *target, ship *viewer);
//Returns the number of enemy fighters within threshold of pos.
int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold);
//Returns true if OK for *aip to fire its current weapon at its current target.
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip);
//Does all the stuff needed to aim and fire a turret.
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum);
#endif
-2852
View File
File diff suppressed because it is too large. Load diff
-940
View File
@@ -1,940 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#include "anim/animplay.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cmdline/cmdline.h"
#include "globalincs/linklist.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "pcxutils/pcxutils.h"
#include "render/3d.h"
#include "graphics/material.h"
#include "tracing/Monitor.h"
static color Color_xparent;
anim *first_anim = NULL;
anim_instance anim_free_list;
anim_instance anim_render_list;
#define MAX_ANIM_INSTANCES 25
anim_instance anim_render_instance[MAX_ANIM_INSTANCES];
int Anim_paused; /// Global variable to pause the playing back of anims
int Anim_inited = FALSE;
fix t1,t2;
int Anim_ignore_frametime=0; // flag used to ignore frametime... useful when need to avoid saturated frametimes
/**
* @brief Initialise animation
* @details Queue all the ::anim_render_instance[] elements onto the ::anim_free_list
*/
void anim_init()
{
int i;
if ( Anim_inited == TRUE )
return;
list_init( &anim_free_list );
list_init( &anim_render_list );
// Link all anim render slots into the free list
for (i=1; i < MAX_ANIM_INSTANCES; i++) {
list_append(&anim_free_list, &anim_render_instance[i]);
}
Anim_paused = 0;
Anim_inited = TRUE;
}
/**
* @brief Display the frames for the currently playing anims
*/
void anim_render_all(int screen_id, float frametime)
{
anim_instance* A;
anim_instance* temp;
A = GET_FIRST(&anim_render_list);
while( A !=END_OF_LIST(&anim_render_list) ) {
temp = GET_NEXT(A);
if ( A->screen_id == screen_id ) {
if ( Anim_ignore_frametime ) {
frametime = 0.0f;
Anim_ignore_frametime=0;
}
if ( anim_show_next_frame(A, frametime) == -1 ) {
A->data = NULL;
anim_release_render_instance(A);
}
}
A = temp;
}
}
/**
* @brief Display the frames for the passed animation
* @details It will ignore animations which do not have the same id as the passed screen_id
*/
void anim_render_one(int screen_id, anim_instance *ani, float frametime)
{
// make sure this guy's screen id matches the passed one
if(screen_id != ani->screen_id){
return;
}
// otherwise render it
if ( Anim_ignore_frametime ) {
frametime = 0.0f;
Anim_ignore_frametime=0;
}
if ( anim_show_next_frame(ani, frametime) == -1 ) {
ani->data = NULL;
anim_release_render_instance(ani);
}
}
MONITOR(NumANIPlayed)
/**
* @brief Setup an anim_play_struct for passing into ::anim_play().
* @details Will fill in default values, which you can then change before calling ::anim_play().
*/
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int base_w, int base_h)
{
aps->anim_info = a_info;
aps->x = x;
aps->y = y;
aps->base_w = base_w;
aps->base_h = base_h;
aps->start_at = 0;
aps->stop_at = a_info->total_frames - 1;
aps->screen_id = 0;
aps->world_pos = NULL;
aps->radius = 0.0f;
aps->framerate_independent = 0;
aps->color = NULL;
aps->skip_frames = 1;
aps->looped = 0;
aps->ping_pong = 0;
}
/**
* @brief Will add an anim instance to the anim_render_list.
* This will cause the anim to be played at the x,y position specified in the parameter list.
*
* @param aps Compressed animation that we should make an instance from
* @return If success pointer to instance, NULL if anim anim could not be played
*/
anim_instance *anim_play(anim_play_struct *aps)
{
Assert( aps->anim_info != NULL );
Assert( aps->start_at >= 0 );
Assert( aps->stop_at < aps->anim_info->total_frames );
Assert( !(aps->looped && aps->ping_pong) ); // shouldn't have these both set at once
MONITOR_INC(NumANIPlayed, 1);
anim_instance *instance;
// Find next free anim instance slot on queue
instance = GET_FIRST(&anim_free_list);
Assert( instance != &anim_free_list ); // shouldn't have the dummy element
// remove instance from the free list
list_remove( &anim_free_list, instance );
// insert instance onto the end of anim_render_list
list_append( &anim_render_list, instance );
aps->anim_info->instance_count++;
instance->frame_num = -1;
instance->last_frame_num = -99;
instance->parent = aps->anim_info;
instance->data = aps->anim_info->data;
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = instance->parent->file_offset;
}
instance->frame = (ubyte *) vm_malloc(instance->parent->width * instance->parent->height * 2);
Assert( instance->frame != NULL );
memset( instance->frame, 0, instance->parent->width * instance->parent->height * 2 );
instance->time_elapsed = 0.0f;
instance->stop_at = aps->stop_at;
instance->x = aps->x;
instance->y = aps->y;
instance->world_pos = aps->world_pos;
instance->radius = aps->radius;
instance->framerate_independent = aps->framerate_independent;
instance->last_bitmap = -1;
instance->stop_now = FALSE;
instance->screen_id = aps->screen_id;
instance->aa_color = aps->color;
instance->skip_frames = aps->skip_frames;
instance->looped = aps->looped;
instance->ping_pong = aps->ping_pong;
instance->direction = ANIM_DIRECT_FORWARD;
instance->paused = 0;
instance->loop_count = 0;
if ( aps->color == NULL ){
instance->xlate_pal = 1;
} else {
instance->xlate_pal = 0;
}
if(aps->base_w < 0 || aps->base_h < 0) {
instance->base_w = gr_screen.max_w_unscaled_zoomed;
instance->base_h = gr_screen.max_h_unscaled_zoomed;
} else {
instance->base_w = aps->base_w;
instance->base_h = aps->base_h;
}
// determining the start_at frame is more complicated, since it must be a key-frame.
// Futhermore, need to subtract 1 from key-frame number, since frame number is always
// incremented the first time anim_show_next_frame() is called
instance->start_at = aps->start_at;
if ( aps->start_at > 0 ) {
key_frame *keyp;
int idx;
int key = 0;
int offset = 0;
int frame_num = aps->start_at;
keyp = instance->parent->keys;
idx = 0;
while (idx < instance->parent->num_keys) {
if (key == frame_num)
break;
key = keyp[idx].frame_num - 1;
offset = keyp[idx].offset;
idx++;
}
if (key > instance->frame_num) { // best key is closer than current position
instance->frame_num = key;
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = instance->parent->file_offset + offset;
} else {
instance->data = instance->parent->data + offset;
}
}
instance->frame_num--; // required
}
return instance;
}
/**
* @brief This function is called to blit the next frame of an anim instance to the screen.
* This is normally called by the anim_render_all() function.
*
* @param instance Pointer to animation instance
* @param frametime Time elapsed since last call, in seconds
*/
int anim_show_next_frame(anim_instance *instance, float frametime)
{
int bitmap_id, bitmap_flags=0, new_frame_num, frame_diff=0, i, n_frames=0,frame_save;
float percent_through, time;
vertex image_vertex;
int aabitmap = 0;
int bpp = 16;
Assert( instance != NULL );
instance->time_elapsed += frametime;
// Advance to the next frame, if we determine enough time has elapsed.
if(instance->direction == ANIM_DIRECT_FORWARD)
n_frames = instance->stop_at - instance->start_at + 1;
else if(instance->direction == ANIM_DIRECT_REVERSE)
n_frames = instance->start_at - instance->stop_at + 1;
time = n_frames / i2fl(instance->parent->fps);
percent_through = instance->time_elapsed / time;
if(instance->direction == ANIM_DIRECT_FORWARD)
new_frame_num = instance->start_at - 1 + (int) lround(percent_through * n_frames);
else
new_frame_num = instance->start_at - 1 - (int) lround(percent_through * n_frames);
frame_save = instance->frame_num;
// If framerate independent, use the new_frame_num... unless instance->skip_frames is
// FALSE, then only advance a maximum of one frame (this is needed since some big animations
// should just play slower rather than taking the hit of decompressing multiple frames and
// creating an even greater slowdown
if (instance->framerate_independent) {
if(instance->direction == ANIM_DIRECT_FORWARD){
if ( new_frame_num > instance->last_frame_num) {
if ( instance->skip_frames )
instance->frame_num = new_frame_num;
else
instance->frame_num++;
}
} else if(instance->direction == ANIM_DIRECT_REVERSE){
if( new_frame_num < instance->last_frame_num) {
if ( instance->skip_frames )
instance->frame_num = new_frame_num;
else
instance->frame_num--;
}
}
}
else {
if(instance->direction == ANIM_DIRECT_FORWARD){
if ( new_frame_num > instance->last_frame_num) {
instance->frame_num++;
}
} else if(instance->direction == ANIM_DIRECT_REVERSE){
if ( new_frame_num < instance->last_frame_num) {
instance->frame_num--;
}
}
}
if(instance->direction == ANIM_DIRECT_FORWARD){
if ( instance->frame_num < instance->start_at ) {
instance->frame_num = instance->start_at;
}
} else if(instance->direction == ANIM_DIRECT_REVERSE){
if ( instance->frame_num > instance->start_at ) {
instance->frame_num = instance->start_at;
}
}
if ( instance->stop_now == TRUE ) {
return -1;
}
// If past the last frame, clamp to the last frame and then set the stop_now flag in the
// anim instance. The next iteration, the animation will stop.
if(instance->direction == ANIM_DIRECT_FORWARD){
if (instance->frame_num >= instance->stop_at ) {
if (instance->looped) { // looped animations
instance->frame_num = instance->stop_at;
instance->time_elapsed = 0.0f;
} else if(instance->ping_pong) { // pingponged animations
instance->frame_num = instance->stop_at;
anim_reverse_direction(instance);
} else { // one-shot animations
instance->frame_num = instance->stop_at;
instance->last_frame_num = instance->frame_num;
instance->stop_now = TRUE;
}
}
} else if(instance->direction == ANIM_DIRECT_REVERSE){
if (instance->frame_num <= instance->stop_at ) {
if (instance->looped) { // looped animations
instance->frame_num = instance->stop_at;
instance->time_elapsed = 0.0f;
} else if(instance->ping_pong) { // pingponged animations
instance->frame_num = instance->stop_at;
anim_reverse_direction(instance);
} else { // one-shot animations
instance->frame_num = instance->stop_at+1;
instance->last_frame_num = instance->frame_num;
instance->stop_now = TRUE;
}
}
}
if(instance->direction == ANIM_DIRECT_FORWARD){
if( instance->last_frame_num >= instance->start_at ) {
frame_diff = instance->frame_num - instance->last_frame_num;
} else {
frame_diff = 1;
}
} else if(instance->direction == ANIM_DIRECT_REVERSE){
if( instance->last_frame_num <= instance->start_at ) {
frame_diff = instance->last_frame_num - instance->frame_num;
} else {
frame_diff = 1;
}
}
Assert(frame_diff >= 0);
Assert( instance->frame_num >= 0 && instance->frame_num < instance->parent->total_frames );
// if the anim is paused, ignore all the above changes and still display this frame
if(instance->paused || Anim_paused){
instance->frame_num = frame_save;
instance->time_elapsed -= frametime;
frame_diff = 0;
}
if (instance->parent->flags & ANF_XPARENT){
bitmap_flags = 0;
}
bpp = 16;
if(instance->aa_color != NULL){
bitmap_flags |= BMP_AABITMAP;
aabitmap = 1;
bpp = 8;
}
if ( frame_diff > 0 ) {
instance->last_frame_num = instance->frame_num;
t1 = timer_get_fixed_seconds();
for ( i = 0; i < frame_diff; i++ ) {
anim_check_for_palette_change(instance);
// if we're playing backwards, every frame must be a keyframe and we set the data ptr here
if(instance->direction == ANIM_DIRECT_REVERSE){
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = instance->parent->file_offset + instance->parent->keys[instance->frame_num-1].offset;
} else {
instance->data = instance->parent->data + instance->parent->keys[instance->frame_num-1].offset;
}
}
ubyte *temp = NULL;
int temp_file_offset = -1;
// if we're using bitmap polys
BM_SELECT_TEX_FORMAT();
if ( anim_instance_is_streamed(instance) ) {
if ( instance->xlate_pal ){
temp_file_offset = unpack_frame_from_file(instance, instance->frame, instance->parent->width*instance->parent->height, instance->parent->palette_translation, aabitmap, bpp);
} else {
temp_file_offset = unpack_frame_from_file(instance, instance->frame, instance->parent->width*instance->parent->height, NULL, aabitmap, bpp);
}
} else {
if ( instance->xlate_pal ){
temp = unpack_frame(instance, instance->data, instance->frame, instance->parent->width*instance->parent->height, instance->parent->palette_translation, aabitmap, bpp);
} else {
temp = unpack_frame(instance, instance->data, instance->frame, instance->parent->width*instance->parent->height, NULL, aabitmap, bpp);
}
}
// always go back to screen format
BM_SELECT_SCREEN_FORMAT();
// see if we had an error during decode (corrupted anim stream)
if ( (temp == NULL) && (temp_file_offset < 0) ) {
mprintf(("ANI: Fatal ERROR at frame %i!! Aborting playback of \"%s\"...\n", instance->frame_num, instance->parent->name));
// return -1 to end all playing of this anim instanc
return -1;
}
if(instance->direction == ANIM_DIRECT_FORWARD){
if ( anim_instance_is_streamed(instance) ) {
instance->file_offset = temp_file_offset;
} else {
instance->data = temp;
}
}
}
t2 = timer_get_fixed_seconds();
}
else {
t2=t1=0;
}
// this only happens when the anim is being looped, we need to reset the last_frame_num
if ( (instance->time_elapsed == 0) && (instance->looped) ) {
instance->last_frame_num = -1;
instance->frame_num = -1;
instance->data = instance->parent->data;
instance->file_offset = instance->parent->file_offset;
instance->loop_count++;
}
t1 = timer_get_fixed_seconds();
if ( frame_diff == 0 && instance->last_bitmap != -1 ) {
bitmap_id = instance->last_bitmap;
}
else {
if ( instance->last_bitmap != -1 ){
bm_release(instance->last_bitmap);
}
bitmap_id = bm_create(bpp, instance->parent->width, instance->parent->height, instance->frame, bitmap_flags);
}
if ( bitmap_id == -1 ) {
// anim has finsished playing, free the instance frame data
anim_release_render_instance(instance);
return -1;
// NOTE: there is no need to free the instance, since it was pre-allocated as
// part of the anim_free_list
}
else {
gr_set_bitmap(bitmap_id);
// determine x,y to display the bitmap at
if ( instance->world_pos == NULL ) {
int old_max_w_unscaled = gr_screen.max_w_unscaled;
int old_max_h_unscaled = gr_screen.max_h_unscaled;
int old_max_w_unscaled_zoomed = gr_screen.max_w_unscaled_zoomed;
int old_max_h_unscaled_zoomed = gr_screen.max_h_unscaled_zoomed;
gr_set_screen_scale(instance->base_w, instance->base_h);
gr_set_clip(0, 0, instance->base_w, instance->base_h, GR_RESIZE_MENU);
if ( instance->aa_color == NULL ) {
gr_bitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
}
else {
gr_set_color_fast( (color*)instance->aa_color );
gr_aabitmap(instance->x, instance->y, GR_RESIZE_MENU_NO_OFFSET);
}
gr_set_screen_scale(old_max_w_unscaled, old_max_h_unscaled, old_max_w_unscaled_zoomed, old_max_h_unscaled_zoomed);
gr_reset_clip();
}
else {
g3_rotate_vertex(&image_vertex,instance->world_pos);
Assert(instance->radius != 0.0f);
//g3_draw_bitmap(&image_vertex, 0, instance->radius*1.5f, TMAP_FLAG_TEXTURED | TMAP_HTL_2D);
material mat_params;
material_set_unlit(&mat_params, bitmap_id, 1.0f, false, false);
g3_render_rect_screen_aligned_2d(&mat_params, &image_vertex, 0, instance->radius*1.5f);
}
instance->last_bitmap = bitmap_id;
}
t2 = timer_get_fixed_seconds();
return 0;
}
/**
* @brief Free a particular animation instance that is on the anim_render_list.
* Do not call this function to free an animation instance in general (use
* free_anim_instance() for that), only when you want to free an instance
* that is on the anim_render_list
*/
void anim_release_render_instance(anim_instance* instance)
{
Assert( instance != NULL );
if (instance->frame != NULL)
vm_free(instance->frame);
instance->frame = NULL;
instance->parent->instance_count--;
if ( instance->last_bitmap != -1 ) {
bm_release(instance->last_bitmap);
instance->last_bitmap = -1;
}
// remove instance from anim_render_list
list_remove( &anim_render_list, instance );
// insert instance into the anim_free_list
list_append( &anim_free_list, instance );
}
/**
* @brief Free all anim instances that are on the anim_render_list.
*
* @param screen_id Optional parameter that lets you only free a subset of the anim instances.
* A screen_id of 0 is the default value, and this is used for animations that always play when
* they are placed on the aim_render_list.
*/
void anim_release_all_instances(int screen_id)
{
anim_instance* A;
anim_instance* temp;
if ( Anim_inited == FALSE )
return;
A = GET_FIRST(&anim_render_list);
while( A !=END_OF_LIST(&anim_render_list) ) {
temp = GET_NEXT(A);
if ( A->screen_id == screen_id || screen_id == 0 ) {
anim_release_render_instance(A);
}
A = temp;
}
}
// -----------------------------------------------------------------------------
// anim_read_header()
//
// Read the header of a .ani file. Below is the format of a .ani header
//
// #bytes | description
// 2 | obsolete, kept for compatibility with old versions
// 2 | version number
// 2 | fps
// 1 | transparent red value
// 1 | transparent green value
// 1 | transparent blue value
// 2 | width
// 2 | height
// 2 | number of frames
// 1 | packer code
// 763 | palette
// 2 | number of key frames
// 2 | key frame number } repeats
// 4 | key frame offset } repeats
// 4 | compressed data length
//
void anim_read_header(anim *ptr, CFILE *fp)
{
ptr->width = cfread_short(fp);
// If first 2 bytes are zero, this means we are using a new format, which includes
// a version, and fps values. This is only done since a version number was not included
// in the original header.
// default
Color_xparent.red = 0;
Color_xparent.green = 255;
Color_xparent.blue = 0;
if ( ptr->width == 0 ) {
ptr->version = cfread_short(fp);
ptr->fps = cfread_short(fp);
// version 2 added a custom transparency color
if ( ptr->version >= 2 ) {
cfread(&Color_xparent.red, 1, 1, fp);
cfread(&Color_xparent.green, 1, 1, fp);
cfread(&Color_xparent.blue, 1, 1, fp);
}
ptr->width = cfread_short(fp);
}
else {
ptr->version = 0;
ptr->fps = 30;
}
ptr->height = cfread_short(fp);
#ifndef NDEBUG
// get size of ani compared to power of 2
int r, floor_pow;
r = ptr->height;
floor_pow = 0;
while(r >= 2) {
r /= 2;
floor_pow++;
}
int floor_size = (int) pow(2.0, floor_pow);
int diff = ptr->height - floor_size;
float waste = 100.0f * float((floor_size - diff))/(2.0f *(float)floor_size);
if (diff != 0) {
if (ptr->height > 16) {
mprintf(("ANI %s with size %dx%d (%.1f%% wasted)\n", ptr->name, ptr->width, ptr->height, waste));
}
}
#endif
ptr->total_frames = cfread_short(fp);
ptr->packer_code = cfread_ubyte(fp);
cfread(&ptr->palette, 256, 3, fp);
ptr->num_keys = cfread_short(fp);
// store xparent colors
ptr->xparent_r = Color_xparent.red;
ptr->xparent_g = Color_xparent.green;
ptr->xparent_b = Color_xparent.blue;
if(ptr->total_frames == ptr->num_keys){
ptr->flags |= ANF_ALL_KEYFRAMES;
}
}
/**
* @brief Load an animation. This stores the compressed data, which instances of the animation can reference.
* Must be free'ed later with anim_free().
*
* @param real_filename Filename of animation
* @param cf_dir_type
* @param file_mapped Whether to use memory-mapped file or not.
*
* @details Memory-mapped files will page in the animation from disk as it is needed, but performance is not as good.
* @return Pointer to anim that is loaded if sucess, NULL if failure.
*/
anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
{
anim *ptr;
CFILE *fp;
int count,idx;
char name[_MAX_PATH];
Assert( real_filename != NULL );
strcpy_s( name, real_filename );
char *p = strchr( name, '.' );
if ( p ) {
*p = 0;
}
strcat_s( name, ".ani" );
ptr = first_anim;
while (ptr) {
if (!stricmp(name, ptr->name))
break;
ptr = ptr->next;
}
if (!ptr) {
fp = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
if ( !fp )
return NULL;
ptr = (anim *) vm_malloc(sizeof(anim));
Assert(ptr);
ptr->flags = 0;
ptr->next = first_anim;
first_anim = ptr;
Assert(strlen(name) < _MAX_PATH - 1);
strcpy_s(ptr->name, name);
ptr->instance_count = 0;
ptr->width = 0;
ptr->height = 0;
ptr->total_frames = 0;
ptr->keys = NULL;
ptr->ref_count=0;
anim_read_header(ptr, fp);
if (ptr->width < 0 || ptr->height < 0) {
Error(LOCATION, "Ani file %s has a faulty header and cannot be loaded.", name);
}
if(ptr->num_keys > 0){
ptr->keys = (key_frame*)vm_malloc(sizeof(key_frame) * ptr->num_keys);
Assert(ptr->keys != NULL);
}
// store how long the anim should take on playback (in seconds)
ptr->time = i2fl(ptr->total_frames)/ptr->fps;
for(idx=0;idx<ptr->num_keys;idx++){
ptr->keys[idx].frame_num = 0;
cfread(&ptr->keys[idx].frame_num, 2, 1, fp);
cfread(&ptr->keys[idx].offset, 4, 1, fp);
ptr->keys[idx].frame_num = INTEL_INT( ptr->keys[idx].frame_num ); //-V570
ptr->keys[idx].offset = INTEL_INT( ptr->keys[idx].offset ); //-V570
}
cfread(&count, 4, 1, fp); // size of compressed data
count = INTEL_INT( count );
ptr->cfile_ptr = NULL;
if ( file_mapped == PAGE_FROM_MEM) {
// Try mapping the file to memory
ptr->flags |= ANF_MEM_MAPPED;
ptr->cfile_ptr = cfopen(name, "rb", CFILE_MEMORY_MAPPED, cf_dir_type);
}
// couldn't memory-map file... must be in a packfile, so stream manually
if ( file_mapped == PAGE_FROM_MEM && !ptr->cfile_ptr ) {
ptr->flags &= ~ANF_MEM_MAPPED;
ptr->flags |= ANF_STREAMED;
ptr->cfile_ptr = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
}
ptr->cache = NULL;
// If it opened properly as mem-mapped (or streamed)
if (ptr->cfile_ptr != NULL) {
// VERY IMPORTANT STEP
// Set the data pointer to the compressed data (which is not at the start of the
// file). Use ftell() to find out how far we've already parsed into the file
//
int offset;
offset = cftell(fp);
ptr->file_offset = offset;
if ( ptr->flags & ANF_STREAMED ) {
ptr->data = NULL;
ptr->cache_file_offset = ptr->file_offset;
ptr->cache = (ubyte*)vm_malloc(ANI_STREAM_CACHE_SIZE+2);
Assert(ptr->cache);
cfseek(ptr->cfile_ptr, offset, CF_SEEK_SET);
cfread(ptr->cache, ANI_STREAM_CACHE_SIZE, 1, ptr->cfile_ptr);
} else {
ptr->data = (ubyte*)cf_returndata(ptr->cfile_ptr) + offset;
}
} else {
// Not a memory mapped file (or streamed)
ptr->flags &= ~ANF_MEM_MAPPED;
ptr->flags &= ~ANF_STREAMED;
ptr->data = (ubyte *) vm_malloc(count);
ptr->file_offset = -1;
cfread(ptr->data, count, 1, fp);
}
cfclose(fp);
// store screen signature, so we can tell if palette changes
ptr->screen_sig = gr_screen.signature;
anim_set_palette(ptr);
}
ptr->ref_count++;
return ptr;
}
/**
* @brief Free an animation that was loaded with anim_load().
* @details All instances referencing this animation must be free'ed or get an assert.
*/
int anim_free(anim *ptr)
{
Assert ( ptr != NULL );
anim *list, **prev_anim;
list = first_anim;
prev_anim = &first_anim;
while (list && (list != ptr)) {
prev_anim = &list->next;
list = list->next;
}
if ( !list )
return -2;
// only free when ref_count is 0
ptr->ref_count--;
if ( ptr->ref_count > 0 )
return -1;
// only free if there are no playing instances
if ( ptr->instance_count > 0 )
return -1;
if(ptr->keys != NULL){
vm_free(ptr->keys);
ptr->keys = NULL;
}
if ( ptr->flags & (ANF_MEM_MAPPED|ANF_STREAMED) ) {
cfclose(ptr->cfile_ptr);
if (ptr->cache != NULL) {
vm_free(ptr->cache);
ptr->cache = NULL;
}
}
else {
Assert(ptr->data);
if (ptr->data != NULL) {
vm_free(ptr->data);
ptr->data = NULL;
}
}
*prev_anim = ptr->next;
vm_free(ptr);
return 0;
}
/**
* @brief Called at the beginning of a mission to initialize any mission dependent anim data.
* @todo Redundant?
*/
void anim_level_init()
{
}
/**
* @brief Called after the end of a mission to clean up any mission dependent anim data.
*/
void anim_level_close()
{
anim_release_all_instances();
}
void anim_reverse_direction(anim_instance *ai)
{
int temp;
// you're not allowed to call anim_reverse_direction(...) unless every frame is a keyframe!!!!
// The God of Delta-RLE demands it be thus.
Assertion( ai->parent->flags & ANF_ALL_KEYFRAMES, "Ani was set to play backwards. In order to enable this, all frames of the animation MUST be keyframes.");
// flip the animation direction
if(ai->direction == ANIM_DIRECT_FORWARD){
ai->direction = ANIM_DIRECT_REVERSE;
} else if(ai->direction == ANIM_DIRECT_REVERSE){
ai->direction = ANIM_DIRECT_FORWARD;
}
// flip frame_num and last_frame_num
temp = ai->frame_num;
ai->frame_num = ai->last_frame_num;
ai->last_frame_num = temp;
// flip the start and stop at frames
temp = ai->stop_at;
ai->stop_at = ai->start_at;
ai->start_at = temp;
// make sure to sync up the time correctly
if(ai->direction == ANIM_DIRECT_FORWARD){
ai->time_elapsed = ((float)ai->frame_num - (float)ai->start_at - 1.0f) / (float)ai->parent->fps;
} else if(ai->direction == ANIM_DIRECT_REVERSE) {
ai->time_elapsed = ((float)ai->start_at - (float)ai->frame_num - 1.0f) / (float)ai->parent->fps;
}
}
void anim_ignore_next_frametime()
{
Anim_ignore_frametime=1;
}
int anim_instance_is_streamed(anim_instance *ai)
{
Assert(ai);
return ( ai->parent->flags & ANF_STREAMED );
}
unsigned char anim_instance_get_byte(anim_instance *ai, int offset)
{
int absolute_offset;
anim *parent;
Assert(ai);
Assert(ai->parent->cfile_ptr);
Assert(ai->parent->flags & ANF_STREAMED);
parent = ai->parent;
absolute_offset = ai->file_offset + offset;
// maybe in cache?
int cache_offset;
cache_offset = absolute_offset - parent->cache_file_offset;
if ( (cache_offset >= 0) && (cache_offset < ANI_STREAM_CACHE_SIZE) ) {
return parent->cache[cache_offset];
} else {
// fill cache
cfseek(parent->cfile_ptr, absolute_offset, CF_SEEK_SET);
cfread(parent->cache, ANI_STREAM_CACHE_SIZE, 1, parent->cfile_ptr);
parent->cache_file_offset = absolute_offset;
return parent->cache[0];
}
}
-68
View File
@@ -1,68 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef __ANIMPLAY_H__
#define __ANIMPLAY_H__
#include "cfile/cfile.h"
#include "globalincs/pstypes.h"
struct anim;
struct anim_info;
struct anim_instance;
// structure passed in when playing an anim. Talk about overkill..
typedef struct {
anim *anim_info;
int x;
int y;
int base_w;
int base_h;
int start_at;
int stop_at;
int screen_id;
vec3d *world_pos;
float radius;
int framerate_independent;
void *color;
int skip_frames;
int looped;
int ping_pong;
} anim_play_struct;
enum
{
PAGE_FROM_DISK = 0,
PAGE_FROM_MEM = 1
};
extern int Anim_paused;
void anim_init();
void anim_level_init();
void anim_level_close();
void anim_render_all(int screen_id, float frametime);
void anim_render_one(int screen_id, anim_instance *ani, float frametime);
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int max_x = -1, int max_y = -1);
anim_instance *anim_play(anim_play_struct *aps);
void anim_ignore_next_frametime();
int anim_show_next_frame(anim_instance *instance, float frametime);
void anim_release_all_instances(int screen_id = 0);
void anim_release_render_instance(anim_instance* instance);
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
int anim_free(anim *ptr);
void anim_read_header(anim *ptr, CFILE *fp);
void anim_reverse_direction(anim_instance *ai); // called automatically for ping-ponging, and can also be called externally
int anim_instance_is_streamed(anim_instance *ai);
unsigned char anim_instance_get_byte(anim_instance *ai, int offset);
#endif /* __ANIMPLAY_H__ */
-721
View File
@@ -1,721 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#include "anim/animplay.h"
#include "anim/packunpack.h"
#include "bmpman/bmpman.h"
#include "graphics/2d.h"
const int packer_code = PACKER_CODE;
const int transparent_code = 254;
void anim_check_for_palette_change(anim_instance *instance) {
if ( instance->parent->screen_sig != gr_screen.signature ) {
instance->parent->screen_sig = gr_screen.signature;
anim_set_palette(instance->parent);
}
}
anim_instance *init_anim_instance(anim *ptr, int bpp)
{
anim_instance *inst;
if (!ptr) {
Int3();
return NULL;
}
if ( ptr->flags & ANF_STREAMED ) {
if ( ptr->file_offset < 0 ) {
Int3();
return NULL;
}
} else {
if ( !ptr->data ) {
Int3();
return NULL;
}
}
ptr->instance_count++;
inst = (anim_instance *) vm_malloc(sizeof(anim_instance));
Assert(inst);
memset(inst, 0, sizeof(anim_instance));
inst->frame_num = -1;
inst->last_frame_num = -1;
inst->parent = ptr;
inst->data = ptr->data;
inst->file_offset = ptr->file_offset;
inst->stop_now = FALSE;
inst->aa_color = NULL;
inst->frame = (ubyte *) vm_malloc(inst->parent->width * inst->parent->height * (bpp >> 3));
Assert( inst->frame != NULL );
memset( inst->frame, 0, inst->parent->width * inst->parent->height * (bpp >> 3) );
return inst;
}
void free_anim_instance(anim_instance *inst)
{
Assert(inst->frame);
vm_free(inst->frame);
inst->frame = NULL;
inst->parent->instance_count--;
inst->parent = NULL;
inst->data = NULL;
inst->file_offset = -1;
vm_free(inst);
}
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp)
{
if ( anim_instance_is_streamed(inst) ) {
if ( inst->file_offset < 0 ) {
return NULL;
}
} else {
if (!inst->data){
return NULL;
}
}
inst->frame_num++;
if (inst->frame_num >= inst->parent->total_frames) {
inst->data = NULL;
inst->file_offset = inst->parent->file_offset;
return NULL;
}
anim_check_for_palette_change(inst);
if ( anim_instance_is_streamed(inst) ) {
if ( xlate_pal ){
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation, aabitmap, bpp);
} else {
inst->file_offset = unpack_frame_from_file(inst, inst->frame, inst->parent->width*inst->parent->height, NULL, aabitmap, bpp);
}
} else {
if ( xlate_pal ){
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, inst->parent->palette_translation, aabitmap, bpp);
} else {
inst->data = unpack_frame(inst, inst->data, inst->frame, inst->parent->width*inst->parent->height, NULL, aabitmap, bpp);
}
}
return inst->frame;
}
/**
* @brief Convert a 24 bit value to a 16 bit value
* @param bit_24 24 bit value
* @param bit_16 16 bit value (output)
*/
void convert_24_to_16(int bit_24, ushort *bit_16)
{
ubyte *pixel = (ubyte*)&bit_24;
ubyte alpha = 1;
bm_set_components((ubyte*)bit_16, (ubyte*)&pixel[0], (ubyte*)&pixel[1], (ubyte*)&pixel[2], &alpha);
}
/**
* @brief Unpack a pixel given the passed index and the anim_instance's palette
* @return Bytes stuffed
*/
int unpack_pixel(anim_instance *ai, ubyte *data, ubyte pix, int aabitmap, int bpp)
{
int bit_24;
ushort bit_16 = 0;
ubyte bit_8 = 0;
ubyte al = 0;
ubyte r, g, b;
int pixel_size = (bpp / 8);
anim *a = ai->parent;
Assert(a);
// if this is an aabitmap, don't run through the palette
if(aabitmap){
switch(bpp){
case 16 :
bit_16 = (ushort)pix;
break;
case 8:
// 8 bit-per-pixel aa bitmaps are a bit special since they only use value in the range [0, 15] where 15 wraps
// around back to 0. Since the rest of the code expects the value to be in the range [0, 255] the pixel value
// needs to be adjusted here. By muliplying the value with 17 the original range [0, 15] is mapped to [0, 255]
if (pix >= 15) {
bit_8 = 0;
} else {
bit_8 = (ubyte)(pix * 17);
}
break;
default:
Int3();
}
} else {
// if the pixel value is 255, or is the xparent color, make it so
if(((a->palette[pix*3] == a->xparent_r) && (a->palette[pix*3+1] == a->xparent_g) && (a->palette[pix*3+2] == a->xparent_b)) ){
if (pixel_size > 2) {
bit_24 = 0;
} else {
r = b = 0;
g = 255;
bm_set_components((ubyte*)&bit_16, &r, &g, &b, &al);
}
} else {
if (pixel_size > 2) {
ubyte pixel[4];
pixel[0] = ai->parent->palette[pix * 3 + 2];
pixel[1] = ai->parent->palette[pix * 3 + 1];
pixel[2] = ai->parent->palette[pix * 3];
pixel[3] = 255;
memcpy(&bit_24, pixel, sizeof(int));
if (pixel_size == 4) {
bit_24 = INTEL_INT(bit_24);
}
} else {
// stuff the 24 bit value
memcpy(&bit_24, &ai->parent->palette[pix * 3], 3); //-V512
// convert to 16 bit
convert_24_to_16(bit_24, &bit_16);
}
}
}
// stuff the pixel
switch (bpp) {
case 32:
case 24:
memcpy(data, &bit_24, pixel_size);
break;
case 16:
memcpy(data, &bit_16, pixel_size);
break;
case 8:
*data = bit_8;
break;
default:
Int3();
return 0;
}
return pixel_size;
}
/**
* @brief Unpack a pixel given the passed index and the anim_instance's palette
* @return Bytes stuffed
*/
int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count = 0, int aabitmap = 0, int bpp = 8)
{
int bit_24;
int idx;
ubyte al = 0;
ushort bit_16 = 0;
ubyte bit_8 = 0;
anim *a = ai->parent;
int pixel_size = (bpp / 8);
ubyte r, g, b;
Assert(a);
// if this is an aabitmap, don't run through the palette
if(aabitmap){
switch(bpp){
case 16 :
bit_16 = (ushort)pix;
break;
case 8 :
// 8 bit-per-pixel aa bitmaps are a bit special since they only use value in the range [0, 15] where 15 wraps
// around back to 0. Since the rest of the code expects the value to be in the range [0, 255] the pixel value
// needs to be adjusted here. By muliplying the value with 17 the original range [0, 15] is mapped to [0, 255]
if (pix >= 15) {
bit_8 = 0;
} else {
bit_8 = (ubyte)(pix * 17);
}
break;
default :
Int3();
}
} else {
// if the pixel value is 255, or is the xparent color, make it so
if(((a->palette[pix*3] == a->xparent_r) && (a->palette[pix*3+1] == a->xparent_g) && (a->palette[pix*3+2] == a->xparent_b)) ){
if (pixel_size > 2) {
bit_24 = 0;
} else {
r = b = 0;
g = 255;
bm_set_components((ubyte*)&bit_16, &r, &g, &b, &al);
}
} else {
if (pixel_size > 2) {
ubyte pixel[4];
pixel[0] = ai->parent->palette[pix * 3 + 2];
pixel[1] = ai->parent->palette[pix * 3 + 1];
pixel[2] = ai->parent->palette[pix * 3];
pixel[3] = 255;
memcpy(&bit_24, pixel, sizeof(int));
if (pixel_size == 4) {
bit_24 = INTEL_INT(bit_24);
}
} else {
// stuff the 24 bit value
memcpy(&bit_24, &ai->parent->palette[pix * 3], 3); //-V512
// convert to 16 bit
convert_24_to_16(bit_24, &bit_16);
}
}
}
// stuff the pixel
for (idx=0; idx<count; idx++) {
switch (bpp) {
case 32:
case 24:
memcpy(data + (idx * pixel_size), &bit_24, pixel_size);
break;
case 16:
memcpy(data + (idx * pixel_size), &bit_16, pixel_size);
break;
case 8:
*(data + idx) = bit_8;
break;
}
}
return (pixel_size * count);
}
/**
* @brief Unpack frame
*
* @param ai Animation instance
* @param ptr Packed data to unpack
* @param frame Where to store unpacked data to
* @param size Total number of unpacked pixels requested
* @param pal_translate Color translation lookup table (NULL if no palette translation desired)
* @param aabitmap
* @param bpp
*/
ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
{
int xlate_pal, value, count = 0;
int stuffed;
int pixel_size = (bpp / 8);
if ( pal_translate == NULL ) {
xlate_pal = 0;
}
else {
xlate_pal = 1;
}
if (*ptr == PACKING_METHOD_RLE_KEY) { // key frame, Hoffoss's RLE format
ptr++;
while (size > 0) {
value = *ptr++;
if (value != packer_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
frame += stuffed;
size--;
} else {
count = *ptr++;
if (count < 2){
value = packer_code;
} else {
value = *ptr++;
}
if (++count > size){
count = size;
}
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
frame += stuffed;
size -= count;
}
}
}
else if ( *ptr == PACKING_METHOD_STD_RLE_KEY) { // key frame, with high bit as count
ptr++;
while (size > 0) {
value = *ptr++;
if ( !(value & STD_RLE_CODE) ) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
frame += stuffed;
size--;
} else {
count = value & (~STD_RLE_CODE);
value = *ptr++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
frame += stuffed;
}
}
}
else if (*ptr == PACKING_METHOD_RLE) { // normal frame, Hoffoss's RLE format
ptr++;
while (size > 0) {
value = *ptr++;
if (value != packer_code) {
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
} else {
// temporary pixel
stuffed = pixel_size;
}
frame += stuffed;
size--;
} else {
count = *ptr++;
if (count < 2){
value = packer_code;
} else {
value = *ptr++;
}
if (++count > size){
count = size;
}
size -= count;
Assert(size >= 0);
if (value != transparent_code ) {
if ( xlate_pal ) {
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
} else {
stuffed = count * pixel_size;
}
frame += stuffed;
}
}
}
else if ( *ptr == PACKING_METHOD_STD_RLE) { // normal frame, with high bit as count
ptr++;
while (size > 0) {
value = *ptr++;
if ( !(value & STD_RLE_CODE) ) {
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
} else {
stuffed = pixel_size;
}
frame += stuffed;
size--;
} else {
count = value & (~STD_RLE_CODE);
value = *ptr++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
} else {
stuffed = pixel_size * count;
}
frame += stuffed;
}
}
}
else {
// unknown packing method
return NULL;
}
return ptr;
}
/**
* @brief Unpack frame from file
*
* @param ai Animation instance
* @param frame Where to store unpacked data to
* @param size Total number of unpacked pixels requested
* @param pal_translate Color translation lookup table (NULL if no palette translation desired)
* @param aabitmap
* @param bpp
*/
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
{
int xlate_pal, value, count = 0;
int offset = 0;
int stuffed;
int pixel_size = (bpp / 8);
if ( pal_translate == NULL ) {
xlate_pal = 0;
}
else {
xlate_pal = 1;
}
if (anim_instance_get_byte(ai,offset) == PACKING_METHOD_RLE_KEY) { // key frame, Hoffoss's RLE format
offset++;
while (size > 0) {
value = anim_instance_get_byte(ai,offset);
offset++;
if (value != packer_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
frame += stuffed;
size--;
} else {
count = anim_instance_get_byte(ai,offset);
offset++;
if (count < 2) {
value = packer_code;
} else {
value = anim_instance_get_byte(ai,offset);
offset++;
}
if (++count > size){
count = size;
}
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
frame += stuffed;
size -= count;
}
}
}
else if ( anim_instance_get_byte(ai,offset) == PACKING_METHOD_STD_RLE_KEY) { // key frame, with high bit as count
offset++;
while (size > 0) {
value = anim_instance_get_byte(ai,offset);
offset++;
if ( !(value & STD_RLE_CODE) ) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
frame += stuffed;
size--;
} else {
count = value & (~STD_RLE_CODE);
value = anim_instance_get_byte(ai,offset);
offset++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
frame += stuffed;
}
}
}
else if (anim_instance_get_byte(ai,offset) == PACKING_METHOD_RLE) { // normal frame, Hoffoss's RLE format
offset++;
while (size > 0) {
value = anim_instance_get_byte(ai,offset);
offset++;
if (value != packer_code) {
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
} else {
stuffed = pixel_size;
}
frame += stuffed;
size--;
} else {
count = anim_instance_get_byte(ai,offset);
offset++;
if (count < 2) {
value = packer_code;
} else {
value = anim_instance_get_byte(ai,offset);
offset++;
}
if (++count > size){
count = size;
}
size -= count;
Assert(size >= 0);
if (value != transparent_code ) {
if ( xlate_pal ) {
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
} else {
stuffed = pixel_size * count;
}
frame += stuffed;
}
}
}
else if ( anim_instance_get_byte(ai,offset) ) { // normal frame, with high bit as count
offset++;
while (size > 0) {
value = anim_instance_get_byte(ai,offset);
offset++;
if ( !(value & STD_RLE_CODE) ) {
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel(ai, frame, pal_translate[value], aabitmap, bpp);
} else {
stuffed = unpack_pixel(ai, frame, (ubyte)value, aabitmap, bpp);
}
} else {
stuffed = pixel_size;
}
frame += stuffed;
size--;
} else {
count = value & (~STD_RLE_CODE);
value = anim_instance_get_byte(ai,offset);
offset++;
if (count > size)
count = size;
size -= count;
Assert(size >= 0);
if (value != transparent_code) {
if ( xlate_pal ){
stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp);
} else {
stuffed = unpack_pixel_count(ai, frame, (ubyte)value, count, aabitmap, bpp);
}
} else {
stuffed = pixel_size * count;
}
frame += stuffed;
}
}
}
else {
// unknown packing method
return -1;
}
return ai->file_offset + offset;
}
/**
* @brief Set animation palette
* @todo Actually convert the frame data to correct palette at this point
*/
void anim_set_palette(anim *ptr)
{
int i, xparent_found = 0;
// create the palette translation look-up table
for ( i = 0; i < 256; i++ ) {
ptr->palette_translation[i] = (ubyte)i;
}
if ( xparent_found ) {
ptr->flags |= ANF_XPARENT;
}
else {
ptr->flags &= ~ANF_XPARENT;
}
}
-111
View File
@@ -1,111 +0,0 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef __PACKUNPACK_H__
#define __PACKUNPACK_H__
#include "globalincs/pstypes.h"
struct CFILE;
#define ANI_STREAM_CACHE_SIZE 4096
#define PACKER_CODE 0xEE /// Used by PACKING_METHOD_RLE
#define PACKING_METHOD_RLE 0 /// Hoffoss's RLE format
#define PACKING_METHOD_RLE_KEY 1 /// Hoffoss's key frame RLE format
#define PACKING_METHOD_STD_RLE 2 /// Standard RLE format (high bit is count)
#define PACKING_METHOD_STD_RLE_KEY 3 /// Standard RLE format key frame
#define STD_RLE_CODE 0x80
typedef struct key_frame {
int frame_num; // which frame number this key frame is
int offset; // offset from the start of data block
} key_frame;
#define ANF_MEM_MAPPED (1<<0) // animation is memory-mapped file
#define ANF_STREAMED (1<<1)
#define ANF_XPARENT (1<<2) // animation has transparency
#define ANF_ALL_KEYFRAMES (1<<3) // all the frames are keyframes (this is necessary if we want to play the file backwards)
typedef struct anim {
anim *next;
char name[MAX_PATH_LEN];
ubyte packer_code;
int width;
int height;
int total_frames;
int instance_count; // number of instances that are currently playing
int ref_count; // number of times this anim has been loaded
float time; // playback time in seconds
int num_keys;
key_frame *keys;
ubyte palette[768];
ubyte palette_translation[256];
ubyte *data; // points to compressed data
CFILE* cfile_ptr;
int version;
int fps;
ubyte xparent_r; // red component for the transparent color in source image
ubyte xparent_g; // green component for the transparent color in source image
ubyte xparent_b; // blue component for the transparent color in source image
int flags;
uint screen_sig;
int file_offset; // file offset to start of frame data
int cache_file_offset;
ubyte *cache;
} anim;
// the direction to play the anim (forwards or backwards)
#define ANIM_DIRECT_FORWARD 0
#define ANIM_DIRECT_REVERSE 1
typedef struct anim_instance {
anim_instance *next, *prev;
int x,y; // coordinates anim is played at (top left corner of anim)
int base_w, base_h; // coordinate scale this anim is played in.
vec3d *world_pos; // world (x,y,z) position of explosion
float radius; // radius of image, needed for scaling
int frame_num; // current frame, or last frame if between frames (first frame is 0)
int last_frame_num;// last frame rendered
anim *parent; // pointer to anim structure, which holds compressed data
ubyte *data; // pointer to next frame's compressed data
ubyte *frame; // uncompressed frame
float time_elapsed; // how long the anim has played for (in seconds)
int start_at; // frame anim playing should start
int stop_at; // frame anim playing should stop
int framerate_independent; // animation should play back in same amount of time, regardless
int skip_frames; // should anim skip frames during framerate independent playback
int looped; // should anim keep playing over and over...
int stop_now; // flag to indicate time to stop the animation
int last_bitmap; // id of last bitmap that was rendered out from animation
int screen_id; // 0 means all screens should render, otherwise screen specific
void *aa_color; // anti-aliased bitmap color
int xlate_pal;
int direction; // playing forwards or backwards ?
int ping_pong; // should be played ping-pong style
int paused; // pause the anim
int file_offset; // current offset into frame (like data, put offset into file)
int loop_count; // starts at 0, and is incremented each time it loops
} anim_instance;
ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
void anim_init();
anim_instance *init_anim_instance(anim *ptr, int bpp);
void free_anim_instance(anim_instance *inst);
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
void anim_set_palette(anim *a);
void anim_check_for_palette_change(anim_instance *inst);
#endif /* __PACKUNPACK_H__ */
Loaded 100 of 2664 files, more files were not shown because too many files have changed in this diff. Show more