//-------------------------------------------------------------------------------------------------- // Name: CBreakableGlassSystem // Desc: Constructor //-------------------------------------------------------------------------------------------------- CBreakableGlassSystem::CBreakableGlassSystem() : m_enabled(false) { // Add physics callback if (IPhysicalWorld* pPhysWorld = gEnv->pPhysicalWorld) { const float listenerPriority = 2001.0f; pPhysWorld->AddEventClient(EventPhysCollision::id, &CBreakableGlassSystem::HandleImpact, 1, listenerPriority); } // Hook up debug cvars if (m_pGlassCVars = new SBreakableGlassCVars()) { #ifdef GLASS_DEBUG_MODE // Rendering REGISTER_CVAR2("g_glassSystem_draw", &m_pGlassCVars->m_draw, 1, VF_CHEAT, "Toggles drawing of glass nodes"); REGISTER_CVAR2("g_glassSystem_drawWireframe", &m_pGlassCVars->m_drawWireframe, 0, VF_CHEAT, "Toggles drawing of glass node wireframe"); REGISTER_CVAR2("g_glassSystem_drawDebugData", &m_pGlassCVars->m_drawDebugData, 0, VF_CHEAT, "Toggles drawing of glass node break/impact data"); REGISTER_CVAR2("g_glassSystem_drawFragData", &m_pGlassCVars->m_drawFragData, 0, VF_CHEAT, "Toggles drawing of glass physicalized fragment data"); // Impact decals REGISTER_CVAR2("g_glassSystem_decalAlwaysRebuild", &m_pGlassCVars->m_decalAlwaysRebuild, 0, VF_CHEAT, "Forces decals to rebuild every frame, allowing real-time tweaking."); REGISTER_CVAR2("g_glassSystem_decalScale", &m_pGlassCVars->m_decalScale, 2.5f, VF_CHEAT, "Scale of procedural impact decals on glass"); REGISTER_CVAR2("g_glassSystem_decalMinRadius", &m_pGlassCVars->m_decalMinRadius, 0.25f, VF_CHEAT, "Minimum size of decal around impact"); REGISTER_CVAR2("g_glassSystem_decalMaxRadius", &m_pGlassCVars->m_decalMaxRadius, 1.25f, VF_CHEAT, "Maximum size of decal around impact"); REGISTER_CVAR2("g_glassSystem_decalRandChance", &m_pGlassCVars->m_decalRandChance, 0.67f, VF_CHEAT, "Chance for a decal to randomly be scaled up"); REGISTER_CVAR2("g_glassSystem_decalRandScale", &m_pGlassCVars->m_decalRandScale, 1.6f, VF_CHEAT, "Scale of decal if selected randomly"); REGISTER_CVAR2("g_glassSystem_decalMinImpactSpeed", &m_pGlassCVars->m_minImpactSpeed, 400.0f, VF_CHEAT, "Minimum speed for an impact to use the bullet decal"); // Physicalized fragments REGISTER_CVAR2("g_glassSystem_fragImpulseScale", &m_pGlassCVars->m_fragImpulseScale, 5.0f, VF_CHEAT, "Scales impulse applied to fragments when physicalized"); REGISTER_CVAR2("g_glassSystem_fragAngImpulseScale", &m_pGlassCVars->m_fragAngImpulseScale, 0.1f, VF_CHEAT, "Scales *angular* impulse applied to fragments when physicalized"); REGISTER_CVAR2("g_glassSystem_fragImpulseDampen", &m_pGlassCVars->m_fragImpulseDampen, 0.3f, VF_CHEAT, "Dampens impulse applied to non-directly impacted fragments"); REGISTER_CVAR2("g_glassSystem_fragAngImpulseDampen", &m_pGlassCVars->m_fragAngImpulseDampen, 0.4f, VF_CHEAT, "Dampens *angular* impulse applied to non-directly impacted fragments"); REGISTER_CVAR2("g_glassSystem_fragSpread", &m_pGlassCVars->m_fragSpread, 1.5f, VF_CHEAT, "Spread velocity to apply to impacted fragments"); REGISTER_CVAR2("g_glassSystem_fragMaxSpeed", &m_pGlassCVars->m_fragMaxSpeed, 4.0f, VF_CHEAT, "Maximum speed to apply to physicalized fragments"); // Impact breaks REGISTER_CVAR2("g_glassSystem_impactSplitMinRadius", &m_pGlassCVars->m_impactSplitMinRadius, 0.05f, VF_CHEAT, "Minimum radius for split around impact"); REGISTER_CVAR2("g_glassSystem_impactSplitRandMin", &m_pGlassCVars->m_impactSplitRandMin, 0.5f, VF_CHEAT, "Minimum radius variation for split around impact"); REGISTER_CVAR2("g_glassSystem_impactSplitRandMax", &m_pGlassCVars->m_impactSplitRandMax, 1.5f, VF_CHEAT, "Maximum radius variation for split around impact"); REGISTER_CVAR2("g_glassSystem_impactEdgeFadeScale", &m_pGlassCVars->m_impactEdgeFadeScale, 2.0f, VF_CHEAT, "Scales radial crack fade distance"); // Particle effects REGISTER_CVAR2("g_glassSystem_particleFXEnable", &m_pGlassCVars->m_particleFXEnable, 1, VF_CHEAT, "Toggles particle effects being played when fragments are broken"); REGISTER_CVAR2("g_glassSystem_particleFXUseColours", &m_pGlassCVars->m_particleFXUseColours, 0, VF_CHEAT, "Toggles particle effects being coloured to match the glass"); REGISTER_CVAR2("g_glassSystem_particleFXScale", &m_pGlassCVars->m_particleFXScale, 0.25f, VF_CHEAT, "Scales the glass particle effects spawned"); #endif // GLASS_DEBUG_MODE } // Add callback for system enabled cvar IConsole* pConsole = gEnv->pConsole; ICVar* pSysEnabledCvar = pConsole ? pConsole->GetCVar("g_glassSystemEnable") : NULL; if (pSysEnabledCvar) { m_enabled = (pSysEnabledCvar->GetIVal() != 0); pSysEnabledCvar->SetOnChangeCallback(OnEnabledCVarChange); } }//-------------------------------------------------------------------------------------------------
void CRevertibleConfigLoader::RevertCVarChanges() { if (!m_savedCVars.empty()) { CryLog ("Need to undo %" PRISIZE_T " %s...", m_savedCVars.size(), (m_savedCVars.size() == 1) ? "variable" : "variables"); IConsole * pConsole = gEnv->pConsole; CryFixedStringT<128> cmd; //Revert the saved cvars in reverse order to handle duplicate settings of the same cvar (which shouldn't be done but people ignore warnings) for (int n = m_savedCVars.size()-1; n >= 0; --n) { ICVar * var = gEnv->pConsole->GetCVar(m_savedCVars[n].m_name); if (var && var->GetType() == CVAR_STRING && strlen(m_savedCVars[n].m_value) == 0) { var->Set(m_savedCVars[n].m_value); } else { cmd.Format("%s %s", m_savedCVars[n].m_name, m_savedCVars[n].m_value); } pConsole->ExecuteString(cmd.c_str(), true); } m_cvarsTextBlock.EmptyWithoutFreeing(); m_savedCVars.clear(); } }
CLaptopUtil::CLaptopUtil() { IConsole * pConsole = gEnv->pConsole; pConsole->Register( "g_show_laptop_status", &CLaptopUtil::g_show_laptop_status, 0, 0, "Show laptop status"); pConsole->Register( "g_show_laptop_status_test", &CLaptopUtil::g_show_laptop_status_test, 0, 0, "Show fake laptop status for testing"); m_isLaptop = false; m_percentBatLife = 0; m_secBatLife = 0; m_isWLan = false; m_isBattery = false; m_signalStrength = false; Init(); if(m_isLaptop) { Update(); //gEnv->pGame->GetIGameFramework()->RegisterListener(this, "laptoputil", FRAMEWORKLISTENERPRIORITY_MENU); } }
void VMSaveState() { HRESULT rc; IProgress *progress; ISession *session; IConsole *console; rc = CoCreateInstance(CLSID_Session, NULL, CLSCTX_INPROC_SERVER, IID_ISession, (void**)&session); if (!SUCCEEDED(rc)) { ShowError(L"Failed to create session instance for '%s'. rc = 0x%x", name, rc); return; } rc = machine->LockMachine(session, LockType_Shared); if (!SUCCEEDED(rc)) { ShowError(L"Failed to lock '%s'. rc = 0x%x", name, rc); return; } session->get_Console(&console); rc = console->SaveState(&progress); if (FAILED(rc)) { ShowError(L"Failed to save '%s' state. rc = 0x%x", name, rc); return; } progress->WaitForCompletion(-1); session->UnlockMachine(); SAFE_RELEASE(progress); SAFE_RELEASE(console); SAFE_RELEASE(session); }
void VMAcpiShutdown() { HRESULT rc; ISession *session; IConsole *console; rc = CoCreateInstance(CLSID_Session, NULL, CLSCTX_INPROC_SERVER, IID_ISession, (void**)&session); if (!SUCCEEDED(rc)) { ShowError(L"Failed to create session instance for '%s'. rc = 0x%x", name, rc); return; } rc = machine->LockMachine(session, LockType_Shared); if (!SUCCEEDED(rc)) { ShowError(L"Failed to lock '%s'. rc = 0x%x", name, rc); return; } session->get_Console(&console); rc = console->PowerButton(); if (FAILED(rc)) ShowError(L"Failed to press '%s' power button. rc = 0x%x", name, rc); session->UnlockMachine(); SAFE_RELEASE(console); SAFE_RELEASE(session); }
//------------------------------------------------------------------------ void SCVars::ReleaseCVars() { IConsole *pConsole = gEnv->pConsole; pConsole->UnregisterVariable("mono_exceptionsTriggerMessageBoxes", true); pConsole->UnregisterVariable("mono_exceptionsTriggerFatalErrors", true); }
CFeatureTestMgr::~CFeatureTestMgr() { IConsole* pConsole = GetISystem()->GetIConsole(); if (pConsole) { pConsole->RemoveCommand("ft_map_runAll"); pConsole->RemoveCommand("ft_map_forceRun"); } }
void CLua::Init() { IConfig *pConfig = Kernel()->RequestInterface<IConfig>(); if(pConfig) pConfig->RegisterCallback(ConfigSaveCallback, this); IConsole *pConsole = Kernel()->RequestInterface<IConsole>(); if(pConsole) { pConsole->Register("add_lua_file", "s", CFGFLAG_CLIENT, ConAddLuaFile, this, "Add a Lua file"); } }
void Init() { m_pConsole = Kernel()->RequestInterface<IConsole>(); m_pStorage = Kernel()->RequestInterface<IStorage>(); if(!m_pConsole || !m_pStorage) return; m_pConsole->Register("dbg_dumpmem", "", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_DbgDumpmem, this, "Dump the memory", IConsole::CONSOLELEVEL_ADMIN); m_pConsole->Register("dbg_lognetwork", "", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_DbgLognetwork, this, "Log the network", IConsole::CONSOLELEVEL_ADMIN); }
CGameTokenSystem::~CGameTokenSystem() { if (m_pScriptBind) delete m_pScriptBind; IConsole *pConsole = gEnv->pConsole; pConsole->UnregisterVariable("gt_show", true); pConsole->UnregisterVariable("gt_showPosX", true); pConsole->UnregisterVariable("gt_showPosY", true); pConsole->UnregisterVariable("gt_showLines", true); pConsole->UnregisterVariable("gt_showFilter", true); }
//-------------------------------------------------------------------------------------------------- // Name: ~CBreakableGlassSystem // Desc: Destructor //-------------------------------------------------------------------------------------------------- CBreakableGlassSystem::~CBreakableGlassSystem() { // Release all nodes and data ResetAll(); #ifdef GLASS_DEBUG_MODE // Remove debug cvars after all nodes that could be using them if (IConsole* pConsole = gEnv->pConsole) { pConsole->UnregisterVariable("g_glassSystem_draw"); pConsole->UnregisterVariable("g_glassSystem_drawWireframe"); pConsole->UnregisterVariable("g_glassSystem_drawDebugData"); pConsole->UnregisterVariable("g_glassSystem_drawFragData"); pConsole->UnregisterVariable("g_glassSystem_decalAlwaysRebuild"); pConsole->UnregisterVariable("g_glassSystem_decalScale"); pConsole->UnregisterVariable("g_glassSystem_decalMinRadius"); pConsole->UnregisterVariable("g_glassSystem_decalMaxRadius"); pConsole->UnregisterVariable("g_glassSystem_decalRandChance"); pConsole->UnregisterVariable("g_glassSystem_decalRandScale"); pConsole->UnregisterVariable("g_glassSystem_decalMinImpactSpeed"); pConsole->UnregisterVariable("g_glassSystem_fragImpulseScale"); pConsole->UnregisterVariable("g_glassSystem_fragAngImpulseScale"); pConsole->UnregisterVariable("g_glassSystem_fragImpulseDampen"); pConsole->UnregisterVariable("g_glassSystem_fragAngImpulseDampen"); pConsole->UnregisterVariable("g_glassSystem_fragSpread"); pConsole->UnregisterVariable("g_glassSystem_fragMaxSpeed"); pConsole->UnregisterVariable("g_glassSystem_particleFXEnable"); pConsole->UnregisterVariable("g_glassSystem_particleFXUseColours"); pConsole->UnregisterVariable("g_glassSystem_particleFXScale"); } #endif // GLASS_DEBUG_MODE SAFE_DELETE(m_pGlassCVars); // Remove system enabled cvar callback IConsole* pConsole = gEnv->pConsole; ICVar* pSysEnabledCVar = pConsole ? pConsole->GetCVar("g_glassSystemEnable") : NULL; if (pSysEnabledCVar) { pSysEnabledCVar->SetOnChangeCallback(NULL); } // Remove physics callback if (IPhysicalWorld* pPhysWorld = gEnv->pPhysicalWorld) { pPhysWorld->RemoveEventClient(EventPhysCollision::id, &CBreakableGlassSystem::HandleImpact, 1); } }//-------------------------------------------------------------------------------------------------
SForceFeedbackSystemCVars::~SForceFeedbackSystemCVars() { IConsole *pConsole = gEnv->pConsole; if (pConsole) { pConsole->UnregisterVariable("ffs_debug", true); pConsole->RemoveCommand("ffs_PlayEffect"); pConsole->RemoveCommand("ffs_StopAllEffects"); pConsole->RemoveCommand("ffs_Reload"); } }
void CGameStateRecorder::Release() { // if(m_pRecordGameEventFtor) //delete m_pRecordGameEventFtor; IConsole* pConsole = gEnv->pConsole; if(pConsole) { pConsole->UnregisterVariable( "demo_force_game_state", true ); pConsole->UnregisterVariable( "demo_actor_info", true ); pConsole->UnregisterVariable( "demo_actor_filter", true ); } delete this; }
void CFriends::Init() { IConfig *pConfig = Kernel()->RequestInterface<IConfig>(); if(pConfig) pConfig->RegisterCallback(ConfigSaveCallback, this); IConsole *pConsole = Kernel()->RequestInterface<IConsole>(); if(pConsole) { pConsole->Register("add_friend", "ss", CFGFLAG_CLIENT, ConAddFriend, this, "Add a friend"); pConsole->Register("remove_Friend", "ss", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a friend"); } }
CTargetTrackThreatModifier::CTargetTrackThreatModifier() { ITargetTrackManager *pTargetTrackManager = gEnv->pAISystem->GetTargetTrackManager(); if (pTargetTrackManager) pTargetTrackManager->SetTargetTrackThreatModifier(this); IConsole *pConsole = gEnv->pConsole; assert(pConsole); m_pCVar_CloakMinDist = pConsole->GetCVar("ai_CloakMinDist"); m_pCVar_CloakMaxDist = pConsole->GetCVar("ai_CloakMaxDist"); m_pCVar_SOMSpeedRelaxed = pConsole->GetCVar("ai_SOMSpeedRelaxed"); m_pCVar_SOMSpeedCombat = pConsole->GetCVar("ai_SOMSpeedCombat"); }
void CGameQueryListener::ConnectToServer(const char* server) { //first check the version of the server ... char myVersion[32]; GetISystem()->GetProductVersion().ToShortString(myVersion); string version(myVersion); SGameServer* targetServer = FindServer(server); if(!targetServer) { CryWarning(VALIDATOR_MODULE_NETWORK, VALIDATOR_WARNING, "Selected server not found in list!"); return; } if(version.compare(targetServer->GetServerGameVersion()) != 0) { CryWarning(VALIDATOR_MODULE_NETWORK, VALIDATOR_WARNING, "Game versions differ - not connecting!"); return; } string addr(server); string port; int pos = addr.find(":"); if(pos != string::npos) //space for port { port = addr.substr(pos+1, addr.size()-pos); addr.erase(pos, addr.size()-pos); } IConsole* pConsole = gEnv->pConsole; pConsole->GetCVar("cl_serveraddr")->Set(addr.c_str()); if(port.size() > 0) pConsole->GetCVar("cl_serverport")->Set(port.c_str()); string tempHost = pConsole->GetCVar("cl_serveraddr")->GetString(); SGameStartParams params; //this would connect to a server params.flags = eGSF_Client; params.hostname = tempHost.c_str(); params.pContextParams = NULL; params.port = pConsole->GetCVar("cl_serverport")->GetIVal(); CCryAction *action = (CCryAction*) (gEnv->pGame->GetIGameFramework()); if(action) { gEnv->pConsole->ExecuteString("net_lanbrowser 0"); action->StartGameContext(¶ms); } }
//------------------------------------------------------------------------ CViewSystem::~CViewSystem() { ClearAllViews(); IConsole* pConsole = gEnv->pConsole; CRY_ASSERT(pConsole); pConsole->UnregisterVariable("cl_camera_noise", true); pConsole->UnregisterVariable("cl_camera_noise_freq", true); pConsole->UnregisterVariable("cl_ViewSystemDebug", true); pConsole->UnregisterVariable("cl_DefaultNearPlane", true); //Remove as level system listener if (CCryAction::GetCryAction()->GetILevelSystem()) CCryAction::GetCryAction()->GetILevelSystem()->RemoveListener(this); }
void CFriends::Friends() { CALLSTACK_ADD(); char aBuf[128]; IConsole *pConsole = Kernel()->RequestInterface<IConsole>(); if(pConsole) { for(int i = 0; i < m_NumFriends; ++i) { str_format(aBuf, sizeof(aBuf), "Name: %s, Clan: %s", m_aFriends[i].m_aName, m_aFriends[i].m_aClan); pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, m_Foes?"foes":"friends", aBuf, true); } } }
virtual void Save(const char *pFilename) { if(!m_pStorage) return; if(!pFilename) pFilename = "settings.cfg"; m_ConfigFile = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE); if(!m_ConfigFile) return; char aLineBuf[1024*2]; char aEscapeBuf[1024*2]; #define MACRO_CONFIG_INT(Name,ScriptName,def,min,max,flags,desc) if(((flags)&(CFGFLAG_SAVE))&&((flags)&(m_FlagMask))){ str_format(aLineBuf, sizeof(aLineBuf), "%s %i", #ScriptName, g_Config.m_##Name); WriteLine(aLineBuf); } #define MACRO_CONFIG_STR(Name,ScriptName,len,def,flags,desc) if(((flags)&(CFGFLAG_SAVE))&&((flags)&(m_FlagMask))){ EscapeParam(aEscapeBuf, g_Config.m_##Name, sizeof(aEscapeBuf)); str_format(aLineBuf, sizeof(aLineBuf), "%s \"%s\"", #ScriptName, aEscapeBuf); WriteLine(aLineBuf); } #include "config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR for(int i = 0; i < m_NumCallbacks; i++) m_aCallbacks[i].m_pfnFunc(this, m_aCallbacks[i].m_pUserData); io_close(m_ConfigFile); if(m_pConsole) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "saved config to '%s'", pFilename); m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "config", aBuf); } }
void CFriends::Init(bool Foes) { CALLSTACK_ADD(); m_Foes = Foes; IConfig *pConfig = Kernel()->RequestInterface<IConfig>(); if(pConfig) pConfig->RegisterCallback(ConfigSaveCallback, this); IConsole *pConsole = Kernel()->RequestInterface<IConsole>(); if(pConsole) { if(Foes) { pConsole->Register("add_foe", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConAddFriend, this, "Add a foe"); pConsole->Register("remove_foe", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a foe"); pConsole->Register("foes", "", CFGFLAG_CLIENT, ConFriends, this, "List foes"); } else { pConsole->Register("add_friend", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConAddFriend, this, "Add a friend"); pConsole->Register("remove_friend", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a friend"); pConsole->Register("friends", "", CFGFLAG_CLIENT, ConFriends, this, "List friends"); } } }
virtual void Init(int FlagMask) { m_pStorage = Kernel()->RequestInterface<IStorage>(); m_pConsole = Kernel()->RequestInterface<IConsole>(); m_FlagMask = FlagMask; Reset(); if(m_pConsole) m_pConsole->Register("save_config", "?s", CFGFLAG_SERVER|CFGFLAG_CLIENT|CFGFLAG_STORE, Con_SaveConfig, this, "Save config to file"); }
void CBitmapUi::SetScreenState( const EScreenState state ) { if ( gEnv->IsEditor() ) { return; } m_currentScreenState = state; // TODO: Fix console drawing during CSystem::UpdateLoadingScreen to properly remove one of // the issues that can cause flickering during level load and when the console is visible. if ( state == eSS_LoadingScreen ) { IConsole* pConsole = gEnv->pConsole; if ( pConsole != NULL ) { pConsole->ShowConsole( false ); } } }
void CEditorGame::SetGameRules() { IGameFramework *pGameFramework = g_pGame->GetIGameFramework(); IConsole *pConsole = gEnv->pConsole; const char *szGameRules = NULL; const char *szLevelName = pConsole->GetCVar("sv_map")->GetString(); ILevelInfo *pLevelInfo = pGameFramework->GetILevelSystem()->GetLevelInfo(szLevelName); if (pLevelInfo) { szGameRules = pLevelInfo->GetDefaultGameRules(); } if (!szGameRules) { szGameRules = s_pEditorGame->m_bUsingMultiplayerGameRules ? "DeathMatch" : "SinglePlayer"; } pGameFramework->GetIGameRulesSystem()->CreateGameRules(szGameRules); pConsole->GetCVar("sv_gamerules")->Set(szGameRules); }
CFeatureTestMgr::CFeatureTestMgr() : m_runningTestIndex(), m_pRunningTest(), m_pAutoTester(), m_running(), m_pendingRunAll(), m_pendingQuickload(), m_pendingLevelReload(), m_hasQuickloaded(), m_timeWaitedForScheduled(0.0f), m_waiting(false), m_timeoutScheduled(0.0f) { IConsole* pConsole = GetISystem()->GetIConsole(); if (pConsole) { pConsole->AddCommand("ft_map_runAll", CmdMapRunAll, VF_CHEAT, "FEATURE TESTER: Run all enabled map feature tests"); pConsole->AddCommand("ft_map_forceRun", CmdMapForceRun, VF_CHEAT, "FEATURE TESTER: Force run of the provided test (even if it's not ready)"); pConsole->RegisterAutoComplete("ft_map_forceRun", &s_featureTestMgrArgumentAutoComplete); } }
//------------------------------------------------------------------------ void SCVars::ReleaseCVars() { IConsole *pConsole = gEnv->pConsole; pConsole->UnregisterVariable("mono_exceptionsTriggerMessageBoxes", true); pConsole->UnregisterVariable("mono_exceptionsTriggerFatalErrors", true); pConsole->UnregisterVariable("mono_realtimeScripting", true); #ifndef RELEASE pConsole->UnregisterVariable("mono_realtimeScriptingDebug", true); #endif pConsole->UnregisterVariable("mono_realtimeScriptingDetectChanges", true); pConsole->RemoveCommand("mono_reload"); pConsole->UnregisterVariable("mono_softBreakpoints", true); pConsole->UnregisterVariable("mono_scriptDirectory", true); }
//------------------------------------------------------------------------ CVehicleCVars::~CVehicleCVars() { assert (s_pThis != 0); s_pThis = 0; IConsole *pConsole = gEnv->pConsole; pConsole->RemoveCommand("v_tpvDist"); pConsole->RemoveCommand("v_tpvHeight"); pConsole->RemoveCommand("v_reload_system"); pConsole->RemoveCommand("v_exit_player"); #if ENABLE_VEHICLE_DEBUG pConsole->UnregisterVariable("v_debugVehicle", true); pConsole->UnregisterVariable("v_draw_components", true); pConsole->UnregisterVariable("v_draw_helpers", true); pConsole->UnregisterVariable("v_draw_seats", true); pConsole->UnregisterVariable("v_draw_tm", true); pConsole->UnregisterVariable("v_draw_passengers", true); pConsole->UnregisterVariable("v_debugdraw", true); pConsole->UnregisterVariable("v_debug_mem", true); pConsole->UnregisterVariable("v_debugView", true); #endif pConsole->UnregisterVariable("v_lights", true); pConsole->UnregisterVariable("v_lights_enable_always", true); pConsole->UnregisterVariable("v_autoDisable", true); pConsole->UnregisterVariable("v_set_passenger_tm", true); pConsole->UnregisterVariable("v_disable_hull", true); pConsole->UnregisterVariable("v_treadUpdateTime", true); pConsole->UnregisterVariable("v_transitionAnimations", true); pConsole->UnregisterVariable("v_ragdollPassengers", true); pConsole->UnregisterVariable("v_goliathMode", true); pConsole->UnregisterVariable("v_slipSlopeFront", true); pConsole->UnregisterVariable("v_slipSlopeRear", true); pConsole->UnregisterVariable("v_slipFrictionModFront", true); pConsole->UnregisterVariable("v_slipFrictionModRear", true); pConsole->UnregisterVariable("v_vehicle_quality", true); pConsole->UnregisterVariable("v_driverControlledMountedGuns", true); pConsole->UnregisterVariable("v_debugSuspensionIK", true); }
//------------------------------------------------------------------------- CGameRulesStandardState::~CGameRulesStandardState() { IConsole *pConsole = gEnv->pConsole; pConsole->RemoveCommand("g_setgamestate"); CMenuRender3DModelMgr::Release(true); }
CMaterialEffectsCVars::~CMaterialEffectsCVars() { assert (s_pThis != 0); s_pThis = 0; IConsole *pConsole = gEnv->pConsole; pConsole->RemoveCommand("mfx_Reload"); pConsole->RemoveCommand("mfx_ReloadHUDEffects"); pConsole->UnregisterVariable("mfx_ParticleImpactThresh", true); pConsole->UnregisterVariable("mfx_SoundImpactThresh", true); pConsole->UnregisterVariable("mfx_RaisedSoundImpactThresh", true); pConsole->UnregisterVariable("mfx_Debug", true); pConsole->UnregisterVariable("mfx_DebugVisual", true); pConsole->UnregisterVariable("mfx_DebugVisualFilter", true); pConsole->UnregisterVariable("mfx_Enable", true); pConsole->UnregisterVariable("mfx_pfx_minScale", true); pConsole->UnregisterVariable("mfx_pfx_maxScale", true); pConsole->UnregisterVariable("mfx_pfx_maxDist", true); pConsole->UnregisterVariable("mfx_Timeout", true); pConsole->UnregisterVariable("mfx_EnableFGEffects", true); pConsole->UnregisterVariable("mfx_EnableAttachedEffects", true); pConsole->UnregisterVariable("mfx_SerializeFGEffects", true); }
CAnimationGraphCVars::~CAnimationGraphCVars() { assert (s_pThis != 0); s_pThis = 0; IConsole *pConsole = gEnv->pConsole; pConsole->UnregisterVariable("ag_debugExactPos", true); pConsole->UnregisterVariable("ac_predictionSmoothingPos", true); pConsole->UnregisterVariable("ac_predictionSmoothingOri", true); pConsole->UnregisterVariable("ac_predictionProbabilityPos", true); pConsole->UnregisterVariable("ac_predictionProbabilityOri", true); pConsole->UnregisterVariable("ac_triggercorrectiontimescale", true); pConsole->UnregisterVariable("ac_targetcorrectiontimescale", true); pConsole->UnregisterVariable("ac_new", true); pConsole->UnregisterVariable("ac_movementControlMethodHor", true); pConsole->UnregisterVariable("ac_movementControlMethodVer", true); pConsole->UnregisterVariable("ac_movementControlMethodFilter", true); pConsole->UnregisterVariable("ac_templateMCMs", true); pConsole->UnregisterVariable("ac_entityAnimClamp", true); pConsole->UnregisterVariable("ac_animErrorClamp", true); pConsole->UnregisterVariable("ac_animErrorMaxDistance", true); pConsole->UnregisterVariable("ac_animErrorMaxAngle", true); pConsole->UnregisterVariable("ac_debugAnimError", true); pConsole->UnregisterVariable("ac_debugLocations", true); pConsole->UnregisterVariable("ac_debugMotionParams", true); pConsole->UnregisterVariable("ac_frametime", true); pConsole->UnregisterVariable("ac_debugText", true); pConsole->UnregisterVariable("ac_debugXXXValues", true); pConsole->UnregisterVariable("ac_debugEntityParams", true); pConsole->UnregisterVariable("ac_DebugFilter", true); pConsole->UnregisterVariable("ac_debugColliderMode", true); pConsole->UnregisterVariable("ac_debugMovementControlMethods", true); pConsole->UnregisterVariable("ac_disableSlidingContactEvents", true); pConsole->UnregisterVariable("ac_useMovementPrediction", true); pConsole->UnregisterVariable("ac_useQueuedRotation", true); pConsole->UnregisterVariable("ac_debugCarryCorrection", true); pConsole->UnregisterVariable("g_distanceForceNoIk", true); pConsole->UnregisterVariable("g_spectatorCollisions", true); pConsole->UnregisterVariable("ag_turnSpeedParamScale", true); }
IGameRef CGameStartup::Init(SSystemInitParams &startupParams) { MEMSTAT_CONTEXT(EMemStatContextTypes::MSC_Other, 0, "Game startup initialisation"); #if defined(CVARS_WHITELIST) startupParams.pCVarsWhitelist = &g_CVarsWhiteList; #endif // defined(CVARS_WHITELIST) startupParams.pGameStartup = this; if (!InitFramework(startupParams)) { return 0; } InlineInitializationProcessing("CGameStartup::Init"); LOADING_TIME_PROFILE_SECTION(m_pFramework->GetISystem()); ISystem* pSystem = m_pFramework->GetISystem(); startupParams.pSystem = pSystem; const ICmdLineArg* pSvBind = gEnv->pSystem->GetICmdLine()->FindArg(eCLAT_Pre, "sv_bind"); IConsole* pConsole = pSystem->GetIConsole(); if ((pSvBind != NULL) && (pConsole != NULL)) { string command = pSvBind->GetName() + string(" ") + pSvBind->GetValue(); pConsole->ExecuteString(command.c_str(), true, false); } #if defined(ENABLE_STATS_AGENT) const ICmdLineArg *pPipeArg = pSystem->GetICmdLine()->FindArg(eCLAT_Pre,"lt_pipename"); CStatsAgent::CreatePipe( pPipeArg ); #endif REGISTER_COMMAND("g_loadMod", CGameStartupStatic::RequestLoadMod,VF_NULL,""); REGISTER_COMMAND("g_unloadMod", CGameStartupStatic::RequestUnloadMod, VF_NULL, ""); // load the appropriate game/mod #if !defined(_RELEASE) const ICmdLineArg *pModArg = pSystem->GetICmdLine()->FindArg(eCLAT_Pre,"MOD"); #else const ICmdLineArg *pModArg = NULL; #endif // !defined(_RELEASE) InlineInitializationProcessing("CGameStartup::Init LoadLocalizationData"); IGameRef pOut; if (pModArg && (*pModArg->GetValue() != 0) && (pSystem->IsMODValid(pModArg->GetValue()))) { const char* pModName = pModArg->GetValue(); assert(pModName); pOut = Reset(pModName); } else { pOut = Reset(GAME_NAME); } if (!m_pFramework->CompleteInit()) { pOut->Shutdown(); return 0; } InlineInitializationProcessing("CGameStartup::Init FrameworkCompleteInit"); // should be after init game (should be executed even if there is no game) if(startupParams.bExecuteCommandLine) pSystem->ExecuteCommandLine(); pSystem->GetISystemEventDispatcher()->RegisterListener(this); // Creates and starts the realtime update system listener. if (pSystem->IsDevMode()) { CGameRealtimeRemoteUpdateListener::GetGameRealtimeRemoteUpdateListener().Enable(true); } GCOV_FLUSH; if (ISystem *pSystem = gEnv ? GetISystem() : NULL) { pSystem->RegisterErrorObserver(&m_errorObsever); pSystem->RegisterWindowMessageHandler(this); } else { CryLogAlways("failed to find ISystem to register error observer"); assert(0); } InlineInitializationProcessing("CGameStartup::Init End"); #if defined(CRY_UNIT_TESTING) // Register All unit tests of this module. #if defined(_LIB) if(gEnv->pSystem) { CryUnitTest::Test *pTest = CryUnitTest::Test::m_pFirst; for (; pTest != 0; pTest = pTest->m_pNext) { CryUnitTest::IUnitTestManager *pTestManager = gEnv->pSystem->GetITestSystem()->GetIUnitTestManager(); if (pTestManager) { pTest->m_unitTestInfo.module = "StaticBinary"; pTestManager->CreateTest( pTest->m_unitTestInfo ); } } } #endif // run unit tests CryUnitTest::IUnitTestManager *pTestManager = (gEnv && gEnv->pSystem) ? gEnv->pSystem->GetITestSystem()->GetIUnitTestManager() : NULL; if (pTestManager) { const ICmdLineArg* pSkipUnitTest = gEnv->pSystem->GetICmdLine()->FindArg(eCLAT_Pre, "skip_unit_tests"); if(pSkipUnitTest == NULL) { const ICmdLineArg* pUseUnitTestExcelReporter = gEnv->pSystem->GetICmdLine()->FindArg(eCLAT_Pre, "use_unit_test_excel_reporter"); if(pUseUnitTestExcelReporter) { gEnv->pSystem->GetITestSystem()->GetIUnitTestManager()->RunAllTests(CryUnitTest::ExcelReporter); } else // default is the minimal reporter { gEnv->pSystem->GetITestSystem()->GetIUnitTestManager()->RunAllTests(CryUnitTest::MinimalReporter); } } } #endif // CRY_UNIT_TESTING assert(gEnv); PREFAST_ASSUME(gEnv); GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RANDOM_SEED, (UINT_PTR)gEnv->pTimer->GetAsyncTime().GetMicroSecondsAsInt64(), 0); return pOut; }