mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-02-27 05:51:21 +00:00
A number of changes
- Made Melee available - punch stormtroopers to death! (default melee damage is now 25) - Draw hand models when in melee (to be replaced with fists soon) - Made movement not reactivate saber by default (cvar controlled) - Draw open hand when saber is thrown
This commit is contained in:
parent
e488f5ce27
commit
bd0a130e6e
14 changed files with 104 additions and 42 deletions
|
@ -302,6 +302,7 @@ 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_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 +530,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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -13,6 +13,7 @@ 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_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;
|
||||
|
|
|
@ -26,6 +26,7 @@ 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_motion_enable_saber;
|
||||
cvar_t *vr_crouch_toggle;
|
||||
cvar_t *vr_irl_crouch_enabled;
|
||||
cvar_t *vr_irl_crouch_to_stand_ratio;
|
||||
|
|
|
@ -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;
|
||||
|
||||
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)
|
||||
if (vr.velocitytriggeractive)
|
||||
{
|
||||
vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity > velocityRequired);
|
||||
}
|
||||
static bool fired = false;
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -186,6 +186,7 @@ typedef struct {
|
|||
|
||||
//Hand models
|
||||
qhandle_t handModel_relaxed;
|
||||
qhandle_t handModel_fist;
|
||||
qhandle_t handModel_force;
|
||||
|
||||
qhandle_t halfShieldModel;
|
||||
|
|
|
@ -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_r.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" );
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ typedef struct {
|
|||
|
||||
//Hand models
|
||||
qhandle_t handModel_relaxed;
|
||||
qhandle_t handModel_fist;
|
||||
qhandle_t handModel_force;
|
||||
|
||||
qhandle_t saberHilt;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@ void WP_Melee( gentity_t *ent )
|
|||
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 : 25;
|
||||
float range = ent->s.number ? 64 : 32;
|
||||
|
||||
VectorMA( wpMuzzle, range, wpFwd, end );
|
||||
|
|
Loading…
Reference in a new issue