Skip to content

Commit

Permalink
Refactor: Renamed seg_t as HEdge
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 2, 2012
1 parent 8e370df commit 485ea4d
Show file tree
Hide file tree
Showing 44 changed files with 762 additions and 762 deletions.
30 changes: 15 additions & 15 deletions doomsday/engine/api/dd_maptypes.h
Expand Up @@ -6,21 +6,21 @@
#define DMT_VERTEX_POS DDVT_FLOAT


#define DMT_SEG_SIDEDEF DDVT_PTR
#define DMT_HEDGE_SIDEDEF DDVT_PTR

#define DMT_SEG_V DDVT_PTR // [Start, End] of the segment.
#define DMT_SEG_LINEDEF DDVT_PTR
#define DMT_SEG_SEC DDVT_PTR
#define DMT_SEG_SUBSECTOR DDVT_PTR
#define DMT_SEG_BACKSEG DDVT_PTR
#define DMT_SEG_ANGLE DDVT_ANGLE
#define DMT_SEG_SIDE DDVT_BYTE // 0=front, 1=back
#define DMT_SEG_FLAGS DDVT_BYTE
#define DMT_SEG_LENGTH DDVT_FLOAT // Accurate length of the segment (v1 -> v2).
#define DMT_SEG_OFFSET DDVT_FLOAT
#define DMT_HEDGE_V DDVT_PTR // [Start, End] of the segment.
#define DMT_HEDGE_LINEDEF DDVT_PTR
#define DMT_HEDGE_SEC DDVT_PTR
#define DMT_HEDGE_SUBSECTOR DDVT_PTR
#define DMT_HEDGE_TWIN DDVT_PTR
#define DMT_HEDGE_ANGLE DDVT_ANGLE
#define DMT_HEDGE_SIDE DDVT_BYTE // 0=front, 1=back
#define DMT_HEDGE_FLAGS DDVT_BYTE
#define DMT_HEDGE_LENGTH DDVT_FLOAT // Accurate length of the segment (v1 -> v2).
#define DMT_HEDGE_OFFSET DDVT_FLOAT

#define DMT_SUBSECTOR_SEGCOUNT DDVT_UINT
#define DMT_SUBSECTOR_SEGS DDVT_PTR // [segcount] size.
#define DMT_SUBSECTOR_HEDGECOUNT DDVT_UINT
#define DMT_SUBSECTOR_HEDGES DDVT_PTR // [hedgeCount] size.
#define DMT_SUBSECTOR_POLYOBJ DDVT_PTR // NULL, if there is no polyobj.
#define DMT_SUBSECTOR_SECTOR DDVT_PTR

Expand Down Expand Up @@ -57,8 +57,8 @@
#define DMT_SECTOR_PLANECOUNT DDVT_UINT
#define DMT_SECTOR_REVERB DDVT_FLOAT

