Browse Source

Opfor fixes (#242)

* Update displacer. Play displacer sounds in player entity

* Detach player from a rope when they get teleported with displacer

* Make snarks enemies to shock troopers

* Don't explicitly set Touch as touch function for displacer ball

* Fix possible null pointer reference is desert eagle
opforfixed
Roman Chistokhodov 3 years ago committed by GitHub
parent
commit
a32bec7904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      dlls/gearbox/displacer.cpp
  2. 2
      dlls/gearbox/displacerball.h
  3. 5
      dlls/gearbox/eagle.cpp
  4. 2
      dlls/monsters.cpp
  5. 53
      dlls/player.cpp
  6. 2
      dlls/player.h

36
dlls/gearbox/displacer.cpp

@ -56,7 +56,6 @@ void CDisplacerBall::Spawn(void) @@ -56,7 +56,6 @@ void CDisplacerBall::Spawn(void)
pev->frame = 0;
pev->scale = 0.75;
SetTouch( &CDisplacerBall::Touch );
SetThink( &CDisplacerBall::FlyThink );
pev->nextthink = gpGlobals->time + 0.2;
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
@ -154,9 +153,7 @@ void CDisplacerBall::SelfCreate(entvars_t *pevOwner,Vector vecStart) @@ -154,9 +153,7 @@ void CDisplacerBall::SelfCreate(entvars_t *pevOwner,Vector vecStart)
void CDisplacerBall::Touch(CBaseEntity *pOther)
{
// Do not collide with the owner.
if (ENT(pOther->pev) == pev->owner || (ENT(pOther->pev) == VARS(pev->owner)->owner))
return;
pev->velocity = g_vecZero;
TraceResult tr;
Vector vecSpot;
@ -164,11 +161,7 @@ void CDisplacerBall::Touch(CBaseEntity *pOther) @@ -164,11 +161,7 @@ void CDisplacerBall::Touch(CBaseEntity *pOther)
pev->enemy = pOther->edict();
CBaseEntity *pTarget = NULL;
if (!pOther->pev->takedamage)
{
EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, "weapons/displacer_impact.wav", 1, ATTN_NORM, 0, 100);
UTIL_MuzzleLight( pOther->pev->origin, 160.0f, 255, 180, 96, 1.0f, 100.0f );
}
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/displacer_impact.wav", 0.9f, ATTN_NORM);
if( ( g_pGameRules->IsMultiplayer() && !g_pGameRules->IsCoOp() ) && pOther->IsPlayer() )
{
@ -219,7 +212,7 @@ void CDisplacerBall::Circle( void ) @@ -219,7 +212,7 @@ void CDisplacerBall::Circle( void )
WRITE_COORD(pev->origin.z);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z + 800); // reach damage radius over .2 seconds
WRITE_COORD(pev->origin.z + 800.0f); // reach damage radius over .2 seconds
WRITE_SHORT(iRingSprite);
WRITE_BYTE(0); // startframe
WRITE_BYTE(0); // framerate
@ -237,8 +230,6 @@ void CDisplacerBall::Circle( void ) @@ -237,8 +230,6 @@ void CDisplacerBall::Circle( void )
void CDisplacerBall::KillThink( void )
{
if( pRemoveEnt )
UTIL_Remove( pRemoveEnt );
SetThink( &CDisplacerBall::ExplodeThink );
pev->nextthink = gpGlobals->time + 0.2f;
}
@ -335,7 +326,7 @@ BOOL CDisplacer::PlayEmptySound(void) @@ -335,7 +326,7 @@ BOOL CDisplacer::PlayEmptySound(void)
{
if (m_iPlayEmptySound)
{
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "buttons/button11.wav", 1, ATTN_NORM);
EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "buttons/button11.wav", 0.9f, ATTN_NORM);
m_iPlayEmptySound = 0;
return 0;
}
@ -395,7 +386,7 @@ void CDisplacer::Precache(void) @@ -395,7 +386,7 @@ void CDisplacer::Precache(void)
//=========================================================
BOOL CDisplacer::Deploy()
{
return DefaultDeploy("models/v_displacer.mdl", "models/p_displacer.mdl", DISPLACER_DRAW, "displacer", UseDecrement());
return DefaultDeploy("models/v_displacer.mdl", "models/p_displacer.mdl", DISPLACER_DRAW, "egon", UseDecrement());
}
//=========================================================
@ -421,7 +412,7 @@ void CDisplacer::SecondaryAttack(void) @@ -421,7 +412,7 @@ void CDisplacer::SecondaryAttack(void)
if (m_fFireOnEmpty || !CanFireDisplacer(DISPLACER_SECONDARY_USAGE))
{
PlayEmptySound();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
return;
}
@ -443,7 +434,7 @@ void CDisplacer::PrimaryAttack() @@ -443,7 +434,7 @@ void CDisplacer::PrimaryAttack()
if ( m_fFireOnEmpty || !CanFireDisplacer(DISPLACER_PRIMARY_USAGE))
{
PlayEmptySound();
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3f;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
return;
}
m_iFireMode = FIREMODE_FORWARD;
@ -490,10 +481,10 @@ void CDisplacer::ClearSpin( void ) @@ -490,10 +481,10 @@ void CDisplacer::ClearSpin( void )
switch (m_iFireMode)
{
case FIREMODE_FORWARD:
STOP_SOUND(ENT(pev), CHAN_WEAPON, "weapons/displacer_spin.wav");
STOP_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/displacer_spin.wav");
break;
case FIREMODE_BACKWARD:
STOP_SOUND(ENT(pev), CHAN_WEAPON, "weapons/displacer_spin2.wav");
STOP_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/displacer_spin2.wav");
break;
}
}
@ -509,12 +500,12 @@ void CDisplacer::SpinUp( void ) @@ -509,12 +500,12 @@ void CDisplacer::SpinUp( void )
if( m_iFireMode == FIREMODE_FORWARD )
{
EMIT_SOUND( edict(), CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM );
EMIT_SOUND( m_pPlayer->edict(), CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM );
SetThink (&CDisplacer::Displace);
}
else
{
EMIT_SOUND( edict(), CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM );
EMIT_SOUND( m_pPlayer->edict(), CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM );
SetThink (&CDisplacer::Teleport);
}
pev->nextthink = gpGlobals->time + 0.9;
@ -583,6 +574,9 @@ void CDisplacer::Teleport( void ) @@ -583,6 +574,9 @@ void CDisplacer::Teleport( void )
if( pTarget && /*HACK*/( tmp != Vector( 0, 0, 0 )/*HACK*/ ) )
{
if( (m_pPlayer->m_afPhysicsFlags & PFLAG_ONROPE) )
m_pPlayer->LetGoRope();
// UTIL_ScreenFade( m_pPlayer, Vector( 0, 200, 0 ), 0.5, 0.5, 255, FFADE_IN );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase();
@ -619,7 +613,7 @@ void CDisplacer::Teleport( void ) @@ -619,7 +613,7 @@ void CDisplacer::Teleport( void )
}
else
{
EMIT_SOUND( edict(), CHAN_BODY, "buttons/button11.wav", 1, ATTN_NORM );
EMIT_SOUND( m_pPlayer->edict(), CHAN_WEAPON, "buttons/button11.wav", 0.9f, ATTN_NORM );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.9;
}

