From 8fb649709e1cd1e6725e18f2c8e5edf321c9e25d Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Wed, 11 Oct 2023 20:14:07 +0300 Subject: [PATCH] Sync code style in sky warp functions --- src/client/refresh/gl1/gl1_warp.c | 51 +++--- src/client/refresh/gl3/gl3_surf.c | 4 +- src/client/refresh/gl3/gl3_warp.c | 52 +++--- src/client/refresh/gl3/header/local.h | 4 +- src/client/refresh/gl4/gl4_surf.c | 2 +- src/client/refresh/gl4/gl4_warp.c | 50 +++-- src/client/refresh/gl4/header/local.h | 2 +- src/client/refresh/vk/vk_warp.c | 253 ++++++++++++++++---------- 8 files changed, 232 insertions(+), 186 deletions(-) diff --git a/src/client/refresh/gl1/gl1_warp.c b/src/client/refresh/gl1/gl1_warp.c index 8966df0f..7e205c08 100644 --- a/src/client/refresh/gl1/gl1_warp.c +++ b/src/client/refresh/gl1/gl1_warp.c @@ -34,7 +34,7 @@ static float skyrotate; static int skyautorotate; static vec3_t skyaxis; static image_t *sky_images[6]; -static int skytexorder[6] = {0, 2, 1, 3, 4, 5}; +static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; GLfloat vtx_sky[12]; GLfloat tex_sky[8]; @@ -42,13 +42,13 @@ unsigned int index_vtx = 0; unsigned int index_tex = 0; /* 3dstudio environment map names */ -char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; +static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; float r_turbsin[] = { #include "../constants/warpsin.h" }; -static vec3_t skyclip[6] = { +static const vec3_t skyclip[6] = { {1, 1, 0}, {1, -1, 0}, {0, -1, 1}, @@ -56,9 +56,8 @@ static vec3_t skyclip[6] = { {1, 0, 1}, {-1, 0, 1} }; -int c_sky; -static int st_to_vec[6][3] = { +static const int st_to_vec[6][3] = { {3, -1, 2}, {-3, 1, 2}, @@ -69,7 +68,7 @@ static int st_to_vec[6][3] = { {2, -1, -3} /* look straight down */ }; -static int vec_to_st[6][3] = { +static const int vec_to_st[6][3] = { {-2, 3, 1}, {2, 3, -1}, @@ -157,14 +156,12 @@ R_EmitWaterPolys(msurface_t *fa) static void R_DrawSkyPolygon(int nump, vec3_t vecs) { - int i, j; + int i; vec3_t v, av; float s, t, dv; int axis; float *vp; - c_sky++; - /* decide which face it maps to */ VectorCopy(vec3_origin, v); @@ -214,6 +211,8 @@ R_DrawSkyPolygon(int nump, vec3_t vecs) /* project new texture coords */ for (i = 0; i < nump; i++, vecs += 3) { + int j; + j = vec_to_st[axis][2]; if (j > 0) @@ -274,10 +273,10 @@ R_DrawSkyPolygon(int nump, vec3_t vecs) } } -void +static void R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) { - float *norm; + const float *norm; float *v; qboolean front, back; float d, e; @@ -289,7 +288,7 @@ R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (nump > MAX_CLIP_VERTS - 2) { - Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS"); + Com_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__); } if (stage == 6) @@ -413,27 +412,22 @@ R_ClearSkyBox(void) } } -void +static void R_MakeSkyVec(float s, float t, int axis) { vec3_t v, b; - int j, k; + int j; - if (r_farsee->value == 0) - { - b[0] = s * 2300; - b[1] = t * 2300; - b[2] = 2300; - } - else - { - b[0] = s * 4096; - b[1] = t * 4096; - b[2] = 4096; - } + float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f; + + b[0] = s * dist; + b[1] = t * dist; + b[2] = dist; for (j = 0; j < 3; j++) { + int k; + k = st_to_vec[axis][j]; if (k < 0) @@ -488,7 +482,7 @@ R_DrawSkyBox(void) for (i = 0; i < 6; i++) { if ((skymins[0][i] < skymaxs[0][i]) && - (skymins[1][i] < skymaxs[1][i])) + (skymins[1][i] < skymaxs[1][i])) { break; } @@ -516,7 +510,7 @@ R_DrawSkyBox(void) } if ((skymins[0][i] >= skymaxs[0][i]) || - (skymins[1][i] >= skymaxs[1][i])) + (skymins[1][i] >= skymaxs[1][i])) { continue; } @@ -576,4 +570,3 @@ RI_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) sky_min = 1.0 / 512; sky_max = 511.0 / 512; } - diff --git a/src/client/refresh/gl3/gl3_surf.c b/src/client/refresh/gl3/gl3_surf.c index eacf1124..e9c3847d 100644 --- a/src/client/refresh/gl3/gl3_surf.c +++ b/src/client/refresh/gl3/gl3_surf.c @@ -723,7 +723,7 @@ RecursiveWorldNode(entity_t *currententity, mnode_t *node) if (surf->texinfo->flags & SURF_SKY) { /* just adds to visible sky bounds */ - GL3_AddSkySurface(surf); + R_AddSkySurface(surf); } else if (surf->texinfo->flags & (SURF_TRANS33 | SURF_TRANS66)) { @@ -780,7 +780,7 @@ GL3_DrawWorld(void) gl3state.currenttexture = -1; - GL3_ClearSkyBox(); + R_ClearSkyBox(); RecursiveWorldNode(&ent, gl3_worldmodel->nodes); DrawTextureChains(&ent); GL3_DrawSkyBox(); diff --git a/src/client/refresh/gl3/gl3_warp.c b/src/client/refresh/gl3/gl3_warp.c index dd54a363..ca70a358 100644 --- a/src/client/refresh/gl3/gl3_warp.c +++ b/src/client/refresh/gl3/gl3_warp.c @@ -83,21 +83,16 @@ GL3_EmitWaterPolys(msurface_t *fa) #define ON_EPSILON 0.1 /* point on plane side epsilon */ enum { MAX_CLIP_VERTS = 64 }; - -static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; - -static float skymins[2][6], skymaxs[2][6]; -static float sky_min, sky_max; - static float skyrotate; static int skyautorotate; static vec3_t skyaxis; -static gl3image_t* sky_images[6]; +static gl3image_t *sky_images[6]; +static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; /* 3dstudio environment map names */ -static const char* suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; +static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; -vec3_t skyclip[6] = { +static const vec3_t skyclip[6] = { {1, 1, 0}, {1, -1, 0}, {0, -1, 1}, @@ -105,9 +100,8 @@ vec3_t skyclip[6] = { {1, 0, 1}, {-1, 0, 1} }; -int c_sky; -int st_to_vec[6][3] = { +static const int st_to_vec[6][3] = { {3, -1, 2}, {-3, 1, 2}, @@ -118,7 +112,7 @@ int st_to_vec[6][3] = { {2, -1, -3} /* look straight down */ }; -int vec_to_st[6][3] = { +static const int vec_to_st[6][3] = { {-2, 3, 1}, {2, 3, -1}, @@ -129,6 +123,8 @@ int vec_to_st[6][3] = { {-2, 1, -3} }; +static float skymins[2][6], skymaxs[2][6]; +static float sky_min, sky_max; void GL3_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) @@ -163,16 +159,14 @@ GL3_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) } static void -DrawSkyPolygon(int nump, vec3_t vecs) +R_DrawSkyPolygon(int nump, vec3_t vecs) { - int i, j; + int i; vec3_t v, av; float s, t, dv; int axis; float *vp; - c_sky++; - /* decide which face it maps to */ VectorCopy(vec3_origin, v); @@ -222,6 +216,8 @@ DrawSkyPolygon(int nump, vec3_t vecs) /* project new texture coords */ for (i = 0; i < nump; i++, vecs += 3) { + int j; + j = vec_to_st[axis][2]; if (j > 0) @@ -283,9 +279,9 @@ DrawSkyPolygon(int nump, vec3_t vecs) } static void -ClipSkyPolygon(int nump, vec3_t vecs, int stage) +R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) { - float *norm; + const float *norm; float *v; qboolean front, back; float d, e; @@ -297,13 +293,13 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (nump > MAX_CLIP_VERTS - 2) { - Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS"); + Com_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__); } if (stage == 6) { /* fully clipped, so draw it */ - DrawSkyPolygon(nump, vecs); + R_DrawSkyPolygon(nump, vecs); return; } @@ -335,7 +331,7 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (!front || !back) { /* not clipped */ - ClipSkyPolygon(nump, vecs, stage + 1); + R_ClipSkyPolygon(nump, vecs, stage + 1); return; } @@ -386,12 +382,12 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) } /* continue */ - ClipSkyPolygon(newc[0], newv[0][0], stage + 1); - ClipSkyPolygon(newc[1], newv[1][0], stage + 1); + R_ClipSkyPolygon(newc[0], newv[0][0], stage + 1); + R_ClipSkyPolygon(newc[1], newv[1][0], stage + 1); } void -GL3_AddSkySurface(msurface_t *fa) +R_AddSkySurface(msurface_t *fa) { int i; vec3_t verts[MAX_CLIP_VERTS]; @@ -405,12 +401,12 @@ GL3_AddSkySurface(msurface_t *fa) VectorSubtract(p->verts[i].pos, gl3_origin, verts[i]); } - ClipSkyPolygon(p->numverts, verts[0], 0); + R_ClipSkyPolygon(p->numverts, verts[0], 0); } } void -GL3_ClearSkyBox(void) +R_ClearSkyBox(void) { int i; @@ -425,7 +421,7 @@ static void MakeSkyVec(float s, float t, int axis, mvtx_t* vert) { vec3_t v, b; - int j, k; + int j; float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f; @@ -435,6 +431,8 @@ MakeSkyVec(float s, float t, int axis, mvtx_t* vert) for (j = 0; j < 3; j++) { + int k; + k = st_to_vec[axis][j]; if (k < 0) diff --git a/src/client/refresh/gl3/header/local.h b/src/client/refresh/gl3/header/local.h index 7935afed..39ca8ba8 100644 --- a/src/client/refresh/gl3/header/local.h +++ b/src/client/refresh/gl3/header/local.h @@ -477,8 +477,8 @@ extern void GL3_EmitWaterPolys(msurface_t *fa); extern void GL3_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis); extern void GL3_DrawSkyBox(void); -extern void GL3_ClearSkyBox(void); -extern void GL3_AddSkySurface(msurface_t *fa); +extern void R_ClearSkyBox(void); +extern void R_AddSkySurface(msurface_t *fa); // gl3_surf.c diff --git a/src/client/refresh/gl4/gl4_surf.c b/src/client/refresh/gl4/gl4_surf.c index 93fd9cd8..dba40b23 100644 --- a/src/client/refresh/gl4/gl4_surf.c +++ b/src/client/refresh/gl4/gl4_surf.c @@ -780,7 +780,7 @@ GL4_DrawWorld(void) gl4state.currenttexture = -1; - GL4_ClearSkyBox(); + R_ClearSkyBox(); RecursiveWorldNode(&ent, gl4_worldmodel->nodes); DrawTextureChains(&ent); GL4_DrawSkyBox(); diff --git a/src/client/refresh/gl4/gl4_warp.c b/src/client/refresh/gl4/gl4_warp.c index e602fd5b..d351c442 100644 --- a/src/client/refresh/gl4/gl4_warp.c +++ b/src/client/refresh/gl4/gl4_warp.c @@ -83,21 +83,16 @@ GL4_EmitWaterPolys(msurface_t *fa) #define ON_EPSILON 0.1 /* point on plane side epsilon */ enum { MAX_CLIP_VERTS = 64 }; - -static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; - -static float skymins[2][6], skymaxs[2][6]; -static float sky_min, sky_max; - static float skyrotate; static int skyautorotate; static vec3_t skyaxis; -static gl4image_t* sky_images[6]; +static gl4image_t *sky_images[6]; +static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; /* 3dstudio environment map names */ -static const char* suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; +static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; -vec3_t skyclip[6] = { +static const vec3_t skyclip[6] = { {1, 1, 0}, {1, -1, 0}, {0, -1, 1}, @@ -105,9 +100,8 @@ vec3_t skyclip[6] = { {1, 0, 1}, {-1, 0, 1} }; -int c_sky; -int st_to_vec[6][3] = { +static const int st_to_vec[6][3] = { {3, -1, 2}, {-3, 1, 2}, @@ -118,7 +112,7 @@ int st_to_vec[6][3] = { {2, -1, -3} /* look straight down */ }; -int vec_to_st[6][3] = { +static const int vec_to_st[6][3] = { {-2, 3, 1}, {2, 3, -1}, @@ -129,6 +123,8 @@ int vec_to_st[6][3] = { {-2, 1, -3} }; +static float skymins[2][6], skymaxs[2][6]; +static float sky_min, sky_max; void GL4_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) @@ -163,16 +159,14 @@ GL4_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) } static void -DrawSkyPolygon(int nump, vec3_t vecs) +R_DrawSkyPolygon(int nump, vec3_t vecs) { - int i, j; + int i; vec3_t v, av; float s, t, dv; int axis; float *vp; - c_sky++; - /* decide which face it maps to */ VectorCopy(vec3_origin, v); @@ -222,6 +216,8 @@ DrawSkyPolygon(int nump, vec3_t vecs) /* project new texture coords */ for (i = 0; i < nump; i++, vecs += 3) { + int j; + j = vec_to_st[axis][2]; if (j > 0) @@ -283,9 +279,9 @@ DrawSkyPolygon(int nump, vec3_t vecs) } static void -ClipSkyPolygon(int nump, vec3_t vecs, int stage) +R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) { - float *norm; + const float *norm; float *v; qboolean front, back; float d, e; @@ -297,13 +293,13 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (nump > MAX_CLIP_VERTS - 2) { - Com_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS"); + Com_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__); } if (stage == 6) { /* fully clipped, so draw it */ - DrawSkyPolygon(nump, vecs); + R_DrawSkyPolygon(nump, vecs); return; } @@ -335,7 +331,7 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) if (!front || !back) { /* not clipped */ - ClipSkyPolygon(nump, vecs, stage + 1); + R_ClipSkyPolygon(nump, vecs, stage + 1); return; } @@ -386,8 +382,8 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) } /* continue */ - ClipSkyPolygon(newc[0], newv[0][0], stage + 1); - ClipSkyPolygon(newc[1], newv[1][0], stage + 1); + R_ClipSkyPolygon(newc[0], newv[0][0], stage + 1); + R_ClipSkyPolygon(newc[1], newv[1][0], stage + 1); } void @@ -405,12 +401,12 @@ GL4_AddSkySurface(msurface_t *fa) VectorSubtract(p->verts[i].pos, gl4_origin, verts[i]); } - ClipSkyPolygon(p->numverts, verts[0], 0); + R_ClipSkyPolygon(p->numverts, verts[0], 0); } } void -GL4_ClearSkyBox(void) +R_ClearSkyBox(void) { int i; @@ -425,7 +421,7 @@ static void MakeSkyVec(float s, float t, int axis, mvtx_t* vert) { vec3_t v, b; - int j, k; + int j; float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f; @@ -435,6 +431,8 @@ MakeSkyVec(float s, float t, int axis, mvtx_t* vert) for (j = 0; j < 3; j++) { + int k; + k = st_to_vec[axis][j]; if (k < 0) diff --git a/src/client/refresh/gl4/header/local.h b/src/client/refresh/gl4/header/local.h index 2f6d19fa..b942db89 100644 --- a/src/client/refresh/gl4/header/local.h +++ b/src/client/refresh/gl4/header/local.h @@ -477,7 +477,7 @@ extern void GL4_EmitWaterPolys(msurface_t *fa); extern void GL4_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis); extern void GL4_DrawSkyBox(void); -extern void GL4_ClearSkyBox(void); +extern void R_ClearSkyBox(void); extern void GL4_AddSkySurface(msurface_t *fa); diff --git a/src/client/refresh/vk/vk_warp.c b/src/client/refresh/vk/vk_warp.c index a69bda2e..c6ce151a 100644 --- a/src/client/refresh/vk/vk_warp.c +++ b/src/client/refresh/vk/vk_warp.c @@ -34,9 +34,12 @@ static float skyrotate; static int skyautorotate; static vec3_t skyaxis; static image_t *sky_images[6]; -static int skytexorder[6] = {0, 2, 1, 3, 4, 5}; +static const int skytexorder[6] = {0, 2, 1, 3, 4, 5}; -static vec3_t skyclip[6] = { +/* 3dstudio environment map names */ +static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; + +static const vec3_t skyclip[6] = { {1, 1, 0}, {1, -1, 0}, {0, -1, 1}, @@ -45,7 +48,7 @@ static vec3_t skyclip[6] = { {-1, 0, 1} }; -static int st_to_vec[6][3] = { +static const int st_to_vec[6][3] = { {3, -1, 2}, {-3, 1, 2}, @@ -56,7 +59,7 @@ static int st_to_vec[6][3] = { {2, -1, -3} /* look straight down */ }; -static int vec_to_st[6][3] = { +static const int vec_to_st[6][3] = { {-2, 3, 1}, {2, 3, -1}, @@ -179,87 +182,130 @@ EmitWaterPolys(msurface_t *fa, image_t *texture, float *modelMatrix, } } - -//=================================================================== - static void -DrawSkyPolygon(int nump, vec3_t vecs) +R_DrawSkyPolygon(int nump, vec3_t vecs) { - int i; - vec3_t v, av; - float s, t, dv; - int axis; - float *vp; + int i; + vec3_t v, av; + float s, t, dv; + int axis; + float *vp; - // decide which face it maps to + /* decide which face it maps to */ VectorCopy(vec3_origin, v); - for (i=0, vp=vecs ; i av[1] && av[0] > av[2]) + + if ((av[0] > av[1]) && (av[0] > av[2])) { if (v[0] < 0) + { axis = 1; + } else + { axis = 0; + } } - else if (av[1] > av[2] && av[1] > av[0]) + else if ((av[1] > av[2]) && (av[1] > av[0])) { if (v[1] < 0) + { axis = 3; + } else + { axis = 2; + } } else { if (v[2] < 0) + { axis = 5; + } else + { axis = 4; + } } - // project new texture coords - for (i=0 ; i 0) + { dv = vecs[j - 1]; + } else + { dv = -vecs[-j - 1]; + } + if (dv < 0.001) - continue; // don't divide by zero + { + continue; /* don't divide by zero */ + } + j = vec_to_st[axis][0]; + if (j < 0) - s = -vecs[-j -1] / dv; + { + s = -vecs[-j - 1] / dv; + } else - s = vecs[j-1] / dv; + { + s = vecs[j - 1] / dv; + } + j = vec_to_st[axis][1]; + if (j < 0) - t = -vecs[-j -1] / dv; + { + t = -vecs[-j - 1] / dv; + } else - t = vecs[j-1] / dv; + { + t = vecs[j - 1] / dv; + } if (s < skymins[0][axis]) + { skymins[0][axis] = s; + } + if (t < skymins[1][axis]) + { skymins[1][axis] = t; + } + if (s > skymaxs[0][axis]) + { skymaxs[0][axis] = s; + } + if (t > skymaxs[1][axis]) + { skymaxs[1][axis] = t; + } } } static void -ClipSkyPolygon(int nump, vec3_t vecs, int stage) +R_ClipSkyPolygon(int nump, vec3_t vecs, int stage) { - float *norm; + const float *norm; float *v; qboolean front, back; float d, e; @@ -270,17 +316,21 @@ ClipSkyPolygon(int nump, vec3_t vecs, int stage) int i, j; if (nump > MAX_CLIP_VERTS - 2) + { Com_Error(ERR_DROP, "%s: MAX_CLIP_VERTS", __func__); + } + if (stage == 6) { /* fully clipped, so draw it */ - DrawSkyPolygon(nump, vecs); + R_DrawSkyPolygon(nump, vecs); return; } front = back = false; norm = skyclip[stage]; - for (i=0, v = vecs ; ipolys ; p ; p=p->next) + /* calculate vertex values for sky box */ + for (p = fa->polys; p; p = p->next) { for (i = 0; i < p->numverts; i++) { VectorSubtract(p->verts[i].pos, r_origin, verts[i]); } - ClipSkyPolygon(p->numverts, verts[0], 0); + + R_ClipSkyPolygon(p->numverts, verts[0], 0); } } - -/* -============== -R_ClearSkyBox -============== -*/ -void R_ClearSkyBox (void) +void +R_ClearSkyBox(void) { - int i; + int i; - for (i=0 ; i<6 ; i++) + for (i = 0; i < 6; i++) { skymins[0][i] = skymins[1][i] = 9999; skymaxs[0][i] = skymaxs[1][i] = -9999; } } - -static void MakeSkyVec (float s, float t, int axis, float *vertexData) +static void +MakeSkyVec(float s, float t, int axis, float *vertexData) { - vec3_t v, b; - int j; + vec3_t v, b; + int j; float dist = (r_farsee->value == 0) ? 2300.0f : 4096.0f; @@ -404,29 +453,43 @@ static void MakeSkyVec (float s, float t, int axis, float *vertexData) b[1] = t * dist; b[2] = dist; - for (j = 0; j<3; j++) + for (j = 0; j < 3; j++) { int k; k = st_to_vec[axis][j]; + if (k < 0) + { v[j] = -b[-k - 1]; + } else + { v[j] = b[k - 1]; + } } - // avoid bilerp seam - s = (s + 1)*0.5; - t = (t + 1)*0.5; + /* avoid bilerp seam */ + s = (s + 1) * 0.5; + t = (t + 1) * 0.5; if (s < sky_min) + { s = sky_min; + } else if (s > sky_max) + { s = sky_max; + } + if (t < sky_min) + { t = sky_min; + } else if (t > sky_max) + { t = sky_max; + } t = 1.0 - t; @@ -447,7 +510,7 @@ R_DrawSkyBox(void) for (i = 0; i < 6; i++) { if ((skymins[0][i] < skymaxs[0][i]) && - (skymins[1][i] < skymaxs[1][i])) + (skymins[1][i] < skymaxs[1][i])) { break; } @@ -486,7 +549,7 @@ R_DrawSkyBox(void) } if ((skymins[0][i] >= skymaxs[0][i]) || - (skymins[1][i] >= skymaxs[1][i])) + (skymins[1][i] >= skymaxs[1][i])) { continue; } @@ -524,24 +587,18 @@ R_DrawSkyBox(void) } } -/* -============ -RE_SetSky -============ -*/ -// 3dstudio environment map names -static char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; -void RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) +void +RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis) { char skyname[MAX_QPATH]; int i; - strncpy(skyname, name, sizeof(skyname) - 1); + Q_strlcpy(skyname, name, sizeof(skyname)); skyrotate = rotate; skyautorotate = autorotate; VectorCopy(axis, skyaxis); - for (i = 0; i<6; i++) + for (i = 0; i < 6; i++) { image_t *image;