From 808f6fd842f581f31aa0d91617a759af46fdc732 Mon Sep 17 00:00:00 2001 From: James Haley Date: Mon, 7 Feb 2011 01:50:40 +0000 Subject: Added graphical intro loading screen, and -nograph parameter which disables it. Made most D_DoomMain messages dependent on -devparm. wipegamestate should start == 1, which is currently GS_UNKNOWN. Changed -wart behavior. Verified *no* changes in Strife to p_sight.c. Subversion-branch: /branches/strife-branch Subversion-revision: 2251 --- src/strife/p_sight.c | 332 ++++++++++++++++++++++++++------------------------- 1 file changed, 171 insertions(+), 161 deletions(-) (limited to 'src/strife/p_sight.c') diff --git a/src/strife/p_sight.c b/src/strife/p_sight.c index 79c1bb1d..e0b2ad3c 100644 --- a/src/strife/p_sight.c +++ b/src/strife/p_sight.c @@ -37,66 +37,68 @@ // // P_CheckSight // -fixed_t sightzstart; // eye z of looker -fixed_t topslope; -fixed_t bottomslope; // slopes to top and bottom of target +fixed_t sightzstart; // eye z of looker +fixed_t topslope; +fixed_t bottomslope; // slopes to top and bottom of target -divline_t strace; // from t1 to t2 -fixed_t t2x; -fixed_t t2y; +divline_t strace; // from t1 to t2 +fixed_t t2x; +fixed_t t2y; -int sightcounts[2]; +int sightcounts[2]; // // P_DivlineSide // Returns side 0 (front), 1 (back), or 2 (on). // +// [STRIFE] Verified unmodified +// int P_DivlineSide -( fixed_t x, - fixed_t y, - divline_t* node ) +( fixed_t x, + fixed_t y, + divline_t* node ) { - fixed_t dx; - fixed_t dy; - fixed_t left; - fixed_t right; + fixed_t dx; + fixed_t dy; + fixed_t left; + fixed_t right; if (!node->dx) { - if (x==node->x) - return 2; - - if (x <= node->x) - return node->dy > 0; + if (x==node->x) + return 2; + + if (x <= node->x) + return node->dy > 0; - return node->dy < 0; + return node->dy < 0; } - + if (!node->dy) { - if (x==node->y) - return 2; + if (x==node->y) + return 2; - if (y <= node->y) - return node->dx < 0; + if (y <= node->y) + return node->dx < 0; - return node->dx > 0; + return node->dx > 0; } - + dx = (x - node->x); dy = (y - node->y); left = (node->dy>>FRACBITS) * (dx>>FRACBITS); right = (dy>>FRACBITS) * (node->dx>>FRACBITS); - + if (right < left) - return 0; // front side - + return 0; // front side + if (left == right) - return 2; - return 1; // back side + return 2; + return 1; // back side } @@ -106,23 +108,25 @@ P_DivlineSide // along the first divline. // This is only called by the addthings and addlines traversers. // +// [STRIFE] Verified unmodified +// fixed_t P_InterceptVector2 -( divline_t* v2, - divline_t* v1 ) +( divline_t* v2, + divline_t* v1 ) { fixed_t frac; fixed_t num; fixed_t den; - + den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy); if (den == 0) - return 0; + return 0; // I_Error ("P_InterceptVector: parallel"); - + num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) + - FixedMul ( (v2->y - v1->y)>>8 , v1->dx); + FixedMul ( (v2->y - v1->y)>>8 , v1->dx); frac = FixedDiv (num , den); return frac; @@ -133,29 +137,31 @@ P_InterceptVector2 // Returns true // if strace crosses the given subsector successfully. // +// [STRIFE] Verified unmodified +// boolean P_CrossSubsector (int num) { - seg_t* seg; - line_t* line; - int s1; - int s2; - int count; - subsector_t* sub; - sector_t* front; - sector_t* back; - fixed_t opentop; - fixed_t openbottom; - divline_t divl; - vertex_t* v1; - vertex_t* v2; - fixed_t frac; - fixed_t slope; - + seg_t* seg; + line_t* line; + int s1; + int s2; + int count; + subsector_t* sub; + sector_t* front; + sector_t* back; + fixed_t opentop; + fixed_t openbottom; + divline_t divl; + vertex_t* v1; + vertex_t* v2; + fixed_t frac; + fixed_t slope; + #ifdef RANGECHECK if (num>=numsubsectors) - I_Error ("P_CrossSubsector: ss %i with numss = %i", - num, - numsubsectors); + I_Error ("P_CrossSubsector: ss %i with numss = %i", + num, + numsubsectors); #endif sub = &subsectors[num]; @@ -166,33 +172,33 @@ boolean P_CrossSubsector (int num) for ( ; count ; seg++, count--) { - line = seg->linedef; - - // allready checked other side? - if (line->validcount == validcount) - continue; - - line->validcount = validcount; - - v1 = line->v1; - v2 = line->v2; - s1 = P_DivlineSide (v1->x,v1->y, &strace); - s2 = P_DivlineSide (v2->x, v2->y, &strace); - - // line isn't crossed? - if (s1 == s2) - continue; - - divl.x = v1->x; - divl.y = v1->y; - divl.dx = v2->x - v1->x; - divl.dy = v2->y - v1->y; - s1 = P_DivlineSide (strace.x, strace.y, &divl); - s2 = P_DivlineSide (t2x, t2y, &divl); - - // line isn't crossed? - if (s1 == s2) - continue; + line = seg->linedef; + + // allready checked other side? + if (line->validcount == validcount) + continue; + + line->validcount = validcount; + + v1 = line->v1; + v2 = line->v2; + s1 = P_DivlineSide (v1->x, v1->y, &strace); + s2 = P_DivlineSide (v2->x, v2->y, &strace); + + // line isn't crossed? + if (s1 == s2) + continue; + + divl.x = v1->x; + divl.y = v1->y; + divl.dx = v2->x - v1->x; + divl.dy = v2->y - v1->y; + s1 = P_DivlineSide (strace.x, strace.y, &divl); + s2 = P_DivlineSide (t2x, t2y, &divl); + + // line isn't crossed? + if (s1 == s2) + continue; // Backsector may be NULL if this is an "impassible // glass" hack line. @@ -202,58 +208,58 @@ boolean P_CrossSubsector (int num) return false; } - // stop because it is not two sided anyway - // might do this after updating validcount? - if ( !(line->flags & ML_TWOSIDED) ) - return false; - - // crosses a two sided line - front = seg->frontsector; - back = seg->backsector; - - // no wall to block sight with? - if (front->floorheight == back->floorheight - && front->ceilingheight == back->ceilingheight) - continue; - - // possible occluder - // because of ceiling height differences - if (front->ceilingheight < back->ceilingheight) - opentop = front->ceilingheight; - else - opentop = back->ceilingheight; - - // because of ceiling height differences - if (front->floorheight > back->floorheight) - openbottom = front->floorheight; - else - openbottom = back->floorheight; - - // quick test for totally closed doors - if (openbottom >= opentop) - return false; // stop - - frac = P_InterceptVector2 (&strace, &divl); - - if (front->floorheight != back->floorheight) - { - slope = FixedDiv (openbottom - sightzstart , frac); - if (slope > bottomslope) - bottomslope = slope; - } - - if (front->ceilingheight != back->ceilingheight) - { - slope = FixedDiv (opentop - sightzstart , frac); - if (slope < topslope) - topslope = slope; - } - - if (topslope <= bottomslope) - return false; // stop + // stop because it is not two sided anyway + // might do this after updating validcount? + if ( !(line->flags & ML_TWOSIDED) ) + return false; + + // crosses a two sided line + front = seg->frontsector; + back = seg->backsector; + + // no wall to block sight with? + if (front->floorheight == back->floorheight + && front->ceilingheight == back->ceilingheight) + continue; + + // possible occluder + // because of ceiling height differences + if (front->ceilingheight < back->ceilingheight) + opentop = front->ceilingheight; + else + opentop = back->ceilingheight; + + // because of ceiling height differences + if (front->floorheight > back->floorheight) + openbottom = front->floorheight; + else + openbottom = back->floorheight; + + // quick test for totally closed doors + if (openbottom >= opentop) + return false; // stop + + frac = P_InterceptVector2 (&strace, &divl); + + if (front->floorheight != back->floorheight) + { + slope = FixedDiv (openbottom - sightzstart , frac); + if (slope > bottomslope) + bottomslope = slope; + } + + if (front->ceilingheight != back->ceilingheight) + { + slope = FixedDiv (opentop - sightzstart , frac); + if (slope < topslope) + topslope = slope; + } + + if (topslope <= bottomslope) + return false; // stop } // passed the subsector ok - return true; + return true; } @@ -263,38 +269,40 @@ boolean P_CrossSubsector (int num) // Returns true // if strace crosses the given node successfully. // +// [STRIFE] Verified unmodified +// boolean P_CrossBSPNode (int bspnum) { - node_t* bsp; - int side; + node_t* bsp; + int side; if (bspnum & NF_SUBSECTOR) { - if (bspnum == -1) - return P_CrossSubsector (0); - else - return P_CrossSubsector (bspnum&(~NF_SUBSECTOR)); + if (bspnum == -1) + return P_CrossSubsector (0); + else + return P_CrossSubsector (bspnum&(~NF_SUBSECTOR)); } - + bsp = &nodes[bspnum]; - + // decide which side the start point is on side = P_DivlineSide (strace.x, strace.y, (divline_t *)bsp); if (side == 2) - side = 0; // an "on" should cross both sides + side = 0; // an "on" should cross both sides // cross the starting side if (!P_CrossBSPNode (bsp->children[side]) ) - return false; - + return false; + // the partition plane is crossed here if (side == P_DivlineSide (t2x, t2y,(divline_t *)bsp)) { - // the line doesn't touch the other side - return true; + // the line doesn't touch the other side + return true; } - - // cross the ending side + + // cross the ending side return P_CrossBSPNode (bsp->children[side^1]); } @@ -305,16 +313,18 @@ boolean P_CrossBSPNode (int bspnum) // if a straight line between t1 and t2 is unobstructed. // Uses REJECT. // +// [STRIFE] Verified unmodified +// boolean P_CheckSight -( mobj_t* t1, - mobj_t* t2 ) +( mobj_t* t1, + mobj_t* t2 ) { - int s1; - int s2; - int pnum; - int bytenum; - int bitnum; + int s1; + int s2; + int pnum; + int bytenum; + int bitnum; // First check for trivial rejection. @@ -328,10 +338,10 @@ P_CheckSight // Check in REJECT table. if (rejectmatrix[bytenum]&bitnum) { - sightcounts[0]++; + sightcounts[0]++; - // can't possibly be connected - return false; + // can't possibly be connected + return false; } // An unobstructed LOS is possible. @@ -339,11 +349,11 @@ P_CheckSight sightcounts[1]++; validcount++; - + sightzstart = t1->z + t1->height - (t1->height>>2); topslope = (t2->z+t2->height) - sightzstart; bottomslope = (t2->z) - sightzstart; - + strace.x = t1->x; strace.y = t1->y; t2x = t2->x; -- cgit v1.2.3