From 1b22652e5cdcb4d981e4d0f9df464509830a0957 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 27 Mar 2023 21:38:46 +0100 Subject: [PATCH] Fixed aiming of bowcaster and demp alt fire --- .../jni/OpenJK/code/game/wp_bowcaster.cpp | 17 +++++++++++++---- .../Android/jni/OpenJK/code/game/wp_demp2.cpp | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/game/wp_bowcaster.cpp b/Projects/Android/jni/OpenJK/code/game/wp_bowcaster.cpp index 97b665f..6cea1eb 100644 --- a/Projects/Android/jni/OpenJK/code/game/wp_bowcaster.cpp +++ b/Projects/Android/jni/OpenJK/code/game/wp_bowcaster.cpp @@ -151,15 +151,24 @@ static void WP_BowcasterMainFire( gentity_t *ent ) static void WP_BowcasterAltFire( gentity_t *ent ) //--------------------------------------------------------- { - vec3_t start; + vec3_t start, forward, angs; int damage = weaponData[WP_BOWCASTER].altDamage; - VectorCopy( muzzle, start ); + if ( BG_UseVRPosition(ent)) + { + BG_CalculateVRWeaponPosition(start, angs); + AngleVectors(angs, forward, NULL, NULL); + } + else { + VectorCopy( muzzle, start ); + VectorCopy( forwardVec, forward ); + } + WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall - WP_MissileTargetHint(ent, start, forwardVec); + WP_MissileTargetHint(ent, start, forward); - gentity_t *missile = CreateMissile( start, forwardVec, BOWCASTER_VELOCITY, 10000, ent, qtrue ); + gentity_t *missile = CreateMissile( start, forward, BOWCASTER_VELOCITY, 10000, ent, qtrue ); missile->classname = "bowcaster_alt_proj"; missile->s.weapon = WP_BOWCASTER; diff --git a/Projects/Android/jni/OpenJK/code/game/wp_demp2.cpp b/Projects/Android/jni/OpenJK/code/game/wp_demp2.cpp index fbc42a1..4a593f1 100644 --- a/Projects/Android/jni/OpenJK/code/game/wp_demp2.cpp +++ b/Projects/Android/jni/OpenJK/code/game/wp_demp2.cpp @@ -210,10 +210,19 @@ static void WP_DEMP2_AltFire( gentity_t *ent ) { int damage = weaponData[WP_REPEATER].altDamage; int count; - vec3_t start; + vec3_t start, angs, forward; trace_t tr; - VectorCopy( muzzle, start ); + if ( BG_UseVRPosition(ent)) + { + BG_CalculateVRWeaponPosition(start, angs); + AngleVectors(angs, forward, NULL, NULL); + } + else { + VectorCopy( muzzle, start ); + VectorCopy(forwardVec, forward); + } + WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall count = ( level.time - ent->client->ps.weaponChargeTime ) / DEMP2_CHARGE_UNIT; @@ -230,8 +239,8 @@ static void WP_DEMP2_AltFire( gentity_t *ent ) damage *= ( 1 + ( count * ( count - 1 )));// yields damage of 12,36,84...gives a higher bonus for longer charge // the shot can travel a whopping 4096 units in 1 second. Note that the shot will auto-detonate at 4096 units...we'll see if this looks cool or not - WP_MissileTargetHint(ent, start, forwardVec); - gentity_t *missile = CreateMissile( start, forwardVec, DEMP2_ALT_RANGE, 1000, ent, qtrue ); + WP_MissileTargetHint(ent, start, forward); + gentity_t *missile = CreateMissile( start, forward, DEMP2_ALT_RANGE, 1000, ent, qtrue ); // letting it know what the charge size is. missile->count = count;