//----------------------------------------------------------------------------- // Purpose: Closes the door if it is not already closed. //----------------------------------------------------------------------------- void CBaseDoor::InputClose( inputdata_t &inputdata ) { if ( m_toggle_state != TS_AT_BOTTOM ) { DoorGoDown(); } }
/* <698be> ../cstrike/dlls/doors.cpp:946 */ void CRotDoor::__MAKE_VHOOK(Restart)(void) { CBaseToggle::AxisDir(pev); if (pev->spawnflags & SF_DOOR_ROTATE_BACKWARDS) { pev->movedir = pev->movedir * -1; } if (pev->speed == 0) pev->speed = 100; if (pev->spawnflags & SF_DOOR_START_OPEN) { pev->angles = m_vecAngle2; Vector vecSav = m_vecAngle1; m_vecAngle2 = m_vecAngle1; m_vecAngle1 = vecSav; pev->movedir = pev->movedir * -1; } m_toggle_state = TS_AT_BOTTOM; DoorGoDown(); }
// // Causes the door to "do its thing", i.e. start moving, and cascade activation. // int CBaseDoor::DoorActivate( ) { if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return 0; if (FBitSet(pev->spawnflags, SF_DOOR_NO_AUTO_RETURN) && m_toggle_state == TS_AT_TOP) {// door should close DoorGoDown(); } else {// door should open if ( m_hActivator != NULL && m_hActivator->IsPlayer() ) {// give health if player opened the door (medikit) // VARS( m_eoActivator )->health += m_bHealthValue; m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC ); } // play door unlock sounds PlayLockSounds(pev, &m_ls, FALSE, FALSE); DoorGoUp(); } return 1; }
// // Causes the door to "do its thing", i.e. start moving, and cascade activation. // int CBaseDoor::DoorActivate() { if( !UTIL_IsMasterTriggered( m_sMaster, m_hActivator ) ) return 0; if( GetSpawnFlags().Any( SF_DOOR_NO_AUTO_RETURN ) && m_toggle_state == TS_AT_TOP ) {// door should close DoorGoDown(); } else {// door should open if( m_hActivator != NULL && m_hActivator->IsPlayer() ) { // give health if player opened the door (medikit) m_hActivator->GiveHealth( m_bHealthValue, DMG_GENERIC ); } // play door unlock sounds PlayLockSounds( this, &m_ls, false, false ); DoorGoUp(); } return 1; }
/* <69949> ../cstrike/dlls/doors.cpp:334 */ void CBaseDoor::__MAKE_VHOOK(Restart)(void) { SetMovedir(pev); m_toggle_state = TS_AT_BOTTOM; DoorGoDown(); if (pev->spawnflags & SF_DOOR_USE_ONLY) SetTouch(NULL); else SetTouch(&CBaseDoor::DoorTouch); }
void CBaseDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { m_hActivator = pActivator; if( !FStringNull( m_iChainTarget )) ChainUse( useType, value ); m_bDoorTouched = false; if( IsLockedByMaster( )) { PlayLockSounds( pev, &m_ls, TRUE, FALSE ); return; } if( FBitSet( pev->spawnflags, SF_DOOR_ONOFF_MODE )) { if( useType == USE_ON ) { if( m_iState == STATE_OFF ) { // door should open if( m_hActivator != NULL && m_hActivator->IsPlayer( )) m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC ); PlayLockSounds( pev, &m_ls, FALSE, FALSE ); DoorGoUp(); } return; } else if( useType == USE_OFF ) { if( m_iState == STATE_ON ) { DoorGoDown(); } return; } else if( useType == USE_SET ) { // change texture pev->frame = !pev->frame; return; } } // if not ready to be used, ignore "use" command. if( m_iState == STATE_OFF || FBitSet( pev->spawnflags, SF_DOOR_NO_AUTO_RETURN ) && m_iState == STATE_ON ) DoorActivate(); }
//----------------------------------------------------------------------------- // Purpose: Opens the door if it is not already open. //----------------------------------------------------------------------------- void CBaseDoor::InputToggle( inputdata_t &inputdata ) { // I'm locked, can't open if (m_bLocked) return; if (m_toggle_state == TS_AT_BOTTOM) { DoorGoUp(); } else if (m_toggle_state == TS_AT_TOP) { DoorGoDown(); } }
// // Used by SUB_UseTargets, when a door is the target of a button. // void CBaseDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { m_hActivator = pActivator; if (!UTIL_IsMasterTriggered(m_sMaster, pActivator)) return; if (m_iSpeedMode==1){ //AJH for changing door speeds pev->speed+=m_fAcceleration; DoorActivate(); ALERT(at_debug, "speed increased by %f and is now %f\n", m_fAcceleration,pev->speed); } else{ if (m_iOnOffMode) { if (useType == USE_ON) { if (m_toggle_state == TS_AT_BOTTOM) { PlayLockSounds(pev, &m_ls, FALSE, FALSE); DoorGoUp(); } return; } else if (useType == USE_OFF) { if (m_toggle_state == TS_AT_TOP) { DoorGoDown(); } return; } } // if not ready to be used, ignore "use" command. if (m_toggle_state == TS_AT_TOP) { if (!FBitSet(pev->spawnflags, SF_DOOR_NO_AUTO_RETURN)) return; } else if (m_toggle_state != TS_AT_BOTTOM) return; DoorActivate(); } }
void CBaseTrainDoor::Blocked( CBaseEntity *pOther ) { if( door_state == TD_SHIFT_UP ) { DoorGoDown( ); } else if( door_state == TD_SHIFT_DOWN ) { DoorGoUp( ); } else if( door_state == TD_SLIDING_UP ) { DoorSlideDown( ); } else if( door_state == TD_SLIDING_DOWN ) { DoorSlideUp( ); } }
BOOL CBaseDoor::DoorActivate( void ) { if( IsLockedByMaster( )) return 0; if( FBitSet(pev->spawnflags, SF_DOOR_NO_AUTO_RETURN ) && m_iState == STATE_ON ) { // door should close DoorGoDown(); } else { // door should open if( m_hActivator != NULL && m_hActivator->IsPlayer( )) m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC ); // play door unlock sounds PlayLockSounds( pev, &m_ls, FALSE, FALSE ); DoorGoUp(); } return 1; }
// // Causes the door to "do its thing", i.e. start moving, and cascade activation. // int CBaseDoor::DoorActivate( ) { if ( CHalfLifeRules *rules = dynamic_cast<CHalfLifeRules *>( g_pGameRules ) ) { if ( rules->EntityShouldBePrevented( edict() ) ) { return 0; } } if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return 0; if (FBitSet(pev->spawnflags, SF_DOOR_NO_AUTO_RETURN) && m_toggle_state == TS_AT_TOP) {// door should close DoorGoDown(); } else {// door should open if ( m_hActivator != NULL && m_hActivator->IsPlayer() ) {// give health if player opened the door (medikit) // VARS( m_eoActivator )->health += m_bHealthValue; m_hActivator->TakeHealth( m_bHealthValue, DMG_GENERIC ); } // play door unlock sounds PlayLockSounds(pev, &m_ls, FALSE, FALSE); DoorGoUp(); } if ( CHalfLifeRules *singlePlayerRules = dynamic_cast< CHalfLifeRules * >( g_pGameRules ) ) { singlePlayerRules->HookModelIndex( this->edict() ); } return 1; }
//----------------------------------------------------------------------------- // Purpose: Causes the door to "do its thing", i.e. start moving, and cascade activation. // Output : int //----------------------------------------------------------------------------- int CBaseDoor::DoorActivate( ) { if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return 0; if (HasSpawnFlags(SF_DOOR_NO_AUTO_RETURN) && m_toggle_state == TS_AT_TOP) { // door should close DoorGoDown(); } else { // door should open // play door unlock sounds PlayLockSounds(this, &m_ls, FALSE, FALSE); if ( m_toggle_state != TS_AT_TOP && m_toggle_state != TS_GOING_UP ) { DoorGoUp(); } } return 1; }
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(); } } } }
void CBaseDoor::Blocked( CBaseEntity *pOther ) { edict_t *pentTarget = NULL; CBaseDoor *pDoor = NULL; // 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 (m_toggle_state == TS_GOING_DOWN) { DoorGoUp(); } else { DoorGoDown(); } } // Block all door pieces with the same targetname here. if ( !FStringNull ( pev->targetname ) ) { for (;;) { 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; pDoor->pev->velocity = g_vecZero;// stop! } else {// set angles to realign rotating doors pDoor->pev->angles = pev->angles; pDoor->pev->avelocity = g_vecZero; } } if ( pDoor->m_toggle_state == TS_GOING_DOWN) pDoor->DoorGoUp(); else pDoor->DoorGoDown(); } } } } } }
//----------------------------------------------------------------------------- // Purpose: Called every frame when the door is blocked while opening or closing. // Input : pOther - The blocking entity. //----------------------------------------------------------------------------- void CBaseDoor::Blocked( CBaseEntity *pOther ) { // Hurt the blocker a little. if ( m_flBlockDamage ) { // if the door is marked "force closed" or it has a negative wait, then there's nothing to do but // push/damage the object. // If block damage is set, but this object is a physics prop that can't be damaged, just // give up and disable collisions if ( (m_bForceClosed || m_flWait < 0) && pOther->GetMoveType() == MOVETYPE_VPHYSICS && (pOther->m_takedamage == DAMAGE_NO || pOther->m_takedamage == DAMAGE_EVENTS_ONLY) ) { EntityPhysics_CreateSolver( this, pOther, true, 4.0f ); } else { pOther->TakeDamage( CTakeDamageInfo( this, this, m_flBlockDamage, DMG_CRUSH ) ); } } // If we're set to force ourselves closed, keep going if ( m_bForceClosed ) return; // 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 ( GetEntityName() != NULL_STRING ) { 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->m_vecMoveDir == m_vecMoveDir && pDoor->GetAbsVelocity() == GetAbsVelocity() && pDoor->GetLocalAngularVelocity() == GetLocalAngularVelocity()) { pDoor->m_nSimulationTick = m_nSimulationTick; // don't run simulation 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( vec3_origin );// stop! } else {// set angles to realign rotating doors pDoor->SetLocalAngles( GetLocalAngles() ); pDoor->SetLocalAngularVelocity( vec3_angle ); } } if ( pDoor->m_toggle_state == TS_GOING_DOWN) 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 CBaseDoor::Blocked( CBaseEntity *pOther ) { CBaseDoor *pDoor = NULL; // Hurt the blocker a little. if( GetDamage() ) pOther->TakeDamage( this, this, GetDamage(), 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( m_toggle_state == TS_GOING_DOWN ) { DoorGoUp(); } else { DoorGoDown(); } } // Block all door pieces with the same targetname here. if( HasTargetname() ) { CBaseEntity* pTarget = nullptr; while( ( pTarget = UTIL_FindEntityByTargetname( pTarget, GetTargetname() ) ) != nullptr ) { if( pTarget != this ) { if( pTarget->ClassnameIs( "func_door" ) || pTarget->ClassnameIs( "func_door_rotating" ) ) { pDoor = static_cast<CBaseDoor*>( pTarget ); if( pDoor->m_flWait >= 0 ) { //TODO: comparing avel with vel is probably wrong - Solokiller if( pDoor->GetAbsVelocity() == GetAbsVelocity() && pDoor->GetAngularVelocity() == GetAbsVelocity() ) { // this is the most hacked, evil, bastardized thing I've ever seen. kjb if( pTarget->ClassnameIs( "func_door" ) ) {// set origin to realign normal doors pDoor->SetAbsOrigin( GetAbsOrigin() ); pDoor->SetAbsVelocity( g_vecZero );// stop! } else {// set angles to realign rotating doors pDoor->SetAbsAngles( GetAbsAngles() ); pDoor->SetAngularVelocity( g_vecZero ); } } if( !GetSpawnFlags().Any( SF_DOOR_SILENT ) ) STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMoving ) ); if( pDoor->m_toggle_state == TS_GOING_DOWN ) pDoor->DoorGoUp(); else pDoor->DoorGoDown(); } } } } } }
void CBaseDoor::Blocked( CBaseEntity *pOther ) { CBaseEntity *pTarget = NULL; CBaseDoor *pDoor = NULL; // ALERT(at_debug, "%s blocked\n", STRING(pev->targetname)); // Hurt the blocker a little. if ( pev->dmg ) if (m_hActivator) pOther->TakeDamage( pev, m_hActivator->pev, pev->dmg, DMG_CRUSH ); //AJH Attribute damage to he who switched me. else 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) { //LRC - thanks to [insert name here] for this if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) ) STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving) ); if (m_toggle_state == TS_GOING_DOWN) { DoorGoUp(); } else { DoorGoDown(); } } // Block all door pieces with the same targetname here. //LRC - in immediate mode don't do this, doors are expected to do it themselves. if ( !m_iImmediateMode && !FStringNull ( pev->targetname ) ) { for (;;) { pTarget = UTIL_FindEntityByTargetname(pTarget, STRING(pev->targetname)); if ( !pTarget ) break; if ( VARS( pTarget->pev ) != pev && FClassnameIs ( pTarget->pev, "func_door" ) || FClassnameIs ( pTarget->pev, "func_door_rotating" ) ) { pDoor = GetClassPtr( (CBaseDoor *) VARS(pTarget->pev) ); if ( pDoor->m_flWait >= 0) { // avelocity == velocity!? LRC 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 ( pTarget->pev, "func_door" ) ) {// set origin to realign normal doors pDoor->pev->origin = pev->origin; UTIL_SetVelocity(pDoor, g_vecZero);// stop! } else {// set angles to realign rotating doors pDoor->pev->angles = pev->angles; UTIL_SetAvelocity(pDoor, g_vecZero); } } if ( pDoor->m_toggle_state == TS_GOING_DOWN) pDoor->DoorGoUp(); else pDoor->DoorGoDown(); } } } } }