-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathd_local.h
150 lines (107 loc) · 3.97 KB
/
d_local.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// d_local.h: private rasterization driver defs
#include "r_model.h" // FIXME
#include "r_local.h" // FIXME
#include "r_shared.h"
// TODO: fine-tune this; it's based on providing some overage even if there
// is a 2k-wide scan, with subdivision every 8, for 256 spans of 12 bytes each
#define SCANBUFFERPAD 0x1000
#define R_SKY_SMASK 0x007F0000
#define R_SKY_TMASK 0x007F0000
#define DS_SPAN_LIST_END -128
#define SURFCACHE_SIZE_AT_320X200 600*1024
typedef struct surfcache_s {
struct surfcache_s *next;
struct surfcache_s **owner; // NULL is an empty chunk of memory
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
int dlight;
int size; // including header
unsigned width;
unsigned height; // DEBUG only needed for debug
float mipscale;
struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements
} surfcache_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct sspan_s {
int u, v, count;
} sspan_t;
extern cvar_t d_subdiv16;
extern float scale_for_mip;
extern qbool d_roverwrapped;
extern surfcache_t *sc_rover;
extern surfcache_t *d_initial_rover;
extern float d_sdivzstepu, d_tdivzstepu, d_zistepu;
extern float d_sdivzstepv, d_tdivzstepv, d_zistepv;
extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin;
extern fixed16_t sadjust, tadjust;
extern fixed16_t bbextents, bbextentt;
void D_DrawSpans8 (espan_t *pspans);
void D_DrawSpans16 (espan_t *pspans);
void D_DrawZSpans (espan_t *pspans);
void Turbulent8 (espan_t *pspan);
void D_SpriteDrawSpans (sspan_t *pspan);
void D_DrawSkyScans8 (espan_t *pspan);
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel);
extern int D_MipLevelForScale (float scale);
#if id386
extern void D_PolysetAff8Start (void);
extern void D_PolysetAff8End (void);
#endif
extern short *d_pzbuffer;
extern unsigned int d_zrowbytes, d_zwidth;
extern int *d_pscantable;
extern int d_scantable[MAXHEIGHT];
extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
extern int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
extern pixel_t *d_viewbuffer;
extern short *zspantable[MAXHEIGHT];
extern int d_minmip;
extern float d_scalemip[3];
extern void (*d_drawspans) (espan_t *pspan);
#ifdef FTE_PEXT_TRANS
#define PAL555_SIZE 32*32*32
#define TRANS_LEVELS 65
#define TRANS_MAX (TRANS_LEVELS - 1)
#define TRANS_UPPER_CAP (TRANS_MAX / (TRANS_LEVELS + 0.0))
#define TRANS_LOWER_CAP (1.0 / TRANS_LEVELS)
#define REMAP_MAX 64
// palette remap cache
typedef struct palremap_s {
int r;
int g;
int b;
int key;
int references;
byte pal[256];
} palremap_t;
palremap_t *palremaps;
int palremapsize;
#define fbremapidx(x) palremaps[1].pal[x]
#define identityremap palremaps[0]
#define fullbrightremap palremaps[1]
palremap_t *D_GetPaletteRemap(int red, int green, int blue, qbool desaturate, qbool fullbrights, int topcolor, int bottomcolor);
byte *D_GetMenuTintPal(void);
struct palremap_s *D_IdentityRemap(void);
void D_DereferenceRemap(palremap_t *palremap);
void D_InitTrans(void);
// void Set_TransLevelI(int level);
//void D_SetTransLevel(float level, blendmode_t blend);
extern byte Trans(byte p, byte p2);
extern byte AddBlend(byte p, byte p2);
extern byte *pal555to8;
void D_ShutdownTrans(void);
#endif