Commit graph

5693 commits

Author SHA1 Message Date
Kp f1cfbaa982 Use enum class for cockpit_3d_view 2021-01-25 00:45:07 +00:00
Kp 77acae6510 Use enum class for weapon_box_user 2021-01-17 22:23:23 +00:00
Kp 423e513a4a Move overlap_dirty to gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp 977684ba29 Move static_time to gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp 977714c93f Move weapon_box_user to gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp b4ba47f7bc Move weapon_box_fade_values to gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp 8bc06dc700 Move weapon_box_states to gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp d40a587628 Move old_weapon into gauge_inset_window 2021-01-17 22:23:23 +00:00
Kp b70f569178 Use enum class for OGL_TEXFILT_* constants 2021-01-17 22:23:23 +00:00
Kp a682d2bacb Simplify movie_play_status
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.
2021-01-17 22:23:23 +00:00
Kp 6f7b0b4743 Use enum class for PlayMovie result 2021-01-17 22:23:23 +00:00
Kp 7b99654379 Use enum class for weapon_box_states 2021-01-17 22:23:23 +00:00
Kp 1843d375f2 Use enumerated_array for Secondary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp e9f590eeb1 Use enumerated_array for Primary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp baa2823953 Pass player_info to which_bomb
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.
2021-01-17 22:23:22 +00:00
Kp c7680621a8 Switch mine type if only alternate mine is available
v0.58.1 did this, but the functionality was accidentally removed in
859b399d20.  Restore it.

