Skip to content

Commit

Permalink
libcommon: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Aug 24, 2014
1 parent f65ae0f commit c3a2a9e
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 202 deletions.
147 changes: 66 additions & 81 deletions doomsday/plugins/common/include/g_common.h
Expand Up @@ -27,34 +27,10 @@
#include "player.h"
#include <doomsday/uri.h>

DENG_EXTERN_C dd_bool singledemo;

#if __cplusplus
extern GameRuleset defaultGameRules;

extern "C" {
#endif

dd_bool G_QuitInProgress(void);

/**
* Returns the current logical game state.
*/
gamestate_t G_GameState(void);

/**
* Change the game's state.
*
* @param state The state to change to.
*/
void G_ChangeGameState(gamestate_t state);

gameaction_t G_GameAction(void);

void G_SetGameAction(gameaction_t action);
class SaveSlots;

#if __cplusplus
} // extern "C"
extern GameRuleset defaultGameRules;

/**
* Schedule a new game session (deferred).
Expand Down Expand Up @@ -120,67 +96,93 @@ de::String G_MapTitle(de::Uri const &mapUri);
*/
patchid_t G_MapTitlePatch(de::Uri const &mapUri);

/**
* Attempt to extract the logical map number encoded in the @a mapUri. Assumes the default
* form for the current game mode (i.e., MAPXX or EXMY).
*
* @param mapUri Unique identifier of the map.
*
* @return Extracted/decoded map number, otherwise @c 0.
*
* @deprecated Should use map URIs instead.
*/
uint G_MapNumberFor(de::Uri const &mapUri);

/**
* Compose a Uri for the identified @a episode and @a map combination using the default
* form for the current game mode (i.e., MAPXX or EXMY).
*
* @param episode Logical episode number.
* @param map Logical map number.
*
* @return Resultant Uri.
*
* @deprecated Should use map URIs instead. Map references composed of a logical episode
* and map number pair are a historical legacy that should only be used when necessary,
* for compatibility reasons.
*/
de::Uri G_ComposeMapUri(uint episode, uint map);

/**
* Chooses a default user description for a saved session.
*
* @param saveName Name of the saved session from which the existing description should
* be re-used. Use a zero-length string to disable.
* @param autogenerate @c true to generate a useful description (map name, map time, etc...)
* if none exists for the @a saveName referenced.
*/
de::String G_DefaultSavedSessionUserDescription(de::String const &saveName, bool autogenerate = true);

/**
* Returns the game's SaveSlots.
*/
SaveSlots &G_SaveSlots();

extern "C" {
#endif

/**
* Reveal the game @em help display.
* Returns @c true, if the game is currently quiting.
*/
void G_StartHelp(void);
dd_bool G_QuitInProgress(void);

/// @todo Should not be a global function; mode breaks game session separation.
dd_bool G_StartFinale(char const *script, int flags, finale_mode_t mode, char const *defId);
/**
* Returns the current logical game state.
*/
gamestate_t G_GameState(void);

/**
* Signal that play on the current map may now begin.
* Change the current logical game state to @a newState.
*/
void G_BeginMap(void);
void G_ChangeGameState(gamestate_t newState);

/**
* Determines whether an intermission should be scheduled (if any) when the players leave the
* @em current map.
* Returns the current game action.
*/
dd_bool G_IntermissionActive(void);
gameaction_t G_GameAction(void);

/**
* To be called to initiate the intermission.
* Change the current game action to @a newAction.
*/
void G_IntermissionBegin(void);
void G_SetGameAction(gameaction_t newAction);

/**
* To be called when the intermission ends.
* Reveal the game @em help display.
*/
void G_IntermissionDone(void);
void G_StartHelp(void);

#if __cplusplus
} // extern "C"
/// @todo Should not be a global function; mode breaks game session separation.
dd_bool G_StartFinale(char const *script, int flags, finale_mode_t mode, char const *defId);

/**
* Returns the logical map number for the identified map.
*
* @param mapUri Unique identifier of the map to lookup.
*
* @deprecated Should use map URIs instead.
* Signal that play on the current map may now begin.
*/
uint G_MapNumberFor(de::Uri const &mapUri);
void G_BeginMap(void);

/**
* Compose a Uri for the identified @a episode and @a map combination using the default
* form for the current game mode (i.e., MAPXX or EXMY).
*
* @param episode Logical episode number.
* @param map Logical map number.
*
* @return Resultant Uri.
*
* @deprecated Should use map URIs instead. Map references composed of a logical episode
* and map number pair are a historical legacy that should only be used when necessary,
* for compatibility reasons.
* To be called when the intermission ends.
*/
de::Uri G_ComposeMapUri(uint episode, uint map);

extern "C" {
#endif
void G_IntermissionDone(void);

AutoStr *G_CurrentMapUriPath(void);

Expand All @@ -207,25 +209,8 @@ D_CMD( CCmdExitLevel );

#if __cplusplus
} // extern "C"
#endif

#include <de/String>

class SaveSlots;

/**
* Chooses a default user description for a saved session.
*
* @param saveName Name of the saved session from which the existing description should be
* re-used. Use a zero-length string to disable.
* @param autogenerate @c true= generate a useful description (map name, map time, etc...) if none
* exists for the referenced save @a slotId.
*/
de::String G_DefaultSavedSessionUserDescription(de::String const &saveName, bool autogenerate = true);

/**
* Returns the game's SaveSlots.
*/
SaveSlots &G_SaveSlots();
DENG_EXTERN_C dd_bool singledemo;

#endif // __cplusplus
#endif // LIBCOMMON_GAME_H

0 comments on commit c3a2a9e

Please sign in to comment.