Client/Server: Make the server control the sky.

This commit is contained in:
Marco Cawthorne 2021-02-22 17:27:22 +01:00
parent 3e13cb46ff
commit 20a67bf418
5 changed files with 16 additions and 14 deletions

View file

@ -5,7 +5,7 @@ PATH="$SCRPATH"/bin:"$PATH"
if [ -f "$SCRPATH"/bin/fteqcc ]; then if [ -f "$SCRPATH"/bin/fteqcc ]; then
export OLDDIR=$(pwd) export OLDDIR=$(pwd)
find -name Makefile | grep 'src\/Makefile' | grep -v engine | while read MFILE_N; do find "$SCRPATH" -name Makefile | grep 'src\/Makefile' | grep -v engine | while read MFILE_N; do
cd $(dirname $MFILE_N) cd $(dirname $MFILE_N)
make make
cd $OLDDIR cd $OLDDIR

View file

@ -126,7 +126,6 @@ CSQC_RendererRestarted(string rstr)
/* GS-Entbase */ /* GS-Entbase */
Fade_Init(); Fade_Init();
Sky_Update();
Decal_Reload(); Decal_Reload();
FX_Init(); FX_Init();
} }
@ -163,6 +162,7 @@ CSQC_UpdateView(float w, float h, float focus)
video_res[0] = w; video_res[0] = w;
video_res[1] = h; video_res[1] = h;
Sky_Update();
cvar_set("_background", serverkey("background")); cvar_set("_background", serverkey("background"));
if (serverkeyfloat("background") == 1) { if (serverkeyfloat("background") == 1) {

View file

@ -14,11 +14,13 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
var string g_strSkyName;
void void
Sky_Update(void) Sky_Update(void)
{ {
if (serverkeyfloat("*bspversion") != BSPVER_HL) { if (g_strSkyName != serverkey("skyname")) {
return; g_strSkyName = serverkey("skyname");
}
localcmd(sprintf("sky %s\n", g_strSkyName)); localcmd(sprintf("sky %s\n", g_strSkyName));
} }
}

View file

@ -22,12 +22,6 @@ var float g_flHDRIrisFadeUp = 0.1;
var float g_flHDRIrisFadeDown = 0.5; var float g_flHDRIrisFadeDown = 0.5;
var int g_iHDREnabled = 0; var int g_iHDREnabled = 0;
#ifdef VALVE
var string g_strSkyName = "desert";
#else
var string g_strSkyName = "";
#endif
class worldspawn:CBaseEntity class worldspawn:CBaseEntity
{ {
virtual void(string, string) SpawnKey; virtual void(string, string) SpawnKey;
@ -58,9 +52,6 @@ void worldspawn::SpawnKey(string strField, string strKey)
case "chaptertitle": case "chaptertitle":
GameMessage_Setup(strKey, 0); GameMessage_Setup(strKey, 0);
break; break;
case "skyname":
g_strSkyName = strKey;
break;
case "ambientsound": case "ambientsound":
if (g_ambientsound) { if (g_ambientsound) {
break; break;

View file

@ -368,6 +368,7 @@ initents
??? ???
================= =================
*/ */
.string skyname;
void void
initents(void) initents(void)
{ {
@ -459,6 +460,14 @@ initents(void)
* let's add our own that we can actually trust. */ * let's add our own that we can actually trust. */
forceinfokey(world, "sv_playerslots", cvar_string("sv_playerslots")); forceinfokey(world, "sv_playerslots", cvar_string("sv_playerslots"));
/* Set the default sky */
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
if (!self.skyname) {
self.skyname = "desert";
}
forceinfokey(world, "skyname", self.skyname);
}
Plugin_InitEnts(); Plugin_InitEnts();
Mapcycle_Init(); Mapcycle_Init();
Vote_Init(); Vote_Init();