diff --git a/tools/qfcc/include/qfcc.h b/tools/qfcc/include/qfcc.h index d2ec12ecf..e305b1798 100644 --- a/tools/qfcc/include/qfcc.h +++ b/tools/qfcc/include/qfcc.h @@ -550,3 +550,8 @@ typedef struct { } options_t; 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); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index b8bdb91a6..d73de4ec5 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -789,6 +789,19 @@ function_expr (expr_t *e1, expr_t *e2) 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 ? e1->e.def->type : e1->e.expr.type; diff --git a/tools/qfcc/source/pr_comp.c b/tools/qfcc/source/pr_comp.c index 61fe0b9b0..349c60f7a 100644 --- a/tools/qfcc/source/pr_comp.c +++ b/tools/qfcc/source/pr_comp.c @@ -100,8 +100,8 @@ PrecacheModel (def_t *e, int ch) } } - if (numsounds == MAX_SOUNDS) - Error ("PrecacheModels: numsounds == MAX_SOUNDS"); + if (nummodels == MAX_MODELS) + Error ("PrecacheModels: nummodels == MAX_MODELS"); strcpy (precache_models[i], n); if (ch >= '1' && ch <= '9')