Commit graph

11223 commits

Author SHA1 Message Date
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 9fb0406234 Make rename-guidebot menu inherit from newmenu 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 efcd9b91ce Use enum class for WALL_IS_DOORWAY_sresult_t
This generates the same code, but shrinks the debug information.
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