2019-07-24 09:40:34 -07:00
|
|
|
/* Copyright (C) 2019 Wildfire Games.
|
2009-04-18 10:00:33 -07:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2010-02-17 15:21:49 -08:00
|
|
|
#ifndef INCLUDED_GAMESETUP
|
|
|
|
|
#define INCLUDED_GAMESETUP
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
//
|
|
|
|
|
// GUI integration
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// display progress / description in loading screen
|
|
|
|
|
extern void GUI_DisplayLoadProgress(int percent, const wchar_t* pending_task);
|
|
|
|
|
|
|
|
|
|
extern void Render();
|
|
|
|
|
|
2019-07-24 09:40:34 -07:00
|
|
|
extern bool ShouldRender();
|
|
|
|
|
|
2007-05-26 16:29:20 -07:00
|
|
|
/**
|
|
|
|
|
* initialize global modules that are be needed before Init.
|
|
|
|
|
* must be called from the very beginning of main.
|
|
|
|
|
**/
|
|
|
|
|
extern void EarlyInit();
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
enum InitFlags
|
|
|
|
|
{
|
|
|
|
|
// avoid setting a video mode / initializing OpenGL; assume that has
|
|
|
|
|
// already been done and everything is ready for rendering.
|
|
|
|
|
// needed by map editor because it creates its own window.
|
|
|
|
|
INIT_HAVE_VMODE = 1,
|
|
|
|
|
|
|
|
|
|
// skip initializing the in-game GUI.
|
|
|
|
|
// needed by map editor because it uses its own GUI.
|
2013-08-20 14:07:42 -07:00
|
|
|
INIT_NO_GUI = 2,
|
|
|
|
|
|
|
|
|
|
// avoid setting display_error app hook
|
|
|
|
|
// needed by map editor because it has its own wx error display
|
2014-08-25 09:02:40 -07:00
|
|
|
INIT_HAVE_DISPLAY_ERROR = 4,
|
|
|
|
|
|
|
|
|
|
// initialize the mod folders from command line parameters
|
2014-08-25 09:38:54 -07:00
|
|
|
INIT_MODS = 8,
|
|
|
|
|
|
|
|
|
|
// mount the public mod
|
|
|
|
|
// needed by the map editor as "mod" does not provide everything it needs
|
|
|
|
|
INIT_MODS_PUBLIC = 16
|
2014-08-25 09:02:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum ShutdownFlags
|
|
|
|
|
{
|
|
|
|
|
// start shutdown from config down
|
|
|
|
|
// needed for loading mods as specified in the config
|
|
|
|
|
// without having to go through a full init-shutdown cycle
|
|
|
|
|
SHUTDOWN_FROM_CONFIG = 1
|
2006-04-23 16:14:18 -07:00
|
|
|
};
|
|
|
|
|
|
2010-06-03 12:07:59 -07:00
|
|
|
/**
|
|
|
|
|
* enable/disable rendering of the GUI (intended mainly for screenshots)
|
|
|
|
|
*/
|
|
|
|
|
extern void RenderGui(bool RenderingState);
|
2010-11-20 17:25:16 -08:00
|
|
|
extern void RenderLogger(bool RenderingState);
|
2009-04-18 08:27:38 -07:00
|
|
|
|
2010-12-04 21:17:28 -08:00
|
|
|
/**
|
|
|
|
|
* enable/disable rendering of the cursor - this does not hide cursor, but reverts to OS style
|
|
|
|
|
*/
|
|
|
|
|
extern void RenderCursor(bool RenderingState);
|
|
|
|
|
|
|
|
|
|
|
2006-12-09 06:39:52 -08:00
|
|
|
class CmdLineArgs;
|
2014-08-25 09:02:40 -07:00
|
|
|
class Paths;
|
2017-08-23 16:52:32 -07:00
|
|
|
extern const std::vector<CStr>& GetMods(const CmdLineArgs& args, int flags);
|
2018-05-24 11:08:56 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mounts all files of the given mods in the global VFS.
|
|
|
|
|
* Make sure to call CacheEnabledModVersions after every call to this.
|
|
|
|
|
*/
|
2014-08-25 09:02:40 -07:00
|
|
|
extern void MountMods(const Paths& paths, const std::vector<CStr>& mods);
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
extern bool Init(const CmdLineArgs& args, int flags);
|
2019-09-15 05:16:28 -07:00
|
|
|
extern void InitInput();
|
|
|
|
|
extern void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods = std::vector<CStr>());
|
2017-05-23 12:26:33 -07:00
|
|
|
extern void InitNonVisual(const CmdLineArgs& args);
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
extern void Shutdown(int flags);
|
2011-04-06 19:32:16 -07:00
|
|
|
extern void CancelLoad(const CStrW& message);
|
2010-02-17 15:21:49 -08:00
|
|
|
|
2014-04-20 13:03:57 -07:00
|
|
|
extern bool InDevelopmentCopy();
|
|
|
|
|
|
2010-02-17 15:21:49 -08:00
|
|
|
#endif // INCLUDED_GAMESETUP
|