Commit graph

3838 commits

Author SHA1 Message Date
Kp b5460a0a48 Construct nm_item_text in place 2021-06-28 03:37:49 +00:00
Kp 3d14dbacde Remove digi_reset
It was only available in debug builds, and did nothing when called.
2021-06-28 03:37:49 +00:00
Kp 6e12644620 Remove write-only field digi_sound::bits 2021-06-28 03:37:49 +00:00
Kp 73c3474f8e Reduce uses of RAIIdmem for local variables 2021-06-28 03:37:49 +00:00
Kp ee07a45712 Simplify MALLOC invocations
Remove overload for C array decay, and fix up the call sites that
required it.
2021-06-28 03:37:48 +00:00
Kp 32b7899059 Remove const qualifier from gr_init_bitmap
gr_init_bitmap can be passed a pointer to uninitialized memory, and
will save that pointer into the bitmap for the underlying memory to be
initialized later.  In gcc-11, this triggers a warning because the
`const` qualifier leads gcc to expect that the memory will only be read
(while uninitialized) and not written.

Reported-by: TheDemonicSurfer <https://github.com/dxx-rebirth/dxx-rebirth/issues/593>
2021-06-12 21:07:32 +00:00
Dave Milici 87adf05c75
Merge a9d14fc03d into 48589d0fb0 2021-05-04 10:03:00 -07:00
C.W. Betts 48589d0fb0 Add App Category entries to the plists. 2021-04-30 14:43:15 -06:00
Dave Milici ea6379de2d Add above/below option sync blank interval for external sync doubler. 2021-04-08 14:07:35 -07:00
Kp 1843ed752c Fix Windows build of kconfig.h
fbd05a1592 changed joy.h to include only fwd-event.h, but not event.h.
event.h included maths.h, which kconfig.h was relying on.  Add an
inclusion of maths.h into kconfig.h to define `fix`.

Fixes: fbd05a1592 ("optimize include files (include what you use)")
2021-04-04 22:01:25 +00:00
Kp 18c39192f6 Reduce use of global structures in cheat functions 2021-04-04 22:01:25 +00:00
Kp 02c99b7645 Consolidate stereo dimension math
Remove VR_half_width, VR_half_height.  Their values are directly derived
from VR_stereo, and can be computed on demand.
2021-04-04 22:01:25 +00:00
Dave Milici 6bc0e822d2 Handle HUD overlays in separate screen rects for stereo renderings. 2021-03-17 16:30:31 -07:00
Dave Milici f51e7b86b9 Reorganize & consolidate stereo vars per PR suggestions. 2021-03-15 11:32:10 -07:00
Dave Milici 4d9e656809 Enumerate stereo formats for better logic insulation. 2021-03-14 09:25:38 -07:00
Dave Milici 509da82ee8 Add -gl_stereoview option for selecting stereo viewport modes. 2021-03-12 10:07:45 -08:00
Dave Milici 8c8b7419b6 Improved conditionals for stereo vs non-stereo modes.
Hot-key handling for cycling thru stereo modes & parallax adjustments.
Simplified stereo adjustments for left/right eye separation & offsets.
Not quite compatible yet with Bob Akka stereo method from Descent 1.5.
Function key assignments different (F5..F8) due to pre-empted hot-keys.

ALT+SHIFT+F5:	decrease eye separation (VR_eye_width)
ALT+SHIFT+F6:	increase eye separation (VR_eye_width)
    SHIFT+F5:	decrease image shift (VR_eye_offset)
    SHIFT+F6:	increase image shift (VR_eye_offset)
ALT|SHIFT+F7:	reset eye separation + image shift
ALT|SHIFT+F8:	cycle thru half-width + half-height formats

Note for compiling dxx-rebirth snapshot on MacOSX:

