Commit graph

10922 commits

Author SHA1 Message Date
Kp 336d84f451 Access unique_segment::light_subtracted directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 37bd70369d Access unique_segment::objects directly
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment.  Eventually, segment will be
removed.  Adjust references to go through unique_segment to support this
change.
2020-08-10 03:45:13 +00:00
Kp 7ad8d8c28b Rename object::movement_type to movement_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.
2020-08-10 03:45:13 +00:00
Kp 5245b1c4a3 Rename object::control_type to control_source
gcc and clang disagree about how to disambiguate when an identifier is
both a typename and a member.  Avoid the disagreement by renaming the
member.

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/532>
2020-08-10 03:45:13 +00:00
Kp 102cb5572f Exchange order of gauge_hud_type, gauge_inset_window_view
This generates better code by raising the computation of one array
level outside certain conditionals.
2020-08-10 03:45:13 +00:00
Kp 637efae03a Use enum class for gauges window indexing 2020-08-10 03:45:13 +00:00
Kp 1c42f69ff2 Use enum class for object_signature_t 2020-08-10 03:45:13 +00:00
Kp 38cddb0289 Use enum class for object movement_type 2020-08-10 03:45:13 +00:00
Kp 9e2543ecbf Use enum class for object control_type 2020-08-06 03:47:56 +00:00
Kp 4ef247e494 Use enum class for collision_result values 2020-08-06 03:47:56 +00:00
Kp 9b90a790f9 Add forward-declaration header for enumerated_array 2020-08-06 03:47:56 +00:00
Kp 021c86d4dd Remove unnecessary variable in InitMarkerInput
This was a leftover from an earlier prototype.  gcc-7 warns about it,
but gcc-8 and later silently allow it.  Remove it to fix the gcc-7
build, since it is not needed.

Reported-by: Kieltux <https://github.com/dxx-rebirth/dxx-rebirth/issues/531>
Fixes: ec6a78c481 ("Use enum class for marker index types")
2020-08-06 03:47:56 +00:00
Kp 111b655b09 Remove GM_GAME_OVER
Various sites assign GM_GAME_OVER to Game_mode, but no sites test for
it.  Its only value would be to clear out other flags, but that can be
done by clearing Game_mode.
2020-08-06 03:47:56 +00:00
Arne de Bruijn 294d54eb58 Workaround for missing forever flag in sound object demo recording
In the original code there was a 'Hack to keep sounds from building up...'
which changed a non-forever linked sound to a non-linked sound. Therefore
the forever flag wasn't needed in the demo files. The commit
4a98e796ab removed the hack, which caused
non-forever sounds to start looping on demo playback.
This commit restores the hack as far as demo files are concerned.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/477>
Fixes: 4a98e796ab ("Prevent stacking weapon rotation sounds")
2020-08-05 15:32:44 +02:00
Kreeblah 81a93441c0
Fixed macOS compilation 2020-08-02 16:03:19 -07:00
Kp 8d3f47d646 Fix hoard orb handling on player death
Descent tracked hoard orbs by borrowing the player's proximity bomb
slot.  Commit 829e95b6f8 moved proximity
bomb tracking to its own slot, but failed to update the player
death/deres logic accordingly.  This caused multiple inconsistencies
when a player was killed in hoard mode:

- The killed player saw the orb drop as expected.
- The killed player _also_ kept the orb in inventory after respawn,
  because the counter was not reset.
- Other players saw no orb drop.

Fix the inappropriate retention by resetting the orb count in
init_player_stats_new_ship.  Fix the inappropriate failure to drop by
adding a new unconditional field to the player death/deres message.  In
hoard games, use it to pass the orb count.  In other games, ignore it.

Fixes: 829e95b6f8 ("Separate hoard/proximity tracking")
Reported-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/526>
2020-08-01 18:29:01 +00:00
Kp 0789298192 Hide HUD key graphics in competitive games
The keys are always enabled, so there is no need to show them here.
Non-fullscreen users already dedicate space to the key graphic, so
nothing can be saved by adding a special case for those viewing modes.
2020-08-01 18:29:01 +00:00
Kp fab8afe96c Simplify always-true title_screen::allow_keys
The value is always true, so delete tests for it and remove the
variable.
2020-08-01 18:29:01 +00:00
Kp 8ebfee3c41 Remove unused show_title_screen parameters
- allow_keys is always 1
- from_hog_only was ignored in the callee because PhysFS does not
  support it.
2020-08-01 18:29:01 +00:00
Kp 519c14a407 Use timestamped savegame description if none is given
Instead of a generic "-no title-", insert the time of the save.  This
conveys some information to users, who may find it helpful for
distinguishing individual saves.
2020-07-22 03:11:18 +00:00
Kp 1d24a2f942 Fix off-by-one in save slot memory
Save menus have a non-selectable first element used to allocate extra
space for the save game's embedded screenshot.  The memorized save game
slot failed to account for this, causing the game to suggest a slot one
less than the last used slot.  Attentive users could override the
suggestion, but the game should suggest the correct slot automatically.

Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/524>
2020-07-22 03:11:18 +00:00
Kp d7bc4fb0df Fix global array overflow in kbuild.cpp error message 2020-07-22 03:11:18 +00:00
Kp ec6a78c481 Use enum class for marker index types 2020-07-22 03:11:18 +00:00
Kp 0c9adb9d4a Use enum for net_udp_can_join_netgame result
This enum preserves the original numeric codes and logic.
2020-07-22 03:11:18 +00:00
Kp bb6bf76b0f Centralize computing height of some fullscreen gauges
Gauges aligned to the left side of the screen try to move up in
multiplayer, and move farther in large multiplayer games.  However, the
logic for this was inconsistent, and could draw shields and afterburner
state on the same line.  Fix this by computing the starting point once,
and passing it down to the functions that need it.

