1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id:$ 5 // 6 // Copyright (C) 1993-1996 by id Software, Inc. 7 // 8 // This source is available for distribution and/or modification 9 // only under the terms of the DOOM Source Code License as 10 // published by id Software. All rights reserved. 11 // 12 // The source is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 // for more details. 16 // 17 // DESCRIPTION: 18 // Refresh module, BSP traversal and handling. 19 // 20 //----------------------------------------------------------------------------- 21 22 23 #ifndef __R_BSP__ 24 #define __R_BSP__ 25 26 #include "tarray.h" 27 #include <stddef.h> 28 29 // The 3072 below is just an arbitrary value picked to avoid 30 // drawing lines the player is too close to that would overflow 31 // the texture calculations. 32 #define TOO_CLOSE_Z 3072 33 34 struct FWallCoords 35 { 36 fixed_t tx1, tx2; // x coords at left, right of wall in view space rx1,rx2 37 fixed_t ty1, ty2; // y coords at left, right of wall in view space ry1,ry2 38 39 short sx1, sx2; // x coords at left, right of wall in screen space xb1,xb2 40 fixed_t sz1, sz2; // depth at left, right of wall in screen space yb1,yb2 41 42 bool Init(int x1, int y1, int x2, int y2, int too_close); 43 }; 44 45 struct FWallTmapVals 46 { 47 float UoverZorg, UoverZstep; 48 float InvZorg, InvZstep; 49 50 void InitFromWallCoords(const FWallCoords *wallc); 51 void InitFromLine(int x1, int y1, int x2, int y2); 52 }; 53 54 extern FWallCoords WallC; 55 extern FWallTmapVals WallT; 56 57 enum 58 { 59 FAKED_Center, 60 FAKED_BelowFloor, 61 FAKED_AboveCeiling 62 }; 63 64 struct drawseg_t 65 { 66 seg_t* curline; 67 fixed_t light, lightstep; 68 fixed_t iscale, iscalestep; 69 short x1, x2; // Same as sx1 and sx2, but clipped to the drawseg 70 short sx1, sx2; // left, right of parent seg on screen 71 fixed_t sz1, sz2; // z for left, right of parent seg on screen 72 fixed_t siz1, siz2; // 1/z for left, right of parent seg on screen 73 fixed_t cx, cy, cdx, cdy; 74 fixed_t yrepeat; 75 BYTE silhouette; // 0=none, 1=bottom, 2=top, 3=both 76 BYTE bFogBoundary; 77 BYTE bFakeBoundary; // for fake walls 78 int shade; 79 // Pointers to lists for sprite clipping, 80 // all three adjusted so [x1] is first value. 81 ptrdiff_t sprtopclip; // type short 82 ptrdiff_t sprbottomclip; // type short 83 ptrdiff_t maskedtexturecol; // type short 84 ptrdiff_t swall; // type fixed_t 85 int fake; // ident fake drawseg, don't draw and clip sprites 86 // backups 87 ptrdiff_t bkup; // sprtopclip backup, for mid and fake textures 88 FWallTmapVals tmapvals; 89 }; 90 91 92 extern seg_t* curline; 93 extern side_t* sidedef; 94 extern line_t* linedef; 95 extern sector_t* frontsector; 96 extern sector_t* backsector; 97 98 extern drawseg_t *drawsegs; 99 extern drawseg_t *firstdrawseg; 100 extern drawseg_t* ds_p; 101 102 extern TArray<size_t> InterestingDrawsegs; // drawsegs that have something drawn on them 103 extern size_t FirstInterestingDrawseg; 104 105 extern int WindowLeft, WindowRight; 106 extern WORD MirrorFlags; 107 extern seg_t* ActiveWallMirror; 108 109 extern TArray<size_t> WallMirrors; 110 111 typedef void (*drawfunc_t) (int start, int stop); 112 113 EXTERN_CVAR (Bool, r_drawflat) // [RH] Don't texture segs? 114 115 // BSP? 116 void R_ClearClipSegs (short left, short right); 117 void R_ClearDrawSegs (); 118 void R_RenderBSPNode (void *node); 119 120 // killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: 121 sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, bool); 122 123 124 #endif 125