From beb5a6d7c672bc3c7060554e63f1503b6cd244fe Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 22 May 2023 21:28:54 +0100 Subject: [PATCH] Small tweaks to the melee --- Projects/Android/jni/JKXR/VrInputDefault.cpp | 1 + Projects/Android/jni/OpenJK/code/game/g_weapon.cpp | 5 +++-- Projects/Android/jni/OpenJK/code/game/w_local.h | 2 +- Projects/Android/jni/OpenJK/code/game/wp_melee.cpp | 6 +++--- Projects/Android/jni/OpenJK/codeJK2/game/g_weapon.cpp | 2 +- Projects/Android/jni/OpenJK/codeJK2/game/w_local.h | 2 +- Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp | 6 +++--- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index e05fa14..5c249b9 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -956,6 +956,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, //process force motion controls here if (vr_force_motion_controlled->integer && + cl.frame.ps.weapon != WP_MELEE && !vr.weapon_stabilised && // If dual sabers we can't really use motion control force as the off hand could be swinging for an attack !vr.dualsabers) diff --git a/Projects/Android/jni/OpenJK/code/game/g_weapon.cpp b/Projects/Android/jni/OpenJK/code/game/g_weapon.cpp index a5979e7..1c04f69 100644 --- a/Projects/Android/jni/OpenJK/code/game/g_weapon.cpp +++ b/Projects/Android/jni/OpenJK/code/game/g_weapon.cpp @@ -1405,7 +1405,8 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire ) } else { - WP_Melee( ent ); + //Pass true so we know this is actually melee from a tusken rifle + WP_Melee( ent, qtrue ); } break; @@ -1465,7 +1466,7 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire ) alert = 0; // if you want it to alert enemies, remove this if ( !alt_fire || !g_debugMelee->integer ) { - WP_Melee( ent ); + WP_Melee( ent, qfalse ); } break; diff --git a/Projects/Android/jni/OpenJK/code/game/w_local.h b/Projects/Android/jni/OpenJK/code/game/w_local.h index 5f6ce51..c57140a 100644 --- a/Projects/Android/jni/OpenJK/code/game/w_local.h +++ b/Projects/Android/jni/OpenJK/code/game/w_local.h @@ -67,7 +67,7 @@ void WP_EmplacedFire( gentity_t *ent ); void prox_mine_think( gentity_t *ent ); void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace ); void WP_FireFlechette( gentity_t *ent, qboolean alt_fire ); -void WP_Melee( gentity_t *ent ); +void WP_Melee( gentity_t *ent, qboolean alt_fire ); void WP_FireNoghriStick( gentity_t *ent ); void WP_FireRepeater( gentity_t *ent, qboolean alt_fire ); void rocketThink( gentity_t *ent ); diff --git a/Projects/Android/jni/OpenJK/code/game/wp_melee.cpp b/Projects/Android/jni/OpenJK/code/game/wp_melee.cpp index 1dbd794..05a3d5d 100644 --- a/Projects/Android/jni/OpenJK/code/game/wp_melee.cpp +++ b/Projects/Android/jni/OpenJK/code/game/wp_melee.cpp @@ -26,13 +26,13 @@ along with this program; if not, see . #include "wp_saber.h" #include "w_local.h" -void WP_Melee( gentity_t *ent ) +void WP_Melee( gentity_t *ent, qboolean alt_fire ) //--------------------------------------------------------- { gentity_t *tr_ent; trace_t tr; vec3_t mins, maxs, end; - int damage = ent->s.number ? (g_spskill->integer*2)+1 : 25; + int damage = ent->s.number ? (g_spskill->integer*2)+1 : (alt_fire ? 3 : 20); float range = ent->s.number ? 64 : 32; VectorMA( muzzle, range, forwardVec, end ); @@ -67,7 +67,7 @@ void WP_Melee( gentity_t *ent ) if ( tr_ent && tr_ent->takedamage ) { - int dflags = DAMAGE_NO_KNOCKBACK; + int dflags = (ent->s.number || alt_fire) ? DAMAGE_NO_KNOCKBACK : DAMAGE_DEATH_KNOCKBACK; G_PlayEffect( G_EffectIndex( "melee/punch_impact" ), tr.endpos, forwardVec ); //G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) ); if ( ent->NPC && (ent->NPC->aiFlags&NPCAI_HEAVY_MELEE) ) diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_weapon.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_weapon.cpp index 4fb25bb..006acba 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_weapon.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_weapon.cpp @@ -636,7 +636,7 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire ) case WP_MELEE: alert = 0; // if you want it to alert enemies, remove this - WP_Melee( ent ); + WP_Melee( ent, qfalse ); break; case WP_ATST_MAIN: diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/w_local.h b/Projects/Android/jni/OpenJK/codeJK2/game/w_local.h index 5fd05a1..f586706 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/w_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/game/w_local.h @@ -61,7 +61,7 @@ void WP_EmplacedFire( gentity_t *ent ); void WP_FireFlechette( gentity_t *ent, qboolean alt_fire ); void prox_mine_stick( gentity_t *self, gentity_t *other, trace_t *trace ); void prox_mine_think( gentity_t *ent ); -void WP_Melee( gentity_t *ent ); +void WP_Melee( gentity_t *ent, qboolean alt_fire ); void WP_FireRepeater( gentity_t *ent, qboolean alt_fire ); void rocketThink( gentity_t *ent ); void WP_FireRocket( gentity_t *ent, qboolean alt_fire ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp index 68646ea..c65c64e 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp @@ -30,13 +30,13 @@ along with this program; if not, see . // Temp melee attack damage routine //--------------------------------------------------------- -void WP_Melee( gentity_t *ent ) +void WP_Melee( gentity_t *ent, qboolean alt_fire ) //--------------------------------------------------------- { gentity_t *tr_ent; trace_t tr; vec3_t mins, maxs, end; - int damage = ent->s.number ? (g_spskill->integer*2)+1 : 25; + int damage = ent->s.number ? (g_spskill->integer*2)+1 : 20; float range = ent->s.number ? 64 : 32; VectorMA( wpMuzzle, range, wpFwd, end ); @@ -68,6 +68,6 @@ void WP_Melee( gentity_t *ent ) if ( tr_ent && tr_ent->takedamage ) { G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) ); - G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); + G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, damage, DAMAGE_DEATH_KNOCKBACK, MOD_MELEE ); } } \ No newline at end of file