Commit graph

11051 commits

Author SHA1 Message Date
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
Kp 81d8b353b2 Fix gcc-11 -Wmisleading-indentation warning
Reindent the affected tests.
2020-12-14 00:04:41 +00:00
Kp bace343437 Fix gcc-11 warning -Wmaybe-uninitialized on input array
For gcc bug #10138 [1], gcc-11 gained a new way to show a
-Wmaybe-uninitialized warning.  When an uninitialized array is passed by
`const T *` to a function, gcc-11 assumes the array is an input to the
function, and warns accordingly.  This is often useful, but is incorrect
for the Rebirth partial_range code.  In this code, the pointer is only
passed so that the eventual exception can print the memory address of
the affected array.  The called function does not dereference the
pointer, and so cannot be influenced by any uninitialized values in the
underlying array.

Change the report function to take the array address in a `uintptr_t`,
and cast it back for printing.  This silences the gcc-11 warning, while
preserving the previous semantics in the code.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138
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 9694df2063 Fix leak of PHYSFS handle if SDL_AllocRW fails
Previously, if SDL_AllocRW failed, then the handle would not be saved
into an SDL_RWops (since that object was not created), but it would also
not be closed immediately.
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
Kp 0f022f4b10 Fix clang build
clang warns if all of:
- type T is deleted by a pointer T*
- T has a non-virtual destructor
- T has a virtual function
- T is not final

Fix the build by making the relevant types T final, since nothing
inherited from them.
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
Kreeblah caa29824b9
Merge dcb6280ef4 into d7999c9fad 2020-11-12 02:31:48 -08:00
Kreeblah dcb6280ef4
Added missing Homebrew dependencies 2020-11-12 02:30:14 -08:00
Edward E d7999c9fad Fix truncation of callback pointer on Windows
Previously fixed ec709efaa3,
but reverted 8a4ac70541
2020-10-29 03:40:19 +00:00
Kp 6af0595cfe Use platform-specific OpenGL libraries for GLU test 2020-10-28 04:02:31 +00: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 52e4d6f103 Remove printf checking on vnm_messagebox_aN
It is always invoked with format arguments.
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