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

📄 r_segs.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 5 页
字号:
        {            // calculate lighting            index = rw_scale>>LIGHTSCALESHIFT;                        if (index >=  MAXLIGHTSCALE )                index = MAXLIGHTSCALE-1;            dc_colormap = walllights[index];            dc_x = rw_x;            dc_iscale = 0xffffffffu / (unsigned)rw_scale;            if(frontsector->extra_colormap && !fixedcolormap)                dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);        }        if(dc_numlights)        {          lighttable_t** xwalllights;          for(i = 0; i < dc_numlights; i++)          {            int lightnum;            if((frontsector->lightlist[i].caster && frontsector->lightlist[i].caster->flags & FF_FOG && frontsector->lightlist[i].height != *frontsector->lightlist[i].caster->bottomheight) || (dc_lightlist[i].extra_colormap && dc_lightlist[i].extra_colormap->fog))              lightnum = (dc_lightlist[i].lightlevel >> LIGHTSEGSHIFT);            else              lightnum = (dc_lightlist[i].lightlevel >> LIGHTSEGSHIFT)+extralight;            if (dc_lightlist[i].extra_colormap);            else if (curline->v1->y == curline->v2->y)                lightnum--;            else if (curline->v1->x == curline->v2->x)                lightnum++;                if (lightnum < 0)                xwalllights = scalelight[0];            else if (lightnum >= LIGHTLEVELS)                xwalllights = scalelight[LIGHTLEVELS-1];            else                xwalllights = scalelight[lightnum];            index = rw_scale>>LIGHTSCALESHIFT;                        if (index >=  MAXLIGHTSCALE )                index = MAXLIGHTSCALE-1;            if(dc_lightlist[i].extra_colormap && !fixedcolormap)              dc_lightlist[i].rcolormap = dc_lightlist[i].extra_colormap->colormap + (xwalllights[index] - colormaps);            else if(!fixedcolormap)              dc_lightlist[i].rcolormap = xwalllights[index];            else              dc_lightlist[i].rcolormap = fixedcolormap;            colfunc = R_DrawColumnShadowed_8;          }        }        if(dc_wallportals)          colfunc = R_DrawPortalColumn_8;        frontscale[rw_x] = rw_scale;          // draw the wall tiers        if (midtexture)        {            // single sided line            dc_yl = yl;            dc_yh = yh;            dc_texturemid = rw_midtexturemid;            dc_source = R_GetColumn(midtexture,texturecolumn);            dc_texheight = textureheight[midtexture] >> FRACBITS;            //profile stuff ---------------------------------------------------------#ifdef TIMING            ProfZeroTimer();#endif#ifdef HORIZONTALDRAW            hcolfunc ();#else            colfunc ();#endif#ifdef TIMING            RDMSR(0x10,&mycount);            mytotal += mycount;      //64bit add                        if(nombre--==0)                I_Error("R_DrawColumn CPU Spy reports: 0x%d %d\n", *((int*)&mytotal+1),                (int)mytotal );#endif            //profile stuff ---------------------------------------------------------                        // dont draw anything more for this column, since            // a midtexture blocks the view            ceilingclip[rw_x] = viewheight;            floorclip[rw_x] = -1;        }        else        {            // two sided line            if (toptexture)            {                // top wall                mid = pixhigh>>HEIGHTBITS;                pixhigh += pixhighstep;                                if (mid >= floorclip[rw_x])                    mid = floorclip[rw_x]-1;                                if (mid >= yl)                {                    dc_yl = yl;                    dc_yh = mid;                    dc_texturemid = rw_toptexturemid;                    dc_source = R_GetColumn(toptexture,texturecolumn);                    dc_texheight = textureheight[toptexture] >> FRACBITS;#ifdef HORIZONTALDRAW                    hcolfunc ();#else                    colfunc ();#endif                    ceilingclip[rw_x] = mid;                }                else                    ceilingclip[rw_x] = yl-1;            }            else            {                // no top wall                if (markceiling)                {                    ceilingclip[rw_x] = yl-1;#ifdef OLDWATER                    if (!waterplane || markwater)                         waterclip[rw_x] = yl-1;#endif                }            }                        if (bottomtexture)            {                // bottom wall                mid = (pixlow+HEIGHTUNIT-1)>>HEIGHTBITS;                pixlow += pixlowstep;                                // no space above wall?                if (mid <= ceilingclip[rw_x])                    mid = ceilingclip[rw_x]+1;                if (mid <= yh)                {                    dc_yl = mid;                    dc_yh = yh;                    dc_texturemid = rw_bottomtexturemid;                    dc_source = R_GetColumn(bottomtexture,                        texturecolumn);                    dc_texheight = textureheight[bottomtexture] >> FRACBITS;#ifdef HORIZONTALDRAW                    hcolfunc ();#else                    colfunc ();#endif                    floorclip[rw_x] = mid;#ifdef OLDWATER                    if (waterplane && waterz<worldlow)                        waterclip[rw_x] = mid;#endif                }                else                {                    floorclip[rw_x] = yh+1;                }            }            else            {                // no bottom wall                if (markfloor)                {                    floorclip[rw_x] = yh+1;#ifdef OLDWATER                    if (!waterplane || markwater)                        waterclip[rw_x] = yh+1;#endif                }            }        }        if (maskedtexture || numthicksides)        {          // save texturecol          //  for backdrawing of masked mid texture          maskedtexturecol[rw_x] = texturecolumn;        }        if(dc_numlights)        {          for(i = 0; i < dc_numlights; i++)          {            dc_lightlist[i].height += dc_lightlist[i].heightstep;            if(dc_lightlist[i].flags & FF_SOLID)              dc_lightlist[i].botheight += dc_lightlist[i].botheightstep;          }        }        if(dc_wallportals)        {          wallportal_t* wpr;          for(wpr = dc_wallportals; wpr; wpr = wpr->next)          {            wpr->top += wpr->topstep;            wpr->bottom += wpr->bottomstep;          }        }        for(i = 0; i < MAXFFLOORS; i++)        {          if (ffloor[i].mark)          {            int y_w = ffloor[i].b_frac >> HEIGHTBITS;            ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = y_w;            ffloor[i].b_frac += ffloor[i].b_step;          }          ffloor[i].f_frac += ffloor[i].f_step;        }        rw_scale += rw_scalestep;        topfrac += topstep;        bottomfrac += bottomstep;    }}//// R_StoreWallRange// A wall segment will be drawn//  between start and stop pixels (inclusive).//void R_StoreWallRange( int   start, int   stop){    fixed_t             hyp;    fixed_t             sineval;    angle_t             distangle, offsetangle;    fixed_t             vtop;    int                 lightnum;    int                 i;    //SoM: 3/26/2000: Use Boom limit removal and see if it works better.    //SoM: Boom code:    if (ds_p == drawsegs+maxdrawsegs)    {      unsigned pos = ds_p - drawsegs;      unsigned pos2 = firstnewseg - drawsegs;      unsigned newmax = maxdrawsegs ? maxdrawsegs*2 : 128;      drawsegs = realloc(drawsegs,newmax*sizeof(*drawsegs));      ds_p = drawsegs + pos;      firstnewseg = drawsegs + pos2;      maxdrawsegs = newmax;    }    #ifdef RANGECHECK    if (start >=viewwidth || start > stop)        I_Error ("Bad R_RenderWallRange: %i to %i", start , stop);#endif        sidedef = curline->sidedef;    linedef = curline->linedef;        // mark the segment as visible for auto map    linedef->flags |= ML_MAPPED;        // calculate rw_distance for scale calculation    rw_normalangle = curline->angle + ANG90;    offsetangle = abs(rw_normalangle-rw_angle1);        if (offsetangle > ANG90)        offsetangle = ANG90;        distangle = ANG90 - offsetangle;    hyp = R_PointToDist (curline->v1->x, curline->v1->y);    sineval = finesine[distangle>>ANGLETOFINESHIFT];    rw_distance = FixedMul (hyp, sineval);            ds_p->x1 = rw_x = start;    ds_p->x2 = stop;    ds_p->curline = curline;    rw_stopx = stop+1;    //SoM: Code to remove limits on openings.    {      extern short *openings;      extern size_t maxopenings;      size_t pos = lastopening - openings;      size_t need = (rw_stopx - start)*4 + pos;      if (need > maxopenings)        {          drawseg_t *ds;  //needed for fix from *cough* zdoom *cough*          short *oldopenings = openings;          short *oldlast = lastopening;          do            maxopenings = maxopenings ? maxopenings*2 : 16384;          while (need > maxopenings);          openings = realloc(openings, maxopenings * sizeof(*openings));          lastopening = openings + pos;        // borrowed fix from *cough* zdoom *cough*        // [RH] We also need to adjust the openings pointers that        //    were already stored in drawsegs.        for (ds = drawsegs; ds < ds_p; ds++)          {  #define ADJUST(p) if (ds->p + ds->x1 >= oldopenings && ds->p + ds->x1 <= oldlast)\                        ds->p = ds->p - oldopenings + openings;            ADJUST (maskedtexturecol);            ADJUST (sprtopclip);            ADJUST (sprbottomclip);            ADJUST (thicksidecol);          }  #undef ADJUST        }    }  // end of code to remove limits on openings        // calculate scale at both ends and step    ds_p->scale1 = rw_scale =        R_ScaleFromGlobalAngle (viewangle + xtoviewangle[start]);    if (stop > start)    {        ds_p->scale2 = R_ScaleFromGlobalAngle (viewangle + xtoviewangle[stop]);        ds_p->scalestep = rw_scalestep = (ds_p->scale2 - rw_scale) / (stop-start);    }    else    {        // UNUSED: try to fix the stretched line bug#if 0        if (rw_distance < FRACUNIT/2)        {            fixed_t         trx,try;            fixed_t         gxt,gyt;                        trx = curline->v1->x - viewx;            try = curline->v1->y - viewy;                        gxt = FixedMul(trx,viewcos);            gyt = -FixedMul(try,viewsin);            ds_p->scale1 = FixedDiv(projection, gxt-gyt)<<detailshift;        }#endif        ds_p->scale2 = ds_p->scale1;    }        // calculate texture boundaries    //  and decide if floor / ceiling marks are needed    worldtop = frontsector->ceilingheight - viewz;    worldbottom = frontsector->floorheight - viewz;#ifdef OLDWATER    //added:18-02-98:WATER!    if (waterplane)    {        waterz = waterplane->height - viewz;        if (waterplane->height >= frontsector->ceilingheight)            I_Error("eau plus haut que plafond");    }#endif    midtexture = toptexture = bottomtexture = maskedtexture = 0;    ds_p->maskedtexturecol = NULL;    ds_p->numthicksides = numthicksides = 0;    ds_p->thicksidecol = NULL;    for(i = 0; i < MAXFFLOORS; i++)    {      ffloor[i].mark = false;      ds_p->thicksides[i] = NULL;    }    if(numffloors)    {      for(i = 0; i < numffloors; i++)        ffloor[i].f_pos = ffloor[i].height - viewz;    }    if (!backsector)    {        // single sided line        midtexture = texturetranslation[sidedef->midtexture];        // a single sided line is terminal, so it must mark ends        markfloor = markceiling = true;#ifdef OLDWATER        //added:18-02-98:WATER! onesided marque toujours l'eau si ya dlo

⌨️ 快捷键说明

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