Skip to content

Commit

Permalink
Client|Server: Untangled header includes (don't use de_*.h), cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed May 13, 2015
1 parent f9fe10b commit 5fdf849
Show file tree
Hide file tree
Showing 7 changed files with 542 additions and 588 deletions.
200 changes: 99 additions & 101 deletions doomsday/client/include/dd_main.h
@@ -1,7 +1,7 @@
/** @file dd_main.h
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2006-2015 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -17,57 +17,45 @@
* http://www.gnu.org/licenses</small>
*/

/**
* Engine Core
*/

#ifndef LIBDENG_MAIN_H
#define LIBDENG_MAIN_H

#ifndef __cplusplus
# error "C++ required"
#endif

#include "dd_types.h"
#include "resource/resourcesystem.h"
#include "Games"
#include "world/worldsystem.h"
#include "ui/infine/infinesystem.h"
#include "api_plugin.h"
#include "api_gameexport.h"
#include <doomsday/filesys/sys_direc.h>
#include <de/c_wrapper.h>
#include <de/LibraryFile>
#ifndef DENG_MAIN_H
#define DENG_MAIN_H

#include <QList>
#include <QMap>
#include <de/LibraryFile>
#include <de/String>
#include <doomsday/resource/resourceclass.h>

struct game_s;

extern int verbose;
//extern FILE* outFile; // Output file for console messages.

extern char *startupFiles; // A list of names of files to be autoloaded during startup, whitespace in between (in .cfg).
#include "api_plugin.h"
#include "api_gameexport.h"
#include "Games"

extern int isDedicated;
#include "resource/resourcesystem.h"
#include "world/worldsystem.h"
#include "ui/infine/infinesystem.h"

extern finaleid_t titleFinale;
namespace de {
class File1;
}

#ifndef WIN32
extern GETGAMEAPI GetGameAPI;
#endif

extern int gameDataFormat;

extern de::dint verbose;
extern de::dint isDedicated;
extern de::dint gameDataFormat;
#ifdef __CLIENT__
extern int symbolicEchoMode;
extern de::dint symbolicEchoMode;
#endif

int DD_EarlyInit(void);
void DD_FinishInitializationAfterWindowReady(void);
dd_bool DD_Init(void);
de::dint DD_EarlyInit();
void DD_FinishInitializationAfterWindowReady();

/**
* Returns @c true if shutdown is in progress.
*/
bool DD_IsShuttingDown();

/**
* Print an error message and quit.
Expand All @@ -76,118 +64,128 @@ void App_Error(char const *error, ...);

void App_AbnormalShutdown(char const *error);

/// Returns the application's global InFineSystem.
InFineSystem &App_InFineSystem();

/// Returns the application's global WorldSystem.
de::WorldSystem &App_WorldSystem();

#undef Con_Open

/**
* Attempt to change the 'open' state of the console.
* @note In dedicated mode the console cannot be closed.
*/
void Con_Open(int yes);
void Con_Open(de::dint yes);

/// @return @c true if shutdown is in progress.
dd_bool DD_IsShuttingDown(void);
void DD_CheckTimeDemo();
void DD_UpdateEngineState();

void DD_CheckTimeDemo(void);
void DD_UpdateEngineState(void);
//
// Resources (logical) ------------------------------------------------------------
//

/**
* Loads all the plugins from the library directory. Note that audio plugins
* are not loaded here, they are managed by AudioDriver.
*/
void Plug_LoadAll(void);
/// Returns the application's global ResourceSystem.
ResourceSystem &App_ResourceSystem();

/**
* Unloads all plugins.
* Convenient method of returning a resource class from the application's global
* resource system.
*/
void Plug_UnloadAll(void);
ResourceClass &App_ResourceClass(de::String className);

de::LibraryFile const &Plug_FileForPlugin(pluginid_t id);
/// @overload
ResourceClass &App_ResourceClass(resourceclassid_t classId);

//
// Game modules -------------------------------------------------------------------
//

/**
* Executes all the hooks of the given type. Bit zero of the return value
* is set if a hook was executed successfully (returned true). Bit one is
* set if all the hooks that were executed returned true.
* Switch to/activate the specified game.
*/
int DD_CallHooks(int hook_type, int parm, void* data);
bool App_ChangeGame(de::Game &game, bool allowReload = false);

/**
* Sets the ID of the currently active plugin in the current thread.
*
* @param id Plugin id.
* Returns @c true if a game module is presently loaded.
*/
void DD_SetActivePluginId(pluginid_t id);
dd_bool App_GameLoaded();

/**
* @return Unique identifier of the currently active plugin. The currently
* active plugin is tracked separately for each thread.
* Returns the application's global Games (collection).
*/
pluginid_t DD_ActivePluginId(void);

dd_bool DD_ExchangeGamePluginEntryPoints(pluginid_t pluginId);
de::Games &App_Games();

/**
* Locate the address of the named, exported procedure in the plugin.
* Returns the current game from the application's global collection.
*/
void* DD_FindEntryPoint(pluginid_t pluginId, const char* fn);

/// @return Symbolic name of the material scheme associated with @a textureSchemeName.
de::String DD_MaterialSchemeNameForTextureScheme(de::String textureSchemeName);

/// @return The application's global InFineSystem.
InFineSystem &App_InFineSystem();
de::Game &App_CurrentGame();

/// @return The application's global ResourceSystem.
ResourceSystem &App_ResourceSystem();
/**
* Frees the info structures for all registered games.
*/
void App_ClearGames();

/// @return The application's global WorldSystem.
de::WorldSystem &App_WorldSystem();
//
// Plugins ------------------------------------------------------------------------
//

/**
* Convenient method of returning a resource class from the application's global
* resource system.
* Loads all the plugins from the library directory. Note that audio plugins
* are not loaded here, they are managed by AudioDriver.
*/
ResourceClass &App_ResourceClass(de::String className);
void Plug_LoadAll();

/**
* Convenient method of returning a resource class from the application's global
* resource system.
* Unloads all plugins.
*/
ResourceClass &App_ResourceClass(resourceclassid_t classId);

/// @return @c true iff there is presently a game loaded.
dd_bool App_GameLoaded();
void Plug_UnloadAll();

/// @return The current game from the application's global collection.
de::Game &App_CurrentGame();

/**
* Switch to/activate the specified game.
* @return Unique identifier of the currently active plugin. The currently
* active plugin is tracked separately for each thread.
*/
bool App_ChangeGame(de::Game &game, bool allowReload = false);
pluginid_t DD_ActivePluginId();

/// @return The application's global Games (collection).
de::Games &App_Games();
/**
* Sets the ID of the currently active plugin in the current thread.
*
* @param id Plugin id.
*/
void DD_SetActivePluginId(pluginid_t id);

fontschemeid_t DD_ParseFontSchemeName(char const *str);
/**
* Executes all the hooks of the given type. Bit zero of the return value
* is set if a hook was executed successfully (returned true). Bit one is
* set if all the hooks that were executed returned true.
*/
de::dint DD_CallHooks(de::dint hook_type, de::dint parm, void *context);

/// @return Symbolic name of the material scheme associated with @a textureSchemeName.
AutoStr *DD_MaterialSchemeNameForTextureScheme(Str const *textureSchemeName);
de::LibraryFile const &Plug_FileForPlugin(pluginid_t id);

const char* value_Str(int val);
bool DD_ExchangeGamePluginEntryPoints(pluginid_t pluginId);

/**
* Frees the info structures for all registered games.
* Locate the address of the named, exported procedure in the plugin.
*/
void DD_DestroyGames(void);
void *DD_FindEntryPoint(pluginid_t pluginId, char const *fn);

//
// Misc/utils ---------------------------------------------------------------------
//

/**
* Attempts to read help strings from the game-specific help file.
*/
void DD_ReadGameHelp(void);
void DD_ReadGameHelp();

D_CMD(Load);
D_CMD(Unload);
D_CMD(Reset);
D_CMD(ReloadGame);
/// @return Symbolic name of the material scheme associated with @a textureSchemeName.
AutoStr *DD_MaterialSchemeNameForTextureScheme(Str const *textureSchemeName);

/// @overload
de::String DD_MaterialSchemeNameForTextureScheme(de::String textureSchemeName);

fontschemeid_t DD_ParseFontSchemeName(char const *str);

#endif /* LIBDENG_MAIN_H */
#endif // DENG_MAIN_H
2 changes: 1 addition & 1 deletion doomsday/client/include/gl/gl_main.h
Expand Up @@ -83,7 +83,7 @@ void GL_Register();
* cannot yet be initialized, such as the texture management, so any rendering
* occuring before GL_Init() must be done with manually prepared textures.
*/
dd_bool GL_EarlyInit();
void GL_EarlyInit();

/**
* Finishes GL initialization. This can be called once the virtual file
Expand Down
53 changes: 21 additions & 32 deletions doomsday/client/include/sys_system.h
@@ -1,7 +1,7 @@
/** @file sys_system.h
/** @file sys_system.h Abstract interfaces for platform specific services.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2006-2015 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2006 Jamie Jones <jamie_jones_au@yahoo.com.au>
*
* @par License
Expand All @@ -18,34 +18,31 @@
* http://www.gnu.org/licenses</small>
*/

/**
* OS Specific Services Subsystem.
*/

#ifndef LIBDENG_FILESYS_SYSTEM_H
#define LIBDENG_FILESYS_SYSTEM_H
#ifndef DENG_CORE_SYSTEM_H
#define DENG_CORE_SYSTEM_H

#include <de/libcore.h>
#include <de/NativePath>
#include "dd_types.h"

#ifdef __cplusplus
extern "C" {
#endif
extern de::dint novideo;

extern int novideo;
void Sys_Init();
void Sys_Shutdown();

void Sys_Init(void);
void Sys_Shutdown(void);
/**
* Returns @c true if shutdown is in progress.
*/
bool Sys_IsShuttingDown();

#undef Sys_Quit
void Sys_Quit(void);
DENG_EXTERN_C void Sys_Quit();

/// @return @c true if shutdown is in progress.
dd_bool Sys_IsShuttingDown(void);
void Sys_HideMouseCursor();

int Sys_CriticalMessage(const char* msg);
int Sys_CriticalMessagef(const char* format, ...) PRINTF_F(1,2);
de::NativePath Sys_SteamBasePath();

void Sys_Sleep(int millisecs);
void Sys_Sleep(de::dint millisecs);

/**
* Blocks the thread for a very short period of time. If attempting to wait
Expand All @@ -55,17 +52,9 @@ void Sys_Sleep(int millisecs);
*
* @note Longer waits should use Sys_Sleep() -- this is a busy wait.
*/
void Sys_BlockUntilRealTime(uint realTimeMs);

void Sys_ShowCursor(dd_bool show);
void Sys_HideMouse(void);
#if 0
void Sys_MessageBox(const char* msg, dd_bool iserror);
void Sys_OpenTextEditor(const char* filename);
#endif
void Sys_BlockUntilRealTime(de::duint realTimeMs);

#ifdef __cplusplus
} // extern "C"
#endif
de::dint Sys_CriticalMessage(char const *msg);
de::dint Sys_CriticalMessagef(char const *format, ...) PRINTF_F(1,2);

#endif /* LIBDENG_FILESYS_SYSTEM_H */
#endif // DENG_CORE_SYSTEM_H

1 comment on commit 5fdf849

@skyjake
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit seems to break Unix builds. Nothing major, though, fixing...

Please sign in to comment.