mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 13:31:03 +00:00
Added placeholder hand model
- made sure other force powers originate from off-hand - switch 1st/3rd person using right stick when using saber - if goggles equipped, then you can zoom in and out using right stick, and exit with B button
This commit is contained in:
parent
0c9d6d3e86
commit
f73fbfa451
10 changed files with 73 additions and 19 deletions
|
@ -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!
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include "cg_local.h"
|
||||
#include "cg_media.h" //just for cgs....
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
Binary file not shown.
BIN
assets/z_vr_assets.pk3
Normal file
BIN
assets/z_vr_assets.pk3
Normal file
Binary file not shown.
|
@ -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";
|
||||
|
||||
|
|
Loading…
Reference in a new issue