Commit graph

5380 commits

Author SHA1 Message Date
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
Kp 6dce3f90c2 Pass UI_DIALOG& to ui_close_dialog 2020-10-12 03:28:26 +00:00
Kp b6a7f63e5d Pass UI_DIALOG& to ui_gadget_calc_keys 2020-10-12 03:28:26 +00:00
Kp f79e0343d9 Pass UI_DIALOG& to ui_gadget_send_event 2020-10-12 03:28:25 +00:00
Kp c1ce3a2938 Pass explicit nullptr for ui_create_dialog createdata 2020-10-12 03:28:25 +00:00
Kp 147078615a Make object_dialog inherit from UI_DIALOG 2020-10-12 03:28:25 +00:00
Kp d25d14c24f Make wall_dialog inherit from UI_DIALOG 2020-10-12 03:28:25 +00:00
Kp 7fb4f7b396 Use std::array for editor mine filename 2020-10-12 03:28:25 +00:00
Kp a6abf76d0a Use enum class for index into ObjBitmaps 2020-10-07 03:59:14 +00:00
Kp 24497fa085 Use enum class for bmread mode selector 2020-10-07 03:59:14 +00:00
Kp 56b45ca2e8 Fix off-by-one in menu logic
If a menu was all text except for the last element, the menu would
incorrectly be classifed as all text, and citem would be pinned to the
first element.

Fixes: 14a9657136 ("Use partial_range to store newmenu_item pointer/length")
2020-10-03 22:34:38 +00:00
Kp c482d01be5 Move some fvi types to namespaces 2020-10-01 03:25:27 +00:00
Kp e6126b800f Reorder endlevel definitions to split by dcx/dsx 2020-10-01 03:25:27 +00:00
Kp d7560843b0 Fix exit tunnel sequence
The index and the value were transposed, and since both were integer
types, the type system was unable to warn that the new code was
incorrect.  Swap the variables to bind as intended.

Reported-by: Donkyhotay <https://github.com/dxx-rebirth/dxx-rebirth/issues/544>
Fixes: de4efc4f46 ("Qualify more uses of shared_segment members")
2020-10-01 03:25:27 +00:00