Browse Source

rework filter

foolsday
mittorn 9 years ago
parent
commit
19a4378397
  1. 2
      dlls/cbase.h
  2. 42
      dlls/gravgun.cpp
  3. 25
      dlls/prop.cpp

2
dlls/cbase.h

@ -213,7 +213,7 @@ public:
} }
virtual void Blocked( CBaseEntity *pOther ) { if (m_pfnBlocked) (this->*m_pfnBlocked)( pOther ); }; virtual void Blocked( CBaseEntity *pOther ) { if (m_pfnBlocked) (this->*m_pfnBlocked)( pOther ); };
virtual CBaseEntity * TouchGravGun( CBaseEntity *attacker ){ return NULL; }; virtual bool TouchGravGun( CBaseEntity *attacker, int stage ){ return false; };
// allow engine to allocate instance data // allow engine to allocate instance data
void *operator new( size_t stAllocateBlock, entvars_t *pev ) void *operator new( size_t stAllocateBlock, entvars_t *pev )
{ {

42
dlls/gravgun.cpp

@ -200,7 +200,7 @@ BOOL CGrav::HasAmmo(void)
void CGrav::Attack(void) void CGrav::Attack(void)
{ {
if (m_AimentEntity) { m_AimentEntity = NULL; } if (m_AimentEntity) { m_AimentEntity = NULL; m_iStage = 0; }
pev->nextthink = gpGlobals->time + 1.1; pev->nextthink = gpGlobals->time + 1.1;
m_flNextGravgunAttack - gpGlobals->time + 0.5; m_flNextGravgunAttack - gpGlobals->time + 0.5;
@ -240,21 +240,21 @@ void CGrav::Attack(void)
CBaseEntity* crosent; CBaseEntity* crosent;
crosent = FindEntityForward4(m_pPlayer, 1000); crosent = FindEntityForward4(m_pPlayer, 1000);
int oc = 0; //int oc = 0;
if (crosent) { if (crosent) {
m_flNextGravgunAttack = gpGlobals->time + 0.8; m_flNextGravgunAttack = gpGlobals->time + 0.8;
oc = crosent->ObjectCaps(); //oc = crosent->ObjectCaps();
int propc = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE; //int propc = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE;
if (oc == propc || crosent->IsPlayer()) { if (crosent->TouchGravGun(m_pPlayer,3)) {
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, GRAV_SOUND_STARTUP, 1, ATTN_NORM, 0, 70 + RANDOM_LONG(0, 34)); EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, GRAV_SOUND_STARTUP, 1, ATTN_NORM, 0, 70 + RANDOM_LONG(0, 34));
//if (crosent->pev->flags& FL_ONGROUND) { pev->velocity = pev->velocity * 0.95; }; //if (crosent->pev->flags& FL_ONGROUND) { pev->velocity = pev->velocity * 0.95; };
crosent->TouchGravGun(m_pPlayer); crosent->TouchGravGun(m_pPlayer,3);
Vector pusher = vecAiming; Vector pusher = vecAiming;
pusher.x = pusher.x * 2500; pusher.x = pusher.x * 2500;
pusher.y = pusher.y * 2500; pusher.y = pusher.y * 2500;
@ -330,24 +330,16 @@ void CGrav::Attack2(void)
pev->fuser1 = 1000; pev->fuser1 = 1000;
} }
CBaseEntity* crosent; CBaseEntity* crossent = FindEntityForward4(m_pPlayer,500);
crosent = FindEntityForward4(m_pPlayer,500);
int oc = 0;
if (crosent){
if (crossent && crossent->TouchGravGun(m_pPlayer, 0) ){
oc = crosent->ObjectCaps();
}
int propc = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION | FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE);
//int propn2 = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) | FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_DONT_SAVE;
if (oc == propc ){
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, GRAV_SOUND_RUN, 0.6, ATTN_NORM, 0, 70 + RANDOM_LONG(0, 34)); EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, GRAV_SOUND_RUN, 0.6, ATTN_NORM, 0, 70 + RANDOM_LONG(0, 34));
m_AimentEntity = crosent; if(crossent->TouchGravGun(m_pPlayer, 0))
Pull(crosent,5); {
m_AimentEntity->TouchGravGun(m_pPlayer); m_AimentEntity = crossent;
GravAnim(GAUSS_SPIN, 0, 0); Pull(crossent,5);
GravAnim(GAUSS_SPIN, 0, 0);
}
} }
else { else {
@ -453,8 +445,8 @@ void CGrav::GrabThink()
} }
void CGrav::Pull(CBaseEntity* ent,float force){ void CGrav::Pull(CBaseEntity* ent,float force)
ent->TouchGravGun(m_pPlayer); {
UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle);
ent->pev->angles.x = UTIL_AngleMod(ent->pev->angles.x); ent->pev->angles.x = UTIL_AngleMod(ent->pev->angles.x);
ent->pev->angles.y = UTIL_AngleMod(ent->pev->angles.y); ent->pev->angles.y = UTIL_AngleMod(ent->pev->angles.y);
@ -480,6 +472,7 @@ void CGrav::Pull(CBaseEntity* ent,float force){
m_iStage = 1; m_iStage = 1;
SetThink( &CGrav::GrabThink ); SetThink( &CGrav::GrabThink );
pev->nextthink = gpGlobals->time + 0.001; pev->nextthink = gpGlobals->time + 0.001;
ent->TouchGravGun(m_pPlayer, 1);
} }
} }
else else
@ -524,6 +517,7 @@ void CGrav::Pull(CBaseEntity* ent,float force){
m_iStage = 2; m_iStage = 2;
SetThink( &CGrav::GrabThink ); SetThink( &CGrav::GrabThink );
pev->nextthink = gpGlobals->time + 0.001; pev->nextthink = gpGlobals->time + 0.001;
ent->TouchGravGun(m_pPlayer, 2);
} }

25
dlls/prop.cpp

@ -94,11 +94,28 @@ public:
virtual void BounceSound(void); virtual void BounceSound(void);
virtual int BloodColor(void) { return DONT_BLEED; } virtual int BloodColor(void) { return DONT_BLEED; }
virtual void Killed(entvars_t *pevAttacker, int iGib); virtual void Killed(entvars_t *pevAttacker, int iGib);
virtual CBaseEntity * TouchGravGun( CBaseEntity *attacker ) virtual bool TouchGravGun( CBaseEntity *attacker, int stage )
{ {
m_owner2 = attacker; if(stage)
m_attacker = attacker; {
return attacker; pev->nextthink = gpGlobals->time + m_flRespawnTime;
SetThink( &CProp::RespawnThink);
}
if( !m_attacker)
{
m_owner2 = attacker;
m_attacker = attacker;
return true;
}
if( m_attacker && ( pev->velocity.Length() < 600) )
m_attacker = attacker;
return true;
if( ( stage == 2 ) && ( m_attacker == attacker ) )
{
m_owner2 = attacker;
return true;
}
return false;
} }
void CheckRotate(); void CheckRotate();
void EXPORT RespawnThink(); void EXPORT RespawnThink();

Loading…
Cancel
Save