Skip to content

Commit

Permalink
Vertex: Added getter methods for all Vertex property values
Browse files Browse the repository at this point in the history
Plus various refactorings to move more code into the class itself.
  • Loading branch information
danij-deng committed Mar 10, 2013
1 parent 7b715c5 commit 387e6cc
Show file tree
Hide file tree
Showing 25 changed files with 519 additions and 410 deletions.
4 changes: 2 additions & 2 deletions doomsday/client/include/map/bsp/hedgeinfo.h
Expand Up @@ -80,8 +80,8 @@ struct HEdgeInfo

HEdgeInfo& initFromHEdge(HEdge const& hedge)
{
V2d_Copy(start, hedge.v[0]->origin);
V2d_Copy(end, hedge.v[1]->origin);
V2d_Copy(start, hedge.v[0]->origin());
V2d_Copy(end, hedge.v[1]->origin());
V2d_Subtract(direction, end, start);

pLength = V2d_Length(direction);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/map/bsp/hedgeintercept.h
Expand Up @@ -61,8 +61,8 @@ struct HEdgeIntercept
{
LOG_INFO("Vertex #%i [x:%f, y:%f] beforeSector: #%d afterSector: #%d %s")
<< inst.vertex->buildData.index
<< inst.vertex->origin[VX]
<< inst.vertex->origin[VY]
<< inst.vertex->origin()[VX]
<< inst.vertex->origin()[VY]
<< (inst.before? inst.before->buildData.index : -1)
<< (inst.after? inst.after->buildData.index : -1)
<< (inst.selfRef? "SELFREF" : "");
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/map/bsp/linedefinfo.h
Expand Up @@ -70,8 +70,8 @@ struct LineDefInfo
const Vertex* end = lineDef->L_v2;

// Check for zero-length line.
if((fabs(start->origin[VX] - end->origin[VX]) < distEpsilon) &&
(fabs(start->origin[VY] - end->origin[VY]) < distEpsilon))
if((fabs(start->origin()[VX] - end->origin()[VX]) < distEpsilon) &&
(fabs(start->origin()[VY] - end->origin()[VY]) < distEpsilon))
flags |= ZeroLength;

if(lineDef->L_backsidedef && lineDef->L_frontsidedef)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/map/bsp/superblockmap.h
Expand Up @@ -248,8 +248,8 @@ class SuperBlock
LOG_DEBUG("Build: %s %p sector: %d [%1.1f, %1.1f] -> [%1.1f, %1.1f]")
<< (hedge->lineDef? "NORM" : "MINI")
<< hedge << hedge->sector->buildData.index
<< hedge->v[0]->origin[VX] << hedge->v[0]->origin[VY]
<< hedge->v[1]->origin[VX] << hedge->v[1]->origin[VY];
<< hedge->v[0]->origin()[VX] << hedge->v[0]->origin()[VY]
<< hedge->v[1]->origin()[VX] << hedge->v[1]->origin()[VY];
}
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/include/map/hedge.h
Expand Up @@ -39,13 +39,13 @@
#define BACK 1

#define HE_v(n) v[(n)? 1:0]
#define HE_vorigin(n) HE_v(n)->origin
#define HE_vorigin(n) HE_v(n)->origin()

#define HE_v1 HE_v(0)
#define HE_v1origin HE_v(0)->origin
#define HE_v1origin HE_v(0)->origin()

#define HE_v2 HE_v(1)
#define HE_v2origin HE_v(1)->origin
#define HE_v2origin HE_v(1)->origin()

#define HEDGE_BACK_SECTOR(h) ((h)->twin ? (h)->twin->sector : NULL)

Expand Down
9 changes: 5 additions & 4 deletions doomsday/client/include/map/linedef.h
Expand Up @@ -33,16 +33,17 @@
#include "p_mapdata.h"
#include "p_dmu.h"
#include "MapElement"
#include "map/vertex.h"

// Helper macros for accessing linedef data elements.
#define L_v(n) v[(n)? 1:0]
#define L_vorigin(n) v[(n)? 1:0]->origin
#define L_vorigin(n) v[(n)? 1:0]->origin()

#define L_v1 L_v(0)
#define L_v1origin L_v(0)->origin
#define L_v1origin L_v(0)->origin()

#define L_v2 L_v(1)
#define L_v2origin L_v(1)->origin
#define L_v2origin L_v(1)->origin()

#define L_vo(n) vo[(n)? 1:0]
#define L_vo1 L_vo(0)
Expand Down Expand Up @@ -96,7 +97,7 @@ class LineDef : public de::MapElement
{
public:
Vertex *v[2];
struct lineowner_s* vo[2]; /// Links to vertex line owner nodes [left, right].
LineOwner *vo[2]; /// Links to vertex line owner nodes [left, right].
lineside_t sides[2];
int flags; /// Public DDLF_* flags.
byte inFlags; /// Internal LF_* flags.
Expand Down
10 changes: 5 additions & 5 deletions doomsday/client/include/map/r_world.h
Expand Up @@ -187,18 +187,18 @@ boolean R_IsGlowingPlane(const Plane* plane);
/// @return Current glow strength for the plane.
float R_GlowStrength(const Plane* pln);

lineowner_t* R_GetVtxLineOwner(const Vertex* vtx, const LineDef* line);
LineOwner* R_GetVtxLineOwner(const Vertex* vtx, const LineDef* line);

#ifdef __CLIENT__
/**
* A neighbour is a line that shares a vertex with 'line', and faces the
* specified sector.
*/
LineDef* R_FindLineNeighbor(const Sector* sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
const LineOwner* own, boolean antiClockwise, binangle_t* diff);

LineDef* R_FindSolidLineNeighbor(const Sector *sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
const LineOwner* own, boolean antiClockwise, binangle_t* diff);

/**
* A line's align neighbor is a line that shares a vertex with 'line' and
Expand All @@ -207,14 +207,14 @@ LineDef* R_FindSolidLineNeighbor(const Sector *sector, const LineDef* line,
* long sidedef by the shadow generator).
*/
LineDef* R_FindLineAlignNeighbor(const Sector* sec, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, int alignment);
const LineOwner* own, boolean antiClockwise, int alignment);

/**
* Find a backneighbour for the given line. They are the neighbouring line
* in the backsector of the imediate line neighbor.
*/
LineDef* R_FindLineBackNeighbor(const Sector* sector, const LineDef* line,
const lineowner_t* own, boolean antiClockwise, binangle_t* diff);
const LineOwner* own, boolean antiClockwise, binangle_t* diff);
#endif // __CLIENT__

/**
Expand Down

0 comments on commit 387e6cc

Please sign in to comment.