gl_model.c: made a lot of procs and vars static

only user of 'loadmodel' outside of gl_model.c was Sky_LoadTexture,
so changed it to accept a model pointer.

TODO: remove need for globals such as mod_base, loadmodel, loadname
This commit is contained in:
Ozkan Sezer 2022-07-05 08:50:02 +03:00
parent 2dd6a14ccf
commit 00530bda9b
7 changed files with 95 additions and 88 deletions

View file

@ -26,16 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
qmodel_t *loadmodel;
char loadname[32]; // for hunk tags
static qmodel_t* loadmodel;
static char loadname[32]; // for hunk tags
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer);
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer);
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer);
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
static void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer);
static void Mod_LoadBrushModel (qmodel_t *mod, void *buffer);
static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer);
static qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
static void Mod_Print (void);
static cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
static cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
static byte *mod_novis;
static int mod_novis_capacity;
@ -44,8 +46,8 @@ static byte *mod_decompressed;
static int mod_decompressed_capacity;
#define MAX_MOD_KNOWN 2048 /*johnfitz -- was 512 */
qmodel_t mod_known[MAX_MOD_KNOWN];
int mod_numknown;
static qmodel_t mod_known[MAX_MOD_KNOWN];
static int mod_numknown;
texture_t *r_notexture_mip; //johnfitz -- moved here from r_main.c
texture_t *r_notexture_mip2; //johnfitz -- used for non-lightmapped surfs with a missing texture
@ -61,6 +63,8 @@ void Mod_Init (void)
Cvar_RegisterVariable (&external_vis);
Cvar_RegisterVariable (&external_ents);
Cmd_AddCommand ("mcache", Mod_Print);
//johnfitz -- create notexture miptex
r_notexture_mip = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip");
strcpy (r_notexture_mip->name, "notexture");
@ -130,7 +134,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, qmodel_t *model)
Mod_DecompressVis
===================
*/
byte *Mod_DecompressVis (byte *in, qmodel_t *model)
static byte *Mod_DecompressVis (byte *in, qmodel_t *model)
{
int c;
byte *out;
@ -221,11 +225,13 @@ void Mod_ClearAll (void)
qmodel_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (mod->type != mod_alias)
{
mod->needload = true;
TexMgr_FreeTexturesForOwner (mod); //johnfitz
}
}
}
void Mod_ResetAll (void)
@ -251,7 +257,7 @@ Mod_FindName
==================
*/
qmodel_t *Mod_FindName (const char *name)
static qmodel_t *Mod_FindName (const char *name)
{
int i;
qmodel_t *mod;
@ -263,8 +269,10 @@ qmodel_t *Mod_FindName (const char *name)
// search the currently loaded models
//
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (!strcmp (mod->name, name) )
break;
}
if (i == mod_numknown)
{
@ -304,7 +312,7 @@ Mod_LoadModel
Loads a model into the cache
==================
*/
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
static qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
{
byte *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap
@ -398,19 +406,21 @@ qmodel_t *Mod_ForName (const char *name, qboolean crash)
===============================================================================
*/
byte *mod_base;
static byte *mod_base;
/*
=================
Mod_CheckFullbrights -- johnfitz
=================
*/
qboolean Mod_CheckFullbrights (byte *pixels, int count)
static qboolean Mod_CheckFullbrights (byte *pixels, int count)
{
int i;
for (i = 0; i < count; i++)
{
if (*pixels++ > 223)
return true;
}
return false;
}
@ -422,7 +432,7 @@ Quake64 bsp
Check if we have any missing textures in the array
=================
*/
qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
static qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
{
int i;
@ -439,7 +449,7 @@ qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
Mod_LoadTextures
=================
*/
void Mod_LoadTextures (lump_t *l)
static void Mod_LoadTextures (lump_t *l)
{
int i, j, pixels, num, maxanim, altmax;
miptex_t *mt;
@ -533,9 +543,9 @@ void Mod_LoadTextures (lump_t *l)
if (!q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp
{
if (loadmodel->bspversion == BSPVERSION_QUAKE64)
Sky_LoadTextureQ64 (tx);
Sky_LoadTextureQ64 (loadmodel, tx);
else
Sky_LoadTexture (tx);
Sky_LoadTexture (loadmodel, tx);
}
else if (tx->name[0] == '*') //warping texture
{
@ -744,7 +754,7 @@ void Mod_LoadTextures (lump_t *l)
Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc
=================
*/
void Mod_LoadLighting (lump_t *l)
static void Mod_LoadLighting (lump_t *l)
{
int i, mark;
byte *in, *out, *data;
@ -840,7 +850,7 @@ void Mod_LoadLighting (lump_t *l)
Mod_LoadVisibility
=================
*/
void Mod_LoadVisibility (lump_t *l)
static void Mod_LoadVisibility (lump_t *l)
{
loadmodel->viswarn = false;
if (!l->filelen)
@ -858,7 +868,7 @@ void Mod_LoadVisibility (lump_t *l)
Mod_LoadEntities
=================
*/
void Mod_LoadEntities (lump_t *l)
static void Mod_LoadEntities (lump_t *l)
{
char basemapname[MAX_QPATH];
char entfilename[MAX_QPATH];
@ -922,7 +932,7 @@ _load_embedded:
Mod_LoadVertexes
=================
*/
void Mod_LoadVertexes (lump_t *l)
static void Mod_LoadVertexes (lump_t *l)
{
dvertex_t *in;
mvertex_t *out;
@ -950,7 +960,7 @@ void Mod_LoadVertexes (lump_t *l)
Mod_LoadEdges
=================
*/
void Mod_LoadEdges (lump_t *l, int bsp2)
static void Mod_LoadEdges (lump_t *l, int bsp2)
{
medge_t *out;
int i, count;
@ -1000,7 +1010,7 @@ void Mod_LoadEdges (lump_t *l, int bsp2)
Mod_LoadTexinfo
=================
*/
void Mod_LoadTexinfo (lump_t *l)
static void Mod_LoadTexinfo (lump_t *l)
{
texinfo_t *in;
mtexinfo_t *out;
@ -1057,7 +1067,7 @@ CalcSurfaceExtents
Fills in s->texturemins[] and s->extents[]
================
*/
void CalcSurfaceExtents (msurface_t *s)
static void CalcSurfaceExtents (msurface_t *s)
{
float mins[2], maxs[2], val;
int i,j, e;
@ -1127,7 +1137,7 @@ Mod_PolyForUnlitSurface -- johnfitz -- creates polys for unlightmapped surfaces
TODO: merge this into BuildSurfaceDisplayList?
================
*/
void Mod_PolyForUnlitSurface (msurface_t *fa)
static void Mod_PolyForUnlitSurface (msurface_t *fa)
{
vec3_t verts[64];
int numverts, i, lindex;
@ -1172,7 +1182,7 @@ void Mod_PolyForUnlitSurface (msurface_t *fa)
Mod_CalcSurfaceBounds -- johnfitz -- calculate bounding box for per-surface frustum culling
=================
*/
void Mod_CalcSurfaceBounds (msurface_t *s)
static void Mod_CalcSurfaceBounds (msurface_t *s)
{
int i, e;
mvertex_t *v;
@ -1209,7 +1219,7 @@ void Mod_CalcSurfaceBounds (msurface_t *s)
Mod_LoadFaces
=================
*/
void Mod_LoadFaces (lump_t *l, qboolean bsp2)
static void Mod_LoadFaces (lump_t *l, qboolean bsp2)
{
dsface_t *ins;
dlface_t *inl;
@ -1340,7 +1350,7 @@ void Mod_LoadFaces (lump_t *l, qboolean bsp2)
Mod_SetParent
=================
*/
void Mod_SetParent (mnode_t *node, mnode_t *parent)
static void Mod_SetParent (mnode_t *node, mnode_t *parent)
{
node->parent = parent;
if (node->contents < 0)
@ -1354,7 +1364,7 @@ void Mod_SetParent (mnode_t *node, mnode_t *parent)
Mod_LoadNodes
=================
*/
void Mod_LoadNodes_S (lump_t *l)
static void Mod_LoadNodes_S (lump_t *l)
{
int i, j, count, p;
dsnode_t *in;
@ -1410,7 +1420,7 @@ void Mod_LoadNodes_S (lump_t *l)
}
}
void Mod_LoadNodes_L1 (lump_t *l)
static void Mod_LoadNodes_L1 (lump_t *l)
{
int i, j, count, p;
dl1node_t *in;
@ -1462,7 +1472,7 @@ void Mod_LoadNodes_L1 (lump_t *l)
}
}
void Mod_LoadNodes_L2 (lump_t *l)
static void Mod_LoadNodes_L2 (lump_t *l)
{
int i, j, count, p;
dl2node_t *in;
@ -1514,7 +1524,7 @@ void Mod_LoadNodes_L2 (lump_t *l)
}
}
void Mod_LoadNodes (lump_t *l, int bsp2)
static void Mod_LoadNodes (lump_t *l, int bsp2)
{
if (bsp2 == 2)
Mod_LoadNodes_L2(l);
@ -1526,7 +1536,7 @@ void Mod_LoadNodes (lump_t *l, int bsp2)
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
}
void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
static void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -1572,7 +1582,7 @@ void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
}
}
void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
static void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -1615,7 +1625,7 @@ void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
}
}
void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
static void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -1663,7 +1673,7 @@ void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
Mod_LoadLeafs
=================
*/
void Mod_LoadLeafs (lump_t *l, int bsp2)
static void Mod_LoadLeafs (lump_t *l, int bsp2)
{
void *in = (void *)(mod_base + l->fileofs);
@ -1680,7 +1690,7 @@ void Mod_LoadLeafs (lump_t *l, int bsp2)
Mod_LoadClipnodes
=================
*/
void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
static void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
{
dsclipnode_t *ins;
dlclipnode_t *inl;
@ -1788,7 +1798,7 @@ Mod_MakeHull0
Duplicate the drawing hull structure as a clipping hull
=================
*/
void Mod_MakeHull0 (void)
static void Mod_MakeHull0 (void)
{
mnode_t *in, *child;
mclipnode_t *out; //johnfitz -- was dclipnode_t
@ -1825,7 +1835,7 @@ void Mod_MakeHull0 (void)
Mod_LoadMarksurfaces
=================
*/
void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
static void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
{
int i, j, count;
msurface_t **out;
@ -1883,7 +1893,7 @@ void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
Mod_LoadSurfedges
=================
*/
void Mod_LoadSurfedges (lump_t *l)
static void Mod_LoadSurfedges (lump_t *l)
{
int i, count;
int *in, *out;
@ -1907,7 +1917,7 @@ void Mod_LoadSurfedges (lump_t *l)
Mod_LoadPlanes
=================
*/
void Mod_LoadPlanes (lump_t *l)
static void Mod_LoadPlanes (lump_t *l)
{
int i, j;
mplane_t *out;
@ -1945,7 +1955,7 @@ void Mod_LoadPlanes (lump_t *l)
RadiusFromBounds
=================
*/
float RadiusFromBounds (vec3_t mins, vec3_t maxs)
static float RadiusFromBounds (vec3_t mins, vec3_t maxs)
{
int i;
vec3_t corner;
@ -1963,7 +1973,7 @@ float RadiusFromBounds (vec3_t mins, vec3_t maxs)
Mod_LoadSubmodels
=================
*/
void Mod_LoadSubmodels (lump_t *l)
static void Mod_LoadSubmodels (lump_t *l)
{
dmodel_t *in;
dmodel_t *out;
@ -2013,7 +2023,8 @@ Therefore, the bounding box of the hull can be constructed entirely
from axial planes found in the clipnodes for that hull.
=================
*/
void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
#if 0 /* disabled for now -- see in Mod_SetupSubmodels() */
static void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
{
mplane_t *plane;
mclipnode_t *node;
@ -2052,6 +2063,7 @@ void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
Mod_BoundsFromClipNode (mod, hull, node->children[0]);
Mod_BoundsFromClipNode (mod, hull, node->children[1]);
}
#endif /* #if 0 */
/* EXTERNAL VIS FILE SUPPORT:
*/
@ -2153,7 +2165,7 @@ static void Mod_LoadLeafsExternal(FILE* f)
Mod_LoadBrushModel
=================
*/
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
static void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
{
int i, j;
int bsp2;
@ -2314,17 +2326,14 @@ mtriangle_t triangles[MAXALIASTRIS];
// a pose is a single set of vertexes. a frame may be
// an animating sequence of poses
trivertx_t *poseverts[MAXALIASFRAMES];
int posenum;
byte **player_8bit_texels_tbl;
byte *player_8bit_texels;
static int posenum;
/*
=================
Mod_LoadAliasFrame
=================
*/
void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
static void *Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
{
trivertx_t *pinframe;
int i;
@ -2347,7 +2356,6 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
frame->bboxmax.v[i] = pdaliasframe->bboxmax.v[i];
}
pinframe = (trivertx_t *)(pdaliasframe + 1);
poseverts[posenum] = pinframe;
@ -2364,7 +2372,7 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
Mod_LoadAliasGroup
=================
*/
void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame)
static void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame)
{
daliasgroup_t *pingroup;
int i, numframes;
@ -2437,7 +2445,7 @@ do { \
else if (pos[off] != 255) fdc = pos[off]; \
} while (0)
void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
static void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
{
byte fillcolor = *skin; // assume this is the pixel to fill
floodfill_t fifo[FLOODFILL_FIFO_SIZE];
@ -2450,11 +2458,13 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
filledcolor = 0;
// attempt to find opaque black
for (i = 0; i < 256; ++i)
{
if (d_8to24table[i] == (255 << 0)) // alpha 1.0
{
filledcolor = i;
break;
}
}
}
// can't fill to filled color or to transparent color (used as visited marker)
@ -2488,7 +2498,7 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
Mod_LoadAllSkins
===============
*/
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
static void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
{
int i, j, k, size, groupskins;
char name[MAX_QPATH];
@ -2600,7 +2610,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
Mod_CalcAliasBounds -- johnfitz -- calculate bounds of alias model for nonrotated, yawrotated, and fullrotated cases
=================
*/
void Mod_CalcAliasBounds (aliashdr_t *a)
static void Mod_CalcAliasBounds (aliashdr_t *a)
{
int i,j,k;
float dist, yawradius, radius;
@ -2705,7 +2715,9 @@ void Mod_SetExtraFlags (qmodel_t *mod)
if (!strcmp (mod->name, "progs/flame2.mdl") ||
!strcmp (mod->name, "progs/flame.mdl") ||
!strcmp (mod->name, "progs/boss.mdl"))
{
mod->flags |= MOD_FBRIGHTHACK;
}
}
/*
@ -2713,7 +2725,7 @@ void Mod_SetExtraFlags (qmodel_t *mod)
Mod_LoadAliasModel
=================
*/
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
{
int i, j;
mdl_t *pinmodel;
@ -2873,7 +2885,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
Mod_LoadSpriteFrame
=================
*/
void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
static void *Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
@ -2921,7 +2933,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
Mod_LoadSpriteGroup
=================
*/
void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
static void *Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
{
dspritegroup_t *pingroup;
mspritegroup_t *pspritegroup;
@ -2973,7 +2985,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
Mod_LoadSpriteModel
=================
*/
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
static void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
{
int i;
int version;
@ -3050,7 +3062,7 @@ void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
Mod_Print
================
*/
void Mod_Print (void)
static void Mod_Print (void)
{
int i;
qmodel_t *mod;

View file

@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#ifndef GL_MODEL_H
#define GL_MODEL_H
#include "modelgen.h"
#include "spritegn.h"
@ -517,4 +517,4 @@ byte *Mod_NoVisPVS (qmodel_t *model);
void Mod_SetExtraFlags (qmodel_t *mod);
#endif // __MODEL__
#endif /* GL_MODEL_H */

View file

@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
float Fog_GetDensity(void);
float *Fog_GetColor(void);
extern qmodel_t *loadmodel;
extern int rs_skypolys; //for r_speeds readout
extern int rs_skypasses; //for r_speeds readout
extern int rs_skypolys; // for r_speeds readout
extern int rs_skypasses; // for r_speeds readout
float skyflatcolor[3];
float skymins[2][6], skymaxs[2][6];
@ -92,7 +92,7 @@ Sky_LoadTexture
A sky texture is 256*128, with the left side being a masked overlay
==============
*/
void Sky_LoadTexture (texture_t *mt)
void Sky_LoadTexture (qmodel_t *mod, texture_t *mt)
{
char texturename[64];
unsigned x, y, p, r, g, b, count, halfwidth, *rgba;
@ -114,8 +114,8 @@ void Sky_LoadTexture (texture_t *mt)
for (y=0 ; y<mt->height ; y++)
memcpy (back_data + y*halfwidth, src + halfwidth + y*mt->width, halfwidth);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", loadmodel->name, mt->name);
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, halfwidth, mt->height, SRC_INDEXED, back_data, "", (src_offset_t)back_data, TEXPREF_NONE);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", mod->name, mt->name);
solidskytexture = TexMgr_LoadImage (mod, texturename, halfwidth, mt->height, SRC_INDEXED, back_data, "", (src_offset_t)back_data, TEXPREF_NONE);
// extract front layer and upload
r = g = b = count = 0;
@ -139,8 +139,8 @@ void Sky_LoadTexture (texture_t *mt)
}
front_data = back_data + halfwidth*mt->height;
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", loadmodel->name, mt->name);
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, halfwidth, mt->height, SRC_INDEXED, front_data, "", (src_offset_t)front_data, TEXPREF_ALPHA);
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", mod->name, mt->name);
alphaskytexture = TexMgr_LoadImage (mod, texturename, halfwidth, mt->height, SRC_INDEXED, front_data, "", (src_offset_t)front_data, TEXPREF_ALPHA);
// calculate r_fastsky color based on average of all opaque foreground colors
skyflatcolor[0] = (float)r/(count*255);
@ -155,7 +155,7 @@ Sky_LoadTextureQ64
Quake64 sky textures are 32*64
==============
*/
void Sky_LoadTextureQ64 (texture_t *mt)
void Sky_LoadTextureQ64 (qmodel_t *mod, texture_t *mt)
{
char texturename[64];
unsigned i, p, r, g, b, count, halfheight, *rgba;
@ -175,8 +175,8 @@ void Sky_LoadTextureQ64 (texture_t *mt)
front_rgba = (byte *) Hunk_AllocName (4*mt->width*halfheight, "q64_skytex");
// Normal indexed texture for the back layer
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", loadmodel->name, mt->name);
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, mt->width, halfheight, SRC_INDEXED, back, "", (src_offset_t)back, TEXPREF_NONE);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", mod->name, mt->name);
solidskytexture = TexMgr_LoadImage (mod, texturename, mt->width, halfheight, SRC_INDEXED, back, "", (src_offset_t)back, TEXPREF_NONE);
// front layer, convert to RGBA and upload
p = r = g = b = count = 0;
@ -199,8 +199,8 @@ void Sky_LoadTextureQ64 (texture_t *mt)
count++;
}
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", loadmodel->name, mt->name);
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, mt->width, halfheight, SRC_RGBA, front_rgba, "", (src_offset_t)front_rgba, TEXPREF_ALPHA);
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", mod->name, mt->name);
alphaskytexture = TexMgr_LoadImage (mod, texturename, mt->width, halfheight, SRC_RGBA, front_rgba, "", (src_offset_t)front_rgba, TEXPREF_ALPHA);
// calculate r_fastsky color based on average of all opaque foreground colors
skyflatcolor[0] = (float)r/(count*255);

View file

@ -605,7 +605,6 @@ void TexMgr_Init (void)
int i;
static byte notexture_data[16] = {159,91,83,255,0,0,0,255,0,0,0,255,159,91,83,255}; //black and pink checker
static byte nulltexture_data[16] = {127,191,255,255,0,0,0,255,0,0,0,255,127,191,255,255}; //black and blue checker
extern texture_t *r_notexture_mip, *r_notexture_mip2;
// init texture list
free_gltextures = (gltexture_t *) Hunk_AllocName (MAX_GLTEXTURES * sizeof(gltexture_t), "gltextures");

View file

@ -45,8 +45,6 @@ float turbsin[] =
//
//==============================================================================
extern qmodel_t *loadmodel;
msurface_t *warpface;
cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE};

View file

@ -108,6 +108,8 @@ extern int r_visframecount; // ??? what difs?
extern int r_framecount;
extern mplane_t frustum[4];
extern texture_t *r_notexture_mip, *r_notexture_mip2;
//
// view origin
//
@ -397,8 +399,8 @@ void Sky_Init (void);
void Sky_ClearAll (void);
void Sky_DrawSky (void);
void Sky_NewMap (void);
void Sky_LoadTexture (texture_t *mt);
void Sky_LoadTextureQ64 (texture_t *mt);
void Sky_LoadTexture (qmodel_t *m, texture_t *mt);
void Sky_LoadTextureQ64 (qmodel_t *m, texture_t *mt);
void Sky_LoadSkyBox (const char *name);
void TexMgr_RecalcWarpImageSize (void);

View file

@ -30,8 +30,6 @@ extern cvar_t pausable;
int current_skill;
void Mod_Print (void);
/*
==================
Host_Quit_f
@ -2325,7 +2323,5 @@ void Host_InitCommands (void)
Cmd_AddCommand ("viewframe", Host_Viewframe_f);
Cmd_AddCommand ("viewnext", Host_Viewnext_f);
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
Cmd_AddCommand ("mcache", Mod_Print);
}