2
dlls/gearbox/displacerball.h

@ -28,7 +28,5 @@ public: @@ -28,7 +28,5 @@ public:
void ArmBeam( int iSide );
int m_iBeams;
CBaseEntity *pRemoveEnt;
};
#endif

5
dlls/gearbox/eagle.cpp

@ -91,11 +91,13 @@ void CEagle::Holster( int skiplocal /* = 0 */ ) @@ -91,11 +91,13 @@ void CEagle::Holster( int skiplocal /* = 0 */ )
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
SendWeaponAnim( DEAGLE_HOLSTER );
#if !CLIENT_DLL
if (m_pEagleLaser)
{
m_pEagleLaser->Killed( NULL, GIB_NEVER );
m_pEagleLaser = NULL;
}
#endif
}
void CEagle::SecondaryAttack()
@ -167,7 +169,8 @@ void CEagle::PrimaryAttack() @@ -167,7 +169,8 @@ void CEagle::PrimaryAttack()
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_EAGLE, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.5;
#if !CLIENT_DLL
m_pEagleLaser->Suspend( 0.6 );
if (m_pEagleLaser)
m_pEagleLaser->Suspend( 0.6f );
#endif
}
else

2
dlls/monsters.cpp

@ -2200,7 +2200,7 @@ int CBaseMonster::IRelationship( CBaseEntity *pTarget ) @@ -2200,7 +2200,7 @@ int CBaseMonster::IRelationship( CBaseEntity *pTarget )
/*INSECT*/ { R_FR ,R_FR ,R_FR ,R_FR ,R_FR ,R_NO ,R_FR ,R_FR ,R_FR ,R_FR ,R_NO ,R_FR, R_NO, R_NO, R_NO, R_NO, R_NO},
/*PLAYERALLY*/ { R_NO ,R_DL ,R_AL ,R_AL ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_NO ,R_NO, R_NO, R_NO, R_DL, R_DL, R_DL},
/*PBIOWEAPON*/ { R_NO ,R_NO ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_DL ,R_NO ,R_DL, R_NO, R_DL, R_DL, R_DL, R_DL},
/*ABIOWEAPON*/ { R_NO ,R_NO ,R_DL ,R_DL ,R_DL ,R_AL ,R_NO ,R_DL ,R_DL ,R_NO ,R_NO ,R_DL, R_DL, R_NO, R_DL, R_NO, R_DL},
/*ABIOWEAPON*/ { R_NO ,R_NO ,R_DL ,R_DL ,R_DL ,R_AL ,R_NO ,R_DL ,R_DL ,R_NO ,R_NO ,R_DL, R_DL, R_NO, R_DL, R_DL, R_DL},
/*XPREDATOR*/ { R_NO ,R_DL ,R_DL ,R_DL ,R_DL ,R_NO ,R_NO ,R_NO ,R_DL ,R_DL ,R_NO ,R_NO, R_NO, R_AL, R_AL, R_AL, R_DL},
/*XSHOCK*/ { R_NO ,R_DL ,R_HT ,R_DL ,R_HT ,R_NO ,R_NO ,R_NO ,R_NO ,R_NO ,R_NO ,R_DL, R_NO, R_NO, R_AL, R_AL, R_HT},
/*PLRALLYMIL*/ { R_NO ,R_DL ,R_AL ,R_DL ,R_DL ,R_HT ,R_DL ,R_DL ,R_DL ,R_DL ,R_NO ,R_DL, R_NO, R_NO, R_DL, R_HT, R_AL}

