📄 hw_main.c
字号:
|| (gr_linedef->flags & ML_DONTDRAW) ) l = polybottom; else l = polybottom > openbottom ? polybottom : openbottom; if (drawtextured) { fixed_t texturevpeg; // PEGGING if (gr_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = l + textureheight[gr_sidedef->midtexture] - h + polybottom - l; else texturevpeg = polytop - h; grTex = HWR_GetTexture (gr_midtexture ); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; } // set top/bottom coords wallVerts[2].y = wallVerts[3].y = (float)h * crapmul; wallVerts[0].y = wallVerts[1].y = (float)l * crapmul; // set alpha for transparent walls (new boom and legacy linedef types) // ooops ! this do not work at all because render order we should render it in backtofront order switch ( gr_linedef->special ) { case 260 : case 284 : blendmode = HWR_TranstableToAlpha(tr_transmed, &Surf);break; case 285 : blendmode = HWR_TranstableToAlpha(tr_transmor, &Surf);break; case 286 : blendmode = HWR_TranstableToAlpha(tr_transhi , &Surf);break; case 287 : blendmode = HWR_TranstableToAlpha(tr_transfir, &Surf);break; case 288 : //FIXME: not work like this must be laoded with firetranslucent to true ! blendmode = HWR_TranstableToAlpha(tr_transfx1, &Surf);break; case 283 : blendmode = PF_Substractive;break; default : blendmode = PF_Masked;break; } HWR_ProjectWall( wallVerts, &Surf, blendmode); } } else { // Single sided line... Deal only with the middletexture (if one exists) gr_midtexture = texturetranslation[gr_sidedef->midtexture]; if (gr_midtexture) { if (drawtextured) { fixed_t texturevpeg; // PEGGING if (gr_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset; else // top of texture at top texturevpeg = gr_sidedef->rowoffset; grTex = HWR_GetTexture (gr_midtexture ); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldbottom) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; } // set top/bottom coords wallVerts[2].y = wallVerts[3].y = (float)worldtop * crapmul; wallVerts[0].y = wallVerts[1].y = (float)worldbottom * crapmul; // I don't think that solid walls can use translucent linedef types... HWR_ProjectWall( wallVerts, &Surf, PF_Masked); } } //Hurdler: 3d-floors test#ifdef R_FAKEFLOORS if(gr_frontsector && gr_backsector && gr_frontsector->tag != gr_backsector->tag && (gr_backsector->ffloors || gr_frontsector->ffloors)) { ffloor_t* rover; fixed_t highcut, lowcut; highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight; if(gr_backsector->ffloors) { for(rover = gr_backsector->ffloors; rover; rover = rover->next) { if(!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || (rover->flags & FF_INVERTSIDES)) continue; if(*rover->topheight < lowcut || *rover->bottomheight > highcut) continue; h = *rover->topheight; l = *rover->bottomheight; if(h > highcut) h = highcut; if(l < lowcut) l = lowcut; //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords wallVerts[2].y = wallVerts[3].y = (float)h * crapmul; wallVerts[0].y = wallVerts[1].y = (float)l * crapmul; if (drawtextured) { grTex = HWR_GetTexture ( texturetranslation[sides[rover->master->sidenum[0]].midtexture] ); wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h) * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h)) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; } if (rover->master->special != 302) { HWR_ProjectWall( wallVerts, &Surf, PF_Masked ); } } } else if(gr_frontsector->ffloors) { for(rover = gr_frontsector->ffloors; rover; rover = rover->next) { if(!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_ALLSIDES)) continue; if(*rover->topheight < lowcut || *rover->bottomheight > highcut) continue; h = *rover->topheight; l = *rover->bottomheight; if(h > highcut) h = highcut; if(l < lowcut) l = lowcut; //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords wallVerts[2].y = wallVerts[3].y = (float)h * crapmul; wallVerts[0].y = wallVerts[1].y = (float)l * crapmul; if (drawtextured) { grTex = HWR_GetTexture ( texturetranslation[sides[rover->master->sidenum[0]].midtexture] ); wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h) * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h)) * grTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX; wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; } if (rover->master->special != 302) { HWR_ProjectWall( wallVerts, &Surf, PF_Masked ); } } } }#endif//Hurdler: end of 3d-floors test}//// ClipWallSegment// Clips the given range of columns// and includes it in the new clip list.//typedef struct{ int first; int last;} cliprange_t;#define MAXSEGS 128// newend is one past the last valid segcliprange_t* newend;cliprange_t gr_solidsegs[MAXSEGS];void printsolidsegs( void){ cliprange_t* start; if(!newend || cv_grbeta.value!=2) return; for(start=gr_solidsegs;start!=newend;start++) CONS_Printf("%d-%d|",start->first,start->last ); CONS_Printf("\n\n" );}//////static void HWR_ClipSolidWallSegment (int first, int last ){ cliprange_t* next; cliprange_t* start; float lowfrac, highfrac; boolean poorhack=false; // Find the first range that touches the range // (adjacent pixels are touching). start = gr_solidsegs; while (start->last < first-1) start++; if (first < start->first) { if (last < start->first-1) { // Post is entirely visible (above start), // so insert a new clippost. HWR_StoreWallRange (first, last ); next = newend; newend++; while (next != start) { *next = *(next-1 ); next--; } next->first = first; next->last = last; printsolidsegs( ); return; } // There is a fragment above *start. if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (first, last); poorhack=true; } else { highfrac = HWR_ClipViewSegment (start->first+1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); HWR_StoreWallRange (0, highfrac ); } // Now adjust the clip size. start->first = first; } // Bottom contained in start? if (last <= start->last) { printsolidsegs( ); return; } next = start; while (last >= (next+1)->first-1) { // There is a fragment between two posts. if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (first,last ); poorhack=true; } else { lowfrac = HWR_ClipViewSegment (next->last-1 , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); highfrac = HWR_ClipViewSegment ((next+1)->first+1 , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); HWR_StoreWallRange (lowfrac, highfrac ); } next++; if (last <= next->last) { // Bottom is contained in next. // Adjust the clip size. start->last = next->last; goto crunch; } } if(first==next->first+1) // 1 line texture { if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (first,last ); poorhack=true; }else HWR_StoreWallRange (0, 1 ); } else { // There is a fragment after *next. if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (first,last ); poorhack=true; } else { lowfrac = HWR_ClipViewSegment ( next->last-1 , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); HWR_StoreWallRange (lowfrac, 1 ); } } // Adjust the clip size. start->last = last; // Remove start+1 to next from the clip list, // because start now covers their area.crunch: if (next == start) { printsolidsegs( ); // Post just extended past the bottom of one post. return; } while (next++ != newend) { // Remove a post. *++start = *next; } newend = start; printsolidsegs( );}//// handle LineDefs with upper and lower texture (windows)//static void HWR_ClipPassWallSegment (int first, int last ){ cliprange_t* start; float lowfrac, highfrac; //to allow noclipwalls but still solidseg reject of non-visible walls boolean poorhack=false; // Find the first range that touches the range // (adjacent pixels are touching). start = gr_solidsegs; while (start->last < first-1) start++; if (first < start->first) { if (last < start->first-1) { // Post is entirely visible (above start). HWR_StoreWallRange (0, 1 ); return; } // There is a fragment above *start. if (!cv_grclipwalls.value) { //20/08/99: Changed by Hurdler (taken from faB's code) if (!poorhack) HWR_StoreWallRange (0,1 ); poorhack=true; } else { highfrac = HWR_ClipViewSegment ( min(start->first+1,start->last) , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); HWR_StoreWallRange (0, highfrac ); } } // Bottom contained in start? if (last <= start->last) return; while (last >= (start+1)->first-1) { // There is a fragment between two posts. if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (0,1 ); poorhack=true; } else { lowfrac = HWR_ClipViewSegment (max(start->last-1,start->first) , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); highfrac = HWR_ClipViewSegment (min((start+1)->first+1,(start+1)->last) , (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2 ); HWR_StoreWallRange (lowfrac, highfrac ); } start++; if (last <= start->last) return; } if(first==start->first+1) // 1 line texture { if (!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (0,1 ); poorhack=true; }else HWR_StoreWallRange (0, 1 ); } else { // There is a fragment after *next. if(!cv_grclipwalls.value) { if (!poorhack) HWR_StoreWallRange (0,1 ); poorhack=true; } else {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -