diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index 92d44b0d6..ef10df04e 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/d3xp/Game_local.cpp @@ -5772,8 +5772,6 @@ bool idGameLocal::Shell_IsActive() const { if ( game->isVR ) { - //return common->Dialog().IsDialogActive() || shellHandler->IsActive(); - //if ( common->Dialog().IsDialogPausing() || shellHandler->IsActive() ) return true; if ( common->Dialog().IsDialogActive() || shellHandler->IsActive() ) return true; } else diff --git a/neo/d3xp/IK.cpp b/neo/d3xp/IK.cpp index 2e4c57e40..32a06854b 100644 --- a/neo/d3xp/IK.cpp +++ b/neo/d3xp/IK.cpp @@ -245,24 +245,25 @@ bool idIK::SolveTwoArmBones( idVec3& startPos, idVec3& endPos, const idVec3& dir lengthInv = idMath::InvSqrt( lengthSqr ); length = lengthInv * lengthSqr; - // if the start and end position are too far out or too close to each other + + //koz - if using motion controls and displaying the body, and a controller is reporting a impossible position, restrain the arm length. + + if ( 0 && game->isVR && vr_playerBodyMode.GetInteger() == 0 ) + { + maxLen = (len0 + len1) * 1.40f; + if ( length > maxLen ) + { + lenDif = (maxLen - length) / 2.0f; + vec0.Normalize(); + endPos = startPos + maxLen * vec0; - /* - maxLen = ( len0 + len1 ) * 1.40f; - if ( length > maxLen && 0 ) - { - - lenDif = ( maxLen - length ) / 2.0f; - vec0.Normalize(); - endPos = startPos + maxLen * vec0; - - jointPos = endPos - ( len1 - lenDif ) * vec0; - startPos = startPos + lenDif * vec0; - return false; + jointPos = endPos - (len1 - lenDif) * vec0; + startPos = startPos + lenDif * vec0; + return false; + } } - */ - + // if the start and end position are too far out or too close to each other if ( length > len0 + len1 ) { vec0.Normalize(); diff --git a/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index f135e040e..61f2945c5 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/d3xp/Player.cpp @@ -9233,6 +9233,14 @@ void idPlayer::EvaluateControls() if( gameLocal.time > minRespawnTime ) { gameLocal.sessionCommand = "died"; + + if ( game->isVR ) + { + common->Printf( "Player evaluate controls setting playerdead true %d\n", Sys_Milliseconds() ); + commonVr->wasLoaded = false; + commonVr->playerDead = true; + } + } } } @@ -13136,7 +13144,7 @@ void idPlayer::CalculateViewFlashPos( idVec3 &origin, idMat3 &axis, idVec3 flash if ( flashMode == FLASH_HAND ) { - if ( game->IsPDAOpen() || commonVr->PDArising || currentWeapon == weapon_pda || (!commonVr->VR_USE_MOTION_CONTROLS /*&& !vr_showBody.GetBool()*/) || (commonVr->handInGui && flashMode == FLASH_GUN) ) + if ( game->IsPDAOpen() || commonVr->PDAforcetoggle || currentWeapon == weapon_pda || (!commonVr->VR_USE_MOTION_CONTROLS /*&& !vr_showBody.GetBool()*/) || (commonVr->handInGui && flashMode == FLASH_GUN) ) { flashMode = FLASH_HEAD; } @@ -13265,9 +13273,9 @@ void idPlayer::CalculateViewFlashPos( idVec3 &origin, idMat3 &axis, idVec3 flash // koz fixme this is where we set the left hand position. Yes it's a stupid place to do it move later - if ( game->IsPDAOpen() || commonVr->PDArising || currentWeapon == weapon_pda) return; //dont dont anything with the left hand if motion controlling the PDA, only if fixed. + if ( game->IsPDAOpen() || commonVr->PDAforcetoggle || currentWeapon == weapon_pda) return; //dont dont anything with the left hand if motion controlling the PDA, only if fixed. - if ( commonVr->VR_USE_MOTION_CONTROLS && ( !game->IsPDAOpen() || commonVr->PDArising || currentWeapon == weapon_pda ) ) + if ( commonVr->VR_USE_MOTION_CONTROLS && ( !game->IsPDAOpen() || commonVr->PDAforcetoggle || currentWeapon == weapon_pda ) ) { static idVec3 motionPosition = vec3_zero; @@ -13803,24 +13811,21 @@ void idPlayer::CalculateRenderView() // koz fixme pause - handle the PDA model if game is paused // really really need to move this somewhere else, - if ( commonVr->PDAforcetoggle || commonVr->PDArising ) + if ( !commonVr->PDAforcetoggle && commonVr->PDAforced && weapon->IdentifyWeapon() != WEAPON_PDA ) // PDAforced cannot be valid if the weapon is not the PDA + { + commonVr->PDAforced = false; + commonVr->VR_GAME_PAUSED = false; + } + + if ( commonVr->PDAforcetoggle ) { - if ( commonVr->PDAforcetoggle && Sys_Milliseconds() - commonVr->pdaToggleTime < 3000 ) - { - // dont force a toggle if level just loaded to allow shell time to shutdown. - commonVr->PDAforcetoggle = false; - return; - } - if ( !commonVr->PDAforced ) { - if ( !commonVr->PDArising ) + if ( weapon->IdentifyWeapon() != WEAPON_PDA ) { - //common->Printf( "idPlayer::CalculateRenderView calling SelectWeapon for PDA\nPDA Forced = %i, PDA Rising = %i, PDAForceToggle = %i\n",commonVr->PDAforced,commonVr->PDArising,commonVr->PDAforcetoggle ); + common->Printf( "idPlayer::CalculateRenderView calling SelectWeapon for PDA\nPDA Forced = %i, PDAForceToggle = %i\n",commonVr->PDAforced,commonVr->PDAforcetoggle ); SelectWeapon( weapon_pda, true ); - commonVr->PDAforcetoggle = false; - commonVr->PDArising = true; - + const function_t* func; func = scriptObject.GetFunction( "SetWeaponHandPose" ); if ( func ) @@ -13836,23 +13841,19 @@ void idPlayer::CalculateRenderView() else { - if ( weapon->IdentifyWeapon() == WEAPON_PDA && weapon->status == WP_READY ) + if ( weapon->status == WP_READY ) { commonVr->PDAforced = true; - commonVr->PDArising = false; + commonVr->PDAforcetoggle = false; } } } else { // pda has been already been forced active, put it away. - if ( commonVr->PDAforcetoggle ) - { - //common->Printf( "idPlayer::CalculateRenderView calling TogglePDA\n" ); - TogglePDA(); - commonVr->PDAforcetoggle = false; - commonVr->PDAforced = false; - commonVr->PDArising = false; - } + + TogglePDA(); + commonVr->PDAforcetoggle = false; + commonVr->PDAforced = false; } } @@ -14423,7 +14424,7 @@ void idPlayer::Event_GetWeaponHandState() int handState = 0; - if ( commonVr->handInGui || commonVr->PDArising || currentWeapon == weapon_pda ) + if ( commonVr->handInGui || commonVr->PDAforcetoggle || currentWeapon == weapon_pda ) { handState = 2 ; } diff --git a/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index 25da03408..56ea5a5c1 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/d3xp/PlayerView.cpp @@ -881,7 +881,7 @@ void idPlayerView::RenderPlayerView( idMenuHandler_HUD* hudManager ) commonVr->lastCenterEyeAxis = view->viewaxis; commonVr->lastCenterEyeOrigin = view->vieworg; - if ( !commonVr->PDAforced && !commonVr->PDArising && !game->IsPDAOpen() ) // koz moved this so we can see the hud if we want, but still skip all other view effects. + if ( !commonVr->PDAforced && !commonVr->PDAforcetoggle && !game->IsPDAOpen() ) // koz moved this so we can see the hud if we want, but still skip all other view effects. { commonVr->swfRenderMode = RENDERING_HUD; player->DrawHUDVR( hudManager ); @@ -893,7 +893,7 @@ void idPlayerView::RenderPlayerView( idMenuHandler_HUD* hudManager ) if ( player->pdaMenu != NULL ) { - if ( !commonVr->PDAforced && !commonVr->PDArising ) // dont render the PDA gui if the PDA model been forced up to display the pause menus. + if ( !commonVr->PDAforced && !commonVr->PDAforcetoggle ) // dont render the PDA gui if the PDA model been forced up to display the pause menus. { commonVr->swfRenderMode = RENDERING_PDA; player->pdaMenu->Update(); @@ -2065,7 +2065,7 @@ void FullscreenFXManager::Process( const renderView_t* view ) // do the actual drawing if( drawIt ) // koz fix me had temp made this always false, cant remember what I was testing now, make sure nothing is broken. { - common->Printf( "Process FullscreenFX %s\n", pfx->GetName().c_str() ); + //common->Printf( "Process FullscreenFX %s\n", pfx->GetName().c_str() ); atLeastOneFX = true; // we need to dump to _currentRender diff --git a/neo/d3xp/Weapon.cpp b/neo/d3xp/Weapon.cpp index 2fa853216..b5dbdbdce 100644 --- a/neo/d3xp/Weapon.cpp +++ b/neo/d3xp/Weapon.cpp @@ -5286,7 +5286,7 @@ void idWeapon::Event_Melee() { idEntity* ent; trace_t tr; - common->Printf( "Melee!!\n" ); + if( weaponDef == NULL ) { gameLocal.Error( "No weaponDef on '%s'", this->GetName() ); diff --git a/neo/d3xp/menus/MenuScreen_Shell_Pause.cpp b/neo/d3xp/menus/MenuScreen_Shell_Pause.cpp index 221b7f4ae..0b9ff4bf8 100644 --- a/neo/d3xp/menus/MenuScreen_Shell_Pause.cpp +++ b/neo/d3xp/menus/MenuScreen_Shell_Pause.cpp @@ -268,12 +268,7 @@ void idMenuScreen_Shell_Pause::ShowScreen( const mainMenuTransition_t transition isMpPause = false; if( isDead ) { - - if ( game->isVR ) - { - commonVr->playerDead = true; - } - + option.Append( "#str_02187" ); // load game menuOptions.Append( option ); option.Clear(); diff --git a/neo/d3xp/menus/MenuScreen_Shell_VR_Rendering_Options.cpp b/neo/d3xp/menus/MenuScreen_Shell_VR_Rendering_Options.cpp index 397c9d497..e2df40970 100644 --- a/neo/d3xp/menus/MenuScreen_Shell_VR_Rendering_Options.cpp +++ b/neo/d3xp/menus/MenuScreen_Shell_VR_Rendering_Options.cpp @@ -340,10 +340,10 @@ void idMenuScreen_Shell_VR_Rendering_Options::idMenuDataSource_Shell_VR_Renderin switch ( fieldIndex ) { case RENDERING_OPTIONS_FIELD_PIXEL_DENSITY: { - const float percent = LinearAdjust( vr_pixelDensity.GetFloat(), 1.0f, 2.0f, 0.0f, 100.0f ); - const float adjusted = percent + (float)adjustAmount * 5.0f; - const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted ); - vr_pixelDensity.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, .5f, 2.0f ) ); + const float pd = vr_pixelDensity.GetFloat(); + const float adjusted = pd + (float)adjustAmount * .05; + const float clamped = idMath::ClampFloat( 0.8f, 2.0f, adjusted ); + vr_pixelDensity.SetFloat( clamped ); break; } diff --git a/neo/framework/Common_load.cpp b/neo/framework/Common_load.cpp index c8667a5c7..e16b1a2e6 100644 --- a/neo/framework/Common_load.cpp +++ b/neo/framework/Common_load.cpp @@ -232,9 +232,7 @@ void idCommonLocal::UnloadMap() StopPlayingRenderDemo(); commonVr->PDAforcetoggle = false; - commonVr->PDArising = false; commonVr->PDAforced = false; - commonVr->playerDead = false; commonVr->vrIsBackgroundSaving = false; commonVr->VR_GAME_PAUSED = false; @@ -763,17 +761,19 @@ void idCommonLocal::ExecuteMapChange() // Issue a render at the very end of the load process to update soundTime before the first frame soundSystem->Render(); + // koz commonVr->PDAforcetoggle = false; - commonVr->PDArising = false; commonVr->PDAforced = false; - commonVr->playerDead = false; commonVr->vrIsBackgroundSaving = false; commonVr->VR_GAME_PAUSED = false; commonVr->pdaToggleTime = Sys_Milliseconds(); + commonVr->wasLoaded = true; vr_headingBeamMode.SetModified(); vr_weaponSight.SetModified(); - + // koz end + + } /* @@ -1038,8 +1038,7 @@ bool idCommonLocal::SaveGame( const char* saveName ) commonVr->lastSaveTime = Sys_Milliseconds(); commonVr->wasSaved = true; - - + return true; } @@ -1054,10 +1053,8 @@ bool idCommonLocal::LoadGame( const char* saveName ) // koz fixme do this right. // Make sure the pda is in a valid state on game load. commonVr->PDAforced = false; - commonVr->PDArising = false; commonVr->PDAforcetoggle = false; commonVr->VR_GAME_PAUSED = false; - commonVr->playerDead = false; commonVr->VR_GAME_PAUSED = false; commonVr->pdaToggleTime = Sys_Milliseconds() + 1000; // Koz end @@ -1403,12 +1400,14 @@ CONSOLE_COMMAND_SHIP( saveGame, "saves a game", NULL ) } // Koz end - commonVr->gameSaving = true; + commonVr->gameSavingLoading = true; + commonVr->VR_GAME_PAUSED = true; if( commonLocal.SaveGame( savename ) ) { common->Printf( "Saved: %s\n", savename ); } - commonVr->gameSaving = false; + commonVr->gameSavingLoading = false; + commonVr->VR_GAME_PAUSED = false; } diff --git a/neo/framework/common_frame.cpp b/neo/framework/common_frame.cpp index 2f845161c..5dd28f4cb 100644 --- a/neo/framework/common_frame.cpp +++ b/neo/framework/common_frame.cpp @@ -301,7 +301,7 @@ void idCommonLocal::Draw() //koz fixme had playerdead here, can't remember why... but it was breaking the exit game selection in the pause menu, so //commented out, need to test all this crap again. - if ( (commonVr->PDAforced || commonVr->PDArising) ) //&& !commonVr->playerDead) // koz fixme do we only want to use the PDA model in VR? + if ( commonVr->PDAforced || commonVr->PDAforcetoggle ) //&& !commonVr->playerDead) // koz fixme do we only want to use the PDA model in VR? { game->Shell_Render(); //koz render the menu Dialog().Render( false ); @@ -318,10 +318,9 @@ void idCommonLocal::Draw() } // Koz begin - if ( !game->isVR || commonVr->playerDead || ( !commonVr->PDAforced && !commonVr->PDArising ) ) + if ( ( !game->isVR || commonVr->playerDead ) || ( !commonVr->PDAforced && !commonVr->PDAforcetoggle ) ) { game->Shell_Render(); //koz render any menus outside of game ( main menu etc ) - //if ( game->isVR ) commonVr->HMDTrackStatic(); // add headtracking to menus } //Koz end @@ -377,7 +376,7 @@ void idCommonLocal::Draw() } else { - if ( !commonVr->PDAforced && !commonVr->PDArising ) + if ( !commonVr->PDAforced && !commonVr->PDAforcetoggle ) { Dialog().Render( loadGUI != NULL ); if ( game->Shell_IsActive() ) console->Draw( false ); @@ -687,104 +686,74 @@ void idCommonLocal::Frame() // will be stopped just as if the g_stoptime cvar was set. bool ingame = false; - bool isVR = false; - static bool PDAopenedByPause = false; - + // warning: this may be the worst code written since the dawn of humanity. if ( game ) { ingame = game->IsInGame(); - - if ( game->isVR ) - { - if ( commonVr->wasSaved ) - { - if ( ( Sys_Milliseconds() - commonVr->lastSaveTime ) > 2000 ) - { - commonVr->wasSaved = false; - isVR = true; - } - else - { - isVR = false; - } - } - else - { - isVR = true; - } - } - } - if ( isVR ) - { + if ( game->isVR ) + { + static bool ing, shellact, vrpause, pauseG, forcet, pdaf, savlo, playerd, wasl = false; + + if ( playerd != commonVr->playerDead || wasl != commonVr->wasLoaded || ingame != ing || shellact != game->Shell_IsActive() || vrpause != commonVr->VR_GAME_PAUSED || pauseG != pauseGame || forcet != commonVr->PDAforcetoggle || pdaf != commonVr->PDAforced || savlo != commonVr->gameSavingLoading ) + { + ing = ingame; + shellact = game->Shell_IsActive(); + vrpause = commonVr->VR_GAME_PAUSED; + pauseG = pauseGame; + forcet = commonVr->PDAforcetoggle; + pdaf = commonVr->PDAforced; + savlo = commonVr->gameSavingLoading; + playerd = commonVr->playerDead; + wasl = commonVr->wasLoaded; + + common->Printf( "Pause diag: ingame = %d, VR_GAME_PAUSED = %d, pausegame = %d, game->isShellactive = %d playerdead = %d\n", ingame, commonVr->VR_GAME_PAUSED, pauseGame, game->Shell_IsActive(), commonVr->playerDead ); + common->Printf( "Pause diag: PDAforcetoggle = %d, PDAforced = %d, savingLoading = %d, wasloaded = %d\n", commonVr->PDAforcetoggle, commonVr->PDAforced, commonVr->gameSavingLoading, commonVr->wasLoaded ); + } - /* - if ( pauseGame ) + if ( ( commonVr->VR_GAME_PAUSED || commonVr->PDAforced ) && !common->Dialog().IsDialogActive() && !game->Shell_IsActive() ) { - common->Printf( "Pause diag: ingame = %d, VR_GAME_PAUSED = %d, pausegame = %d, game->ishellactive = %d\n", ingame, commonVr->VR_GAME_PAUSED, pauseGame, game->Shell_IsActive() ); - common->Printf( "Pause diag: PDAforcetoggle = %d, PDAforced = %d, PDA rising =%d\n", commonVr->PDAforcetoggle, commonVr->PDAforced, commonVr->PDArising ); + // the pda has been forced up, but there is no active shell or dialog. + // force everything closed. + common->Printf( "Pause 1 setting forcetoggle\n" ); + commonVr->PDAforcetoggle = true; // tell the pda check code to force it down. + commonVr->VR_GAME_PAUSED = false; } - */ - - if ( commonVr->VR_GAME_PAUSED ) // game is paused, check to exit + else if ( ( ingame && pauseGame && ( game->Shell_IsActive() /* || Dialog().IsDialogActive() */ ) ) && ( !commonVr->PDAforced && !commonVr->gameSavingLoading ) ) { - if ( ingame ) + if ( commonVr->playerDead && commonVr->wasLoaded ) { - if ( !pauseGame ) + game->Shell_Show( false ); + + if ( !game->Shell_IsActive() ) { - if ( !PDAopenedByPause ) - { - commonVr->VR_GAME_PAUSED = false; - commonVr->PDArising = false; - commonVr->PDAforced = false; - commonVr->PDAforcetoggle = false; //koz 11-20 - } - else if ( commonVr->PDAforced && !commonVr->PDArising ) - { - //common->Printf( "idCommonLocal::Frame() 1 setting PDAforceToggle true\n" ); - commonVr->PDAforcetoggle = true; - PDAopenedByPause = false; - commonVr->VR_GAME_PAUSED = false; - } + commonVr->playerDead = false; + commonVr->wasLoaded = false; + commonVr->PDAforced = false; + commonVr->PDAforcetoggle = false; + commonVr->VR_GAME_PAUSED = false; } } else { - commonVr->VR_GAME_PAUSED = false; - PDAopenedByPause = false; - commonVr->PDArising = false; - commonVr->PDAforced = false; - - } - } - else // game is not paused, see if we need to pause it - { - if ( pauseGame && ingame && !commonVr->gameSaving ) - { - if ( game->IsPDAOpen() && !PDAopenedByPause ) // the PDA was already opened, dont toggle it - { - commonVr->VR_GAME_PAUSED = true; - PDAopenedByPause = false; - commonVr->PDAforced = false; - commonVr->PDArising = false; - } - else if ( !commonVr->PDAforced && !commonVr->PDArising ) // force a PDA toggle; + if ( !commonVr->playerDead ) { - // koz debugcommon->Printf( "idCommonLocal::Frame() 2 setting PDAforceToggle true\n" ); + common->Printf( "Pause 2 setting forcetoggle\n" ); commonVr->PDAforcetoggle = true; - PDAopenedByPause = true; - } - else if ( commonVr->PDAforced ) // pda is up, pause the game. - { - commonVr->VR_GAME_PAUSED = true; - PDAopenedByPause = true; - commonVr->PDArising = false; } } + + } + else if ( ( ingame && pauseGame && ( game->Shell_IsActive() /* || Dialog().IsDialogActive() */ ) ) && ( commonVr->PDAforced && !commonVr->VR_GAME_PAUSED ) ) + { + commonVr->VR_GAME_PAUSED = true; } + + } + // Koz end if ( pauseGame && !ingame ) // koz added !ingame diff --git a/neo/renderer/OpenGL/gl_backend.cpp b/neo/renderer/OpenGL/gl_backend.cpp index 918324e42..e4f9bed47 100644 --- a/neo/renderer/OpenGL/gl_backend.cpp +++ b/neo/renderer/OpenGL/gl_backend.cpp @@ -428,7 +428,7 @@ void RB_StereoRenderExecuteBackEndCommands( const emptyCommand_t* const allCmds if ( game->isVR ) { - if ( commonVr->playerDead || (game->Shell_IsActive() && !commonVr->PDAforced && !commonVr->PDArising ) || (!commonVr->PDAforced && common->Dialog().IsDialogActive() ) ) + if ( commonVr->playerDead || (game->Shell_IsActive() && !commonVr->PDAforced && !commonVr->PDAforcetoggle ) || (!commonVr->PDAforced && common->Dialog().IsDialogActive() ) ) { commonVr->HMDTrackStatic(); diff --git a/neo/sound/OpenAL/AL_SoundHardware.cpp b/neo/sound/OpenAL/AL_SoundHardware.cpp index c7967fd30..40e324d52 100644 --- a/neo/sound/OpenAL/AL_SoundHardware.cpp +++ b/neo/sound/OpenAL/AL_SoundHardware.cpp @@ -39,7 +39,7 @@ idCVar s_device( "s_device", "-1", CVAR_INTEGER | CVAR_ARCHIVE, "Which audio dev idCVar s_showPerfData( "s_showPerfData", "0", CVAR_BOOL, "Show XAudio2 Performance data" ); extern idCVar s_volume_dB; -idCVar vr_forceOculusAudio( "vr_forceOculusAudio","0", CVAR_BOOL | CVAR_ARCHIVE, "Request openAL to open audio on Rift headphones instead of default device\n" ); +idCVar vr_forceOculusAudio( "vr_forceOculusAudio","1", CVAR_BOOL | CVAR_ARCHIVE, "Request openAL to open audio on Rift headphones instead of default device\n" ); /* ======================== idSoundHardware_OpenAL::idSoundHardware_OpenAL diff --git a/neo/sys/sys_session_savegames.cpp b/neo/sys/sys_session_savegames.cpp index a2d1733cc..45346cfb2 100644 --- a/neo/sys/sys_session_savegames.cpp +++ b/neo/sys/sys_session_savegames.cpp @@ -356,7 +356,7 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi { idSaveLoadParms& parms = processorLoadFiles->GetParmsNonConst(); saveGameHandle_t handle = 0; - + { // Put in a local block so everything will go in the global heap before the map change, but the heap is // automatically popped out on early return or exception @@ -434,7 +434,6 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi } common->OnLoadFilesCompleted( parms ); - return handle; } diff --git a/neo/sys/win32/win_input.cpp b/neo/sys/win32/win_input.cpp index a24fca268..4be93bd02 100644 --- a/neo/sys/win32/win_input.cpp +++ b/neo/sys/win32/win_input.cpp @@ -1169,7 +1169,7 @@ int idJoystickWin32::PollInputEvents( int inputDeviceNum ) { if ( (inputState.Buttons & ovrButton_A) != (oldInputState.Buttons & ovrButton_A) ) { - common->Printf( "Posting input event for r_touch_a val : %d\n", (inputState.Buttons & ovrButton_A) ); + //common->Printf( "Posting input event for r_touch_a val : %d\n", (inputState.Buttons & ovrButton_A) ); PostInputEvent( inputDeviceNum, J_ACTION24, (inputState.Buttons & ovrButton_A) ); } diff --git a/neo/vr/Vr.cpp b/neo/vr/Vr.cpp index 5add1527c..082ad06a8 100644 --- a/neo/vr/Vr.cpp +++ b/neo/vr/Vr.cpp @@ -170,6 +170,8 @@ idCVar vr_bodyToMove( "vr_bodyToMove", "1", CVAR_BOOL | CVAR_GAME | CVAR_ARCHIVE idCVar vr_crouchMode( "vr_crouchMode", "0", CVAR_INTEGER | CVAR_GAME | CVAR_ARCHIVE, "Crouch Mode:\n 0 = Full motion crouch (In game matches real life)\n 1 = Crouch anim triggered by smaller movement." ); idCVar vr_crouchTriggerDist( "vr_crouchTriggerDist", "10", CVAR_FLOAT | CVAR_ARCHIVE, " Distance ( in inches ) player must crouch in real life to toggle crouch\n" ); + +idCVar vr_frameCheck( "vr_frameCheck", "0", CVAR_INTEGER | CVAR_ARCHIVE, "0 = bypass frame check" ); // Koz end //=================================================================== @@ -208,11 +210,12 @@ iVr::iVr() PDAforcetoggle = false; PDAforced = false; PDArising = false; - gameSaving = false; + gameSavingLoading = false; forceLeftStick = true; // start the PDA in the left menu. pdaToggleTime = Sys_Milliseconds(); lastSaveTime = Sys_Milliseconds(); wasSaved = false; + wasLoaded = false; PDAclipModelSet = false; useFBO = false; @@ -230,7 +233,7 @@ iVr::iVr() hmdPositionTracked = false; - vrFrameNumber = 0; + lastPostFrame = 0; @@ -317,11 +320,7 @@ iVr::iVr() wipTotalDeltaAvg = 0.0f; hmdFrameTime = 0; - - frameStack[100] = { 0 }; - frameHead = 0; - frameTail = 0; - + lastRead = 0; currentRead = 0; updateScreen = false; @@ -816,7 +815,6 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV headPositionDelta = vec3_zero; bodyPositionDelta = vec3_zero; absolutePosition = vec3_zero; - common->Printf( "Bail no hmd\n" ); return; } @@ -828,7 +826,7 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV poseLastHmdAbsolutePosition = poseHmdAbsolutePosition; - if ( idLib::frameNumber == lastFrame ) //&& !commonVr->renderingSplash ) + if ( vr_frameCheck.GetInteger() == 1 && idLib::frameNumber == lastFrame ) //&& !commonVr->renderingSplash ) { //make sure to return the same values for this frame. hmdAngles.roll = lastRoll; diff --git a/neo/vr/Vr.h b/neo/vr/Vr.h index ce1f9f4f3..c04973e87 100644 --- a/neo/vr/Vr.h +++ b/neo/vr/Vr.h @@ -134,14 +134,14 @@ class iVr bool PDAforcetoggle; bool PDAforced; bool PDArising; - bool gameSaving; - + bool gameSavingLoading; + int swfRenderMode; bool PDAclipModelSet; int pdaToggleTime; int lastSaveTime; bool wasSaved; - + bool wasLoaded; bool forceLeftStick; @@ -149,22 +149,12 @@ class iVr bool handInGui; - bool vrIsBackgroundSaving; - - int vrFrameNumber; + int lastPostFrame; - - int frameStack[100]; - ovrPosef framePose[100]; - double sampleTime[100]; - int frameHead; - int frameTail; + int frameCount; - - - - int vrFrame; + double sensorSampleTime; ovrPosef EyeRenderPose[2]; @@ -281,7 +271,7 @@ class iVr float independentWeaponYaw; float independentWeaponPitch; - float playerDead; + bool playerDead; bool isLoading;