⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 r_segs.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 5 页
字号:
        if (waterplane)            markwater = true;        else            markwater = false;#endif                if (linedef->flags & ML_DONTPEGBOTTOM)        {            vtop = frontsector->floorheight +                textureheight[sidedef->midtexture];            // bottom of texture at bottom            rw_midtexturemid = vtop - viewz;        }        else        {            // top of texture at top            rw_midtexturemid = worldtop;        }        rw_midtexturemid += sidedef->rowoffset;        ds_p->silhouette = SIL_BOTH;        ds_p->sprtopclip = screenheightarray;        ds_p->sprbottomclip = negonearray;        ds_p->bsilheight = MAXINT;        ds_p->tsilheight = MININT;    }    else    {        // two sided line        ds_p->sprtopclip = ds_p->sprbottomclip = NULL;        ds_p->silhouette = 0;                if (frontsector->floorheight > backsector->floorheight)        {            ds_p->silhouette = SIL_BOTTOM;            ds_p->bsilheight = frontsector->floorheight;        }        else if (backsector->floorheight > viewz)        {            ds_p->silhouette = SIL_BOTTOM;            ds_p->bsilheight = MAXINT;            // ds_p->sprbottomclip = negonearray;        }                if (frontsector->ceilingheight < backsector->ceilingheight)        {            ds_p->silhouette |= SIL_TOP;            ds_p->tsilheight = frontsector->ceilingheight;        }        else if (backsector->ceilingheight < viewz)        {            ds_p->silhouette |= SIL_TOP;            ds_p->tsilheight = MININT;            // ds_p->sprtopclip = screenheightarray;        }                if (backsector->ceilingheight <= frontsector->floorheight)        {            ds_p->sprbottomclip = negonearray;            ds_p->bsilheight = MAXINT;            ds_p->silhouette |= SIL_BOTTOM;        }                if (backsector->floorheight >= frontsector->ceilingheight)        {            ds_p->sprtopclip = screenheightarray;            ds_p->tsilheight = MININT;            ds_p->silhouette |= SIL_TOP;        }        //SoM: 3/25/2000: This code fixes an automap bug that didn't check        // frontsector->ceiling and backsector->floor to see if a door was closed.        // Without the following code, sprites get displayed behind closed doors.        {          extern int doorclosed;    // killough 1/17/98, 2/8/98, 4/7/98          if (doorclosed || backsector->ceilingheight<=frontsector->floorheight)            {              ds_p->sprbottomclip = negonearray;              ds_p->bsilheight = MAXINT;              ds_p->silhouette |= SIL_BOTTOM;            }          if (doorclosed || backsector->floorheight>=frontsector->ceilingheight)            {                   // killough 1/17/98, 2/8/98              ds_p->sprtopclip = screenheightarray;              ds_p->tsilheight = MININT;              ds_p->silhouette |= SIL_TOP;            }        }        worldhigh = backsector->ceilingheight - viewz;        worldlow = backsector->floorheight - viewz;                // hack to allow height changes in outdoor areas        if (frontsector->ceilingpic == skyflatnum            && backsector->ceilingpic == skyflatnum)        {            worldtop = worldhigh;        }                        if (worldlow != worldbottom            || backsector->floorpic != frontsector->floorpic            || backsector->lightlevel != frontsector->lightlevel            //SoM: 3/22/2000: Check floor x and y offsets.            || backsector->floor_xoffs != frontsector->floor_xoffs            || backsector->floor_yoffs != frontsector->floor_yoffs            //SoM: 3/22/2000: Prevents bleeding.            || frontsector->heightsec != -1            || backsector->floorlightsec != frontsector->floorlightsec            //SoM: 4/3/2000: Check for colormaps            || frontsector->extra_colormap != backsector->extra_colormap            || (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag))        {            markfloor = true;        }        else        {            // same plane on both sides            markfloor = false;        }                        if (worldhigh != worldtop            || backsector->ceilingpic != frontsector->ceilingpic            || backsector->lightlevel != frontsector->lightlevel            //SoM: 3/22/2000: Check floor x and y offsets.            || backsector->ceiling_xoffs != frontsector->ceiling_xoffs            || backsector->ceiling_yoffs != frontsector->ceiling_yoffs            //SoM: 3/22/2000: Prevents bleeding.            || (frontsector->heightsec != -1 &&                frontsector->ceilingpic != skyflatnum)            || backsector->floorlightsec != frontsector->floorlightsec            //SoM: 4/3/2000: Check for colormaps            || frontsector->extra_colormap != backsector->extra_colormap            || (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag))        {            markceiling = true;        }        else        {            // same plane on both sides            markceiling = false;        }                if (backsector->ceilingheight <= frontsector->floorheight            || backsector->floorheight >= frontsector->ceilingheight)        {            // closed door            markceiling = markfloor = true;        }        #ifdef OLDWATER        //added:18-02-98: WATER! jamais mark si l'eau ne touche pas        //                d'upper et de bottom        // (on s'en fout des differences de hauteur de plafond et        //  de sol, tant que ca n'interrompt pas la surface de l'eau)        markwater = false;#endif        // check TOP TEXTURE        if (worldhigh < worldtop)        {#ifdef OLDWATER            //added:18-02-98:WATER! toptexture, check si ca touche watersurf            if (waterplane &&                waterz > worldhigh &&                waterz < worldtop)                markwater = true;#endif                        // top texture            toptexture = texturetranslation[sidedef->toptexture];            if (linedef->flags & ML_DONTPEGTOP)            {                // top of texture at top                rw_toptexturemid = worldtop;            }            else            {                vtop = backsector->ceilingheight                     + textureheight[sidedef->toptexture];                                // bottom of texture                rw_toptexturemid = vtop - viewz;            }        }        // check BOTTOM TEXTURE        if (worldlow > worldbottom)     //seulement si VISIBLE!!!        {#ifdef OLDWATER            //added:18-02-98:WATER! bottomtexture, check si ca touche watersurf            if (waterplane &&                waterz < worldlow &&                waterz > worldbottom)                markwater = true;#endif            // bottom texture            bottomtexture = texturetranslation[sidedef->bottomtexture];                        if (linedef->flags & ML_DONTPEGBOTTOM )            {                // bottom of texture at bottom                // top of texture at top                rw_bottomtexturemid = worldtop;            }            else    // top of texture at top                rw_bottomtexturemid = worldlow;        }                rw_toptexturemid += sidedef->rowoffset;        rw_bottomtexturemid += sidedef->rowoffset;        // allocate space for masked texture tables        if (frontsector && backsector && frontsector->tag != backsector->tag && (backsector->ffloors || frontsector->ffloors))        {          ffloor_t* rover;          ffloor_t* r2;          fixed_t   lowcut, highcut;          //markceiling = markfloor = true;          maskedtexture = true;          ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;          lastopening += rw_stopx - rw_x;          lowcut = frontsector->floorheight > backsector->floorheight ? frontsector->floorheight : backsector->floorheight;          highcut = frontsector->ceilingheight < backsector->ceilingheight ? frontsector->ceilingheight : backsector->ceilingheight;          if(frontsector->ffloors && backsector->ffloors)          {            i = 0;            for(rover = backsector->ffloors; rover != NULL && i < MAXFFLOORS; rover = rover->next)            {              if(!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS))                continue;              if(rover->flags & FF_INVERTSIDES)                continue;              if(*rover->topheight < lowcut || *rover->bottomheight > highcut)                continue;              for(r2 = frontsector->ffloors; r2; r2 = r2->next)              {                if(!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES)                   || *r2->topheight < lowcut || *r2->bottomheight > highcut)                  continue;                if(rover->flags & FF_EXTRA)                {                  if(!(r2->flags & FF_CUTEXTRA))                    continue;                  if(r2->flags & FF_EXTRA && (r2->flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))                    continue;                }                else                {                  if(!(r2->flags & FF_CUTSOLIDS))                    continue;                }                if(*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight)                  continue;                break;              }              if(r2)                continue;              ds_p->thicksides[i] = rover;              i++;            }            for(rover = frontsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next)            {              if(!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS))                continue;              if(!(rover->flags & FF_ALLSIDES))                continue;              if(*rover->topheight < lowcut || *rover->bottomheight > highcut)                continue;              for(r2 = backsector->ffloors; r2; r2 = r2->next)              {                if(!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES)                   || *r2->topheight < lowcut || *r2->bottomheight > highcut)                  continue;                if(rover->flags & FF_EXTRA)                {                  if(!(r2->flags & FF_CUTEXTRA))                    continue;                  if(r2->flags & FF_EXTRA && (r2->flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))                    continue;                }                else                {                  if(!(r2->flags & FF_CUTSOLIDS))                    continue;                }                if(*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight)                  continue;                break;              }              if(r2)                continue;              ds_p->thicksides[i] = rover;              i++;            }          }          else if(backsector->ffloors)          {            for(rover = backsector->ffloors, i = 0; rover && i < MAXFFLOORS; rover = rover->next)            {              if(!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS) || rover->flags & FF_INVERTSIDES)                continue;              if(*rover->topheight <= frontsector->floorheight || *rover->bottomheight >= frontsector->ceilingheight)                continue;              ds_p->thicksides[i] = rover;              i++;            }          }          else if(frontsector->ffloors)          {            for(rover = frontsector->ffloors, i = 0; rover && i < MAXFFLOORS; rover = rover->next)            {              if(!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_ALLSIDES))                continue;              if(*rover->topheight <= frontsector->floorheight || *rover->bottomheight >= frontsector->ceilingheight)                continue;              if(*rover->topheight <= backsector->floorheight || *rover->bottomheight >= backsector->ceilingheight)                continue;              ds_p->thicksides[i] = rover;              i++;            }          }          ds_p->numthicksides = numthicksides = i;        }        if (sidedef->midtexture)        {            // masked midtexture            if(!ds_p->thicksidecol)            {              ds_p->maskedtexturecol = maskedtexturecol = lastopening - rw_x;              lastopening += rw_stopx - rw_x;            }            else              ds_p->maskedtexturecol = ds_p->thicksidecol;            maskedtexture = true;        }    }        // calculate rw_offset (only needed for textured lines)    segtextured = midtexture || toptexture || bottomtexture || maskedtexture || (numthicksides > 0);        if (segtextured)    {        offsetangle = rw_normalangle-rw_angle1;                if (offsetangle > ANG180)            offsetangle = -offsetangle;                if (offsetangle > ANG90)            offsetangle = ANG90;                sineval = finesine[offsetangle >>ANGLETOFINESHIFT];        rw_offset = FixedMul (hyp, sineval);                if (rw_normalangle-rw_angle1 < ANG180)            rw_offset = -rw_offset;                /// don't use texture offset for splats        rw_offset2 = rw_offset + curline->offset;        rw_offset += sidedef->textureoffset + curline->offset;        rw_centerangle = ANG90 + viewangle - rw_normalangle;                // calculate light table        //  use different light tables        //  for horizontal / vertical / diagonal        // OPTIMIZE: get rid of LIGHTSEGSHIFT globally        if (!fixedcolormap)        {            lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+extralight;                        if (curline->v1->y == curline->v2->y)                lightnum--;            else if (curline->v1->x == curline->v2->x

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -