diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index 81cc9efe..8ebac94f 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -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 \n"); + Com_Printf("Usage: sky \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 diff --git a/src/client/cl_view.c b/src/client/cl_view.c index 559c1292..2cb2f0e3 100644 --- a/src/client/cl_view.c +++ b/src/client/cl_view.c @@ -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 */ diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index c5172a66..6fa00c7f 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -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); diff --git a/src/client/refresh/gl1/gl1_warp.c b/src/client/refresh/gl1/gl1_warp.c index ba96a4a3..50083db9 100644 --- a/src/client/refresh/gl1/gl1_warp.c +++ b/src/client/refresh/gl1/gl1_warp.c @@ -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++) diff --git a/src/client/refresh/gl3/gl3_warp.c b/src/client/refresh/gl3/gl3_warp.c index d0eaf281..e8db6b78 100644 --- a/src/client/refresh/gl3/gl3_warp.c +++ b/src/client/refresh/gl3/gl3_warp.c @@ -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(); diff --git a/src/client/refresh/gl3/header/local.h b/src/client/refresh/gl3/header/local.h index 15f8e0bd..68413057 100644 --- a/src/client/refresh/gl3/header/local.h +++ b/src/client/refresh/gl3/header/local.h @@ -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); diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 01313774..502660d6 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -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; diff --git a/src/client/vid/header/ref.h b/src/client/vid/header/ref.h index 0978f9a8..5c6725b3 100644 --- a/src/client/vid/header/ref.h +++ b/src/client/vid/header/ref.h @@ -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); diff --git a/src/client/vid/vid.c b/src/client/vid/vid.c index 12cc6e86..c8524751 100644 --- a/src/client/vid/vid.c +++ b/src/client/vid/vid.c @@ -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); } } diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 0e787e7a..405b870c 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -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])); diff --git a/src/game/header/local.h b/src/game/header/local.h index d52ddc6a..83b14d75 100644 --- a/src/game/header/local.h +++ b/src/game/header/local.h @@ -342,6 +342,7 @@ typedef struct /* world vars */ char *sky; float skyrotate; + int skyautorotate; vec3_t skyaxis; char *nextmap; diff --git a/src/game/savegame/savegame.c b/src/game/savegame/savegame.c index 0f929fff..1de19838 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -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) diff --git a/src/game/savegame/tables/fields.h b/src/game/savegame/tables/fields.h index e4de6885..9b7b311e 100644 --- a/src/game/savegame/tables/fields.h +++ b/src/game/savegame/tables/fields.h @@ -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},