From 3ca303a41c11f10aa64a9a3f41fd98e61c6b5631 Mon Sep 17 00:00:00 2001 From: danij Date: Sun, 25 Mar 2007 19:57:17 +0000 Subject: [PATCH] Fixed: In jHexen if a subsector which was made up partly by segs used 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. --- doomsday/engine/portable/include/mapdata.hs | 3 +++ doomsday/engine/portable/include/p_maptypes.h | 3 +++ doomsday/engine/portable/src/p_polyob.c | 11 ++++++++--- doomsday/engine/portable/src/rend_dyn.c | 10 ++++++++++ doomsday/engine/portable/src/rend_main.c | 11 ++++++++++- doomsday/plugins/jhexen/src/po_man.c | 3 +++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/doomsday/engine/portable/include/mapdata.hs b/doomsday/engine/portable/include/mapdata.hs index 42d2487f54..5decaa07ca 100644 --- a/doomsday/engine/portable/include/mapdata.hs +++ b/doomsday/engine/portable/include/mapdata.hs @@ -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 diff --git a/doomsday/engine/portable/include/p_maptypes.h b/doomsday/engine/portable/include/p_maptypes.h index 9adfd0829e..17112071e9 100644 --- a/doomsday/engine/portable/include/p_maptypes.h +++ b/doomsday/engine/portable/include/p_maptypes.h @@ -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 diff --git a/doomsday/engine/portable/src/p_polyob.c b/doomsday/engine/portable/src/p_polyob.c index 402d3231aa..6e024e44f6 100644 --- a/doomsday/engine/portable/src/p_polyob.c +++ b/doomsday/engine/portable/src/p_polyob.c @@ -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; @@ -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) { diff --git a/doomsday/engine/portable/src/rend_dyn.c b/doomsday/engine/portable/src/rend_dyn.c index 2366aae4b3..d69602b2e5 100644 --- a/doomsday/engine/portable/src/rend_dyn.c +++ b/doomsday/engine/portable/src/rend_dyn.c @@ -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. @@ -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. diff --git a/doomsday/engine/portable/src/rend_main.c b/doomsday/engine/portable/src/rend_main.c index 2bd13650ef..7daf74f416 100644 --- a/doomsday/engine/portable/src/rend_main.c +++ b/doomsday/engine/portable/src/rend_main.c @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/doomsday/plugins/jhexen/src/po_man.c b/doomsday/plugins/jhexen/src/po_man.c index c654672007..54d293d5c6 100644 --- a/doomsday/plugins/jhexen/src/po_man.c +++ b/doomsday/plugins/jhexen/src/po_man.c @@ -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;