#define DMT_SIDEDEF_SEGCOUNT DDVT_UINT
#define DMT_SIDEDEF_SEGS DDVT_PTR // [segcount] size, segs arranged left>right
#define DMT_SIDEDEF_HEDGECOUNT DDVT_UINT
#define DMT_SIDEDEF_HEDGES DDVT_PTR // [hedgeCount] size, hedges arranged left>right
#define DMT_SIDEDEF_LINE DDVT_PTR
#define DMT_SIDEDEF_SECTOR DDVT_PTR
#define DMT_SIDEDEF_FLAGS DDVT_SHORT
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -276,7 +276,7 @@ enum {
DD_LINE_COUNT,
DD_SIDE_COUNT,
DD_VERTEX_COUNT,
DD_SEG_COUNT,
DD_HEDGE_COUNT,
DD_SUBSECTOR_COUNT,
DD_NODE_COUNT,
DD_POLYOBJ_COUNT,
Expand Down Expand Up @@ -653,7 +653,7 @@ enum {
DMU_NONE = 0,

DMU_VERTEX = 1,
DMU_SEG,
DMU_HEDGE,
DMU_LINEDEF,
DMU_SIDEDEF,
DMU_NODE,
Expand Down Expand Up @@ -724,7 +724,7 @@ enum {
DMU_HEIGHT,
DMU_TARGET_HEIGHT,
DMU_SPEED,
DMU_SEG_COUNT
DMU_HEDGE_COUNT
};

/**
Expand Down Expand Up @@ -1066,8 +1066,8 @@ typedef struct aaboxf_s {
angle_t angle; \
angle_t destAngle; /* Destination angle. */ \
angle_t angleSpeed; /* Rotation speed. */ \
unsigned int numSegs; \
struct seg_s** segs; \
unsigned int numHEdges; \
struct hedge_s** hedges; \
struct fvertex_s* originalPts; /* Used as the base for the rotations. */ \
struct fvertex_s* prevPts; /* Use to restore the old point values. */ \
float speed; /* Movement speed. */ \
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_types.h
Expand Up @@ -208,7 +208,7 @@ struct node_s;
struct vertex_s;
struct linedef_s;
struct side_s;
struct seg_s;
struct hedge_s;
struct subsector_s;
struct sector_s;
struct polyblock_s;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/doomsday.h
Expand Up @@ -69,7 +69,7 @@ extern "C" {
typedef struct vertex_s {int type; } vertex_t;
typedef struct linedef_s { int type; } linedef_t;
typedef struct sidedef_s { int type; } sidedef_t;
typedef struct seg_s { int type; } seg_t;
typedef struct hedge_s { int type; } HEdge;
typedef struct subsector_s { int type; } subsector_t;
typedef struct sector_s { int type; } sector_t;
typedef struct plane_s { int type; } plane_t;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/data/cphelp.txt
Expand Up @@ -1045,7 +1045,7 @@ desc = 1=Filter camera movement between game tics (OBSOLETE).
desc = 1=Load generated GL nodes data from the bspcache directory. 0=Always generate new GL data.

[bsp-factor]
desc = glBSP: changes the cost assigned to SEG splits (default: 7).
desc = glBSP: changes the cost assigned to edge splits (default: 7).

[con-show-during-setup]
desc = 1=Show console when a map is being loaded.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/p_linedef.h
Expand Up @@ -87,7 +87,7 @@ boolean LineDef_BackClosed(const linedef_t* lineDef, int side, boolean ignoreOpa

/**
* The DOOM lighting model applies a sector light level delta when drawing
* Segs based on their 2D world angle.
* line segments based on their 2D world angle.
*
* @param lineDef LineDef to calculate delta for.
* @param side Side of the LineDef we are interested in.
Expand Down
12 changes: 6 additions & 6 deletions doomsday/engine/portable/include/p_mapdata.h
Expand Up @@ -47,14 +47,14 @@
#define GET_SIDE_IDX(si) ( (int) ((si) - sideDefs) )
#define GET_SECTOR_IDX(sec) ( (int) ((sec) - sectors) )
#define GET_SUBSECTOR_IDX(sub) ( (int) ((sub) - ssectors) )
#define GET_SEG_IDX(seg) ( (int) ((seg) - segs) )
#define GET_HEDGE_IDX(he) ( (int) ((he) - hedges) )
#define GET_NODE_IDX(nd) ( (int) ((nd) - nodes) )

// Return the index of plane within a sector's planes array.
#define GET_PLANE_IDX(pln) ( (int) ((pln) - (pln)->sector->planes[0]) )

#define VERTEX_PTR(i) (&vertexes[i])
#define SEG_PTR(i) (&segs[i])
#define HEDGE_PTR(i) (&hedges[i])
#define SECTOR_PTR(i) (&sectors[i])
#define SUBSECTOR_PTR(i) (&ssectors[i])
#define NODE_PTR(i) (&nodes[i])
Expand Down Expand Up @@ -268,8 +268,8 @@ extern Uri* mapUri;
extern uint numVertexes;
extern vertex_t* vertexes;

extern uint numSegs;
extern seg_t* segs;
extern uint numHEdges;
extern HEdge* hedges;

extern uint numSectors;
extern sector_t* sectors;
Expand Down Expand Up @@ -302,8 +302,8 @@ typedef struct gamemap_s {
uint numVertexes;
vertex_t* vertexes;

uint numSegs;
seg_t* segs;
uint numHEdges;
HEdge* hedges;

uint numSectors;
sector_t* sectors;
Expand Down
130 changes: 65 additions & 65 deletions doomsday/engine/portable/include/p_maptypes.h
Expand Up @@ -49,53 +49,53 @@ typedef struct vertex_s {
mvertex_t buildData;
} vertex_t;

// Helper macros for accessing seg data elements.
// Helper macros for accessing hedge data elements.
#define FRONT 0
#define BACK 1

#define SG_v(n) v[(n)]
#define SG_vpos(n) SG_v(n)->V_pos
#define HE_v(n) v[(n)? 1:0]
#define HE_vpos(n) HE_v(n)->V_pos

#define SG_v1 SG_v(0)
#define SG_v1pos SG_v(0)->V_pos
#define HE_v1 HE_v(0)
#define HE_v1pos HE_v(0)->V_pos

#define SG_v2 SG_v(1)
#define SG_v2pos SG_v(1)->V_pos
#define HE_v2 HE_v(1)
#define HE_v2pos HE_v(1)->V_pos

#define SG_sector(n) sec[(n)]
#define SG_frontsector SG_sector(FRONT)
#define SG_backsector SG_sector(BACK)
#define HE_sector(n) sec[(n)? 1:0]
#define HE_frontsector HE_sector(FRONT)
#define HE_backsector HE_sector(BACK)

#define SEG_SIDEDEF(s) ((s)->lineDef->sideDefs[(s)->side])
#define HEDGE_SIDEDEF(s) ((s)->lineDef->sideDefs[(s)->side])

// Seg flags
#define SEGF_POLYOBJ 0x1 // Seg is part of a poly object.
// HEdge flags
#define HEDGEF_POLYOBJ 0x1 // HEdge is part of a poly object.

// Seg frame flags
#define SEGINF_FACINGFRONT 0x0001
// HEdge frame flags
#define HEDGEINF_FACINGFRONT 0x0001

typedef struct seg_s {
typedef struct hedge_s {
runtime_mapdata_header_t header;
struct vertex_s* v[2]; // [Start, End] of the segment.
struct linedef_s* lineDef;
struct sector_s* sec[2];
struct subsector_s* subsector;
struct seg_s* backSeg;
struct hedge_s* twin;
angle_t angle;
byte side; // 0=front, 1=back
byte flags;
float length; // Accurate length of the segment (v1 -> v2).
float offset;
biassurface_t* bsuf[3]; // 0=middle, 1=top, 2=bottom
short frameFlags;
} seg_t;
} HEdge;

#define SUBF_MIDPOINT 0x80 // Midpoint is tri-fan centre.

typedef struct subsector_s {
runtime_mapdata_header_t header;
unsigned int segCount;
struct seg_s** segs; // [segcount] size.
unsigned int hedgeCount;
struct hedge_s** hedges; // [hedgeCount] size.
struct polyobj_s* polyObj; // NULL, if there is no polyobj.
struct sector_s* sector;
int addSpriteCount; // frame number of last R_AddSprites
Expand Down Expand Up @@ -306,12 +306,12 @@ typedef struct sector_s {
msector_t buildData;
} sector_t;

// Parts of a wall segment.
typedef enum segsection_e {
SEG_MIDDLE,
SEG_TOP,
SEG_BOTTOM
} segsection_t;
// Sidedef sections.
typedef enum sidedefsection_e {
SS_MIDDLE,
SS_TOP,
SS_BOTTOM
} sidedefsection_t;

// Helper macros for accessing sidedef top/middle/bottom section data elements.
#define SW_surface(n) sections[(n)]
Expand All @@ -326,42 +326,42 @@ typedef enum segsection_e {
#define SW_surfacergba(n) SW_surface(n).rgba
#define SW_surfaceblendmode(n) SW_surface(n).blendMode

#define SW_middlesurface SW_surface(SEG_MIDDLE)
#define SW_middleflags SW_surfaceflags(SEG_MIDDLE)
#define SW_middleinflags SW_surfaceinflags(SEG_MIDDLE)
#define SW_middlematerial SW_surfacematerial(SEG_MIDDLE)
#define SW_middletangent SW_surfacetangent(SEG_MIDDLE)
#define SW_middlebitangent SW_surfacebitangent(SEG_MIDDLE)
#define SW_middlenormal SW_surfacenormal(SEG_MIDDLE)
#define SW_middletexmove SW_surfacetexmove(SEG_MIDDLE)
#define SW_middleoffset SW_surfaceoffset(SEG_MIDDLE)
#define SW_middlevisoffset SW_surfacevisoffset(SEG_MIDDLE)
#define SW_middlergba SW_surfacergba(SEG_MIDDLE)
#define SW_middleblendmode SW_surfaceblendmode(SEG_MIDDLE)

#define SW_topsurface SW_surface(SEG_TOP)
#define SW_topflags SW_surfaceflags(SEG_TOP)
#define SW_topinflags SW_surfaceinflags(SEG_TOP)
#define SW_topmaterial SW_surfacematerial(SEG_TOP)
#define SW_toptangent SW_surfacetangent(SEG_TOP)
#define SW_topbitangent SW_surfacebitangent(SEG_TOP)
#define SW_topnormal SW_surfacenormal(SEG_TOP)
#define SW_toptexmove SW_surfacetexmove(SEG_TOP)
#define SW_topoffset SW_surfaceoffset(SEG_TOP)
#define SW_topvisoffset SW_surfacevisoffset(SEG_TOP)
#define SW_toprgba SW_surfacergba(SEG_TOP)

#define SW_bottomsurface SW_surface(SEG_BOTTOM)
#define SW_bottomflags SW_surfaceflags(SEG_BOTTOM)
#define SW_bottominflags SW_surfaceinflags(SEG_BOTTOM)
#define SW_bottommaterial SW_surfacematerial(SEG_BOTTOM)
#define SW_bottomtangent SW_surfacetangent(SEG_BOTTOM)
#define SW_bottombitangent SW_surfacebitangent(SEG_BOTTOM)
#define SW_bottomnormal SW_surfacenormal(SEG_BOTTOM)
#define SW_bottomtexmove SW_surfacetexmove(SEG_BOTTOM)
#define SW_bottomoffset SW_surfaceoffset(SEG_BOTTOM)
#define SW_bottomvisoffset SW_surfacevisoffset(SEG_BOTTOM)
#define SW_bottomrgba SW_surfacergba(SEG_BOTTOM)
#define SW_middlesurface SW_surface(SS_MIDDLE)
#define SW_middleflags SW_surfaceflags(SS_MIDDLE)
#define SW_middleinflags SW_surfaceinflags(SS_MIDDLE)
#define SW_middlematerial SW_surfacematerial(SS_MIDDLE)
#define SW_middletangent SW_surfacetangent(SS_MIDDLE)
#define SW_middlebitangent SW_surfacebitangent(SS_MIDDLE)
#define SW_middlenormal SW_surfacenormal(SS_MIDDLE)
#define SW_middletexmove SW_surfacetexmove(SS_MIDDLE)
#define SW_middleoffset SW_surfaceoffset(SS_MIDDLE)
#define SW_middlevisoffset SW_surfacevisoffset(SS_MIDDLE)
#define SW_middlergba SW_surfacergba(SS_MIDDLE)
#define SW_middleblendmode SW_surfaceblendmode(SS_MIDDLE)

#define SW_topsurface SW_surface(SS_TOP)
#define SW_topflags SW_surfaceflags(SS_TOP)
#define SW_topinflags SW_surfaceinflags(SS_TOP)
#define SW_topmaterial SW_surfacematerial(SS_TOP)
#define SW_toptangent SW_surfacetangent(SS_TOP)
#define SW_topbitangent SW_surfacebitangent(SS_TOP)
#define SW_topnormal SW_surfacenormal(SS_TOP)
#define SW_toptexmove SW_surfacetexmove(SS_TOP)
#define SW_topoffset SW_surfaceoffset(SS_TOP)
#define SW_topvisoffset SW_surfacevisoffset(SS_TOP)
#define SW_toprgba SW_surfacergba(SS_TOP)

#define SW_bottomsurface SW_surface(SS_BOTTOM)
#define SW_bottomflags SW_surfaceflags(SS_BOTTOM)
#define SW_bottominflags SW_surfaceinflags(SS_BOTTOM)
#define SW_bottommaterial SW_surfacematerial(SS_BOTTOM)
#define SW_bottomtangent SW_surfacetangent(SS_BOTTOM)
#define SW_bottombitangent SW_surfacebitangent(SS_BOTTOM)
#define SW_bottomnormal SW_surfacenormal(SS_BOTTOM)
#define SW_bottomtexmove SW_surfacetexmove(SS_BOTTOM)
#define SW_bottomoffset SW_surfaceoffset(SS_BOTTOM)
#define SW_bottomvisoffset SW_surfacevisoffset(SS_BOTTOM)
#define SW_bottomrgba SW_surfacergba(SS_BOTTOM)

#define FRONT 0
#define BACK 1
Expand All @@ -375,8 +375,8 @@ typedef struct msidedef_s {
typedef struct sidedef_s {
runtime_mapdata_header_t header;
surface_t sections[3];
unsigned int segCount;
struct seg_s** segs; // [segcount] size, segs arranged left>right
unsigned int hedgeCount;
struct hedge_s** hedges; // [hedgeCount] size, hedges arranged left>right
struct linedef_s* line;
struct sector_s* sector;
short flags;
Expand Down Expand Up @@ -433,7 +433,7 @@ typedef struct mlinedef_s {

// Normally NULL, except when this linedef directly overlaps an earlier
// one (a rarely-used trick to create higher mid-masked textures).
// No segs should be created for these overlapping linedefs.
// No hedges should be created for these overlapping linedefs.
struct linedef_s *overlap;
} mlinedef_t;

Expand Down
18 changes: 9 additions & 9 deletions doomsday/engine/portable/include/p_seg.h
@@ -1,4 +1,4 @@
/**\file p_seg.h
/**\file p_hedge.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
Expand All @@ -23,23 +23,23 @@
*/

/**
* Map Seg.
* Map Half-edge.
*/

#ifndef LIBDENG_MAP_SEG_H
#define LIBDENG_MAP_SEG_H
#ifndef LIBDENG_MAP_HEDGE_H
#define LIBDENG_MAP_HEDGE_H

#include "r_data.h"
#include "p_dmu.h"

/**
* Update the seg, property is selected by DMU_* name.
* Update the half-edge, property is selected by DMU_* name.
*/
int Seg_GetProperty(const seg_t* seg, setargs_t* args);
int HEdge_GetProperty(const HEdge* hedge, setargs_t* args);

/**
* Get the value of a seg property, selected by DMU_* name.
* Get the value of a half-edge property, selected by DMU_* name.
*/
int Seg_SetProperty(seg_t* seg, const setargs_t* args);
int HEdge_SetProperty(HEdge* hedge, const setargs_t* args);

#endif /* LIBDENG_MAP_SEG_H */
#endif /* LIBDENG_MAP_HEDGE_H */
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/r_fakeradio.h
Expand Up @@ -32,7 +32,7 @@
* wall segments and determining, which subsector vertices will be
* shadowed.
*
* In other words, walls use shadow polygons (over entire segs), while
* In other words, walls use shadow polygons (over entire hedges), while
* planes use vertex lighting. Since planes are usually tesselated
* into a great deal of subsectors (and triangles), they are better
* suited for vertex lighting. In some cases we will be forced to
Expand Down

0 comments on commit 485ea4d

Please sign in to comment.