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.
This adds support for using clipping planes with the passthrough shader
by passing through the clip equation of the specified plane and then
using gl_ClipDistance for using the built-in clipping capabilities.
Invalid values previously corrupted the internal position counter which
caused crashes on some platforms because the position counter would
overflow in the next read operation. I added some assertions to track
the position counter corruption and it's probably a good idea to leave
them in to catch possible future errors early.
The actual fix was to just ensure that the seek position it always valid
for the file.
This fixes#1059.
This makes it easier to determine what takes the most time while loading
the mission (loading models) and how we could optimize that load time
(optimize model loading).
This is not a bug fix but it also shouldn't cause any regressions since
there are no actual code changes so this could be merged before the
release of 3.8.
The current shaders compute the clip values in the vertex shader and
then discard fragments if those values say that the fragment is clipped.
I don't know why this was done but, as far as I can tell, this behavior
can be fully replaced by using the built-in OpenGL clip-plane feature
which should also reduce the amount of fragment shader invocations. This
won't affect performance too much since we rarely use clip planes but it
seems like the correct thing to do.
This should make sure that the environment map is only redrawn if
necessary. In my case that should improve frame times by around 1ms for
the normal case when the environment map doesn't need to be redrawn.
The updated values for the distortion map were rendered too close to the
edge of the screen so they were clipped which meant that there was no
distortion data available. This fixes that by moving the rendered
primitives farther away from the edge. I'm not sure why this worked in
3.7.4, maybe the fixed function rendering used some slightly different
matrix.
I also don't know why this wouldn't work consistently across GPU vendors
but maybe the rasterization rules vary a bit across drivers.
This fixes#1307.
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.
Immediately clearing the z-buffer is definitely not a good way of
saving it for later use. This fixes the lightshaft rendering (which was
broken by my fix in #1282) by removing the depth buffer clear from the
z-buffer restore function. The z-Buffer is cleared anyway before
rendering into it so it shouldn't make a difference.
I'm pretty sure that this is a bug since the documentation of
std::string::copy says that it doesn't append a 0 byte so our code would
need to do it manually. Instead, the code appended the 0 byte to the
input buffer which also conflicts with const-correctness (the function
was used on a lua-string buffer which should be const outside Lua).
Due to some initialization order issues the original header string
wasn't printed to the log anymore. This fixes that by initializing
outwnd_inited before doing the initial outwnd_print.
The briefing icon lables previously just wrote the label string to the
mission files without surrounding it with an XSTR which made is
impossible to translate them. I fixed that by using the right function
call when saving the value.
This fixes Mantis 3193.
Previously, the key text would use the localized key name which made it
hard for scripts to consistently handle key presses across different
languages. This changes that interface so that it always returns the
english name of the key.
As described in #1278, the current scripting system has issues with
handling non-trivial C++ types. Since fixing that deficiency is too much
work, especially since we are in a feature freeze, I decided to simply
enforce the usage of trivial types for scripting handles. Fortunately,
only two handles used non-trivial types so it was relatively easy to fix
those instances by dynamically allocating those and only storing the
pointers in the lua memory.
This fixes a bug in JAD-XA where the game would crash at the last boss.
Also, I noticed that the HudGauge handle used a copy of the hud gauge
rather than a pointer to the actual instance so I'm pretty sure that any
scripting changes to a custom HUD gauge simply didn't work before.
The DRADIS has two icon types, one where the color is scaled with the
IFF color and once which isn't. Due to a regression, both icons were
previously scaled with the IFF color which made the icons look bad. This
fixes that.
If the descripting of a weapon is too long it would currently cause a
very unhelpful assertion message. This fixes that by checking the length
of the lines when parsing the weapon description. I removed the
assertions since the string is just cut of if it is too long so that
fixes the actual assertion.
I also added two unit tests for making sure that too long descriptions
cause warnings.
I found this issue while debugging the JAD gauntlet where a script calls
getSignature() on an invalid object. However, object_h does not see the
object as invalid even though its signature is 0 which is defined to be
an invalid sigature. This should fix that by making sure that
object_h::isValid returns false if the saved signature is not valid.
I just encountered this assertion while debugging another issue. As far
as I can tell, this can happen if the ship dies the same frame that
change_ship_class is called. Since a negative hull_strength value is a
valid value this assert is invalid. The CLAMP should ensure that the
following code still behaves as expected.
The generated shields did not respect the display offset specified in
the table so they were drawn out of the clipping bounds of the gauge
which meant that they were not visible. This fixes that by respecting
the specified display offset when rendering the shield icons.
I added the "allow high DPI windows" SDL-flag while investigating #998
but since that flag isn't used on Windows we can safely remove it again
without causing issues.
Since the rendering code always accesses all four frames it must be
ensured that they are all present. Currently, there is a bmpman
assertion about an invalid handle if the animation does not have enough
frames. This fixes that by warning about that and then resetting the
bitmap handle to -1 so that the rendering code doesn't try to use the
handle.
This sets the dpiAware flag which should improve the compatibility with
High-DPI displays. It also sets a few values for specfying what Windows
versions we support and it also enabled the nicer dialog boxes which
makes the error and warning dialogs look a bit nicer.
One of the nightly builds failed to compile with an error saying that it
had run out of heap space. This adds the suggested flag which should
hopefully fix this issue.
The C++ standard allows to have no return in a function but in most
cases that is not the desired behavior. There are currently no instances
of this warning in our code but I encountered this error while
developing something else.
The flag was previously used to restrict searching of mission files to
the root directory of the mod. Since the SDL merge changed what the
default root directory is (now it's the mod folder in the user folder)
this broke the mission editor and it didn't show any missions anymore.
This fixes that by altering how Skip_packfile_search affects the file
search. Now that causes the search to skip files in VPs but it still
includes all other files that are present on the disk.
I also fixed some inconsistent behavior in the various file enumeration
functions since they weren't doing the same thing.
This changes the original behavior slightly since new files aren't found
in this search since the file list is only initialized when CFile is
started so if a new file is added after that, it is not reflected in the
mission list. Since that is pretty rare we can probably ignore that
here.
This fixes#1224.
Cotire (the CMake module we use for handling precompiled headers) can
auotmaically generate a prefix header by examining the includes of the
project. However, if a system include changes, the prefix header may
change as well which triggers a complete project rebuild. To avoid this
and to add the ability to customize the prefix header, I added a
manually maintaned header which will be used by all platforms and which
will only change if that file is manually changed.
A piece of debris spawned from a ship will say what class of ship it came from. If that ship has an alternate class name defined in FRED, that's used instead. If the ship class table entry specifies an "$Alt name:", however, that isn't used, which could potentially be confusing. This fixes that oversight.
This fixes a bug whereby creating a pilot in the barracks screen (not the initial pilot selection screen) would effectively clone the variable vector from whatever pilot was selected beforehand.
If FSO runs for a very long time (5 hours to be exact) then the SDL
performance counter reaches a value so hight that rescaling it to
microseconds causes an overflow which is bad.
This fixes that by implementing the rescaling by computing the factor in
the timer initialization code and then multiplying the SDL time with
that. This uses the same principle as the changes done by @TheMatthew in #1082.
According to the tests done by @chief1983, this fixes#1237.
Previously, the hud gauge was hidden if the player ship had taken no
damage. However, this made it impossible to see if subsystems have been
damaged.
These changes make sure that the subsystem values are shown even if the
hull integrity is at 100%. This is done by first collecting all the
necessary information about each line in the gauge and then, if that list
is non-empty, rendering it. This is necessary since the gauge code can't
decide if anything will be visible before looking at the entire
subsystem list.
There is a minor behavior change with how popups are handled.
Previously, the code would return if the HUD gauge was a popup and its
strength was at 100%. However, I think that this was dead code anyway
since that condition could never be true at that point because the code
would have returned earlier if there was no damage.
This fixes Mantis 3183.
In large mods this caused memory issues since we reached the 32-bit
memory limit when loading all models of a large mod (e.g. Blue Planet).
I fixed that by explicitly unloading the loaded model once the code is
done with it.
This fixes Mantis 3177.
This regression was introduced with the new model draw list which separates
collecting the drawing information and actually drawing the objects.
Previously, the scripting hook was always executed and the override
condition was used to determine if the normal rendering should happen.
Since 3.7.4, the scripting code is only executed if the condition was
overridden by Lua and if that override is active then the model isn't
rendered at all.
This executes the scripting hook in all cases and then checks if the
scripting system specified if rendering of that object should be
skipped. This introduces some slight changes in behavior since, when the
scripting hook is executed, the object isn't actually being rendered but
instead it's added to the draw list. IMO, that is not a major issue for
any existing application or else we would have heard about that until
now.
This fixes Mantis 3175.
The code wrongly used return instead of continue. This caused a second
sun to disappear if the bitmap of the first sun wasn't drawn.
This fixes Mantis 3188.
This happened in BtA where a script changed the font after rendering its
UI. Since the briefing code didn't account for that, the word wrapping
code used the wrong font for calculating how long a line would be which
made the display look wrong.
Fixes a subtle problem with vm_test_parallel() wherein a relative error
was accidentally converted into an absolute error.
Instead of comparing the result of the cross product to the zero vector,
the two calculated components of the cross product are compared against
each other. This permits vectors whose cross product is a large number
but whose cross product partials are within relative error of each other
to be treated as parallel.
For example, the following two vectors may now be considered as parallel
whereas before they were not:
v1 = (1000004.0, 1.0, 1.0)
v2 = (1000000.0, 1.0, 1.0)
The relative difference between them is sufficiently small according to
vm_vec_equal() for them to be considered equal, but their cross product
would have elements whose magnitudes would be near 4.0 which would
otherwise indicate that they are not parallel. By comparing the partials
instead, a higher degree of consistency is maintained.
Signed-off-by: Peter Mitsis <[email protected]>
This fixes#1051 by explicity telling SDL to create the window in the
display corner instead of centering the window. This has caused some
problems because the window borders aren't visible anymore in this case
which lead to some confusion.
PNGs can have 16 bits per channel but we always tell libpng to reduce
that to 8 bits per channel. However, we do not tell the caller of
png_read_header that this will happen so instead of 32-bits per pixel,
we tell bmpman that the image has 64 bits per pixel which causes some
issues.
The specific issue I fixed was the system map of BtA where the jump
nodes used a 16-bit PNG which broke the alpha blending of those bitmaps
since bmpan though that the image had no alpha channel.
Previously, if a mod used an upper case "Data" folder (which is the case
for the Diaspora development files) the file enumeration would fail on
case sensitive platforms (e.g. Linux) since FSO searched for a path with
a lower case "data". These changes make it so that FSO looks for all
instances of the path type name regeardless of case. Since the real path
was also needed elsewhere I added a new cf_file field which stores the
actual path which can then be used by fopen operations.
This fixes#1182.
If the object number is set for the render info the renderer uses the
instance information of that object to render the model. That is not
correct for the lab since the instance data is handled by the lab code
in that case.
This fixes#643.
If there was only one object and that got deleted the code that keeps
track of the highest object index would cause a negativ array index. I
added a check to make sure that the index was positive but that still
means that Highest_object_index will be negativ after that function
returns. I looked at the usages of the value and that value seems to be
fine with that code so I think this should be safe.
The HDR changes made the nebula bitmaps a lot less visible. This fixes
that by boosting the color of the bitmaps when they are rendered.
I choose 3 since that gives a similar look to 3.7.4 but that can be
further tweaked if desired.
I also added two debug scopes to help track down where that stuff was
actually rendered.
This fixes#712.
The code the test was testing isn't used by anyway so we don't loose
test coverage. I'm also quite certain that the failure is caused by some
sort of compiler bug or wrong standard library implementation.
THe flagset changes misplaced the post-parsing flag processing so that
it was only executed if a special flag was found. That was not the case
previously and this restores that behavior. I also simplified the code a
bit while I was at it.
This fixes#1191.
Since the cubmap loading code explicitly states that it doesn't support
resizing it's only logical to skip that if the bitmap that is currently
being loaded is a cube map.
This fixes#611.
Since Unix is case senssitive this should make sure that case errors are
cought early in mod development. This is an Error and not a Warning
since a mod with such a folder structure would never work under Unix and
as such it's justified to break mods that currently use this.
The root issue of #976 was that the code that reset the depth buffer of
the scene framebuffer was actually setting the depth buffer of the bloom
framebuffer since that didn't get reset properly. To fix this I
introduced a system in our GL_state which keeps track of a stack of
"bound" framebuffers which allows us to return to the previous
framebuffer with a simple function call.
I also added support for GL_KHR_debug since that help me while debugging
which texture was in use. In the future I'll probably extend that to
other areas of the OpenGL code as needed.
This fixes#976.
Fixes pointer access violation when docked ships warp out by moving dock_undock_all call to red_alert_delete.
It was previously thought that dock_undock_all() was supposed to be within ship_cleanup() and was safe to do so. Nope.
dock_evaluate_all_docked_objects makes the assumption that the dock_list is still valid, so if the function called by it happens to nuke the dock_list (like with ship_cleanup) then it'll work with invalid pointer values.
It was previously thought that dock_undock_all() was supposed to be within ship_cleanup() and was safe to do so. Nope.
dock_evaluate_all_docked_objects makes the assumption that the dock_list is still valid, so if the function called by it happens to nuke the dock_list (like with ship_cleanup) then it'll work with invalid pointer values.
This is a bit complicated to explain, so stick with me.
When transferring energy from shields to weapons (or vice versa), the values modified are the so-called "target deltas" rather than directly modifying the shield strength or weapon energy values. The ship_chase_shield_energy_targets() function carries out actually meeting these targets without exceeding a change of ETS_RECHARGE_RATE percent per second. At least, that's what it's supposed to do, and obviously works that way when the target delta is positive.
When the target delta is negative, however, a logic error with the conditional meant to limit the rate of change instead functions backwards; if the amount of desired change exceeds the per-frame limit, the amount of change is set to the total desired change, and if the amount of desired change is smaller than the per-frame limit, than the amount of change is the per-frame limit (even though that's more than the amount that's supposed to be drained).
Since the target delta is modified by the amount by which the value changed, this leads to an interesting consequence whereby the "extra" amount taken away is added back in the next frame... which has another interesting side-effect if the "extra" drain tried to reduce shields below 0. Namely, the shield code doesn't let it, while ship_chase_shield_energy_targets() remains blissfully unaware that the actual change was smaller than requested. So on the next frame, you spontaneously get some fraction of a percent of your shields back. Which, naturally, you can then transfer energy from to your weapons ad infinitum; the amount is small, but you can continually transfer it, so you're getting weapon energy out of nowhere.
Now, straight-up fixing the logic error would be a major retail balance change; if transferring energy from your shields to your weapons only gradually reduced your shields, instead of taking a huge chunk at the start, it would be a much safer option. Therefore, the only non-balance-changing fix is to just remove the broken conditional entirely (so that it always drains the full amount instantaneously, regardless of how big or small it is).
I've left the fixed conditional commented out so that somebody, when we're not in a feature freeze, can add an AI profile or mod table flag to restore the check, allowing for slow energy transfers.
A conditional originally added to shield_add_strength() to make shields not recharge beyond the recharge limit forgot to check that the amount shields are changing by was positive (unlike a couple other conditionals added/modified around the same time), so a call to shield_add_strength() with a negative delta (e.g. when transferring energy from shields to weapons) when the current shield strength is at or above the recharge limit (i.e. full strength when a recharge limit isn't specified) would immediately return without doing anything. This would, of course, result in no change to shield strength... so if you had full shields and had drained your weapon batteries dry, you could get free energy by hitting the button to transfer energy from your shields.
Same as the GLSL version checks, these conditions were always true since
we only support OpenGL 3.2 now.
There was also an assertion condition that didn't make sense so I fixed
that.
These checks were from a time when we supported lower OpenGL version
than 3.2. Since we don't do that anymore and show an error if the
drivers don't support that, these conditions always evaluated to true
and could be removed.
secondary_animation_position wasn't being set by the ship_weapon constructor, which could cause potential issues with whatever uninitialized data it wound up being set to (like, say, being unable to fire any weapons in the second secondary bank until you've cycled through it once). Since it depended on uninitialized data, the behavior could even change between 32-bit and 64-bit builds (and Release/Debug, of course).
While I was at it, I also noticed some variables were getting set twice; in one instance (primary_animation_done_time), it was even being set to the wrong value the second time (according to the pre-flagset code that used memset() on it and then overrode some values that shouldn't have been zero). Not sure what problems that could've caused; possibly some issues with animations and primary weapons, I guess, if the "done" timestamp was invalid when it shouldn't have been.
* Adds a warning for debug users when an unknown ship_state is passed to red_alert_delete.
* Removes commented-out code
* Doxy's ship_cleanup()
*Conform to each file's style.
*Extend ship_cleanup to better handle red-alert deletion.
*Also treat cleanup_mode as a flagset, instead of an enum as it was previously.
*Use existing methods to determine dock status and find the head of the dock list.
*Fixes a derp with dock_dead_undock_all()
*Doccument some docking methods in object.h
*Address requested changes.
* Looks like a shallow copy wasn't enough, so this fix creates ship_weapons::clear() which is called by ship_weapons's constructor and by ship::clear().
In ship::clear(), The E removed
memset(&weapons, 0, sizeof(ship_weapon));
but did not add a corresponding
weapons = ship_weapon();
This fixes that. Additionally, this PR removes one of the two uses of ship::clear() by tweaking hud_observer_init. Originally, the code used memcpy, but if the assignment operator works for ai_info, it should be suitable for ship too.
vm_vector_2_matrix was improperly guarded against bad parameters. In the
case I encountered the uvec was the negative of fvec which produced a
null vector when the cross product of the two vector was constructed.
These changes should fix that bug by ignoring the uvec parameter. Since
vm_vector_2_matrix and vm_vector_2_matrix_norm are basically the same, I
converted the former into an alias of the latter and only fixed that
code.
Changes a few windows (tech room, campaign room, medal case, and HUD config menu) to issue Warnings instead of Errors if certain pieces of interface art are missing. If their mask bitmap is missing, they automatically close themselves and display the old "Sorry, this feature is available only in the retail version" popup from the demo, allowing FSO to run the demo data without crashing when you click on the wrong button.
It also restores the special demo popup for the campaign room, which allows you to at least restart the demo campaign without deleting and recreating your pilot.
Initialization of the medal window locks the mask twice (once directly and once indirectly, through set_mask_bmap()), then closing the medal window tries to release it after only unlocking it once. bm_release() will refuse to do anything if the BMPMAN entry is still locked, though, so the first release therefore does nothing, and since it will then only be released once (indirectly, by Medals_window.destroy()) after being loaded twice, the mask stays loaded in memory until FSO exits. By moving the release until after Medals_window is destroyed, the mask should be successfully released when the medals window closes.
The demo doesn't include techroom art because the demo doesn't have a techroom (or a campaign room, or a HUD config menu), but it still otherwise works with the higher-resolution interface.
If an event with a directive contains both an is-destroyed/is-destroyed-delay for a wing with multiple waves AND the event's Sexp_useful_number is 0 (either the event contains an "is-event-*" SEXP (or one of the "-delay" ones with the optional third argument not set), and that SEXP didn't return true, or some part of the event evaluated to SEXP_CANT_EVAL) AND the wing currently has 0 ships in the mission (so Directive_count gets set to DIRECTIVE_WING_ZERO to mark the directive as being "temporarily" true, until the next wave arrives), then the directive winds up in the list of displayed directives without actually having a born_on_date set, so it fails this assertion. Since this is caused by the data supplied (in the mission) rather than a coding mistake, and since this assertion doesn't actually seem to be guarding against anything (because nothing bad happens if the comparison happens anyway, just with a born_on_date of 0), and it behaves just fine in Release builds where the assertion isn't checked, the simplest solution would seem to be to just remove the assertions altogether.
Found this issue while testing with demo data, so blame whatever Canadian wrote the first demo mission to make the "Destroy Libra" event check for either Libra being destroyed OR an event (that can't ever become true until after at least one wave of Libra gets destroyed) becoming true.
Somewhat related to the previous commit: if, in the future, we have another instance of trying to unload a nonexistent graphic, it would make much more sense if BMPMAN returned -1 (like it already does for other failure conditions, like trying to unload an unused slot) rather than tripping the "n >= 0" assertion down below (calling with -2 or other negative values that can still trip that assertion unaccounted for, because those would definitely be mistakes in the code).
If Fade_anim.first_frame was -1 (like, for instance, if the animation did not exist, which it doesn't in the demo data), the briefing code would still try to do stuff with it, and then unload it when it closed. This seems like a bad idea in general.
It defaults to an empty string (resulting in no music) anyway, so there's no harm in it being missing, and the demo's mainhall.tbl doesn't contain these lines, so this change makes it possible to reach the mainhall with demo data.
This makes the debug window resizable and also reduces the default size
to ~80% of the used display. This also makes sure that the main window
has input focus after the debug window was created.
Currently there are multiple locations in the code where the version is
constructed by printing the individual numbers together. This is mostly
sufficient but it hides information such as the commit hash or the build
name (e.g. RC1). These changes unify that behavior by always using the
version string generated by CMake.
This allows to show the debug output in a second window in real time.
This system could be expanded further to allow more interactivity but
the current status is good enough.
When the function was rewritten as part of the TrueType PR, its logic was also unintentionally changed so that it expected timestamps in milliseconds when everything calling it provides "fix"es, which represent 65536ths of a second.
This changes some functionality but it shouldn't cause too many issues
since the previous functionality was kind of a hack anyway.
This also adds a simulation conditional hook that has only been
available through global hooks before.
This adds a utility library for handling all the nasty lua referencing
stuff. It also provides functions for convienent usage of lua objects
such as tables and functions which allows to use them directly from C++
code without using the ugly Lua C-API.
Not resizing the Messages vector here was leading to a debug error about an out-of-range vector subscript, and who knows what other problems were being caused by overwriting whatever memory was after the Messages vector. There's no equivalent problem when parsing, because as each message is parsed, it gets pushed onto the back of the vector instead of assigned directly to an index.
Makes beams inherit their firing ship's collision group if "$Weapons inherit parent collision group:" is enabled, and adds a collision group check to beam/ship collisions (and only beam/ship collisions, since collision groups are only currently checked for ship/ship and ship/weapon collisions).
This shouldn't break any existing mods, since usage of collision groups is surprisingly rare, and so is usage of weapons inheriting their parent's collision groups, and this change should only affect mods that do both at the same time; from a (very quick, non-representative) survey of modders, it's entirely possible that the mod requesting this change is the only one that does so (theoretically, there could be a mod out there that uses scripting to explicitly set the collision group of a beam object, but if they did so and then relied on it not actually doing anything, that's incredibly silly of them).
The timers on Windows apparently have a lower resolution than Linux
which causes issues with overlapping events. These changes apply an
offset to all timestamps if the same timestamp is detected while
processing the buffered events.
This is basically the old code but it has been ported to the new tracing
system.
There is still some weirdness with the percentages but I have no idea
where that comes from since I don't know the code.
This is a feature for developers that is not needed in FastDebug builds.
This should speed up these builds a bit since iterator debugging causes
quite a performance penalty.
Swaps the order of the scripting call block and the cycle-to-next-bank-if-out-of-ammo block so that e.g. "$On Weapon Fired:" scripts for a specific weapon type (which checks the currently-selected bank) will work properly when firing the last missile in the bank. Fixes issue #1091.
Since there are so many member I decided it would be better to use the
new member assignment syntax since that automatically guarantees the
right initialization order.
Before, they were assuming any joystick had at least 1 hat; this way, they now treat it similarly to buttons. If requesting the status of a button the joystick doesn't have, they return 0. If the joystick doesn't have a hat, querying a hat position will likewise now also return 0. This code will obviously need changed when we get around to proper (e.g. multiple) hat support.
When this line was converted by the bitset flags PR, it was accidentally changed from setting the flag to reading the flag, making it a do-nothing line and causing the flag to be cleared on mission load.
Before, if any parsing call failed it would throw an exception which
would have been propagated to the exception handler in main() which
terminates the program. This should fix that.
Upgrades and deprecates the original jettison-cargo-delay sexp by removing the unused delay parameter and adding a new parameter to control the speed of jettisoning. It further fixes the physics calculations by using the dockpoint normal instead of the vector between the center of the host ship to the center of the cargo.
See also the thread on HLP: http://www.hard-light.net/forums/index.php?topic=92844.0
This creates a factor that is used to multiply the timestamp. It will
overflow less, (once every 300 years or so) and not lose as much precision
as the previous implementation.
The performance is slightly improved, there are no more branches and one
floating point multiply.
Note: this relies on long double having a 64 bit mantissa. This is the
case on x86 Windows, Linux, and Mac OS. However, it is unconfirmed to
work on other architechtures.
Signed-off-by: Matthew Khouzam <[email protected]>
GL_EXT_gpu_shader4 is part of the GLSL 1.50 language standard so the
FXAA shader doesn't need to check against that. I also added a
conditional define for FXAA_GATHER4_ALPHA if the GLSL version supports
it which is the case when it's >= 4.00.
The other issue was a minor change from inout to out where Mesa
complained that the target variable might not have been initialized.
The new design is centered around the Event Trace JSON format but it
should still be possible to adapt it for other profiling tools. The old
profiling system has been removed.
Previous fixed used a logical NOT (!) instead of a bitwise NOT (~), derp!
In addition, the LE_VM_INTERNAL state now ignores VM_CENTERING, so it won't go false if the camera is returning to center.
primative_batch_buffer:desired_buffer_size was not properly initialized in vc120 compilers during debugging. Default constructors proved insufficient, and std:map::operator[] seems to ignore them anyway. This fix gets around that by explicitly clearing desired_buffer)size from within batching_init_buffer()
When this functionality was added in commit 0662cb6959 it made an explicit check to see if the node was -1, and if so (meaning the node is not present), defaulted the value to true; a month later commit 57c4855e25 "simplified" this to a single is_sexp_true() call, which returns false if the node isn't present... but the documentation still claimed that the default value was true.
Ten years later, and Axem wanted to know why his submodel wasn't being fixed by the repair-subsystem SEXP. I don't know if this is the first time in ten years anybody's wanted to use repair-subsystem on a destroyable submodel, or if everyone was just assuming it worked as intended and never noticing it didn't; regardless, while the "simple" solution would seem to be to fix the documentation (since the current behavior has been the actual behavior for almost as long as the feature has existed), it seems unlikely that there would be many unintended consequences of just fixing submodels by default, and if anyone has used these SEXPs in the intervening ten years, it was probably under the assumption that they worked as the documentation claimed.
Since Windows line endings include this character it needs to be ignored
since the text rendering would display it as an unknown character
otherwise.
This was reported by @AxemP.
Fix unlimited transfer of energy to shields (energy lost)
Fix thresholds in ai balance shields, rearm timer & call4help
Fix scaling in shield pain flash
Fix variable number of shield segments in shield pain flash
Lastly includes formatting tidy-up in shield pain flash
Make sure we've got initialized values in the secondary pattern indexes
for a ship_weapon and also allow linked/dual fire to be in sequence
instead of swapping in the base weapon at the beginning of each pattern
loop.
This fixes an issue where the event music cuts off after ~ 3 seconds
because the fields tracking how much data has been read so far were not
reset. I also fixed the calculation of how much data may be read since
that was slightly broken by the new audio stream reading code.
I'm not entirely sure if this is the correct way to do the computation
but I see no other way of fixing it but since the zero vector is a valid
value for the relative velocity this seems to be the most sensible
solution.
Also, related to this I found out that FSO causes a lot of NaN errors at
runtime which may need to be investigated at some point to make sure
they don't cause issues like this bug.
Reasons being; it's incompatible with FXAA, it's slow, and it's causing
OGL init to fail on certain systems. Oh, and it probably doesn't work
anyway :)
This will make sure that an exception doesn't just silently crash the
game (if the dialog can be shown at that point). This caused some issues
in the past so I thought it would be a good idea. I also added a check
for a preprocessor define to disable exception catching completely which
should make it possible to use a debugger to debug uncaught exceptions.
The routine vm_vec_normalize_quick_mag() did not normalize a vector.
Instead of dividing the vector by the 'quick magnitude', it multiplied
it. This routine was only called by one other routine (which was
fortunately unused)--vm_vec_normalized_dir_quick_mag().
Given both the incorrect behavior as well as their lack of use, those
routines have been removed.
Signed-off-by: Peter Mitsis <[email protected]>
Uses fl_abs() (which evaluates to fabsf()) instead of an if-else
statement to get the absolute value of a float. A compiler for the
x86 platform is able use SSE instructions to optimize calls to fabsf().
Signed-off-by: Peter Mitsis <[email protected]>
@niffiwan discovered that some retail sounds trigger the newly
introduced so the warning needs to be suppressed for those few files.
See #1005 for the full discussion.
Designed to work around issues with gunpoints on animated subsystems,
and those gunpoints being in the "triggered" position, and thus there's
lines pointing to empty space in the weapon loadout screen.
Use this to specify an alternate model that has the gunpoints in the
"correct" position.
ADPCM playback was broken by #991 when an older FFmpeg version (< 3.1)
was used. The newer version has a better API for handling decoder that
return multiple frames of data per packet which I already used. However,
I didn't bother implementing that for the older API since I haven't seen
a decoder that actually returned multiple frames per packet but ADPCM is
such a decoder. This fixes that by implementing the correct behavior
with the old API.
1) I accidentally used subshells for matching the tag patterns which
broke the regex match.
2) The destination directory for the library files wasn't created by
default so it broke the build.
- Add libs prebuilt with mxe
- Update cmake scripts to use them
- Make MINGW builds use the generic def_files inclusion method
- Some minor fixes to compilation
previous_primary_bank was only getting set if the ship had a ballistic weapon or if secondary banks were changed, so previous_secondary_bank wasn't getting set at all. I fixed the second problem my simply using the correct variables, and the first problem by consolidating the ballistic and non-ballistic code so that there was less code redundancy (without that redundancy, it's unlikely the mistake would've been made in the first place); I figured this was a better solution than just copying the code to set previous_primary_bank into the non-ballistic codepath.
Also simplified the code for setting the previous weapon bank according to asarium's suggestion.
This is the first step towards moving all audio decoding to FFmpeg which
will reduce the amount of external code we will need to include. This
only replaces the AudioStream code with an FFmpeg based solution which
should make the code easier to review.
It turns out that FFmpeg is actually able to decode the Interplay MVE
movies so we can drop the old MVE code and just use FFMpeg and the new
video player interface for that.
This was requested by @AxemP.
The implementation is a bit more complicated than simply retrieving the
value since that is only updated when the weapon is fired. Instead, the
function calculates what the current value should be based on the code
from the function that updates the value when the weapon is fired.
Setting the value is disabled since the extra processing code could
alter the calculation a script does so that after setting the value,
reading it again would return a different value.
The ogg/vorbis DLLs were linked with a dynamic runtime which caused the
error that was reported in the nightly thread. These new DLLs statically
link the runtime which should eliminate the dependency on the runtime
DLL.
Apaprently the alpha blend behavior has been broken for a long time and
alpha blending was always enabled. I changed the default lua opacity
type to match this behavior so that older scripts don't get broken by
this.
Also added the "Center Text On Gauge X-Position:" option for the Fixed Messages gauge, which by default is enabled only if the gauge's position is not overridden.
cmission.main_hall defaults to an empty string, so calling main_hall_init() with an empty string is neither unsurprising nor uncommon. Since it's not actually caused by bad data, the warning can be considered actively harmful by training users that sometimes FSO just gives you a pointless warning.
The codebase had quite a few instances of .size() being called and then checked to see if it was 0 or not (or less than 1, or greater-than-or-equal-to 1, which are basically equivalent), when .empty() could be called instead (negated or not, depending on what the original condition was).
Changes "A-Objects" to "OBJ_INDEX(A)" (not sure why that one didn't generate warnings, but whatever), removes a redundant should_be_ignored() call (it will have already been called for that ship for the code to be in that block in the first place), and adds an assertion to make sure that the jnp iterator is valid before trying to dereference it.
Most AI profile-related five-value lists are related to the number of difficulty levels. "$Detail Distance Multiplier:", however, is related to the number of detail levels (MAX_DETAIL_LEVEL + 1, because detail levels go from 0-MAX_DETAIL_LEVEL; MAX_DETAIL_LEVEL + 1 is also the size the detail_distance_mult array is defined with). Those two numbers happen to be the same (5); however, this may not always be the case in the future, and this way it's explicit that this field isn't related to difficulty at all.
Ignore_List (the list of flags used to determine if a ship is an invalid target) was originally a statically-initialized bitfield stored in an int; the new bitset flags code added a set_default_ignore_list() function to provide the default values, but then forgot to call it anywhere. As a result, "hidden-from-sensors" (and the other, less-likely-to-be-noticed flags) was having no effect on the player's ability to target anything. This adds a call to set_default_ignore_list() to ship_init() so that the original functionality is restored.
This uses the program binary support included in OpenGL 4.1 to build a
cache of compiled shaders. It does this by computing the MD5 of the
source code of the shaders and using that hash to save the files. That
should make sure that a change to a shader is automatically reflected in
the shader cache.
As far as I can tell this issue has been present for a very long time,
maybe even since retail. It was only uncovered since the recent changes
initialized the mission text by default which corrupted the table text
that was currently being parsed.
This also adds a unit test that validated that pausing works correctly.
A few things I noticed while working on ai-chase-ship-class, split out into a separate PR. Some code is reordered, some is cleaned up; nothing too extensive. The most notable changes are a) the modification of the Ai_goal_text function to work on the AI_GOAL_X #define directly rather than unnecessarily calculate the bit; b) changing the HUD text of "fly to ship" to "rendezvous with" plus the ship name; c) adding a Warning in ai_update_goal_references; and d) changing ship_name to target_name in ship_return_orders for clarity
texture2D has been deprecated for some time and Mac also doesn't support
it anymore. The 1.50 GLSL specification says that texture is the correct
function for texel lookup so I used that.
This adds unit tests (or maybe these count more as functional tests) for
parsing the intelligence data displayed in the tech room. It is parsed
from species.tbl by code/menuui/techroom.cpp and stored in the global
array Intel_info. The number of entries is saved in the global int
Integer_info_size.
Every test has its own mod dir with a species.tbl that it parses by
calling techroom_intel_init(). The test fixture resets the intel state
with techroom_intel_reset() between tests.
These tests assume that the file is preprocessed correctly, so it does
not try to test if e.g. comments are removed correctly, ... Only the
parsing that is unique to species.tbl is tested.
While it isn't strictly necessary since the Windows drivers typically
support the features we need it's still the better solution.
It also allows WINE to run FRED2 on Linux since there the code profile
is actually needed.
This is not technically correct since the FRED code is not able to
create an OpenGL Core context but since FRED is Windows only it's not a
problem because those drivers usually support the Core profile features
in the Compatibility profile.
tech_render_anim did not check whether there were any intel/weapon
entries before trying to read from Current_list, which means that it
read at Current_list[-1], which is a Bad Thing (TM).
Do not try to render an anim if there is no entry.
Add missing new line to BSP Parse timing and make it nprintf("Model").
Log value of HUD_config.rp_dist when it is not valid.
Fail reading a .plr file if it has a zero-length section.
startSectionWrite would push unnamed sections on _sectionOffsets, but
endSectionWrite was not removing them, leading to _sectionOffsets
containing tens of unnamed sections when parsing the HUD config.
Pop the unnamed sections in endSectionWrite.
Opening the log file failed when the data path did not exists, e.g.
during the user's first run. Create it before trying to open the log
file.
Also, include <direct.h> in windows_stubs/config.h since the equivalent
stubs for Unix are also declared there.
This fixes a few of the bad design descisions of previous shader
iterations. This uses a dedicated class for managing the resources and
uniform locations of a shader program.
Uniforms are also stored in this object which makes a lot more sense
than storing them in the OpenGL state where they had to be reset every
time a new shader was used.
There are still a lot of possible enhancments to make, e.g. by using
uniform blocks and buffers instead of standard uniforms which would make
uniform location handling easier.
Another optimization that I will investigate is reducing the amount or
different compiled shaders by turning some of the current compile-time
defines into bool uniforms.
This uses GL_KHR_debug for exposing debug group information. This is
very useful for tools like apitrace where it's used for assiciating
OpenGL commands with a specific application function.
The groups are created using a utility macro which is removed in release
builds so it should have no impact on the release performance.
The previous code generated a lot of OpenGL function calls because every
star was rendered using a separate NanoVG frame. This fixes that by
using the path renderer directly which removes most of the
inefficiencies.
This is related to #898.
The code was using the 32-bit types while being compiled under 64-bit
because a header was missing. I fixed this issue by using fixed width
integer types.
It was setting the Pierce_shields flag based on whether or not the Beam flag was set, rather than based on whether or not the beam flag was explicitly provided; as such, a TBM entry for a non-piercing beam that contained a "$Flags:" entry but didn't re-set "no pierce shields" could spontaneously regain its piercing status (explicitly setting "beam" again will re-add piercing, but this should match previous behavior).
This fixes an Int3 in the ai code where it couldn't find a ship that was
destroyed before a mission. This was found through a mission bug in
FreeSpace Blue "Slaying Ravana" where the "Somtus" is marked as
destroyed before mission but then the AI is given orders which target
that ship.
Also adds code for detecting if the FreeTrack client is actually
reporting valid values. I only tested it with FaceTrackNoIR so it may
not work for other head trackers.
For some reason, FRED has some code that checks a checksum and if it
doesn't match it exits after a certain time with an obscure error
message. It doesn't affect us since the checksum is always right but it
was probably some kind of DRM at some point.
Avoid potential uint overflow if joystick returns a range greater than
the maximum expected range. I guess this could also be fixed by
limiting raw to rng-1 (?)
* Moves a camera lock statement into do_view_chase() to coincide with do_view_slew()'s style;
* Resets camera angles when transitioning into chase and external views from target padlock view;
See also my comments on #762. The flag is almost entirely redundant, so this PR removes it in all instances where it's used in the ballistic primaries code. There are one or two places where removing it was not a no-op, so I adjusted the rest of the code accordingly (most notably in the parsing validation when it checks that primary weapon cargo has been assigned). I also added a few divide-by-zero checks and slightly tweaked the support ship rearm code. The use of the SIF_BALLISTIC_PRIMARIES flag in the ingame_join code was replaced with a dummy value to avoid bumping the multiplayer packet version number.
This disables all mouse grabbing which is useful for debugging when SDL gets interrupted without giving up
control of the mouse. That usually leads to problems since you can't
interact with the debugger window anymore.
_mkdir was horribly broken. It was creating all directories in the given
path but failed to create the actually wanted last portion.
On Windows, _mkdir only creates the last portion.
Fix this by simply calling mkdir, which does the Right Thing (TM).
This is a new implementation of the JSON dumping which was already
proposed in #22 but this version tries to allow implementing both
reading and writing JSON files without having to change the existing
code too much. This is done by using an abstract class to hide the
differences between writing the JSON and binary files.
This is currently only capable of writing the files but not reading them
so if the option is enabled all changes to the pilot file are lost. I
will implement reading after this PR has been merged since I would like
to reduce the amount of changes that need to be reviewed.
Starting with git 127976c (#851), FSO fails to start, displaying an
error. This is my attempt to fix it. FSO starts, but I do not know how
to check that the flags are parsed correctly.
* Adds VM_CENTERING to replace view_centering
* view_modify() now takes care of centering the view
* Reorganized view-related controls and logic to be cleaner
If "value" is empty, then attempting to access "value[value.length() - 1]" is equivalent to trying to access "value[-1]", which is an out-of-bounds access (causing debug builds to complain and undefined behavior).
When PR #831 got rid of a warning in sexp_event_delay_status(), it did so by getting rid of the 64-bit temporary variable (in order to get rid of a warning in the non-use_msecs branch). However, that 64-bit variable was protecting against overflow when using numbers of milliseconds >= 65535, which are used by e.g. the Icarus cutscene mission from Blue Planet, leading to interesting (but wrong) behavior.
This restores usage of the uint64_t temporary variable by reverting that specific change, but then avoids the warning by moving that temporary variable to be inside the use_msecs branch; I get no warnings when compiling this version of sexp.cpp, and Icarus works again.
The new joystick API (commit f91c681ee1) didn't include calls to joy_ff_init() and joy_ff_shutdown(), disabling haptic support. Simply restoring these calls was enough to make it work on my system again.
If CurrentJoystickGUID was present but set to an empty string, the new code was comparing all joystick GUIDs against the empty string, and therefore concluding that no joystick was currently selected. This just treats an empty string as though CurrentJoystickGUID weren't set at all, allowing the index-based CurrentJoystick to take over.
While working on #824, I found out that cleaning up that particular piece of code would not be doable cleanly without a refactor of the multi_sexp infrastructure. This is that refactor; it encapsulates the code of multi_sexp inside a class, an instance of which is then used to manage all the network stuff that sexps need to do.
Kobrar reported that joystick events were not properly assigned to the
right Joystick instances because the GUIDs of the joysticks was the same
(that's another problem since the code assumes that they actually are
Globally Unique like the name says).
The fix was to simply use the instance ID for checking if two sticks are
the same which seems to work more reliably.
* There's now registers for both 4 position and 8 position hats for both timestamps and downcounts
* There's conversion code to allow an 8-position hat to act like a 4-position hat, which is needed by the FSO codebase which only uses 4-pos hats
* There's also conversion code to allow a 4-pos hat to act like an 8-position hat to some degree.
Target priorities could previous only select based on very few flags, for the simple reason that very few were defined in the ai_tgt_*_flags[] arrays. This simply adds additional flags (even some that seem a little silly; I can't actually think of a reason to especially target "objects that are being rendered", but hey, maybe somebody will find a use for it in the future).
This introduces a new mechanism for handling bit flags. Instead of using an int (or two, or three) to write bits into, this uses the std::bitset in a wrapper class that accepts an enum class as input. This means that certain classes of errors we've had a few of in the engine, where a coder used the wrong set of flags or checked them against the wrong variable (SF_STEALTH vs SIF_STEALTH, for example) can now be detected at a compiler level rather than not at all.
getHatPosition() returns a value from the HatPosition enum, so the conversion to a 0-based index is incorrect (and causes the hat switch to basically not work with continuous controls).
When the hat switch code was fixed to restrict joysticks to 32 buttons again, it forgot to invalidate buttons between numButtons() and 32. This could lead to some assertions being failed when the joystick got asked for the status of a nonexistent button.
* Fix (undocumented) issue with hat presses not registering.
* Use array instead of a vector for _hat::DownCount
* No, no die-nam-ick numbor of boot-ons to-day. Und no, ve only haff vone hat. Sad Heavy is Sad.
* Fixes an out-of-bounds error caused by incorrect indexing in Joystick::handleHatEvent.
Also fixes a bug where the hatGetDownTime would return a nonzero value if the hat was active but in a different position than the input parameter.
If the -noninteractive command line option is set then dialogs won't be
shown and the default action is taken. This should be useful for
the standalone server.
Apparently MSVC 2013 allocates memory when locking a mutex which calls
our allocation hook when the tries to call our memory tracking function
which leads to a deadlock. Since there is no way of providing a memory
allocation function for std::mutex the best solution is to simply
disable the lock_guard for everything before MSVC 2015. That will
probably corrupt the memory tracking values at some point but it's
better than not being able to run FSO at all.
Coverity defects 1320483, 1320484, 1320485, and 1320486 noted that several values were being set and then immediately overwritten before they could do anything. These appear to be related to behavior that Volition disabled before release that would allow the AI to slow down while attacking capital ships. It seemed a shame to waste this code, so I've added a flag to enable the behavior.
This allows to use a different method of creating and managing the
OpenGL context. This is needed of wxFRED where the OpenGL context is
created by wxWidgets. This will probably also fix#753 since it uses the
old wgl based method of creating an OpenGL context in FRED.
If a required argument is invalid, ade_get_args() returns 0, but it wasn't making sure va_end(vl) got called first, leading to potential memory corruption (probably not a huge issue in actual usage because most people try not to release scripts that throw errors).
Previously the code simply skipped the invalid tokens and silently
ignored them. This is frustrating for modders and also let #758 slip
into the code base which would not have happened otherwise.
This removes the built-in OpenGL function pointer because we don't need
it since we are using the SDL function for that. Also explicitly uses a
compatibility loader although that has no effect on the generated code.
The documentation says that the SDL OpenGL attributes need to be
initialized before a window is created. These changes implement that by
moving the actual SD_Window creation inside the OpenGL setup. FRED only
sets the native window handle to the correct HWND and gropengl uses
that.
"Unchecked return value from library". The function can't return an
error value so I added a ml_printf (which is used at another place for
error logging as well) to log the error.
It looks like this was added to trunk (a0f31e6), synced with antipodes (4952b70), and then one of the antipodes merges (7e77b5a) wound up combining both additions.
The Assertion which was triggered was carried over from the OpenGL code
but the stub code was using pretty much the same code so removing the
Assertion seems like the correct way to solve this.
This instructs SDL to create an OpenGL debug context when a debug build
is used. Additionally it uses GL_ARB_debug_output if it's available to
provide OpenGL debug output.
This allows to use standard TrueType Fonts for text rendering in FSO. It uses the NanoVG library which provides the ability of drawing 2D shapes. This library is used for most 2D operations now and can also be used directly by using the PathRenderer class.
The CMake merge changed the default files system to include individual files instead of use a bunch of hardcoded strings, but the old file got left behind for some reason. Also, the same merge added some spurious extra imports of def_files.h which I removed at the same time (although if somebody wanted to go through and clean up all of our imports again, it'd probably be a good time for it).
The launcher passes the mod folders as relative paths using / as the
directory separator. That path is copied into the cf_root path and when
cf_create_directory tries to create the directory, mkdir_recursive can't
handle the / in the path and tries to create two path elements at once
which is not supported by mkdir.
These changes fix that by converting mod paths to the native format
(from the / format, so it's a No-op on Unix) before using it in
cf_create_root().
This expands the existing system which only worked on Windows to all
supported platforms.
If the MSVC debug runtime is not present then its behavior is emulated
by adding a header to each allocated memory block.
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")
option(FSO_BUILD_APPIMAGE"Build an AppImage package"OFF)
ENDIF(WIN32)
OPTION(FSO_BUILD_TOOLS"Build tools related to FSO"OFF)
OPTION(FSO_BUILD_TESTS"Build unit tests"OFF)
OPTION(FSO_DEVELOPMENT_MODE"Generate binaries in development mode, only use if you know what you're doing!"OFF)
OPTION(FSO_BUILD_QTFRED"Build qtFRED2 binary"OFF)
IF(WIN32ORAPPLE)
# On windows and mac the default should be to always build the included libraries
SET(FSO_BUILD_INCLUDED_LIBS_DEFAULTON)
ELSE()
SET(FSO_BUILD_INCLUDED_LIBS_DEFAULTOFF)
ENDIF()
OPTION(FSO_BUILD_INCLUDED_LIBS"Build and use the included libraries istead of using the system headers and libraries"${FSO_BUILD_INCLUDED_LIBS_DEFAULT})
OPTION(FSO_USE_LUAJIT"Use LuaJIT for Lua scripting, needs a working internet connection!"OFF)
OPTION(FSO_USE_OPENALSOFT"Download and build OpenAL Soft instead of using the system libraries"OFF)
OPTION(FSO_FATAL_WARNINGS"Determines if warnings in the build are considered fatal errors, primarily used for CI"OFF)
SET(FSO_FREESPACE_PATH"${CMAKE_INSTALL_PREFIX}"CACHEFILEPATH"The path of the FreeSpace directory you want to use. Please note that you will have to change CMAKE_INSTALL_PREFIX if you change this at some point.")
SET(FSO_RUN_ARGUMENTS""CACHESTRING"Additional arguments passed to a generated executable when run with the generated build files.")
option(FSO_INSTALL_DEBUG_FILES"Install some debug files (currently only PDB files on windows)"OFF)
option(ENABLE_COTIRE"Enable cotire for faster compilation. Enabled by default."ON)
option(FSO_RELEASE_LOGGING"Enable logging output for release builds"OFF)
OPTION(FSO_BUILD_WITH_FFMPEG"Enable the usage of FFmpeg for sound and custscenes"ON)
MARK_AS_ADVANCED(FORCEFSO_CMAKE_DEBUG)
MARK_AS_ADVANCED(FORCEFSO_BUILD_INCLUDED_LIBS)
MARK_AS_ADVANCED(FORCEFSO_USE_OPENALSOFT)
MARK_AS_ADVANCED(FORCEFSO_USE_LUAJIT)
MARK_AS_ADVANCED(FORCEFSO_DEVELOPMENT_MODE)
MARK_AS_ADVANCED(FORCEFSO_FATAL_WARNINGS)
mark_as_advanced(FORCEFSO_INSTALL_DEBUG_FILES)
mark_as_advanced(FORCEENABLE_COTIRE)
mark_as_advanced(FORCEFSO_RELEASE_LOGGING)
mark_as_advanced(FORCEFSO_BUILD_WITH_FFMPEG)
# Include cotire file from https://github.com/sakra/cotire/
- 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
In 2002 Volition released the source code for Freespace2. In the years since dedicated individuals have added countless new features to create a flexible and powerful space combat simulation engine. More info can be found on our [wiki](http://www.hard-light.net/wiki/index.php/Source_Code_Project)
People interested in contributing are encouraged to read [this thread](http://www.hard-light.net/forums/index.php?topic=82688.0)
The "projects" directory contains ready projects for:
* Microsoft Visual C++ 6, 2005, 2008, 2010, 2011, 2013, 2015
* Apple Xcode
* Code::Blocks
* Eclipse
Review the commit logs to see what's new.
See the INSTALL file for instructions on how to build fs2_open, or open the relevant MSVC project
Before you do anything, make sure you have updated your git submodules, either by running `git submodule update --init --recursive` or by cloning the repository with the `--recursive` flag.<br/>
The main instructions for building can be found at our github wiki, on the [Building](https://github.com/scp-fs2open/fs2open.github.com/wiki/Building) page.
####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/
option(MSVC_USE_RUNTIME_DLL"Use the dynamically linked version of the runtime"OFF)
option(MSVC_RELEASE_DEBUGGING"Set options that allow to debug release builds"OFF)
MARK_AS_ADVANCED(FORCEMSVC_USE_RUNTIME_DLL)
MARK_AS_ADVANCED(FORCEMSVC_RELEASE_DEBUGGING)
# These are the warnings we disable
set(WARNING_FLAGS
/wd4100# unreferenced formal parameters
/wd4127# constant conditional (assert)
/wd4201# nonstandard extension used: nameless struct/union (happens a lot in Windows include headers)
/wd4290# C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
/wd4390# empty control statement (triggered by nprintf and mprintf's inside of one-line if's, etc)
/wd4410# illegal size for operand... ie... fxch st(1)
/wd4511# copy constructor could not be generated (happens a lot in Windows include headers)
/wd4512# assignment operator could not be generated (happens a lot in Windows include headers)
/wd4514# unreferenced inline function removed
/wd4611# _setjmp warning. Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us.
/wd4663# C++ language change (template specification)
/wd4710# is inline function not expanded (who cares?)
/wd4711# tells us an inline function was expanded (who cares?)
/wd4786# is identifier truncated to 255 characters (happens all the time in Microsoft #includes) -- Goober5000"
/wd4996# deprecated strcpy, strcat, sprintf, etc. (from MSVC 2005) - taylor
/wd4311# Disables warnings about casting pointer types to ints. The funny thing is these warnings can't be resolved, just disabled... - m!m
/wd4302# Same as above - m!m
/wd4366# The result of the unary '&' operator may be unaligned - m!m
/wd4592# "symbol will be dynamically initialized" is being generated by a compiler bug, see https://stackoverflow.com/a/34027257 for an explanation - m!m
$<$<CONFIG:Release>:/wd4101># In release mode there are unreferenced variables because debug needs them
/wd4995# "'vsprintf': name was marked as #pragma deprecated" is being caused by our custom definition of vsprintf. I have no idea what causes this or how to fix it - m!m
/wd4723# "potential divide by 0" is caused by some code that definitely will not divide by zero - m!m
/wd4121# "alignment of a member was sensitive to packing" happens in a Windows header - m!m
SET(MSVC_SIMD_INSTRUCTIONS"${MSVC_DETECTED_SIMD_INSTRUCTIONS}"CACHEFILEPATH"The SIMD instructions which will be used, possible values are ${POSSIBLE_INSTUCTION_SETS}")
#define AIG_TYPE_PLAYER_WING 4 // from player direct to wing
#define AIG_TYPE_DYNAMIC 5 // created on the fly
// flags for AI_GOALS
#define AIGF_DOCKER_INDEX_VALID (1<<0) // when set, index field for docker is valid
#define AIGF_DOCKEE_INDEX_VALID (1<<1) // when set, index field for dockee is valid
#define AIGF_GOAL_ON_HOLD (1<<2) // when set, this goal cannot currently be satisfied, although it could be in the future
#define AIGF_SUBSYS_NEEDS_FIXUP (1<<3) // when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
#define AIGF_GOAL_OVERRIDE (1<<4) // paired with AIG_TYPE_DYNAMIC to mean this goal overrides any other goal
#define AIGF_PURGE (1<<5) // purge this goal next time we process
#define AIGF_GOALS_PURGED (1<<6) // this goal has already caused other goals to get purged
Formation_wing,// Fly in formation as part of wing.
Awaiting_repair,// Awaiting a repair ship.
Being_repaired,// Currently docked with repair ship.
Repairing,// Repairing a ship (or going to repair a ship)
Seek_lock,// set if should focus on gaining aspect lock, not hitting with lasers
Formation_object,// Fly in formation off a specific object.
Temporary_ignore,// Means current ignore_objnum is only temporary, not an order from the player.
Use_exit_path,// Used by path code, to flag path as an exit path
Use_static_path,// Used by path code, use fixed path, don't try to recreate
Target_collision,// Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
Unload_secondaries,// Fire secondaries as fast as possible!
On_subsys_path,// Current path leads to a subsystem
Avoid_shockwave_ship,// Avoid an existing shockwave from a ship.
Avoid_shockwave_weapon,// Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
Avoid_shockwave_started,// Already started avoiding shockwave, don't keep deciding whether to avoid.
Attack_slowly,// Move slowly while attacking.
Repair_obstructed,// Ship wants to be repaired, but path is obstructed.
Kamikaze,// Crash into target
No_dynamic,// Not allowed to get dynamic goals
Avoiding_small_ship,// Avoiding a player ship.
Avoiding_big_ship,// Avoiding a large ship.
Big_ship_collide_recover_1,// Collided into a big ship. Recovering by flying away.
Big_ship_collide_recover_2,// Collided into a big ship. Fly towards big ship sphere perimeter.
Stealth_pursuit,// AI is trying to fight stealth ship
Unload_primaries,// Fire primaries as fast as possible!
Trying_unsuccessfully_to_warp,// Trying to warp, but can't warp at the moment
Free_afterburner_use,// Use afterburners while following waypoints or flying towards objects
NUM_VALUES
};
FLAG_LIST(Goal_Flags){
Docker_index_valid,// when set, index field for docker is valid
Dockee_index_valid,// when set, index field for dockee is valid
Goal_on_hold,// when set, this goal cannot currently be satisfied, although it could be in the future
Subsys_needs_fixup,// when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
Goal_override,// paired with AIG_TYPE_DYNAMIC to mean this goal overrides any other goal
Purge,// purge this goal next time we process
Goals_purged,// this goal has already caused other goals to get purged
Depart_sound_played,// Goober5000 - replacement for AL's hack ;)
Target_own_team,
NUM_VALUES
};
FLAG_LIST(Maneuver_Override_Flags){
Full_rot,// full sexp control over pitch/bank/heading rotation
Roll,// Sexp forced roll maneuver
Pitch,// Sexp forced pitch change
Heading,// Sexp forced heading change
Full_lat,// full control over up/side/forward movement
Up,// Sexp forced vertical movement
Sideways,// Sexp forced horizontal movement
Forward,// Sexp forced forward movement
Dont_bank_when_turning,// maps to CIF_DONT_BANK_WHEN_TURNING
Dont_clamp_max_velocity,// maps to CIF_DONT_CLAMP_MAX_VELOCITY
Instantaneous_acceleration,// maps to CIF_INSTANTANEOUS_ACCELERATION
Never_expire,// don't clear the maneuver when the timestamp is up
if(!(En_objp->flags&OF_PROTECTED)||((aip->goals[0].ai_mode&(AI_GOAL_DISABLE_SHIP|AI_GOAL_DISARM_SHIP))&&swip->wi_flags&WIF_PUNCTURE)){//override lockdown on protected ships when using anti subsystem weapons - Valathil
if(!(En_objp->flags[Object::Object_Flags::Protected])||((aip->goals[0].ai_mode&(AI_GOAL_DISABLE_SHIP|AI_GOAL_DISARM_SHIP))&&swip->wi_flags[Weapon::Info_Flags::Puncture])){//override lockdown on protected ships when using anti subsystem weapons - Valathil
// If ship is protected and very low on hits, don't fire missiles.
@@ -1605,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));
status=SHIP_STATUS_UNKNOWN;
}
}
@@ -1620,15 +1680,15 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
// if the goal is an ignore/disable/disarm goal, then
// Goober5000 - see note at PURGE_GOALS_ALL_SHIPS... this is bizarre
DCF_BOOL2(asteroids,Asteroids_enabled,"enables or disables asteroids","Usage: asteroids [bool]\nTurns asteroid system on/off. If nothing passed, then toggles it.\n");
Loaded 100 of 2295 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.