mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-18 03:00:36 +02:00
fix(vr): put in-game fullscreen menus on the panel, and load the test map late
Three things, all found by running it. The mission briefing was drawn onto the player's face. VR_UseScreenLayer only asked whether clc.state was CA_ACTIVE, so a fullscreen menu that comes up while the player is still in the world skipped the quad layer and was drawn as screen space 2D into both eye buffers - at the near plane, a hand's width away, with no disparity to fuse and each eye warping it through its own asymmetric frustum. That is exactly what the panel exists to prevent; nothing in-game was reaching for it. It now checks UI_FullscreenMenuUp as well. The log said so before the headset did: "view3d 0" with the eye passes still running means the 3D scene is not being drawn at all, which only happens when a fullscreen menu is covering it. map in autoexec.cfg never had a chance. That file is exec'd during Com_Init and the game's own startup - the intro stages, then the menu - runs afterwards and tears down anything loaded there. vr_startMap now waits until the client is sitting idle at the menu and loads it then. vr_testStart also prints unconditionally: a hook that silently does nothing is indistinguishable from one that never ran, and telling those apart has cost enough already. vr_captureEye is a plain archived cvar rather than a VR_TuningCvar. Those force their default at every start, which is right for a value still being argued with and wrong for a switch - it made the config's own setting impossible to honour and cost a device run to notice. The handoff warns about this exact trap. vr_traceFrame is off in the shipped config: three lines a second rolls anything that prints once out of logcat within a minute. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ce91fd1bf7
commit
013b2f5bbf
4 files changed
+83
-7
No files matched your search
+44
-1
@@ -2698,9 +2698,48 @@ spawning, and a give aimed at nothing is silently dropped.
|
||||
*/
|
||||
static void CL_RunStartupCommand( void ) {
|
||||
static qboolean fired;
|
||||
static qboolean mapFired;
|
||||
static int activeSince;
|
||||
static int idleSince;
|
||||
cvar_t *cmd;
|
||||
|
||||
// Loading the map from autoexec.cfg does not survive: that runs during
|
||||
// Com_Init, and the game's own startup - the intro stages and then the
|
||||
// menu - comes afterwards and tears it down again. So it waits here until
|
||||
// the client is actually sitting at the menu doing nothing.
|
||||
if ( clc.state == CA_DISCONNECTED ) {
|
||||
cvar_t *startMap;
|
||||
|
||||
activeSince = 0;
|
||||
fired = qfalse;
|
||||
|
||||
if ( mapFired ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !idleSince ) {
|
||||
idleSince = cls.realtime;
|
||||
return;
|
||||
}
|
||||
|
||||
// Long enough for the intro stages to have finished handing the client
|
||||
// around; starting a map underneath them leaves the menu on top of it.
|
||||
if ( cls.realtime - idleSince < 4000 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
startMap = Cvar_Get( "vr_startMap", "", CVAR_TEMP );
|
||||
mapFired = qtrue;
|
||||
|
||||
if ( startMap && startMap->string[0] ) {
|
||||
Com_Printf( "vr_startMap: %s\n", startMap->string );
|
||||
Cbuf_AddText( va( "map %s\n", startMap->string ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
idleSince = 0;
|
||||
|
||||
if ( clc.state != CA_ACTIVE ) {
|
||||
// Armed again for the next map, so this works on every load rather
|
||||
// than only the first.
|
||||
@@ -2725,8 +2764,12 @@ static void CL_RunStartupCommand( void ) {
|
||||
cmd = Cvar_Get( "vr_testStart", "", CVAR_TEMP );
|
||||
fired = qtrue;
|
||||
|
||||
// Printed either way. A hook that silently does nothing is indistinguishable
|
||||
// from one that never ran, and telling those apart has cost enough already.
|
||||
Com_Printf( "vr_testStart: in world, command is \"%s\"\n",
|
||||
( cmd && cmd->string[0] ) ? cmd->string : "" );
|
||||
|
||||
if ( cmd && cmd->string[0] ) {
|
||||
Com_Printf( "vr_testStart: %s\n", cmd->string );
|
||||
Cbuf_AddText( va( "%s\n", cmd->string ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -724,6 +724,11 @@ void SCR_DrawSmallChar( int x, int y, int ch );
|
||||
|
||||
void UpdateStereoSide( stereoFrame_t s );
|
||||
|
||||
// Whether a menu covering the whole screen is up. True during the mission
|
||||
// briefing and anything else that takes over the view while the player is
|
||||
// still in the world.
|
||||
qboolean UI_FullscreenMenuUp( void );
|
||||
|
||||
//
|
||||
// cl_cin.c
|
||||
//
|
||||
|
||||
+21
-2
@@ -894,7 +894,11 @@ qboolean VR_Init(void)
|
||||
vr.vr_wristBack = VR_TuningCvar("vr_wristBack", "0.07");
|
||||
// Dumps the left eye to main/vrshotN.tga every two seconds, so what the
|
||||
// renderer produced can be looked at directly instead of described.
|
||||
vr_captureEye = VR_TuningCvar("vr_captureEye", "0");
|
||||
// Deliberately not a VR_TuningCvar. Those force their default at every
|
||||
// start, which is right for a value still being argued with and wrong for a
|
||||
// switch: it made the config's own setting impossible to honour, and cost a
|
||||
// device run finding out.
|
||||
vr_captureEye = Cvar_Get("vr_captureEye", "0", CVAR_ARCHIVE);
|
||||
// How long the weapon hand grip may be held and still count as a tap
|
||||
// for reload. The reference calls this vr_reloadtimeoutms.
|
||||
vr_reloadTapMs = Cvar_Get("vr_reloadTapMs", "400", CVAR_ARCHIVE);
|
||||
@@ -3963,7 +3967,22 @@ world behind them.
|
||||
*/
|
||||
qboolean VR_UseScreenLayer(void)
|
||||
{
|
||||
return (clc.state != CA_ACTIVE) ? qtrue : qfalse;
|
||||
if (clc.state != CA_ACTIVE) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
// A menu covering the whole screen belongs on the panel too, even though
|
||||
// the player is technically in the world. The mission briefing is one, and
|
||||
// without this it is drawn as screen space 2D into both eye buffers - which
|
||||
// puts it at the near plane, a hand's width from the player's face, with no
|
||||
// disparity to fuse and each eye warping it through its own asymmetric
|
||||
// frustum. It is exactly the problem the quad layer was built to solve; it
|
||||
// simply was not being reached for anything in-game.
|
||||
if (UI_FullscreenMenuUp()) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// The reference keeps one of these per weapon (vr_weapon_adjustment_<id>);
|
||||
// this is a single global one until the numbers for each are known.
|
||||
set vr_weaponAdjust "1,0,0,0,0,0,0"
|
||||
set vr_weaponAdjust "1,-10,-6,0,0,0,0"
|
||||
|
||||
// How long the weapon hand grip may be held and still count as a tap for
|
||||
// reload, rather than being ignored.
|
||||
@@ -39,6 +39,11 @@ set vr_reloadTapMs 400
|
||||
|
||||
// Dumps the left eye to main/vrshotN.tga every two seconds. Pull them one at a
|
||||
// time - pulling the directory drags the pk3s with it.
|
||||
// The per frame timing report is three lines a second, which rolls anything
|
||||
// useful out of logcat within a minute or two. Off while hunting anything that
|
||||
// prints once.
|
||||
set vr_traceFrame 0
|
||||
|
||||
set vr_captureEye 1
|
||||
|
||||
// --- weapon test harness ---
|
||||
@@ -53,6 +58,10 @@ set vr_captureEye 1
|
||||
set cheats 1
|
||||
set vr_testStart "give all"
|
||||
|
||||
// Drop straight into a map on launch. Comment out to get the menu instead.
|
||||
// m1l1 is the training level; any map name works.
|
||||
map m1l1
|
||||
// Drop straight into a map on launch. Clear it to get the menu instead.
|
||||
//
|
||||
// Not "map m1l1" directly: autoexec runs during Com_Init, and the game's own
|
||||
// startup - the intro stages, then the menu - comes afterwards and tears any
|
||||
// map loaded here straight back down. This waits until the client is sitting
|
||||
// idle at the menu and then loads it.
|
||||
set vr_startMap "m1l1"
|
||||
Reference in new issue
Block a user