mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Set the skybox from the map's worldspawn sky field.
This commit is contained in:
parent
4af6c8c108
commit
aad204e80c
3 changed files with 36 additions and 0 deletions
|
@ -200,6 +200,9 @@ typedef struct
|
|||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
|
||||
struct plitem_s *edicts;
|
||||
struct plitem_s *worldspawn;
|
||||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int viewentity; // cl_entitites[cl.viewentity] = player
|
||||
int maxclients;
|
||||
|
|
|
@ -39,6 +39,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/plugin.h"
|
||||
#include "QF/qfplist.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/skin.h"
|
||||
|
@ -149,6 +150,9 @@ CL_ClearState (void)
|
|||
if (!sv.active)
|
||||
Host_ClearMemory ();
|
||||
|
||||
if (cl.edicts)
|
||||
PL_Free (cl.edicts);
|
||||
|
||||
// wipe the entire cl structure
|
||||
memset (&cl, 0, sizeof (cl));
|
||||
r_force_fullscreen = 0;
|
||||
|
|
|
@ -47,6 +47,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/idparse.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/qfplist.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/skin.h"
|
||||
|
@ -122,6 +123,24 @@ const char *svc_strings[] = {
|
|||
float r_gravity;
|
||||
dstring_t *centerprint;
|
||||
|
||||
static void
|
||||
CL_LoadSky (void)
|
||||
{
|
||||
plitem_t *item;
|
||||
const char *name = 0;
|
||||
|
||||
if (!cl.worldspawn) {
|
||||
R_LoadSkys (0);
|
||||
return;
|
||||
}
|
||||
if ((item = PL_ObjectForKey (cl.worldspawn, "sky"))
|
||||
|| (item = PL_ObjectForKey (cl.worldspawn, "skyname"))
|
||||
|| (item = PL_ObjectForKey (cl.worldspawn, "skyname"))) {
|
||||
name = PL_String (item);
|
||||
}
|
||||
R_LoadSkys (name);
|
||||
}
|
||||
|
||||
/*
|
||||
CL_EntityNum
|
||||
|
||||
|
@ -282,6 +301,16 @@ CL_NewMap (const char *mapname)
|
|||
Con_NewMap ();
|
||||
Sbar_CenterPrint (0);
|
||||
|
||||
if (cl.model_precache[1] && cl.model_precache[1]->entities) {
|
||||
static progs_t edpr;
|
||||
|
||||
cl.edicts = ED_Parse (&edpr, cl.model_precache[1]->entities);
|
||||
if (cl.edicts) {
|
||||
cl.worldspawn = PL_ObjectAtIndex (cl.edicts, 0);
|
||||
CL_LoadSky ();
|
||||
}
|
||||
}
|
||||
|
||||
map_cfg (mapname, 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue