The last PhysFS 1 release was in March 2009. The last PhysFS 2 release
was in August 2017, shortly before the release of PhysFS 3 in September
2017. Most distributions have moved to PhysFS 3. Drop support for
PhysFS 1 and PhysFS 2. PhysFS 2 support could be restored if there is
interest.
Remove the use of qsort, since PhysFS sorts the result. The PhysFS sort
is case-sensitive rather than insensitive as the qsort was, but this is
unlikely to matter for most users.
Avoid an unnecessary strlen. The required data can be obtained from the
strchr.
Suppress player files that do not end in `.plr`. PhysFS should not
return such a file, and if it did, later code would likely become
confused. Hide such files from the user.
Previously, if the background failed to load, the kmatrix window was
immediately aborted. Change the logic so that a failure to load uses a
blank black background, but still shows the kmatrix window.
This reduces the chance of players hitting a difficult-to-fix
double-free bug, by preventing the free from occurring when the window
times out while not in focus. A proper fix requires not freeing the
window in a recursive call path.
Some group functionality was disabled in 2665869c24, but the globals
to support the disabled code were not removed. Move them into a
corresponding #if 0, since they have no value with the group code
disabled.
Fixes: 2665869c24 ("Mark editor groups broken")
It has never worked correctly. It compares real vertex numbers (as used
to index in Vertices[]) to abstract vertex numbers (always in the range
of [0, 7], as used on a theoretical segment.
Once the loop has determined a vertex is used at least twice, there is
no need to count how many more times it is used. Return immediately
after detecting the second use.
- Make it static
- Remove the update of Num_vertices, since the caller reverses that
update.
- Remove the reversal, since it is no longer needed.
- Remove the test and update of Vertices.count, because the caller
always passes a vertex number that makes the test false.
These refer to the Miner levels, which were removed in the preceding
commit since support for them has been marked as broken for an extended
period, and no one has reported an issue.
The Miner LVL files are not present in retail Descent 2 data. I know of
no way to obtain them. The code for loading them has been marked as
broken since 2018, and no one reported it. Remove this support to
simplify future work.
This reduces the call depth by one, and eliminates a load of a global
variable that always has the value MULTI_PROTO_UDP. It adds a load of
the address of the empty dispatch object. Overall, this should be an
improvement.
Every user now uses inheritance and a virtual function override. Make
callback_handler pure virtual, delete its body, and then delete the
member variables that existed only for use in that body. Remove the
constructor parameters that initialized those variables, and update all
derived classes accordingly.
The requirement to call send_creation_events from outside the
constructor makes the presence of a helper function convenient. Rename
ui_create_dialog to window_create, and move it to window.h.
This reverts commit 2bed74b056. The host
authority functionality, though important, is less important than basic
stability. Exposing the game window during this period causes various
problems, since drawing the window runs game logic:
- On escape from the final level of a mission, the player escapes the mine
twice.
- The game window is freed prematurely during the cleanup after finishing the
mission. This later leads to a use-after-free while trying to return to the
main menu.
- Game sounds continue to play in the background while the kmatrix window is
open.
- There is a brief flash of a game after exiting the kmatrix window, before the
next level initializes completely and the player warps to the correct start
spot.
Remove the logic to expose the game window during this fragile time. If this
breaks the host authority code, that will need to be fixed differently.
Fixes: 2bed74b056 ("During kmatrix bring up Game_wind againso the host can still follow the game - becomes necessary later with host-authority functions")
`const auto &&` deduces a type that is always const, which breaks the
SDL-only build. Use cg3s_point explicitly, so that the type is const
for OpenGL and mutable for SDL-only.
Fixes: ec6a78c481 ("Use enum class for marker index types")
Commit 6d3dce4e16 and commit
61f186bc18 tightened type checking for
texture values, and fixed all affected sites in the OpenGL build. The
SDL-only build had additional code paths that were not noticed or fixed.
This commit fixes those paths.
Commit cb2b844 and subsequent commits changed load_exit_models to only
call bm_free_extra_objbitmaps if EMULATING_D1. The variable
extra_bitmap_num is initialized as a side effect of
bm_free_extra_objbitmaps, so it wasn't initialized anymore if
not EMULATING_D1. This broke the exit sequence with the
D2 Mac Demo data and add-on missions with custom exit sequences.
This commit adds initialization of extra_bitmap_num if not EMULATING_D1
to fix the exit handling.
Kreeblah reports that clang now warns for powerup.cpp due to a missing
__attribute_format_printf. This was incorrectly dropped in
ffb653c0b8. gcc did not warn, but clang
now warns. Add back the attribute.
Fixes: ffb653c0b8 ("Pass control_info & to various functions")
Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/pull/547>
If a menu was all text except for the last element, the menu would
incorrectly be classifed as all text, and citem would be pinned to the
first element.
Fixes: 14a9657136 ("Use partial_range to store newmenu_item pointer/length")
The index and the value were transposed, and since both were integer
types, the type system was unable to warn that the new code was
incorrect. Swap the variables to bind as intended.
Reported-by: Donkyhotay <https://github.com/dxx-rebirth/dxx-rebirth/issues/544>
Fixes: de4efc4f46 ("Qualify more uses of shared_segment members")
Support for ORTHO_VIEWS has been broken since commit
db514a5ded in December 2004.
`git blame HEAD -L872,+4 -- similar/editor/meddraw.cpp`:
```
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 872) }
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 873) } else
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 874) #if ORTHO_VIEWS
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 875) else if ( screen_canvas == TopViewBox->canvas )
```
When ORTHO_VIEWS is true, this code expands to `} else else if (...)`; a
double-else is not legal, so the code cannot have been compiled with
ORTHO_VIEWS enabled. All 4 of the relevant lines date to db514a5ded,
which itself is an import of files from the D1X editor.
Rebirth built with OpenGL has a hard dependency on the GL utility
library, but did not have a configure time test to report this. Add
one.
Reported-by: shoober420 <https://github.com/dxx-rebirth/dxx-rebirth/issues/468>
When joystick support is not present, `event_joystick_get_button` is not
declared in joy.h.
Fixes: c24864b180 ("make menus controllable with joystick")
The same logic is used in two places. Move it to a helper function, and
switch from repeated use of snprintf for one character at a time to
instead use fill_n.
Check if the cockpit window textures are still valid when reusing the
previous cockpit data in cockpit_decode_alpha.
This fixes a crash when leaving the graphics options menu while in
the game with cockpit visible, since that calls
ogl_smash_texture_list_internal which invalidates all textures.
For historical reasons, the kcm_* arrays are smaller than the player's
configuration settings. Move the kcm_ arrays to be the first range
passed to zip, so that traversal does not exceed the array.
Fixes: d959eeca8f ("Use zip in kconfig to allow use of range-based for")
When AddressSanitizer is enabled, gcc-10 will warn that strncpy will
truncate the message. This truncation is valid, since it only loses the
terminating null byte, and the next line explicitly supplies a
terminating null. Switch to memcpy to eliminate the warning and produce
simpler code.
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
tmap1 cannot be rotated, so checking for it inside
convert_to_d1_tmap_num is wrong. tmap2 can be rotated, and checking for
it outside convert_to_d1_tmap_num is cleaner.
Add a comment in the #include directive to hide it from the PCH scanner,
since this file should not be included in the PCH. It is only used in
one file, and it is included under special circumstances. In
particular, it is included while inside a namespace.
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.
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.
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.
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.
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>
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")
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.
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")
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>
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.
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.
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>
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>