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.
Commit 8a437a759c changed the logic to
always set show_all to 1. This renders the short-circuit logic in
info_display_object_placement irrelevant, as show_all will always force
the information to draw. Remove the variables that were used to decide
whether a redraw was required.
A prior conversion changed the actual rendering to use the argument
cv_font, but still picked which render function to use based on the
flags for the active font. Switch to use only the supplied font.
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.
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.