export CXXFLAGS=-Wno-uninitialized
scons macos_add_frameworks=False
2021-03-11 12:32:01 -08:00
Dave Milici bb903a1d80 Support stereo viewport rendering in half-height & half-width formats.
Enable stereo mode when launched via -gl_stereo option.
GL_STEREO quad buffering may not be available unless OGL layer
supports stereo pixel format descriptors.
Half-height viewport rendering for above/below format.
Half-width viewport rendering for side/by/side formats.
HUD & cockpit elements disabled when stereo views active.
2021-03-11 12:32:01 -08:00
Dave Milici 4169183342 Initial stereo rendering test in side-by-side format.
OGL layer used for rendering surfaces, so using left/right viewports absent stereo quad buffers.
Using legacy Descent +/- eye offset method for left/right stereo perspective rendering passes.
2021-03-11 12:32:01 -08:00
Kp 537e9fef37 Throw if a bitmap starts outside its parents boundaries
Such bitmaps will, at best, fail to render due to clipping.  These
should never happen, so report it with an exception if it does.
2021-02-25 03:53:49 +00:00
Kp 1ec6fdb0b5 Add back forwarding includes
These are not necessary for proper compilation, but are included so that
a mismatch between the forward declaration and the definition will be
diagnosed immediately.
2021-02-20 23:46:51 +00:00
Kp 6a425bb2a7 Drop unnecessary includes 2021-02-20 23:46:51 +00:00
dimag0g 6282dd25b9
Merge fbd05a1592 into 8fdc326c2a 2021-02-16 21:30:26 -08:00
C.W. Betts 8fdc326c2a Add CFBundleIdentifier to the plists. 2021-02-07 19:58:12 -07:00
Kp 00f6436959 Zero out newmenu_item::nm_private_imenu
Clear the largest union member to avoid issues with uninitialized
members.  A future change will refine this to construct members to
specific values.
2021-02-08 01:56:15 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp b0338164f7 Remove SDLMain.m
According to @raptor, this is not needed on modern OSX for SDL1 or SDL2,
and breaks the build on SDL2.  Remove it.

Reported-by: raptor <https://github.com/dxx-rebirth/dxx-rebirth/issues/565>
2021-02-06 17:53:53 +00:00
Kp 081024eb8f Fix build for screenshot=legacy opengl=0
Reported-by: dimag0g <https://github.com/dxx-rebirth/dxx-rebirth/pull/568>
2021-02-06 17:53:53 +00:00
Kp 6e52dc8db2 Shrink newmenu_item::right_offset
Its value never exceeds UINT8_MAX.
2021-02-06 17:53:53 +00:00
Kp a4bc997be3 Pack newmenu_item more tightly
Move value down to eliminate one area of padding on 64-bit systems.
2021-02-06 17:53:53 +00:00
Kp 1afd0eeae2 Move NETFLAG_DOPOWERUP to netgame_info and clarify name 2021-01-25 00:45:07 +00:00
Kp 81a2d92ee9 Move ResolutionX, ResolutionY to CCfg 2021-01-25 00:45:07 +00:00
Kp 49944a3fbf Use enum, not integral_constant, for netflag/netgrant constants 2021-01-25 00:45:07 +00:00
Kp 5d0d9dcc1a Use primary_weapon_index_t for pick_up_primary 2021-01-25 00:45:07 +00:00
Kp 2196f6add5 Use enumerated_array for Secondary_ammo_max 2021-01-25 00:45:07 +00:00
Kp 6c63e11caa Use enumerated_array for Secondary_weapon_to_weapon_info 2021-01-25 00:45:07 +00:00
Kp b20fa0d77d Use enumerated_array for Primary_weapon_to_weapon_info 2021-01-25 00:45:07 +00:00
Kp 9abf81c77a Factor out logic for toggling between base/super weapons 2021-01-25 00:45:07 +00:00
Kp f1cfbaa982 Use enum class for cockpit_3d_view 2021-01-25 00:45:07 +00:00
Kp 775d039083 Expand gcc memcpy workaround to gcc-10
The upstream bug is still not fixed.
2021-01-17 22:23:23 +00:00
Kp 77acae6510 Use enum class for weapon_box_user 2021-01-17 22:23:23 +00:00
Kp b70f569178 Use enum class for OGL_TEXFILT_* constants 2021-01-17 22:23:23 +00:00
Kp 1843d375f2 Use enumerated_array for Secondary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp e9f590eeb1 Use enumerated_array for Primary_weapon_to_powerup 2021-01-17 22:23:22 +00:00
Kp baa2823953 Pass player_info to which_bomb
Previously, rendering the preferred bomb type could also change it if
the active type was exhausted.  This is undesirable, since it depends on
the user to have a HUD mode which causes the bomb type to render.
Switch to only change the active type if the user tries to drop a bomb
while the active type is unavailable.  Some call sites already switch
bomb types automatically on depletion.  Those sites will still do so.
2021-01-17 22:23:22 +00:00
Kp c868d32eba Prevent copying class window 2020-12-27 22:03:09 +00:00
Kp e4f8d02380 Make screen_resolution_menu inherit from newmenu 2020-12-27 22:03:09 +00:00
Kp ed2bc8e213 Use enum class for nm_type 2020-12-27 22:03:09 +00:00
Kp 15f9b3d43f Enable use of some STL algorithms on zip_iterator
std::find_if needs common iterator traits.  Add the relevant type
definitions to zip_iterator.

