Commit graph

5535 commits

Author SHA1 Message Date
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