mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-27 14:22:18 +00:00
Half a fix of Rockets
This commit is contained in:
parent
fa197dd11e
commit
06af8b2696
7 changed files with 228 additions and 140 deletions
|
@ -131,8 +131,15 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
const ovrVector3f positionRHand = pWeapon->HeadPose.Pose.Position;
|
||||
const ovrQuatf quatLHand = pOff->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionLHand = pOff->HeadPose.Pose.Position;
|
||||
|
||||
VectorSet(pVRClientInfo->rhandposition, positionRHand.x, positionRHand.y, positionRHand.z);
|
||||
Vector4Set(pVRClientInfo->rhand_orientation_quat, quatRHand.x, quatRHand.y, quatRHand.z, quatRHand.w);
|
||||
VectorSet(pVRClientInfo->lhandposition, positionLHand.x, positionLHand.y, positionLHand.z);
|
||||
Vector4Set(pVRClientInfo->lhand_orientation_quat, quatLHand.x, quatLHand.y, quatLHand.z, quatLHand.w);
|
||||
|
||||
//Right Hand
|
||||
if(pVRClientInfo->right_handed) {
|
||||
//GB - FP Already does this so we end up with backward hands
|
||||
/*if(pVRClientInfo->right_handed) {
|
||||
VectorSet(pVRClientInfo->rhandposition, positionRHand.x, positionRHand.y, positionRHand.z);
|
||||
Vector4Set(pVRClientInfo->rhand_orientation_quat, quatRHand.x, quatRHand.y, quatRHand.z, quatRHand.w);
|
||||
VectorSet(pVRClientInfo->lhandposition, positionLHand.x, positionLHand.y, positionLHand.z);
|
||||
|
@ -142,7 +149,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
Vector4Set(pVRClientInfo->lhand_orientation_quat, quatRHand.x, quatRHand.y, quatRHand.z, quatRHand.w);
|
||||
VectorSet(pVRClientInfo->rhandposition, positionLHand.x, positionLHand.y, positionLHand.z);
|
||||
Vector4Set(pVRClientInfo->rhand_orientation_quat, quatLHand.x, quatLHand.y, quatLHand.z, quatLHand.w);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
|
|
|
@ -13222,7 +13222,7 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
|
|||
|
||||
gunOrigin = GetEyePosition();
|
||||
|
||||
if ( game->isVR && commonVr->VR_USE_MOTION_CONTROLS ) gunOrigin += commonVr->leanOffset;
|
||||
gunOrigin += commonVr->leanOffset;
|
||||
|
||||
// direction the player body is facing.
|
||||
idMat3 bodyAxis = idAngles( 0.0, viewAngles.yaw, 0.0f ).ToMat3();
|
||||
|
@ -13287,8 +13287,7 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
|
|||
}
|
||||
}
|
||||
|
||||
if (commonVr->VR_USE_MOTION_CONTROLS )
|
||||
{
|
||||
|
||||
// motion control weapon positioning.
|
||||
//-----------------------------------
|
||||
|
||||
|
@ -13443,7 +13442,7 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
|
|||
|
||||
origin -= originOffset * weapAxis;
|
||||
origin += attacherToDefault * weapAxis; // handWeaponAttacherToDefaultOffset[hand][currentWeaponIndex] * weapAxis; // add the attacher offsets
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool idPlayer::CanDualWield( int num ) const
|
||||
|
|
|
@ -56,12 +56,19 @@ const idEventDef EV_Fizzle( "<fizzle>", NULL );
|
|||
const idEventDef EV_RadiusDamage( "<radiusdmg>", "e" );
|
||||
const idEventDef EV_GetProjectileState( "getProjectileState", NULL, 'd' );
|
||||
|
||||
const idEventDef EV_CreateProjectile( "projectileCreateProjectile", "evv" );
|
||||
const idEventDef EV_LaunchProjectile( "projectileLaunchProjectile", "vvv" );
|
||||
const idEventDef EV_SetGravity( "setGravity", "f" );
|
||||
|
||||
CLASS_DECLARATION( idEntity, idProjectile )
|
||||
EVENT( EV_Explode, idProjectile::Event_Explode )
|
||||
EVENT( EV_Fizzle, idProjectile::Event_Fizzle )
|
||||
EVENT( EV_Touch, idProjectile::Event_Touch )
|
||||
EVENT( EV_RadiusDamage, idProjectile::Event_RadiusDamage )
|
||||
EVENT( EV_GetProjectileState, idProjectile::Event_GetProjectileState )
|
||||
EVENT( EV_CreateProjectile, idProjectile::Event_CreateProjectile )
|
||||
EVENT( EV_LaunchProjectile, idProjectile::Event_LaunchProjectile )
|
||||
EVENT( EV_SetGravity, idProjectile::Event_SetGravity )
|
||||
END_CLASS
|
||||
|
||||
/*
|
||||
|
@ -69,7 +76,10 @@ END_CLASS
|
|||
idProjectile::idProjectile
|
||||
================
|
||||
*/
|
||||
idProjectile::idProjectile( void ) {
|
||||
idProjectile::idProjectile() :
|
||||
launchOrigin( 0.0f ),
|
||||
launchAxis( mat3_identity )
|
||||
{
|
||||
owner = NULL;
|
||||
lightDefHandle = -1;
|
||||
thrust = 0.0f;
|
||||
|
@ -282,6 +292,7 @@ idProjectile::Launch
|
|||
*/
|
||||
void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3& pushVelocity, const float timeSinceFire, const float launchPower, const float dmgPower, const float motionThrowSpeed ) {
|
||||
float fuse;
|
||||
float startthrust;
|
||||
float endthrust;
|
||||
idVec3 velocity;
|
||||
idAngles angular_velocity;
|
||||
|
@ -295,6 +306,7 @@ void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3&
|
|||
idVec3 gravVec;
|
||||
idVec3 tmp;
|
||||
idMat3 axis;
|
||||
int thrust_start;
|
||||
int contents;
|
||||
int clipMask;
|
||||
|
||||
|
@ -306,6 +318,7 @@ void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3&
|
|||
}
|
||||
|
||||
thrust = spawnArgs.GetFloat( "thrust" );
|
||||
startthrust = spawnArgs.GetFloat( "thrust_start" );
|
||||
endthrust = spawnArgs.GetFloat( "thrust_end" );
|
||||
|
||||
spawnArgs.GetVector( "velocity", "0 0 0", velocity );
|
||||
|
@ -338,6 +351,7 @@ void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3&
|
|||
}
|
||||
|
||||
thrust *= mass;
|
||||
thrust_start = SEC2MS( startthrust ) + gameLocal.time;
|
||||
thrust_end = SEC2MS( endthrust ) + gameLocal.time;
|
||||
|
||||
lightStartTime = 0;
|
||||
|
@ -368,6 +382,13 @@ void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3&
|
|||
clipMask |= CONTENTS_PROJECTILE;
|
||||
}
|
||||
|
||||
if( !idStr::Cmp( this->GetEntityDefName(), "projectile_helltime_killer" ) )
|
||||
{
|
||||
contents = CONTENTS_MOVEABLECLIP;
|
||||
clipMask = CONTENTS_MOVEABLECLIP;
|
||||
fuse = 10.0f;
|
||||
}
|
||||
|
||||
// don't do tracers on client, we don't know origin and direction
|
||||
if ( spawnArgs.GetBool( "tracers" ) && gameLocal.random.RandomFloat() > 0.5f ) {
|
||||
SetModel( spawnArgs.GetString( "model_tracer" ) );
|
||||
|
@ -388,6 +409,9 @@ void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3&
|
|||
physicsObj.SetOrigin( start );
|
||||
physicsObj.SetAxis( axis );
|
||||
|
||||
launchOrigin = start;
|
||||
launchAxis = axis;
|
||||
|
||||
thruster.SetPosition( &physicsObj, 0, idVec3( GetPhysics()->GetBounds()[ 0 ].x, 0, 0 ) );
|
||||
|
||||
if ( !gameLocal.isClient ) {
|
||||
|
@ -773,6 +797,40 @@ void idProjectile::Event_GetProjectileState( void ) {
|
|||
idThread::ReturnInt( state );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::Event_CreateProjectile
|
||||
================
|
||||
*/
|
||||
void idProjectile::Event_CreateProjectile( idEntity* owner, const idVec3& start, const idVec3& dir )
|
||||
{
|
||||
Create( owner, start, dir );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::Event_LaunchProjectile
|
||||
================
|
||||
*/
|
||||
void idProjectile::Event_LaunchProjectile( const idVec3& start, const idVec3& dir, const idVec3& pushVelocity )
|
||||
{
|
||||
Launch( start, dir, pushVelocity );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::Event_SetGravity
|
||||
================
|
||||
*/
|
||||
void idProjectile::Event_SetGravity( float gravity )
|
||||
{
|
||||
idVec3 gravVec;
|
||||
|
||||
gravVec = gameLocal.GetGravity();
|
||||
gravVec.NormalizeFast();
|
||||
physicsObj.SetGravity( gravVec * gravity );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::Explode
|
||||
|
|
|
@ -62,6 +62,9 @@ public :
|
|||
idEntity * GetOwner( void ) const;
|
||||
void CatchProjectile( idEntity* o, const char* reflectName );
|
||||
int GetProjectileState();
|
||||
void Event_CreateProjectile( idEntity* owner, const idVec3& start, const idVec3& dir );
|
||||
void Event_LaunchProjectile( const idVec3& start, const idVec3& dir, const idVec3& pushVelocity );
|
||||
void Event_SetGravity( float gravity );
|
||||
|
||||
virtual void Think( void );
|
||||
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
|
@ -137,6 +140,9 @@ protected:
|
|||
private:
|
||||
bool netSyncPhysics;
|
||||
|
||||
idVec3 launchOrigin;
|
||||
idMat3 launchAxis;
|
||||
|
||||
void AddDefaultDamageEffect( const trace_t &collision, const idVec3 &velocity );
|
||||
|
||||
void Event_Explode( void );
|
||||
|
|
|
@ -2594,7 +2594,7 @@ void idWeapon::PresentWeapon( bool showViewModel, int hand ) {
|
|||
viewWeaponAxis = playerViewAxis;
|
||||
owner->CalculateViewFlashlightPos( viewWeaponOrigin, viewWeaponAxis, flashlightOffsets[owner->hands[vr_weaponHand.GetInteger()].currentWeapon] );
|
||||
}
|
||||
else if ( isPlayerLeftHand ) // Koz left hand
|
||||
else if ( isPlayerLeftHand || hand != vr_weaponHand.GetInteger()) // Koz left hand
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -4117,6 +4117,8 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
|
|||
int num_projectiles;
|
||||
int i;
|
||||
idMat3 axis;
|
||||
idMat3 proj_axis;
|
||||
bool forceMuzzle;
|
||||
idVec3 tmp;
|
||||
idProjectile *lastProjectile;
|
||||
|
||||
|
@ -4129,6 +4131,7 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
|
|||
attack_cone = spawnArgs.GetFloat( "attack_cone", "70" );
|
||||
projectile_spread = spawnArgs.GetFloat( "projectile_spread", "0" );
|
||||
num_projectiles = spawnArgs.GetInt( "num_projectiles", "1" );
|
||||
forceMuzzle = spawnArgs.GetBool( "forceMuzzle", "0" );
|
||||
|
||||
GetMuzzle( jointname, muzzle, axis );
|
||||
|
||||
|
@ -4151,6 +4154,10 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
|
|||
axis[2] = axis[0];
|
||||
axis[0] = -tmp;
|
||||
|
||||
proj_axis = axis;
|
||||
|
||||
if( !forceMuzzle ) // _D3XP
|
||||
{
|
||||
// make sure the projectile starts inside the monster bounding box
|
||||
const idBounds& ownerBounds = physicsObj.GetAbsBounds();
|
||||
projClip = lastProjectile->GetPhysics()->GetClipModel();
|
||||
|
@ -4159,19 +4166,26 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
|
|||
// check if the owner bounds is bigger than the projectile bounds
|
||||
if( ( ( ownerBounds[1][0] - ownerBounds[0][0] ) > ( projBounds[1][0] - projBounds[0][0] ) ) &&
|
||||
( ( ownerBounds[1][1] - ownerBounds[0][1] ) > ( projBounds[1][1] - projBounds[0][1] ) ) &&
|
||||
( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) ) {
|
||||
if ( (ownerBounds - projBounds).RayIntersection( muzzle, viewAxis[ 0 ], distance ) ) {
|
||||
( ( ownerBounds[1][2] - ownerBounds[0][2] ) > ( projBounds[1][2] - projBounds[0][2] ) ) )
|
||||
{
|
||||
if( ( ownerBounds - projBounds ).RayIntersection( muzzle, viewAxis[ 0 ], distance ) )
|
||||
{
|
||||
start = muzzle + distance * viewAxis[ 0 ];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
start = ownerBounds.GetCenter();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// projectile bounds bigger than the owner bounds, so just start it from the center
|
||||
start = ownerBounds.GetCenter();
|
||||
}
|
||||
|
||||
gameLocal.clip.Translation( tr, start, muzzle, projClip, axis, MASK_SHOT_RENDERMODEL, this );
|
||||
muzzle = tr.endpos;
|
||||
}
|
||||
|
||||
// set aiming direction
|
||||
GetAimDir( muzzle, target, this, dir );
|
||||
|
|
|
@ -325,6 +325,10 @@ public:
|
|||
float z;
|
||||
|
||||
idVec3( void );
|
||||
explicit idVec3( const float xyz )
|
||||
{
|
||||
Set( xyz, xyz, xyz );
|
||||
}
|
||||
explicit idVec3( const float x, const float y, const float z );
|
||||
|
||||
void Set( const float x, const float y, const float z );
|
||||
|
|
Loading…
Reference in a new issue