Commit graph

10670 commits

Author SHA1 Message Date
Kp b4d974e5b2 Remove register; it has no effect, and will be deprecated in C++17 2020-05-02 21:18:42 +00:00
Kp ddc25b59b7 Explicitly zero-initialize object structure members
C++17 will require this in order for `object::object()` to be constexpr.
Add it here, before switching over.
2020-05-02 21:18:42 +00:00
Kp e4323bf192 Fix gcc-7 build
The existing test for gcc pr #82541 was insufficient, and allowed using
-Wduplicated-branches with gcc-7 in some cases it should not.  Extend
the test to cover these cases.
2020-05-02 21:18:42 +00:00
Kp f0a47c358b Tell clang that GNU extensions are fine in GNU++14 mode 2020-04-28 04:09:47 +00:00
Kp b2672ae79e Merge 'refs/pull/505/head' into master 2020-04-28 04:09:47 +00:00
Matt Montag 7ec771e89a Fix bug in select_file_handler
newpath is a std::array and does not decay to char* automatically.
Use data() method to get char[], which does decay to char*.

This compile-time issue only affected Mac OS X.
2020-04-26 11:39:03 -07:00
Kp 49138117e4 OSX: log FRAMEWORKPATH, FRAMEWORKS from the construction environment 2020-04-26 17:26:23 +00:00
Kp 03318382d0 Only search for frameworks in directories that exist
mmontag reported that the OS X linker warns when attempting to search a
framework directory that does not exist.  Suppress this warning by
checking for the directory and not adding it to the search path if it
does not exist.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619457491>
2020-04-26 17:26:23 +00:00
Kp a6590fa496 Update SConstruct test for -Wold-style-cast on OS X
mmontag reports that <HIServices/Processes.h> is no longer available,
and the change from 15b0ec7f42 needs to be
applied to SConstruct as well.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619463994>
2020-04-26 17:26:23 +00:00
Kp 333d619858 Update tool_bundle.py to parse correctly under Python3
mmontag reports that tool_bundle.py cannot be parsed under Python 3.
Fortunately, the errors are all straightforward, so non-OS X systems can
see the errors when the file is imported.  Normally, the file is only
imported when building for darwin, so non-OS X systems do not see the
problem.

- Add parentheses to print() calls.  This is not consistent with the
  rest of the Rebirth output scheme, but is simple to do.
- Adjust the syntax for raising exceptions.

Reported-by: mmontag <https://github.com/dxx-rebirth/dxx-rebirth/issues/503#issuecomment-619463994>
2020-04-26 17:26:23 +00:00
Kp 95ebb67ad0 Add release note about savegame format change
zicodxx reported in issue #449 that savegames created in a new build,
then loaded in an older one, may behave incorrectly in the old build.
This cannot be fixed in the new build without reverting the logic change
which caused it.  Support for old builds has always been best effort, so
this will not be fixed.  Add a release note about it.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/449>
2020-04-26 17:26:23 +00:00
Kp 705f15161f Simplify argument error reporting 2020-04-26 17:26:23 +00:00
Kp df19889f61 Prefer NSDMI over simple default constructors
This protects against mistakes if more constructors are added, and makes
the code easier to read.
2020-04-26 17:26:23 +00:00
Kp a431f23817 Use enumerated constant for save slot indexes 2020-04-26 17:26:23 +00:00
Kp 0b070880a7 Use C++11 user-defined literals to dispatch valptridx error style
Switch valptridx error style dispatching from using macro pasting to
using C++11 user-defined literals.  This makes the code a bit easier to
read, and removes the need for a C99-conforming preprocessor here, which
should help anyone trying to port to Microsoft Visual Studio.

The new implementation also fixes a limitation of the previous
implementation.  Before, an override that referenced an invalid name
could be silently ignored.  Now, incorrect overrides cause an attempt to
use an undefined instantiation, which fails with a compilation error.
2020-04-26 17:26:23 +00:00
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation.  In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.

Switch to the compiler-provided version for both gcc and clang.
2020-04-26 17:26:23 +00:00
Kp d2e190ec3d Update snapshot ebuilds
- Remove the d1x, d2x ebuilds.  Gentoo uses the dxx name now, so the old
  placeholder ebuilds are no longer needed.
