Skip to content

Commit

Permalink
HEdge: Removed the redundant flags member
Browse files Browse the repository at this point in the history
This was only used to record whether a HEdge belongs to Polyobj
and as we can determine this by checking the LineDef flag, it is
therefore redundant.
  • Loading branch information
danij-deng committed Apr 15, 2012
1 parent 10faf64 commit 7b7bc40
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 30 deletions.
1 change: 0 additions & 1 deletion doomsday/engine/api/dd_maptypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#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_HEDGE_NEXT DDVT_PTR
Expand Down
4 changes: 0 additions & 4 deletions doomsday/engine/portable/include/mapdata.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ internal
#define HEDGE_BACK_SECTOR(h) ((h)->twin ? (h)->twin->sector : NULL)
#define HEDGE_SIDEDEF(h) ((h)->lineDef->sideDefs[(h)->side])

// HEdge flags
#define HEDGEF_POLYOBJ 0x1 /// < Half-edge is part of a poly object.

// HEdge frame flags
#define HEDGEINF_FACINGFRONT 0x0001

Expand Down Expand Up @@ -94,7 +91,6 @@ struct HEdge
PTR sector_s* sector
ANGLE angle_t angle
BYTE byte side // 0=front, 1=back
BYTE byte flags
FLOAT float length // Accurate length of the segment (v1 -> v2).
FLOAT float offset
- biassurface_t*[3] bsuf // 0=middle, 1=top, 2=bottom
Expand Down
4 changes: 0 additions & 4 deletions doomsday/engine/portable/include/p_maptypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ typedef struct vertex_s {
#define HEDGE_BACK_SECTOR(h) ((h)->twin ? (h)->twin->sector : NULL)
#define HEDGE_SIDEDEF(h) ((h)->lineDef->sideDefs[(h)->side])

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

// HEdge frame flags
#define HEDGEINF_FACINGFRONT 0x0001

Expand All @@ -88,7 +85,6 @@ typedef struct hedge_s {
struct sector_s* sector;
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
Expand Down
4 changes: 0 additions & 4 deletions doomsday/engine/portable/src/dam_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ static void writeSeg(GameMap* map, HEdge* s)
writeLong(s->twin? (GameMap_HEdgeIndex(map, s->twin) + 1) : 0);
writeLong((long) s->angle);
writeByte(s->side);
writeByte(s->flags);
writeLong(s->next? (GameMap_HEdgeIndex(map, s->next) + 1) : 0);
writeLong(s->twin? (GameMap_HEdgeIndex(map, s->prev) + 1) : 0);
}
Expand All @@ -740,7 +739,6 @@ static void readSeg(GameMap* map, HEdge* s)
s->twin = (obIdx == 0? NULL : GameMap_HEdge(map, (unsigned) obIdx - 1));
s->angle = (angle_t) readLong();
s->side = readByte();
s->flags = readByte();
obIdx = readLong();
s->next = (obIdx == 0? NULL : GameMap_HEdge(map, (unsigned) obIdx - 1));
obIdx = readLong();
Expand Down Expand Up @@ -927,7 +925,6 @@ static void writePolyobj(GameMap* map, uint idx)
writeLong(he->sector? (GameMap_SectorIndex(map, he->sector) + 1) : 0);
writeLong((long) he->angle);
writeByte(he->side);
writeByte(he->flags);
}
}

Expand Down Expand Up @@ -976,7 +973,6 @@ static void readPolyobj(GameMap* map, uint idx)
he->sector = (obIdx == 0? NULL : &map->sectors[(unsigned) obIdx - 1]);
he->angle = (angle_t) readLong();
he->side = (readByte()? 1 : 0);
he->flags = readByte();

line = he->lineDef;
line->L_frontside->hedgeLeft = line->L_frontside->hedgeRight = he;
Expand Down
1 change: 0 additions & 1 deletion doomsday/engine/portable/src/edit_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ static void hardenPolyobjs(GameMap* dest, editmap_t* src)
hedge->twin = NULL;
hedge->bspLeaf = NULL;
hedge->sector = line->L_frontsector;
hedge->flags |= HEDGEF_POLYOBJ;

line->L_frontside->hedgeLeft = line->L_frontside->hedgeRight = hedge;

Expand Down
14 changes: 2 additions & 12 deletions doomsday/engine/portable/src/hedge.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,8 @@ void HEdge_Delete(HEdge* hedge)

int HEdge_SetProperty(HEdge* hedge, const setargs_t* args)
{
switch(args->prop)
{
case DMU_FLAGS:
DMU_SetValue(DMT_HEDGE_FLAGS, &hedge->flags, args, 0);
break;
default:
Con_Error("HEdge_SetProperty: Property %s is not writable.\n", DMU_Str(args->prop));
}

assert(hedge);
Con_Error("HEdge_SetProperty: Property %s is not writable.\n", DMU_Str(args->prop));
return false; // Continue iteration.
}

Expand Down Expand Up @@ -101,9 +94,6 @@ int HEdge_GetProperty(const HEdge* hedge, setargs_t* args)
DMU_GetValue(DMT_HEDGE_SECTOR, &sec, args, 0);
break;
}
case DMU_FLAGS:
DMU_GetValue(DMT_HEDGE_FLAGS, &hedge->flags, args, 0);
break;
case DMU_ANGLE:
DMU_GetValue(DMT_HEDGE_ANGLE, &hedge->angle, args, 0);
break;
Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/portable/src/rend_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static void calcSegDivisions(walldiv_t* div, const HEdge* hedge,
div->num = 0;

// Polyobj hedges are never split.
if(hedge->flags & HEDGEF_POLYOBJ) return;
if(hedge->lineDef && (hedge->lineDef->flags & LF_POLYOBJ)) return;

// Only hedges at sidedef ends can/should be split.
side = HEDGE_SIDEDEF(hedge);
Expand Down Expand Up @@ -2654,7 +2654,7 @@ static void occludeBspLeaf(const BspLeaf* bspLeaf, boolean forwardFacing)
{
// Occlusions can only happen where two sectors contact.
if(hedge->lineDef &&
HEDGE_BACK_SECTOR(hedge) && !(hedge->flags & HEDGEF_POLYOBJ) && // Polyobjects don't occlude.
HEDGE_BACK_SECTOR(hedge) && !(hedge->lineDef->flags & LF_POLYOBJ) && // Polyobjects don't occlude.
(forwardFacing == ((hedge->frameFlags & HEDGEINF_FACINGFRONT)? true : false)))
{
back = HEDGE_BACK_SECTOR(hedge);
Expand Down Expand Up @@ -2775,8 +2775,8 @@ static void Rend_RenderBspLeaf(BspLeaf* bspLeaf)
HEdge* hedge = bspLeaf->hedge;
do
{
if(!(hedge->flags & HEDGEF_POLYOBJ) &&// Not handled here.
hedge->lineDef && // "minisegs" have no linedefs.
if(hedge->lineDef && // "minisegs" have no linedefs.
!(hedge->lineDef->flags & LF_POLYOBJ) && // Not handled here.
(hedge->frameFlags & HEDGEINF_FACINGFRONT))
{
boolean solid;
Expand Down

0 comments on commit 7b7bc40

Please sign in to comment.