DETOUR_DECL_STATIC(bool __gcc_regcall, ParseDynamicAttributes, void *ecattr, KeyValues *kv) { DevMsg("ParseDynamicAttributes: \"%s\" \"%s\"\n", kv->GetName(), kv->GetString()); if (V_stricmp(kv->GetName(), "ExtAttr") == 0) { auto ext = reinterpret_cast<CTFBot::ExtendedAttr *>((uintptr_t)ecattr + 0x10); const char *val = kv->GetString(); if (V_stricmp(val, "AlwaysFireWeaponAlt") == 0) { DevMsg(" found: ExtAttr AlwaysFireWeaponAlt\n"); ext->TurnOn(ExtAttr::ALWAYS_FIRE_WEAPON_ALT); } else if (V_stricmp(val, "TargetStickies") == 0) { DevMsg(" found: ExtAttr TargetStickies\n"); ext->TurnOn(ExtAttr::TARGET_STICKIES); } else { Warning("TFBotSpawner: Invalid extended attribute '%s'\n", val); } DevMsg(" Got ExtAttr, returning true\n"); return true; } DevMsg(" Passing through to actual ParseDynamicAttributes\n"); return DETOUR_STATIC_CALL(ParseDynamicAttributes)(ecattr, kv); }
//------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_FlickBehavior::KeyValue( const char *szKeyName, const char *szValue ) { if ( V_stricmp( szKeyName, "distance" ) == 0 ) { m_flDistance = atof( szValue ); m_flDistanceSq = m_flDistance * m_flDistance; return true; } else if ( V_stricmp( szKeyName, "propel_distance" ) == 0 ) { m_flPropelDistance = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "propel_height" ) == 0 ) { m_flPropelHeight = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "min_damage" ) == 0 ) { m_flMinDamage = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "max_damage" ) == 0 ) { m_flMaxDamage = atof( szValue ); return true; } return BaseClass::KeyValue( szKeyName, szValue ); }
static void FileSystem_AddLoadedSearchPath( CFSSearchPathsInit &initInfo, const char *pPathID, const char *fullLocationPath, bool bLowViolence ) { // Check for mounting LV game content in LV builds only if ( V_stricmp( pPathID, "game_lv" ) == 0 ) { // Not in LV build, don't mount if ( !initInfo.m_bLowViolence ) return; // Mount, as a game path pPathID = "game"; } // Check for mounting HD game content if enabled if ( V_stricmp( pPathID, "game_hd" ) == 0 ) { // Not in LV build, don't mount if ( !initInfo.m_bMountHDContent ) return; // Mount, as a game path pPathID = "game"; } // Special processing for ordinary game folders if ( V_stristr( fullLocationPath, ".vpk" ) == NULL && Q_stricmp( pPathID, "game" ) == 0 ) { if ( CommandLine()->FindParm( "-tempcontent" ) != 0 ) { char szPath[MAX_PATH]; Q_snprintf( szPath, sizeof(szPath), "%s_tempcontent", fullLocationPath ); initInfo.m_pFileSystem->AddSearchPath( szPath, pPathID, PATH_ADD_TO_TAIL ); } } if ( initInfo.m_pLanguage && Q_stricmp( initInfo.m_pLanguage, "english" ) && V_strstr( fullLocationPath, "_english" ) != NULL ) { char szPath[MAX_PATH]; char szLangString[MAX_PATH]; // Need to add a language version of this path first Q_snprintf( szLangString, sizeof(szLangString), "_%s", initInfo.m_pLanguage); V_StrSubst( fullLocationPath, "_english", szLangString, szPath, sizeof( szPath ), true ); initInfo.m_pFileSystem->AddSearchPath( szPath, pPathID, PATH_ADD_TO_TAIL ); } initInfo.m_pFileSystem->AddSearchPath( fullLocationPath, pPathID, PATH_ADD_TO_TAIL ); }
//------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_JumpBehavior::KeyValue( const char *szKeyName, const char *szValue ) { if ( V_stricmp( szKeyName, "min_range" ) == 0 ) { m_flMinRange = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "jump_delay_min" ) == 0 ) { m_flJumpTimeMin = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "jump_delay_max" ) == 0 ) { m_flJumpTimeMax = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "damage_distance" ) == 0 ) { m_flDamageDistance = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "jump_damage" ) == 0 ) { m_flJumpDamage = atof( szValue ); return true; } return BaseClass::KeyValue( szKeyName, szValue ); }
//------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_HealOtherBehavior::KeyValue( const char *szKeyName, const char *szValue ) { if ( V_stricmp( szKeyName, "heal_distance" ) == 0 ) { m_flHealDistance = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "approach_distance" ) == 0 ) { m_flApproachDistance = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "heal_amount" ) == 0 ) { m_flHealAmount = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "consideration_distance" ) == 0 ) { m_flHealConsiderationDistance = atof( szValue ); m_flHealConsiderationDistanceSquared = m_flHealConsiderationDistance * m_flHealConsiderationDistance; return true; } return BaseClass::KeyValue( szKeyName, szValue ); }
void CASW_Spawn_Manager::Update() { if ( m_iHordeToSpawn > 0 ) { if ( m_vecHordePosition != vec3_origin && ( !m_batchInterval.HasStarted() || m_batchInterval.IsElapsed() ) ) { int iToSpawn = MIN( m_iHordeToSpawn, asw_max_alien_batch.GetInt() ); int iSpawned = SpawnAlienBatch( asw_horde_class.GetString(), iToSpawn, m_vecHordePosition, m_angHordeAngle, 0 ); if (asw_director_debug.GetInt() >= 4) Msg("spawned %d/%d %s (horde) at (%f, %f, %f)\n", iSpawned, m_iHordeToSpawn, asw_horde_class.GetString(), VectorExpand(m_vecHordePosition)); m_iHordeToSpawn -= iSpawned; for (int i = 0; i < iSpawned; i++) { if (RandomFloat() < asw_horde_wanderers.GetFloat()) { KeyValues *pWanderer = RandomWanderer(); if (pWanderer) { FOR_EACH_TRUE_SUBKEY(pWanderer, pNPC) { if (V_stricmp(pNPC->GetName(), "NPC")) { Warning("Spawn Manager ignoring non-NPC key in WANDERER definition: %s\n", pNPC->GetName()); continue; } const char *szAlienClass = pNPC->GetString("AlienClass"); if (SpawnAlienAt(szAlienClass, m_vecHordePosition + Vector(0, 0, !V_stricmp(szAlienClass, "asw_buzzer") ? 128 : 32), m_angHordeAngle, pNPC)) { if (asw_director_debug.GetInt() >= 4) { Msg("spawned %s (horde wanderer) at (%f, %f, %f)\n", szAlienClass, VectorExpand(m_vecHordePosition)); } } } } else { const char *szAlienClass = asw_wanderer_class.GetString(); if (SpawnAlienAt(szAlienClass, m_vecHordePosition + Vector(0, 0, !V_stricmp(szAlienClass, "asw_buzzer") ? 128 : 32), m_angHordeAngle)) { if (asw_director_debug.GetInt() >= 4) { Msg("spawned %s (horde wanderer) at (%f, %f, %f)\n", szAlienClass, VectorExpand(m_vecHordePosition)); } } } } }
//----------------------------------------------------------------------------- // Fixes up all elements //----------------------------------------------------------------------------- void CImportSFMV8::FixupElement( CDmElement *pElement ) { if ( !pElement ) return; const char *pType = pElement->GetTypeString(); if ( !V_stricmp( pType, "DmeAnimationSet" ) ) { // Remove 'midpoint' from all controls, and // Add 'defaultBalance' and 'defaultMultilevel' to all non-transform controls CDmrElementArray<> srcControls( pElement, "controls" ); if ( srcControls.IsValid() ) { int nCount = srcControls.Count(); for ( int i = 0; i < nCount; ++i ) { CDmElement *pControl = srcControls[i]; if ( pControl ) { if ( !pControl->GetValue<bool>( "transform" ) ) { pControl->InitValue( "defaultBalance", 0.5f ); pControl->InitValue( "defaultMultilevel", 0.5f ); pControl->RemoveAttribute( "midpoint" ); } } } } } }
//=============================================================================== // Actualiza la textura de la luz //=============================================================================== void CBaseFlashlightEffect::UpdateFlashlightTexture( const char* pTextureName ) { static const char *pEmptyString = ""; if ( pTextureName == NULL ) pTextureName = pEmptyString; if ( !m_nFlashlightTexture.IsValid() || V_stricmp( m_textureName, pTextureName ) != 0 ) { if ( pTextureName == pEmptyString ) { m_nFlashlightTexture.Init( "effects/flashlight001", TEXTURE_GROUP_OTHER, true ); } else { m_nFlashlightTexture.Init( pTextureName, TEXTURE_GROUP_OTHER, true ); } V_strncpy( m_textureName, pTextureName, sizeof(m_textureName) ); } // Iniciamos la textura del Flash if ( !m_nMuzzleFlashTexture.IsValid() ) m_nMuzzleFlashTexture.Init( "effects/muzzleflash_light", TEXTURE_GROUP_OTHER, true ); }
//------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_PrepareToEngageBehavior::KeyValue( const char *szKeyName, const char *szValue ) { if ( V_stricmp( szKeyName, "prepare_radius_min" ) == 0 ) { m_flPrepareRadiusMin = atof( szValue ); return true; } if ( V_stricmp( szKeyName, "prepare_radius_max" ) == 0 ) { m_flPrepareRadiusMax = atof( szValue ); return true; } return BaseClass::KeyValue( szKeyName, szValue ); }
//----------------------------------------------------------------------------- // Populate element choice lists //----------------------------------------------------------------------------- bool CVcdBlockDoc::GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement, const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list ) { if ( !Q_stricmp( pChoiceListType, "allelements" ) ) { AddElementsRecursively( m_hEditRoot, list ); return true; } if ( !Q_stricmp( pChoiceListType, "info_targets" ) ) { const CDmrElementArray<> entities = GetEntityList(); bool bFound = false; int nCount = entities.Count(); for ( int i = 0; i < nCount; ++i ) { CDmeVMFEntity *pNode = CastElement< CDmeVMFEntity >( entities[ i ] ); if ( !V_stricmp( pNode->GetClassName(), "info_target" ) ) { bFound = true; ElementChoice_t sChoice; sChoice.m_pValue = pNode; sChoice.m_pChoiceString = pNode->GetTargetName(); list.AddToTail( sChoice ); } } return bFound; } // by default, try to treat the choice list type as a Dme element type AddElementsRecursively( m_hEditRoot, list, pChoiceListType ); return list.Count() > 0; }
void TrackPlayers() { if (debugoverlay == nullptr) { Warning("debugoverlay is nullptr!\n"); return; } if (V_stricmp(cvar_indexes.GetString(), "all") == 0) { for (int i = 1; i <= 32; ++i) { debugoverlay->AddEntityTextOverlay(i, 0, cvar_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff, "#%d", i); } } else { char *dup = strdup(cvar_indexes.GetString()); char *s = strtok(dup, ","); while (s != nullptr) { int idx = std::stoi(s, nullptr, 0); // DevMsg("%d\n", idx); if (idx >= 0 && idx < 2048) { debugoverlay->AddEntityTextOverlay(idx, 0, cvar_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff, "#%d", idx); } s = strtok(nullptr, ","); } free(dup); } }
//----------------------------------------------------------------------------- // Populate string choice lists //----------------------------------------------------------------------------- bool CVcdBlockDoc::GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement, const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list ) { if ( !Q_stricmp( pChoiceListType, "info_targets" ) ) { const CDmrElementArray<> entities = GetEntityList(); StringChoice_t sChoice; sChoice.m_pValue = ""; sChoice.m_pChoiceString = ""; list.AddToTail( sChoice ); int nCount = entities.Count(); for ( int i = 0; i < nCount; ++i ) { CDmeVMFEntity *pNode = CastElement< CDmeVMFEntity >( entities[ i ] ); if ( !V_stricmp( pNode->GetClassName(), "info_target" ) ) { StringChoice_t sChoice; sChoice.m_pValue = pNode->GetTargetName(); sChoice.m_pChoiceString = pNode->GetTargetName(); list.AddToTail( sChoice ); } } return true; } return false; }
//----------------------------------------------------------------------------- // Purpose: Figure out the file type from its extension. Returns false if we don't have an enum for that extension. //----------------------------------------------------------------------------- bool CTextureSystem::GetFileTypeFromFilename( const char *pFilename, CTextureSystem::EFileType *pFileType ) { char strRight[16]; V_StrRight( pFilename, 4, strRight, sizeof( strRight ) ); if ( V_stricmp( strRight, ".vmt" ) == 0 ) { *pFileType = CTextureSystem::k_eFileTypeVMT; return true; } else if ( V_stricmp( strRight, ".vtf" ) == 0 ) { *pFileType = CTextureSystem::k_eFileTypeVTF; return true; } return false; }
static void DoEntFire( const char *pszTarget, const char *pszAction, const char *pszValue, float delay, HSCRIPT hActivator, HSCRIPT hCaller ) { const char *target = "", *action = "Use"; variant_t value; target = STRING( AllocPooledString( pszTarget ) ); // Don't allow them to run anything on a point_servercommand unless they're the host player. Otherwise they can ent_fire // and run any command on the server. Admittedly, they can only do the ent_fire if sv_cheats is on, but // people complained about users resetting the rcon password if the server briefly turned on cheats like this: // give point_servercommand // ent_fire point_servercommand command "rcon_password mynewpassword" if ( gpGlobals->maxClients > 1 && V_stricmp( target, "point_servercommand" ) == 0 ) { return; } if ( *pszAction ) { action = STRING( AllocPooledString( pszAction ) ); } if ( *pszValue ) { value.SetString( AllocPooledString( pszValue ) ); } if ( delay < 0 ) { delay = 0; } g_EventQueue.AddEvent( target, action, value, delay, ToEnt(hActivator), ToEnt(hCaller) ); }
bool CUtlString::IsEqual_CaseInsensitive( const char *src ) const { if ( !src ) { return (Length() == 0); } return ( V_stricmp( Get(), src ) == 0 ); }
inline EventDesiredResult<CTFBot> CTFBotRocketJump_Wait::OnCommandString(CTFBot *actor, const char *cmd) { if (V_stricmp(cmd, "JumpVertical") == 0) { return EventDesiredResult<CTFBot>::SuspendFor(new CTFBotRocketJump_JumpVertical(), "Doing a vertical jump"); } return EventDesiredResult<CTFBot>::Continue(); }
int WCKVBase_Vector::FindByKeyName( const char *pKeyName ) const { for ( int i=0; i < m_KeyValues.Count(); i++ ) { if ( V_stricmp( m_KeyValues[i].szKey, pKeyName ) == 0 ) return i; } return GetInvalidIndex(); }
void CASW_Spawn_Manager::SelectSpawnSet() { int iDifficulty = 1; if (ASWGameRules()) { iDifficulty = clamp(ASWGameRules()->GetMissionDifficulty(), 1, 99); } if (asw_director_debug.GetBool()) { Msg("Mission difficulty: %d\n", iDifficulty); } #define FIND_SPAWN_SET(pConfig, pszConfigName) \ if ((pConfig)) \ { \ for (KeyValues *pSpawnSet = pConfig; pSpawnSet; pSpawnSet = pSpawnSet->GetNextTrueSubKey()) \ { \ if (V_stricmp(pSpawnSet->GetName(), "SpawnSet")) \ { \ Warning("Spawn Manager %s config should only have SpawnSet keys, but it has a %s key.\n", pszConfigName, pSpawnSet->GetName()); \ continue; \ } \ \ if ((!V_stricmp(pSpawnSet->GetString("Map"), "*") || !V_stricmp(pSpawnSet->GetString("Map"), STRING(gpGlobals->mapname))) && \ pSpawnSet->GetInt("MinDifficulty", 1) <= iDifficulty && pSpawnSet->GetInt("MaxDifficulty", 99) >= iDifficulty) \ { \ if (asw_director_debug.GetBool()) \ { \ Msg("Spawn Manager candidate SpawnSet: %s\n", pSpawnSet->GetString("Name", "[unnamed]")); \ } \ m_pSpawnSet = pSpawnSet; \ } \ } \ } FIND_SPAWN_SET(m_pGlobalConfig, "global"); FIND_SPAWN_SET(m_pMissionConfig, "mission"); #undef FIND_SPAWN_SET Assert(m_pSpawnSet); if (!m_pSpawnSet) { Warning("Spawn Manager could not find any spawn config!!!\n"); } else if (asw_director_debug.GetBool()) { KeyValuesDumpAsDevMsg(m_pSpawnSet); if (!V_stricmp(m_pSpawnSet->GetString("Map", "*"), "*")) { Warning("Spawn Manager using default SpawnSet.\n"); } Msg("Spawn Manager using SpawnSet: %s\n", m_pSpawnSet->GetString("Name", "[unnamed]")); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CHudElement *CHud::FindElement(const char *pName) { for (int i = 0; i < m_HudList.Size(); i++) { if (V_stricmp(m_HudList[i]->GetName(), pName) == 0) return m_HudList[i]; } DevWarning(1, "Could not find Hud Element: %s\n", pName); Assert(0); return NULL; }
//------------------------------------------------------------------------------ // Purpose: function to set up parameters // Input : szKeyName - the name of the key // szValue - the value to be set // Output : returns true of we handled this key //------------------------------------------------------------------------------ bool CAI_ASW_ShieldBehavior::KeyValue( const char *szKeyName, const char *szValue ) { if ( V_stricmp( szKeyName, "distance") == 0 ) { m_flDistance = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "max_frozen_time") == 0 ) { m_flMaxFrozenTime = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "frozen_down_time") == 0 ) { m_flSFrozenDownTime = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "frozen_param" ) == 0 ) { m_FrozenParm = GetSymbol( szValue ); return true; } else if ( V_stricmp( szKeyName, "frozen_time_reduction_multiplier" ) == 0 ) { m_flFrozenTimeReductionMultiplier = atof( szValue ); return true; } else if ( V_stricmp( szKeyName, "frozen_time_expansion_multiplier" ) == 0 ) { m_flFrozenTimeExpansionMultiplier = atof( szValue ); return true; } return BaseClass::KeyValue( szKeyName, szValue ); }
void RunProcessAtCommandLine( CUtlVector<char*> &newArgv, bool bShowAppWindow, bool bCreateSuspended, int iPriority ) { // current directory (use c:\\ because we don't want it to accidentally share // DLLs like vstdlib with us). PROCESS_INFORMATION pi; PROCESS_INFORMATION pi; if ( RunProcessFromArgs( newArgv, bShowAppWindow, bCreateSuspended, g_FileCachePath, &pi ) ) { if ( g_pConnMgr ) g_pConnMgr->SetAppState( VMPI_SERVICE_STATE_BUSY ); if ( newArgv.Count() > 0 && newArgv[0] ) { V_FileBase( newArgv[0], g_RunningProcess_ExeName, sizeof( g_RunningProcess_ExeName ) ); if ( V_stricmp( g_RunningProcess_ExeName, "vrad" ) == 0 || V_stricmp( g_RunningProcess_ExeName, "vvis" ) == 0 ) V_FileBase( newArgv[newArgv.Count()-1], g_RunningProcess_MapName, sizeof( g_RunningProcess_MapName ) ); } g_hRunningProcess = pi.hProcess; g_hRunningThread = pi.hThread; g_dwRunningProcessId = pi.dwProcessId; g_pPerfTracker->Init( g_dwRunningProcessId ); g_CurJobPriority = iPriority; g_CreateProcessTime = GetTickCount(); SendStartStatus( true ); } else { Msg( " - ERROR in CreateProcess (%s)!\n", GetLastErrorString() ); SendStartStatus( false ); g_CurJobPriority = -1; g_RunningProcess_ExeName[0] = 0; g_RunningProcess_MapName[0] = 0; } }
//----------------------------------------------------------------------------- // Purpose: Finds Python client class by Network class Name //----------------------------------------------------------------------------- PyClientClassBase *FindPyClientClassToNetworkClass( const char *pNetworkName ) { PyClientClassBase *p = g_pPyClientClassHead; while( p ) { if ( V_stricmp( p->m_strPyNetworkedClassName, pNetworkName ) == 0) { return p; } p = p->m_pPyNext; } return NULL; }
bool FileSystem_IsHldsUpdateToolDedicatedServer() { // To determine this, we see if the directory our executable was launched from is "orangebox". // We only are under "orangebox" if we're run from hldsupdatetool. char baseDir[MAX_PATH]; if ( !FileSystem_GetBaseDir( baseDir, sizeof( baseDir ) ) ) return false; V_FixSlashes( baseDir ); V_StripTrailingSlash( baseDir ); const char *pLastDir = V_UnqualifiedFileName( baseDir ); return ( pLastDir && V_stricmp( pLastDir, "orangebox" ) == 0 ); }
//----------------------------------------------------------------------------- // Purpose: Finds Python client class by Name //----------------------------------------------------------------------------- PyClientClassBase *FindPyClientClass( const char *pName ) { PyClientClassBase *p = g_pPyClientClassHead; while( p ) { if ( V_stricmp( p->GetName(), pName ) == 0) { return p; } p = p->m_pPyNext; } return NULL; }
//----------------------------------------------------------------------------- // Purpose: Strip off the last directory from dirName // Input : *dirName - // maxlen - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool V_StripLastDir( char *dirName, int maxlen ) { if( dirName[0] == 0 || !V_stricmp( dirName, "./" ) || !V_stricmp( dirName, ".\\" ) ) return false; int len = V_strlen( dirName ); Assert( len < maxlen ); // skip trailing slash if ( PATHSEPARATOR( dirName[len-1] ) ) { len--; } while ( len > 0 ) { if ( PATHSEPARATOR( dirName[len-1] ) ) { dirName[len] = 0; V_FixSlashes( dirName, CORRECT_PATH_SEPARATOR ); return true; } len--; } // Allow it to return an empty string and true. This can happen if something like "tf2/" is passed in. // The correct behavior is to strip off the last directory ("tf2") and return true. if( len == 0 ) { V_snprintf( dirName, maxlen, ".%c", CORRECT_PATH_SEPARATOR ); return true; } return true; }
//----------------------------------------------------------------------------- // Purpose: Loads all the materials for the given game config. //----------------------------------------------------------------------------- void CTextureSystem::LoadMaterials(CGameConfig *pConfig) { CTextureGroup *pGroup = new CTextureGroup("Materials"); pGroup->SetTextureFormat(tfVMT); m_pActiveContext->Groups.AddToTail(pGroup); // Add all the materials to the group. CMaterial::EnumerateMaterials( this, "materials", (int)pGroup, INCLUDE_WORLD_MATERIALS ); // Watch the materials directory recursively... CMaterialFileChangeWatcher *pWatcher = new CMaterialFileChangeWatcher; pWatcher->Init( this, (int)pGroup ); m_ChangeWatchers.AddToTail( pWatcher ); Assert( m_pCubemapTexture == NULL ); m_pCubemapTexture = MaterialSystemInterface()->FindTexture( "editor/cubemap", NULL, true ); if ( m_pCubemapTexture ) { m_pCubemapTexture->IncrementReferenceCount(); CMatRenderContextPtr pRenderContext( MaterialSystemInterface() ); pRenderContext->BindLocalCubemap( m_pCubemapTexture ); } // Get the nodraw texture. m_pNoDrawTexture = NULL; for ( int i=0; i < m_Textures.Count(); i++ ) { if ( V_stricmp( m_Textures[i]->GetName(), "tools/toolsnodraw" ) == 0 || V_stricmp( m_Textures[i]->GetName(), "tools/toolsnodraw" ) == 0 ) { m_pNoDrawTexture = m_Textures[i]; break; } } if ( !m_pNoDrawTexture ) m_pNoDrawTexture = CMaterial::CreateMaterial( "tools/toolsnodraw", true ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool C_SceneEntity::GetHWMorphSceneFileName( const char *pFilename, char *pHWMFilename ) { // Are we even using hardware morph? if ( !UseHWMorphVCDs() ) return false; // Multi-player only! if ( !m_bMultiplayer ) return false; // Do we have a valid filename? if ( !( pFilename && pFilename[0] ) ) return false; // Check to see if we already have an player/hwm/* filename. if ( ( V_strstr( pFilename, "/high" ) != NULL ) || ( V_strstr( pFilename, "\\high" ) != NULL ) ) { V_strcpy( pHWMFilename, pFilename ); return true; } // Find the hardware morph scene name and pass that along as well. char szScene[MAX_PATH]; V_strcpy( szScene, pFilename ); char szSceneHWM[MAX_PATH]; szSceneHWM[0] = '\0'; char *pszToken = strtok( szScene, "/\\" ); while ( pszToken != NULL ) { if ( !V_stricmp( pszToken, "low" ) ) { V_strcat( szSceneHWM, "high", sizeof( szSceneHWM ) ); } else { V_strcat( szSceneHWM, pszToken, sizeof( szSceneHWM ) ); } pszToken = strtok( NULL, "/\\" ); if ( pszToken != NULL ) { V_strcat( szSceneHWM, "\\", sizeof( szSceneHWM ) ); } } V_strcpy( pHWMFilename, szSceneHWM ); return true; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CHL2WarsPlayer::ClientCommand( const CCommand &args ) { // FIXME: Most commands do not check the number of args. // (Although this doesn't really matter since an arg out of range is just an empty string...). if( GetControlledUnit() && GetControlledUnit()->GetIUnit() ) { if( GetControlledUnit()->GetIUnit()->ClientCommand( args ) ) return true; } if( !V_stricmp( args[0], "player_clearselection" ) ) { ClearSelection(); return true; } else if( !V_stricmp( args[0], "player_addunit" ) ) { for( int i = 1; i < args.ArgC(); i++ ) { #ifdef CLIENTSENDEHANDLE long iEncodedEHandle = atol(args[i]); int iSerialNum = (iEncodedEHandle >> MAX_EDICT_BITS); int iEntryIndex = iEncodedEHandle & ~(iSerialNum << MAX_EDICT_BITS); EHANDLE pEnt( iEntryIndex, iSerialNum ); #else CBaseEntity *pEnt = UTIL_EntityByIndex( atoi(args[i]) ); #endif // CLIENTSENDEHANDLE //DevMsg( "player_addunit: selecting ent #%d\n", atoi(args[i]) ); if( pEnt && pEnt->IsAlive() && pEnt->GetIUnit() ) pEnt->GetIUnit()->Select(this); else DevMsg( "player_addunit: tried to select an invalid unit (#%d)\n", atoi(args[i]) ); } return true; } else if( !V_stricmp( args[0], "player_removeunit" ) )
//----------------------------------------------------------------------------- // Fixes up all elements //----------------------------------------------------------------------------- void CImportSFMV6::FixupElement( CDmElement *pElement ) { if ( !pElement ) return; const char *pType = pElement->GetTypeString(); if ( !V_stricmp( pType, "DmeProjectedLight" ) ) { Vector vDir = pElement->GetValue<Vector>( "direction" ); pElement->RemoveAttribute( "direction" ); Quaternion q = DirectionToOrientation( vDir ); pElement->SetValue<Quaternion>( "orientation", q ); } }
DETOUR_DECL_MEMBER(ActionResult<CTFBot>, CTFBotTacticalMonitor_OnCommandString, CTFBot *actor, const char *cmd) { #warning put me back! /* if (V_stricmp(cmd, "gotoupgradestation") == 0) { return ActionResult<CTFBot>::SuspendFor(new CTFBotGoToUpgradeStation(), "Going to an upgrade station."); } if (V_stricmp(cmd, "purchaseupgrades") == 0) { return ActionResult<CTFBot>::SuspendFor(new CTFBotPurchaseUpgrades(), "Purchasing upgrades."); }*/ if (V_stricmp(cmd, "collectmoney") == 0 && CTFBotCollectMoney::IsPossible(actor)) { return ActionResult<CTFBot>::SuspendFor(new CTFBotCollectMoney(), "Collecting money."); } return DETOUR_MEMBER_CALL(CTFBotTacticalMonitor_OnCommandString)(actor, cmd); }