From b4596caab921cc5f49ce1ac2da7f5bda515e50a0 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 12 Jul 2023 16:33:15 +0100 Subject: [PATCH] Don't trigger haptics when blade hits solid if saber is in flight --- .../jni/OpenJK/code/cgame/cg_players.cpp | 22 ++++++++++++------- .../jni/OpenJK/codeJK2/cgame/cg_players.cpp | 14 ++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp index d859feb..8dee997 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_players.cpp @@ -6504,10 +6504,13 @@ Ghoul2 Insert End { if ( !noMarks ) { - 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 ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) ) @@ -6534,10 +6537,13 @@ Ghoul2 Insert End { if ( !noMarks ) { - 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) ) || ( WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS2) ) ) diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp index 3e47e78..b02e78f 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp @@ -4588,8 +4588,11 @@ Ghoul2 Insert End { if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) ) { - 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); + } /* if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) ) @@ -4610,8 +4613,11 @@ Ghoul2 Insert End } else { - 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 ); // All I need is a bool to mark whether I have a previous point to work with.