TBDC and more..

- Merged TBDC changes from JKO
- Made B/Y buttons not switch when switched sticks (so saber toggle is on correct hand)
- Fixed issue with switched sticks making item selector scroll use wrong thumbstick
- Fix crash when using built in menu to choose alternative saber (need to find out where model has gone though)
This commit is contained in:
Simon 2023-06-07 23:33:59 +01:00
parent 72fc1b9b83
commit fc72b58bb6
15 changed files with 191 additions and 57 deletions

View file

@ -56,9 +56,11 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
uint32_t secondaryButtonsNew;
uint32_t secondaryButtonsOld;
int primaryButton1;
int primaryButton2;
bool primaryButton2New;
bool primaryButton2Old;
int secondaryButton1;
int secondaryButton2;
bool secondaryButton2New;
bool secondaryButton2Old;
int primaryThumb;
int secondaryThumb;
if (vr_control_scheme->integer == LEFT_HANDED_DEFAULT && vr_switch_sticks->integer)
@ -76,6 +78,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
primaryThumb = xrButton_RThumb;
secondaryThumb = xrButton_LThumb;
}
if (vr_switch_sticks->integer)
{
//
@ -88,9 +91,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
primaryButtonsNew = pOffTrackedRemoteNew->Buttons;
primaryButtonsOld = pOffTrackedRemoteOld->Buttons;
primaryButton1 = offButton1;
primaryButton2 = offButton2;
secondaryButton1 = domButton1;
secondaryButton2 = domButton2;
}
else
{
@ -101,11 +102,15 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
secondaryButtonsNew = pOffTrackedRemoteNew->Buttons;
secondaryButtonsOld = pOffTrackedRemoteOld->Buttons;
primaryButton1 = domButton1;
primaryButton2 = domButton2;
secondaryButton1 = offButton1;
secondaryButton2 = offButton2;
}
//Don't switch B/Y buttons even if switched sticks
primaryButton2New = domButton2 & pDominantTrackedRemoteNew->Buttons;
primaryButton2Old = domButton2 & pDominantTrackedRemoteOld->Buttons;
secondaryButton2New = offButton2 & pOffTrackedRemoteNew->Buttons;
secondaryButton2Old = offButton2 & pOffTrackedRemoteOld->Buttons;
//Allow weapon alignment mode toggle on x
if (vr_align_weapons->value)
{
@ -173,14 +178,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
}
/*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]);
@ -225,9 +223,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
//Close the datapad
if (((secondaryButtonsNew & secondaryButton2) !=
(secondaryButtonsOld & secondaryButton2)) &&
(secondaryButtonsNew & secondaryButton2)) {
if (secondaryButton2New && !secondaryButton2Old) {
Sys_QueEvent(0, SE_KEY, A_TAB, true, 0, NULL);
}
@ -307,15 +303,26 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Left/right to switch between which selector we are using
if (vr.item_selector == 1) {
float x, y;
if (vr_switch_sticks->integer)
{
x = pSecondaryJoystick->x;
y = pSecondaryJoystick->y;
}
else
{
x = pPrimaryJoystick->x;
y = pPrimaryJoystick->y;
}
static bool selectorSwitched = false;
if (between(-0.2f, pPrimaryJoystick->y, 0.2f) &&
(primaryJoystickX > 0.8f || primaryJoystickX < -0.8f)) {
if (between(-0.2f, y, 0.2f) &&
(x > 0.8f || x < -0.8f)) {
if (!selectorSwitched) {
if (primaryJoystickX > 0.8f) {
if (x > 0.8f) {
sendButtonActionSimple("itemselectornext");
selectorSwitched = true;
} else if (primaryJoystickX < -0.8f) {
} else if (x < -0.8f) {
sendButtonActionSimple("itemselectorprev");
selectorSwitched = true;
}
@ -327,20 +334,31 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Left/right to switch between which selector we are using
if (vr.item_selector == 2) {
float x, y;
if (vr_switch_sticks->integer)
{
x = pPrimaryJoystick->x;
y = pPrimaryJoystick->y;
}
else
{
x = pSecondaryJoystick->x;
y = pSecondaryJoystick->y;
}
static bool selectorSwitched = false;
if (between(-0.2f, pSecondaryJoystick->y, 0.2f) &&
(pSecondaryJoystick->x > 0.8f || pSecondaryJoystick->x < -0.8f)) {
if (between(-0.2f, y, 0.2f) &&
(x > 0.8f || x < -0.8f)) {
if (!selectorSwitched) {
if (pSecondaryJoystick->x > 0.8f) {
if (x > 0.8f) {
sendButtonActionSimple("itemselectornext");
selectorSwitched = true;
} else if (pSecondaryJoystick->x < -0.8f) {
} else if (x < -0.8f) {
sendButtonActionSimple("itemselectorprev");
selectorSwitched = true;
}
}
} else if (between(-0.4f, pSecondaryJoystick->x, 0.4f)) {
} else if (between(-0.4f, x, 0.4f)) {
selectorSwitched = false;
}
}
@ -716,7 +734,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
//B Button
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2)) {
if (primaryButton2New != primaryButton2Old) {
if (vr.cgzoommode == 1 || vr.cgzoommode == 3)
{ // Exit scope only when using binoculars or nightvision
sendButtonActionSimple("exitscope");
@ -724,13 +742,13 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
else if (cl.frame.ps.weapon == WP_SABER && vr.velocitytriggered)
{
//B button toggles saber on/off in first person
if (primaryButtonsNew & primaryButton2) {
if (primaryButton2New && !primaryButton2Old) {
sendButtonActionSimple("togglesaber");
}
}
else if (cl.frame.ps.weapon != WP_DISRUPTOR)
{
sendButtonAction("+altattack", (primaryButtonsNew & primaryButton2));
sendButtonAction("+altattack", primaryButton2New);
}
}
@ -811,7 +829,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{
//Apply a filter and quadratic scaler so small movements are easier to make
float dist = 0;
if (vr.item_selector != 2)
if (vr.item_selector != (vr_switch_sticks->integer ? 1 : 2))
{
dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
}
@ -844,9 +862,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
//Open the datapad
if (((secondaryButtonsNew & secondaryButton2) !=
(secondaryButtonsOld & secondaryButton2)) &&
(secondaryButtonsNew & secondaryButton2)) {
if (secondaryButton2New && !secondaryButton2Old) {
Sys_QueEvent(0, SE_KEY, A_TAB, true, 0, NULL);
}

View file

@ -3063,9 +3063,24 @@ static void CG_DrawCrosshair3D(int type) // 0 - force, 1 - weapons
ent.radius = w / 640 * xmax * trace.fraction * 2048 / 64.0f;
ent.customShader = hShader;
ent.shaderRGBA[0] = (type == 0 && !cg_forceCrosshair) ? 0 : 255;
ent.shaderRGBA[1] = (type == 0) ? 0 : 255;
ent.shaderRGBA[2] = 255;
if(type == 0 && !cg_forceCrosshair) //Not Active Force Crosshair
{
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 180;
ent.shaderRGBA[2] = 180;
}
else if(type == 0) //Active Force Crosshair
{
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 90;
ent.shaderRGBA[2] = 90;
}
else //Regular Crosshair
{
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 255;
ent.shaderRGBA[2] = 255;
}
ent.shaderRGBA[3] = 255;
cgi_R_AddRefEntityToScene(&ent);

View file

@ -33,6 +33,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../Rufl/hstring.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
#define LOOK_SWING_SCALE 0.5f
#define CG_SWINGSPEED 0.3f
@ -6809,13 +6810,13 @@ Ghoul2 Insert End
renderfx, (qboolean)!noDlight );
if (CG_getPlayer1stPersonSaber(cent) &&
cent->gent->client->ps.saberEventFlags & (SEF_BLOCKED|SEF_PARRIED) &&
vr->saberBlockDebounce < cg.time &&
cent->gent->client->ps.saberEventFlags & (SEF_BLOCKED|SEF_PARRIED) &&
cent->gent->client->ps.saberBounceMove != LS_NONE &&
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
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, vr->right_handed ? (2 - saberNum) : (1 + saberNum), 100, 0, 0);
}
@ -8532,7 +8533,8 @@ Ghoul2 Insert End
for ( int saberNum = 0; saberNum < numSabers; saberNum++ )
{
if (saberNum == 0 && cent->currentState.saberInFlight)
if ((saberNum == 0 && cent->currentState.saberInFlight) ||
cent->gent->client->ps.saber[saberNum].name == nullptr)
{
continue;
}

View file

@ -2257,11 +2257,40 @@ int NPC_ShotEntity( gentity_t *ent, vec3_t impactPos )
}
int location = Q_irand(0, 99);
if (location < 65 || cg.renderingThirdPerson ||
int torsoRatio = 65;
int legsRatio = 20;
int headRatio = 15;
switch ( g_spskill->integer )
{
//Easiest difficulty, low chance of hittitng anything else
case 0:
torsoRatio = 90;
legsRatio = 5;
headRatio = 5;
break;
//Medium difficulty, half-half chance of picking up the player
case 1:
torsoRatio = 60;
legsRatio = 25;
headRatio = 15;
break;
//Hardest difficulty, always turn on attacking player
case 2:
default:
torsoRatio = 50;
legsRatio = 35;
headRatio = 15;
break;
}
if (location < torsoRatio || cg.renderingThirdPerson ||
ent->client == NULL || ent->client->ps.clientNum != 0) {
// 65% chance (unless ent is not the player, then always go for chest, which is original behaviour)
CalcEntitySpot(ent, SPOT_CHEST, targ);
} else if (location < 85) {
} else if (location < legsRatio + torsoRatio) {
// 20% chance
CalcEntitySpot(ent, SPOT_LEGS, targ);
} else {

View file

@ -27,6 +27,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "g_vehicles.h"
#include "../cgame/cg_local.h"
extern cvar_t *g_TeamBeefDirectorsCut;
#if !defined(RUFL_HSTRING_INC)
#include "../Rufl/hstring.h"
#endif

View file

@ -25,7 +25,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../rd-common/tr_public.h"
// bg_pmove.c -- both games player movement code
// takes a playerstate and a usercmd as input and returns a modifed playerstate
@ -46,6 +45,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_vehicles.h"
#include <float.h>
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern qboolean G_DoDismemberment( gentity_t *self, vec3_t point, int mod, int damage, int hitLoc, qboolean force = qfalse );
extern qboolean G_EntIsUnlockedDoor( int entityNum );
@ -14085,7 +14085,19 @@ static void PM_Weapon( void )
return;
}
PM_AddEvent( EV_FIRE_WEAPON );
addTime = weaponData[pm->ps->weapon].fireTime;
if(pm->ps->weapon == WP_BRYAR_PISTOL && g_TeamBeefDirectorsCut->integer == 1)
{
addTime = TBDC_BRYAR_PISTOL_FIRERATE;
}
else if(pm->ps->weapon == WP_BLASTER && g_TeamBeefDirectorsCut->integer == 1)
{
addTime = TBDC_BLASTER_FIRERATE;
}
else
{
addTime = weaponData[pm->ps->weapon].fireTime;
}
switch( pm->ps->weapon)
{

View file

@ -34,6 +34,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "Q3_Interface.h"
#include "g_navigator.h"
extern cvar_t *g_TeamBeefDirectorsCut;
#define TURN_OFF 0x00000100
extern qboolean Rosh_TwinPresent( gentity_t *self );
@ -6055,7 +6057,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const
}
}
// figure momentum add, even if the damage won't be taken
if ( knockback && !(dflags&DAMAGE_DEATH_KNOCKBACK) ) //&& targ->client
if ( knockback && (!(dflags&DAMAGE_DEATH_KNOCKBACK) || (g_TeamBeefDirectorsCut->integer == 1 && targ->s.number != 0))) //&& targ->client //GB not the player
{
G_ApplyKnockback( targ, newDir, knockback );
G_CheckKnockdown( targ, attacker, newDir, dflags, mod );
@ -6718,6 +6720,10 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, const
{//special case because this is shotgun-ish damage, we need to multiply the knockback
knockback *= 12;//*6 for 6 flechette shots
}
else if(g_TeamBeefDirectorsCut->integer == 1)
{
knockback *= 2;
}
G_ApplyKnockback( targ, newDir, knockback );
}

View file

@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "w_local.h"
#include "bg_local.h"
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//---------------
@ -75,7 +77,12 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
WP_MissileTargetHint(ent, start, forward);
gentity_t *missile = CreateMissile( start, forward, BRYAR_PISTOL_VEL, 10000, ent, alt_fire );
float velocity = BRYAR_PISTOL_VEL;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_BRYAR_PISTOL_VEL;
}
gentity_t *missile = CreateMissile( start, forward, velocity, 10000, ent, alt_fire );
missile->classname = "bryar_proj";
if ( ent->s.weapon == WP_BLASTER_PISTOL

View file

@ -28,6 +28,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//---------------
@ -60,6 +62,11 @@ void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean a
velocity *= BLASTER_NPC_HARD_VEL_CUT;
}
}
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_BLASTER_VELOCITY;
}
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall

View file

@ -28,6 +28,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-------------------
// Wookiee Bowcaster
@ -98,7 +100,14 @@ static void WP_BowcasterMainFire( gentity_t *ent )
for ( int i = 0; i < count; i++ )
{
// create a range of different velocities
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
vel = TBDC_BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );;
}
else
{
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
}
vectoangles( forward, angs );
@ -168,7 +177,12 @@ static void WP_BowcasterAltFire( gentity_t *ent )
WP_MissileTargetHint(ent, start, forward);
gentity_t *missile = CreateMissile( start, forward, BOWCASTER_VELOCITY, 10000, ent, qtrue );
float velocity = BOWCASTER_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_BOWCASTER_VELOCITY;
}
gentity_t *missile = CreateMissile( start, forward, velocity, 10000, ent, qtrue );
missile->classname = "bowcaster_alt_proj";
missile->s.weapon = WP_BOWCASTER;

View file

@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "bg_local.h"
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-------------------
// DEMP2
@ -53,7 +55,12 @@ static void WP_DEMP2_MainFire( gentity_t *ent )
WP_MissileTargetHint(ent, start, forward);
gentity_t *missile = CreateMissile( start, forward, DEMP2_VELOCITY, 10000, ent );
float velocity = DEMP2_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_DEMP2_VELOCITY;
}
gentity_t *missile = CreateMissile( start, forward, velocity, 10000, ent );
missile->classname = "demp2_proj";
missile->s.weapon = WP_DEMP2;

View file

@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "bg_local.h"
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-------------------
// Heavy Repeater
@ -43,7 +45,12 @@ static void WP_RepeaterMainFire( gentity_t *ent, vec3_t dir )
WP_MissileTargetHint(ent, start, dir);
gentity_t *missile = CreateMissile( start, dir, REPEATER_VELOCITY, 10000, ent );
float velocity = REPEATER_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_REPEATER_VELOCITY;
}
gentity_t *missile = CreateMissile( start, dir, velocity, 10000, ent );
missile->classname = "repeater_proj";
missile->s.weapon = WP_REPEATER;
@ -109,7 +116,12 @@ static void WP_RepeaterAltFire( gentity_t *ent )
}
WP_MissileTargetHint(ent, start, forward);
missile = CreateMissile( start, forward, REPEATER_ALT_VELOCITY, 10000, ent, qtrue );
float velocity = REPEATER_ALT_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
velocity = TBDC_REPEATER_ALT_VELOCITY;
}
missile = CreateMissile( start, forward, velocity, 10000, ent, qtrue );
}
missile->classname = "repeater_alt_proj";

View file

@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "bg_local.h"
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-----------------------
// Rocket Launcher
@ -54,7 +56,12 @@ void rocketThink( gentity_t *ent )
}
if ( ent->enemy && ent->enemy->inuse )
{
float vel = (ent->spawnflags&1)?ent->speed:ROCKET_VELOCITY;
float baseVelocity = ROCKET_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->integer == 1)
{
baseVelocity = TBDC_ROCKET_VELOCITY;
}
float vel = (ent->spawnflags&1)?ent->speed:baseVelocity;
float newDirMult = ent->angle?ent->angle*2.0f:1.0f;
float oldDirMult = ent->angle?(1.0f-ent->angle)*2.0f:1.0f;

View file

@ -4791,8 +4791,6 @@ Ghoul2 Insert End
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", "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

@ -29,7 +29,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-----------------------
// Golan Arms Flechette