Commit graph

5422 commits

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