mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
ATST fixes
- Push muzzle flash away so it doesn't blind player - Ensure ATST sounds play even though player is in first person (cg_players.cpp) - Slight improvement to position of hand models - Weapon selector shows the two Main/Side options for ATST
This commit is contained in:
parent
d78ed1f40e
commit
3b139bb537
4 changed files with 88 additions and 28 deletions
|
@ -1166,7 +1166,7 @@ void CG_PlayerAnimSounds( int animFileIndex, qboolean torso, int oldFrame, int f
|
|||
}
|
||||
}
|
||||
|
||||
if ( entNum == 0 && !cg.renderingThirdPerson )//!cg_thirdPerson.integer )
|
||||
if ( entNum == 0 && !cg.renderingThirdPerson && !vr->in_vehicle)//!cg_thirdPerson.integer )
|
||||
{//player in first person view does not play any keyframed sounds
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2032,11 +2032,13 @@ wasForceSpeed=isForceSpeed;
|
|||
&g_entities[cg.snap->ps.viewEntity].client->ps); // HAX - because I wanted to --eez
|
||||
}
|
||||
|
||||
//Render hand models when appropriate
|
||||
if (!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
|
||||
&& (cg.snap->ps.viewEntity == 0 || cg.snap->ps.viewEntity >= ENTITYNUM_WORLD))
|
||||
{
|
||||
|
@ -2047,7 +2049,7 @@ wasForceSpeed=isForceSpeed;
|
|||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
VectorMA( handEnt.origin, -1.0f, forward, handEnt.origin );
|
||||
VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin );
|
||||
|
||||
|
||||
handEnt.renderfx = RF_DEPTHHACK | RF_VRVIEWMODEL;
|
||||
|
@ -2077,7 +2079,7 @@ wasForceSpeed=isForceSpeed;
|
|||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
VectorMA( handEnt.origin, -1.0f, forward, handEnt.origin );
|
||||
VectorMA( handEnt.origin, -3.0f, forward, handEnt.origin );
|
||||
VectorCopy(handEnt.origin, handEnt.oldorigin);
|
||||
|
||||
vec3_t axis[3];
|
||||
|
|
|
@ -1156,10 +1156,16 @@ void CG_AddViewWeapon( playerState_t *ps )
|
|||
|
||||
// set up gun position
|
||||
float scale = CG_CalculateWeaponPositionAndScale( ps, hand.origin, angles );
|
||||
|
||||
if (vr->in_vehicle)
|
||||
{
|
||||
//Shunt the origin up if we are in a vehicle to avoid blinding the player with a muzzle flash
|
||||
VectorMA( hand.origin, 2.0f * cg_worldScale.value, cg.refdef.viewaxis[2], hand.origin );
|
||||
}
|
||||
|
||||
VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[0], hand.origin );
|
||||
VectorMA( hand.origin, (cg_gun_y.value+leanOffset), cg.refdef.viewaxis[1], hand.origin );
|
||||
VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );
|
||||
// VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[0], hand.origin );
|
||||
// VectorMA( hand.origin, (cg_gun_y.value+leanOffset), cg.refdef.viewaxis[1], hand.origin );
|
||||
// VectorMA( hand.origin, (cg_gun_z.value+fovOffset), cg.refdef.viewaxis[2], hand.origin );
|
||||
|
||||
AnglesToAxis( angles, hand.axis );
|
||||
|
||||
|
@ -2814,8 +2820,7 @@ qboolean ForcePower_Valid(int index);
|
|||
|
||||
void CG_DrawItemSelector( void )
|
||||
{
|
||||
if (cg.predicted_player_state.stats[STAT_HEALTH] <= 0 ||
|
||||
(g_entities[0].client && g_entities[0].client->NPC_class != CLASS_KYLE))
|
||||
if (cg.predicted_player_state.stats[STAT_HEALTH] <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2898,7 +2903,10 @@ void CG_DrawItemSelector( void )
|
|||
switch (cg.itemSelectorType)
|
||||
{
|
||||
case 0: //weapons
|
||||
count = WP_MELEE;
|
||||
if (vr->in_vehicle)
|
||||
count = 2;
|
||||
else
|
||||
count = WP_MELEE;
|
||||
beam.shaderRGBA[0] = 0xff;
|
||||
beam.shaderRGBA[1] = 0xae;
|
||||
beam.shaderRGBA[2] = 0x40;
|
||||
|
@ -3010,26 +3018,33 @@ void CG_DrawItemSelector( void )
|
|||
{
|
||||
int itemId = index;
|
||||
if (cg.itemSelectorType == 0) {
|
||||
itemId = index+1; // We need to ignore WP_NONE for weapons
|
||||
if (itemId == count)
|
||||
if (vr->in_vehicle)
|
||||
{
|
||||
break;
|
||||
itemId = WP_ATST_MAIN + index;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = index + 1; // We need to ignore WP_NONE for weapons
|
||||
if (itemId == count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef _DEMO
|
||||
if (itemId == WP_SABER ||
|
||||
itemId == WP_BRYAR_PISTOL ||
|
||||
itemId == WP_BLASTER ||
|
||||
itemId == WP_FLECHETTE ||
|
||||
itemId == WP_REPEATER ||
|
||||
itemId == WP_THERMAL) {
|
||||
CG_RegisterWeapon(itemId);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (itemId == WP_SABER ||
|
||||
itemId == WP_BRYAR_PISTOL ||
|
||||
itemId == WP_BLASTER ||
|
||||
itemId == WP_FLECHETTE ||
|
||||
itemId == WP_REPEATER ||
|
||||
itemId == WP_THERMAL) {
|
||||
CG_RegisterWeapon(itemId);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
CG_RegisterWeapon(itemId);
|
||||
CG_RegisterWeapon(itemId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -3037,7 +3052,8 @@ void CG_DrawItemSelector( void )
|
|||
switch (cg.itemSelectorType)
|
||||
{
|
||||
case 0: //weapons
|
||||
selectable = CG_WeaponSelectable(itemId, cg.weaponSelect, qfalse) && cg.snap->ps.ammo[weaponData[itemId].ammoIndex];
|
||||
selectable = vr->in_vehicle || // both ATST weapons are always selectable
|
||||
(CG_WeaponSelectable(itemId, cg.weaponSelect, qfalse) && cg.snap->ps.ammo[weaponData[itemId].ammoIndex]);
|
||||
break;
|
||||
case 1: //gadgets
|
||||
selectable = CG_InventorySelectable(itemId) && inv_icons[itemId];
|
||||
|
@ -3063,7 +3079,7 @@ void CG_DrawItemSelector( void )
|
|||
angles[YAW] = wheelAngles[YAW];
|
||||
angles[PITCH] = wheelAngles[PITCH];
|
||||
angles[ROLL] =
|
||||
(float)(360 / (count - ((cg.itemSelectorType == 0) ? 1 : 0))) * index;
|
||||
(float)(360 / (count - ((cg.itemSelectorType == 0 && !vr->in_vehicle) ? 1 : 0))) * index;
|
||||
vec3_t forward, up;
|
||||
AngleVectors(angles, forward, NULL, up);
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wp_saber.h"
|
||||
#include "w_local.h"
|
||||
#include "g_functions.h"
|
||||
#include "bg_local.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
// ATST Main
|
||||
//---------------------------------------------------------
|
||||
|
@ -40,13 +42,27 @@ void WP_ATSTMainFire( gentity_t *ent )
|
|||
// vel = 4500.0f;
|
||||
// }
|
||||
|
||||
|
||||
vec3_t dir, angs, start;
|
||||
|
||||
if ( BG_UseVRPosition(ent) )
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors( angs, dir, NULL, NULL );
|
||||
}
|
||||
else {
|
||||
VectorCopy(wpMuzzle, start);
|
||||
VectorCopy(wpFwd, dir);
|
||||
vectoangles(wpFwd, angs);
|
||||
}
|
||||
|
||||
if ( !ent->s.number )
|
||||
{
|
||||
// player shoots faster
|
||||
vel *= 1.6f;
|
||||
}
|
||||
|
||||
gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent );
|
||||
gentity_t *missile = CreateMissile( start, dir, vel, 10000, ent );
|
||||
|
||||
missile->classname = "atst_main_proj";
|
||||
missile->s.weapon = WP_ATST_MAIN;
|
||||
|
@ -76,7 +92,20 @@ void WP_ATSTSideAltFire( gentity_t *ent )
|
|||
vel = ATST_SIDE_ALT_VELOCITY;
|
||||
}
|
||||
|
||||
gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent, qtrue );
|
||||
vec3_t dir, angs, start;
|
||||
|
||||
if ( BG_UseVRPosition(ent) )
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors( angs, dir, NULL, NULL );
|
||||
}
|
||||
else {
|
||||
VectorCopy(wpMuzzle, start);
|
||||
VectorCopy(wpFwd, dir);
|
||||
vectoangles(wpFwd, angs);
|
||||
}
|
||||
|
||||
gentity_t *missile = CreateMissile( start, dir, vel, 10000, ent, qtrue );
|
||||
|
||||
missile->classname = "atst_rocket";
|
||||
missile->s.weapon = WP_ATST_SIDE;
|
||||
|
@ -127,7 +156,20 @@ void WP_ATSTSideFire( gentity_t *ent )
|
|||
{
|
||||
int damage = weaponData[WP_ATST_SIDE].damage;
|
||||
|
||||
gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, ATST_SIDE_MAIN_VELOCITY, 10000, ent, qfalse );
|
||||
vec3_t dir, angs, start;
|
||||
|
||||
if ( BG_UseVRPosition(ent) )
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors( angs, dir, NULL, NULL );
|
||||
}
|
||||
else {
|
||||
VectorCopy(wpMuzzle, start);
|
||||
VectorCopy(wpFwd, dir);
|
||||
vectoangles(wpFwd, angs);
|
||||
}
|
||||
|
||||
gentity_t *missile = CreateMissile( start, dir, ATST_SIDE_MAIN_VELOCITY, 10000, ent, qfalse );
|
||||
|
||||
missile->classname = "atst_side_proj";
|
||||
missile->s.weapon = WP_ATST_SIDE;
|
||||
|
|
Loading…
Reference in a new issue