Commit graph

5711 commits

Author SHA1 Message Date
Kp 40b0b6c8fb Adjust indent to silence clang -Wmisleading-indentation
gcc treats the intervening lines since the last `if` as sufficient to
recognize this as not misleading.  clang does not.  Change the indent to
calm clang.
2021-06-28 03:37:51 +00:00
Kp e1aac6949a Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp 770ae0cea5 Replace __attribute_noreturn with C++11 [[noreturn]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:50 +00:00
Kp a3bf147768 Move create_vertex_list_from_invalid_side to dcx 2021-06-28 03:37:50 +00:00
Kp 028f4f8a56 Use structured bindings to access enumerated ranges 2021-06-28 03:37:50 +00:00
Kp eaf319ac4e Inline guidebot search into create_buddy_bot
Remove use of a predicate/std::find_if, and switch to structured
bindings to access the enumerated range.
2021-06-28 03:37:50 +00:00
Kp 7b12aac1bb Transpose returned values for enumerate() of non-tuple
Match the order used for tuple.
2021-06-28 03:37:50 +00:00
Kp 2dd497c96b Switch find_seg_side to use std::optional instead of a magic value 2021-06-28 03:37:50 +00:00
Kp 212400d140 Convert nm_messagebox_str to use messagebox_newmenu 2021-06-28 03:37:50 +00:00
Kp 496aba9886 Make net_udp_select_teams_menu inherit from newmenu 2021-06-28 03:37:50 +00:00
Kp 2cb98e3470 Simplify setup of team vector 2021-06-28 03:37:50 +00:00
Kp 4901e9161d Convert high score saying dialog to use run_blocking_newmenu 2021-06-28 03:37:50 +00:00
Kp 4c34875c84 Remove unused subfunction_handler
Previous commits eliminated all uses of it.  Remove the unused stubs.
2021-06-28 03:37:50 +00:00
Kp 55ea87ca3f Move callback_newmenu handling into event_handler 2021-06-28 03:37:50 +00:00
Kp cfb75c221f Inline newmenu_do4 into its sole caller, newmenu_do2 2021-06-28 03:37:50 +00:00
Kp 0c2f95e2cd Remove write-only member window_rendered_data::rear_view 2021-06-28 03:37:50 +00:00
Kp 8a9eb82d6e Factor out choosing bounty target 2021-06-28 03:37:50 +00:00
Kp 728e687116 Use std library for shuffling netgame start positions 2021-06-28 03:37:50 +00:00
Kp 3d15289273 Return connect type from net_udp_show_game_info 2021-06-28 03:37:50 +00:00
Kp 1f3b678077 Make net_udp preview game menu inherit from newmenu 2021-06-28 03:37:50 +00:00
Kp 0e9e88da87 Make file browser Windows drive selection menu inherit from newmenu 2021-06-28 03:37:50 +00:00
Kp 19d0de3cea Move weapon reorder menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 925ed7491b Move netgame grant-powerup menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp da7059a0a7 Move netgame more-options menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp e9f895de73 Move netgame powerups-allowed menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp b1ea316a63 Move netgame list menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 2e41a2b169 Move manual net join menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 5f4e8da3b9 Move sandbox menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 56ad2266da Move netgame menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 52f9e29e82 Move gameplay menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 71f05d987a Move sound menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 431a2f99f1 Move graphics configuration menu subfunction handling to event_handler 2021-06-28 03:37:50 +00:00
Kp 3f8ef01dc7 Move hud configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 464e4e99fb Move hud style configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp d8860549c4 Move reticle configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 8fc9778e5e Move input configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 8a3cd4c614 Move joystick configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp f5e837d70b Move mouse configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp c3a35fd952 Move keyboard configuration menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp f3d47c2b3c Move options_menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 54456faf2a Move main_menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 4aef667ac6 Move wimp_menu subfunction handling to event_handler 2021-06-28 03:37:49 +00:00
Kp 53cd92727e Move marker_delete_are_you_sure_menu select handling to event_handler 2021-06-28 03:37:49 +00:00
Kp ce8a5d4275 Pass EVENT_NEWMENU_SELECTED through full event_handler
This makes the path slightly longer now, but allows derived types to
switch away from subfunction_handler individually.
2021-06-28 03:37:49 +00:00
Kp 6cf6c62550 Convert some uses of nm_messagebox_str to run_blocking_newmenu
The latter more clearly shows that the code flow will not proceed past
this point while the menu is open.  This conversion sets the stage for
later changes to make these menus asynchronous.
2021-06-28 03:37:49 +00:00
Kp 63ac8a1f5d Move saved_text out of imenu_specific_type
This significantly shrinks newmenu_item, by not embedding a saved_text
in the union that is present in every newmenu_item.
2021-06-28 03:37:49 +00:00
Kp d0d7545ec1 Unload robot movies on exit 2021-06-28 03:37:49 +00:00
Kp 76a7361786 Close descent.hog on exit
Add RAII wrappers for unmounting PHYSFS paths.  Use them in places that
previously handled unmounting explicitly.  Also, use it for descent.hog
/ descent2.hog, which previously were left mounted indefinitely.
2021-06-28 03:37:49 +00:00
Kp 1dba8e40ec Move PHYSFSX_addRelToSearchPath pathname to caller
Some callers will need access to the computed path.  Change the callers
to pass in a buffer for this path, and have PHYSFSX_addRelToSearchPath
fill that buffer directly.
2021-06-28 03:37:49 +00:00
Kp c98c412fbb Remove template indirection around PHYSFSX_getRealPath
All callers use a std::array<char, PATH_MAX>, so update the definition
to use that.
2021-06-28 03:37:49 +00:00
Kp 391a539ad2 Use enum class for PHYSFSX_addRelToSearchPath append/prepend parameter 2021-06-28 03:37:49 +00:00
Kp 93a7e34caf Move newmenu_item slider storage of saved_text out of line
When other newmenu_item private members also move, this will make
newmenu_item smaller.
2021-06-28 03:37:49 +00:00
Kp 1936b771e1 Construct nm_item_input in place 2021-06-28 03:37:49 +00:00
Kp 821e68527d Remove nm_set_item_input overload for char[]
Require use of std::array.  There is no need to support both overloads.
2021-06-28 03:37:49 +00:00
Kp 2a504ee03e Construct nm_item_menu in place 2021-06-28 03:37:49 +00:00
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 d0a8cf7769 Avoid unnecessary reallocations in D1 shareware sound decompression
lastsize was never updated from 0, so every pass would reallocate the
buffer.  Switch to a std::vector and rely on it to remember the size.
Manually tracking the size would be slightly more efficient, but this is
not a hot path and the vector approach is easier to review.
2021-06-28 03:37:48 +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
AlumiuN b918d33e1c Fix door lock/unlock triggers causing a crash when given an invalid wall location 2021-06-14 15:16:56 +12:00
AlumiuN a17129a9aa Fixed mission menu subdirectory handling 2021-06-13 20:15:26 +12:00
Dave Milici 87adf05c75
Merge a9d14fc03d into 48589d0fb0 2021-05-04 10:03:00 -07:00
Dave Milici a9d14fc03d Relocate stereo conditional for cockpit views into select_cockpit().
Avoids switching cockpit views to CM_LETTERBOX when player dies or
level ends which stereo viewport is active, as well as other calls
to select_cockpit().
2021-05-04 09:55:48 -07:00
Dave Milici a394bd0312 Consolidated above/below format cases for readability. 2021-05-04 08:46:26 -07:00
Dave Milici 5025cedf45 Simplified case for above/below blank interval adjustment. 2021-05-03 16:05:12 -07:00
Kp 58a1d86c05 Fix return type of check_trans_wall lambda (#588)
The deduced return type is `grs_bitmap`, which is inefficient, but not
wrong on its own.  However, `rle_expand_texture` uses the address of its
argument as a long-term cache key, so it must never be called with the
address of a stack-local variable.  When the return type is
`grs_bitmap`, the argument to `rle_expand_texture` is a reference to a
stack-local variable.  Fix this by setting the return type to
`const grs_bitmap &`, so that the argument to `rle_expand_texture` is a
reference to an element in the global GameBitmaps array.

AlumiuN proposed an initial fix, but based on analysis of why that fix
worked, I elected to use a different, smaller, fix instead.

Reported-by: CHILLYBUS <https://github.com/dxx-rebirth/dxx-rebirth/issues/588>
Reported-by: KynikossDragonn <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-825978696>
Analyzed-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-826009993>
Analyzed-by: 4C1T <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-826016402>
Proposed-fix-by: AlumiuN <c4d1f41946>
Fixes: 61f186bc18 ("Use enum class for texture1_value")
2021-04-24 17:32:47 +00:00
Dave Milici d06751282b Hack to keep stereo formats remaining fullscreen.
When player gets killed, the screen inexplicably switches to
another viewport format to show explosion POV and then switches
to cockpit viewport, which is not compatible with stereo formats.

Unable to locate where exactly cockpit gets switched on player
dead state, so hack is in place to keep stereo formats fullscreen.
2021-04-08 14:07:35 -07:00
Dave Milici ea6379de2d Add above/below option sync blank interval for external sync doubler. 2021-04-08 14:07:35 -07:00
Kp 1ebb738434 Fix break for !DXX_USE_EDITOR
Fixes: ddb9e8e774 ("Add in-game editor menu to update Cursegp")
2021-04-07 01:45:58 +00:00
Kp 6666928824 Fix Windows build of menu.cpp
Commit 6ad87cf78ab3 removed support for char[] as an input to
nm_item_input and fixed all sites that used it in the cross-platform
build.  The Windows build has one use that no other platform does, and
this use was not fixed.  Fix it now.

Fixes: 6ad87cf78ab369cdc26080ac579fb2ab3f592de6 ("Remove nm_set_item_input overload for char[]")
2021-04-04 22:01:25 +00:00
Kp 32ef2969e6 Override mapping of D1 secret door texture
Previously, this texture was handled by the default branch, which would
add 64.  For this texture, adding 64 picks a frame late in an animation,
causing the texture to have transparent areas.  The intended texture, as
used in D1, has no transparent areas.  Add a special case to pick the
first frame, which appears solid.

Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/577>
Analyzed-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/577#issuecomment-783002296>
2021-04-04 22:01:25 +00:00
Kp 414c59c6ba Enable backtick-based segment reporting in D1
This is a developer feature that is useful in D2.  Backport it to D1.
2021-04-04 22:01:25 +00:00
Kp ddb9e8e774 Add in-game editor menu to update Cursegp 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 63940def1a Hide -gl_stereo behind #if !defined(RELEASE)
As discussed in pull #582, there are some rough edges to this feature.
Hide the option, but not the functionality, from users until these can
be corrected.  Users who want to experiment with the feature can access
it through the command-line or the in-game hotkeys in any build.  This
change only hides the help text, to prevent users from finding it and
expecting it to be fully finished.
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
Kp 70ef749ff4 Consolidate stereo GL calls
Reorder the logic to unify the common calls at the bottom of the
function, and skip computing anything if called in no-stereo mode.
2021-04-04 22:01:25 +00:00
Kp 426621398f Only read viewport if VR needs it for an update 2021-04-04 22:01:25 +00:00
Kp 8cc8e80eae Fix VR build failure due to implicit fallthrough
The fallthrough appears to be intentional.  Add an annotation to allow
it.

Fixes: 6bc0e822d2 ("Handle HUD overlays in separate screen rects for stereo renderings.")
2021-04-04 22:01:25 +00:00
Dave Milici 23bbe7dde8 Offset HUD screen rects for out-of-screen stereo parallax on HUD overlays.
Used 1x VR_eye_offset to track image shift adjustments via OGL frustum planes
instead of 2x VR_eye_offset used in Descent 1.5 image shift adjustments.

Without any HUD rect offset, HUD overlays would appear to match the zero-parallax
view plane instead of appearing in an out-of-screen parallax view plane.
2021-03-17 18:01:03 -07:00
Dave Milici 6bc0e822d2 Handle HUD overlays in separate screen rects for stereo renderings. 2021-03-17 16:30:31 -07:00
Dave Milici ca1478ea88 Relocate stereo viewport scaling at caller level outside of OGL layer.
Almost compatible size with HUD screen effects if re-enabled.
2021-03-15 20:02:22 -07:00
Dave Milici 528650c37e Use std::array for viewport/tranform params per PR suggestion. 2021-03-15 14:45:29 -07:00
Dave Milici 08b8790ad0 Remove separate left/right caches for stereo viewport + transform params.
ogl_stereo_frame() is only ever called once for selected stereo view..
2021-03-15 14:30:48 -07:00
Dave Milici ab7924e129 Relocate viewport/transform adjustments inside ogl_stereo_frame() call.
Note since ogl_stereo_frame() is only ever called once per ogl_start_frame()..
ogl_end_frame() instance, only the active stereo eye view needs to be handled.
Implies that separate left/right viewport/transform caches are redundant.
2021-03-15 14:01:53 -07:00
Dave Milici f51e7b86b9 Reorganize & consolidate stereo vars per PR suggestions. 2021-03-15 11:32:10 -07:00
Dave Milici fdfcb726d1 Use frustum left/right clipping for image shift instead of viewport clipping.
left/right clipping planes affected by frustum matrix term M[2][0] (8th element)
2021-03-14 11:45:37 -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 f5d2dfa7ce Use Descent 1.5 defaults for stereo parallax params. 2021-03-11 12:32:01 -08:00
Dave Milici 4ca5f63b49 Use GL viewport clipping for stereo parallax image shift adjustments.
Equivalent to legacy Descent 1.5 pixel shift methods for stereo formats.
Since Descent is rendering viewpoint differences for left/right eyes,
pixel shifting via display viewport is sufficient adjustment.

Since OGL layer here is essentially handling display output surfaces,
the OGL projection transform is not useful for stereo parallax effects
as when used for 3D scenes.
2021-03-11 12:32:01 -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
Dmitry Grigoryev 09946a1d99 Fix alignment of screen resolution menu text 2021-03-05 13:03:07 +01:00
Kp fcd5991eeb Clamp kconfig window size to screen size 2021-02-25 03:53:49 +00:00
Kp 6c814ff095 Draw kconfig background based on window dimensions
Replace hardcoded dimensions with the dimensions used by the window
being drawn.
2021-02-25 03:53:49 +00:00
Kp 6a425bb2a7 Drop unnecessary includes 2021-02-20 23:46:51 +00:00