diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 8b0772c..9c91551 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="59" + android:versionName="1.1.7" android:installLocation="auto" > diff --git a/Projects/Android/jni/JKXR/JKXR_SurfaceView.cpp b/Projects/Android/jni/JKXR/JKXR_SurfaceView.cpp index 978f714..5b42010 100644 --- a/Projects/Android/jni/JKXR/JKXR_SurfaceView.cpp +++ b/Projects/Android/jni/JKXR/JKXR_SurfaceView.cpp @@ -302,6 +302,9 @@ void VR_Init() vr_force_distance_trigger = Cvar_Get( "vr_force_distance_trigger", "0.15", CVAR_ARCHIVE); vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE); vr_force_motion_controlled = Cvar_Get ("vr_force_motion_controlled", "1", CVAR_ARCHIVE); + vr_force_motion_push = Cvar_Get ("vr_force_motion_push", "3", CVAR_ARCHIVE); + vr_force_motion_pull = Cvar_Get ("vr_force_motion_pull", "4", CVAR_ARCHIVE); + vr_motion_enable_saber = Cvar_Get ("vr_motion_enable_saber", "0", CVAR_ARCHIVE); vr_crouch_toggle = Cvar_Get ("vr_crouch_toggle", "0", CVAR_ARCHIVE); vr_irl_crouch_enabled = Cvar_Get ("vr_irl_crouch_enabled", "0", CVAR_ARCHIVE); vr_irl_crouch_to_stand_ratio = Cvar_Get ("vr_irl_crouch_to_stand_ratio", "0.65", CVAR_ARCHIVE); @@ -529,8 +532,8 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f } else if (strcmp(event, "chainsaw_fire") == 0) // Saber { - //Special handling for dual sabers - if (vr.dualsabers) + //Special handling for dual sabers / melee + if (vr.dualsabers || cl.frame.ps.weapon == WP_MELEE) { if (position == 4 || position == 0) // both hands diff --git a/Projects/Android/jni/JKXR/VrClientInfo.h b/Projects/Android/jni/JKXR/VrClientInfo.h index 3185adf..bb1716f 100644 --- a/Projects/Android/jni/JKXR/VrClientInfo.h +++ b/Projects/Android/jni/JKXR/VrClientInfo.h @@ -90,6 +90,7 @@ typedef struct { int item_selector; // 1 - weapons/gadgets/saber stance, 2 - Force powers bool velocitytriggered; + bool velocitytriggeractive; float primaryswingvelocity; bool primaryVelocityTriggeredAttack; float secondaryswingvelocity; diff --git a/Projects/Android/jni/JKXR/VrCvars.h b/Projects/Android/jni/JKXR/VrCvars.h index ba88ce4..2c34dc6 100644 --- a/Projects/Android/jni/JKXR/VrCvars.h +++ b/Projects/Android/jni/JKXR/VrCvars.h @@ -13,6 +13,9 @@ extern cvar_t *vr_force_velocity_trigger; extern cvar_t *vr_force_distance_trigger; extern cvar_t *vr_two_handed_weapons; extern cvar_t *vr_force_motion_controlled; +extern cvar_t *vr_force_motion_push; +extern cvar_t *vr_force_motion_pull; +extern cvar_t *vr_motion_enable_saber; extern cvar_t *vr_crouch_toggle; extern cvar_t *vr_irl_crouch_enabled; extern cvar_t *vr_irl_crouch_to_stand_ratio; diff --git a/Projects/Android/jni/JKXR/VrInputCommon.cpp b/Projects/Android/jni/JKXR/VrInputCommon.cpp index 00264f1..86cefe0 100644 --- a/Projects/Android/jni/JKXR/VrInputCommon.cpp +++ b/Projects/Android/jni/JKXR/VrInputCommon.cpp @@ -26,6 +26,9 @@ cvar_t *vr_force_velocity_trigger; cvar_t *vr_force_distance_trigger; cvar_t *vr_two_handed_weapons; cvar_t *vr_force_motion_controlled; +cvar_t *vr_force_motion_push; +cvar_t *vr_force_motion_pull; +cvar_t *vr_motion_enable_saber; cvar_t *vr_crouch_toggle; cvar_t *vr_irl_crouch_enabled; cvar_t *vr_irl_crouch_to_stand_ratio; diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index d194091..bf23835 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -499,7 +499,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, if (vr.velocitytriggered) { static bool fired = false; vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity > - vr_weapon_velocity_trigger->value); + (vr_weapon_velocity_trigger->value / 2.0f)); if (fired != vr.primaryVelocityTriggeredAttack) { ALOGV("**WEAPON EVENT** veocity triggered %s", @@ -518,7 +518,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, if (vr.velocitytriggered) { static bool fired = false; vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity > - vr_weapon_velocity_trigger->value); + (vr_weapon_velocity_trigger->value / 2.0f)); if (fired != vr.secondaryVelocityTriggeredAttack) { ALOGV("**WEAPON EVENT** veocity triggered %s", @@ -537,26 +537,33 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, cl.frame.ps.weapon == WP_STUN_BATON) { //Does weapon velocity trigger attack if (vr.velocitytriggered) { - static bool fired = false; + if (vr.velocitytriggeractive) + { + static bool fired = false; - float velocityRequired = (cl.frame.ps.weapon == WP_SABER) ? vr_weapon_velocity_trigger->value : - (vr_weapon_velocity_trigger->value / 2.0f); + float velocityRequired = (cl.frame.ps.weapon == WP_SABER) + ? vr_weapon_velocity_trigger->value : + (vr_weapon_velocity_trigger->value / 2.0f); - vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity > velocityRequired); - //player has to be dual wielding for this to be true - if (vr.dualsabers) - { - vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity > velocityRequired); - } + vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity > + velocityRequired); + //player has to be dual wielding for this to be true + if (vr.dualsabers) + { + vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity > + velocityRequired); + } - bool triggered = vr.primaryVelocityTriggeredAttack || (vr.dualsabers && vr.secondaryVelocityTriggeredAttack); - if (fired != triggered) - { - ALOGV("**WEAPON EVENT** veocity triggered %s", - triggered ? "+attack" : "-attack"); - //normal attack is a punch with the left hand - sendButtonAction("+attack", triggered); - fired = triggered; + bool triggered = vr.primaryVelocityTriggeredAttack || + (vr.dualsabers && vr.secondaryVelocityTriggeredAttack); + if (fired != triggered) + { + ALOGV("**WEAPON EVENT** veocity triggered %s", + triggered ? "+attack" : "-attack"); + //normal attack is a punch with the left hand + sendButtonAction("+attack", triggered); + fired = triggered; + } } } else if (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack) { //send a stop attack as we have an unfinished velocity attack @@ -905,6 +912,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) @@ -952,11 +960,11 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, if (fabs(deltaLength) > vr_force_distance_trigger->value) { if (deltaLength < 0 && !palmAway) { - sendButtonActionSimple(va("useGivenForce %i", FP_PULL)); + sendButtonActionSimple(va("useGivenForce %i", vr_force_motion_pull->integer)); } else if (deltaLength > 0 && palmAway) { - sendButtonActionSimple(va("useGivenForce %i", FP_PUSH)); + sendButtonActionSimple(va("useGivenForce %i", vr_force_motion_push->integer)); } vr.secondaryVelocityTriggeredAttack = false; diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_media.h b/Projects/Android/jni/OpenJK/code/cgame/cg_media.h index 69a8676..633968f 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_media.h +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_media.h @@ -186,6 +186,7 @@ typedef struct { //Hand models qhandle_t handModel_relaxed; + qhandle_t handModel_fist; qhandle_t handModel_force; qhandle_t halfShieldModel; diff --git a/Projects/Android/jni/OpenJK/code/client/snd_music.cpp b/Projects/Android/jni/OpenJK/code/client/snd_music.cpp index 8c8eec9..8f39e14 100644 --- a/Projects/Android/jni/OpenJK/code/client/snd_music.cpp +++ b/Projects/Android/jni/OpenJK/code/client/snd_music.cpp @@ -602,7 +602,7 @@ static qboolean Music_ParseLeveldata( gsl::czstring psLevelName ) { // then this must be "action" music under current rules... // - assert( !strcmp(psMusicStateType, Music_BaseStateToString(eBGRNDTRACK_ACTION) ? Music_BaseStateToString(eBGRNDTRACK_ACTION):"") ); + //assert( !strcmp(psMusicStateType, Music_BaseStateToString(eBGRNDTRACK_ACTION) ? Music_BaseStateToString(eBGRNDTRACK_ACTION):"") ); // // does this marker exist in the explore piece? // 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/qcommon/common.cpp b/Projects/Android/jni/OpenJK/code/qcommon/common.cpp index 6f8c142..6f5d306 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/common.cpp +++ b/Projects/Android/jni/OpenJK/code/qcommon/common.cpp @@ -990,13 +990,11 @@ void Com_ExecuteCfg(void) // skip the q3config.cfg and autoexec.cfg if "safe" is on the command line Cbuf_ExecuteText(EXEC_NOW, "exec " Q3CONFIG_NAME "\n"); Cbuf_Execute(); - Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n"); //Execute to overwrite weapon locations with our desired adjustments -#ifdef JK2_MODE - Cbuf_AddText( "exec weapons_vr_jo.cfg\n" ); -#else - Cbuf_AddText( "exec weapons_vr_ja.cfg\n" ); -#endif + Cbuf_ExecuteText(EXEC_NOW, "exec weapons_vr.cfg\n" ); + Cbuf_Execute(); + // Execute autoexec last (allowing to re-adjust weapons) + Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n"); Cbuf_Execute(); } } diff --git a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h index 20a2b73..5551645 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h +++ b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h @@ -23,7 +23,7 @@ along with this program; if not, see . // Current version of the single player game #define VERSION_STRING_DOTTED "1.0.1.1" -#define JKXR_VERSION "1.1.4" +#define JKXR_VERSION "1.1.7" #ifdef _DEBUG #define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION diff --git a/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp b/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp index 060ef35..b912625 100644 --- a/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp +++ b/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp @@ -6519,11 +6519,7 @@ void UI_ResetDefaults( void ) ui.Cmd_ExecuteText( EXEC_APPEND, "cvar_restart\n"); Controls_SetDefaults(); ui.Cmd_ExecuteText( EXEC_APPEND, "exec default.cfg\n"); -#ifdef JK2_MODE - ui.Cmd_ExecuteText( EXEC_APPEND, "exec weapons_vr_jo.cfg\n"); -#else - ui.Cmd_ExecuteText( EXEC_APPEND, "exec weapons_vr_ja.cfg\n"); -#endif + ui.Cmd_ExecuteText( EXEC_APPEND, "exec weapons_vr.cfg\n"); ui.Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h index 5e1b85a..3478969 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h @@ -810,7 +810,7 @@ void CG_DrawCenterString( void ); // void CG_Player( centity_t *cent ); void CG_ResetPlayerEntity( centity_t *cent ); -void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent ); +void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent, bool forceShownInFirstPerson = false ); void CG_GetTagWorldPosition( refEntity_t *model, char *tag, vec3_t pos, vec3_t axis[3] ); // diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp index f769620..b7b21dd 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp @@ -1317,6 +1317,7 @@ static void CG_RegisterGraphics( void ) { //VR Hand models cgs.media.handModel_relaxed = cgi_R_RegisterModel( "models/players/kyle/lhand_r.md3" ); + cgs.media.handModel_fist = cgi_R_RegisterModel( "models/players/kyle/lhand_force_fisting.md3" ); cgs.media.handModel_force = cgi_R_RegisterModel( "models/players/kyle/lhand_f.md3" ); cgs.media.saberHilt = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h index 101666d..35a3821 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h @@ -144,6 +144,7 @@ typedef struct { //Hand models qhandle_t handModel_relaxed; + qhandle_t handModel_fist; qhandle_t handModel_force; qhandle_t saberHilt; diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp index 4773fd1..ed08375 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_players.cpp @@ -3400,7 +3400,7 @@ CG_AddRefEntityWithPowerups Adds a piece with modifications or duplications for powerups =============== */ -void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent ) +void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent, bool forceShownInFirstPerson ) { if ( !cent ) { @@ -3431,7 +3431,7 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen // cgi_S_AddLoopingSound( 0, cent->lerpOrigin, vec3_origin, cgs.media.overchargeLoopSound ); // } - if (player1stPersonSaber) { + if (player1stPersonSaber && !forceShownInFirstPerson) { ent->renderfx = RF_THIRD_PERSON; } @@ -4588,6 +4588,9 @@ Ghoul2 Insert End { if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) ) { + int position = (vr->right_handed ? 2 : 1); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + /* if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) ) { @@ -4607,6 +4610,9 @@ Ghoul2 Insert End } else { + int position = (vr->right_handed ? 2 : 1); + cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0); + theFxScheduler.PlayEffect( "spark", trace.endpos, trace.plane.normal ); // All I need is a bool to mark whether I have a previous point to work with. //....come up with something better.. @@ -4897,6 +4903,9 @@ void CG_Player(centity_t *cent ) { if (cent->gent->client->ps.clientNum == 0) { vr->velocitytriggered = (!cg.renderingThirdPerson && (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON)); + cvar_t *vr_motion_enable_saber = gi.cvar("vr_motion_enable_saber", "0", CVAR_ARCHIVE); + vr->velocitytriggeractive = ((cg.snap->ps.weapon == WP_SABER && (cent->gent->client->ps.saberActive || vr_motion_enable_saber->integer)) || + cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON); } //Get the player's light level for stealth calculations @@ -5076,7 +5085,7 @@ Ghoul2 Insert Start {//no viewentity if ( cent->currentState.number == cg.snap->ps.clientNum ) {//I am the player - if ( cg.snap->ps.weapon != WP_SABER && cg.snap->ps.weapon != WP_MELEE ) + if ( cg.snap->ps.weapon != WP_SABER ) {//not using saber or fists ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors } @@ -5084,7 +5093,7 @@ Ghoul2 Insert Start } else if ( cent->currentState.number == cg.snap->ps.viewEntity ) {//I am the view entity - if ( cg.snap->ps.weapon != WP_SABER && cg.snap->ps.weapon != WP_MELEE ) + if ( cg.snap->ps.weapon != WP_SABER ) {//not using first person saber test or, if so, not using saber ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors } @@ -5749,7 +5758,7 @@ Ghoul2 Insert End {//no viewentity if ( cent->currentState.number == cg.snap->ps.clientNum ) {//I am the player - if ( cg.snap->ps.weapon != WP_SABER && cg.snap->ps.weapon != WP_MELEE ) + if ( cg.snap->ps.weapon != WP_SABER ) {//not using saber or fists renderfx = RF_THIRD_PERSON; // only draw in mirrors } @@ -5757,7 +5766,7 @@ Ghoul2 Insert End } else if ( cent->currentState.number == cg.snap->ps.viewEntity ) {//I am the view entity - if ( cg.snap->ps.weapon != WP_SABER && cg.snap->ps.weapon != WP_MELEE ) + if ( cg.snap->ps.weapon != WP_SABER ) {//not using saber or fists renderfx = RF_THIRD_PERSON; // only draw in mirrors } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp index 9f43997..c2bd5dd 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_view.cpp @@ -2033,10 +2033,10 @@ wasForceSpeed=isForceSpeed; } //Render hand models when appropriate - if (!in_camera + if (cg.snap->ps.clientNum == 0 + && !in_camera && !cg.renderingThirdPerson && cg.predicted_player_state.stats[STAT_HEALTH] > 0 - && cg.snap->ps.weapon != WP_MELEE && !vr->weapon_stabilised && !vr->in_vehicle && !cg_pano.integer @@ -2060,6 +2060,10 @@ wasForceSpeed=isForceSpeed; { handEnt.hModel = cgs.media.handModel_force; } + else if (cg.snap->ps.weapon == WP_MELEE) + { + handEnt.hModel = cgs.media.handModel_fist; + } else { handEnt.hModel = cgs.media.handModel_relaxed; @@ -2071,12 +2075,28 @@ wasForceSpeed=isForceSpeed; VectorScale( handEnt.axis[i], (vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] ); } - cgi_R_AddRefEntityToScene(&handEnt); + centity_t *cent = &cg_entities[0]; + CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent, true); - if (cg.snap->ps.weapon == WP_NONE) + if (cg.snap->ps.weapon == WP_NONE || + cg.snap->ps.weapon == WP_MELEE || + (cg.snap->ps.weapon == WP_SABER && cg.snap->ps.saberInFlight)) { BG_CalculateVRDefaultPosition(0, handEnt.origin, handEnt.angles); + if (cg.snap->ps.weapon == WP_SABER && cg.snap->ps.saberInFlight) + { + handEnt.hModel = cgs.media.handModel_force; + } + else if (cg.snap->ps.weapon == WP_MELEE) + { + handEnt.hModel = cgs.media.handModel_fist; + } + else + { + handEnt.hModel = cgs.media.handModel_relaxed; + } + //Move it back a bit? AngleVectors(handEnt.angles, forward, NULL, NULL); VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin ); @@ -2088,7 +2108,7 @@ wasForceSpeed=isForceSpeed; VectorScale( handEnt.axis[i], (!vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] ); } - cgi_R_AddRefEntityToScene(&handEnt); + CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent); } } } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index 79a3043..4ed6595 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -2953,8 +2953,7 @@ void CG_DrawItemSelector( void ) if (cg.itemSelectorType == ST_WEAPON) // weapons { - if (cg.weaponSelect != WP_NONE && - cg.weaponSelect != WP_MELEE) { + if (cg.weaponSelect != WP_NONE) { refEntity_t sprite; memset(&sprite, 0, sizeof(sprite)); VectorCopy(wheelOrigin, sprite.origin); @@ -3036,10 +3035,9 @@ void CG_DrawItemSelector( void ) } else { - itemId = index + 1; // We need to ignore WP_NONE for weapons - if (itemId == count) + if (itemId == WP_NONE) { - break; + itemId = WP_MELEE; } } } @@ -3078,8 +3076,7 @@ void CG_DrawItemSelector( void ) VectorClear(angles); angles[YAW] = wheelAngles[YAW]; angles[PITCH] = wheelAngles[PITCH]; - angles[ROLL] = - (float)(360 / (count - ((cg.itemSelectorType == ST_WEAPON && !vr->in_vehicle) ? 1 : 0))) * index; + angles[ROLL] = (float)(360 / count) * index; vec3_t forward, up; AngleVectors(angles, forward, NULL, up); @@ -3311,6 +3308,28 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire ) case WP_SABER: cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0); break; + case WP_MELEE: + { + if (vr->primaryVelocityTriggeredAttack && vr->secondaryVelocityTriggeredAttack) + { + position = 4; + } + else if (vr->primaryVelocityTriggeredAttack) + { + position = (vr->right_handed ? 2 : 1); + } + else if (vr->secondaryVelocityTriggeredAttack) // secondary triggered + { + position = (vr->right_handed ? 1 : 2); + } + else + { + position = -1; + } + + cgi_HapticEvent( "chainsaw_fire", position, 0, 50, 0, 0); + } + break; case WP_BRYAR_PISTOL: case WP_BOWCASTER: case WP_BLASTER: diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_client.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_client.cpp index 5ea04b6..091e443 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_client.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_client.cpp @@ -1645,7 +1645,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded client->ps.clientNum = index; // give default weapons - client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE ); + client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MELEE ); client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_BRYAR_PISTOL ); //these are precached in g_items, ClearRegisteredItems() client->ps.inventory[INV_ELECTROBINOCULARS] = 1; @@ -1766,7 +1766,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded if ( spawnPoint->spawnflags & 64 ) {//player starts with absolutely no weapons - ent->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE ); + ent->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MELEE ); ent->client->ps.ammo[weaponData[WP_NONE].ammoIndex] = 32000; // checkme ent->client->ps.weapon = WP_NONE; ent->client->ps.weaponstate = WEAPON_READY; diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_trigger.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_trigger.cpp index bb412ff..37713a4 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_trigger.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_trigger.cpp @@ -224,36 +224,44 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace ) } } - bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; - bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h - bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid; - if ( (self->spawnflags & 2) && ( !( self->spawnflags & 4 ) || ( ( self->spawnflags & 4) && !useGestureAllowed ) ) ) - { // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active - // In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand. - vec3_t forward; - - if ( other->client ) - { - if ( (other->client->ps.clientNum == 0) && (self->spawnflags & 4) && !thirdPersonActive && !vr->remote_droid ) + bool useGestureAllowed = false; + if (vr) + { + bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; + cvar_t *vr_gesture_triggered_use = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE); + bool useGestureEnabled = vr_gesture_triggered_use == nullptr || + vr_gesture_triggered_use->integer; // defined in VrCvars.h + useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid; + if ((self->spawnflags & 2) && + (!(self->spawnflags & 4) || ((self->spawnflags & 4) && !useGestureAllowed))) + { // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active + // In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand. + vec3_t forward; + + if (other->client) { - // In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person or controlling droid) - vec3_t origin, angles; - BG_CalculateVRWeaponPosition(origin, angles); - AngleVectors( angles, forward, NULL, NULL ); + if ((other->client->ps.clientNum == 0) && (self->spawnflags & 4) && + !thirdPersonActive && !vr->remote_droid) + { + // In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person or controlling droid) + vec3_t origin, angles; + BG_CalculateVRWeaponPosition(origin, angles); + AngleVectors(angles, forward, NULL, NULL); + } + else + { + AngleVectors(other->client->ps.viewangles, forward, NULL, NULL); + } } else { - AngleVectors( other->client->ps.viewangles, forward, NULL, NULL ); + AngleVectors(other->currentAngles, forward, NULL, NULL); } - } - else - { - AngleVectors( other->currentAngles, forward, NULL, NULL ); - } - if ( DotProduct( self->movedir, forward ) < 0.5 ) - {//Not Within 45 degrees - return; + if (DotProduct(self->movedir, forward) < 0.5) + {//Not Within 45 degrees + return; + } } } 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/weapons.h b/Projects/Android/jni/OpenJK/codeJK2/game/weapons.h index f796fc6..cea3740 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/weapons.h +++ b/Projects/Android/jni/OpenJK/codeJK2/game/weapons.h @@ -84,7 +84,7 @@ typedef enum //# weapon_e } weapon_t; #define FIRST_WEAPON WP_SABER // this is the first weapon for next and prev weapon switching -#define MAX_PLAYER_WEAPONS WP_STUN_BATON // this is the max you can switch to and get with the give all. +#define MAX_PLAYER_WEAPONS WP_MELEE // this is the max you can switch to and get with the give all. // AMMO_NONE must be first and AMMO_MAX must be last, cause weapon load validates based off of these vals typedef enum //# ammo_e diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/wp_melee.cpp index a6237c4..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 : 3; + 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 diff --git a/assets/z_vr_weapons_jko_Crusty_and_Elin.pk3 b/assets/z_vr_weapons_jko_Crusty_and_Elin.pk3 new file mode 100644 index 0000000..fa793a7 Binary files /dev/null and b/assets/z_vr_weapons_jko_Crusty_and_Elin.pk3 differ diff --git a/java/com/drbeef/jkxr/GLES3JNIActivity.java b/java/com/drbeef/jkxr/GLES3JNIActivity.java index bcb0dde..bf88ccd 100644 --- a/java/com/drbeef/jkxr/GLES3JNIActivity.java +++ b/java/com/drbeef/jkxr/GLES3JNIActivity.java @@ -195,9 +195,6 @@ public void create() { //Copy the command line params file copy_asset("/sdcard/JKXR", "commandline.txt", false); - //Copy the weapon adjustment config - should we force overwrite? - copy_asset("/sdcard/JKXR/JK2/base", "weapons_vr_jo.cfg", true); - //Our assets copy_asset("/sdcard/JKXR/JK2/base", "z_vr_assets_base.pk3", true); copy_asset("/sdcard/JKXR/JK2/base", "z_vr_assets_jko.pk3", true); @@ -208,8 +205,11 @@ public void create() { copy_asset("/sdcard/JKXR/JK2/base", "GGDynamicWeapons.pk3", false); //Weapon Models - copy_asset("/sdcard/JKXR/JK2/base", "z_Crusty_and_Elin_vr_weapons.pk3", true); + copy_asset("/sdcard/JKXR/JK2/base", "z_vr_weapons_jko_Crusty_and_Elin.pk3", true); copy_asset("/sdcard/JKXR/JK2/base", "assets6_vr_weapons_shaders.pk3", true); + //Delete weapons pak and config with old name + delete_asset(new File("/sdcard/JKXR/JK2/base/z_Crusty_and_Elin_vr_weapons.pk3")); + delete_asset(new File("/sdcard/JKXR/JK2/base/weapons_vr_jo.cfg")); } @@ -233,9 +233,12 @@ public void create() { copy_asset(demoFolder, "packaged_mods_credits.txt", false); copy_asset(demoFolder, "GGDynamicWeapons.pk3", false); - //Weapon Models - copy_asset(demoFolder, "z_Crusty_and_Elin_vr_weapons.pk3", true); - copy_asset(demoFolder, "assets6_vr_weapons_shaders.pk3", true); + //Weapon Models + copy_asset(demoFolder, "z_vr_weapons_jko_Crusty_and_Elin.pk3", true); + copy_asset(demoFolder, "assets6_vr_weapons_shaders.pk3", true); + //Delete weapons pak and config with old name + delete_asset(new File(demoFolder + "/z_Crusty_and_Elin_vr_weapons.pk3")); + delete_asset(new File(demoFolder + "/weapons_vr_jo.cfg")); } //Read these from a file and pass through @@ -338,6 +341,18 @@ public static void copy_stream(InputStream in, OutputStream out) } } + public void delete_asset(File file) { + if (!file.exists()) { + return; + } + if (file.isDirectory()) { + for (File nestedFile : file.listFiles()) { + delete_asset(nestedFile); + } + } + file.delete(); + } + @Override protected void onStart() { Log.v( TAG, "GLES3JNIActivity::onStart()" ); diff --git a/z_vr_assets_base/models/players/kyle/lhand_force_fisting.md3 b/z_vr_assets_base/models/players/kyle/lhand_force_fisting.md3 new file mode 100644 index 0000000..f28e660 Binary files /dev/null and b/z_vr_assets_base/models/players/kyle/lhand_force_fisting.md3 differ diff --git a/assets/weapons_vr_jo.cfg b/z_vr_assets_jko/weapons_vr.cfg similarity index 55% rename from assets/weapons_vr_jo.cfg rename to z_vr_assets_jko/weapons_vr.cfg index 75365e3..fad7a26 100644 --- a/assets/weapons_vr_jo.cfg +++ b/z_vr_assets_jko/weapons_vr.cfg @@ -4,21 +4,21 @@ // Values are: scale,right,up,forward,pitch,yaw,roll seta vr_weapon_adjustment_1 "0.55,-4.89,8.12,-12.36,-28.60,10.80,-199.50" -seta vr_weapon_adjustment_10 "1.840,-3.489,6.370,-7.946,0.000,0.000,0.000" -seta vr_weapon_adjustment_11 "1.755,-5.140,4.980,-10.462,18.700,1.000,-11.000" -seta vr_weapon_adjustment_12 "1.840,-3.087,4.424,-8.750,22.400,0.000,-21.400" -seta vr_weapon_adjustment_13 "1.000,-6.860,12.340,-4.600,-49.700,0.000,0.000" +seta vr_weapon_adjustment_10 "1.704,-3.404,4.765,-8.826,33.500,0.000,-27.000" +seta vr_weapon_adjustment_11 "1.104,-5.544,4.475,-10.290,25.000,0.000,-31.100" +seta vr_weapon_adjustment_12 "1.716,-3.065,4.231,-7.751,18.200,0.000,-23.200" +seta vr_weapon_adjustment_13 "1.146,-6.248,9.110,-12.950,15.100,0.000,-2.700" seta vr_weapon_adjustment_14 "0.52,-12.87,13.29,-22.09,11.30,26.60,-3.40" seta vr_weapon_adjustment_18 "0.510,-8.235,10.706,-3.922,-5.600,0.400,0.000" seta vr_weapon_adjustment_19 "0.43,-8.97,13.22,-21.68,-4.80,-4.50,-0.40" -seta vr_weapon_adjustment_2 "1.000,-3.800,4.840,-8.020,0.000,0.000,0.000" +seta vr_weapon_adjustment_2 "1.010,-3.604,5.188,-11.050,0.000,0.000,0.000" seta vr_weapon_adjustment_20 "0.44,-13.55,12.79,-26.06,0.30,-1.40,-0.40" seta vr_weapon_adjustment_22 "0.64,-12.59,12.94,-20.44,11.30,26.60,-3.40" -seta vr_weapon_adjustment_3 "0.906,-4.194,8.234,-9.801,0.000,0.000,0.000" -seta vr_weapon_adjustment_4 "0.928,-4.095,9.116,-3.707,0.000,0.000,0.000" +seta vr_weapon_adjustment_3 "1.010,-4.079,6.495,-7.842,0.000,0.000,0.000" +seta vr_weapon_adjustment_4 "1.068,-3.408,6.891,-6.611,0.000,0.000,0.000" seta vr_weapon_adjustment_5 "1.642,-2.826,6.249,-8.429,0.000,0.000,0.000" -seta vr_weapon_adjustment_6 "0.652,-3.344,13.988,-7.730,0.000,0.000,0.000" +seta vr_weapon_adjustment_6 "0.904,-3.695,8.938,-9.115,0.000,0.000,0.000" seta vr_weapon_adjustment_7 "0.998,-4.349,6.473,-10.160,0.000,0.000,0.000" -seta vr_weapon_adjustment_8 "1.006,-4.553,11.571,-12.545,0.000,0.000,0.000" -seta vr_weapon_adjustment_9 "1.456,-3.695,6.676,-3.420,0.000,0.000,0.000" +seta vr_weapon_adjustment_8 "1.000,-4.780,8.240,-10.440,0.000,0.000,0.000" +seta vr_weapon_adjustment_9 "1.500,-3.587,4.467,-7.747,0.000,0.000,0.000"