Laser Saber deflections
Guns balancing.
This commit is contained in:
Grant Bagwell 2023-04-04 23:37:41 +02:00
parent 65674abe2a
commit 1939a26542
7 changed files with 98 additions and 26 deletions

View file

@ -306,7 +306,7 @@ void VR_Init()
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);
vr_saber_block_debounce_time = Cvar_Get ("vr_saber_block_debounce_time", "200", CVAR_ARCHIVE);
vr_saber_block_debounce_time = Cvar_Get ("vr_saber_block_debounce_time", "1000", CVAR_ARCHIVE);
vr_haptic_intensity = Cvar_Get ("vr_haptic_intensity", "1.0", CVAR_ARCHIVE);
vr_comfort_vignette = Cvar_Get ("vr_comfort_vignette", "0.0", CVAR_ARCHIVE);
vr_saber_3rdperson_mode = Cvar_Get ("vr_saber_3rdperson_mode", "1", CVAR_ARCHIVE);

View file

@ -43,6 +43,7 @@ typedef struct {
int cgzoommode;
int cgzoomdir;
int saberBlockDebounce; // Amount of time after player is blocked that the saber position is fixed
short saberBounceMove;
int forceid;

View file

@ -17,6 +17,7 @@ Authors : Simon Brown
#include <client/client.h>
#include <statindex.h>
#include "android/sys_local.h"
#include "VrTBDC.h"
#ifdef JK2_MODE
#include "../OpenJK/codeJK2/game/weapons.h"
@ -121,12 +122,63 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_DEFAULT]);
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles[ANGLES_DEFAULT]);
//if we are in saber block debounce, don't update the saber angles
if (vr.saberBlockDebounce < cl.serverTime) {
rotation[PITCH] = 45;
//If we are in a saberBlockDebounce thing then add on an angle
//Lerped upon how far from the start of the saber move
if (vr.saberBlockDebounce > cl.serverTime) {
float lerp = 0.0f;
//Where are we in the lerp
// 0 = vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME
// 1 = vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME / 2
// 0 (again) = vr.saberBlockDebounce
if(cl.serverTime < vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME / 2)
{
//Somewhere between 0 and 1
lerp = float(cl.serverTime - (vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME)) / float((vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME / 2) - (vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME));
}
else
{
//Somewhere between 1 and 0
lerp = 1 - float(cl.serverTime - (vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME / 2)) / float(vr.saberBlockDebounce - (vr.saberBlockDebounce - TBDC_SABER_BOUNCETIME / 2));
}
switch(vr.saberBounceMove) {
case VRLS_B1_BR:
rotation[PITCH] += lerp * TBDC_SABER_BOUNCEANGLE;
rotation[YAW] -= lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1__R:
rotation[YAW] -= lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1_TR:
rotation[PITCH] -= lerp * TBDC_SABER_BOUNCEANGLE;
rotation[YAW] -= lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1_T_:
rotation[PITCH] -= lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1_TL:
rotation[PITCH] -= lerp * TBDC_SABER_BOUNCEANGLE;
rotation[YAW] += lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1__L:
rotation[YAW] += lerp * TBDC_SABER_BOUNCEANGLE;
break;
case VRLS_B1_BL:
rotation[PITCH] += lerp * TBDC_SABER_BOUNCEANGLE;
rotation[YAW] += lerp * TBDC_SABER_BOUNCEANGLE;
break;
}
}
/*else if(cl.serverTime > vr.saberBlockDebounce + 3000)
{
if(vr.saberBounceMove < 82)
{
vr.saberBounceMove = 82;
}
vr.saberBlockDebounce = cl.serverTime + TBDC_SABER_BOUNCETIME;
}*/
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_SABER]);
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles[ANGLES_SABER]);
}
rotation[PITCH] = vr_weapon_pitchadjust->value;
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_ADJUSTED]);
@ -380,7 +432,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
VectorCopy(vr.weaponoffset, vr.weaponoffset_history[0]);
vr.weaponoffset_history_timestamp[0] = vr.weaponoffset_timestamp;
if (vr.saberBlockDebounce < cl.serverTime) {
//if (vr.saberBlockDebounce < cl.serverTime) {
VectorSet(vr.weaponposition, pWeapon->Pose.position.x,
pWeapon->Pose.position.y, pWeapon->Pose.position.z);
@ -389,7 +441,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
pWeapon->Pose.position.y, pWeapon->Pose.position.z);
VectorSubtract(vr.weaponoffset, vr.hmdposition, vr.weaponoffset);
vr.weaponoffset_timestamp = Sys_Milliseconds();
}
//}
vec3_t velocity;
VectorSet(velocity, pWeapon->Velocity.linearVelocity.x,

View file

@ -6,17 +6,33 @@
#define JKXR_VRTBDC_H
//VELOCITIES
#define TBDC_BRYAR_PISTOL_VEL 3600
#define TBDC_BLASTER_VELOCITY 4600
#define TBDC_BRYAR_PISTOL_VEL 3300
#define TBDC_BLASTER_VELOCITY 4200
#define TBDC_BOWCASTER_VELOCITY 3000
#define TBDC_REPEATER_VELOCITY 3200
#define TBDC_REPEATER_VELOCITY 3000
#define TBDC_REPEATER_ALT_VELOCITY 1600
#define TBDC_DEMP2_VELOCITY 2500
#define TBDC_ROCKET_VELOCITY 2800
#define TBDC_ROCKET_VELOCITY 2400
//FIRERATES
#define TBDC_BRYAR_PISTOL_FIRERATE 250
#define TBDC_BLASTER_FIRERATE 200
//SABERS
#define TBDC_SABER_BOUNCETIME 200
#define TBDC_SABER_BOUNCEANGLE 90
typedef enum {
// Invalid, or saber not armed
VRLS_NONE = 0,
//Bounces
VRLS_B1_BR = 82,
VRLS_B1__R,
VRLS_B1_TR,
VRLS_B1_T_,
VRLS_B1_TL,
VRLS_B1__L,
VRLS_B1_BL
} vrBounce;
#endif //JKXR_VRTBDC_H

View file

@ -6792,7 +6792,7 @@ Ghoul2 Insert End
vr->saberBlockDebounce < cg.time &&
bladeNum == 0) // Only need to do this for the first blade
{
cvar_t *vr_saber_block_debounce_time = gi.cvar("vr_saber_block_debounce_time", "200", CVAR_ARCHIVE); // defined in VrCvars.h
cvar_t *vr_saber_block_debounce_time = gi.cvar("vr_saber_block_debounce_time", "1000", CVAR_ARCHIVE); // defined in VrCvars.h
vr->saberBlockDebounce = cg.time + vr_saber_block_debounce_time->integer;
cgi_HapticEvent("shotgun_fire", 0, vr->right_handed ? (2 - saberNum) : (1 + saberNum), 100, 0, 0);

View file

@ -32,6 +32,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../game/wp_saber.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
#define LOOK_SWING_SCALE 0.5
@ -4781,11 +4782,13 @@ Ghoul2 Insert End
if (CG_getPlayer1stPersonSaber(cent) &&
cent->gent->client->ps.saberEventFlags & (SEF_BLOCKED|SEF_PARRIED) &&
cent->gent->client->ps.saberBounceMove != LS_NONE &&
vr->saberBlockDebounce < cg.time)
{
cvar_t *vr_saber_block_debounce_time = gi.cvar("vr_saber_block_debounce_time", "200", CVAR_ARCHIVE); // defined in VrCvars.h
vr->saberBlockDebounce = cg.time + vr_saber_block_debounce_time->integer;
//cvar_t *vr_saber_block_debounce_time = gi.cvar("vr_saber_block_debounce_time", "1000", CVAR_ARCHIVE); // defined in VrCvars.h
//vr->saberBlockDebounce = cg.time + vr_saber_block_debounce_time->integer;
vr->saberBlockDebounce = cg.time + TBDC_SABER_BOUNCETIME;
vr->saberBounceMove = cent->gent->client->ps.saberBounceMove;
cgi_HapticEvent("shotgun_fire", 0, 0, 100, 0, 0);
}

View file

@ -5352,10 +5352,10 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_
{//special case because this is shotgun-ish damage, we need to multiply the knockback
knockback *= 12;//*6 for 6 flechette shots
}
if(g_TeamBeefDirectorsCut->value)
else if(g_TeamBeefDirectorsCut->value)
{
knockback *= 2;
}
` }
G_ApplyKnockback( targ, newDir, knockback );
}