CEquipmentSystemInterface::CEquipmentSystemInterface(CEditorGame* pEditorGame, IGameToEditorInterface *pGameToEditorInterface) : m_pEditorGame(pEditorGame) { m_pIItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem(); m_pIEquipmentManager = m_pIItemSystem->GetIEquipmentManager(); InitItems(pGameToEditorInterface); }
const std::vector<IResource*>& CArchive::GetChildren() { if(!mChildren.size()) { InitItems(); BuildHierarchy(mPath.string(), mChildren); } return mChildren; }
void __fastcall TfrmEditLightAnim::ebReloadClick(TObject *Sender) { ebSave->Enabled = false; m_CurrentItem = 0; LALib.Reload (); m_Props->ClearProperties (); m_Items->ClearList (); InitItems (); }
//--------------------------------------------------------------------------- void __fastcall TfrmEditLightAnim::FormShow(TObject *Sender) { ebSave->Enabled = false; UI->BeginEState(esEditLightAnim); InitItems(); // check window position UI->CheckWindowPos(this); }
void __fastcall TfrmEditLightAnim::ebAddAnimClick(TObject *Sender) { // folder name AnsiString pref; TElTreeItem* item = m_Items->GetSelected(); if (item) FHelper.MakeName(item,0,pref,true); pref += "la"; AnsiString name = FHelper.GenerateName (pref.c_str(),2,fastdelegate::bind<TFindObjectByName>(this,&TfrmEditLightAnim::FindItemByName),false,true); CLAItem* I = LALib.AppendItem(name.c_str(),0); InitItems (); m_Items->SelectItem (*I->cName,true,false,true); OnModified (); }
void __fastcall TfrmEditLightAnim::ebCloneClick(TObject *Sender) { if (m_CurrentItem){ // folder name AnsiString name = FHelper.GenerateName (m_CurrentItem->cName.c_str(),2,fastdelegate::bind<TFindObjectByName>(this,&TfrmEditLightAnim::FindItemByName),false,true); CLAItem* I = LALib.AppendItem(name.c_str(),m_CurrentItem); InitItems (); m_Items->SelectItem (*I->cName,true,false,true); OnModified (); }else{ ELog.DlgMsg(mtError, "Select item at first."); } }
void LunaticInit(MGLDraw *mgl) { gamemgl = mgl; logFile = AppdataOpen("loonylog.txt", "wt"); InitCosSin(); InitDisplay(gamemgl); InitSound(); InitMonsters(); InitTiles(mgl); InitItems(); InitInterface(); LoadOptions(); MusicInit(); mgl->SetLastKey(0); MGL_srand(timeGetTime()); InitControls(); InitPlayer(INIT_GAME, 0, 0); msgFromOtherModules = 0; }
int CMusikSourcesCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if ( CMusikPropTree::OnCreate(lpCreateStruct) == -1 ) return -1; if ( m_DropTarget ) m_DropTarget->Register( this ); // edit in place m_EditInPlace.Create( WS_CHILD, CRect( 0, 0, 0, 0 ), this, 123 ); CFont font; font.CreateStockObject( DEFAULT_GUI_FONT ); m_EditInPlace.SetFont( &font ); InitItems(); return 0; }
void CUIBagWnd::Init(CUIXml& xml, LPCSTR path, const shared_str& sectionName, const shared_str& sectionPrice) { m_sectionName = sectionName; m_sectionPrice = sectionPrice; CUIXmlInit::InitStatic (xml, path, 0, this); for (int i = 0; i < NUMBER_OF_GROUPS; i++) { CUIXmlInit::InitDragDropListEx (xml, "dragdrop_list_bag", 0, &m_groups[i]); m_groups[i].SetMessageTarget (GetParent()); IBuyWnd* w = smart_cast<IBuyWnd*>(GetParent()); w->BindDragDropListEvents (&m_groups[i], true); } CUIXmlInit::Init3tButton (xml, "bag_back_btn", 0, &m_btnBack); InitBoxes (xml); InitWpnSectStorage (); InitItems (); }
int ParseIbuf(char sep) { unsigned char *cp; unsigned char *ep, cks, c; int i, err, len; InitItems(); bcopy((void *) ibuf, icpy, IBUF_SIZE); len = 0; for (i=0; i<IBUF_SIZE; i++) { c = icpy[i]; if (c == 0) icpy[i] = ' '; if (c == ETX) { icpy[i] = 0; len = i + 1; break; } } err = 0; if (len > 4) { cks = 0; for (i=0; i<len -2; i++) cks ^= ibuf[i]; if (cks != ibuf[i]) err++; else icpy[i] = 0; } else err++; if (err) return 0; /* Illegal string length or checksum error */ cp = &(icpy[4]); /* Skip STX 99 c */ for (i=0; i<ITEMS; i++) { ep = index(cp,sep); if (ep) { *ep = 0; MyStrCpy(items[i],cp); cp = ++ep; } else break; } MyStrCpy(items[i],cp); item = i+1; return item; }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame ====\n"); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); //ZOID //This game.dll only supports deathmatch if (!deathmatch->value) { gi.dprintf("Forcing deathmatch."); gi.cvar_set("deathmatch", "1"); } //force coop off if (coop->value) gi.cvar_set("coop", "0"); //ZOID // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); //ZOID capturelimit = gi.cvar ("capturelimit", "0", CVAR_SERVERINFO); instantweap = gi.cvar ("instantweap", "0", CVAR_SERVERINFO); //ZOID password = gi.cvar ("password", "", CVAR_USERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; //ZOID CTFInit(); //ZOID }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame ====\n"); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); zdmflags = gi.cvar ("zdmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); gamedir = gi.cvar ("gamedir", "baseq2", CVAR_SERVERINFO); #ifdef CACHE_SOUND printSoundRejects = gi.cvar("printsoundrejects", "0", CVAR_SERVERINFO); #endif // items InitItems (); #if defined(_DEBUG) && defined(_Z_TESTMODE) gi.dprintf ("==== InitTestWeapon ====\n"); InitTestWeapon(); gi.dprintf ("==== InitTestItem ====\n"); InitTestItem(); #endif Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; // get at the gl_polyblend client variable gi.cvar("gl_polyblend", "1", CVAR_USERINFO); }
// // D_DoomMain // void D_DoomMain (void) { unsigned p; extern std::string defdemoname; gamestate = GS_STARTUP; M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command Printf (PRINT_HIGH, "Heapsize: %u megabytes\n", got_heapsize); M_LoadDefaults (); // load before initing other systems C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line const char* iwad = Args.CheckValue("-iwad"); if (!iwad) iwad = ""; std::vector<std::string> newwadfiles, newpatchfiles; newwadfiles.push_back(iwad); D_AddWadCommandLineFiles(newwadfiles); D_AddDehCommandLineFiles(newpatchfiles); D_LoadResourceFiles(newwadfiles, newpatchfiles); I_Init(); V_Init(); atterm(V_Close); #ifdef _WIN32 const char *sdlv = getenv("SDL_VIDEODRIVER"); Printf (PRINT_HIGH, "Using %s video driver.\n",sdlv); #endif C_InitConsole(screen->width, screen->height, true); atterm(C_ShutdownConsole); // SDL needs video mode set up first before input code can be used I_InitInput(); D_Init(); atterm(D_Shutdown); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks(); // [RH] User-configurable startup strings. Because BOOM does. if (GStrings(STARTUP1)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP1)); if (GStrings(STARTUP2)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP2)); if (GStrings(STARTUP3)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP3)); if (GStrings(STARTUP4)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP4)); if (GStrings(STARTUP5)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP5)); // Nomonsters sv_nomonsters = Args.CheckParm("-nomonsters"); // Respawn sv_monstersrespawn = Args.CheckParm("-respawn"); // Fast sv_fastmonsters = Args.CheckParm("-fast"); // developer mode devparm = Args.CheckParm ("-devparm"); // Record a vanilla demo p = Args.CheckParm ("-record"); if (p) { autorecord = true; autostart = true; demorecordfile = Args.GetArg (p+1); } // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); // Check for -playdemo, play a single demo then quit. p = Args.CheckParm ("-playdemo"); // Hack to check for +playdemo command, since if you just add it normally // it won't run because it's attempting to run a demo and still set up the // first map as normal. if (!p) p = Args.CheckParm ("+playdemo"); if (p && p < Args.NumArgs()-1) { Printf (PRINT_HIGH, "Playdemo parameter found on command line.\n"); singledemo = true; defdemoname = Args.GetArg (p+1); } // [SL] check for -timedemo (was removed at some point) p = Args.CheckParm("-timedemo"); if (p && p < Args.NumArgs() - 1) { singledemo = true; G_TimeDemo(Args.GetArg(p + 1)); } const char *val = Args.CheckValue ("-skill"); if (val) { sv_skill.Set (val[0]-'0'); } p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } if (devparm) Printf (PRINT_HIGH, "%s", GStrings(D_DEVSTR)); // D_DEVSTR // [RH] Now that all text strings are set up, // insert them into the level and cluster data. G_SetLevelStrings(); // [RH] Parse through all loaded mapinfo lumps G_ParseMapInfo(); // [ML] Parse musinfo lump G_ParseMusInfo(); // [RH] Parse any SNDINFO lumps S_ParseSndInfo(); // NOTE(jsd): Set up local player color EXTERN_CVAR(cl_color); R_BuildPlayerTranslation (0, V_GetColorFromString (NULL, cl_color.cstring())); I_FinishClockCalibration (); Printf (PRINT_HIGH, "D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame (); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); Printf_Bold("\n\35\36\36\36\36 Odamex Client Initialized \36\36\36\36\37\n"); if(gamestate != GS_CONNECTING) Printf(PRINT_HIGH, "Type connect <address> or use the Odamex Launcher to connect to a game.\n"); Printf(PRINT_HIGH, "\n"); setmodeneeded = false; // [Fly] we don't need to set a video mode here! //gamestate = GS_FULLCONSOLE; // [SL] allow the user to pass the name of a netdemo as the first argument. // This allows easy launching of netdemos from Windows Explorer or other GUIs. // [Xyltol] if (Args.GetArg(1)) { std::string demoarg = Args.GetArg(1); if (demoarg.find(".odd") != std::string::npos) CL_NetDemoPlay(demoarg); } p = Args.CheckParm("-netplay"); if (p) { if (Args.GetArg(p + 1)) { std::string filename = Args.GetArg(p + 1); CL_NetDemoPlay(filename); } else { Printf(PRINT_HIGH, "No netdemo filename specified.\n"); } } // denis - bring back the demos if ( gameaction != ga_loadgame ) { if (autostart || netgame || singledemo) { if (singledemo) G_DoPlayDemo(); else { if(autostart) { // single player warp (like in g_level) serverside = true; sv_allowexit = "1"; sv_freelook = "1"; sv_allowjump = "1"; sv_allowredscreen = "1"; sv_gametype = GM_COOP; players.clear(); players.push_back(player_t()); players.back().playerstate = PST_REBORN; consoleplayer_id = displayplayer_id = players.back().id = 1; } G_InitNew (startmap); if (autorecord) if (G_RecordDemo(demorecordfile.c_str())) G_BeginRecording(); } } else { if (gamestate != GS_CONNECTING) gamestate = GS_HIDECONSOLE; C_HideConsole(); if (gamemode == commercial_bfg) // DOOM 2 BFG Edtion AddCommandString("menu_main"); D_StartTitle (); // start up intro loop } } // denis - this will run a demo and quit p = Args.CheckParm ("+demotest"); if (p && p < Args.NumArgs()-1) { demotest = 1; defdemoname = Args.GetArg (p+1); G_DoPlayDemo(); while(demoplayback) { DObject::BeginFrame (); G_Ticker(); DObject::EndFrame (); gametic++; } } else { demotest = 0; D_DoomLoop (); // never returns } }
/* * This will be called when the dll is first loaded, * which only happens when a new game is started or * a save game is loaded. */ void InitGame(void) { gi.dprintf("Game is starting up.\n"); gi.dprintf("Game is %s.\n", GAMEVERSION); gun_x = gi.cvar("gun_x", "0", 0); gun_y = gi.cvar("gun_y", "0", 0); gun_z = gi.cvar("gun_z", "0", 0); sv_rollspeed = gi.cvar("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar("sv_gravity", "800", 0); /* noset vars */ dedicated = gi.cvar("dedicated", "0", CVAR_NOSET); /* latched vars */ sv_cheats = gi.cvar("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH); gi.cvar("gamedate", __DATE__, CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar("deathmatch", "0", CVAR_LATCH); coop = gi.cvar("coop", "0", CVAR_LATCH); skill = gi.cvar("skill", "1", CVAR_LATCH); maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH); /* change anytime vars */ dmflags = gi.cvar("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar("password", "", CVAR_USERINFO); spectator_password = gi.cvar("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar("filterban", "1", 0); g_select_empty = gi.cvar("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar("run_pitch", "0.002", 0); run_roll = gi.cvar("run_roll", "0.005", 0); bob_up = gi.cvar("bob_up", "0.005", 0); bob_pitch = gi.cvar("bob_pitch", "0.002", 0); bob_roll = gi.cvar("bob_roll", "0.002", 0); /* flood control */ flood_msgs = gi.cvar("flood_msgs", "4", 0); flood_persecond = gi.cvar("flood_persecond", "4", 0); flood_waitdelay = gi.cvar("flood_waitdelay", "10", 0); /* dm map list */ sv_maplist = gi.cvar("sv_maplist", "", 0); /* items */ InitItems(); Com_sprintf(game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf(game.helpmessage2, sizeof(game.helpmessage2), ""); /* initialize all entities for this game */ game.maxentities = maxentities->value; g_edicts = gi.TagMalloc(game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; /* initialize all clients for this game */ game.maxclients = maxclients->value; game.clients = gi.TagMalloc(game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients + 1; }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame (Lazarus) ====\n"); gi.dprintf("by Mr. Hyde & Mad Dog\ne-mail: [email protected]\n\n"); // Knightmare- init cvars lithium_defaults(); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); commentary = gi.cvar ("commentary", "0", CVAR_LATCH); // Knightmare- increase maxentities //maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); maxentities = gi.cvar ("maxentities", va("%i",MAX_EDICTS), CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); //ZOID capturelimit = gi.cvar ("capturelimit", "0", CVAR_SERVERINFO); instantweap = gi.cvar ("instantweap", "0", CVAR_SERVERINFO); //ZOID password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // Lazarus actorchicken = gi.cvar("actorchicken", "1", CVAR_SERVERINFO|CVAR_LATCH); actorjump = gi.cvar("actorjump", "1", CVAR_SERVERINFO|CVAR_LATCH); actorscram = gi.cvar("actorscram", "1", CVAR_SERVERINFO|CVAR_LATCH); alert_sounds = gi.cvar("alert_sounds", "0", CVAR_SERVERINFO|CVAR_LATCH); allow_fog = gi.cvar ("allow_fog", "1", CVAR_ARCHIVE); // set to 0 to bypass target_changelevel clear inventory flag // because some user maps have this erroneously set allow_clear_inventory = gi.cvar ("allow_clear_inventory", "1", CVAR_ARCHIVE); cd_loopcount = gi.cvar("cd_loopcount","4",0); cl_gun = gi.cvar("cl_gun", "1", 0); cl_3dcam = gi.cvar("cl_3dcam", "0", 0); // Knightmare added corpse_fade = gi.cvar("corpse_fade", "0", CVAR_SERVERINFO|CVAR_LATCH); corpse_fadetime = gi.cvar("corpse_fadetime", "20", 0); crosshair = gi.cvar("crosshair", "1", 0); footstep_sounds = gi.cvar("footstep_sounds", "0", CVAR_SERVERINFO|CVAR_LATCH); fov = gi.cvar("fov", "90", 0); hand = gi.cvar("hand", "0", 0); jetpack_weenie = gi.cvar("jetpack_weenie", "0", CVAR_SERVERINFO); joy_pitchsensitivity = gi.cvar("joy_pitchsensitivity", "1", 0); joy_yawsensitivity = gi.cvar("joy_yawsensitivity", "-1", 0); jump_kick = gi.cvar("jump_kick", "0", CVAR_SERVERINFO|CVAR_LATCH); lights = gi.cvar("lights", "1", 0); lightsmin = gi.cvar("lightsmin", "a", CVAR_SERVERINFO); m_pitch = gi.cvar("m_pitch", "0.022", 0); m_yaw = gi.cvar("m_yaw", "0.022", 0); monsterjump = gi.cvar("monsterjump", "1", CVAR_SERVERINFO|CVAR_LATCH); rocket_strafe = gi.cvar("rocket_strafe", "0", 0); s_primary = gi.cvar("s_primary", "0", 0); #ifdef KMQUAKE2_ENGINE_MOD sv_maxgibs = gi.cvar("sv_maxgibs", "160", CVAR_SERVERINFO); #else sv_maxgibs = gi.cvar("sv_maxgibs", "20", CVAR_SERVERINFO); #endif turn_rider = gi.cvar("turn_rider", "1", CVAR_SERVERINFO); zoomrate = gi.cvar("zoomrate", "80", CVAR_ARCHIVE); zoomsnap = gi.cvar("zoomsnap", "20", CVAR_ARCHIVE); // shift_ and rotate_distance only used for debugging stuff - this is the distance // an entity will be moved by "item_left", "item_right", etc. shift_distance = gi.cvar("shift_distance", "1", CVAR_SERVERINFO); rotate_distance = gi.cvar("rotate_distance", "1", CVAR_SERVERINFO); // GL stuff gl_clear = gi.cvar("gl_clear", "0", 0); // Lazarus saved cvars that we may or may not manipulate, but need to // restore to original values upon map exit. lazarus_cd_loop = gi.cvar("lazarus_cd_loop", "0", 0); lazarus_gl_clear= gi.cvar("lazarus_gl_clear","0", 0); lazarus_pitch = gi.cvar("lazarus_pitch", "0", 0); lazarus_yaw = gi.cvar("lazarus_yaw", "0", 0); lazarus_joyp = gi.cvar("lazarus_joyp", "0", 0); lazarus_joyy = gi.cvar("lazarus_joyy", "0", 0); lazarus_cl_gun = gi.cvar("lazarus_cl_gun", "0", 0); lazarus_crosshair = gi.cvar("lazarus_crosshair", "0", 0); /*if(lazarus_gl_clear->value) gi.cvar_forceset("gl_clear", va("%d",lazarus_gl_clear->value)); else gi.cvar_forceset("lazarus_gl_clear", va("%d",gl_clear->value));*/ if(!deathmatch->value && !coop->value) { /*if(lazarus_pitch->value) { gi.cvar_forceset("cd_loopcount", va("%d",(int)(lazarus_cd_loop->value))); gi.cvar_forceset("m_pitch", va("%f",lazarus_pitch->value)); gi.cvar_forceset("m_yaw", va("%f",lazarus_yaw->value)); gi.cvar_forceset("cl_gun", va("%d",(int)(lazarus_cl_gun->value))); gi.cvar_forceset("crosshair", va("%d",(int)(lazarus_crosshair->value))); } else {*/ gi.cvar_forceset("lazarus_cd_loop", va("%d",(int)(cd_loopcount->value))); #ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity gi.cvar_forceset("lazarus_pitch", va("%f",m_pitch->value)); gi.cvar_forceset("lazarus_yaw", va("%f",m_yaw->value)); gi.cvar_forceset("lazarus_joyp", va("%f",joy_pitchsensitivity->value)); gi.cvar_forceset("lazarus_joyy", va("%f",joy_yawsensitivity->value)); #endif gi.cvar_forceset("lazarus_cl_gun", va("%d",(int)(cl_gun->value))); gi.cvar_forceset("lazarus_crosshair", va("%d",(int)(crosshair->value))); //} } tpp = gi.cvar ("tpp", "0", CVAR_ARCHIVE); tpp_auto = gi.cvar ("tpp_auto", "1", 0); crossh = gi.cvar ("crossh", "1", 0); allow_download = gi.cvar("allow_download", "0", 0); blaster_color = gi.cvar("blaster_color", "1", 0); // Knightmare added // If this is an SP game and "readout" is not set, force allow_download off // so we don't get the annoying "Refusing to download path with .." messages // due to misc_actor sounds. if(allow_download->value && !readout->value && !deathmatch->value) gi.cvar_forceset("allow_download", "0"); bounce_bounce = gi.cvar("bounce_bounce", "0.5", 0); bounce_minv = gi.cvar("bounce_minv", "60", 0); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; //ZOID CTFInit(); //ZOID }
void D_DoomMain (void) { M_ClearRandom(); gamestate = GS_STARTUP; if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command I_Init (); D_CheckNetGame (); M_LoadDefaults (); // load before initing other systems M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line //D_AddDefWads(); //SV_InitMultipleFiles (wadfiles); //wadhashes = W_InitMultipleFiles (wadfiles); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks (); // [RH] Initialize configurable strings. D_InitStrings (); // [RH] User-configurable startup strings. Because BOOM does. if (STARTUP1[0]) Printf (PRINT_HIGH, "%s\n", STARTUP1); if (STARTUP2[0]) Printf (PRINT_HIGH, "%s\n", STARTUP2); if (STARTUP3[0]) Printf (PRINT_HIGH, "%s\n", STARTUP3); if (STARTUP4[0]) Printf (PRINT_HIGH, "%s\n", STARTUP4); if (STARTUP5[0]) Printf (PRINT_HIGH, "%s\n", STARTUP5); devparm = Args.CheckParm ("-devparm"); // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char *val = Args.CheckValue ("-skill"); if (val) { skill.Set (val[0]-'0'); } unsigned p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } if (devparm) Printf (PRINT_HIGH, "%s", Strings[0].builtin); // D_DEVSTR const char *v = Args.CheckValue ("-timer"); if (v) { double time = atof (v); Printf (PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); timelimit.Set ((float)time); } const char *w = Args.CheckValue ("-avg"); if (w) { Printf (PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); timelimit.Set (20); } // Check for -file in shareware if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_FatalError ("You cannot -file with the shareware version. Register!"); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-background")) daemon_init(); #endif // Use wads mentioned on the commandline to start with std::vector<std::string> start_wads; std::string custwad; const char *iwadparm = Args.CheckValue ("-iwad"); if (iwadparm) { custwad = iwadparm; FixPathSeparator (custwad); start_wads.push_back(custwad); } DArgs files = Args.GatherFiles ("-file", ".wad", true); if (files.NumArgs() > 0) { modifiedgame = true; for (size_t i = 0; i < files.NumArgs(); i++) { start_wads.push_back(files.GetArg (i)); } } D_DoomWadReboot(start_wads); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); strncpy(level.mapname, startmap, sizeof(level.mapname)); gamestate = GS_STARTUP; G_ChangeMap (); D_DoomLoop (); // never returns }
void D_DoomMain (void) { const char *iwad; M_ClearRandom(); gamestate = GS_STARTUP; M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command // Always log by default if (!LOG.is_open()) C_DoCommand("logfile"); Printf (PRINT_HIGH, "Heapsize: %u megabytes\n", got_heapsize); M_LoadDefaults (); // load before initing other systems C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line iwad = Args.CheckValue("-iwad"); if(!iwad) iwad = ""; D_AddDefWads(iwad); D_AddCmdParameterFiles(); wadhashes = W_InitMultipleFiles (wadfiles); SV_InitMultipleFiles (wadfiles); // [RH] Initialize configurable strings. D_InitStrings (); D_DoDefDehackedPatch(); I_Init (); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks (); // [RH] User-configurable startup strings. Because BOOM does. if (STARTUP1[0]) Printf (PRINT_HIGH, "%s\n", STARTUP1); if (STARTUP2[0]) Printf (PRINT_HIGH, "%s\n", STARTUP2); if (STARTUP3[0]) Printf (PRINT_HIGH, "%s\n", STARTUP3); if (STARTUP4[0]) Printf (PRINT_HIGH, "%s\n", STARTUP4); if (STARTUP5[0]) Printf (PRINT_HIGH, "%s\n", STARTUP5); devparm = Args.CheckParm ("-devparm"); // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char *val = Args.CheckValue ("-skill"); if (val) { sv_skill.Set (val[0]-'0'); } if (devparm) Printf (PRINT_HIGH, "%s", Strings[0].builtin); // D_DEVSTR const char *v = Args.CheckValue ("-timer"); if (v) { double time = atof (v); Printf (PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); sv_timelimit.Set ((float)time); } const char *w = Args.CheckValue ("-avg"); if (w) { Printf (PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); sv_timelimit.Set (20); } // [RH] Now that all text strings are set up, // insert them into the level and cluster data. G_SetLevelStrings (); // [RH] Parse through all loaded mapinfo lumps G_ParseMapInfo (); // [RH] Parse any SNDINFO lumps S_ParseSndInfo(); // Check for -file in shareware if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_FatalError ("You cannot -file with the shareware version. Register!"); Printf (PRINT_HIGH, "R_Init: Init DOOM refresh daemon.\n"); R_Init (); Printf (PRINT_HIGH, "P_Init: Init Playloop state.\n"); P_Init (); Printf (PRINT_HIGH, "SV_InitNetwork: Checking network game status.\n"); SV_InitNetwork(); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-background")) daemon_init(); #endif // Use wads mentioned on the commandline to start with //std::vector<std::string> start_wads; //std::string custwad; //iwad = Args.CheckValue("-iwad"); //D_DoomWadReboot(start_wads); unsigned p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } strncpy(level.mapname, startmap, sizeof(level.mapname)); G_ChangeMap (); D_DoomLoop (); // never returns }
/* * This will be called when the dll is first loaded, * which only happens when a new game is started or * a save game is loaded. */ void InitGame (void) { gi.dprintf ("\n==== InitGame ====\n"); #ifdef Q2VR_ENGINE_MOD { int i; gi.dprintf("Initializing hash tables..."); for (i = 0; mmoveList[i].mmoveStr; i++) { mmoveList[i].mmoveHash = Hash32(mmoveList[i].mmoveStr, strlen(mmoveList[i].mmoveStr)); } for (i = 0; functionList[i].funcStr; i++) { functionList[i].funcHash = Hash32(functionList[i].funcStr, strlen(functionList[i].funcStr)); } gi.dprintf(" Done!\n"); } #endif gi.dprintf("Sorting tables..."); funcListSize = sizeof(functionList) / sizeof(functionList[0]) - 1; qsort(functionList,funcListSize, sizeof(functionList[0]), funcsort); mmoveListSize = (sizeof(mmoveList) / sizeof(mmoveList[0])) - 1; qsort(mmoveList,mmoveListSize, sizeof(mmoveList[0]), mmovesort); gi.dprintf(" Done!\n"); //Knightmare lithium_defaults(); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); sv_stopspeed = gi.cvar ("sv_stopspeed", "100", 0); // PGM - was #define in g_phys.c //ROGUE g_showlogic = gi.cvar ("g_showlogic", "0", 0); huntercam = gi.cvar ("huntercam", "1", CVAR_SERVERINFO|CVAR_LATCH); strong_mines = gi.cvar ("strong_mines", "0", 0); randomrespawn = gi.cvar ("randomrespawn", "0", 0); //ROGUE // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); gamedir = gi.cvar("gamedir","",CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); //Knightmare- increase maxentities //maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); maxentities = gi.cvar ("maxentities", va("%i",MAX_EDICTS), CVAR_LATCH); gamerules = gi.cvar ("gamerules", "0", CVAR_LATCH); //PGM // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // Lazarus actorchicken = gi.cvar("actorchicken", "1", CVAR_SERVERINFO|CVAR_LATCH); actorjump = gi.cvar("actorjump", "1", CVAR_SERVERINFO|CVAR_LATCH); actorscram = gi.cvar("actorscram", "1", CVAR_SERVERINFO|CVAR_LATCH); alert_sounds = gi.cvar("alert_sounds", "0", CVAR_ARCHIVE); allow_fog = gi.cvar ("allow_fog", "1", CVAR_ARCHIVE); // set to 0 to bypass target_changelevel clear inventory flag // because some user maps have this erroneously set allow_clear_inventory = gi.cvar ("allow_clear_inventory", "1", CVAR_ARCHIVE); cd_loopcount = gi.cvar("cd_loopcount","4",0); cl_gun = gi.cvar("cl_gun", "1", 0); cl_thirdperson = gi.cvar(CLIENT_THIRDPERSON_CVAR, "0", 0); // Knightmare added corpse_fade = gi.cvar("corpse_fade", "0", CVAR_ARCHIVE); corpse_fadetime = gi.cvar("corpse_fadetime", "20", CVAR_ARCHIVE); crosshair = gi.cvar("crosshair", "1", 0); footstep_sounds = gi.cvar("footstep_sounds", "0", CVAR_SERVERINFO|CVAR_LATCH); fov = gi.cvar("fov", "90", 0); hand = gi.cvar("hand", "0", 0); jetpack_weenie = gi.cvar("jetpack_weenie", "0", CVAR_SERVERINFO); joy_pitchsensitivity = gi.cvar("joy_pitchsensitivity", "1", 0); joy_yawsensitivity = gi.cvar("joy_yawsensitivity", "-1", 0); jump_kick = gi.cvar("jump_kick", "0", CVAR_SERVERINFO|CVAR_LATCH); lights = gi.cvar("lights", "1", 0); lightsmin = gi.cvar("lightsmin", "a", CVAR_SERVERINFO); m_pitch = gi.cvar("m_pitch", "0.022", 0); m_yaw = gi.cvar("m_yaw", "0.022", 0); monsterjump = gi.cvar("monsterjump", "1", CVAR_SERVERINFO|CVAR_LATCH); rocket_strafe = gi.cvar("rocket_strafe", "0", 0); #ifdef KMQUAKE2_ENGINE_MOD sv_maxgibs = gi.cvar("sv_maxgibs", "160", CVAR_SERVERINFO); #else sv_maxgibs = gi.cvar("sv_maxgibs", "20", CVAR_SERVERINFO); #endif turn_rider = gi.cvar("turn_rider", "1", CVAR_SERVERINFO); zoomrate = gi.cvar("zoomrate", "80", CVAR_ARCHIVE); zoomsnap = gi.cvar("zoomsnap", "20", CVAR_ARCHIVE); // shift_ and rotate_distance only used for debugging stuff - this is the distance // an entity will be moved by "item_left", "item_right", etc. shift_distance = gi.cvar("shift_distance", "1", CVAR_SERVERINFO); rotate_distance = gi.cvar("rotate_distance", "1", CVAR_SERVERINFO); // GL stuff gl_clear = gi.cvar("gl_clear", "0", 0); // Lazarus saved cvars that we may or may not manipulate, but need to // restore to original values upon map exit. lazarus_cd_loop = gi.cvar("lazarus_cd_loop", "0", 0); lazarus_gl_clear= gi.cvar("lazarus_gl_clear","0", 0); lazarus_pitch = gi.cvar("lazarus_pitch", "0", 0); lazarus_yaw = gi.cvar("lazarus_yaw", "0", 0); lazarus_joyp = gi.cvar("lazarus_joyp", "0", 0); lazarus_joyy = gi.cvar("lazarus_joyy", "0", 0); lazarus_cl_gun = gi.cvar("lazarus_cl_gun", "0", 0); lazarus_crosshair = gi.cvar("lazarus_crosshair", "0", 0); /*if(lazarus_gl_clear->value) gi.cvar_forceset("gl_clear", va("%d",lazarus_gl_clear->value)); else gi.cvar_forceset("lazarus_gl_clear", va("%d",gl_clear->value));*/ if(!deathmatch->value && !coop->value) { /*if(lazarus_pitch->value) { gi.cvar_forceset("cd_loopcount", va("%d",(int)(lazarus_cd_loop->value))); #ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity gi.cvar_forceset("m_pitch", va("%f",lazarus_pitch->value)); gi.cvar_forceset("m_yaw", va("%f",lazarus_yaw->value)); #endif //gi.cvar_forceset("cl_gun", va("%d",(int)(lazarus_cl_gun->value))); //gi.cvar_forceset("crosshair", va("%d",(int)(lazarus_crosshair->value))); } else {*/ gi.cvar_forceset("lazarus_cd_loop", va("%d",(int)(cd_loopcount->value))); #ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity gi.cvar_forceset("lazarus_pitch", va("%f",m_pitch->value)); gi.cvar_forceset("lazarus_yaw", va("%f",m_yaw->value)); gi.cvar_forceset("lazarus_joyp", va("%f",joy_pitchsensitivity->value)); gi.cvar_forceset("lazarus_joyy", va("%f",joy_yawsensitivity->value)); #endif gi.cvar_forceset("lazarus_cl_gun", va("%d",(int)(cl_gun->value))); gi.cvar_forceset("lazarus_crosshair", va("%d",(int)(crosshair->value))); //} } tpp = gi.cvar ("tpp", "0", CVAR_ARCHIVE); tpp_auto = gi.cvar ("tpp_auto", "1", 0); crossh = gi.cvar ("crossh", "1", 0); allow_download = gi.cvar("allow_download", "0", 0); // If this is an SP game and "readout" is not set, force allow_download off // so we don't get the annoying "Refusing to download path with .." messages // due to misc_actor sounds. if(allow_download->value && !readout->value && !deathmatch->value) gi.cvar_forceset("allow_download", "0"); bounce_bounce = gi.cvar("bounce_bounce", "0.5", 0); bounce_minv = gi.cvar("bounce_minv", "60", 0); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; g_clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); game.clients = g_clients; globals.num_edicts = game.maxclients+1; //====== //ROGUE if(gamerules) { InitGameRules(); // if there are game rules to set up, do so now. } //ROGUE //====== }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { IRC_init (); gi.dprintf ("==== InitGame ====\n"); ReadConfigFile (); ReadMOTDFile (); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__, CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH); deathmatch = gi.cvar ("deathmatch", "1", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); if (!deathmatch->value) { gi.dprintf("Turning deathmatch on.\n"); gi.cvar_forceset("deathmatch", "1"); } if (coop->value) { gi.dprintf("Turning coop off.\n"); gi.cvar_forceset("coop", "0"); } // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); capturelimit = gi.cvar ("capturelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); filterban = gi.cvar ("filterban", "1", 0); needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO); radiolog = gi.cvar ("radiolog", "0", 0); teamplay = gi.cvar ("teamplay", "0", CVAR_SERVERINFO | CVAR_LATCH); motd_time = gi.cvar ("motd_time", "2", 0); hostname = gi.cvar ("hostname", "unnamed", CVAR_SERVERINFO); strtwpn = gi.cvar ("dmweapon", MK23_NAME, 0); actionmaps = gi.cvar ("actionmaps", "1", 0); if (actionmaps->value && num_maps < 1) { gi.dprintf("No maps were read from the config file, \"actionmaps\" won't be used.\n"); gi.cvar_forceset("actionmaps", "0"); } nohud = gi.cvar ("nohud", "0", CVAR_LATCH); roundlimit = gi.cvar ("roundlimit", "0", CVAR_SERVERINFO); limchasecam = gi.cvar ("limchasecam", "0", CVAR_LATCH); skipmotd = gi.cvar ("skipmotd", "0", 0); roundtimelimit = gi.cvar ("roundtimelimit", "0", CVAR_SERVERINFO); maxteamkills = gi.cvar ("maxteamkills", "0", 0); twbanrounds = gi.cvar ("twbanrounds", "2", 0); tkbanrounds = gi.cvar ("tkbanrounds", "2", 0); noscore = gi.cvar ("noscore", "0", CVAR_LATCH); // Was serverinfo actionversion = gi.cvar ("actionversion", "none set", CVAR_SERVERINFO | CVAR_LATCH); gi.cvar_set ("actionversion", ACTION_VERSION); use_voice = gi.cvar ("use_voice", "1", 0); //slicer ppl_idletime = gi.cvar ("ppl_idletime", "15", 0); use_buggy_bandolier = gi.cvar ("use_buggy_bandolier", "0", 0); use_tourney = gi.cvar ("use_tourney", "0", CVAR_SERVERINFO | CVAR_LATCH); use_3teams = gi.cvar ("use_3teams", "0", CVAR_SERVERINFO | CVAR_LATCH); use_kickvote = gi.cvar ("use_kickvote", "1", 0); //slicer use_mapvote = gi.cvar ("use_mapvote", "1", 0); //slicer use_scramblevote = gi.cvar ("use_scramblevote", "1", 0); //slicer ctf = gi.cvar ("ctf", "0", CVAR_SERVERINFO | CVAR_LATCH); ctf_forcejoin = gi.cvar ("ctf_forcejoin", "", 0); ctf_mode = gi.cvar ("ctf_mode", "0", 0); ctf_dropflag = gi.cvar ("ctf_dropflag", "1", 0); ctf_respawn = gi.cvar ("ctf_respawn", "4", 0); ctf_model = gi.cvar ("ctf_model", "male", CVAR_LATCH); use_grapple = gi.cvar ("use_grapple", "0", 0); mv_public = gi.cvar ("mv_public", "0", 0); //slicer vk_public = gi.cvar ("vk_public", "0", 0); //slicer punishkills = gi.cvar ("punishkills", "1", 0); //slicer mapvote_waittime = gi.cvar ("mapvote_waittime", "8", 0); ff_afterround = gi.cvar ("ff_afterround", "1", 0); uvtime = gi.cvar ("uvtime", "40", 0); sv_gib = gi.cvar ("sv_gib", "1", 0); sv_crlf = gi.cvar ("sv_crlf", "0", CVAR_LATCH); // 0 == DONT ALLOW IT vrot = gi.cvar ("vrot", "0", 0); rrot = gi.cvar ("rrot", "0", 0); llsound = gi.cvar ("llsound", "1", CVAR_LATCH); use_cvote = gi.cvar ("use_cvote", "0", 0); // Removed it from Serverinfo new_irvision = gi.cvar ("new_irvision", "0", 0); use_rewards = gi.cvar ("use_rewards", "1", 0); use_warnings = gi.cvar ("use_warnings", "1", 0); check_time = gi.cvar ("check_time", "3", 0); video_check = gi.cvar ("video_check", "0", 0); video_max_3dfx = gi.cvar ("video_max_3dfx", "1.5", 0); video_max_3dfxam = gi.cvar ("video_max_3dfxam", "1.5", 0); video_max_opengl = gi.cvar ("video_max_opengl", "3.0", 0); video_force_restart = gi.cvar ("video_force_restart", "0", CVAR_LATCH); video_check_lockpvs = gi.cvar ("video_check_lockpvs", "0", 0); video_check_glclear = gi.cvar ("video_check_glclear", "0", 0); video_checktime = gi.cvar ("video_checktime", "15", 0); hc_single = gi.cvar ("hc_single", "1", CVAR_LATCH); //default ON wp_flags = gi.cvar ("wp_flags", "511", 0); // 511 = WPF_MK23 | WPF_MP5 | WPF_M4 | WPF_M3 | WPF_HC | WPF_SNIPER | WPF_DUAL | WPF_KNIFE | WPF_GRENADE itm_flags = gi.cvar ("itm_flags", "63", 0); // 63 = ITF_SIL | ITF_SLIP | ITF_BAND | ITF_KEV | ITF_LASER | ITF_HELM matchmode = gi.cvar ("matchmode", "0", CVAR_SERVERINFO | CVAR_LATCH); hearall = gi.cvar ("hearall", "0", 0); // used in matchmode teamdm = gi.cvar ("teamdm", "0", CVAR_LATCH); teamdm_respawn = gi.cvar ("teamdm_respawn", "2", 0); respawn_effect = gi.cvar("respawn_effect", "0", 0); item_respawnmode = gi.cvar ("item_respawnmode", "0", CVAR_LATCH); item_respawn = gi.cvar ("item_respawn", "59", 0); weapon_respawn = gi.cvar ("weapon_respawn", "74", 0); ammo_respawn = gi.cvar ("ammo_respawn", "30", 0); wave_time = gi.cvar("wave_time", "5", 0); mm_forceteamtalk = gi.cvar ("mm_forceteamtalk", "0", 0); mm_adminpwd = gi.cvar ("mm_adminpwd", "0", 0); mm_allowlock = gi.cvar ("mm_allowlock", "1", CVAR_LATCH); mm_pausecount = gi.cvar ("mm_allowcount", "3", CVAR_LATCH); mm_pausetime = gi.cvar ("mm_pausetime", "2", CVAR_LATCH); teams[TEAM1].teamscore = gi.cvar ("t1", "0", CVAR_SERVERINFO); teams[TEAM2].teamscore = gi.cvar ("t2", "0", CVAR_SERVERINFO); teams[TEAM3].teamscore = gi.cvar ("t3", "0", CVAR_SERVERINFO); stats_endmap = gi.cvar("stats_endmap", "1",0); stats_afterround = gi.cvar ("stats_afterround", "0", 0); auto_join = gi.cvar ("auto_join", "0", 0); auto_equip = gi.cvar ("auto_equip", "0", 0); auto_menu = gi.cvar ("auto_menu", "0", 0); eventeams = gi.cvar ("eventeams", "0", 0); use_balancer = gi.cvar ("use_balancer", "0", 0); dm_choose = gi.cvar ("dm_choose", "0", 0); dm_shield = gi.cvar ("dm_shield", "0", 0); use_punch = gi.cvar ("use_punch", "1", 0); //TNG:Freud - new spawning system use_oldspawns = gi.cvar ("use_oldspawns", "0", CVAR_LATCH); //TNG:Freud - ghosts use_ghosts = gi.cvar ("use_ghosts", "0", CVAR_LATCH); radio_max = gi.cvar ("radio_max", "3", 0); radio_time = gi.cvar ("radio_time", "2", 0); radio_ban = gi.cvar ("radio_ban", "15", 0); //SLIC2 radio_repeat_time = gi.cvar ("radio_repeat_time", "1", 0); radio_repeat = gi.cvar ("radio_repeat", "2", 0); unique_weapons = gi.cvar ("weapons", teamplay->value ? "1" : "1", CVAR_SERVERINFO | CVAR_LATCH); // zucc changed teamplay to 1 unique_items = gi.cvar ("items", "1", CVAR_SERVERINFO | CVAR_LATCH); ir = gi.cvar ("ir", "1", 0); knifelimit = gi.cvar ("knifelimit", "40", 0); allweapon = gi.cvar ("allweapon", "0", CVAR_SERVERINFO); allitem = gi.cvar ("allitem", "0", CVAR_SERVERINFO); tgren = gi.cvar ("tgren", "0", CVAR_SERVERINFO); //SLIC2 /*flashgren = gi.cvar ("flashgren", "1", 0); flashradius = gi.cvar ("flashradius", "300", 0); flashtime = gi.cvar ("flashtime", "100", 0);*/ //SLIC2 sv_shelloff = gi.cvar ("shelloff", "1", 0); bholelimit = gi.cvar ("bholelimit", "0", 0); splatlimit = gi.cvar ("splatlimit", "0", 0); darkmatch = gi.cvar ("darkmatch", "0", CVAR_LATCH); // Darkmatch day_cycle = gi.cvar ("day_cycle", "10", 0); // Darkmatch cycle time. use_classic = gi.cvar ("use_classic", "0", CVAR_SERVERINFO); // Reset Spread and Grenade Strength to 1.52 CGF_SFX_InstallGlassSupport (); // william for CGF (glass fx) g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // items InitItems (); game.helpmessage1[0] = '\0'; game.helpmessage2[0] = '\0'; // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof (g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = (int)maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof (game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients + 1; if (ctf->value) CTFInit (); //PG BUND - must be at end of gameinit: vInitGame (); }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame ====\n"); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // NeVo - 3.22 cvars g_diesink = gi.cvar ("g_diesink", "0", CVAR_ARCHIVE); cl_weapmaxfov = gi.cvar ("cl_weapmaxfov", "120", CVAR_ARCHIVE); // Mmm... hacky g_respawnprotect = gi.cvar ("g_respawnprotect", "1", CVAR_ARCHIVE); g_corpsegore = gi.cvar ("g_corpsegore", "1", CVAR_ARCHIVE); g_autoplayerid = gi.cvar ("g_autoplayerid", "1", CVAR_ARCHIVE); g_grenadeshrapnel = gi.cvar ("g_grenadeshrapnel", "0", CVAR_ARCHIVE); g_impulselog = gi.cvar ("g_impulselog", "1", CVAR_ARCHIVE); g_impulsekick = gi.cvar ("g_impulsekick", "1", CVAR_ARCHIVE); g_rocketjump = gi.cvar ("g_rocketjump", "1", CVAR_ARCHIVE); g_smartdamage = gi.cvar ("g_smartdamage", "1", CVAR_ARCHIVE); g_dmscoreboardmode = gi.cvar ("g_dmscoreboardmode", "1", CVAR_ARCHIVE); g_cooperativeexit = gi.cvar ("g_cooperativeexit", "1", CVAR_ARCHIVE); r_fogdensity = gi.cvar ("r_fogdensity", "0.23", NULL); // NeVo - goddamn hack (fix this shit for Berlin, lightlevel too) g_grenadehack = gi.cvar ("g_grenadehack", "-0.06", CVAR_ARCHIVE); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; }
// // D_DoomMain // void D_DoomMain (void) { unsigned p; const char *iwad; extern std::string defdemoname; M_ClearRandom(); gamestate = GS_STARTUP; SetLanguageIDs (); M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError ("Could not initialize LZO routines"); C_ExecCmdLineParams (false, true); // [Nes] test for +logfile command Printf (PRINT_HIGH, "Heapsize: %u megabytes\n", got_heapsize); M_LoadDefaults (); // load before initing other systems C_ExecCmdLineParams (true, false); // [RH] do all +set commands on the command line iwad = Args.CheckValue("-iwad"); if(!iwad) iwad = ""; D_AddDefWads(iwad); D_AddCmdParameterFiles(); wadhashes = W_InitMultipleFiles (wadfiles); // [RH] Initialize localizable strings. GStrings.LoadStrings (W_GetNumForName ("LANGUAGE"), STRING_TABLE_SIZE, false); GStrings.Compact (); // [RH] Initialize configurable strings. //D_InitStrings (); D_DoDefDehackedPatch (); // [RH] Moved these up here so that we can do most of our // startup output in a fullscreen console. HU_Init (); I_Init (); V_Init (); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks (); // [RH] User-configurable startup strings. Because BOOM does. if (GStrings(STARTUP1)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP1)); if (GStrings(STARTUP2)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP2)); if (GStrings(STARTUP3)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP3)); if (GStrings(STARTUP4)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP4)); if (GStrings(STARTUP5)[0]) Printf (PRINT_HIGH, "%s\n", GStrings(STARTUP5)); // Nomonsters sv_nomonsters = Args.CheckParm("-nomonsters"); // Respawn sv_monstersrespawn = Args.CheckParm("-respawn"); // Fast sv_fastmonsters = Args.CheckParm("-fast"); // developer mode devparm = Args.CheckParm ("-devparm"); // Record a vanilla demo p = Args.CheckParm ("-record"); if (p) { autorecord = true; autostart = true; demorecordfile = Args.GetArg (p+1); } // get skill / episode / map from parms strcpy (startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); // Check for -playdemo, play a single demo then quit. p = Args.CheckParm ("-playdemo"); // Hack to check for +playdemo command, since if you just add it normally // it won't run because it's attempting to run a demo and still set up the // first map as normal. if (!p) p = Args.CheckParm ("+playdemo"); if (p && p < Args.NumArgs()-1) { Printf (PRINT_HIGH, "Playdemo parameter found on command line.\n"); singledemo = true; defdemoname = Args.GetArg (p+1); } const char *val = Args.CheckValue ("-skill"); if (val) { sv_skill.Set (val[0]-'0'); } p = Args.CheckParm ("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi (Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy (startmap, CalcMapName (ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm ("+map"); if (p && p < Args.NumArgs()-1) { strncpy (startmap, Args.GetArg (p+1), 8); ((char *)Args.GetArg (p))[0] = '-'; autostart = true; } if (devparm) Printf (PRINT_HIGH, "%s", GStrings(D_DEVSTR)); // D_DEVSTR // [RH] Now that all text strings are set up, // insert them into the level and cluster data. G_SetLevelStrings (); // [RH] Parse through all loaded mapinfo lumps G_ParseMapInfo (); // [ML] Parse musinfo lump G_ParseMusInfo (); // [RH] Parse any SNDINFO lumps S_ParseSndInfo(); // Check for -file in shareware if (modifiedgame && (gameinfo.flags & GI_SHAREWARE)) I_Error ("You cannot -file with the shareware version. Register!"); #ifdef WIN32 const char *sdlv = getenv("SDL_VIDEODRIVER"); Printf (PRINT_HIGH, "Using %s video driver.\n",sdlv); #endif Printf (PRINT_HIGH, "M_Init: Init miscellaneous info.\n"); M_Init (); Printf (PRINT_HIGH, "R_Init: Init DOOM refresh daemon.\n"); R_Init (); Printf (PRINT_HIGH, "P_Init: Init Playloop state.\n"); P_InitEffects(); // [ML] Do this here so we don't have to put particle crap in server P_Init (); Printf (PRINT_HIGH, "S_Init: Setting up sound.\n"); Printf (PRINT_HIGH, "S_Init: default sfx volume is %g\n", (float)snd_sfxvolume); Printf (PRINT_HIGH, "S_Init: default music volume is %g\n", (float)snd_musicvolume); S_Init (snd_sfxvolume, snd_musicvolume); I_FinishClockCalibration (); Printf (PRINT_HIGH, "D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame (); Printf (PRINT_HIGH, "ST_Init: Init status bar.\n"); ST_Init (); // [RH] Initialize items. Still only used for the give command. :-( InitItems (); // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet (); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams (false, false); Printf_Bold("\n\35\36\36\36\36 Odamex Client Initialized \36\36\36\36\37\n"); if(gamestate != GS_CONNECTING) Printf(PRINT_HIGH, "Type connect <address> or use the Odamex Launcher to connect to a game.\n"); Printf(PRINT_HIGH, "\n"); setmodeneeded = false; // [Fly] we don't need to set a video mode here! //gamestate = GS_FULLCONSOLE; // [SL] allow the user to pass the name of a netdemo as the first argument. // This allows easy launching of netdemos from Windows Explorer or other GUIs. // [Xyltol] if (Args.GetArg(1)) { std::string demoarg = Args.GetArg(1); if (demoarg.find(".odd") != std::string::npos) CL_NetDemoPlay(demoarg); } p = Args.CheckParm("-netplay"); if (p) { if (Args.GetArg(p + 1)) { std::string filename = Args.GetArg(p + 1); CL_NetDemoPlay(filename); } else { Printf(PRINT_HIGH, "No netdemo filename specified.\n"); } } // denis - bring back the demos if ( gameaction != ga_loadgame ) { if (autostart || netgame || singledemo) { if (singledemo) G_DoPlayDemo(); else { if(autostart) { // single player warp (like in g_level) serverside = true; sv_allowexit = "1"; sv_freelook = "1"; sv_allowjump = "1"; sv_allowredscreen = "1"; sv_gametype = GM_COOP; players.clear(); players.push_back(player_t()); players.back().playerstate = PST_REBORN; consoleplayer_id = displayplayer_id = players.back().id = 1; } G_InitNew (startmap); if (autorecord) if (G_RecordDemo(demorecordfile.c_str())) G_BeginRecording(); } } else { if (gamestate != GS_CONNECTING) gamestate = GS_HIDECONSOLE; C_ToggleConsole(); D_StartTitle (); // start up intro loop } } // denis - this will run a demo and quit p = Args.CheckParm ("+demotest"); if (p && p < Args.NumArgs()-1) { demotest = 1; defdemoname = Args.GetArg (p+1); G_DoPlayDemo(); while(demoplayback) { DObject::BeginFrame (); G_Ticker(); DObject::EndFrame (); gametic++; } } else { demotest = 0; D_DoomLoop (); // never returns } }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame ====\n"); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); sv_stopspeed = gi.cvar ("sv_stopspeed", "100", 0); // PGM - was #define in g_phys.c //ROGUE g_showlogic = gi.cvar ("g_showlogic", "0", 0); huntercam = gi.cvar ("huntercam", "1", CVAR_SERVERINFO|CVAR_LATCH); strong_mines = gi.cvar ("strong_mines", "0", 0); randomrespawn = gi.cvar ("randomrespawn", "0", 0); //ROGUE // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); gamerules = gi.cvar ("gamerules", "0", CVAR_LATCH); //PGM // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; //====== //ROGUE if(gamerules) { InitGameRules(); // if there are game rules to set up, do so now. } //ROGUE //====== }
/* * This will be called when the dll is first loaded, * which only happens when a new game is started or * a save game is loaded. */ void InitGame(void) { gi.dprintf(DEVELOPER_MSG_SAVE, "Game is starting up.\n"); gi.dprintf(DEVELOPER_MSG_SAVE, "Game is %s built on %s.\n", GAMEVERSION, __DATE__); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", va("%i",MAX_EDICTS), CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); zdmflags = gi.cvar ("zdmflags", "0", CVAR_SERVERINFO); /* FS: Zaero specific game dll changes */ fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); /* flood control */ flood_msgs = gi.cvar("flood_msgs", "4", 0); flood_persecond = gi.cvar("flood_persecond", "4", 0); flood_waitdelay = gi.cvar("flood_waitdelay", "10", 0); // items InitItems (); game.helpmessage1[0] = 0; game.helpmessage2[0] = 0; // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; }
void InitGame (void) { int i; #ifdef _DEBUG _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG ); // _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG ); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF |_CRTDBG_CHECK_ALWAYS_DF // |_CRTDBG_CHECK_CRT_DF |_CRTDBG_LEAK_CHECK_DF); gi.dprintf ("!!!! DEBUGGING !!!! \n"); #endif gi.dprintf ("==== InitGame ====\n"); srand( (unsigned)time( NULL ) ); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "0", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); no_spec = gi.cvar ("no_spec", "0", 0); no_shadows = gi.cvar ("no_shadows", "0", 0); no_zoom = gi.cvar ("no_zoom", "0", 0); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); // deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); // coop = gi.cvar ("coop", "0", CVAR_LATCH); // JOSEPH 16-OCT-98 maxentities = gi.cvar ("maxentities", /*"1024"*/"2048", CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO|CVAR_ARCHIVE); fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO); timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); filterban = gi.cvar ("filterban", "1", 0); antilag = gi.cvar("antilag", "1", CVAR_SERVERINFO); props = gi.cvar("props", "0", 0); bonus = gi.cvar("bonus", "0", 0); if (kpded2 && (int)gi.cvar("sv_uptime", "0", 0)->value) { // kpded2's uptime status is enabled, so disable ours starttime = 0; } else { char buf[20]; Com_sprintf(buf, sizeof(buf), "%d", time(NULL)); starttime = atoi(gi.cvar("starttime", buf, 0)->string); gi.cvar("uptime", "", CVAR_SERVERINFO); } g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); kick_flamehack = gi.cvar ("kick_flamehack", "1", CVAR_SERVERINFO); anti_spawncamp = gi.cvar ("anti_spawncamp", "1", 0); idle_client = gi.cvar("idle_client", "120", 0); // Ridah, new cvar's developer = gi.cvar ("developer", "0", 0); g_vehicle_test = gi.cvar ("g_vehicle_test", "0", CVAR_LATCH); // Enables Hovercars for all players dm_locational_damage = gi.cvar ("dm_locational_damage", "0", 0); showlights = gi.cvar ("showlights", "0", 0); timescale = gi.cvar("timescale", "1.0", 0); // speed hack fix gi.cvar_set("sv_enforcetime", "1"); teamplay = gi.cvar("teamplay", "0", CVAR_LATCH|CVAR_SERVERINFO); if (teamplay->value != 0 && teamplay->value != 1 && teamplay->value != 4) gi.cvar_set("teamplay", "1"); cashlimit = gi.cvar ("cashlimit", "0", teamplay->value == 1 ? CVAR_SERVERINFO : 0); g_cashspawndelay = gi.cvar("g_cashspawndelay", "5", CVAR_ARCHIVE|CVAR_LATCH); dm_realmode = gi.cvar( "dm_realmode", "0", CVAR_LATCH|CVAR_SERVERINFO); g_mapcycle_file = gi.cvar( "g_mapcycle_file", "", 0); // Ridah, done. // snap - team tags gi.cvar(TEAMNAME, "", CVAR_SERVERINFO); gi.cvar_set(TEAMNAME, ""); gi.cvar(SCORENAME, "", CVAR_SERVERINFO); gi.cvar_set(SCORENAME, ""); // the "rconx serverinfo" command needs this to be the final serverinfo cvar gi.cvar(TIMENAME, "", CVAR_SERVERINFO); gi.cvar_set(TIMENAME, ""); // items InitItems (); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; // disable single player and co-op modes gi.cvar_set("deathmatch", "1"); gi.cvar_set("coop", "0"); i = proccess_ini_file(); if (i != OK) gi.dprintf("Error opening comp ini file\n"); else gi.dprintf("Processed comp.ini file\n"); if (!map_list_filename[0]) strcpy(map_list_filename, g_mapcycle_file->string); if (map_list_filename[0]) { i = read_map_file(); if (i != OK) gi.dprintf("Error opening map list file (%s)\n", map_list_filename); else gi.dprintf("Processed map list file (%s)\n", map_list_filename); } if (!num_maps) allow_map_voting = false; cmd_check[0] = '\176'; for (i=1; i<7; i++) cmd_check[i] = 'A'+(rand()%26)+(rand()&32); cmd_check[i] = 0; // load & initialize GeoIP library if (!disable_geoip) { #ifdef _WIN32 HINSTANCE libgeoip = LoadLibrary("GeoIP"); #else void *libgeoip = dlopen("libGeoIP.so.1", RTLD_LAZY|RTLD_LOCAL); #endif if (libgeoip) { void* (*_GeoIP_new)(int flags); #ifdef _WIN32 *(void**)&_GeoIP_new = GetProcAddress(libgeoip, "GeoIP_new"); *(void**)&_GeoIP_delete = GetProcAddress(libgeoip, "GeoIP_delete"); *(void**)&_GeoIP_country_name_by_addr = GetProcAddress(libgeoip, "GeoIP_country_name_by_addr"); #else _GeoIP_new = dlsym(libgeoip, "GeoIP_new"); _GeoIP_delete = dlsym(libgeoip, "GeoIP_delete"); _GeoIP_country_name_by_addr = dlsym(libgeoip, "GeoIP_country_name_by_addr"); #endif geoip = _GeoIP_new(0); if (!geoip) { #ifdef _WIN32 FreeLibrary(libgeoip); #else dlclose(libgeoip); #endif gi.dprintf("Failed to load GeoIP database\n"); } else gi.dprintf("Loaded GeoIP database\n"); } } if (kpded2) { /* enable kpded2 features: GMF_CLIENTPOV - improved eyecam chase mode GMF_CLIENTTEAM - team info in server browsers GMF_CLIENTNOENTS - removes everything when spectating is disabled GMF_WANT_ALL_DISCONNECTS - cancelled connection notifications */ char buf[10]; sprintf(buf, "%d", GMF_CLIENTPOV | GMF_CLIENTNOENTS | GMF_WANT_ALL_DISCONNECTS | (teamplay->value ? GMF_CLIENTTEAM : 0)); gi.cvar_forceset("g_features", buf); } }
/* ============ InitGame This will be called when the dll is first loaded, which only happens when a new game is started or a save game is loaded. ============ */ void InitGame (void) { gi.dprintf ("==== InitGame ====\n"); gi.dprintf ("Chicken Scheme Init\n"); Chicken_Start(); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0); gun_z = gi.cvar ("gun_z", "0", 0); //FIXME: sv_ prefix is wrong for these sv_rollspeed = gi.cvar ("sv_rollspeed", "200", 0); sv_rollangle = gi.cvar ("sv_rollangle", "2", 0); sv_maxvelocity = gi.cvar ("sv_maxvelocity", "2000", 0); sv_gravity = gi.cvar ("sv_gravity", "800", 0); // noset vars dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET); // latched vars sv_cheats = gi.cvar ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); gi.cvar ("gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_LATCH); gi.cvar ("gamedate", __DATE__ , CVAR_SERVERINFO | CVAR_LATCH); maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH); maxspectators = gi.cvar ("maxspectators", "4", CVAR_SERVERINFO); deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH); coop = gi.cvar ("coop", "0", CVAR_LATCH); skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); // change anytime vars dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO); password = gi.cvar ("password", "", CVAR_USERINFO); spectator_password = gi.cvar ("spectator_password", "", CVAR_USERINFO); needpass = gi.cvar ("needpass", "0", CVAR_SERVERINFO); filterban = gi.cvar ("filterban", "1", 0); g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE); run_pitch = gi.cvar ("run_pitch", "0.002", 0); run_roll = gi.cvar ("run_roll", "0.005", 0); bob_up = gi.cvar ("bob_up", "0.005", 0); bob_pitch = gi.cvar ("bob_pitch", "0.002", 0); bob_roll = gi.cvar ("bob_roll", "0.002", 0); // flood control flood_msgs = gi.cvar ("flood_msgs", "4", 0); flood_persecond = gi.cvar ("flood_persecond", "4", 0); flood_waitdelay = gi.cvar ("flood_waitdelay", "10", 0); // dm map list sv_maplist = gi.cvar ("sv_maplist", "", 0); // items InitItems (); Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), ""); Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), ""); // initialize all entities for this game game.maxentities = maxentities->value; g_edicts = gi.TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME); globals.edicts = g_edicts; globals.max_edicts = game.maxentities; // initialize all clients for this game game.maxclients = maxclients->value; game.clients = gi.TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME); globals.num_edicts = game.maxclients+1; }
// // D_DoomMain // // [NightFang] - Cause I cant call ArgsSet from g_level.cpp // [ML] 23/1/07 - Add Response file support back in // void D_DoomMain() { unsigned int p; gamestate = GS_STARTUP; // init console so it can capture all of the startup messages C_InitConsole(); atterm(C_ShutdownConsole); W_SetupFileIdentifiers(); // [RH] Initialize items. Still only used for the give command. :-( InitItems(); M_FindResponseFile(); // [ML] 23/1/07 - Add Response file support back in if (lzo_init () != LZO_E_OK) // [RH] Initialize the minilzo package. I_FatalError("Could not initialize LZO routines"); C_ExecCmdLineParams(false, true); // [Nes] test for +logfile command // Always log by default if (!LOG.is_open()) C_DoCommand("logfile"); M_LoadDefaults(); // load before initing other systems C_ExecCmdLineParams(true, false); // [RH] do all +set commands on the command line std::vector<std::string> newwadfiles, newpatchfiles; const char* iwad_filename_cstr = Args.CheckValue("-iwad"); if (iwad_filename_cstr) { std::string iwad_filename(iwad_filename_cstr); M_AppendExtension(iwad_filename, ".WAD"); newwadfiles.push_back(iwad_filename); } D_AddWadCommandLineFiles(newwadfiles); D_AddDehCommandLineFiles(newpatchfiles); D_LoadResourceFiles(newwadfiles, newpatchfiles); Printf(PRINT_HIGH, "I_Init: Init hardware.\n"); I_Init(); // [SL] Call init routines that need to be reinitialized every time WAD changes D_Init(); atterm(D_Shutdown); Printf(PRINT_HIGH, "SV_InitNetwork: Checking network game status.\n"); SV_InitNetwork(); // Base systems have been inited; enable cvar callbacks cvar_t::EnableCallbacks(); // [RH] User-configurable startup strings. Because BOOM does. if (GStrings(STARTUP1)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP1)); if (GStrings(STARTUP2)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP2)); if (GStrings(STARTUP3)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP3)); if (GStrings(STARTUP4)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP4)); if (GStrings(STARTUP5)[0]) Printf(PRINT_HIGH, "%s\n", GStrings(STARTUP5)); // developer mode devparm = Args.CheckParm("-devparm"); if (devparm) Printf (PRINT_HIGH, "%s", GStrings(D_DEVSTR)); // D_DEVSTR // Nomonsters if (Args.CheckParm("-nomonsters")) sv_nomonsters = 1; // Respawn if (Args.CheckParm("-respawn")) sv_monstersrespawn = 1; // Fast if (Args.CheckParm("-fast")) sv_fastmonsters = 1; // get skill / episode / map from parms strcpy(startmap, (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1"); const char* val = Args.CheckValue("-skill"); if (val) sv_skill.Set(val[0] - '0'); p = Args.CheckParm("-timer"); if (p && p < Args.NumArgs() - 1) { float time = atof(Args.GetArg(p + 1)); Printf(PRINT_HIGH, "Levels will end after %g minute%s.\n", time, time > 1 ? "s" : ""); sv_timelimit.Set(time); } if (Args.CheckValue("-avg")) { Printf(PRINT_HIGH, "Austin Virtual Gaming: Levels will end after 20 minutes\n"); sv_timelimit.Set(20); } // [RH] Lock any cvars that should be locked now that we're // about to begin the game. cvar_t::EnableNoSet(); // [RH] Now that all game subsystems have been initialized, // do all commands on the command line other than +set C_ExecCmdLineParams(false, false); // [AM] Initialize banlist SV_InitBanlist(); Printf(PRINT_HIGH, "========== Odamex Server Initialized ==========\n"); #ifdef UNIX if (Args.CheckParm("-fork")) daemon_init(); #endif p = Args.CheckParm("-warp"); if (p && p < Args.NumArgs() - (1+(gameinfo.flags & GI_MAPxx ? 0 : 1))) { int ep, map; if (gameinfo.flags & GI_MAPxx) { ep = 1; map = atoi(Args.GetArg(p+1)); } else { ep = Args.GetArg(p+1)[0]-'0'; map = Args.GetArg(p+2)[0]-'0'; } strncpy(startmap, CalcMapName(ep, map), 8); autostart = true; } // [RH] Hack to handle +map p = Args.CheckParm("+map"); if (p && p < Args.NumArgs() - 1) { strncpy(startmap, Args.GetArg(p + 1), 8); ((char*)Args.GetArg(p))[0] = '-'; autostart = true; } strncpy(level.mapname, startmap, sizeof(level.mapname)); G_ChangeMap(); D_DoomLoop(); // never returns }