File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ enum m_state_e m_return_state;
8787qboolean m_return_onerror ;
8888char m_return_reason [32 ];
8989
90+ extern cvar_t vr_enabled ;
91+
9092#define StartingGame (m_multiplayer_cursor == 1)
9193#define JoiningGame (m_multiplayer_cursor == 0)
9294#define IPXConfig (m_net_cursor == 0)
959961 OPT_ALWAYSMLOOK ,
960962 OPT_LOOKSPRING ,
961963 OPT_LOOKSTRAFE ,
964+ OPT_VR ,
962965//#ifdef _WIN32
963966// OPT_USEMOUSE,
964967//#endif
@@ -1069,6 +1072,10 @@ void M_AdjustSliders (int dir)
10691072 case OPT_LOOKSTRAFE : // lookstrafe
10701073 Cvar_Set ("lookstrafe" , lookstrafe .value ? "0" : "1" );
10711074 break ;
1075+
1076+ case OPT_VR :
1077+ Cvar_Set ("vr_enabled" , vr_enabled .value ? "0" : "1" );
1078+ break ;
10721079 }
10731080}
10741081
@@ -1179,6 +1186,10 @@ void M_Options_Draw (void)
11791186 M_Print (16 , 32 + 8 * OPT_LOOKSTRAFE , " Lookstrafe" );
11801187 M_DrawCheckbox (220 , 32 + 8 * OPT_LOOKSTRAFE , lookstrafe .value );
11811188
1189+ // OPT_VR:
1190+ M_Print (16 , 32 + 8 * OPT_VR , " VR Mode" );
1191+ M_DrawCheckbox (220 , 32 + 8 * OPT_VR , vr_enabled .value );
1192+
11821193 // OPT_VIDEO:
11831194 if (vid_menudrawfn )
11841195 M_Print (16 , 32 + 8 * OPT_VIDEO , " Video Options" );
Original file line number Diff line number Diff line change @@ -332,9 +332,18 @@ void VR_UpdateScreenContent()
332332 ovrLayerEyeFov ld ;
333333 ovrLayerHeader * layers ;
334334
335- GLint w = mirror_texture -> OGL .Header .TextureSize .w ;
336- GLint h = mirror_texture -> OGL .Header .TextureSize .h ;
335+ GLint w , h ;
337336
337+
338+ // Last chance to enable VR Mode - we get here when the game already start up with vr_enabled 1
339+ // If enabling fails, unset the cvar and return.
340+ if ( !vr_initialized && !VR_Enable () ) {
341+ Cvar_Set ("vr_enabled" , "0" );
342+ return ;
343+ }
344+
345+ w = mirror_texture -> OGL .Header .TextureSize .w ;
346+ h = mirror_texture -> OGL .Header .TextureSize .h ;
338347
339348 // Get current orientation of the HMD
340349 ftiming = ovrHmd_GetFrameTiming (hmd , 0 );
You can’t perform that action at this time.
0 commit comments