- Update the dxx snapshot ebuild to a current commit.
- Resynchronize the dxx snapshot ebuild from the dxx live ebuild.
  - This adds support for USE=valgrind and for USE=data.
- Add a helper script to generate snapshot ebuilds for arbitrary
  commits.
2020-04-19 20:47:07 +00:00
Kp 3b1f33c0c3 Make ebuild dependency on game data configurable via USE=data 2020-04-19 20:47:07 +00:00
Kp 238f529ff4 Clean generated PCH headers
Initialize PCHManager on the clean path, so that the generated headers
are reported to the SCons core.
2020-04-19 20:47:07 +00:00
Kp 5fa8c06914 Add experimental support for autosaves
Set autosave interval to 10 minutes, unless specified in the player's
configuration file.  Players can change the autosave to 0 minutes to
disable it.
2020-04-19 20:47:07 +00:00
Kp ddce1b00d5 Ignore Manifest files in the Gentoo ebuild area 2020-04-19 20:47:07 +00:00
Kp 7d3f4333be Require support for C++14 template variables 2020-04-19 20:47:07 +00:00
Kp f9b90d4e8c Raise minimum required gcc version to gcc-7
gcc-4.9 support is now difficult to test due to system libraries linking
to newer symbols.  gcc-4.9 is unsupported upstream, as are gcc-5 and
gcc-6.  Raise the minimum required gcc version to the minimum version
supported upstream.

Debian Jessie shipped gcc-4.9.2, and support for this target was the
primary motivator for retaining gcc-4.9 support.  Jessie ended regular
support in June 2018, and will end Long Term Support in June 2020.  It
seems unlikely that Jessie would receive a snapshot build of Rebirth in
the months it has left.

Debian Stretch shipped gcc-6, but is currently considered "oldstable"
and has been superseded by Debian Buster.  Further, Debian Stretch
provides a package for gcc-7, so Stretch users can still build Rebirth
using only packages available from the package manager.
2020-04-19 20:47:07 +00:00
Kp a1b3a86cba Use std::chrono::duration for ThisLevelTime, PlayTimeAllowed
Store PlayTimeAllowed in ticks since it is frequently accessed for logic
tests, but only rarely accessed for display.
2020-04-19 20:47:07 +00:00
Kp d197ba42c3 Fix mouse-selection in listboxes
Commit d355ef4030 removed a seemingly unnecessary modification of the
global variable grd_curcanv->cv_font, after eliminating all local reads
of it.  However, a non-local read, buried in listbox_mouse, depended on
grd_curcanv->cv_font being set to a MEDIUM font.  After that commit,
grd_curcanv->cv_font retained its prior value, which is not a MEDIUM
font.  This caused listbox_mouse to compute an incorrect height of the
lines in the listbox, which manifested as the game choosing the wrong
line when the mouse is clicked in the listbox.

Fix the problem by explicitly using MEDIUM3_FONT, since that was
usually the value left in grd_curcanv->cv_font prior to that commit.  In
some cases, a different MEDIUM font would be left there, but all the
MEDIUM fonts have the same height, so they are interchangeable for this
purpose.

Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/498>
Fixes: d355ef4030 ("Pass font to various drawing functions")
2020-04-04 19:30:23 +00:00
Kp 23ebf27554 Move digi functions to dcx; use bitset for channels 2020-04-04 19:30:22 +00:00
Kp 3f8aced47d Check for converted sounds before doing any work 2020-04-04 19:30:22 +00:00
Kp 714c13b3c1 Move WallAnims into d_game_shared_state 2020-04-04 19:30:22 +00:00
Kp bcff9e6aaa Simplify wall flag assignment
Move the tests up and keep the flags ready to assign.
2020-04-04 19:30:22 +00:00
Kp 443f4f8c83 Avoid reloading ObjBitmapPtrs[i] 2020-04-04 19:30:22 +00:00
Arne de Bruijn a2b49a9a08 Add PIGGY_PAGE_IN to ogl_cache_polymodel_textures 2020-04-04 12:13:59 +02:00
Kp 0fb82b47f6 SDL2: fix size of letterbox sequences
andrew-strong reported that using SDL2, with the window set to full
screen, but a windowed size less than full screen, caused letterbox
sequences, such as the player ship destroyed sequence, to render in a
subwindow sized to the dimensions game would have when unmaximized, even
if the game window is maximized at the time of the sequence.