Also add them to d_range, to avoid errors when a range is zipped.
2020-12-27 22:03:09 +00:00
Kp d28ec4723e Allow comparing const instances of screen_mode 2020-12-27 22:03:09 +00:00
Kp ae021b12e7 Use named Difficulty_level enum members in MENU_DIFFICULTY_TEXT 2020-12-27 22:03:09 +00:00
Kp 995e25f740 Simplify dxx_gettext when defined(USE_BUILTIN_ENGLISH_TEXT_STRINGS) 2020-12-27 22:03:09 +00:00
Kp daf53321bf Remove return value of new_player_config
It always succeeds.
2020-12-27 22:03:09 +00:00
Kp 115c38cd77 Remove kmatrix_poll2
After the previous commit, its only purpose is to automatically dismiss
the window after 3 seconds.  Users may be surprised by this, and the
automatic dismissal has limited value.  Remove it and let the user
remain at the cancel dialog until a decision is made.
2020-12-27 22:03:09 +00:00
Kp 80fc124a63 Remove unnecessary definitions of static member variables
C++17 permits, but deprecates, this form.  Remove it to simplify the
code.
2020-12-27 22:03:09 +00:00
Kp e7629f35ee Move newmenu_item::saved_text into the two sub-types that need it 2020-12-27 22:03:09 +00:00
Kp e6875641c9 Move Newmenu_allowed_chars into individual newmenu_item
Allowed characters are more properly scoped to a specific text entry
field.  Move them there to eliminate a global.
2020-12-27 22:03:09 +00:00
Kp 1f8c8e355b Allow newmenu callers to choose whether to use a background box
Previously, callers chose whether to use a fullscreen background image,
and the newmenu code inferred that callers without a background image
wanted a background box, while those with a background image wanted no
box.  Change newmenu_layout to take a parameter specifying the caller's
intent, so that a caller can choose to have any combination of a
background image and a background box.
2020-12-27 22:03:09 +00:00
Kp 2b9c146ff2 Convert glitz menu to inherit from newmenu
Add a static method to block until the menu closes, so that the glitz
menu can continue to block its caller.
2020-12-27 22:03:09 +00:00
Kp c0601edde3 Move GammaLevel to CCfg 2020-12-27 22:03:09 +00:00
Kp a4f41f8360 Pass grs_canvas& to print_clock 2020-12-27 22:03:09 +00:00
Kp c1d6150015 Pass grs_font& to gr_set_curfont 2020-12-27 22:03:09 +00:00
Kp 916eb7a0f9 Extend DXX_CHECK_VAR_IS_DEFINED to work in ASan mode
When AddressSanitizer is enabled, include code to read from the checked
variable, to force AddressSanitizer to perform an accessibility check.
2020-12-27 22:03:09 +00:00
Kp effa7435c2 Remove newmenu_listbox1
It is no longer used.
2020-12-27 22:03:09 +00:00
Kp 0c53d3a34f Replace PHYSFSX_isNewPath with !PHYSFS_getMountPoint
PHYSFSX_isNewPath retrieves from PhysFS a list of all paths, then
searches them, and frees them at the end.  PhysFS can search its own
list without needing the allocations, so delegate the work to it.
2020-12-27 22:03:09 +00:00
Kp 079602b91a Inline string_array_t::tidy comparator
There is only one call, so the target can be moved into the
implementation.  This removes use of a call-by-pointer.
2020-12-27 22:03:09 +00:00
Kp 095d660c55 Inline listbox_get_window
It is only used once.
2020-12-26 21:17:29 +00:00
Kp def7e03260 Move listbox callback handling to a derived class 2020-12-26 21:17:29 +00:00
Kp f43e98764a Move listbox to newmenu.h 2020-12-26 21:17:29 +00:00
Kp f01c29c779 Flatten newmenu_do* hierarchy
There is now a single caller for newmenu_do3.  Inline do3 into do2, so
that do2 calls do4.  Mark do4 as static.
2020-12-26 21:17:29 +00:00
Kp d1ff6becb4 Move listbox_layout to newmenu.h
Rename listbox_create_structure to listbox_layout::create_structure.
2020-12-26 21:17:29 +00:00
Kp 2ded2b2d0c Make kmatrix background optional
Previously, if the background failed to load, the kmatrix window was
immediately aborted.  Change the logic so that a failure to load uses a
blank black background, but still shows the kmatrix window.
2020-12-26 21:17:29 +00:00
Kp b9a27094eb Pass menu_title through listbox functions 2020-12-26 21:17:29 +00:00
Kp b63ccc63ca Make passive_messagebox inherit from newmenu
passive_messagebox is only suitable when the user's selection does not
matter, so restrict to be used for cases where only one "choice" is
offered.
2020-12-26 21:17:29 +00:00
Kp 834f009dd7 Use enum class for wallnum_t 2020-12-26 21:17:29 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp faa4d2ce34 Use enum class for vertnum_t 2020-12-26 21:17:29 +00:00
Kp 10b43d4ba0 Enable quick exit from is_free_vertex
Once the loop has determined a vertex is used at least twice, there is
no need to count how many more times it is used.  Return immediately
after detecting the second use.
2020-12-26 21:17:29 +00:00
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
Kp 1864f2dfdf Remove unnecessary UI menu member button 2020-10-12 03:28:25 +00:00
Kp 46dc19f539 Make messagebox 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 c482d01be5 Move some fvi types to namespaces 2020-10-01 03:25:27 +00:00
Kp b136994551 Move valptridx<segment> to dcx
segment is now dcx, so move the valptridx wrapper.
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 1fc8663eff Improve ui_add_gadget_inputbox length handling
Fix potential buffer overflow if `length` (now `length_of_initial_text`)
is less than the `strlen` computed length of text.