Fixes: 859b399d20 ("Use mask for Secondary_last_was_super")
2021-01-17 22:23:22 +00:00
Kp b51da25a42 Add quick-exit path for robot awareness in no-robot games
If no awareness events are pending, skip scanning objects for robots
to inform about the awareness events.
2021-01-17 22:23:22 +00:00
Kp 93bef60b79 Improve D1 emulation of process_awareness_events
When D2 emulates D1, use the D1 recursion limit.
2021-01-17 22:23:22 +00:00
Kp 1d5afd34ce Improve post-level score screen message
Use a special message when the timeout has elapsed, and the game is
waiting for the user to restore focus to the score screen.
2021-01-17 22:23:22 +00:00
Dmitry Grigoryev 1338ddab34 Add menu page for HUD style and cockpit view 2020-12-28 22:39:36 +01:00
Kp 04c1d8cc57 Move marker deletion are-you-sure to a non-blocking window 2020-12-27 22:03:09 +00:00
Kp a45726d7e4 drop_robot_egg: return immediately if count-to-drop == 0
This suppresses a misleading warning when a robot is set to drop 0
objects of an invalid type.
2020-12-27 22:03:09 +00:00
Kp e4f8d02380 Make screen_resolution_menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp ed2bc8e213 Use enum class for nm_type 2020-12-27 22:03:09 +00:00
Kp 306b5ddebe Simplify levelwarp_menu handling of EVENT_WINDOW_CLOSE 2020-12-27 22:03:09 +00:00
Kp e45ba0b4a9 Make new game menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 03512841b1 Make do_difficulty_menu menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp ae021b12e7 Use named Difficulty_level enum members in MENU_DIFFICULTY_TEXT 2020-12-27 22:03:09 +00:00
Kp 8e76a5a064 Avoid gcc snprintf truncation warning in net_udp.cpp
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.
2020-12-27 22:03:09 +00:00
Kp 3e467e54a3 Make MakeNewPlayerFile menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp daf53321bf Remove return value of new_player_config
It always succeeds.
2020-12-27 22:03:09 +00:00
Kp 76cbd11956 Make kmatrix_window::event_handler cancel menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 115c38cd77 Remove kmatrix_poll2
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.
2020-12-27 22:03:09 +00:00
Kp 479005b769 Remove call to dispatch->do_protocol_frame in kmatrix_poll2
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.
2020-12-27 22:03:09 +00:00
Kp 907c69dcb7 Skip some kmatrix logic when not in the foreground
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.
2020-12-27 22:03:09 +00:00
Kp 80fc124a63 Remove unnecessary definitions of static member variables
C++17 permits, but deprecates, this form.  Remove it to simplify the
code.
2020-12-27 22:03:09 +00:00
Kp e7629f35ee Move newmenu_item::saved_text into the two sub-types that need it 2020-12-27 22:03:09 +00:00
Kp e6875641c9 Move Newmenu_allowed_chars into individual newmenu_item
Allowed characters are more properly scoped to a specific text entry
field.  Move them there to eliminate a global.
2020-12-27 22:03:09 +00:00
Kp 40501fa31e Make PlayerFinishedLevel menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 421959643c Make get_level_name menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 3e210a9ceb Make do_screen_message menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 1f8c8e355b Allow newmenu callers to choose whether to use a background box
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.
2020-12-27 22:03:09 +00:00
Kp c9d5d3be02 Fix buffer overflow on ill-formed briefing picture filename 2020-12-27 22:03:09 +00:00
Kp 1b58b82e81 Convert debug briefing menu to inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 2b9c146ff2 Convert glitz menu to inherit from newmenu
Add a static method to block until the menu closes, so that the glitz
menu can continue to block its caller.
2020-12-27 22:03:09 +00:00
Kp c0601edde3 Move GammaLevel to CCfg 2020-12-27 22:03:09 +00:00
Kp 3cbae9df31 Reset cockpit on leaving graphics menu
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.
2020-12-27 22:03:09 +00:00
Kp 17b3812ee3 Make more_game_options_menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp 9be9f7ae64 Pass grs_font& to show_time 2020-12-27 22:03:09 +00:00
Kp 318ed5b684 Simplify info_display_default
Commit 8a437a759c made show_all always
true.
2020-12-27 22:03:09 +00:00
Kp c3e2d1841c Simplify info_display_segsize
Commit 8a437a759c made show_all always
true.
2020-12-27 22:03:09 +00:00
Kp 7fde0a00a0 Simplify info_display_object_placement
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.
2020-12-27 22:03:09 +00:00
Kp aaf4629c05 Fix potential canvas.cv_font / cv_font inconsistency in gr_ustring
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.
2020-12-27 22:03:09 +00:00
Kp 9dd3f0dbf4 Pass grs_font& to nm_rstring 2020-12-27 22:03:09 +00:00
Kp 135ba07db4 Pass grs_font& to nm_string_inputbox 2020-12-27 22:03:09 +00:00
Kp 8b7e5ba04d Pass grs_font& to nm_string 2020-12-27 22:03:09 +00:00
Kp 0fa2afb6a6 Pass grs_font& to nm_string_slider 2020-12-27 22:03:09 +00:00
Kp d11f5c0cab Simplify newmenu font setup 2020-12-27 22:03:09 +00:00
Kp c1d6150015 Pass grs_font& to gr_set_curfont 2020-12-27 22:03:09 +00:00
Kp effa7435c2 Remove newmenu_listbox1
It is no longer used.
2020-12-27 22:03:09 +00:00
Kp 7f2df64649 Make mission_menu inherit from listbox 2020-12-27 22:03:09 +00:00
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 92aeee1efc Fix array underflow in GotoPrevWall when no walls exist 2020-12-26 21:17:29 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp e2565e6120 Move some group structures inside #if 0
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")
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 38770bea12 Remove remap_side_uvs
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.
2020-12-26 21:17:29 +00:00
Kp 9d62300898 Make find_edge more like automap_find_edge
Both have similar purposes, but search for different matching data
structures.
2020-12-26 21:17:29 +00:00
Kp 10b43d4ba0 Enable quick exit from is_free_vertex
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.
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 95d8095c6d Simplify med_set_vertex
- 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.
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 90d43d6519 Simplify compress_vertices 2020-12-26 21:17:29 +00:00
Kp c58a69dbec Return vertnum_t from med_add_vertex 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
Kp 407678dfdf Convert multi_send_endlevel_packet to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp ea6504e60b Convert multi_level_sync to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp 2f90d7a208 Convert multi_do_protocol_frame to dispatch through a vtable 2020-12-20 20:39:07 +00:00
Kp d070377e6b Convert multi_objnum_is_past to dispatch through a vtable
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.
2020-12-20 20:39:07 +00:00
Kp 479884288c Always delegate to window_create for send_creation_events 2020-12-20 20:39:07 +00:00
Kp a56ff84fd5 Make listbox callback const 2020-12-20 20:39:07 +00:00
Kp a4cfdba4d9 Make joystick_sensitivity::menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp f0b6a23e0e Make mouse_sensitivity::menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp c5a677817b Make keyboard_sensitivity::menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp a0b09f0657 Make netgame_powerups_allowed_menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 485369810a Make grant_powerup_menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 696141eabf Use enum class for weapon_info::bounce 2020-12-20 20:39:07 +00:00
Kp e261ca2884 Use enum class for weapon_info::matter 2020-12-20 20:39:07 +00:00
Kp 7f48fe045b Use std::move_backward in scores_maybe_add_player 2020-12-20 20:39:07 +00:00
Kp e72dae0b91 Initialize scores_menu members in constructor 2020-12-20 20:39:07 +00:00
Kp 305c3dc04c Avoid passing pointer to uninitialized last_game to scores_view
The position parameter should avoid the value being used, but avoid
passing a pointer to known-uninitialized data to be safe.
2020-12-20 20:39:07 +00:00
Kp 7da06d916c Move DoGameOver inline
Delete the backward comment.  This function is used for single player,
not multiplayer.
2020-12-20 20:39:07 +00:00
Kp 9f8fbb1a77 Remove newdemo_strip_frames
The sole user is based on newdemo_do2, which is being retired.  This
feature was only available in developer builds.
2020-12-20 20:39:07 +00:00
Kp 6cca4ab2ce Make main multiplayer menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 131e5a257e Make options menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 9edbf27300 Make sandbox menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp df1ee5e671 Make weapon reorder menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 303815f80c Make netgame_list_game_menu inherit from newmenu 2020-12-20 20:39:07 +00:00
Kp 08d3288aee Move netgame list setup into netgame_list_game_menu_items 2020-12-20 20:39:07 +00:00
Kp 34b8541986 Make netgame_info_menu inherit from passive_newmenu 2020-12-20 20:39:07 +00:00
Kp b8ef5c89c3 Use enumerated_array for lines passed to netgame_info
Avoid incrementing an iteration variable, and instead write the values
to precomputed offsets.  Avoid copying constant strings into mutable
storage.
2020-12-19 16:13:26 +00:00
Kp d7cce3a8ff Change demo F1 help menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp 90f46b7a02 Change netgame F1 help menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp e57c9efa7e Change main F1 help menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp 76acfdd38f Convert main menu to inherit from newmenu 2020-12-19 16:13:26 +00:00
Kp 8e65573c56 Eliminate move construction of newmenu_layout
Construct one in place, update it, and then use it to initialize the
rest of the newmenu.
2020-12-19 16:13:26 +00:00
Kp c68dddd372 Move various definitions into namespaces 2020-12-19 16:13:26 +00:00
Kp b1b2300c7d Use enum class for wall_key 2020-12-19 16:13:26 +00:00
Kp 47c33cbd55 Use enum class for WALL_IS_DOORWAY_FLAG
This reduces the size of the debug information substantially.
2020-12-19 16:13:26 +00:00
Kp 137fd95ae0 Reduce indirection resolving chosen menu item
Instead of storing a hardcoded array of identifiers, use the index in
the main array as the identifier.  Split `enum MENUS` accordingly.
2020-12-19 16:13:26 +00:00
Kp 56122687d1 Delegate newmenu subfunction handling into virtual function 2020-12-19 16:13:26 +00:00
Kp d4cf9943c5 Make newmenu subfunction const 2020-12-19 16:13:26 +00:00
Kp 1032462988 Make newmenu max_displayable const 2020-12-19 16:13:26 +00:00
Kp de5c300724 Make newmenu_layout::all_text const 2020-12-19 16:13:26 +00:00
Kp 530f396b2e Make newmenu::tiny_mode_flag, tabs_flag, max_on_menu const 2020-12-19 16:13:26 +00:00
Kp 200952c3d9 Add type-specific tag wrappers for newmenu calls
Make the compiler check that title, subtitle, and filename are passed in
the right places.
2020-12-19 16:13:26 +00:00
Kp 53566b7673 Move struct newmenu to newmenu.h 2020-12-19 16:13:26 +00:00
Kp 5c7fc7d143 Remove unused UI_DIALOG d_callback
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.
2020-12-19 16:13:26 +00:00
Kp 2709676f8d Rename ui_create_dialog to window_create
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.
2020-12-19 16:13:26 +00:00
Kp 0d70c3831c Revert "During kmatrix bring up Game_wind again ..."
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")
2020-12-14 00:04:41 +00:00
Kp 81d8b353b2 Fix gcc-11 -Wmisleading-indentation warning
Reindent the affected tests.
2020-12-14 00:04:41 +00:00
Kp 017c4ce933 Restore buffering on PCX loads
Commit 3114874713 delegated PCX loading to
SDL_image, and as an incidental change, switched to using an unbuffered
PHYSFS file.  On Linux, this has no perceptible difference in
performance.  On Windows, the unbuffered accesses cause enough of a
performance problem for users to notice and report an issue.  Add a new
helper to create an SDL_RWops around a buffered file, and use that for
PCX loading.

