doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

r_defs.h (3355B)


      1 #ifndef __R_DEFS__
      2 #define __R_DEFS__
      3 
      4 #include "doomdef.h"
      5 #include "m_fixed.h"
      6 #include "d_think.h"
      7 #include "p_mobj.h"
      8 
      9 #define SIL_NONE		0
     10 #define SIL_BOTTOM		1
     11 #define SIL_TOP			2
     12 #define SIL_BOTH		3
     13 #define MAXDRAWSEGS		256
     14 
     15 typedef struct {
     16     fixed_t	x;
     17     fixed_t	y;
     18 } vertex_t;
     19 
     20 struct line_s;
     21 
     22 typedef struct {
     23     thinker_t thinker;	
     24     fixed_t   x;
     25     fixed_t   y;
     26     fixed_t   z;
     27 } degenmobj_t;
     28 
     29 typedef	struct {
     30     fixed_t         floorheight;
     31     fixed_t         ceilingheight;
     32     short           floorpic;
     33     short           ceilingpic;
     34     short           lightlevel;
     35     short           special;
     36     short           tag;
     37     int             soundtraversed;
     38     mobj_t*         soundtarget;
     39     int             blockbox[4];
     40     degenmobj_t     soundorg;
     41     int             validcount;
     42     mobj_t*         thinglist;
     43     void*           specialdata;
     44     int             linecount;
     45     struct line_s** lines;	
     46 } sector_t;
     47 
     48 typedef struct {
     49     fixed_t	textureoffset;
     50     fixed_t	rowoffset;
     51     short	toptexture;
     52     short	bottomtexture;
     53     short	midtexture;
     54     sector_t*	sector;
     55 } side_t;
     56 
     57 typedef enum {
     58     ST_HORIZONTAL,
     59     ST_VERTICAL,
     60     ST_POSITIVE,
     61     ST_NEGATIVE
     62 } slopetype_t;
     63 
     64 typedef struct line_s {
     65     vertex_t*	v1;
     66     vertex_t*	v2;
     67     fixed_t	dx;
     68     fixed_t	dy;
     69     short	flags;
     70     short	special;
     71     short	tag;
     72     short	sidenum[2];			
     73     fixed_t	bbox[4];
     74     slopetype_t	slopetype;
     75     sector_t*	frontsector;
     76     sector_t*	backsector;
     77     int		validcount;
     78     void*	specialdata;		
     79 } line_t;
     80 
     81 typedef struct subsector_s {
     82     sector_t*	sector;
     83     short	numlines;
     84     short	firstline;
     85 } subsector_t;
     86 
     87 typedef struct {
     88     vertex_t*	v1;
     89     vertex_t*	v2;
     90     fixed_t	offset;
     91     angle_t	angle;
     92     side_t*	sidedef;
     93     line_t*	linedef;
     94     sector_t*	frontsector;
     95     sector_t*	backsector;
     96 } seg_t;
     97 
     98 typedef struct {
     99     fixed_t	x;
    100     fixed_t	y;
    101     fixed_t	dx;
    102     fixed_t	dy;
    103     fixed_t	bbox[2][4];
    104     unsigned short children[2];
    105 } node_t;
    106 
    107 typedef struct {
    108     byte topdelta;	
    109     byte length; 	
    110 } post_t;
    111 
    112 typedef post_t column_t;
    113 typedef byte	lighttable_t;	
    114 
    115 typedef struct drawseg_s {
    116     seg_t*		curline;
    117     int			x1;
    118     int			x2;
    119     fixed_t		scale1;
    120     fixed_t		scale2;
    121     fixed_t		scalestep;
    122     int			silhouette;
    123     fixed_t		bsilheight;
    124     fixed_t		tsilheight;
    125     short*		sprtopclip;		
    126     short*		sprbottomclip;	
    127     short*		maskedtexturecol;
    128 } drawseg_t;
    129 
    130 typedef struct { 
    131     short width;		
    132     short height; 
    133     short leftoffset;	
    134     short topoffset;	
    135     int   columnofs[8];	
    136 } patch_t;
    137 
    138 typedef struct vissprite_s {
    139     struct vissprite_s*	prev;
    140     struct vissprite_s*	next;
    141     int			x1;
    142     int			x2;
    143     fixed_t		gx;
    144     fixed_t		gy;		
    145     fixed_t		gz;
    146     fixed_t		gzt;
    147     fixed_t		startfrac;
    148     fixed_t		scale;
    149     fixed_t		xiscale;	
    150     fixed_t		texturemid;
    151     int			patch;
    152     lighttable_t*	colormap;
    153     int			mobjflags;
    154 } vissprite_t;
    155 
    156 typedef struct {
    157     boolean	rotate;
    158     short	lump[8];
    159     byte	flip[8];
    160 } spriteframe_t;
    161 
    162 typedef struct {
    163     int            numframes;
    164     spriteframe_t* spriteframes;
    165 } spritedef_t;
    166 
    167 typedef struct {
    168   fixed_t height;
    169   int     picnum;
    170   int     lightlevel;
    171   int     minx;
    172   int     maxx;
    173   byte		pad1;
    174   byte		top[SCREENWIDTH];
    175   byte		pad2;
    176   byte		pad3;
    177   byte		bottom[SCREENWIDTH];
    178   byte		pad4;
    179 } visplane_t;
    180 
    181 #endif