//----------------------------------------------------------------------------- // Spawn //----------------------------------------------------------------------------- void CNPC_Eli::Spawn() { // Eli is allowed to use multiple models, because he appears in the pod. // He defaults to his normal model. char *szModel = (char *)STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/eli.mdl"; SetModelName( AllocPooledString(szModel) ); } Precache(); SetModel( szModel ); BaseClass::Spawn(); SetHullType(HULL_HUMAN); SetHullSizeNormal(); // If Eli has a parent, he's currently inside a pod. Prevent him from moving. if ( GetMoveParent() ) { SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_NONE ); CapabilitiesAdd( bits_CAP_ANIMATEDFACE | bits_CAP_TURN_HEAD ); CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE ); } else { SetupWithoutParent(); } AddEFlags( EFL_NO_DISSOLVE | EFL_NO_MEGAPHYSCANNON_RAGDOLL | EFL_NO_PHYSCANNON_INTERACTION ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = 8; m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; NPCInit(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPointCommentaryNode::Precache() { PrecacheModel( STRING( GetModelName() ) ); if ( m_iszCommentaryFile.Get() != NULL_STRING ) { PrecacheScriptSound( STRING( m_iszCommentaryFile.Get() ) ); } else { Warning("%s: %s has no commentary file.\n", GetClassName(), GetDebugName() ); } if ( m_iszCommentaryFileNoHDR.Get() != NULL_STRING ) { PrecacheScriptSound( STRING( m_iszCommentaryFileNoHDR.Get() ) ); } BaseClass::Precache(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvLaser::Spawn( void ) { if ( !GetModelName() ) { SetThink( &CEnvLaser::SUB_Remove ); return; } SetSolid( SOLID_NONE ); // Remove model & collisions SetThink( &CEnvLaser::StrikeThink ); SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled PointsInit( GetLocalOrigin(), GetLocalOrigin() ); Precache( ); if ( !m_pSprite && m_iszSpriteName != NULL_STRING ) { m_pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteName), GetAbsOrigin(), TRUE ); } else { m_pSprite = NULL; } if ( m_pSprite ) { m_pSprite->SetParent( GetMoveParent() ); m_pSprite->SetTransparency( kRenderGlow, m_clrRender->r, m_clrRender->g, m_clrRender->b, m_clrRender->a, m_nRenderFX ); } if ( GetEntityName() != NULL_STRING && !(m_spawnflags & SF_BEAM_STARTON) ) { TurnOff(); } else { TurnOn(); } }
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 CBaseProjectile::Spawn( void ) { Precache(); SetModel( STRING( GetModelName() ) ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); AddFlag( FL_OBJECT ); UTIL_SetSize( this, -Vector( 1.0f, 1.0f, 1.0f ), Vector( 1.0f, 1.0f, 1.0f ) ); // Setup attributes. SetGravity( 0.001f ); m_takedamage = DAMAGE_NO; // Setup the touch and think functions. SetTouch( &CBaseProjectile::ProjectileTouch ); SetThink( &CBaseProjectile::FlyThink ); SetNextThink( gpGlobals->curtime ); }
//----------------------------------------------------------------------------- // 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; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPhysMagnet::Spawn( void ) { Precache(); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); SetModel( STRING( GetModelName() ) ); m_takedamage = DAMAGE_EVENTS_ONLY; solid_t tmpSolid; PhysModelParseSolid( tmpSolid, this, GetModelIndex() ); if ( m_massScale > 0 ) { float mass = tmpSolid.params.mass * m_massScale; mass = clamp( mass, 0.5, 1e6 ); tmpSolid.params.mass = mass; } PhysSolidOverride( tmpSolid, m_iszOverrideScript ); VPhysicsInitNormal( GetSolid(), GetSolidFlags(), true, &tmpSolid ); // Wake it up if not asleep if ( !HasSpawnFlags(SF_MAGNET_ASLEEP) ) { VPhysicsGetObject()->Wake(); } if ( HasSpawnFlags(SF_MAGNET_MOTIONDISABLED) ) { VPhysicsGetObject()->EnableMotion( false ); } m_bActive = true; m_pConstraintGroup = NULL; m_flTotalMass = 0; m_flNextSuckTime = 0; BaseClass::Spawn(); }
short GetUtilFlag(short model_id) { LPFUNCTIONCOMP lpComp; char resName[NAME_BUF_MAX_SIZE]; char *modelName = GetModelName(); short flag = 0; snprintf( resName, NAME_BUF_MAX_SIZE, "%s/%s", MAINTENANCE_RESPATH, MAINTENANCE_RESFILE ); if ( ParseFunctionListTag( resName, modelName, &lpComp ) != 0 ) goto Err; while( lpComp != NULL ){ if ( lpComp->type == FUNCTYPE_CLEANING ) flag |= UF_CLEANING; else if ( lpComp->type == FUNCTYPE_DEEP_CLEANING ) flag |= UF_DEEP_CLEANING; else if ( lpComp->type == FUNCTYPE_ROLLER_CLEANING ) flag |= UF_ROLLER_CLEANING; else if ( lpComp->type == FUNCTYPE_PLATE_CLEANING ) flag |= UF_PLATE_CLEANING; else if ( lpComp->type == FUNCTYPE_NOZZLE_CHECK ) flag |= UF_NOZZLE_CHECK; else if ( lpComp->type == FUNCTYPE_POWER_OFF ) flag |= UF_POWER_OFF; else if ( lpComp->type == FUNCTYPE_AUTOPOWER ) flag |= UF_AUTO_POWER; else if ( lpComp->type == FUNCTYPE_INK_WARNING ) flag |= UF_INK_WARNING; else if ( lpComp->type == FUNCTYPE_INK_RESET ) flag |= UF_INK_RESET; else if ( lpComp->type == FUNCTYPE_INK_CARTRIDGE ) flag |= UF_INK_CARTRIDGE; else if ( lpComp->type == FUNCTYPE_QUIET ) flag |= UF_QUIET; else if ( lpComp->type == FUNCTYPE_HEAD_ALIGNMENT_AUTO ) flag |= UF_HEAD_ALIGNMENT; else if ( lpComp->type == FUNCTYPE_HEAD_ALIGNMENT_MANUAL ) flag |= UF_HEAD_ALIGNMENT; else if ( lpComp->type == FUNCTYPE_CUSTOM ) flag |= UF_CUSTOM; else if ( lpComp->type == FUNCTYPE_PAPER_SOURCE_SETTING ) flag |= UI_PAPER_SOURCE_SETTING; lpComp = lpComp->next; } FreeFunctionCompList( lpComp ); #if 0 ModelTable* model_table; if( (model_table = GetModelTableEntry(model_id)) != NULL ) return model_table->util_flag; #endif Err: return flag; }
//-------------------------------------------------------------------------------------------------------- void CFuncNavCost::Spawn( void ) { BaseClass::Spawn(); gm_masterCostVector.AddToTail( this ); gm_dirtyTimer.Start( UPDATE_DIRTY_TIME ); SetSolid( SOLID_BSP ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_NONE ); SetModel( STRING( GetModelName() ) ); AddEffects( EF_NODRAW ); SetCollisionGroup( COLLISION_GROUP_NONE ); VPhysicsInitShadow( false, false ); SetThink( &CFuncNavCost::CostThink ); SetNextThink( gpGlobals->curtime + UPDATE_DIRTY_TIME ); m_tags.RemoveAll(); const char *tags = STRING( m_iszTags ); // chop space-delimited string into individual tokens if ( tags ) { char *buffer = new char [ strlen( tags ) + 1 ]; Q_strcpy( buffer, tags ); for( char *token = strtok( buffer, " " ); token; token = strtok( NULL, " " ) ) { m_tags.AddToTail( CFmtStr( "%s", token ) ); } delete [] buffer; } }
void CBubbling::Spawn( void ) { Precache(); SetModel( GetModelName() ); // Set size SetSolidType( SOLID_NOT ); // Remove model & collisions SetRenderAmount( 0 ); // The engine won't draw this model if this is set to 0 and blending is on SetRenderMode( kRenderTransTexture ); int speed = fabs( GetSpeed() ); // HACKHACK!!! - Speed in rendercolor SetRenderColor( Vector( speed >> 8, speed & 255, ( GetSpeed() < 0 ) ? 1 : 0 ) ); if( !GetSpawnFlags().Any( SF_BUBBLES_STARTOFF ) ) { SetThink( &CBubbling::FizzThink ); SetNextThink( gpGlobals->time + 2.0 ); m_state = true; } else m_state = false; }
void CPushable::Spawn( void ) { if ( HasSpawnFlags( SF_PUSH_BREAKABLE ) ) { BaseClass::Spawn(); } else { Precache(); SetSolid( SOLID_VPHYSICS ); SetMoveType( MOVETYPE_PUSH ); SetModel( STRING( GetModelName() ) ); CreateVPhysics(); } #ifdef HL1_DLL // Force HL1 Pushables to stay axially aligned. VPhysicsGetObject()->SetInertia( Vector( 1e30, 1e30, 1e30 ) ); #endif//HL1_DLL }
void CSpriteTrail::Spawn( void ) { #ifdef CLIENT_DLL BaseClass::Spawn(); #else if ( GetModelName() != NULL_STRING ) { BaseClass::Spawn(); return; } SetModelName( m_iszSpriteName ); BaseClass::Spawn(); SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NOCLIP ); SetCollisionBounds( vec3_origin, vec3_origin ); TurnOn(); #endif }
ImodelIGC* CPigShip::FindModel(BSTR bstrModel) { if (!BSTRLen(bstrModel)) return NULL; USES_CONVERSION; LPCSTR pszModel = OLE2CA(bstrModel); const ClusterListIGC* pClusters = GetIGC()->GetMission()->GetClusters(); for (ClusterLinkIGC* itCluster = pClusters->first(); itCluster; itCluster = itCluster->next()) { IclusterIGC* pCluster = itCluster->data(); const ModelListIGC* pModels = pCluster->GetModels(); for (ModelLinkIGC* it = pModels->first(); it; it = it->next()) { ImodelIGC* pModel = it->data(); if (0 == _stricmp(GetModelName(pModel), pszModel)) return pModel; } } return NULL; }
//-------------------------------------------------------------------------------------------------------- void CFuncNavBlocker::Spawn( void ) { gm_NavBlockers.AddToTail( this ); if ( !m_blockedTeamNumber ) m_blockedTeamNumber = TEAM_ANY; SetMoveType( MOVETYPE_NONE ); SetModel( STRING( GetModelName() ) ); AddEffects( EF_NODRAW ); SetCollisionGroup( COLLISION_GROUP_NONE ); SetSolid( SOLID_NONE ); AddSolidFlags( FSOLID_NOT_SOLID ); CollisionProp()->WorldSpaceAABB( &m_CachedMins, &m_CachedMaxs ); if ( m_bDisabled ) { g_EventQueue.AddEvent( this, "UnblockNav", 2.0f, this, this ); } else { g_EventQueue.AddEvent( this, "BlockNav", 2.0f, this, this ); } }
void CFunc_LiquidPortal::Activate( void ) { BaseClass::Activate(); SetSolid( SOLID_VPHYSICS ); SetSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_NONE ); SetModel( STRING( GetModelName() ) ); ComputeLinkMatrix(); //collision origin may have changed during activation SetThink( &CFunc_LiquidPortal::Think ); for( int i = m_hLeftToTeleportThisFill.Count(); --i >= 0; ) { CBaseEntity *pEnt = m_hLeftToTeleportThisFill[i].Get(); if( pEnt && pEnt->IsPlayer() ) { ((CPortal_Player *)pEnt)->m_hSurroundingLiquidPortal = this; } } }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CColorCorrectionVolume::Spawn( void ) { BaseClass::Spawn(); AddEFlags( EFL_FORCE_CHECK_TRANSMIT | EFL_DIRTY_ABSTRANSFORM ); Precache(); SetSolid( SOLID_BSP ); SetSolidFlags( FSOLID_TRIGGER | FSOLID_NOT_SOLID ); SetModel( STRING( GetModelName() ) ); SetThink( &CColorCorrectionVolume::ThinkFunc ); SetNextThink( gpGlobals->curtime + 0.01f ); if( m_bStartDisabled ) { m_bEnabled = false; } else { m_bEnabled = true; } }
//----------------------------------------------------------------------------- // Purpose: This used to have something to do with bees flying, but // now it only initializes moving furniture in scripted sequences //----------------------------------------------------------------------------- void CNPC_Furniture::Spawn( ) { Precache(); SetModel( STRING(GetModelName()) ); SetMoveType( MOVETYPE_STEP ); SetSolid( SOLID_BBOX ); // Our collision, if needed, will be done through bone followers AddSolidFlags( FSOLID_NOT_SOLID ); SetBloodColor( DONT_BLEED ); m_iHealth = TOO_MUCH_HEALTH_TO_DIE; //wow m_takedamage = DAMAGE_AIM; SetSequence( 0 ); SetCycle( 0 ); SetNavType( NAV_FLY ); AddFlag( FL_FLY ); CapabilitiesAdd( bits_CAP_MOVE_FLY | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE ); AddEFlags( EFL_NO_MEGAPHYSCANNON_RAGDOLL ); // pev->nextthink += 1.0; // SetThink (WalkMonsterDelay); ResetSequenceInfo( ); SetCycle( 0 ); NPCInit(); // Furniture needs to block LOS SetBlocksLOS( true ); // Furniture just wastes CPU doing sensing code, since all they do is idle and play scripts GetSenses()->AddSensingFlags( SENSING_FLAGS_DONT_LOOK | SENSING_FLAGS_DONT_LISTEN ); }
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ MakeSelfSpecifier /*e*/ // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // Overridden to allow specification by name or id as an option. void CModelObjectPlus::MakeSelfSpecifier( AEDesc& inSuperSpecifier, AEDesc& outSelfSpecifier) const { Str255 string; GetModelName(string); if ((mFlags&mfSpecifyByName) && string[0]) { if (mSuperModel==nil) Throw_(errAEEventNotHandled); StAEDescriptor nameKeyData; OSErr err=::AECreateDesc(typeChar,&string[1],string[0],nameKeyData); ThrowIfOSErr_(err); err=::CreateObjSpecifier(GetModelKind(),&inSuperSpecifier,formName,&nameKeyData.mDesc,false,&outSelfSpecifier); ThrowIfOSErr_(err); } else if (mFlags&mfSpecifyById) { if (mSuperModel==nil) Throw_(errAEEventNotHandled); StAEDescriptor idKeyData; StAEDescriptor bogusType; GetAEProperty(pID,bogusType,idKeyData); // get the unique id for this object OSErr err=::CreateObjSpecifier(GetModelKind(),&inSuperSpecifier,formUniqueID,&idKeyData.mDesc,false,&outSelfSpecifier); ThrowIfOSErr_(err); } else inheritedModelObject::MakeSelfSpecifier(inSuperSpecifier,outSelfSpecifier); }
//----------------------------------------------------------------------------- // Purpose: Spawn function //----------------------------------------------------------------------------- void CTFDroppedWeapon::Spawn( void ) { Assert( m_pWeaponInfo ); SetModel( STRING( GetModelName() ) ); AddSpawnFlags( SF_NORESPAWN ); BaseClass::Spawn(); if ( VPhysicsGetObject() ) { // All weapons must have same weight. VPhysicsGetObject()->SetMass( 25.0f ); } SetCollisionGroup( COLLISION_GROUP_DEBRIS ); m_flCreationTime = gpGlobals->curtime; // Remove 30s after spawning m_flRemoveTime = gpGlobals->curtime + 30.0f; SetThink( &CTFDroppedWeapon::RemovalThink ); SetNextThink( gpGlobals->curtime ); }
void CFuncTank::Spawn( void ) { Precache(); SetMoveType( MOVETYPE_PUSH ); // so it doesn't get pushed by anything SetSolid( SOLID_VPHYSICS ); SetModel( STRING( GetModelName() ) ); m_yawCenter = GetLocalAngles().y; m_pitchCenter = GetLocalAngles().x; m_vTargetPosition = vec3_origin; if ( IsActive() ) SetNextThink( gpGlobals->curtime + 1.0f ); UpdateMatrix(); m_sightOrigin = WorldBarrelPosition(); // Point at the end of the barrel if ( m_spread > MAX_FIRING_SPREADS ) { m_spread = 0; } // No longer aim at target position if have one m_spawnflags &= ~SF_TANK_AIM_AT_POS; if (m_spawnflags & SF_TANK_DAMAGE_KICK) { m_takedamage = DAMAGE_YES; } // UNDONE: Do this? //m_targetEntityName = m_target; CreateVPhysics(); }
/*! \return pointer to the next model string<br> NULL if there are no more models in the list ******************************************************************************/ const char* PrinterProxy::GetNextModelName ( MODEL_HANDLE& theModelHandle ) const { TRACE("PP::GetNextModelName()\n"); const char* szModelName = GetModelName(theModelHandle); if (szModelName == NULL) { TRACE("PP:GetNextModelName - reset to being of list\n"); szModelName = m_szModelNames; } else { szModelName += strlen(szModelName)+1; } if (*szModelName == '\0') { TRACE("PP:GetNextModelName - hit end of list\n"); szModelName = NULL; } theModelHandle = szModelName; return szModelName; } //GetNextModelName
void CGunTarget::Spawn( void ) { SetSolid( SOLID_BSP ); SetMoveType( MOVETYPE_PUSH ); SetModel( STRING( GetModelName() ) ); if ( m_flSpeed == 0 ) m_flSpeed = 100; // Don't take damage until "on" m_takedamage = DAMAGE_NO; AddFlag( FL_NPC ); m_on = false; m_iMaxHealth = m_iHealth; if ( HasSpawnFlags(FGUNTARGET_START_ON) ) { SetMoveDone( &CGunTarget::Start ); SetMoveDoneTime( 0.3 ); } CreateVPhysics(); }
void CRagdollProp::Spawn( void ) { // Starts out as the default fade scale value m_flDefaultFadeScale = m_flFadeScale; // NOTE: If this fires, then the assert or the datadesc is wrong! (see DEFINE_RAGDOLL_ELEMENT above) Assert( RAGDOLL_MAX_ELEMENTS == 24 ); Precache(); SetModel( STRING( GetModelName() ) ); CStudioHdr *pStudioHdr = GetModelPtr( ); if ( pStudioHdr->flags() & STUDIOHDR_FLAGS_NO_FORCED_FADE ) { DisableAutoFade(); } else { m_flFadeScale = m_flDefaultFadeScale; } matrix3x4_t pBoneToWorld[MAXSTUDIOBONES]; BaseClass::SetupBones( pBoneToWorld, BONE_USED_BY_ANYTHING ); // FIXME: shouldn't this be a subset of the bones // this is useless info after the initial conditions are set SetAbsAngles( vec3_angle ); int collisionGroup = (m_spawnflags & SF_RAGDOLLPROP_DEBRIS) ? COLLISION_GROUP_DEBRIS : COLLISION_GROUP_NONE; InitRagdoll( vec3_origin, 0, vec3_origin, pBoneToWorld, pBoneToWorld, 0, collisionGroup, true ); m_lastUpdateTickCount = 0; m_flBlendWeight = 0.0f; m_nOverlaySequence = -1; // Unless specified, do not allow this to be dissolved if ( HasSpawnFlags( SF_RAGDOLLPROP_ALLOW_DISSOLVE ) == false ) { AddEFlags( EFL_NO_DISSOLVE ); } }
//----------------------------------------------------------------------------- // Precache - precaches all resources this NPC needs //----------------------------------------------------------------------------- void CNPC_Breen::Precache() { PrecacheModel( STRING( GetModelName() ) ); BaseClass::Precache(); }
//========================================================= // Precache - precaches all resources this NPC needs //========================================================= void CGenericActor::Precache() { PrecacheModel( STRING( GetModelName() ) ); }
void CWorld::Precache( void ) { COM_TimestampedLog( "CWorld::Precache - Start" ); g_WorldEntity = this; g_fGameOver = false; g_pLastSpawn = NULL; g_Language.SetValue( LANGUAGE_ENGLISH ); // TODO use VGUI to get current language #ifndef INFESTED_DLL ConVarRef stepsize( "sv_stepsize" ); stepsize.SetValue( 24 ); #endif ConVarRef roomtype( "room_type" ); roomtype.SetValue( 0 ); // Set up game rules Assert( !g_pGameRules ); if (g_pGameRules) { delete g_pGameRules; } InstallGameRules(); Assert( g_pGameRules ); g_pGameRules->Init(); CSoundEnt::InitSoundEnt(); // UNDONE: Make most of these things server systems or precache_registers // ================================================= // Activities // ================================================= ActivityList_Free(); RegisterSharedActivities(); EventList_Free(); RegisterSharedEvents(); // Only allow precaching between LevelInitPreEntity and PostEntity CBaseEntity::SetAllowPrecache( true ); COM_TimestampedLog( "IGameSystem::LevelInitPreEntityAllSystems" ); IGameSystem::LevelInitPreEntityAllSystems( STRING( GetModelName() ) ); COM_TimestampedLog( "g_pGameRules->CreateStandardEntities()" ); // Create the player resource g_pGameRules->CreateStandardEntities(); COM_TimestampedLog( "InitBodyQue()" ); InitBodyQue(); COM_TimestampedLog( "SENTENCEG_Init()" ); // init sentence group playback stuff from sentences.txt. // ok to call this multiple times, calls after first are ignored. SENTENCEG_Init(); COM_TimestampedLog( "PrecacheStandardParticleSystems()" ); // Precache standard particle systems PrecacheStandardParticleSystems( ); // the area based ambient sounds MUST be the first precache_sounds COM_TimestampedLog( "W_Precache()" ); // player precaches W_Precache (); // get weapon precaches COM_TimestampedLog( "ClientPrecache()" ); ClientPrecache(); COM_TimestampedLog( "PrecacheTempEnts()" ); // precache all temp ent stuff CBaseTempEntity::PrecacheTempEnts(); COM_TimestampedLog( "LightStyles" ); // // 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"); COM_TimestampedLog( "InitializeAINetworks" ); // ================================================= // Load and Init AI Networks // ================================================= CAI_NetworkManager::InitializeAINetworks(); // ================================================= // Load and Init AI Schedules // ================================================= COM_TimestampedLog( "LoadAllSchedules" ); g_AI_SchedulesManager.LoadAllSchedules(); // ================================================= // Initialize NPC Relationships // ================================================= COM_TimestampedLog( "InitDefaultAIRelationships" ); g_pGameRules->InitDefaultAIRelationships(); COM_TimestampedLog( "InitInteractionSystem" ); CBaseCombatCharacter::InitInteractionSystem(); COM_TimestampedLog( "g_pGameRules->Precache" ); // Call the gamerules precache after the AI precache so that games can precache NPCs that are always loaded g_pGameRules->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"); if ( m_iszDetailSpriteMaterial.Get() != NULL_STRING ) { PrecacheMaterial( STRING( m_iszDetailSpriteMaterial.Get() ) ); } COM_TimestampedLog( "CWorld::Precache - Finish" ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Furniture::Precache( void ) { PrecacheModel( STRING( GetModelName() ) ); }
void CCyclerSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { m_animate = !m_animate; ALERT( at_console, "Sprite: %s\n", GetModelName() ); }
//----------------------------------------------------------------------------- // Precache - precaches all resources this NPC needs //----------------------------------------------------------------------------- void CNPC_Kleiner::Precache() { PrecacheModel( STRING( GetModelName() ) ); BaseClass::Precache(); }
std::string CSysInfo::GetUserAgent() { static std::string result; if (!result.empty()) return result; result = GetAppName() + "/" + CSysInfo::GetVersionShort() + " ("; #if defined(TARGET_DARWIN) #if defined(TARGET_DARWIN_IOS) std::string iDevStr(GetModelName()); // device model name with number of model version size_t iDevStrDigit = iDevStr.find_first_of("0123456789"); std::string iDev(iDevStr, 0, iDevStrDigit); // device model name without number if (iDevStrDigit == 0) iDev = "unknown"; result += iDev + "; "; std::string iOSVerison(GetOsVersion()); size_t lastDotPos = iOSVerison.rfind('.'); if (lastDotPos != std::string::npos && iOSVerison.find('.') != lastDotPos && iOSVerison.find_first_not_of('0', lastDotPos + 1) == std::string::npos) iOSVerison.erase(lastDotPos); StringUtils::Replace(iOSVerison, '.', '_'); if (iDev == "AppleTV4") result += "CPU TVOS "; else if (iDev == "iPad" || iDev == "AppleTV") result += "CPU OS "; else result += "CPU iPhone OS "; result += iOSVerison + " like Mac OS X"; #else result += "Macintosh; "; std::string cpuFam(GetBuildTargetCpuFamily()); if (cpuFam == "x86") result += "Intel "; else if (cpuFam == "PowerPC") result += "PPC "; result += "Mac OS X "; std::string OSXVersion(GetOsVersion()); StringUtils::Replace(OSXVersion, '.', '_'); result += OSXVersion; #endif #elif defined(TARGET_ANDROID) result += "Linux; Android "; std::string versionStr(GetOsVersion()); const size_t verLen = versionStr.length(); if (verLen >= 2 && versionStr.compare(verLen - 2, 2, ".0", 2) == 0) versionStr.erase(verLen - 2); // remove last ".0" if any result += versionStr; std::string deviceInfo(GetModelName()); char buildId[PROP_VALUE_MAX]; int propLen = __system_property_get("ro.build.id", buildId); if (propLen > 0 && propLen <= PROP_VALUE_MAX) { if (!deviceInfo.empty()) deviceInfo += " "; deviceInfo += "Build/"; deviceInfo.append(buildId, propLen); } if (!deviceInfo.empty()) result += "; " + deviceInfo; #elif defined(TARGET_POSIX) result += "X11; "; struct utsname un; if (uname(&un) == 0) { std::string cpuStr(un.machine); if (cpuStr == "x86_64" && GetXbmcBitness() == 32) cpuStr = "i686 (x86_64)"; result += un.sysname; result += " "; result += cpuStr; } else result += "Unknown"; #else result += "Unknown"; #endif result += ")"; if (GetAppName() != "Kodi") result += " Kodi_Fork_" + GetAppName() + "/1.0"; // default fork number is '1.0', replace it with actual number if necessary #ifdef TARGET_LINUX // Add distribution name std::string linuxOSName(GetOsName(true)); if (!linuxOSName.empty()) result += " " + linuxOSName + "/" + GetOsVersion(); #endif #ifdef TARGET_RASPBERRY_PI result += " HW_RaspberryPi/1.0"; #elif defined (TARGET_DARWIN_IOS) std::string iDevVer; if (iDevStrDigit == std::string::npos) iDevVer = "0.0"; else iDevVer.assign(iDevStr, iDevStrDigit, std::string::npos); StringUtils::Replace(iDevVer, ',', '.'); result += " HW_" + iDev + "/" + iDevVer; #endif // add more device IDs here if needed. // keep only one device ID in result! Form: // result += " HW_" + "deviceID" + "/" + "1.0"; // '1.0' if device has no version #if defined(TARGET_ANDROID) // Android has no CPU string by default, so add it as additional parameter struct utsname un1; if (uname(&un1) == 0) { std::string cpuStr(un1.machine); StringUtils::Replace(cpuStr, ' ', '_'); result += " Sys_CPU/" + cpuStr; } #endif result += " App_Bitness/" + StringUtils::Format("%d", GetXbmcBitness()); std::string fullVer(CSysInfo::GetVersion()); StringUtils::Replace(fullVer, ' ', '-'); result += " Version/" + fullVer; return result; }