Skip to content

Commit

Permalink
Fixed: In jHexen if a subsector which was made up partly by segs used…
Browse files Browse the repository at this point in the history
… to form a polyobject, was visible at the same time as that polyobject: the segs were rendered twice (once as part of the wall drawing and again when dealing with just the poly object's segs).

Fixed: In jHexen, the movement of camera players was obstructed by polyobjects.
  • Loading branch information
danij committed Mar 25, 2007
1 parent 714f877 commit 3ca303a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doomsday/engine/portable/include/mapdata.hs
Expand Up @@ -20,6 +20,9 @@ internal
#define SG_frontsector sec[FRONT]
#define SG_backsector sec[BACK]

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

// Seg frame flags
#define SEGINF_FACINGFRONT 0x0001
#define SEGINF_BACKSECSKYFIX 0x0002
Expand Down
3 changes: 3 additions & 0 deletions doomsday/engine/portable/include/p_maptypes.h
Expand Up @@ -24,6 +24,9 @@ typedef struct vertex_s {
#define SG_frontsector sec[FRONT]
#define SG_backsector sec[BACK]

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

// Seg frame flags
#define SEGINF_FACINGFRONT 0x0001
#define SEGINF_BACKSECSKYFIX 0x0002
Expand Down
11 changes: 8 additions & 3 deletions doomsday/engine/portable/src/p_polyob.c
Expand Up @@ -164,7 +164,7 @@ void UpdateSegBBox(seg_t *seg)
void PO_SetupPolyobjs(void)
{
uint i, j, k, num;
seg_t **segList;
seg_t **segList, *seg;
line_t *line;
side_t *side;

Expand All @@ -174,9 +174,14 @@ void PO_SetupPolyobjs(void)
num = polyobjs[i].numsegs;
for(j = 0; j < num; ++j, segList++)
{
if((*segList)->linedef)
seg = (*segList);

// Mark this as a poly object seg.
seg->flags |= SEGF_POLYOBJ;

if(seg->linedef)
{
line = (*segList)->linedef;
line = seg->linedef;

for(k = 0; k < 2; ++k)
{
Expand Down
10 changes: 10 additions & 0 deletions doomsday/engine/portable/src/rend_dyn.c
Expand Up @@ -1513,7 +1513,12 @@ static boolean DL_LightSegIteratorFunc(lumobj_t *lum, subsector_t *ssec)
for(j = 0, seg = ssec->firstseg; j < ssec->segcount; ++j, seg++)
{
if(seg->linedef) // "minisegs" have no linedefs.
{
if(seg->flags & SEGF_POLYOBJ)
continue;

DL_ProcessWallSeg(lum, seg, ssec);
}
}

// Is there a polyobj on board? Light it, too.
Expand Down Expand Up @@ -1641,7 +1646,12 @@ void DL_ProcessSubsector(subsector_t *ssec)
for(j = 0, seg = ssec->firstseg; j < num; ++j, seg++)
{
if(seg->linedef) // "minisegs" have no linedefs.
{
if(seg->flags & SEGF_POLYOBJ)
continue;

DL_ProcessSegForGlow(seg, sect);
}
}

// Is there a polyobj on board? Light it, too.
Expand Down
11 changes: 10 additions & 1 deletion doomsday/engine/portable/src/rend_main.c
Expand Up @@ -1605,7 +1605,7 @@ static void Rend_MarkSegsFacingFront(subsector_t *sub)
for(i = 0, seg = sub->firstseg; i < sub->segcount; ++i, seg++)
{
// Occlusions can only happen where two sectors contact.
if(!seg->linedef)
if(!seg->linedef || (seg->flags & SEGF_POLYOBJ))
continue;

seg->frameflags &= ~SEGINF_BACKSECSKYFIX;
Expand Down Expand Up @@ -1694,6 +1694,9 @@ static void Rend_SSectSkyFixes(subsector_t *ssec)
if(!side)
continue;

if(seg->flags & SEGF_POLYOBJ) // No sky fixes for polyobj segs.
continue;

backsec = seg->SG_backsector;
frontsec = seg->SG_frontsector;

Expand Down Expand Up @@ -1823,6 +1826,9 @@ static void Rend_OccludeSubsector(subsector_t *sub, boolean forward_facing)
if(!seg->linedef || !seg->SG_backsector)
continue;

if(seg->flags & SEGF_POLYOBJ)
continue; // Polyobjects don't occlude.

if(forward_facing != (seg->frameflags & SEGINF_FACINGFRONT))
continue;

Expand Down Expand Up @@ -2003,6 +2009,9 @@ static void Rend_RenderSubsector(uint ssecidx)
// Draw the walls.
for(j = 0, seg = ssec->firstseg; j < ssec->segcount; ++j, seg++)
{
if(seg->flags & SEGF_POLYOBJ) // Not handled here.
continue;

if(seg->linedef == NULL) // "minisegs" have no linedefs.
continue;

Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/jhexen/src/po_man.c
Expand Up @@ -629,6 +629,9 @@ static void ThrustMobj(mobj_t *mobj, seg_t *seg, polyobj_t * po)
if(IS_CLIENT)
return;

if(P_IsCamera(mobj)) // Cameras don't interact with polyobjs.
return;

if(!(mobj->flags & MF_SHOOTABLE) && !mobj->player)
{
return;
Expand Down

0 comments on commit 3ca303a

Please sign in to comment.