If ever there were more than 100 goal targets in a mission, the old version of ai_get_goal_target_name would start corrupting memory. Rather than making a hacky workaround, this just makes it dynamic.
This code is highly inefficient (find_parent_operator() is O(n) for Num_sexp_nodes, and it runs every frame for all sexps with negative values) and should not actually be necessary. But it is useful as a debug tool, so I added some #ifdef's.
This enables the clang readability checks that I found to be sensible. I
disabled a few that would have caused a lot of unnecessary warnings in
our code.
Since the original release of FS2, internal strings have been translated to their English entries in strings.tbl but external strings have not been translated to their English entries in tstrings.tbl. It appears that string translation was universal until it was disabled via a hack, probably due to FRED idiosyncrasies (see comment in `fred_init()`), and then not re-enabled for release. PR #2343 re-enabled it, but this turned out to have undesirable side-effects since many mods used incorrect XSTR indexes for external strings.
This PR restores the previous behavior and also cleanly separates localization into translated and untranslated modes. FRED will always run in untranslated mode. FSO will run in translated mode for all languages except English, where it will run in untranslated mode UNLESS the new option `$Use tabled strings for the default language` is enabled in game_settings.tbl.
The ship goals dialog was incorrectly assigning a goal target name for every dockpoint, which could quickly cause the limit to be exceeded if the FREDder browsed a lot of dockpoints.
This also indicates a need to fix the goal target name system as the counter is never decremented. That will be in a subsequent PR.
Having recalled that other SCP folks stated pow shoud not be used to do simple squaring, I figured it might be a good idea to update the two instances I found where that was the case.
This PR adds a scripting hook which triggers when a ship begins it's departure process. It has one variable that is the ship. I have tested and it works as expected. This new hook is very useful for triggering events whenever a ship needs an alteration to it's departure methods. For example, in Fate of the Galaxy we require ships to warp out along a certain vector. This hook allows us to see when the ship is begining that depature and then break the ship's warp, order the ship to instead follow a waypoint path, and then jump out.
This PR adds a scripting hook which triggers when the pain flash is shown. It has one variable that lists what type of flash was shown, shield with `Pain_Type == 0` and hull with `Pain_Type == 1` . I have tested and it works as expected.
The sexps that activate and deactive glowmaps are very useful for ships, though previously the glowmap status was not passed to the ship's cockpit. This PR adds the ability for glowmap status to carry to this ship's cockpit (if it has one).
Previously if a ship's glowmaps were deactivated via sexp, then the glowmaps would reaactivie at the ship's final explosinos. This PR fixes that by carrying that flag into the ship explosion FX code.
This adds the capability to have a Lua script that does not need to use
our table syntax at all but instead defines the hooks by calling API
functions. This also makes it possible to add hook functions at runtime
if the script requires that.
Also clean up some unused debug stuff.
Due to code rot, the support ship hull repair code was a bit more tangled than it should have been, so I tidied it up. I also fixed a bug Sarn noticed where a support ship would think all subsystems were repaired if the hull repair rate was set to 0.
As noticed in Discord, in loop1-2 some of your wingmen have missing weapons, but as the ships are locked it's impossible for the player to modify them. These ships should not be part of the check.
This is a pretty easy fix; sorry it took seven years!
Instead of firing an Int3() when a ship has no arrival paths, just log it and continue. And change the upstream warnings, which should have been more visible, from WarningEx to Warning.
Certain mods provide their own tstrings.tbl, but this runs into trouble when you localize data meant for one mod using a tstrings.tbl meant for another mod. See the Mantis ticket:
http://scp.indiegames.us/mantis/view.php?id=2942
and also the HLP post:
http://www.hard-light.net/forums/index.php?topic=85041.msg1716600#msg1716600
This PR adds an optional flag that will check the untranslated string against the "default language" translated string. The two strings should be identical. If they aren't, the code assumes there is a tstrings.tbl mismatch.
I modified the mission listing code to enable this check when localizing mission info (titles and descriptions), and to avoid adding the mission to the list if there is a mismatch. Fortunately, I think mission listing is the only place where this bug is likely to happen.
Currently `$Closeup_Pos:` and `$Closeup_Zoom:` control the camera zoom and position values for the techroom, briefing and HUD Target Box. Unfortunately, with very large ships this results in an issue, to fit the view of an entire big ship in the HUD Target Box the zoom and position must be set a certain way which results in the ship looking very far away when viewed in the techroom. This PR adds two new fields that control camera postion and zoom but only for the HUD Target Box, thus modders can now set values for both and have the ships look good in both the Techroom and HUD Target Box. The new hud target box values are optional, and if not specifed they default to the values for `$Closeup_Pos:` and `$Closeup_Zoom:` .
From the comments:
// Do some checks to see if we are actually going to play this message at all. These checks have been moved above the
// "if ( Num_messages_playing )" block because we don't want to cancel an existing message if we have nothing to replace it with.
Additionally, by not incrementing `Num_playing_messages` if the code skips to `all_done`, this prevents messages that aren't playing from delaying messages in the queue that are actually valid and should play.
This adds an ai_profiles flag that checks comm systems for non-player ships. If their comm system is damaged, they will not send messages and you will not be able to issue squadmsg orders.
See also:
http://scp.indiegames.us/mantis/view.php?id=1947
This updates #2299 and restores the use of `event_music_level_start(-1)` in `freespace.cpp`. This call was removed in #2299 because it was thought to be redundant but removal of that call resulted in music not playing upon mission restarts. This PR restores that call and fixes that issue.
This is in response to Mantis 1424:
http://scp.indiegames.us/mantis/view.php?id=1424
Since retail, the hotkey lists have been determined based on what attacks the player. Mod makers may want to change this, so this PR adds the following options:
Default - retail behavior
Friendly/Enemy (or Hostile) - display in the specified list regardless of who attacks whom
None - don't display in the hotkey list at all
This PR also slightly cleans up the hotkey list function with a small optimization and a few tweaky fixes for edge cases.
This adds the titular feature, as well as FRED support. There are also some associated minor UI fixes in FRED and some cleanup in missiongoals.cpp. And "Event Flags" are now a thing in case we want to add any other flags in the future.
Ships which do not have the maximum number of primary and secondary banks (3 and 4) will have gaps in the loadout slots, so be sure to only check the weapon slots that the ship class is actually equipped with.
Yet another obscure edge case from Aftermath: Reboot. The FREDder ought not to create this situation in the first place, but if he does, don't enter an endless loop.
In the SEXP parser, zero-length strings are valid, as are zero-length operators. But zero-length numbers are interpreted as missing arguments, since their only syntactic separators are spaces and the parser skips over whitespace. And in any case, zero-length numbers are not semantically valid anyway. This PR adds a sanity check to intercept all zero-length numbers, as well as malformed numbers, and convert them to 0.
This fixes issue #2314.
There is a special function, `hud_find_target_distance`, which is used in most places for target distance. However it wasn't used for jump nodes in this location.
Incidentally, the player's target's distance is cached, and this distance will always be current for the target box, so we can use the cached value and save a function call.
This moves towards defining the hooks in the code module that executes
them. Also provides the API necessary for better documentation of hooks.
This only covers a few hooks as a test and demonstration of the new API.
If no issues are found with this it can be extended in the future.
This is the best way to address Mantis 2715. I took a look at allowing empty banks in the course of working on PR #2318, and it was completely intractable. But in order to prevent certain "funnies" such as violation of bank restrictions, it's a good idea to ensure all banks are populated.
This PR adds a new XSTR for a popup message, and incidentally adds another XSTR to a message that should have had one already but didn't.
If ships have less than their full allocation of weapons, the code is supposed to compact the array so that these weapons all appear at the beginning. This is done for small ships (fighters and bombers), but was not done for capital ships. There was also a lot of code duplication with small ships getting extra error checking than capital ships. This commit removes the duplicate code, makes the error checking more robust, and incidentally fixes the weapon array compacting for capital ships.
Although not used very often, ai_info.target_signature should be set to -1 whenever no target is specified, just like everywhere else to make sure that the code is as predictable as possible.
(Found while trying to figure out why the heck would the Object update packet send this at all??)
This PR refactors the function's name to something more indicative of what it actually does, and removes a call made to it from within freespace.cpp which, due to changes in how the soundtrack system works, is now redundant and doesn't actually do anything anymore.
The sound was passed the data from before the resampling took place so
it though it would be playing a stereo sound and rightly cause an
assertion. This fixes that by refreshing the properties after appliying
the resampling properties.
PR #1514 made this change to avoid having to constantly update fred.rc with new FSO versions, but it was inadvertently reverted in commit 9ac97f24223a7446d4364acfdb451c90697d6577; this also reverts PR #2286, since that's a somewhat more hackish solution to the same problem.
This does some refactoring to make it possible to cimpile and run FSO
without needing to link to FFmpeg. Since that eliminates support for
cutscenes or sound this is mostly useful for running a standalone server
which has no need for this anyway.
This reduces the image size of the standalone Docker image to only 20MB
and also resolves any licensing issues that might have existed.
The standalone did not initialize SDL and so did not receive the quit
signal when it was sent SIGTERM or SIGINT. This fixes that by making the
standalone server just use the normal os initialization code.
Also includes some other code cleanup and some more logging to make it
more apparent in the log what is currently happening at standalone
startup.
This adds a Dockerfile which compiles FSO for the alpine Linux
distribution and then creates a standalone image based on those
binaries. That sidesteps the problem that existed with trying to use the
AppImage binaries on that distribution.
This produces a much smaller image (78MB instead of 230MB) so it should
be a bit more managable. Building can be done like this:
docker build --build-arg build_type=FastDebug -t scpfs2open/fso-standalone -f docker/standalone/Dockerfile .
This mostly meant for special docker standalone server builds where it
might be useful to have full release performance but also have the logs
available if necessary. This now always compiles the log statements but
enables or disables them with a constexpr so they should not appear in
actual release binaries.
This will provide a proper error message when such a function is called
that will mention the name of the function and that it is deprecated and
cannot be used anymore in the targetted engine version.
This will make it easier to get logs from FSO running in a docker
container since logging to stdout is the easiest solution there.
Also includes some other changes that will make this work better in
Docker containers.
If anything less than or equal to 0 was specified it would trigger some
kind of an assert in the standard library since that is not a valid
value for a normal distribution. Now a parse warning is generated and a
safe default value is used.
This fixes#2269.
This adds a new graphics type for the Vulkan graphics API. All this does
is to create a vulkan instance and a presentation surface with the help
of SDL.
The largest new feature is that it is now possible to include other
files into the RML by using the "include" tag. This is useful for making
markup files more modular.
Also added some more options for existing things (e.g. built-in detail
options).
This elimiates all of the remaining "old style" uniforms from our
shaders. This might not be optimal for all situations but I have
confirmed that it is at least not worse at the moment.
This is a generic way to get matrix data to shaders without using
(old-school) uniforms. This is another step towards more compatibility
with how new APIs (Vulkan) do things to increase the odds for a Vulkan
port at some point.
It seems that when RTT for cockpits was added that the scaling of ships in the target box fell through the cracks. Properly specifying the `clip_aspect` fixes the issue. This PR fixes issue #2250.
Weapon names with a `#` should not display text after that `#` in the HUD. For the most part this works, but there were a few cases this didn't (such as primaries using the weapon name). This PR fixes two spots that fell between the cracks.
Previously, Engine Wash Intensity didn't actually do anything in the code. This adds a game table setting that let's modders specify to the game to actually take the intensity value into account when calculating engine wash effects.
For some reason my repro had some critical issues and I was unable to comitt to the PR #2210. I have closed that PR and opened this one given the discussion in #2210. The result of that discussion was `but omit line 594`. That is what this PR does.
Three main changes in this PR:
1) The enums for the "easy settings" launcher options are now clearer and more explicit, and the enum assignments for a lot of graphics options are now fixed, as they were incorrect due to code rot.
2) Some of the command-line flags options have been recategorized: -window, -fullscreen_window, -nomotiondebris and -noscalevid are now Gameplay; and -fps is now HUD.
3) Since post-processing is required for nebula fading, it now defaults to on, and the flag has been changed to -no_post_process.
Persistent buffer mapping is an OpenGL technique where the contents of a
buffer object are mapped to a persistent pointer instead of having to
map and unmap a buffer every time it is modified.
This decreases the overhead for updating data in a uniform buffer object
which now only consists of a memcpy and a flush call.
This is in preparation for using persistently mapped buffers for uniform
buffers. Since that functionality is not available in the OpenGL version
we are targetting I implemented a fall-back which simply uses
glBufferSubData.
I did a benchmark with these changes and there was no change in
performance to the current master version.
error_display shows the line where the error was detected. Warning
itself is pretty useless for parsing related errors so I replaced all
Warnings (where appropriate) with an equivalent error_display.
Does this by refactoring how the timing is calculated. It also removes the Next Arrival Time Array, which does not actually do a good job of calculating it, anyway. We can now rely on the other oo_arrive_time arrays exclusively by subtracting from current time.
Squashed Commits:
1. Use function to pull FrametimeOverall to keep from breaking Fred.
2. Remove unsed parameter from multi_oo_calc_interp_splines
3. And also fix the corresponding declarations and functions calls.
In aiturret.cpp there is a mprintf, `mprintf(("nothing ok to fire\n"));` which greatly pollutes the debug log in missions with turreted ships. I'm not sure what this message helps debug, thus I propose commenting it out.
Previously, using max and min delays resulted in guns firing that were not within the specified range. This PR fixes that while also simplfying the code. `frand_range` is already using in each of those functions so I figured it would be fine to use it and also simplify the code. That, instead of `next_fire_delay = (((float)rand()) / (((float)RAND_MAX + 1.0f) * (winfo_p->max_delay - winfo_p->min_delay + 1.0f) + winfo_p->min_delay))`.
These function have been around since retail. What they were supposed to do was allow the V team to get a baseline of how much data object updating would use without the limiting system.
However, the way that multi_rate_add work, is that they say to the limting system, "The client is getting a lot of data, so limit it some more." And that eventually causes debug build object updates to slow to a crawl.
This PR tidies up the comments in the initial velocity setting, properly sets the player's throttle, and cleans up issues with initial velocity setting and hyperspace warpin types.
Note the removed code block for hyperspace warpin ending was removed becuase it is not needed, as physics calculatios already handles that. Also the calculations that were there did not properly account for initial ship velocity setting.
A few early on descriptions in this file are inconsistent or even plain wrong. This should correct that.
Also, rename vm_vec_imag() to vm_vec_inv_mag_quick() to better describe what it is.
It turns out that the code that set initial ship velocities did not account for local ship rotation changes. This bug is only noticeable when ships are very high speeds, high initial velocities, and have high drift values thus it was never recognized before. This PR fixes that by ensuring that the velocity vectors are set appropriately. As discussed with Goober on Discord, this fixed behaviour is indistingushable when using FS ships and most mods, this the behavipur will be on by default.
This was previously using the wrong direction of the conversion so it
produced wrong values. This should fix that and should hopefully bring
the nebula experience back to how it is supposed to look.
When the `+Max Delay:` and `+Min Delay` for `Fire Wait` were added they were only added to primary firing and not turret firing. Specifically, `turret_set_next_fire_timestamp` uses only `winfo_p->fire_wait` while `ship_fire_primary` uses the delays. Checking with the original author DahBlount they specified it was an oversight, thus this PR fixes that and allows the delays to now work properly with turret firerates.
Overview: This PR restores all expected functionalility of the 3D weapon select flag while also providing modders with a way to use both 3D models and custom weapon icons.
PR #2055 provided a way for modders to use 3D weapons while still using specified weapon icons. Unfortunately that resulted in weapon icons not changing to an image of the 3D model when the 3d weapon selection flag was used. It was requested on the forum that this behaviour be restored. This PR restores that behaviour while still allowing modders to use 3D weapon models and their own weapon icons. Instead of the approach taken in PR #2055, this PR will automatically show a 3D weapon model if there is not weapon animation specified and if a weapon tech model is specified. Thus, if a modder wants to use their custom weapon icon but also have a 3D weapon model shown, they simply do not specify a model animation but do specify a tech model for the weapon (the 3d weapon selection flag does not need to be checked). If the 3d weapon selection flag is checked then the 3D weapon model will of course still be used, but the weapon icons will now show the image of the 3D model instead of any custom weapon icons the modder specified. In other words, the flag acts exactly as expected for the player.
I also tested this for each case and it works as desribed above.
Should fix rare multi crash where reserving net signatures for spawened munitions would cause an ushort overflow, triggering an assert in multi_set_network_signature.
Turns out we can just remove the assert, and just guarantee that signature is going to be in the required range.
Squash history:
1. Improve Assertions (as per Taylor's suggestion) and reconfigure Int3
2. Wording change on last assertion
Any server build created this year will crash any client connected to it because it will send a packet cotaining hull updating information, but accidentally unset the flag for new hull info. The client was therefore unaligned with the packet, causing the local subsystem_update array to go bonkers.
Removes about half of the Int3()'s in multiutil.cpp by making Assertions more robust, changing two functions to void type (because there was no way to get an error value from them, anyway), and adding two Verify()'s in case we ever decide to start using the multi variable change functions.
Squash History:
1) Forgot to change one Assert to Assertion
2) Change Verify to Assertion, because of better argument support.
3) Fix a couple copy paste errors
Just a quick PR to make multiutil slightly more readable by removing one unused function (whose functionality is already in the object update packet), two globals which we only increment and we do nothing with, and some defines that have been commented out because the size returned can actually vary.
several of the bitwise manipulations on signed integers are technically undefined behaviour.
I made the internal variables unsigned and the results are then converted to signed ints as before.
This should not actually change any observable results.
Did some cleanup as well, while I was at it.
This fixes string comparison of ship names in multi. Any respawned ship would be given a default name and would return false for any future name comparison.
The most visible affect of this was being given the default loadout and fighter on respawn instead of the fighter and weapons you selected, but Taylor was spotting a lot of potential other break points as he looked through other unrelated multi issues on mantis.
Squash History:
1) Fix comments and warning to be clearer.
2) Replace NULL with nullptr
Intent probably was to empty the vectors and not check for state empty.
This was most likely a bug, which was called by the no_discard attribute on the function.
Previously deprecated enum for hasViewmode() lua function didn't have a warning. This fixes that.
Also, I am adding a check to ignore it while writing scripting.hmtl.
This PR allows modders/FREDers to actually see what default controls available are in FRED and not the hard coded ones from `Control_config` that may not be relevant for their mod. For example, a mod may disable many controls and change the default key for many controls in the table, but that is not reflected in FRED since FRED simply checks the hard coded ones from `Control_config`.
Example:
Previously, if the modder specifies a default key for, say, `Enter Subspace (End Mission)` as `Enter` instead of `Alt-J` in `Controlconfigdefaults.tbl` then the game will only look for if `Enter` was pressed, whereas the `key-pressed` tree in FRED will not show that and will still show `Alt-J`. Then if the FREDer uses `Alt-J` it won't ever actually trigger in-game since the control table has switched it to `Enter`. This PR would allow FRED to properly show `Enter` instead of `Alt-J` in the sexp tree for `key-pressed`.
Background:
1) Game reads the hardcoded values for each key and saves in `Control_config`
2) Game parses `Controlconfigdefaults.tbl` and updates the default keys in `Control_config` with any that are specified in that table.
3) Now the key defaults have been changed, and when `key-pressed` is called it searches for it's argument in the updated `Control_config` array, but only searches for the default. Thus even if the player changed the key, it will still find it and properly convert it.
All of that works well and as expected. But FRED never goes beyond step 1, so when FREDing I don't use the drop down tree for `key-pressed` since it doesn't actually match what the game will know when it parses `Controlconfigdefaults.tbl` in step 2.
This expands the functionality of the cusotm controls to work with rebindings when using the sexp `key-pressed`. A key default value must be specified in `controlsconfigcommon.cpp` for the sexp `key-pressed` to track key binding changes. This PR adds that functionality by assigning default keys that were not in use (alt shift 1-5).
According to the CreateProcess() documentation, passing NULL in the eighth argument starts a process in the same directory as the original process, which is what we're trying to do.
Please note this is a Windows only solution, and cannot be ported to QTFred
Addresses 1775, already tested on Release and Debug
A quick update that should allow for the FPS gauge to be hidden together with the rest of the HUD. Sounds useful for anyone wanting to take clean screenshots.
Also, thanks @wookiejedi for showing me how to do this.
(Will that even work? that's my first real meeting with GitHub so I'm a bit anxious.)
Many mods and scripts use custom features that are triggered by key press. Currently, those keypresses cannot be changed by the player. I want to add 5 controls that do nothing and thus can be used for scripts/modding purposes. This way the modder could add new features/controls easily and have them show up in the controls menu and be bindable. As opposed to using a script which triggers via a keypress, and that keypress cannot be changed by the player in game (and may be bound to another control).
Also, Axem has expressed he would find this feature and Fate of the Galaxy certainly will.
This PR adds functionality to `Has Xstr:` in `controlconfiguredefaults.tbl`. Previously this value was use as a boolean, 0 or 1 to specify if the string should be used. This PR treats that field as an integer, and thus allows modders to specify which string to use for the control. If the value is 0 (default) then the string is not used, if the value is 1 then the defautl string is used and if the value is greater then 1 the game will use that specified index in strings.tbl.
This allows modders to properly translate all control names. Specifially, six controls overlaped with pre-existing string.tbl indexes adn thus could not be translated properly. These are VIEW_TOPDOWN, VIEW_TRACK_TARGET, AUTO_PILOT_TOGGLE, NAV_CYCLE, TOGGLE_GLIDING, and CYCLE_PRIMARY_WEAPON_SEQUENCE.
This PR will allow modders to now proerly have full control name translations. It also provides a fix for issue #1629.
Fixes the following:
1. Crash from creating an icon from a jumpnode
2. Crash from creating an icon from a waypoint
3. Waypoint would become a jumpnode icon in briefing screen.
This line is the cause:
iconp->ship_class = (int)std::distance(Ship_info.cbegin(), it);
The main purpose of this commit is to change iconp to biconp, like the rest of the function uses.
The other change is how it checks for a jumpnode so that it is only true if there *is* a jumpnode.
Per dicussion on Discord and and Github, `set-object-position` does not work properly and the fix would involve making it act the same way as `ship-maneuver`. With discussions with Goober (who originally made it), we have decided to deprecate the sexp. I have talked with folks who have used it thus I am not removing it from FRED with this PR but I am open to discussion on that point.
If you modified an existing ship type without using +nocreate, it would both modify it and add it to the vector again, leading to (at the very least) wasted memory. I copied over some more standard behavior from other parsing functions to hopefully avoid problems with modular objecttypes.
Previosuly, subsystem brackets in the target ship gauge were not always drawn in the correct location when using RTT with the gauge. This PR fixes that.
First one is to allow MinGW failures since that is unreliable at the
moment. Second one is a fix for the regex used by clang-tidy so that it
doesn't try to analyze CMake files.
Free look will now move in the same directions as ship controls, whether pitch or yaw, and whether using keyboard or mouse/joystick.
Also, remove an inaccurate comment, and add a clarifying one.
The Z coordinate, from negative to positive, means "front to back", so a Z value of 1.0 (with relative playback, which is what 2D sounds use) means "as far back as possible", i.e. the rear speakers. It's hard to know if this was intentional or not, but feedback from an actual user with a surround setup is that the opposite is preferable.
There are now three states for cutscenes: always viewable, where they will appear no matter what; never viewable, where they will never appear; and viewable, which can be modified during the campaign. Currently cutscenes will go from not-viewable to viewable, but organizing the flags this way will allow a future feature to make cutscenes not-viewable, if that is desired.
There's also a small edit to csv_convert to guard against array overflows. Not directly related to the feature but it's in the same place and affects the same code.
Sanity checking for repeat counts shouldn't crash the game, so change from Error to Warning and use a sensible default. Also copy the check (with minor modification) to also check trigger counts.
The `On Goals Cleared` scripting hook would result in FRED not working, thus this PR adds a check for scripting state to the hook and will only run if the scripting state is active. Now FRED will run proprerly.
This adds JSON as an additional scripting documentation output format.
This can be used by external tools to examine the scripting
documentation and generate interface declarations or documentation for
any language. The existing documentation code is left largely in place.
Set-secondary-weapon and set-secondary-ammo have been up to know been allowed to exceed tabled cargo sizes, as long as you didn't put a value for requested_ammo in the sexp.
The limits would be inherited from the last secondary weapon in the slot, definitely not idea behavior.
Now includes matching changes to set-primary-ammo
It turns out that `angles_2_matrix ` would return a pitch value that was not the actual pitch from the 3x3 matrix. The pitch line in the code is uses a modifed `cosp` as the demoninator to calculate the pitch angle. I looked up online what the caclulation should be and found a more accurate way than using the modifed cosp, is to use ( fvec.xyz.x^2 + fvec.xyz.z^2 )^0.5 I tested using the new calculation throughouly and in each test it returned the proper pitch value from the 3x3 orientation matrix.
This is a follow-up to #1450, based on feedback and preference. Instead of always resetting campaign progress, just switch to the campaign. The player can then explore the tech room database or the finished missions if he chooses.
This also fixes a few bugs:
1) Ever since the tech-database-reset feature was introduced in 2003 or so, the game incorrectly checked the campaign being unselected, not the campaign being selected. This is now obsolete since neither the tech database nor the campaign progress are reset.
2) Not all campaign loading failure types were recorded in `mission_load_campaign`.
The default fade argument is `true`, as specified by the sexp help, not false. This probably doesn't matter here as the multi packet should receive all sexp arguments anyway, but better to be consistent.
Adds 'On Goals Cleared' hook variable for scripting system. Previosly there was not scripting or sexp method to determine if a ship had all of it's goals cleared.
Originall the scripting hook `On Waypoints Done` only provided the ship or wing. This PR adds the waypoint path that was completed as an additional hook variable.
We didn't realize that Gauge_load_common had some assumptions about where Origin: and Offset: are, so we accidentally broke custom radars. Moving this section up forces modders to have an odd order for their entries, but based on the way the code was written, there really doesn't seem to be another choice.
This commit disables emissive lighting on objects by default (as the new HDR process makes it unnecessary) and switches the -no-emissive commandline parameter to -emissive; Setting that parameter will restore the old behaviour. The -no-emissive parameter is retained to avoid user-facing error messages.
In addition, this commit sets the default bloom value to 25.
This should fix#1886. I built it and it fixes the immediate problem.
Only two of the documentation files we have in the codebase were actually updated.
Verison name in prebuilt.cmake also needed to be changed due to prebuild SDL version changing during upgrade to the prebuild repository.
Part of modernizing the code base, Travis, at least, prefers defaults to be in the class definition instead of having multiple constructor functions have the same default values.
Allows jump nodes to use instrinsic/dumb rotation again by exposing the jump node class to the model instancing code and adding a check for it in modelread.
Unique pointers need to be constructed in very particular ways, but so did this NGON radar class, so we just had to put the constructor function inside unique pointer constructor.
And to keep that special pointer from going out of scope, we switched to the ternery operator.
Also made these changes:
Change to hypotf()
Fix Shadowing, Zero Vector macro not working at all.
Offset changed to offset_incoming
blip changed to blip_instance
Offset changed to = {} to initialize the struct without a problem.
clampBlip() required an override
Give offset a default initializer.
Switch to <cmath>
(Apparently <math.h> was deprecated and needs to be replaced with <cmath>.)
One last complaint from travis about a redundant default value.
Thank you Travis!
* Modders can specify how many sides the radar can have (as few as 3) with "Ngon Sides:" and can also define an optional twist angle with "Ngon Offset:".
* Also refactors the standard radar code a bit
Covertity is complaining about portions of the verts array being uninitialized, so this is just a quick change to initialize the array first before doing anything else.
These coverity issues are all caused by the same code being copy and pasted in three different places.
There does not seem to be danger of the negative array access, but the changes that "fix" it are also slight optimizations (assuming the compiler hasn't been catching them).
In short, I am basically just moving code around to avoid duiplicate checks and in other places checking for the negative array index explicitly.
Suggested style corrections now included.
This uses clangs LibTooling for parsing the FSO source files to ASTs
which can then be used for extracing the strings used in XSTR calls.
This supports both standard XSTR calls and UI_XSTR definitions and
writes the resulting information in the strings.tbl format to stdout.
It also detects duplicate translation id usages with different text
values.
Although not technically a bug, several mods have been misled by the description of the "$Rearm Rate:" weapons table setting, and specifying an initial ammo value that is less than 100 for ballistic primaries would force the ballistic ammo to be loaded all at once, with "$Rearm Rate:" just specifying how long that one load would take.
This allows modders to use more realistic behavior for things like anti-turret ballistic primaries, where initial ammo could be in the thirties so that any number above zero can be added per load.
Since the Lua state is destroyed before all the object events, this was
causing issues. This should fix that by clearing the events when the lua
state is destroyed.
Since FSO does not support Unicode characters in filesystem paths on
Windows yet, it is necessary to catch these issues early on and display
an appropriate error message. These changes do that by going through the
path with our UTF-8 decoder and detecting any characters that are out of
the ASCII range.
Enhances play-sound-from-file, etc. to allow more than one audio stream to be played at the same time, provided all stream are referenced by audio handles contained in variables.
The intent behind this sort (added in #2094) was to make the order of files returned by the filesystem consistent across platforms; however, the sort occurred not only after the filesystem search, but after the packfile search, which changed the order files load in on all filesystems instead of making it consistent. This moves the sort to be after the filesystem search but before the packfile search, hopefully making load order consistent once more.
When loading a .plr file, HUD_config.rp_dist is loaded and then sanity-checked; if the value is out of bounds, a Warning is generated and RR_INFINITY assigned. HUD_config.rp_dist is also loaded when loading a .csg file, however the sanity check isn't present; this copies the block over so the behavior is identical.
This bug has been around since the original public source code release!
The error message character calculation did not agree with the actual error check. This PR fixes that. Thanks to Novachen on Discord for discovering this.
The grant-medal and was-medal-granted sexps will now translate medal names, in the same way that tech-add-intel-xstr translates intel entries. There is also some minor cleanup and the specifying of correct default -1 numbers for the xstr-capable sexps.
When running a mod on non-windows, that isn't packed into VP files, the
mod can break when loading. On non-windows filesystems, the file
order isn't guaranteed to be alphabetical (but it is on Windows).
As a result, we load tables in an effectively random order.
Lots of mods rely on the filesystem ordering to e.g. implement a very
loose dependency system for their lua scripts.
Referenced on the forum here:
https://www.hard-light.net/forums/index.php?topic=95750.msg1885275#msg1885275
Here's a log from Solaris failing to run:
https://fsnebula.org/log/5d7b4414cb0d332b466b5ee2#True-138
Instead, always sort filesystem listing by name *before* applying the
provided sort order.
I've built a few different versions of this patch, and like this one the
best. The other ones I tried:
1. Adding a `CF_SORT_REVERSE_NAME` and using it everywhere that
`CF_SORT_REVERSE` is used, and replacing all uses of `CF_SORT_NONE` with
`CF_SORT_NAME`. I didn't like this as it was a much larger diff.
2. Adding a `CF_SORT_REVERSE_NAME` to the `scripting.cpp` call for
loading tables. I didn't like this one because this bug can in theory
impact non scripting tables.
Here's a log from Solaris working with the new build:
https://fsnebula.org/log/5d7b4f37cb0d332b3d6b5ed3#True-138
While it might be a reasonable enhancement in the future to build a proper dependency system for lua scripts and tables,
this is a much smaller and easier change, and doesn't require any work from modders.
As per the discussion in https://github.com/scp-fs2open/fs2open.github.com/issues/2092,
if you specify the turn time, these can behave quite weirdly.
Some mods that we don't want to break backwards compatability with use
that mode, but at least we can note the pitfalls in help.
Not sure why we didn't catch this earlier but this should hopefully fix
the crash. The cause was that we constructed an SCP_string from a null
pointer instead of using the empty string as the default.
This will write Mini dumps in the event that the executable causes a
crash. This will allow us to take a closer look at any crashes without
having to reproduce them.
This re-implements the eval_nums function to use C varargs, instead of C++11 template parameter packs. This is necessary because Visual Studio has a bug where template parameter packs corrupt heap memory somehow.
"Cloning" failure was actually being caused by the pilot verification function resetting all pilot info and then not loading controls from the file to replace them.
The Control_Config array would all be set to -1 and then would get written into the file the next time the player was saved, making it seem that the controls were not being copied.
The original and current code would reset controls to defaults when a pilot was created. And it would just let the old controls remain in case of a clone. The above problem would occur just as you hit accept on the bottom of the baracks screen.
Original behavior in Fred was accidentally removed when upgrading the FSO mission parser to keep it from crashing FSO from a bad sexp. But returning false is only necessary in FSO since in FRED, we can fix the error once we know about it.
NaN should propagate through the SEXP tree, but not all SEXPs do this properly. The problem was made worse after I introducted `eval_num()` which silently ignored NaN values. This commit adds new boolean arguments to `eval_num()` to flag NaN results, and changes all calls of `eval_num()` to properly handle the new arguments. Additionally, this adds `eval_nums()` and `eval_array()` functions to more smoothly handle cases where many numbers appear in a row.
Extremely rare bug caused by use of multiple protect from weapon flags. One of the Ai-Turret functions was setting only one of the flags because "else if" was typed instead of "if".
Lab_selected_index must remain unchanged until labviewer_change_model is
called. There the variable is used to determine if a new ship must be
created and updated afterwards.
Coverity spotted this dead code. Looks like the original coder forgot that they had checked for !p already or was a case of mindless copy-pasting code..
Because of
pcode = strchr(p,' ')+1;
it looks like it really is safe to remove.
This allows to mark certain functions or virtvars to be declared as
"deprecated" starting with a specific engine version. What this means is
that a special message will be added to the documentation stating since
when the function is deprecated and can contain an optional message. The
actual enforcement of the deprecation depends on the target version of
the mod so that we can stay backwards compatible.
If the mod supports the version since when the function is deprecated,
it will not be added to the Lua state which means that it doesn't exist
for the calling script. If the targetted version is before the stated
version, the function will still be added to the Lua state.
As the first function to use this feature, I have deprecated
createParticle in the testing library and moved it to the graphics
library with a new name reflecting that it creates a persistent
particle. I also added the corresponding function for adding a
non-persistent particle.
Previously if the 3D_weapon flag was used it would always create a weapon icon and overrride any pre-existing icons the modder would specify. This PR fixes that by adding an extra set of conditionals, which specify if a weapon has an icon file name then it should be used, and if the weapon does not have an `$Anim:` but does have a model then that model should be used if the 3D_weapon flag is enabled.
This PR adds a table entry that allows modders to specify the RGBI values for the damage and emp arc colors (which were previosuly hardcoded).
This option adds the table entry to `Game_settings.tbl` under `#Graphic Settings` with the lines:
```
$EMP Arc Color:
+Primary Color Option 1: rgb
+Primary Color Option 2: rgb
+Secondary Color Option 1: rgb
$Damage Arc Color:
+Primary Color Option 1: rgb
+Primary Color Option 2: rgb
+Secondary Color Option 1: rgb
```
This PR allows modders to set, on a per-ship class basis, the fields for what hull and shiled integrity the AI wingmen send the "Help" message at. One good use case is when ships have low hitpoints, thus now the modder can set AI can call for help sooner then at simply 30% hull.
In single-player, or while running as a server, sexp_deal_with_ship_flag() makes sure that object_flag, ship_flag, and p_object_flag aren't NUM_VALUES (i.e. not set) before trying to call flags.set() with them. However, the client code in multi_sexp_deal_with_ship_flag() had no such security checks, and as such would try to set NUM_VALUES, which is outside the range of valid flags; this led to a crash in Release builds and an Assertion otherwise.
Current the AI always selects capital+ weapons vs big/huge ships. This
makes the AI take shields into accounts, and not use the weapon if
either the shields are still up, or the weapon isn't good vs shields.
I don't greatly like the magic number 1.33 to determine if a weapon is
good vs shields, I'm happy to take alternative suggestions. I have
checked DE, WoD & BP tables and I don't think this change will affect
any of them (picked them because their either use capital+ weapons or
have shielded capships)
There's one DE weapon that the AI won't select anymore while shields
are up; however its fluff says it's bad vs shields and suggests a
paired shield-breaker so think it should be OK.
This PR adds a sexp that returns the integer value of a ship or wing hotkey. No hotkey returns -1, F5 returns 0, F6 returns 1, ... and the sexp takes one arguemnt, the ship or wing name.
This new sexp allows a FREDer to set a hotkey for a ship or wing. The sexp takes 2 or more arguemnts, the integer of the hotkey to set (F5=0, F6=1, ... F12=7) and the names of the ship(s) and/or wing(s).
Implements the feature request from issue #610.
As an aside, this PR also patches the `ship_set_subsystem_strength` function (which is only used by the debug console and in the event you fire at your training instructor) to use the same code as the `set-subystem-strength` sexp. This properly handles submodels blown off, sounds, etc.
Previosuly, flyby sounds were only specified on a per-species basis. This PR allows each ship class to use a specific flyby sound. This will allow modders to set the custom sound in ships.tbl, just like any other per-class sound.
Making wp_list null lets ai_mission_goal_achievable reset the waypoints
list correctly, otherwise it thinks the waypoints are ok when in fact
something has invalidated them
This allows modders to restrict the amount of rotation in a death roll.
It's fairly simple to fit in with the existing code which has a lot of
hard coded constants. The intended use case is to restrict pitch &
heading changes so there's less chance of rapid forward rolls or flat
spins, especially with faster-than-FS2 ships.
I'd almost rather rewrite the entire code to dynamically use ships mass
& velocity except for retail compatibility issues.
Every g3_start_frame must have a matching g3_end_frame. Thus, a return
in the middle of a function after an opening g3_start_frame must make
sure to call g3_end_frame before it leaves to avoid a dangling frame
context.
As described in the bug report at
https://github.com/scp-fs2open/fs2open.github.com/issues/1827
a floating point rounding issue could be the trigger for the problem.
A bit of small cleanups in preparation of larger scale refactoring.
remove unused member heavy_collision_cm_pos of collision info struct,
which was set in several places but never used.
This provides a cleaner fix for the bug where using show ship caused detail_box calculations to incorrectly work on the player's ship.
It also reverts the changes made by PR #2018.
This PR fixes issue #2015, which is a bug where using `show ship` caused detail_box calculations to incorrectly use world coordinates for submodels on the player's ship, rather then the correct local coordinates.
Allows subspace strikes to choose which fireball to use for the warp effect. If absent, FIREBALL_WARP is used as the default (which was the previous hardcoded behavior).
"+WarpEffect:" can be specified as either an index or using the fireball's unique ID.
Add a submodel property that overrides the hard-coded distance
multipliers applied to the distances at which details boxes & spheres
are rendered. The distance multipliers are set by the "model detail"
setting in the options screen. Note that this is different to the LOD
distance multipliers which are not hard-coded.
This allows some more creative uses of detail boxes & spheres, e.g. to
stop models subobjects from being rendered when they're out of player
view. Past testing showed a reasonable performance improvement with
complicated models.
This is a submodel property rather than global, or a ship flag, to allow
flexibility, i.e. a single model could choose this option only for the
submodels that want to use detail boxes/spheres in this fashion, which
other detail boxes/spheres use the conventional approach.
Code & ideas originally from zookeeper, I've just packaged it up for
the PR.
This has been rebased & squashed based on feedback in the PR
Fixes a minor bug that incorrectly draws Rectangles to a scripted HUD gauge. The third and fourht arguments needed to be width and heigth, not x2 and y2.
This adds the following functions to the scripted gauge API: drawCircle, drawRect, and drawLine. Also note that I created an additional function, for HUDGauge:renderCircle_unfilled, becuase the precedent shown by having two functions for `gr_unfilled_circle` and `gr_circle` and adding a fourth argument to `renderCircle` seemed to affect a lot of other functions.
This commit adds new id for existing strings, so that they are translateable through the strings.tbl.
The following is translateable now:
- The 'or' seperator in the Keypress Directive gauge, if one function is bound to two keys.
- The Supernova warning.
- The error message that is displayed prior the pilot selection screen, if something is wrong with the loaded modification.
The new gauge can be accessed by the scripting API with which a function
can be set which will be called when this gauge is rendered. This can be
used for exposing the HUD gauge positioning and RTT options to the
scripting API without a lot of work needed for the script writer.
There is currently only one rendering function implemented since this is
only a proof of concept.
Switch from 3x specific is_arriving functions to a single with params
Change flag names; replace "ndl" with "dock_follower"
Change dock-arrival helpers to not set follower flag on leaders
This PR fixes a bug where an invalid lua font handle would not be properly returned as invalid. An invalid handle is returned properly if the font name is invalid, but not if the index is invalid, thus this PR fixes that.
The only thing a CFILE contained was a version field which isn't used
anymore so that could be removed which basically meant that CFILE was
just an indirection to a Cfile_block which I then just renamed to CFILE.
The CFILE type is an opaque handle now since the contents are not
relevant to a user of Cfile.
Currently, the player is unable to see a RTT hud gauge if in chase view. This adds an option in the hud_gauges.tbl that tells the game whether to draw a gauge based on if chase view is the active view. So for example, a modder using RTT mapped gauges can now make a HUD that displays on the interior of the ship (ie RTT with the cockpit model) and a HUD that displays when the player switches to chase view.
In this block of code, the conditions were checked with a set of four hook variables but then subsequently run with only two. This adds all four previously used variables. More importantly, it adds the hook variables with expected and user-friendly names, since 'self' and 'object' are not necessarily intuitive.
This is a system for storing arbitrary data in the config file and then
easily retrieving it later on. This has full Lua support for exposing
the available options in a custom UI and changing the values of the
options. This ported some of the existing command line options over to
the new system which is opt-in for the moment by using a mod_table flag.
This adds some auto-closing code to the scripting API of the CFile
system. If a file has to be auto-closed then an error will be displayed
to let the the script writer know that something is wrong.
This should not break existing scripts since causing file handle leaks
should never happen and if it does, this will make it easier to find
these issues.
There's a number of issues fixed here:
* Radar blips of docked ships were the wrong colour in stage 1
* You could target docked ships in stage 1
* Docked ships thrusters were visible in stage 1
* Hyperspace warptype ship could initially appear at their
warp-destination, then spring back to the correct location to complete
the rest of their warpin (because a docked ship had higher speed than
the dock leader)
There may also be a number of other subtle bugs with docked warpin;
e.g. I suspect (but haven't tested) that AI turrets could fire on
docked ships during warpin
These should also be fixed
Lastly, fixes issue #1867
We need to build our own curl binary since Homebrew doesn't support
--with-libssh2 anymore.
I've also added caching to both the Linux and macOS code to avoid
rebuilding curl for each nightly.
Currently is-docked always returns true if only a single argument is
supplied. This is probably as designed (except for not erroring on a
single arg) however it's quite easy to update to work for a single
argument and this case is useful for FotG, and might be useful for
others.
Somewhere along the line, "sentry gun" was replaced with "escape pod" in the inverted is_flyable check. This made the game think an escape pod wasn't flyable and therefore things like waypoint orders were not displayed. This PR fixes that.
Additionally, I fixed a potential bug in weapons.cpp where the HUGE flag should really check against HUGE ships. And there's a no-op formatting change in hudtargetbox.cpp.
The core bug fixed here is #1982. After ship_create sets up the ship, parse_object_create_sub does further initialization by copying some values from the parse object. In most cases there are sensible defaults, but a few special cases require some post-processing...
- ship sounds
- the new way of initializing warp effects to allow per-ship customization
- intrinsic-no-shields
- an arrival entry in the mission log
- script hooks
I also took a further look at normal ship creation and tweaked some things...
- initialize ai mode in ai_object_init
- remove redundant assigment of ship name from parse_object_create_sub (it's also done in ship_create)
- remove redundant goal clearing from parse_object_create_sub (it's also done in ai_clear_ship_goals via ship_create)
- avoid overwriting the initial ai mode if the fix-ai-class-bug flag is set
- make the code slightly more efficient by not redundantly setting flags while searching for subsystems
If various functions on l_Control_Info were called while Player was nullptr, FSO would CTD due to a null pointer dereference. This commit adds nullptr checks to avoid the problem.
When setting LUA_ADDITIVE_BUTTON_CONTROL, the setButtonControlMode() function (in l_Base) would return "LUA OVERRIDE BUTTON CONTROL", and when setting LUA_OVERRIDE_BUTTON_CONTROL, "LUA ADDITIVE BUTTON CONTROL" would be returned. This commit simply swaps these back so that the appropriate return value is with the corresponding enum value.
When using a string to define the appropriate control in the useButtonControl() function (in l_Control_Info), the command definition was being divided by 32 when the appropriate mathematical operator was modulo; as a result, the only controls that could actually wind up being referenced are these four: TARGET_NEXT, MAX_THROTTLE, END_MISSION, and MULTI_MESSAGE_HOSTILE. By using the modulo operator, the string lookup now appropriately references the relevant button.
MESSAGE_SOURCE_SPECIAL indicates messages whose sender starts with "#", indicating that it's not a ship; however, the code was looking up the source as a ship name regardless, and if the message had a persona set, failing to find that ship name would result in the message failing to send. Commit f67596bc5e (a.k.a. SVN revision 5383) was supposed to fix this, however it was checking if q->source was MESSAGE_SOURCE_SPECIAL when q->source was one of the HUD_SOURCE_* #defines (specifically, MESSAGE_SOURCE_SPECIAL resulted in HUD_SOURCE_TERRAN_CMD). It turned out there was an unused HUD_SOURCE_* #define which behaves identically to HUD_SOURCE_TERRAN_CMD, namely HUD_SOURCE_IMPORTANT. By making MESSAGE_SOURCE_SPECIAL use HUD_SOURCE_IMPORTANT and changing the conditional to compare q->source to HUD_SOURCE_IMPORTANT, the intent behind the original fix can be carried out with minimal effort.
This also fixes issue #1706, which is basically the same as the original mantis issue.
This allows specifying how many times per second an effect should be
triggered for a particle source instead of triggering the effect every
frame. This will allow modders to achieve more consistent particle
effects regardless of FPS.
This is a follow-up to commit 1614384a6a. `Error` is to be avoided if possible because almost all sexp problems are recoverable, and we don't want to bring the entire game to a halt.
Also add some more information to warnings about sexp operators on strings.
Every time an entry for a ship was parsed (e.g. every time it showed up in a .tbm), the selection effect would be reset to the default. Since it's already set to the default in the ship_info constructor, this was both redundant and would make it extremely difficult to actually use a selection effect other than the default without constantly setting it in every .tbm.
Since FRED and FS2 load mission data slightly differently, the warp effect loading code had to be slightly reorganized in order for the warp effects to not be based on invalid data. Additionally, the warp effects had to be initialized a little bit later so that it could accommodate a new set of warp parameters from the parse object. As a bonnus, this PR also handles warp effects being reassigned in change_ship_class.
In commit 9e4c6df219 (PR #1265), the model_render_params::set_replacement_textures() override that accepts a vector of texture replacements was added, which includes allocating its own Replacement_textures array. However, unlike its counterpart from missionparse.cpp, this array doesn't then have all of its elements set to -1. Since it works just fine there, I copied that code here so both versions should behave the same.
The (length > base_length) conditional was redundant with the other conditions. Additionally, the code from the ID_FUEL case (thruster points) checking for "$engine_subsystem=" was making the exact same mistake, so I made the same changes there.
In a Release build, there was absolutely no code making sure that the text "$glow_texture=" was actually present in the properties field of a glow point bank, beyond a simple strlen() check. Even in Debug builds, there was no guarantee that the text was at the start of the properties field; it was just assumed (without even an assertion verifying it). Now, the assertions have been removed and the appropriate conditions are checked in both Release and Debug.
This was causing issues since the new bitmap data was never stored in
the internal buffer FSO uses for getting the image data. Instead, it was
only uploaded to the GPU texture which could be deleted at any time.
This was the case when changing the "3D Hardware Texture" setting which
causes a texture flush.
This fixes#1961.
This can be used by the various subsystems for cleaning up Lua
references before the Lua state is destroyed. This avoids having
dangling references to the Lua state which would cause segfaults later
on.
The first subsystem to use this is the dynamic SEXP system which had
dangling references due to keeping Lua references to the SEXP functions.
This fixes#1954.
Removed a lot of unused functions.
This is mostly a cleanup of a prior refactoring.
There where a lot of unimplemented functions remaining from renaming.
Removed several outcommented parts of code.
This makes some general changes to the particle parsing code. It moves
the trail effect option to the end of the options list to remove an
ambiguity in the resulting parsing code. This is done in a backwards
compatible manner so existing tables will not be broken by this.
This also introduces support for specifying single number ranges
without the parentheses to make that easier to use.
Bad data can cause the name search to fail, and if change-ai-class was called with an invalid AI class, it could cause later invalid array accesses (using an index of -1).
These were all cases where the parameter was the new value when setting
a variable. The variables should always be initialized when that code is
reached but it is still better to check the pointers before using them.
These were found by @niffiwan.
Previously, these two SEXPs could only be used in single-player; now they can be used in multiplayer. (This now allows Admiral MS's ship save/load script to work in multiplayer too.)
Inspired by Parias's patch included in the FSPort Co-Op Mod Beta (https://www.hard-light.net/forums/index.php?topic=88385.0) though with some modifications.
The code already only recomputed collisions if we moved a ship or a wing, but this further optimizes things so that only ships or wings that can collide will cause a recomputation.
precalculate warp values before beginning warp, and use them throughout the warp instead of recalculating in every function
standardize on always using the entire docked assembly for length and half-length calculation, instead of some places the assembly and some places just the dock leader
consolidate and simplify the compute_warpout* functions in light of the above
This will automatically call the destructor of a type of Lua calls the
garbage collector for an object of that type. This is the last step
towards fully supporting non-trivial objects in the Lua API and all
previous workarounds have been removed.
This is pretty much similar to the value setting changes. This is a much
safer solution for getting values out of the scripting system which has
compile time validation for move-only types.
This commit changes the way the scripting API works by properly using
the newly available type information for moving the FSO resources into
the memory supplied by lua. This has full support for rvalue references
which will make it possible to use move-only types with the scripting
API.
This also makes the API much safer to use since it doesn't use pointers
to local values anymore which made it very hard to use the API in a
different context without causing issues.
This only covers writing the FSO values to Lua. Getting values back is
not covered yet.
This was previously used for allowing scripts to set arbitrary values on
scripting objects. However, it was used by only a few scripting
functions and, as far as I know, no script uses this features.
This removes that feature which simplifies the code ade_index_handler
of.
This also simplifies the code that handles the userdata for libraries
provided by FSO.
They updated their Qt version and didn't update the documentation page.
This fixes the recent build errors by using the 5.9 symlink which is
linked to the most recent version.
This replaces the previously used defines with inline functions which
fixes a few warnings if the macros were ever used. This also changes
fsspeech.cpp so it is compiled always since it has no dependency on the
underlying speech system.
The changes from #1752 changed how the offset was computed but the
cubemap code did not update the initial offset computation to account
for this.
This fixes#1921.
Previously, the game uploaded all mipmap levels found in the image files
and then selected which ones it will use by using GL_TEXTURE_BASE_LEVEL.
This unnecessarily used additional GPU memory which is especially bad if
the player already needs to use a lower detail level. This fixes that by
only uploading the necessary mipmap levels.
This adds the "no sparks" flag for subsystems which disables the
generation of spark sources for that subsystem when it is hit.
This was requested by Axem.
Travis CI recently added support for running builds in Windows. This
adds support for testing compilation on Windows using that feature.
The newer version of Visual Studio and MinGW required some code changes
and an update of Google Test which is included in this commit.
* Adds Accept Mission Outcome Event to Game Events
Adds Accept Mission Outcome Event to Game Events, so scritps and other things can be called only when a campaign mission is accepted.
* Fixed double entry
* Define CHA_CMISSIONACCEPT
Adds line to define new conditional hook, CHA_CMISSIONACCEPT
* Add flag_def_list for On Campaign Mission Accept
Adds the proper flag_def_list for "On Campaign Mission Accept" CHA_CMISSIONACCEPT
* Runs New Conditional Hook
Runs the new conditional hook for "On Campaign Mission Accept"
* Reverts event changes
* Reverts state changese
* Reverts post_event change
This adds a new AI goal which is equivalent to play-dead except that it "sticks". It doesn't clear the goal list
so it will continue playing dead until the goal is removed or another goal with a higher priority is added.
In FRED, if all docked ships had their arrival cue set to false, none of them would be loaded
in the mission because there was no dock leader to bring in the entire group. This PR fixes that
by choosing an arbitrary ship (the biggest ship according to ship_class_compare) to be the
dock leader. This consequently fixes issue #1877 because the wing is able to find its ship.
This maintains the type information which can be used for enforce
const-correctness and also for implementing more advanced ways of
handling the type information.
This appears to be a leftover from the development of the shadow
rendering code. The shadow FBO was allocated twice but only one was
used. This removed the unused code and also ports the improved error
handling of that code over to the actual shadow FBO creation code.
This allows the WE_Default warp type to be used with any warp fireball in fireball.tbl. The fireball can be used by specifying its unique ID for the existing $Warpin type and $Warpout type options in ships.tbl. The warp type is managed by bitwise-OR'ing a flag to the fireball's index.
This was an oversight in the JSON changes since those were made long
before the CFile location flags were a thing. This uses the correct
location flags for enumerating pilots for conversion.
This changes the pilot reading code to always use JSON files for storing
the pilot data. Old pilots are converted to the new format when FSO
starts and after that point only JSON pilots will be used.
The warp-effect SEXP can now specify other animations from fireball.tbl that are not necessarily the standard or Knossos animations. Additionally, the SEXP can now specify the duration for the opening and closing of the warp effect.
Nobody ever thought to add a reset-post-effects SEXP to complement set-post-effects, so this remedies that. Also, a few minor edits were made to the scripting documentation.
This adds the runtime and compile version of the used SDL library to the
start of the debug log. This was requested by ngld and should make
diagnosing some errors easier.
The special value DIRECTIVE_WING_ZERO (defined to be -999) is used to
signify to the directives system that an is-destroyed SEXP was found
which specified an empty wing. However, if a second is-destroyed-delay
SEXP is present in the same directive then the count of the parameters
is added to -999 which makes means that the directives system then
displays it on the HUD as a negative number.
This fixes that by resetting the counter to 0 if a second SEXP
encounters the special value which fixes the issue in the supplied test
mission. There are probably other edge cases when using multiple
is-destroyed SEXPs in a directive so I added a warning to the SEXP help
which lets the mission designer know that it is preferable to specify
multiple parameters instead of using multiple is-destroyed SEXPs.
This fixes#1722.
This should make the line draw list class behave identically to the old
line rendering functions. This caused a few issues where the lines were
drawn outside the scissor area which made them invisible.
This fixes#1655.
This makes the deferred fog rendering code use the nebula background
instead of the single fog color for the background.
This is not an ideal solution since objects fade to the fog color
instead of the color of the background but it's better than rendering no
background.
This changes the FFmpeg code to not use av_seek_frame anymore if looping
is not required. This fixes an issue when playing MVE movies since that
format does not support seeking.
This fixes#1828.
Optionally play a sound when autoaim becomes active, and another sound
when autoaim becomes inactive
Credit to zookeeper - I'm just pushing this into master!
This was reported by ngld who experienced issues with Knossos since FRED
did not terminate properly when asked to provide the command line flags.
This should fix that.
This should fix an issue with the playback speed of APNG files which is
present in the current builds. This does not include the Mac libraries
since I cannot compile the libraries for that platform.
This adds a playback property for making the movie loop to the start
when the end is reached. The way this is done is by simply keeping the
decoder running even if the end of the movie is reached. Then the movie
is reset to the beginning and decoding continues. The player detects
this reset by examining the frame times which keeps the playback
constant.
This also includes support for this in the movie scripting API.
This was needed by the restart dialog action and got removed since the
Discord changes needed to know if a mission was active or not.
I removed the code which changed the mission file name and replaced it
with some internal handling in the discord code which should now handle
mission restarts better.
This fixes#1815.
The original issue was reported by Novachen in #1754 where a significant
slowdown was encountered in the controls menu (Ship and Misc tabs). I
traced the cause of the slowdown to repeated uploads of the NanoVG font
atlas texture even though no changes were necessary.
The root cause of the issue was that NanoVG did not handle invalid UTF-8
sequences at the end of a string properly. The UTF-8 decoder returned a
success code even though no code point was decoded which lead the rest
of the code to believe that the font atlas needed to be recreated.
This fixes#1754 by properly handling that case.
This also fixed an assertion failure if NanoVG was asked to render
2D elements without any vertices.
This adds a mission file option for ships which allows specifying a
different string which should be used for displaying the name of the
ship to the user. This name will not be used in SEXPs or other ship
lookup functions so it can be freely translated and two ships can also
have the same display name.
The new feature can be used by adding $Display name: <string> after $Name
for a ship in a mission file. I think I added proper support for FRED
(and qtFRED) so that this new value is properly saved but it would be
great if someone could test that.
This implements one of the features requested in #1730.
1. Removes unused parameter
2. Applies 'static' keyword to the routine.
Together, these two changes should help the compiler generate
more efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
Removes two unused parameters from ai_ship_hit(). Instances where this
routine are called are also updated.
This should result in slightly more efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
Removes the unused parameter from the routine. This has a small
ripple effect such that it results in an unused parameter in one
of the routines from which it is called.
Signed-off-by: Peter Mitsis <[email protected]>
1. Removes unused parameter
2. Applies the 'static' keyword to the routine.
Together, these two changes should help the compiler generate slightly
more efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
1. Removes unused parameter
2. Applies 'static' keyword to the routine
Together, these two changes should help the compiler generate slightly
more efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
1. Removes an unused parameter.
2. Applies the 'static' keyword to the routine.
3. Applies the 'const' keyword to the remaining parameter.
Together these changes should help the compiler generate slightly more
efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
Applies the 'static' keyword to the routine as it is only used in the
module in which it is defined.
Removes an unused parameter.
Together, these two changes should help the compiler generate slightly
more efficient code.
Signed-off-by: Peter Mitsis <[email protected]>
Adds the 'static' keyword to the routine as it is only used in the
module in which it is defined.
Removes its unused parameter (and updates location where it is called).
Signed-off-by: Peter Mitsis <[email protected]>
Removes the unused parameter from the routine and adds the 'static'
keyword to the routine as it is only used in the module in which it
is defined.
Signed-off-by: Peter Mitsis <[email protected]>
This routine is only used in the module in which it is defined, so the
'static' keyword has been applied to it.
One of its three parameters was unused, so it has been removed.
Finally, the 'const' keyword has been applied to appropriate arguments.
These changes should help the compiler generate slightly more efficient
code.
Signed-off-by: Peter Mitsis <[email protected]>
The routine ai_turn_towards_vector() had an unused parameter (frametime)
and it has been removed.
Each of the instances where this routine is called have also been updated
to reflect the parameter removal. As this resulted in the routine
swarm_update_direction() suddenly having an unused parameter, that routine
and the places where it is called have also been updated (remove
unused parameter).
Signed-off-by: Peter Mitsis <[email protected]>
The files are now exclusively stored in the top level user directory to
make the shader cache not dependent on the current mod. This also adds
some code which removes all old shader cache files which may be stored
in the old (per-mod) location.
The amount of output parameters is becoming quite large which makes it
harder to add new input parameters. For that reason I converted the
existing output parameters to a struct which cleans up the function
signature a lot.
This is similar to the other changes I already posted. Here the sound
instance handles are converted to their own handle type which will make
it easier to use the sound API.
Removes the unused parameter from ai_big_maybe_enter_strafe_mode().
Each place where this routine is called has been corrected to reflect
the updated API.
The 'const' keyword has been applied to remaining parameters as
necessary.
Signed-off-by: Peter Mitsis <[email protected]>
Adds the 'const' keyword to the parameters in the routine
ai_big_strafe_maybe_attack_turret() as they are unchanged
by the routine.
Signed-off-by: Peter Mitsis <[email protected]>
The routine ai_big_strafe_maybe_retreat() is only used in the module in
which it is defined. Consequently it now sports the 'static' keyword, and
no longer uses the 'extern' keyword in its forward declaration (which has
been moved to be colocated with other forward declarations).
Secondly, since it was only using one of its two parameters, the unused
parameter has been removed.
Thirdly, since its only remaining parameter is not modified by the routine,
the 'const' keyword has been applied to it.
Signed-off-by: Peter Mitsis <[email protected]>
The routine ai_big_ship() is empty, and appears to have been since it
was initially added many years ago. Removing it helps eliminate some
unused code.
Signed-off-by: Peter Mitsis <[email protected]>
The routine ai_big_maybe_fire_weapons() is only used in the file in
which it is defined and is thus a good candidate for being declared
'static'.
Furthermore, as it was only using two of the five parameters, the
three unused parameters have been removed and all instances where the
routine is called have been updated.
Signed-off-by: Peter Mitsis <[email protected]>
This uses the Discord Rich Presence API for improving the integration of
FSO into Discord. At the moment this includes state notifications for
being in the main hall, the command and mission briefing and in-mission.
When in-mission it also includes the elapsed time of the mission with
support for time compression.
The details part of the notification includes the campaign name and
mission name if possible.
This will make the error message clearer instead of just showing a
cryptic Assert message. This cannot be handled by a simple warning since
capping num_debris_objects to MAX_DEBRIS_OBJECTS would then cause issues
when reading the rest of the header.
Some of those are fixed in the newest version from their git repository
but I don't want to do a full update just for that.
modernize-make-unique was disabled since clang-tidy apparently doesn't
respect the language setting and make_unique is only present in C++14.
This allows to use the built-in lua "require" function with our file
system. This will help organize complicated scripts and it will also
allow to use libraries which were designed for this system.
To enable this change, this includes a new mechanism which allows to
load scripts from the default file system so that the files don't need
to be included in every mod. The default files can be overridden by a
mod if a special mod-table option has been set, similar to how external
shaders are handled right now.
Nightmare discovered an off-by-one error when checking the validity of a
particle effect handle. Since the new ID system makes that much easier
and less error-prone I decided to go ahead and convert all handles to
an ID typedef which also fixes the reported bug.
This was causing issues when using the new scripting API in JAD where
there were a lot of 2D operations which filled up the immediate mode
buffer. The reason was that GL_ARB_vertex_attrib_binding the relative
offset is limited and the movie code adds the immediate buffer offset to
the vertex layout which then hit the offset limit set by OpenGL.
This fixes that by using the normal byte offset method which is already
used by the render_primitives functions.
This adds an API for the scripting system which allows it to load and
display movie files using the standard movie player code which includes
multi-threaded frame decoding.
This allows to directly display RGB(A) movies without transcoding them
to YUV first. This allows the movie player to support APNG files (which
are supported natively by FFmpeg) with an alpha channel and without
converting them to YUV first.
This unifies how our CMake system handles adding source files to the
project so that all subprojects use the same mechanism. This also makes
it easier to add a new source folder to the code project since you don't
need to editor three places at the same time anymore.
The bounds check was not correct for 1-based indices. I moved the
Lua->C++ index conversion before the bounds check so that it makes
more sense.
Also, atoi isn't a reliable way for converting a string to an integer.
The previous code simply set a boolean flag to indicate that the data is
"invalid" which failed the campaign loading operation. With these
changes, those entries will simply be skipped. That can happen if a mod
added or removed a ship or weapon class or if two campaigns share the
same campaign name.
Previously, if parse_weapon_targeting_priorities() couldn't find a weapon matching the name, it wouldn't parse the "+Target Priority:" line, so it would cause a parsing error when the parser failed to find "$Name:" or "#End" there. Now, the "match not found" codepath still parses it so that no mismatch occurs. Also, I reordered the function so that the parsing wasn't happening in the middle of a loop through the list of weapon types, because it made me cringe.
Ideally it wouldn't be an optional argument at all, but that would break backwards-compatibility, so instead it'll just return an invalid ship handle instead of calling ship_create() with a class of -1. In addition, the Assert from ship_create() meant to guard against invalid ship_type values is now an Assertion that actually says what the invalid value of ship_type was, to make future debugging easier.
I added this hack a long time ago and it always bothered me why I didn't
come up with a better solution. This is the better solution which uses
the popup_active function for determining if gr_flip is called within a
popup.
Lua's Ship.TargetSubsystem VIRTVAR, when set, would write to an attribute of the Ships[] array based on an objnum instead of a ship instance index. Since MAX_OBJECTS is drastically higher than MAX_SHIPS, then depending on how many objects happen to be in the mission, an out-of-bounds array access can be easily generated. This commit makes sure to use the objnum instead as an index to the Objects[] array, and then retrieve the ship instance from it.
This converts the previous int handles to a strongly-typed wrapper
handle which will make the API more self-documenting and will ensure
that wrongly used handles are detected at compile time.
I already found a few mistakes with these changes which I also fixed
here.
The current scripting hook is pretty simple and straight forward but it
makes a couple of scripting applications harder to implement than
needed.
For example, a lot of scripts need to do some work every frame
for all or some objects. The script needs to manage an internal list of
all the objects that are affected by that list which includes removing
invalid objects to conserve resources. This effectively mirrors what the
engine already does and adds unnecessary overhead.
In these changes I added a generic event system which can be used by any
part of the code for providing callbacks when a specific event occurs.
As an example, I added hooks for the pre- and post-move events to the
object class which are called before and after physics are applied to an
object.
I integrated that feature into the scripting system so now a script can
simply register a function as a callback which will be called whenever
the target event is executed.
This adds a scripting API which can be used for adding and removing
background from a mission similarly to the existing SEXPs but with full
support for floating point numbers.
This was requested by Axem on Discord.
This is present in the variable modification dialog but not in the
editor which is used for adding a variable. This also adds the
validation to the editor for adding a new variable.
Caching bitmaps between missions is no longer a problem for modern
system and this will improve the default load times when playing more
than one mission.
By enabling the "$Use Actual Primary Range:" profile flag (which can also be set on a per-AI-class basis), the code to determine if the AI should fire its primary weapons will not only perform its current "range based on speed of weapon and target" calculation, but it will also compute the weapon's actual range and not fire if the target is outside of it.
This was not present previously which meant that the command line values
were simply ignored by the engine. This adds the scaling back in which
should restore the lighting behavior to the previous status.
When a ship with three primary banks has a Nolink weapon in one bank, the other two banks are still allowed to link; if that Nolink weapon has a limited ammo supply, however, depleting that ammo supply would disallow primary linking even though the weapon never contributed to primary linking in the first place. This commit changes the logic to only care if the depleted weapon doesn't have the Nolink flag. The ideal solution is probably to change how primary linking works so that even if the weapon doesn't have the Nolink flag the remaining primaries can still link, but that would be much more involved.
If a sound did not receive a valid sound name then the parsing function
would exit early and not set the pitch range properly. This would cause
a divide by zero if the duration of the sound was queried.
This moves the initialization of the pitch range to the start of the
parsing functions which makes sure that the range is initialized even if
the function exits early.
This automatically removes old shader cache files from the mod directory
when FSO is started. Those old files are likely to not be used anymore
so this will reduce the amount of disk space FSO uses for the shader
cache.
This adds an identification of the OpenGL implementation to the shader
content hash to avoid issues when using the same FSO install with
multiple graphics drivers.
Also adds support for querying the supported binary formats and
gracefully handling missing support for the format of a stored shader.
This can be useful when downgrading the version of a graphics driver
since the older version may not support the binary format yet.
The TGA loading code pretends that it does pixel conversion but doesn't
actually do that. This changes ensures that this circumstance is
communicated to the caller of bm_lock which will allow that code to
handle the case properly.
This was reported by Bomb3rman on discord.
The cap-waypoint-speed sexp only works for speeds above 0; this PR changes the documentation to clarify that. I also tweaked an if() block in ship_return_time_to_goal because it used a >=0 comparison whereas every other comparison used >0. (This is only for consistency, because the >0 check is used before this point would be reached.)
This will make debugging config location issues easier since the log
will state which path os_is_legacy_mode took while determining the
legacy mode status.
This removes the clipping plane submodel removal code and replaces it
with shader code that generates vertices outside the clipping volume if
a model should not be rendered. This even improved performance since
clipping no longer needs to be active for all model rendering
operations.
This should finally fix#1579.
This can be used for mark parts of the code which should be unreachable
in normal execution. In debug mode, if such a statement is reached an
Error dialog is shown which aborts the execution. In release mode the
macro is replaced with a compiler specific expression that lets the
compiler know that this part is unreachable which allows it to optimize
the code better.
This allows to use external subtile files (currently only SRT is
configured) for providing subtitles for movie files. This should be more
universal since it also supports container formats with no support for
subtitle streams.
To use this code the srt file needs to be named
"<movie name>-<language code>.srt" where the language code is the file
extension name specified in the localization table. For english the
"-..." part can be omitted.
This adds support for rendering models using thick lines (that means
lines wider than 1 pixel) which is required by the hardpoint HUD gauge.
This feature was present before the switch to OpenGL code and had to be
removed since the core profile does not support rendering lines wider
than 1 pixel.
This uses a geometry shader for converting all the triangles from a
model to 3 quads along the triangle lines which are as thick as set by
the model renderer. Geometry shaders are quite slow if they generate a
lot of geometry (and this generates 4 times the usual amount of geometry
in the shader) so it's probably not a very fast rendering operation but
it is only needed once per frame so it shouldn't be too bad.
I also added support for the RenderDoc API since I needed that for
debugging and it might be useful in the future. It will only become
active if RenderDoc is actually attached to the process so in most cases
the new code will do nothing.
This is largely based on how the existing code is formatted and is in no
way enforced by CI or anything else. This is only so that we actually
have a clang format file in the VCS since it's very useful.
Since there is no OpenAL context if sound is disabled there were errors
when calling alGetError on a non-existant context. This fixes that by
aborting the sound API call when the sound system wasn't initialized.
The current code drops trailing white space which can cause issues if
the translated string is used in concatenations. The retail tstrings.tbl
has some entries with white space at the end but since those strings are
not used for concatenations (or else this issue would have been found
earlier) this change should not cause issues there.
This fixes#1739.
The assignment operator and copy constructors could be replaced with
their default implementations. The destrutor was also not needed since
it only executed the same action the default constructor would have
done.
I also fixed a few issues where the internal char array was used as a
mutable string which changed the string after it was parsed which is not
good(TM).
This also replaces all user-facing occurences of usages of name to use
the new function so that the correct, possibly translated, name is displayed
to the user.
This turns the Warning about missing 640 interface art into a log print. This applies to all instances of 640/1024: loading screens, cbrief and briefing backgrounds, and ship/weapon selection backgrounds.
There were some reports that using a newer launcher together with an
outdated launcher was causing some issues since the new launcher would
write the new config file which would cause FSO to ignore the changes of
the old launcher since the new config file already exists.
This fixes that by adding a check for when the config locations were
last modified. On Linux and Mac it checks when the old config locations
were modified last while on Windows it checks the registry to determine
if there was a change after the new config file was created.
Multiple function pointer dereferences are valid in C but do not change
the result of the operation. The graphics API had some function
definitions which used multiple pointer dereferences while the rest of
the functions did not.
This changes all occurences of the double dereferences to normal GR_CALL
declarations to keep the style in the API definitions consistent.
The code did not account for unicode escape sequences when inserting
scrambling characters which distorted the text and fequently caused
invalid UTF-8 sequences to appear in the text. This fixes that by
using the text iterators already present in the game code. I needed to
rewrite the logic of this block a bit since the previous logic could not
be converted to the way we need to handle unicode sequences at the
moment.
This fixes#1720.
This changes how the bitmap slots are managed by the bmpman system.
Instead of allocating a fixed-size array when the game starts this will
manage multiple "blocks" of bitmap slots. When the engine runs out of
slots in the already allocated blocks it simply creates a new block and
allocates the new slot in that.
This removed the hard limit on how many bitmaps can be loaded at the
same time and should fix issues encountered by mods which use a lot of
bitmap slots (I'm looking at you Spoon).
This implements the idea described in #1503.
Apparently, Appveyor has removed the Qt version 5.7 from their servers
which was used by FSO previously. I have updated the paths to use Qt
5.9.5 instead now but there is a problem with Visual Studio 2013 since
there is no 32-bit Qt version for that compiler installed in the
Appveyor system.
For that reason, I decided to use Visual Studio 2015 instead for the
32-bit builds which means that Visual Studio 2013 will not be tested by
Appveyor anymore. Since no one is using that compiler version anymore
that shouldn't be a big issue.
This should fix the CI issues seen on recent PRs and commits.
These operators used to warn and return NAN if they were given a bit index out of range. For FREDding convenience, out-of-range bit indexes are now a no-op. This is particularly helpful in the situation where a FREDder needs to evaluate an extended bit array, one 32-bit chunk at a time, e.g.
0-31 bits: offset 0
32-63 bits: offset -32
64-95 bits: offset -64
96-127 bits: offset -96
Because the sexp system always evaluates every argument, three out of four branches were always evaluated with invalid bit indexes (negative or too large) even if the sexp logic only used one branch. The new method silently bypasses this behavior.
The viewer mode check seemed to be wrong but I am not entirely sure if I
fixed this correctly. The Viewer_mode variable is a big mess of bitflags
that are not very consistent in what they mean.
This will report the usage of old coding patterns in new code.
modernize-raw-string-literal is disabled since it doesn't work right
with strings with special escape sequences in them.
modernize-use-using is disabled since typedefs are more common in the
FSO code.
This will only check the lines that were changed by a commit or pull
request. This makes it possible to enable more clang-tidy checks without
having to fix all occurences of the warnings in the code base.
Please note that the changes do not work correctly with rebased branches
due to the way Travis CI supplies the commit range. Pull requests will
always be checked properly though.
There were actually two bugs here that were fixed:
1. The model draw list code disabled the fog rendering when it thought
it was it deferred rendering mode but did not account for explicitly
disabling the deferred renderer.
2. The fog effect was applied to both the emissive color and the base
color simultaneously which caused visual errors when rendering fogged
objects using the deferred renderer.
This fixes#1717.
The unused parameter warning cannot be disabled easily in release mode
for clang-tidy so this needs to be done to avoid false-positived in
release mode.
This enabled qtFRED building for all deployments (releases, nightlies
and test builds). qtFRED is relatively stable now and should be
available for wider testing which may be provided by nightly builds.
This also adds AppImage support fot qtFRED although I still couldn't get
it to work entirely since there is some sort of libpng issue which
prevents icons from showing up correctly.
The sexp_tree widget makes the model based dialog a bit ugly here since
it is required for some model operations even though it is a UI
component. In the future it could be split into a model component and an
UI component to allow better separation between model and UI.
This adds a new class which allows to create type safe resource handle
types. At the moment, the engine uses ints pretty much everywhere for
providing handles to resources created by the specific subsystems. Since
all ints are the same to the C/C++ typesystem it is perfectly legal to
pass a sound handle to the graphics API as a buffer handle which will
obviously cause issues.
This adds a new type called "ID" which is a wrapper class for a generic
handle but with added type safety. An instance of this class cannot be
passed to a function expecting another type of handle which provided
compile-time type safety for these APIs.
As an initial test I converted the game sound handles to this new type.
I already found a bug in the mainhall system thanks to this new type.
The mainhall used the game sound handles as sound instance handles which
probably meant that that specific code never really worked right. I
removed the code since there was no better alternative for fixing it.
The current particle system uses dynamic allocation of particle
instances for keeping track of particle instances. This adds unnecessary
overhead in case the code does not need a handle to this particle which
is the case in pretty much all instances.
The new non-persistent particles are stored in a standard vector without
dynamic allocation which should make the processing steps using this
vector much faster and allow better scalability in case more particles
are used by a mission.
This is pretty much an exact copy of the mission save code of FRED2. I
removed the campaign save code for now since it requires some
interactions with the campaign editor which does not exist yet.
TeaCI is a CI service which provides MinGW CI builds (in Docker
containers so no "real" Windows machines). This would be useful for
validating the Windows only code with additional GCC warnings. It would
also make sure that the MinGW setup we currently have continues to work.
This fixes various issues I found while trying to compile FSO in a cross
compilation setup using MinGW. This is a prerequisite for merging Tea-CI
support.
The crash was caused by a static initialization order problem where the
static initializer of the FRED app was called before the initializer of
the outwnd filter vector.
This fixes that by initializing the vector as soon as necessary through
the use of a function with a static variable.
Synchronize the two subsystem-of-ship checks in sexp.cpp and sexp_tree.cpp. Mostly this is just adding OP_BEAM_FLOATING_FIRE to sexp_tree.cpp because whoever added that sexp forgot to add it there.
Returns true if the ship is in a turret's FOV, false otherwise. Requested by JSRNerdo. Uses the object_in_turret_fov internal function which is the same one used by the turret code when it checks whether it can fire.
The CMake code did not specify that qwindows.cll also needed to be
distributed with the application which caused errors for users who had
not installed Qt on their system.
This should make qtFRED redistributable without needing a QT
installation.
Applying the 'static' keyword to applicable routines both informs the
developer where the routine is likely to be used as well as allows the
compiler to perform additional optimizations.
Signed-off-by: Peter Mitsis <[email protected]>
Applies the 'static' keyword to applicable routines to both make it
more clear to the developer where such routines are likely to be used
as well as to provide additional information to the compiler so it can
make better optimizations.
Signed-off-by: Peter Mitsis <[email protected]>
Applying the static keyword to applicable routines makes it both
more clear to the developer where those routines are likely to be
used as well as provide additional information to the compiler to
allow it to make better optimization choices.
Signed-off-by: Peter Mitsis <[email protected]>
Applies the 'static' keyword to various sihp related routines. This both
makes it more clear to the developer where those routines might be used
as well as allowing the compiler to leverage that knowledge and potentially
make additional optimizations.
Signed-off-by: Peter Mitsis <[email protected]>
Removes the following two routines as not only are they unused, but
they have been unused for years.
get_debris_from_same_group()
asteroid_get_random_in_cone()
Signed-off-by: Peter Mitsis <[email protected]>
Applies the 'static' keyword to various asteroid routines. This both
makes it more clear to the developer where those routines might be used
as well as allowing the compiler to leverage that knowledge and potentially
make additional optimizations.
Signed-off-by: Peter Mitsis <[email protected]>
Removes the extern declaration of hud_target_asteroid() from
keycontrol.cpp as it is not used in that module.
Signed-off-by: Peter Mitsis <[email protected]>
This was missed when converting the model uniforms to a uniform buffer
and caused some issues with team colors. This sets that uniform to the
value it had before the uniform buffer changes.
This fixes#1683.
This copies the original FRED code for initializing the individual game
systems to qtFRED. This should fix the various issues caused by missing
game system initialization calls.
The initial JSON flags output lacked this information but it is needed
for proper support by the launcher. This adds a new entry in the JSON
structure without changing anything else so it does not require a new
output version.
When I made the texture array changes I forgot to test the texture
detail feature which caused some visual corruption when using a texture
detail which was less than the maximum. This should fix that.
The minimum and maximum values were not initialized correctly which
caused code which relied on those values to fail unexpectedly.
This assigns the value properly and adds a documentation note which
clarifies when the values are valid.
This fixes two possible assertions and two possible buffer overflows
which could have been caused by a mission with wrong values for
$num_stages and $num_icons.
This fixes#1664.
Since atoi return 0 on error the code tries to access the waypoint list
with index -1 which causes an assert in the lookup code. This fixes that
by using the error detection capabilities of strtol.
This is probably a bug from when I changed how those functions worked.
The function is supposed to return if it successfully retreived a value
from the Lua stack but instead of returning true if it was, it returned
the value it just retrieved. This works fine if that value is true but
causes issues if it was false.
This adds a step to the post-mission cleanup where we explicitly go through Objects and call obj_delete on everything not already deleted; this obviously needs testing.
Also a few cleanup steps in lab_init to make sure the lab isn't contaminated by leftover data from previously played missions.
The previous fix to the weapon orientation failed to account for the
change from local to global space for the weapon position. This fixes
that by rotating the model positions to world space before submitting
the render call.
This fixes#1647.
The rendering material used by the model render list was reused by
multiple draw call submissions so a non-transparent mesh would reset the
fog value set before which would break meshes submitted after that.
There are still some issues with how the fog is rendered which causes
differences between how opaque and transparent meshes are drawn but I
will fix that in another pull request.
This fixes#1645.
With the recent changes to how fog is handled in nebulas it is now
possible to render decals correctly in a nebula environment so there is
no need to disable decals when the mission is in a nebula.
This changes the decal system so that it is able to modify the normal
map of the scene. I tested this with some existing normal maps but I am
not entirely sure if the tangent matrix I construct uses the right
values so some additional testing with normal maps made specifically for
decals would be good.
This also fixed the issues introduced by the changes to how directional
lighting was handled. Now a decal can have a diffuse and a glow map. The
diffuse map is used to change the values of the color buffer and also
supports ambient lighting. The glow map renders into the emissive buffer
and should be used for effects that should not receive lighting.
The previous method of rendering nebula fog didn't work correctly with
deferred shading since it changed the color of the material which
obviously caused some issues when it received light from a beam or a
weapon. This wasn't very noticable before because the directional lights
were handled correctly but since all the lighting operations have been
moved into the deferred shading phase it is very obvious that something
is wrong with our nebula rendering.
This fixes that by introducing a new shader which does a fullscreen pass
after resolving all the lights. It applies the usual fog formula based
on the depth of the fragment but it can only use a fixed distance range.
FSO support specifying a range for every object type but the default
range I chose should work properly for all ship types.
The new code only applies to opaque meshes. Transparent meshes are
fogged using the standard formula.
There were actually multiple issues here. The addition of color mask and
stencil state to the material system overwrote the state set by the
hardpoint renderer so the stencil buffer was never written or read
correctly. I fixed this by introducing three new model render flags
(there were a few open slots in the bit mask so I used those) which set
the correct state using the material system. That also makes setting up
the rendering environment much easier.
Second, gr_opengl_stencil_set used mixed up parameter values which were
probably broken when I introduced more detailed stencil state tracking.
I restored those values to how they were in 3.8.
This fixes the other issue reported in #1640.
The code previously used the matrix stack for handling the orientation
or the weapon models. That is no longer supported by the model renderer
(since it would make handling the transforms harder for no real reason).
I fixed the issue by passing the object orientation directory to the
model render function.
This is a fix for one of the problems mentioned in #1640.
This can happen if a script tries to determine the length of a sound
before actually playing it. This fixes the assertion by loading the
sound when it is necessary.
The emissive part of the lighting was not using the fog values properly
so ships didn't rendered right in nebulas. This fixes that by applying
the standard fog color transform to the emissive part of the scene.
This is a minor cleanup of how the engine passes vertex attribute data
from one shader stage to the next. The current code uses standalone
attribute variables which require a unique name over the entire shader
program which means that the variable names need to be different when a
geometry shader is used which makes the code more complicated and harder
to understand.
The previous version used NanoVG which caused quite a serious FPS drop.
This adds a buffer batching class which groups line drawing operations
together and submits them to the GPU with a single draw call.
This moves all lighting operations into the deferred shading phase of
the rendering pipeline. Previously, directional lights were applied to
all objects while they were being rendered. This was probably done to
avoid doing multiple full screen passes later but caused some problems
since the color information in the G-buffers was not correct for doing
later lighting operations.
This was especially noticable in dark scenes where point lights would
appear to ignore the color of the rendered objects. This should be fixed
with these changes.
I did some performance testing and to my surprise this actually improves
performance in very demanding scenes. My guess would be that applying
the shadows while rendering the objects caused a lot of overdraw which
is not the case anymore since shadows are only computed for visible
pixels. In simple scenes the opposite happens which leads to decreased
performance in those cases but in my opinion the improvement in
demanding scenes outweights this performance decrease.
Specifying the fog rendering options is now handled by the materials
system and the implementation of gr_set_fog was pretty much empty so I
removed it.
This is mostly intended for total conversions to allow them to set
themselves apart from FS2 based mods. It uses the new in-memory
filesystem to support a default icon in case no icon was specified by
the mod.
By making parse_ai_profiles_tbl() actually check the return value of skip_to_start_of_string_either() (and break if the appropriate characters aren't found), AI profile tables should no longer keep parsing past the end of the file and into invalid memory, until they either find an "#End" in memory somewhere or just plain crash.
As a pleasant bonus, a missing "#End" should now generate an appropriate error message.
There was a slight difference between the GGX function from the main
shader and the deferred shader. The deferred shader didn't use the
fresnel value stored in the G-buffer for some reason.
This can be used for keeping code for common functionality in one file
(e.g. lighting functions). The code which detects include statements is
pretty simple so it may break if it is used in a more complicated.
Circular includes are detected and treated as an error.
This fixes a warning caused by parsing the default ai_profiles table
twice. The default table was moved out of the data/tables folder and
into a special builtin category which will not be included in CFile.
This allows to use more complex file structures in the executable
without requiring that those exist as real files. The rest of the code
does not need to handle the difference between a default file and a real
file anymore which means that it's now possible to embed image files
into the executable since bmpman only needs to use the standard CFile
API.
I added two tests which check if the default file can be found and
opened and if a mod file overrides the default file which should always
be possible.
This assertion could be hit if the player died and the engine tried to
play a sound for the now destroyed ship. Since the existing code already
had a check for the case that the object is an observer I just added
another case for OBJ_GHOST.
This changes the model loading code such that all index and vertex data
is packed in a single GPU buffer for each data type (index and vertex
data are still in separate buffers). This reduces the amount of buffer
rebinding needed when rendering a scene which will reduce the CPU
overhead. Furthermore, this opens up possibilities of future
improvements for which it is beneficial if all data is in the same
buffer (e.g. MultiDrawIndirect rendering).
To manage where to put the data in the GPU buffer I implemented a
custom HeapAllocator which manages where data can be put. It uses a very
primitive first-fit algorithm but that is sufficient for this usage
type. This does add quite a lot of overhead while allocating GPU model
data (I did some tracing and some allocation calls took as long as
130ms).
This fixes#1457.
This allows to render screen space decals into the deferred lighting
buffers no matter how complex the underlying geometry is.
Currently there is only limited support for using this in the engine.
Only weapon impact decals are supported at the moment for testing
purposes.
When Unicode_text_mode was false, unicode::num_codepoints() would return (the size_t equivalent of) a negative number, because it was checking the distance from end to start instead of the distance from start to end.
There are a few new warnings in GCC7 so this makes sure that no warning
gets missed by our CI setup. The new configuration should be updated to
the newest GCC version whenever possible.
The crash described in #1561 was caused by a NULL ai profile. The
profile was not set because the lab system already had a loaded ship
object (see line 2230). These changes make sure that the loaded ship
object is deleted before closing the lab system which ensures that the
ai profile is set the next time the lab is initialized.
This fixes#1561.
While debugging a performance issue reported on Discord I noticed that
the HUD rendering code does not have any tracing scopes. This adds a few
tracing scopes to that code to make performance debugging a bit easier.
Previously the campaign room caused a heap-use-after-free error
(detected by AddressSanitizer) when loading the campaign failed two
times. This fixes the error by resetting the text pointers to their
default values when freeing the campaign list data.
This should be the correct way to set the combined depth/stencil buffer.
This has not been tested yet since I do not have a GPU which causes
these issues.
This fixes#1555.
The normally faster version that was used before misbehaved if that
texture unit already used the specified texture object which caused the
glTexSubImage3D to cause out of bounds issues some times.
This fixes#1554.
This caused a warning in GCC7 which is fixed by this. This will also
initialize the array properly since the previous version may not have
worked correctly even if the entire array woudld have been written (on
all supported platform it would have worked since repeating -1 on all 4
bytes of an int will still produce -1).
The previous code could only handle ASCII data correctly but this new
code is also able to handle UTF-8 data correctly by using the Windows
API function MultiByteToWideChar. Since the conversion only happens in
Windows-only code this is not a portability issue.
This fixes an issue reported on the forums where non-ASCII text was not
spoken correctly by the TTS system.
This add a system for adding generic instances of the DynamicSEXP class
to the SEXP system. The only implementation at the moment is the LuaSEXP
which is used by the mn.addSEXP lua API to allow Lua to add new SEXPs.
Since this requires that FRED also runs lua scripts I added a mod table
option to enable scripting in FRED. Since the current scripts are not
built with FRED in mind it would likely break all these scripts if FRED
would be opened with normal scripting enabled.
This fixes#1320.
I forgot to set the alpha blend mode in the NanoVG changes which meant
that the code used additive blending by default which is not good if the
color in use is black. This sets the blend mode to the value that
corresponds to the values used by the NanoVG reference code.
This was reported by chief1983 on Discord. The standalone server crashed
with a SIGBUS error caused by an invalid socket file handle in
FS2NetD_DataReady(). This should fix that by adding additional checks
where necessary to make sure that our socket is valid when the socket
functions are used.
This was an issue since UTF-8 encoded text can contain -128 as part of
an encoding sequence which causes a lot of issues for the parsing code.
I could not find any indication why the original code didn't use null
bytes from the start and I also couldn't find any code that would break
because of this. If anyone knows why this was done like this please let
me know.
This will remove the dependency on a system version of OpenAL and also
enable the advanced sound code for everyone. This removes the ability to
use a custom OpenAL version but removing the only system dependency we
currently have is worth a lot more than being able to use a custom
OpenAL version.
This adds support for displaying subtitles embedded in movie files. This
supports files with multiple subtitle streams where each stream contains
the subtitles for one language. When the movie file is opened, the
stream for the currently active language will be used and displayed.
This resolves one of the points mentioned in #1522.
This also depends on PR #1484.
This moves all the cutscene specific code out of the movie player code
and into the cutscene code so that the movie player can be reused for
usage in other environments.
This is required for #1041 since an implementation of that feature would
reuse the movie player code of the cutscene code but without all the
main loop stuff.
This allows to set string variables to localized values which will make
translating missions much easier.
This resolves one of the points mentioned in #1522.
If the previous rendering operation left the color mask in any other
state than completely enabled then the clear will only affect the
enabled channels. This makes sure that all channels are enabled before
doing the clear.
This fixes an issue reported on the forums:
https://www.hard-light.net/forums/index.php?topic=94200.msg1859118#msg1859118
This allows to use the XSTR mechanism in script to make translating
script text possible. This is compatible with the existing XSTR format
so automatic tstrings.tbl generator tools should work fine with this.
This resolves point 2 of #1522.
One of the main points of contention when adding the NanoVG based
TrueType text rendering was that it required an external Opengl
renderer which may interfere with our rendering engine by changing
OpenGL state without telling the rest of the engine. Since the rendering
interface for NanoVG is abstract and can be easily replaced, I did just
that and replaced it with an implementation that uses only generic
graphics functions without relying on the specific graphics API.
This will improve the interoperability of NanoVG with our engine and
should make later changes to the rendering engine easier since there is
no external rendering code which may interfere with our own code.
This was an issue since a lot of mods used wrong sounds and after the
FFmpeg changes the code would display a warning for those sounds by
default. This will restore the old behavior of printing the warning to
the log where it is easier to ignore if the mod does not explicitly
support 3.8.0.
This adds proper Unicode support by allowing the parse system to read
UTF-8 encoded files. The new mode is controlled by a mod option which
allows older mods to continue using the legacy text encoding.
That option changes the behavior of several systems in FSO. It disallows
the usage of Volition fonts since they don't support Unicode encoding
and changes a few usages of special characters to their unicode
counterparts of generic rendering solutions.
This fixes#1415.
The previous version used PATH instead of LD_LIBRARY_PATH which may have
caused some issues if the system is configured in a way that depends on
the value of LD_LIBRARY_PATH. It also broke launchers that tried to fix
library issues by changing LD_LIBRARY_PATH.
This changes the batched transform code so that instead of using discard
in the fragment shader it uses the built-in clipping capabilities of
OpenGL for removing invisible sub models. This improves performance in
GPU-limited scenes by ~1ms if shadows are enabled.
The original OpenGL Core changes only used a single vertex array object
for specifying the data layout of our vertex data. This uses the OpenGL
extension GL_ARB_vertex_attrib_binding to extend that so that each
vertex_layout uses a separate vertex array object which should improve
performance by reducing the CPU overhead while switching the vertex
layout. Since we need to use offsets into the vertex buffers at some
points this can not be done with the core functions since those do not
support specifying an offset when binding a vertex buffer.
GL_ARB_vertex_attrib_binding does support that and also features an
improved API for specifying the vertex layout. If that extension is not
available then the rendering engine will fall back to the current code.
In CPU intensive scenes I observed a frametime improvement of 1-2 ms.
Now that BMPMAN dynamically allocates the bm_bitmaps array, and deallocates it in bm_close(), which is explicitly called by gr_close(), FRED generates an exception on close because of trying to release bitmap handles after bm_bitmaps has been deallocated and set to null. This is because gr_close() is called by CFREDView::OnDestroy(), but the mission textures aren't fully paged out until CMainFrame::OnClose() (well, technically, CMainFrame::OnClose() calls CFrameWnd::OnClose(), which calls CWinApp::CloseAllDocuments(), which calls CDocManager::CloseAllDocuments(), which calls CDocTemplate::CloseAllDocuments(), which calls CDocument::OnCloseDocument(), which calls CFREDDoc::DeleteContents(), which calls CFREDDoc::editor_init_mission(), which calls reset_mission(), which calls clear_mission(), which calls model_free_all(), which calls model_instance_free_all(), which calls model_unload() for every model, which calls model_page_out_textures(), which *finally* calls the crashing bm_release()). This commit moves the gr_close() call to CMainFrame::OnClose(), *after* it calls CFrameWnd::OnClose(), which avoids the exception as bm_bitmaps is still intact long enough for those final textures to be freed from it.
FSO now allows the window title to be specified via game_settings.tbl, some never-used function arguments were pruned at the same time, and fred.rc now receives version information (for the About dialogue and the title bar) from a cmake-generated header, so the version numbers get filled in properly. Speaking of FRED's About dialogue, it now displays the copyright symbol properly.
In-mission events (SEXP chains that are used for directives and all mission logic) can sometimes call "training SEXPs", which depend on special variables set in the game_do_training_checks() function. However, this function was called near the end of game_frame(), well after mission_eval_goals() (which processes all mission events). This means that most training SEXPs wouldn't actually evaluate as true until the frame after whatever condition they were checking became fulfilled. This, combined with PR #1388 making the "targeted" SEXP actually use the appropriate variables (Players_target and Players_targeted_subsys), means that Diaspora's very first training mission's very first instruction (after launching from the launch tube, anyway) could not be completed, because the mission logic assumed that "key-pressed" and "targeted" would both return true on the same frame (which, after PR #1388, they did not).
This commit moves game_do_training_checks() to be called immediately before mission_eval_goals(), and therefore immediately after obj_move_all(), meaning Training_context_speed_set can become set the same frame the player's ship reaches the appropriate velocity and the relevant SEXPs can operate on the most up-to-date data available.
This will output the flags data in a better format than the current
binary format. For determining if the JSON output should be used this
uses an optional parameter for -get_flags. The command line parsing does
not cause an error if a parameter is specified for an option that does
not support them. This way, the launcher can just pass "json_v1" to the
option and an old build will just silently ignore it and use the binary
format.
For some reason, commit 8b43ed823c moved the consumption of the "#Soundtrack End" token out of parse_soundtrack(), when if a soundtrack needs to be skipped (e.g. because it's in a .tbm, flagged with +nocreate, and the original doesn't exist), it will skip straight past "#Soundtrack End" to reach the next "#Soundtrack Start". It also changed how music tables are parsed so that they'll skip any junk data that happens to be between sections, which is atypical of how tables are parsed. This commit changes both of these things: "Soundtrack End" is once again consumed near the end of parse_soundtrack(), and the while loop uses check_for_string() instead of skipping to the start of a section.
Even if bm_init() gets called more than once, for whatever reason. Unless bm_close() is called first, in which case it will re-allocate, potentially with a different MAX_BITMAPS (but it's okay, because there shouldn't be any active handles to worry about if bm_close() was called).
The texture array changes introduced the default material which is
similar to the passthrough shader but allows to use texture arrays. The
vertex shader is the same as for the passthrough shader so that shader
also supports clipping planes.
*Homing conditions are now consistant with in-frame checks
*Swarm missiles will now only change their homing pos during a change frame. This'll reduce their hit rate if SWARM_FRAME_STOP_SWARMING is too low, but will make their pathing more cinematic.
This adds support for specifying multiple sounds for a single game sound
entry. The engine then selects which sound will be played based on the
strategy provided by the game data. This required a few changes to some
of the game code since previously every game sound had exactly one sound
file attached to it. The most notable change is that it is no longer
possible to determine the exact duration a sound can have so instead the
new code computes the maximum duration a sound can have and uses that
where appropriate.
This also adds support for randomizing the pitch and volume of the sound
to provide a more varied experience even if only a single sound is used.
One possible issue that exists is that the "sequential" strategy only
works globally at the moment so if two sources use the same game sound
concurrently then the two sources will share the sequence of sounds
since there is no sound instance data at the moment. That can be added
in a future change but should not present a huge issue for most
use-cases.
Visual Studio on Appveyor somehow causes deprecation error on _our_
definition of vsprintf. I have no idea why these changes introduced this
warning but I won't debug Visual Studio compiler bugs that I can't
reproduce with my Visual Studio version so I just disabled those
warnings.
The code probably tried to check if the sound is available but since the
sounds vector is not long enough if the sound is not specified in the
table it would cause an out-of-bounds failure if the sound was missing
from the table. Furthermore, the current code would only have worked if
the sound was preloaded since the id is -1 until the sound is loaded for
the first time.
Previously, the source orientation was always aligned to the world so it
couldn't adapt to a weapon that changes direction. This fixes that by
introducing a "relative" mode for source orientations that is enabled by
default and disabled if the direction is set explicitly.
The particle sources of the beams were missing multiple properties
(direction and impact normals) and the generic shape effect didn't have
any way of controlling how long the source was active. This fixes that
by introducing an effect timing field similar to the single particle
effect.
Shield impact sounds now re-use the shield quadrant calculated by the collision code instead of naively recalculating based on global hitpos, allowing the hull impact sound to play if the shot pierces shields or was fired from within the shield mesh, and simplifying the relevant calculations in the process.
The function previously used glFramebufferTexture3D which caused issues
on the Mesa drivers and probably also with other drivers. This fixes
that by using glFramebufferTextureLayer which is the right function for
this use case.
This was previously not enforced and some code did not call this
function at the correct time which caused crashes since data was not
initialized correctly. This adds a check to ensure that the function was
called and fixes the code that uses the model_draw_list.
In previous versions of FSO the GPU data of a model was stored in
various different layouts depending on what data was required for
rendering that model. Since the transform batching code was added to the
model loading code this wasn't the case anymore since all data had to
use the same vertex stride even if the data wasn't used.
This made these changes possible where a standard C-struct is now used
for managing the layout of the data in GPU memory. This makes the code
easier to read and also easier to extend in the future since all layout
data is available in the struct.
This fixes a CTD when FRED is started since the graphics function
pointers are not valid at that point which causes a null pointer
dereference when starting FRED. This fixes that by checking if the
graphics system has been initialized before calling that function.
This fixes#1483.
I split this from #1331 to make reviewing these two changesets easier.
These changes convert all usages of const char* to SCP_string in the
static SEXP arrays so that the dynamic SEXP system can use SCP_strings
instead of having to allocate the strings and then somehow figure out
which strings must be freed at the end of the program.
This also converts the SEXP arrays to vectors so that new SEXP operators
can be added at runtime later.
This uses UBOs for building a buffer object of uniform data before
using that data to draw objects. This should reduce the CPU overhead by
reducing the amount of glUniform calls required for executing a single
draw call. This is especially useful if rendering is limited by the CPU
which should help performance for people with slower CPUs.
This fixes#910.
This restores the behavior from before the matrix system changes. The
observed behavior is more or less the desired behavior sinde setting the
2D projection matrix resets the model matrix stack but it happens to
work with the previous movie code since the 2D matrix is not set if no
perspective projection matrix was set before. This would need to be
fixed if the movie player should ever work within a mission but for now
this will fix the reported bug.
There is nothing specific to OpenGL in that code anymore since it's all
handled in the shaders at this point. This will make the lighting
information available in the normal graphics code which allows to use
those values when filling the uniform buffer for the model rendering.
This provides ~10% to 20% of an improvement if shadows are enabled. The
required features are not available in our OpenGL target version so I
added a fallback meachanism that will continue to use the standard
instancing method.
With an RX 480 and these changes I can play/watch the BP2 Icarus
cutscene at a consistent 60FPS which wasn't possible before.
This was requested by Axem for improving the usability of FSO
screenshots. This will remove the need to convert the TGA files to PNG
before uploading them to an online image hoster.
All transformations are now handled by shaders so there is nothing
special going on in the graphics API specific code anymore. Since model
uniform buffers require access to these matrices I moved the matrix
handling out of the graphics API code.
The PCX loader requires this or else the data isn't loaded correctly.
This matches what the code did before the texture array merge but it
only does it for PCX textures now since the other formats handle 32 and
24 bits per pixel correctly.
This fixes#1472.
If a 32-bit color shadow framebuffer is not supported this will first
try to fall back to 16-bit and if that still doesn't work it will
disable shadows completely. This should fix the rendering artifacts
reported on the forums here:
http://www.hard-light.net/forums/index.php?topic=93867.msg1854164#msg1854164
This adds empty lines to the beginning of the Lua source passed to the
interpreter so that the interpreter sees the lines in the source as they
appear in the table.
This might slow down parsing a bit since get_line_num is quite slow but
it should not be noticable in most instances since the script tables
tend to be quite short.
This fixes#1469.
Since the system already tracks if a buffer is still in use by the GPU
the buffer updates can assume that there will be no synchronization
issues if the buffer is mapped into memory.
This converts the deferred lighting shader to use uniform buffers for
the dynamic data sent to the GPU while rendering the lighting effects.
This doesn't affect performance but the deferred lighting code is a
nicely isolated piece of rendering code where I could test how the
rendering code could use the uniform buffers.
This is related to #910.
Back when I added the "same emp time for capships" flag in SVN r9540, I neglected to multiply the EMP time by 1000, as the EMP disruption time for fighters is specified in seconds but the time for capships is specified in milliseconds. So, using this flag would cause capships to suffer EMP disruption for almost no time at all.
This PR fixes that, and also extends the explosion-effect sexp to specify this parameter. And I also cleaned up the fireball section by calling eval_num(n) just once instead of several times.
Since 4500 strings are not enough for some mods there was a request for
removing that limit. I chose to use an unordered map for storing the
entries since the indices are not guaranteed to be sequential.
This fixes Mantis 3199.
When the OPF_NUMBER and OPF_POSITIVE behaviors were made more robust, it exposed a latent bug in the play-sound sexps. These had OPF_POSITIVE where they should have had OPF_NUMBER. With this fix, sounds can now play from all coordinates, positive or negative.
There is a bug where, when displaying an error message with a sexp node that contains a variable, the code will trigger an Assertion in the process of printing the error message. This is because it tries to transcode the sexp variable from name to index, when that has already been done further up the pipeline. This fixes that by adding a quick test to see if the expected variable name is an integer.
I changed those lines in another PR and forgot to revert these before I
submitted it. This will fix the OpenGL errors that appeared when shadows
were enabled.
Time-undocked will cause FSO to freeze unless you know what you're doing, so this PR fixes some gotcha areas. Inspired by The E's rant on Discord which, while not 100% correct, did indicate some areas for improvement.
1) Set the default "number of times docked" argument to 1 when the sexp is created in FRED, same as with the has-[un]docked-delay sexps
2) Catch any <= 0 counts when the sexp is called in FRED and set them to 1. (This was done for other sexps which used mission_log_get_time_indexed, but was not done for time-[un]docked for some reason.)
3) Add an assertion to mission_log_get_time_indexed as a last resort to guard against invalid counts.
This introduces a new function in the OpenGL state tracker which
combines setting the active texture unit and enabling a texture. The
reason this is a good idea is that this new function can filter out
unneeded calls to glActiveTexture if the texture is already enabled on
that specific unit. This happens very often when rendering several
submodels of a model which share their textures.
This is unlikely to yield significant performance improvements but
avoiding unneded OpenGL calls is always a good idea.
The code did not use the right method for calculating the required size
of the memory. This was never noticed before because the old OpenGL
texture loading code only used 16-bit textures for interface data but
the new code uses 32-bit textures which exhausted the available memory.
This was found and reported by @chief1983.
Since our target version is only OpenGL 3.2 all additional functionality
should only be used through their respective extensions to avoid
accidentially using a function not available in our minimum target
environment.
This converts all usages of bmpman textures to OpenGL texture arrays.
That means that all frames of an animation are stored in a single OpenGL
texture object and can be accessed at the same time in a single draw
call. This should significantly reduce the overhead of drawing lots of
particles since all particles of a single animation can be drawn with a
single draw call.
This fixes#1169.
Thanks to the new material system, it's now possible to easily make the
2D functions independent of the underlying graphics API which allows to
reduce the size of the gr_screen 2D API.
beam_pause_sounds() "pauses" looping beam sounds by setting their volume to 0; beam_unpause_sounds() "unpaused" by calling beam_recalc_sounds(), which only set the volume correctly when -no_3d_sound is set; 3D sound updates the sound's position without changing its volume. This PR just makes beam_unpause_sounds() perform the inverse operation of beam_pause_sounds() if 3D sounds are enabled.
Adds a new "+Pulse Interval:" countermeasure field that enables the new behavior; all countermeasures that don't have this field defined still use the old behavior of the global frame counter.
This changes countermeasure logic quite a bit, but I attempted to mitigate performance implications by re-using an existing traversal of the object list in order to build the list of active countermeasures each frame. If any countermeasures are actively pulsing in a frame, the object list is traversed again, looking for homing weapons. Each homing weapon then goes through the active countermeasure list and checks to see if it got decoyed. Most of this central logic is unchanged from the old behavior, although no longer separated into two functions, and it should be more efficient since it's using a prepared list of active countermeasures instead of traversing the object list looking for countermeasures for every homing missile (which are themselves found by traversing the object list).
It serves no purpose there since it's a message specifically designed to
be seen by modders and most times the stack trace doesn't even contain
useful information since there are no debug symbols present.
If the asteroid split rules were used and the asteroid speed happened to be 0 (for example if the field has an average speed of 0), the code would try to normalize a null vector. Now, a random vector is chosen in those cases.
Currently, the graphics code does some color remapping on 8
bit-per-pixel textures since those textures use special 4-bit pixel
values. These changes move that conversion out of the graphics code and
into the image loading/font bitmap creation code.
The reason this is needed is because this conversion breaks 8-bit
textures that try to use the full range of colors. I need to do exactly
that for moving the cutscene renderer to our generic rendering interface
which I can't do at the moment since the existing color conversion
corrupts the video data.
I have tested this with retail data and could not find any visual
changes after applying these changes.
SDL_HapticStopAll stops all effects, including the spring effect so the
joystick goes limp after one mission (joy_ff_stop_effects gets called at
the end of each mission).
This restarts the spring effect which should fix that issue.
This fixes#1417.
Any branch starting with "test/" will cause test builds to be compiled
and uploaded to fs2downloads. This will only work for the main
repository since the secure variables for the FTP credentials only work
for that repository.
This adds a small system for letting a mod specify which version of FSO
was designed for. That would allow us to introduce code which would
normally break backwards-compatibility by putting it in an if block
which checks if the mod supports the FSO version which ontroduced the
behavioral change.
There is currently no code which uses the new functions yet so I added a
few tests to verify that the options do what they are designed to do.
This fixes#1389.
In commit 735f5e199b randomtiger changed how anim_load() worked in seemingly-bizarre ways, for reasons unclear to me. In brief, a condition's logic was reversed, a three-value enum was created of which only one value was used, and as a result loose files passed to anim_load() (and only loose files) would be opened as "memory-mapped", one consequence of which is that they'd keep a cfile block open until the corresponding call to anim_free() (which means that, if a mission had enough different loose animations, the cfile block limit could be reached). Since files in packfiles behaved the same way they always had (namely, being loaded into memory and then closed, thereby not taking up a cfile block), apparently nobody noticed the difference, and this inconsistent code has stayed for the past 13-and-a-half years.
This commit changes the condition after the one changed in the older commit so that they both match, then changes the enum so that the seemingly-meaningless third value is removed, and the other two values are swapped (and the default value of the file_mapped parameter to anim_load() changed) so that the original Volition behavior is restored.
This also introduces the new generic dialog system which should allow
the mission code to open specific dialogs without depending on the
actual Qt implementation.
When streaming an ANI file, first anim_load() is called, then init_anim_instance(). The latter increments the animation's instance_count. If anim_free() is called on an animation that still has instances, it refuses to free the animation. generic_anim_unload() first called anim_free(), then free_anim_instance().
The fact that ANI files would ever unload at all seems to be because some code would unload twice. I can only assume that, combined with the fact that the bug only applies to ANI files, explains how this bug went undetected since November of 2009 (commit b43417882f seems to be when it was added, from a quick glance at git blame).
If we tell it to free up the animation, I think it should happen regardless of whether or not the HUD_TALKING_HEAD gauge is currently active or not. Also, unloading an animation shouldn't crash even if one wasn't loaded in the first place... and if it does, we should probably fix that instead of slapping a band-aid on the calling function.
The old code is not able to handle multi-threaded events so this change
simply filters out all the events that originated from another thread.
This fixes an Assertion caused by an invalid event.
This fixes weird misplaced special characters since the TTF strings
weren't rendered at the right position. This should fix that.
This fixes an issue reported on the forums by Novachen.
This could happen if the user enabled "Point to" and selected "Object"
without having an object selected. This can only happen when there is
only one object in the mission so it's only a minor bug but still
something worth fixing.
This was reported by @AxemP who wanted to have leading tabs in a text
line. However, split_str removed those characters by default since it
ignores leading whitespace. To fix that unexpected behavior of
gr.drawString I added a new paramter to split_str which disabled
whitespace removal and enabled that flag for the scripting function.
That should not be a problem for existing scripts since the expected
behavior would be that leading whitespace remains in place and since we
have not received any bug reports about missing white space I'm going to
assume that no one has used the function like this before removed those
characters by default since it ignores leading whitespace. To fix that
unexpected behavior of gr.drawString I added a new paramter to split_str
which disabled whitespace removal and enabled that flag for the
scripting function.
That should not be a problem for existing scripts since the expected
behavior would be that leading whitespace remains in place and since we
have not received any bug reports about missing white space I'm going to
assume that no one has used the function like this before.
At least on NVidia drivers, the medium-severity warning "Framebuffer unsupported. Framebuffer object Scene framebuffer is unsupported because the depth and stencil attachments are mismatched." would get repeatedly output to the debug log. @SamuelCho suggested this change, which gets rid of the warnings and doesn't appear to have introduced any graphical glitches.
Fixes#1382.
This assertion could apparently be hit if a ship was vanished (e.g. with ship-vanish) in the middle of talking. Rather than making the vanishing code aware of (and responsible for) Message_shipnum, it seemed simpler to just make hud_show_message_sender() clear the invalid shipnum itself.
The flagset changes probably broke this behavior by not respecting the "inconsistent" value set by the OnInit function when ships have inconsistent values for a specific flag. This should fix that and restore the 3.7.4 behavior.
Cutscene audio decoding was accidentally named "FFmpeg decode video", causing some minor problems in the profiling code (because the same name is used for actual video decoding, resulting in an assertion firing).
sexp_manipulate_colgroup() was using logical NOT when it should've been using bitwise NOT, meaning that removing any collision group would remove all collision groups.
This moves all the data related to the editor state that is not directly
connected to the renderer into its own class and file. This should
resemble the fredrenderer <-> fredview separation in the original FRED.
Also adds AVX2 autodetection so that AVX2-capable processors will generate AVX2 projects by default. To my surprise, there is actually a noticeable performance increase between AVX and AVX2 builds.
If framebuffer shockwaves were enabled and a 3D shockwave was created, FSO would use a hardcoded reference to the second slot of the Shockwave_info vector to generate the framebuffer shockwave for it. This only makes sense if and only if:
- the 3D shockwave command-line flag is also enabled
- the default 3D shockwave and default 2D shockwave are both present and loaded
- its the first mission of the session (because after that any shockwave not in the 0th index got unloaded)
I've changed the code so that which index the default 2D shockwave got loaded into gets tracked and used instead of a hardcoded index... and if both default shockwaves are loaded, the first two Shockwave_info indices are both kept between missions instead of just the first. This should allow framebuffer shockwaves to work with 3D shockwaves, regardless of whether or not it's the first mission of the session and whether or not a custom 2D shockwave was loaded (and happened to wind up at index 1). Slight downside in that missing the default 2D shockwave file, but having a custom 2D shockwave loaded, will now result in framebuffer shockwaves not being drawn at all, rather than using the custom 2D shockwave by accident; not sure that's really all that much of a problem, though.
Prior to APNG support, a regular non-animated PNG could be used as a still-frame command briefing animation. This started causing a crash when APNG support was added because any PNGs sent through generic_anim_stream() would get ga->type set to BM_TYPE_PNG, then sent through the APNG code... which would determine that they weren't APNGs, throw an ApngException, and generic_anim_stream() would return -1... except that BM_TYPE_PNG would still be set, so that when it later came time to render the still frame in generic_frame_render(), it would be sent through generic_anim_render_variable_frame_delay()... which expected a fully-formed APNG, tried to dereference ga->png.anim, and crashed.
This commit is a simple fix to reset ga->type to BM_TYPE_NONE if APNG processing fails, allowing the still-frame PNG to go through generic_anim_render_fixed_frame_delay(), the code path it used to take, and allowing it to display properly instead of crashing.
After someone tripped an assertion in the shockwave code which provided no details, I found some... questionable vector-related code. I changed all the code I could find that looped through the vector with iterator-based code, converted most Asserts into Assertions for more informative debugging, and added a couple Assertions to check previously-unchecked assumptions (which theoretically should never be tripped, but we'll see). A test build with the vector fixes resulted in the assertion no longer tripping so I'm fairly sure the improper erasure of the vector was causing problems (leftover data from a previous mission with a model number that no longer made sense because the model was unloaded).
The gun convergence code would detect if the target was within the minimum distance and move the predicted target point farther away if so, but wouldn't also alter the dist_to_aim variable to match; since predicted_target_pos is used by the autoaim code while dist_to_aim is what automatic convergence uses, this meant automatic convergence didn't respect the minimum distance at all.
Looks like this was broken in 7bb10d8408.
SND_MISSILE_START_LOAD and SND_BALLISTIC_START_LOAD (indices 33 and 200, respectively) could never actually play due to a logic error (they checked that a variable was true and the loop was on the last bank, when those conditions being met earlier in the function set that same variable to false). As far as I can tell, this broke back in 2006 with commit f300716e93.
This should make it possible to have both DLL version installed at the
same time without causing conflicts.
Combined with the new DLL, this will finally fix#974.
There's a bit of debug code that checks to make sure all ranks are in ascending point order; if this check fails, FSO calls Int3() instead of trying to describe the problem. I've changed it to a Warning that actually explains the problem, so the modder can fix it.
os_init_cmdline() contains the legacy-mode codepath in a conditional, but then doesn't put the non-legacy mode code in an else branch, resulting in cmdline_fso.cfg getting processed twice, leading to e.g. every mod getting loaded twice (which can cause all kinds of issues). This just wraps the non-legacy code in an else branch so that FSO running in legacy mode won't do both.
This renames the functions exposed by flagset so that it's clear that
64-bit values are returned. This also cleans up usages of wrong format
specified when that value is printed which caused some issues in the
past.
This should also fix#1336.
I encrypted those values using my user instead of our SirKnightly
account which meant that the values failed to decrypt. These new values
were encrypted using the SirKnightly user which should allow Appveyor to
upload the nightly builds to our FTP servers.
Since BinTray may be unreliable as our nightly host @chief1983 and I
decided that it would be best to return hosting to our dedeicated FTP
servers. These changes implement that together with a pending pull
request for the nightly script.
While searching for the cause of the rate-limiting of our BinTray
organization, I revoked the API key used by the CI servers in case the
key got compromised somehow. These are the updated keys which should
allow us to upload nightly builds again.
@chief1983 and I are working on a nightly solution which does not
require BinTray but until that works we need these updated keys.
fa60c666bc tried to fix an issue reported
by Coverity which was an intentional "issue". This restores the original
behavior which will cause a new coverity issue which can be ignored.
This fixes Mantis 3195.
The problem was caused by an oversight in 07107ce9b2 (namely, that changing some strings from being passed directly to string-formatting to being passed as arguments to a "%s" format-specifier meant that "%%" was no longer needed to get a plain "%" out the other side).
The iterator known as _L, besides having an absurdly poor name,
clashes with standard headers on OpenBSD -current at the time
of writing. This commit is the minimum needed to build on
OpenBSD with an updated C++ standard library.
FotG needs a tint shader for a feature; basically toggle screen tinting
when a key is pressed as a visual indicator of which mode your ship it
in. Was previously done in a custom shader.
2017-03-12 22:04:33 +10:00
1422 changed files with 265505 additions and 58730 deletions
FreeSpace: The Great War (Released 1998) and FreeSpace 2 (1999) are mission-based space combat simulators, like X-Wing/TIE Fighter and Wing Commander. Among the greatest games of the genre, they were also effectively the last.
The FreeSpace series follows humanity and their Vasudan allies as they fight to withstand the xenocidal, enigmatic Shivans, a species of unknown origin, vast technological capability, and seemingly limitless malice.
## FreeSpace Open
Thanks to Volition's generosity, we've continued development of FreeSpace 2 as FreeSpace Open, building graphical enhancements to bring the original games up to modern standards, telling new stories set in the FreeSpace universe and original worlds, and creating spectacular total conversions that let players fly in the beloved universes of Babylon 5, Battlestar Galactica, Wing Commander, and Star Wars.
## Hard-Light Productions
HLP is a fan community built on love and open-source code. We're dedicated to bringing modders together and giving them a place to share their own hard work and draw inspiration from the work of others. Thanks to Volition's generosity, we've continued development of FreeSpace 2 as FreeSpace Open, building graphical enhancements to bring the original games up to modern standards, telling new stories set in the FreeSpace universe and original worlds, and creating spectacular total conversions that let players fly in the beloved universes of Babylon 5, Battlestar Galactica, Wing Commander, and Star Wars.
Find us at:
- Our [website](http://www.hard-light.net/) and [forums](http://www.hard-light.net/forums/)
After installing retail FS2, use [Knossos](https://fsnebula.org/knossos/) to upgrade to the most recent release of FSO. Knossos is an advanced mod manager and launcher for FSO.
## Improvements
The new open source game engine has several distingushing features including:
- Linux and Mac OS X support
- OpenGL support
- OpenAL audio support
- Easy mod installation
- OGG support
- Hardware transform, clipping, and lighting
## The FreeSpace Upgrade Project
While the SCP improves the code of the game engine to enable new and exciting features, the FreeSpace Upgrade Project (FSU) creates material that takes advantage of the improved game engine.
The FSU improves the ships, effects, and background elements of FreeSpace 2. Every now and then these improvements are released as a pack called MediaVPs. These assorted improvements enhance the graphics of the game.
While the best way to experience the FSU is by playing the game with it, you can watch this [comparison video](https://www.youtube.com/watch?v=RM1YC_gK-qo) between 1999 and 2019 to have an idea of how much more beautiful FSU makes the game.
^(Much of this content was pulled from existing sources, such as InsaneBaron's "What Is Hard Light Productions" [thread](https://www.hard-light.net/forums/index.php?topic=86650.0), the Wiki's [Getting Started article](https://wiki.hard-light.net/index.php/Getting_started) and more.)
SET(IMPORT_EXE_DIR"IMPORT_EXE_DIR-NOTFOUND"CACHEFILEPATH"Required for a cross compiling build, point to binary directory of a cmake build for the real OS")
- With this release we decided to drop the "`3.Major_revision.Minor_revision`" versioning scheme in favor of a year based scheme since the Major and Minor versions did not have much meaning anymore. Instead the scheme will now be "`<year>.<number that is incremented every release>.0`". The last 0 is still there because some of our systems expect that. It will be gone at some point.
### Added
- Full Unicode text support: You can now use non-ASCII characters without having to worry about special fonts and special characters. This is an opt-in mod flag.
- Translation features for making it easier to only distribute one version of a mod which includes all languages.
- OpenAL Soft is included by default in binary distributions of FSO now.
- System for dynamically adding new SEXPs. With this a Lua script can expose functionality to the mission which can be used exactly the same as a standard SEXP with all the usual editing features in FRED.
- Support for displaying decals on the surface of an object.
- Integrated support for the [Discord Rich Presence API](https://discordapp.com/rich-presence).
- New markup based user interface system using [libRocket](https://github.com/libRocket/libRocket).
### Changed
- Exposed the movie player to the scripting API for advanced display features
- Various OpenGL optimizations for better graphics performance:
- Animations now use texture arrays
- Model uniforms get sent to the GPU using uniform buffers for less overhead
- Various other minor changes
- Converted pilot files from custom binary format to JSON
- Replaced Blinn-Phong BRDF with GGX BRDF
### Fixed
- Refactored bitmap slot handling and removed the fixed upper limit on the number of bitmaps. No more bmpman corruption!
- Support for APNG animations: [APNG](https://en.wikipedia.org/wiki/APNG) is a variant of the established PNG format which allows to store animations instead of single frames in a PNG file. This change allows to use these animation files in FSO which significantly improves usability for modders since they no longer have to store all individual frames as separate images.
- Physically-Based Rendering (PBR): This upgrade of our rendering engine allows to use [PBR](https://en.wikipedia.org/wiki/Physically_based_rendering) assets to make models look more realistic and allow more artistic freedom for modders since they have more control over how a model looks. This also added support for HDR lighting which should improve the overall graphics experience.
- Native particle systems: Particles have always been supported by FSO but the effects that could be created by them were very limited. There were some attempts to fix this by using Lua scripting for more advanced features but that suffered from performance issues. With these new particle systems that feature has been integrated directly into the engine which should improve performance and allow for better effects in the future.
- TrueType Font support: [TrueType](https://en.wikipedia.org/wiki/TrueType) fonts improve the text rendering capabilities of FSO by allowing to use freely scaleable font faces instead of the previous bitmap fonts.
### Changed
- We now use SDL2 on all platforms: SDL is a library for abstracting away the differences between different platforms. We now use SDL2 for all platforms which reduces the amount of platform-specific code tremendously and should result in better usability on all platforms. This was a major change that has been in development for several years. Here are a few key features that were added:
- Pilot and configuration data is now stored in the correct location across all platforms (this allows to run FSO on Windows from the Program Files directory without administrator rights)
- All platforms now use the ini files for storing settings. This fixes a lot of issues with the registry on Windows.
- Better support for input devices. Since SDL handles keyboard, mouse and joystick input we now have better support on newer OS versions. Note: This does not mean that we support multiple joysticks (yet). There is ongoing development effort to support this but this release does not have that yet.
- CMake build system generation: This isn't relevant for players but we are now using [CMake](https://en.wikipedia.org/wiki/CMake) for handling compiling our builds. This improves cross-platform support and allows to implement advanced compilation features across multiple platforms. Modders will like the new "FastDebug" builds which are like the previous "Debug" builds but are compiled with all the optimizations of normal Release builds. That should make modding a lot easier since you can now debug your mod with almost the same performance as a Release build.
- Improved shield effects: Rendering of the shields is now handled by special shaders which improves the overall quality of the effects and allows more freedom for future effects.
- Use OpenGL Core Profile for rendering: This is another major graphical upgrade which adds support for the OpenGL Core profile across all platforms (this was also made possible by the SDL2 integration). This upgrade allows us to use more modern rendering techniques and is especially useful for our Linux users who use the open-source Mesa drivers since our shaders failed to compile with those drivers. Now everyone will be able to enjoy the new graphical features added in this and previous releases. This also made some internal changes to how we handle rendering which improves the usability of our rendering engine within our code.
- Use FFmpeg for video & audio decoding: [FFmpeg](https://www.ffmpeg.org/) is a multi-media library which exposes functionality for decoding video and audio files to their raw form so that we can use that data. Thanks to this library we can now play 1080p cutscenes without any stuttering or frame-timing issues. It also allows to use more advanced audio and video codecs such as H.264 for video or Opus for audio.
- WebUI based multiplayer standalone server (for non-Windows platforms)
- Toggle subsytem scanning, scannable, cargo revealed, hidden from sensors, stealth and friendly stealth added to the `alter-ship-flag` SEXP
- Support added to add more languages besides English, French, German and Polish, leading the way to better localization!
-`player-is-cheating` SEXP
- New ship flag to enable smarter AI use of afterburners. Now it can use them while flying waypoints or attacking capital ships (use the `free-afterburner-use` flag with `alter-ship-flag`)
- Experimental configurations to make AVX builds (see [this post](http://www.hard-light.net/forums/index.php?topic=85566.0) for more explanations)
- Frame profiling code, see what exactly is slowing down FreeSpace. (Mostly for devs or coders)
### Changed
- Unstretched interface screens
- Automatically non stretched HUD gauges and simpler modder options for placing HUD gauges
-`show-subtitle-text` can now display messages as well as raw text
- Allow a user-specified number of credit images
- event.log can now snapshot events checked in a frame and record the status of an event the previous time it was checked as well as the current state
- Allow the specification of the positions of medals, callsigns and labels on the medal screen.
- The number of medals is now dynamic!
-`is-facing` now works for things that aren't ships (like waypoints!)
- allowing `fade-in` and `fade-out` sexps to use any color, not just black, white and red.
- Objecttype tables support for deciding how enemies respond to ship classes when disabled
- Allow modders to set a [mood](http://www.hard-light.net/forums/index.php?topic=81991.msg1639770#msg1639770) for builtin messages and then switch the mood for the mission on the fly using a SEXP
- Allow modders to set the chance of builtin messages being sent, how many will be sent per mission and how long is the delay between two messages
- Allow campaigns to be hidden in the campaign and tech rooms ([Game settings.tbl](https://wiki.hard-light.net/index.php/Game_settings.tbl#.23Ignored_Campaign_File_Names))
- Allow mods to set a default campaign ([Game settings.tbl](https://wiki.hard-light.net/index.php/Game_settings.tbl#.24Default_Campaign_File_Name:))
- Split the Locked flag so that you can lock Ships or Weapons on the game loadout screen independently
- Mixed ammo for primary and secondary weapons - [`$Substitute`](http://www.hard-light.net/wiki/index.php/Weapons.tbl#.24Substitute:) - Allows you to have a weapon that fires other weapon ammo in a specific pattern (say a Gatling gun with tracers).
- The active support ship limit per side is now dynamic. See [`set-support-ship`](https://wiki.hard-light.net/index.php/SCP_SEXPs#set-support-ship) for more info.
### Fixed
- Various multiplayer SEXP fixes
-`rotating-subsys-set-time` now accelerates properly
- [Fixed a whole heap of memory, logic and coding errors](http://www.hard-light.net/forums/index.php?topic=78044.0) -- using PVS-Studio: C/C++ source code analysis and checking tool
- show-subtitle-text can now display messages as well as raw text - Goober5000
- toggle subsytem scanning, scannable, cargo revealed, hidden from sensors, stealth and friendly stealth added to the alter-ship-flag sexp - karajorma
- Support added to add more languages besides English, French, German and Polish, leading the way to better localization! - karajorma
- event.log can now snapshot events checked in a frame and record the status of an event the previous time it was checked as well as the current state - karajorma
- added a player-is-cheating sexp - The E
- allow a user-specified number of credit images - Goober5000
- allow the specification of the positions of medals, callsigns and labels on the medal screen. - Goober5000
- lua function to check if a ship is warp capable, and access to a ship's auto-aim FOV - zookeeper
- is-facing now works for things that aren't ships (like waypoints!) - zookeeper
- experimental configurations to make AVX builds (see this post for more explainations) - The E
- new ship flag to enable smarter AI use of afterburners. Now it can use them while flying waypoints or attacking capital ships (use the free-afterburner-use flag with alter-ship-flag) - Admiral MS
- the number of medals is now dynamic! - Goober5000
- frame profiling code, see what exactly is slowing down FreeSpace. (Mostly for devs or coders) - Swifty + The E
- allowing fade-in and fade-out sexps to use any color, not just black, white and red. - Goober5000
Before you do anything, make sure you have updated your git submodules, either by running `git submodule update --init --recursive` or by cloning the repository with the `--recursive` flag.<br/>
<br/>
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
*`CMAKE_BUILD_TYPE`: Sets the binary build type between `Debug` and `Release` (default)
#### 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_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 automatically 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.
The main instructions for building can be found at our github wiki, on the [Building](https://github.com/scp-fs2open/fs2open.github.com/wiki/Building) page.
####The goal of this file is simply to offer a comprehensive checklist of things we must check when updating the documentation.
1. Changelog:
- Is [Changelog.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Changelog.md) up-to-date with the latest release?
- Is it in the proper [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format?
2. Build instructions:
- If a programmer who never built FSO before read the build instruction at [Readme.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Readme.md), would they manage to build FSO?
- Is the information in the file up-to-date regarding other matters (such as versions of tools mentioned, links to other guides, etc.)?
- Is the information in the [Building](https://github.com/scp-fs2open/fs2open.github.com/wiki/Building) article, and its sub-articles, still up-to-date?
3. Forums:
- Does the [Forum](https://www.hard-light.net/forums/index.php?board=50.0) contain enough clear information to help a new developer find their way into the up-to-date instructions?
- Is there anything that might mislead a new developer to stumble onto old tools, dead links and/or old versions of the project?
4. General documentation files:
- Is the information in the following files up-to-date?
- [About.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/About.md) (Should contain general information about FS, FS2, HLP, FSO and FSU)
- [Authors.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Authors.md) (Should contain information about the original developers, a way to see FSO's contributors, and special thanks to Volition and Dave Baranec)
- [Copying.md](https://github.com/scp-fs2open/fs2open.github.com/blob/master/Copying.md) (Should contain Volition's Copyright terms and a way to check FSO's Licensing info)
# Since the Travis CI people are not capable of enabling SSH/SCP support for their libcurl we need to build that manually...
# These commands are based on the tutorial from here: http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/
/wd4311# Disables warnings about casting pointer types to ints. The funny thing is these warnings can't be resolved, just disabled... - m!m
/wd4302# Same as above - m!m
/wd4366# The result of the unary '&' operator may be unaligned - m!m
/wd4592# "symbol will be dynamically initialized" is being generated by a compiler bug, see https://stackoverflow.com/a/34027257 for an explanation - m!m
$<$<CONFIG:Release>:/wd4101># In release mode there are unreferenced variables because debug needs them
/wd4995# "'vsprintf': name was marked as #pragma deprecated" is being caused by our custom definition of vsprintf. I have no idea what causes this or how to fix it - m!m
/wd4723# "potential divide by 0" is caused by some code that definitely will not divide by zero - m!m
/wd4121# "alignment of a member was sensitive to packing" happens in a Windows header - m!m
@@ -1640,7 +1665,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
}
else
{
Int3();// get ALLENDER
mprintf(("Potentially incorrect behaviour in AI goal for ship %s: Ship %s could not be found among currently active, departed, or yet-to-arrive ships.\nPlease check the mission file.\n",Ships[objp->instance].ship_name,aigp->target_name));
Assertion(ssp->turret_enemy_objnum>=0,"The turret enemy object number %d for %s on ship number %d is invalid.",ssp->turret_enemy_objnum,ssp->sub_name,ssp->parent_objnum);
DCF_BOOL2(asteroids,Asteroids_enabled,"enables or disables asteroids","Usage: asteroids [bool]\nTurns asteroid system on/off. If nothing passed, then toggles it.\n");
Assertion(goal_position>=cb->lib_offset,"Invalid offset values detected while seeking! Goal was "SIZE_T_ARG", lib_offset is "SIZE_T_ARG".",goal_position,cb->lib_offset);
cb->raw_position=goal_position-cb->lib_offset;
Assertion(cb->raw_position<=cb->size,"Invalid raw_position value detected!");
intresult=0;
if(cfile->fp){
// If we have a file pointer we can also seek in that file
Assertion(goal_position>=cfile->lib_offset,"Invalid offset values detected while seeking! Goal was "SIZE_T_ARG", lib_offset is "SIZE_T_ARG".",goal_position,cfile->lib_offset);
}
// If we only have a data pointer this will do all the work
Loaded 100 of 1422 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.