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.
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.
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.
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.
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().
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.
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[]")
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.
The fallthrough appears to be intentional. Add an annotation to allow
it.
Fixes: 6bc0e822d2 ("Handle HUD overlays in separate screen rects for stereo renderings.")
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.
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.
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.
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.
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.
fbd05a1592 dropped an include of "jukebox.h" as unnecessary. jukebox
was almost unnecessary, but jukebox includes physfsx, and physfsx
includes stdexcept. stdexcept is necessary. Include stdexcept
directly.
Fixes: fbd05a1592 ("optimize include files (include what you use)")
Commit e6875641c9 moved allowed_chars from global scope into
individual newmenu_item entries. However, it did not enforce that this
field be initialized, and some callers failed to do so. The save game
menu was such a caller, and crashed when using an uninitialized value as
the allowed_chars pointer. There is no character restriction here, so
explicitly set the pointer to nullptr.
Reported-by: kitelessd <https://github.com/dxx-rebirth/dxx-rebirth/issues/571>
Fixes: e6875641c9 ("Move Newmenu_allowed_chars into individual newmenu_item")
clang warns for an unused constexpr global variable. gcc does not.
Move the affected variable into the same #if that guards the use of the
variable.
Fixes: 4a8d7c7574 ("Default to 1024x768 for new users, not 640x480")
640x480 is too small to render some dialogs correctly, and is much
smaller than even a small laptop screen. Smaller resolutions are still
supported, if the user chooses to switch.
When the user opens the menu via the mouse, grd_curcanv points to a
canvas other than the top level canvas. When the user opens the menu
via the keyboard, grd_curcanv points to the top level canvas. For this
menu, the top level canvas must be used in order to get correct
alignment. Switch the constructor to always use the top level canvas.
Reported-by: dimag0g <https://github.com/dxx-rebirth/dxx-rebirth/issues/564>
Fixes: e45ba0b4a9 ("Make new game menu inherit from newmenu")
Callers only ever test for whether the movie was skipped, and never
distinguish between a movie that ran to completion versus a movie that
the user interrupted. Combine these two statuses into one value, and
eliminate the logic in RunMovie that picked which of the two to return.
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.
v0.58.1 did this, but the functionality was accidentally removed in
859b399d20. Restore it.
Fixes: 859b399d20 ("Use mask for Secondary_last_was_super")
gcc computes a potential value range for game times as [0, 1092] instead
of the [0, 50] that the game uses. This could be reasonable as the code
was before, but even adding an explicit range check before the usage
does not eliminate the warning. Avoid the warning by increasing the
size of the buffer to avoid truncation even if the value were 1092.
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.
The menu operated by kmatrix_poll2 exists only when the containing
kmatrix menu is also open. kmatrix has its own call to
do_protocol_frame, so there is no need for another one here.
Closing the kmatrix window while it is not in the foreground may cause a
use-after-free when it is closed again later, since the event loop can
reenter kmatrix_window::event_handler. Skip the exit logic if the
window is not in the foreground, so that it remains open until it times
out while in the foreground.