Fixes: 3114874713 ("Delegate PCX loading to SDL_image")
Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/549>
Reported-by: aybe <https://github.com/dxx-rebirth/dxx-rebirth/issues/555>
Analyzed-by: arbruijn <https://github.com/dxx-rebirth/dxx-rebirth/issues/555#issuecomment-735442076>
2020-11-30 05:12:00 +00:00
Kp dcecc6b9f7 Fix sdlmixer=0 build 2020-11-30 05:12:00 +00:00
Kp 3b5fa6f30b Fix D2 emulation of D1 textures
Fixes: 6d3dce4e16 ("Use enum class for tmap_num2")
2020-11-30 05:12:00 +00:00
Kp dd5f31a19c Fix SDL-only build of automap.cpp
`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")
2020-11-30 05:12:00 +00:00
Kp 64d50d624a Fix SDL-only build break on texture handling
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.
2020-11-30 05:12:00 +00:00
Arne de Bruijn 1d55bc7746 always init extra_bitmap_num in load_exit_models
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.
2020-11-29 22:24:13 +01:00
Kp a028ea14ae Restore format(printf) attribute for powerup_basic
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>
2020-10-27 04:27:55 +00:00
Kp 31bb275b0f Delete bogus member variable
nitems was moved to listbox_layout, and should no longer be in listbox.
Remove it.
2020-10-23 01:57:29 +00:00
Kp ddcf8c1798 Remove support for show_order_form
The original way to order the full version is defunct.  Remove the code
that showed that page.
2020-10-22 02:26:17 +00:00
Kp d309c141e7 Switch non-format uses of nm_messagebox to nm_messagebox_str 2020-10-22 02:26:16 +00:00
Kp 29d3e9a8c4 Move kconfig initialization to NSDMI where possible 2020-10-22 02:26:16 +00:00
Kp ceaea3ec22 Move automap initialization to NSDMI where possible
Some members are initialized with literal values.  Move those to an
NSDMI so that all constructor invocations will set them.
2020-10-22 02:26:16 +00:00
Kp ae657007fe Remove send_creation_events parameter
It is always nullptr.
2020-10-22 02:26:16 +00:00
Kp 2869566866 Remove unused ui_create_dialog parameter createdata
It is always nullptr.  Remove the parameter and pass nullptr where the
parameter was used.
2020-10-22 02:26:16 +00:00
Kp 261acf0ebc Simplify object_dialog callback_handler
The window is a C++ object; it does not need to access a global to get a
pointer to its own data.
2020-10-22 02:26:16 +00:00
Kp d61f3014b9 Remove sole use of non-nullptr createdata
object_dialog needs one parameter.  Move that handling to the
constructor.
2020-10-22 02:26:16 +00:00
Kp d2c5b4d64a Make listbox inherit from window 2020-10-22 02:26:16 +00:00
Kp 09531047b9 Use uint8_t for allow_abort_flag
It is only ever 0 or 1.
2020-10-22 02:26:16 +00:00
Kp 6d50470286 Improve packing of automap structure
Shrink fields that only ever hold byte sized values.
2020-10-12 03:28:26 +00:00
Kp ffb653c0b8 Pass control_info & to various functions
Switch from a direct global reference to passing control_info& as a
parameter.
2020-10-12 03:28:26 +00:00
Kp 47184c1463 Make newmenu inherit from window 2020-10-12 03:28:26 +00:00
Kp 8b7c83c5cb Move newmenu layout to substructure 2020-10-12 03:28:26 +00:00
Kp 840532c4d7 Rename newmenu_create_structure variables to be descriptive
s/tw/iterative_layout_max_width/
s/th/iterative_layout_max_height/
2020-10-12 03:28:26 +00:00
Kp 7e73ee2c78 Pass newmenu& to newmenu_create_structure 2020-10-12 03:28:26 +00:00
Kp 21b98ed513 Reorder newmenu fields to reduce wasted space 2020-10-12 03:28:26 +00:00
Kp 2ccfcb64d8 Use named enum for newmenu TinyMode 2020-10-12 03:28:26 +00:00
Kp 96f5428378 Use named enum for newmenu TabsFlag 2020-10-12 03:28:26 +00:00
Kp 82e007cd09 Remove write-only newmenu::dblclick_flag 2020-10-12 03:28:26 +00:00
Kp f8185494ad Pass UI_DIALOG& to ui_add_gadget_icon 2020-10-12 03:28:26 +00:00
Kp 4f572bbe23 Pass UI_DIALOG& to ui_add_gadget_userbox 2020-10-12 03:28:26 +00:00
Kp 95598a34e3 Pass UI_DIALOG& to ui_add_gadget_inputbox 2020-10-12 03:28:26 +00:00
Kp 466f431c91 Pass UI_DIALOG& to ui_add_gadget_checkbox 2020-10-12 03:28:26 +00:00
Kp 506f24ed04 Pass UI_GADGET_RADIO& to ui_radio_set_value 2020-10-12 03:28:26 +00:00
Kp f531c7d43e Pass UI_DIALOG& to ui_add_gadget_radio 2020-10-12 03:28:26 +00:00
Kp a563b5edf7 Pass UI_DIALOG& to ui_add_gadget_button 2020-10-12 03:28:26 +00:00