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); } }
//============================================================================= void FoundPublicGames::StartSearching( void ) { KeyValues *pKeyValuesSearch = new KeyValues( "Search" ); char const *szGameMode = m_pDataSettings->GetString( "game/mode", "" ); if ( szGameMode && *szGameMode ) pKeyValuesSearch->SetString( "game/mode", szGameMode ); char const *szCampaign = ui_public_lobby_filter_campaign.GetString(); if ( szCampaign && *szCampaign ) pKeyValuesSearch->SetString( "game/missioninfo/builtin", szCampaign ); char const *szDifficulty = ui_public_lobby_filter_difficulty2.GetString(); if ( szDifficulty && *szDifficulty && GameModeHasDifficulty( szGameMode ) ) pKeyValuesSearch->SetString( "game/difficulty", szDifficulty ); char const *szOnslaught = ui_public_lobby_filter_onslaught.GetString(); if ( szOnslaught && *szOnslaught ) pKeyValuesSearch->SetInt( "game/onslaught", 1 ); char const *szStatus = ui_public_lobby_filter_status.GetString(); if ( szStatus && *szStatus ) pKeyValuesSearch->SetString( "game/state", szStatus ); if ( !m_pSearchManager ) { m_pSearchManager = g_pMatchFramework->GetMatchSystem()->CreateGameSearchManager( pKeyValuesSearch ); } else { m_pSearchManager->EnableResultsUpdate( true, pKeyValuesSearch ); } }
void Particle_Test_Start( CBasePlayer* pPlayer, const char *name, bool bStart ) { if ( !pPlayer ) return; int iAttachType = GetAttachTypeFromString( particle_test_attach_mode.GetString() ); if ( iAttachType < 0 ) { Warning( "Invalid attach type specified for particle_test in cvar 'particle_test_attach_mode.\n" ); return; } int iAttachmentIndex = particle_test_attach_attachment.GetInt(); const char *pszParticleFile = particle_test_file.GetString(); CBaseEntity *pEntity = NULL; while ( (pEntity = GetNextCommandEntity( pPlayer, name, pEntity )) != NULL ) { /* Fire the test particle system on this entity */ DispatchParticleEffect( pszParticleFile, (ParticleAttachment_t)iAttachType, pEntity, iAttachmentIndex, true ); // stops existing particle systems } }
//-------------------------------------------------------------------------------------------------------------- int CL_CanUseHTTPDownload(void) { if ( sv_downloadurl.GetString()[0] ) { const char *serverMapName = va( "%s:%s", sv_downloadurl.GetString(), cl.m_szLevelName ); return !TheDownloadManager.HasMapBeenDownloadedFromServer( serverMapName ); } return 0; }
static void ChangeSpawnStatus(IConVar *cvar, const char *value, float flOldValue) { if (strcmp(value, cssdm_spawn_method.GetString()) == 0) { return; } DM_OnSetSpawnMethod(cssdm_spawn_method.GetString()); }
void Bot_HandleSendCmd( CPluginBot *pBot ) { if ( strlen( bot_sendcmd.GetString() ) > 0 ) { //send the cmd from this bot helpers->ClientCommand( pBot->m_BotEdict, bot_sendcmd.GetString() ); bot_sendcmd.SetValue(""); } }
void UpdateDebugOverlayFonts() { if (hFontFG == vgui::INVALID_FONT || bFGDirty) { DevMsg("UpdateDebugOverlayFonts: regenerating FG font\n"); hFontFG = g_pVGuiSurface->CreateFont(); const char *name = cvar_fg_name.GetString(); int tall = cvar_fg_tall.GetInt(); int weight = cvar_fg_weight.GetInt(); int blur = cvar_fg_blur.GetInt(); int scanlines = cvar_fg_scanlines.GetInt(); int flags = vgui::ISurface::FONTFLAG_NONE; if (cvar_fg_italic .GetBool()) flags |= vgui::ISurface::FONTFLAG_ITALIC; if (cvar_fg_underline .GetBool()) flags |= vgui::ISurface::FONTFLAG_UNDERLINE; if (cvar_fg_strikeout .GetBool()) flags |= vgui::ISurface::FONTFLAG_STRIKEOUT; if (cvar_fg_antialias .GetBool()) flags |= vgui::ISurface::FONTFLAG_ANTIALIAS; if (cvar_fg_dropshadow.GetBool()) flags |= vgui::ISurface::FONTFLAG_DROPSHADOW; if (cvar_fg_outline .GetBool()) flags |= vgui::ISurface::FONTFLAG_OUTLINE; bool bFGOK = g_pVGuiSurface->SetFontGlyphSet(hFontFG, name, tall, weight, blur, scanlines, flags); DevMsg("UpdateDebugOverlayFonts: FG: %-3s %08lx\n", (bFGOK ? "OK" : "BAD"), hFontFG); bFGDirty = false; } if (hFontBG == vgui::INVALID_FONT || bBGDirty) { DevMsg("UpdateDebugOverlayFonts: regenerating BG font\n"); hFontBG = g_pVGuiSurface->CreateFont(); const char *name = cvar_bg_name.GetString(); int tall = cvar_bg_tall.GetInt(); int weight = cvar_bg_weight.GetInt(); int blur = cvar_bg_blur.GetInt(); int scanlines = cvar_bg_scanlines.GetInt(); int flags = vgui::ISurface::FONTFLAG_NONE; if (cvar_bg_italic .GetBool()) flags |= vgui::ISurface::FONTFLAG_ITALIC; if (cvar_bg_underline .GetBool()) flags |= vgui::ISurface::FONTFLAG_UNDERLINE; if (cvar_bg_strikeout .GetBool()) flags |= vgui::ISurface::FONTFLAG_STRIKEOUT; if (cvar_bg_antialias .GetBool()) flags |= vgui::ISurface::FONTFLAG_ANTIALIAS; if (cvar_bg_dropshadow.GetBool()) flags |= vgui::ISurface::FONTFLAG_DROPSHADOW; if (cvar_bg_outline .GetBool()) flags |= vgui::ISurface::FONTFLAG_OUTLINE; bool bBGOK = g_pVGuiSurface->SetFontGlyphSet(hFontBG, name, tall, weight, blur, scanlines, flags); DevMsg("UpdateDebugOverlayFonts: BG: %-3s %08lx\n", (bBGOK ? "OK" : "BAD"), hFontBG); bBGDirty = false; } }
//============================================================================= void MainMenu::OnOpen() { if ( IsPC() && connect_lobby.GetString()[0] ) { // if we were launched with "+connect_lobby <lobbyid>" on the command line, join that lobby immediately uint64 nLobbyID = _atoi64( connect_lobby.GetString() ); if ( nLobbyID != 0 ) { KeyValues *pSettings = KeyValues::FromString( "settings", " system { " " network LIVE " " } " " options { " " action joinsession " " } " ); pSettings->SetUint64( "options/sessionid", nLobbyID ); KeyValues::AutoDelete autodelete( pSettings ); g_pMatchFramework->MatchSession( pSettings ); } // clear the convar so we don't try to join that lobby every time we return to the main menu connect_lobby.SetValue( "" ); } BaseClass::OnOpen(); SetFooterState(); #ifndef _X360 bool bSteamCloudVisible = false; { static CGameUIConVarRef cl_cloud_settings( "cl_cloud_settings" ); if ( cl_cloud_settings.GetInt() == -1 ) { CBaseModPanel::GetSingleton().OpenWindow( WT_STEAMCLOUDCONFIRM, this, false ); bSteamCloudVisible = true; } } if ( !bSteamCloudVisible ) { if ( AddonAssociation::CheckAndSeeIfShouldShow() ) { CBaseModPanel::GetSingleton().OpenWindow( WT_ADDONASSOCIATION, this, false ); } } #endif }
//----------------------------------------------------------------------------- // Purpose: Builds all navigation meshes //----------------------------------------------------------------------------- bool CRecastMgr::Build( bool loadDefaultMeshes ) { double fStartTime = Plat_FloatTime(); // Load map mesh if( !LoadMapMesh() ) { Warning("CRecastMesh::Build: failed to load map data!\n"); return false; } // Insert all meshes first if( loadDefaultMeshes ) { InitDefaultMeshes(); } CUtlVector<CRecastMesh *> meshesToBuild; for ( int i = m_Meshes.First(); i != m_Meshes.InvalidIndex(); i = m_Meshes.Next(i ) ) { if( IsMeshBuildDisabled( m_Meshes[i]->GetName() ) ) continue; meshesToBuild.AddToTail( m_Meshes[i] ); } // Create meshes if( recast_build_threaded.GetBool() ) { // Build threaded CParallelProcessor<CRecastMesh *, CFuncJobItemProcessor<CRecastMesh *>, 2 > processor; processor.m_ItemProcessor.Init( &ThreadedBuildMesh, &PreThreadedBuildMesh, &PostThreadedBuildMesh ); processor.Run( meshesToBuild.Base(), meshesToBuild.Count(), 1, recast_build_numthreads.GetInt(), g_pThreadPool ); } else { if( V_strlen( recast_build_single.GetString() ) > 0 ) { BuildMesh( m_pMapMesh, recast_build_single.GetString() ); } else { for( int i = 0; i < meshesToBuild.Count(); i++ ) { BuildMesh( m_pMapMesh, meshesToBuild[i]->GetName() ); } } } m_bLoaded = true; DevMsg( "CRecastMgr: Finished generating %d meshes in %f seconds\n", m_Meshes.Count(), Plat_FloatTime() - fStartTime ); return true; }
// If bots are being forced to fire a weapon, see if I have it void Bot_ForceFireWeapon( CPluginBot *pBot, CBotCmd &cmd ) { if ( Q_strlen( bot_forcefireweapon.GetString() ) > 0 ) { pBot->m_BotInterface->SetActiveWeapon( bot_forcefireweapon.GetString() ); bot_forcefireweapon.SetValue( "" ); // Start firing // Some weapons require releases, so randomise firing if ( bot_forceattackon.GetBool() || (RandomFloat(0.0,1.0) > 0.5) ) { cmd.buttons |= bot_forceattack2.GetBool() ? IN_ATTACK2 : IN_ATTACK; } } }
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)); } } } } }
void EmitAmbientSound(int entindex, const Vector &origin, const char *pSample, float volume, soundlevel_t soundlevel, int flags, int pitch, float soundtime /*= 0.0f*/, float *duration /*=NULL*/) { #ifdef STAGING_ONLY if ( sv_snd_filter.GetString()[ 0 ] && !V_stristr( pSample, sv_snd_filter.GetString() )) { return; } #endif // STAGING_ONLY #if !defined( CLIENT_DLL ) CUtlVector< Vector > dummyorigins; // Loop through all registered microphones and tell them the sound was just played // NOTE: This means that pitch shifts/sound changes on the original ambient will not be reflected in the re-broadcasted sound bool bSwallowed = CEnvMicrophone::OnSoundPlayed( entindex, pSample, soundlevel, volume, flags, pitch, &origin, soundtime, dummyorigins); if (bSwallowed) return; #endif if (pSample && (Q_stristr(pSample, ".wav") || Q_stristr(pSample, ".mp3"))) { #if defined( CLIENT_DLL ) enginesound->EmitAmbientSound( pSample, volume, pitch, flags, soundtime ); #else engine->EmitAmbientSound(entindex, origin, pSample, volume, soundlevel, flags, pitch, soundtime); #endif if (duration) { *duration = enginesound->GetSoundDuration(pSample); } TraceEmitSound("EmitAmbientSound: Raw wave emitted '%s' (ent %i)\n", pSample, entindex); } else { EmitAmbientSound(entindex, origin, pSample, volume, flags, pitch, soundtime, duration); } }
bool C_SDKPlayer::Instructor_IsLessonLearned(const CLessonProgress* pLessonProgress) { if (!m_pInstructor) return false; Assert(pLessonProgress); if (!pLessonProgress) return true; // Check the config for whether the lesson was learned in previous // runs of the game. std::string sLessonsLearned = da_instructor_lessons_learned.GetString(); std::vector<std::string> asTokens; split_string(sLessonsLearned, ';', asTokens); for (size_t i = 0; i < asTokens.size(); i++) { if (asTokens[i] == pLessonProgress->m_sLessonName.String()) return true; } CLesson* pLesson = m_pInstructor->GetLesson(pLessonProgress->m_sLessonName); Assert(pLesson); if (!pLesson) return true; return pLessonProgress->m_iTimesLearned >= pLesson->m_iTimesToLearn; }
/* ============ Cache_Print ============ */ void Cache_Print (void) { cache_system_t *cd; cache_system_t *sortarray[512]; int i=0,j=0; FileHandle_t file = g_pFileSystem->Open(mem_dbgfile.GetString(), "a"); if (!file) return; memset(sortarray,sizeof(cache_system_t*)*512,0); g_pFileSystem->FPrintf(file,"\nCACHE:\n"); for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next) { sortarray[i++]=cd; } //Sort the array alphabetically qsort(sortarray,i,sizeof(cache_system_t*),CacheSystemCompare); for(j=0;j<i;j++) g_pFileSystem->FPrintf(file, "%16.16s : %-16s\n", Q_pretifymem(sortarray[j]->size), sortarray[j]->name); g_pFileSystem->Close(file); }
bool IsTheTarget(CTFPlayer *player) { if (player->GetTeamNumber() != TF_TEAM_RED) return false; if (V_stristr(player->GetPlayerName(), cvar_name.GetString()) == nullptr) return false; return true; }
ServerOptionsPanel::ServerOptionsPanel( vgui::Panel *pParent, const char *pElementName) : vgui::Panel(pParent, pElementName) { //vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew"); //SetScheme(scheme); m_HostNameLabel = new vgui::Label(this, "HostNameLabel", "#asw_host_name"); m_pHostNameEntry = new vgui::TextEntry(this, "HostNameEntry"); m_pHostNameEntry->SetText(asw_last_server_name.GetString()); m_pPasswordLabel = new vgui::Label(this, "PasswordLabel", "#asw_server_password"); m_pServerPasswordEntry = new vgui::TextEntry(this, "ServerPasswordEntry"); m_pServerPasswordEntry->SetText(""); m_pMaxPlayersLabel = new vgui::Label(this, "MaxPlayersLabel", "#asw_max_players"); m_pMaxPlayersCombo = new vgui::ComboBox(this, "MaxPlayersComboBox", 5, false); m_pMaxPlayersCombo->AddItem("2", NULL); m_pMaxPlayersCombo->AddItem("3", NULL); m_pMaxPlayersCombo->AddItem("4", NULL); m_pMaxPlayersCombo->AddItem("5", NULL); m_pMaxPlayersCombo->AddItem("6", NULL); char maxplayersbuffer[8]; int players = clamp<int>(asw_last_max_players.GetInt(), 2, 6); Q_snprintf(maxplayersbuffer, sizeof(maxplayersbuffer), "%d", players); m_pMaxPlayersCombo->SetText(maxplayersbuffer); m_pLANCheck = new vgui::CheckButton(this, "LanCheckButton", "#asw_lan_server"); m_pLANCheck->SetSelected(asw_last_sv_lan.GetBool()); m_pCancelButton = new vgui::Button(this, "CancelButton", "#asw_chooser_close", this, "Cancel"); }
void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const char *video, bool bLongLoading) #endif { if (g_forcedChange) { logger->LogMessage("[SM] Changed map to \"%s\"", map); RETURN_META(MRES_IGNORED); } const char *newmap = sm_nextmap.GetString(); if (newmap[0] == 0 || !g_HL2.IsMapValid(newmap)) { RETURN_META(MRES_IGNORED); } logger->LogMessage("[SM] Changed map to \"%s\"", newmap); ke::SafeSprintf(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), newmap); ke::SafeSprintf(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "Normal level change"); #if SOURCE_ENGINE != SE_DARKMESSIAH RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown)); #else RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown, video, bLongLoading)); #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_NPC_Puppet::AccumulateLayers( CStudioHdr *hdr, Vector pos[], Quaternion q[], float poseparam[], float currentTime, int boneMask ) { if ( m_hAnimationTarget == NULL ) return; C_BaseAnimatingOverlay *pTarget = dynamic_cast<C_BaseAnimatingOverlay *>( m_hAnimationTarget->GetBaseAnimating() ); if ( pTarget == NULL ) return; // resort the layers int layer[MAX_OVERLAYS]; int i; for (i = 0; i < MAX_OVERLAYS; i++) { layer[i] = MAX_OVERLAYS; } for (i = 0; i < pTarget->m_AnimOverlay.Count(); i++) { if (pTarget->m_AnimOverlay[i].m_nOrder < MAX_OVERLAYS) { layer[pTarget->m_AnimOverlay[i].m_nOrder] = i; } } int j; for (j = 0; j < MAX_OVERLAYS; j++) { i = layer[ j ]; if (i < pTarget->m_AnimOverlay.Count()) { float fWeight = pTarget->m_AnimOverlay[i].m_flWeight; if (fWeight > 0) { const char *pSequenceName = pTarget->GetSequenceName( pTarget->m_AnimOverlay[i].m_nSequence ); int nSequence = LookupSequence( pSequenceName ); if ( nSequence >= 0 ) { float fCycle = pTarget->m_AnimOverlay[ i ].m_flCycle; fCycle = ClampCycle( fCycle, IsSequenceLooping( nSequence ) ); if (fWeight > 1) fWeight = 1; AccumulatePose( hdr, NULL, pos, q, nSequence, fCycle, poseparam, boneMask, fWeight, currentTime ); #if _DEBUG if (Q_stristr( hdr->pszName(), r_sequence_debug.GetString()) != NULL) { DevMsgRT( "%6.2f : %30s : %5.3f : %4.2f : %1d\n", currentTime, hdr->pSeqdesc( nSequence ).pszLabel(), fCycle, fWeight, i ); } #endif } } } } }
void Bot::StartGame (void) { // this function handles the selection of teams & class // handle counter-strike stuff here... if (m_startAction == CMENU_TEAM) { m_startAction = CMENU_IDLE; // switch back to idle if (yb_forceteam.GetString ()[0] == 'C' || yb_forceteam.GetString ()[0] == 'c') m_wantedTeam = 2; else if (yb_forceteam.GetString ()[0] == 'T' || yb_forceteam.GetString ()[0] == 't') m_wantedTeam = 1; if (m_wantedTeam != 1 && m_wantedTeam != 2) m_wantedTeam = 5; // select the team the bot wishes to join... FakeClientCommand (GetEntity (), "menuselect %d", m_wantedTeam); } else if (m_startAction == CMENU_CLASS) { m_startAction = CMENU_IDLE; // switch back to idle if (g_gameVersion == CSVER_CZERO) // czero has spetsnaz and militia skins { if (m_wantedClass < 1 || m_wantedClass > 5) m_wantedClass = engine->RandomInt (1, 5); // use random if invalid } else { if (m_wantedClass < 1 || m_wantedClass > 4) m_wantedClass = engine->RandomInt (1, 4); // use random if invalid } // select the class the bot wishes to use... FakeClientCommand (GetEntity (), "menuselect %d", m_wantedClass); // bot has now joined the game (doesn't need to be started) m_notStarted = false; // check for greeting other players, since we connected if (engine->RandomInt (0, 100) < 20) ChatMessage (CHAT_HELLO); } }
void CMultiplayRules::ChangeLevel( void ) { char szNextMap[32]; if ( nextlevel.GetString() && *nextlevel.GetString() && engine->IsMapValid( nextlevel.GetString() ) ) { Q_strncpy( szNextMap, nextlevel.GetString(), sizeof( szNextMap ) ); } else { GetNextLevelName( szNextMap, sizeof(szNextMap) ); IncrementMapCycleIndex(); } g_fGameOver = true; Msg( "CHANGE LEVEL: %s\n", szNextMap ); engine->ChangeLevel( szNextMap, NULL ); }
void GESndMixer_Callback( IConVar *var, const char *pOldString, float flOldValue ) { ConVar *cVar = static_cast<ConVar*>(var); if ( !Q_stricmp( cVar->GetString(), "GE_NoMusic" ) ) GEMusicManager()->PauseMusic(); else if ( !Q_stricmp( pOldString, "GE_NoMusic" ) ) GEMusicManager()->ResumeMusic(); }
//============================================================================= void FoundPublicGames::Activate() { BaseClass::Activate(); if ( BaseModHybridButton *pWndCreateGame = dynamic_cast< BaseModHybridButton * >( FindChildByName( "DrpCreateGame" ) ) ) { pWndCreateGame->SetVisible( CanCreateGame() ); pWndCreateGame->SetText( CFmtStr( "#L4D360UI_FoudGames_CreateNew_%s", m_pDataSettings->GetString( "game/mode", "" ) ) ); } if ( Panel *pLabelX = FindChildByName( "LblPressX" ) ) pLabelX->SetVisible( CanCreateGame() ); if ( m_drpDifficulty ) { m_drpDifficulty->SetCurrentSelection( CFmtStr( "filter_difficulty_%s", ui_public_lobby_filter_difficulty2.GetString() ) ); } if ( m_drpOnslaught ) { m_drpOnslaught->SetCurrentSelection( CFmtStr( "filter_onslaught_%s", ui_public_lobby_filter_onslaught.GetString() ) ); } if ( m_drpGameStatus ) { m_drpGameStatus->SetCurrentSelection( CFmtStr( "filter_status_%s", ui_public_lobby_filter_status.GetString() ) ); } if ( m_drpCampaign ) { m_drpCampaign->SetCurrentSelection( CFmtStr( "filter_campaign_%s", ui_public_lobby_filter_campaign.GetString() ) ); } #if !defined( _X360 ) && !defined( NO_STEAM ) if ( steamapicontext ) { if ( ISteamUserStats *pSteamUserStats = steamapicontext->SteamUserStats() ) { SteamAPICall_t hSteamAPICall = pSteamUserStats->GetNumberOfCurrentPlayers(); m_callbackNumberOfCurrentPlayers.Set( hSteamAPICall, this, &FoundPublicGames::Steam_OnNumberOfCurrentPlayers ); } } #endif }
void Cache_Print_Sounds_And_Totals (void) { char buf[50]; cache_system_t *cd; cache_system_t *sortarray[MAX_SFX]; long i=0,j=0; long totalsndbytes=0; FileHandle_t file = g_pFileSystem->Open(mem_dbgfile.GetString(), "a"); int subtot=0; if (!file) return; memset(sortarray,sizeof(cache_system_t*)*MAX_SFX,0); //pack names into the array. for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next) { if (Q_stristr(cd->name,".wav")) { sortarray[i++]=cd; } } qsort(sortarray,i,sizeof(cache_system_t*),CacheSystemCompare); if (!file) return; g_pFileSystem->FPrintf(file,"\nCACHED SOUNDS:\n"); //now process the sorted list. (totals by directory) for (j=0;j<i;j++) { g_pFileSystem->FPrintf(file, "\t%16.16s : %s\n", Q_pretifymem(sortarray[j]->size,buf),sortarray[j]->name); totalsndbytes+=sortarray[j]->size; #ifdef _WIN32 if (j+1==i || ComparePath1(sortarray[j]->name,sortarray[j+1]->name)==0) { char pathbuf[512]; _splitpath(sortarray[j]->name,NULL,pathbuf,NULL,NULL); g_pFileSystem->FPrintf(file, "\tTotal Bytes used in \"%s\": %s\n",pathbuf,Q_pretifymem(totalsndbytes-subtot,buf)); subtot=totalsndbytes; } #endif } g_pFileSystem->FPrintf(file,"Total bytes in cache used by sound: %s\n",Q_pretifymem(totalsndbytes,buf)); g_pFileSystem->Close(file); }
void Cache_Print_Models_And_Totals (void) { char buf[50]; cache_system_t *cd; cache_system_t *sortarray[512]; long i=0,j=0; long totalbytes=0; FileHandle_t file = g_pFileSystem->Open(mem_dbgfile.GetString(), "a"); int subtot=0; if (!file) return; memset(sortarray,sizeof(cache_system_t*)*512,0); //pack names into the array. for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next) { if (strstr(cd->name,".mdl")) { sortarray[i++]=cd; } } qsort(sortarray,i,sizeof(cache_system_t*),CacheSystemCompare); g_pFileSystem->FPrintf(file,"\nCACHED MODELS:\n"); //now process the sorted list. for (j=0;j<i;j++) { int k; mstudiotexture_t *ptexture; studiohdr_t *phdr=(studiohdr_t*)sortarray[j]->user->data; ptexture = (mstudiotexture_t *)( ((char*)phdr) + phdr->textureindex); subtot=0; for (k = 0; k < phdr->numtextures; k++) subtot+=ptexture[k].width * ptexture[k].height+768; // (256*3 for the palette) g_pFileSystem->FPrintf(file, "\t%16.16s : %s\n", Q_pretifymem(sortarray[j]->size,buf),sortarray[j]->name); totalbytes+=sortarray[j]->size; } g_pFileSystem->FPrintf(file,"Total bytes in cache used by models: %s\n",Q_pretifymem(totalbytes,buf)); g_pFileSystem->Close(file); }
virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); TextEntry *pTextEntryUserName = dynamic_cast< TextEntry * >( FindChildByName( "UserNameTextEntry" ) ); if ( pTextEntryUserName ) { pTextEntryUserName->SetText( "" ); pTextEntryUserName->InsertString( youtube_username.GetString() ); } }
void CVersionWarnPanel::OnTick() { BaseClass::OnTick(); if (Q_strcmp(cl_showversionwarnpanel.GetString(), cl_showversionwarnpanel.GetDefault()) != 0) { SetVisible(true); HFont m_hfReleaseFont = m_pReleaseText->GetFont(); char m_cReleaseText[225]; m_pReleaseText->GetText(m_cReleaseText, sizeof(m_cReleaseText)); char m_cReleaseF[225]; Q_snprintf(m_cReleaseF, 225, m_cReleaseText, MOM_CURRENT_VERSION, cl_showversionwarnpanel.GetString()); cl_showversionwarnpanel.Revert(); m_pReleaseText->SetText(m_cReleaseF); m_pReleaseText->SetURL("https://github.com/momentum-mod/game/releases"); SetSize(UTIL_ComputeStringWidth(m_hfReleaseFont, m_cReleaseF) + m_pReleaseText->GetXPos() * 2, GetTall()); m_pReleaseText->SetPos(m_pReleaseText->GetXPos(), GetTall() / 2); } }
//--------------------------------------------------------------------------------- // Purpose: Setup the map list to choose from //--------------------------------------------------------------------------------- void ManiAutoMap::SetupMapList(void) { FreeList((void **) &automap_list, &automap_list_size); ignore_this_map = true; const char *map_string = mani_automap_map_list.GetString(); if (FStrEq(map_string,"")) return; ignore_this_map = false; int i = 0; int j = 0; char map_name[64] = ""; for (;;) { if (map_string[i] == ':' || map_string[i] == '\0') { map_name[j] = '\0'; if (i != 0) { if (engine->IsMapValid(map_name)) { AddToList((void **) &automap_list, sizeof(automap_id_t), &automap_list_size); Q_strcpy(automap_list[automap_list_size - 1].map_name, map_name); if (FStrEq(map_name, current_map)) { ignore_this_map = true; } } j = 0; if (map_string[i] == '\0') { break; } else { i++; j = 0; continue; } } else { break; } } map_name[j] = map_string[i]; j++; i++; } }
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 ); m_iHordeToSpawn -= iSpawned; if ( m_iHordeToSpawn <= 0 ) { ASWDirector()->OnHordeFinishedSpawning(); m_vecHordePosition = vec3_origin; } else if ( iSpawned == 0 ) // if we failed to spawn any aliens, then try to find a new horde location { if ( asw_director_debug.GetBool() ) { Msg( "Horde failed to spawn any aliens, trying new horde position.\n" ); } if ( !FindHordePosition() ) // if we failed to find a new location, just abort this horde { m_iHordeToSpawn = 0; ASWDirector()->OnHordeFinishedSpawning(); m_vecHordePosition = vec3_origin; } } m_batchInterval.Start( asw_batch_interval.GetFloat() ); } else if ( m_vecHordePosition == vec3_origin ) { Msg( "Warning: Had horde to spawn but no position, clearing.\n" ); m_iHordeToSpawn = 0; ASWDirector()->OnHordeFinishedSpawning(); } } if ( asw_director_debug.GetBool() ) { engine->Con_NPrintf( 14, "SM: Batch interval: %f pos = %f %f %f\n", m_batchInterval.HasStarted() ? m_batchInterval.GetRemainingTime() : -1, VectorExpand( m_vecHordePosition ) ); } if ( m_iAliensToSpawn > 0 ) { if (wandererSize() < WANDERER_QUEUE_SIZE-1) { queueWanderers(); m_iAliensToSpawn--; } } if (wandererQueueStart != wandererQueueEnd) { while ( wandererQueueStart != wandererQueueEnd && SpawnAlientAtRandomNode()); } }
//----------------------------------------------------------------------------- // Purpose: Saves the generated navigation meshes //----------------------------------------------------------------------------- void CRecastMgr::DebugRender() { int idx = m_Meshes.Find( recast_debug_mesh.GetString() ); if( idx == m_Meshes.InvalidIndex() ) { // Might be visualizing a server mesh that does not exist on the client // Insert dummy mesh on the fly. IRecastMgr *pRecastMgr = warsextension->GetRecastMgr(); if( pRecastMgr->GetNavMesh( recast_debug_mesh.GetString() ) ) { CRecastMesh *pMesh = new CRecastMesh(); pMesh->Init( recast_debug_mesh.GetString() ); idx = m_Meshes.Insert( pMesh->GetName(), pMesh ); } } if( m_Meshes.IsValidIndex( idx ) ) { m_Meshes[idx]->DebugRender(); } }
//----------------------------------------------------------------------------- // Purpose: Create a new Bot and put it in the game. // Output : Pointer to the new Bot, or NULL if there's no free clients. //----------------------------------------------------------------------------- CBasePlayer *BotPutInServer( bool bFrozen, int iTeam ) { g_iNextBotTeam = iTeam; char botname[ 64 ]; Q_snprintf( botname, sizeof( botname ), "Bot%02i", BotNumber ); // This is an evil hack, but we use it to prevent sv_autojointeam from kicking in. edict_t *pEdict = engine->CreateFakeClient( botname ); if (!pEdict) { Msg( "Failed to create Bot.\n"); return NULL; } // Allocate a CBasePlayer for the bot, and call spawn //ClientPutInServer( pEdict, botname ); CHL2MP_Player *pPlayer = ((CHL2MP_Player *)CBaseEntity::Instance( pEdict )); pPlayer->ClearFlags(); pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT ); if ( bFrozen ) pPlayer->AddEFlags( EFL_BOT_FROZEN ); BotNumber++; g_BotData[pPlayer->entindex()-1].m_WantedTeam = iTeam; g_BotData[pPlayer->entindex()-1].m_flJoinTeamTime = gpGlobals->curtime + 0.3; //DHL - Skillet - Spawn the bot pPlayer->ChangeTeam( TEAM_UNASSIGNED ); //This is required for PickDefaultSpawnTeam() to work pPlayer->Spawn(); //pPlayer->SetModelName( MAKE_STRING(bot_playermodel.GetString()) ); if ( Q_strlen( bot_playermodel.GetString() ) > 2 ) pPlayer->SetModel( bot_playermodel.GetString() ); return pPlayer; }