void TEST_Init (void) { try { com_aliasSysPool = Mem_CreatePool("Common: Alias system"); com_cmdSysPool = Mem_CreatePool("Common: Command system"); com_cmodelSysPool = Mem_CreatePool("Common: Collision model"); com_cvarSysPool = Mem_CreatePool("Common: Cvar system"); com_fileSysPool = Mem_CreatePool("Common: File system"); com_genericPool = Mem_CreatePool("Generic"); Mem_Init(); Cbuf_Init(); Cmd_Init(); Cvar_Init(); FS_InitFilesystem(true); FS_AddGameDirectory("./unittest", false); FS_AddHomeAsGameDirectory("unittest", true); Swap_Init(); SV_Init(); NET_Init(); FS_ExecAutoexec(); OBJZERO(csi); } catch (comDrop_t const&) { Sys_Error("Error during initialization"); } http_timeout = Cvar_Get("noname"); http_proxy = Cvar_Get("noname"); hwclass = Cvar_Get("hwclass", "5"); }
int main (int argc, char **argv) { char bspFilename[MAX_OSPATH]; if (argc < 2) { Usage(); } com_genericPool = Mem_CreatePool("slicer"); com_fileSysPool = Mem_CreatePool("slicer filesys"); Swap_Init(); Mem_Init(); SL_Parameter(argc, argv); Com_StripExtension(config.filename, bspFilename, sizeof(bspFilename)); Com_DefaultExtension(bspFilename, sizeof(bspFilename), ".bsp"); FS_InitFilesystem(false); SL_BSPSlice(LoadBSPFile(bspFilename), config.thickness, config.scale, config.singleContour, config.multipleContour); Mem_Shutdown(); return EXIT_SUCCESS; }
void TEST_Init (void) { Com_SetExceptionCallback(Test_InitError); com_aliasSysPool = Mem_CreatePool("Common: Alias system"); com_cmdSysPool = Mem_CreatePool("Common: Command system"); com_cmodelSysPool = Mem_CreatePool("Common: Collision model"); com_cvarSysPool = Mem_CreatePool("Common: Cvar system"); com_fileSysPool = Mem_CreatePool("Common: File system"); com_genericPool = Mem_CreatePool("Generic"); Mem_Init(); Cbuf_Init(); Cmd_Init(); Cvar_Init(); FS_InitFilesystem(qtrue); FS_AddGameDirectory("./unittest", qfalse); Swap_Init(); SV_Init(); NET_Init(); FS_ExecAutoexec(); OBJZERO(csi); Com_SetExceptionCallback(Test_RunError); http_timeout = Cvar_Get("noname", "", 0, NULL); http_proxy = Cvar_Get("noname", "", 0, NULL); }
void dEngine_Init(void) { FS_InitFilesystem(); Log_Printf("dEngine Initialization...\n"); ENT_InitCacheSystem(); TEXT_InitCacheSystem(); MAT_InitCacheSystem(); #ifdef GENERATE_VIDEO dEngine_INIT_ScreenshotBuffer(); #endif engine.sceneId = -1; dEngine_RequireSceneId(0); //engine.recordVideo = 0; engine.musicFilename[0] = '\0'; engine.musicStartAt = 0; engine.playback.filename[0] = '\0'; // Enable/disable sounds here engine.soundEnabled = 0; engine.musicEnabled = 0; engine.gameCenterEnabled = 0; ENPAR_Init(); dEngine_ReadConfig(); SCR_Init(); MATLIB_LoadLibraries(); COLL_InitUnitCube(); ENE_Mem_Init(); //SND_Init(); MENU_Init(); }
void Com_Init( char *commandLine ) { char *s; Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ ); try { Cvar_Init (); // prepare enough of the subsystems to handle // cvar and command buffer management Com_ParseCommandLine( commandLine ); //Swap_Init (); Cbuf_Init (); Com_InitZoneMemory(); Cmd_Init (); // override anything from the config files with command line args Com_StartupVariable( NULL ); // done early so bind command exists CL_InitKeyCommands(); com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT); FS_InitFilesystem (); //uses z_malloc //re.R_InitWorldEffects(); // this doesn't do much but I want to be sure certain variables are intialized. Com_ExecuteCfg(); // override anything from the config files with command line args Com_StartupVariable( NULL ); // allocate the stack based hunk allocator Com_InitHunkMemory(); // if any archived cvars are modified after this, we will trigger a writing // of the config file cvar_modifiedFlags &= ~CVAR_ARCHIVE; // // init commands and vars // Cmd_AddCommand ("quit", Com_Quit_f); Cmd_AddCommand ("writeconfig", Com_WriteConfig_f ); com_maxfps = Cvar_Get ("com_maxfps", "125", CVAR_ARCHIVE); com_developer = Cvar_Get ("developer", "0", CVAR_TEMP ); com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP ); com_speedslog = Cvar_Get ("speedslog", "0", CVAR_TEMP ); com_timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT ); com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT); com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT); com_speeds = Cvar_Get ("com_speeds", "0", 0); #ifdef G2_PERFORMANCE_ANALYSIS com_G2Report = Cvar_Get("com_G2Report", "0", 0); #endif cl_paused = Cvar_Get ("cl_paused", "0", CVAR_ROM); sv_paused = Cvar_Get ("sv_paused", "0", CVAR_ROM); com_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM); com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM); com_skippingcin = Cvar_Get ("skippingCinematic", "0", CVAR_ROM); com_buildScript = Cvar_Get( "com_buildScript", "0", 0 ); com_affinity = Cvar_Get( "com_affinity", "1", CVAR_ARCHIVE ); com_bootlogo = Cvar_Get( "com_bootlogo", "1", CVAR_ARCHIVE ); if ( com_developer && com_developer->integer ) { Cmd_AddCommand ("error", Com_Error_f); Cmd_AddCommand ("crash", Com_Crash_f ); Cmd_AddCommand ("freeze", Com_Freeze_f); } s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ ); com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO ); #ifdef JK2_MODE JK2SP_Init(); Com_Printf("Running Jedi Outcast Mode\n"); #else SE_Init(); // Initialize StringEd Com_Printf("Running Jedi Academy Mode\n"); #endif Sys_Init(); // this also detects CPU type, so I can now do this CPU check below... Sys_SetProcessorAffinity(); Netchan_Init( Com_Milliseconds() & 0xffff ); // pick a port value that should be nice and random // VM_Init(); SV_Init(); CL_Init(); // set com_frameTime so that if a map is started on the // command line it will still be able to count on com_frameTime // being random enough for a serverid com_frameTime = Com_Milliseconds(); // add + commands from command line if ( !Com_AddStartupCommands() ) { // if the user didn't give any commands, run default action if ( com_bootlogo->integer ) { Cbuf_AddText ("cinematic openinglogos\n"); } } com_fullyInitialized = qtrue; Com_Printf ("--- Common Initialization Complete ---\n"); //HACKERY FOR THE DEUTSCH //if ( (Cvar_VariableIntegerValue("ui_iscensored") == 1) //if this was on before, set it again so it gets its flags // ) //{ // Cvar_Get( "ui_iscensored", "1", CVAR_ARCHIVE|CVAR_ROM|CVAR_INIT|CVAR_CHEAT|CVAR_NORESTART); // Cvar_Set( "ui_iscensored", "1"); //just in case it was archived // // NOTE : I also create this in UI_Init() // Cvar_Get( "g_dismemberment", "0", CVAR_ARCHIVE|CVAR_ROM|CVAR_INIT|CVAR_CHEAT); // Cvar_Set( "g_dismemberment", "0"); //just in case it was archived //} } catch ( int code ) { Com_CatchError (code); Sys_Error ("Error during initialization %s", Com_ErrorString (code)); } }
/* ================= Com_Init ================= */ void Com_Init( char *commandLine ) { char *s; Com_Printf( "%s %s %s\n", Q3_VERSION, CPUSTRING, __DATE__ ); try { // prepare enough of the subsystems to handle // cvar and command buffer management Com_ParseCommandLine( commandLine ); Swap_Init (); Cbuf_Init (); Com_InitZoneMemory(); Cmd_Init (); Cvar_Init (); // get the commandline cvars set Com_StartupVariable( NULL ); // done early so bind command exists CL_InitKeyCommands(); FS_InitFilesystem (); //uses z_malloc Com_InitJournaling(); Cbuf_AddText ("exec default.cfg\n"); // skip the jk2config.cfg if "safe" is on the command line if ( !Com_SafeMode() ) { Cbuf_AddText ("exec jk2config.cfg\n"); } Cbuf_AddText ("exec autoexec.cfg\n"); Cbuf_Execute (); // override anything from the config files with command line args Com_StartupVariable( NULL ); // allocate the stack based hunk allocator Com_InitHunkMemory(); // if any archived cvars are modified after this, we will trigger a writing // of the config file cvar_modifiedFlags &= ~CVAR_ARCHIVE; // // init commands and vars // Cmd_AddCommand ("quit", Com_Quit_f); Cmd_AddCommand ("writeconfig", Com_WriteConfig_f ); com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE); com_developer = Cvar_Get ("developer", "0", CVAR_TEMP ); com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP ); com_speedslog = Cvar_Get ("speedslog", "0", CVAR_TEMP ); com_timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT ); com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT); com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT); com_viewlog = Cvar_Get( "viewlog", "0", CVAR_TEMP ); com_speeds = Cvar_Get ("com_speeds", "0", 0); cl_paused = Cvar_Get ("cl_paused", "0", CVAR_ROM); sv_paused = Cvar_Get ("sv_paused", "0", CVAR_ROM); com_sv_running = Cvar_Get ("sv_running", "0", CVAR_ROM); com_cl_running = Cvar_Get ("cl_running", "0", CVAR_ROM); com_skippingcin = Cvar_Get ("skippingCinematic", "0", CVAR_ROM); com_buildScript = Cvar_Get( "com_buildScript", "0", 0 ); com_FirstTime = Cvar_Get( "com_FirstTime", "0", CVAR_ARCHIVE); if ( com_developer && com_developer->integer ) { Cmd_AddCommand ("error", Com_Error_f); Cmd_AddCommand ("crash", Com_Crash_f ); Cmd_AddCommand ("freeze", Com_Freeze_f); } s = va("%s %s %s", Q3_VERSION, CPUSTRING, __DATE__ ); com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO ); SP_Init(); // Initialize StripEd Sys_Init(); // this also detects CPU type, so I can now do this CPU check below... if( !com_FirstTime->integer ) // special request to detect and use top-settings for Intel Williamette chip... { Cvar_Set( "com_FirstTime", "1" ); // only do this once // // ( make a local ptr only for quick test, since this is a common module ) // cvar_t* s_CPUType = Cvar_Get("sys_cpuid","",0); if (s_CPUType->value == CPUID_INTEL_WILLIAMETTE) { Cbuf_AddText ("exec perfect.cfg\n"); // Cbuf_Execute (); } } Netchan_Init( Com_Milliseconds() & 0xffff ); // pick a port value that should be nice and random // VM_Init(); SV_Init(); CL_Init(); Sys_ShowConsole( com_viewlog->integer, qfalse ); // set com_frameTime so that if a map is started on the // command line it will still be able to count on com_frameTime // being random enough for a serverid com_frameTime = Com_Milliseconds(); // add + commands from command line if ( !Com_AddStartupCommands() ) { #ifdef NDEBUG // if the user didn't give any commands, run default action // if ( !com_dedicated->integer ) { Cbuf_AddText ("cinematic openinglogos\n"); // if( !com_introPlayed->integer ) { // Cvar_Set( com_introPlayed->name, "1" ); // Cvar_Set( "nextmap", "cinematic intro" ); // } } #endif } com_fullyInitialized = qtrue; Com_Printf ("--- Common Initialization Complete ---\n"); } catch (const char* reason) { Sys_Error ("Error during initialization %s", reason); } }
void Host_Init (int argc, char **argv, int default_memsize) { vfsfile_t *vf; cvar_t *v; char cfg[MAX_PATH] = {0}; int i; char *cfg_name; COM_InitArgv (argc, argv); COM_StoreOriginalCmdline(argc, argv); #ifdef WITH_DP_MEM Memory2_Init (); #endif Host_InitMemory (default_memsize); #ifdef WITH_TCL // interpreter should be initialized // before any cvar definitions TCL_InterpInit (); #endif Cbuf_Init (); Cmd_Init (); Cvar_Init (); COM_Init (); Key_Init (); #ifdef WITH_DP_MEM Memory2_Init_Commands (); #endif Cache_Init_Commands (); FS_InitFilesystem (); NET_Init (); Commands_For_Configs_Init (); ConfigManager_Init(); ResetBinds(); i = COM_CheckParm("+cfg_load"); if (i && (i + 1 < COM_Argc())) { cfg_name = COM_Argv(i + 1); } else { cfg_name = MAIN_CONFIG_FILENAME; } snprintf(cfg, sizeof(cfg), "%s", cfg_name); COM_ForceExtensionEx (cfg, ".cfg", sizeof (cfg)); Cbuf_AddText(va("cfg_load %s\n", cfg)); Cbuf_Execute(); Cbuf_AddEarlyCommands (); Cbuf_Execute (); Con_Init (); NET_InitClient (); Netchan_Init (); #if (!defined WITH_PNG_STATIC || !defined WITH_JPEG_STATIC || defined WITH_MP3_PLAYER) QLib_Init(); #endif Sys_Init (); CM_Init (); PM_Init (); Mod_Init (); SV_Init (); CL_Init (); Cvar_CleanUpTempVars (); SYSINFO_Init(); #ifdef WITH_TCL if (!TCL_InterpLoaded()) Com_Printf_State (PRINT_FAIL, "Could not load "TCL_LIB_NAME", embedded Tcl disabled\n"); #endif Hunk_AllocName (0, "-HOST_HUNKLEVEL-"); host_hunklevel = Hunk_LowMark (); host_initialized = true; // walk through all vars and forse OnChange event if cvar was modified, // also apply that to variables which mirrored in userinfo because of cl_parsefunchars was't applyed as this moment, // same for serverinfo and may be this fix something also. for ( v = NULL; (v = Cvar_Next ( v )); ) { char val[2048]; // if ( !v->modified ) // continue; // not modified even that strange at this moment if ( Cvar_GetFlags( v ) & (CVAR_ROM | CVAR_INIT) ) continue; snprintf(val, sizeof(val), "%s", v->string); Cvar_Set(v, val); } Hud_262LoadOnFirstStart(); Com_Printf_State (PRINT_INFO, "Exe: "__TIME__" "__DATE__"\n"); Com_Printf_State (PRINT_INFO, "Hunk allocation: %4.1f MB.\n", (float) host_memsize / (1024 * 1024)); Com_Printf ("\nezQuake %s\n\n", VersionString()); Com_Printf(Host_PrintBars("ezQuake\x9c" "SourceForge\x9c" "net", 38)); Com_Printf(Host_PrintBars("ezQuake Initialized", 38)); Com_Printf("\n"); Com_Printf ("\nType /help to access the manual.\nUse /describe to learn about commands.\n", VersionString()); if ((vf = FS_OpenVFS("autoexec.cfg", "rb", FS_ANY))) { Cbuf_AddText ("exec autoexec.cfg\n"); VFS_CLOSE(vf); } Cmd_StuffCmds_f (); // process command line arguments Cbuf_AddText ("cl_warncmd 1\n"); #ifdef WIN32 // // Verify that ezQuake is associated with the QW:// protocl handler. // { extern qbool CL_CheckIfQWProtocolHandler(); extern cvar_t cl_verify_qwprotocol; if (cl_verify_qwprotocol.integer >= 2) { // Always register the qw:// protocol. Cbuf_AddText("register_qwurl_protocol\n"); } else if (cl_verify_qwprotocol.integer == 1 && !CL_CheckIfQWProtocolHandler()) { // Check if the running exe is the one associated with the qw:// protocol. Com_PrintVerticalBar(0.8 * vid.conwidth / 8); Com_Printf("\n"); Com_Printf("This ezQuake is not associated with the "); Com_Printf("\x02QW:// protocol.\n"); Com_Printf("Register it using "); Com_Printf("\x02/register_qwurl_protocol\n"); Com_Printf("(set "); Com_Printf("\x02 cl_verify_qwprotocol "); Com_Printf("to 0 to hide this warning)\n"); Com_PrintVerticalBar(0.8 * vid.conwidth / 8); Com_Printf("\n"); } } #endif // WIN32 // Check if a qtv/demo file is specified as the first argument, in that case play that // otherwise, do some more checks of what to show at startup. { char cmd[1024] = {0}; if (COM_CheckArgsForPlayableFiles(cmd, sizeof(cmd))) { Cbuf_AddText(cmd); } else { Startup_Place(); } } #ifdef _WIN32 SetForegroundWindow(mainwindow); SetActiveWindow(mainwindow); #endif host_everything_loaded = true; }
/** * @brief Init function * @sa Com_ParseScripts * @sa Qcommon_Shutdown * @sa Sys_Init * @sa CL_Init */ void Qcommon_Init (int argc, char** argv) { logfile_active = nullptr; developer = nullptr; Sys_InitSignals(); /* random seed */ Com_SetRandomSeed(time(nullptr)); com_aliasSysPool = Mem_CreatePool("Common: Alias system for commands and enums"); com_cmdSysPool = Mem_CreatePool("Common: Command system"); com_cmodelSysPool = Mem_CreatePool("Common: Collision model"); com_cvarSysPool = Mem_CreatePool("Common: Cvar system"); com_fileSysPool = Mem_CreatePool("Common: File system"); com_genericPool = Mem_CreatePool("Generic"); com_networkPool = Mem_CreatePool("Network"); try { OBJZERO(csi); /* prepare enough of the subsystems to handle * cvar and command buffer management */ Com_InitArgv(argc, argv); Swap_Init(); Cbuf_Init(); Cmd_Init(); Cvar_Init(); uploadcrashdump = Cvar_Get("uploadcrashdump", "1", 0, "upload crashdumps to the developers"); Key_Init(); /* we need to add the early commands twice, because * a basedir needs to be set before executing * config files, but we want other parms to override * the settings of the config files */ Cbuf_AddEarlyCommands(false); Cbuf_Execute(); FS_InitFilesystem(true); Cbuf_AddText("exec default.cfg\n"); #ifdef DEDICATED_ONLY Cbuf_AddText("exec dedconfig.cfg\n"); #else Cbuf_AddText("exec config.cfg\n"); #endif Cbuf_AddEarlyCommands(true); Cbuf_Execute(); Com_SetRenderModified(false); Com_SetUserinfoModified(false); /* init commands and vars */ Cmd_AddCommand("saveconfig", Com_WriteConfig_f, "Write the configuration to file"); Cmd_AddCommand("gametypelist", Com_GameTypeList_f, "List all available multiplayer game types"); #ifdef DEBUG Cmd_AddCommand("debug_help", Com_DebugHelp_f, "Show some debugging help"); Cmd_AddCommand("debug_error", Com_DebugError_f, "Just throw a fatal error to test error shutdown procedures"); #endif Cmd_AddCommand("setdeveloper", Com_DeveloperSet_f, "Set the developer cvar to only get the debug output you want"); developer = Cvar_Get("developer", "0", 0, "Activate developer output to logfile and gameconsole"); #ifdef DEBUG logfile_active = Cvar_Get("logfile", "2", 0, "0 = deactivate logfile, 1 = write normal logfile, 2 = flush on every new line, 3 = always append to existing file"); #else logfile_active = Cvar_Get("logfile", "1", 0, "0 = deactivate logfile, 1 = write normal logfile, 2 = flush on every new line, 3 = always append to existing file"); #endif sv_gametype = Cvar_Get("sv_gametype", "fight1on1", CVAR_ARCHIVE | CVAR_SERVERINFO, "Sets the multiplayer gametype - see gametypelist command for a list of all gametypes"); http_proxy = Cvar_Get("http_proxy", "", CVAR_ARCHIVE, "Use this proxy for http transfers"); http_timeout = Cvar_Get("http_timeout", "3", CVAR_ARCHIVE, "Http connection and read timeout"); port = Cvar_Get("port", DOUBLEQUOTE(PORT_SERVER), CVAR_NOSET); masterserver_url = Cvar_Get("masterserver_url", MASTER_SERVER, CVAR_ARCHIVE, "URL of UFO:AI masterserver"); #ifdef DEDICATED_ONLY sv_dedicated = Cvar_Get("sv_dedicated", "1", CVAR_SERVERINFO | CVAR_NOSET, "Is this a dedicated server?"); /* don't allow to override this from commandline of config */ Cvar_ForceSet("sv_dedicated", "1"); #else sv_dedicated = Cvar_Get("sv_dedicated", "0", CVAR_SERVERINFO | CVAR_NOSET, "Is this a dedicated server?"); /* set this to false for client - otherwise Qcommon_Frame would set the initial values to multiplayer */ sv_gametype->modified = false; s_language = Cvar_Get("s_language", "", CVAR_ARCHIVE, "Game language - full language string e.g. en_EN.UTF-8"); s_language->modified = false; cl_maxfps = Cvar_Get("cl_maxfps", "50", CVAR_ARCHIVE); Cvar_SetCheckFunction("cl_maxfps", Com_CvarCheckMaxFPS); #endif // 5 is an i7 with a medium gfx-card // 3 dual core with 2 GB // 2 EeePc with 1 GB // 1 smartphone const char* hwclassVal = "5"; #ifdef __ANDROID__ /** get the hardware class of the machine we are running on. */ hwclassVal = "1"; #endif hwclass = Cvar_Get("hwclass", hwclassVal, 0, "Defines the hardware class of this machine. 1 is the lowest, 5 is the highest."); const char* s = va("UFO: Alien Invasion %s %s %s %s", UFO_VERSION, CPUSTRING, __DATE__, BUILDSTRING); Cvar_Get("version", s, CVAR_NOSET, "Full version string"); Cvar_Get("ver", UFO_VERSION, CVAR_SERVERINFO | CVAR_NOSET, "Version number"); if (sv_dedicated->integer) Cmd_AddCommand("quit", Com_Quit, "Quits the game"); Mem_Init(); Sys_Init(); NET_Init(); #ifndef NO_HTTP curl_global_init(CURL_GLOBAL_NOTHING); Com_Printf("%s initialized.\n", curl_version()); #endif SV_Init(); /* e.g. init the client hunk that is used in script parsing */ CL_Init(); Com_ParseScripts(sv_dedicated->integer); #ifndef DEDICATED_ONLY Cbuf_AddText("exec keys.cfg\n"); #endif if (!sv_dedicated->integer) Cbuf_AddText("init\n"); else Cbuf_AddText("dedicated_start\n"); Cbuf_Execute(); FS_ExecAutoexec(); /* add + commands from command line * if the user didn't give any commands, run default action */ if (Cbuf_AddLateCommands()) { /* the user asked for something explicit * so drop the loading plaque */ SCR_EndLoadingPlaque(); } const cvar_t* com_pipefile = Cvar_Get("com_pipefile", "", CVAR_ARCHIVE, "Filename of the pipe that is used to send commands to the game"); if (com_pipefile->string[0] != '\0') { FS_CreateOpenPipeFile(com_pipefile->string, &pipefile); } CL_InitAfter(); /* Check memory integrity */ Mem_CheckGlobalIntegrity(); #ifndef DEDICATED_ONLY if (!sv_dedicated->integer) { Schedule_Timer(cl_maxfps, &CL_Frame, nullptr, nullptr); Schedule_Timer(Cvar_Get("cl_slowfreq", "10", 0, nullptr), &CL_SlowFrame, nullptr, nullptr); /* now hide the console */ Sys_ShowConsole(false); } #endif Schedule_Timer(Cvar_Get("sv_freq", "10", CVAR_NOSET, nullptr), &SV_Frame, nullptr, nullptr); /** @todo This line wants to be removed */ Schedule_Timer(Cvar_Get("cbuf_freq", "10", 0, nullptr), &Cbuf_Execute_timer, nullptr, nullptr); Com_Printf("====== UFO Initialized ======\n"); Com_Printf("=============================\n"); } catch (comDrop_t const&) { Sys_Error("Error during initialization"); } }
void dEngine_Init() { ENT_InitCacheSystem(); TEXT_InitCacheSystem(); MAT_InitCacheSystem(); #ifdef GENERATE_VIDEO dEngine_INIT_ScreenshotBuffer(); #endif engine.sceneId = -1; dEngine_RequireSceneId(0); //engine.recordVideo = 0; engine.musicFilename[0] = '\0'; engine.musicStartAt = 0; engine.playback.filename[0] = '\0'; engine.soundEnabled = 1; engine.musicEnabled = 1; engine.gameCenterEnabled = 0; ENPAR_Init(); FS_InitFilesystem(); dEngine_ReadConfig(); SCR_Init(); MATLIB_LoadLibraries(); COLL_InitUnitCube(); ENE_Mem_Init(); SND_Init(); MENU_Init(); //TESTS /* char c = CHAR_MAX; unsigned char uc = UCHAR_MAX; short s = SHRT_MAX; unsigned short us = USHRT_MAX; int i = INT_MAX; unsigned int ui = UINT_MAX; long l = LONG_MAX; unsigned long ul = ULONG_MAX; printf("\n"); printf("LIMITS: c:%d, uc:%u, s:%d, us:%u\n" "LIMITS: i:%d, ui:%u, l:%ld, ul:%lu\n", c, uc, s, us, i, ui, l, ul); // promotion printf("\n"); printf("i = s: %d, \n", i = s); printf("i = us: %d, \n", i = us); printf("ui = s: %u, \n", ui = s); printf("ui = us: %u\n", ui = us); // narrowing printf("\n"); printf("c = s: %d, \n", c = s); printf("c = us: %d, \n", c = us); printf("uc = s: %d, \n", uc = s); //Ln:31 printf("uc = us: %d\n", uc = us); printf("\n"); printf("uc = UCHAR_MAX (%u) + 1: %u, \n", UCHAR_MAX, uc = UCHAR_MAX + 1); // Ln:36 printf("uc = -1: %d\n", uc = -1); */ }
/* ================= Qcommon_Init ================= */ void Qcommon_Init (int argc, char **argv) { static const char *apVersion = APPLICATION " v" VERSION " " CPUSTRING " " __DATE__ " " BUILDSTRING; if (setjmp (abortframe) ) Sys_Error ("Error during initialization"); z_chain.next = z_chain.prev = &z_chain; // prepare enough of the subsystems to handle // cvar and command buffer management COM_InitArgv (argc, argv); Swap_Init (); Cbuf_Init (); Cmd_Init (); Cvar_Init (); Key_Init (); // we need to add the early commands twice, because // a basedir or cddir needs to be set before execing // config files, but we want other parms to override // the settings of the config files Cbuf_AddEarlyCommands (false); Cbuf_Execute(); FS_InitFilesystem (); Cbuf_AddText ("exec default.cfg\n"); Cbuf_Execute(); Cbuf_AddText ("exec aprconfig.cfg\n"); Cbuf_Execute(); FS_ExecConfig("autoexec.cfg"); Cbuf_Execute(); Cbuf_AddEarlyCommands (true); Cbuf_Execute(); Cmd_AddCommand ("echo", Cmd_Echo_f); // init commands and vars Cmd_AddCommand ("z_stats", Z_Stats_f); Cmd_AddCommand( "z_check", Z_Check ); host_speeds = Cvar_Get ("host_speeds", "0", 0); developer = Cvar_Get ("developer", "0", 0); timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT); fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT); logfile_active = Cvar_Get ("logfile", "0", 0); showtrace = Cvar_Get ("showtrace", "0", 0); #ifdef DEDICATED_ONLY dedicated = Cvar_Get ("dedicated", "1", CVAR_ROM); #else dedicated = Cvar_Get ("dedicated", "0", CVAR_NOSET); #endif timescale->OnChange = OnChange_Timescale; OnChange_Timescale(timescale, timescale->resetString); Cvar_Get ("version", apVersion, CVAR_SERVERINFO|CVAR_ROM); Cmd_AddMacro( "date", Com_Date_m ); Cmd_AddMacro( "time", Com_Time_m ); if (dedicated->integer) Cmd_AddCommand ("quit", Com_Quit); #ifndef NDEBUG Cmd_AddCommand( "error", Com_Error_f ); Cmd_AddCommand( "errordrop", Com_ErrorDrop_f ); Cmd_AddCommand( "freeze", Com_Freeze_f ); Cmd_AddCommand( "crash", Com_Crash_f ); #endif Sys_Init (); srand(Sys_Milliseconds()); NET_Init (); Netchan_Init (); SV_Init (); CL_Init (); ComInitialized = true; Cbuf_InsertFromDefer(); //Execute commands which was initialized after loading autoexec (ignore, highlight etc) FS_ExecConfig ("postinit.cfg"); Cbuf_Execute(); // add + commands from command line if (!Cbuf_AddLateCommands ()) { // if the user didn't give any commands, run default action if (!dedicated->integer) Cbuf_AddText ("toggleconsole\n"); else Cbuf_AddText ("dedicated_start\n"); Cbuf_Execute(); } else { // the user asked for something explicit // so drop the loading plaque SCR_EndLoadingPlaque(); } Com_Printf ("====== " APPLICATION " Initialized ======\n\n"); }
/* ==================== Host_Init ==================== */ void Host_Init (int argc, char **argv, int default_memsize) { COM_InitArgv (argc, argv); #if !defined(CLIENTONLY) && !defined(SERVERONLY) if (COM_CheckParm("-dedicated")) dedicated = true; #endif Host_InitMemory (default_memsize); Cbuf_Init (); Cmd_Init (); Cvar_Init (); COM_Init (); Key_Init (); FS_InitFilesystem (); COM_CheckRegistered (); Con_Init (); if (!dedicated) { Cbuf_AddText ("exec default.cfg\n"); Cbuf_AddText ("exec config.cfg\n"); Cbuf_Execute (); } Cbuf_AddEarlyCommands (); Cbuf_Execute (); NET_Init (); Netchan_Init (); Sys_Init (); CM_Init (); PM_Init (); Host_InitLocal (); SV_Init (); CL_Init (); Cvar_CleanUpTempVars (); Hunk_AllocName (0, "-HOST_HUNKLEVEL-"); host_hunklevel = Hunk_LowMark (); host_initialized = true; Com_Printf ("Exe: "__TIME__" "__DATE__"\n"); Com_Printf ("%4.1f megs RAM used.\n", host_memsize / (1024*1024.0)); Com_Printf ("\n========= " PROGRAM " Initialized =========\n"); if (dedicated) { Cbuf_AddText ("exec server.cfg\n"); Cmd_StuffCmds_f (); // process command line arguments Cbuf_Execute (); // if a map wasn't specified on the command line, spawn start map if (!com_serveractive) Cmd_ExecuteString ("map start"); if (!com_serveractive) Host_Error ("Couldn't spawn a server"); } else { Cbuf_AddText ("exec autoexec.cfg\n"); Cmd_StuffCmds_f (); // process command line arguments Cbuf_AddText ("cl_warncmd 1\n"); } }