Reported-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/521>
2020-07-16 02:31:04 +00:00
Kp d738f6c21e Change enum side_type to enum class side_type 2020-07-16 02:31:04 +00:00
Kp 8d2ee6f14d Replace enumerate helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp daf06acfbe Replace zip helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp 48bfabee99 Use std::disjunction to simplify any_ephemeral_range 2020-07-16 02:31:04 +00:00
Kp 9081b2f071 Rename xrange_extent to xrange
This is handled separately to split out the churn of the renaming from
the logic changes that made this possible.
2020-07-16 02:31:04 +00:00
Kp 92ec624e47 Replace xrange helper function with class template argument deduction 2020-07-16 02:31:04 +00:00
Kp 250713d932 Use if constexpr to simplify xrange_extent::init_begin
Switch from tag-based overload dispatching to use `if constexpr`.
2020-07-16 02:31:04 +00:00
Kp 34a5d3797d Use enum class for gr_blend 2020-07-16 02:31:04 +00:00
Kp 6285878c4c Add color_palette_index type alias, to note palette-related uint8_t 2020-07-16 02:31:04 +00:00
Kp 80f8bbabd1 Add constexpr to compile-time switches in font templates 2020-07-16 02:31:04 +00:00
Kp 8cc7be4986 Use std::bitset to track used colors
This reduces memory usage over using std::array<bool> for the same
number of bits.
2020-07-16 02:31:04 +00:00
Kp 6af56a27f2 Remove outdated joystick preprocessor guards
Testing for buttons||hats||axes is equivalent to testing for
joysticks!=0, since SConstruct forces joysticks=0 when
buttons == 0 && hats == 0 && axes == 0.  Remove tests of
buttons||hats||axes when those occur inside a test for joysticks!=0.
2020-07-16 02:31:04 +00:00
Kp 4f26a205ea Increase height of kconfig joystick window
The addition of the binding for a menu key causes the axes to float off
the bottom of the window.  Increase the window height to fix this.
2020-07-09 02:47:18 +00:00
Kp 5735175999 Merge 'refs/pull/516/head' into master 2020-07-09 02:47:18 +00:00
Kp a20551191a Remove useless D1 test for TRIGGER_ONE_SHOT
This block previously was used to clear TRIGGER_ON, but that change was
removed because TRIGGER_ON was a write-only flag.  This block is now
useless, so remove it.  This should also fix an obscure crash reported
by AlumiuN.

AlumiuN proposed adding a test that seg->children[side] is still valid,
but since the logic to execute would be useless even when the test
succeeds, it is simpler to remove this code entirely.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/515>
Suggested-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/pull/518#issue-443277182>
2020-07-07 04:09:44 +00:00
Kp 738e4a740e Remove TRIGGER_FLAG::ON; it is write-only
The game clears it in various cases, but never tests for it.  Remove it.
2020-07-07 04:09:44 +00:00
Kp b814434181 Revert "fix invalid polymodels if words_need_alignment=1"
This reverts commit 60edaa7dce.

This commit was brought in through a merge to obtain a different change,
and was supposed to be suppressed in preference to the change from
dfcb0fcdc.  Revert it here, since reloading the variable suffices to fix
the problem, and this commit forces a reload on all platforms, rather
than only reloading on platforms that need it.
2020-07-07 04:09:44 +00:00
Kp 2e979c954d Merge 'refs/pull/519/head' into master 2020-07-05 23:34:33 +00:00
Kp 569802e00f Convert kconfig array lookups to require correct enumerated type
This ensures that an array is indexed by the appropriate type.  Indexing
a mouse array with a joystick index is undefined behavior, and with this
change, such undefined behavior is now a compilation error.
2020-07-05 23:34:33 +00:00
Kp a27b50a357 Use symbolic names to look up kconfig offsets 2020-07-05 23:34:33 +00:00
Kp caf3a71aa2 Remove plx special case for version 0.56.0
That version was a long time ago.  Assume anyone who has not run a build
newer than 0.56.0 by now will not do so.
2020-07-05 23:34:33 +00:00
Kp 9b9642dcac Only enable joystick axis->button bridge if both axes!=0 and buttons!=0
If axes!=0 and buttons==0 and hats==0, then the build fails because some
button-related functionality is missing.  Move the joystick axis->button
bridge into a conditional to exclude it in this case.

Fixes: 74ef8b02e6 ("Added axis buttons")
2020-07-05 23:34:33 +00:00
Kp be1a539898 Reduce lookups of descent.hog size in briefings 2020-07-05 23:34:33 +00:00
Kp 85f0dcde01 Avoid repeatedly reopening descent.hog during briefings
PHYSFSX_fsize opens the file, reads its length, and closes it.  Calling
PHYSFSX_fsize in a loop is wasteful, since the file size should not
change while the game is playing.
2020-07-05 23:34:33 +00:00
Kp c0daa89ad5 Avoid reopening descent.sng
If !canUseExtensions, then fp is already open to descent.sng.  There is
no need to reopen it just to get its length.
2020-07-05 23:34:33 +00:00