Skip to content

Commit

Permalink
Refactor|GameMap: Moved GameMap to namespace de
Browse files Browse the repository at this point in the history
Note that the global theMap variable was also moved.
  • Loading branch information
danij-deng committed Jun 6, 2013
1 parent dc49eee commit f56ae7c
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 139 deletions.
10 changes: 9 additions & 1 deletion doomsday/api/api_thinker.h
Expand Up @@ -58,7 +58,15 @@ DENG_API_TYPEDEF(Thinker)
void (*Run)(void);
void (*Add)(thinker_t* th);
void (*Remove)(thinker_t* th);
void (*SetStasis)(thinker_t* th, boolean on);

/**
* Change the 'in stasis' state of a thinker (stop it from thinking).
*
* @param th The thinker to change.
* @param on @c true, put into stasis.
*/
void (*SetStasis)(thinker_t *th, boolean on);

int (*Iterate)(thinkfunc_t func, int (*callback) (thinker_t*, void*), void* context);
}
DENG_API_T(Thinker);
Expand Down
5 changes: 4 additions & 1 deletion doomsday/client/include/audio/s_environ.h
Expand Up @@ -24,7 +24,10 @@

#include "api_uri.h"

namespace de {
class GameMap;
}

class Sector;

typedef enum audioenvironmentclass_e {
Expand Down Expand Up @@ -59,7 +62,7 @@ void S_MarkSectorReverbDirty(Sector *sec);
* two dimensions at least), they do not move and are not created/destroyed
* once the map has been loaded; this step can be pre-processed.
*/
void S_DetermineBspLeafsAffectingSectorReverb(GameMap *map);
void S_DetermineBspLeafsAffectingSectorReverb(de::GameMap *map);

/**
* Recalculates reverb properties for a sector. One must first mark the sector
Expand Down
4 changes: 3 additions & 1 deletion doomsday/client/include/edit_map.h
Expand Up @@ -22,13 +22,15 @@
#include <QList>
#include "Vertex"

namespace de {
class GameMap;
}

DENG_EXTERN_C int bspFactor;

void MPE_Register();

GameMap *MPE_GetLastBuiltMap();
de::GameMap *MPE_GetLastBuiltMap();

bool MPE_GetLastBuiltMapResult();

Expand Down
4 changes: 3 additions & 1 deletion doomsday/client/include/map/bsp/partitioner.h
Expand Up @@ -28,13 +28,15 @@

#include "map/bsp/bsptreenode.h" /// @todo remove me

class GameMap;
class BspLeaf;
class Segment;
class Line;
class Sector;

namespace de {

class GameMap;

namespace bsp {

/// Minimum length of a half-edge post partitioning. Used in cost evaluation.
Expand Down
18 changes: 11 additions & 7 deletions doomsday/client/include/map/gamemap.h
@@ -1,4 +1,4 @@
/** @file gamemap.h World Map.
/** @file map/gamemap.h World Map.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -72,6 +72,8 @@ typedef enum {
struct clplane_s;
struct clpolyobj_s;

namespace de {

/**
* World map.
*
Expand All @@ -98,7 +100,7 @@ class GameMap
typedef QSet<Surface *> SurfaceSet;

public:
de::Uri _uri;
Uri _uri;
char _oldUniqueId[256];

struct thinkers_s {
Expand Down Expand Up @@ -146,7 +148,7 @@ class GameMap
* This ID is the name of the lump tag that marks the beginning of map
* data, e.g. "MAP03" or "E2M8".
*/
de::Uri uri() const;
Uri uri() const;

/// @return The old 'unique' identifier of the map.
char const *oldUniqueId() const;
Expand Down Expand Up @@ -235,7 +237,7 @@ class GameMap
/**
* Returns the root element for the map's BSP tree.
*/
de::MapElement *bspRoot() const;
MapElement *bspRoot() const;

