Callers only ever test for whether the movie was skipped, and never
distinguish between a movie that ran to completion versus a movie that
the user interrupted. Combine these two statuses into one value, and
eliminate the logic in RunMovie that picked which of the two to return.
Previously, rendering the preferred bomb type could also change it if
the active type was exhausted. This is undesirable, since it depends on
the user to have a HUD mode which causes the bomb type to render.
Switch to only change the active type if the user tries to drop a bomb
while the active type is unavailable. Some call sites already switch
bomb types automatically on depletion. Those sites will still do so.
v0.58.1 did this, but the functionality was accidentally removed in
859b399d20. Restore it.
Fixes: 859b399d20 ("Use mask for Secondary_last_was_super")
gcc computes a potential value range for game times as [0, 1092] instead
of the [0, 50] that the game uses. This could be reasonable as the code
was before, but even adding an explicit range check before the usage
does not eliminate the warning. Avoid the warning by increasing the
size of the buffer to avoid truncation even if the value were 1092.
After the previous commit, its only purpose is to automatically dismiss
the window after 3 seconds. Users may be surprised by this, and the
automatic dismissal has limited value. Remove it and let the user
remain at the cancel dialog until a decision is made.
The menu operated by kmatrix_poll2 exists only when the containing
kmatrix menu is also open. kmatrix has its own call to
do_protocol_frame, so there is no need for another one here.
Closing the kmatrix window while it is not in the foreground may cause a
use-after-free when it is closed again later, since the event loop can
reenter kmatrix_window::event_handler. Skip the exit logic if the
window is not in the foreground, so that it remains open until it times
out while in the foreground.
Previously, callers chose whether to use a fullscreen background image,
and the newmenu code inferred that callers without a background image
wanted a background box, while those with a background image wanted no
box. Change newmenu_layout to take a parameter specifying the caller's
intent, so that a caller can choose to have any combination of a
background image and a background box.
Calling gr_set_mode invalidates loaded fonts. Avoid a use-after-free by
forcing a cockpit reset, which will reinitialize canvases that reference
the unloaded fonts.
PHYSFSX_isNewPath retrieves from PhysFS a list of all paths, then
searches them, and frees them at the end. PhysFS can search its own
list without needing the allocations, so delegate the work to it.
->when_selected is always get_absolute_path. Remove the pointer and
replace the indirect calls with a direct reference.
->userdata is always a pointer to the buffer for get_absolute_path to
fill. Change the type from `void *` to an appropriate reference.
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.
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.
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")
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.