Pyrogenesis  trunk
Macros | Functions | Variables
GameSetup.cpp File Reference
#include "precompiled.h"
#include "lib/app_hooks.h"
#include "lib/config2.h"
#include "lib/input.h"
#include "lib/ogl.h"
#include "lib/timer.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/file/common/file_stats.h"
#include "lib/res/h_mgr.h"
#include "lib/res/graphics/cursor.h"
#include "lib/sysdep/cursor.h"
#include "lib/sysdep/cpu.h"
#include "lib/sysdep/gfx.h"
#include "lib/sysdep/os_cpu.h"
#include "lib/tex/tex.h"
#include "graphics/CinemaManager.h"
#include "graphics/FontMetrics.h"
#include "graphics/GameView.h"
#include "graphics/LightEnv.h"
#include "graphics/MapReader.h"
#include "graphics/MaterialManager.h"
#include "graphics/TerrainTextureManager.h"
#include "gui/GUI.h"
#include "gui/GUIManager.h"
#include "gui/scripting/ScriptFunctions.h"
#include "i18n/L10n.h"
#include "maths/MathUtil.h"
#include "network/NetServer.h"
#include "network/NetClient.h"
#include "network/NetMessage.h"
#include "network/NetMessages.h"
#include "ps/CConsole.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/GameSetup/Atlas.h"
#include "ps/GameSetup/GameSetup.h"
#include "ps/GameSetup/Paths.h"
#include "ps/GameSetup/Config.h"
#include "ps/GameSetup/CmdLineArgs.h"
#include "ps/GameSetup/HWDetect.h"
#include "ps/Globals.h"
#include "ps/Hotkey.h"
#include "ps/Joystick.h"
#include "ps/Loader.h"
#include "ps/Mod.h"
#include "ps/Profile.h"
#include "ps/ProfileViewer.h"
#include "ps/Profiler2.h"
#include "ps/Pyrogenesis.h"
#include "ps/scripting/JSInterface_Console.h"
#include "ps/TouchInput.h"
#include "ps/UserReport.h"
#include "ps/Util.h"
#include "ps/VideoMode.h"
#include "ps/VisualReplay.h"
#include "ps/World.h"
#include "renderer/Renderer.h"
#include "renderer/VertexBufferManager.h"
#include "renderer/ModelRenderer.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptStats.h"
#include "simulation2/Simulation2.h"
#include "lobby/IXmppClient.h"
#include "soundmanager/scripting/JSInterface_Sound.h"
#include "soundmanager/ISoundManager.h"
#include "tools/atlas/GameInterface/GameLoop.h"
#include "tools/atlas/GameInterface/View.h"
#include <X11/Xlib.h>
#include <iostream>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

Macros

#define MUST_INIT_X11   1
 

Functions

void restart_engine ()
 
 ERROR_GROUP (System)
 
 ERROR_TYPE (System, SDLInitFailed)
 
 ERROR_TYPE (System, VmodeFailed)
 
 ERROR_TYPE (System, RequiredExtensionsMissing)
 
static void SetTextureQuality (int quality)
 
void GUI_DisplayLoadProgress (int percent, const wchar_t *pending_task)
 
void Render ()
 
static size_t OperatingSystemFootprint ()
 
static size_t ChooseCacheSize ()
 
ErrorReactionInternal psDisplayError (const wchar_t *text, size_t flags)
 
std::vector< CStr > & GetMods (const CmdLineArgs &args, int flags)
 
void MountMods (const Paths &paths, const std::vector< CStr > &mods)
 
static void InitVfs (const CmdLineArgs &args, int flags)
 
static void InitPs (bool setup_gui, const CStrW &gui_page, ScriptInterface *srcScriptInterface, JS::HandleValue initData)
 
static void InitInput ()
 
static void ShutdownPs ()
 
static void InitRenderer ()
 
static void InitSDL ()
 
static void ShutdownSDL ()
 
void EndGame ()
 
void Shutdown (int flags)
 
static void FixLocales ()
 
void EarlyInit ()
 initialize global modules that are be needed before Init. More...
 
bool Autostart (const CmdLineArgs &args)
 
bool AutostartVisualReplay (const std::string &replayFile)
 Returns true if the user has intended to start a visual replay from command line. More...
 
