Not as clean as it could be, but for now it will work.

This commit is contained in:
Joseph Carter 2000-05-19 03:06:05 +00:00
parent f6887de132
commit 466344b359
11 changed files with 77 additions and 21 deletions

View file

@ -387,6 +387,8 @@ extern dlight_t cl_dlights[MAX_DLIGHTS];
extern qboolean nomaster;
extern char *server_version; // version of server we connected to
extern qboolean allowskybox;
//=============================================================================

View file

@ -254,6 +254,8 @@ extern cvar_t *gl_max_size;
CVAR_FIXME */
extern cvar_t *gl_playermip;
extern cvar_t *r_skyname;
extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern qboolean mirror;
extern mplane_t *mirror_plane;

View file

@ -153,4 +153,6 @@ void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
void R_LoadSkys (char *);
#endif // _RENDER_H

View file

@ -32,8 +32,6 @@
#endif
#include <ctype.h>
#include "sys.h"
#include "quakedef.h"
#ifdef _WIN32
#include "winquake.h"
#include "winsock.h"
@ -42,6 +40,8 @@
#include <netinet/in.h>
#endif
#include "sys.h"
#include "quakedef.h"
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
@ -673,6 +673,19 @@ void CL_FullServerinfo_f (void)
else
Con_Printf("Invalid standards version: %s", p);
}
if ((p = Info_ValueForKey(cl.serverinfo, "skybox")) && *p)
{
if (stricmp (p, "none") == 0)
{
allowskybox = false;
} else {
allowskybox = true;
Cmd_ExecuteString (va("loadsky %s\n", p));
// R_LoadSkys (p);
}
} else {
allowskybox = false;
}
}
/*

View file

@ -181,6 +181,8 @@ cvar_t *gl_reporttjunctions;
CVAR_FIXME */
cvar_t *gl_finish;
cvar_t *r_skyname;
/* extern cvar_t gl_ztrick;
CVAR_FIXME */
extern cvar_t *gl_ztrick;

View file

@ -56,6 +56,8 @@
qboolean VID_Is8bit(void);
extern void R_InitBubble();
qboolean allowskybox; // allow skyboxes? --KB
/*
==================
R_InitTextures
@ -217,7 +219,9 @@ R_Init
===============
*/
void R_Init (void)
{
{
allowskybox = false; // server will decide if this is allowed --KB
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
Cmd_AddCommand ("envmap", R_Envmap_f);
Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
@ -301,6 +305,9 @@ void R_Init (void)
/* Cvar_RegisterVariable (&gl_reporttjunctions);
CVAR_FIXME */
gl_reporttjunctions = Cvar_Get("gl_reporttjunctions", "0", CVAR_NONE, "None");
r_skyname = Cvar_Get("r_skyname", "none", CVAR_NONE,
"name of the current skybox");
R_InitBubble();
@ -505,6 +512,7 @@ R_NewMap
void R_NewMap (void)
{
int i;
cvar_t *r_skyname;
for (i=0 ; i<256 ; i++)
d_lightstylevalue[i] = 264; // normal light value
@ -535,7 +543,11 @@ void R_NewMap (void)
mirrortexturenum = i;
cl.worldmodel->textures[i]->texturechain = NULL;
}
R_LoadSkys ("none");
r_skyname = Cvar_FindVar ("r_skyname");
if (r_skyname != NULL)
R_LoadSkys (r_skyname->string);
else
R_LoadSkys ("none");
}

View file

@ -896,7 +896,7 @@ void R_DrawSkyChain (msurface_t *s)
vec3_t verts[MAX_CLIP_VERTS];
glpoly_t *p;
if (skyloaded)
if (allowskybox && skyloaded)
{
c_sky = 0;
GL_Bind(solidskytexture);

View file

@ -808,6 +808,7 @@ char *ED_ParseEdict (char *data, edict_t *ent)
qboolean anglehack;
qboolean init;
char keyname[256];
cvar_t *r_skyname;
init = false;
@ -825,23 +826,22 @@ char *ED_ParseEdict (char *data, edict_t *ent)
if (!data)
SV_Error ("ED_ParseEntity: EOF without closing brace");
// anglehack is to allow QuakeEd to write single scalar angles
// and allow them to be turned into vectors. (FIXME...)
if (!strcmp(com_token, "angle"))
{
strcpy (com_token, "angles");
anglehack = true;
}
else
anglehack = false;
// anglehack is to allow QuakeEd to write single scalar angles
// and allow them to be turned into vectors. (FIXME...)
if (!strcmp(com_token, "angle"))
{
strcpy (com_token, "angles");
anglehack = true;
} else
anglehack = false;
// FIXME: change light to _light to get rid of this hack
if (!strcmp(com_token, "light"))
strcpy (com_token, "light_lev"); // hack for single light def
// FIXME: change light to _light to get rid of this hack
if (!strcmp(com_token, "light"))
strcpy (com_token, "light_lev"); // hack for single light def
strcpy (keyname, com_token);
// parse value
// parse value
data = COM_Parse (data);
if (!data)
SV_Error ("ED_ParseEntity: EOF without closing brace");
@ -855,7 +855,17 @@ if (!strcmp(com_token, "light"))
// and are immediately discarded by quake
if (keyname[0] == '_')
continue;
if (stricmp (keyname, "skyname") == 0 ||
stricmp (keyname, "qlsky") == 0)
{
Info_SetValueForKey (svs.info, "skybox",
"1", MAX_SERVERINFO_STRING);
r_skyname = Cvar_Get ("r_skyname", com_token,
CVAR_NONE, "name of skybox");
continue;
}
key = ED_FindField (keyname);
if (!key)
{

View file

@ -249,8 +249,10 @@ R_Init
void R_Init (void)
{
int dummy;
// get stack position so we can guess if we are going to overflow
allowskybox = false; // server decides this --KB
// get stack position so we can guess if we are going to overflow
r_stack_start = (byte *)&dummy;
R_InitTurb ();

View file

@ -33,6 +33,7 @@
#include "quakedef.h"
#include "r_local.h"
qboolean allowskybox; // whether or not to allow skyboxes --KB
/*
===============

View file

@ -91,6 +91,7 @@ void SV_New_f (void)
{
char *gamedir;
int playernum;
cvar_t *r_skyname;
if (host_client->state == cs_spawned)
return;
@ -147,6 +148,15 @@ void SV_New_f (void)
// send server info string
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) );
// Send our current skybox
r_skyname = Cvar_FindVar ("r_skyname");
if (r_skyname != NULL)
{
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("r_skyname %s",
r_skyname->string));
}
}
/*