mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 13:31:03 +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
b7fed25470
commit
dfa54a439a
20 changed files with 148 additions and 71 deletions
|
@ -343,6 +343,7 @@ void VR_Init()
|
||||||
vr_force_distance_trigger = Cvar_Get( "vr_force_distance_trigger", "0.15", CVAR_ARCHIVE);
|
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_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_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_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_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_irl_crouch_to_stand_ratio = Cvar_Get ("vr_irl_crouch_to_stand_ratio", "0.65", CVAR_ARCHIVE);
|
||||||
|
@ -573,8 +574,8 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f
|
||||||
}
|
}
|
||||||
else if (strcmp(event, "chainsaw_fire") == 0) // Saber
|
else if (strcmp(event, "chainsaw_fire") == 0) // Saber
|
||||||
{
|
{
|
||||||
//Special handling for dual sabers
|
//Special handling for dual sabers / melee
|
||||||
if (vr.dualsabers)
|
if (vr.dualsabers || cl.frame.ps.weapon == WP_MELEE)
|
||||||
{
|
{
|
||||||
if (position == 4 ||
|
if (position == 4 ||
|
||||||
position == 0) // both hands
|
position == 0) // both hands
|
||||||
|
|
|
@ -91,6 +91,7 @@ typedef struct {
|
||||||
int item_selector; // 1 - weapons/gadgets/saber stance, 2 - Force powers
|
int item_selector; // 1 - weapons/gadgets/saber stance, 2 - Force powers
|
||||||
|
|
||||||
bool velocitytriggered;
|
bool velocitytriggered;
|
||||||
|
bool velocitytriggeractive;
|
||||||
float primaryswingvelocity;
|
float primaryswingvelocity;
|
||||||
bool primaryVelocityTriggeredAttack;
|
bool primaryVelocityTriggeredAttack;
|
||||||
float secondaryswingvelocity;
|
float secondaryswingvelocity;
|
||||||
|
|
|
@ -13,6 +13,7 @@ extern cvar_t *vr_force_velocity_trigger;
|
||||||
extern cvar_t *vr_force_distance_trigger;
|
extern cvar_t *vr_force_distance_trigger;
|
||||||
extern cvar_t *vr_two_handed_weapons;
|
extern cvar_t *vr_two_handed_weapons;
|
||||||
extern cvar_t *vr_force_motion_controlled;
|
extern cvar_t *vr_force_motion_controlled;
|
||||||
|
extern cvar_t *vr_motion_enable_saber;
|
||||||
extern cvar_t *vr_crouch_toggle;
|
extern cvar_t *vr_crouch_toggle;
|
||||||
extern cvar_t *vr_irl_crouch_enabled;
|
extern cvar_t *vr_irl_crouch_enabled;
|
||||||
extern cvar_t *vr_irl_crouch_to_stand_ratio;
|
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_force_distance_trigger;
|
||||||
cvar_t *vr_two_handed_weapons;
|
cvar_t *vr_two_handed_weapons;
|
||||||
cvar_t *vr_force_motion_controlled;
|
cvar_t *vr_force_motion_controlled;
|
||||||
|
cvar_t *vr_motion_enable_saber;
|
||||||
cvar_t *vr_crouch_toggle;
|
cvar_t *vr_crouch_toggle;
|
||||||
cvar_t *vr_irl_crouch_enabled;
|
cvar_t *vr_irl_crouch_enabled;
|
||||||
cvar_t *vr_irl_crouch_to_stand_ratio;
|
cvar_t *vr_irl_crouch_to_stand_ratio;
|
||||||
|
|
|
@ -500,7 +500,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
if (vr.velocitytriggered) {
|
if (vr.velocitytriggered) {
|
||||||
static bool fired = false;
|
static bool fired = false;
|
||||||
vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity >
|
vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity >
|
||||||
vr_weapon_velocity_trigger->value);
|
(vr_weapon_velocity_trigger->value / 2.0f));
|
||||||
|
|
||||||
if (fired != vr.primaryVelocityTriggeredAttack) {
|
if (fired != vr.primaryVelocityTriggeredAttack) {
|
||||||
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
||||||
|
@ -519,7 +519,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
if (vr.velocitytriggered) {
|
if (vr.velocitytriggered) {
|
||||||
static bool fired = false;
|
static bool fired = false;
|
||||||
vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity >
|
vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity >
|
||||||
vr_weapon_velocity_trigger->value);
|
(vr_weapon_velocity_trigger->value / 2.0f));
|
||||||
|
|
||||||
if (fired != vr.secondaryVelocityTriggeredAttack) {
|
if (fired != vr.secondaryVelocityTriggeredAttack) {
|
||||||
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
||||||
|
@ -538,19 +538,25 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
cl.frame.ps.weapon == WP_STUN_BATON) {
|
cl.frame.ps.weapon == WP_STUN_BATON) {
|
||||||
//Does weapon velocity trigger attack
|
//Does weapon velocity trigger attack
|
||||||
if (vr.velocitytriggered) {
|
if (vr.velocitytriggered) {
|
||||||
|
if (vr.velocitytriggeractive)
|
||||||
|
{
|
||||||
static bool fired = false;
|
static bool fired = false;
|
||||||
|
|
||||||
float velocityRequired = (cl.frame.ps.weapon == WP_SABER) ? vr_weapon_velocity_trigger->value :
|
float velocityRequired = (cl.frame.ps.weapon == WP_SABER)
|
||||||
|
? vr_weapon_velocity_trigger->value :
|
||||||
(vr_weapon_velocity_trigger->value / 2.0f);
|
(vr_weapon_velocity_trigger->value / 2.0f);
|
||||||
|
|
||||||
vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity > velocityRequired);
|
vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity >
|
||||||
|
velocityRequired);
|
||||||
//player has to be dual wielding for this to be true
|
//player has to be dual wielding for this to be true
|
||||||
if (vr.dualsabers)
|
if (vr.dualsabers)
|
||||||
{
|
{
|
||||||
vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity > velocityRequired);
|
vr.secondaryVelocityTriggeredAttack = (vr.secondaryswingvelocity >
|
||||||
|
velocityRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool triggered = vr.primaryVelocityTriggeredAttack || (vr.dualsabers && vr.secondaryVelocityTriggeredAttack);
|
bool triggered = vr.primaryVelocityTriggeredAttack ||
|
||||||
|
(vr.dualsabers && vr.secondaryVelocityTriggeredAttack);
|
||||||
if (fired != triggered)
|
if (fired != triggered)
|
||||||
{
|
{
|
||||||
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
ALOGV("**WEAPON EVENT** veocity triggered %s",
|
||||||
|
@ -560,6 +566,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
sendButtonAction("+attack", triggered);
|
sendButtonAction("+attack", triggered);
|
||||||
fired = triggered;
|
fired = triggered;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack) {
|
} else if (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack) {
|
||||||
//send a stop attack as we have an unfinished velocity attack
|
//send a stop attack as we have an unfinished velocity attack
|
||||||
vr.primaryVelocityTriggeredAttack = false;
|
vr.primaryVelocityTriggeredAttack = false;
|
||||||
|
|
|
@ -1441,6 +1441,7 @@ static void CG_RegisterGraphics( void ) {
|
||||||
|
|
||||||
//VR Hand models
|
//VR Hand models
|
||||||
cgs.media.handModel_relaxed = cgi_R_RegisterModel( "models/players/kyle/lhand_r.md3" );
|
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.handModel_force = cgi_R_RegisterModel( "models/players/kyle/lhand_f.md3" );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,7 @@ typedef struct {
|
||||||
|
|
||||||
//Hand models
|
//Hand models
|
||||||
qhandle_t handModel_relaxed;
|
qhandle_t handModel_relaxed;
|
||||||
|
qhandle_t handModel_fist;
|
||||||
qhandle_t handModel_force;
|
qhandle_t handModel_force;
|
||||||
|
|
||||||
qhandle_t halfShieldModel;
|
qhandle_t halfShieldModel;
|
||||||
|
|
|
@ -6992,9 +6992,11 @@ void CG_Player( centity_t *cent ) {
|
||||||
if (cent->gent->client->ps.clientNum == 0) {
|
if (cent->gent->client->ps.clientNum == 0) {
|
||||||
vr->velocitytriggered = (!cg.renderingThirdPerson &&
|
vr->velocitytriggered = (!cg.renderingThirdPerson &&
|
||||||
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON));
|
(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 && (g_entities[0].client->ps.SaberActive() || vr_motion_enable_saber->integer)) ||
|
||||||
|
cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
G_RagDoll(cent->gent, cent->lerpAngles);
|
G_RagDoll(cent->gent, cent->lerpAngles);
|
||||||
|
|
||||||
if ( cent->currentState.weapon )
|
if ( cent->currentState.weapon )
|
||||||
|
@ -7037,7 +7039,7 @@ Ghoul2 Insert Start
|
||||||
{//no viewentity
|
{//no viewentity
|
||||||
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
||||||
{//I am the player
|
{//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
|
{//not using saber or fists
|
||||||
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
@ -7045,7 +7047,7 @@ Ghoul2 Insert Start
|
||||||
}
|
}
|
||||||
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
||||||
{//I am the view entity
|
{//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
|
{//not using first person saber test or, if so, not using saber
|
||||||
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
@ -8156,7 +8158,7 @@ Ghoul2 Insert End
|
||||||
{//no viewentity
|
{//no viewentity
|
||||||
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
||||||
{//I am the player
|
{//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
|
{//not using saber or fists
|
||||||
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
@ -8164,7 +8166,7 @@ Ghoul2 Insert End
|
||||||
}
|
}
|
||||||
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
||||||
{//I am the view entity
|
{//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
|
{//not using saber or fists
|
||||||
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
|
|
@ -2355,13 +2355,13 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Render hand models when appropriate
|
//Render hand models when appropriate
|
||||||
if (!in_camera
|
if (cg.snap->ps.clientNum == 0
|
||||||
|
&& !in_camera
|
||||||
&& !cg.renderingThirdPerson
|
&& !cg.renderingThirdPerson
|
||||||
&& cg.predicted_player_state.stats[STAT_HEALTH] > 0
|
&& cg.predicted_player_state.stats[STAT_HEALTH] > 0
|
||||||
&& cg.snap->ps.viewEntity < ENTITYNUM_WORLD
|
&& cg.snap->ps.viewEntity < ENTITYNUM_WORLD
|
||||||
&& g_entities[cg.snap->ps.viewEntity].client
|
&& g_entities[cg.snap->ps.viewEntity].client
|
||||||
&& !(g_entities[cg.snap->ps.viewEntity].client->ps.dualSabers && cg.snap->ps.weapon == WP_SABER)
|
&& !(g_entities[cg.snap->ps.viewEntity].client->ps.dualSabers && cg.snap->ps.weapon == WP_SABER)
|
||||||
&& cg.snap->ps.weapon != WP_MELEE
|
|
||||||
&& !vr->weapon_stabilised
|
&& !vr->weapon_stabilised
|
||||||
&& !vr->in_vehicle
|
&& !vr->in_vehicle
|
||||||
&& !cg_pano.integer
|
&& !cg_pano.integer
|
||||||
|
@ -2388,6 +2388,10 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
||||||
{
|
{
|
||||||
handEnt.hModel = cgs.media.handModel_force;
|
handEnt.hModel = cgs.media.handModel_force;
|
||||||
}
|
}
|
||||||
|
else if (cg.snap->ps.weapon == WP_MELEE)
|
||||||
|
{
|
||||||
|
handEnt.hModel = cgs.media.handModel_fist;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handEnt.hModel = cgs.media.handModel_relaxed;
|
handEnt.hModel = cgs.media.handModel_relaxed;
|
||||||
|
@ -2399,20 +2403,28 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
||||||
VectorScale( handEnt.axis[i], (vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
|
VectorScale( handEnt.axis[i], (vr->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
centity_t *cent = &cg_entities[cg.snap->ps.clientNum];
|
centity_t *cent = &cg_entities[0];
|
||||||
if (!cent)
|
CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent, true);
|
||||||
|
|
||||||
|
if (cg.snap->ps.weapon == WP_NONE ||
|
||||||
|
cg.snap->ps.weapon == WP_MELEE ||
|
||||||
|
(cg.snap->ps.weapon == WP_SABER && cg.snap->ps.saberInFlight))
|
||||||
{
|
{
|
||||||
cgi_R_AddRefEntityToScene(&handEnt);
|
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
|
else
|
||||||
{
|
{
|
||||||
CG_AddRefEntityWithPowerups(&handEnt, cent->currentState.powerups, cent, true);
|
handEnt.hModel = cgs.media.handModel_relaxed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cg.snap->ps.weapon == WP_NONE)
|
|
||||||
{
|
|
||||||
BG_CalculateVRDefaultPosition(0, handEnt.origin, handEnt.angles);
|
|
||||||
|
|
||||||
//Move it back a bit?
|
//Move it back a bit?
|
||||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||||
VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin );
|
VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin );
|
||||||
|
|
|
@ -3118,8 +3118,7 @@ void CG_DrawItemSelector( void )
|
||||||
|
|
||||||
if (cg.itemSelectorType == ST_WEAPON) // weapons
|
if (cg.itemSelectorType == ST_WEAPON) // weapons
|
||||||
{
|
{
|
||||||
if (cg.weaponSelect != WP_NONE &&
|
if (cg.weaponSelect != WP_NONE) {
|
||||||
cg.weaponSelect != WP_MELEE) {
|
|
||||||
refEntity_t sprite;
|
refEntity_t sprite;
|
||||||
memset(&sprite, 0, sizeof(sprite));
|
memset(&sprite, 0, sizeof(sprite));
|
||||||
VectorCopy(wheelOrigin, sprite.origin);
|
VectorCopy(wheelOrigin, sprite.origin);
|
||||||
|
@ -3206,10 +3205,9 @@ void CG_DrawItemSelector( void )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemId = index + 1; // We need to ignore WP_NONE for weapons
|
if (itemId == 0)
|
||||||
if (itemId == count)
|
|
||||||
{
|
{
|
||||||
break;
|
itemId = WP_MELEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CG_RegisterWeapon(itemId);
|
CG_RegisterWeapon(itemId);
|
||||||
|
@ -3245,8 +3243,7 @@ void CG_DrawItemSelector( void )
|
||||||
VectorClear(angles);
|
VectorClear(angles);
|
||||||
angles[YAW] = wheelAngles[YAW];
|
angles[YAW] = wheelAngles[YAW];
|
||||||
angles[PITCH] = wheelAngles[PITCH];
|
angles[PITCH] = wheelAngles[PITCH];
|
||||||
angles[ROLL] =
|
angles[ROLL] = (float)(360 / count) * index;
|
||||||
(float)(360 / (count - ((cg.itemSelectorType == ST_WEAPON && !vr->in_vehicle) ? 1 : 0))) * index;
|
|
||||||
vec3_t forward, up;
|
vec3_t forward, up;
|
||||||
AngleVectors(angles, forward, NULL, up);
|
AngleVectors(angles, forward, NULL, up);
|
||||||
|
|
||||||
|
@ -3487,7 +3484,9 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire )
|
||||||
//Haptics
|
//Haptics
|
||||||
switch (ent->weapon) {
|
switch (ent->weapon) {
|
||||||
case WP_SABER:
|
case WP_SABER:
|
||||||
if (cent->gent->client->ps.dualSabers)
|
case WP_MELEE:
|
||||||
|
if (cent->gent->client->ps.dualSabers ||
|
||||||
|
ent->weapon == WP_MELEE)
|
||||||
{
|
{
|
||||||
if (vr->primaryVelocityTriggeredAttack && vr->secondaryVelocityTriggeredAttack)
|
if (vr->primaryVelocityTriggeredAttack && vr->secondaryVelocityTriggeredAttack)
|
||||||
{
|
{
|
||||||
|
@ -3506,7 +3505,8 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire )
|
||||||
position = -1;
|
position = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
|
||||||
|
cgi_HapticEvent( "chainsaw_fire", position, 0, 40, 0, 0);
|
||||||
break;
|
break;
|
||||||
case WP_BRYAR_PISTOL:
|
case WP_BRYAR_PISTOL:
|
||||||
case WP_BOWCASTER:
|
case WP_BOWCASTER:
|
||||||
|
|
|
@ -2260,7 +2260,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded
|
||||||
|
|
||||||
// give default weapons
|
// give default weapons
|
||||||
//these are precached in g_items, ClearRegisteredItems()
|
//these are precached in g_items, ClearRegisteredItems()
|
||||||
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE );
|
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MELEE );
|
||||||
//client->ps.inventory[INV_ELECTROBINOCULARS] = 1;
|
//client->ps.inventory[INV_ELECTROBINOCULARS] = 1;
|
||||||
//ent->client->ps.inventory[INV_BACTA_CANISTER] = 1;
|
//ent->client->ps.inventory[INV_BACTA_CANISTER] = 1;
|
||||||
|
|
||||||
|
@ -2406,7 +2406,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded
|
||||||
|
|
||||||
if ( spawnPoint->spawnflags & 64 ) //NOWEAPON
|
if ( spawnPoint->spawnflags & 64 ) //NOWEAPON
|
||||||
{//player starts with absolutely no weapons
|
{//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;
|
ent->client->ps.ammo[weaponData[WP_NONE].ammoIndex] = 32000;
|
||||||
ent->client->ps.weapon = WP_NONE;
|
ent->client->ps.weapon = WP_NONE;
|
||||||
ent->client->ps.weaponstate = WEAPON_READY;
|
ent->client->ps.weaponstate = WEAPON_READY;
|
||||||
|
|
|
@ -32,7 +32,7 @@ void WP_Melee( gentity_t *ent )
|
||||||
gentity_t *tr_ent;
|
gentity_t *tr_ent;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
vec3_t mins, maxs, end;
|
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;
|
float range = ent->s.number ? 64 : 32;
|
||||||
|
|
||||||
VectorMA( muzzle, range, forwardVec, end );
|
VectorMA( muzzle, range, forwardVec, end );
|
||||||
|
|
|
@ -1317,6 +1317,7 @@ static void CG_RegisterGraphics( void ) {
|
||||||
|
|
||||||
//VR Hand models
|
//VR Hand models
|
||||||
cgs.media.handModel_relaxed = cgi_R_RegisterModel( "models/players/kyle/lhand_r.md3" );
|
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.handModel_force = cgi_R_RegisterModel( "models/players/kyle/lhand_f.md3" );
|
||||||
cgs.media.saberHilt = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
|
cgs.media.saberHilt = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,7 @@ typedef struct {
|
||||||
|
|
||||||
//Hand models
|
//Hand models
|
||||||
qhandle_t handModel_relaxed;
|
qhandle_t handModel_relaxed;
|
||||||
|
qhandle_t handModel_fist;
|
||||||
qhandle_t handModel_force;
|
qhandle_t handModel_force;
|
||||||
|
|
||||||
qhandle_t saberHilt;
|
qhandle_t saberHilt;
|
||||||
|
|
|
@ -4588,6 +4588,9 @@ Ghoul2 Insert End
|
||||||
{
|
{
|
||||||
if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) )
|
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) )
|
if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) )
|
||||||
{
|
{
|
||||||
|
@ -4607,6 +4610,9 @@ Ghoul2 Insert End
|
||||||
}
|
}
|
||||||
else
|
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 );
|
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.
|
// All I need is a bool to mark whether I have a previous point to work with.
|
||||||
//....come up with something better..
|
//....come up with something better..
|
||||||
|
@ -4897,6 +4903,9 @@ void CG_Player(centity_t *cent ) {
|
||||||
if (cent->gent->client->ps.clientNum == 0) {
|
if (cent->gent->client->ps.clientNum == 0) {
|
||||||
vr->velocitytriggered = (!cg.renderingThirdPerson &&
|
vr->velocitytriggered = (!cg.renderingThirdPerson &&
|
||||||
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON));
|
(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
|
//Get the player's light level for stealth calculations
|
||||||
|
@ -5076,7 +5085,7 @@ Ghoul2 Insert Start
|
||||||
{//no viewentity
|
{//no viewentity
|
||||||
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
||||||
{//I am the player
|
{//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
|
{//not using saber or fists
|
||||||
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
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 )
|
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
||||||
{//I am the view entity
|
{//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
|
{//not using first person saber test or, if so, not using saber
|
||||||
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
ent.renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
@ -5749,7 +5758,7 @@ Ghoul2 Insert End
|
||||||
{//no viewentity
|
{//no viewentity
|
||||||
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
if ( cent->currentState.number == cg.snap->ps.clientNum )
|
||||||
{//I am the player
|
{//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
|
{//not using saber or fists
|
||||||
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
@ -5757,7 +5766,7 @@ Ghoul2 Insert End
|
||||||
}
|
}
|
||||||
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
else if ( cent->currentState.number == cg.snap->ps.viewEntity )
|
||||||
{//I am the view entity
|
{//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
|
{//not using saber or fists
|
||||||
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
renderfx = RF_THIRD_PERSON; // only draw in mirrors
|
||||||
}
|
}
|
||||||
|
|
|
@ -2033,10 +2033,10 @@ wasForceSpeed=isForceSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Render hand models when appropriate
|
//Render hand models when appropriate
|
||||||
if (!in_camera
|
if (cg.snap->ps.clientNum == 0
|
||||||
|
&& !in_camera
|
||||||
&& !cg.renderingThirdPerson
|
&& !cg.renderingThirdPerson
|
||||||
&& cg.predicted_player_state.stats[STAT_HEALTH] > 0
|
&& cg.predicted_player_state.stats[STAT_HEALTH] > 0
|
||||||
&& cg.snap->ps.weapon != WP_MELEE
|
|
||||||
&& !vr->weapon_stabilised
|
&& !vr->weapon_stabilised
|
||||||
&& !vr->in_vehicle
|
&& !vr->in_vehicle
|
||||||
&& !cg_pano.integer
|
&& !cg_pano.integer
|
||||||
|
@ -2060,6 +2060,10 @@ wasForceSpeed=isForceSpeed;
|
||||||
{
|
{
|
||||||
handEnt.hModel = cgs.media.handModel_force;
|
handEnt.hModel = cgs.media.handModel_force;
|
||||||
}
|
}
|
||||||
|
else if (cg.snap->ps.weapon == WP_MELEE)
|
||||||
|
{
|
||||||
|
handEnt.hModel = cgs.media.handModel_fist;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handEnt.hModel = cgs.media.handModel_relaxed;
|
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] );
|
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);
|
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?
|
//Move it back a bit?
|
||||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||||
VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin );
|
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] );
|
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.itemSelectorType == ST_WEAPON) // weapons
|
||||||
{
|
{
|
||||||
if (cg.weaponSelect != WP_NONE &&
|
if (cg.weaponSelect != WP_NONE) {
|
||||||
cg.weaponSelect != WP_MELEE) {
|
|
||||||
refEntity_t sprite;
|
refEntity_t sprite;
|
||||||
memset(&sprite, 0, sizeof(sprite));
|
memset(&sprite, 0, sizeof(sprite));
|
||||||
VectorCopy(wheelOrigin, sprite.origin);
|
VectorCopy(wheelOrigin, sprite.origin);
|
||||||
|
@ -3036,10 +3035,9 @@ void CG_DrawItemSelector( void )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemId = index + 1; // We need to ignore WP_NONE for weapons
|
if (itemId == WP_NONE)
|
||||||
if (itemId == count)
|
|
||||||
{
|
{
|
||||||
break;
|
itemId = WP_MELEE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3078,8 +3076,7 @@ void CG_DrawItemSelector( void )
|
||||||
VectorClear(angles);
|
VectorClear(angles);
|
||||||
angles[YAW] = wheelAngles[YAW];
|
angles[YAW] = wheelAngles[YAW];
|
||||||
angles[PITCH] = wheelAngles[PITCH];
|
angles[PITCH] = wheelAngles[PITCH];
|
||||||
angles[ROLL] =
|
angles[ROLL] = (float)(360 / count) * index;
|
||||||
(float)(360 / (count - ((cg.itemSelectorType == ST_WEAPON && !vr->in_vehicle) ? 1 : 0))) * index;
|
|
||||||
vec3_t forward, up;
|
vec3_t forward, up;
|
||||||
AngleVectors(angles, forward, NULL, up);
|
AngleVectors(angles, forward, NULL, up);
|
||||||
|
|
||||||
|
@ -3311,6 +3308,28 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire )
|
||||||
case WP_SABER:
|
case WP_SABER:
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
||||||
break;
|
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_BRYAR_PISTOL:
|
||||||
case WP_BOWCASTER:
|
case WP_BOWCASTER:
|
||||||
case WP_BLASTER:
|
case WP_BLASTER:
|
||||||
|
|
|
@ -1645,7 +1645,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded
|
||||||
client->ps.clientNum = index;
|
client->ps.clientNum = index;
|
||||||
|
|
||||||
// give default weapons
|
// 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.stats[STAT_WEAPONS] |= ( 1 << WP_BRYAR_PISTOL ); //these are precached in g_items, ClearRegisteredItems()
|
||||||
client->ps.inventory[INV_ELECTROBINOCULARS] = 1;
|
client->ps.inventory[INV_ELECTROBINOCULARS] = 1;
|
||||||
|
|
||||||
|
@ -1766,7 +1766,7 @@ qboolean ClientSpawn(gentity_t *ent, SavedGameJustLoaded_e eSavedGameJustLoaded
|
||||||
|
|
||||||
if ( spawnPoint->spawnflags & 64 )
|
if ( spawnPoint->spawnflags & 64 )
|
||||||
{//player starts with absolutely no weapons
|
{//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.ammo[weaponData[WP_NONE].ammoIndex] = 32000; // checkme
|
||||||
ent->client->ps.weapon = WP_NONE;
|
ent->client->ps.weapon = WP_NONE;
|
||||||
ent->client->ps.weaponstate = WEAPON_READY;
|
ent->client->ps.weaponstate = WEAPON_READY;
|
||||||
|
|
|
@ -84,7 +84,7 @@ typedef enum //# weapon_e
|
||||||
} weapon_t;
|
} weapon_t;
|
||||||
|
|
||||||
#define FIRST_WEAPON WP_SABER // this is the first weapon for next and prev weapon switching
|
#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
|
// AMMO_NONE must be first and AMMO_MAX must be last, cause weapon load validates based off of these vals
|
||||||
typedef enum //# ammo_e
|
typedef enum //# ammo_e
|
||||||
|
|
|
@ -36,7 +36,7 @@ void WP_Melee( gentity_t *ent )
|
||||||
gentity_t *tr_ent;
|
gentity_t *tr_ent;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
vec3_t mins, maxs, end;
|
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;
|
float range = ent->s.number ? 64 : 32;
|
||||||
|
|
||||||
VectorMA( wpMuzzle, range, wpFwd, end );
|
VectorMA( wpMuzzle, range, wpFwd, end );
|
||||||
|
|
Loading…
Reference in a new issue