diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp
index a2b3392..f59128b 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp
@@ -4866,6 +4866,11 @@ void CG_Player(centity_t *cent ) {
vr->weaponid = WP_NONE;
}
+ if (cent->gent->client->ps.clientNum == 0) {
+ vr->velocitytriggered = (!cg.renderingThirdPerson &&
+ (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE));
+ }
+
//Get the player's light level for stealth calculations
CG_GetPlayerLightLevel( cent );
@@ -4886,9 +4891,6 @@ void CG_Player(centity_t *cent ) {
return;
}
- //Before we go any further, default this to false, it can be updated later
- vr->velocitytriggered = false;
-
if ( cent->currentState.vehicleModel != 0 )
{//Using an alternate (md3 for now) model
refEntity_t ent;
@@ -5218,7 +5220,6 @@ extern vmCvar_t cg_thirdPersonAlpha;
vec3_t angles;
BG_CalculateVRSaberPosition(cent->gent->client->renderInfo.muzzlePoint, angles);
AngleVectors( angles, cent->gent->client->renderInfo.muzzleDir, NULL, NULL );
- vr->velocitytriggered = true;
}
}
}
diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
index 13f4b12..4677a08 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
@@ -2838,8 +2838,8 @@ void CG_DrawItemSelector( void )
case 2: //fighting style
count = 3;
beam.shaderRGBA[0] = 0xff;
- beam.shaderRGBA[1] = 0x00;
- beam.shaderRGBA[2] = 0x00;
+ beam.shaderRGBA[1] = 0xff;
+ beam.shaderRGBA[2] = 0xff;
break;
case 3: // force powers
count = MAX_SHOWPOWERS;
diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/wp_thermal.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/wp_thermal.cpp
index 4eb3969..57e2b7d 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/game/wp_thermal.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/game/wp_thermal.cpp
@@ -28,6 +28,8 @@ along with this program; if not, see .
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
+#include
+#include
//---------------------
// Thermal Detonator
@@ -266,6 +268,10 @@ void WP_ThermalThink( gentity_t *ent )
}
}
+#define OLDEST_READING 5
+#define NEWEST_READING 2
+#define TD_REAL_THROW_VEL_MULT 4.4f
+
//---------------------------------------------------------
gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
//---------------------------------------------------------
@@ -274,11 +280,25 @@ gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
vec3_t dir, start;
float damageScale = 1.0f;
- if ( ent->client && !ent->NPC)
+ bolt = G_Spawn();
+
+ bool realThrow = false;
+ if ( ent->client && !ent->NPC && ent->client->ps.clientNum == 0)
{
vec3_t angs;
BG_CalculateVRWeaponPosition(start, angs);
- AngleVectors(angs, dir, NULL, NULL);
+
+ //Caclulate speed between two controller position readings
+ float distance = VectorDistance(vr->weaponoffset_history[NEWEST_READING], vr->weaponoffset_history[OLDEST_READING]);
+ float t = vr->weaponoffset_history_timestamp[NEWEST_READING] - vr->weaponoffset_history_timestamp[OLDEST_READING];
+ float velocity = distance / (t/(float)1000.0);
+
+ //Calculate trajectory
+ VectorSubtract(vr->weaponoffset_history[NEWEST_READING], vr->weaponoffset_history[OLDEST_READING], dir);
+ VectorNormalize( dir );
+ BG_ConvertFromVR(dir, NULL, dir);
+ VectorScale( dir, velocity * TD_REAL_THROW_VEL_MULT, bolt->s.pos.trDelta );
+ realThrow = true;
}
else {
VectorCopy( wpFwd, dir );
@@ -286,7 +306,6 @@ gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
}
- bolt = G_Spawn();
bolt->classname = "thermal_detonator";
@@ -345,11 +364,16 @@ gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
// normal ones bounce, alt ones explode on impact
bolt->s.pos.trType = TR_GRAVITY;
bolt->owner = ent;
- VectorScale( dir, TD_VELOCITY * chargeAmount, bolt->s.pos.trDelta );
+
+ if (!realThrow) {
+ VectorScale(dir, TD_VELOCITY * chargeAmount, bolt->s.pos.trDelta);
+ }
if ( ent->health > 0 )
{
- bolt->s.pos.trDelta[2] += 120;
+ if (!realThrow) {
+ bolt->s.pos.trDelta[2] += 120;
+ }
if ( ent->NPC && ent->enemy )
{//FIXME: we're assuming he's actually facing this direction...