mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 16:30:43 +00:00
various merge cleanups including moving the contents of R_Textures_Init into
Mod_Init
This commit is contained in:
parent
dda567a961
commit
8f4394de4f
9 changed files with 49 additions and 155 deletions
|
@ -69,7 +69,31 @@ texture_t *r_notexture_mip;
|
||||||
void
|
void
|
||||||
Mod_Init (void)
|
Mod_Init (void)
|
||||||
{
|
{
|
||||||
|
int x, y, m;
|
||||||
|
byte *dest;
|
||||||
|
|
||||||
memset (mod_novis, 0xff, sizeof (mod_novis));
|
memset (mod_novis, 0xff, sizeof (mod_novis));
|
||||||
|
r_notexture_mip =
|
||||||
|
Hunk_AllocName (sizeof (texture_t) + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2,
|
||||||
|
"notexture");
|
||||||
|
|
||||||
|
r_notexture_mip->width = r_notexture_mip->height = 16;
|
||||||
|
r_notexture_mip->offsets[0] = sizeof (texture_t);
|
||||||
|
|
||||||
|
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16 * 16;
|
||||||
|
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8 * 8;
|
||||||
|
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4 * 4;
|
||||||
|
|
||||||
|
for (m = 0; m < 4; m++) {
|
||||||
|
dest = (byte *) r_notexture_mip + r_notexture_mip->offsets[m];
|
||||||
|
for (y = 0; y < (16 >> m); y++)
|
||||||
|
for (x = 0; x < (16 >> m); x++) {
|
||||||
|
if ((y < (8 >> m)) ^ (x < (8 >> m)))
|
||||||
|
*dest++ = 0;
|
||||||
|
else
|
||||||
|
*dest++ = 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -66,38 +66,6 @@ extern void GDT_Init ();
|
||||||
extern entity_t r_worldentity;
|
extern entity_t r_worldentity;
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
R_Textures_Init (void)
|
|
||||||
{
|
|
||||||
int x, y, m;
|
|
||||||
byte *dest;
|
|
||||||
|
|
||||||
// create a simple checkerboard texture for the default
|
|
||||||
r_notexture_mip =
|
|
||||||
Hunk_AllocName (sizeof (texture_t) + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2,
|
|
||||||
"notexture");
|
|
||||||
|
|
||||||
r_notexture_mip->width = r_notexture_mip->height = 16;
|
|
||||||
r_notexture_mip->offsets[0] = sizeof (texture_t);
|
|
||||||
|
|
||||||
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16 * 16;
|
|
||||||
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8 * 8;
|
|
||||||
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4 * 4;
|
|
||||||
|
|
||||||
for (m = 0; m < 4; m++) {
|
|
||||||
dest = (byte *) r_notexture_mip + r_notexture_mip->offsets[m];
|
|
||||||
for (y = 0; y < (16 >> m); y++) {
|
|
||||||
for (x = 0; x < (16 >> m); x++) {
|
|
||||||
if ((y < (8 >> m)) ^ (x < (8 >> m)))
|
|
||||||
*dest++ = 0;
|
|
||||||
else
|
|
||||||
*dest++ = 0xff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_Envmap_f
|
R_Envmap_f
|
||||||
|
|
||||||
|
|
|
@ -928,8 +928,6 @@ Host_Init (quakeparms_t *parms)
|
||||||
Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n");
|
Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n");
|
||||||
Con_Printf ("%4.1f megabyte heap\n", parms->memsize / (1024 * 1024.0));
|
Con_Printf ("%4.1f megabyte heap\n", parms->memsize / (1024 * 1024.0));
|
||||||
|
|
||||||
R_Textures_Init (); // needed even for dedicated servers
|
|
||||||
|
|
||||||
if (cls.state != ca_dedicated) {
|
if (cls.state != ca_dedicated) {
|
||||||
vid_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
vid_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
||||||
if (!vid_basepal)
|
if (!vid_basepal)
|
||||||
|
|
|
@ -70,6 +70,7 @@ cvar_t *r_timegraph;
|
||||||
cvar_t *r_wateralpha;
|
cvar_t *r_wateralpha;
|
||||||
cvar_t *r_waterripple;
|
cvar_t *r_waterripple;
|
||||||
cvar_t *r_waterwarp;
|
cvar_t *r_waterwarp;
|
||||||
|
cvar_t *r_zgraph;
|
||||||
|
|
||||||
cvar_t *scr_centertime;
|
cvar_t *scr_centertime;
|
||||||
cvar_t *scr_consize;
|
cvar_t *scr_consize;
|
||||||
|
@ -253,6 +254,9 @@ R_Init_Cvars (void)
|
||||||
"Set to make liquids ripple, try setting to 5");
|
"Set to make liquids ripple, try setting to 5");
|
||||||
r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, NULL,
|
r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, NULL,
|
||||||
"Toggles whether surfaces are warped in liquid.");
|
"Toggles whether surfaces are warped in liquid.");
|
||||||
|
r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, NULL,
|
||||||
|
"Toggle the graph that reports the changes of "
|
||||||
|
"z-axis position");
|
||||||
scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How "
|
scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How "
|
||||||
"long in seconds screen hints are displayed");
|
"long in seconds screen hints are displayed");
|
||||||
scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL,
|
scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL,
|
||||||
|
|
|
@ -109,29 +109,22 @@ float xOrigin, yOrigin;
|
||||||
mplane_t screenedge[4];
|
mplane_t screenedge[4];
|
||||||
|
|
||||||
// refresh flags
|
// refresh flags
|
||||||
int r_framecount = 1; // so frame counts initialized to 0
|
int r_framecount = 1; // so frame counts initialized to 0 don't match
|
||||||
// don't match
|
|
||||||
int r_visframecount;
|
int r_visframecount;
|
||||||
int d_spanpixcount;
|
int d_spanpixcount;
|
||||||
int r_polycount;
|
int r_polycount;
|
||||||
int r_drawnpolycount;
|
int r_drawnpolycount;
|
||||||
int r_wholepolycount;
|
int r_wholepolycount;
|
||||||
|
|
||||||
#define VIEWMODNAME_LENGTH 256
|
|
||||||
char viewmodname[VIEWMODNAME_LENGTH + 1];
|
|
||||||
int modcount;
|
|
||||||
|
|
||||||
int *pfrustum_indexes[4];
|
int *pfrustum_indexes[4];
|
||||||
int r_frustum_indexes[4 * 6];
|
int r_frustum_indexes[4 * 6];
|
||||||
|
|
||||||
int reinit_surfcache = 1; // if 1, surface cache is currently
|
int reinit_surfcache = 1; // if 1, surface cache is currently empty
|
||||||
// empty and must be reinitialized
|
// and must be reinitialized for current
|
||||||
// for current cache size
|
// cache size
|
||||||
|
|
||||||
mleaf_t *r_viewleaf, *r_oldviewleaf;
|
mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||||
|
|
||||||
texture_t *r_notexture_mip;
|
|
||||||
|
|
||||||
float r_aliastransition, r_resfudge;
|
float r_aliastransition, r_resfudge;
|
||||||
|
|
||||||
int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
@ -146,36 +139,6 @@ extern cvar_t *scr_fov;
|
||||||
void R_NetGraph (void);
|
void R_NetGraph (void);
|
||||||
void R_ZGraph (void);
|
void R_ZGraph (void);
|
||||||
|
|
||||||
void
|
|
||||||
R_Textures_Init (void)
|
|
||||||
{
|
|
||||||
int x, y, m;
|
|
||||||
byte *dest;
|
|
||||||
|
|
||||||
// create a simple checkerboard texture for the default
|
|
||||||
r_notexture_mip =
|
|
||||||
Hunk_AllocName (sizeof (texture_t) + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2,
|
|
||||||
"notexture");
|
|
||||||
|
|
||||||
r_notexture_mip->width = r_notexture_mip->height = 16;
|
|
||||||
r_notexture_mip->offsets[0] = sizeof (texture_t);
|
|
||||||
|
|
||||||
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16 * 16;
|
|
||||||
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8 * 8;
|
|
||||||
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4 * 4;
|
|
||||||
|
|
||||||
for (m = 0; m < 4; m++) {
|
|
||||||
dest = (byte *) r_notexture_mip + r_notexture_mip->offsets[m];
|
|
||||||
for (y = 0; y < (16 >> m); y++)
|
|
||||||
for (x = 0; x < (16 >> m); x++) {
|
|
||||||
if ((y < (8 >> m)) ^ (x < (8 >> m)))
|
|
||||||
*dest++ = 0;
|
|
||||||
else
|
|
||||||
*dest++ = 0xff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void R_LoadSky_f (void);
|
void R_LoadSky_f (void);
|
||||||
|
|
||||||
|
@ -215,7 +178,6 @@ R_Init (void)
|
||||||
Sys_MakeCodeWriteable ((long) R_EdgeCodeStart,
|
Sys_MakeCodeWriteable ((long) R_EdgeCodeStart,
|
||||||
(long) R_EdgeCodeEnd - (long) R_EdgeCodeStart);
|
(long) R_EdgeCodeEnd - (long) R_EdgeCodeStart);
|
||||||
#endif // USE_INTEL_ASM
|
#endif // USE_INTEL_ASM
|
||||||
|
|
||||||
D_Init ();
|
D_Init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,12 +343,12 @@ R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
|
||||||
|
|
||||||
verticalFieldOfView = r_refdef.horizontalFieldOfView / screenAspect;
|
verticalFieldOfView = r_refdef.horizontalFieldOfView / screenAspect;
|
||||||
|
|
||||||
// values for perspective projection
|
// values for perspective projection
|
||||||
// if math were exact, the values would range from 0.5 to to range+0.5
|
// if math were exact, the values would range from 0.5 to to range+0.5
|
||||||
// hopefully they wll be in the 0.000001 to range+.999999 and truncate
|
// hopefully they wll be in the 0.000001 to range+.999999 and truncate
|
||||||
// the polygon rasterization will never render in the first row or column
|
// the polygon rasterization will never render in the first row or column
|
||||||
// but will definately render in the [range] row and column, so adjust the
|
// but will definately render in the [range] row and column, so adjust the
|
||||||
// buffer origin to get an exact edge to edge fill
|
// buffer origin to get an exact edge to edge fill
|
||||||
xcenter = ((float) r_refdef.vrect.width * XCENTERING) +
|
xcenter = ((float) r_refdef.vrect.width * XCENTERING) +
|
||||||
r_refdef.vrect.x - 0.5;
|
r_refdef.vrect.x - 0.5;
|
||||||
aliasxcenter = xcenter * r_aliasuvscale;
|
aliasxcenter = xcenter * r_aliasuvscale;
|
||||||
|
@ -967,6 +929,12 @@ R_RenderView_ (void)
|
||||||
if (r_timegraph->int_val)
|
if (r_timegraph->int_val)
|
||||||
R_TimeGraph ();
|
R_TimeGraph ();
|
||||||
|
|
||||||
|
if (r_netgraph->int_val)
|
||||||
|
R_NetGraph ();
|
||||||
|
|
||||||
|
if (r_zgraph->int_val)
|
||||||
|
R_ZGraph ();
|
||||||
|
|
||||||
if (r_aliasstats->int_val)
|
if (r_aliasstats->int_val)
|
||||||
R_PrintAliasStats ();
|
R_PrintAliasStats ();
|
||||||
|
|
||||||
|
|
|
@ -1628,8 +1628,6 @@ Host_Init (void)
|
||||||
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
||||||
Con_Printf ("%4.1f megs RAM used.\n", host_parms.memsize / (1024 * 1024.0));
|
Con_Printf ("%4.1f megs RAM used.\n", host_parms.memsize / (1024 * 1024.0));
|
||||||
|
|
||||||
R_Textures_Init ();
|
|
||||||
|
|
||||||
vid_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
vid_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
||||||
if (!vid_basepal)
|
if (!vid_basepal)
|
||||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||||
|
|
|
@ -797,7 +797,7 @@ R_ShowNearestLoc (void)
|
||||||
if (r_drawentities->int_val)
|
if (r_drawentities->int_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nearloc = locs_find (cl.simorg);
|
nearloc = locs_find (r_origin);
|
||||||
|
|
||||||
if (nearloc) {
|
if (nearloc) {
|
||||||
dl = CL_AllocDlight (4096);
|
dl = CL_AllocDlight (4096);
|
||||||
|
|
|
@ -64,38 +64,6 @@ extern cvar_t *r_netgraph;
|
||||||
extern void GDT_Init ();
|
extern void GDT_Init ();
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
R_Textures_Init (void)
|
|
||||||
{
|
|
||||||
int x, y, m;
|
|
||||||
byte *dest;
|
|
||||||
|
|
||||||
// create a simple checkerboard texture for the default
|
|
||||||
r_notexture_mip =
|
|
||||||
Hunk_AllocName (sizeof (texture_t) + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2,
|
|
||||||
"notexture");
|
|
||||||
|
|
||||||
r_notexture_mip->width = r_notexture_mip->height = 16;
|
|
||||||
r_notexture_mip->offsets[0] = sizeof (texture_t);
|
|
||||||
|
|
||||||
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16 * 16;
|
|
||||||
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8 * 8;
|
|
||||||
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4 * 4;
|
|
||||||
|
|
||||||
for (m = 0; m < 4; m++) {
|
|
||||||
dest = (byte *) r_notexture_mip + r_notexture_mip->offsets[m];
|
|
||||||
for (y = 0; y < (16 >> m); y++) {
|
|
||||||
for (x = 0; x < (16 >> m); x++) {
|
|
||||||
if ((y < (8 >> m)) ^ (x < (8 >> m)))
|
|
||||||
*dest++ = 0;
|
|
||||||
else
|
|
||||||
*dest++ = 0xff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_Envmap_f
|
R_Envmap_f
|
||||||
|
|
||||||
|
|
|
@ -143,40 +143,8 @@ void R_NetGraph (void);
|
||||||
void R_ZGraph (void);
|
void R_ZGraph (void);
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
R_Textures_Init (void)
|
|
||||||
{
|
|
||||||
int x, y, m;
|
|
||||||
byte *dest;
|
|
||||||
|
|
||||||
// create a simple checkerboard texture for the default
|
|
||||||
r_notexture_mip =
|
|
||||||
Hunk_AllocName (sizeof (texture_t) + 16 * 16 + 8 * 8 + 4 * 4 + 2 * 2,
|
|
||||||
"notexture");
|
|
||||||
|
|
||||||
r_notexture_mip->width = r_notexture_mip->height = 16;
|
|
||||||
r_notexture_mip->offsets[0] = sizeof (texture_t);
|
|
||||||
|
|
||||||
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16 * 16;
|
|
||||||
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8 * 8;
|
|
||||||
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4 * 4;
|
|
||||||
|
|
||||||
for (m = 0; m < 4; m++) {
|
|
||||||
dest = (byte *) r_notexture_mip + r_notexture_mip->offsets[m];
|
|
||||||
for (y = 0; y < (16 >> m); y++)
|
|
||||||
for (x = 0; x < (16 >> m); x++) {
|
|
||||||
if ((y < (8 >> m)) ^ (x < (8 >> m)))
|
|
||||||
*dest++ = 0;
|
|
||||||
else
|
|
||||||
*dest++ = 0xff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void R_LoadSky_f (void);
|
void R_LoadSky_f (void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
R_Init (void)
|
R_Init (void)
|
||||||
{
|
{
|
||||||
|
@ -498,7 +466,7 @@ R_ShowNearestLoc (void)
|
||||||
|
|
||||||
if (r_drawentities->int_val)
|
if (r_drawentities->int_val)
|
||||||
return;
|
return;
|
||||||
nearloc = locs_find (cl.simorg);
|
nearloc = locs_find (r_origin);
|
||||||
if (nearloc) {
|
if (nearloc) {
|
||||||
dl = CL_AllocDlight (4096);
|
dl = CL_AllocDlight (4096);
|
||||||
VectorCopy (nearloc->loc, dl->origin);
|
VectorCopy (nearloc->loc, dl->origin);
|
||||||
|
@ -544,8 +512,7 @@ R_DrawEntitiesOnList (void)
|
||||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||||
|
|
||||||
// see if the bounding box lets us trivially reject, also
|
// see if the bounding box lets us trivially reject, also
|
||||||
// sets
|
// sets trivial accept status
|
||||||
// trivial accept status
|
|
||||||
if (R_AliasCheckBBox ()) {
|
if (R_AliasCheckBBox ()) {
|
||||||
j = R_LightPoint (currententity->origin);
|
j = R_LightPoint (currententity->origin);
|
||||||
|
|
||||||
|
@ -874,8 +841,7 @@ R_EdgeDrawing (void)
|
||||||
|
|
||||||
if (!r_dspeeds->int_val) {
|
if (!r_dspeeds->int_val) {
|
||||||
VID_UnlockBuffer ();
|
VID_UnlockBuffer ();
|
||||||
S_ExtraUpdate (); // don't let sound get messed up if
|
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||||
// going slow
|
|
||||||
VID_LockBuffer ();
|
VID_LockBuffer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,7 +980,7 @@ R_InitTurb (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 1280; i++) {
|
for (i = 0; i < (SIN_BUFFER_SIZE); i++) {
|
||||||
sintable[i] = AMP + sin (i * 3.14159 * 2 / CYCLE) * AMP;
|
sintable[i] = AMP + sin (i * 3.14159 * 2 / CYCLE) * AMP;
|
||||||
intsintable[i] = AMP2 + sin (i * 3.14159 * 2 / CYCLE) * AMP2;
|
intsintable[i] = AMP2 + sin (i * 3.14159 * 2 / CYCLE) * AMP2;
|
||||||
// AMP2 not 20
|
// AMP2 not 20
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue