TBDC Weapons

This commit is contained in:
Grant Bagwell 2023-04-02 23:18:28 +02:00
parent e3524e8e48
commit cb52d310c1
14 changed files with 159 additions and 4116 deletions

View file

@ -164,6 +164,13 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll)
if (!vr.maxHeight || vr.maxHeight < 1.0) {
vr.maxHeight = vr.hmdposition[1];
}
//GB Instantiate initial velocity
if(!vr.tempWeaponVelocity)
{
vr.tempWeaponVelocity = 400.0f;
}
vr.curHeight = vr.hmdposition[1];
}

View file

@ -29,6 +29,9 @@ typedef struct {
bool third_person;
float fov_x;
float fov_y;
float tempWeaponVelocity;
bool immersive_cinematics;
bool weapon_stabilised;
bool right_handed;

View file

@ -349,6 +349,27 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
}
static bool changed = false;
if (between(-0.2f, primaryJoystickX, 0.2f) &&
between(0.8f, pPrimaryJoystick->y, 1.0f)) {
if(!changed) {
vr.tempWeaponVelocity += 25;
changed = true;
ALOGV("**TBDC** Projectile speed %f",vr.tempWeaponVelocity);
}
} else if (between(-0.2f, primaryJoystickX, 0.2f) &&
between(-1.0f, pPrimaryJoystick->y, -0.8f)) {
if(!changed) {
vr.tempWeaponVelocity -= 25;
ALOGV("**TBDC** Projectile speed %f",vr.tempWeaponVelocity);
changed = true;
}
}
else
{
changed = false;
}
//dominant hand stuff first
{
//Record recent weapon position for trajectory based stuff
@ -647,7 +668,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
(secondaryButtonsOld & secondaryButton1)) &&
(secondaryButtonsNew & secondaryButton1)) {
#ifdef JK2_MODE
sendButtonActionSimple("save quik*");
//sendButtonActionSimple("save quik*");
#else
sendButtonActionSimple("save quick");
#endif

View file

@ -0,0 +1,22 @@
//
// Created by baggyg on 02/04/2023.
//
#ifndef JKXR_VRTBDC_H
#define JKXR_VRTBDC_H
//VELOCITIES
#define TBDC_BRYAR_PISTOL_VEL 3600
#define TBDC_BLASTER_VELOCITY 4600
#define TBDC_BOWCASTER_VELOCITY 3000
#define TBDC_REPEATER_VELOCITY 3200
#define TBDC_REPEATER_ALT_VELOCITY 1600
#define TBDC_DEMP2_VELOCITY 2500
#define TBDC_ROCKET_VELOCITY 2800
//FIRERATES
#define TBDC_BRYAR_PISTOL_FIRERATE 250
#define TBDC_BLASTER_FIRERATE 200
#endif //JKXR_VRTBDC_H

View file

@ -39,6 +39,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include <float.h>
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
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 );
@ -7642,6 +7644,7 @@ void PM_WeaponLightsaber(void)
PM_AddEvent( EV_FIRE_WEAPON );
if ( !addTime )
{
addTime = weaponData[pm->ps->weapon].fireTime;
if ( g_timescale != NULL )
{
@ -8403,7 +8406,20 @@ 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->value)
{
addTime = TBDC_BRYAR_PISTOL_FIRERATE;
}
else if(pm->ps->weapon == WP_BLASTER && g_TeamBeefDirectorsCut->value)
{
addTime = TBDC_BLASTER_FIRERATE;
}
else
{
addTime = weaponData[pm->ps->weapon].fireTime;
}
switch( pm->ps->weapon)
{

View file

@ -29,7 +29,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//---------------
// Blaster
//---------------
@ -54,6 +55,11 @@ static void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qbo
}
}
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->value)
{
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
gentity_t *missile = CreateMissile( start, dir, velocity, 10000, ent, altFire );
@ -121,9 +127,15 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
if ( alt_fire )
{
// add some slop to the alt-fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BLASTER_ALT_SPREAD;
angs[YAW] += Q_flrand(-1.0f, 1.0f) * BLASTER_ALT_SPREAD;
if(vr->weapon_stabilised) {
// add some slop to the alt-fire direction
angs[PITCH] += Q_flrand(-0.5f, 0.5f) * BLASTER_ALT_SPREAD;
angs[YAW] += Q_flrand(-0.5f, 0.5f) * BLASTER_ALT_SPREAD;
} else {
// add some slop to the alt-fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BLASTER_ALT_SPREAD;
angs[YAW] += Q_flrand(-1.0f, 1.0f) * BLASTER_ALT_SPREAD;
}
}
else
{
@ -138,10 +150,18 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
}
else
{
if (vr->cgzoommode != 4) { // much more accurate if using the scope
// add some slop to the main-fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BLASTER_MAIN_SPREAD;
angs[YAW] += Q_flrand(-1.0f, 1.0f) * BLASTER_MAIN_SPREAD;
if(vr->cgzoommode != 4) { // much more accurate if using the scope
//GB - If double handing reduce by two thirds
if(vr->weapon_stabilised)
{
// 1/3 as much variety if stabilised
angs[PITCH] += Q_flrand(-0.33f, 0.33f) * BLASTER_MAIN_SPREAD;
angs[YAW] += Q_flrand(-0.33f, 0.33f) * BLASTER_MAIN_SPREAD;
} else {
// add some slop to the main-fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BLASTER_MAIN_SPREAD;
angs[YAW] += Q_flrand(-1.0f, 1.0f) * BLASTER_MAIN_SPREAD;
}
}
}
}

View file

@ -29,6 +29,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->value)
{
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 );
@ -160,8 +169,12 @@ static void WP_BowcasterAltFire( gentity_t *ent )
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
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->value)
{
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

@ -28,6 +28,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//---------------
// Bryar Pistol
@ -69,8 +72,12 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
AngleVectors( angs, forward, NULL, NULL );
}
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->value)
{
velocity = TBDC_BRYAR_PISTOL_VEL;
}
gentity_t *missile = CreateMissile( start, forward, velocity, 10000, ent, alt_fire );
missile->classname = "bryar_proj";
missile->s.weapon = WP_BRYAR_PISTOL;

