mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
Make files.dat actually useful. I really dislike the hardcoding, but it /is/
useful. Also, fix a bug in PrecacheModel where it was checking MAX_SOUNDS and numsounds instead of models.
This commit is contained in:
parent
c9af1575d3
commit
10ad8bebbd
3 changed files with 20 additions and 2 deletions
|
@ -550,3 +550,8 @@ typedef struct {
|
||||||
} options_t;
|
} options_t;
|
||||||
|
|
||||||
extern options_t options;
|
extern options_t options;
|
||||||
|
|
||||||
|
//XXX eww :/
|
||||||
|
void PrecacheSound (def_t *e, int ch);
|
||||||
|
void PrecacheModel (def_t *e, int ch);
|
||||||
|
void PrecacheFile (def_t *e, int ch);
|
||||||
|
|
|
@ -789,6 +789,19 @@ function_expr (expr_t *e1, expr_t *e2)
|
||||||
return error (e1, "Called object is not a function");
|
return error (e1, "Called object is not a function");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e1->type == ex_def && e2 && e2->type == ex_string) {
|
||||||
|
//XXX eww, I hate this, but it's needed :(
|
||||||
|
def_t *func = e1->e.def;
|
||||||
|
def_t *e = PR_ReuseConstant (e2, 0);
|
||||||
|
|
||||||
|
if (strncmp (func->name, "precache_sound", 14) == 0)
|
||||||
|
PrecacheSound (e, func->name[4]);
|
||||||
|
else if (strncmp (func->name, "precache_model", 14) == 0)
|
||||||
|
PrecacheModel (e, func->name[14]);
|
||||||
|
else if (strncmp (func->name, "precache_file", 13) == 0)
|
||||||
|
PrecacheFile (e, func->name[13]);
|
||||||
|
}
|
||||||
|
|
||||||
ftype = e1->type == ex_def
|
ftype = e1->type == ex_def
|
||||||
? e1->e.def->type
|
? e1->e.def->type
|
||||||
: e1->e.expr.type;
|
: e1->e.expr.type;
|
||||||
|
|
|
@ -100,8 +100,8 @@ PrecacheModel (def_t *e, int ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numsounds == MAX_SOUNDS)
|
if (nummodels == MAX_MODELS)
|
||||||
Error ("PrecacheModels: numsounds == MAX_SOUNDS");
|
Error ("PrecacheModels: nummodels == MAX_MODELS");
|
||||||
|
|
||||||
strcpy (precache_models[i], n);
|
strcpy (precache_models[i], n);
|
||||||
if (ch >= '1' && ch <= '9')
|
if (ch >= '1' && ch <= '9')
|
||||||
|
|
Loading…
Reference in a new issue