mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-23 20:32:44 +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,163 +13287,162 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
|
|||
}
|
||||
}
|
||||
|
||||
if (commonVr->VR_USE_MOTION_CONTROLS )
|
||||
{
|
||||
// motion control weapon positioning.
|
||||
//-----------------------------------
|
||||
|
||||
idVec3 weapOrigin = vec3_zero;
|
||||
idMat3 weapAxis = mat3_identity;
|
||||
// motion control weapon positioning.
|
||||
//-----------------------------------
|
||||
|
||||
// idVec3 fixPosVec = idVec3( -17.0f, 6.0f, 0.0f );
|
||||
// idVec3 fixPos = fixPosVec;
|
||||
// idQuat fixRot = idAngles( 40.0f, -40.0f, 20.0f ).ToQuat();
|
||||
idVec3 attacherToDefault = vec3_zero;
|
||||
// idMat3 rot180 = idAngles( 0.0f, 180.0f, 0.0f ).ToMat3();
|
||||
idVec3 weapOrigin = vec3_zero;
|
||||
idMat3 weapAxis = mat3_identity;
|
||||
|
||||
if ( !hands[ hand ].PDAfixed && currentWeaponEnum == WEAPON_PDA )
|
||||
{
|
||||
// do the non-PDA hand first (the hand with the pointy finger)
|
||||
int fingerHand = 1 - hand;
|
||||
// idVec3 fixPosVec = idVec3( -17.0f, 6.0f, 0.0f );
|
||||
// idVec3 fixPos = fixPosVec;
|
||||
// idQuat fixRot = idAngles( 40.0f, -40.0f, 20.0f ).ToQuat();
|
||||
idVec3 attacherToDefault = vec3_zero;
|
||||
// idMat3 rot180 = idAngles( 0.0f, 180.0f, 0.0f ).ToMat3();
|
||||
|
||||
attacherToDefault = handWeaponAttacherToDefaultOffset[fingerHand][currentWeaponIndex];
|
||||
originOffset = weapon->weaponHandDefaultPos[fingerHand];
|
||||
commonVr->MotionControlGetHand( fingerHand, hands[fingerHand].motionPosition, hands[fingerHand].motionRotation );
|
||||
if ( !hands[ hand ].PDAfixed && currentWeaponEnum == WEAPON_PDA )
|
||||
{
|
||||
// do the non-PDA hand first (the hand with the pointy finger)
|
||||
int fingerHand = 1 - hand;
|
||||
|
||||
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.f, 0.0f ).ToQuat();
|
||||
hands[fingerHand].motionRotation = weaponPitch * hands[fingerHand].motionRotation;
|
||||
attacherToDefault = handWeaponAttacherToDefaultOffset[fingerHand][currentWeaponIndex];
|
||||
originOffset = weapon->weaponHandDefaultPos[fingerHand];
|
||||
commonVr->MotionControlGetHand( fingerHand, hands[fingerHand].motionPosition, hands[fingerHand].motionRotation );
|
||||
|
||||
GetViewPos( weapOrigin, weapAxis );
|
||||
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.f, 0.0f ).ToQuat();
|
||||
hands[fingerHand].motionRotation = weaponPitch * hands[fingerHand].motionRotation;
|
||||
|
||||
weapOrigin += commonVr->leanOffset;
|
||||
//commonVr->HMDGetOrientation( hmdAngles, headPositionDelta, bodyPositionDelta, absolutePosition, false );// gameLocal.inCinematic );
|
||||
GetViewPos( weapOrigin, weapAxis );
|
||||
|
||||
hmdAngles = commonVr->poseHmdAngles;
|
||||
headPositionDelta = commonVr->poseHmdHeadPositionDelta;
|
||||
bodyPositionDelta = commonVr->poseHmdBodyPositionDelta;
|
||||
absolutePosition = commonVr->poseHmdAbsolutePosition;
|
||||
weapOrigin += commonVr->leanOffset;
|
||||
//commonVr->HMDGetOrientation( hmdAngles, headPositionDelta, bodyPositionDelta, absolutePosition, false );// gameLocal.inCinematic );
|
||||
|
||||
hmdAngles = commonVr->poseHmdAngles;
|
||||
headPositionDelta = commonVr->poseHmdHeadPositionDelta;
|
||||
bodyPositionDelta = commonVr->poseHmdBodyPositionDelta;
|
||||
absolutePosition = commonVr->poseHmdAbsolutePosition;
|
||||
|
||||
|
||||
|
||||
weapAxis = idAngles( 0.0, weapAxis.ToAngles().yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
|
||||
weapAxis = idAngles( 0.0, weapAxis.ToAngles().yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
|
||||
|
||||
weapOrigin += weapAxis[0] * headPositionDelta.x + weapAxis[1] * headPositionDelta.y + weapAxis[2] * headPositionDelta.z;
|
||||
weapOrigin += weapAxis[0] * headPositionDelta.x + weapAxis[1] * headPositionDelta.y + weapAxis[2] * headPositionDelta.z;
|
||||
|
||||
weapOrigin += hands[fingerHand].motionPosition * weapAxis;
|
||||
weapAxis = hands[fingerHand].motionRotation.ToMat3() * weapAxis;
|
||||
weapOrigin += hands[fingerHand].motionPosition * weapAxis;
|
||||
weapAxis = hands[fingerHand].motionRotation.ToMat3() * weapAxis;
|
||||
|
||||
//weapon->CalculateHideRise( weapOrigin, weapAxis );
|
||||
//weapon->CalculateHideRise( weapOrigin, weapAxis );
|
||||
|
||||
idAngles motRot = hands[fingerHand].motionRotation.ToAngles();
|
||||
motRot.yaw -= commonVr->bodyYawOffset;
|
||||
motRot.Normalize180();
|
||||
hands[fingerHand].motionRotation = motRot.ToQuat();
|
||||
idAngles motRot = hands[fingerHand].motionRotation.ToAngles();
|
||||
motRot.yaw -= commonVr->bodyYawOffset;
|
||||
motRot.Normalize180();
|
||||
hands[fingerHand].motionRotation = motRot.ToQuat();
|
||||
|
||||
SetHandIKPos( fingerHand, weapOrigin, weapAxis, hands[fingerHand].motionRotation, false );
|
||||
SetHandIKPos( fingerHand, weapOrigin, weapAxis, hands[fingerHand].motionRotation, false );
|
||||
|
||||
// now switch hands and fall through again.,
|
||||
}
|
||||
// NOT the PDA
|
||||
// now switch hands and fall through again.,
|
||||
}
|
||||
// NOT the PDA
|
||||
|
||||
attacherToDefault = handWeaponAttacherToDefaultOffset[hand][currentWeaponIndex];
|
||||
originOffset = weapon->weaponHandDefaultPos[hand];
|
||||
attacherToDefault = handWeaponAttacherToDefaultOffset[hand][currentWeaponIndex];
|
||||
originOffset = weapon->weaponHandDefaultPos[hand];
|
||||
|
||||
commonVr->MotionControlGetHand( hand, hands[ hand ].motionPosition, hands[ hand ].motionRotation );
|
||||
commonVr->MotionControlGetHand( hand, hands[ hand ].motionPosition, hands[ hand ].motionRotation );
|
||||
|
||||
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.0f, 0.0f ).ToQuat();
|
||||
hands[ hand ].motionRotation = weaponPitch * hands[ hand ].motionRotation;
|
||||
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.0f, 0.0f ).ToQuat();
|
||||
hands[ hand ].motionRotation = weaponPitch * hands[ hand ].motionRotation;
|
||||
|
||||
GetViewPos( weapOrigin, weapAxis );
|
||||
GetViewPos( weapOrigin, weapAxis );
|
||||
|
||||
weapOrigin += commonVr->leanOffset;
|
||||
weapOrigin += commonVr->leanOffset;
|
||||
|
||||
//commonVr->HMDGetOrientation( hmdAngles, headPositionDelta, bodyPositionDelta, absolutePosition, false );// gameLocal.inCinematic );
|
||||
//commonVr->HMDGetOrientation( hmdAngles, headPositionDelta, bodyPositionDelta, absolutePosition, false );// gameLocal.inCinematic );
|
||||
|
||||
hmdAngles = commonVr->poseHmdAngles;
|
||||
headPositionDelta = commonVr->poseHmdHeadPositionDelta;
|
||||
bodyPositionDelta = commonVr->poseHmdBodyPositionDelta;
|
||||
absolutePosition = commonVr->poseHmdAbsolutePosition;
|
||||
hmdAngles = commonVr->poseHmdAngles;
|
||||
headPositionDelta = commonVr->poseHmdHeadPositionDelta;
|
||||
bodyPositionDelta = commonVr->poseHmdBodyPositionDelta;
|
||||
absolutePosition = commonVr->poseHmdAbsolutePosition;
|
||||
|
||||
|
||||
weapAxis = idAngles( 0.0f, weapAxis.ToAngles().yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
|
||||
weapAxis = idAngles( 0.0f, weapAxis.ToAngles().yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
|
||||
|
||||
weapOrigin += weapAxis[0] * headPositionDelta.x + weapAxis[1] * headPositionDelta.y + weapAxis[2] * headPositionDelta.z;
|
||||
weapOrigin += weapAxis[0] * headPositionDelta.x + weapAxis[1] * headPositionDelta.y + weapAxis[2] * headPositionDelta.z;
|
||||
|
||||
weapOrigin += hands[ hand ].motionPosition * weapAxis;
|
||||
weapOrigin += hands[ hand ].motionPosition * weapAxis;
|
||||
|
||||
if ( currentWeaponEnum != WEAPON_ARTIFACT && currentWeaponEnum != WEAPON_SOULCUBE )
|
||||
{
|
||||
weapAxis = hands[ hand ].motionRotation.ToMat3() * weapAxis;
|
||||
}
|
||||
else
|
||||
{
|
||||
weapAxis = idAngles( 0.0f ,viewAngles.yaw , 0.0f).ToMat3();
|
||||
}
|
||||
if ( currentWeaponEnum != WEAPON_ARTIFACT && currentWeaponEnum != WEAPON_SOULCUBE )
|
||||
{
|
||||
weapAxis = hands[ hand ].motionRotation.ToMat3() * weapAxis;
|
||||
}
|
||||
else
|
||||
{
|
||||
weapAxis = idAngles( 0.0f ,viewAngles.yaw , 0.0f).ToMat3();
|
||||
}
|
||||
|
||||
//DebugCross( weapOrigin, weapAxis, colorYellow );
|
||||
//DebugCross( weapOrigin, weapAxis, colorYellow );
|
||||
|
||||
if ( currentWeaponEnum != WEAPON_PDA )
|
||||
{
|
||||
hands[hand].TrackWeaponDirection( weapOrigin );
|
||||
//GB why do both hands here
|
||||
//hands[1 - hand].TrackWeaponDirection( weapOrigin );
|
||||
weapon->CalculateHideRise( weapOrigin, weapAxis );
|
||||
//check for melee hit?
|
||||
}
|
||||
else if( !hands[ hand ].PDAfixed )
|
||||
{
|
||||
// Koz FIXME hack hack hack this is getting so ungodly ugly.
|
||||
// Lovely. I forgot to correct the origin for the PDA model when I switched
|
||||
// to always showing the body, so now when holding the PDA it doesn't align with your controller.
|
||||
// will fix the assets later but for now hack this correction in.
|
||||
if ( currentWeaponEnum != WEAPON_PDA )
|
||||
{
|
||||
hands[hand].TrackWeaponDirection( weapOrigin );
|
||||
//GB why do both hands here
|
||||
//hands[1 - hand].TrackWeaponDirection( weapOrigin );
|
||||
weapon->CalculateHideRise( weapOrigin, weapAxis );
|
||||
//check for melee hit?
|
||||
}
|
||||
else if( !hands[ hand ].PDAfixed )
|
||||
{
|
||||
// Koz FIXME hack hack hack this is getting so ungodly ugly.
|
||||
// Lovely. I forgot to correct the origin for the PDA model when I switched
|
||||
// to always showing the body, so now when holding the PDA it doesn't align with your controller.
|
||||
// will fix the assets later but for now hack this correction in.
|
||||
|
||||
/* GB Debugger Change Values
|
||||
* float _vr_pdaPosX = 0.0;
|
||||
float _vr_pdaPosY = 0.0;
|
||||
float _vr_pdaPosZ = 0.0;
|
||||
if(_vr_pdaPosX != 0.0f && _vr_pdaPosX != vr_pdaPosX.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosX", _vr_pdaPosX);
|
||||
if(_vr_pdaPosY != 0.0f && _vr_pdaPosY != vr_pdaPosY.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosY", _vr_pdaPosY);
|
||||
if(_vr_pdaPosZ != 0.0f && _vr_pdaPosZ != vr_pdaPosZ.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosZ", _vr_pdaPosZ);
|
||||
*/
|
||||
const idVec3 pdaHackOrigin[2] { idVec3( vr_pdaPosX.GetFloat(), vr_pdaPosY.GetFloat(), vr_pdaPosZ.GetFloat() ), idVec3( vr_pdaPosX.GetFloat(), -vr_pdaPosY.GetFloat(), vr_pdaPosZ.GetFloat() ) };
|
||||
weapOrigin += pdaHackOrigin[hand] * weapAxis;
|
||||
}
|
||||
/* GB Debugger Change Values
|
||||
* float _vr_pdaPosX = 0.0;
|
||||
float _vr_pdaPosY = 0.0;
|
||||
float _vr_pdaPosZ = 0.0;
|
||||
if(_vr_pdaPosX != 0.0f && _vr_pdaPosX != vr_pdaPosX.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosX", _vr_pdaPosX);
|
||||
if(_vr_pdaPosY != 0.0f && _vr_pdaPosY != vr_pdaPosY.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosY", _vr_pdaPosY);
|
||||
if(_vr_pdaPosZ != 0.0f && _vr_pdaPosZ != vr_pdaPosZ.GetFloat())
|
||||
cvarSystem->SetCVarFloat("vr_pdaPosZ", _vr_pdaPosZ);
|
||||
*/
|
||||
const idVec3 pdaHackOrigin[2] { idVec3( vr_pdaPosX.GetFloat(), vr_pdaPosY.GetFloat(), vr_pdaPosZ.GetFloat() ), idVec3( vr_pdaPosX.GetFloat(), -vr_pdaPosY.GetFloat(), vr_pdaPosZ.GetFloat() ) };
|
||||
weapOrigin += pdaHackOrigin[hand] * weapAxis;
|
||||
}
|
||||
|
||||
idAngles motRot = hands[ hand ].motionRotation.ToAngles();
|
||||
motRot.yaw -= commonVr->bodyYawOffset;
|
||||
motRot.Normalize180();
|
||||
hands[ hand ].motionRotation = motRot.ToQuat();
|
||||
idAngles motRot = hands[ hand ].motionRotation.ToAngles();
|
||||
motRot.yaw -= commonVr->bodyYawOffset;
|
||||
motRot.Normalize180();
|
||||
hands[ hand ].motionRotation = motRot.ToQuat();
|
||||
|
||||
SetHandIKPos( hand, weapOrigin, weapAxis, hands[ hand ].motionRotation, false );
|
||||
SetHandIKPos( hand, weapOrigin, weapAxis, hands[ hand ].motionRotation, false );
|
||||
|
||||
if ( hands[ hand ].PDAfixed ) return;
|
||||
if ( hands[ hand ].PDAfixed ) return;
|
||||
|
||||
if ( currentWeaponEnum == WEAPON_PDA )
|
||||
{
|
||||
if ( currentWeaponEnum == WEAPON_PDA )
|
||||
{
|
||||
|
||||
PDAaxis = weapAxis;
|
||||
PDAorigin = weapOrigin;
|
||||
if ( hands[ hand ].wasPDA == false )
|
||||
{
|
||||
SetFlashHandPose(); // Call set flashlight hand pose script function
|
||||
SetWeaponHandPose();
|
||||
hands[ hand ].wasPDA = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hands[hand].wasPDA = false;
|
||||
}
|
||||
PDAaxis = weapAxis;
|
||||
PDAorigin = weapOrigin;
|
||||
if ( hands[ hand ].wasPDA == false )
|
||||
{
|
||||
SetFlashHandPose(); // Call set flashlight hand pose script function
|
||||
SetWeaponHandPose();
|
||||
hands[ hand ].wasPDA = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hands[hand].wasPDA = false;
|
||||
}
|
||||
|
||||
axis = weapAxis;
|
||||
origin = weapOrigin;
|
||||
axis = weapAxis;
|
||||
origin = weapOrigin;
|
||||
|
||||
origin -= originOffset * weapAxis;
|
||||
origin += attacherToDefault * weapAxis; // handWeaponAttacherToDefaultOffset[hand][currentWeaponIndex] * weapAxis; // add the attacher offsets
|
||||
|
||||
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,27 +4154,38 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
|
|||
axis[2] = axis[0];
|
||||
axis[0] = -tmp;
|
||||
|
||||
// make sure the projectile starts inside the monster bounding box
|
||||
const idBounds &ownerBounds = physicsObj.GetAbsBounds();
|
||||
projClip = lastProjectile->GetPhysics()->GetClipModel();
|
||||
projBounds = projClip->GetBounds().Rotate( axis );
|
||||
proj_axis = axis;
|
||||
|
||||
// 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 ) ) {
|
||||
start = muzzle + distance * viewAxis[ 0 ];
|
||||
} else {
|
||||
if( !forceMuzzle ) // _D3XP
|
||||
{
|
||||
// make sure the projectile starts inside the monster bounding box
|
||||
const idBounds& ownerBounds = physicsObj.GetAbsBounds();
|
||||
projClip = lastProjectile->GetPhysics()->GetClipModel();
|
||||
projBounds = projClip->GetBounds().Rotate( axis );
|
||||
|
||||
// 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 ) )
|
||||
{
|
||||
start = muzzle + distance * viewAxis[ 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
start = ownerBounds.GetCenter();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// projectile bounds bigger than the owner bounds, so just start it from the center
|
||||
start = ownerBounds.GetCenter();
|
||||
}
|
||||
} 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;
|
||||
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