Compare commits

...
Author SHA1 Message Date
z64555 8b517ddda9 Adds outwindow init and the SCP_mspdbcs init and cleanup. 2016-08-15 17:45:22 -05:00
z64555 6bc5a395e0 Pointless style flag is pointless 2016-08-15 17:28:52 -05:00
z64555 318496992e Fix bug where scene would not repaint when window was resized to something smaller. 2016-08-15 17:24:55 -05:00
z64555 1e28d526ae Prevent excessive calls to wxfred::render_resize if the viewport size didn't change. 2016-08-15 16:10:48 -05:00
z64555 26a746d612 Some work on the viewport:
* Viewport now resizes. There's some kinks with re-draw to work out, though
* Viewport now displays starfield
* Viewport now displays mission grid
2016-08-15 07:24:39 -05:00
z64555 5b41dce69c Update wxfred2.cpp to use flagsets. Also a bit of whitespace maintenance (yawn). 2016-08-15 05:38:04 -05:00
z64555 ea9b611782 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into wxfred2 2016-08-15 04:37:40 -05:00
m!m ddd64146d9 Merge pull request #820 from z64555/fix/filelength
Adds macro to replace instances of the deprecated filelength with...
2016-08-15 11:12:50 +02:00
MageKing17 43ca34cb4c Merge pull request #821 from SamuelCho/lightshafts_reorder
Reorder lightshafts in the post process pipeline.
2016-08-14 20:16:50 -07:00
SamuelCho 60bee02f92 Reorder lightshafts in the post process pipeline. Fixes the glare effect from being too bright. 2016-08-14 19:09:29 -07:00
z64555 2b4117256a Adds macro to replace instances of the deprecated filelength with _filelength if using MSVC. 2016-08-14 20:11:40 -05:00
z64555 9474f58820 Setup OS and FSO backend initialization.
* Currently only works on Windows due to the OpenGL loader (wxFredRender) being rather basic.
2016-08-14 19:36:16 -05:00
Fabian Woltermann d5ac9a33c1 Merge pull request #815 from asarium/feature/flagsetInitializer
Add initializer_list support for flagset
2016-08-14 17:07:33 +02:00
asarium d1baf8edca Add initializer_list support for flagset
This allows to initialize a flagset instance from a {...} expression
without having to create an intermediary instance.
2016-08-14 16:39:29 +02:00
m!m af9cc94470 Merge pull request #807 from The-E/ship_subsys_flags
Changes the subsystem flags to the new flag system.
2016-08-14 16:24:28 +02:00
z64555 6f7039ed01 Merge pull request #809 from asarium/fix/joystickGUIDs
Fix wrong joystick event assignment
2016-08-14 02:11:58 -05:00
z64555 006853ae44 Forgot to set canvas target in context creation. 2016-08-13 20:33:50 -05:00
z64555 22f56a12d9 * Implements wxFredRender's render_init() and render_frame() functions.
* Implements glcViewport's construction
2016-08-13 20:09:52 -05:00
Fabian Woltermann 8a85b5abe8 Merge pull request #811 from Echelon9/fix/legacy-mode-warning-wrapping
Improve legacy mode warning console message
2016-08-14 00:48:00 +02:00
Echelon9 69a88cf58f Improve legacy mode warning console message
Without the new line, this important warning line can get lost within
the console messages e.g. on Linux.
2016-08-13 17:44:03 -04:00
asarium a4d70c78cb Fix wrong joystick event assignment
Kobrar reported that joystick events were not properly assigned to the
right Joystick instances because the GUIDs of the joysticks was the same
(that's another problem since the code assumes that they actually are
Globally Unique like the name says).

