//========================================================= // ClearBeams - remove all beams //========================================================= void CISlave::ClearBeams() { for( int i = 0; i < ISLAVE_MAX_BEAMS; i++ ) { if( m_pBeam[i] ) { UTIL_Remove( m_pBeam[i] ); m_pBeam[i] = NULL; } } m_iBeams = 0; pev->skin = 0; STOP_SOUND( ENT( pev ), CHAN_WEAPON, "debris/zap4.wav" ); }
void CFuncRotating :: RotateFriction( void ) { // angular impulse support if( GetLocalAvelocity() != g_vecZero ) { m_iState = STATE_ON; SetMoveDoneTime( 0.1 ); RampPitchVol(); } else { STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise3 )); SetMoveDoneTime( -1 ); m_iState = STATE_OFF; } }
void CWallHealth::Off(void) { // Stop looping sound. if (m_iOn > 1) STOP_SOUND( ENT(pev), CHAN_STATIC, "items/medcharge4.wav" ); m_iOn = 0; if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0) ) { pev->nextthink = pev->ltime + m_iReactivate; SetThink( &CWallHealth::Recharge ); } else SetThink( &CBaseEntity::SUB_DoNothing ); }
// Give the disc back to it's owner void CDisc::ReturnToThrower( void ) { if (m_bDecapitate) { STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" ); if ( !m_bRemoveSelf ) ((CBasePlayer*)(CBaseEntity*)m_hOwner)->GiveAmmo( MAX_DISCS, "disc", MAX_DISCS ); } else { if ( !m_bRemoveSelf ) ((CBasePlayer*)(CBaseEntity*)m_hOwner)->GiveAmmo( 1, "disc", MAX_DISCS ); } UTIL_Remove( this ); }
void CRecharge::Off(void) { // Stop looping sound. if (m_iOn > 1) STOP_SOUND( ENT(pev), CHAN_STATIC, "items/suitcharge1.wav" ); m_iOn = 0; if ((!m_iJuice) && ( ( m_iReactivate = static_cast<int>(g_pGameRules->FlHEVChargerRechargeTime()) ) > 0) ) { pev->nextthink = pev->ltime + m_iReactivate; SetThink(&CRecharge::Recharge); } else SetThink( &CRecharge::SUB_DoNothing ); }
// // The door has reached the "down" position. Back to quiescence. // void CBaseTrainDoor :: DoorHitBottom( void ) { STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 )); EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise2 ), 1, ATTN_NORM ); ASSERT( door_state == TD_SHIFT_DOWN ); door_state = TD_CLOSED; if( pev->impulse ) { SetThink( ActivateTrain ); SetNextThink( 1.0 ); } SUB_UseTargets( m_hActivator, USE_ON, 0 ); }
void CWallHealth::Off(void) { // Stop looping sound. if (m_iOn > 1) STOP_SOUND( this, CHAN_STATIC, "items/medcharge4.wav" ); m_iOn = 0; if ((!m_iJuice) && ( ( m_iReactivate = g_pGameRules->FlHealthChargerRechargeTime() ) > 0) ) { SetNextThink( GetLastThink() + m_iReactivate ); SetThink(&CWallHealth::Recharge); } else SetThink( &CWallHealth::SUB_DoNothing ); }
void CFuncPlat::Blocked( CBaseEntity *pOther ) { ALERT( at_aiconsole, "%s Blocked by %s\n", STRING( pev->classname ), STRING( pOther->pev->classname ) ); // Hurt the blocker a little pOther->TakeDamage( this, this, 1, DMG_CRUSH ); if( pev->noiseMovement ) STOP_SOUND( ENT( pev ), CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) ); // Send the platform back where it came from ASSERT( m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN ); if( m_toggle_state == TS_GOING_UP ) GoDown(); else if( m_toggle_state == TS_GOING_DOWN ) GoUp(); }
void COsprey :: Killed( entvars_t *pevAttacker, int iGib ) { pev->movetype = MOVETYPE_TOSS; pev->gravity = 0.3; SetAbsVelocity( m_velocity ); SetLocalAvelocity( Vector( RANDOM_FLOAT( -20, 20 ), 0, RANDOM_FLOAT( -50, 50 ) )); STOP_SOUND( ENT(pev), CHAN_STATIC, "apache/ap_rotor4.wav" ); UTIL_SetSize( pev, Vector( -32, -32, -64), Vector( 32, 32, 0) ); SetThink( DyingThink ); SetTouch( CrashTouch ); SetNextThink( 0.1 ); pev->health = 0; pev->takedamage = DAMAGE_NO; m_startTime = gpGlobals->time + 4.0; }
void CRpgRocket::Detonate(void) { TraceResult tr; Vector vecSpot;// trace starts here! CBaseEntity *pPlayer = CBaseEntity::Instance(pev->owner); if (m_pLauncher) { // my launcher is still around, tell it I'm dead. m_pLauncher->m_iChargeLevel--; if (m_pLauncher->m_pSpot)//make sound only if laser spot created EMIT_SOUND(pPlayer->edict(), CHAN_ITEM, "weapons/beep2.wav", 1, ATTN_NORM);//play sound at player } STOP_SOUND(edict(), CHAN_VOICE, "weapons/rocket1.wav"); vecSpot = pev->origin + Vector(0, 0, 8); UTIL_TraceLine(vecSpot, vecSpot + Vector(0, 0, -40), ignore_monsters, ENT(pev), &tr); Explode(&tr, DMG_BLAST); }
// // Platform has hit top. Pauses, then starts back down again. // void CFuncPlat::HitTop( void ) { if( pev->noiseMovement ) STOP_SOUND( ENT( pev ), CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) ); if( pev->noiseStopMoving ) EMIT_SOUND( ENT( pev ), CHAN_WEAPON, ( char* ) STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM ); ASSERT( m_toggle_state == TS_GOING_UP ); m_toggle_state = TS_AT_TOP; if( !IsTogglePlat() ) { // After a delay, the platform will automatically start going down again. SetThink( &CFuncPlat::CallGoDown ); pev->nextthink = pev->ltime + 3; } }
void CBaseDoor::DoorHitTop( void ) { if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT )) { STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 )); EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise2 ), 1, ATTN_NORM ); } ASSERT( m_iState == STATE_TURN_ON ); m_iState = STATE_ON; // toggle-doors don't come down automatically, they wait for refire. if( FBitSet( pev->spawnflags, SF_DOOR_NO_AUTO_RETURN )) { // re-instate touch method, movement is complete if( !FBitSet( pev->spawnflags, SF_DOOR_USE_ONLY )) SetTouch( DoorTouch ); } else { // in flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open SetMoveDoneTime( m_flWait ); SetMoveDone( DoorGoDown ); if( m_flWait == -1 ) { SetNextThink( -1 ); } } // fire the close target (if startopen is set, then "top" is closed) - netname is the close target if( FBitSet( pev->spawnflags, SF_DOOR_START_OPEN )) { UTIL_FireTargets( pev->netname, m_hActivator, this, USE_TOGGLE, 0 ); } else { UTIL_FireTargets( pev->message, m_hActivator, this, USE_TOGGLE, 0 ); } if( FBitSet( pev->spawnflags, SF_DOOR_ONOFF_MODE )) SUB_UseTargets( m_hActivator, USE_OFF, 0 ); else SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); // this isn't finished }
/* <6940c> ../cstrike/dlls/doors.cpp:721 */ void CBaseDoor::DoorHitTop(void) { if (!(pev->spawnflags & SF_DOOR_SILENT)) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving)); EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseArrived), VOL_NORM, ATTN_NORM); } assert(m_toggle_state == TS_GOING_UP); m_toggle_state = TS_AT_TOP; // toggle-doors don't come down automatically, they wait for refire. if (pev->spawnflags & SF_DOOR_NO_AUTO_RETURN) { // Re-instate touch method, movement is complete if (!(pev->spawnflags & SF_DOOR_USE_ONLY)) { SetTouch(&CBaseDoor::DoorTouch); } } else { // In flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open pev->nextthink = pev->ltime + m_flWait; SetThink(&CBaseDoor::DoorGoDown); if (m_flWait == -1) { pev->nextthink = -1; } } // Fire the close target (if startopen is set, then "top" is closed) - netname is the close target if (!FStringNull(pev->netname) && (pev->spawnflags & SF_DOOR_START_OPEN)) { FireTargets(STRING(pev->netname), m_hActivator, this, USE_TOGGLE, 0); } // this isn't finished SUB_UseTargets(m_hActivator, USE_TOGGLE, 0); }
void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther ) { CBaseEntity *pEnemy = m_hEnemy; if (pOther == pEnemy) { if (m_hTargetEnt != NULL) m_hTargetEnt->Use( pEnemy, pEnemy, USE_ON, 1.0 ); if (m_hTouch != NULL && pEnemy != NULL ) m_hTouch->Touch( pEnemy ); } else { m_pNihilanth->MakeFriend( pev->origin ); } SetTouch( NULL ); STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" ); UTIL_Remove( this ); }
void CApache :: Killed( entvars_t *pevAttacker, int iGib ) { pev->movetype = MOVETYPE_TOSS; pev->gravity = 0.3; STOP_SOUND( ENT(pev), CHAN_STATIC, "apache/ap_rotor2.wav" ); UTIL_SetSize( pev, Vector( -32, -32, -64), Vector( 32, 32, 0) ); SetThink(&CApache :: DyingThink ); SetTouch(&CApache :: CrashTouch ); SetNextThink( 0.1 ); pev->health = 0; pev->takedamage = DAMAGE_NO; if (pev->spawnflags & SF_NOWRECKAGE) { m_flNextRocket = gpGlobals->time + 4.0; } else { m_flNextRocket = gpGlobals->time + 15.0; } }
void CApache :: Killed( entvars_t *pevAttacker, int iGib ) { pev->movetype = MOVETYPE_TOSS; pev->gravity = 0.3; STOP_SOUND( ENT(pev), CHAN_STATIC, "apache/ap_rotor2.wav" ); UTIL_SetSize( pev, Vector( -32, -32, -64), Vector( 32, 32, 0) ); SetThink( DyingThink ); SetTouch( CrashTouch ); pev->nextthink = gpGlobals->time + 0.1; pev->health = 0; pev->takedamage = DAMAGE_NO; if (pev->spawnflags & SF_NOWRECKAGE) { m_flNextRocket = gpGlobals->time + 4.0; } else { m_flNextRocket = gpGlobals->time + 15.0; } // modif de Julien if ( pev->spawnflags & SF_APACHE_LENSFLARE && m_bFlashLightOn == TRUE ) { m_bFlashLightOn = FALSE; MESSAGE_BEGIN( MSG_ALL, gmsgLensFlare, NULL ); WRITE_BYTE ( 0 ); // éteint WRITE_BYTE ( ENTINDEX ( edict() ) ); MESSAGE_END(); } }
void CBaseDoor::DoorHitBottom( void ) { if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT )) { STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 )); EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise2 ), 1, ATTN_NORM ); } ASSERT( m_iState == STATE_TURN_OFF ); m_iState = STATE_OFF; // re-instate touch method, cycle is complete if( FBitSet( pev->spawnflags, SF_DOOR_USE_ONLY )) { // use only door SetTouch( NULL ); } else { // touchable door SetTouch( DoorTouch ); } // fire the close target (if startopen is set, then "top" is closed) - netname is the close target if( !FBitSet( pev->spawnflags, SF_DOOR_START_OPEN )) { UTIL_FireTargets( pev->netname, m_hActivator, this, USE_TOGGLE, 0 ); } else { UTIL_FireTargets( pev->message, m_hActivator, this, USE_TOGGLE, 0 ); } if( FBitSet( pev->spawnflags, SF_DOOR_ONOFF_MODE )) SUB_UseTargets( m_hActivator, USE_ON, 0 ); else SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); }
// // The door has reached the "up" position. Either go back down, or wait for another activation. // void CBaseDoor::DoorHitTop( void ) { if( !GetSpawnFlags().Any( SF_DOOR_SILENT ) ) { STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMoving ) ); EMIT_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseArrived ), 1, ATTN_NORM ); } ASSERT( m_toggle_state == TS_GOING_UP ); m_toggle_state = TS_AT_TOP; // toggle-doors don't come down automatically, they wait for refire. if( GetSpawnFlags().Any( SF_DOOR_NO_AUTO_RETURN ) ) { // Re-instate touch method, movement is complete if( !GetSpawnFlags().Any( SF_DOOR_USE_ONLY ) ) SetTouch( &CBaseDoor::DoorTouch ); } else { // In flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open SetNextThink( GetLastThink() + m_flWait ); SetThink( &CBaseDoor::DoorGoDown ); if( m_flWait == -1 ) { SetNextThink( -1 ); } } // Fire the close target (if startopen is set, then "top" is closed) - netname is the close target if( HasNetName() && GetSpawnFlags().Any( SF_DOOR_START_OPEN ) ) FireTargets( GetNetName(), m_hActivator, this, USE_TOGGLE, 0 ); SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 ); // this isn't finished }
void CBaseDoor::Blocked( CBaseEntity *pOther ) { // hurt the blocker a little. if( pev->dmg ) pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH ); // if a door has a negative wait, it would never come back if blocked, // so let it just squash the object to death real fast if( m_flWait >= 0 ) { if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT )) STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 )); if( m_iState == STATE_TURN_OFF ) { DoorGoUp(); } else { DoorGoDown(); } } // block all door pieces with the same targetname here. if( !FStringNull( pev->targetname )) { CBaseDoor *pDoorList[64]; int doorCount = GetDoorMovementGroup( pDoorList, ARRAYSIZE( pDoorList )); for( int i = 0; i < doorCount; i++ ) { CBaseDoor *pDoor = pDoorList[i]; if( pDoor->m_flWait >= 0) { if( m_bDoorGroup && pDoor->pev->movedir == pev->movedir && pDoor->GetAbsVelocity() == GetAbsVelocity() && pDoor->GetLocalAvelocity() == GetLocalAvelocity( )) { pDoor->m_iPhysicsFrame = g_ulFrameCount; // don't run physics this frame if you haven't run yet // this is the most hacked, evil, bastardized thing I've ever seen. kjb if( !pDoor->IsRotatingDoor( )) { // set origin to realign normal doors pDoor->SetLocalOrigin( GetLocalOrigin( )); pDoor->SetAbsVelocity( g_vecZero ); // stop! } else { // set angles to realign rotating doors pDoor->SetLocalAngles( GetLocalAngles( )); pDoor->SetLocalAvelocity( g_vecZero ); } } if( pDoor->m_iState == STATE_TURN_OFF ) pDoor->DoorGoUp(); else pDoor->DoorGoDown(); } } } }
/* <6a465> ../cstrike/dlls/doors.cpp:817 */ void CBaseDoor::__MAKE_VHOOK(Blocked)(CBaseEntity *pOther) { edict_t *pentTarget = NULL; CBaseDoor *pDoor = NULL; const float checkBlockedInterval = 0.25f; // Hurt the blocker a little. if (pev->dmg != 0.0f) { pOther->TakeDamage(pev, pev, pev->dmg, DMG_CRUSH); } if (gpGlobals->time - m_lastBlockedTimestamp < checkBlockedInterval) { return; } m_lastBlockedTimestamp = gpGlobals->time; // if a door has a negative wait, it would never come back if blocked, // so let it just squash the object to death real fast if (m_flWait >= 0) { if (m_toggle_state == TS_GOING_DOWN) { DoorGoUp(); } else { DoorGoDown(); } } // Block all door pieces with the same targetname here. if (!FStringNull(pev->targetname)) { while (true) { pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->targetname)); if (VARS(pentTarget) != pev) { if (FNullEnt(pentTarget)) break; if (FClassnameIs(pentTarget, "func_door") || FClassnameIs(pentTarget, "func_door_rotating")) { pDoor = GetClassPtr((CBaseDoor *)VARS(pentTarget)); if (pDoor->m_flWait >= 0) { if (pDoor->pev->velocity == pev->velocity && pDoor->pev->avelocity == pev->velocity) { // this is the most hacked, evil, bastardized thing I've ever seen. kjb if (FClassnameIs(pentTarget, "func_door")) { // set origin to realign normal doors pDoor->pev->origin = pev->origin; // stop! pDoor->pev->velocity = g_vecZero; } else { // set angles to realign rotating doors pDoor->pev->angles = pev->angles; pDoor->pev->avelocity = g_vecZero; } } if (!(pev->spawnflags & SF_DOOR_SILENT)) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving)); } if (pDoor->m_toggle_state == TS_GOING_DOWN) pDoor->DoorGoUp(); else pDoor->DoorGoDown(); } } } } } }
void CBandsaw::Holster( ) { STOP_SOUND( ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/bandsaw_idle.wav" ); m_pPlayer->m_flNextAttack = gpGlobals->time + 0.6; SendWeaponAnim( BANDSAW_HOLSTER ); }
void CStomp::Think( void ) { TraceResult tr; pev->nextthink = gpGlobals->time + 0.1; // Do damage for this frame Vector vecStart = pev->origin; vecStart.z += 30; Vector vecEnd = vecStart + (pev->movedir * pev->speed * gpGlobals->frametime); UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr ); if ( tr.pHit && tr.pHit != pev->owner ) { entvars_t *pevOwner = pev; if ( pev->owner ) pevOwner = VARS(pev->owner); if ( tr.pHit && tr.pHit->v.health > 0) { if (UTIL_IsPlayer(tr.pHit)) { UTIL_TakeDamage( tr.pHit,pev, pevOwner, gSkillData.gargantuaDmgStomp, DMG_SONIC ); } else if (tr.pHit->v.euser4 != NULL) { CMBaseMonster *pMonster = GetClassPtr((CMBaseMonster *)VARS(tr.pHit)); pMonster->TakeDamage(pev, pevOwner, gSkillData.gargantuaDmgStomp, DMG_SONIC ); } } } // Accelerate the effect pev->speed = pev->speed + (gpGlobals->frametime) * pev->framerate; pev->framerate = pev->framerate + (gpGlobals->frametime) * 1500; // Move and spawn trails while ( gpGlobals->time - pev->dmgtime > STOMP_INTERVAL ) { pev->origin = pev->origin + pev->movedir * pev->speed * STOMP_INTERVAL; for ( int i = 0; i < 2; i++ ) { CMSprite *pSprite = CMSprite::SpriteCreate( GARG_STOMP_SPRITE_NAME, pev->origin, TRUE ); if ( pSprite ) { UTIL_TraceLine( pev->origin, pev->origin - Vector(0,0,500), ignore_monsters, edict(), &tr ); pSprite->pev->origin = tr.vecEndPos; pSprite->pev->velocity = Vector(RANDOM_FLOAT(-200,200),RANDOM_FLOAT(-200,200),175); // pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0, 12.0 ) ); pSprite->pev->nextthink = gpGlobals->time + 0.3; pSprite->SetThink( SUB_Remove ); pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast ); } } pev->dmgtime += STOMP_INTERVAL; // Scale has the "life" of this effect pev->scale -= STOMP_INTERVAL * pev->speed; if ( pev->scale <= 0 ) { // Life has run out UTIL_Remove(this->edict()); STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND ); } } }
void CPushable::StopSound( void ) { Vector dist = pev->oldorigin - pev->origin; if ( dist.Length() <= 0 ) STOP_SOUND( ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound] ); }
void CPushable :: Move( CBaseEntity *pOther, int push ) { entvars_t* pevToucher = pOther->pev; int playerTouch = 0; // Is entity standing on this pushable ? if ( FBitSet(pevToucher->flags,FL_ONGROUND) && pevToucher->groundentity && VARS(pevToucher->groundentity) == pev ) { // Only push if floating if ( pev->waterlevel > 0 ) pev->velocity.z += pevToucher->velocity.z * 0.1; return; } if ( pOther->IsPlayer() ) { if ( push && !(pevToucher->button & (IN_FORWARD|IN_USE)) ) // Don't push unless the player is pushing forward and NOT use (pull) return; playerTouch = 1; } float factor; if ( playerTouch ) { if ( !(pevToucher->flags & FL_ONGROUND) ) // Don't push away from jumping/falling players unless in water { if ( pev->waterlevel < 1 ) return; else factor = 0.1; } else factor = 1; } else factor = 0.25; pev->velocity.x += pevToucher->velocity.x * factor; pev->velocity.y += pevToucher->velocity.y * factor; float length = sqrt( pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y ); if ( push && (length > MaxSpeed()) ) { pev->velocity.x = (pev->velocity.x * MaxSpeed() / length ); pev->velocity.y = (pev->velocity.y * MaxSpeed() / length ); } if ( playerTouch ) { pevToucher->velocity.x = pev->velocity.x; pevToucher->velocity.y = pev->velocity.y; if ( (gpGlobals->time - m_soundTime) > 0.7 ) { m_soundTime = gpGlobals->time; if ( length > 0 && FBitSet(pev->flags,FL_ONGROUND) ) { m_lastSound = RANDOM_LONG(0,2); EMIT_SOUND(ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM); // SetThink( StopSound ); // pev->nextthink = pev->ltime + 0.1; } else STOP_SOUND( ENT(pev), CHAN_WEAPON, m_soundNames[m_lastSound] ); } } }
void CFuncTank::StopRotSound( void ) { if( pev->spawnflags & SF_TANK_SOUNDON ) STOP_SOUND( edict(), CHAN_STATIC, ( char* ) STRING( pev->noise ) ); pev->spawnflags &= ~SF_TANK_SOUNDON; }
void CTripmineGrenade :: PowerupThink( void ) { TraceResult tr; if (m_hOwner == NULL) { // find an owner edict_t *oldowner = pev->owner; pev->owner = NULL; UTIL_TraceLine( pev->origin + m_vecDir * 8, pev->origin - m_vecDir * 32, dont_ignore_monsters, ENT( pev ), &tr ); if (tr.fStartSolid || (oldowner && tr.pHit == oldowner)) { pev->owner = oldowner; m_flPowerUp += 0.1; pev->nextthink = gpGlobals->time + 0.1; return; } if (tr.flFraction < 1.0) { pev->owner = tr.pHit; m_hOwner = CBaseEntity::Instance( pev->owner ); m_posOwner = m_hOwner->pev->origin; m_angleOwner = m_hOwner->pev->angles; } else { STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/mine_deploy.wav" ); STOP_SOUND( ENT(pev), CHAN_BODY, "weapons/mine_charge.wav" ); SetThink( SUB_Remove ); pev->nextthink = gpGlobals->time + 0.1; ALERT( at_console, "WARNING:Tripmine at %.0f, %.0f, %.0f removed\n", pev->origin.x, pev->origin.y, pev->origin.z ); KillBeam(); return; } } else if (m_posOwner != m_hOwner->pev->origin || m_angleOwner != m_hOwner->pev->angles) { // disable STOP_SOUND( ENT(pev), CHAN_VOICE, "weapons/mine_deploy.wav" ); STOP_SOUND( ENT(pev), CHAN_BODY, "weapons/mine_charge.wav" ); CBaseEntity *pMine = Create( "weapon_tripmine", pev->origin + m_vecDir * 24, pev->angles ); pMine->pev->spawnflags |= SF_NORESPAWN; SetThink( SUB_Remove ); KillBeam(); pev->nextthink = gpGlobals->time + 0.1; return; } // ALERT( at_console, "%d %.0f %.0f %0.f\n", pev->owner, m_pOwner->pev->origin.x, m_pOwner->pev->origin.y, m_pOwner->pev->origin.z ); if (gpGlobals->time > m_flPowerUp) { // make solid pev->solid = SOLID_BBOX; UTIL_SetOrigin( pev, pev->origin ); MakeBeam( ); // play enabled sound EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "weapons/mine_activate.wav", 0.5, ATTN_NORM, 1.0, 75 ); } pev->nextthink = gpGlobals->time + 0.1; }
void CMomentaryDoor::MomentaryMoveDone( void ) { STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving)); EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseArrived), 1, ATTN_NORM); }
void CNihilanthHVR::RemoveTouch( CBaseEntity *pOther ) { STOP_SOUND(edict(), CHAN_WEAPON, "x/x_teleattack1.wav" ); UTIL_Remove( this ); }
void CRpgRocket::FollowThink(void) { CBaseEntity *pOther = NULL; Vector vecTarget; Vector vecDir; float flDist, flMax, flDot; TraceResult tr; UTIL_MakeAimVectors(pev->angles); CreateTrail(); vecTarget = gpGlobals->v_forward; flMax = 4096; // Examine all entities within a reasonable radius while ((pOther = UTIL_FindEntityByClassname(pOther, "laser_spot")) != NULL) { UTIL_TraceLine(pev->origin, pOther->pev->origin, dont_ignore_monsters, ENT(pev), &tr); // ALERT( at_console, "%f\n", tr.flFraction ); if (tr.flFraction >= 0.90) { vecDir = pOther->pev->origin - pev->origin; flDist = vecDir.Length(); vecDir = vecDir.Normalize(); flDot = DotProduct(gpGlobals->v_forward, vecDir); if ((flDot > 0) && (flDist * (1 - flDot) < flMax)) { flMax = flDist * (1 - flDot); vecTarget = vecDir; } } } pev->angles = UTIL_VecToAngles(vecTarget); // this acceleration and turning math is totally wrong, but it seems to respond well so don't change it. float flSpeed = pev->velocity.Length(); if (gpGlobals->time - m_flIgniteTime < 1.0) { pev->velocity = pev->velocity * 0.2 + vecTarget * (flSpeed * 0.8 + 400); if (pev->waterlevel == 3 && pev->watertype > CONTENT_FLYFIELD) { // go slow underwater if (pev->velocity.Length() > 300) { pev->velocity = pev->velocity.Normalize() * 300; } UTIL_BubbleTrail(pev->origin - pev->velocity * 0.1, pev->origin, 4); } else { if (pev->velocity.Length() > 2000) { pev->velocity = pev->velocity.Normalize() * 2000; } } } else { if (pev->effects & EF_LIGHT) { pev->effects = 0; STOP_SOUND(ENT(pev), CHAN_VOICE, "weapons/rocket1.wav"); } pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798; if ((pev->waterlevel == 0 || pev->watertype == CONTENT_FOG) && pev->velocity.Length() < 1500) { Detonate(); } } //ALERT( at_console, "%.0f\n", flSpeed ); SetNextThink(0.05); }
void CGauss::SecondaryAttack() { entvars_t *pevOwner = VARS( pev->owner ); if ( m_pPlayer->pev->waterlevel == 3 ) { if ( m_fInAttack != 0 ) { ::WaterRadiusDamage( pev->origin, pev, pevOwner, (dmg_gauss_secondary.value*2) * (mp_wpn_power.value/100), (dmg_gauss_secondary.value*4) * (mp_wpn_power.value/100), CLASS_NONE, DMG_SHOCK | DMG_NEVERGIB); EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/electro4.wav", 0.55, ATTN_NORM); m_iClip = 0; SendWeaponAnim( GAUSS_IDLE ); m_fInAttack = 0; } else { PlayEmptySound(3); } m_flNextSecondaryAttack = m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5; return; } if ( m_fInAttack == 0 ) { if ( m_iClip <= 0 ) { PlayEmptySound(3); m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; return; } m_fPrimaryFire = FALSE; m_iClip-=2; m_iFiredAmmo++; m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase(); SendWeaponAnim( GAUSS_SPINUP ); m_fInAttack = 1; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5; m_pPlayer->m_flStartCharge = gpGlobals->time; m_pPlayer->m_flAmmoStartCharge = UTIL_WeaponTimeBase() + GetFullChargeTime(); EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/gauss_charge.wav",1.0 , ATTN_NORM, 0, 110 ); m_iSoundState = SND_CHANGE_PITCH; if ( m_iClip <= 0 ) { StartFire(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; m_iClip = 0; return; } } else if (m_fInAttack == 1) { if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase()) { SendWeaponAnim( GAUSS_SPIN ); m_fInAttack = 2; } } else { // during the charging process, eat one bit of ammo every once in a while if ( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 ) { m_iClip-=2; m_iFiredAmmo++; m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.7; } if ( m_iClip <= 0 ) { // out of ammo! force the gun to fire StartFire(); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1; m_iClip = 0; return; } if ( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge ) { // don't eat any more ammo after gun is fully charged. m_pPlayer->m_flNextAmmoBurn = 1000; } int pitch = ( gpGlobals->time - m_pPlayer->m_flStartCharge ) * ( 150 / GetFullChargeTime() ) + 100; if ( pitch > 250 ) pitch = 250; if ( m_iSoundState == 0 ) EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/gauss_charge.wav", 1.0, ATTN_NORM, m_iSoundState, pitch); m_iSoundState = SND_CHANGE_PITCH; if ( m_pPlayer->m_flStartCharge < gpGlobals->time - 20 ) { // Player charged up too long. Zap him. EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/electro4.wav", 1.0, ATTN_NORM, 0, 80 + RANDOM_LONG(0,0x3f)); EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/electro6.wav", 1.0, ATTN_NORM, 0, 75 + RANDOM_LONG(0,0x3f)); STOP_SOUND( ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/gauss_charge.wav" ); m_fInAttack = 0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0; m_pPlayer->TakeDamage( VARS(eoNullEntity), VARS(eoNullEntity), 105, DMG_SHOCK | DMG_NEVERGIB ); UTIL_ScreenFade( m_pPlayer, Vector(255,128,0), 2, 0.5, 128, FFADE_IN ); SendWeaponAnim( GAUSS_IDLE ); return; } } }