Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into oculus-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 10, 2014
2 parents 505632e + 0f70943 commit 5441f43
Show file tree
Hide file tree
Showing 86 changed files with 2,890 additions and 2,298 deletions.
7 changes: 7 additions & 0 deletions doomsday/plugins/common/common.pri
Expand Up @@ -15,6 +15,7 @@ HEADERS += \
$$common_inc/d_net.h \
$$common_inc/d_netcl.h \
$$common_inc/d_netsv.h \
$$common_inc/dmu_archiveindex.h \
$$common_inc/dmu_lib.h \
$$common_inc/fi_lib.h \
$$common_inc/g_common.h \
Expand All @@ -35,6 +36,8 @@ HEADERS += \
$$common_inc/hu_pspr.h \
$$common_inc/hu_stuff.h \
$$common_inc/m_argv.h \
$$common_inc/mapstatereader.h \
$$common_inc/mapstatewriter.h \
$$common_inc/mobj.h \
$$common_inc/pause.h \
$$common_inc/p_actor.h \
Expand Down Expand Up @@ -65,6 +68,7 @@ HEADERS += \
$$common_inc/polyobjs.h \
$$common_inc/r_common.h \
$$common_inc/saveinfo.h \
$$common_inc/thinkerinfo.h \
$$common_inc/x_hair.h \
$$common_inc/xgclass.h

Expand Down Expand Up @@ -95,6 +99,8 @@ SOURCES += \
$$common_src/hu_pspr.c \
$$common_src/hu_stuff.cpp \
$$common_src/m_ctrl.c \
$$common_src/mapstatereader.cpp \
$$common_src/mapstatewriter.cpp \
$$common_src/mobj.c \
$$common_src/pause.c \
$$common_src/p_actor.cpp \
Expand Down Expand Up @@ -125,4 +131,5 @@ SOURCES += \
$$common_src/polyobjs.cpp \
$$common_src/r_common.c \
$$common_src/saveinfo.cpp \
$$common_src/thinkerinfo.cpp \
$$common_src/x_hair.c
17 changes: 3 additions & 14 deletions doomsday/plugins/common/include/g_common.h
Expand Up @@ -69,13 +69,12 @@ void G_EndGame(void);
dd_bool G_QuitInProgress(void);

/**
* @param episode Logical episode number.
* @param map Logical map number (i.e., not a warp/translated number).
* @param mapUri Map identifier.
* @param mapEntrance Logical map entry point number.
* @param rules Game rules to apply.
*/
void G_NewGame(uint episode, uint map, uint mapEntrance, GameRuleset const *rules);
void G_DeferredNewGame(uint episode, uint map, uint mapEntrance, GameRuleset const *rules);
void G_NewGame(Uri const *mapUri, uint mapEntrance, GameRuleset const *rules);
void G_DeferredNewGame(Uri const *mapUri, uint mapEntrance, GameRuleset const *rules);

/**
* Signal that play on the current map may now begin.
Expand Down Expand Up @@ -103,16 +102,6 @@ void G_LeaveMap(uint newMap, uint mapEntryPoint, dd_bool secretExit);
*/
Uri *G_ComposeMapUri(uint episode, uint map);

/**
* Compose the Uri for the @em current map.
*
* @note Some APIs are designed such that a NULL uri pointer means the "current map",
* so, calling this may be unnecessary.
*
* @return Resultant Uri. Must be destroyed with Uri_Delete() when no longer needed.
*/
Uri *G_CurrentMapUri(void);

/**
* Determine if the specified @a episode and @a map value pair are valid and if not,
* adjust their are values within the ranges defined by the current game type and mode.
Expand Down
80 changes: 80 additions & 0 deletions doomsday/plugins/common/include/mapstatereader.h
@@ -0,0 +1,80 @@
/** @file mapstatereader.h Saved map state reader.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program 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. This program 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 this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

#ifndef LIBCOMMON_MAPSTATEREADER_H
#define LIBCOMMON_MAPSTATEREADER_H

#include "common.h"
#include "dmu_archiveindex.h"
#include <de/Error>

/**
* Performs saved game map state deserialization.
*
* @ingroup libcommon
*/
class MapStateReader
{
public:
/// Base class for read-related errors. @ingroup errors
DENG2_ERROR(ReadError);

public:
/**
* @param saveVersion Logical saved state version number.
*/
MapStateReader(int saveVersion);

/**
* Deserialize the saved map state using the specified @a reader.
*/
void read(Reader *reader);

/**
* Returns the logical map version of the saved map state.
*/
int mapVersion();

/**
* Returns the reader to use when deserializing the saved map state.
*/
Reader *reader();

/**
* Finds and returns a material with the identifier @a serialId.
*
* @param serialId Unique identifier for the material in the material archive.
* @param group Used with previous versions of the material archive, which
* separated materials into groups (0= Flats 1= Textures).
*
* @return Pointer to the associated material; otherwise @c 0 (not archived).
*/
Material *material(materialarchive_serialid_t serialId, int group);

/**
* Provides access to the side archive to use when deserializing the map state.
*/
dmu_lib::SideArchive &sideArchive();

private:
DENG2_PRIVATE(d)
};

