Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/skyjake/Doomsday-Engine i…
Browse files Browse the repository at this point in the history
…nto oculus-refactor
  • Loading branch information
skyjake committed Feb 24, 2014
2 parents 7c4e311 + c10a15f commit cb7e364
Show file tree
Hide file tree
Showing 38 changed files with 1,075 additions and 1,245 deletions.
73 changes: 71 additions & 2 deletions doomsday/plugins/common/include/g_common.h
Expand Up @@ -46,7 +46,11 @@ extern "C" {

void G_Register(void);

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

void G_ChangeGameState(gamestate_t state);

gameaction_t G_GameAction(void);
Expand Down Expand Up @@ -77,7 +81,7 @@ dd_bool G_QuitInProgress(void);
* @param mapEntrance Logical map entry point number.
* @param rules Game rules to apply.
*/
void G_NewGame(Uri const *mapUri, uint mapEntrance, GameRuleset const *rules);
void G_NewSession(Uri const *mapUri, uint mapEntrance, GameRuleset const *rules);
void G_DeferredNewGame(Uri const *mapUri, uint mapEntrance, GameRuleset const *rules);

/**
Expand Down Expand Up @@ -149,4 +153,69 @@ D_CMD( CCmdExitLevel );
} // extern "C"
#endif

#endif /* LIBCOMMON_GAME_H */
#if __cplusplus
#include <de/String>

class GameStateReaderFactory;
class SaveSlots;

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

/**
* Parse @a str and determine whether it references a logical game-save slot.
*
* @param str String to be parsed. Parse is divided into three passes.
* Pass 1: Check for a known game-save description which matches this.
* Search is in logical save slot creation order.
* Pass 2: Check for keyword identifiers.
* <auto> = The "auto save" slot.
* <last> = The last used slot.
* <quick> = The currently nominated "quick save" slot.
* Pass 3: Check for a unique save slot identifier.
*
* @return The parsed slot id if found; otherwise a zero-length string.
*/
de::String G_SaveSlotIdFromUserInput(de::String str);

/**
* Determines whether game session loading is presently possible.
*/
bool G_SessionLoadingPossible();

/**
* Determines whether game session saving is presently possible.
*/
bool G_SessionSavingPossible();

/**
* Schedule a game session save (deferred).
*
* @param slotId Unique identifier of the save slot to use.
* @param userDescription New user description for the game-save. Can be @c NULL in which
* case it will not change if the slot has already been used.
* If an empty string a new description will be generated automatically.
*
* @return @c true iff @a slotId is valid and saving is presently possible.
*/
bool G_SaveSession(de::String slotId, de::String *userDescription = 0);

/**
* Schedule a game session load (deferred).
*
* @param slotId Unique identifier of the save slot to use.
*
* @return @c true iff @a slotId is in use and loading is presently possible.
*/
bool G_LoadSession(de::String slotId);

/**
* Returns the game's GameStateReaderFactory.
*/
GameStateReaderFactory &G_GameStateReaderFactory();

#endif // __cplusplus

#endif // LIBCOMMON_GAME_H
5 changes: 2 additions & 3 deletions doomsday/plugins/common/include/hu_lib.h
Expand Up @@ -622,9 +622,8 @@ typedef struct mndata_edit_s {
ddstring_t oldtext; // If the current edit is canceled...
uint maxLength;
uint maxVisibleChars;
const char* emptyString; // Drawn when editfield is empty/null.
void* data1;
int data2;
char const *emptyString; // Drawn when editfield is empty/null.
void *data1;
} mndata_edit_t;

#ifdef __cplusplus
Expand Down
11 changes: 7 additions & 4 deletions doomsday/plugins/common/include/p_savedef.h
Expand Up @@ -32,6 +32,8 @@
# define SAVEGAMEEXTENSION "dsg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define NUMSAVESLOTS 8
//# define BASE_SLOT 8
# define AUTO_SLOT 9

#elif __JDOOM64__
Expand All @@ -43,6 +45,8 @@
# define SAVEGAMEEXTENSION "6sg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define NUMSAVESLOTS 8
//# define BASE_SLOT 8
# define AUTO_SLOT 9

#elif __JHERETIC__
Expand All @@ -54,6 +58,8 @@
# define SAVEGAMEEXTENSION "hsg"
# define SAVEGAME_DEFAULT_DIR "savegame"

# define NUMSAVESLOTS 8
//# define BASE_SLOT 8
# define AUTO_SLOT 9

#elif __JHEXEN__
Expand All @@ -64,13 +70,10 @@
# define SAVEGAMEEXTENSION "hxs"
# define SAVEGAME_DEFAULT_DIR "hexndata"

# define NUMSAVESLOTS 6
# define BASE_SLOT 6
# define AUTO_SLOT 7

#endif

#if !__JHEXEN__
#define PRE_VER5_END_SPECIALS 7
#endif

#endif // LIBCOMMON_SAVEGAME_DEFS_H
110 changes: 24 additions & 86 deletions doomsday/plugins/common/include/p_saveg.h
Expand Up @@ -21,8 +21,13 @@
#ifndef LIBCOMMON_SAVESTATE_H
#define LIBCOMMON_SAVESTATE_H

#ifdef __cplusplus

#include "common.h"

class MapStateReader;
class MapStateWriter;

DENG_EXTERN_C int saveToRealPlayerNum[MAXPLAYERS];

#if __JHEXEN__
Expand All @@ -32,51 +37,9 @@ typedef struct targetplraddress_s {
} targetplraddress_t;

DENG_EXTERN_C targetplraddress_t *targetPlayerAddrs;
#endif

#ifdef __cplusplus
extern "C" {
#endif

/// Initialize this module.
void SV_Initialize(void);

/// Shutdown this module.
void SV_Shutdown(void);

/**
* Save the current game state to the specified @a slotNumber.
*
* @param description Textual description to include in the save info. Can be @c 0
* in which case a description will be auto-generated.
*
* @return @c true iff the game state was saved successfully.
*/
dd_bool SV_SaveGame(int slotNumber, char const *description);

/**
* Load the game state associated with the specified @a slotNumber.
*
* @return @c true iff the game state was loaded successfully.
*/
dd_bool SV_LoadGame(int slotNumber);

#if !__JHEXEN__
/**
* Saves a snapshot of the world, a still image.
* No data of movement is included (server sends it).
*/
void SV_SaveGameClient(uint gameId);

void SV_LoadGameClient(uint gameId);
#endif

#if __JHEXEN__
/**
* Returns @c true iff a game-save is present and serialized @a map state is
* present for logical save @a slotNumber.
*/
dd_bool SV_HxHaveMapStateForSlot(int slotNumber, uint map);
void SV_InitTargetPlayers();
void SV_ClearTargetPlayers();
#endif

/**
Expand Down Expand Up @@ -110,55 +73,30 @@ typedef struct playerheader_s {
#endif
} playerheader_t;

#if __JHEXEN__
void SV_InitTargetPlayers(void);
void SV_ClearTargetPlayers(void);
#endif

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

# ifdef __cplusplus
#include "gamestatereader.h"
void SV_WriteLine(Line *line, MapStateWriter *msw);
void SV_ReadLine(Line *line, MapStateReader *msr);

class MapStateReader;
class MapStateWriter;
class SaveInfo;
class SaveSlots;
void SV_WriteSector(Sector *sec, MapStateWriter *msw);
void SV_ReadSector(Sector *sec, MapStateReader *msr);

/**
* Returns the game's SaveSlots.
*/
SaveSlots &SV_SaveSlots();
#endif // __cplusplus

/**
* Declare a new saved game state reader/interpreter.
*
* @param recognizer Format recognizer function.
* @param maker Reader instantiator function.
*/
void SV_DeclareGameStateReader(GameStateRecognizeFunc recognizer, GameStateReaderMakeFunc maker);
#ifdef __cplusplus
extern "C" {
#endif

#if !__JHEXEN__
/**
* Determines whether the game session associated with save @a info is interpretable as a
* potentially loadable savegame state.
*
* @param info SaveInfo to attempt to read game session header into.
* Saves a snapshot of the world, a still image.
* No data of movement is included (server sends it).
*/
bool SV_RecognizeGameState(SaveInfo &info);

void SV_WriteLine(Line *line, MapStateWriter *msw);
void SV_ReadLine(Line *line, MapStateReader *msr);

void SV_WriteSector(Sector *sec, MapStateWriter *msw);
void SV_ReadSector(Sector *sec, MapStateReader *msr);
void SV_SaveGameClient(uint gameId);

# if __JHEXEN__
void SV_HxSaveHubMap(void);
void SV_LoadGameClient(uint gameId);
#endif

void SV_HxLoadHubMap(void);
# endif // __JHEXEN__
# endif // __cplusplus
#ifdef __cplusplus
} // extern "C"
#endif

#endif // LIBCOMMON_SAVESTATE_H
13 changes: 3 additions & 10 deletions doomsday/plugins/common/include/p_saveio.h
Expand Up @@ -69,23 +69,16 @@ de::Path SV_ClientSavePath();
/*
* File management
*/
LZFILE *SV_OpenFile(de::Path filePath, de::String mode);

void SV_CloseFile();

LZFILE *SV_File();

bool SV_ExistingFile(de::Path filePath);

int SV_RemoveFile(de::Path filePath);

void SV_CopyFile(de::Path srcPath, de::Path destPath);
void SV_CopyFile(de::Path srcFilePath, de::Path destFilePath);

bool SV_OpenGameSaveFile(de::Path fileName, bool write);
bool SV_OpenFile(de::Path filePath, bool write);

#if __JHEXEN__
bool SV_OpenMapSaveFile(de::Path path);
#endif
void SV_CloseFile();

#if __JHEXEN__
saveptr_t *SV_HxSavePtr();
Expand Down
6 changes: 5 additions & 1 deletion doomsday/plugins/common/include/saveinfo.h
Expand Up @@ -22,7 +22,6 @@
#define LIBCOMMON_SAVEINFO

#include "common.h"
#include <de/Path>
#include <de/String>

/**
Expand Down Expand Up @@ -87,6 +86,11 @@ class SaveInfo
*/
bool gameSessionIsLoadable() const;

/**
* Determines whether a saved map session exists.
*/
bool haveMapSession(uint map) const;

/**
* Attempt to update the save info from the named saved game session file. If the save path
* is invalid, unreachable, or the game state is not recognized -- the save info is returned
Expand Down

0 comments on commit cb7e364

Please sign in to comment.