private void Init() { _world = idE.RenderSystem.CreateRenderWorld(); _needsRender.Set(true); _lightOrigin.Set(new Vector4(-128.0f, 0.0f, 0.0f, 1.0f)); _lightColor.Set(new Vector4(1.0f, 1.0f, 1.0f, 1.0f)); _modelOrigin.Set(Vector4.Zero); _viewOffset.Set(new Vector4(-128.0f, 0.0f, 0.0f, 1.0f)); //_modelAnimation = null; _animationLength = 0; _animationEndTime = -1; //modelDef = -1; _updateAnimation = true; }
/// <summary> /// Loads a map and spawns all the entities. /// </summary> /// <param name="mapName"></param> /// <param name="renderWorld"></param> /// <param name="soundWorld"></param> /// <param name="isServer"></param> /// <param name="isClient"></param> /// <param name="randSeed"></param> public abstract void InitFromNewMap(string mapName, idRenderWorld renderWorld, idSoundWorld soundWorld, bool isServer, bool isClient, int randSeed);
public override void InitFromNewMap(string mapName, idRenderWorld renderWorld, idSoundWorld soundWorld, bool isServer, bool isClient, int randomSeed) { idConsole.DeveloperWriteLine("InitFromNewMap"); _isServer = isServer; _isClient = isClient; _isMultiplayer = isServer || isClient; if(_currentMapFileName != null) { idConsole.Warning("TODO: MapShutdown"); // TODO: MapShutdown(); } idConsole.WriteLine("----------- Game Map Init ------------"); _gameState = GameState.Startup; _currentRenderWorld = renderWorld; _currentSoundWorld = soundWorld; LoadMap(mapName, randomSeed); idConsole.Warning("TODO: InitScriptForMap"); // TODO: InitScriptForMap(); MapPopulate(); _gameRules.Reset(); _gameRules.Precache(); // free up any unused animations // TODO: animationLib.FlushUnusedAnims(); _gameState = GameState.Active; idConsole.WriteLine("--------------------------------------"); }
/// <summary> /// Called in an orderly fashion at system startup, so commands, cvars, files, etc are all available. /// </summary> public void Init() { idConsole.WriteLine("-------- Initializing Session --------"); // TODO: commands /*cmdSystem->AddCommand( "writePrecache", Sess_WritePrecache_f, CMD_FL_SYSTEM|CMD_FL_CHEAT, "writes precache commands" ); #ifndef ID_DEDICATED*/ idE.CmdSystem.AddCommand("map", "loads a map", CommandFlags.System, Cmd_Map /* TODO: idCmdSystem::ArgCompletion_MapName*/); /*cmdSystem->AddCommand( "devmap", Session_DevMap_f, CMD_FL_SYSTEM, "loads a map in developer mode", idCmdSystem::ArgCompletion_MapName ); cmdSystem->AddCommand( "testmap", Session_TestMap_f, CMD_FL_SYSTEM, "tests a map", idCmdSystem::ArgCompletion_MapName ); cmdSystem->AddCommand( "writeCmdDemo", Session_WriteCmdDemo_f, CMD_FL_SYSTEM, "writes a command demo" ); cmdSystem->AddCommand( "playCmdDemo", Session_PlayCmdDemo_f, CMD_FL_SYSTEM, "plays back a command demo" ); cmdSystem->AddCommand( "timeCmdDemo", Session_TimeCmdDemo_f, CMD_FL_SYSTEM, "times a command demo" ); cmdSystem->AddCommand( "exitCmdDemo", Session_ExitCmdDemo_f, CMD_FL_SYSTEM, "exits a command demo" ); cmdSystem->AddCommand( "aviCmdDemo", Session_AVICmdDemo_f, CMD_FL_SYSTEM, "writes AVIs for a command demo" ); cmdSystem->AddCommand( "aviGame", Session_AVIGame_f, CMD_FL_SYSTEM, "writes AVIs for the current game" ); cmdSystem->AddCommand( "recordDemo", Session_RecordDemo_f, CMD_FL_SYSTEM, "records a demo" ); cmdSystem->AddCommand( "stopRecording", Session_StopRecordingDemo_f, CMD_FL_SYSTEM, "stops demo recording" ); cmdSystem->AddCommand( "playDemo", Session_PlayDemo_f, CMD_FL_SYSTEM, "plays back a demo", idCmdSystem::ArgCompletion_DemoName ); cmdSystem->AddCommand( "timeDemo", Session_TimeDemo_f, CMD_FL_SYSTEM, "times a demo", idCmdSystem::ArgCompletion_DemoName ); cmdSystem->AddCommand( "timeDemoQuit", Session_TimeDemoQuit_f, CMD_FL_SYSTEM, "times a demo and quits", idCmdSystem::ArgCompletion_DemoName ); cmdSystem->AddCommand( "aviDemo", Session_AVIDemo_f, CMD_FL_SYSTEM, "writes AVIs for a demo", idCmdSystem::ArgCompletion_DemoName ); cmdSystem->AddCommand( "compressDemo", Session_CompressDemo_f, CMD_FL_SYSTEM, "compresses a demo file", idCmdSystem::ArgCompletion_DemoName ); #endif cmdSystem->AddCommand( "disconnect", Session_Disconnect_f, CMD_FL_SYSTEM, "disconnects from a game" ); cmdSystem->AddCommand( "demoShot", Session_DemoShot_f, CMD_FL_SYSTEM, "writes a screenshot for a demo" ); cmdSystem->AddCommand( "testGUI", Session_TestGUI_f, CMD_FL_SYSTEM, "tests a gui" ); #ifndef ID_DEDICATED cmdSystem->AddCommand( "saveGame", SaveGame_f, CMD_FL_SYSTEM|CMD_FL_CHEAT, "saves a game" ); cmdSystem->AddCommand( "loadGame", LoadGame_f, CMD_FL_SYSTEM|CMD_FL_CHEAT, "loads a game", idCmdSystem::ArgCompletion_SaveGame ); #endif cmdSystem->AddCommand( "takeViewNotes", TakeViewNotes_f, CMD_FL_SYSTEM, "take notes about the current map from the current view" ); cmdSystem->AddCommand( "takeViewNotes2", TakeViewNotes2_f, CMD_FL_SYSTEM, "extended take view notes" ); cmdSystem->AddCommand( "rescanSI", Session_RescanSI_f, CMD_FL_SYSTEM, "internal - rescan serverinfo cvars and tell game" ); cmdSystem->AddCommand( "promptKey", Session_PromptKey_f, CMD_FL_SYSTEM, "prompt and sets the CD Key" ); cmdSystem->AddCommand( "hitch", Session_Hitch_f, CMD_FL_SYSTEM|CMD_FL_CHEAT, "hitches the game" );*/ // the same idRenderWorld will be used for all games // and demos, insuring that level specific models // will be freed _renderWorld = idE.RenderSystem.CreateRenderWorld(); idConsole.Warning("TODO: init sound"); /*sw = soundSystem->AllocSoundWorld( rw ); menuSoundWorld = soundSystem->AllocSoundWorld( rw );*/ // we have a single instance of the main menu _guiMainMenu = idE.UIManager.FindInterface("guis/mainmenu.gui", true, false, true); idConsole.Warning("TODO: map list"); /*guiMainMenu_MapList = uiManager->AllocListGUI(); guiMainMenu_MapList->Config(guiMainMenu, "mapList"); idAsyncNetwork::client.serverList.GUIConfig(guiMainMenu, "serverList");*/ _guiRestartMenu = idE.UIManager.FindInterface("guis/restart.gui", true, false, true); _guiGameOver = idE.UIManager.FindInterface("guis/gameover.gui", true, false, true); _guiMsg = idE.UIManager.FindInterface("guis/msg.gui", true, false, true); _guiTakeNotes = idE.UIManager.FindInterface("guis/takeNotes.gui", true, false, true); _guiIntro = idE.UIManager.FindInterface("guis/intro.gui", true, false, true); _whiteMaterial = idE.DeclManager.FindMaterial("_white"); idConsole.WriteLine("session initialized"); idConsole.WriteLine("--------------------------------------"); }
/// <summary> /// Creates a new renderWorld to be used for drawing. /// </summary> /// <returns></returns> public idRenderWorld CreateRenderWorld() { idRenderWorld world = new idRenderWorld(); _worlds.Add(world); return world; }
private void Clear() { _frameCount = 0; _viewCount = 0; _staticAllocCount = 0; _frameShaderTime = 0; _viewPortOffset = Vector2.Zero; _tiledViewPort = Vector2.Zero; _ambientLightVector = Vector4.Zero; _sortOffset = 0; _worlds.Clear(); _primaryRenderWorld = null; _primaryView = null; _primaryRenderView = new idRenderView(); _defaultMaterial = null; /* testImage = NULL; ambientCubeImage = NULL;*/ _viewDefinition = null; /*memset( &pc, 0, sizeof( pc ) ); memset( &lockSurfacesCmd, 0, sizeof( lockSurfacesCmd ) );*/ _identitySpace = new ViewEntity(); /*logFile = NULL;*/ _renderCrops = new idRectangle[idE.MaxRenderCrops]; _currentRenderCrop = 0; _guiRecursionLevel = 0; _guiModel = null; /*demoGuiModel = NULL; memset( gammaTable, 0, sizeof( gammaTable ) ); takingScreenshot = false;*/ }