#endif // LIBCOMMON_MAPSTATEREADER_H
58 changes: 58 additions & 0 deletions doomsday/plugins/common/include/mapstatewriter.h
@@ -0,0 +1,58 @@
/** @file mapstatewriter.h Saved map state writer.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program 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. This program 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 this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

#ifndef LIBCOMMON_MAPSTATEWRITER_H
#define LIBCOMMON_MAPSTATEWRITER_H

#include "common.h"

/**
* Performs saved game map state serialization.
*
* @ingroup libcommon
*/
class MapStateWriter
{
public:
/**
* @param excludePlayers Exclude player data. Used by Hexen when serializing hubs.
*/
MapStateWriter(bool excludePlayers = false);

/**
* Serialize the map state using the specified @a reader.
*/
void write(Writer *writer);

/**
* Returns a unique SerialId for the specified @a material.
*/
materialarchive_serialid_t serialIdFor(Material *material);

/**
* Returns the writer to use when serializing the map state.
*/
Writer *writer();

private:
DENG2_PRIVATE(d)
};

#endif // LIBCOMMON_MAPSTATEWRITER_H
8 changes: 6 additions & 2 deletions doomsday/plugins/common/include/p_ceiling.h
Expand Up @@ -23,6 +23,10 @@
#define LIBCOMMON_THINKER_CEILING_H

#include "doomsday.h"
#ifdef __cplusplus
# include "mapstatereader.h"
# include "mapstatewriter.h"
#endif

#define CEILSPEED (1)
#define CEILWAIT (150)
Expand Down Expand Up @@ -68,8 +72,8 @@ typedef struct ceiling_s {
int tag; // id.

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
void write(MapStateWriter *msw) const;
int read(MapStateReader *msr);
#endif
} ceiling_t;

Expand Down
9 changes: 7 additions & 2 deletions doomsday/plugins/common/include/p_door.h
Expand Up @@ -22,6 +22,11 @@
#ifndef LIBCOMMON_THINKER_DOOR_H
#define LIBCOMMON_THINKER_DOOR_H

#ifdef __cplusplus
# include "mapstatereader.h"
# include "mapstatewriter.h"
#endif

#define DOORSPEED (2)
#define DOORWAIT (150)

Expand Down Expand Up @@ -66,8 +71,8 @@ typedef struct door_s {
int topCountDown;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
void write(MapStateWriter *msw) const;
int read(MapStateReader *msr);
#endif
} door_t;

Expand Down
8 changes: 6 additions & 2 deletions doomsday/plugins/common/include/p_floor.h
Expand Up @@ -23,6 +23,10 @@
#define LIBCOMMON_THINKER_FLOOR_H

#include "doomsday.h"
#ifdef __cplusplus
# include "mapstatereader.h"
# include "mapstatewriter.h"
#endif

#define FLOORSPEED (1)

Expand Down Expand Up @@ -104,8 +108,8 @@ typedef struct floor_s {
#endif

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
void write(MapStateWriter *msw) const;
int read(MapStateReader *msr);
#endif
} floor_t;

Expand Down
13 changes: 10 additions & 3 deletions doomsday/plugins/common/include/p_mapsetup.h
Expand Up @@ -46,12 +46,19 @@ void P_FinalizeMapChange(Uri const *uri);
*/
void P_SetupMap(Uri *uri);

/**
* @param mapUri Identifier of the map to lookup the author of. Can be @c 0 in which
* case the author for the @em current map will be returned (if set).
*/
char const *P_MapAuthor(Uri const *mapUri, dd_bool supressGameAuthor);

/**
* @param mapUri Identifier of the map to lookup the title of. Can be @c 0 in which
* case the title for the @em current map will be returned (if set).
*/
char const *P_MapTitle(Uri const *mapUri);
patchid_t P_MapTitlePatch(uint episode, uint map);

char const *P_CurrentMapAuthor(dd_bool supressGameAuthor);
char const *P_CurrentMapTitle(void);
patchid_t P_MapTitlePatch(uint episode, uint map);

#if __JDOOM__ || __JDOOM64__ || __JHERETIC__
void P_FindSecrets(void);
Expand Down
8 changes: 6 additions & 2 deletions doomsday/plugins/common/include/p_plat.h
Expand Up @@ -23,6 +23,10 @@
#define LIBCOMMON_THINKER_PLAT_H

#include "doomsday.h"
#ifdef __cplusplus
# include "mapstatereader.h"
# include "mapstatewriter.h"
#endif

#define PLATWAIT (3)
#define PLATSPEED (1)
Expand Down Expand Up @@ -72,8 +76,8 @@ typedef struct plat_s {
plattype_e type;

#ifdef __cplusplus
void write(Writer *writer) const;
int read(Reader *reader, int mapVersion);
void write(MapStateWriter *msw) const;
int read(MapStateReader *msr);
#endif
} plat_t;

Expand Down

0 comments on commit 5441f43

Please sign in to comment.