diff --git a/Projects/Android/jni/OpenJK/JKXR/windows/JKXR_SurfaceView.cpp b/Projects/Android/jni/OpenJK/JKXR/windows/JKXR_SurfaceView.cpp index 732f1a1..04c23d0 100644 --- a/Projects/Android/jni/OpenJK/JKXR/windows/JKXR_SurfaceView.cpp +++ b/Projects/Android/jni/OpenJK/JKXR/windows/JKXR_SurfaceView.cpp @@ -56,7 +56,7 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll) //Keep this for our records VectorCopy(vr.hmdorientation, vr.hmdorientation_last); - if (!vr.third_person && !vr.remote_npc && !vr.remote_turret + if (!vr.third_person && !vr.remote_npc && !vr.remote_turret && !vr.cgzoommode #ifndef JK2_MODE && !vr.in_vehicle #endif @@ -65,7 +65,7 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll) VectorCopy(vr.hmdorientation, vr.hmdorientation_first); } - if (!vr.remote_turret) + if (!vr.remote_turret && !vr.cgzoommode) { VectorCopy(vr.weaponangles[ANGLES_ADJUSTED], vr.weaponangles_first[ANGLES_ADJUSTED]); } @@ -143,7 +143,8 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side *up = 0.0f; *side = remote_movementSideways / 3.0f; *pos_side = 0.0f; - *yaw = vr.snapTurn; + *yaw = vr.snapTurn + vr.hmdorientation_first[YAW] + + vr.weaponangles[ANGLES_ADJUSTED][YAW] - vr.weaponangles_first[ANGLES_ADJUSTED][YAW]; *pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH]; *roll = 0.0f;//vr.hmdorientation[ROLL]; } @@ -241,7 +242,7 @@ void VR_Init() vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE); vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE); vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE); - vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-20.0", CVAR_ARCHIVE); + vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE); vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE); //Defaults diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp index fcf4d1f..26f6bd6 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp @@ -368,6 +368,7 @@ static void CG_RegisterCustomSounds(clientInfo_t *ci, int iSoundEntryBase, //SB: Never render any player model if 1st person and using the saber bool CG_getPlayer1stPersonSaber(const centity_t *cent) { return (!cent->gent->NPC && !cg.renderingThirdPerson && + cent->gent->client->ps.clientNum == 0 && cent->gent->client->ps.weapon == WP_SABER); } @@ -6507,12 +6508,15 @@ Ghoul2 Insert End { if ( !noMarks ) { - if (saberNum == 1 || !cent->gent->client->ps.saberInFlight) + if (CG_getPlayer1stPersonSaber(cent)) { - int position = (vr->right_handed ? - ((saberNum == 0) ? 2 : 1) : - ((saberNum == 0) ? 1 : 2)); - cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + if (saberNum == 1 || !cent->gent->client->ps.saberInFlight) + { + int position = (vr->right_handed ? + ((saberNum == 0) ? 2 : 1) : + ((saberNum == 0) ? 1 : 2)); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + } } /* @@ -6540,12 +6544,15 @@ Ghoul2 Insert End { if ( !noMarks ) { - if (saberNum == 1 || !cent->gent->client->ps.saberInFlight) + if (CG_getPlayer1stPersonSaber(cent)) { - int position = (vr->right_handed ? - ((saberNum == 0) ? 2 : 1) : - ((saberNum == 0) ? 1 : 2)); - cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + if (saberNum == 1 || !cent->gent->client->ps.saberInFlight) + { + int position = (vr->right_handed ? + ((saberNum == 0) ? 2 : 1) : + ((saberNum == 0) ? 1 : 2)); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + } } if ( ( !WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) ) diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_view.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_view.cpp index d37e758..c2a36fa 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_view.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_view.cpp @@ -2261,8 +2261,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) { { cg.refdef.viewangles[ROLL] = vr->hmdorientation[ROLL]; cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH]; - cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] - + vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]); + cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]); AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis); } diff --git a/Projects/Android/jni/OpenJK/code/game/bg_misc.cpp b/Projects/Android/jni/OpenJK/code/game/bg_misc.cpp index 1929f23..df70a55 100644 --- a/Projects/Android/jni/OpenJK/code/game/bg_misc.cpp +++ b/Projects/Android/jni/OpenJK/code/game/bg_misc.cpp @@ -725,7 +725,7 @@ float getHMDYawForCalc() return vr->hmdorientation[YAW]; } - return 0.0f; + return vr->weaponangles[ANGLES_ADJUSTED][YAW]; } void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out) diff --git a/Projects/Android/jni/OpenJK/code/game/g_active.cpp b/Projects/Android/jni/OpenJK/code/game/g_active.cpp index 523ec70..54d30fa 100644 --- a/Projects/Android/jni/OpenJK/code/game/g_active.cpp +++ b/Projects/Android/jni/OpenJK/code/game/g_active.cpp @@ -4970,12 +4970,13 @@ extern cvar_t *g_skippingcin; // ucmd->angles[PITCH] = 0; // } - if ( cg.zoomMode == 2 ) + //Allow movement when zoomed +/* if (cg.zoomMode == 2) { // Any kind of movement when the player is NOT ducked when the disruptor gun is zoomed will cause us to auto-magically un-zoom if ( ( (ucmd->forwardmove||ucmd->rightmove) && ucmd->upmove >= 0 //crouching-moving is ok - && !(ucmd->buttons&BUTTON_USE)/*leaning is ok*/ + && !(ucmd->buttons&BUTTON_USE)//leaning is ok ) || ucmd->upmove > 0 //jumping not allowed ) @@ -4986,7 +4987,8 @@ extern cvar_t *g_skippingcin; cg.zoomTime = cg.time; cg.zoomLocked = qfalse; } - } + }*/ + if ( (player_locked || (ent->client->ps.eFlags&EF_FORCE_GRIPPED) diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp index 80aea05..e3e96ec 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp @@ -3074,8 +3074,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) { { cg.refdef.viewangles[ROLL] = vr->hmdorientation[ROLL]; cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH]; - cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] - + vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]); + cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]); AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis); } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp index 6fe7fc1..73541ba 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp @@ -4588,10 +4588,13 @@ Ghoul2 Insert End { if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) ) { - if (!cent->gent->client->ps.saberInFlight) + if (cent->gent->client->ps.clientNum == 0) { - int position = (vr->right_handed ? 2 : 1); - cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + if (!cent->gent->client->ps.saberInFlight) + { + int position = (vr->right_handed ? 2 : 1); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + } } /* @@ -4613,10 +4616,13 @@ Ghoul2 Insert End } else { - if (!cent->gent->client->ps.saberInFlight) + if (cent->gent->client->ps.clientNum == 0) { - int position = (vr->right_handed ? 2 : 1); - cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + if (!cent->gent->client->ps.saberInFlight) + { + int position = (vr->right_handed ? 2 : 1); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + } } theFxScheduler.PlayEffect( "spark", trace.endpos, trace.plane.normal ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/bg_misc.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/bg_misc.cpp index 9106970..525d9ad 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/bg_misc.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/bg_misc.cpp @@ -658,7 +658,8 @@ float getHMDYawForCalc() if (!vr->third_person && vr->cgzoommode != 2 && vr->cgzoommode != 4 ) { return vr->hmdorientation[YAW]; } - return 0.0f; + + return vr->weaponangles[ANGLES_ADJUSTED][YAW]; } void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out) diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_active.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_active.cpp index a67dc85..36fa13d 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_active.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_active.cpp @@ -2248,12 +2248,13 @@ extern cvar_t *g_skippingcin; // ucmd->angles[PITCH] = 0; // } - if ( cg.zoomMode == 2 ) + //Allow movement when zoomed +/* if ( cg.zoomMode == 2 ) { // Any kind of movement when the player is NOT ducked when the disruptor gun is zoomed will cause us to auto-magically un-zoom if ( ( (ucmd->forwardmove||ucmd->rightmove) && ucmd->upmove >= 0 //crouching-moving is ok - && !(ucmd->buttons&BUTTON_USE)/*leaning is ok*/ + && !(ucmd->buttons&BUTTON_USE)//leaning is ok ) || ucmd->upmove > 0 //jumping not allowed ) @@ -2265,7 +2266,7 @@ extern cvar_t *g_skippingcin; cg.zoomLocked = qfalse; } } - +*/ if ( (player_locked || (ent->client->ps.eFlags&EF_FORCE_GRIPPED)) && ent->client->ps.pm_type < PM_DEAD ) // unless dead {//lock out player control if ( !player_locked )