mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 16:51:08 +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;
|
break;
|
||||||
|
|
||||||
case OP_ADDRESS:
|
case OP_ADDRESS:
|
||||||
if (pr_boundscheck->int_val
|
if (pr_boundscheck->int_val) {
|
||||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
if (OPA.entity_var < 0
|
||||||
pr->pr_edictareasize)) {
|
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||||
PR_RunError (pr, "Progs attempted to address an out of "
|
PR_RunError (pr, "Progs attempted to address an out "
|
||||||
"bounds edict");
|
"of bounds edict");
|
||||||
}
|
if (OPA.entity_var == 0 && pr->null_bad)
|
||||||
if (pr_boundscheck->int_val
|
PR_RunError (pr, "assignment to world entity");
|
||||||
&& (OPA.entity_var == 0 && pr->null_bad)) {
|
if (OPB.integer_var < 0
|
||||||
PR_RunError (pr, "assignment to world entity");
|
|| OPB.integer_var >= pr->progs->entityfields)
|
||||||
}
|
PR_RunError (pr, "Progs attempted to address an "
|
||||||
if (pr_boundscheck->int_val
|
"invalid field in an edict");
|
||||||
&& (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);
|
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||||
OPC.integer_var = &ed->v[OPB.integer_var] - pr->pr_globals;
|
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_FNC:
|
||||||
case OP_LOAD_I:
|
case OP_LOAD_I:
|
||||||
case OP_LOAD_P:
|
case OP_LOAD_P:
|
||||||
if (pr_boundscheck->int_val
|
if (pr_boundscheck->int_val) {
|
||||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
if (OPA.entity_var < 0
|
||||||
pr->pr_edictareasize)) {
|
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||||
PR_RunError (pr, "Progs attempted to read an out of "
|
PR_RunError (pr, "Progs attempted to read an out of "
|
||||||
"bounds edict number");
|
"bounds edict number");
|
||||||
}
|
if (OPB.integer_var < 0
|
||||||
if (pr_boundscheck->int_val
|
|| OPB.integer_var >= pr->progs->entityfields)
|
||||||
&& (OPB.integer_var < 0 || OPB.integer_var >=
|
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||||
pr->progs->entityfields)) {
|
"field in an edict");
|
||||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
|
||||||
"field in an edict");
|
|
||||||
}
|
}
|
||||||
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
ed = PROG_TO_EDICT (pr, OPA.entity_var);
|
||||||
OPC.integer_var = ed->v[OPB.integer_var].integer_var;
|
OPC.integer_var = ed->v[OPB.integer_var].integer_var;
|
||||||
break;
|
break;
|
||||||
case OP_LOAD_V:
|
case OP_LOAD_V:
|
||||||
if (pr_boundscheck->int_val
|
if (pr_boundscheck->int_val) {
|
||||||
&& (OPA.entity_var < 0 || OPA.entity_var >=
|
if (OPA.entity_var < 0
|
||||||
pr->pr_edictareasize)) {
|
|| OPA.entity_var >= pr->pr_edictareasize)
|
||||||
PR_RunError (pr, "Progs attempted to read an out of "
|
PR_RunError (pr, "Progs attempted to read an out of "
|
||||||
"bounds edict number");
|
"bounds edict number");
|
||||||
}
|
if (OPB.integer_var < 0
|
||||||
if (pr_boundscheck->int_val
|
|| OPB.integer_var + 2 >= pr->progs->entityfields)
|
||||||
&& (OPB.integer_var < 0
|
|
||||||
|| OPB.integer_var + 2 >= pr->progs->entityfields)) {
|
|
||||||
PR_RunError (pr, "Progs attempted to read an invalid "
|
PR_RunError (pr, "Progs attempted to read an invalid "
|
||||||
"field in an edict");
|
"field in an edict");
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,23 +218,36 @@ CL_KeepaliveMessage (void)
|
||||||
SZ_Clear (&cls.message);
|
SZ_Clear (&cls.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
CL_NewMap (const char *mapname)
|
map_cfg (const char *mapname, int all)
|
||||||
{
|
{
|
||||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||||
|
QFile *f;
|
||||||
|
|
||||||
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
|
||||||
Con_NewMap ();
|
|
||||||
|
|
||||||
COM_StripExtension (mapname, name);
|
COM_StripExtension (mapname, name);
|
||||||
strcat (name, ".cfg");
|
strcat (name, ".cfg");
|
||||||
Cbuf_AddText (host_cbuf, "exec ");
|
if (COM_FOpenFile (name, &f)) {
|
||||||
Cbuf_AddText (host_cbuf, name);
|
Qclose (f);
|
||||||
Cbuf_AddText (host_cbuf, "\n");
|
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);
|
free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_NewMap (const char *mapname)
|
||||||
|
{
|
||||||
|
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
||||||
|
Con_NewMap ();
|
||||||
|
|
||||||
|
map_cfg (mapname, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_ParseServerInfo (void)
|
CL_ParseServerInfo (void)
|
||||||
{
|
{
|
||||||
|
@ -308,6 +321,8 @@ CL_ParseServerInfo (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we try to load everything else until a cache allocation fails
|
// 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++) {
|
for (i = 1; i < nummodels; i++) {
|
||||||
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
|
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
|
||||||
|
|
|
@ -253,22 +253,36 @@ CL_CheckOrDownloadFile (const char *filename)
|
||||||
return false;
|
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
|
void
|
||||||
CL_NewMap (const char *mapname)
|
CL_NewMap (const char *mapname)
|
||||||
{
|
{
|
||||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
|
||||||
|
|
||||||
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS);
|
||||||
Team_NewMap ();
|
Team_NewMap ();
|
||||||
Con_NewMap ();
|
Con_NewMap ();
|
||||||
Hunk_Check (); // make sure nothing is hurt
|
Hunk_Check (); // make sure nothing is hurt
|
||||||
|
|
||||||
COM_StripExtension (mapname, name);
|
map_cfg (mapname, 1);
|
||||||
strcat (name, ".cfg");
|
|
||||||
Cbuf_AddText (cl_cbuf, "exec ");
|
|
||||||
Cbuf_AddText (cl_cbuf, name);
|
|
||||||
Cbuf_AddText (cl_cbuf, "\n");
|
|
||||||
free (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -292,6 +306,9 @@ Model_NextDownload (void)
|
||||||
return; // started a download
|
return; // started a download
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cl.model_name[1])
|
||||||
|
map_cfg (cl.model_name[1], 0);
|
||||||
|
|
||||||
for (i = 1; i < MAX_MODELS; i++) {
|
for (i = 1; i < MAX_MODELS; i++) {
|
||||||
char *info_key = 0;
|
char *info_key = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue