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 qboolean nomaster;
extern char *server_version; // version of server we connected to 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 */ CVAR_FIXME */
extern cvar_t *gl_playermip; extern cvar_t *gl_playermip;
extern cvar_t *r_skyname;
extern int mirrortexturenum; // quake texturenum, not gltexturenum extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern qboolean mirror; extern qboolean mirror;
extern mplane_t *mirror_plane; extern mplane_t *mirror_plane;

View file

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

View file

@ -32,8 +32,6 @@
#endif #endif
#include <ctype.h> #include <ctype.h>
#include "sys.h"
#include "quakedef.h"
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"
#include "winsock.h" #include "winsock.h"
@ -42,6 +40,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "sys.h"
#include "quakedef.h"
// we need to declare some mouse variables here, because the menu system // we need to declare some mouse variables here, because the menu system
// references them even when on a unix system. // references them even when on a unix system.
@ -673,6 +673,19 @@ void CL_FullServerinfo_f (void)
else else
Con_Printf("Invalid standards version: %s", p); 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_FIXME */
cvar_t *gl_finish; cvar_t *gl_finish;
cvar_t *r_skyname;
/* extern cvar_t gl_ztrick; /* extern cvar_t gl_ztrick;
CVAR_FIXME */ CVAR_FIXME */
extern cvar_t *gl_ztrick; extern cvar_t *gl_ztrick;

View file

@ -56,6 +56,8 @@
qboolean VID_Is8bit(void); qboolean VID_Is8bit(void);
extern void R_InitBubble(); extern void R_InitBubble();
qboolean allowskybox; // allow skyboxes? --KB
/* /*
================== ==================
R_InitTextures R_InitTextures
@ -218,6 +220,8 @@ R_Init
*/ */
void R_Init (void) void R_Init (void)
{ {
allowskybox = false; // server will decide if this is allowed --KB
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
Cmd_AddCommand ("envmap", R_Envmap_f); Cmd_AddCommand ("envmap", R_Envmap_f);
Cmd_AddCommand ("pointfile", R_ReadPointFile_f); Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
@ -302,6 +306,9 @@ void R_Init (void)
CVAR_FIXME */ CVAR_FIXME */
gl_reporttjunctions = Cvar_Get("gl_reporttjunctions", "0", CVAR_NONE, "None"); 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(); R_InitBubble();
R_InitParticles (); R_InitParticles ();
@ -505,6 +512,7 @@ R_NewMap
void R_NewMap (void) void R_NewMap (void)
{ {
int i; int i;
cvar_t *r_skyname;
for (i=0 ; i<256 ; i++) for (i=0 ; i<256 ; i++)
d_lightstylevalue[i] = 264; // normal light value d_lightstylevalue[i] = 264; // normal light value
@ -535,6 +543,10 @@ void R_NewMap (void)
mirrortexturenum = i; mirrortexturenum = i;
cl.worldmodel->textures[i]->texturechain = NULL; cl.worldmodel->textures[i]->texturechain = NULL;
} }
r_skyname = Cvar_FindVar ("r_skyname");
if (r_skyname != NULL)
R_LoadSkys (r_skyname->string);
else
R_LoadSkys ("none"); R_LoadSkys ("none");
} }

View file

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

View file

@ -808,6 +808,7 @@ char *ED_ParseEdict (char *data, edict_t *ent)
qboolean anglehack; qboolean anglehack;
qboolean init; qboolean init;
char keyname[256]; char keyname[256];
cvar_t *r_skyname;
init = false; init = false;
@ -825,18 +826,17 @@ char *ED_ParseEdict (char *data, edict_t *ent)
if (!data) if (!data)
SV_Error ("ED_ParseEntity: EOF without closing brace"); SV_Error ("ED_ParseEntity: EOF without closing brace");
// anglehack is to allow QuakeEd to write single scalar angles // anglehack is to allow QuakeEd to write single scalar angles
// and allow them to be turned into vectors. (FIXME...) // and allow them to be turned into vectors. (FIXME...)
if (!strcmp(com_token, "angle")) if (!strcmp(com_token, "angle"))
{ {
strcpy (com_token, "angles"); strcpy (com_token, "angles");
anglehack = true; anglehack = true;
} } else
else
anglehack = false; anglehack = false;
// FIXME: change light to _light to get rid of this hack // FIXME: change light to _light to get rid of this hack
if (!strcmp(com_token, "light")) if (!strcmp(com_token, "light"))
strcpy (com_token, "light_lev"); // hack for single light def strcpy (com_token, "light_lev"); // hack for single light def
strcpy (keyname, com_token); strcpy (keyname, com_token);
@ -856,6 +856,16 @@ if (!strcmp(com_token, "light"))
if (keyname[0] == '_') if (keyname[0] == '_')
continue; 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); key = ED_FindField (keyname);
if (!key) if (!key)
{ {

View file

@ -250,7 +250,9 @@ void R_Init (void)
{ {
int dummy; 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_stack_start = (byte *)&dummy;
R_InitTurb (); R_InitTurb ();

View file

@ -33,6 +33,7 @@
#include "quakedef.h" #include "quakedef.h"
#include "r_local.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; char *gamedir;
int playernum; int playernum;
cvar_t *r_skyname;
if (host_client->state == cs_spawned) if (host_client->state == cs_spawned)
return; return;
@ -147,6 +148,15 @@ void SV_New_f (void)
// send server info string // send server info string
MSG_WriteByte (&host_client->netchan.message, svc_stufftext); MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
MSG_WriteString (&host_client->netchan.message, va("fullserverinfo \"%s\"\n", svs.info) ); 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));
}
} }
/* /*