bool Init (const CmdLineArgs &args, int flags)
 Returns true if successful, false if mods changed and restart_engine was called. More...
 
void InitGraphics (const CmdLineArgs &args, int flags)
 
void RenderGui (bool RenderingState)
 enable/disable rendering of the GUI (intended mainly for screenshots) More...
 
void RenderLogger (bool RenderingState)
 
void RenderCursor (bool RenderingState)
 enable/disable rendering of the cursor - this does not hide cursor, but reverts to OS style More...
 
CStr8 LoadSettingsOfScenarioMap (const VfsPath &mapPath)
 Temporarily loads a scenario map and retrieves the "ScriptSettings" JSON data from it. More...
 
void CancelLoad (const CStrW &message)
 
bool InDevelopmentCopy ()
 

Variables

bool g_DoRenderGui = true
 
bool g_DoRenderLogger = true
 
bool g_DoRenderCursor = true
 
shared_ptr< ScriptRuntimeg_ScriptRuntime
 
static const int SANE_TEX_QUALITY_DEFAULT = 5
 
bool g_InDevelopmentCopy
 
bool g_CheckedIfInDevelopmentCopy = false
 

Macro Definition Documentation

#define MUST_INIT_X11   1

Function Documentation

bool Autostart ( const CmdLineArgs args)
bool AutostartVisualReplay ( const std::string &  replayFile)

Returns true if the user has intended to start a visual replay from command line.

void CancelLoad ( const CStrW &  message)
static size_t ChooseCacheSize ( )
static
void EarlyInit ( )

initialize global modules that are be needed before Init.

must be called from the very beginning of main.

void EndGame ( )
ERROR_GROUP ( System  )
ERROR_TYPE ( System  ,
SDLInitFailed   
)
ERROR_TYPE ( System  ,
VmodeFailed   
)
ERROR_TYPE ( System  ,
RequiredExtensionsMissing   
)
static void FixLocales ( )
static
std::vector<CStr>& GetMods ( const CmdLineArgs args,
int  flags 
)
void GUI_DisplayLoadProgress ( int  percent,
const wchar_t pending_task 
)
bool InDevelopmentCopy ( )
bool Init ( const CmdLineArgs args,
int  flags 
)

Returns true if successful, false if mods changed and restart_engine was called.

In the latter case the caller should call Shutdown() with SHUTDOWN_FROM_CONFIG.

void InitGraphics ( const CmdLineArgs args,
int  flags 
)
static void InitInput ( )
static
static void InitPs ( bool  setup_gui,
const CStrW &  gui_page,
ScriptInterface srcScriptInterface,
JS::HandleValue  initData 
)
static
static void InitRenderer ( )
static
static void InitSDL ( )
static
static void InitVfs ( const CmdLineArgs args,
int  flags 
)
static
CStr8 LoadSettingsOfScenarioMap ( const VfsPath mapPath)

Temporarily loads a scenario map and retrieves the "ScriptSettings" JSON data from it.

The scenario map format is used for scenario and skirmish map types (random games do not use a "map" (format) but a small JavaScript program which creates a map on the fly). It contains a section to initialize the game setup screen.

Parameters
mapPathAbsolute path (from VFS root) to the map file to peek in.
Returns
ScriptSettings in JSON format extracted from the map.
void MountMods ( const Paths paths,
const std::vector< CStr > &  mods 
)
static size_t OperatingSystemFootprint ( )
static
ErrorReactionInternal psDisplayError ( const wchar_t text,
size_t  flags 
)
void Render ( )
void RenderCursor ( bool  RenderingState)

enable/disable rendering of the cursor - this does not hide cursor, but reverts to OS style

void RenderGui ( bool  RenderingState)

enable/disable rendering of the GUI (intended mainly for screenshots)

void RenderLogger ( bool  RenderingState)
void restart_engine ( )
static void SetTextureQuality ( int  quality)
static
void Shutdown ( int  flags)
static void ShutdownPs ( )
static
static void ShutdownSDL ( )
static

Variable Documentation

bool g_CheckedIfInDevelopmentCopy = false
bool g_DoRenderCursor = true
bool g_DoRenderGui = true
bool g_DoRenderLogger = true
bool g_InDevelopmentCopy
shared_ptr<ScriptRuntime> g_ScriptRuntime
const int SANE_TEX_QUALITY_DEFAULT = 5
static