| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* System specific interface stuff. |
| 31 |
* |
| 32 |
*-----------------------------------------------------------------------------*/ |
| 33 |
|
| 34 |
#ifndef __R_DRAW__ |
| 35 |
#define __R_DRAW__ |
| 36 |
|
| 37 |
#include "r_defs.h" |
| 38 |
|
| 39 |
enum column_pipeline_e { |
| 40 |
RDC_PIPELINE_STANDARD, |
| 41 |
RDC_PIPELINE_TRANSLUCENT, |
| 42 |
RDC_PIPELINE_TRANSLATED, |
| 43 |
RDC_PIPELINE_FUZZ, |
| 44 |
RDC_PIPELINE_MAXPIPELINES, |
| 45 |
}; |
| 46 |
|
| 47 |
// Used to specify what kind of filering you want |
| 48 |
enum draw_filter_type_e { |
| 49 |
RDRAW_FILTER_NONE, |
| 50 |
RDRAW_FILTER_POINT, |
| 51 |
RDRAW_FILTER_MAXFILTERS |
| 52 |
}; |
| 53 |
|
| 54 |
typedef enum |
| 55 |
{ |
| 56 |
DRAW_COLUMN_ISPATCH = 0x00000001 |
| 57 |
} draw_column_flags_e; |
| 58 |
|
| 59 |
typedef struct draw_column_vars_s* pdraw_column_vars_s; |
| 60 |
typedef void (*R_DrawColumn_f)(pdraw_column_vars_s dcvars); |
| 61 |
|
| 62 |
// Packaged into a struct - POPE |
| 63 |
typedef struct draw_column_vars_s |
| 64 |
{ |
| 65 |
int x; |
| 66 |
int yl; |
| 67 |
int yh; |
| 68 |
int dy; |
| 69 |
fixed_t iscale; |
| 70 |
fixed_t texturemid; |
| 71 |
int texheight; // killough |
| 72 |
const byte *source; // first pixel in a column |
| 73 |
const byte *prevsource; // first pixel in previous column |
| 74 |
const byte *nextsource; // first pixel in next column |
| 75 |
const lighttable_t *colormap; |
| 76 |
const byte *translation; |
| 77 |
int edgeslope; // OR'ed RDRAW_EDGESLOPE_* |
| 78 |
// 1 if R_DrawColumn* is currently drawing a masked column, otherwise 0 |
| 79 |
int drawingmasked; |
| 80 |
unsigned int flags; //e6y: for detect patches ind colfunc() |
| 81 |
|
| 82 |
// heretic |
| 83 |
int baseclip; |
| 84 |
} draw_column_vars_t; |
| 85 |
|
| 86 |
void R_SetDefaultDrawColumnVars(draw_column_vars_t *dcvars); |
| 87 |
|
| 88 |
typedef struct { |
| 89 |
int y; |
| 90 |
int x1; |
| 91 |
int x2; |
| 92 |
fixed_t z; // the current span z coord |
| 93 |
fixed_t xfrac; |
| 94 |
fixed_t yfrac; |
| 95 |
fixed_t xstep; |
| 96 |
fixed_t ystep; |
| 97 |
const byte *source; // start of a 64*64 tile image |
| 98 |
const lighttable_t *colormap; |
| 99 |
|
| 100 |
fixed_t xoffs; |
| 101 |
fixed_t yoffs; |
| 102 |
fixed_t xscale; |
| 103 |
fixed_t yscale; |
| 104 |
fixed_t sine; |
| 105 |
fixed_t cosine; |
| 106 |
fixed_t planeheight; |
| 107 |
const lighttable_t **planezlight; |
| 108 |
} draw_span_vars_t; |
| 109 |
|
| 110 |
typedef struct { |
| 111 |
byte *topleft; |
| 112 |
int pitch; |
| 113 |
} draw_vars_t; |
| 114 |
|
| 115 |
extern draw_vars_t drawvars; |
| 116 |
|
| 117 |
extern byte playernumtotrans[MAX_MAXPLAYERS]; // CPhipps - what translation table for what player |
| 118 |
extern byte *translationtables; |
| 119 |
|
| 120 |
R_DrawColumn_f R_GetDrawColumnFunc(enum column_pipeline_e type, enum draw_filter_type_e filterz); |
| 121 |
|
| 122 |
// Span blitting for rows, floor/ceiling. No Spectre effect needed. |
| 123 |
void R_DrawSpan(draw_span_vars_t *dsvars); |
| 124 |
|
| 125 |
void R_InitBuffer(int width, int height); |
| 126 |
|
| 127 |
void R_InitBuffersRes(void); |
| 128 |
|
| 129 |
// Initialize color translation tables, for player rendering etc. |
| 130 |
void R_InitTranslationTables(void); |
| 131 |
|
| 132 |
// Rendering function. |
| 133 |
void R_FillBackScreen(void); |
| 134 |
|
| 135 |
// If the view size is not full screen, draws a border around it. |
| 136 |
void R_DrawViewBorder(void); |
| 137 |
|
| 138 |
// haleyjd 09/13/04: new function to call from main rendering loop |
| 139 |
// which gets rid of the unnecessary reset of various variables during |
| 140 |
// column drawing. |
| 141 |
void R_ResetColumnBuffer(void); |
| 142 |
|
| 143 |
void R_SetFuzzPos(int fuzzpos); |
| 144 |
int R_GetFuzzPos(); |
| 145 |
|
| 146 |
// height is the height of the last column, in pixels |
| 147 |
void R_ResetFuzzCol(int height); |
| 148 |
|
| 149 |
// Calls R_ResetFuzzCol if x is aligned to the fuzz cell grid |
| 150 |
void R_CheckFuzzCol(int x, int height); |
| 151 |
|
| 152 |
#endif |