tycho suggested a change that resolves this issue, and basic testing
showed no unwanted side effects.

Reported-by: andrew-strong <https://github.com/dxx-rebirth/dxx-rebirth/issues/399>
Suggested-by: tycho <https://github.com/dxx-rebirth/dxx-rebirth/issues/399#issuecomment-583688998>
2020-03-28 17:32:34 +00:00
Kp 2e682e140d Prevent sound stacking when all primary weapons are exhausted
ziplantil reported that in Descent 1, if a player has an empty Vulcan
cannon, and no energy, then attempting to fire a weapon would play the
SOUND_ALREADY_SELECTED clip every frame until the player ceased trying
to fire.  The problem does not impact Descent 2 since Descent 2 does not
play this sound sample when trying to activate a weapon that is already
active.

If the current weapon is already LASER_INDEX, then
select_primary_weapon(LASER_INDEX) simplifies to:

```

	// Pointless, player already using this weapon
	newdemo_record_player_weapon(LASER_INDEX)
	if (Primary_weapon != LASER_INDEX) {
		// skipped, path is false
	}
	else
	{
		if (wait_for_rearm)	// true for this path
			// Bad, plays every frame
			digi_play_sample(SOUND_ALREADY_SELECTED);
	}
	// Pointless, Primary_weapon already is LASER_INDEX
	Primary_weapon = LASER_INDEX;
	if (weapon_name)
	{
		// skipped, path is false
	}

```

Skipping the call avoids two pointless statements, one bad statement,
and nothing useful.  Therefore, the simplest fix for the problem is to
call select_primary_weapon(LASER_INDEX) only if the primary weapon is
not currently LASER_INDEX.

Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/499>
2020-03-28 17:09:28 +00:00
Kp af8adaef1b Defer digi_mixer_start_sound work until it is needed
If no channel is available, the mix parameters are unused.  Move their
construction to occur after a channel for the sound is found.
2020-03-28 16:55:43 +00:00
Kp b19496ca72 Set digi_mixer channel callback once at startup
The callback is never changed, so it does not need to be reset on every
new sound.
2020-03-28 16:54:28 +00:00
Kp 6a27ae3544 Prevent copying RAIIMix_Chunk
No code tried to copy it, but if a copy was created, it would cause a
double-free later.  Prevent copying to avoid introduction of a
double-free bug.
2020-03-28 16:51:43 +00:00
Kp 7478eab4c9 Remove references to DXX forum
The forum vanished several months ago and now points to a server with a
bad certificate.  Stop directing people to that hostname.
2020-03-25 02:31:10 +00:00
Kp ed4cb636b7 Fix memory leak when deleting listbox items 2020-03-14 03:41:30 +00:00
Kp a645fd2eba Allocate morph_data vectors dynamically
This greatly reduces the size of morph_data for most uses.
2020-02-26 05:07:34 +00:00
Kp 85a9034137 Move morph_data::morph_deltas into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 73612f6667 Move morph_data::morph_vecs into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 74f8fd0d4d Move morph_data::morph_times into a trailing allocation
Initially, this just makes the code more complicated.  In the end, it
will allow choosing the array size dynamically.
2020-02-26 05:07:34 +00:00
Kp 00df407381 Use a custom allocation for morph_data
This will enable shrinking the morph arrays to allocate only what is
needed.
2020-02-26 05:07:34 +00:00
Kp ce7cf4f7ef Rename gauges span to avoid conflict with C++20 type of the same name 2020-02-26 05:07:34 +00:00
Kp 5a08c40878 Use zip for morph update_points 2020-02-26 05:07:34 +00:00
Kp 27a96d0337 Simplify partial_range check for unsigned offset/length 2020-02-26 05:07:34 +00:00
Kp 4ec6a13bfa Zip morph polymodel sequences 2020-02-26 05:07:34 +00:00
Kp 9db512a9d6 Simplify Descent2 briefing removal of carriage returns
Read the entire buffer at once, then remove the carriage returns and set
a null terminator.  This reduces the number of calls to PHYSFS_read from
len to 1.
2020-02-26 05:07:34 +00:00
Kp d4c48d80b5 Fix some failures in check_header_includes=1 builds 2020-02-26 05:07:34 +00:00
Kp 707df7b9de Move some newdemo functions into namespace dsx 2020-02-26 05:07:34 +00:00