Kp
95d8095c6d
Simplify med_set_vertex
...
- Make it static
- Remove the update of Num_vertices, since the caller reverses that
update.
- Remove the reversal, since it is no longer needed.
- Remove the test and update of Vertices.count, because the caller
always passes a vertex number that makes the test false.
2020-12-26 21:17:29 +00:00
Kp
70d55c010d
Move Num_vertices into if(DXX_USE_EDITOR)
...
Non-editor builds only need Num_vertices as a local during mine loading.
2020-12-26 21:17:29 +00:00
Kp
c58a69dbec
Return vertnum_t from med_add_vertex
2020-12-26 21:17:29 +00:00
Kp
6b3e78054c
Remove support for reading Miner's .LVL files
...
The Miner LVL files are not present in retail Descent 2 data. I know of
no way to obtain them. The code for loading them has been marked as
broken since 2018, and no one reported it. Remove this support to
simplify future work.
2020-12-20 20:39:07 +00:00
Kp
dd3f272929
Use enum class for actdoornum_t
2020-12-20 20:39:07 +00:00
Kp
1c2fcf86e0
Convert multi_leave_game to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
e2c95058db
Convert multi_endlevel to dispatch through a vtable
2020-12-20 20:39:07 +00:00
Kp
a3eb82cefd
Move multi code into namespaces
2020-12-20 20:39:07 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
e7cd8bedec
Remove obsolete embed_window_pointer_t
2020-10-22 02:26:16 +00:00
Kp
8ec63edcd2
Remove obsolete window_create/callback_window
...
All users have been converted to inherit and use virtual functions
instead of a callback function.
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
295619e633
SDL2: explicitly ignore unwanted key repeats
2020-10-12 03:28:26 +00:00
Kp
9a29ea0e1c
Fold check_partial_range into its sole caller
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
4d3eeb903e
Make MENU's window to inherit from window
...
Due to ordering constraints, this is not merged into MENU, but is
instead kept as a distinct sub-type that is pointed at by MENU. MENU
sets the window's position based on parsing of the menu definition file,
but the parser expects to store window position data into MENU before
creating the window. If menubar_window were merged into MENU, the
parser would need a temporary, and all callers that create the window
would need to consult that temporary.
2020-10-12 03:28:26 +00:00
Kp
07eb412244
Make menubar.cpp Menu[] an array of MENU*
, not MENU
2020-10-12 03:28:26 +00:00
Kp
a8f6ef9faf
Set embedded window pointer to nullptr on construction
2020-10-12 03:28:26 +00:00
Kp
6ffa495bf4
Split out special handling for creating menubar
...
All callers request either the menubar or something else, but never
conditionally request one or the other. Split the special handling that
picks a different handler based on which element the caller requested.
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
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
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
3b7a34b066
Pass UI_DIALOG& to ui_draw_scrollbar
2020-10-12 03:28:26 +00:00
Kp
028f0c4cda
Remove unused function ui_draw_frame
2020-10-12 03:28:26 +00:00
Kp
c5afd0eb55
Pass UI_DIALOG& to ui_draw_icon
2020-10-12 03:28:26 +00:00
Kp
9e9429fe58
Pass UI_DIALOG& to ui_draw_userbox
2020-10-12 03:28:26 +00:00
Kp
b45e696574
Pass UI_DIALOG& to ui_draw_checkbox
2020-10-12 03:28:26 +00:00
Kp
380d30f943
Pass UI_DIALOG& to ui_draw_radio
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
ff039c0c90
Pass UI_DIALOG& to ui_add_gadget_scrollbar
2020-10-12 03:28:26 +00:00
Kp
1d7f2e2ab5
Replace ui_gadget_do with virtual function dispatch
2020-10-12 03:28:26 +00:00
Kp
d78d16b82f
Pass UI_DIALOG& to ui_draw_inputbox
2020-10-12 03:28:26 +00:00
Kp
a399fa7b58
Rename ui_icon_do to UI_GADGET_ICON::event_handler
2020-10-12 03:28:26 +00:00
Kp
ca0894c3ab
Rename ui_userbox_do to UI_GADGET_USERBOX::event_handler
2020-10-12 03:28:26 +00:00
Kp
6c89583ca0
Rename ui_inputbox_do to UI_GADGET_INPUTBOX::event_handler
2020-10-12 03:28:26 +00:00
Kp
be157822d8
Rename ui_checkbox_do to UI_GADGET_CHECKBOX::event_handler
2020-10-12 03:28:26 +00:00
Kp
9280187833
Rename ui_radio_do to UI_GADGET_RADIO::event_handler
2020-10-12 03:28:26 +00:00
Kp
43c30bd6b3
Rename ui_scrollbar_do to UI_GADGET_SCROLLBAR::event_handler
2020-10-12 03:28:26 +00:00
Kp
8a4879a7e7
Rename ui_listbox_do to UI_GADGET_LISTBOX::event_handler
2020-10-12 03:28:26 +00:00
Kp
422ee41626
Rename ui_button_do to UI_GADGET_BUTTON::event_handler
2020-10-12 03:28:26 +00:00
Kp
26cb111bc0
Pass UI_DIALOG& to ui_mouse_on_gadget
2020-10-12 03:28:26 +00:00
Kp
a21d89ea6c
Pass UI_DIALOG& to ui_draw_button
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
dd2a60de69
Pass UI_DIALOG& to ui_dialog_set_current_canvas
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
564f699002
Pass UI_DIALOG& to ui_gadget_get_next, ui_gadget_get_prev
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
d7bff3daf3
Pass UI_DIALOG& to ui_dialog_do_gadgets
2020-10-12 03:28:25 +00:00
Kp
f79e0343d9
Pass UI_DIALOG& to ui_gadget_send_event
2020-10-12 03:28:25 +00:00
Kp
6ff47e2a18
Pass UI_DIALOG& to ui_add_gadget_listbox
2020-10-12 03:28:25 +00:00
Kp
33beedc9fd
Pass UI_DIALOG& to ui_draw_listbox
2020-10-12 03:28:25 +00:00
Kp
b30d60a521
Pass UI_DIALOG& to ui_gadget_add
2020-10-12 03:28:25 +00:00
Kp
b19e0698a1
Simplify out ui_dialog_get_window
...
UI_DIALOG now extends window, so the conversion is implicit.
2020-10-12 03:28:25 +00:00
Kp
8547c918c2
Make ui_file_browser inherit from UI_DIALOG
2020-10-12 03:28:25 +00:00
Kp
563ac19708
Make menu.cpp menu inherit from UI_DIALOG
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