mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 17:12:15 +00:00
allow the progs code to hook into the parsing processes
This is an imperfect revision of history.
This commit is contained in:
parent
0effc54835
commit
53ee50655c
3 changed files with 67 additions and 31 deletions
|
@ -599,6 +599,27 @@ PR_gametype (progs_t *pr)
|
||||||
RETURN_STRING (pr, pr_gametype);
|
RETURN_STRING (pr, pr_gametype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PF_PR_SetField (progs_t *pr)
|
||||||
|
{
|
||||||
|
edict_t *ent = P_EDICT (pr, 0);
|
||||||
|
ddef_t *field = PR_FindField (pr, P_GSTRING (pr, 1));
|
||||||
|
const char *value = P_GSTRING (pr, 2);
|
||||||
|
|
||||||
|
R_INT (pr) = 0;
|
||||||
|
if (field)
|
||||||
|
R_INT (pr) = ED_ParseEpair (pr, ent->v, field, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
PF_PR_FindFunction (progs_t *pr)
|
||||||
|
{
|
||||||
|
dfunction_t *func = PR_FindFunction (pr, P_GSTRING (pr, 0));
|
||||||
|
R_FUNCTION (pr) = 0;
|
||||||
|
if (func)
|
||||||
|
R_FUNCTION (pr) = func - pr->pr_functions;
|
||||||
|
}
|
||||||
|
|
||||||
#define QF (PR_RANGE_QF << PR_RANGE_SHIFT) |
|
#define QF (PR_RANGE_QF << PR_RANGE_SHIFT) |
|
||||||
|
|
||||||
static builtin_t builtins[] = {
|
static builtin_t builtins[] = {
|
||||||
|
@ -635,6 +656,9 @@ static builtin_t builtins[] = {
|
||||||
{"stoi", PF_stoi, QF 113},
|
{"stoi", PF_stoi, QF 113},
|
||||||
{"stov", PF_stov, QF 114},
|
{"stov", PF_stov, QF 114},
|
||||||
{"gametype", PR_gametype, QF 115},
|
{"gametype", PR_gametype, QF 115},
|
||||||
|
|
||||||
|
{"PR_SetField", PF_PR_SetField, -1},
|
||||||
|
{"PR_FindFunction", PF_PR_FindFunction, -1},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1440,6 +1440,9 @@ static builtin_t builtins[] = {
|
||||||
{"freeboxhull", PF_freeboxhull, QF 96},
|
{"freeboxhull", PF_freeboxhull, QF 96},
|
||||||
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
||||||
{"checkextension", PF_checkextension, QF 99},
|
{"checkextension", PF_checkextension, QF 99},
|
||||||
|
|
||||||
|
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
||||||
|
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -699,6 +699,13 @@ PF_Remove (progs_t *pr)
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
|
||||||
ed = P_EDICT (pr, 0);
|
ed = P_EDICT (pr, 0);
|
||||||
|
if (NUM_FOR_EDICT (pr, ed) < *pr->reserved_edicts) {
|
||||||
|
if (pr_double_remove->int_val == 1) {
|
||||||
|
PR_DumpState (pr);
|
||||||
|
SV_Printf ("Reserved entity remove\n");
|
||||||
|
} else // == 2
|
||||||
|
PR_RunError (pr, "Reserved entity remove\n");
|
||||||
|
}
|
||||||
if (ed->free && pr_double_remove->int_val) {
|
if (ed->free && pr_double_remove->int_val) {
|
||||||
if (pr_double_remove->int_val == 1) {
|
if (pr_double_remove->int_val == 1) {
|
||||||
PR_DumpState (pr);
|
PR_DumpState (pr);
|
||||||
|
@ -2007,6 +2014,8 @@ static builtin_t builtins[] = {
|
||||||
{"SV_SetPing", PR_SV_SetPing, -1},
|
{"SV_SetPing", PR_SV_SetPing, -1},
|
||||||
{"SV_UserCmd", PR_SV_UserCmd, -1},
|
{"SV_UserCmd", PR_SV_UserCmd, -1},
|
||||||
{"SV_Spawn", PR_SV_Spawn, -1},
|
{"SV_Spawn", PR_SV_Spawn, -1},
|
||||||
|
|
||||||
|
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue