Commit graph

4503 commits

Author SHA1 Message Date
Kp df3f695023 Make menu.cpp:browser inherit from listbox 2020-12-27 22:03:09 +00:00
Kp e6f6bb68a0 Use enum class for browser::select_dir 2020-12-27 22:03:09 +00:00
Kp fcb3607ac4 Shrink browser::select_dir, browser::new_path to uint8_t
These are flag values.  There is no need to store an int.
2020-12-27 22:03:09 +00:00
Kp 0c77bee1d9 Change PHYSFS_removeFromSearchPath to PHYSFS_unmount
Per the documentation, PHYSFS_removeFromSearchPath is a deprecated
wrapper for PHYSFS_unmount.  Call PHYSFS_unmount directly.
2020-12-27 22:03:09 +00:00
Kp fa648075a9 Change PHYSFS_addToSearchPath to PHYSFS_mount
Per the documentation, PHYSFS_addToSearchPath is a deprecated wrapper
for PHYSFS_mount.  Call PHYSFS_mount directly.
2020-12-27 22:03:09 +00:00
Kp 0c53d3a34f Replace PHYSFSX_isNewPath with !PHYSFS_getMountPoint
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.
2020-12-27 22:03:09 +00:00
Kp 6211fd029a Simplify menu.cpp:browser
->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.
2020-12-27 22:03:09 +00:00
Kp ae5ee376f3 Move music file picking behind USE_SDLMIXER
None of these functions are used when sdlmixer=0, but the recursive
usage prevented the compiler from reporting this.
2020-12-27 22:03:09 +00:00
Kp 079602b91a Inline string_array_t::tidy comparator
There is only one call, so the target can be moved into the
implementation.  This removes use of a call-by-pointer.
2020-12-27 22:03:09 +00:00
Kp ac97d00698 Remove support for PhysFS 1, PhysFS 2
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.
2020-12-27 22:03:09 +00:00
Kp 165d8c9d1c Make demo_selection_listbox inherit from listbox 2020-12-27 22:03:09 +00:00
Kp c7f5e91007 Make pilot_selection_listbox inherit from listbox 2020-12-26 21:17:29 +00:00
Kp 8cc209b566 Simplify listing player files at startup
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.
2020-12-26 21:17:29 +00:00
Kp 095d660c55 Inline listbox_get_window
It is only used once.
2020-12-26 21:17:29 +00:00
Kp def7e03260 Move listbox callback handling to a derived class 2020-12-26 21:17:29 +00:00
Kp f43e98764a Move listbox to newmenu.h 2020-12-26 21:17:29 +00:00
Kp f01c29c779 Flatten newmenu_do* hierarchy
There is now a single caller for newmenu_do3.  Inline do3 into do2, so
that do2 calls do4.  Mark do4 as static.
2020-12-26 21:17:29 +00:00
Kp d1ff6becb4 Move listbox_layout to newmenu.h
Rename listbox_create_structure to listbox_layout::create_structure.
2020-12-26 21:17:29 +00:00
Kp 2ded2b2d0c Make kmatrix background optional
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.
2020-12-26 21:17:29 +00:00
Kp 03ebeda31a Fix use-after-free in kmatrix handling 2020-12-26 21:17:29 +00:00
Kp 1cc7be6b11 Construct listbox_layout directly in listbox 2020-12-26 21:17:29 +00:00
Kp b9a27094eb Pass menu_title through listbox functions 2020-12-26 21:17:29 +00:00
Kp b63ccc63ca Make passive_messagebox inherit from newmenu
passive_messagebox is only suitable when the user's selection does not
matter, so restrict to be used for cases where only one "choice" is
offered.
2020-12-26 21:17:29 +00:00
Kp 6322f2bb9c In multiplayer, show mission/level name on kmatrix screen
Requested-by: snytek <https://github.com/dxx-rebirth/dxx-rebirth/issues/553>
2020-12-26 21:17:29 +00:00
Kp cba756b826 Make hud_config_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp a9e723a822 Make gameplay_config_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp 09465f0f3d Make reticle_config_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp e79f907057 Make graphics_config_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp 316379a498 Make input_config_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp 7c46e5c760 Make sound_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp 11990bb856 Make manual_join_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp 57592811e0 Use enum class for direct_join::connecting 2020-12-26 21:17:29 +00:00
Kp 533f7752f4 Make wimp_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp be6c52b27e Make levelwarp_menu inherit from newmenu 2020-12-26 21:17:29 +00:00
Kp f22a73c2cc Remove unnecessary use of event_process_all in sandbox
The sandbox window is called in a context where an outer event loop will
work just as well.
2020-12-26 21:17:29 +00:00
Kp b459422206 Do not force player to leave score screen after final level
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.
2020-12-26 21:17:29 +00:00
Kp 60e2622234 Use enum class for kmatrix tracking of reactor destruction
Name the two states, instead of using 0/1.
2020-12-26 21:17:29 +00:00
Kp 834f009dd7 Use enum class for wallnum_t 2020-12-26 21:17:29 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp faa4d2ce34 Use enum class for vertnum_t 2020-12-26 21:17:29 +00:00
Kp fd9e65554f Switch automap_find_edge to use std::hash 2020-12-26 21:17:29 +00:00
Kp 70d55c010d Move Num_vertices into if(DXX_USE_EDITOR)
Non-editor builds only need Num_vertices as a local during mine loading.
2020-12-26 21:17:29 +00:00
Kp 4658abc87e Remove Adam_level_names[]
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.
2020-12-20 20:39:07 +00:00
Kp 6b3e78054c Remove support for reading Miner's .LVL files
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.
2020-12-20 20:39:07 +00:00
Kp 1c2fcf86e0 Convert multi_leave_game to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp e2c95058db Convert multi_endlevel to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp a3eb82cefd Move multi code into namespaces 2020-12-20 20:39:07 +00:00
Kp 5e4047ce2a Convert disconnect_player to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 955ce55661 Convert kick_player to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 2007257064 Convert get_multi_endlevel_poll2 to dispatch through a vtable 2020-12-20 20:39:07 +00:00