forked from QW-Group/ezquake-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d_init.c
111 lines (83 loc) · 2.68 KB
/
d_init.c
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
/*
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_init.c: rasterization driver initialization
#include "quakedef.h"
#include "d_local.h"
#define NUM_MIPS 4
cvar_t d_subdiv16 = {"d_subdiv16", "1"};
cvar_t d_mipcap = {"d_mipcap", "0"};
cvar_t d_mipscale = {"d_mipscale", "1"};
void OnChange_r_drawflat (cvar_t *, char *, qbool *);
// hetman /r_drawflat for software builds {
cvar_t r_drawflat = {"r_drawflat", "0", 0, OnChange_r_drawflat};
cvar_t r_wallcolor = {"r_wallcolor", "60"};
cvar_t r_floorcolor = {"r_floorcolor", "25"};
// } hetman
surfcache_t *d_initial_rover;
qbool d_roverwrapped;
int d_minmip;
float d_scalemip[NUM_MIPS-1];
static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8};
extern int d_aflatcolor;
void (*d_drawspans) (espan_t *pspan);
// hetman /r_drawflat for software builds {
void OnChange_r_drawflat (cvar_t *var, char *val, qbool *cancel) {
if (cls.state != ca_disconnected) {
Com_Printf("You must be disconnected before toggling Simple Textures.\n");
*cancel = true;
}
}
// } hetman
void D_Init (void) {
Cvar_SetCurrentGroup(CVAR_GROUP_TEXTURES);
Cvar_Register (&d_subdiv16);
Cvar_Register (&d_mipcap);
Cvar_Register (&d_mipscale);
// hetman /r_drawflat for software builds {
Cvar_Register (&r_drawflat);
Cvar_Register (&r_floorcolor);
Cvar_Register (&r_wallcolor);
// } hetman
Cvar_ResetCurrentGroup();
r_aliasuvscale = 1.0;
#ifdef FTE_PEXT_TRANS
#ifdef GLQUAKE
D_InitTrans();
#endif
#endif
}
void D_EnableBackBufferAccess (void) {
VID_LockBuffer ();
}
void D_DisableBackBufferAccess (void) {
VID_UnlockBuffer ();
}
void D_SetupFrame (void) {
int i;
d_viewbuffer = r_dowarp ? r_warpbuffer : (void *) vid.buffer;
screenwidth = r_dowarp ? WARP_WIDTH : vid.rowbytes;
d_roverwrapped = false;
d_initial_rover = sc_rover;
d_minmip = bound(0, d_mipcap.value, 3);
for (i = 0; i < NUM_MIPS - 1; i++)
d_scalemip[i] = basemip[i] * d_mipscale.value;
#if id386
if (d_subdiv16.value )
d_drawspans = D_DrawSpans16;
else
#endif
d_drawspans = D_DrawSpans8;
d_aflatcolor = 0;
}