Rename variables to clarify usage.

Eliminate the unnecessary use of `strlen`.
2020-09-28 03:32:15 +00:00
Kp 88ab83c354 Remove write-only field UI_GADGET_INPUTBOX::slength 2020-09-28 03:32:15 +00:00
Kp 9a5e968646 Use std::unique_ptr for UI_GADGET_INPUTBOX::text 2020-09-28 03:32:15 +00:00
Kp 59ca93f219 Simplify copy+uppercase pattern in editor code
Change d_strupr to both copy and uppercase, instead of using strcpy to
copy and then a separate phase to rewrite the text as uppercase.
2020-09-28 03:32:15 +00:00
Kp a6b8012b5d Make editor_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp e4442a1b05 Remove code for ORTHO_VIEWS
Support for ORTHO_VIEWS has been broken since commit
db514a5ded in December 2004.

`git blame HEAD -L872,+4 -- similar/editor/meddraw.cpp`:
```
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 872) 			}
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 873) 		} else
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 874) #if ORTHO_VIEWS
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 875) 		 else if ( screen_canvas == TopViewBox->canvas )
```

When ORTHO_VIEWS is true, this code expands to `} else else if (...)`; a
double-else is not legal, so the code cannot have been compiled with
ORTHO_VIEWS enabled.  All 4 of the relevant lines date to db514a5ded,
which itself is an import of files from the D1X editor.
2020-09-21 03:18:12 +00:00
Kp cd620e5f8c Make trigger_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp 09966079c4 Make centers_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp b97f581d56 Make hostage_dialog inherit from UI_DIALOG 2020-09-21 03:18:12 +00:00
Kp 5cdd562244 Move UI_DIALOG callback handling to virtual function 2020-09-21 03:18:12 +00:00
Kp 8760387188 Make UI_DIALOG inherit from window 2020-09-21 03:18:12 +00:00
Kp 3c1c270643 Make info_dialog_window inherit from window 2020-09-21 03:18:12 +00:00
Kp e068c685f4 Make scores_menu inherit from window 2020-09-21 03:18:12 +00:00
Kp 08701ca190 Store kmatrix_result in a uint8_t size enum 2020-09-21 03:18:12 +00:00