diff --git a/Projects/Android/jni/JKVR/VrClientInfo.h b/Projects/Android/jni/JKVR/VrClientInfo.h
index b76e76b..d2acf9c 100644
--- a/Projects/Android/jni/JKVR/VrClientInfo.h
+++ b/Projects/Android/jni/JKVR/VrClientInfo.h
@@ -14,6 +14,7 @@ typedef struct {
int weaponid;
int lastweaponid;
bool mountedgun;
+ int cgzoommode;
vec3_t hmdposition;
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!
diff --git a/Projects/Android/jni/JKVR/VrInputDefault.cpp b/Projects/Android/jni/JKVR/VrInputDefault.cpp
index daa32e4..a9409fd 100644
--- a/Projects/Android/jni/JKVR/VrInputDefault.cpp
+++ b/Projects/Android/jni/JKVR/VrInputDefault.cpp
@@ -224,6 +224,31 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
}
}
+ if (vr.cgzoommode > 1)
+ {
+ if (between(-0.2f, primaryJoystickX, 0.2f)) {
+ sendButtonAction("+attack", between(0.8f, pPrimaryJoystick->y, 1.0f));
+ sendButtonAction("+altattack", between(-1.0f, pPrimaryJoystick->y, -0.8f));
+ }
+ } else if (vr.weaponid == WP_SABER)
+ {
+ static bool switched = false;
+ if (between(-0.2f, primaryJoystickX, 0.2f) &&
+ (between(0.8f, pPrimaryJoystick->y, 1.0f) ||
+ between(-1.0f, pPrimaryJoystick->y, -0.8f))) {
+ if (!switched) {
+ if (between(0.8f, pPrimaryJoystick->y, 1.0f)) {
+ sendButtonActionSimple("cg_thirdPerson 1");
+ } else {
+ sendButtonActionSimple("cg_thirdPerson 0");
+ }
+ switched = true;
+ }
+ } else {
+ switched = false;
+ }
+ }
+
vr.weapon_stabilised = stabilised;
//if (!vr.item_selector)
@@ -244,13 +269,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
}
}
- //ALOGV("**GB WEAPON ACTIVE** %i",vr.weaponid);
- if (!scopeready && vr.weaponid >= 15 && vr.weaponid <= 17) {
- lastScopeReady = false;
- ALOGV("**WEAPON EVENT** disable scope mode forced");
- sendButtonActionSimple("weapalt");
- }
-
//Engage scope / virtual stock (iron sight lock) if conditions are right
static bool scopeEngaged = qfalse;
if (scopeEngaged != vr.scopeengaged) {
@@ -468,14 +486,14 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
// Uncomment to debug offhand reaching
- ALOGV("Quick Save> Dist: %f | OffHandToDownAngle: %f | HandOffs: %f %f %f\nHmdHandDot: %f | HmdFwdXY: %f %f | WpnFwdXY: %f %f\nTrackOk: %i, DistOk: %i, HeightOk: %i, HnadAngleOk: %i, HmdHandDotOk: %i",
+/* ALOGV("Quick Save> Dist: %f | OffHandToDownAngle: %f | HandOffs: %f %f %f\nHmdHandDot: %f | HmdFwdXY: %f %f | WpnFwdXY: %f %f\nTrackOk: %i, DistOk: %i, HeightOk: %i, HnadAngleOk: %i, HmdHandDotOk: %i",
distanceToHMDOff, offhandToDownAngle, vr.offhandoffset[0],
vr.offhandoffset[1], vr.offhandoffset[2],
hmdToOffhandDotProduct, hmdForwardXY[0], hmdForwardXY[1], offhandForwardXY[0],
offhandForwardXY[1],
bpTrackOk, bpOffhandDistToHMDOk, bpOffhandHeightOk, bpOffhandAngleOk,
bpHmdToOffhandAngleOk);
-
+*/
// Check quicksave
if (canUseQuickSave) {
@@ -529,7 +547,13 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
//Alt Fire (B Button)
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2)) {
- sendButtonAction("+altattack", (primaryButtonsNew & primaryButton2));
+ if (vr.cgzoommode > 0)
+ {
+ sendButtonActionSimple("invuse");
+ }
+ else {
+ sendButtonAction("+altattack", (primaryButtonsNew & primaryButton2));
+ }
}
diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp
index e1daca6..8f50936 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp
@@ -26,6 +26,7 @@ along with this program; if not, see .
#include "cg_local.h"
#include "cg_media.h" //just for cgs....
+#include
void CG_TargetCommand_f( void );
extern qboolean player_locked;
@@ -140,6 +141,8 @@ void CG_ToggleBinoculars( void )
cg.zoomTime = cg.time;
cgi_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.zoomEnd );
}
+
+ vr->cgzoommode = cg.zoomMode;
}
void CG_ToggleLAGoggles( void )
@@ -182,6 +185,8 @@ void CG_ToggleLAGoggles( void )
cg.zoomTime = cg.time;
cgi_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.zoomEnd );
}
+
+ vr->cgzoommode = cg.zoomMode;
}
void CG_LoadHud_f( void)
diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp
index 560fce5..4aa9c44 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp
@@ -2032,7 +2032,7 @@ wasForceSpeed=isForceSpeed;
}
handEnt.renderfx = RF_DEPTHHACK;
- handEnt.hModel = cgi_R_RegisterModel( "models/weapons2/thermal/thermal_hand.md3" );
+ handEnt.hModel = cgi_R_RegisterModel( "models/hands/left_hand_relaxed.md3" );
VectorCopy(handEnt.origin, handEnt.oldorigin);
AnglesToAxis(handEnt.angles, handEnt.axis);
cgi_R_AddRefEntityToScene(&handEnt);
diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
index 5d7852a..cb2be7a 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp
@@ -2804,6 +2804,7 @@ void CG_DrawItemSelector( void )
break;
}
+#ifdef _DEMO
if (itemId == WP_SABER ||
itemId == WP_BRYAR_PISTOL ||
itemId == WP_BLASTER ||
@@ -2814,6 +2815,9 @@ void CG_DrawItemSelector( void )
} else {
continue;
}
+#else
+ CG_RegisterWeapon(itemId);
+#endif
}
{
diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_items.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_items.cpp
index 07877b3..5c424d5 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/game/g_items.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_items.cpp
@@ -890,7 +890,7 @@ void FinishSpawningItem( gentity_t *ent ) {
{
gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)\n", ent->classname, vtos(ent->s.origin) );
}
- assert( 0 && "item starting in solid");
+ //assert( 0 && "item starting in solid");
#ifndef FINAL_BUILD
if (!g_entities[ENTITYNUM_WORLD].s.radius){ //not a region
delayedShutDown = level.time + 100;
diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/wp_saber.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/wp_saber.cpp
index 74046de..aa97253 100644
--- a/Projects/Android/jni/OpenJK/codeJK2/game/wp_saber.cpp
+++ b/Projects/Android/jni/OpenJK/codeJK2/game/wp_saber.cpp
@@ -6741,7 +6741,17 @@ void ForceTelepathy( gentity_t *self )
return;
}
- AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
+ vec3_t origin, angles;
+ if (self->client->ps.clientNum == 0)
+ {
+ BG_CalculateVROffHandPosition(origin, angles);
+ AngleVectors(angles, forward, NULL, NULL);
+ }
+ else
+ {
+ AngleVectors(self->client->ps.viewangles, forward, NULL, NULL);
+ VectorCopy(self->client->ps.viewangles, angles);
+ }
VectorNormalize( forward );
VectorMA( self->client->renderInfo.eyePoint, 2048, forward, end );
@@ -6954,20 +6964,21 @@ void ForceGrip( gentity_t *self )
self->client->ps.weaponTime = floor( self->client->ps.weaponTime * g_timescale->value );
}
+ vec3_t origin, angles;
if (self->client->ps.clientNum == 0)
{
- vec3_t origin, angles;
BG_CalculateVROffHandPosition(origin, angles);
AngleVectors(angles, forward, NULL, NULL);
}
else
{
AngleVectors(self->client->ps.viewangles, forward, NULL, NULL);
+ VectorCopy(self->client->ps.viewangles, angles);
}
VectorNormalize( forward );
VectorMA( self->client->renderInfo.handLPoint, FORCE_GRIP_DIST, forward, end );
- if ( self->enemy && (self->s.number || InFront( self->enemy->currentOrigin, self->client->renderInfo.eyePoint, self->client->ps.viewangles, 0.2f ) ) )
+ if ( self->enemy && (self->s.number || InFront( self->enemy->currentOrigin, self->client->renderInfo.eyePoint, angles, 0.2f ) ) )
{//NPCs can always lift enemy since we assume they're looking at them, players need to be facing the enemy
if ( gi.inPVS( self->enemy->currentOrigin, self->client->renderInfo.eyePoint ) )
{//must be in PVS
@@ -8131,7 +8142,16 @@ static void WP_ForcePowerRun( gentity_t *self, forcePowers_t forcePower, usercmd
NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEGRIP_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
}
//get their org
- VectorCopy( self->client->ps.viewangles, angles );
+ if (self->client->ps.clientNum == 0)
+ {
+ vec3_t origin;
+ BG_CalculateVROffHandPosition(origin, angles);
+ }
+ else
+ {
+ VectorCopy( self->client->ps.viewangles, angles );
+ }
+
angles[0] -= 10;
AngleVectors( angles, dir, NULL, NULL );
if ( gripEnt->client )
@@ -8146,7 +8166,7 @@ static void WP_ForcePowerRun( gentity_t *self, forcePowers_t forcePower, usercmd
//how far are they
dist = Distance( self->client->renderInfo.handLPoint, gripEntOrg );
if ( self->client->ps.forcePowerLevel[FP_GRIP] == FORCE_LEVEL_2 &&
- (!InFront( gripEntOrg, self->client->renderInfo.handLPoint, self->client->ps.viewangles, 0.3f ) ||
+ (!InFront( gripEntOrg, self->client->renderInfo.handLPoint, angles, 0.3f ) ||
DistanceSquared( gripEntOrg, self->client->renderInfo.handLPoint ) > FORCE_GRIP_DIST_SQUARED))
{//must face them
WP_ForcePowerStop( self, FP_GRIP );
diff --git a/assets/z_npc_vr.pk3 b/assets/z_npc_vr.pk3
deleted file mode 100644
index d90091b..0000000
Binary files a/assets/z_npc_vr.pk3 and /dev/null differ
diff --git a/assets/z_vr_assets.pk3 b/assets/z_vr_assets.pk3
new file mode 100644
index 0000000..2320481
Binary files /dev/null and b/assets/z_vr_assets.pk3 differ
diff --git a/java/com/drbeef/jkquest/GLES3JNIActivity.java b/java/com/drbeef/jkquest/GLES3JNIActivity.java
index b41ccaa..4e66611 100644
--- a/java/com/drbeef/jkquest/GLES3JNIActivity.java
+++ b/java/com/drbeef/jkquest/GLES3JNIActivity.java
@@ -189,8 +189,8 @@ import static android.system.Os.setenv;
copy_asset("/sdcard/JKQuest/Demo/base", "UltimateSounds_JK2.pk3", false);
copy_asset("/sdcard/JKQuest/Demo/base", "z_bryar_ashura.pk3", false);
- //Bummser's NPC tweaks
- copy_asset("/sdcard/JKQuest/Demo/base", "z_npc_vr.pk3", false);
+ //Our assets
+ copy_asset("/sdcard/JKQuest/JK2/base", "z_vr_assets.pk3", true);
commandLineParams = "jo";