View file

@ -28,6 +28,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-------------------
// DEMP2
@ -52,7 +55,12 @@ static void WP_DEMP2_MainFire( gentity_t *ent )
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, forward, DEMP2_VELOCITY, 10000, ent );
float velocity = DEMP2_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->value)
{
velocity = TBDC_DEMP2_VELOCITY;
}
gentity_t *missile = CreateMissile( start, forward, velocity, 10000, ent );
missile->classname = "demp2_proj";
missile->s.weapon = WP_DEMP2;

View file

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

View file

@ -28,6 +28,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-------------------
// Heavy Repeater
@ -41,7 +44,12 @@ static void WP_RepeaterMainFire( gentity_t *ent, vec3_t dir, vec3_t start )
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, dir, REPEATER_VELOCITY, 10000, ent );
float velocity = REPEATER_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->value)
{
velocity = TBDC_REPEATER_VELOCITY;
}
gentity_t *missile = CreateMissile( start, dir, velocity, 10000, ent );
missile->classname = "repeater_proj";
missile->s.weapon = WP_REPEATER;
@ -105,7 +113,12 @@ static void WP_RepeaterAltFire( gentity_t *ent )
}
else
{
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->value)
{
velocity = TBDC_REPEATER_ALT_VELOCITY;
}
missile = CreateMissile( start, forward, velocity, 10000, ent, qtrue );
}
missile->classname = "repeater_alt_proj";

View file

@ -28,7 +28,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
#include <JKXR/VrClientInfo.h>
#include <JKXR/VrTBDC.h>
extern cvar_t *g_TeamBeefDirectorsCut;
//-----------------------
// Rocket Launcher
//-----------------------
@ -147,6 +149,11 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
int damage = weaponData[WP_ROCKET_LAUNCHER].damage;
float vel = ROCKET_VELOCITY;
if(ent->client && ent->client->ps.clientNum == 0 && g_TeamBeefDirectorsCut->value)
{
vel = TBDC_ROCKET_VELOCITY;
}
if ( alt_fire )
{
vel *= 0.5f;
@ -165,6 +172,7 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, forward, vel, 10000, ent, alt_fire );
missile->classname = "rocket_proj";