mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-20 08:21:08 +00:00
Add 'skyautorotate' worldspawn property as found in rerelease game.
This is necessary to stop the sky in some rerelease maps, eg base1, from spinning: these maps set a 'skyrotate' value, but explicitly disable it with the new 'skyautorotate'.
This commit is contained in:
parent
9cb349e6e9
commit
10e791471e
13 changed files with 43 additions and 32 deletions
|
@ -381,12 +381,13 @@ SCR_SizeDown_f(void)
|
|||
void
|
||||
SCR_Sky_f(void)
|
||||
{
|
||||
float rotate;
|
||||
int autorotate = 1;
|
||||
float rotate = 0;
|
||||
vec3_t axis;
|
||||
|
||||
if (Cmd_Argc() < 2)
|
||||
{
|
||||
Com_Printf("Usage: sky <basename> <rotate> <axis x y z>\n");
|
||||
Com_Printf("Usage: sky <basename> <rotate> <axis x y z> <autorotate>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -395,12 +396,7 @@ SCR_Sky_f(void)
|
|||
rotate = (float)strtod(Cmd_Argv(2), (char **)NULL);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
rotate = 0;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() == 6)
|
||||
if (Cmd_Argc() > 5)
|
||||
{
|
||||
axis[0] = (float)strtod(Cmd_Argv(3), (char **)NULL);
|
||||
axis[1] = (float)strtod(Cmd_Argv(4), (char **)NULL);
|
||||
|
@ -413,7 +409,12 @@ SCR_Sky_f(void)
|
|||
axis[2] = 1;
|
||||
}
|
||||
|
||||
R_SetSky(Cmd_Argv(1), rotate, axis);
|
||||
if (Cmd_Argc() == 7)
|
||||
{
|
||||
autorotate = (float)strtod(Cmd_Argv(6), (char **)NULL);
|
||||
}
|
||||
|
||||
R_SetSky(Cmd_Argv(1), rotate, autorotate, axis);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -239,7 +239,8 @@ CL_PrepRefresh(void)
|
|||
char mapname[MAX_QPATH];
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
float rotate;
|
||||
float rotate = 0;
|
||||
int autorotate = 1;
|
||||
vec3_t axis;
|
||||
|
||||
if (!cl.configstrings[CS_MODELS + 1][0])
|
||||
|
@ -346,9 +347,9 @@ CL_PrepRefresh(void)
|
|||
/* set sky textures and speed */
|
||||
Com_Printf("sky\r");
|
||||
SCR_UpdateScreen();
|
||||
rotate = (float)strtod(cl.configstrings[CS_SKYROTATE], (char **)NULL);
|
||||
sscanf(cl.configstrings[CS_SKYROTATE], "%f %d", &rotate, &autorotate);
|
||||
sscanf(cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]);
|
||||
R_SetSky(cl.configstrings[CS_SKY], rotate, axis);
|
||||
R_SetSky(cl.configstrings[CS_SKY], rotate, autorotate, axis);
|
||||
Com_Printf(" \r");
|
||||
|
||||
/* the renderer can now free unneeded stuff */
|
||||
|
|
|
@ -1878,7 +1878,7 @@ extern void RI_BeginRegistration(char *model);
|
|||
extern struct model_s * RI_RegisterModel(char *name);
|
||||
extern struct image_s * RI_RegisterSkin(char *name);
|
||||
|
||||
extern void RI_SetSky(char *name, float rotate, vec3_t axis);
|
||||
extern void RI_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis);
|
||||
extern void RI_EndRegistration(void);
|
||||
|
||||
extern void RI_RenderFrame(refdef_t *fd);
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
#define ON_EPSILON 0.1 /* point on plane side epsilon */
|
||||
#define MAX_CLIP_VERTS 64
|
||||
|
||||
float skyrotate;
|
||||
vec3_t skyaxis;
|
||||
static float skyrotate;
|
||||
static int skyautorotate;
|
||||
static vec3_t skyaxis;
|
||||
image_t *sky_images[6];
|
||||
msurface_t *warpface;
|
||||
int skytexorder[6] = {0, 2, 1, 3, 4, 5};
|
||||
|
@ -693,7 +694,8 @@ R_DrawSkyBox(void)
|
|||
|
||||
glPushMatrix();
|
||||
glTranslatef(r_origin[0], r_origin[1], r_origin[2]);
|
||||
glRotatef(r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
|
||||
glRotatef((skyautorotate ? r_newrefdef.time : 1.f) * skyrotate,
|
||||
skyaxis[0], skyaxis[1], skyaxis[2]);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
|
@ -713,12 +715,11 @@ R_DrawSkyBox(void)
|
|||
|
||||
R_Bind(sky_images[skytexorder[i]]->texnum);
|
||||
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
|
||||
index_vtx = 0;
|
||||
index_tex = 0;
|
||||
index_vtx = 0;
|
||||
index_tex = 0;
|
||||
|
||||
R_MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
||||
R_MakeSkyVec( skymins [ 0 ] [ i ], skymaxs [ 1 ] [ i ], i );
|
||||
|
@ -737,13 +738,14 @@ R_DrawSkyBox(void)
|
|||
}
|
||||
|
||||
void
|
||||
RI_SetSky(char *name, float rotate, vec3_t axis)
|
||||
RI_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis)
|
||||
{
|
||||
char skyname[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
Q_strlcpy(skyname, name, sizeof(skyname));
|
||||
skyrotate = rotate;
|
||||
skyautorotate = autorotate;
|
||||
VectorCopy(axis, skyaxis);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
|
|
|
@ -287,6 +287,7 @@ 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];
|
||||
|
||||
|
@ -327,13 +328,14 @@ int vec_to_st[6][3] = {
|
|||
|
||||
|
||||
void
|
||||
GL3_SetSky(char *name, float rotate, vec3_t axis)
|
||||
GL3_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis)
|
||||
{
|
||||
char skyname[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
Q_strlcpy(skyname, name, sizeof(skyname));
|
||||
skyrotate = rotate;
|
||||
skyautorotate = autorotate;
|
||||
VectorCopy(axis, skyaxis);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
|
@ -706,7 +708,8 @@ GL3_DrawSkyBox(void)
|
|||
{
|
||||
// glRotatef(gl3_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
|
||||
hmm_vec3 rotAxis = HMM_Vec3(skyaxis[0], skyaxis[1], skyaxis[2]);
|
||||
modMVmat = HMM_MultiplyMat4(modMVmat, HMM_Rotate(gl3_newrefdef.time * skyrotate, rotAxis));
|
||||
modMVmat = HMM_MultiplyMat4(modMVmat, HMM_Rotate(
|
||||
(skyautorotate ? gl3_newrefdef.time : 1.f) * skyrotate, rotAxis));
|
||||
}
|
||||
gl3state.uni3DData.transModelMat4 = modMVmat;
|
||||
GL3_UpdateUBO3D();
|
||||
|
|
|
@ -475,7 +475,7 @@ extern void GL3_LM_EndBuildingLightmaps(void);
|
|||
extern void GL3_EmitWaterPolys(msurface_t *fa);
|
||||
extern void GL3_SubdivideSurface(msurface_t *fa, gl3model_t* loadmodel);
|
||||
|
||||
extern void GL3_SetSky(char *name, float rotate, vec3_t axis);
|
||||
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);
|
||||
|
|
|
@ -1725,7 +1725,7 @@ static const int r_skysideimage[6] = {5, 2, 4, 1, 0, 3};
|
|||
extern mtexinfo_t r_skytexinfo[6];
|
||||
|
||||
static void
|
||||
RE_SetSky (char *name, float rotate, vec3_t axis)
|
||||
RE_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis)
|
||||
{
|
||||
char skyname[MAX_QPATH];
|
||||
int i;
|
||||
|
|
|
@ -182,7 +182,7 @@ typedef struct
|
|||
struct model_s * (EXPORT *RegisterModel) (char *name);
|
||||
struct image_s * (EXPORT *RegisterSkin) (char *name);
|
||||
|
||||
void (EXPORT *SetSky) (char *name, float rotate, vec3_t axis);
|
||||
void (EXPORT *SetSky) (const char *name, float rotate, int autorotate, const vec3_t axis);
|
||||
void (EXPORT *EndRegistration) (void);
|
||||
|
||||
void (EXPORT *RenderFrame) (refdef_t *fd);
|
||||
|
@ -268,7 +268,7 @@ void R_BeginRegistration(char *map);
|
|||
void R_Clear(void);
|
||||
struct model_s *R_RegisterModel(char *name);
|
||||
struct image_s *R_RegisterSkin(char *name);
|
||||
void R_SetSky(char *name, float rotate, vec3_t axis);
|
||||
void R_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis);
|
||||
void R_EndRegistration(void);
|
||||
struct image_s *Draw_FindPic(char *name);
|
||||
void R_RenderFrame(refdef_t *fd);
|
||||
|
|
|
@ -633,11 +633,11 @@ R_RegisterSkin(char *name)
|
|||
}
|
||||
|
||||
void
|
||||
R_SetSky(char *name, float rotate, vec3_t axis)
|
||||
R_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis)
|
||||
{
|
||||
if (ref_active)
|
||||
{
|
||||
re.SetSky(name, rotate, axis);
|
||||
re.SetSky(name, rotate, autorotate, axis);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -450,6 +450,7 @@ ED_ParseEdict(char *data, edict_t *ent)
|
|||
|
||||
init = false;
|
||||
memset(&st, 0, sizeof(st));
|
||||
st.skyautorotate = 1;
|
||||
|
||||
/* go through all the dictionary pairs */
|
||||
while (1)
|
||||
|
@ -903,7 +904,7 @@ SP_worldspawn(edict_t *ent)
|
|||
gi.configstring(CS_SKY, "unit1_");
|
||||
}
|
||||
|
||||
gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate));
|
||||
gi.configstring(CS_SKYROTATE, va("%f %d", st.skyrotate, st.skyautorotate));
|
||||
|
||||
gi.configstring(CS_SKYAXIS, va("%f %f %f",
|
||||
st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]));
|
||||
|
|
|
@ -342,6 +342,7 @@ typedef struct
|
|||
/* world vars */
|
||||
char *sky;
|
||||
float skyrotate;
|
||||
int skyautorotate;
|
||||
vec3_t skyaxis;
|
||||
char *nextmap;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
* load older savegames. This should be bumped if the files
|
||||
* in tables/ are changed, otherwise strange things may happen.
|
||||
*/
|
||||
#define SAVEGAMEVER "YQ2-5"
|
||||
#define SAVEGAMEVER "YQ2-6"
|
||||
|
||||
#ifndef BUILD_DATE
|
||||
#define BUILD_DATE __DATE__
|
||||
|
@ -830,6 +830,7 @@ ReadGame(const char *filename)
|
|||
{"YQ2-3", 3},
|
||||
{"YQ2-4", 4},
|
||||
{"YQ2-5", 5},
|
||||
{"YQ2-6", 6},
|
||||
};
|
||||
|
||||
for (i=0; i < sizeof(version_mappings)/sizeof(version_mappings[0]); ++i)
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
{"gravity", STOFS(gravity), F_LSTRING, FFL_SPAWNTEMP},
|
||||
{"sky", STOFS(sky), F_LSTRING, FFL_SPAWNTEMP},
|
||||
{"skyrotate", STOFS(skyrotate), F_FLOAT, FFL_SPAWNTEMP},
|
||||
{"skyautorotate", STOFS(skyautorotate), F_INT, FFL_SPAWNTEMP},
|
||||
{"skyaxis", STOFS(skyaxis), F_VECTOR, FFL_SPAWNTEMP},
|
||||
{"minyaw", STOFS(minyaw), F_FLOAT, FFL_SPAWNTEMP},
|
||||
{"maxyaw", STOFS(maxyaw), F_FLOAT, FFL_SPAWNTEMP},
|
||||
|
|
Loading…
Reference in a new issue