Skip to content

Commit

Permalink
Refactor|World: Cleaned up Plane, Sector and Surface ctors
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jun 13, 2013
1 parent 7fa518e commit a12fb2f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 32 deletions.
10 changes: 5 additions & 5 deletions doomsday/client/include/world/plane.h
Expand Up @@ -49,10 +49,8 @@ class Plane : public de::MapElement
*/
DENG2_DEFINE_AUDIENCE(HeightChange, void planeHeightChanged(Plane &plane, coord_t oldHeight))

/*
* Property value defaults:
*/
static int const MAX_SMOOTH_MOVE; ///< 64, $smoothplane: Maximum speed for a smoothed plane.
// Constants:
static int const MAX_SMOOTH_MOVE = 64; ///< $smoothplane: Maximum speed for a smoothed plane.

public:
/**
Expand All @@ -62,7 +60,9 @@ class Plane : public de::MapElement
* @param normal Normal of the plane (will be normalized if necessary).
* @param height Height of the plane in map space coordinates.
*/
Plane(Sector &sector, de::Vector3f const &normal, coord_t height = 0);
Plane(Sector &sector,
de::Vector3f const &normal = de::Vector3f(0, 0, 1),
coord_t height = 0);

/**
* Returns the owning Sector of the plane.
Expand Down
5 changes: 4 additions & 1 deletion doomsday/client/include/world/polyobj.h
Expand Up @@ -47,6 +47,9 @@ typedef struct polyobj_s
/// The polyobj is not presently linked in the BSP. @ingroup errors
DENG2_ERROR(NotLinkedError);

/*
* Linked-element lists:
*/
typedef QList<Line *> Lines;
typedef QList<Vertex *> Vertexes;

Expand All @@ -56,7 +59,7 @@ typedef struct polyobj_s
DD_BASE_POLYOBJ_ELEMENTS()

public:
polyobj_s(de::Vector2d const &origin = de::Vector2d(0, 0));
polyobj_s(de::Vector2d const &origin = de::Vector2d());

/// @note: Does nothing about the user data section.
~polyobj_s();
Expand Down
10 changes: 2 additions & 8 deletions doomsday/client/include/world/sector.h
Expand Up @@ -82,12 +82,6 @@ class Sector : public de::MapElement
void sectorLightColorChanged(Sector &sector, de::Vector3f const &oldLightColor,
int changedComponents /*bit-field (0x1=Red, 0x2=Green, 0x4=Blue)*/))

/*
* Property value defaults:
*/
static float const DEFAULT_LIGHT_LEVEL; ///< 1.f
static de::Vector3f const DEFAULT_LIGHT_COLOR; ///< red=1.f green=1.f, blue=1.f

/*
* Linked-element lists:
*/
Expand Down Expand Up @@ -132,8 +126,8 @@ class Sector : public de::MapElement
AudioEnvironmentFactors _reverb;

public:
Sector(float lightLevel = DEFAULT_LIGHT_LEVEL,
de::Vector3f const &lightColor = DEFAULT_LIGHT_COLOR);
Sector(float lightLevel = 1,
de::Vector3f const &lightColor = de::Vector3f(1, 1, 1));

/**
* Returns the sector plane with the specified @a planeIndex.
Expand Down
12 changes: 4 additions & 8 deletions doomsday/client/include/world/surface.h
Expand Up @@ -72,12 +72,8 @@ class Surface : public de::MapElement
void tintColorChanged(Surface &sector, de::Vector3f const &oldTintColor,
int changedComponents /*bit-field (0x1=Red, 0x2=Green, 0x4=Blue)*/))

/*
* Property value defaults:
*/
static float const DEFAULT_OPACITY; ///< 1.f
static de::Vector3f const DEFAULT_TINT_COLOR; ///< red=1.f, green=1.f, blue=1.f
static int const MAX_SMOOTH_MATERIAL_MOVE; ///< 8, $smoothmatoffset: Maximum speed for a smoothed material offset.
// Constants:
static int const MAX_SMOOTH_MATERIAL_MOVE = 8; ///< Maximum speed for a smoothed material offset.

#ifdef __CLIENT__
struct DecorSource
Expand Down Expand Up @@ -111,8 +107,8 @@ class Surface : public de::MapElement
* @param tintColor Default tint color.
*/
Surface(de::MapElement &owner,
float opacity = DEFAULT_OPACITY,
de::Vector3f const &tintColor = DEFAULT_TINT_COLOR);
float opacity = 1,
de::Vector3f const &tintColor = de::Vector3f(1, 1, 1));

/**
* Returns the owning map element. Either @c DMU_SIDE, or @c DMU_PLANE.
Expand Down
3 changes: 0 additions & 3 deletions doomsday/client/src/world/plane.cpp
Expand Up @@ -37,9 +37,6 @@

using namespace de;

// $smoothplane: Maximum speed for a smoothed plane.
int const Plane::MAX_SMOOTH_MOVE = 64;

DENG2_PIMPL(Plane)
{
/// Sector that owns the plane.
Expand Down
3 changes: 0 additions & 3 deletions doomsday/client/src/world/sector.cpp
Expand Up @@ -40,9 +40,6 @@

using namespace de;

float const Sector::DEFAULT_LIGHT_LEVEL = 1.f;
Vector3f const Sector::DEFAULT_LIGHT_COLOR = Vector3f(1.f, 1.f, 1.f);

DENG2_PIMPL(Sector),
DENG2_OBSERVES(Plane, HeightChange)
{
Expand Down
4 changes: 0 additions & 4 deletions doomsday/client/src/world/surface.cpp
Expand Up @@ -36,10 +36,6 @@

using namespace de;

float const Surface::DEFAULT_OPACITY = 1.f;
Vector3f const Surface::DEFAULT_TINT_COLOR = Vector3f(1.f, 1.f, 1.f);
int const Surface::MAX_SMOOTH_MATERIAL_MOVE = 8;

DENG2_PIMPL(Surface)
{
/// Owning map element, either @c DMU_SIDE, or @c DMU_PLANE.
Expand Down

0 comments on commit a12fb2f

Please sign in to comment.