/**
* Provides access to the list of line segments for efficient traversal.
Expand Down Expand Up @@ -278,7 +280,7 @@ class GameMap
*
* @return BspLeaf instance for that BSP node's leaf.
*/
BspLeaf *bspLeafAtPoint(de::Vector2d const &point) const;
BspLeaf *bspLeafAtPoint(Vector2d const &point) const;

/**
* @copydoc bspLeafAtPoint()
Expand All @@ -287,7 +289,7 @@ class GameMap
* with vanilla DOOM. Note that this means there is a maximum size for the
* point: it cannot exceed the fixed-point 16.16 range (about 65k units).
*/
BspLeaf *bspLeafAtPoint_FixedPrecision(de::Vector2d const &point) const;
BspLeaf *bspLeafAtPoint_FixedPrecision(Vector2d const &point) const;

int mobjsBoxIterator(AABoxd const &box,
int (*callback) (struct mobj_s *, void *), void *parameters = 0) const;
Expand Down Expand Up @@ -625,7 +627,7 @@ class GameMap
*
* @see hasLightGrid()
*/
de::LightGrid &lightGrid();
LightGrid &lightGrid();

/**
* Initialize the ambient lighting grid (smoothed sector lighting).
Expand Down Expand Up @@ -727,4 +729,6 @@ void GameMap_SetMobjID(GameMap *map, thid_t id, boolean inUse);
// The current map.
DENG_EXTERN_C GameMap *theMap;

} // namespace de

#endif // DENG_WORLD_MAP_H
9 changes: 6 additions & 3 deletions doomsday/client/include/map/sector.h
Expand Up @@ -38,9 +38,12 @@
#endif

class BspLeaf;
class GameMap;
class Surface;

namespace de {
class GameMap;
}

/**
* @defgroup sectorFrameFlags Sector frame flags
* @ingroup map
Expand Down Expand Up @@ -212,7 +215,7 @@ class Sector : public de::MapElement,
*
* @param map Map to collate sides from. @todo Refactor away.
*/
void buildSides(GameMap const &map);
void buildSides(de::GameMap const &map);

/**
* Provides access to the list of BSP leafs which reference the sector, for
Expand All @@ -230,7 +233,7 @@ class Sector : public de::MapElement,
*
* @param map Map to collate BSP leafs from. @todo Refactor away.
*/
void buildBspLeafs(GameMap const &map);
void buildBspLeafs(de::GameMap const &map);

/**
* Provides access to the list of BSP leafs which contribute to the environmental
Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/include/render/lightgrid.h
Expand Up @@ -24,11 +24,12 @@

#include <de/Vector>

class GameMap;
class Sector;

namespace de {

class GameMap;

/**
* Simple global illumination method utilizing a 2D grid of light levels, achieving
* smoothed ambient sector lighting.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/resource/maparchive.h
Expand Up @@ -23,10 +23,10 @@
#include "dd_share.h"
#include "uri.hh"

class GameMap;

namespace de {

class GameMap;

/**
* @ingroup resource
*/
Expand Down
6 changes: 4 additions & 2 deletions doomsday/client/src/audio/s_environ.cpp
Expand Up @@ -35,6 +35,8 @@

#include "audio/s_environ.h"

using namespace de;

// Used for vertex sector owners, side line owners and reverb BSP leafs.
typedef struct ownernode_s {
void *data;
Expand Down Expand Up @@ -72,7 +74,7 @@ const char* S_AudioEnvironmentName(AudioEnvironmentClass env)
return "";
}

AudioEnvironmentClass S_AudioEnvironmentForMaterial(const Uri* uri)
AudioEnvironmentClass S_AudioEnvironmentForMaterial(uri_s const *uri)
{
if(uri)
{
Expand All @@ -81,7 +83,7 @@ AudioEnvironmentClass S_AudioEnvironmentForMaterial(const Uri* uri)
{
for(int k = 0; k < env->count.num; ++k)
{
Uri* ref = env->materials[k];
uri_s *ref = env->materials[k];
if(!ref || !Uri_Equality(ref, uri)) continue;

// See if we recognise the material name.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/client/cl_main.cpp
Expand Up @@ -32,6 +32,8 @@
#include "map/gamemap.h"
#include "render/r_main.h"

using namespace de;

extern int gotFrame;

ident_t clientID;
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/client/cl_mobj.cpp
Expand Up @@ -31,6 +31,8 @@
#include "de_play.h"
#include "de_audio.h"

using namespace de;

/// Convert 8.8/10.6 fixed point to 16.16.
#define UNFIXED8_8(x) (((x) << 16) / 256)
#define UNFIXED10_6(x) (((x) << 16) / 64)
Expand Down
26 changes: 2 additions & 24 deletions doomsday/client/src/client/cl_sound.cpp
@@ -1,4 +1,4 @@
/** @file
/** @file cl_sound.cpp Clientside Sounds.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand All @@ -17,12 +17,6 @@
* http://www.gnu.org/licenses</small>
*/

/**
* cl_sound.c: Clientside Sounds
*/

// HEADER FILES ------------------------------------------------------------

#include "de_base.h"
#include "de_console.h"
#include "de_network.h"
Expand All @@ -31,23 +25,7 @@

#include "client/cl_sound.h"

// MACROS ------------------------------------------------------------------

// TYPES -------------------------------------------------------------------

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

// PUBLIC DATA DEFINITIONS -------------------------------------------------

// PRIVATE DATA DEFINITIONS ------------------------------------------------

// CODE --------------------------------------------------------------------
using namespace de;

/**
* Read a sound delta from the message buffer and play it.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/client/cl_world.cpp
Expand Up @@ -35,6 +35,8 @@
#include "client/cl_world.h"
#include "r_util.h"

using namespace de;

#define MAX_TRANSLATIONS 16384

#define MVF_CEILING 0x1 // Move ceiling.
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/src/edit_bias.cpp
Expand Up @@ -36,6 +36,8 @@

#include "map/gamemap.h"

using namespace de;

D_CMD(BLEditor);

void SBE_MenuSave(ui_object_t *ob);
Expand Down
8 changes: 5 additions & 3 deletions doomsday/client/src/map/gamemap.cpp
@@ -1,4 +1,4 @@
/** @file gamemap.cpp World Map.
/** @file map/gamemap.cpp World Map.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -39,7 +39,7 @@
/// Size of Blockmap blocks in map units. Must be an integer power of two.
#define MAPBLOCKUNITS (128)

using namespace de;
namespace de {

DENG2_PIMPL(GameMap)
{
Expand Down Expand Up @@ -684,7 +684,7 @@ void GameMap::initLightGrid()

#endif // __CLIENT__

de::Uri GameMap::uri() const
Uri GameMap::uri() const
{
return _uri;
}
Expand Down Expand Up @@ -2004,3 +2004,5 @@ void GameMap::updateMissingMaterialsForLinesOfSector(Sector const &sec)
}

#endif // __CLIENT__

} // namespace de
1 change: 1 addition & 0 deletions doomsday/client/src/map/mesh.cpp
Expand Up @@ -21,6 +21,7 @@

#include "HEdge"
#include "Face"
#include "Vertex"

#include "map/mesh.h"

Expand Down
4 changes: 4 additions & 0 deletions doomsday/client/src/map/p_data.cpp
Expand Up @@ -55,8 +55,12 @@ static EntityDefIdMap entityDefIdMap;

extern "C" boolean mapSetup; // We are currently setting up a map.

namespace de {

GameMap *theMap; // Available globally inside the engine.

}

#undef P_MapExists
DENG_EXTERN_C boolean P_MapExists(char const *uriCString)
{
Expand Down

0 comments on commit f56ae7c

Please sign in to comment.