//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Dota_Resupply::CrateThink( void ) { StudioFrameAdvance(); DispatchAnimEvents( this ); SetNextThink( gpGlobals->curtime + 0.1f ); // Start closing if we're not already if ( GetSequence() != LookupSequence( "Close" ) ) { // Not ready to close? if ( m_flCloseTime <= gpGlobals->curtime ) { //m_hActivator = NULL; ResetSequence( LookupSequence( "Close" ) ); } } else { // See if we're fully closed if ( IsSequenceFinished() ) { // Stop thinking SetThink( NULL ); CPASAttenuationFilter sndFilter( this, "AmmoCrate.Close" ); EmitSound( sndFilter, entindex(), "AmmoCrate.Close" ); // FIXME: We're resetting the sequence here // but setting Think to NULL will cause this to never have // StudioFrameAdvance called. What are the consequences of that? ResetSequence( LookupSequence( "Idle" ) ); SetBodygroup( 1, true ); m_hActivator->SetCanShop( false ); m_hActivator = NULL; } } }
//========================================================= // RunTask //========================================================= void CHAssassin :: RunTask ( Task_t *pTask ) { switch ( pTask->iTask ) { case TASK_ASSASSIN_FALL_TO_GROUND: MakeIdealYaw( m_vecEnemyLKP ); ChangeYaw( pev->yaw_speed ); if (m_fSequenceFinished) { if (pev->velocity.z > 0) { pev->sequence = LookupSequence( "fly_up" ); } else if (HasConditions ( bits_COND_SEE_ENEMY )) { pev->sequence = LookupSequence( "fly_attack" ); pev->frame = 0; } else { pev->sequence = LookupSequence( "fly_down" ); pev->frame = 0; } ResetSequenceInfo( ); SetYawSpeed(); } if (pev->flags & FL_ONGROUND) { // ALERT( at_console, "on ground\n"); TaskComplete( ); } break; default: CBaseMonster :: RunTask ( pTask ); break; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNewWallHealth::Recharge(void) { EmitSound( "WallHealth.Recharge" ); m_flJuice = m_iJuice = sk_healthcharger.GetInt(); m_nState = 0; ResetSequence( LookupSequence( "idle" ) ); StudioFrameAdvance(); m_iReactivate = 0; SetThink( NULL ); }
//========================================================= // ********** DeadHGrunt SPAWN ********** //========================================================= void CDeadHGrunt::Spawn( void ) { PRECACHE_MODEL( "models/hgrunt.mdl" ); SetModel( "models/hgrunt.mdl" ); pev->effects = 0; pev->yaw_speed = 8; pev->sequence = 0; m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[ m_iPose ] ); if( pev->sequence == -1 ) { ALERT( at_console, "Dead hgrunt with bad pose\n" ); } // Corpses have less health pev->health = 8; // map old bodies onto new bodies switch( pev->body ) { case 0: // Grunt with Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_GRUNT ); SetBodygroup( GUN_GROUP, GUN_MP5 ); break; case 1: // Commander with Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_COMMANDER ); SetBodygroup( GUN_GROUP, GUN_MP5 ); break; case 2: // Grunt no Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_GRUNT ); SetBodygroup( GUN_GROUP, GUN_NONE ); break; case 3: // Commander no Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_COMMANDER ); SetBodygroup( GUN_GROUP, GUN_NONE ); break; } MonsterInitDead(); }
//----------------------------------------------------------------------------- // Purpose: Input that sets the sequence of the entity //----------------------------------------------------------------------------- void CEnvEffectsScript::InputSetSequence( inputdata_t &inputdata ) { if ( inputdata.value.StringID() != NULL_STRING ) { int nSequence = LookupSequence( STRING( inputdata.value.StringID() ) ); if ( nSequence != ACT_INVALID ) { SetSequence( nSequence ); ResetSequenceInfo(); SetCycle( 0.0f ); m_flPlaybackRate = 1.0f; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CCycler_TF2Commando::Think( void ) { // Change sequence if ( IsSequenceFinished() ) { // Raising our shield? if ( m_bShieldActive ) { ResetSequence( LookupSequence( "ShieldUpIdle" ) ); } else if ( GetSequence() == LookupSequence( "ShieldDown" ) ) { ResetSequence( LookupSequence( "Idle" ) ); } } SetNextThink( gpGlobals->curtime + 0.1f ); if (m_animate) { StudioFrameAdvance ( ); } }
//----------------------------------------------------------------------------- // Purpose: Retire the turret until enabled again //----------------------------------------------------------------------------- void CNPC_RocketTurret::Disable( void ) { if ( !m_bEnabled ) return; UpdateSkin( ROCKET_SKIN_IDLE ); m_bEnabled = false; ResetSequence(LookupSequence("close")); SetThink( &CNPC_RocketTurret::ClosingThink ); SetNextThink( gpGlobals->curtime + 0.05 ); SetEnemy( NULL ); }
void CNewRecharge::Recharge(void) { EmitSound( "SuitRecharge.Start" ); ResetSequence( LookupSequence( "idle" ) ); UpdateJuice( MaxJuice() ); m_nState = 0; m_flJuice = m_iJuice; m_iReactivate = 0; StudioFrameAdvance(); SetThink( &CNewRecharge::SUB_DoNothing ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_RocketTurret::SearchThink() { if ( PreThink() || GetEnemy() == NULL ) return; SetSequence ( LookupSequence( "idle" ) ); UpdateAimPoint(); //Update our think time SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE ); // Still can't see enemy, zip around frantically if ( !m_bHasSightOfEnemy ) { if ( m_flTimeSpentPaused >= m_flPauseLength ) { float flOffsetX = RandomFloat( -5.0f, 5.0f ); float flOffsetY = RandomFloat( -5.0f, 5.0f ); if ( fabs(m_flTotalDivergenceX) <= MAX_DIVERGENCE_X || SignDiffers( m_flTotalDivergenceX, flOffsetX ) ) { m_flTotalDivergenceX += flOffsetX; m_vecGoalAngles.x += flOffsetX; } if ( fabs(m_flTotalDivergenceY) <= MAX_DIVERGENCE_Y || SignDiffers( m_flTotalDivergenceY, flOffsetY ) ) { m_flTotalDivergenceY += flOffsetY; m_vecGoalAngles.y += flOffsetY; } // Reset pause timer m_flTimeSpentPaused = 0.0f; m_flPauseLength = RandomFloat( 0.3f, 2.5f ); } m_flTimeSpentPaused += ROCKET_TURRET_THINK_RATE; } else { // Found target, go back to following it SetThink( &CNPC_RocketTurret::FollowThink ); SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE ); } // Move beam towards goal angles UpdateFacing(); }
//----------------------------------------------------------------------------- // Canister finished opening //----------------------------------------------------------------------------- void CEnvHeadcrabCanister::CanisterFinishedOpening( void ) { ResetSequence( LookupSequence( "idle_open" ) ); m_OnOpened.FireOutput( this, this, 0 ); m_bOpened = true; SetContextThink( NULL, gpGlobals->curtime, s_pOpenThinkContext ); if ( !HasSpawnFlags( SF_START_IMPACTED ) ) { if ( !HasSpawnFlags( SF_WAIT_FOR_INPUT_TO_SPAWN_HEADCRABS ) ) { StartSpawningHeadcrabs( 3.0f ); } } }
//----------------------------------------------------------------------------- // Purpose: Cores play a special animation when picked up and dropped // Input : pPhysGunUser - player picking up object // reason - type of pickup //----------------------------------------------------------------------------- void CPropGladosCore::OnPhysGunPickup( CBasePlayer* pPhysGunUser, PhysGunPickup_t reason ) { if ( m_bFirstPickup ) { float flTalkingDelay = (CORETYPE_CURIOUS == m_iCoreType) ? (2.0f) : (0.0f); StartTalking ( flTalkingDelay ); } m_bFirstPickup = false; ResetSequence(LookupSequence("turn")); // +use always enables motion on these props EnableMotion(); BaseClass::OnPhysGunPickup ( pPhysGunUser, reason ); }
//----------------------------------------------------------------------------- // Purpose: // Input : *pActivator - // *pCaller - // useType - // value - //----------------------------------------------------------------------------- void CItem_AmmoCrate::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { CBasePlayer *pPlayer = ToBasePlayer( pActivator ); if ( pPlayer == NULL ) return; m_OnUsed.FireOutput( pActivator, this ); int iSequence = LookupSequence( "Open" ); // See if we're not opening already if ( GetSequence() != iSequence ) { Vector mins, maxs; trace_t tr; CollisionProp()->WorldSpaceAABB( &mins, &maxs ); Vector vOrigin = GetAbsOrigin(); vOrigin.z += ( maxs.z - mins.z ); mins = (mins - GetAbsOrigin()) * 0.2f; maxs = (maxs - GetAbsOrigin()) * 0.2f; mins.z = ( GetAbsOrigin().z - vOrigin.z ); UTIL_TraceHull( vOrigin, vOrigin, mins, maxs, MASK_SOLID, this, COLLISION_GROUP_NONE, &tr ); if ( tr.startsolid || tr.allsolid ) return; m_hActivator = pPlayer; // Animate! ResetSequence( iSequence ); // Make sound CPASAttenuationFilter sndFilter( this, "AmmoCrate.Open" ); EmitSound( sndFilter, entindex(), "AmmoCrate.Open" ); // Start thinking to make it return SetThink( &CItem_AmmoCrate::CrateThink ); SetNextThink( gpGlobals->curtime + 0.1f ); } // Don't close again for two seconds m_flCloseTime = gpGlobals->curtime + AMMO_CRATE_CLOSE_DELAY; }
// ********** Dead Zombie Soldier SPAWN ********** void CDeadZombieSoldier :: Spawn( ) { Precache(); SET_MODEL(ENT(pev), "models/zombie_soldier.mdl"); pev->effects = 0; pev->sequence = 0; pev->health = 8; m_bloodColor = BLOOD_COLOR_GREEN; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) ALERT ( at_console, "Dead scientist with bad pose\n" ); MonsterInitDead(); }
void CPropGladosCore::Spawn( void ) { SetupVOList(); Precache(); KeyValue( "model", GLADOS_CORE_MODEL_NAME ); BaseClass::Spawn(); //Default to 'dropped' animation ResetSequence(LookupSequence("drop")); SetCycle( 1.0f ); DisableAutoFade(); m_iEyeballAttachment = LookupAttachment( "eyeball" ); SetContextThink( &CPropGladosCore::AnimateThink, gpGlobals->curtime + 0.1f, s_pAnimateThinkContext ); }
// // ********** Scientist SPAWN ********** // void CSittingScientist :: Spawn( ) { if (pev->model) PRECACHE_MODEL((char*)STRING(pev->model)); //LRC else PRECACHE_MODEL("models/scientist.mdl"); if (pev->model) SET_MODEL(ENT(pev), STRING(pev->model)); //LRC else SET_MODEL(ENT(pev), "models/scientist.mdl"); Precache(); InitBoneControllers(); UTIL_SetSize(pev, Vector(-14, -14, 0), Vector(14, 14, 36)); pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; pev->effects = 0; pev->health = 50; m_bloodColor = BLOOD_COLOR_RED; m_flFieldOfView = VIEW_FIELD_WIDE; // indicates the width of this monster's forward view cone ( as a dotproduct result ) m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD; if (!FBitSet(pev->spawnflags, SF_SITTINGSCI_POSTDISASTER)) //LRC- allow a sitter to be postdisaster. SetBits(pev->spawnflags, SF_MONSTER_PREDISASTER); // predisaster only! if ( pev->body == -1 ) {// -1 chooses a random head pev->body = RANDOM_LONG(0, NUM_SCIENTIST_HEADS-1);// pick a head, any head } // Luther is black, make his hands black if ( pev->body == HEAD_LUTHER ) pev->skin = 1; m_baseSequence = LookupSequence( "sitlookleft" ); pev->sequence = m_baseSequence + RANDOM_LONG(0,4); ResetSequenceInfo( ); SetThink(&CSittingScientist ::SittingThink); SetNextThink( 0.1 ); DROP_TO_FLOOR ( ENT(pev) ); }
//========================================================= // ********** DeadOtis SPAWN ********** //========================================================= void CDeadOtis :: Spawn( ) { Precache(); SET_MODEL(ENT(pev), "models/otis.mdl"); pev->effects = 0; pev->yaw_speed = 8; pev->sequence = 0; m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) ALERT ( at_console, "Dead Otis with bad pose\n" ); // Corpses have less health pev->health = 8; MonsterInitDead(); }
//----------------------------------------------------------------------------- // Open the canister! //----------------------------------------------------------------------------- void CEnvHeadcrabCanister::OpenCanister( void ) { if ( m_bOpened ) return; int nOpenSequence = LookupSequence( "open" ); if ( nOpenSequence != ACT_INVALID ) { EmitSound( "HeadcrabCanister.Open" ); ResetSequence( nOpenSequence ); SetContextThink( &CEnvHeadcrabCanister::WaitForOpenSequenceThink, gpGlobals->curtime + 0.01f, s_pOpenThinkContext ); } else { CanisterFinishedOpening(); } }
//------------------------------------------------------------------------------ // Purpose: //------------------------------------------------------------------------------ void CPropVehicleChoreoGeneric::InputOpen( inputdata_t &inputdata ) { int nSequence = LookupSequence( "open" ); // Set to the desired anim, or default anim if the desired is not present if ( nSequence > ACTIVITY_NOT_AVAILABLE ) { SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( nSequence ); ResetClientsideFrame(); } else { // Not available try to get default anim Msg( "Choreo Generic Vehicle %s: missing open sequence\n", GetDebugName() ); SetSequence( 0 ); } }
//========================================================= // ********** DeadBarney SPAWN ********** //========================================================= void CDeadBarney :: Spawn( ) { PRECACHE_MODEL("models/barney.mdl"); SET_MODEL(ENT(pev), "models/barney.mdl"); pev->yaw_speed = 8; pev->sequence = 0; m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) { ALERT ( at_console, "Dead barney with bad pose\n" ); } // Corpses have less health pev->health = 8;//gSkillData.barneyHealth; MonsterInitDead(); }
//========================================================= // ********** DeadConstruction SPAWN ********** //========================================================= void CDeadConstruction :: Spawn( ) { PRECACHE_MODEL("models/construction.mdl"); SET_MODEL(ENT(pev), "models/construction.mdl"); pev->effects = 0; pev->yaw_speed = 8; pev->sequence = 0; m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) { ALERT ( at_console, "Dead construction with bad pose\n" ); } // Corpses have less health pev->health = 8; MonsterInitDead(); }
void CBlendingCycler::Spawn( void ) { // Remove if it's not blending if (m_iLowerBound == 0 && m_iUpperBound == 0) { UTIL_Remove( this ); return; } GenericCyclerSpawn( (char *)STRING( GetModelName() ), Vector(-16,-16,-16), Vector(16,16,16)); if (!m_iBlendspeed) m_iBlendspeed = 5; // Initialise Sequence if (m_iszSequence != NULL_STRING) { SetSequence( LookupSequence( STRING(m_iszSequence) ) ); } m_iCurrent = m_iLowerBound; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFPowerup::Spawn( void ) { BaseClass::Precache(); BaseClass::Spawn(); BaseClass::SetOriginalSpawnOrigin( GetAbsOrigin() ); BaseClass::SetOriginalSpawnAngles( GetAbsAngles() ); VPhysicsDestroyObject(); SetMoveType( MOVETYPE_NONE ); SetSolidFlags( FSOLID_NOT_SOLID | FSOLID_TRIGGER ); if ( m_bDisabled ) { SetDisabled( true ); } m_bRespawning = false; ResetSequence( LookupSequence("idle") ); }
//========================================================= // ********** DeadBarney SPAWN ********** //========================================================= void CNPC_DeadBarney::Spawn( void ) { PrecacheModel("models/barneyhl1.mdl"); SetModel( "models/barneyhl1.mdl"); ClearEffects(); SetSequence( 0 ); m_bloodColor = BLOOD_COLOR_RED; SetRenderColor( 255, 255, 255, 255 ); SetSequence( m_iDesiredSequence = LookupSequence( m_szPoses[m_iPose] ) ); if ( GetSequence() == -1 ) { Msg ( "Dead barney with bad pose\n" ); } // Corpses have less health m_iHealth = 0.0;//gSkillData.barneyHealth; NPCInitDead(); }
// ********** Dead Human Grunt Ally SPAWN ********** void CDeadHGruntAlly :: Spawn( void ) { Precache(); SET_MODEL(ENT(pev), "models/hgrunt_opfor.mdl"); pev->effects = 0; pev->yaw_speed = 8; pev->sequence = 0; pev->health = 8; // Corpses have less health m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) ALERT ( at_console, "Dead Human Grunt Ally with bad pose\n" ); // Weapons & Torso switch( pev->weapons ) { case HGRUNT_ALLY_SHOTGUN: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_MASK ); break; case HGRUNT_ALLY_M4A1: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_BERET ); break; case HGRUNT_ALLY_M249: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_SHOTGUN ); break; default: SetBodygroup( ALLY_GUN_GROUP, ALLY_GUN_NONE ); break; } // Heads switch( m_iHead ) { default: case 0: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_MASK ); break; case 1: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_BERET ); break; case 2: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_SHOTGUN ); break; case 3: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_SAW ); break; case 4: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_SAW_BLACK ); break; case 5: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_MP ); break; case 6: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_MAJOR ); break; case 7: SetBodygroup( ALLY_HEAD_GROUP, ALLY_HEAD_BERET_BLACK ); break; } MonsterInitDead(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropVehicleViewController::InputForcePlayerIn( inputdata_t &inputdata ) { #ifdef SecobMod__Enable_Fixed_Multiplayer_AI CBasePlayer *pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin()); #else CBasePlayer *pPlayer = UTIL_PlayerByIndex(1); #endif //SecobMod__Enable_Fixed_Multiplayer_AI if ( !pPlayer ) return; ResetUseKey( pPlayer ); // Get the entry animation from the input int iEntryAnim = ACTIVITY_NOT_AVAILABLE; if ( inputdata.value.StringID() != NULL_STRING ) { iEntryAnim = LookupSequence( inputdata.value.String() ); if ( iEntryAnim == ACTIVITY_NOT_AVAILABLE ) { Warning("vehicle_viewcontroller %s could not find specified entry animation %s\n", STRING(GetEntityName()), inputdata.value.String() ); return; } } // Make sure we successfully got in the vehicle if ( pPlayer->GetInVehicle( GetServerVehicle(), VEHICLE_ROLE_DRIVER ) == false ) { // The player was unable to enter the vehicle and the output has failed Assert( 0 ); return; } // Setup the "enter" vehicle sequence SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( iEntryAnim ); ResetClientsideFrame(); m_bEnterAnimOn = true; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CItem_AmmoCrate::Spawn( void ) { Precache(); BaseClass::Spawn(); SetModel( STRING( GetModelName() ) ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); CreateVPhysics(); ResetSequence( LookupSequence( "Idle" ) ); SetBodygroup( 1, true ); m_flCloseTime = gpGlobals->curtime; m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; SetCycle( 0 ); m_takedamage = DAMAGE_EVENTS_ONLY; }
// Overridden to make BigMomma jump on command; the model doesn't support it otherwise. void CBigMomma :: SetActivity ( Activity NewActivity ) { int iSequence; if (NewActivity == ACT_HOP) { iSequence = LookupSequence( "jump" ); } else { iSequence = LookupActivity ( NewActivity ); } // Set to the desired anim, or default anim if the desired is not present if ( iSequence > ACTIVITY_NOT_AVAILABLE ) { if ( pev->sequence != iSequence || !m_fSequenceLoops ) { // don't reset frame between walk and run if ( !(m_Activity == ACT_WALK || m_Activity == ACT_RUN) || !(NewActivity == ACT_WALK || NewActivity == ACT_RUN)) pev->frame = 0; } pev->sequence = iSequence; // Set to the reset anim (if it's there) ResetSequenceInfo( ); SetYawSpeed(); } else { // Not available try to get default anim ALERT ( at_aiconsole, "%s has no sequence for act:%d\n", STRING(pev->classname), NewActivity ); pev->sequence = 0; // Set to the reset anim (if it's there) } m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present // In case someone calls this with something other than the ideal activity m_IdealActivity = m_Activity; }
void SequencePrecache( void *pmodel, const char *pSequenceName ) { int index = LookupSequence( pmodel, pSequenceName ); if( index >= 0 ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if( !pstudiohdr || index >= pstudiohdr->numseq ) return; mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + index; pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex); for( int i = 0; i < pseqdesc->numevents; i++ ) { // don't send client-side events to the server AI if( pevent[i].event >= EVENT_CLIENT ) continue; if( IsSoundEvent( pevent[i].event )) { if( !Q_strlen(pevent[i].options )) { ALERT( at_error, "Bad sound event %d in sequence %s :: %s (sound is \"%s\")\n", pevent[i].event, pstudiohdr->name, pSequenceName, pevent[i].options ); } PRECACHE_SOUND( pevent[i].options ); } } } }
void SequencePrecache( void *pmodel, const char *pSequenceName ) { int index = LookupSequence( pmodel, pSequenceName ); if ( index >= 0 ) { studiohdr_t *pstudiohdr; pstudiohdr = (studiohdr_t *)pmodel; if ( !pstudiohdr || index >= pstudiohdr->numseq ) return; mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + index; pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex); for (int i = 0; i < pseqdesc->numevents; i++) { // Don't send client-side events to the server AI if ( pevent[i].event >= EVENT_CLIENT ) continue; // UNDONE: Add a callback to check to see if a sound is precached yet and don't allocate a copy // of it's name if it is. if ( IsSoundEvent( pevent[i].event ) ) { if ( !strlen(pevent[i].options) ) { ALERT( at_error, "Bad sound event %d in sequence %s :: %s (sound is \"%s\")\n", pevent[i].event, pstudiohdr->name, pSequenceName, pevent[i].options ); } PRECACHE_SOUND( (char *)(gpGlobals->pStringBase + ALLOC_STRING(pevent[i].options) ) ); } } } }
//========================================================= // ********** DeadGenericMonster SPAWN ********** //========================================================= void CDeadGenericMonster :: Spawn( void ) { Precache(); SET_MODEL(ENT(pev), STRING(pev->model)); pev->effects = 0; pev->yaw_speed = 8; //LRC -- what? pev->sequence = 0; if (pev->netname) { pev->sequence = LookupSequence( STRING(pev->netname) ); if (pev->sequence == -1) { ALERT ( at_debug, "Invalid sequence name \"%s\" in monster_generic_dead\n", STRING(pev->netname) ); } } else { pev->sequence = LookupActivity( pev->frags ); // if (pev->sequence == -1) // { // ALERT ( at_error, "monster_generic_dead - specify a sequence name or choose a different death type: model \"%s\" has no available death sequences.\n", STRING(pev->model) ); // } //...and if that doesn't work, forget it. } // Corpses have less health pev->health = 8; MonsterInitDead(); ResetSequenceInfo( ); pev->frame = 255; // pose at the _end_ of its death sequence. }