mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
do a pre and post pass for maps/mapname.cfg and use maps_default.cfg if
maps/mapname.cfg doesn't exist.
This commit is contained in:
parent
8d736d7424
commit
ec0273e3dc
3 changed files with 74 additions and 50 deletions
|
@ -417,21 +417,17 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
break;
|
||||
|
||||
case OP_ADDRESS:
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
||||
pr->pr_edictareasize)) {
|
||||
PR_RunError (pr, "Progs attempted to address an out of "
|
||||
"bounds edict");
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPA.entity_var == 0 && pr->null_bad)) {
|
||||
PR_RunError (pr, "assignment to world entity");
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPB.integer_var < 0 || OPB.integer_var >=
|
||||
pr->progs->entityfields)) {
|
||||
PR_RunError (pr, "Progs attempted to address an invalid "
|
||||
"field in an edict");
|
||||
if (pr_boundscheck->int_val) {
|
||||
if (OPA.entity_var < 0
|
||||
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||
PR_RunError (pr, "Progs attempted to address an out "
|
||||
"of bounds edict");
|
||||
if (OPA.entity_var == 0 && pr->null_bad)
|
||||
PR_RunError (pr, "assignment to world entity");
|
||||
if (OPB.integer_var < 0
|
||||
|| OPB.integer_var >= pr->progs->entityfields)
|
||||
PR_RunError (pr, "Progs attempted to address an "
|
||||
"invalid field in an edict");
|
||||
}
|
||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||
OPC.integer_var = &ed->v[OPB.integer_var] - pr->pr_globals;
|
||||
|
@ -454,31 +450,27 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
case OP_LOAD_FNC:
|
||||
case OP_LOAD_I:
|
||||
case OP_LOAD_P:
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
||||
pr->pr_edictareasize)) {
|
||||
PR_RunError (pr, "Progs attempted to read an out of "
|
||||
"bounds edict number");
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPB.integer_var < 0 || OPB.integer_var >=
|
||||
pr->progs->entityfields)) {
|
||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||
"field in an edict");
|
||||
if (pr_boundscheck->int_val) {
|
||||
if (OPA.entity_var < 0
|
||||
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||
PR_RunError (pr, "Progs attempted to read an out of "
|
||||
"bounds edict number");
|
||||
if (OPB.integer_var < 0
|
||||
|| OPB.integer_var >= pr->progs->entityfields)
|
||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||
"field in an edict");
|
||||
}
|
||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||
OPC.integer_var = ed->v[OPB.integer_var].integer_var;
|
||||
break;
|
||||
case OP_LOAD_V:
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
||||
pr->pr_edictareasize)) {
|
||||
if (pr_boundscheck->int_val) {
|
||||
if (OPA.entity_var < 0
|
||||
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||
PR_RunError (pr, "Progs attempted to read an out of "
|
||||
"bounds edict number");
|
||||
}
|
||||
if (pr_boundscheck->int_val
|
||||
&& (OPB.integer_var < 0
|
||||
|| OPB.integer_var + 2 >= pr->progs->entityfields)) {
|
||||
if (OPB.integer_var < 0
|
||||
|| OPB.integer_var + 2 >= pr->progs->entityfields)
|
||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||
"field in an edict");
|
||||
}
|
||||
|
|
|
@ -218,23 +218,36 @@ CL_KeepaliveMessage (void)
|
|||
SZ_Clear (&cls.message);
|
||||
}
|
||||
|
||||
void
|
||||
CL_NewMap (const char *mapname)
|
||||
static void
|
||||
map_cfg (const char *mapname, int all)
|
||||
{
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
|
||||
|
||||
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
||||
Con_NewMap ();
|
||||
QFile *f;
|
||||
|
||||
COM_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
Cbuf_AddText (host_cbuf, "exec ");
|
||||
Cbuf_AddText (host_cbuf, name);
|
||||
Cbuf_AddText (host_cbuf, "\n");
|
||||
if (COM_FOpenFile (name, &f)) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (host_cbuf, name);
|
||||
} else {
|
||||
Cmd_Exec_File (host_cbuf, "maps_default.cfg");
|
||||
}
|
||||
if (all)
|
||||
Cbuf_Execute_Stack (host_cbuf);
|
||||
else
|
||||
Cbuf_Execute_Sets (host_cbuf);
|
||||
free (name);
|
||||
}
|
||||
|
||||
void
|
||||
CL_NewMap (const char *mapname)
|
||||
{
|
||||
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
||||
Con_NewMap ();
|
||||
|
||||
map_cfg (mapname, 1);
|
||||
}
|
||||
|
||||
void
|
||||
CL_ParseServerInfo (void)
|
||||
{
|
||||
|
@ -308,6 +321,8 @@ CL_ParseServerInfo (void)
|
|||
}
|
||||
|
||||
// now we try to load everything else until a cache allocation fails
|
||||
if (model_precache[1])
|
||||
map_cfg (model_precache[1], 0);
|
||||
|
||||
for (i = 1; i < nummodels; i++) {
|
||||
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
|
||||
|
|
|
@ -253,22 +253,36 @@ CL_CheckOrDownloadFile (const char *filename)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
map_cfg (const char *mapname, int all)
|
||||
{
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
QFile *f;
|
||||
|
||||
COM_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
if (COM_FOpenFile (name, &f)) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (cl_cbuf, name);
|
||||
} else {
|
||||
Cmd_Exec_File (cl_cbuf, "maps_default.cfg");
|
||||
}
|
||||
if (all)
|
||||
Cbuf_Execute_Stack (cl_cbuf);
|
||||
else
|
||||
Cbuf_Execute_Sets (cl_cbuf);
|
||||
free (name);
|
||||
}
|
||||
|
||||
void
|
||||
CL_NewMap (const char *mapname)
|
||||
{
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
|
||||
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
||||
Team_NewMap ();
|
||||
Con_NewMap ();
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
COM_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
Cbuf_AddText (cl_cbuf, "exec ");
|
||||
Cbuf_AddText (cl_cbuf, name);
|
||||
Cbuf_AddText (cl_cbuf, "\n");
|
||||
free (name);
|
||||
map_cfg (mapname, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -292,6 +306,9 @@ Model_NextDownload (void)
|
|||
return; // started a download
|
||||
}
|
||||
|
||||
if (cl.model_name[1])
|
||||
map_cfg (cl.model_name[1], 0);
|
||||
|
||||
for (i = 1; i < MAX_MODELS; i++) {
|
||||
char *info_key = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue