FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

dlls/doors.cpp

131415161718
#include "engine/IEngineSound.h" #include "physics_npc_solver.h" #ifdef HL1_DLL #include "filters.h" #endif
13141516171819202122
#include "engine/IEngineSound.h" #include "physics_npc_solver.h" #include "ff_scriptman.h" //#include "ff_luaobject_wrapper.h" #include "ff_luacontext.h" #ifdef HL1_DLL #include "filters.h" #endif
212223242526
#include "KeyValues.h" #endif // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
252627282930313233
#include "KeyValues.h" #endif #undef MINMAX_H #include "minmax.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
321322323324325326327
void CBaseDoor::MovingSoundThink( void ) { CPASAttenuationFilter filter( this ); filter.MakeReliable(); EmitSound_t ep;
328329330331332333334335336337338339340341
void CBaseDoor::MovingSoundThink( void ) { // --> Mirv: Bug #0000094: Door sounds aren't heard when they're emitted from inside the "void." trace_t tr; UTIL_TraceLine(m_vecPosition1, m_vecPosition2, CONTENTS_SOLID|CONTENTS_MOVEABLE, this, COLLISION_GROUP_NONE, &tr); CPASAttenuationFilter filter((m_toggle_state == TS_GOING_DOWN || m_toggle_state == TS_AT_TOP) ? tr.endpos : tr.startpos); // <-- Mirv: Bug #0000094: Door sounds aren't heard when they're emitted from inside the "void." filter.MakeReliable(); EmitSound_t ep;
448449450451452453454455456457458459
switch ( m_toggle_state ) { case TS_AT_TOP: UpdateAreaPortals( true ); break; case TS_AT_BOTTOM: UpdateAreaPortals( false ); break; } #ifdef HL1_DLL
462463464465466467468469470471472473474475476
switch ( m_toggle_state ) { case TS_AT_BOTTOM: UpdateAreaPortals( false ); break; case TS_GOING_DOWN: case TS_GOING_UP: case TS_AT_TOP: default: UpdateAreaPortals( true ); break; } #ifdef HL1_DLL
591592593594595596
return; } // If door has master, and it's not ready to trigger, // play 'locked' sound. if (m_sMaster != NULL_STRING && !UTIL_IsMasterTriggered(m_sMaster, pOther))
608609610611612613614615616617618619620621622623624625
return; } // TODO: Will need to change this so more than players can trigger doors //CFFLuaObjectWrapper hAllowed; CFFLuaSC hAllowed( 1, pOther ); if( _scriptman.RunPredicates_LUA( this, &hAllowed, "allowed" ) ) { if( !hAllowed.GetBool() ) { _scriptman.RunPredicates_LUA( this, &hAllowed, "onfailtouch" ); return; } } // If door has master, and it's not ready to trigger, // play 'locked' sound. if (m_sMaster != NULL_STRING && !UTIL_IsMasterTriggered(m_sMaster, pOther))
609610611612613614
if (DoorActivate( )) { // Temporarily disable the touch function, until movement is finished. SetTouch( NULL ); }
638639640641642643644
if (DoorActivate( )) { _scriptman.RunPredicates_LUA( this, &hAllowed, "ontouch" ); // Temporarily disable the touch function, until movement is finished. SetTouch( NULL ); }
682683684685686687
return; } // if not ready to be used, ignore "use" command. if (m_toggle_state == TS_AT_BOTTOM || (HasSpawnFlags(SF_DOOR_NO_AUTO_RETURN) && m_toggle_state == TS_AT_TOP) ) {
712713714715716717718719720721722723724725726727728
return; } //CFFLuaObjectWrapper hAllowed; CFFLuaSC hAllowed( 1, pActivator ); if( _scriptman.RunPredicates_LUA( this, &hAllowed, "allowed" ) ) { if( !hAllowed.GetBool() ) { _scriptman.RunPredicates_LUA( this, &hAllowed, "onfailuse" ); return; } } // if not ready to be used, ignore "use" command. if (m_toggle_state == TS_AT_BOTTOM || (HasSpawnFlags(SF_DOOR_NO_AUTO_RETURN) && m_toggle_state == TS_AT_TOP) ) {
691692693694695696
} else { DoorActivate(); } }
732733734735736737738
} else { _scriptman.RunPredicates_LUA( this, &hAllowed, "onuse" ); DoorActivate(); } }
771772773774775776777
//----------------------------------------------------------------------------- void CBaseDoor::InputOpen( inputdata_t &inputdata ) { if (m_toggle_state != TS_AT_TOP && m_toggle_state != TS_GOING_UP ) { // I'm locked, can't open if (m_bLocked)
813814815816817818819820
//----------------------------------------------------------------------------- void CBaseDoor::InputOpen( inputdata_t &inputdata ) { // jon: if already open and being told to open, stay open... if ( /* m_toggle_state != TS_AT_TOP && */ m_toggle_state != TS_GOING_UP ) { // I'm locked, can't open if (m_bLocked)
858859860861862863864
// play door unlock sounds PlayLockSounds(this, &m_ls, FALSE, FALSE); if ( m_toggle_state != TS_AT_TOP && m_toggle_state != TS_GOING_UP ) { DoorGoUp(); }
901902903904905906907908
// play door unlock sounds PlayLockSounds(this, &m_ls, FALSE, FALSE); // jon: if already open and being told to open, stay open... if ( /* m_toggle_state != TS_AT_TOP && */ m_toggle_state != TS_GOING_UP ) { DoorGoUp(); }
876877878879880881
edict_t *pevActivator; UpdateAreaPortals( true ); // It could be going-down, if blocked. ASSERT(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN);
920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
edict_t *pevActivator; UpdateAreaPortals( true ); // jon: if already open and being told to open, stay open... if ( m_toggle_state == TS_AT_TOP ) { // toggle-doors don't come down automatically, they wait for refire. if (HasSpawnFlags( SF_DOOR_NO_AUTO_RETURN)) { // Re-instate touch method, movement is complete SetTouch( &CBaseDoor::DoorTouch ); } else { // set destdelta to the vector needed to move //Vector vecDestDelta = m_vecPosition2 - m_vecPosition1; // divide vector length by speed to get time to reach dest //float flTravelTime = vecDestDelta.Length() / m_flSpeed; // In flWait seconds, DoorGoDown will fire, unless wait is -1, then door stays open //SetMoveDoneTime( m_flWait + (flTravelTime * 2) ); SetMoveDoneTime( m_flWait + 0.25f ); SetMoveDone( &CBaseDoor::DoorGoDown ); if ( m_flWait == -1 ) { SetNextThink( TICK_NEVER_THINK ); } } // seriously, do nothing but stay open return; } // It could be going-down, if blocked. ASSERT(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN);
945946947948949950951
{ if ( !HasSpawnFlags( SF_DOOR_SILENT ) ) { CPASAttenuationFilter filter( this ); filter.MakeReliable(); StopMovingSound();
1022102310241025102610271028102910301031103210331034
{ if ( !HasSpawnFlags( SF_DOOR_SILENT ) ) { // --> Mirv: Bug #0000094: Door sounds aren't heard when they're emitted from inside the "void." trace_t tr; UTIL_TraceLine(m_vecPosition1, m_vecPosition2, CONTENTS_SOLID|CONTENTS_MOVEABLE, this, COLLISION_GROUP_NONE, &tr); CPASAttenuationFilter filter(tr.endpos); // <-- Mirv: Bug #0000094: Door sounds aren't heard when they're emitted from inside the "void." filter.MakeReliable(); StopMovingSound();
1057105810591060106110621063
} // Close the area portals just after the door closes, to prevent visual artifacts in multiplayer games SetContextThink( &CBaseDoor::CloseAreaPortalsThink, gpGlobals->curtime + 0.5f, CLOSE_AREAPORTAL_THINK_CONTEXT ); }
1140114111421143114411451146
} // Close the area portals just after the door closes, to prevent visual artifacts in multiplayer games SetContextThink( &CBaseDoor::CloseAreaPortalsThink, gpGlobals->curtime + 1.0f, CLOSE_AREAPORTAL_THINK_CONTEXT ); }
113711381139114011411142
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)
12201221122212231224122512261227122812291230
if ( m_bForceClosed ) return; // --> Mirv: #0000356: Packs, grens keeping doors from closing if (pOther->GetCollisionGroup() == COLLISION_GROUP_WEAPON || pOther->GetCollisionGroup() == COLLISION_GROUP_PROJECTILE) return; // <-- Mirv: #0000356: Packs, grens keeping doors from closing // 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)