The fix was to simply use the instance ID for checking if two sticks are
the same which seems to work more reliably.
2016-08-13 23:14:47 +02:00
m!m ecc878586c Merge pull request #808 from The-E/flagset_emergency_fix
Bugfix for flagsets
2016-08-13 21:54:15 +02:00
Fabian Woltermann d7e6e5e152 Fixes an issue in flagsets where the sanity check for flagset::set was inverted. 2016-08-13 18:26:17 +02:00
Fabian Woltermann b352a4c13a Merge pull request #770 from asarium/cmake_/ninjaColor
Enable color diagnostics for Ninja generator
2016-08-13 15:17:42 +02:00
Fabian Woltermann dc11b13edd Merge pull request #783 from MageKing17/feature/more-target-flags
Greatly expand available flags for creating target priority groups.
2016-08-13 15:17:15 +02:00
Fabian Woltermann e1ba2256ed Changes the subsystem flags to the new flag system. 2016-08-13 13:52:51 +02:00
Fabian Woltermann 0117ba446c Merge pull request #794 from z64555/fix/joystick_hats1
More compatibility code for joystick hats.
2016-08-13 11:50:24 +02:00
Fabian Woltermann 71acc296f0 Merge pull request #804 from z64555/feature/freelook
Feature/freelook
2016-08-13 11:50:06 +02:00
z64555 d24aa9f478 Remove 4-pos hat to 8-pos hat conversion code. Revert this commit if needed in the future! 2016-08-13 01:03:50 -05:00
z64555 431dd7067e More joystick hat compatibility code.
* There's now registers for both 4 position and 8 position hats for both timestamps and downcounts
* There's conversion code to allow an 8-position hat to act like a 4-position hat, which is needed by the FSO codebase which only uses 4-pos hats
* There's also conversion code to allow a 4-pos hat to act like an 8-position hat to some degree.
2016-08-13 01:03:49 -05:00
MageKing17 c17c58265a Merge pull request #805 from Echelon9/feature/readme-badges
Add badges to Readme
2016-08-12 22:17:17 -07:00
Echelon9 229a578b61 Add badges to Readme
Re-add visual badges that provide overview of build and code quality
status via Travis and Coverity.
2016-08-13 00:40:54 -04:00
z64555 994f8f7ec4 Fix bug introduced by freelook code that disabled target padlock view mode. 2016-08-12 21:47:04 -05:00
MageKing17 78de88adcf Greatly expand available flags for creating target priority groups.
Target priorities could previous only select based on very few flags, for the simple reason that very few were defined in the ai_tgt_*_flags[] arrays. This simply adds additional flags (even some that seem a little silly; I can't actually think of a reason to especially target "objects that are being rendered", but hey, maybe somebody will find a use for it in the future).
2016-08-12 19:24:07 -07:00
Fabian Woltermann 770fce8de5 Bitset flags -- take 2 (#775)
This introduces a new mechanism for handling bit flags. Instead of using an int (or two, or three) to write bits into, this uses the std::bitset in a wrapper class that accepts an enum class as input. This means that certain classes of errors we've had a few of in the engine, where a coder used the wrong set of flags or checked them against the wrong variable (SF_STEALTH vs SIF_STEALTH, for example) can now be detected at a compiler level rather than not at all.
2016-08-12 16:13:50 -07:00
z64555 b60f8742e2 Re-Re-enables the freelook mode. Somehow got lost during the Antipodes merge. 2016-08-12 18:09:24 -05:00
Fabian Woltermann 1ea71d2ba6 Merge pull request #803 from asarium/fix/fredFastDebug
Fix FRED configuration
2016-08-12 21:15:13 +02:00
asarium e8d74a833b Fix FRED configuration 2016-08-12 20:28:29 +02:00
Fabian Woltermann 97153b80a1 Merge pull request #801 from asarium/warnings/more64bit
And another batch of 64-bit fixes
2016-08-12 14:55:06 +02:00
asarium a685642554 And another batch of 64-bit fixes 2016-08-12 09:42:55 +02:00
MageKing17 96c7ea9247 Merge pull request #798 from asarium/cleanup/windebug
Remove unused code in windebug.cpp
2016-08-11 18:40:19 -07:00
MageKing17 a1c82455e4 Merge pull request #797 from asarium/warnings/evenmore64bit
Another batch of 64-bit warning fixes.
2016-08-11 18:40:09 -07:00
z64555 80f6f31f15 Merge pull request #799 from The-E/math_include_cleanup
A bit of include cleanup
2016-08-11 20:39:04 -05:00
z64555 682b279553 Merge pull request #800 from The-E/only_old_stars
Dead code cleanup in starfield.cpp
2016-08-11 20:39:01 -05:00
Fabian Woltermann 2d85ced533 Merge pull request #788 from asarium/build/sdlmain
Use the provided sdlmain library again
2016-08-11 23:04:00 +02:00
Fabian Woltermann ab315f2064 Merge pull request #792 from asarium/cleanup/disableFredDeprecation
Disable MBCS deprecation warnings in FRED
2016-08-11 23:03:40 +02:00
Fabian Woltermann b5e837a040 Merge pull request #796 from asarium/fix/memoryStats
Fix Windows memory statistics
2016-08-11 23:03:26 +02:00
Fabian Woltermann 444a9ba614 Merge pull request #789 from asarium/cmake_/msvcWarningSpecifications
Clean up CMake MSVC warning handling
2016-08-11 23:02:52 +02:00
Fabian Woltermann e103bcdf69 Removes a bit of dead code that we probably aren't going to develop any further. 2016-08-11 23:01:28 +02:00
Fabian Woltermann 44c64d79f1 Removes old int type includes we carried around from when we supported old compilers 2016-08-11 22:57:49 +02:00
asarium c40ede030a Another batch of 64-bit warning fixes. 2016-08-11 22:19:50 +02:00
asarium 76c220251b Remove unused code in windebug.cpp 2016-08-11 22:10:43 +02:00
MageKing17 affecc9285 Merge pull request #791 from asarium/warnings/more64bit
Fix even more 64-bit warnings
2016-08-11 12:54:51 -07:00
asarium c6a74c2f04 Fix Windows memory statistics 2016-08-11 21:48:11 +02:00
asarium 9a46e9b55e Fix negative shift warning
This converts the fix conversion macros to constexpr functions which
should have the same runtime effects with the added type safety.
2016-08-11 10:42:40 +02:00
asarium 6c3da4b455 Fix even more 64-bit warnings 2016-08-11 10:08:11 +02:00
z64555 83724c0d8a Merge pull request #793 from MageKing17/bugfix/invalid-joystick-buttons
Fix a couple button-related joystick issues.
2016-08-10 23:24:39 -05:00
MageKing17 9f12e1f749 Fix hat position comparison in joy_down()
getHatPosition() returns a value from the HatPosition enum, so the conversion to a 0-based index is incorrect (and causes the hat switch to basically not work with continuous controls).
2016-08-10 20:42:00 -07:00
MageKing17 7906f0b9b3 Fix allowing invalid joystick buttons through to the joystick API.
When the hat switch code was fixed to restrict joysticks to 32 buttons again, it forgot to invalidate buttons between numButtons() and 32. This could lead to some assertions being failed when the joystick got asked for the status of a nonexistent button.
2016-08-10 18:55:57 -07:00
z64555 20990416a9 Implement wxFredRender components. 2016-08-10 17:56:51 -05:00
asarium d7707053c3 Disable MBCS deprecation warnings in FRED 2016-08-10 23:44:20 +02:00
z64555 627ef75af0 Fix (undocumented) issue with hat presses not registering. (#777)
* Fix (undocumented) issue with hat presses not registering.

* Use array instead of a vector for _hat::DownCount

* No, no die-nam-ick numbor of boot-ons to-day. Und no, ve only haff vone hat. Sad Heavy is Sad.

* Fixes an out-of-bounds error caused by incorrect indexing in Joystick::handleHatEvent.
Also fixes a bug where the hatGetDownTime would return a nonzero value if the hat was active but in a different position than the input parameter.
2016-08-10 23:31:09 +02:00
MageKing17 9cef8ed64b Merge pull request #782 from asarium/fix/luaFixes
Fix a few lua related issues
2016-08-10 12:19:35 -07:00
MageKing17 8f32c6100e Merge pull request #786 from asarium/fix/grbatch
Fix wrong return type in grbatch
2016-08-10 11:26:27 -07:00
asarium 2b52c7888e Remove _cdecl usages 2016-08-10 18:03:29 +02:00
asarium 74b0702577 Specify ignored warnings in CMake toolchain file
This means that it's no longer necessary to include pstypes.h just for
ignoring the standard warnings.
2016-08-10 17:24:04 +02:00
asarium b26a70d96a Use the provided sdlmain library again 2016-08-10 16:45:04 +02:00
asarium 5b28824f62 Fix wrong return type in grbatch 2016-08-10 15:18:55 +02:00
Fabian Woltermann 9953fd924e Merge pull request #779 from asarium/warnings/more64bit
More 64-bit MSVC warning fixes
2016-08-10 14:32:21 +02:00
Fabian Woltermann 14f80e6a07 Merge pull request #784 from asarium/fix/fontHeightHack
Improve font top and bottom offset handling
2016-08-10 14:30:50 +02:00
Fabian Woltermann e805cc15fc Merge pull request #785 from asarium/fix/modelrenderVars
Fix uninitialized values in modelrender
2016-08-10 14:30:22 +02:00
asarium 0cabe71fdd More 64-bit MSVC warning fixes 2016-08-10 13:33:12 +02:00
asarium f5c0234d3b Fix uninitialized values in modelrender 2016-08-10 13:28:36 +02:00
asarium 19de867f31 Improve font top and bottom offset handling 2016-08-10 12:59:19 +02:00
niffiwan c3b4380351 Merge pull request #781 from asarium/fix/mainhallDistance
Fix wrong parameter order
2016-08-10 09:50:29 +10:00
asarium 72a956e0ed Fix wrong handle pointer validation 2016-08-10 00:06:33 +02:00
asarium 5e12ec392c Fix wrong parameter order 2016-08-10 00:03:17 +02:00
asarium 188bf2bb1e Fix wrong initial value 2016-08-09 23:55:38 +02:00
MageKing17 5f38b7fbce Merge pull request #780 from asarium/fix/shaderCrash
Fix Assert caused by invalid comparision
2016-08-09 13:58:29 -07:00
asarium b982c04a00 Fix Assert caused by invalid comparision 2016-08-09 22:24:00 +02:00
m!m 079c6ae86e Fix FRED executable version information (#778) 2016-08-09 11:15:46 -07:00
m!m 22c0255277 Fix a bunch of 64-bit MSVC warnings (#709)
* Fix a bunch of 64-bit warnings

* Fix Linux compilation error

* Fix Mac error

* Fix some issues

* Fix more GCC warnings

* Remote unwanted change

* Remove accidentally readded file

* Fix wrong limit check

* Use BEAM_INDEX macro for getting beam object index

* Fix 32-bit warning

* Use BEAM_INDEX instead of pointer arithmetic
2016-08-09 11:08:54 -07:00
asarium 526962fb60 Fix Clang warning 2016-08-09 10:44:27 +02:00
Fabian Woltermann 7265711551 Merge pull request #776 from scp-fs2open/revert-720-cleanup/update-sdl2-to-custom-libsdl
Revert "Update included SDL2.dll files to ones compiled from our custom libsdl."
2016-08-09 09:01:54 +02:00
Fabian Woltermann 5ffc569eed Merge pull request #759 from asarium/fix/hudParseErrors
Detect HUD gauges parse error and print a warning
2016-08-09 08:30:34 +02:00
Fabian Woltermann 6703007ee2 Merge pull request #761 from MageKing17/feature/allow-ai-slowdown
Add an AI flag to enable old, unused behavior when attacking big ships.
2016-08-09 08:29:58 +02:00
MageKing17 cdef2ee86a Revert "Update included SDL2.dll files to ones compiled from our custom libsdl." 2016-08-08 21:10:04 -07:00
MageKing17 552a575232 Merge pull request #773 from asarium/fix/772
Fix logic error in controlsconfig.cpp
2016-08-08 12:27:56 -07:00
asarium bfdcad1848 Fix logic error in controlsconfig.cpp
This fixes #772.
2016-08-08 19:54:12 +02:00
MageKing17 76b7c0a3d2 Merge pull request #771 from asarium/feature/noninteractive
Add noninteractive mode
2016-08-08 08:39:13 -07:00
asarium 8dbfb3a334 Fix CI failure with outdated GCC version 2016-08-08 16:49:22 +02:00
asarium 84973dd56f Use CMake variable for determining library with dlsym 2016-08-08 16:47:29 +02:00
asarium 1086e330fb Fix warnings by updating external includes 2016-08-08 16:22:39 +02:00
asarium 775d404bf1 Enable color diagnostics for Ninja generator
Also improves flags handling a bit. Previously only the C++ flags were
set, now the C flags are set as well.
2016-08-08 15:59:33 +02:00
asarium ab6c3f4ac8 Add noninteractive mode
If the -noninteractive command line option is set then dialogs won't be
shown and the default action is taken. This should be useful for
the standalone server.
2016-08-08 15:46:08 +02:00
Fabian Woltermann 302b0297b5 Merge pull request #767 from asarium/fix/64-bitFRED
Fix 64-bit compilation of FRED
2016-08-08 13:21:37 +02:00
z64555 92fc16372f Create wxFredRender files, this'll be for the graphics of wxFred and used by the glcViewport class(es). 2016-08-08 05:50:41 -05:00
z64555 cd25f907ac Merge pull request #2 from asarium/wxfred2_dev
Fix MSVC compilation issues
2016-08-08 04:33:11 -05:00
asarium c2363989e4 Fix MSVC compilation issues 2016-08-08 11:27:45 +02:00
z64555 7b13d5c1f2 Merge pull request #1 from asarium/wxfred2_dev
Fix wxFRED CMake and compliation errors
2016-08-08 04:18:56 -05:00
asarium 25f6be7867 Use the version string in the project headers 2016-08-08 11:17:05 +02:00
asarium 9756b52845 Fix wxFRED CMake and compliation errors 2016-08-08 11:17:05 +02:00
z64555 93101aa8ce Remove glrcMissionFrame. 2016-08-08 04:07:48 -05:00
z64555 10a37e6ddb Add link targets to core codebase. 2016-08-08 02:46:08 -05:00
z64555 469a31602e Fix access violation. Can't append items to wxChoice elements for the moment. 2016-08-07 23:15:43 -05:00
z64555 3521740a60 Update XRC and generated files to use wxWidgets 3.0.2 (or later. wxFormBuilder doesn't say which version it uses) 2016-08-07 23:15:42 -05:00
z64555 beaee70a82 Fix building after rebase with master. 2016-08-07 23:15:42 -05:00
z64555 eb3b65e051 Implement Copy functions, settle on using OIN_t's for object selection queues. 2016-08-07 23:15:41 -05:00
z64555 4bb547ce09 (FRED) Fix bug where AIF_NO_DYNAMIC flags weren't set with copied objects 2016-08-07 23:15:40 -05:00
z64555 5294db25b3 Implement port of core mission management functions 2016-08-07 23:15:40 -05:00
z64555 5983ddeea4 Some FRED cleanup and debugging 2016-08-07 23:15:39 -05:00
z64555 37d16a65c4 Updating README with info on wxWidget's Release packages. 2016-08-07 23:15:39 -05:00
z64555 8c54c63908 Update the README a bit. 2016-08-07 23:15:38 -05:00
z64555 ae7bf0667e Fix linking due to an unknown, removed, or renamed ailocal.h 2016-08-07 23:15:38 -05:00
z64555 c018329a4c Adds new define to disable FSO's mem* function overrides 2016-08-07 23:15:38 -05:00
z64555 f188960f91 Fixes compiling by de-tangling a #include chain that was exposed by commit 798a8922879f7af8ebd2bb07a6cdaa655a2e038b 2016-08-07 23:15:37 -05:00
niffiwan 7255d5e8e4 Update Linux to link successfully with libcode.a 2016-08-07 23:15:36 -05:00
z64555 198c6cace9 End of linkage work. (This commit is probably temporary)
* Includes wxfredstubs.cpp to prevent linkage to certain data members and functions defined in freespace.cpp.
 * "_SECURE_SCL" and "_HAS_ITERATOR_DEBUGGING" defines removed from the project files
 * C runtime library (CRT) switched to use DLL so as to integrate with wxWidgets default settings.
2016-08-07 23:15:34 -05:00
z64555 5efe85b4db Beginning setup to link into code.lib, defined some variables needed for linkage and link tests. 2016-08-07 23:15:01 -05:00
z64555 fb8fe9bb75 Started work on docFRED2, and mission load/save methods. More work done on glcViewport. 2016-08-07 23:14:59 -05:00
z64555 790f8b9d8c Some header name wrangling, a Big O snuck in somehow. 2016-08-07 23:14:03 -05:00
z64555 0bcc9f27d4 glcViewport and glrcMissionFrame classes added. README updated. 2016-08-07 23:13:59 -05:00
MageKing17 4b900bb84c Merge pull request #764 from asarium/wxFRED/graphicsInterface
Add interface for creating an OpenGL context
2016-08-07 15:42:30 -07:00
MageKing17 820d4b88be Merge pull request #769 from asarium/fix/768
Fix for #768
2016-08-07 15:38:24 -07:00
asarium 5ba393ce5d Fix for #768
Apparently MSVC 2013 allocates memory when locking a mutex which calls
our allocation hook when the tries to call our memory tracking function
which leads to a deadlock. Since there is no way of providing a memory
allocation function for std::mutex the best solution is to simply
disable the lock_guard for everything before MSVC 2015. That will
probably corrupt the memory tracking values at some point but it's
better than not being able to run FSO at all.
2016-08-07 23:45:38 +02:00
MageKing17 c76c1cb4ff Add an AI flag to enable old, unused behavior when attacking big ships.
Coverity defects 1320483, 1320484, 1320485, and 1320486 noted that several values were being set and then immediately overwritten before they could do anything. These appear to be related to behavior that Volition disabled before release that would allow the AI to slow down while attacking capital ships. It seemed a shame to waste this code, so I've added a flag to enable the behavior.
2016-08-07 14:27:59 -07:00
asarium 1fb0a57fd8 Fix 64-bit compilation of FRED 2016-08-07 23:00:17 +02:00
Fabian Woltermann 8543e99352 Merge pull request #755 from asarium/fix/gladVersion
Use the OpenGL version provided by GLAD
2016-08-07 22:28:09 +02:00
Fabian Woltermann 17e5918eeb Merge pull request #756 from asarium/cleanup/gladLoader
Improve GLAD config a bit
2016-08-07 22:27:53 +02:00
Fabian Woltermann d0ea08ed6c Merge pull request #766 from asarium/fix/linewidth
Fix for #765
2016-08-07 22:27:17 +02:00
asarium 0bf5ba092b Add interface for creating an OpenGL context
This allows to use a different method of creating and managing the
OpenGL context. This is needed of wxFRED where the OpenGL context is
created by wxWidgets. This will probably also fix #753 since it uses the
old wgl based method of creating an OpenGL context in FRED.
2016-08-07 21:38:36 +02:00
MageKing17 195b0b1d53 Merge pull request #763 from The-E/radarsetup_flag_fix
SIF_STEALTH and SF2_STEALTH are different things, I'm afraid
2016-08-07 11:41:22 -07:00
asarium 4f5ae67020 Fix for #765
glLineWidth is no longer an effective way of setting the line width of
2D operations.
2016-08-07 19:49:48 +02:00
Fabian Woltermann 580892243f SIF_STEALTH and SF2_STEALTH are different things, I'm afraid 2016-08-07 16:46:14 +02:00
niffiwan 9b537434fc Merge pull request #760 from MageKing17/coverity/1360950
Make sure va_end() gets called in ade_get_args() (fix Coverity 1360950)
2016-08-07 10:46:34 +10:00
MageKing17 5cdcd2beac Make sure va_end() gets called in ade_get_args() (fix Coverity 1360950)
If a required argument is invalid, ade_get_args() returns 0, but it wasn't making sure va_end(vl) got called first, leading to potential memory corruption (probably not a huge issue in actual usage because most people try not to release scripts that throw errors).
2016-08-06 12:57:03 -07:00
asarium 7baefbcd45 Detect HUD gauges parse error and print a warning
Previously the code simply skipped the invalid tokens and silently
ignored them. This is frustrating for modders and also let #758 slip
into the code base which would not have happened otherwise.
2016-08-06 21:40:52 +02:00
MageKing17 02aad7e5a7 Merge pull request #758 from asarium/fix/hudparse
Fix parsing code error introduced by TTF merge
2016-08-06 11:56:03 -07:00
asarium 0d165f159e Fix parsing code error introduced by TTF merge 2016-08-06 19:15:47 +02:00
asarium e6f00e37ae Improve GLAD config a bit
This removes the built-in OpenGL function pointer because we don't need
it since we are using the SDL function for that. Also explicitly uses a
compatibility loader although that has no effect on the generated code.
2016-08-06 15:24:19 +02:00
asarium 877fae7d5f Use the OpenGL version provided by GLAD 2016-08-06 15:15:23 +02:00
MageKing17 82ac53a693 Merge pull request #750 from PhantomHoover/master
Fixed actual_main to correctly return 0 on success and made
2016-08-06 00:04:54 -07:00
MageKing17 a4c6437104 Merge pull request #749 from The-E/parse_object_flag_fix
Fixes a mismatched flag type error in multiteamselect.
2016-08-06 00:04:31 -07:00
MageKing17 858df67078 Merge pull request #754 from niffiwan/fix/coverity_and_travis
Fix coverity scan triggered from travis
2016-08-06 00:04:09 -07:00
niffiwan 41b0b53b85 Fix coverity scan triggered from travis
Update modeling file to deal with SDL2.0 changes
2016-08-06 16:42:56 +10:00
Fabian Woltermann d60b756b4b Merge pull request #748 from asarium/fix/cfileArchiver
Fix compilation of cfile(archiver|extractor)
2016-08-06 08:29:13 +02:00
MageKing17 9ee98d45a2 Merge pull request #752 from asarium/fix/multiSort
Fix sorting function multi_create_sort_func
2016-08-05 15:13:41 -07:00
Fabian Woltermann fb9f3bc322 Merge pull request #751 from asarium/fix/fredOpenGL
Make sure that SDL OpenGL is initialized
2016-08-05 23:40:54 +02:00
asarium 81e3cf6fac Fix sorting function multi_create_sort_func
The function returned the wrong value for same string which caused the
MSVC debug runtime to throw an error. This fixes that.
2016-08-05 23:38:17 +02:00
asarium 0473ead31f Make sure that SDL OpenGL is initialized
The documentation says that the SDL OpenGL attributes need to be
initialized before a window is created. These changes implement that by
moving the actual SD_Window creation inside the OpenGL setup. FRED only
sets the native window handle to the correct HWND and gropengl uses
that.
2016-08-05 21:51:29 +02:00
Phantom Hoover 9ef81071fe doxygenate game_main() 2016-08-05 19:57:51 +01:00
Phantom Hoover 7b094e6966 good point mageking 2016-08-05 19:46:36 +01:00
Fabian Woltermann 88df37c6d6 Merge pull request #747 from asarium/coverity/1360947
Fix for Coverity 1360947
2016-08-05 19:19:24 +02:00
Phantom Hoover ef147c7284 Fixed actual_main to correctly return 0 on success and made
-shadow_quality imply -enable_shadows.
2016-08-05 18:10:16 +01:00
Fabian Woltermann e470d2959e Fixes a mismatched flag type error in multiteamselect. 2016-08-05 19:08:31 +02:00
asarium bc304bddfc Fix compilation of cfile(archiver|extractor) 2016-08-05 18:40:52 +02:00
Fabian Woltermann 0a0a1db421 Merge pull request #742 from asarium/fix/beamPiercingEffect
Fix variable for piercing beam particle effect
2016-08-05 18:32:48 +02:00
Fabian Woltermann dffb0c7c1d Merge pull request #746 from asarium/coverity/1320536
Fix wrong argument order in multiple functions
2016-08-05 18:32:30 +02:00
Fabian Woltermann 6dacfd8ffb Merge pull request #745 from asarium/coverity/1093292
Fix for Coverity 1093292
2016-08-05 18:32:16 +02:00
Fabian Woltermann ab17ccd424 Merge pull request #743 from asarium/fix/fredSDLMain
Call SDL_SetMainReady() in fred_init
2016-08-05 18:31:56 +02:00
asarium b408ca72f3 Fix for Coverity 1360947 2016-08-05 18:25:59 +02:00
asarium 7435d7a703 Fix for Coverity 1320538 2016-08-05 17:53:47 +02:00
asarium fa60c666bc Fix for Coverity 1320537 2016-08-05 17:50:49 +02:00
asarium 04d494e1a4 Fix for Coverity 1320536
Apparently someone mixed up left and right...
2016-08-05 17:49:01 +02:00
asarium 7e3b30f5bf Fix for Coverity 1093296 2016-08-05 17:38:57 +02:00
asarium e4783b3d34 Fix for Coverity 1093295 2016-08-05 17:37:52 +02:00
asarium 8ee84a05c0 Fix for Coverity 1093294 2016-08-05 17:35:35 +02:00
asarium 6899b1680d Fix for Coverity 1093293 2016-08-05 17:33:16 +02:00
asarium 1cfbc8859e Fix for Coverity 1093292
"Unchecked return value from library". The function can't return an
error value so I added a ml_printf (which is used at another place for
error logging as well) to log the error.
2016-08-05 17:28:44 +02:00
asarium 9a10a78ed3 Fix variable for piercing beam particle effect 2016-08-05 10:54:00 +02:00
Fabian Woltermann bd7a691b8e Merge pull request #722 from z64555/cleanup/fred
Cleanup/fred
2016-08-05 10:30:47 +02:00
asarium 6e9ce021cc Call SDL_SetMainReady() in fred_init 2016-08-05 09:58:30 +02:00
z64555 17a6896e1d Merge branch 'master' into cleanup/fred
Conflicts:
	fred2/fred.cpp
	fred2/fredrender.cpp
2016-08-04 19:18:16 -05:00
z64555 d46b17606d Fix linking with the Freespace project 2016-08-04 13:54:38 -05:00
Fabian Woltermann a570eca073 Merge pull request #739 from asarium/cmakeMerge/particlesystems
Add a new particle effect system
2016-08-04 12:46:33 +02:00
Fabian Woltermann c7f3097f7d Merge pull request #731 from asarium/fix/standaloneAssert
Fix Assertion when running in standalone mode
2016-08-04 11:28:30 +02:00
Fabian Woltermann e8954c4297 Merge pull request #733 from asarium/fix/openglVersion
Actually enforce the OpenGL 2.0 requirement
2016-08-04 11:28:07 +02:00
asarium bbeaaa1565 Add a new particle effect system
This is similar to the script I wrote a few years ago but unlike that
one, this solution doesn't kill the performance.
2016-08-04 11:08:39 +02:00
m!m 91b1d294ec Merge pull request #738 from MageKing17/coverity/1360951
Remove duplicate fclose() call (fix Coverity defect 1360951)
2016-08-03 23:26:32 +02:00
Fabian Woltermann eb164b3ff8 Merge pull request #737 from X3N0-Life-Form/lua_iff
Expose IFF to lua
2016-08-03 22:36:55 +02:00
MageKing17 4b634327e1 Remove duplicate fclose() call (fix Coverity defect 1360951)
It looks like this was added to trunk (a0f31e6), synced with antipodes (4952b70), and then one of the antipodes merges (7e77b5a) wound up combining both additions.
2016-08-03 13:28:29 -07:00
X3N0-Life-Form 625ea48d9e Expose IFF to lua
Adds the 'attacks' function to the 'team' lua type, which exposes the iff_x_attacks_y function to the lua engine.
2016-08-03 21:27:19 +02:00
Fabian Woltermann 0afe5ba8bd Merge pull request #730 from asarium/feature/openGLDebug
Use an OpenGL debug context and debug extensions
2016-08-03 11:47:49 +02:00
Fabian Woltermann 1783df6b5f Merge pull request #728 from asarium/fix/reallocCrash
Fix segfault when calling realloc
2016-08-03 11:47:30 +02:00
Fabian Woltermann 34d88d9d99 Merge pull request #735 from asarium/fix/axemFonts
Fix some font scripting bugs reported by Axem
2016-08-03 11:44:55 +02:00
Fabian Woltermann 8a9c9fb999 Merge pull request #734 from asarium/fix/luaConst
Fix const correctness in lua.cpp/.h
2016-08-03 11:28:27 +02:00
asarium 5d14899808 Fix const correctness in lua.cpp/.h 2016-08-03 10:53:23 +02:00
asarium acab2d2c46 Fix campaign list spacing 2016-08-03 10:41:09 +02:00
asarium 63f7f04502 Add error message for wrong font index 2016-08-03 10:27:22 +02:00
asarium 026564b973 Actually enforce the OpenGL 2.0 requirement 2016-08-03 09:53:51 +02:00
z64555 33ae17f00b Merge pull request #671 from asarium/feature/joystickAPI
Add improved joystick API
2016-08-03 02:21:43 -05:00
Fabian Woltermann d9a45d8dc0 Merge pull request #729 from asarium/fix/luaFontIndex
Fix off-by-one error in Lua font API
2016-08-02 23:27:38 +02:00
asarium 1679d81efa Fix Assertion when running in standalone mode
The Assertion which was triggered was carried over from the OpenGL code
but the stub code was using pretty much the same code so removing the
Assertion seems like the correct way to solve this.
2016-08-02 23:04:35 +02:00
asarium 0b5aed3e11 Use an OpenGL debug context and debug extensions
This instructs SDL to create an OpenGL debug context when a debug build
is used. Additionally it uses GL_ARB_debug_output if it's available to
provide OpenGL debug output.
2016-08-02 20:24:50 +02:00
asarium f91c681ee1 Add improved joystick API
This API allows to handle events from multiple joysticks but currently
only the events from the configured joystick are used.
2016-08-02 20:08:21 +02:00
asarium 3a63dc3800 Fix segfault when calling realloc 2016-08-02 20:00:35 +02:00
asarium 2e90049eba Fix off-by-one error in Lua font API 2016-08-02 19:39:13 +02:00
Cliff Gordon b92be0b5da Merge pull request #727 from asarium/fix/freebsd
LGTM, shouldn't even affect any other build platforms.
2016-08-02 12:38:05 -05:00
Cliff Gordon dae5c58b98 Merge pull request #723 from asarium/fix/configCase
Well, running dos2unix on it didn't create any local changes, so it looks to be entirely unix line endings now, as it should be.  LGTM.
2016-08-02 12:28:00 -05:00
asarium 1f4e40757d Fix build on FreeBSD 2016-08-02 19:10:51 +02:00
Fabian Woltermann dfc10ad8db Merge pull request #725 from asarium/fix/fontOptions
Fix code that was overwritten by TTF merge
2016-08-02 14:54:58 +02:00
asarium bb503de698 Fix code that was overwritten by TTF merge 2016-08-02 12:34:55 +02:00
Fabian Woltermann f3f4560824 Merge pull request #724 from asarium/cleanup/directx
Remove last remains of DirectX
2016-08-02 12:18:14 +02:00
Fabian Woltermann 9bfc0be819 Merge pull request #696 from asarium/cmakeMerge/memory
Add new memory tracking subsystem
2016-08-02 12:17:56 +02:00
Fabian Woltermann 36f08ca62b Merge pull request #715 from asarium/fix/fredCwd
Use the current working directory for FRED
2016-08-02 12:16:45 +02:00
Fabian Woltermann b4db345e5e Merge pull request #692 from asarium/test/ttf-3
TrueType support
2016-08-02 12:16:23 +02:00
Fabian Woltermann 2cfd82b182 Merge pull request #720 from MageKing17/cleanup/update-sdl2-to-custom-libsdl
Update included SDL2.dll files to ones compiled from our custom libsdl.
2016-08-02 12:15:51 +02:00
z64555 0c90a75900 Cleanup missionsave.h and .cpp 2016-08-02 04:24:18 -05:00
z64555 060c090827 Doxy and organize wing.h and .cpp. Probably needs a bit more cleanup. 2016-08-02 04:23:04 -05:00
z64555 a57483ffad Cleanup of mainfrm.h and .cpp 2016-08-02 04:23:02 -05:00
z64555 581e6320e1 Cleanup grid.h and .cpp 2016-08-02 04:21:56 -05:00
z64555 35dc235599 Cleanup of fredrender.h and .cpp. 2016-08-02 04:21:54 -05:00
z64555 fddbbf47bd Remove unused Preferences dialog and related variables. 2016-08-02 04:21:52 -05:00
z64555 1c4eb25e84 Cleanup freddoc.h and .cpp 2016-08-02 04:21:24 -05:00
z64555 ed3c9f1621 Cleanup of fred.h and fred.cpp 2016-08-02 04:21:22 -05:00
z64555 f836d5e002 Some header wrangling 2016-08-02 04:21:20 -05:00
z64555 2829eb5e35 Remove editor.h 2016-08-02 04:21:18 -05:00
z64555 c062a071fb Cleanup and doxy a few dialogs 2016-08-02 04:19:39 -05:00
asarium a4302fde2f Remove last remains of DirectX 2016-08-02 11:10:24 +02:00
asarium 16be3b7cc5 Add support for TrueType fonts
This allows to use standard TrueType Fonts for text rendering in FSO. It uses the NanoVG library which provides the ability of drawing 2D shapes. This library is used for most 2D operations now and can also be used directly by using the PathRenderer class.
2016-08-02 10:57:28 +02:00
asarium 9630b595e0 Make config key check case-insensitive
Fix for #719.
2016-08-02 10:39:04 +02:00
MageKing17 0d8e09f136 Merge pull request #716 from asarium/fix/fredErrorPrinting
Clean up FRED init a bit
2016-08-02 01:32:51 -07:00
m!m 44c7155f34 Merge pull request #718 from chief1983/speech_debugging
Speech Debugging
2016-08-02 10:31:00 +02:00
m!m 6a12b90df5 Merge pull request #721 from MageKing17/cleanup/remove-old-def_files
Remove old def_files.cpp file and clean up some redundant imports.
2016-08-02 10:29:16 +02:00
Cliff 8f58fa88c1 Add some debugging to the speech code for troubleshooting future issues, under the Speech filter. 2016-08-01 22:12:45 -05:00
MageKing17 dd4af145bf Remove old def_files.cpp file and clean up some redundant imports.
The CMake merge changed the default files system to include individual files instead of use a bunch of hardcoded strings, but the old file got left behind for some reason. Also, the same merge added some spurious extra imports of def_files.h which I removed at the same time (although if somebody wanted to go through and clean up all of our imports again, it'd probably be a good time for it).
2016-08-01 14:20:24 -07:00
MageKing17 253987dfb3 Update included SDL2.dll files to ones compiled from our custom libsdl. 2016-08-01 14:11:20 -07:00
SamuelCho 9a91e6041c Merge pull request #714 from The-E/fxaa-fix2
Moves the FXAA pass to after the tonemapping step
2016-08-01 10:23:01 -07:00
asarium 18154bfa60 Clean up FRED init a bit
Maybe this will help tracking down that FRED OpenGL issue
2016-08-01 19:10:51 +02:00
asarium 28f9fafa84 Use the current working directory for FRED
This allows to run the executable in a different directory. This is very
useful for debugging from within Visual Studio.
2016-08-01 18:38:21 +02:00
Fabian Woltermann e3d4cc1bc7 _actually_ move the fxaa pass 2016-08-01 11:54:00 +02:00
Fabian Woltermann 2b333fc299 Merge branch 'master' of https://github.com/scp-fs2open/fs2open.github.com into fxaa-fix2
Conflicts:
	code/graphics/gropenglpostprocessing.cpp
2016-08-01 11:48:58 +02:00
Fabian Woltermann 97c7ad43ce Moves the FXAA pass to after the tonemapping step, as recommended in the FXAA documentation 2016-08-01 11:46:45 +02:00
Fabian Woltermann 6a76b99083 Merge pull request #713 from SamuelCho/fxaa_fix
Make sure we can write to the alpha channel before doing the FXAA luminance prepass
2016-08-01 11:43:55 +02:00
SamuelCho c049c64c00 Make sure we can write to the alpha channel before doing the FXAA luminance prepass. 2016-07-31 21:04:04 -07:00
MageKing17 feb49eae9f Merge pull request #710 from asarium/fix/nestedModFolder
Fix directory creation for nested mod folders.
2016-07-30 16:05:48 -07:00
asarium 7cf42b6811 Fix directory creation for nested mod folders.
The launcher passes the mod folders as relative paths using / as the
directory separator. That path is copied into the cf_root path and when
cf_create_directory tries to create the directory, mkdir_recursive can't
handle the / in the path and tries to create two path elements at once
which is not supported by mkdir.

These changes fix that by converting mod paths to the native format
(from the / format, so it's a No-op on Unix) before using it in
cf_create_root().
2016-07-30 21:53:15 +02:00
Fabian Woltermann 42a217d48a Merge pull request #706 from asarium/cmake_/gcc-leak-check
Add option for -fsanitize=leak on GCC
2016-07-30 08:41:54 +02:00
MageKing17 24ccb7c8ff Merge pull request #707 from asarium/fix/memleak_modelinterp
Fix memory leak in modelinterp.cpp
2016-07-29 10:40:51 -07:00
m!m e3e0eae93e Merge pull request #702 from The-E/fb_thruster_adjustments
Adds a commandline switch analoguous to framebuffer shockwaves to enable the distortion effect for thrusters
2016-07-29 14:39:32 +02:00
asarium d0bfc47e59 Fix memory leak in modelinterp.cpp
bsp_info.outline_buffer was allocated but not freed when unloading the
model.
2016-07-29 12:30:21 +02:00
asarium 31712e0c48 Add option for -fsanitize=leak on GCC 2016-07-29 12:00:33 +02:00
asarium 7b352e511c Add new memory tracking subsystem
This expands the existing system which only worked on Windows to all
supported platforms.

If the MSVC debug runtime is not present then its behavior is emulated
by adding a header to each allocated memory block.
2016-07-29 11:02:45 +02:00
m!m 0819d57fd5 Merge pull request #705 from rtoijala/fix-lua51-search
Add lua51 as a possible pkg-config name
2016-07-29 10:28:00 +02:00
Fabian Woltermann d709ac3732 Merge pull request #697 from asarium/cmake_/platformChecks
Use CMake for determining if a specific header is available
2016-07-29 10:04:29 +02:00
Fabian Woltermann f30e8a3141 Merge pull request #704 from asarium/fix/cmakeConfig
Fix default CMake configuration
2016-07-29 10:04:07 +02:00
Risto Toijala baa2f9f5d7 Add lua51 as a possible pkg-config name
Basically the same as PR #628 but for CMake this time.
2016-07-29 11:00:00 +03:00
asarium 3b4e258f32 Fix default CMake configuration 2016-07-28 23:10:02 +02:00
Fabian Woltermann 624c5842c0 Merge pull request #703 from asarium/fix/submodules
Add CMake error if external modules could not be found
2016-07-28 22:36:28 +02:00
asarium 465d95dd7f Add CMake error if external modules could not be found 2016-07-28 21:16:35 +02:00
MageKing17 850824cd3c Merge pull request #701 from scp-fs2open/lab_weapon_thruster_fix
Fixes issue when rendering thrusters on weapon models
2016-07-28 12:01:51 -07:00
Fabian Woltermann 53222e66e3 Adds a commandline switch analoguous to framebuffer shockwaves to enable the distortion effect for thrusters 2016-07-28 20:22:49 +02:00
Fabian Woltermann 9f0897d916 Fixes issue when rendering thrusters on weapon models 2016-07-28 20:04:40 +02:00
Fabian Woltermann c0e67c44e8 Merge pull request #699 from asarium/ci/vsversionUpdate
Update tested visual studio versions
2016-07-28 11:36:24 +02:00
MageKing17 b40631e268 Merge pull request #698 from asarium/fix/portableMode
Expose portable mode in launcher
2016-07-28 02:17:03 -07:00
asarium 4edd6fd5a9 Update tested visual studio versions 2016-07-28 11:09:39 +02:00
asarium 690d293d9a Expose portable mode in launcher 2016-07-28 10:17:20 +02:00
Fabian Woltermann 4c53d46aec Merge pull request #695 from asarium/cmake_/appimage
Add AppImage support for nightly builds
2016-07-27 23:21:05 +02:00
asarium 06768e72d4 Use Platform checks for determining if a header is available 2016-07-27 22:24:28 +02:00
asarium 5826b880fb Add AppImage support 2016-07-27 20:53:40 +02:00
Fabian Woltermann 6646bf3002 Merge pull request #694 from asarium/fix/nightly
Fix AppVeyor Bintray config
2016-07-27 19:26:56 +02:00
asarium ea77b6fc7e Fix AppVeyor Bintray config 2016-07-27 19:24:35 +02:00
Fabian Woltermann aec35e4aba Merge pull request #693 from asarium/fix/nightly
Fix nightly BinTray user
2016-07-27 18:49:20 +02:00
asarium 676bc68beb Fix nightly BinTray user 2016-07-27 18:47:02 +02:00
Fabian Woltermann fc2a3e2869 Merge pull request #691 from asarium/fix/secureVars
Update secure variables for the main repo
2016-07-27 18:15:49 +02:00
asarium 983f1f386d Update AppVeyor variables 2016-07-27 16:12:09 +02:00
Fabian Woltermann a1582c7619 Merge pull request #690 from asarium/fix/Readme
Update readme
2016-07-27 16:03:28 +02:00
Fabian Woltermann 4a1c7ad37b Merge pull request #689 from asarium/cmake_/binarySourceDir
Don't allow binary and source directory to be the same
2016-07-27 16:03:01 +02:00
asarium b02270a6eb Update secure variables for the main repo 2016-07-27 15:57:36 +02:00
asarium 65bc829ffc Update readme 2016-07-27 15:46:04 +02:00
asarium c51d7e5676 Don't allow binary and source directory to be the same 2016-07-27 15:43:51 +02:00
Fabian Woltermann a3c674b1f1 Merge pull request #680 from asarium/cmake_/pr
Move build system to CMake
2016-07-27 15:23:16 +02:00
asarium 0af3a04140 Don't link the speech lib
It's not needed, we just need the header.
2016-07-26 22:30:57 +02:00
asarium 8a883eb3a0 Disable speech building on MSVC2010 2016-07-26 22:24:06 +02:00
asarium 3e0f1a8501 Turn FRED warning into status message 2016-07-26 22:18:18 +02:00
asarium 4d25eabcf6 Enable FRED2 by default
If MFC could not be found then it's disabled without causing an error.
2016-07-26 22:16:13 +02:00
asarium 33141220c0 If supported set the Freespace2 as the default project 2016-07-23 22:24:50 +02:00
asarium 29d180d3a7 Fix build naming 2016-07-22 22:22:11 +02:00
asarium 26ed09d5b3 Fix revision in version 2016-07-22 12:10:05 +02:00
asarium 1bcd5400d3 Move build system to CMake 2016-07-22 12:07:19 +02:00
1251 changed files with 69460 additions and 194551 deletions

No files matched your search

+8
View File
@@ -268,8 +268,16 @@ xcuserdata
*.xccheckout
####
# Visual Studio Code
.vscode
####
# Documentation
#
documentation/doxygen/*
!documentation/doxygen/.gitkeep
.idea/*
projects/*
+6
View File
@@ -0,0 +1,6 @@
[submodule "cmake/external/cotire"]
path = cmake/external/cotire
url = https://github.com/sakra/cotire.git
[submodule "cmake/external/rpavlik-cmake-modules"]
path = cmake/external/rpavlik-cmake-modules
url = https://github.com/asarium/cmake-modules.git
+42 -17
View File
@@ -1,34 +1,55 @@
language: cpp
sudo: true
language: generic
sudo: required
dist: trusty
cache:
directories:
- $HOME/cmake
addons:
apt:
packages:
- ninja-build
- libopenal-dev
- libogg-dev
- libvorbis-dev
- build-essential
- automake
- autoconf
- libtheora-dev
- libreadline6-dev
- libpng12-dev
- libjpeg62-dev
- liblua5.1-0-dev
- libjansson-dev
- libtool
- libsdl2-dev
coverity_scan:
project:
name: "scp-fs2open/fs2open.github.com"
description: "Coverity via Travis CI"
notification_email: [email protected]
build_command_prepend: "./autogen.sh --enable-debug"
build_command: "make -j2"
build_command: "ci/travis/script.sh"
# must match TRAVIS_BRANCH check below
branch_pattern: coverity_scan
deploy:
- provider: releases
api_key:
secure: "Wdt4Ccefo7a0ZDjEJQJgpghh7n72FtNJuKSAPUvoz4gtEX6Ct9J8yJI1t9V3jE3CTbbLJ21/Q6eZRDfT7UfNJe5DdepoJsP9DeFhKMWqQCq+AChqQWlm0KeZAffJoJreL8vXYhnRYcLT9ceZHEH6AqwN9TPV+xJziGPISAkYNZ8="
skip_cleanup: true
file_glob: true
file: "/tmp/builds/*"
on:
condition: '"$RELEASE_BUILD" == true'
tags: true
- provider: bintray
user: sirknightly
key:
secure: "CZtvDW/zPf1Nxru21i8Wd+9hgiBRA8VowWBX0gmCOGgRq9WHISttKQQmBWGHuyVZ3rYvtE4Va2bR+2qRN+TFNkUUuOCOQkdBJTCal9nS3G/LprEmsOashG0Q5PTfMMBnlKzKxaxGJW6UhFj2GySmHEAjsFLVpuNWGJeeZgZQ3UE="
file: ci/bintray.json
on:
condition: '"$NIGHTLY_BUILD" == true'
tags: true
env:
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
# also note that fork's don't get access to secure keys
# you have to test using a branch in the main repo
- secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk="
matrix:
include:
@@ -38,20 +59,20 @@ matrix:
env: CONFIGURATION="Debug"
- os: linux
compiler: clang
env: CONFIGURATION="Debug"
env: CONFIGURATION="Debug" CC=clang CXX=clang++
- os: osx
compiler: clang
env: CONFIGURATION="Debug" MACOSX_ARCH=x86_64
env: CONFIGURATION="Debug"
- os: linux
compiler: gcc
env: CONFIGURATION="Release"
- os: linux
compiler: clang
env: CONFIGURATION="Release"
env: CONFIGURATION="Release" CC=clang CXX=clang++
- os: osx
compiler: clang
env: CONFIGURATION="Release" MACOSX_ARCH=x86_64
env: CONFIGURATION="Release"
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
@@ -59,10 +80,14 @@ before_install:
# unfortunately COVERITY_SCAN_BRANCH isn't defined until later in the
# build process
- if ([[ "${TRAVIS_JOB_NUMBER##*.}" != "1" ]] && [[ "${TRAVIS_BRANCH}" == "coverity_scan" ]]); then false ; fi
- ./ci/travis/before_install.sh
- source "./ci/travis/check_release.sh"
- "./ci/travis/before_install.sh"
install:
- ./ci/travis/install.sh
- "./ci/travis/install.sh"
- export PATH=$HOME/cmake/bin:$PATH
before_script:
- ./ci/travis/before_script.sh
- "./ci/travis/before_script.sh"
script:
- ./ci/travis/script.sh
- if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi
before_deploy:
- "./ci/travis/before_deploy.sh"
+186
View File
@@ -0,0 +1,186 @@
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 OLD)
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)
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/CMake")
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)
set(APPIMAGE_ASSISTANT "" CACHE STRING "The root directory of an AppImage clone.")
ENDIF(WIN32)
OPTION(FSO_BUILD_TOOLS "Build tools related to FSO" OFF)
OPTION(FSO_DEVELOPMENT_MODE "Generate binaries in development mode, only use if you know what you're doing!" OFF)
OPTION(FSO_BUILD_WXFRED2 "Build wxFRED2 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(COTIRE_ENABLE "Enable cotire, this speeds up builds but may cause issues while developing (default = OFF)" OFF)
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 COTIRE_ENABLE)
mark_as_advanced(FORCE FSO_INSTALL_DEBUG_FILES)
IF(COTIRE_ENABLE)
# Include cotire file from https://github.com/sakra/cotire/
include(cotire)
ENDIF(COTIRE_ENABLE)
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()
# 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_WXFRED2)
ADD_SUBDIRECTORY(wxfred2)
ENDIF(FSO_BUILD_WXFRED2)
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 "Building FRED2: ${FSO_BUILD_FRED2}")
message(STATUS "Using text to speech: ${FSO_USE_SPEECH}")
message(STATUS "Using voice recogition: ${FSO_USE_VOICEREC}")
elseif(UNIX)
message(STATUS "Building AppImage: ${FSO_BUILD_APPIMAGE}")
ENDIF()
message(STATUS "Building FSO tools: ${FSO_BUILD_TOOLS}")
message(STATUS "Building wxFRED: ${FSO_BUILD_WXFRED2}")
message(STATUS "Fatal warnings: ${FSO_FATAL_WARNINGS}")
-64
View File
@@ -1,64 +0,0 @@
# Makefile.am for fs2_open (top level)
#
# This file uses GNU Automake to generate makefiles
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = mongoose code
EXTRA_DIST = \
FS2OpenSCPReadMe.doc \
projects/Xcode/English.lproj/InfoPlist.strings \
projects/Xcode/FS2_Open.icns \
projects/Xcode/FS2_Open.xcodeproj/project.pbxproj \
projects/Xcode/Frameworks.tgz \
projects/Xcode/Info-debug.plist \
projects/Xcode/Info.plist \
projects/Xcode/README.Xcode \
projects/Xcode/SDLMain.h \
projects/Xcode/SDLMain.m
# D_ variants are defaults and should always be used
AM_CXXFLAGS = -I./code @D_CFLAGS@
AM_LDFLAGS = @D_LDFLAGS@
EXTRA_PROGRAMS = cfilearchiver cfileextractor
###############################################################################
##
## Begin utilitites
##
CPPSOURCES=$(wildcard code/*/*.cpp code/*/*.h)
# cfilearchiver -- to create VPs
cfilearchiver_SOURCES = \
code/cfilearchiver/cfilearchiver.cpp
# cfileextractor -- to extract files from VPs
cfileextractor_SOURCES = \
code/cfileextractor/cfileextractor.cpp
# catch all to build utilitites
tools: cfilearchiver cfileextractor
# cleaning
clean-tools:
-test -z "$(EXTRA_PROGRAMS)" || rm -f $(EXTRA_PROGRAMS)
## cppcheck : check for many code issues
cppcheck: ${CPPSOURCES}
cppcheck ${CPPSOURCES} --enable=all --platform=unix64 \
--std=c99 --inline-suppr --quiet
##
## End utilitites
##
###############################################################################
# make sure we get this stuff cleaned up
clean-generic: clean-tools
-11
View File
@@ -1,11 +0,0 @@
The "projects" directory contains ready projects for:
Microsoft Visual C++ 6
Microsoft Visual C++ 2005
Microsoft Visual C++ 2008
Micrsofot Visual C++ 2010
Apple Xcode
Code::Blocks
See the ChangeLog to see what's new.
See the INSTALL file for instructions on how to build fs2_open.
-19
View File
@@ -1,19 +0,0 @@
[![Coverity](https://scan.coverity.com/projects/870/badge.svg)](https://scan.coverity.com/projects/870)
[![Build Status](https://travis-ci.org/scp-fs2open/fs2open.github.com.svg?branch=master)](https://travis-ci.org/scp-fs2open/fs2open.github.com)
Welcome to Freespace Open!
In 2002 Volition released the source code for Freespace2. In the years since dedicated individuals have added countless new features to create a flexible and powerful space combat simulation engine. More info can be found on our [wiki](http://www.hard-light.net/wiki/index.php/Source_Code_Project)
People interested in contributing are encouraged to read [this thread](http://www.hard-light.net/forums/index.php?topic=82688.0)
The "projects" directory contains ready projects for:
* Microsoft Visual C++ 6, 2005, 2008, 2010, 2011, 2013, 2015
* Apple Xcode
* Code::Blocks
* Eclipse
Review the commit logs to see what's new.
See the INSTALL file for instructions on how to build fs2_open, or open the relevant MSVC project
+38
View File
@@ -0,0 +1,38 @@
FreeSpace2 *S*ource *C*ode *P*roject
==
[![Build Status](https://travis-ci.org/scp-fs2open/fs2open.github.com.svg?branch=master)](https://travis-ci.org/scp-fs2open/fs2open.github.com)
[![Coverity](https://img.shields.io/coverity/scan/870.svg)](https://scan.coverity.com/projects/870)
Building
--
For building you will need [CMake](http://www.cmake.org/cmake/resources/software.html). Version 3.4 is required. Once you have installed CMake you should create a build directory where the project/make files should be created, **do not create them inside the source tree!**<br>
<br>
On Windows you can use the `cmake-gui` executable to get a nice GUI, on Unix just use `cmake`. Use the newly created directory as build directory (change to this directory on Unix) and run cmake. On Windows this can be done by clicking the `Configure` button. Choose your compiler version and hit `Generate` when configuring is done. <br>
Depending on the makefile generator used build the `all` or `ALL_BUILD` target to compile the project.<br>
### Available variables to control the build
* `FSO_BUILD_WXFRED2`: Build the wxfred2 project, requires wxWidgets
* `FSO_FREESPACE_PATH`: Sets the path of your FreeSpace install, can be used to automatically run the generated executables with the correct working directory, this is an optional variable. By default this will use the value of the `FS2PATH` environment variable.
* `FSO_BUILD_TOOLS`: Build some tools related to FSO
#### Windows only variables
* `FSO_BUILD_FRED2`: Build FRED2, requires a Visual Studio version that ships with MFC
* `FSO_USE_SPEECH`: Build a binary with text-to-speech support
* `FSO_USE_VOICEREC`: Build a binary with voice recognition support
#### Advanced variables
You should only use these variables if you know what you're doing
* `FSO_CMAKE_DEBUG`: Print CMake debugging informations
* `FSO_BUILD_INCLUDED_LIBS`: Build libraries from the included source
* `FSO_USE_OPENALSOFT`: Use [OpenALSoft](http://kcat.strangesoft.net/openal.html) for OpenAL support
* `FSO_USE_LUAJIT`: Use [luajit](http://luajit.org/) as a replacement for lua
* `FSO_DEVELOPMENT_MODE`: Toggles some development behavior, only use if you really need it.
* `FSO_RUN_ARGUMENTS`: If you run an executable from within the project, these arguments will also be passed to the executable
* `FSO_BUILD_POSTFIX`: Sets a postfix to be added to the executable name, may be useful for release candidates.
#### Visual Studio specific variables
* `MSVC_USE_RUNTIME_DLL`: Use the DLL version of the runtime, experimental and not well tested.
* `MSVC_SIMD_INSTRUCTIONS`: The instruction set the executables will be optimized for.
### Generating an installation package
CMake can automaticall generate installation packages of the project. To do this you will just need to run the `package` target of the build system and the package will be placed inside your build directory. On Windows you will have to install [NSIS](http://nsis.sourceforge.net/Main_Page) to use this.
+36 -12
View File
@@ -1,16 +1,40 @@
version: 1.0.0.{build}
shallow_clone: true
configuration:
- Debug
- Release
clone_depth: 10
environment:
matrix:
- VisualStudioVersion: 10.0
PlatformToolset: v100
ProjectPath: projects/MSVC_2010/Freespace2.vcxproj
- VisualStudioVersion: 12.0
PlatformToolset: v120
ProjectPath: projects/MSVC_2013/Freespace2.vcxproj
- VisualStudioVersion: 14.0
PlatformToolset: v140
ProjectPath: projects/MSVC_2015/Freespace2.vcxproj
- VS_VERSION: 12
CMAKE_GENERATOR: Visual Studio 12 2013
PlatformToolset: v120_xp
- VS_VERSION: 14
CMAKE_GENERATOR: Visual Studio 14 2015
PlatformToolset: v140_xp
before_build:
- git submodule update --init --recursive
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/check_release.ps1
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/before_build.ps1
build_script:
- msbuild "%ProjectPath%" /p:Configuration="Debug SSE2" /m /p:PlatformToolset="%PlatformToolset%" /verbosity:minimal
test: off
- ps: . $Env:APPVEYOR_BUILD_FOLDER/ci/appveyor/build.ps1
deploy:
- provider: GitHub
auth_token:
secure: 3kV4efHXwRnfXzmJPRAOs8D7+MhwXUXYeayI/P5y114L09kJa6b6L70beXdW7yYr
on:
ReleaseBuild: true # deploy on release push only
- provider: BinTray
username: sirknightly
api_key:
secure: pYWqfiZhIWvFYdjVWPXNaHobmnkXIWa4+LwoiyMTEiu4Z0CiCAW0ZrMfTKVkORKz
subject: scp-fs2open
repo: FSO
package: nightly
version: $(VersionName)
publish: true
override: true
on:
NightlyBuild: true # deploy on nightly push only
-139
View File
@@ -1,139 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
PKG_NAME="fs2_open"
# check the version of a package
check_version() {
COMMAND=$1
MAJOR=$2
MINOR=$3
MICRO=$4
($COMMAND --version) </dev/null >/dev/null 2>&1 || return 1
ver=`$COMMAND --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
major=`echo $ver | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
minor=`echo $ver | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
micro=`echo $ver | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
test -z "$major" && major=0
test -z "$minor" && minor=0
test -z "$micro" && micro=0
fail=0
if [ ! "$major" -gt "$MAJOR" ]; then
if [ "$major" -lt "$MAJOR" ]; then
fail=1
elif [ ! "$minor" -gt "$MINOR" ]; then
if [ "$minor" -lt "$MINOR" ]; then
fail=1
elif [ "$micro" -lt "$MICRO" ]; then
fail=1
fi
fi
fi
return "$fail"
}
AUTOMAKE=
ACLOCAL=
DIE=0
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed to."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
for AM in automake-1.11 automake-1.10 automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake; do
(check_version "$AM" 1 6 1) && {
AUTOMAKE="$AM"
break
}
done
if [ -z "$AUTOMAKE" ]; then
echo
echo "**Error**: You must have \`automake' version 1.6.1 or greater"
echo "installed to compile $PKG_NAME. Download the appropriate package"
echo "for your distribution, or get the source tarball at"
echo "ftp://ftp.gnu.org/pub/gnu/"
DIE=1
fi
# if no automake, don't bother testing for aclocal
test -z "$AUTOMAKE" || {
for ACL in aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal-1.6 aclocal; do
(check_version "$ACL" 1 6 1) && {
ACLOCAL="$ACL"
break
}
done
if [ -z "$ACLOCAL" ]; then
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed seems to be outdated. Get a recent package from"
echo "ftp://ftp.gnu.org/pub/gnu/"
DIE=1
fi
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for coin in `find $srcdir -name configure.ac -print`
do
dr=`dirname $coin`
if test -f $dr/NO-AUTO-GEN; then
echo skipping $dr -- flagged as no auto-gen
else
echo processing $dr
macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
( cd $dr
aclocalinclude="$ACLOCAL_FLAGS"
for k in $macrodirs; do
if test -d $k; then
aclocalinclude="$aclocalinclude -I $k"
##else
## echo "**Warning**: No such directory \`$k'. Ignored."
fi
done
echo "Running autoreconf..."
autoreconf --install
)
# DIE if the subshell failed
if [ $? -ne 0 ]; then
exit 1
fi
fi
done
#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
# to not run configure, call autogen.sh as,
# NOCONFIGURE=1 ./autogen.sh
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile $PKG_NAME.
else
echo Skipping configure process.
fi
+5
View File
@@ -0,0 +1,5 @@
New-Item build -type directory
Set-Location -Path build
cmake -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER/../install" -DFSO_USE_SPEECH="ON" `
-DFSO_USE_VOICEREC="ON" -DMSVC_SIMD_INSTRUCTIONS=SSE2 -G "$Env:CMAKE_GENERATOR" -T "$Env:PlatformToolset" ..
+28
View File
@@ -0,0 +1,28 @@
write "$env:DeployBuild"
write "$env:DeployConfig"
if ([System.Convert]::ToBoolean($env:DeployBuild)) {
# Release build
if (![System.Convert]::ToBoolean($env:DeployConfig)) {
exit 0 # End the build
}
$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 "$($env:PackageName)-builds-Win32.zip" "$env:APPVEYOR_BUILD_FOLDER/../install/*"
Push-AppveyorArtifact "$($env:PackageName)-builds-Win32.zip"
} else {
cmake --build . --config "$Env:CONFIGURATION" -- /verbosity:minimal
if (! ($?)) {
exit 1
}
}
+30
View File
@@ -0,0 +1,30 @@
# Default values
Set-AppveyorBuildVariable 'ReleaseBuild' 'false'
Set-AppveyorBuildVariable 'NightlyBuild' 'false'
Set-AppveyorBuildVariable 'DeployBuild' 'false'
Set-AppveyorBuildVariable 'PackagePrefix' ''
Set-AppveyorBuildVariable 'VersionName' ''
if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^release_(.*)")) {
# Tag matches
Set-AppveyorBuildVariable 'ReleaseBuild' 'true'
Set-AppveyorBuildVariable 'PackageName' "fs2_open_$($matches[1])"
}
if ([System.Convert]::ToBoolean($env:APPVEYOR_REPO_TAG) -And ("$env:APPVEYOR_REPO_TAG_NAME" -match "^nightly_(.*)")) {
# Tag matches
Set-AppveyorBuildVariable 'NightlyBuild' 'true'
Set-AppveyorBuildVariable 'PackageName' "nightly_$($matches[1])"
Set-AppveyorBuildVariable 'VersionName' "$($matches[1])"
}
if (($Env:Configuration -eq "Release") -And ($Env:VS_VERSION -eq "14")) {
Set-AppveyorBuildVariable 'DeployConfig' 'true'
} else {
Set-AppveyorBuildVariable 'DeployConfig' 'false'
}
if ([System.Convert]::ToBoolean($env:ReleaseBuild) -Or [System.Convert]::ToBoolean($env:NightlyBuild)) {
Set-AppveyorBuildVariable 'DeployBuild' 'true'
}
+19
View File
@@ -0,0 +1,19 @@
{
"package": {
"subject": "scp-fs2open",
"repo": "FSO",
"name": "nightly"
},
"version": {
"name": "$VERSION_NAME"
},
"files": [
{
"includePattern": "/tmp/builds/(.*)",
"uploadPattern": "$1"
}
],
"publish": true
}
+8
View File
@@ -0,0 +1,8 @@
#!/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
+3 -3
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env sh
set -e
set -ex
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo add-apt-repository --yes ppa:zoogie/sdl2-snapshots
sudo apt-get update -qq
# Nothing to do here
:
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
# Nothing to do here
:
+19 -13
View File
@@ -1,20 +1,26 @@
#!/usr/bin/env sh
set -e
set -ex
mkdir -p build
cd build
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
# Due to a bug in gcc the array bounds check isn't working correctly
# This can be removed when gcc is updated
AUTOGEN_CONFIG="--enable-fatal-warnings --enable-generic-architecture"
CXXFLAGS="-Wno-array-bounds -Wno-unknown-pragmas"
if [ "$CONFIGURATION" = "Debug" ]; then
AUTOGEN_CONFIG="$AUTOGEN_CONFIG --enable-debug"
export CXXFLAGS="-m64 -mtune=generic -mfpmath=sse -msse -msse2 -pipe -Wno-unknown-pragmas"
CMAKE="cmake -G Ninja -DFSO_FATAL_WARNINGS=ON"
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" \
-DFSO_BUILD_APPIMAGE=ON -DAPPIMAGE_ASSISTANT="$HOME/AppImageAssistant" \
-DFSO_BUILD_INCLUDED_LIBS=ON ../..
cd ..
done
else
eval $CMAKE -DCMAKE_BUILD_TYPE=$CONFIGURATION ..
fi
export CXXFLAGS
./autogen.sh $AUTOGEN_CONFIG
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd projects/Xcode
tar -xvzf Frameworks.tgz
cmake -G "Xcode" -DFSO_FATAL_WARNINGS=ON -DFSO_INSTALL_DEBUG_FILES=ON -DCMAKE_INSTALL_PREFIX="/tmp/release" ..
fi
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
RELEASE_BUILD=false
NIGHTLY_BUILD=false
BUILD_DEPLOYMENT=false
BUILD_CONFIGS="Release FastDebug"
VERSION_NAME=""
PACKAGE_NAME=""
RELEASE_PATTERN="^release_(.*)$"
NIGHTLY_PATTERN="^nightly_(.*)$"
if [[ "$TRAVIS_TAG" =~ $RELEASE_PATTERN ]]; then
echo "This is a release tag!";
RELEASE_BUILD=true;
PACKAGE_NAME="fs2_open_${BASH_REMATCH[1]}";
fi
if [[ "$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 ([ "$RELEASE_BUILD" = true ] || [ "$NIGHTLY_BUILD" = true ]); then
BUILD_DEPLOYMENT=true;
fi
if [ "$BUILD_DEPLOYMENT" = true ]; then
if ([ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CC" = "clang" ]); then
echo "Skipping non-release compiler";
exit 0;
fi
if ([[ "$CONFIGURATION" == "Debug" ]]); then
echo "Skipping non-release configuration";
exit 0;
fi
fi
export RELEASE_BUILD
export NIGHTLY_BUILD
export BUILD_DEPLOYMENT
export BUILD_CONFIGS
export VERSION_NAME
export PACKAGE_NAME
+25 -3
View File
@@ -1,9 +1,31 @@
#!/usr/bin/env sh
set -e
set -ex
FILENAME=
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo apt-get install libsdl2-dev
if [ ! -d "$HOME/cmake/bin" ]; then
# If the cache does not currently contain CMake then download and install it
FILENAME=cmake-3.4.3-Linux-x86_64
mkdir -p $HOME/cmake/
wget -O /tmp/cmake.tar.gz --no-check-certificate https://www.cmake.org/files/v3.4/$FILENAME.tar.gz
tar -xzf /tmp/cmake.tar.gz -C $HOME/cmake/ --strip-components=1
fi
export PATH=$HOME/cmake/bin:$PATH
cd $HOME
if [ "${BUILD_DEPLOYMENT}" = true ]; then
wget -c "https://github.com/probonopd/AppImageKit/releases/download/5/AppImageAssistant" # (64-bit)
chmod a+x ./AppImageAssistant
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
gem install xcpretty thefox-pastebin
gem install xcpretty xcpretty-travis-formatter thefox-pastebin
brew update
brew outdated cmake || brew upgrade cmake
fi
cmake --version
+35
View File
@@ -0,0 +1,35 @@
#!/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"
ninja install appimage
cd ..
done
ls -al /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 -f `xcpretty-travis-formatter`
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
+8 -7
View File
@@ -2,15 +2,16 @@
set -e
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
make -j 4
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cd projects/Xcode
cd build
xcodebuild -project FS2_Open.xcodeproj -configuration "$CONFIGURATION" clean build | tee release.log | xcpretty
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
ninja
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
cmake --build . --config "$CONFIGURATION" | tee build.log | xcpretty -f `xcpretty-travis-formatter`
XCODE_RET=${PIPESTATUS[0]}
if [ "$XCODE_RET" -ne "0" ]; then
pastebin -e 1d -f release.log
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
fi
fi
+4
View File
@@ -0,0 +1,4 @@
[Desktop Entry]
Name=FreeSpace Open
Exec=$<TARGET_FILE_NAME:Freespace2>
Icon=app_icon.png
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export LD_LIBRARY_PATH="${HERE}"/lib:$PATH
"${HERE}"/bin/$<TARGET_FILE_NAME:Freespace2> $@
+14
View File
@@ -0,0 +1,14 @@
include(WriteCompilerDetectionHeader)
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
)
+23
View File
@@ -0,0 +1,23 @@
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")
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")
install(FILES "${CMAKE_SOURCE_DIR}/freespace2/resources/app_icon.png" DESTINATION ".")
add_custom_target(appimage
COMMAND "${APPIMAGE_ASSISTANT}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/fs2_open_${FSO_BINARY_SUFFIX}.AppImage")
add_dependencies(appimage install)
+52
View File
@@ -0,0 +1,52 @@
// 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 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(AVX)
std::cout << "AVX";
else if(SSE2)
std::cout << "SSE2";
else if(SSE)
std::cout << "SSE";
return 0;
}
+154
View File
@@ -0,0 +1,154 @@
# ------------------------- 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
@@ -0,0 +1,37 @@
# 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)
Vendored Submodule
+1
Submodule cmake/external/cotire added at 40a46bf2fb.
+33
View File
@@ -0,0 +1,33 @@
add_library(speech INTERFACE)
if (WIN32)
find_package(WindowsSDK REQUIRED)
foreach(dir ${WINDOWSSDK_DIRS})
get_windowssdk_library_dirs("${dir}" LIB_DIRS)
find_library(SPEECH_LIBRARY
NAMES sapi
PATHS ${LIB_DIRS}
NO_DEFAULT_PATH)
if (SPEECH_LIBRARY)
set(SDK_DIR "${dir}")
break()
endif()
endforeach()
if (NOT SPEECH_LIBRARY)
message(SEND_ERROR "Text to speech library could not be found! Either install it or disable the speech option.")
return()
endif()
get_windowssdk_include_dirs("${SDK_DIR}" INCLUDE_DIRS)
target_include_directories(speech INTERFACE ${INCLUDE_DIRS})
else()
message(SEND_ERROR "Text to Speech is not supported on this platform!")
endif()
target_compile_definitions(speech INTERFACE -DFS2_SPEECH)
+5
View File
@@ -0,0 +1,5 @@
include(platformChecks)
include(Cxx11)
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/project.h.in ${GENERATED_SOURCE_DIR}/project.h)
+3
View File
@@ -0,0 +1,3 @@
SET(BINARY_DESTINATION ".")
SET(LIBRAY_DESTINATION "${BINARY_DESTINATION}")
+8
View File
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,14 @@
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)
+11
View File
@@ -0,0 +1,11 @@
MESSAGE(STATUS "Doing Mac OSX specific things...")
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})
+10
View File
@@ -0,0 +1,10 @@
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()
+2
View File
@@ -0,0 +1,2 @@
target_compile_definitions(platform INTERFACE SCP_SOLARIS)
+6
View File
@@ -0,0 +1,6 @@
INCLUDE(util)
MESSAGE(STATUS "Configuring UNIX specific things and stuff...")
target_compile_definitions(platform INTERFACE SCP_UNIX USE_OPENAL)
+20
View File
@@ -0,0 +1,20 @@
MESSAGE(STATUS "Configuring Windows specific things and stuff...")
target_link_libraries(platform INTERFACE
comctl32.lib
msacm32.lib
odbc32.lib
odbccp32.lib
vfw32.lib
winmm.lib
wsock32.lib
Psapi.lib
)
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)
+17
View File
@@ -0,0 +1,17 @@
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckLibraryExists)
include(CheckPrototypeDefinition)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
CHECK_INCLUDE_FILE_CXX("cxxabi.h" HAVE_CXXAPI_H)
set(PLATFORM_CHECK_HEADER "${GENERATED_SOURCE_DIR}/platformChecks.h")
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/platformChecks.h.in "${PLATFORM_CHECK_HEADER}")
+9
View File
@@ -0,0 +1,9 @@
#ifndef __PLATFORM_CHECKS_H__
#define __PLATFORM_CHECKS_H__
#pragma once
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_CXXAPI_H
#endif // __PLATFORM_CHECKS_H__
+22
View File
@@ -0,0 +1,22 @@
add_library(platform INTERFACE)
IF(FSO_CMAKE_DEBUG)
INCLUDE(debug-vars)
ENDIF(FSO_CMAKE_DEBUG)
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)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
ELSE(WIN32)
MESSAGE(STATUS "This platform is not supported, good luck!")
ENDIF(WIN32)
+17
View File
@@ -0,0 +1,17 @@
#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
+20
View File
@@ -0,0 +1,20 @@
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-unused-function")
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")
+65
View File
@@ -0,0 +1,65 @@
# Clang
include(EnableExtraCompilerWarnings)
include(CheckCXXCompilerFlag)
MESSAGE(STATUS "Doing configuration specific to clang...")
unset(COMPILER_FLAGS)
if(DEFINED ENV{CXXFLAGS})
set(COMPILER_FLAGS $ENV{CXXFLAGS})
endif()
if(NOT COMPILER_FLAGS)
set(COMPILER_FLAGS "-march=native -pipe")
endif()
globally_enable_extra_compiler_warnings()
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()
# Omit "deprecated conversion from string constant to 'char*'" warnings.
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-write-strings")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-function")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-deprecated -Wno-char-subscripts")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-parameter")
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")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Werror")
endif()
set(CMAKE_CXX_FLAGS ${COMPILER_FLAGS})
set(CMAKE_C_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 "")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -rdynamic")
+73
View File
@@ -0,0 +1,73 @@
include(EnableExtraCompilerWarnings)
include(CheckCCompilerFlag)
include(util)
MESSAGE(STATUS "Doing configuration specific to gcc...")
option(GCC_ENABLE_LEAK_CHECK "Enable the -fsanitize=leak" OFF)
unset(COMPILER_FLAGS)
if(DEFINED ENV{CXXFLAGS})
set(COMPILER_FLAGS $ENV{CXXFLAGS})
endif()
if(NOT COMPILER_FLAGS)
set(COMPILER_FLAGS "-march=native -pipe")
endif()
globally_enable_extra_compiler_warnings()
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
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()
# Omit "deprecated conversion from string constant to 'char*'" warnings.
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-write-strings")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-function")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-deprecated -Wno-char-subscripts")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-unused-parameter")
set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered")
set(COMPILER_FLAGS_DEBUG "-O0 -g -Wshadow")
if (FSO_FATAL_WARNINGS)
# Make warnings fatal if the right variable is set
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Werror")
endif()
set(CMAKE_CXX_FLAGS ${COMPILER_FLAGS})
set(CMAKE_C_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 (GCC_ENABLE_LEAK_CHECK)
check_linker_flag("-fsanitize=leak" SUPPORTS_FSANITIZE_LEAK)
if (SUPPORTS_FSANITIZE_LEAK)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=leak")
endif()
endif()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -rdynamic")
IF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-zignore")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+130
View File
@@ -0,0 +1,130 @@
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)
MARK_AS_ADVANCED(FORCE MSVC_USE_RUNTIME_DLL)
# These are the warnings we disable
set(WARNING_FLAGS
/wd"4100" # unreferenced formal parameters
/wd"4127" # constant conditional (assert)
/wd"4201" # nonstandard extension used: nameless struct/union (happens a lot in Windows include headers)
/wd"4290" # C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
/wd"4390" # empty control statement (triggered by nprintf and mprintf's inside of one-line if's, etc)
/wd"4410" # illegal size for operand... ie... fxch st(1)
/wd"4511" # copy constructor could not be generated (happens a lot in Windows include headers)
/wd"4512" # assignment operator could not be generated (happens a lot in Windows include headers)
/wd"4514" # unreferenced inline function removed
/wd"4611" # _setjmp warning. Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us.
/wd"4663" # C++ language change (template specification)
/wd"4710" # is inline function not expanded (who cares?)
/wd"4711" # tells us an inline function was expanded (who cares?)
/wd"4786" # is identifier truncated to 255 characters (happens all the time in Microsoft #includes) -- Goober5000"
/wd"4996" # deprecated strcpy, strcat, sprintf, etc. (from MSVC 2005) - taylor
/wd"4311" # Disables warnings about casting pointer types to ints. The funny thing is these warnings can't be resolved, just disabled... - m!m
/wd"4302" # Same as above - m!m
/wd"4366" # The result of the unary '&' operator may be unaligned - m!m
$<$<CONFIG:Release>:/wd"4101"> # In release mode there are unreferenced variables because debug needs them
)
target_compile_options(compiler INTERFACE ${WARNING_FLAGS})
# Base
set(CMAKE_C_FLAGS "/MP /GS- /analyze- /Zc:wchar_t /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo")
set(CMAKE_CXX_FLAGS "/MP /GS- /analyze- /Zc:wchar_t /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo")
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 /W2 /Gy- /Ox /Ot /Ob2 /fp:precise /GF /Oy /Oi /Zi /W3")
set(CMAKE_CXX_FLAGS_RELEASE "/GL /W2 /Gy- /Ox /Ot /Ob2 /fp:precise /GF /Oy /Oi /Zi /W3")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /LTCG /INCREMENTAL:NO")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
globally_enable_extra_compiler_warnings()
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()
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)
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)
+33
View File
@@ -0,0 +1,33 @@
# 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_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()
+169
View File
@@ -0,0 +1,169 @@
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} 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_FILES_TO_TARGET _target)
FOREACH(file IN LISTS TARGET_COPY_FILES)
ADD_CUSTOM_COMMAND(
TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "$<TARGET_FILE_DIR:${_target}>"
COMMENT "copying '${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}>")
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(COTIRE_ENABLE)
# Disable unity build as it doesn't work well for us
set_target_properties(${target} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
# add ignored paths for the precompiled header here
set_target_properties(code PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH
"${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}")
IF(DEFINED CMAKE_CONFIGURATION_TYPES)
cotire(${target} CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
ELSE(DEFINED CMAKE_CONFIGURATION_TYPES)
cotire(${target})
ENDIF(DEFINED CMAKE_CONFIGURATION_TYPES)
ENDIF(COTIRE_ENABLE)
endmacro(configure_cotire)
macro(add_target_copy_files)
INSTALL(FILES ${ARGN}
DESTINATION ${BINARY_DESTINATION}
)
SET(TARGET_COPY_FILES ${TARGET_COPY_FILES} ${ARGN} CACHE INTERNAL "" FORCE)
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)
+52
View File
@@ -0,0 +1,52 @@
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 3)
set_if_not_defined(FSO_VERSION_MINOR 7)
set_if_not_defined(FSO_VERSION_BUILD 5)
# 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(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 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}")
+56
View File
@@ -0,0 +1,56 @@
INCLUDE(source_groups.cmake)
INCLUDE(voice_rec.cmake)
ADD_LIBRARY(code STATIC ${file_root} ${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 gl_12)
TARGET_LINK_LIBRARIES(code PUBLIC ${OPENAL_LIBS})
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 oggvorbis)
TARGET_LINK_LIBRARIES(code PUBLIC ${SDL_LIBS})
TARGET_LINK_LIBRARIES(code PUBLIC platform)
TARGET_LINK_LIBRARIES(code PUBLIC compiler)
IF (FSO_USE_SPEECH)
find_package(Speech REQUIRED)
target_link_libraries(code PUBLIC speech)
ENDIF(FSO_USE_SPEECH)
# Headers for standalone "gui" on UNIX
IF(UNIX)
TARGET_LINK_LIBRARIES(code PUBLIC jansson)
TARGET_LINK_LIBRARIES(code PUBLIC ${MONGOOSE_LIBS})
ENDIF(UNIX)
IF(FSO_BUILD_TOOLS)
ADD_SUBDIRECTORY(cfilearchiver)
ADD_SUBDIRECTORY(cfileextractor)
ENDIF(FSO_BUILD_TOOLS)
include(util)
configure_cotire(code)
include(../cmake/Cxx11.cmake)
-915
View File
@@ -1,915 +0,0 @@
## code/Makefile.am for fs2_open
##
## $Id: Makefile.am,v 1.31.2.10 2007-11-22 04:52:12 taylor Exp $
EXTRA_DIST = \
freespace2/app_icon.ico \
freespace2/freespace.rc \
freespace2/freespaceresource.h \
freespace2/goal_com.bmp \
freespace2/goal_fail.bmp \
freespace2/goal_inc.bmp \
freespace2/goal_none.bmp \
freespace2/goal_ord.bmp \
fred2/addvariabledlg.cpp \
fred2/addvariabledlg.h \
fred2/adjustgriddlg.cpp \
fred2/adjustgriddlg.h \
fred2/asteroideditordlg.cpp \
fred2/asteroideditordlg.h \
fred2/bgbitmapdlg.cpp \
fred2/bgbitmapdlg.h \
fred2/briefingeditordlg.cpp \
fred2/briefingeditordlg.h \
fred2/campaigneditordlg.cpp \
fred2/campaigneditordlg.h \
fred2/campaignfilelistbox.cpp \
fred2/campaignfilelistbox.h \
fred2/campaigntreeview.cpp \
fred2/campaigntreeview.h \
fred2/campaigntreewnd.cpp \
fred2/campaigntreewnd.h \
fred2/cmdbrief.cpp \
fred2/cmdbrief.h \
fred2/createwingdlg.cpp \
fred2/createwingdlg.h \
fred2/customwingnames.cpp \
fred2/customwingnames.h \
fred2/debriefingeditordlg.cpp \
fred2/debriefingeditordlg.h \
fred2/dialog1.cpp \
fred2/dialog1.h \
fred2/dumpstats.cpp \
fred2/dumpstats.h \
fred2/editor.h \
fred2/eventeditor.cpp \
fred2/eventeditor.h \
fred2/folderdlg.cpp \
fred2/folderdlg.h \
fred2/fred.cpp \
fred2/fred.h \
fred2/fred.rc \
fred2/freddoc.cpp \
fred2/freddoc.h \
fred2/fredrender.cpp \
fred2/fredrender.h \
fred2/fredstubs.cpp \
fred2/fredview.cpp \
fred2/fredview.h \
fred2/grid.cpp \
fred2/grid.h \
fred2/ignoreordersdlg.cpp \
fred2/ignoreordersdlg.h \
fred2/initialships.cpp \
fred2/initialships.h \
fred2/initialstatus.cpp \
fred2/initialstatus.h \
fred2/mainfrm.cpp \
fred2/mainfrm.h \
fred2/makehelp.bat \
fred2/management.cpp \
fred2/management.h \
fred2/messageeditordlg.cpp \
fred2/messageeditordlg.h \
fred2/missiongoalsdlg.cpp \
fred2/missiongoalsdlg.h \
fred2/missionnotesdlg.cpp \
fred2/missionnotesdlg.h \
fred2/missionsave.cpp \
fred2/missionsave.h \
fred2/modifyvariabledlg.cpp \
fred2/modifyvariabledlg.h \
fred2/operatorargtypeselect.cpp \
fred2/operatorargtypeselect.h \
fred2/orienteditor.cpp \
fred2/orienteditor.h \
fred2/playerstarteditor.cpp \
fred2/playerstarteditor.h \
fred2/prefsdlg.cpp \
fred2/prefsdlg.h \
fred2/reinforcementeditordlg.cpp \
fred2/reinforcementeditordlg.h \
fred2/resource.h \
fred2/resource.hm \
fred2/setglobalshipflags.cpp \
fred2/setglobalshipflags.h \
fred2/sexp_tree.cpp \
fred2/sexp_tree.h \
fred2/shieldsysdlg.cpp \
fred2/shieldsysdlg.h \
fred2/ship_select.cpp \
fred2/ship_select.h \
fred2/shipchecklistbox.cpp \
fred2/shipchecklistbox.h \
fred2/shipclasseditordlg.cpp \
fred2/shipclasseditordlg.h \
fred2/shipeditordlg.cpp \
fred2/shipeditordlg.h \
fred2/shipflagsdlg.cpp \
fred2/shipflagsdlg.h \
fred2/shipgoalsdlg.cpp \
fred2/shipgoalsdlg.h \
fred2/shipspecialdamage.cpp \
fred2/shipspecialdamage.h \
fred2/shipspecialhitpoints.cpp \
fred2/shipspecialhitpoints.h \
fred2/shiptexturesdlg.cpp \
fred2/shiptexturesdlg.h \
fred2/starfieldeditor.cpp \
fred2/starfieldeditor.h \
fred2/stdafx.cpp \
fred2/stdafx.h \
fred2/textviewdlg.cpp \
fred2/textviewdlg.h \
fred2/voiceactingmanager.cpp \
fred2/voiceactingmanager.h \
fred2/waypointpathdlg.cpp \
fred2/waypointpathdlg.h \
fred2/weaponeditordlg.cpp \
fred2/weaponeditordlg.h \
fred2/wing.cpp \
fred2/wing.h \
fred2/wing_editor.cpp \
fred2/wing_editor.h \
fred2/hlp/afxcore.rtf \
fred2/hlp/afxhelp.hm \
fred2/hlp/afxprint.rtf \
fred2/hlp/appexit.bmp \
fred2/hlp/bullet.bmp \
fred2/hlp/curarw2.bmp \
fred2/hlp/curarw4.bmp \
fred2/hlp/curhelp.bmp \
fred2/hlp/editcopy.bmp \
fred2/hlp/editcut.bmp \
fred2/hlp/editpast.bmp \
fred2/hlp/editundo.bmp \
fred2/hlp/filenew.bmp \
fred2/hlp/fileopen.bmp \
fred2/hlp/fileprnt.bmp \
fred2/hlp/filesave.bmp \
fred2/hlp/fred.hm \
fred2/hlp/fred.hpj \
fred2/hlp/help.log \
fred2/hlp/hlpsbar.bmp \
fred2/hlp/hlptbar.bmp \
fred2/hlp/recfirst.bmp \
fred2/hlp/reclast.bmp \
fred2/hlp/recnext.bmp \
fred2/hlp/recprev.bmp \
fred2/hlp/scmax.bmp \
fred2/hlp/scmenu.bmp \
fred2/hlp/scmin.bmp \
fred2/res/bitmap1.bmp \
fred2/res/black_do.bmp \
fred2/res/bmp00001.bmp \
fred2/res/chained.bmp \
fred2/res/chained_directive.bmp \
fred2/res/cursor1.cur \
fred2/res/cursor2.cur \
fred2/res/data.bmp \
fred2/res/fred.ico \
fred2/res/fred.rc2 \
fred2/res/freddoc.ico \
fred2/res/green_do.bmp \
fred2/res/root.bmp \
fred2/res/root_directive.bmp \
fred2/res/toolbar.bmp \
fred2/res/toolbar1.bmp \
fred2/res/variable.bmp \
sound/phrases.xml \
sound/gc.exe \
wxfred2/res/fred.ico \
wxfred2/wxfred.xrc
# D_ variants are defaults and should always be used
# FS2_ variants are for game building and wxFRED
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@ -I./$(VPATH)/../mongoose
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
if BUILD_WXFRED
LIBCODE=
else
LIBCODE=libcode.a
endif
noinst_LIBRARIES = $(LIBCODE)
bin_PROGRAMS = @FS2_BINARY@
EXTRA_PROGRAMS = fs2_open_@PACKAGE_VERSION@ \
fs2_open_@PACKAGE_VERSION@_DEBUG \
wxFRED2_@PACKAGE_VERSION@ \
wxFRED2_@PACKAGE_VERSION@_DEBUG
###############################################################################
##
## Begin CORE library
##
FS2_SOURCES = \
ai/ai.cpp \
ai/ai.h \
ai/aibig.cpp \
ai/aibig.h \
ai/aicode.cpp \
ai/aigoals.cpp \
ai/aigoals.h \
ai/aiinternal.h \
ai/aiturret.cpp \
ai/ai_profiles.cpp \
ai/ai_profiles.h \
anim/animplay.cpp \
anim/animplay.h \
anim/packunpack.cpp \
anim/packunpack.h \
asteroid/asteroid.cpp \
asteroid/asteroid.h \
autopilot/autopilot.cpp \
autopilot/autopilot.h \
bmpman/bm_internal.h \
bmpman/bmpman.cpp \
bmpman/bmpman.h \
camera/camera.cpp \
camera/camera.h \
cfile/cfile.cpp \
cfile/cfile.h \
cfile/cfilearchive.cpp \
cfile/cfilearchive.h \
cfile/cfilelist.cpp \
cfile/cfilesystem.cpp \
cfile/cfilesystem.h \
cmdline/cmdline.cpp \
cmdline/cmdline.h \
cmeasure/cmeasure.cpp \
cmeasure/cmeasure.h \
controlconfig/controlsconfig.cpp \
controlconfig/controlsconfig.h \
controlconfig/controlsconfigcommon.cpp \
cutscene/cutscenes.cpp \
cutscene/cutscenes.h \
cutscene/decoder16.cpp \
cutscene/decoder8.cpp \
cutscene/movie.cpp \
cutscene/movie.h \
cutscene/mve_audio.cpp \
cutscene/mvelib.cpp \
cutscene/mvelib.h \
cutscene/mveplayer.cpp \
cutscene/oggplayer.cpp \
cutscene/oggplayer.h \
ddsutils/ddsutils.cpp \
ddsutils/ddsutils.h \
debris/debris.cpp \
debris/debris.h \
debugconsole/console.cpp \
debugconsole/console.h \
debugconsole/consolecmds.cpp \
debugconsole/consoleparse.cpp \
debugconsole/consoleparse.h \
exceptionhandler/exceptionhandler.cpp \
exceptionhandler/exceptionhandler.h \
external_dll/externalcode.h \
external_dll/trackirglobal.cpp \
external_dll/trackirglobal.h \
fireball/fireballs.cpp \
fireball/fireballs.h \
fireball/warpineffect.cpp \
fs2netd/fs2netd_client.cpp \
fs2netd/fs2netd_client.h \
fs2netd/tcp_client.cpp \
fs2netd/tcp_client.h \
fs2netd/tcp_socket.cpp \
fs2netd/tcp_socket.h \
fs2netd/protocol.h \
gamehelp/contexthelp.cpp \
gamehelp/contexthelp.h \
gamehelp/gameplayhelp.cpp \
gamehelp/gameplayhelp.h \
gamesequence/gamesequence.cpp \
gamesequence/gamesequence.h \
gamesnd/eventmusic.cpp \
gamesnd/eventmusic.h \
gamesnd/gamesnd.cpp \
gamesnd/gamesnd.h \
globalincs/alphacolors.cpp \
globalincs/alphacolors.h \
globalincs/def_files.cpp \
globalincs/def_files.h \
globalincs/fsmemory.cpp \
globalincs/fsmemory.h \
globalincs/globals.h \
globalincs/linklist.h \
globalincs/profiling.cpp \
globalincs/pstypes.h \
globalincs/safe_strings.cpp \
globalincs/safe_strings.h \
globalincs/safe_strings_test.cpp \
globalincs/systemvars.cpp \
globalincs/systemvars.h \
globalincs/version.cpp \
globalincs/version.h \
graphics/2d.cpp \
graphics/2d.h \
graphics/font.cpp \
graphics/font.h \
graphics/generic.cpp \
graphics/generic.h \
graphics/grbatch.cpp \
graphics/grbatch.h \
graphics/grinternal.h \
graphics/gropengl.cpp \
graphics/gropengl.h \
graphics/gropenglbmpman.cpp \
graphics/gropenglbmpman.h \
graphics/gropengldraw.cpp \
graphics/gropengldraw.h \
graphics/gropenglextension.cpp \
graphics/gropenglextension.h \
graphics/gropengllight.cpp \
graphics/gropengllight.h \
graphics/gropenglpostprocessing.cpp \
graphics/gropenglpostprocessing.h \
graphics/gropenglshader.cpp \
graphics/gropenglshader.h \
graphics/gropenglstate.cpp \
graphics/gropenglstate.h \
graphics/gropengltexture.cpp \
graphics/gropengltexture.h \
graphics/gropengltnl.cpp \
graphics/gropengltnl.h \
graphics/grstub.cpp \
graphics/grstub.h \
graphics/line.h \
graphics/shadows.cpp \
graphics/tmapper.h \
hud/hud.cpp \
hud/hud.h \
hud/hudartillery.cpp \
hud/hudartillery.h \
hud/hudbrackets.cpp \
hud/hudbrackets.h \
hud/hudconfig.cpp \
hud/hudconfig.h \
hud/hudescort.cpp \
hud/hudescort.h \
hud/hudets.cpp \
hud/hudets.h \
hud/hudgauges.h \
hud/hudlock.cpp \
hud/hudlock.h \
hud/hudmessage.cpp \
hud/hudmessage.h \
hud/hudnavigation.cpp \
hud/hudnavigation.h \
hud/hudobserver.cpp \
hud/hudobserver.h \
hud/hudparse.cpp \
hud/hudparse.h \
hud/hudreticle.cpp \
hud/hudreticle.h \
hud/hudshield.cpp \
hud/hudshield.h \
hud/hudsquadmsg.cpp \
hud/hudsquadmsg.h \
hud/hudtarget.cpp \
hud/hudtarget.h \
hud/hudtargetbox.cpp \
hud/hudtargetbox.h \
hud/hudwingmanstatus.cpp \
hud/hudwingmanstatus.h \
iff_defs/iff_defs.cpp \
iff_defs/iff_defs.h \
inetfile/cftp.cpp \
inetfile/cftp.h \
inetfile/chttpget.cpp \
inetfile/chttpget.h \
inetfile/inetgetfile.cpp \
inetfile/inetgetfile.h \
io/cursor.cpp \
io/cursor.h \
io/key.cpp \
io/key.h \
io/keycontrol.cpp \
io/keycontrol.h \
io/mouse.cpp \
io/mouse.h \
io/timer.cpp \
io/timer.h \
jpgutils/jpgutils.cpp \
jpgutils/jpgutils.h \
jumpnode/jumpnode.cpp \
jumpnode/jumpnode.h \
lab/lab.cpp \
lab/lab.h \
lab/wmcgui.cpp \
lab/wmcgui.h \
lighting/lighting.cpp \
lighting/lighting.h \
localization/fhash.cpp \
localization/fhash.h \
localization/localize.cpp \
localization/localize.h \
math/fix.cpp \
math/fix.h \
math/floating.cpp \
math/floating.h \
math/fvi.cpp \
math/fvi.h \
math/spline.cpp \
math/spline.h \
math/staticrand.cpp \
math/staticrand.h \
math/vecmat.cpp \
math/vecmat.h \
menuui/barracks.cpp \
menuui/barracks.h \
menuui/credits.cpp \
menuui/credits.h \
menuui/fishtank.cpp \
menuui/fishtank.h \
menuui/mainhallmenu.cpp \
menuui/mainhallmenu.h \
menuui/mainhalltemp.cpp \
menuui/mainhalltemp.h \
menuui/optionsmenu.cpp \
menuui/optionsmenu.h \
menuui/optionsmenumulti.cpp \
menuui/optionsmenumulti.h \
menuui/playermenu.cpp \
menuui/playermenu.h \
menuui/readyroom.cpp \
menuui/readyroom.h \
menuui/snazzyui.cpp \
menuui/snazzyui.h \
menuui/techmenu.cpp \
menuui/techmenu.h \
menuui/trainingmenu.cpp \
menuui/trainingmenu.h \
mission/missionbriefcommon.cpp \
mission/missionbriefcommon.h \
mission/missioncampaign.cpp \
mission/missioncampaign.h \
mission/missiongoals.cpp \
mission/missiongoals.h \
mission/missiongrid.cpp \
mission/missiongrid.h \
mission/missionhotkey.cpp \
mission/missionhotkey.h \
mission/missionload.cpp \
mission/missionload.h \
mission/missionlog.cpp \
mission/missionlog.h \
mission/missionmessage.cpp \
mission/missionmessage.h \
mission/missionparse.cpp \
mission/missionparse.h \
mission/missiontraining.cpp \
mission/missiontraining.h \
missionui/chatbox.cpp \
missionui/chatbox.h \
missionui/fictionviewer.cpp \
missionui/fictionviewer.h \
missionui/missionbrief.cpp \
missionui/missionbrief.h \
missionui/missioncmdbrief.cpp \
missionui/missioncmdbrief.h \
missionui/missiondebrief.cpp \
missionui/missiondebrief.h \
missionui/missionloopbrief.cpp \
missionui/missionloopbrief.h \
missionui/missionpause.cpp \
missionui/missionpause.h \
missionui/missionscreencommon.cpp \
missionui/missionscreencommon.h \
missionui/missionshipchoice.cpp \
missionui/missionshipchoice.h \
missionui/missionweaponchoice.cpp \
missionui/missionweaponchoice.h \
missionui/redalert.cpp \
missionui/redalert.h \
mod_table/mod_table.cpp \
mod_table/mod_table.h \
model/model.h \
model/modelanim.cpp \
model/modelanim.h \
model/modelcollide.cpp \
model/modelinterp.cpp \
model/modelsinc.h \
model/modeloctant.cpp \
model/modelread.cpp \
model/modelrender.cpp \
nebula/neb.cpp \
nebula/neb.h \
nebula/neblightning.cpp \
nebula/neblightning.h \
network/chat_api.cpp \
network/chat_api.h \
network/multi.cpp \
network/multi.h \
network/multilag.cpp \
network/multilag.h \
network/multimsgs.cpp \
network/multimsgs.h \
network/multiteamselect.cpp \
network/multiteamselect.h \
network/multiui.cpp \
network/multiui.h \
network/multiutil.cpp \
network/multiutil.h \
network/multi_campaign.cpp \
network/multi_campaign.h \
network/multi_data.cpp \
network/multi_data.h \
network/multi_dogfight.cpp \
network/multi_dogfight.h \
network/multi_endgame.cpp \
network/multi_endgame.h \
network/multi_ingame.cpp \
network/multi_ingame.h \
network/multi_kick.cpp \
network/multi_kick.h \
network/multi_log.cpp \
network/multi_log.h \
network/multi_obj.cpp \
network/multi_obj.h \
network/multi_observer.cpp \
network/multi_observer.h \
network/multi_options.cpp \
network/multi_options.h \
network/multi_pause.cpp \
network/multi_pause.h \
network/multi_pinfo.cpp \
network/multi_pinfo.h \
network/multi_ping.cpp \
network/multi_ping.h \
network/multi_pmsg.cpp \
network/multi_pmsg.h \
network/multi_pxo.cpp \
network/multi_pxo.h \
network/multi_rate.cpp \
network/multi_rate.h \
network/multi_respawn.cpp \
network/multi_respawn.h \
network/multi_sexp.cpp \
network/multi_sexp.h \
network/multi_team.cpp \
network/multi_team.h \
network/multi_update.h \
network/multi_voice.cpp \
network/multi_voice.h \
network/multi_xfer.cpp \
network/multi_xfer.h \
network/psnet2.cpp \
network/psnet2.h \
network/stand_gui.cpp \
network/stand_gui-unix.cpp \
network/stand_gui.h \
object/collidedebrisship.cpp \
object/collidedebrisweapon.cpp \
object/collideshipship.cpp \
object/collideshipweapon.cpp \
object/collideweaponweapon.cpp \
object/deadobjectdock.cpp \
object/deadobjectdock.h \
object/objcollide.cpp \
object/objcollide.h \
object/objectdock.cpp \
object/objectdock.h \
object/object.cpp \
object/object.h \
object/objectshield.cpp \
object/objectshield.h \
object/objectsnd.cpp \
object/objectsnd.h \
object/objectsort.cpp \
object/parseobjectdock.cpp \
object/parseobjectdock.h \
object/waypoint.cpp \
object/waypoint.h \
observer/observer.cpp \
observer/observer.h \
osapi/dialogs.cpp \
osapi/dialogs.h \
osapi/osapi.cpp \
osapi/osapi.h \
osapi/osregistry.cpp \
osapi/osregistry.h \
osapi/outwnd.cpp \
osapi/outwnd.h \
palman/palman.cpp \
palman/palman.h \
parse/encrypt.cpp \
parse/encrypt.h \
parse/generic_log.cpp \
parse/generic_log.h \
parse/lua.cpp \
parse/lua.h \
parse/parselo.cpp \
parse/parselo.h \
parse/scripting.cpp \
parse/scripting.h \
parse/sexp.cpp \
parse/sexp.h \
particle/particle.cpp \
particle/particle.h \
pcxutils/pcxutils.cpp \
pcxutils/pcxutils.h \
pilotfile/pilotfile.cpp \
pilotfile/pilotfile.h \
pilotfile/pilotfile_convert.cpp \
pilotfile/pilotfile_convert.h \
pilotfile/plr.cpp \
pilotfile/csg.cpp \
pilotfile/plr_convert.cpp \
pilotfile/csg_convert.cpp \
pngutils/pngutils.cpp \
pngutils/pngutils.h \
physics/physics.cpp \
physics/physics.h \
playerman/managepilot.cpp \
playerman/managepilot.h \
playerman/player.h \
playerman/playercontrol.cpp \
popup/popup.cpp \
popup/popup.h \
popup/popupdead.cpp \
popup/popupdead.h \
radar/radar.cpp \
radar/radar.h \
radar/radardradis.cpp \
radar/radardradis.h \
radar/radarorb.cpp \
radar/radarorb.h \
radar/radarsetup.cpp \
radar/radarsetup.h \
render/3d.h \
render/3dclipper.cpp \
render/3ddraw.cpp \
render/3dinternal.h \
render/3dlaser.cpp \
render/3dmath.cpp \
render/3dsetup.cpp \
ship/afterburner.cpp \
ship/afterburner.h \
ship/awacs.cpp \
ship/awacs.h \
ship/shield.cpp \
ship/ship.cpp \
ship/ship.h \
ship/shipcontrails.cpp \
ship/shipcontrails.h \
ship/shipfx.cpp \
ship/shipfx.h \
ship/shiphit.cpp \
ship/shiphit.h \
ship/subsysdamage.h \
sound/audiostr.cpp \
sound/audiostr.h \
sound/acm.cpp \
sound/acm.h \
sound/ds.cpp \
sound/ds.h \
sound/ds3d.cpp \
sound/ds3d.h \
sound/dscap.cpp \
sound/dscap.h \
sound/fsspeech.cpp \
sound/fsspeech.h \
sound/openal.cpp \
sound/openal.h \
sound/rtvoice.cpp \
sound/rtvoice.h \
sound/sound.cpp \
sound/sound.h \
sound/speech.cpp \
sound/speech.h \
sound/voicerec.cpp \
sound/voicerec.h \
sound/ogg/ogg.cpp \
sound/ogg/ogg.h \
species_defs/species_defs.cpp \
species_defs/species_defs.h \
starfield/nebula.cpp \
starfield/nebula.h \
starfield/starfield.cpp \
starfield/starfield.h \
starfield/supernova.cpp \
starfield/supernova.h \
stats/medals.cpp \
stats/medals.h \
stats/scoring.cpp \
stats/scoring.h \
stats/stats.cpp \
stats/stats.h \
tgautils/tgautils.cpp \
tgautils/tgautils.h \
ui/button.cpp \
ui/checkbox.cpp \
ui/gadget.cpp \
ui/icon.cpp \
ui/inputbox.cpp \
ui/keytrap.cpp \
ui/listbox.cpp \
ui/radio.cpp \
ui/scroll.cpp \
ui/slider.cpp \
ui/slider2.cpp \
ui/ui.h \
ui/uidefs.h \
ui/uidraw.cpp \
ui/uimouse.cpp \
ui/window.cpp \
weapon/beam.cpp \
weapon/beam.h \
weapon/corkscrew.cpp \
weapon/corkscrew.h \
weapon/emp.cpp \
weapon/emp.h \
weapon/flak.cpp \
weapon/flak.h \
weapon/muzzleflash.cpp \
weapon/muzzleflash.h \
weapon/shockwave.cpp \
weapon/shockwave.h \
weapon/swarm.cpp \
weapon/swarm.h \
weapon/trails.cpp \
weapon/trails.h \
weapon/weapons.cpp \
weapon/weapon.h
## conditional includes follow:
## joystic support sources
if FS2_OS_WIN32
JOY_SOURCES = \
io/joy.cpp \
io/joy.h \
io/joy_ff.cpp \
io/joy_ff.h \
io/sw_error.hpp \
io/sw_force.h \
io/sw_guid.hpp \
io/swff_lib.cpp
endif
if FS2_OS_UNIX
JOY_SOURCES = \
io/joy.h \
io/joy_ff.h \
io/joy_ff-sdl.cpp \
io/joy-sdl.cpp
endif
## Win32-specific sources
if FS2_OS_WIN32
WIN32_SOURCES = \
directx/vasync.h \
directx/vd3dtypes.h \
directx/vddraw.h \
directx/vdinput.h \
directx/vdplay.h \
directx/vdplobby.h \
directx/vdsetup.h \
directx/vdvp.h \
globalincs/windebug.cpp \
graphics/gl/GLAUX.H \
graphics/gl/GLU.H \
graphics/gl/Gl.h \
graphics/gl/Glext.h \
graphics/gl/wglext.h \
osapi/monopub.h
endif
## Unix-specific sources
if FS2_OS_UNIX
UNIX_SOURCES = \
windows_stub/stubs.cpp \
windows_stub/config.h
endif
## libcode.a
libcode_a_SOURCES = ${FS2_SOURCES} ${JOY_SOURCES} ${WIN32_SOURCES} \
${UNIX_SOURCES}
##
## End CODE library
##
###############################################################################
###############################################################################
##
## Begin MAIN fs2 binary
##
FS2OPEN_SOURCES = \
freespace2/freespace.cpp \
freespace2/freespace.h \
freespace2/levelpaging.cpp \
freespace2/levelpaging.h
fs2_open_@PACKAGE_VERSION@_DEBUG_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_SOURCES = \
${FS2OPEN_SOURCES}
fs2_open_@PACKAGE_VERSION@_DEBUG_LDADD = libcode.a ../mongoose/libmongoose.a
fs2_open_@PACKAGE_VERSION@_LDADD = libcode.a ../mongoose/libmongoose.a
##
## End MAIN binary
##
###############################################################################
###############################################################################
##
## Begin wxFRED2 binary
##
wxFRED_SOURCES = \
wxfred2/res/select.png.h \
wxfred2/res/constz.png.h \
wxfred2/res/constx.png.h \
wxfred2/res/selectrot.png.h \
wxfred2/res/constyz.png.h \
wxfred2/res/constxy.png.h \
wxfred2/res/wingform.png.h \
wxfred2/res/zoomsel.png.h \
wxfred2/res/constxz.png.h \
wxfred2/res/consty.png.h \
wxfred2/res/wingdisband.png.h \
wxfred2/res/showdist.png.h \
wxfred2/res/orbitsel.png.h \
wxfred2/res/zoomext.png.h \
wxfred2/res/rotlocal.png.h \
wxfred2/res/selectmove.png.h \
wxfred2/res/selectlock.png.h \
wxfred2/res/selectlist.png.h \
wxfred2/base/wxfred_base.h \
wxfred2/base/wxfred_base.cpp \
wxfred2/editors/dlgobjecteditor.h \
wxfred2/editors/dlgobjecteditor.cpp \
wxfred2/editors/dlgvoiceactingmanager.h \
wxfred2/editors/frmdebriefingeditor.h \
wxfred2/editors/dlgbackgroundeditor.cpp \
wxfred2/editors/dlgmissionobjectiveseditor.cpp \
wxfred2/editors/frmbriefingeditor.cpp \
wxfred2/editors/frmteamloadouteditor.h \
wxfred2/editors/dlgmissionobjectiveseditor.h \
wxfred2/editors/dlgmissionspecseditor.h \
wxfred2/editors/frmdebriefingeditor.cpp \
wxfred2/editors/dlgfictionviewer.cpp \
wxfred2/editors/dlgvoiceactingmanager.cpp \
wxfred2/editors/dlgsoundenvironment.cpp \
wxfred2/editors/frmcommandbriefingeditor.cpp \
wxfred2/editors/frmbriefingeditor.h \
wxfred2/editors/dlgshieldsystemeditor.h \
wxfred2/editors/dlgreinforcementseditor.h \
wxfred2/editors/dlgeventseditor.h \
wxfred2/editors/frmteamloadouteditor.cpp \
wxfred2/editors/frmcommandbriefingeditor.h \
wxfred2/editors/frmwaypointeditor.h \
wxfred2/editors/dlgasteroidfieldeditor.h \
wxfred2/editors/dlgsetglobalshipflagseditor.cpp \
wxfred2/editors/dlgshieldsystemeditor.cpp \
wxfred2/editors/frmshipseditor.h \
wxfred2/editors/dlgfictionviewer.h \
wxfred2/editors/dlgreinforcementspicker.cpp \
wxfred2/editors/frmcampaigneditor.cpp \
wxfred2/editors/dlgasteroidfieldeditor.cpp \
wxfred2/editors/dlgreinforcementspicker.h \
wxfred2/editors/dlgreinforcementseditor.cpp \
wxfred2/editors/frmcampaigneditor.h \
wxfred2/editors/dlgbackgroundeditor.h \
wxfred2/editors/frmshipseditor.cpp \
wxfred2/editors/dlgeventseditor.cpp \
wxfred2/editors/dlgsetglobalshipflagseditor.h \
wxfred2/editors/frmwingeditor.h \
wxfred2/editors/frmwingeditor.cpp \
wxfred2/editors/frmwaypointeditor.cpp \
wxfred2/editors/dlgsoundenvironment.h \
wxfred2/editors/dlgmissionspecseditor.cpp \
wxfred2/glcviewport.h \
wxfred2/misc/dlgmissionstats.h \
wxfred2/misc/dlgmissionstats.cpp \
wxfred2/wxfred2.cpp \
wxfred2/wxfred2.h \
wxfred2/help/dlgsexphelp.h \
wxfred2/help/dlgsexphelp.cpp \
wxfred2/help/dlgaboutbox.h \
wxfred2/help/dlgaboutbox.cpp \
wxfred2/frmfred2.h \
wxfred2/frmfred2.cpp
wxFRED2_@PACKAGE_VERSION@_DEBUG_SOURCES = \
${wxFRED_SOURCES}
wxFRED2_@PACKAGE_VERSION@_SOURCES = \
${wxFRED_SOURCES}
##
## End wxFRED2 binary
##
###############################################################################
+5 -2
View File
@@ -7,8 +7,9 @@
#include "globalincs/pstypes.h"
#include "def_files/def_files.h"
#include "ai/ai_profiles.h"
#include "globalincs/def_files.h"
#include "globalincs/pstypes.h"
#include "localization/localize.h"
#include "parse/parselo.h"
@@ -78,7 +79,7 @@ void parse_ai_profiles_tbl(const char *filename)
try
{
if (filename == NULL)
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
read_file_text_from_default(defaults_get_file("ai_profiles.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
@@ -466,6 +467,8 @@ void parse_ai_profiles_tbl(const char *filename)
set_flag(profile, "$glide decay requires thrust:", AIPF2_GLIDE_DECAY_REQUIRES_THRUST, AIP_FLAG2);
set_flag(profile, "$ai can slow down when attacking big ships:", AIPF2_AI_CAN_SLOW_DOWN_ATTACKING_BIG_SHIPS, AIP_FLAG2);
profile->bay_arrive_speed_mult = 1.0f;
profile->bay_depart_speed_mult = 1.0f;
if (optional_string("$bay arrive speed multiplier:")) {
+1
View File
@@ -68,6 +68,7 @@
#define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING (1 << 14)
#define AIPF2_ASPECT_INVULNERABILITY_FIX (1 << 15)
#define AIPF2_GLIDE_DECAY_REQUIRES_THRUST (1 << 16)
#define AIPF2_AI_CAN_SLOW_DOWN_ATTACKING_BIG_SHIPS (1 << 17)
// AI Path types
#define AI_PATH_MODE_NORMAL 0
+35 -32
View File
@@ -11,7 +11,7 @@
#include "ai/aibig.h"
#include "ai/aigoals.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "globalincs/linklist.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
@@ -510,7 +510,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
{
// if moving slowly (or stopped), and SIF_SMALL_SHIP, then enter STRAFE mode if enemy fighter/bombers
// are near
if ( sip->flags & SIF_SMALL_SHIP ) {
if ( sip->is_small_ship() ) {
if ( timestamp_elapsed(aip->scan_for_enemy_timestamp) ) {
ship_obj *so;
object *test_objp;
@@ -525,7 +525,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
test_sp = &Ships[test_objp->instance];
if ( iff_x_attacks_y(Ships[Pl_objp->instance].team, test_sp->team) ) {
if ( Ship_info[test_sp->ship_info_index].flags & SIF_SMALL_SHIP ) {
if ( Ship_info[test_sp->ship_info_index].is_small_ship() ) {
dist_squared = vm_vec_dist_squared(&Pl_objp->pos, &test_objp->pos);
if ( dist_squared < ENTER_STRAFE_THREAT_DIST_SQUARED ) {
return 1;
@@ -641,7 +641,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
accelerate_ship(aip, 1.0f);
ship *shipp = &Ships[Pl_objp->instance];
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (dot_to_enemy > 0.75f)) {
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (dot_to_enemy > 0.75f)) {
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 3*F1_0;
@@ -683,7 +683,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float d
accelerate_ship(aip, accel);
ship *shipp = &Ships[Pl_objp->instance];
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags2 & SF2_AFTERBURNER_LOCKED) && (accel > 0.95f)) {
if ((aip->ai_flags & AIF_FREE_AFTERBURNER_USE) && !(shipp->flags[Ship::Ship_Flags::Afterburner_locked]) && (accel > 0.95f)) {
if (ai_maybe_fire_afterburner(Pl_objp, aip)) {
afterburners_start(Pl_objp);
aip->afterburner_stop_time = Missiontime + 3*F1_0;
@@ -748,15 +748,15 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
}
if (tswp->num_secondary_banks > 0) {
if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
int current_bank = tswp->current_secondary_bank;
if (current_bank > -1) {
weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
if(!(En_objp->flags[Object::Object_Flags::Protected]) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
// If ship is protected and very low on hits, don't fire missiles.
if (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage)) {
if (!(En_objp->flags[Object::Object_Flags::Protected]) || (En_objp->hull_strength > 10*swip->damage)) {
if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
@@ -771,7 +771,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *f
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
// reduce firing range of secondaries in nebula
extern int Nebula_sec_range;
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
if ((The_mission.flags[Mission::Mission_Flags::Fullneb]) && Nebula_sec_range) {
firing_range *= 0.8f;
}
@@ -914,10 +914,10 @@ void ai_big_chase()
dist_to_enemy = vm_vec_normalized_dir(&vec_to_enemy, &enemy_pos, &player_pos); // - En_objp->radius;
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy, En_objp->radius);
} else if (En_objp->flags & OF_PROTECTED) { // If protected and we're not attacking a subsystem, stop attacking!
} else if (En_objp->flags[Object::Object_Flags::Protected]) { // If protected and we're not attacking a subsystem, stop attacking!
update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy - En_objp->radius, En_objp->radius);
aip->target_objnum = -1;
if (find_enemy(Pl_objp-Objects, MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]) == -1) {
if (find_enemy(OBJ_INDEX(Pl_objp), MAX_ENEMY_DISTANCE, The_mission.ai_profile->max_attackers[Game_skill_level]) == -1) {
ai_do_default_behavior(Pl_objp);
return;
}
@@ -1174,7 +1174,7 @@ void ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_t
Assert(aip->mode == AIM_STRAFE);
// ensure that Pl_objp is still targeting a big ship
if ( !(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
if ( !(esip->is_big_or_huge()) ) {
ai_big_switch_to_chase_mode(aip);
return;
}
@@ -1350,27 +1350,30 @@ void ai_big_strafe_attack()
ai_big_maybe_fire_weapons(target_dist, target_dot, &Pl_objp->pos, &En_objp->pos, &En_objp->phys_info.vel);
turn_towards_point(Pl_objp, &target_pos, NULL, 0.0f);
// Slow down if we've not been hit for a while
fix last_hit = Missiontime - aip->last_hit_time;
if ( target_dist > 1200 || last_hit < F1_0*6) {
accel = 1.0f;
} else {
float attack_time;
attack_time = f2fl(Missiontime - aip->submode_start_time);
if ( attack_time > 15 ) {
accel = 0.2f;
} else if ( attack_time > 10 ) {
accel = 0.4f;
} else if ( attack_time > 8 ) {
accel = 0.6f;
} else if ( attack_time > 5 ) {
accel = 0.8f;
} else {
if ( aip->ai_profile_flags2 & AIPF2_AI_CAN_SLOW_DOWN_ATTACKING_BIG_SHIPS ) {
// Slow down if we've not been hit for a while
if ( target_dist > 1200 || last_hit < F1_0*6) {
accel = 1.0f;
} else {
float attack_time;
attack_time = f2fl(Missiontime - aip->submode_start_time);
if ( attack_time > 15 ) {
accel = 0.2f;
} else if ( attack_time > 10 ) {
accel = 0.4f;
} else if ( attack_time > 8 ) {
accel = 0.6f;
} else if ( attack_time > 5 ) {
accel = 0.8f;
} else {
accel = 1.0f;
}
}
} else {
accel = 1.0f;
}
accel = 1.0f;
accelerate_ship(aip, accel);
// if haven't been hit in quite a while, leave strafe mode
@@ -1651,7 +1654,7 @@ void ai_big_strafe()
}
*/
// check if target is still a big ship... if not enter chase mode
if ( !(Ship_info[Ships[En_objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
if ( !(Ship_info[Ships[En_objp->instance].ship_info_index].is_big_or_huge()) ) {
ai_big_switch_to_chase_mode(aip);
return;
}
@@ -1724,12 +1727,12 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi
// if Pl_objp's target is not a big/capital ship, then cannot enter strafe mode
// AL 12-31-97: Even though transports are considered big ships, don't enter strafe mode on them
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) || (sip->flags & SIF_TRANSPORT) ) {
if ( !(sip->is_big_or_huge()) || (sip->flags[Ship::Info_Flags::Transport]) ) {
return 0;
}
// If Pl_objp not a fighter or bomber, don't enter strafe mode. -- MK, 11/11/97.
if ( !(Ship_info[Ships[pl_objp->instance].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)) ) {
if ( !(Ship_info[Ships[pl_objp->instance].ship_info_index].is_fighter_bomber()) ) {
return 0;
}
@@ -1751,7 +1754,7 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi
//JAS IMPOSSIBLE } else {
// switch targets
sip = &Ship_info[Ships[parent_objp->instance].ship_info_index];
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) || (sip->flags & SIF_TRANSPORT) ) {
if ( !(sip->is_big_or_huge()) || (sip->flags[Ship::Info_Flags::Transport]) ) {
return 0;
}
set_target_objnum(aip, OBJ_INDEX(parent_objp));
+217 -208
View File
File diff suppressed because it is too large. Load diff
+8 -8
View File
@@ -584,10 +584,10 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
/*
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO) {
if (Ship_info[Ships[shipnum].ship_info_index].flags[Ship::Info_Flags::Cargo]) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_CARGO);
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT) {
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags[Ship::Info_Flags::Support]) {
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_REARM);
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_REARM);
}
@@ -1387,7 +1387,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
ship *shipp = &Ships[objp->instance];
// always valid if has subspace drive
if (!(shipp->flags2 & SF2_NO_SUBSPACE_DRIVE))
if (!(shipp->flags[Ship::Ship_Flags::No_subspace_drive]))
return AI_GOAL_ACHIEVABLE;
// if no subspace drive, only valid if our mothership is present
@@ -1661,7 +1661,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
// if ship is disabled, don't know if it can dock or not
if ( Ships[objp->instance].flags & SF_DISABLED )
if ( Ships[objp->instance].flags[Ship::Ship_Flags::Disabled] )
return AI_GOAL_NOT_KNOWN;
// we must also determine if we're prevented from docking for any reason
@@ -1807,7 +1807,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// if the destination ship is dying or departing (but not completed yet), the mark goal as
// not achievable.
if ( Ships[sindex].flags & (SF_DYING | SF_DEPARTING) )
if ( Ships[sindex].is_dying_or_departing())
return AI_GOAL_NOT_ACHIEVABLE;
// if the destination object is no longer awaiting repair, then remove the item
@@ -2042,7 +2042,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
// Goober5000 - we may want to use AI for the player
// AL 3-7-98: If this is a player ship, and the goal is not a formation goal, then do a quick out
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
if ( !(Player_use_ai) && (objp->flags[Object::Object_Flags::Player_ship]) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
{
return;
}
@@ -2199,11 +2199,11 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
if (aip->target_objnum != -1) {
// Only protect if _not_ a capital ship. We don't want the Lucifer accidentally getting protected.
if (Ship_types[Ship_info[Ships[shipnum].ship_info_index].class_type].ai_bools & STI_AI_PROTECTED_ON_CRIPPLE)
Objects[aip->target_objnum].flags |= OF_PROTECTED;
Objects[aip->target_objnum].flags.set(Object::Object_Flags::Protected);
}
} else // Just in case this ship had been protected, unprotect it.
if (aip->target_objnum != -1)
Objects[aip->target_objnum].flags &= ~OF_PROTECTED;
Objects[aip->target_objnum].flags.remove(Object::Object_Flags::Protected);
break;
}
+66 -65
View File
@@ -4,7 +4,7 @@
#include "ai/aiinternal.h"
#include "asteroid/asteroid.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "globalincs/systemvars.h"
@@ -522,17 +522,17 @@ int valid_turret_enemy(object *objp, object *turret_parent)
sip = &Ship_info[shipp->ship_info_index];
// don't fire at ships with protected bit set!!!
if ( objp->flags & OF_PROTECTED ) {
if ( objp->flags[Object::Object_Flags::Protected] ) {
return 0;
}
// don't shoot at ships without collision check
if (!(objp->flags & OF_COLLIDES)) {
if (!(objp->flags[Object::Object_Flags::Collides])) {
return 0;
}
// don't shoot at arriving ships
if (shipp->flags & SF_ARRIVING) {
if (shipp->is_arriving()) {
return 0;
}
@@ -604,48 +604,48 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
}
// check if protected
if (objp->flags & OF_PROTECTED) {
if (objp->flags[Object::Object_Flags::Protected]) {
return;
}
// check if beam protected
if (eeo->eeo_flags & EEOF_BEAM) {
if (objp->flags & OF_BEAM_PROTECTED) {
if (objp->flags[Object::Object_Flags::Beam_protected]) {
return;
}
}
// check if flak protected
if (eeo->eeo_flags & EEOF_FLAK) {
if (objp->flags & OF_FLAK_PROTECTED) {
if (objp->flags[Object::Object_Flags::Flak_protected]) {
return;
}
}
// check if laser protected
if (eeo->eeo_flags & EEOF_LASER) {
if (objp->flags & OF_LASER_PROTECTED) {
if (objp->flags[Object::Object_Flags::Laser_protected]) {
return;
}
}
// check if missile protected
if (eeo->eeo_flags & EEOF_MISSILE) {
if (objp->flags & OF_MISSILE_PROTECTED) {
if (objp->flags[Object::Object_Flags::Missile_protected]) {
return;
}
}
// don't shoot at small ships if we shouldn't
if (eeo->eeo_flags & EEOF_BIG_ONLY) {
if (!(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
if (!(Ship_info[shipp->ship_info_index].is_big_or_huge())) {
return;
}
}
// don't shoot at big ships if we shouldn't
if (eeo->eeo_flags & EEOF_SMALL_ONLY) {
if ((Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
if ((Ship_info[shipp->ship_info_index].is_big_or_huge())) {
return;
}
}
@@ -730,7 +730,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
if ( Weapons[objp->instance].homing_object == &Objects[eeo->turret_parent_objnum] ) {
if ( dist_comp < eeo->nearest_homing_bomb_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
if (!(ss->flags[Ship::Subsystem_Flags::FOV_Required]) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
@@ -741,7 +741,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// if not homing, check if bomb is flying towards ship
} else if ( bomb_headed_towards_ship(objp, &Objects[eeo->turret_parent_objnum]) ) {
if ( dist_comp < eeo->nearest_bomb_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
if (!(ss->flags[Ship::Subsystem_Flags::FOV_Required]) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
@@ -753,7 +753,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
} // end weapon section
// maybe recalculate dist for big or huge ship
// if (shipp && (Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
// if (shipp && (Ship_info[shipp->ship_info_index].is_big_or_huge())) {
// fvi_ray_boundingbox(min, max, start, direction, hit);
// dist = vm_vec_dist_quick(hit, tvec);
// }
@@ -770,11 +770,11 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// return if we're over the cap
// int max_turrets = 3 + Game_skill_level * Game_skill_level;
int max_turrets = The_mission.ai_profile->max_turret_ownage_target[Game_skill_level];
if (objp->flags & OF_PLAYER_SHIP) {
if (objp->flags[Object::Object_Flags::Player_ship]) {
max_turrets = The_mission.ai_profile->max_turret_ownage_player[Game_skill_level];
}
// Apply the per-turret limit for small targets, if there is one and this is a small target
if (ss->turret_max_target_ownage != -1 && (Ship_info[shipp->ship_info_index].flags & (SIF_SMALL_SHIP))) {
if (ss->turret_max_target_ownage != -1 && (Ship_info[shipp->ship_info_index].is_small_ship())) {
max_turrets = MIN(max_turrets, ss->system_info->turret_max_target_ownage);
}
if (num_att_turrets > max_turrets) {
@@ -783,7 +783,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// modify distance based on lethality of objp to my ship
float active_lethality = aip->lethality;
if (objp->flags & OF_PLAYER_SHIP) {
if (objp->flags[Object::Object_Flags::Player_ship]) {
active_lethality += Player_lethality_bump[Game_skill_level];
}
@@ -804,7 +804,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
// maybe update nearest attacker
if ( dist_comp < eeo->nearest_attacker_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
if (!(ss->flags[Ship::Subsystem_Flags::FOV_Required]) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
@@ -822,7 +822,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
dist_comp *= 0.9f + (0.01f * asteroid_time_to_impact(objp));
if (dist_comp < eeo->nearest_dist ) {
if (!(ss->flags & SSF_FOV_REQUIRED) && (eeo->current_enemy == -1)) {
if (!(ss->flags[Ship::Subsystem_Flags::FOV_Required]) && (eeo->current_enemy == -1)) {
turret_has_no_target = true;
}
if ( (turret_has_no_target) || object_in_turret_fov(objp, ss, eeo->tvec, eeo->tpos, dist + objp->radius) ) {
@@ -843,12 +843,12 @@ int is_target_beam_valid(ship_weapon *swp, object *objp)
{
// check if turret has beam weapon
if (all_turret_weapons_have_flags(swp, WIF_BEAM)) {
if (objp->flags & OF_BEAM_PROTECTED) {
if (objp->flags[Object::Object_Flags::Beam_protected]) {
return 0;
}
if (all_turret_weapons_have_flags(swp, WIF_HUGE)) {
if (objp->type == OBJ_SHIP && !(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
if (objp->type == OBJ_SHIP && !(Ship_info[Ships[objp->instance].ship_info_index].is_big_or_huge()) ) {
return 0;
}
}
@@ -1008,21 +1008,22 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs
}
}
if( ( (tt->wif2_flags != 0) || (tt->wif_flags != 0) ) && (ptr->type == OBJ_WEAPON) ) {
if( ( (tt->wif_flags != 0) || (tt->wif2_flags != 0) || (tt->wif3_flags != 0) ) && (ptr->type == OBJ_WEAPON) ) {
if( ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags & tt->wif_flags ) == tt->wif_flags)
&& ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags2 & tt->wif2_flags ) == tt->wif2_flags) ) {
&& ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags2 & tt->wif2_flags ) == tt->wif2_flags)
&& ( (Weapon_info[Weapons[ptr->instance].weapon_info_index].wi_flags3 & tt->wif3_flags ) == tt->wif3_flags) ) {
found_something = true;
}
}
if( ( ( tt->sif_flags != 0 ) || ( tt->sif2_flags != 0 ) ) && (ptr->type == OBJ_SHIP) ) {
if( ( (Ship_info[Ships[ptr->instance].ship_info_index].flags & tt->sif_flags) == tt->sif_flags)
&& ( (Ship_info[Ships[ptr->instance].ship_info_index].flags2 & tt->sif2_flags) == tt->sif2_flags) ) {
found_something = true;
if( ( tt->sif_flags.any_set() && (ptr->type == OBJ_SHIP) ) ) {
if( (Ship_info[Ships[ptr->instance].ship_info_index].flags & tt->sif_flags) == tt->sif_flags)
{
found_something = true;
}
}
if((tt->obj_flags != 0) && !((ptr->flags & tt->obj_flags) == tt->obj_flags)) {
if ((tt->obj_flags.any_set()) && !((ptr->flags & tt->obj_flags) == tt->obj_flags)) {
found_something = true;
}
@@ -1209,7 +1210,7 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
if (Objects[target_objnum].signature == aip->target_signature) {
if (iff_matches_mask(Ships[Objects[target_objnum].instance].team, enemy_team_mask)) {
if ( !(Objects[target_objnum].flags & OF_PROTECTED) ) { // check this flag as well
if ( !(Objects[target_objnum].flags[Object::Object_Flags::Protected]) ) { // check this flag as well
// nprintf(("AI", "Frame %i: Object %i resuming goal of object %i\n", AI_FrameCount, objnum, target_objnum));
return target_objnum;
}
@@ -1224,8 +1225,8 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
if ((frand() < 0.8f) && (aip->target_objnum != -1) && Use_parent_target) {
//check if aip->target_objnum is valid target
int target_flags = Objects[aip->target_objnum].flags;
if ( target_flags & OF_PROTECTED ) {
auto target_flags = Objects[aip->target_objnum].flags;
if ( target_flags[Object::Object_Flags::Protected] ) {
// AL 2-27-98: why is a protected ship being targeted?
set_target_objnum(aip, -1);
return -1;
@@ -1234,15 +1235,15 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
// maybe use ship target_objnum if valid for turret
// check for beam weapon and beam protected, etc.
bool skip = false;
if ( (target_flags & OF_BEAM_PROTECTED) && beam_flag ) skip = true;
else if ( (target_flags & OF_FLAK_PROTECTED) && flak_flag ) skip = true;
else if ( (target_flags & OF_LASER_PROTECTED) && laser_flag ) skip = true;
else if ( (target_flags & OF_MISSILE_PROTECTED) && missile_flag ) skip = true;
if ( target_flags[Object::Object_Flags::Beam_protected] && beam_flag ) skip = true;
else if ( target_flags[Object::Object_Flags::Flak_protected] && flak_flag ) skip = true;
else if ( target_flags[Object::Object_Flags::Laser_protected] && laser_flag ) skip = true;
else if ( target_flags[Object::Object_Flags::Missile_protected] && missile_flag) skip = true;
if (!skip) {
if ( Objects[aip->target_objnum].type == OBJ_SHIP ) {
// check for huge weapon and huge ship
if ( !big_only_flag || (Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)) ) {
if ( !big_only_flag || (Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].is_big_or_huge()) ) {
// check for tagged only and tagged ship
if ( tagged_only_flag && ship_is_tagged(&Objects[aip->target_objnum]) ) {
// select new target if aip->target_objnum is out of field of view
@@ -1253,7 +1254,7 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
in_fov = turret_fov_test(turret_subsys, tvec, &v2e);
if (turret_subsys->flags & SSF_FOV_EDGE_CHECK) {
if (turret_subsys->flags[Ship::Subsystem_Flags::FOV_edge_check]) {
if (in_fov == false)
if (object_in_turret_fov(&Objects[aip->target_objnum], turret_subsys, tvec, tpos, dist + Objects[aip->target_objnum].radius))
in_fov = true;
@@ -1272,12 +1273,12 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vec3d *tpos, vec3d
enemy_objnum = get_nearest_turret_objnum(objnum, turret_subsys, enemy_team_mask, tpos, tvec, current_enemy, big_only_flag, small_only_flag, tagged_only_flag, beam_flag, flak_flag, laser_flag, missile_flag);
if ( enemy_objnum >= 0 ) {
Assert( !((Objects[enemy_objnum].flags & OF_BEAM_PROTECTED) && beam_flag) );
Assert( !((Objects[enemy_objnum].flags & OF_FLAK_PROTECTED) && flak_flag) );
Assert( !((Objects[enemy_objnum].flags & OF_LASER_PROTECTED) && laser_flag) );
Assert( !((Objects[enemy_objnum].flags & OF_MISSILE_PROTECTED) && missile_flag) );
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Beam_protected]) && beam_flag) );
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Flak_protected]) && flak_flag) );
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Laser_protected]) && laser_flag) );
Assert( !((Objects[enemy_objnum].flags[Object::Object_Flags::Missile_protected]) && missile_flag) );
if ( Objects[enemy_objnum].flags & OF_PROTECTED ) {
if ( Objects[enemy_objnum].flags[Object::Object_Flags::Protected] ) {
Int3();
enemy_objnum = aip->target_objnum;
}
@@ -1360,11 +1361,11 @@ void ship_get_global_turret_gun_info(object *objp, ship_subsys *ssp, vec3d *gpos
turret_ai_update_aim(&Ai_info[Ships[ssp->parent_objnum].ai_index], &Objects[ssp->turret_enemy_objnum], ssp);
if ((ssp->targeted_subsys != nullptr) && !(ssp->flags & SSF_NO_SS_TARGETING)) {
if ((ssp->targeted_subsys != nullptr) && !(ssp->flags[Ship::Subsystem_Flags::No_SS_targeting])) {
vm_vec_unrotate(&enemy_point, &ssp->targeted_subsys->system_info->pnt, &Objects[ssp->turret_enemy_objnum].orient);
vm_vec_add2(&enemy_point, &ssp->last_aim_enemy_pos);
} else {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge())) {
vm_vec_unrotate(&turret_norm, &tp->turret_norm, &objp->orient);
ai_big_pick_attack_point_turret(lep, ssp, &tmp_pos, &turret_norm, &enemy_point, MIN(wip->max_speed * wip->lifetime, wip->weapon_range), tp->turret_fov);
}
@@ -1456,13 +1457,13 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
//Figure out what point on the ship we want to point the gun at, and store the global location
//in enemy_point.
vec3d enemy_point;
if ((ss->targeted_subsys != NULL) && !(ss->flags & SSF_NO_SS_TARGETING)) {
if ((ss->targeted_subsys != NULL) && !(ss->flags[Ship::Subsystem_Flags::No_SS_targeting])) {
if (ss->turret_enemy_objnum != -1) {
vm_vec_unrotate(&enemy_point, &ss->targeted_subsys->system_info->pnt, &Objects[ss->turret_enemy_objnum].orient);
vm_vec_add2(&enemy_point, &ss->last_aim_enemy_pos);
}
} else {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))) {
if ((lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge())) {
ai_big_pick_attack_point_turret(lep, ss, &gun_pos, &gun_vec, &enemy_point, tp->turret_fov, MIN(wip->max_speed * wip->lifetime, wip->weapon_range));
} else {
enemy_point = ss->last_aim_enemy_pos;
@@ -1496,7 +1497,7 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object
in_fov = turret_fov_test(ss, gvec, &v2e);
if (ss->flags & SSF_FOV_EDGE_CHECK) {
if (ss->flags[Ship::Subsystem_Flags::FOV_edge_check]) {
if (in_fov == false)
in_fov = is_object_radius_in_turret_fov(&Objects[ss->turret_enemy_objnum], ss, gvec, &gun_pos, &v2e, predicted_enemy_pos, 0.0f);
}
@@ -1616,7 +1617,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
vm_vec_add2(&abs_gun_pos, &objp->pos);
// Only pick a turret to attack on large ships.
if (!(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
if (!esip->is_big_or_huge())
return best_subsysp;
// Make sure big or huge ship *actually* has subsystems (ie, knossos)
@@ -1868,22 +1869,22 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
object *tobjp = &Objects[turret->turret_enemy_objnum];
// should not get this far. check if ship is protected from beam and weapon is type beam
if ( (wip->wi_flags & WIF_BEAM) && (tobjp->flags & OF_BEAM_PROTECTED) ) {
if ( (wip->wi_flags & WIF_BEAM) && (tobjp->flags[Object::Object_Flags::Beam_protected]) ) {
Int3();
return 0;
}
// should not get this far. check if ship is protected from flak and weapon is type flak
else if ( (wip->wi_flags & WIF_FLAK) && (tobjp->flags & OF_FLAK_PROTECTED) ) {
else if ( (wip->wi_flags & WIF_FLAK) && (tobjp->flags[Object::Object_Flags::Flak_protected]) ) {
Int3();
return 0;
}
// should not get this far. check if ship is protected from laser and weapon is type laser
else if ( (wip->subtype == WP_LASER) && (tobjp->flags & OF_LASER_PROTECTED) ) {
else if ( (wip->subtype == WP_LASER) && (tobjp->flags[Object::Object_Flags::Laser_protected]) ) {
Int3();
return 0;
}
// should not get this far. check if ship is protected from missile and weapon is type missile
else if ( (wip->subtype == WP_MISSILE) && (tobjp->flags & OF_MISSILE_PROTECTED) ) {
else if ( (wip->subtype == WP_MISSILE) && (tobjp->flags[Object::Object_Flags::Missile_protected]) ) {
Int3();
return 0;
}
@@ -1933,7 +1934,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
Script_system.RemHookVars(4, "Ship", "Weapon", "Beam", "Target");
}
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
turret->flags.set(Ship::Subsystem_Flags::Has_fired); //set fired flag for scripting -nike
return true;
}
// don't fire swam, but set up swarm info instead
@@ -1956,7 +1957,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
} else {
turret_swarm_set_up_info(parent_objnum, turret, wip, turret->turret_next_fire_pos);
turret->flags |= SSF_HAS_FIRED; //set fired flag for scripting -nike
turret->flags.set(Ship::Subsystem_Flags::Has_fired); //set fired flag for scripting -nike
return true;
}
}
@@ -2105,7 +2106,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
if ( wip->launch_snd != -1 ) {
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
if ( parent_objnum != OBJ_INDEX(Player_obj) || (turret->flags & SSF_PLAY_SOUND_FOR_PLAYER) ) {
if ( parent_objnum != OBJ_INDEX(Player_obj) || (turret->flags[Ship::Subsystem_Flags::Play_sound_for_player]) ) {
snd_play_3d( &Snds[wip->launch_snd], turret_pos, &View_position );
}
}
@@ -2126,7 +2127,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
turret->turret_next_fire_stamp = timestamp((int) wait);
}
turret->flags |= SSF_HAS_FIRED; //set has fired flag for scriptng - nuke
turret->flags.set(Ship::Subsystem_Flags::Has_fired); //set has fired flag for scriptng - nuke
//Fire animation stuff
model_anim_start_type(turret, TRIGGER_TYPE_TURRET_FIRED, ANIMATION_SUBTYPE_ALL, 1);
@@ -2442,13 +2443,13 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
if ( lep->type != OBJ_SHIP ) {
continue;
}
if ( !(Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
if ( !(Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge()) ) {
continue;
}
}
if ( wip->wi_flags2 & WIF2_SMALL_ONLY ) {
if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
if ( (lep->type == OBJ_SHIP) && (Ship_info[Ships[lep->instance].ship_info_index].is_big_or_huge()) ) {
continue;
}
}
@@ -2457,32 +2458,32 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
if (lep->type == OBJ_SHIP) {
// Check if we're targeting a protected ship
if (lep->flags & OF_PROTECTED) {
if (lep->flags[Object::Object_Flags::Protected]) {
ss->turret_enemy_objnum = -1;
ss->turret_time_enemy_in_range = 0.0f;
continue;
}
// Check if we're targeting a beam protected ship with a beam weapon
if ( (lep->flags & OF_BEAM_PROTECTED) && (wip->wi_flags & WIF_BEAM) ) {
if ( (lep->flags[Object::Object_Flags::Beam_protected]) && (wip->wi_flags & WIF_BEAM) ) {
ss->turret_enemy_objnum = -1;
ss->turret_time_enemy_in_range = 0.0f;
continue;
}
// Check if we're targeting a flak protected ship with a flak weapon
else if ( (lep->flags & OF_FLAK_PROTECTED) && (wip->wi_flags & WIF_FLAK) ) {
else if ( (lep->flags[Object::Object_Flags::Flak_protected]) && (wip->wi_flags & WIF_FLAK) ) {
ss->turret_enemy_objnum = -1;
ss->turret_time_enemy_in_range = 0.0f;
continue;
}
// Check if we're targeting a laser protected ship with a laser weapon
else if ( (lep->flags & OF_LASER_PROTECTED) && (wip->subtype == WP_LASER) ) {
else if ( (lep->flags[Object::Object_Flags::Laser_protected]) && (wip->subtype == WP_LASER) ) {
ss->turret_enemy_objnum = -1;
ss->turret_time_enemy_in_range = 0.0f;
continue;
}
// Check if we're targeting a missile protected ship with a missile weapon
else if ( (lep->flags & OF_MISSILE_PROTECTED) && (wip->subtype == WP_MISSILE) ) {
else if ( (lep->flags[Object::Object_Flags::Missile_protected]) && (wip->subtype == WP_MISSILE) ) {
ss->turret_enemy_objnum = -1;
ss->turret_time_enemy_in_range = 0.0f;
continue;
@@ -2536,7 +2537,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
if (ss->turret_enemy_objnum != -1) {
float dot = 1.0f;
lep = &Objects[ss->turret_enemy_objnum];
if (( lep->type == OBJ_SHIP ) && !(ss->flags & SSF_NO_SS_TARGETING)) {
if (( lep->type == OBJ_SHIP ) && !(ss->flags[Ship::Subsystem_Flags::No_SS_targeting])) {
ss->targeted_subsys = aifft_find_turret_subsys(objp, ss, lep, &dot);
}
ss->turret_next_enemy_check_stamp = timestamp((int) (MAX(dot, 0.5f)*2000.0f) + 1000);
@@ -2563,7 +2564,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
return;
}
if (Objects[ss->turret_enemy_objnum].flags & OF_PROTECTED) {
if (Objects[ss->turret_enemy_objnum].flags[Object::Object_Flags::Protected]) {
// This can happen if the enemy was selected before it became protected.
ss->turret_enemy_objnum = -1;
return;
+38 -24
View File
@@ -12,7 +12,7 @@
#include "asteroid/asteroid.h"
#include "debugconsole/console.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/compatibility.h"
#include "globalincs/linklist.h"
@@ -107,7 +107,7 @@ int asteroid_obj_list_add(int objnum)
int index;
asteroid *cur_asteroid = &Asteroids[Objects[objnum].instance];
index = cur_asteroid - Asteroids;
index = (int)(cur_asteroid - Asteroids);
Assert(index >= 0 && index < MAX_ASTEROID_OBJS);
Assert(!(Asteroid_objs[index].flags & ASTEROID_OBJ_USED));
@@ -320,8 +320,12 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
}
vm_angles_2_matrix(&orient, &angs);
objnum = obj_create( OBJ_ASTEROID, -1, n, &orient, &pos, radius, OF_RENDERS | OF_PHYSICS | OF_COLLIDES);
flagset<Object::Object_Flags> asteroid_default_flagset;
asteroid_default_flagset += Object::Object_Flags::Renders;
asteroid_default_flagset += Object::Object_Flags::Physics;
asteroid_default_flagset += Object::Object_Flags::Collides;
objnum = obj_create(OBJ_ASTEROID, -1, n, &orient, &pos, radius, asteroid_default_flagset);
if ( (objnum == -1) || (objnum >= MAX_OBJECTS) ) {
mprintf(("Couldn't create asteroid -- out of object slots\n"));
@@ -804,7 +808,7 @@ void maybe_throw_asteroid(int count)
// if asteroid is inside inner bound, kill it
if (asteroid_in_inner_bound(&Asteroid_field, &objp->pos, 0.0f)) {
objp->flags |= OF_SHOULD_BE_DEAD;
objp->flags.set(Object::Object_Flags::Should_be_dead);
} else {
Asteroids[objp->instance].target_objnum = so->objnum;
@@ -870,7 +874,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
if (Num_asteroids > MAX_ASTEROIDS-10) {
objp->flags |= OF_SHOULD_BE_DEAD;
objp->flags.set(Object::Object_Flags::Should_be_dead);
} else {
// check to ensure player won't see asteroid appear either
asteroid_wrap_pos(objp, asfieldp);
@@ -915,7 +919,7 @@ void asteroid_process_pre( object *objp )
}
}
int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos, collision_info_struct *asteroid_hit_info)
int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos, collision_info_struct *asteroid_hit_info, vec3d* hitnormal)
{
if (!Asteroids_enabled) {
return 0;
@@ -947,8 +951,18 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos
mc.flags = (MC_CHECK_MODEL);
if (model_collide(&mc))
{
*hitpos = mc.hit_point_world;
if (hitnormal)
{
vec3d normal;
model_find_world_dir(&normal, &mc.hit_normal, mc.model_num, mc.hit_submodel, mc.orient);
*hitnormal = normal;
}
}
return mc.num_hits;
}
@@ -1326,7 +1340,7 @@ void asteroid_do_area_effect(object *asteroid_objp)
ship_objp = &Objects[so->objnum];
// don't blast navbuoys
if ( ship_get_SIF(ship_objp->instance) & SIF_NAVBUOY ) {
if ( ship_get_SIF(ship_objp->instance)[Ship::Info_Flags::Navbuoy] ) {
continue;
}
@@ -1353,7 +1367,7 @@ void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, f
asp = &Asteroids[pasteroid_obj->instance];
if (pasteroid_obj->flags & OF_SHOULD_BE_DEAD){
if (pasteroid_obj->flags[Object::Object_Flags::Should_be_dead]){
return;
}
@@ -1388,8 +1402,8 @@ void asteroid_hit( object * pasteroid_obj, object * other_obj, vec3d * hitpos, f
weapon_info *wip;
wip = &Weapon_info[Weapons[other_obj->instance].weapon_info_index];
// If the weapon didn't play any impact animation, play custom asteroid impact animation
if ( wip->impact_weapon_expl_index < 0 ) {
particle_create( hitpos, &vmd_zero_vector, 0.0f, Asteroid_impact_explosion_radius, PARTICLE_BITMAP, Asteroid_impact_explosion_ani );
if ( wip->impact_weapon_expl_effect < 0 ) {
particle::create( hitpos, &vmd_zero_vector, 0.0f, Asteroid_impact_explosion_radius, particle::PARTICLE_BITMAP, Asteroid_impact_explosion_ani );
}
}
}
@@ -1409,7 +1423,7 @@ void asteroid_level_close()
if (Asteroids[i].flags & AF_USED) {
Asteroids[i].flags &= ~AF_USED;
Assert(Asteroids[i].objnum >=0 && Asteroids[i].objnum < MAX_OBJECTS);
Objects[Asteroids[i].objnum].flags |= OF_SHOULD_BE_DEAD;
Objects[Asteroids[i].objnum].flags.set(Object::Object_Flags::Should_be_dead);
}
}
@@ -1474,7 +1488,7 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
Script_system.SetHookObject("Self", pasteroid_obj);
if(!Script_system.IsConditionOverride(CHA_DEATH, pasteroid_obj))
{
pasteroid_obj->flags |= OF_SHOULD_BE_DEAD;
pasteroid_obj->flags.set(Object::Object_Flags::Should_be_dead);
// multiplayer clients won't go through the following code. asteroid_sub_create will send
// a create packet to the client in the above named function
@@ -1531,8 +1545,8 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
random_shuffle(roids_to_create.begin(), roids_to_create.end());
int total_roids = roids_to_create.size();
for (int i = 0; i < total_roids; i++) {
size_t total_roids = roids_to_create.size();
for (size_t i = 0; i < total_roids; i++) {
vec3d dir_vec,final_vec;
vec3d parent_vel,hit_rel_vec;
@@ -1659,11 +1673,11 @@ int asteroid_will_collide(object *pasteroid_obj, object *escort_objp)
*/
int asteroid_valid_ship_to_warn_collide(ship *shipp)
{
if ( !(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
if ( !(Ship_info[shipp->ship_info_index].is_big_or_huge()) ) {
return 0;
}
if ( shipp->flags & (SF_DYING|SF_DEPART_WARP) ) {
if ( shipp->flags[Ship::Ship_Flags::Dying] || shipp->flags[Ship::Ship_Flags::Depart_warp] ) {
return 0;
}
@@ -1915,8 +1929,8 @@ void asteroid_parse_tbl()
required_string("#Asteroid Types");
int tally = 0;
int max_asteroids =
size_t tally = 0;
size_t max_asteroids =
NUM_DEBRIS_SIZES + Species_info.size() * NUM_DEBRIS_SIZES;
#ifndef NDEBUG
@@ -1930,7 +1944,7 @@ void asteroid_parse_tbl()
asteroid_parse_section(&new_asteroid);
int species = tally / NUM_DEBRIS_SIZES;
size_t species = tally / NUM_DEBRIS_SIZES;
if (tally >= max_asteroids)
{
#ifdef NDEBUG
@@ -1967,7 +1981,7 @@ void asteroid_parse_tbl()
default:
Error(LOCATION, "Get a coder! Math has broken!\n"
"Important numbers:\n"
"\ttally: %d\n"
"\ttally: " SIZE_T_ARG "\n"
"\tNUM_DEBRIS_SIZES: %d\n",
tally, NUM_DEBRIS_SIZES
);
@@ -1992,9 +2006,9 @@ void asteroid_parse_tbl()
}
#endif
Error(LOCATION,
"Found %d asteroids/debris when %d expected\n\n"
"Found " SIZE_T_ARG " asteroids/debris when " SIZE_T_ARG " expected\n\n"
"<Number expected> = <Number of species> * %d + %d generic asteroids\n"
"%d = " SIZE_T_ARG "*%d + %d\n\n"
SIZE_T_ARG " = " SIZE_T_ARG "*%d + %d\n\n"
#ifdef NDEBUG
"Run a debug build to see a list of all parsed asteroids\n",
#else
@@ -2085,7 +2099,7 @@ int set_asteroid_throw_objnum()
ship_objp = &Objects[so->objnum];
float radius = ship_objp->radius*2.0f;
if (Ship_info[Ships[ship_objp->instance].ship_info_index].flags & (SIF_HUGE_SHIP | SIF_BIG_SHIP)) {
if (Ship_info[Ships[ship_objp->instance].ship_info_index].is_big_or_huge()) {
if (ship_objp->pos.xyz.x + radius > Asteroid_field.min_bound.xyz.x)
if (ship_objp->pos.xyz.y + radius > Asteroid_field.min_bound.xyz.y)
if (ship_objp->pos.xyz.z + radius > Asteroid_field.min_bound.xyz.z)
+1 -1
View File
@@ -156,7 +156,7 @@ void asteroid_render(object * obj, draw_list *scene);
void asteroid_delete( object *asteroid_objp );
void asteroid_process_pre( object *asteroid_objp );
void asteroid_process_post( object *asteroid_objp);
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL );
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL, vec3d* hitnormal=NULL );
void asteroid_hit( object *pasteroid_objp, object *other_objp, vec3d *hitpos, float damage );
int asteroid_count();
int asteroid_collide_objnum(object *asteroid_objp);
+45 -42
View File
@@ -11,9 +11,9 @@
#include "autopilot/autopilot.h"
#include "camera/camera.h"
#include "cfile/cfile.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamesnd/eventmusic.h"
#include "globalincs/def_files.h"
#include "def_files/def_files.h"
#include "globalincs/linklist.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
@@ -178,7 +178,7 @@ bool CanAutopilot(vec3d targetPos, bool send_msg)
object *other_objp = &Objects[so->objnum];
// attacks player?
if (iff_x_attacks_y(obj_team(other_objp), obj_team(Player_obj))
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags & SIF_CARGO)) // ignore cargo
&& !(Ship_info[Ships[other_objp->instance].ship_info_index].flags[Ship::Info_Flags::Cargo])) // ignore cargo
{
// Cannot autopilot if enemy within AutopilotMinEnemyDistance meters
if (vm_vec_dist_quick(&targetPos, &other_objp->pos) < AutopilotMinEnemyDistance) {
@@ -233,7 +233,7 @@ bool StartAutopilot()
// If the support ship is doing something then tell the user such.
for ( object *objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) )
{
if ((objp->type == OBJ_SHIP) && !(objp->flags & OF_SHOULD_BE_DEAD))
if ((objp->type == OBJ_SHIP) && !(objp->flags[Object::Object_Flags::Should_be_dead]))
{
Assertion((objp->instance >= 0) && (objp->instance < MAX_SHIPS),
"objp does not have a valid pointer to a ship. Pointer is %d, which is smaller than 0 or bigger than %d",
@@ -248,11 +248,11 @@ bool StartAutopilot()
shipp->ship_name, shipp->ship_info_index, static_cast<int>(Ship_info.size()));
ship_info *sip = &Ship_info[shipp->ship_info_index];
if ( !(sip->flags & SIF_SUPPORT) )
if ( !(sip->flags[Ship::Info_Flags::Support]) )
continue;
// don't deal with dying or departing support ships
if ( shipp->flags & (SF_DYING | SF_DEPARTING) )
if ( shipp->is_dying_or_departing() )
continue;
Assert(shipp->ai_index != -1);
@@ -286,7 +286,7 @@ bool StartAutopilot()
Autopilot_flight_leader = Player_obj;
}
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
LockAPConv = timestamp(); // lock convergence instantly
else
LockAPConv = timestamp(3000); // 3 seconds before we lock convergence
@@ -325,7 +325,7 @@ bool StartAutopilot()
// instantly turn player toward tpos
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
{
vm_vec_sub(&norm1, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
vm_vector_2_matrix(&Player_obj->orient, &norm1, NULL, NULL);
@@ -334,7 +334,7 @@ bool StartAutopilot()
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
)
)
@@ -345,7 +345,7 @@ bool StartAutopilot()
}
// damp speed_cap to 90% of actual -- to make sure ships stay in formation
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
speed_cap = 0.90f * speed_cap;
if ( speed_cap < 1.0f ) {
@@ -367,28 +367,27 @@ bool StartAutopilot()
for (i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 &&
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
(Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
)
)
{
// do we have capital ships in the area?
if (Ship_info[Ships[i].ship_info_index].flags
& ( SIF_CRUISER | SIF_CAPITAL | SIF_SUPERCAP | SIF_CORVETTE | SIF_AWACS | SIF_GAS_MINER | SIF_FREIGHTER | SIF_TRANSPORT))
if (Ship_info[Ships[i].ship_info_index].is_big_ship() || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Supercap])
{
capshipPresent = true;
capIndexes.push_back(i);
// ok.. what size class
if (Ship_info[Ships[i].ship_info_index].flags & (SIF_CAPITAL | SIF_SUPERCAP))
{
capship_counts[0]++;
if (capship_spreads[0] < Objects[Ships[i].objnum].radius)
capship_spreads[0] = Objects[Ships[i].objnum].radius;
}
else if (Ship_info[Ships[i].ship_info_index].flags & (SIF_CORVETTE))
{
if (Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Supercap])
{
capship_counts[0]++;
if (capship_spreads[0] < Objects[Ships[i].objnum].radius)
capship_spreads[0] = Objects[Ships[i].objnum].radius;
}
else if (Ship_info[Ships[i].ship_info_index].flags[Ship::Info_Flags::Corvette])
{
capship_counts[1]++;
if (capship_spreads[1] < Objects[Ships[i].objnum].radius)
capship_spreads[1] = Objects[Ships[i].objnum].radius;
@@ -416,14 +415,14 @@ bool StartAutopilot()
radius = Objects[Ships[i].objnum].radius;
}
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
{// instantly turn the ship to match the direction player is looking
//vm_vec_sub(&norm1, Navs[CurrentNav].GetPosition(), &Player_obj->pos);
vm_vector_2_matrix(&Objects[Ships[i].objnum].orient, &norm1, NULL, NULL);
}
// snap wings into formation
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS && // only if using cinematics
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics] && // only if using cinematics
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY) // only if in a wing
&& Autopilot_flight_leader != &Objects[Ships[i].objnum]) //only if not flight leader's object
{
@@ -470,8 +469,10 @@ bool StartAutopilot()
}
}
// lock primary and secondary weapons
if ( LockWeaponsDuringAutopilot )
Ships[i].flags2 |= (SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
if (LockWeaponsDuringAutopilot) {
Ships[i].flags.set(Ship::Ship_Flags::Primaries_locked);
Ships[i].flags.set(Ship::Ship_Flags::Secondaries_locked);
}
// clear the ship goals and cap the waypoint speed
ai_clear_ship_goals(&Ai_info[Ships[i].ai_index]);
@@ -479,7 +480,7 @@ bool StartAutopilot()
// if they're not part of a wing set their goal
if (Ships[i].wingnum == -1 || The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (Ships[i].wingnum == -1 || The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
{
if (Navs[CurrentNav].flags & NP_WAYPOINT)
{
@@ -496,7 +497,7 @@ bool StartAutopilot()
}
// assign wing goals
if (!(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS))
if (!(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]))
{
for (i = 0; i < MAX_WINGS; i++)
{
@@ -538,7 +539,7 @@ bool StartAutopilot()
{
if (Ships[i].objnum != -1)
{
if (Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
if (Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY))
for (j = 0; j < MAX_AI_GOALS; j++)
{
@@ -557,7 +558,7 @@ bool StartAutopilot()
start_dist = DistanceTo(CurrentNav);
// ----------------------------- setup cinematic -----------------------------
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
{
if (capshipPresent)
{
@@ -570,7 +571,7 @@ bool StartAutopilot()
vm_vec_add(&front, &Autopilot_flight_leader->orient.vec.fvec, &zero);
vm_vec_add(&up, &Autopilot_flight_leader->orient.vec.uvec, &zero);
vm_vec_add(&offset, &zero, &zero);
if (Ship_info[Ships[*idx].ship_info_index].flags & (SIF_CAPITAL | SIF_SUPERCAP))
if (Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Capital] || Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Supercap])
{
//0 - below - three lines of position
@@ -604,7 +605,7 @@ bool StartAutopilot()
capship_placed[0]++;
}
else if (Ship_info[Ships[*idx].ship_info_index].flags & SIF_CORVETTE)
else if (Ship_info[Ships[*idx].ship_info_index].flags[Ship::Info_Flags::Corvette])
{
//1 above - 3 lines of position
// front/back to zero
@@ -913,14 +914,16 @@ void EndAutoPilot()
{
if (Ships[i].objnum != -1 &&
(
Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
Ships[i].flags[Ship::Ship_Flags::Navpoint_carry] ||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY )
)
)
{
//unlock their weaponry
if ( LockWeaponsDuringAutopilot )
Ships[i].flags2 &= ~(SF2_PRIMARIES_LOCKED | SF2_SECONDARIES_LOCKED);
if (LockWeaponsDuringAutopilot) {
Ships[i].flags.remove(Ship::Ship_Flags::Primaries_locked);
Ships[i].flags.remove(Ship::Ship_Flags::Secondaries_locked);
}
Ai_info[Ships[i].ai_index].waypoint_speed_cap = -1; // uncap their speed
Ai_info[Ships[i].ai_index].mode = AIM_NONE; // make AI re-evaluate current ship mode
@@ -955,7 +958,7 @@ void EndAutoPilot()
}
// un-assign wing goals
if ( !(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS) )
if ( !(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]) )
{
for (i = 0; i < MAX_WINGS; i++)
{
@@ -1041,7 +1044,7 @@ void nav_warp(bool prewarp=false)
for (int i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1
&& (Ships[i].flags2 & SF2_NAVPOINT_CARRY
&& (Ships[i].flags[Ship::Ship_Flags::Navpoint_carry]
|| (Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)))
{
vm_vec_add(&Objects[Ships[i].objnum].pos, &Objects[Ships[i].objnum].pos, &targetPos);
@@ -1069,7 +1072,7 @@ void NavSystem_Do()
{
if (AutoPilotEngaged)
{
if (The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS)
if (The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics])
{
camera *cam = nav_get_set_camera();
if (CinematicStarted)
@@ -1148,7 +1151,7 @@ void NavSystem_Do()
}
// ramp time compression - only if not using cinematics
if (AutoPilotEngaged && !(The_mission.flags & MISSION_FLAG_USE_AP_CINEMATICS))
if (AutoPilotEngaged && !(The_mission.flags[Mission::Mission_Flags::Use_ap_cinematics]))
{
int dstfrm_start = start_dist - DistanceTo(CurrentNav);
@@ -1193,14 +1196,14 @@ void NavSystem_Do()
*/
for (int i = 0; i < MAX_SHIPS; i++)
{
if (Ships[i].objnum != -1 && Ships[i].flags2 & SF2_NAVPOINT_NEEDSLINK)
if (Ships[i].objnum != -1 && Ships[i].flags[Ship::Ship_Flags::Navpoint_needslink])
{
object *other_objp = &Objects[Ships[i].objnum];
if (vm_vec_dist_quick(&Player_obj->pos, &other_objp->pos) < (NavLinkDistance + other_objp->radius))
{
Ships[i].flags2 &= ~SF2_NAVPOINT_NEEDSLINK;
Ships[i].flags2 |= SF2_NAVPOINT_CARRY;
Ships[i].flags.remove(Ship::Ship_Flags::Navpoint_needslink);
Ships[i].flags.set(Ship::Ship_Flags::Navpoint_carry);
send_autopilot_msgID(NP_MSG_MISC_LINKED);
}
@@ -1276,7 +1279,7 @@ void parse_autopilot_table(char *filename)
try
{
if (filename == NULL)
read_file_text_from_array(defaults_get_file("autopilot.tbl"));
read_file_text_from_default(defaults_get_file("autopilot.tbl"));
else
read_file_text(filename, CF_TYPE_TABLES);
+1 -1
View File
@@ -84,7 +84,7 @@ struct bitmap_entry {
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
ubyte used_this_frame; // If set, then it was used this frame
int data_size; // How much data this bitmap uses
size_t data_size; // How much data this bitmap uses
int used_count; // How many times it was accessed
#endif
};
+12 -13
View File
@@ -65,7 +65,7 @@ int HEIGHTMAP = -1;
int MISCMAP = -1;
int AMBIENTMAP = -1;
int bm_texture_ram = 0;
size_t bm_texture_ram = 0;
int Bm_paging = 0;
// Extension type lists
@@ -158,8 +158,8 @@ float bitmap_lookup::get_channel_red(float u, float v)
{
Assert( Bitmap_data != NULL );
CLAMP(u, 0.0, 1.0f);
CLAMP(v, 0.0, 1.0f);
CLAMP(u, 0.0f, 1.0f);
CLAMP(v, 0.0f, 1.0f);
int x = fl2i(map_texture_address(u) * (Width-1));
int y = fl2i(map_texture_address(v) * (Height-1));
@@ -1099,7 +1099,7 @@ int bm_is_valid(int handle) {
// c_type = output for an updated BM_TYPE_*
// mm_lvl = number of mipmap levels for the image
// size = size of the data contained in the image
static int bm_load_info(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, int *size)
static int bm_load_info(BM_TYPE type, int n, const char *filename, CFILE *img_cfp, int *w, int *h, int *bpp, BM_TYPE *c_type, int *mm_lvl, size_t *size)
{
int dds_ct;
@@ -1194,7 +1194,8 @@ int bm_load(const char *real_filename) {
int i, free_slot = -1;
int w, h, bpp = 8;
int rc = 0;
int bm_size = 0, mm_lvl = 0;
size_t bm_size = 0;
int mm_lvl = 0;
char filename[MAX_FILENAME_LEN];
BM_TYPE type = BM_TYPE_NONE;
BM_TYPE c_type = BM_TYPE_NONE;
@@ -1399,8 +1400,6 @@ static int bm_load_image_data(const char *filename, int handle, int bitmapnum, i
bitmap_entry *be = &bm_bitmaps[bitmapnum];
bitmap *bmp = &be->bm;
Assert(!Is_standalone);
if (bmp->true_bpp > bpp)
true_bpp = bmp->true_bpp;
else
@@ -1505,7 +1504,8 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
float anim_total_time = 0.0f;
int anim_width = 0, anim_height = 0;
BM_TYPE type = BM_TYPE_NONE, eff_type = BM_TYPE_NONE, c_type = BM_TYPE_NONE;
int bpp = 0, mm_lvl = 0, img_size = 0;
int bpp = 0, mm_lvl = 0;
size_t img_size = 0;
char clean_name[MAX_FILENAME_LEN];
if (!bm_inited)
@@ -1866,7 +1866,7 @@ int bm_load_sub_fast(const char *real_filename, int *handle, int dir_type, bool
int bm_load_sub_slow(const char *real_filename, const int num_ext, const char **ext_list, CFILE **img_cfp, int dir_type) {
char full_path[MAX_PATH];
int size = 0, offset = 0;
size_t size = 0, offset = 0;
int rval = -1;
rval = cf_find_file_location_ext(real_filename, num_ext, ext_list, dir_type, sizeof(full_path) - 1, full_path, &size, &offset, 0);
@@ -2522,10 +2522,10 @@ int bm_make_render_target(int width, int height, int flags) {
return bm_bitmaps[n].handle;
}
void *bm_malloc(int n, int size) {
void *bm_malloc(int n, size_t size) {
Assert((n >= 0) && (n < MAX_BITMAPS));
if (size <= 0)
if (size == 0)
return NULL;
#ifdef BMPMAN_NDEBUG
@@ -3211,10 +3211,9 @@ void bm_unlock(int handle) {
Assert(be->ref_count >= 0); // Trying to unlock data more times than lock was called!!!
}
void bm_update_memory_used(int n, int size)
void bm_update_memory_used(int n, size_t size)
{
Assert( (n >= 0) && (n < MAX_BITMAPS) );
Assert( size >= 0 );
#ifdef BMPMAN_NDEBUG
Assert( bm_bitmaps[n].data_size == 0 );
+3 -3
View File
@@ -112,7 +112,7 @@ struct bitmap
*/
};
extern int bm_texture_ram; //!< how many bytes of textures are used.
extern size_t bm_texture_ram; //!< how many bytes of textures are used.
extern int Bm_paging; //!< Bool type that indicates if BMPMAN is currently paging.
@@ -170,14 +170,14 @@ int bm_get_next_handle();
* @note z64 - This function looks fishy. Not only is handle not used in release builds, but bm_bitmaps[handle].size
* and bm_texture_size aren't modified unless this is a debug build
*/
void *bm_malloc(int handle, int size);
void *bm_malloc(int handle, size_t size);
/**
* @brief (DEBUG) Similar to bm_malloc, but only updates how much memory is used
*
* @note z64 - Also fishy (see bm_malloc)
*/
void bm_update_memory_used(int n, int size);
void bm_update_memory_used(int n, size_t size);
class bitmap_lookup {
ubyte *Bitmap_data;
+9 -9
View File
@@ -612,8 +612,8 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
int old_fontnum;
if (text_fontnum >= 0)
{
old_fontnum = gr_get_current_fontnum();
gr_set_font(text_fontnum);
old_fontnum = font::get_current_fontnum();
font::set_font(text_fontnum);
}
else
{
@@ -634,7 +634,7 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, const char* in_text, const char*
// restore old font
if (old_fontnum >= 0)
{
gr_set_font(old_fontnum);
font::set_font(old_fontnum);
}
//Get image size
@@ -710,8 +710,8 @@ void subtitle::do_frame(float frametime)
int old_fontnum;
if (text_fontnum >= 0)
{
old_fontnum = gr_get_current_fontnum();
gr_set_font(text_fontnum);
old_fontnum = font::get_current_fontnum();
font::set_font(text_fontnum);
}
else
{
@@ -732,7 +732,7 @@ void subtitle::do_frame(float frametime)
// restore old font
if (old_fontnum >= 0)
{
gr_set_font(old_fontnum);
font::set_font(old_fontnum);
}
if(image_id >= 0)
@@ -824,7 +824,7 @@ camid::camid()
sig = -1;
}
camid::camid(int n_idx, int n_sig)
camid::camid(size_t n_idx, int n_sig)
{
idx = n_idx;
sig = n_sig;
@@ -838,7 +838,7 @@ camera* camid::getCamera()
return Cameras[idx];
}
uint camid::getIndex()
size_t camid::getIndex()
{
return idx;
}
@@ -954,7 +954,7 @@ camid cam_get_current()
return Current_camera;
}
uint cam_get_num()
size_t cam_get_num()
{
return Cameras.size();
}
+1 -1
View File
@@ -166,7 +166,7 @@ void cam_reset_camera();
camid cam_lookup(char *name);
camid cam_get_camera(uint index);
camid cam_get_current();
uint cam_get_num();
size_t cam_get_num();
void get_turret_cam_pos(camera *cam, vec3d *pos);
void get_turret_cam_orient(camera *cam, matrix *ori);
+32 -30
View File
@@ -34,6 +34,7 @@
#include "osapi/osapi.h"
#include "parse/encrypt.h"
#include <limits>
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
@@ -107,7 +108,7 @@ static const char *Cfile_cdrom_dir = NULL;
//
static int cfget_cfile_block();
static CFILE *cf_open_fill_cfblock(const char* source, int line, FILE * fp, int type);
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size);
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, size_t offset, size_t size);
#if defined _WIN32
static CFILE *cf_open_mapped_fill_cfblock(const char* source, int line, HANDLE hFile, int type);
@@ -183,9 +184,8 @@ static bool cfile_in_root_dir(const char *exe_path)
*/
int cfile_init(const char *exe_dir, const char *cdrom_dir)
{
int i;
encrypt_init(); /* initialize encryption */
// initialize encryption
encrypt_init();
if (cfile_inited) {
return 0;
@@ -195,7 +195,7 @@ int cfile_init(const char *exe_dir, const char *cdrom_dir)
strncpy(buf, exe_dir, CFILE_ROOT_DIRECTORY_LEN - 1);
buf[CFILE_ROOT_DIRECTORY_LEN - 1] = '\0';
i = strlen(buf);
size_t i = strlen(buf);
// are we in a root directory?
if(cfile_in_root_dir(buf)){
@@ -407,7 +407,7 @@ int cfile_flush_dir(int dir_type)
// proceed to delete the files
del_count = 0;
#if defined _WIN32
int find_handle;
intptr_t find_handle;
_finddata_t find;
find_handle = _findfirst( "*", &find );
if (find_handle != -1) {
@@ -459,11 +459,10 @@ int cfile_flush_dir(int dir_type)
// Returns: new filename or filepath with extension.
char *cf_add_ext(const char *filename, const char *ext)
{
int flen, elen;
static char path[MAX_PATH_LEN];
flen = strlen(filename);
elen = strlen(ext);
size_t flen = strlen(filename);
size_t elen = strlen(ext);
Assert(flen < MAX_PATH_LEN);
strcpy_s(path, filename);
if ((flen < 4) || stricmp(path + flen - elen, ext)) {
@@ -515,7 +514,7 @@ int cf_access(const char *filename, int dir_type, int mode)
// If offset equates to boolean true, it was found in a VP and the logic will negate the function return
int cf_exists(const char *filename, int dir_type)
{
int offset = 1;
size_t offset = 1;
if ( (filename == NULL) || !strlen(filename) )
return 0;
@@ -758,7 +757,7 @@ CFILE *_cfopen(const char* source, int line, const char *file_path, const char *
//================================================
// Search for file on disk, on cdrom, or in a packfile
int offset, size;
size_t offset, size;
char copy_file_path[MAX_PATH_LEN]; // FIX change in memory from cf_find_file_location
strcpy_s(copy_file_path, file_path);
@@ -819,7 +818,7 @@ CFILE *_cfopen(const char* source, int line, const char *file_path, const char *
// returns: success ==> address of CFILE structure
// error ==> NULL
//
CFILE *_cfopen_special(const char* source, int line, const char *file_path, const char *mode, const int size, const int offset, int dir_type)
CFILE *_cfopen_special(const char* source, int line, const char *file_path, const char *mode, const size_t size, const size_t offset, int dir_type)
{
if ( !cfile_inited) {
Int3();
@@ -828,7 +827,6 @@ CFILE *_cfopen_special(const char* source, int line, const char *file_path, cons
Assert( file_path && strlen(file_path) );
Assert( mode != NULL );
Assert( offset >= 0 );
// cfopen_special() only supports reading files, not creating them
if ( strchr(mode, 'w') ) {
@@ -1019,7 +1017,7 @@ static CFILE *cf_open_fill_cfblock(const char* source, int line, FILE *fp, int t
// returns: success ==> ptr to CFILE structure.
// error ==> NULL
//
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, int offset, int size)
static CFILE *cf_open_packed_cfblock(const char* source, int line, FILE *fp, int type, size_t offset, size_t size)
{
// Found it in a pack file
int cfile_block_index;
@@ -1388,7 +1386,7 @@ int cfwrite_string(const char *buf, CFILE *file)
if ( (!buf) || (buf && !buf[0]) ) {
return cfwrite_char(0, file);
}
int len = strlen(buf);
int len = (int)strlen(buf);
if(!cfwrite(buf, len, 1, file)){
return 0;
}
@@ -1397,7 +1395,7 @@ int cfwrite_string(const char *buf, CFILE *file)
int cfwrite_string_len(const char *buf, CFILE *file)
{
int len = strlen(buf);
int len = (int)strlen(buf);
if(!cfwrite_int(len, file)){
return 0;
@@ -1423,7 +1421,11 @@ int cfilelength( CFILE * cfile )
Assert(cb->fp != NULL);
// cb->size gets set at cfopen
return cb->size;
// The rest of the code still uses ints, do an overflow check to detect cases where this fails
Assertion(cb->size <= static_cast<size_t>(std::numeric_limits<int>::max()),
"Integer overflow in cfilelength! A file is too large (but I don't know which...).");
return (int) cb->size;
}
// cfwrite() writes to the file
@@ -1468,7 +1470,7 @@ int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile)
Assert( cb->size == filelength(fileno(cb->fp)) );
#endif
return ((int)bytes_written / elsize);
return (int)(bytes_written / elsize);
}
@@ -1649,7 +1651,7 @@ ushort cf_add_chksum_short(ushort seed, ubyte *buffer, int size)
}
// update cur_chksum with the chksum of the new_data of size new_data_size
uint cf_add_chksum_long(uint seed, ubyte *buffer, int size)
uint cf_add_chksum_long(uint seed, ubyte *buffer, size_t size)
{
uint crc;
ubyte *p;
@@ -1741,14 +1743,12 @@ static int cf_chksum_do(CFILE *cfile, ushort *chk_short, uint *chk_long, int max
// get the chksum of a pack file (VP)
int cf_chksum_pack(const char *filename, uint *chk_long, bool full)
{
const int safe_size = 2097152; // 2 Meg
const size_t safe_size = 2097152; // 2 Meg
const int header_offset = 32; // skip 32bytes for header (header is currently smaller than this though)
ubyte cf_buffer[CF_CHKSUM_SAMPLE_SIZE];
int cf_len = 0;
int cf_total;
int read_size;
int max_size;
size_t read_size;
size_t max_size;
if (chk_long == NULL) {
Int3();
@@ -1766,7 +1766,7 @@ int cf_chksum_pack(const char *filename, uint *chk_long, bool full)
// get the max size
fseek(fp, 0, SEEK_END);
max_size = ftell(fp);
max_size = (size_t)ftell(fp);
// maybe do a chksum of the entire file
if (full) {
@@ -1774,17 +1774,19 @@ int cf_chksum_pack(const char *filename, uint *chk_long, bool full)
}
// othewise it's only a partial check
else {
CLAMP(max_size, 0, safe_size);
if (max_size > safe_size) {
max_size = safe_size;
}
Assertion(max_size > header_offset,
"max_size (%d) > header_offset in packfile %s", max_size, filename);
"max_size (" SIZE_T_ARG ") > header_offset in packfile %s", max_size, filename);
max_size -= header_offset;
fseek(fp, -(max_size), SEEK_END);
fseek(fp, -((long)max_size), SEEK_END);
}
cf_total = 0;
size_t cf_total = 0;
size_t cf_len = 0;
do {
// determine how much we want to read
if ( (max_size - cf_total) >= CF_CHKSUM_SAMPLE_SIZE )
+4 -4
View File
@@ -138,7 +138,7 @@ CFILE *_cfopen(const char* source_file, int line, const char *filename, const ch
// like cfopen(), but it accepts a fully qualified path only (ie, the result of a cf_find_file_location() call)
// NOTE: only supports reading files!!
CFILE *_cfopen_special(const char* source_file, int line, const char *file_path, const char *mode,
const int size, const int offset, int dir_type = CF_TYPE_ANY);
const size_t size, const size_t offset, int dir_type = CF_TYPE_ANY);
#define cfopen_special(...) _cfopen_special(LOCATION, __VA_ARGS__) // Pass source location to the function
// Flush the open file buffer
@@ -238,7 +238,7 @@ int cf_chksum_pack(const char *filename, uint *chk_long, bool full = false);
ushort cf_add_chksum_short(ushort seed, ubyte *buffer, int size);
// update cur_chksum with the chksum of the new_data of size new_data_size
uint cf_add_chksum_long(uint seed, ubyte *buffer, int size);
uint cf_add_chksum_long(uint seed, ubyte *buffer, size_t size);
// convenient for misc checksumming purposes ------------------------------------------
@@ -324,7 +324,7 @@ void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_
// size - File size
// offset - Offset into pack file. 0 if not a packfile.
// Returns: If not found returns 0.
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize = false);
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, size_t *size, size_t *offset, bool localize = false);
// Searches for a file. Follows all rules and precedence and searches
// CD's and pack files. Searches all locations in order for first filename using ext filter list.
@@ -338,7 +338,7 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
// offset - Offset into pack file. 0 if not a packfile.
// Returns: If not found returns -1, else returns offset into ext_list.
// (NOTE: This function is exponentially slow, so don't use it unless truely needed!!)
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out = 0, char *pack_filename = NULL, int *size = NULL, int *offset = NULL, bool localize = false);
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out = 0, char *pack_filename = NULL, size_t *size = NULL, size_t *offset = NULL, bool localize = false);
// Functions to change directories
int cfile_chdir(const char *dir);
+25 -27
View File
@@ -27,13 +27,14 @@
#include "luaconf.h"
#include <sstream>
#include <limits>
#define CHECK_POSITION
// Called once to setup the low-level reading code.
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos )
void cf_init_lowlevel_read_code( CFILE * cfile, size_t lib_offset, size_t size, size_t pos )
{
Assert(cfile != NULL);
@@ -47,13 +48,12 @@ void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int po
if ( cb->fp ) {
if ( cb->lib_offset ) {
fseek( cb->fp, cb->lib_offset, SEEK_SET );
fseek( cb->fp, (long)cb->lib_offset, SEEK_SET );
}
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position;
raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
auto raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
}
}
@@ -84,9 +84,8 @@ int cfeof(CFILE *cfile)
Assert(cb->fp != NULL);
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position;
raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
auto raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
if (cb->raw_position >= cb->size ) {
@@ -116,12 +115,14 @@ int cftell( CFILE * cfile )
Assert(cb->fp != NULL);
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int raw_position;
raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
auto raw_position = ftell(cb->fp) - cb->lib_offset;
Assert(raw_position == cb->raw_position);
#endif
return cb->raw_position;
// The rest of the code still uses ints, do an overflow check to detect cases where this fails
Assertion(cb->raw_position <= static_cast<size_t>(std::numeric_limits<int>::max()),
"Integer overflow in cftell, a file is probably too large (but I don't know which one).");
return (int) cb->raw_position;
}
@@ -143,7 +144,7 @@ int cfseek( CFILE *cfile, int offset, int where )
Assert( !cb->data );
Assert( cb->fp != NULL );
int goal_position;
size_t goal_position;
switch( where ) {
case CF_SEEK_SET:
@@ -162,13 +163,12 @@ int cfseek( CFILE *cfile, int offset, int where )
return 1;
}
int result = fseek(cb->fp, goal_position, SEEK_SET );
int result = fseek(cb->fp, (long)goal_position, SEEK_SET );
cb->raw_position = goal_position - cb->lib_offset;
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset;
tmp_offset = (int)ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
auto tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
return result;
@@ -185,7 +185,7 @@ int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
if(!cf_is_valid(cfile))
return 0;
int size = elsize*nelem;
size_t size = elsize*nelem;
if(buf == NULL || size <= 0)
return 0;
@@ -208,7 +208,7 @@ int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
}
if (cb->max_read_len) {
if ( (size_t)(cb->raw_position+size) > cb->max_read_len ) {
if ( cb->raw_position+size > cb->max_read_len ) {
std::ostringstream s_buf;
s_buf << "Attempted to read " << size << "-byte(s) beyond length limit";
@@ -216,18 +216,17 @@ int cfread(void *buf, int elsize, int nelem, CFILE *cfile)
}
}
int bytes_read = fread( buf, 1, size, cb->fp );
size_t bytes_read = fread( buf, 1, size, cb->fp );
if ( bytes_read > 0 ) {
cb->raw_position += bytes_read;
}
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset;
tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
auto tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
return bytes_read / elsize;
return (int)(bytes_read / elsize);
}
@@ -253,9 +252,8 @@ int cfread_lua_number(double *buf, CFILE *cfile)
cb->raw_position += ftell(cb->fp)-orig_pos;
#if defined(CHECK_POSITION) && !defined(NDEBUG)
int tmp_offset;
tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
auto tmp_offset = ftell(cb->fp) - cb->lib_offset;
Assert(tmp_offset==cb->raw_position);
#endif
return items_read;
+4 -4
View File
@@ -34,9 +34,9 @@ typedef struct Cfile_block {
// int fd; // file descriptor
size_t data_length; // length of data for mmap
#endif
int lib_offset;
int raw_position;
int size; // for packed files
size_t lib_offset;
size_t raw_position;
size_t size; // for packed files
size_t max_read_len; // max read offset, for special error handling
@@ -48,6 +48,6 @@ typedef struct Cfile_block {
extern Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
// Called once to setup the low-level reading code.
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos );
void cf_init_lowlevel_read_code( CFILE * cfile, size_t lib_offset, size_t size, size_t pos );
#endif
+1 -1
View File
@@ -420,7 +420,7 @@ int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile)
}
}
return (out - (char *)buf)/elsize;
return (int)((out - (char *)buf)/elsize);
}
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile)
+40 -33
View File
@@ -178,7 +178,7 @@ int cf_get_packfile_count(cf_root *root)
#if defined _WIN32
filespec += "*.vp";
int find_handle;
intptr_t find_handle;
_finddata_t find;
find_handle = _findfirst( filespec.c_str( ), &find );
@@ -266,7 +266,7 @@ void cf_build_pack_list( cf_root *root )
#if defined _WIN32
strcat_s( filespec, "*.vp" );
int find_handle;
intptr_t find_handle;
_finddata_t find;
find_handle = _findfirst( filespec, &find );
@@ -359,6 +359,16 @@ void cf_build_pack_list( cf_root *root )
vm_free(temp_roots_sort);
}
static char normalize_directory_separator(char in)
{
if (in == '/')
{
return DIR_SEPARATOR_CHAR;
}
return in;
}
static void cf_add_mod_roots(const char* rootDirectory)
{
if (Cmdline_mod)
@@ -380,6 +390,9 @@ static void cf_add_mod_roots(const char* rootDirectory)
Error(LOCATION, "The length of mod directory path '%s' exceeds the maximum of %d!\n", rootPath.c_str(), CF_MAX_PATHNAME_LENGTH);
}
// normalize the path to the native path format
std::transform(rootPath.begin(), rootPath.end(), rootPath.begin(), normalize_directory_separator);
cf_root* root = cf_create_root();
strncpy(root->path, rootPath.c_str(), CF_MAX_PATHNAME_LENGTH-1);
@@ -396,7 +409,6 @@ void cf_build_root_list(const char *cdrom_dir)
Num_path_roots = 0;
cf_root *root = nullptr;
int path_len;
if (os_is_legacy_mode())
{
@@ -463,7 +475,7 @@ void cf_build_root_list(const char *cdrom_dir)
strcpy_s(root->path, working_directory);
path_len = strlen(root->path);
size_t path_len = strlen(root->path);
// do we already have a slash? as in the case of a root directory install
if ( (path_len < (CF_MAX_PATHNAME_LENGTH-1)) && (root->path[path_len-1] != DIR_SEPARATOR_CHAR) ) {
@@ -542,7 +554,7 @@ void cf_search_root_path(int root_index)
#if defined _WIN32
strcat_s( search_path, "*.*" );
int find_handle;
intptr_t find_handle;
_finddata_t find;
find_handle = _findfirst( search_path, &find );
@@ -701,7 +713,7 @@ void cf_search_root_pack(int root_index)
find.filename[sizeof(find.filename)-1] = '\0';
if ( find.size == 0 ) {
int search_path_len = strlen(search_path);
size_t search_path_len = strlen(search_path);
if ( !stricmp( find.filename, ".." )) {
char *p = &search_path[search_path_len-1];
while( (p > search_path) && (*p != DIR_SEPARATOR_CHAR) ) {
@@ -837,18 +849,13 @@ void cf_free_secondary_filelist()
*
* @return If not found returns 0.
*/
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
int cf_find_file_location( const char *filespec, int pathtype, int max_out, char *pack_filename, size_t *size, size_t *offset, bool localize )
{
int i;
uint ui;
int cfs_slow_search = 0;
char longname[MAX_PATH_LEN];
#if defined WIN32
long findhandle;
_finddata_t findstruct;
#endif
Assert( (filespec != NULL) && (strlen(filespec) > 0) ); //-V805
Assert( (pack_filename == NULL) || (max_out > 1) );
@@ -917,7 +924,9 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[ui], filespec, localize );
#if defined _WIN32
findhandle = _findfirst(longname, &findstruct);
_finddata_t findstruct;
intptr_t findhandle = _findfirst(longname, &findstruct);
if (findhandle != -1) {
if (size)
*size = findstruct.size;
@@ -973,7 +982,7 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
*size = f->size;
if (offset)
*offset = f->pack_offset;
*offset = (size_t)f->pack_offset;
if (pack_filename) {
cf_root *r = cf_get_root(f->root_index);
@@ -1001,7 +1010,7 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
*size = f->size;
if (offset)
*offset = f->pack_offset;
*offset = (size_t)f->pack_offset;
if (pack_filename) {
cf_root *r = cf_get_root(f->root_index);
@@ -1048,7 +1057,7 @@ extern char *stristr(char *str, const char *substr);
*
* @return If not found returns -1, else returns offset into ext_list.
*/
int cf_find_file_location_ext( const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize )
int cf_find_file_location_ext( const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out, char *pack_filename, size_t *size, size_t *offset, bool localize )
{
int cur_ext, i;
uint ui;
@@ -1056,12 +1065,7 @@ int cf_find_file_location_ext( const char *filename, const int ext_num, const ch
char longname[MAX_PATH_LEN];
char filespec[MAX_FILENAME_LEN];
char *p = NULL;
#if defined WIN32
long findhandle;
_finddata_t findstruct;
#endif
Assert( (filename != NULL) && (strlen(filename) < MAX_FILENAME_LEN) );
Assert( (ext_list != NULL) && (ext_num > 1) ); // if we are searching for just one ext
// then this is the wrong function to use
@@ -1132,7 +1136,8 @@ int cf_find_file_location_ext( const char *filename, const int ext_num, const ch
cf_create_default_path_string( longname, sizeof(longname)-1, search_order[ui], filespec, localize );
#if defined _WIN32
findhandle = _findfirst(longname, &findstruct);
_finddata_t findstruct;
intptr_t findhandle = _findfirst(longname, &findstruct);
if (findhandle != -1) {
if (size)
*size = findstruct.size;
@@ -1179,11 +1184,11 @@ int cf_find_file_location_ext( const char *filename, const int ext_num, const ch
(*p) = 0;
// go ahead and get our length, which is used to test with later
int filespec_len = strlen(filespec);
size_t filespec_len = strlen(filespec);
// get total legnth, with extension, which is iused to test with later
// (FIXME: this assumes that everything in ext_list[] is the same length!)
uint filespec_len_big = filespec_len + strlen(ext_list[0]);
size_t filespec_len_big = filespec_len + strlen(ext_list[0]);
SCP_vector< cf_file* > file_list_index;
int last_root_index = -1;
@@ -1419,7 +1424,8 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
{
char *ptr;
uint i;
int l, own_flag = 0;
int own_flag = 0;
size_t l;
SCP_vector<file_list_info> my_info;
file_list_info tinfo;
@@ -1447,7 +1453,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
strcat_s(filespec, filter);
_finddata_t find;
int find_handle;
intptr_t find_handle;
find_handle = _findfirst( filespec, &find );
if (find_handle != -1) {
@@ -1463,7 +1469,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
ptr = strrchr(find.name, '.');
if (ptr)
l = ptr - find.name;
l = (size_t)(ptr - find.name);
else
l = strlen(find.name);
@@ -1514,7 +1520,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
ptr = strrchr(dir->d_name, '.');
if (ptr)
l = ptr - dir->d_name;
l = (size_t)(ptr - dir->d_name);
else
l = strlen(dir->d_name);
@@ -1562,7 +1568,7 @@ int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, const char *fi
ptr = strrchr(f->name_ext, '.');
if (ptr)
l = ptr - f->name_ext;
l = (size_t)(ptr - f->name_ext);
else
l = strlen(f->name_ext);
@@ -1620,7 +1626,8 @@ int cf_get_file_list( int max, char **list, int pathtype, const char *filter, in
{
char *ptr;
uint i;
int l, num_files = 0, own_flag = 0;
int num_files = 0, own_flag = 0;
size_t l;
if (max < 1) {
Get_file_list_filter = NULL;
@@ -1641,7 +1648,7 @@ int cf_get_file_list( int max, char **list, int pathtype, const char *filter, in
cf_create_default_path_string( filespec, sizeof(filespec)-1, pathtype, filter );
_finddata_t find;
int find_handle;
intptr_t find_handle;
find_handle = _findfirst( filespec, &find );
if (find_handle != -1) {
@@ -1846,7 +1853,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
#if defined _WIN32
cf_create_default_path_string( filespec, sizeof(filespec)-1, pathtype, filter );
int find_handle;
intptr_t find_handle;
_finddata_t find;
find_handle = _findfirst( filespec, &find );
+19
View File
@@ -0,0 +1,19 @@
add_executable(cfilearchiver EXCLUDE_FROM_ALL cfilearchiver.cpp)
ADD_DEFINITIONS(-DNO_SAFE_STRINGS)
include_directories(${CODE_HEADERS})
set_target_properties(cfilearchiver
PROPERTIES
FOLDER "FSOTools"
)
TARGET_LINK_LIBRARIES(cfilearchiver PUBLIC ${SDL_LIBS})
TARGET_INCLUDE_DIRECTORIES(cfilearchiver PUBLIC ${GENERATED_SOURCE_DIR})
TARGET_INCLUDE_DIRECTORIES(cfilearchiver PUBLIC ${GENERATED_SOURCE_DIR}/code)
IF(MSVC)
set_target_properties(cfilearchiver PROPERTIES
COMPILE_DEFINITIONS_DEBUG "_DEBUG;PDB_DEBUGGING=1"
)
ENDIF(MSVC)
+19
View File
@@ -0,0 +1,19 @@
add_executable(cfileextractor EXCLUDE_FROM_ALL cfileextractor.cpp)
ADD_DEFINITIONS(-DNO_SAFE_STRINGS)
include_directories(${CODE_HEADERS})
set_target_properties(cfileextractor
PROPERTIES
FOLDER "FSOTools"
)
TARGET_LINK_LIBRARIES(cfileextractor PUBLIC ${SDL_LIBS})
TARGET_INCLUDE_DIRECTORIES(cfileextractor PUBLIC ${GENERATED_SOURCE_DIR})
TARGET_INCLUDE_DIRECTORIES(cfileextractor PUBLIC ${GENERATED_SOURCE_DIR}/code)
IF(MSVC)
set_target_properties(cfileextractor PROPERTIES
COMPILE_DEFINITIONS_DEBUG "_DEBUG;PDB_DEBUGGING=1"
)
ENDIF(MSVC)
+49 -29
View File
@@ -157,6 +157,7 @@ Flag exe_params[] =
{ "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
{ "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
{ "-fb_explosions", "Enable Framebuffer Shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_explosions", },
{ "-fb_thrusters", "Enable Framebuffer Thrusters", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_thrusters", },
{ "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT_MEM, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
{ "-enable_shadows", "Enable Shadows", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_shadows"},
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
@@ -180,6 +181,8 @@ Flag exe_params[] =
{ "-nomusic", "Disable music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomusic", },
{ "-no_enhanced_sound", "Disable enhanced sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_enhanced_sound", },
{ "-portable_mode", "Store config in portable location", false, 0, EASY_DEFAULT, "Launcher", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-portable_mode", },
{ "-standalone", "Run as standalone server", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone", },
{ "-startgame", "Skip mainhall and start hosting", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame", },
{ "-closed", "Start hosted server as closed", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-closed", },
@@ -235,6 +238,7 @@ Flag exe_params[] =
{ "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
{ "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
{ "-benchmark_mode", "Puts the game into benchmark mode", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode", },
{ "-noninteractive", "Disables interactive dialogs", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noninteractive", },
};
// forward declaration
@@ -312,6 +316,7 @@ cmdline_parm bloom_intensity_arg("-bloom_intensity", "Set bloom intensity, requi
cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE);
cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post_process and -fxaa", AT_INT);
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
cmdline_parm fb_thrusters_arg("-fb_thrusters", NULL, AT_NONE);
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
cmdline_parm no_batching("-no_batching", NULL, AT_NONE);
cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT);
@@ -340,6 +345,7 @@ bool Cmdline_fxaa = false;
int Cmdline_fxaa_preset = 6;
extern int Fxaa_preset_last_frame;
bool Cmdline_fb_explosions = 0;
bool Cmdline_fb_thrusters = false;
bool Cmdline_no_batching = false;
extern bool ls_force_off;
int Cmdline_shadow_quality = 0;
@@ -461,9 +467,6 @@ cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mis
cmdline_parm dis_collisions("-dis_collisions", NULL, AT_NONE); // Cmdline_dis_collisions
cmdline_parm dis_weapons("-dis_weapons", NULL, AT_NONE); // Cmdline_dis_weapons
cmdline_parm noparseerrors_arg("-noparseerrors", NULL, AT_NONE); // Cmdline_noparseerrors -- turns off parsing errors -C
#ifdef Allow_NoWarn
cmdline_parm nowarn_arg("-no_warn", "Disable warnings (not recommended)", AT_NONE); // Cmdline_nowarn
#endif
cmdline_parm extra_warn_arg("-extra_warn", "Enable 'extra' warnings", AT_NONE); // Cmdline_extra_warn
cmdline_parm fps_arg("-fps", NULL, AT_NONE); // Cmdline_show_fps
cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL, AT_NONE); // Cmdline_show_mem_usage
@@ -481,6 +484,7 @@ cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE); //Cmdline_benchmark_mode
cmdline_parm noninteractive_arg("-noninteractive", NULL, AT_NONE); //Cmdline_noninteractive
char *Cmdline_start_mission = NULL;
@@ -506,6 +510,7 @@ bool Cmdline_frame_profile = false;
bool Cmdline_profile_write_file = false;
bool Cmdline_no_unfocus_pause = false;
bool Cmdline_benchmark_mode = false;
bool Cmdline_noninteractive = false;
// Other
cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
@@ -608,17 +613,20 @@ int is_extra_space(char ch)
// eliminates all leading and trailing extra chars from a string. Returns pointer passed in.
char *drop_extra_chars(char *str)
{
int s, e;
size_t s;
size_t e;
s = 0;
while (str[s] && is_extra_space(str[s]))
s++;
e = strlen(str) - 1; // we already account for NULL later on, so the -1 is here to make
// sure we do our math without taking it into consideration
e = strlen(str);
if (e < 0)
e = 0;
if (e > 0) {
// we already account for NULL later on, so the -1 is here to make
// sure we do our math without taking it into consideration
e -= 1;
}
while (e > s) {
if (!is_extra_space(str[e])){
@@ -673,8 +681,8 @@ bool parm_stuff_args(cmdline_parm *parm, int argc, char *argv[], int index)
parm->args = NULL;
}
int argsize = strlen(argv[index + 1]);
int buffersize = argsize;
size_t argsize = strlen(argv[index + 1]);
size_t buffersize = argsize;
if (saved_args != NULL)
{
@@ -772,7 +780,7 @@ void os_validate_parms(int argc, char *argv[])
if (parm_found == 0) {
// if we got a -help, --help, -h, or -? then show the help text, otherwise show unknown option
if (!stricmp(token, "-help") || !stricmp(token, "--help") || !stricmp(token, "-h") || !stricmp(token, "-?")) {
if (FS_VERSION_REVIS == 0) {
if (FS_VERSION_HAS_REVIS == 0) {
printf("FreeSpace 2 Open, version %i.%i.%i\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
}
else {
@@ -785,16 +793,17 @@ void os_validate_parms(int argc, char *argv[])
// not the prettiest thing but the job gets done
static const int STR_SIZE = 25; // max len of exe_params.name + 5 spaces
const int AT_SIZE = 8; // max len of cmdline_arg_types[] + 2 spaces
int sp=0, atp=0;
size_t atp = 0;
size_t sp = 0;
for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
// don't output deprecated flags
if (stricmp("deprecated", parmp->help)) {
sp = strlen(parmp->name);
if (parmp->arg_type != AT_NONE) {
atp = strlen(cmdline_arg_types[parmp->arg_type]);
printf(" [ %s ]%*s[ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1), NOX(" "), cmdline_arg_types[parmp->arg_type], AT_SIZE-atp, NOX(" "), parmp->help);
printf(" [ %s ]%*s[ %s ]%*s- %s\n", parmp->name, (int)(STR_SIZE - sp -1), NOX(" "), cmdline_arg_types[parmp->arg_type], (int)(AT_SIZE-atp), NOX(" "), parmp->help);
} else {
printf(" [ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1 +AT_SIZE+4), NOX(" "), parmp->help);
printf(" [ %s ]%*s- %s\n", parmp->name, (int)(STR_SIZE - sp -1 +AT_SIZE+4), NOX(" "), parmp->help);
}
}
}
@@ -815,14 +824,14 @@ void os_validate_parms(int argc, char *argv[])
int parse_cmdline_string(char* cmdline, char** argv)
{
int length = strlen(cmdline);
size_t length = strlen(cmdline);
bool start_found = false;
bool quoted = false;
int argc = 0;
size_t argc = 0;
char* current_argv = NULL;
for (int i = 0; i < length; i++)
for (size_t i = 0; i < length; i++)
{
if (!start_found && !isspace(cmdline[i]))
{
@@ -883,7 +892,7 @@ int parse_cmdline_string(char* cmdline, char** argv)
argc++;
}
return argc;
return (int)argc;
}
void os_process_cmdline(char* cmdline)
@@ -943,7 +952,7 @@ void os_init_cmdline(int argc, char *argv[])
if (fp) {
char *buf, *p;
size_t len = filelength(fileno(fp)) + 2;
auto len = static_cast<int>(filelength(fileno(fp))) + 2;
buf = new char[len];
if (fgets(buf, len - 1, fp) != nullptr)
@@ -971,7 +980,7 @@ void os_init_cmdline(int argc, char *argv[])
if ( fp ) {
char *buf, *p;
size_t len = filelength( fileno(fp) ) + 2;
auto len = static_cast<int>(filelength( fileno(fp) )) + 2;
buf = new char [len];
if (fgets(buf, len-1, fp) != nullptr)
@@ -1066,7 +1075,7 @@ int cmdline_parm::get_int()
Assertion(arg_type == AT_INT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_int() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
check_if_args_is_valid();
int offset = 0;
size_t offset = 0;
if (stacks) {
// first off, DON'T STACK NON-STRINGS!!
@@ -1091,7 +1100,7 @@ float cmdline_parm::get_float()
Assertion(arg_type == AT_FLOAT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_float() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
check_if_args_is_valid();
int offset = 0;
size_t offset = 0;
if (stacks) {
// first off, DON'T STACK NON-STRINGS!!
@@ -1178,7 +1187,7 @@ static SCP_vector<SCP_string> unix_get_dir_names(SCP_string parent, SCP_string d
}
// For case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches.
static void handle_unix_modlist(char **modlist, int *len)
static void handle_unix_modlist(char **modlist, size_t *len)
{
// search filesystem for given paths
SCP_vector<SCP_string> mod_paths;
@@ -1488,7 +1497,7 @@ bool SetCmdlineParams()
}
// Ok - mod stacking support
int len = strlen(Cmdline_mod);
size_t len = strlen(Cmdline_mod);
char *modlist = new char[len+2];
memset( modlist, 0, len + 2 );
strcpy_s(modlist, len+2, Cmdline_mod);
@@ -1499,7 +1508,7 @@ bool SetCmdlineParams()
#endif
// null terminate each individual
for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
{
if (modlist[i] == ',')
modlist[i] = '\0';
@@ -1772,6 +1781,11 @@ bool SetCmdlineParams()
Cmdline_fb_explosions = 1;
}
if (fb_thrusters_arg.found())
{
Cmdline_fb_thrusters = true;
}
if ( no_batching.found() )
{
Cmdline_no_batching = true;
@@ -1800,10 +1814,11 @@ bool SetCmdlineParams()
if( enable_shadows_arg.found() )
{
Cmdline_shadow_quality = 2;
if( shadow_quality_arg.found() )
{
Cmdline_shadow_quality = shadow_quality_arg.get_int();
}
}
if( shadow_quality_arg.found() )
{
Cmdline_shadow_quality = shadow_quality_arg.get_int();
}
if( no_deferred_lighting_arg.found() )
@@ -1832,6 +1847,11 @@ bool SetCmdlineParams()
Cmdline_benchmark_mode = true;
}
if (noninteractive_arg.found())
{
Cmdline_noninteractive = true;
}
//Deprecated flags - CommanderDJ
if( deprecated_spec_arg.found() )
{
+2 -3
View File
@@ -76,6 +76,7 @@ extern int Cmdline_bloom_intensity;
extern bool Cmdline_fxaa;
extern int Cmdline_fxaa_preset;
extern bool Cmdline_fb_explosions;
extern bool Cmdline_fb_thrusters;
extern bool Cmdline_no_batching;
extern int Cmdline_shadow_quality;
extern int Cmdline_no_deferred_lighting;
@@ -145,9 +146,6 @@ extern int Cmdline_old_collision_sys;
extern int Cmdline_dis_collisions;
extern int Cmdline_dis_weapons;
extern int Cmdline_noparseerrors;
#ifdef Allow_NoWarn
extern int Cmdline_nowarn;
#endif
extern int Cmdline_extra_warn;
extern int Cmdline_show_mem_usage;
extern int Cmdline_show_pos;
@@ -159,5 +157,6 @@ extern bool Cmdline_frame_profile;
extern bool Cmdline_profile_write_file;
extern bool Cmdline_no_unfocus_pause;
extern bool Cmdline_benchmark_mode;
extern bool Cmdline_noninteractive;
#endif
+1 -1
View File
@@ -93,7 +93,7 @@ void cmeasure_maybe_alert_success(object *objp)
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
hud_start_text_flash(XSTR("Evaded", 1430), 800);
snd_play(&Snds[ship_get_sound(Player_obj, SND_MISSILE_EVADED_POPUP)]);
} else if ( Objects[objp->parent].flags & OF_PLAYER_SHIP ) {
} else if ( Objects[objp->parent].flags[Object::Object_Flags::Player_ship] ) {
send_countermeasure_success_packet( objp->parent );
}
}
+75 -17
View File
@@ -12,7 +12,7 @@
#include "controlconfig/controlsconfig.h"
#include "debugconsole/console.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamehelp/contexthelp.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
@@ -356,6 +356,65 @@ DCF_BOOL(show_controls_info, Show_controls_info);
static int Axes_origin[JOY_NUM_AXES];
static int joy_get_unscaled_reading(int raw, int axn)
{
int rng;
rng = JOY_AXIS_MAX - JOY_AXIS_MIN;
raw -= JOY_AXIS_MIN; // adjust for linear range starting at 0
// cap at limits
if (raw < 0)
raw = 0;
if (raw > rng)
raw = rng;
return (int) ((uint) raw * (uint) F1_0 / (uint) rng); // convert to 0 - F1_0 range.
}
int joy_get_scaled_reading(int raw)
{
int x, d, dead_zone, rng;
float percent, sensitivity_percent, non_sensitivity_percent;
raw -= JOY_AXIS_CENTER;
dead_zone = (JOY_AXIS_MAX - JOY_AXIS_MIN) * Joy_dead_zone_size / 100;
if (raw < -dead_zone) {
rng = JOY_AXIS_CENTER - JOY_AXIS_MIN - dead_zone;
d = -raw - dead_zone;
} else if (raw > dead_zone) {
rng = JOY_AXIS_MAX - JOY_AXIS_CENTER - dead_zone;
d = raw - dead_zone;
} else
return 0;
if (d > rng)
d = rng;
Assert(Joy_sensitivity >= 0 && Joy_sensitivity <= 9);
// compute percentages as a range between 0 and 1
sensitivity_percent = (float) Joy_sensitivity / 9.0f;
non_sensitivity_percent = (float) (9 - Joy_sensitivity) / 9.0f;
// find percent of max axis is at
percent = (float) d / (float) rng;
// work sensitivity on axis value
percent = (percent * sensitivity_percent + percent * percent * percent * percent * percent * non_sensitivity_percent);
x = (int) ((float) F1_0 * percent);
//nprintf(("AI", "d=%6i, sens=%3i, percent=%6.3f, val=%6i, ratio=%6.3f\n", d, Joy_sensitivity, percent, (raw<0) ? -x : x, (float) d/x));
if (raw < 0)
return -x;
return x;
}
void control_config_detect_axis_reset()
{
joystick_read_raw_axis(JOY_NUM_AXES, Axes_origin);
@@ -833,8 +892,6 @@ int control_config_clear_all()
return 0;
}
extern Joy_info joystick;
int control_config_axis_default(int axis)
{
Assert(axis >= 0);
@@ -844,7 +901,8 @@ int control_config_axis_default(int axis)
return -1;
}
if (!joystick.axis_valid[Axis_map_to_defaults[axis]]) {
auto joystick = io::joystick::getCurrentJoystick();
if (joystick == nullptr || Axis_map_to_defaults[axis] >= joystick->numAxes()) {
return -1;
}
}
@@ -1470,7 +1528,7 @@ void control_config_do_frame(float frametime)
if (Axis_override >= 0) {
control_config_bind_axis(z, Axis_override);
strcpy_s(bound_string, Joy_axis_text[Axis_override]);
gr_force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
font::force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
bound_timestamp = timestamp(2500);
control_config_conflict_check();
control_config_list_prepare();
@@ -1538,7 +1596,7 @@ void control_config_do_frame(float frametime)
control_config_bind_key(z, k);
strcpy_s(bound_string, textify_scancode(k));
gr_force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
font::force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
bound_timestamp = timestamp(2500);
control_config_conflict_check();
control_config_list_prepare();
@@ -1552,7 +1610,7 @@ void control_config_do_frame(float frametime)
control_config_bind_joy(z, i);
strcpy_s(bound_string, Joy_button_text[i]);
gr_force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
font::force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
bound_timestamp = timestamp(2500);
control_config_conflict_check();
control_config_list_prepare();
@@ -1576,7 +1634,7 @@ void control_config_do_frame(float frametime)
control_config_bind_joy(z, i);
strcpy_s(bound_string, Joy_button_text[i]);
gr_force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
font::force_fit_string(bound_string, 39, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
bound_timestamp = timestamp(2500);
control_config_conflict_check();
control_config_list_prepare();
@@ -1847,7 +1905,7 @@ void control_config_do_frame(float frametime)
}
// set color and font
gr_set_font(FONT2);
font::set_font(font::FONT2);
if(Conflict_bright){
gr_set_color_fast(&Color_bright_red);
} else {
@@ -1862,7 +1920,7 @@ void control_config_do_frame(float frametime)
gr_string((gr_screen.max_w / 2) - (sw / 2), Conflict_warning_coords[gr_screen.res][1], conflict_str, GR_RESIZE_MENU);
gr_set_font(FONT1);
font::set_font(font::FONT1);
} else {
// might as well always reset the conflict stamp
Conflict_stamp = -1;
@@ -1936,7 +1994,7 @@ void control_config_do_frame(float frametime)
strcpy_s(buf, Control_config[i].text);
}
gr_force_fit_string(buf, 255, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
font::force_fit_string(buf, 255, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
gr_get_string_size(&w, NULL, buf);
gr_printf_menu(x - w / 2, y, buf);
@@ -1976,7 +2034,7 @@ void control_config_do_frame(float frametime)
gr_set_color_fast(c);
if (Cc_lines[line].label) {
strcpy_s(buf, Cc_lines[line].label);
gr_force_fit_string(buf, 255, Control_list_ctrl_w[gr_screen.res]);
font::force_fit_string(buf, 255, Control_list_ctrl_w[gr_screen.res]);
gr_printf_menu(Control_list_coords[gr_screen.res][CONTROL_X_COORD], y, buf);
}
@@ -2040,7 +2098,7 @@ void control_config_do_frame(float frametime)
gr_set_color_fast(c);
}
gr_force_fit_string(buf, 255, Control_list_key_w[gr_screen.res] + Control_list_key_x[gr_screen.res] - x);
font::force_fit_string(buf, 255, Control_list_key_w[gr_screen.res] + Control_list_key_x[gr_screen.res] - x);
gr_printf_menu(x, y, buf);
Cc_lines[line].jx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
@@ -2306,17 +2364,17 @@ void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
// joy_get_scaled_reading will return a value represents the joystick pos from -1 to +1 (fixed point)
*h = 0;
if (Axis_map_to[0] >= 0) {
*h = joy_get_scaled_reading(axes_values[Axis_map_to[0]], Axis_map_to[0]);
*h = joy_get_scaled_reading(axes_values[Axis_map_to[0]]);
}
*p = 0;
if (Axis_map_to[1] >= 0) {
*p = joy_get_scaled_reading(axes_values[Axis_map_to[1]], Axis_map_to[1]);
*p = joy_get_scaled_reading(axes_values[Axis_map_to[1]]);
}
*b = 0;
if (Axis_map_to[2] >= 0) {
*b = joy_get_scaled_reading(axes_values[Axis_map_to[2]], Axis_map_to[2]);
*b = joy_get_scaled_reading(axes_values[Axis_map_to[2]]);
}
*ta = 0;
@@ -2326,7 +2384,7 @@ void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
*tr = 0;
if (Axis_map_to[4] >= 0) {
*tr = joy_get_scaled_reading(axes_values[Axis_map_to[4]], Axis_map_to[4]);
*tr = joy_get_scaled_reading(axes_values[Axis_map_to[4]]);
}
if (Invert_axis[0]) {
+5
View File
@@ -288,6 +288,9 @@ extern int Axis_map_to[];
extern int Invert_axis[];
extern int Invert_axis_defaults[];
extern int Joy_dead_zone_size;
extern int Joy_sensitivity;
extern int Control_config_overlay_id;
extern config_item Control_config[]; //!< Stores the keyboard configuration
@@ -318,4 +321,6 @@ void clear_key_binding(short key);
void control_check_indicate();
void control_config_clear_used_status();
int joy_get_scaled_reading(int raw);
#endif
+6 -2
View File
@@ -12,7 +12,7 @@
#include "cfile/cfile.h"
#include "controlconfig/controlsconfig.h"
#include "globalincs/def_files.h"
#include "def_files/def_files.h"
#include "globalincs/systemvars.h"
#include "io/joy.h"
#include "io/key.h"
@@ -30,6 +30,10 @@ enum CC_tab {
int Failed_key_index;
// Joystick configuration
int Joy_dead_zone_size = 10;
int Joy_sensitivity = 9;
// assume control keys are used as modifiers until we find out
int Shift_is_modifier;
int Ctrl_is_modifier;
@@ -810,7 +814,7 @@ void control_config_common_load_overrides()
if (cf_exists_full("controlconfigdefaults.tbl", CF_TYPE_TABLES)) {
read_file_text("controlconfigdefaults.tbl", CF_TYPE_TABLES);
} else {
read_file_text_from_array(defaults_get_file("controlconfigdefaults.tbl"));
read_file_text_from_default(defaults_get_file("controlconfigdefaults.tbl"));
}
reset_parse();
+1 -1
View File
@@ -10,7 +10,7 @@
#include "cutscene/cutscenes.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamesequence/gamesequence.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
+1 -1
View File
@@ -44,7 +44,7 @@ int movie_find(char *filename, char *out_name)
{
char full_path[MAX_PATH];
char tmp_name[MAX_PATH];
int size, offset = 0;
size_t size, offset = 0;
if (out_name == NULL)
return MOVIE_NONE;
+6 -14
View File
@@ -13,7 +13,6 @@
#include "graphics/2d.h"
#include "graphics/gropengl.h"
#include "graphics/gropengldraw.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglstate.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropengltexture.h"
@@ -70,8 +69,6 @@ ushort *pixelbuf = NULL;
static GLuint GLtex = 0;
static GLfloat gl_screenYH = 0;
static GLfloat gl_screenXW = 0;
static GLfloat gl_screenU = 0;
static GLfloat gl_screenV = 0;
static GLfloat glVertices[4][4] = {{0}};
static int g_screenWidth, g_screenHeight;
static float g_screenX, g_screenY;
@@ -80,12 +77,10 @@ static ubyte g_palette[768];
static ubyte *g_pCurMap = NULL;
static int g_nMapLength = 0;
static int videobuf_created, video_inited;
static int hp2, wp2;
static uint mve_video_skiptimer = 0;
static int mve_scale_video = 0;
// video externs from API graphics functions
extern void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int *h_out);
extern GLenum GL_previous_texture_target;
// the decoders
@@ -486,9 +481,6 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
if (gr_screen.mode == GR_OPENGL) {
gl_screenYH = g_screenY + g_height;
gl_screenXW = g_screenX + g_width;
gl_screenU = i2fl(g_width) / i2fl(wp2);
gl_screenV = i2fl(g_height) / i2fl(hp2);
}
glVertices[0][0] = g_screenX;
@@ -499,17 +491,17 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
glVertices[1][0] = g_screenX;
glVertices[1][1] = gl_screenYH;
glVertices[1][2] = 0;
glVertices[1][3] = gl_screenV;
glVertices[1][3] = 1.f;
glVertices[2][0] = gl_screenXW;
glVertices[2][1] = g_screenY;
glVertices[2][2] = gl_screenU;
glVertices[2][2] = 1.f;
glVertices[2][3] = 0;
glVertices[3][0] = gl_screenXW;
glVertices[3][1] = gl_screenYH;
glVertices[3][2] = gl_screenU;
glVertices[3][3] = gl_screenV;
glVertices[3][2] = 1.f;
glVertices[3][3] = 1.f;
GL_state.Array.BindArrayBuffer(0);
@@ -602,6 +594,7 @@ void mve_video_display()
}
if (gr_screen.mode == GR_OPENGL) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
opengl_shader_set_passthrough(true);
@@ -665,7 +658,6 @@ int mve_video_init(ubyte *data)
if (gr_screen.mode == GR_OPENGL) {
opengl_set_texture_target(GL_TEXTURE_2D);
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
glGenTextures(1, &GLtex);
@@ -694,7 +686,7 @@ int mve_video_init(ubyte *data)
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, g_screenWidth, g_screenHeight, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
// set our color so that we can make sure that it's correct
GL_state.Color(255, 255, 255, 255);
+7 -13
View File
@@ -12,12 +12,11 @@
#include "bmpman/bmpman.h"
#include "cfile/cfile.h"
#include "cutscene/oggplayer.h"
#include "globalincs/def_files.h"
#include "def_files/def_files.h"
#include "globalincs/pstypes.h"
#include "graphics/2d.h"
#include "graphics/gropengl.h"
#include "graphics/gropengldraw.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglstate.h"
#include "graphics/gropengltexture.h"
@@ -33,7 +32,6 @@
extern int Cmdline_noscalevid;
static int hp2, wp2;
static int video_inited = 0;
static int scale_video = 0;
static int playing = 1;
@@ -53,9 +51,6 @@ static GLfloat gl_screenU = 0;
static GLfloat gl_screenV = 0;
static GLfloat glVertices[4][4] = {{0}};
// video externs from API graphics functions
extern void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int *h_out);
static int timer_started = 0;
static longlong base_time = -1;
#ifdef SCP_UNIX
@@ -343,7 +338,6 @@ static void OGG_video_init(theora_info *tinfo)
if (gr_screen.mode == GR_OPENGL) {
opengl_set_texture_target(GL_TEXTURE_2D);
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
if(!is_minimum_GLSL_version())
use_shaders = false;
@@ -395,7 +389,7 @@ static void OGG_video_init(theora_info *tinfo)
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, g_screenWidth, g_screenHeight, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
}
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
@@ -458,7 +452,7 @@ static void OGG_video_init(theora_info *tinfo)
}
if(!use_shaders) {
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
pixelbuf = (ubyte *) vm_malloc(g_screenWidth * g_screenHeight * 3, memory::quiet_alloc);
if (pixelbuf == NULL) {
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
@@ -483,8 +477,8 @@ static void OGG_video_init(theora_info *tinfo)
gl_screenYH = g_screenY + g_screenHeight;
gl_screenXW = g_screenX + g_screenWidth;
gl_screenU = i2fl(g_screenWidth) / i2fl(wp2);
gl_screenV = i2fl(g_screenHeight) / i2fl(hp2);
gl_screenU = 1.f;
gl_screenV = 1.f;
if(use_shaders) {
gl_screenU = i2fl(tinfo->frame_width-1) / i2fl(2048) ;
@@ -649,7 +643,6 @@ static void convert_YUV_to_RGB(yuv_buffer *yuv)
}
}
extern int Mouse_hidden;
static void OGG_video_draw(theora_state *tstate)
{
yuv_buffer yuv;
@@ -658,6 +651,7 @@ static void OGG_video_draw(theora_state *tstate)
if(!use_shaders)
convert_YUV_to_RGB(&yuv);
if (gr_screen.mode == GR_OPENGL) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if(use_shaders) {
GL_state.Texture.SetActiveUnit(0);
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, yuv.y_stride, yuv.y_height, GL_LUMINANCE, GL_UNSIGNED_BYTE, yuv.y);
@@ -743,7 +737,7 @@ THEORAFILE *theora_open(char *filename)
// create the file
movie = (THEORAFILE *) vm_malloc_q( sizeof(THEORAFILE) );
movie = (THEORAFILE *) vm_malloc( sizeof(THEORAFILE), memory::quiet_alloc);
if (movie == NULL)
return NULL;
+6 -4
View File
@@ -27,7 +27,7 @@ static inline int is_power_of_two(int w, int h)
}
int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, size_t *size, ubyte *palette)
{
DDSURFACEDESC2 dds_header;
int code = 0;
@@ -37,7 +37,8 @@ int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *heigh
int ct = DDS_UNCOMPRESSED;
int bits = 0;
int i, is_cubemap = 0;
int d_width = 0, d_height = 0, d_depth = 0, d_size = 0;
uint32_t d_width = 0, d_height = 0, d_depth = 0;
size_t d_size = 0;
if (img_cfp == NULL) {
@@ -276,7 +277,8 @@ int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp, int cf_type)
{
int retval;
int w,h,ct,lvl;
int size = 0, bits = 0;
size_t size = 0;
int bits = 0;
CFILE *cfp;
char real_name[MAX_FILENAME_LEN];
@@ -308,7 +310,7 @@ int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp, int cf_type)
cfseek(cfp, DDS_OFFSET, CF_SEEK_SET);
// read in the data
cfread(data, 1, size, cfp);
cfread(data, 1, (int)size, cfp);
if (bpp)
*bpp = (ubyte)bits;
+1 -1
View File
@@ -138,7 +138,7 @@ typedef struct _DDSURFACEDESC2
//reads a dds header
//returns one of the error values
//'compression_type' comes back as one of the DDS_DXTC* defines
int dds_read_header(const char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0, ubyte *palette = NULL);
int dds_read_header(const char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, size_t *size = 0, ubyte *palette = NULL);
//reads bitmap
//size of the data it stored in size
+23 -13
View File
@@ -12,7 +12,7 @@
#include "cmdline/cmdline.h"
#include "debris/debris.h"
#include "fireball/fireballs.h"
#include "freespace2/freespace.h"
#include "freespace.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
@@ -49,7 +49,7 @@ int Debris_num_submodels = 0;
#define MAX_DEBRIS_DIST 10000.0f // Debris goes away if it's this far away.
#define DEBRIS_DISTANCE_CHECK_TIME (10*1000) // Check every 10 seconds.
#define DEBRIS_INDEX(dp) (dp-Debris)
#define DEBRIS_INDEX(dp) (int)(dp-Debris)
#define MAX_SPEED_SMALL_DEBRIS 200 // maximum velocity of small debris piece
#define MAX_SPEED_BIG_DEBRIS 150 // maximum velocity of big debris piece
@@ -78,7 +78,7 @@ static void debris_start_death_roll(object *debris_obj, debris *debris_p)
}
}
debris_obj->flags |= OF_SHOULD_BE_DEAD;
debris_obj->flags.set(Object::Object_Flags::Should_be_dead);
}
/**
@@ -201,7 +201,7 @@ void maybe_delete_debris(debris *db)
db->next_distance_check = timestamp(DEBRIS_DISTANCE_CHECK_TIME);
} else {
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
if (objp->flags & OF_PLAYER_SHIP) {
if (objp->flags[Object::Object_Flags::Player_ship]) {
if (vm_vec_dist_quick(&objp->pos, &Objects[db->objnum].pos) < MAX_DEBRIS_DIST) {
db->next_distance_check = timestamp(DEBRIS_DISTANCE_CHECK_TIME);
return;
@@ -378,7 +378,7 @@ int debris_find_oldest()
oldest_time = 0x7fffffff;
for ( db = GET_FIRST(&Hull_debris_list); db != END_OF_LIST(&Hull_debris_list); db = GET_NEXT(db) ) {
if ( (db->time_started < oldest_time) && !(Objects[db->objnum].flags & OF_SHOULD_BE_DEAD) ) {
if ( (db->time_started < oldest_time) && !(Objects[db->objnum].flags[Object::Object_Flags::Should_be_dead]) ) {
oldest_index = DEBRIS_INDEX(db);
oldest_time = db->time_started;
}
@@ -418,7 +418,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS );
shipp = &Ships[source_obj->instance];
sip = &Ship_info[shipp->ship_info_index];
vaporize = (shipp->flags &SF_VAPORIZE);
vaporize = (shipp->flags[Ship::Ship_Flags::Vaporize]);
if ( !hull_flag ) {
// Make vaporize debris seen from farther away
@@ -548,10 +548,12 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
if ( pos == NULL )
pos = &source_obj->pos;
uint flags = OF_RENDERS | OF_PHYSICS;
if ( hull_flag )
flags |= OF_COLLIDES;
objnum = obj_create( OBJ_DEBRIS, parent_objnum, n, &source_obj->orient, pos, radius, flags );
flagset<Object::Object_Flags> default_flags;
default_flags.set(Object::Object_Flags::Renders);
default_flags.set(Object::Object_Flags::Physics);
default_flags.set(Object::Object_Flags::Collides, hull_flag != 0);
objnum = obj_create( OBJ_DEBRIS, parent_objnum, n, &source_obj->orient, pos, radius, default_flags);
if ( objnum == -1 ) {
mprintf(("Couldn't create debris object -- out of object slots\n"));
return NULL;
@@ -696,7 +698,7 @@ void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float dama
// Do a little particle spark shower to show we hit
{
particle_emitter pe;
particle::particle_emitter pe;
pe.pos = *hitpos; // Where the particles emit from
pe.vel = debris_obj->phys_info.vel; // Initial velocity of all the particles
@@ -718,7 +720,7 @@ void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float dama
pe.max_vel = 10.0f; // How fast the fastest particle can move
pe.min_life = 0.25f; // How long the particles live
pe.max_life = 0.75f; // How long the particles live
particle_emit( &pe, PARTICLE_FIRE, 0 );
particle::emit( &pe, particle::PARTICLE_FIRE, 0 );
}
// multiplayer clients bail here
@@ -747,7 +749,7 @@ void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float dama
* NOTE: debris_hit_info pointer NULL for debris:weapon collision, otherwise debris:ship collision.
* @return true if hit, else return false.
*/
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info)
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info, vec3d* hitNormal)
{
mc_info mc;
mc_info_init(&mc);
@@ -776,6 +778,14 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
if (model_collide(&mc)) {
*hitpos = mc.hit_point_world;
if (hitNormal)
{
vec3d normal;
model_find_world_dir(&normal, &mc.hit_normal, mc.model_num, mc.hit_submodel, mc.orient);
*hitNormal = normal;
}
}
weapon *wp = &Weapons[other_obj->instance];
+1 -1
View File
@@ -67,7 +67,7 @@ void debris_render(object * obj, draw_list *scene);
void debris_delete( object * obj );
void debris_process_post( object * obj, float frame_time);
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL );
int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL, vec3d* hitnormal = NULL );
void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage );
int debris_get_team(object *objp);
void debris_clear_expired_flag(debris *db);
+24 -17
View File
@@ -36,7 +36,7 @@ uint lastline = 0; // Number of lines written to the console since the last com
// Text Buffer
uint DBROWS = 80; // # of buffer rows
uint DBCOLS = 80; // # of buffer columns
uint lastwhite = 0; // Last whitespace character encountered, used by putc for 'true' word wrapping
size_t lastwhite = 0; // Last whitespace character encountered, used by putc for 'true' word wrapping
ubyte DTABS = 4; //!< Tab size in spaces
/**
@@ -66,7 +66,7 @@ uint dc_scroll_x; // X scroll position (Leftmost character)
uint dc_scroll_y; // Y scroll position (Topmost character)
int row_height; // Row/Line height, in pixels
int col_width; // Col/Character width, in pixels
int dc_font = FONT1;
int dc_font = font::FONT1;
SCP_string dc_title;
@@ -185,9 +185,12 @@ void dc_do_command(SCP_string *cmd_str)
void dc_draw(bool show_prompt = FALSE)
{
gr_clear();
gr_set_font(dc_font);
font::set_font(dc_font);
gr_set_color_fast( &Color_bright );
gr_string( 0x8000, gr_screen.center_offset_y + 3, dc_title.c_str(), GR_RESIZE_NONE );
int w;
gr_get_string_size(&w, nullptr, dc_title.c_str());
gr_string((gr_screen.clip_width - w) / 2, 3, dc_title.c_str(), GR_RESIZE_NONE );
gr_set_color_fast( &Color_normal );
@@ -205,18 +208,19 @@ void dc_draw_cursor( SCP_string &cmd_string, int x, int y )
if ( t & 1 ) {
gr_get_string_size( &w, &h, cmd_string.c_str() );
w %= (DCOLS * Current_font->w);
w %= (DCOLS * col_width);
//gr_string( w, debug_y*16, "_" );
gr_rect(gr_screen.center_offset_x + (x + (w + 1)), gr_screen.center_offset_y + (y + (h + 1)), 2, Current_font->h, GR_RESIZE_NONE);
gr_rect(gr_screen.center_offset_x + (x + (w + 1)), gr_screen.center_offset_y + (y + (h + 1)), 2,
fl2i(font::get_current_font()->getHeight()), GR_RESIZE_NONE);
}
}
void dc_draw_window(bool show_prompt)
{
uint cmd_lines; // Number of lines for the command string
uint buffer_lines; // Number of lines from the buffer to draw
uint i; // The current row we're drawing
uint j; // The current row of the command string we're drawing
size_t cmd_lines; // Number of lines for the command string
size_t buffer_lines; // Number of lines from the buffer to draw
size_t i; // The current row we're drawing
size_t j; // The current row of the command string we're drawing
SCP_string out_str; // The command string + prompt character
SCP_string::iterator str_it; // Iterator to out_str
@@ -235,7 +239,7 @@ void dc_draw_window(bool show_prompt)
// Ensure we don't scroll too far
dc_scroll_x = MIN(dc_scroll_x, (DBCOLS - DCOLS));
if (dc_buffer.size() >= buffer_lines) {
dc_scroll_y = MIN(dc_scroll_y, (dc_buffer.size() - buffer_lines));
dc_scroll_y = MIN(dc_scroll_y, (uint32_t)(dc_buffer.size() - buffer_lines));
} else {
dc_scroll_y = 0; // Disallow vscroll until the buffer is larger than the window
}
@@ -243,7 +247,7 @@ void dc_draw_window(bool show_prompt)
// Draw the buffer strings
for (i = 0; i < buffer_lines; ++i) {
if ((i + dc_scroll_y) < dc_buffer.size()) {
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + (((int)i * row_height) + row_height), dc_buffer[i + dc_scroll_y].substr(dc_scroll_x).c_str(), GR_RESIZE_NONE);
}
}
@@ -261,9 +265,9 @@ void dc_draw_window(bool show_prompt)
++j;
}
}
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + ((i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
gr_string(gr_screen.center_offset_x, gr_screen.center_offset_y + (((int)i * row_height) + row_height), out_str.c_str(), GR_RESIZE_NONE);
dc_draw_cursor(out_str, 0, ((i * row_height)));
dc_draw_cursor(out_str, 0, (((int)i * row_height)));
gr_set_color_fast(&Color_normal);
}
}
@@ -277,9 +281,12 @@ void dc_init(void)
debug_inited = TRUE;
// Init window settings
dc_font = FONT1;
row_height = ((Current_font->h) * 3) / 2; // Row/Line height, in pixels
col_width = Current_font->w; // Col/Character width, in pixels
dc_font = font::FONT1;
row_height = ((fl2i(font::get_current_font()->getHeight())) * 3) / 2; // Row/Line height, in pixels
// This assumes that FONT1 is monospaced!
gr_get_string_size(&col_width, nullptr, " "); // Col/Character width, in pixels
dc_scroll_x = 0;
dc_scroll_y = 0;
DCOLS = (gr_screen.center_w / col_width) - 1; // Subtract as needed. Windowed mode has some quirks with the resolution
+356
View File
@@ -0,0 +1,356 @@
;; AI Profiles table. Incorporates stuff from the old difficulty.tbl
;; plus additional flags previously covered under the blanket New AI
;; flag.
;;
;; This is what the retail table would look like, but you don't have to
;; specify it as it's stored internally by the game. This leaves you
;; with four other slots to specify four other profiles. Every setting
;; is optional, so if you don't specify something it will inherit from
;; the FS2 retail setting. If you don't specify a default profile, it
;; will set the default to retail as well.
;;
#AI Profiles
$Default Profile: FS2 RETAIL
$Profile Name: FS2 RETAIL
;; Difficulty-related values; much of this was originally in
;; difficulty.tbl. Each option specifies a list corresponding to the
;; five skill values (Very Easy, Easy, Medium, Hard, Insane).
;; speed of afterburner recharge
$Player Afterburner Recharge Scale: 5, 3, 2, 1.5, 1
;; maximum damage inflicted by friendly beam fire
$Max Beam Friendly Fire Damage: 0, 5, 10, 20, 30
;; factor applied to player countermeasure lifetime
$Player Countermeasure Life Scale: 3, 2, 1.5, 1.25, 1
;; chance a countermeasure will be fired by an AI-controlled ship
;; (this is scaled by ai_class)
$AI Countermeasure Firing Chance: 0.2, 0.3, 0.5, 0.9, 1.1
;; seconds to add to the time it takes for an enemy to come in range of
;; (i.e. target) a friendly ship
$AI In Range Time: 2, 1.4, 0.75, 0, -1
;; AI ships will link ballistic primaries if ammo levels are greater
;; than these percents
$AI Always Links Ammo Weapons: 95, 80, 60, 40, 20
$AI Maybe Links Ammo Weapons: 90, 60, 40, 20, 10
;; Multiplier that modifies the length and frequency of bursts used
;; by the AI for ballistic primary weapons
$Primary Ammo Burst Multiplier: 0, 0, 0, 0, 0
;; AI ships will link laser primaries if energy levels are greater
;; than these percents
$AI Always Links Energy Weapons: 100, 80, 60, 40, 20
$AI Maybe Links Energy Weapons: 90, 60, 40, 20, 10
;; maximum number of missiles allowed to be homing in on a player at a
;; given time (single-player only; no restriction in multiplayer)
$Max Missiles Locked on Player: 2, 3, 4, 7, 99
;; maximum number of ships allowed to be attacking the player at a
;; given time (single-player only; no restriction in multiplayer)
$Max Player Attackers: 2, 3, 4, 5, 99
;; maximum number of active (i.e. 'thrown') asteroids that can be
;; heading toward a friendly ship at any given time
$Max Incoming Asteroids: 3, 4, 5, 7, 10
;; factor applied to damage suffered by the player
$Player Damage Factor: 0.25, 0.5, 0.65, 0.85, 1
;; factor applied to subsystem damage suffered by the player
;; (in addition to Player Damage Factor)
$Player Subsys Damage Factor: 0.2, 0.4, 0.6, 0.8, 1
;; measure of time (in F1_0 units) after which the AI will recalculate
;; the position of its target
$Predict Position Delay: 2, 1.5, 1.333, 0.5, 0
;; seconds between each instance of an AI ship managing its shields
$AI Shield Manage Delay: 5, 4, 2.5, 1.2, 0.1
;; factor applied to 'fire wait' for friendly ships
$Friendly AI Fire Delay Scale: 2, 1.4, 1.25, 1.1, 1
;; factor applied to 'fire wait' for hostile ships
$Hostile AI Fire Delay Scale: 4, 2.5, 1.75, 1.25, 1
;; factor applied to 'fire wait' for secondaries of friendly ships
$Friendly AI Secondary Fire Delay Scale: 0.4, 0.6, 0.8, 1.0, 1.2
;; factor applied to 'fire wait' for secondaries of hostile ships
$Hostile AI Secondary Fire Delay Scale: 1.4, 1.2, 1.0, 0.8, 0.6
;; factor applied to time it takes for enemy ships to turn
$AI Turn Time Scale: 3, 2.2, 1.6, 1.3, 1
;; Percentage of the time where AI ships will use the glide attack
;; when it is an option.
$Glide Attack Percent: 0, 0, 0, 0, 0
;; Percentage of the time where AI ships will use circle strafe
;; when it is an option.
$Circle Strafe Percent: 0, 0, 0, 0, 0
;; Percentage of the time where AI ships will use glide to strafe
;; capital ships when it is an option.
$Glide Strafe Percent: 0, 0, 0, 0, 0
;; Percentage of the time where AI ships will randomly sidethrust in a
;; dogfight.
$Random Sidethrust Percent: 0, 0, 0, 0, 0
;; The amount of time required for the AI to detect
;; (and try to break) dogfight stalemate.
$Stalemate Time Threshold: 0, 0, 0, 0, 0
;; The maximum distance the AI and target must be within
;; for a dogfight stalemate
$Stalemate Distance Threshold: 0, 0, 0, 0, 0
;; Sets the factor applied to the speed at which the player's shields
;; recharge
$Player Shield Recharge Scale: 4, 2, 1.5, 1.25, 1
;; factor applied to the speed at which the player's weapons recharge
$Player Weapon Recharge Scale: 10, 4, 2.5, 2, 1.5
;; maximum number of turrets on one ship allowed to be attacking a
;; target at a given time
$Max Turret Target Ownage: 3, 4, 7, 12, 19
;; maximum number of turrets on one ship allowed to be attacking the
;; player at a given time
$Max Turret Player Ownage: 3, 4, 7, 12, 19
;; the minimum percentage of the total assessed damage a player
;; must inflict in order to be awarded a kill
$Percentage Required For Kill Scale: 0.30, 0.30, 0.30, 0.30, 0.30
;; the minimum percentage of the total assessed damage a player
;; must inflict in order to be awarded an assist
$Percentage Required For Assist Scale: 0.15, 0.15, 0.15, 0.15, 0.15
;; in TvT and Coop missions all teammates will be granted this
;; percentage of the capships score when someone scores a kill
$Percentage Awarded For Capship Assist: 0.1, 0.2, 0.35, 0.5, 0.6
;; the amount to subtract from the player's score if they are
;; repaired by a support ship
$Repair Penalty: 10, 20, 35, 50, 60
;; time delay after bombs have been fired before they can collide
;; with other weapons (ie. be shot down)
$Delay Before Allowing Bombs to Be Shot Down: 1.5, 1.5, 1.5, 1.5, 1.5
;; Chance AI has to fire missiles at player is (value + 1) / 7 in every
;; 10 second interval
$Chance AI Has to Fire Missiles at Player: 0, 1, 2, 3, 4
;; The maximum amount of delay allowed before the AI will update its
;; aim. Applies for small ships vs small ships
$Max Aim Update Delay: 0, 0, 0, 0, 0
;; The maximum amount of delay allowed before turret AI will update its
;; aim. Applies for turrets vs small ships
$Turret Max Aim Update Delay: 0, 0, 0, 0, 0
;; Size of the player autoaim cone for each difficulty level
;; Only affects the player. If the ship has autoaim, the wider FOV value
;; will be used. Uses convergence.
$Player Autoaim FOV: 0, 0, 0, 0, 0
;; The multiplier that affects at what range LOD switching will occur.
;; NOTE THAT THIS IS NOT BY DIFFICULTY LEVEL (it's by model detail level
;; in the Options menu)
$Detail Distance Multiplier: 0.125, 0.25, 1.0, 4.0, 8.0
;; General AI-related flags. These were previously all lumped together
;; under the New AI mission flag.
;; if set, big ships can attack a beam turret that's firing on them
;; from a ship that they don't currently have targeted.
$big ships can attack beam turrets on untargeted ships: NO
;; if set, enables the new primary weapon selection method
$smart primary weapon selection: NO
;; if set, enables the new secondary weapon selection method (including
;; proper use of bomber+ missiles)
$smart secondary weapon selection: NO
;; if set, shields will devote all their charging energy to the weakest
;; quadrant(s) and not waste energy on fully-charged quadrants
;; (previously was -smart_shields on the command line)
$smart shield management: NO
;; if set, the AI will properly use brief pulses of afterburner power
;; instead of afterburning until fuel is exhausted
$smart afterburner management: NO
;; if set, allows an AI ship to switch to rapid fire for dumbfire
;; missiles
$allow rapid secondary dumbfire: NO
;; if set, causes huge turret weapons (including anti-capship beams) to
;; not target bombs
$huge turret weapons ignore bombs: NO
;; if set, removes the random turret fire delay (from .1 to .9 seconds)
;; inserted in addition to AI Fire Delay Scale
$don't insert random turret fire delay: NO
;; if set, triggers a hack to improves the accuracy of non-homing swarm
;; missiles by firing them along the turret's last fire direction
;; rather than the direction it currently faces
$hack improve non-homing swarm turret fire accuracy: NO
;; if set, shockwaves will cause damage to small ship subsystems
;; (like in FS1)
$shockwaves damage small ship subsystems: NO
;; if set, ships will not be able to engage their jump drive if their
;; navigation subsystem is damaged or destroyed
$navigation subsystem governs warpout capability: NO
;; if set, will not use a minimum speed limit for docked ships
;; (like in FS1)
$ignore lower bound for minimum speed of docked ship: NO
;; if set, will remove the increased delay when weapons are linked
$disable linked fire penalty: NO
;; if set, will not scale weapon damage according to capital/supercap
;; (like in FS1)
$disable weapon damage scaling: NO
;; if set, will add the weapon velocity to the firing ship's velocity
$use additive weapon velocity: NO
;; if set, will dampening closer to real newtonian physics
$use newtonian dampening: NO
;; if set, beam damage is counted when calculating kills and assists
$include beams for kills and assists: NO
;; if set, kills gain score based on the percentage damage the killer
;; inflicted on the dead ship
$score kills based on damage caused: NO
;; if set, kills gain score based on the percentage damage the player
;; gaining the assist inflicted on the dead ship
$score assists based on damage caused: NO
;; if set, players (rather than just their team) can gain score from
;; events in multiplayer
$allow event and goal scoring in multiplayer: NO
;; if set, the AI will properly link primaries according to
;; specified percentages of energy levels, instead of retail behavior
;; where it mistakenly linked according to absolute energy levels
$fix linked primary weapon decision bug: NO
;; if set, prevents turrets from targeting bombs beyond maximum
;; range of the weapons of the turret
$prevent turrets targeting too distant bombs: NO
;; if set, prevents turrets from trying to target subsystems beyond
;; their fov limits, also keeps the turret subsystem targeting
;; preference order intact regardless of the angle to the target
$smart subsystem targeting for turrets: NO
;; if set, heat-seeking missiles will not home in on stealth ships
;; (this mirrors the established behavior where heat-seeking missiles
;; do not home in on ships that are hidden from sensors)
$fix heat seekers homing on stealth ships bug: NO
;; allow a player to commit into a multiplayer game without primaries
$multi allow empty primaries: NO
;; allow a player to commit into a multiplayer game without secondaries
$multi allow empty secondaries: NO
;; if set, allows turrets target other weapons than bombs assuming
;; it is within allowed target priorities
$allow turrets target weapons freely: NO
;; if set forces turrets to use only the set turret fov limits and
;; ignore hard coded limits (with 'fire_down_normals' flag)
$use only single fov for turrets: NO
;; allow AI ships to dodge weapons vertically as well as horizontally
$allow vertical dodge: NO
;; If set makes beam turrets use same FOV rules as other weapons do.
;; Prevents beam from a turret from following the target beyond the
;; turret's FOV.
$force beam turrets to use normal fov: NO
;; Fixes a bug where AI class is not properly set if set in the mission
;; This should be YES if you want anything in AI.tbl to mean anything
$fix AI class bug: NO
;; TBD
$turrets ignore targets radius in range checks: NO
;; If set, the AI will NOT make extra effort to avoid ramming the player
;; during dogfights. This results in more aggressive AI.
$no extra collision avoidance vs player: NO
;; If set, the game will not check if the dying ship is a player's
;; wingman, or if the maximum number of screams have been played, or
;; even if the dying ship is on the player's team before making it give
;; a death scream
$perform fewer checks for death screams: NO
;; TBD
$advanced turret fov edge checks: NO
;; TBD
$require turrets to have target in fov: NO
;; If set, allows shield management for all ships
;; (including capships).
$all ships manage shields: NO
;; If set, ai aims using ship center instead of first gunpoint
$ai aims from ship center: NO
;; If set, allows AI fighters to link their weapons at the beginning of
;; a mission instead of imposing a delay of 30s to 120s
$allow primary link at mission start: NO
;; If set, prevents beams from instantly killing all weapons from first
;; hit, instead allows weapon hitpoints to be used instead
$allow beams to damage bombs: NO
;; TBD
$disable weapon damage scaling for player: NO
;; TBD
$countermeasures affect aspect seekers: NO
;; TBD
$ai path mode: normal
;; TBD
$no warp camera: NO
;; If set, this flag overrides the retail behavior whereby a ship
;; assigned to guard a ship in a wing will instead guard the entire wing
$ai guards specific ship in wing: NO
#End
+30
View File
@@ -0,0 +1,30 @@
#Autopilot
$Link Distance: 1000
$No Nav Selected:
+Msg: Cannot engage autopilot, no navpoint selected.
+Snd File: none
$Gliding:
+Msg: Cannot engage autopilot while gliding.
+Snd File: none
$Too Close:
+Msg: Cannot engage autopilot: waypoint too close.
+Snd File: none
$Hostiles:
+Msg: Cannot engage autopilot: hostile craft near.
+Snd File: none
$Linked:
+Msg: Autopilot Linked
+Snd File: none
$Hazard:
+Msg: Cannot engage autopilot: Hazard Near
+Snd File: none
$Support Present:
+Msg: Cannot engage autopilot: Support Ship Present
+Snd File: none
$Support Working:
+Msg: Cannot engage autopilot: Support Ship is rearming or repairing a ship
+Snd File: none
#END
+19
View File
@@ -0,0 +1,19 @@
uniform sampler2D bloomed;
uniform float bloom_intensity;
uniform int levels;
void main() { // Global constant
vec4 color_out = vec4(0.0, 0.0, 0.0, 1.0);
// Bloom
if (bloom_intensity > 0.0) {
vec3 bloom = vec3(0.0, 0.0, 0.0);
float factor = 0.0;
for (int mipmap = 0; mipmap < levels; ++mipmap) {
float scale = 1.0/exp2(float(mipmap));
factor += scale;
bloom += texture2DLod(bloomed, gl_TexCoord[0].xy, float(mipmap)).rgb * scale;
}
bloom /= factor;
color_out.rgb += bloom * bloom_intensity;
}
gl_FragColor = color_out;
}
+32
View File
@@ -0,0 +1,32 @@
uniform float texSize;
uniform float tapSize;
uniform int level;
uniform sampler2D tex;
// Gaussian Blur
// 2 passes required
void main()
{
// Echelon9 - Due to Apple not implementing array constructors in OS X's
// GLSL implementation we need to setup the arrays this way as a workaround
float BlurWeights[6];
BlurWeights[5] = 0.0402;
BlurWeights[4] = 0.0623;
BlurWeights[3] = 0.0877;
BlurWeights[2] = 0.1120;
BlurWeights[1] = 0.1297;
BlurWeights[0] = 0.1362;
vec4 sum = texture2DLod(tex, gl_TexCoord[0].xy, float(level)) * BlurWeights[0];
#ifdef PASS_0
for (int i = 1; i < 6; i++) {
sum += texture2DLod(tex, vec2(clamp(gl_TexCoord[0].x - float(i) * (texSize) * tapSize, 0.0, 1.0), gl_TexCoord[0].y), float(level)) * BlurWeights[i];
sum += texture2DLod(tex, vec2(clamp(gl_TexCoord[0].x + float(i) * (texSize) * tapSize, 0.0, 1.0), gl_TexCoord[0].y), float(level)) * BlurWeights[i];
}
#endif
#ifdef PASS_1
for (int i = 1; i < 6; i++) {
sum += texture2DLod(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y - float(i) * (texSize) * tapSize, 0.0, 1.0)), float(level)) * BlurWeights[i];
sum += texture2DLod(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y + float(i) * (texSize) * tapSize, 0.0, 1.0)), float(level)) * BlurWeights[i];
}
#endif
gl_FragColor = vec4(sum.rgb, 1.0);
}
+21
View File
@@ -0,0 +1,21 @@
uniform sampler2D tex;
const float Luminance = 0.08;
const float fMiddleGray = 0.2;
const float fWhiteCutoff = 0.4;
const float threshold = 1.0;
// High-pass filter
float luminance(vec3 color)
{
return dot(color, vec3(0.299, 0.587, 0.114));
}
void main() {
vec4 ColorOut = texture2D(tex, gl_TexCoord[0].xy);
//ColorOut *= fMiddleGray / (Luminance + 0.001);
//ColorOut *= (1.0 + (ColorOut / (fWhiteCutoff * fWhiteCutoff)));
//ColorOut -= 6.0;
//ColorOut /= (10.0 + ColorOut);
gl_FragColor.rgb = max(vec3(0.0, 0.0, 0.0), ColorOut.rgb - vec3(1.0, 1.0, 1.0));
gl_FragColor.a = 1.0;
//float luminance = luminance(ColorOut.rgb);
//gl_FragColor.rgb = luminance > threshold ? ColorOut.rgb : vec3(0.0);
}
+3
View File
@@ -0,0 +1,3 @@
#ControlConfigOverride
#End
+39
View File
@@ -0,0 +1,39 @@
/*
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
#include "globalincs/pstypes.h"
#include "def_files/def_files.h"
#include <iterator>
struct def_file
{
const char* filename;
const void* contents;
const size_t size;
};
#include "def_files/generated_def_files-generic.h"
default_file defaults_get_file(const char *filename)
{
default_file def;
auto endIter = std::end(Default_files);
for (auto iter = std::begin(Default_files); iter != endIter; ++iter)
{
if (!stricmp(iter->filename, filename))
{
def.data = iter->contents;
def.size = iter->size;
return def;
}
}
//WMC - This is really bad, because it means we have a default table missing.
Error(LOCATION, "Default table '%s' missing from executable - contact a coder.", filename);
return def;
}
+61
View File
@@ -0,0 +1,61 @@
/*
* You may not sell or otherwise commercially exploit the source or things you
* create based on the source.
*/
#include "globalincs/pstypes.h"
#include "def_files/def_files.h"
#include <iterator>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
struct def_file
{
const char* filename;
const TCHAR* resource_name;
};
def_file Default_files[] =
{
#include "def_files/generated_def_files-win32.h"
};
default_file defaults_get_file(const char *filename)
{
default_file def;
auto endIter = std::end(Default_files);
for (auto iter = std::begin(Default_files); iter != endIter; ++iter)
{
if (!stricmp(iter->filename, filename))
{
HRSRC resource = FindResource(nullptr, iter->resource_name, RT_RCDATA);
if (resource == nullptr)
{
continue;
}
HGLOBAL resHandle = LoadResource(nullptr, resource);
if (resHandle == nullptr)
{
continue;
}
def.data = LockResource(resHandle);
def.size = SizeofResource(nullptr, resource);
return def;
}
}
//WMC - This is really bad, because it means we have a default table missing.
Error(LOCATION, "Default table '%s' missing from executable - contact a coder.", filename);
def.data = nullptr;
def.data = 0;
return def;
}
@@ -11,10 +11,18 @@
#ifndef __DEF_FILES_H_
#define __DEF_FILES_H_
//Used to retrieve pointer to file data from def_files.cpp
const char *defaults_get_file(const char *filename);
#include "globalincs/pstypes.h"
//WMC -
struct default_file
{
const void* data;
size_t size;
};
//Used to retrieve pointer to file data from def_files.cpp
default_file defaults_get_file(const char *filename);
//WMC -
//There are three parts to adding a file
//:PART 1: Add variable declaration for new file
//:PART 2: Add filename of default file to Default_files[] array, along with content variable
+7
View File
@@ -0,0 +1,7 @@
void main()
{
gl_FragData[0] = vec4(0.0, 0.0, 0.0, 1.0); // color
gl_FragData[1] = vec4(0.0, 0.0, -1000000.0, 1.0); // position
gl_FragData[2] = vec4(0.0, 0.0, 0.0, 1.0); // normal
gl_FragData[3] = vec4(0.0, 0.0, 0.0, 0.0); // specular
}
Loaded 100 of 1251 files, more files were not shown because too many files have changed in this diff. Show more