mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 18:31:27 +00:00
Break out the guts of Ed_LoadFromFile into ED_Parse.
ED_Parse does not support progs privided parsing (at this stage, anyway), but this will allow clients to easily get at the entities in a map.
This commit is contained in:
parent
843823de84
commit
8e557e81b6
2 changed files with 25 additions and 13 deletions
|
@ -246,6 +246,7 @@ struct plitem_s *ED_GlobalsDict (progs_t *pr);
|
|||
void ED_InitGlobals (progs_t *pr, struct plitem_s *globals);
|
||||
void ED_InitEntity (progs_t *pr, struct plitem_s *entity, edict_t *ent);
|
||||
struct plitem_s *ED_ConvertToPlist (progs_t *pr, struct script_s *script);
|
||||
struct plitem_s *ED_Parse (progs_t *pr, const char *data);
|
||||
void ED_LoadFromFile (progs_t *pr, const char *data);
|
||||
void ED_EntityParseFunction (progs_t *pr);
|
||||
|
||||
|
|
|
@ -447,20 +447,11 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
|
|||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
ED_LoadFromFile (progs_t *pr, const char *data)
|
||||
VISIBLE plitem_t *
|
||||
ED_Parse (progs_t *pr, const char *data)
|
||||
{
|
||||
script_t *script;
|
||||
plitem_t *entity_list;
|
||||
|
||||
if (pr->edict_parse) {
|
||||
PR_PushFrame (pr);
|
||||
PR_RESET_PARAMS (pr);
|
||||
P_INT (pr, 0) = PR_SetTempString (pr, data);
|
||||
PR_ExecuteProgram (pr, pr->edict_parse);
|
||||
PR_PopFrame (pr);
|
||||
return;
|
||||
}
|
||||
plitem_t *entity_list = 0;
|
||||
|
||||
script = Script_New ();
|
||||
Script_Start (script, "ent data", data);
|
||||
|
@ -474,9 +465,29 @@ ED_LoadFromFile (progs_t *pr, const char *data)
|
|||
Script_UngetToken (script);
|
||||
entity_list = ED_ConvertToPlist (pr, script);
|
||||
}
|
||||
ED_SpawnEntities (pr, entity_list);
|
||||
}
|
||||
Script_Delete (script);
|
||||
return entity_list;
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
ED_LoadFromFile (progs_t *pr, const char *data)
|
||||
{
|
||||
plitem_t *entity_list;
|
||||
|
||||
if (pr->edict_parse) {
|
||||
PR_PushFrame (pr);
|
||||
PR_RESET_PARAMS (pr);
|
||||
P_INT (pr, 0) = PR_SetTempString (pr, data);
|
||||
PR_ExecuteProgram (pr, pr->edict_parse);
|
||||
PR_PopFrame (pr);
|
||||
return;
|
||||
}
|
||||
entity_list = ED_Parse (pr, data);
|
||||
if (entity_list) {
|
||||
ED_SpawnEntities (pr, entity_list);
|
||||
PL_Free (entity_list);
|
||||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
|
|
Loading…
Reference in a new issue