1
0
Fork 0
forked from fte/fteqw

r_skybox should work in sw now

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@104 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-01 22:54:19 +00:00
parent 3c39d1e20f
commit 1d22fd0b85

View file

@ -120,6 +120,8 @@ static char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
int r_skysideimage[6] = {5, 2, 4, 1, 0, 3};
extern mtexinfo_t r_skytexinfo[6];
extern cvar_t gl_skyboxname;
char skyname[128];
void SWR_SetSky (char *name, float rotate, vec3_t axis)
{
@ -157,18 +159,37 @@ qboolean SWR_CheckSky (void)
return true;
}
/*
================
R_LoadSkyBox
================
*/
void *Mod_LoadWall(char *name);
void R_LoadSkyBox (void)
{
int i;
char pathname[MAX_QPATH];
for (i=0 ; i<6 ; i++)
{
sprintf (pathname, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //preferable
if (!r_skytexinfo[i].texture)
{
sprintf (pathname, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //q2 fall back
}
}
}
/*
================
R_InitSkyBox
================
*/
void *Mod_LoadWall(char *name);
void R_InitSkyBox (void)
{
int i;
model_t *wm;
char pathname[MAX_QPATH];
wm = cl.worldmodel;
@ -217,18 +238,6 @@ void R_InitSkyBox (void)
r_skyedges[i].v[1] = wm->numvertexes-9+box_edges[i*2+1];
r_skyedges[i].cachededgeoffset = 0;
}
for (i=0 ; i<6 ; i++)
{
sprintf (pathname, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //preferable
if (!r_skytexinfo[i].texture)
{
sprintf (pathname, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //q2 fall back
}
}
}
/*
@ -246,6 +255,13 @@ qboolean R_EmitSkyBox (void)
if (r_skyframe == r_framecount)
return true; // already set this frame
if (gl_skyboxname.modified)
{
Q_strncpyz (skyname, gl_skyboxname.string, sizeof(skyname));
R_LoadSkyBox();
gl_skyboxname.modified = false;
}
if (!*skyname) //none set
return false;