53
dlls/player.cpp

@ -1931,13 +1931,7 @@ void CBasePlayer::PreThink( void ) @@ -1931,13 +1931,7 @@ void CBasePlayer::PreThink( void )
if( !m_pRope->MoveDown( flDelta ) )
{
//Let go of the rope, detach. - Solokiller
pev->movetype = MOVETYPE_WALK;
pev->solid = SOLID_SLIDEBOX;
m_afPhysicsFlags &= ~PFLAG_ONROPE;
m_pRope->DetachObject();
m_pRope = NULL;
m_bIsClimbing = false;
LetGoRope();
}
}
else
@ -1954,12 +1948,7 @@ void CBasePlayer::PreThink( void ) @@ -1954,12 +1948,7 @@ void CBasePlayer::PreThink( void )
else if( !m_pRope->MoveDown( flDelta ) )
{
//Let go of the rope, detach. - Solokiller
pev->movetype = MOVETYPE_WALK;
pev->solid = SOLID_SLIDEBOX;
m_afPhysicsFlags &= ~PFLAG_ONROPE;
m_pRope->DetachObject();
m_pRope = NULL;
m_bIsClimbing = false;
LetGoRope();
}
}
}
@ -1992,23 +1981,18 @@ void CBasePlayer::PreThink( void ) @@ -1992,23 +1981,18 @@ void CBasePlayer::PreThink( void )
if( m_afButtonPressed & IN_JUMP )
{
//We've jumped off the rope, give us some momentum - Solokiller
pev->movetype = MOVETYPE_WALK;
pev->solid = SOLID_SLIDEBOX;
this->m_afPhysicsFlags &= ~PFLAG_ONROPE;
CRope* rope = m_pRope;
LetGoRope();
Vector vecDir = gpGlobals->v_up * 165.0 + gpGlobals->v_forward * 150.0;
Vector vecVelocity = m_pRope->GetAttachedObjectsVelocity() * 2;
Vector vecVelocity = rope->GetAttachedObjectsVelocity() * 2;
vecVelocity = vecVelocity.Normalize();
vecVelocity = vecVelocity * 200;
pev->velocity = vecVelocity + vecDir;
m_pRope->DetachObject();
m_pRope = NULL;
m_bIsClimbing = false;
}
return;
}
@ -2096,6 +2080,21 @@ void CBasePlayer::PreThink( void ) @@ -2096,6 +2080,21 @@ void CBasePlayer::PreThink( void )
pev->velocity = g_vecZero;
}
}
void CBasePlayer::LetGoRope()
{
//Let go of the rope, detach. - Solokiller
pev->movetype = MOVETYPE_WALK;
pev->solid = SOLID_SLIDEBOX;
m_afPhysicsFlags &= ~PFLAG_ONROPE;
if (m_pRope)
{
m_pRope->DetachObject();
m_pRope = NULL;
}
m_bIsClimbing = false;
}
/* Time based Damage works as follows:
1) There are several types of timebased damage:
@ -4355,17 +4354,7 @@ BOOL CBasePlayer::FBecomeProne( void ) @@ -4355,17 +4354,7 @@ BOOL CBasePlayer::FBecomeProne( void )
if( (m_afPhysicsFlags & PFLAG_ONROPE) )
{
pev->movetype = MOVETYPE_WALK;
pev->solid = SOLID_SLIDEBOX;
this->m_afPhysicsFlags &= ~PFLAG_ONROPE;
if (m_pRope)
{
m_pRope->DetachObject();
m_pRope = NULL;
}
m_bIsClimbing = false;
LetGoRope();
}
return TRUE;

2
dlls/player.h

@ -403,6 +403,8 @@ public: @@ -403,6 +403,8 @@ public:
}
CRope* GetRope() { return m_pRope; }
void LetGoRope();
};
#define AUTOAIM_2DEGREES 0.0348994967025

Loading…
Cancel
Save