本文整理汇总了C++中DevMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ DevMsg函数的具体用法?C++ DevMsg怎么用?C++ DevMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DevMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UTIL_GetLocalPlayer
CNPCSpawnDestination *CTemplateNPCMaker::FindSpawnDestination()
{
CNPCSpawnDestination *pDestinations[ MAX_DESTINATION_ENTS ];
CBaseEntity *pEnt = NULL;
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
int count = 0;
if( !pPlayer )
{
return NULL;
}
// Collect all the qualifiying destination ents
pEnt = gEntList.FindEntityByName( NULL, m_iszDestinationGroup );
if( !pEnt )
{
DevWarning("Template NPC Spawner (%s) doesn't have any spawn destinations!\n", GetDebugName() );
return NULL;
}
while( pEnt )
{
CNPCSpawnDestination *pDestination;
pDestination = dynamic_cast <CNPCSpawnDestination*>(pEnt);
if( pDestination && pDestination->IsAvailable() )
{
bool fValid = true;
Vector vecTest = pDestination->GetAbsOrigin();
if( m_CriterionVisibility != TS_YN_DONT_CARE )
{
// Right now View Cone check is omitted intentionally.
Vector vecTopOfHull = NAI_Hull::Maxs( HULL_HUMAN );
vecTopOfHull.x = 0;
vecTopOfHull.y = 0;
bool fVisible = (pPlayer->FVisible( vecTest ) || pPlayer->FVisible( vecTest + vecTopOfHull ) );
if( m_CriterionVisibility == TS_YN_YES )
{
if( !fVisible )
fValid = false;
}
else
{
if( fVisible )
{
if ( !(pPlayer->GetFlags() & FL_NOTARGET) )
fValid = false;
else
DevMsg( 2, "Spawner %s spawning even though seen due to notarget\n", STRING( GetEntityName() ) );
}
}
}
if( fValid )
{
pDestinations[ count ] = pDestination;
count++;
}
}
pEnt = gEntList.FindEntityByName( pEnt, m_iszDestinationGroup );
}
if( count < 1 )
return NULL;
// Now find the nearest/farthest based on distance criterion
if( m_CriterionDistance == TS_DIST_DONT_CARE )
{
// Pretty lame way to pick randomly. Try a few times to find a random
// location where a hull can fit. Don't try too many times due to performance
// concerns.
for( int i = 0 ; i < 5 ; i++ )
{
CNPCSpawnDestination *pRandomDest = pDestinations[ rand() % count ];
if( HumanHullFits( pRandomDest->GetAbsOrigin() ) )
{
return pRandomDest;
}
}
return NULL;
}
else
{
if( m_CriterionDistance == TS_DIST_NEAREST )
{
float flNearest = FLT_MAX;
CNPCSpawnDestination *pNearest = NULL;
for( int i = 0 ; i < count ; i++ )
{
Vector vecTest = pDestinations[ i ]->GetAbsOrigin();
float flDist = ( vecTest - pPlayer->GetAbsOrigin() ).Length();
//.........这里部分代码省略.........
示例2: Assert
//-----------------------------------------------------------------------------
// Purpose: Init_ForceFeedback
//-----------------------------------------------------------------------------
void CInput::Init_ForceFeedback()
{
// abort startup if user requests no joystick
if ( CommandLine()->FindParm("-noff" ) )
{
return;
}
Assert( !m_pFF );
m_pFF = new ForceFeedbackParams_t;
Assert( m_pFF );
Q_memset( m_pFF, 0, sizeof( *m_pFF ) );
HRESULT hr = DirectInput8Create(GetModuleHandle(0), DIRECTINPUT_VERSION,
IID_IDirectInput8, (void**)&m_pFF->m_pIInput, NULL );
if ( FAILED( hr ) )
{
return;
}
hr = m_pFF->m_pIInput->CreateDevice(GUID_Joystick, &m_pFF->m_pIJoystick, NULL );
if ( FAILED( hr ) )
{
return;
}
hr = m_pFF->m_pIJoystick->SetDataFormat(&c_dfDIJoystick2 );
if ( FAILED( hr ) )
{
return;
}
HWND mainWnd = (HWND)g_pEngineWindow->GetWindowHandle();
hr = m_pFF->m_pIJoystick->SetCooperativeLevel( mainWnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
if ( FAILED( hr ) )
{
return;
}
DIPROPDWORD dwd;
//The following code turns the center spring off
dwd.diph.dwSize = sizeof(DIPROPDWORD);
dwd.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dwd.diph.dwObj = 0;
dwd.diph.dwHow = DIPH_DEVICE;
dwd.dwData = FALSE;
if ( !ff_autocenter.GetBool() )
{
hr = m_pFF->m_pIJoystick->SetProperty( DIPROP_AUTOCENTER, &dwd.diph );
if ( FAILED( hr ) )
{
return;
}
}
// Acquire the device
hr = m_pFF->m_pIJoystick->Acquire();
if( FAILED( hr ) )
{
return;
}
DIDEVCAPS diDevCaps;
Q_memset( &diDevCaps, 0, sizeof( diDevCaps ) );
diDevCaps.dwSize = sizeof( diDevCaps );
hr = m_pFF->m_pIJoystick->GetCapabilities( &diDevCaps );
if ( FAILED( hr ) )
{
DevMsg( "GetCapabilities failed\n" );
return;
}
if ( !( diDevCaps.dwFlags & DIDC_FORCEFEEDBACK ) )
{
// Doesn't support FF
return;
}
DIDEVICEINSTANCE diDI;
Q_memset( &diDI, 0, sizeof( diDI ) );
diDI.dwSize = sizeof( diDI );
hr = m_pFF->m_pIJoystick->GetDeviceInfo( &diDI );
if ( FAILED( hr ) )
{
DevMsg( "GetDeviceInfo failed\n" );
return;
}
//.........这里部分代码省略.........
示例3: RagdollSolveSeparation
void RagdollSolveSeparation( ragdoll_t &ragdoll, CBaseEntity *pEntity )
{
byte needsFix[256];
int fixCount = 0;
Assert(ragdoll.listCount<=ARRAYSIZE(needsFix));
for ( int i = 0; i < ragdoll.listCount; i++ )
{
needsFix[i] = 0;
const ragdollelement_t &element = ragdoll.list[i];
if ( element.pConstraint && element.parentIndex >= 0 )
{
Vector start, target;
element.pObject->GetPosition( &start, NULL );
ragdoll.list[element.parentIndex].pObject->LocalToWorld( &target, element.originParentSpace );
if ( needsFix[element.parentIndex] )
{
needsFix[i] = 1;
++fixCount;
continue;
}
Vector dir = target-start;
if ( dir.LengthSqr() > 1.0f )
{
// this fixes a bug in ep2 with antlion grubs, but causes problems in TF2 - revisit, but disable for TF now
#if !defined(TF_CLIENT_DLL)
// heuristic: guess that anything separated and small mass ratio is in some state that's
// keeping the solver from fixing it
float mass = element.pObject->GetMass();
float massParent = ragdoll.list[element.parentIndex].pObject->GetMass();
if ( mass*2.0f < massParent )
{
// if this is <0.5 mass of parent and still separated it's attached to something heavy or
// in a bad state
needsFix[i] = 1;
++fixCount;
continue;
}
#endif
if ( PhysHasContactWithOtherInDirection(element.pObject, dir) )
{
Ray_t ray;
trace_t tr;
ray.Init( target, start );
UTIL_TraceRay( ray, MASK_SOLID, pEntity, COLLISION_GROUP_NONE, &tr );
if ( tr.DidHit() )
{
needsFix[i] = 1;
++fixCount;
}
}
}
}
}
if ( fixCount )
{
for ( int i = 0; i < ragdoll.listCount; i++ )
{
if ( !needsFix[i] )
continue;
const ragdollelement_t &element = ragdoll.list[i];
Vector target, velocity;
ragdoll.list[element.parentIndex].pObject->LocalToWorld( &target, element.originParentSpace );
ragdoll.list[element.parentIndex].pObject->GetVelocityAtPoint( target, &velocity );
matrix3x4_t xform;
element.pObject->GetPositionMatrix( &xform );
MatrixSetColumn( target, 3, xform );
element.pObject->SetPositionMatrix( xform, true );
element.pObject->SetVelocity( &velocity, &vec3_origin );
}
DevMsg(2, "TICK:%5d:Ragdoll separation count: %d\n", gpGlobals->tickcount, fixCount );
}
else
{
ragdoll.pGroup->ClearErrorState();
}
}
示例4: switch
CBaseEntity *CTFWeaponBaseGun::FireProjectile( CTFPlayer *pPlayer )
{
int iProjectile = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_iProjectile;
CBaseEntity *pProjectile = NULL;
switch( iProjectile )
{
case TF_PROJECTILE_BULLET:
FireBullet( pPlayer );
break;
case TF_PROJECTILE_ROCKET:
pProjectile = FireRocket( pPlayer );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
break;
case TF_PROJECTILE_SYRINGE:
pProjectile = FireNail( pPlayer, iProjectile );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
break;
case TF_PROJECTILE_NAIL:
pProjectile = FireNail(pPlayer, iProjectile);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);
break;
case TF_PROJECTILE_DART:
pProjectile = FireNail(pPlayer, iProjectile);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);
break;
case TF_PROJECTILE_PIPEBOMB:
pProjectile = FirePipeBomb( pPlayer, false );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
break;
case TF_PROJECTILE_PIPEBOMB_REMOTE:
pProjectile = FirePipeBomb( pPlayer, true );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
break;
case TF_PROJECTILE_FLARE:
pProjectile = FireFlare(pPlayer);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);
break;
case TF_PROJECTILE_NONE:
default:
// do nothing!
DevMsg( "Weapon does not have a projectile type set\n" );
break;
}
if ( m_iClip1 != -1 )
{
m_iClip1 -= m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_iAmmoPerShot;
}
else
{
if ( m_iWeaponMode == TF_WEAPON_PRIMARY_MODE )
{
pPlayer->RemoveAmmo( m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_iAmmoPerShot, m_iPrimaryAmmoType );
}
else
{
pPlayer->RemoveAmmo( m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_iAmmoPerShot, m_iSecondaryAmmoType );
}
}
DoFireEffects();
UpdatePunchAngles( pPlayer );
return pProjectile;
}
示例5: GetMoveProbe
//-----------------------------------------------------------------------------
// Step iteratively toward a destination position
//-----------------------------------------------------------------------------
AIMotorMoveResult_t CAI_Motor::MoveGroundStep( const Vector &newPos, CBaseEntity *pMoveTarget, float yaw, bool bAsFarAsCan, bool bTestZ, AIMoveTrace_t *pTraceResult )
{
// By definition, this will produce different results than GroundMoveLimit()
// because there's no guarantee that it will step exactly one step
// See how far toward the new position we can step...
// But don't actually test for ground geometric validity;
// if it isn't valid, there's not much we can do about it
AIMoveTrace_t moveTrace;
unsigned testFlags = AITGM_IGNORE_FLOOR;
char *pchHackBoolToInt = (char*)(&bTestZ);
if ( *pchHackBoolToInt == 2 )
{
testFlags |= AITGM_CRAWL_LARGE_STEPS;
}
else
{
if ( !bTestZ )
testFlags |= AITGM_2D;
}
#ifdef DEBUG
if ( ai_draw_motor_movement.GetBool() )
testFlags |= AITGM_DRAW_RESULTS;
#endif
GetMoveProbe()->TestGroundMove( GetLocalOrigin(), newPos, GetOuter()->GetAITraceMask(), testFlags, &moveTrace );
if ( pTraceResult )
{
*pTraceResult = moveTrace;
}
bool bHitTarget = (moveTrace.pObstruction && (pMoveTarget == moveTrace.pObstruction ));
// Move forward either if there was no obstruction or if we're told to
// move as far as we can, regardless
bool bIsBlocked = IsMoveBlocked(moveTrace.fStatus);
if ( !bIsBlocked || bAsFarAsCan || bHitTarget )
{
#ifdef DEBUG
if ( GetMoveProbe()->CheckStandPosition( GetLocalOrigin(), GetOuter()->GetAITraceMask() ) && !GetMoveProbe()->CheckStandPosition( moveTrace.vEndPosition, GetOuter()->GetAITraceMask() ) )
{
DevMsg( 2, "Warning: AI motor probably given invalid instructions\n" );
}
#endif
// The true argument here causes it to touch all triggers
// in the volume swept from the previous position to the current position
UTIL_SetOrigin(GetOuter(), moveTrace.vEndPosition, true);
// check to see if our ground entity has changed
// NOTE: This is to detect changes in ground entity as the movement code has optimized out
// ground checks. So now we have to do a simple recheck to make sure we detect when we've
// stepped onto a new entity.
if ( GetOuter()->GetFlags() & FL_ONGROUND )
{
GetOuter()->PhysicsStepRecheckGround();
}
// skip tiny steps, but notify the shadow object of any large steps
if ( moveTrace.flStepUpDistance > 0.1f )
{
float height = clamp( moveTrace.flStepUpDistance, 0, StepHeight() );
IPhysicsObject *pPhysicsObject = GetOuter()->VPhysicsGetObject();
if ( pPhysicsObject )
{
IPhysicsShadowController *pShadow = pPhysicsObject->GetShadowController();
if ( pShadow )
{
pShadow->StepUp( height );
}
}
}
if ( yaw != -1 )
{
QAngle angles = GetLocalAngles();
angles.y = yaw;
SetLocalAngles( angles );
}
if ( bHitTarget )
return AIM_PARTIAL_HIT_TARGET;
if ( !bIsBlocked )
return AIM_SUCCESS;
if ( moveTrace.fStatus == AIMR_BLOCKED_NPC )
return AIM_PARTIAL_HIT_NPC;
return AIM_PARTIAL_HIT_WORLD;
}
return AIM_FAILED;
}
示例6: DevMsg
void CGameClientListener::SetupEntityVisibility(edict_t *apEntity, IGameClient *apClient, byte **apPVS, byte **apPAS)
{
DevMsg(eMsgType_Info, "[TRACE] CGameClientCallbacks::SetupEntityVisibility\n");
};
示例7: DevMsg
CClientGameDLL::~CClientGameDLL()
{
DevMsg(eDevMsg_Info, "Destructing the client game dll module...\n");
};
示例8: pRenderContext
float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
{
if ( !IsValid() )
return 0.0f;
if ( !m_wasQueriedThisFrame )
{
CMatRenderContextPtr pRenderContext( materials );
m_wasQueriedThisFrame = true;
int pixels = -1;
int pixelsPossible = -1;
if ( r_pixelvisibility_partial.GetBool() )
{
if ( m_frameIssued != -1 )
{
pixelsPossible = pRenderContext->OcclusionQuery_GetNumPixelsRendered( m_queryHandleCount );
pixels = pRenderContext->OcclusionQuery_GetNumPixelsRendered( m_queryHandle );
}
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, m_queryHandle, pixelsPossible, m_queryHandleCount, gpGlobals->framecount );
}
if ( pixels < 0 || pixelsPossible < 0 )
{
m_failed = ( m_frameIssued >= 0 ) ? true : false;
return m_brightnessTarget * m_clipFraction;
}
m_hasValidQueryResults = true;
if ( pixelsPossible > 0 )
{
float target = (float)pixels / (float)pixelsPossible;
target = (target >= 0.95f) ? 1.0f : (target < 0.0f) ? 0.0f : target;
float rate = gpGlobals->frametime * fadeTimeInv;
m_brightnessTarget = Approach( target, m_brightnessTarget, rate ); // fade in / out
}
else
{
m_brightnessTarget = 0.0f;
}
}
else
{
if ( m_frameIssued != -1 )
{
pixels = pRenderContext->OcclusionQuery_GetNumPixelsRendered( m_queryHandle );
}
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, m_queryHandle, gpGlobals->framecount );
}
if ( pixels < 0 )
{
m_failed = ( m_frameIssued >= 0 ) ? true : false;
return m_brightnessTarget * m_clipFraction;
}
m_hasValidQueryResults = true;
if ( m_frameIssued == gpGlobals->framecount-1 )
{
float rate = gpGlobals->frametime * fadeTimeInv;
float target = 0.0f;
if ( pixels > 0 )
{
// fade in slower than you fade out
rate *= 0.5f;
target = 1.0f;
}
m_brightnessTarget = Approach( target, m_brightnessTarget, rate ); // fade in / out
}
else
{
m_brightnessTarget = 0.0f;
}
}
}
return m_brightnessTarget * m_clipFraction;
}
示例9: MakeNPCInRadius
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTemplateNPCMaker::MakeNPC( void )
{
// If we should be using the radius spawn method instead, do so
if ( m_flRadius && HasSpawnFlags(SF_NPCMAKER_ALWAYSUSERADIUS) )
{
MakeNPCInRadius();
return;
}
if (!CanMakeNPC( ( m_iszDestinationGroup != NULL_STRING ) ))
return;
CNPCSpawnDestination *pDestination = NULL;
if ( m_iszDestinationGroup != NULL_STRING )
{
pDestination = FindSpawnDestination();
if ( !pDestination )
{
DevMsg( 2, "%s '%s' failed to find a valid spawnpoint in destination group: '%s'\n", GetClassname(), STRING(GetEntityName()), STRING(m_iszDestinationGroup) );
return;
}
}
CAI_BaseNPC *pent = NULL;
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
if ( pEntity != NULL )
{
pent = (CAI_BaseNPC *)pEntity;
}
if ( !pent )
{
Warning("NULL Ent in NPCMaker!\n" );
return;
}
if ( pDestination )
{
pent->SetAbsOrigin( pDestination->GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = pDestination->GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
pDestination->OnSpawnedNPC( pent );
}
else
{
pent->SetAbsOrigin( GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
}
m_OnSpawnNPC.Set( pEntity, pEntity, this );
if ( m_spawnflags & SF_NPCMAKER_FADE )
{
pent->AddSpawnFlags( SF_NPC_FADE_CORPSE );
}
pent->RemoveSpawnFlags( SF_NPC_TEMPLATE );
if ( ( m_spawnflags & SF_NPCMAKER_NO_DROP ) == false )
{
pent->RemoveSpawnFlags( SF_NPC_FALL_TO_GROUND ); // don't fall, slam
}
ChildPreSpawn( pent );
DispatchSpawn( pent );
pent->SetOwnerEntity( this );
DispatchActivate( pent );
ChildPostSpawn( pent );
m_nLiveChildren++;// count this NPC
if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
{
m_nMaxNumNPCs--;
if ( IsDepleted() )
{
m_OnAllSpawned.FireOutput( this, this );
// Disable this forever. Don't kill it because it still gets death notices
SetThink( NULL );
SetUse( NULL );
}
}
//.........这里部分代码省略.........
示例10: DevMsg
//-----------------------------------------------------------------------------
// Purpose:
// Output : int
//-----------------------------------------------------------------------------
int CAI_PolicingBehavior::SelectSchedule( void )
{
CBaseEntity *pTarget = m_hPoliceGoal->GetTarget();
// Validate our target
if ( pTarget == NULL )
{
DevMsg( "ai_goal_police with NULL target entity!\n" );
// Turn us off
Disable();
return SCHED_NONE;
}
// Attack if we're supposed to
if ( ( m_flAggressiveTime >= gpGlobals->curtime ) && HasCondition( COND_CAN_MELEE_ATTACK1 ) )
{
return SCHED_MELEE_ATTACK1;
}
// See if we should immediately begin to attack our target
if ( HasCondition( COND_POLICE_TARGET_TOO_CLOSE_SUPPRESS ) )
{
return SelectSuppressSchedule();
}
int newSchedule = SCHED_NONE;
// See if we're harassing
if ( HasCondition( COND_POLICE_TARGET_TOO_CLOSE_HARASS ) )
{
newSchedule = SelectHarassSchedule();
}
// Return that schedule if it was found
if ( newSchedule != SCHED_NONE )
return newSchedule;
// If our enemy is set, fogeda'bout it!
if ( m_flAggressiveTime < gpGlobals->curtime )
{
// Return to your initial spot
if ( GetEnemy() )
{
GetOuter()->SetEnemy( NULL );
GetOuter()->SetState( NPC_STATE_ALERT );
GetOuter()->GetEnemies()->RefreshMemories();
}
HostSetBatonState( false );
m_bTargetIsHostile = false;
}
// If we just started to police, make sure we're on our mark
if ( MaintainGoalPosition() )
return SCHED_POLICE_RETURN_FROM_HARASS;
// If I've got my baton on, keep looking at the target
if ( HostBatonIsOn() )
return SCHED_POLICE_TRACK_TARGET;
// Re-align myself to the goal angles if I've strayed
if ( fabs(UTIL_AngleDiff( GetAbsAngles().y, m_hPoliceGoal->GetAbsAngles().y )) > 15 )
return SCHED_POLICE_FACE_ALONG_GOAL;
return SCHED_IDLE_STAND;
}
示例11: stepsize
//.........这里部分代码省略.........
CSoundEnt::InitSoundEnt();
// Only allow precaching between LevelInitPreEntity and PostEntity
CBaseEntity::SetAllowPrecache( true );
IGameSystem::LevelInitPreEntityAllSystems( STRING( GetModelName() ) );
// Create the player resource
g_pGameRules->CreateStandardEntities();
// UNDONE: Make most of these things server systems or precache_registers
// =================================================
// Activities
// =================================================
ActivityList_Free();
RegisterSharedActivities();
EventList_Free();
RegisterSharedEvents();
// InitBodyQue();
// init sentence group playback stuff from sentences.txt.
// ok to call this multiple times, calls after first are ignored.
SENTENCEG_Init();
// Precache standard particle systems
PrecacheStandardParticleSystems( );
// the area based ambient sounds MUST be the first precache_sounds
// player precaches
W_Precache (); // get weapon precaches
ClientPrecache();
g_pGameRules->Precache();
// precache all temp ent stuff
CBaseTempEntity::PrecacheTempEnts();
g_Language.SetValue( LANGUAGE_ENGLISH ); // TODO use VGUI to get current language
if ( g_Language.GetInt() == LANGUAGE_GERMAN )
{
PrecacheModel( "models/germangibs.mdl" );
}
else
{
PrecacheModel( "models/gibs/hgibs.mdl" );
}
PrecacheScriptSound( "BaseEntity.EnterWater" );
PrecacheScriptSound( "BaseEntity.ExitWater" );
//
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
//
for ( int i = 0; i < ARRAYSIZE(g_DefaultLightstyles); i++ )
{
engine->LightStyle( i, GetDefaultLightstyleString(i) );
}
// styles 32-62 are assigned by the light program for switchable lights
// 63 testing
engine->LightStyle(63, "a");
// =================================================
// Load and Init AI Networks
// =================================================
CAI_NetworkManager::InitializeAINetworks();
// =================================================
// Load and Init AI Schedules
// =================================================
g_AI_SchedulesManager.LoadAllSchedules();
// =================================================
// Initialize NPC Relationships
// =================================================
g_pGameRules->InitDefaultAIRelationships();
CBaseCombatCharacter::InitInteractionSystem();
// Call all registered precachers.
CPrecacheRegister::Precache();
if ( m_iszChapterTitle != NULL_STRING )
{
DevMsg( 2, "Chapter title: %s\n", STRING(m_iszChapterTitle) );
CMessage *pMessage = (CMessage *)CBaseEntity::Create( "env_message", vec3_origin, vec3_angle, NULL );
if ( pMessage )
{
pMessage->SetMessage( m_iszChapterTitle );
m_iszChapterTitle = NULL_STRING;
// send the message entity a play message command, delayed by 1 second
pMessage->AddSpawnFlags( SF_MESSAGE_ONCE );
pMessage->SetThink( &CMessage::SUB_CallUseToggle );
pMessage->SetNextThink( gpGlobals->curtime + 1.0f );
}
}
g_iszFuncBrushClassname = AllocPooledString("func_brush");
}
示例12: SetActivity
AIMoveResult_t CAI_Motor::MoveClimbExecute( const Vector &climbDest, const Vector &climbDir, float climbDist, float yaw, int climbNodesLeft )
{
if ( fabsf( climbDir.z ) > .1 )
{
if ( GetActivity() != ACT_CLIMB_DISMOUNT )
{
Activity desiredActivity = (climbDir.z > -0.01 ) ? ACT_CLIMB_UP : ACT_CLIMB_DOWN;
if ( GetActivity() != desiredActivity )
{
SetActivity( desiredActivity );
}
}
if ( GetActivity() != ACT_CLIMB_UP && GetActivity() != ACT_CLIMB_DOWN && GetActivity() != ACT_CLIMB_DISMOUNT )
{
DevMsg( "Climber not in a climb activity!\n" );
return AIMR_ILLEGAL;
}
if (m_nDismountSequence != ACT_INVALID)
{
if (GetActivity() == ACT_CLIMB_UP )
{
if (climbNodesLeft <= 2 && climbDist < fabs( m_vecDismount.z ))
{
// fixme: No other way to force m_nIdealSequence?
GetOuter()->SetActivity( ACT_CLIMB_DISMOUNT );
GetOuter()->SetCycle( GetOuter()->GetMovementFrame( m_vecDismount.z - climbDist ) );
}
}
}
}
float climbSpeed = GetOuter()->GetInstantaneousVelocity();
if (m_nDismountSequence != ACT_INVALID)
{
// catch situations where the climb mount/dismount finished before reaching goal
climbSpeed = MAX( climbSpeed, 30.0 );
}
else
{
// FIXME: assume if they don't have a dismount animation then they probably don't really support climbing.
climbSpeed = 100.0;
}
SetSmoothedVelocity( climbDir * climbSpeed );
if ( climbDist < climbSpeed * GetMoveInterval() )
{
if (climbDist <= 1e-2)
climbDist = 0;
const float climbTime = climbDist / climbSpeed;
SetMoveInterval( GetMoveInterval() - climbTime );
SetLocalOrigin( climbDest );
return AIMR_CHANGE_TYPE;
}
else
{
SetMoveInterval( 0 );
}
// --------------------------------------------
// Turn to face the climb
// --------------------------------------------
SetIdealYawAndUpdate( yaw );
return AIMR_OK;
}
示例13: ReportDevType
static void ReportDevType( DWORD devType )
{
byte baseType = GET_DIDEVICE_TYPE( devType );
byte subType = GET_DIDEVICE_SUBTYPE( devType );
switch ( baseType )
{
default:
DevMsg( "unknown type\n" );
break;
case DI8DEVTYPE_DEVICE:
DevMsg( "DEVICE\n" );
break;
case DI8DEVTYPE_MOUSE:
DevMsg( "MOUSE\n" );
switch ( subType )
{
default:
break;
case DI8DEVTYPEMOUSE_UNKNOWN:
DevMsg( "DI8DEVTYPEMOUSE_UNKNOWN\n" );
break;
case DI8DEVTYPEMOUSE_TRADITIONAL:
DevMsg( "DI8DEVTYPEMOUSE_TRADITIONAL\n" );
break;
case DI8DEVTYPEMOUSE_FINGERSTICK:
DevMsg( "DI8DEVTYPEMOUSE_FINGERSTICK\n" );
break;
case DI8DEVTYPEMOUSE_TOUCHPAD:
DevMsg( "DI8DEVTYPEMOUSE_TOUCHPAD\n" );
break;
case DI8DEVTYPEMOUSE_TRACKBALL:
DevMsg( "DI8DEVTYPEMOUSE_TRACKBALL\n" );
break;
case DI8DEVTYPEMOUSE_ABSOLUTE:
DevMsg( "DI8DEVTYPEMOUSE_ABSOLUTE\n" );
break;
}
break;
case DI8DEVTYPE_KEYBOARD:
DevMsg( "KEYBOARD\n" );
switch ( subType )
{
default:
break;
case DI8DEVTYPEKEYBOARD_UNKNOWN:
DevMsg( "DI8DEVTYPEKEYBOARD_UNKNOWN\n" );
break;
case DI8DEVTYPEKEYBOARD_PCXT:
DevMsg( "DI8DEVTYPEKEYBOARD_PCXT\n" );
break;
case DI8DEVTYPEKEYBOARD_OLIVETTI:
DevMsg( "DI8DEVTYPEKEYBOARD_OLIVETTI\n" );
break;
case DI8DEVTYPEKEYBOARD_PCAT:
DevMsg( "DI8DEVTYPEKEYBOARD_PCAT\n" );
break;
case DI8DEVTYPEKEYBOARD_PCENH:
DevMsg( "DI8DEVTYPEKEYBOARD_PCENH:\n" );
break;
case DI8DEVTYPEKEYBOARD_NOKIA1050:
DevMsg( "DI8DEVTYPEKEYBOARD_NOKIA1050\n" );
break;
case DI8DEVTYPEKEYBOARD_NOKIA9140:
DevMsg( "DI8DEVTYPEKEYBOARD_NOKIA9140\n" );
break;
case DI8DEVTYPEKEYBOARD_NEC98:
DevMsg( "DI8DEVTYPEKEYBOARD_NEC98\n" );
break;
case DI8DEVTYPEKEYBOARD_NEC98LAPTOP:
DevMsg( "DI8DEVTYPEKEYBOARD_NEC98LAPTOP\n" );
break;
case DI8DEVTYPEKEYBOARD_NEC98106:
DevMsg( "DI8DEVTYPEKEYBOARD_NEC98106\n" );
break;
case DI8DEVTYPEKEYBOARD_JAPAN106:
DevMsg( "DI8DEVTYPEKEYBOARD_JAPAN106\n" );
break;
case DI8DEVTYPEKEYBOARD_JAPANAX:
DevMsg( "DI8DEVTYPEKEYBOARD_JAPANAX\n" );
break;
case DI8DEVTYPEKEYBOARD_J3100:
DevMsg( "DI8DEVTYPEKEYBOARD_J3100\n" );
break;
}
break;
case DI8DEVTYPE_JOYSTICK:
DevMsg( "JOYSTICK\n" );
switch ( subType )
{
default:
break;
case DI8DEVTYPEJOYSTICK_LIMITED :
DevMsg( "DI8DEVTYPEJOYSTICK_LIMITED\n" );
break;
case DI8DEVTYPEJOYSTICK_STANDARD:
DevMsg( "DI8DEVTYPEJOYSTICK_STANDARD\n" );
break;
}
break;
//.........这里部分代码省略.........
示例14: FindTransitionSequence
int FindTransitionSequence( CStudioHdr *pstudiohdr, int iCurrentSequence, int iGoalSequence, int *piDir )
{
if ( !pstudiohdr )
return iGoalSequence;
if ( !pstudiohdr->SequencesAvailable() )
return iGoalSequence;
if ( ( iCurrentSequence < 0 ) || ( iCurrentSequence >= pstudiohdr->GetNumSeq() ) )
return iGoalSequence;
if ( ( iGoalSequence < 0 ) || ( iGoalSequence >= pstudiohdr->GetNumSeq() ) )
{
// asking for a bogus sequence. Punt.
Assert( 0 );
return iGoalSequence;
}
// bail if we're going to or from a node 0
if (pstudiohdr->EntryNode( iCurrentSequence ) == 0 || pstudiohdr->EntryNode( iGoalSequence ) == 0)
{
*piDir = 1;
return iGoalSequence;
}
int iEndNode;
// Msg( "from %d to %d: ", pEndNode->iEndNode, pGoalNode->iStartNode );
// check to see if we should be going forward or backward through the graph
if (*piDir > 0)
{
iEndNode = pstudiohdr->ExitNode( iCurrentSequence );
}
else
{
iEndNode = pstudiohdr->EntryNode( iCurrentSequence );
}
// if both sequences are on the same node, just go there
if (iEndNode == pstudiohdr->EntryNode( iGoalSequence ))
{
*piDir = 1;
return iGoalSequence;
}
int iInternNode = pstudiohdr->GetTransition( iEndNode, pstudiohdr->EntryNode( iGoalSequence ) );
// if there is no transitionial node, just go to the goal sequence
if (iInternNode == 0)
return iGoalSequence;
int i;
// look for someone going from the entry node to next node it should hit
// this may be the goal sequences node or an intermediate node
for (i = 0; i < pstudiohdr->GetNumSeq(); i++)
{
mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc(i );
if (pstudiohdr->EntryNode( i ) == iEndNode && pstudiohdr->ExitNode( i ) == iInternNode)
{
*piDir = 1;
return i;
}
if (seqdesc.nodeflags)
{
if (pstudiohdr->ExitNode( i ) == iEndNode && pstudiohdr->EntryNode( i ) == iInternNode)
{
*piDir = -1;
return i;
}
}
}
// this means that two parts of the node graph are not connected.
DevMsg( 2, "error in transition graph: %s to %s\n", pstudiohdr->pszNodeName( iEndNode ), pstudiohdr->pszNodeName( pstudiohdr->EntryNode( iGoalSequence ) ));
// Go ahead and jump to the goal sequence
return iGoalSequence;
}
示例15: GetAbsOrigin
//-----------------------------------------------------------------------------
// Purpose: Returns whether or not it is OK to make an NPC at this instant.
//-----------------------------------------------------------------------------
bool CBaseNPCMaker::CanMakeNPC( bool bIgnoreSolidEntities )
{
if( ai_inhibit_spawners.GetBool() )
return false;
if ( m_nMaxLiveChildren > 0 && m_nLiveChildren >= m_nMaxLiveChildren )
{// not allowed to make a new one yet. Too many live ones out right now.
return false;
}
if ( m_iszIngoreEnt != NULL_STRING )
{
m_hIgnoreEntity = gEntList.FindEntityByName( NULL, m_iszIngoreEnt );
}
Vector mins = GetAbsOrigin() - Vector( 34, 34, 0 );
Vector maxs = GetAbsOrigin() + Vector( 34, 34, 0 );
maxs.z = GetAbsOrigin().z;
// If we care about not hitting solid entities, look for 'em
if ( !bIgnoreSolidEntities )
{
CBaseEntity *pList[128];
int count = UTIL_EntitiesInBox( pList, 128, mins, maxs, FL_CLIENT|FL_NPC );
if ( count )
{
//Iterate through the list and check the results
for ( int i = 0; i < count; i++ )
{
//Don't build on top of another entity
if ( pList[i] == NULL )
continue;
//If one of the entities is solid, then we may not be able to spawn now
if ( ( pList[i]->GetSolidFlags() & FSOLID_NOT_SOLID ) == false )
{
// Since the outer method doesn't work well around striders on account of their huge bounding box.
// Find the ground under me and see if a human hull would fit there.
trace_t tr;
UTIL_TraceHull( GetAbsOrigin() + Vector( 0, 0, 2 ),
GetAbsOrigin() - Vector( 0, 0, 8192 ),
NAI_Hull::Mins(HULL_HUMAN),
NAI_Hull::Maxs(HULL_HUMAN),
MASK_NPCSOLID,
m_hIgnoreEntity,
COLLISION_GROUP_NONE,
&tr );
if( !HumanHullFits( tr.endpos + Vector( 0, 0, 1 ) ) )
{
return false;
}
}
}
}
}
// Do we need to check to see if the player's looking?
if ( HasSpawnFlags( SF_NPCMAKER_HIDEFROMPLAYER ) )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
if ( pPlayer )
{
// Only spawn if the player's looking away from me
if( pPlayer->FInViewCone( GetAbsOrigin() ) && pPlayer->FVisible( GetAbsOrigin() ) )
{
if ( !(pPlayer->GetFlags() & FL_NOTARGET) )
return false;
DevMsg( 2, "Spawner %s spawning even though seen due to notarget\n", STRING( GetEntityName() ) );
}
}
}
}
return true;
}