From 1d22fd0b85edb9dbb7362c87d2ba915294eecd1f Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 1 Sep 2004 22:54:19 +0000 Subject: [PATCH] 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 --- engine/sw/r_draw.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/engine/sw/r_draw.c b/engine/sw/r_draw.c index a8d29fbee..31162348f 100644 --- a/engine/sw/r_draw.c +++ b/engine/sw/r_draw.c @@ -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;