mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 01:41:10 +00:00
Add support for map specified fog and skys to qw.
This commit is contained in:
parent
be8277c8c4
commit
a55f490b47
3 changed files with 56 additions and 3 deletions
|
@ -276,6 +276,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 playernum;
|
||||
int viewentity;
|
||||
|
|
|
@ -55,6 +55,8 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/hash.h"
|
||||
#include "QF/idparse.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/qfplist.h"
|
||||
#include "QF/quakeio.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sound.h"
|
||||
|
@ -174,6 +176,23 @@ extern cvar_t *hud_scoreboard_uid;
|
|||
entity_t *cl_static_entities;
|
||||
static entity_t **cl_static_tail;
|
||||
|
||||
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")) // Q2/DarkPlaces
|
||||
|| (item = PL_ObjectForKey (cl.worldspawn, "skyname")) // old QF
|
||||
|| (item = PL_ObjectForKey (cl.worldspawn, "qlsky"))) /* QuakeLives */ {
|
||||
name = PL_String (item);
|
||||
}
|
||||
R_LoadSkys (name);
|
||||
}
|
||||
|
||||
int
|
||||
CL_CalcNet (void)
|
||||
|
@ -258,6 +277,26 @@ CL_CheckOrDownloadFile (const char *filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
static plitem_t *
|
||||
map_ent (const char *mapname)
|
||||
{
|
||||
static progs_t edpr;
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
char *buf;
|
||||
plitem_t *edicts = 0;
|
||||
|
||||
QFS_StripExtension (mapname, name);
|
||||
strcat (name, ".ent");
|
||||
if ((buf = (char *) QFS_LoadFile (name, 0))) {
|
||||
edicts = ED_Parse (&edpr, buf);
|
||||
free (buf);
|
||||
} else {
|
||||
edicts = ED_Parse (&edpr, cl.model_precache[1]->entities);
|
||||
}
|
||||
free (name);
|
||||
return edicts;
|
||||
}
|
||||
|
||||
static void
|
||||
CL_NewMap (const char *mapname)
|
||||
{
|
||||
|
@ -269,6 +308,15 @@ CL_NewMap (const char *mapname)
|
|||
Hunk_Check (); // make sure nothing is hurt
|
||||
Sbar_CenterPrint (0);
|
||||
|
||||
if (cl.model_precache[1] && cl.model_precache[1]->entities) {
|
||||
cl.edicts = map_ent (mapname);
|
||||
if (cl.edicts) {
|
||||
cl.worldspawn = PL_ObjectAtIndex (cl.edicts, 0);
|
||||
CL_LoadSky ();
|
||||
Fog_ParseWorldspawn (cl.worldspawn);
|
||||
}
|
||||
}
|
||||
|
||||
map_cfg (mapname, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,12 +186,14 @@ parse_field (progs_t *pr, const char *key, const char *value)
|
|||
If skyname is set, set what the map thinks the skybox name should
|
||||
be. "qlsky" is supported since at least one other map uses it.
|
||||
*/
|
||||
if (strcaseequal (key, "skyname") // QuakeForge
|
||||
|| strcaseequal (key, "sky") // Q2/DarkPlaces
|
||||
|| strcaseequal (key, "qlsky")) { // QuakeLives
|
||||
if (strequal (key, "skyname") // QuakeForge
|
||||
|| strequal (key, "sky") // Q2/DarkPlaces
|
||||
|| strequal (key, "qlsky")) { // QuakeLives
|
||||
Info_SetValueForKey (svs.info, "sky", value, 0);
|
||||
return 1;
|
||||
}
|
||||
if (strequal (key, "fog"))
|
||||
return 1;
|
||||
if (*key == '_') // ignore _fields
|
||||
return 1;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue