mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
Make PR_Init take an instance to initialize
This allows internal sub-systems to do per-instance initializations without other engine systems having to know about them.
This commit is contained in:
parent
6009d1d023
commit
4b7ecdf74a
16 changed files with 35 additions and 23 deletions
|
@ -409,7 +409,7 @@ typedef struct opcode_s {
|
|||
|
||||
extern opcode_t pr_opcodes[];
|
||||
opcode_t *PR_Opcode (pr_short_t opcode);
|
||||
void PR_Opcode_Init (void);
|
||||
void PR_Opcode_Init (void); // idempotent
|
||||
|
||||
typedef struct dstatement_s {
|
||||
pr_opcode_e op:16;
|
||||
|
|
|
@ -53,8 +53,12 @@ typedef struct edict_s edict_t;
|
|||
///@{
|
||||
|
||||
/** Initialize the progs engine.
|
||||
|
||||
The first call will initialize subsystems common to all progs instances.
|
||||
|
||||
\param pr The progs engine instance to initialize.
|
||||
*/
|
||||
void PR_Init (void);
|
||||
void PR_Init (progs_t *pr);
|
||||
|
||||
/** Initialize the Cvars for the progs engine. Call before calling PR_Init().
|
||||
*/
|
||||
|
@ -1488,7 +1492,7 @@ void *PR_Zone_Realloc (progs_t *pr, void *ptr, pr_int_t size);
|
|||
/// \addtogroup debug
|
||||
///@{
|
||||
|
||||
void PR_Debug_Init (void);
|
||||
void PR_Debug_Init (progs_t *pr);
|
||||
void PR_Debug_Init_Cvars (void);
|
||||
int PR_LoadDebug (progs_t *pr);
|
||||
void PR_Debug_Watch (progs_t *pr, const char *expr);
|
||||
|
|
|
@ -583,6 +583,8 @@ Menu_Init (void)
|
|||
menu_pr_state.max_edicts = 0;
|
||||
menu_pr_state.zone_size = 1024 * 1024;
|
||||
|
||||
PR_Init (&menu_pr_state);
|
||||
|
||||
menu_hash = Hash_NewTable (61, menu_get_key, menu_free, 0);
|
||||
|
||||
PR_RegisterBuiltins (&menu_pr_state, builtins);
|
||||
|
|
|
@ -200,7 +200,7 @@ error:
|
|||
}
|
||||
|
||||
void
|
||||
PR_Debug_Init (void)
|
||||
PR_Debug_Init (progs_t *pr)
|
||||
{
|
||||
file_hash = Hash_NewTable (1024, file_get_key, file_free, 0);
|
||||
}
|
||||
|
|
|
@ -466,10 +466,11 @@ PR_Init_Cvars (void)
|
|||
}
|
||||
|
||||
VISIBLE void
|
||||
PR_Init (void)
|
||||
PR_Init (progs_t *pr)
|
||||
{
|
||||
PR_Opcode_Init ();
|
||||
PR_Debug_Init ();
|
||||
PR_Opcode_Init (); // idempotent
|
||||
PR_Resources_Init (pr);
|
||||
PR_Debug_Init (pr);
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
|
|
|
@ -1493,6 +1493,10 @@ PR_Opcode_Init (void)
|
|||
{
|
||||
opcode_t *op;
|
||||
|
||||
if (opcode_table) {
|
||||
// already initialized
|
||||
return;
|
||||
}
|
||||
opcode_table = Hash_NewTable (1021, 0, 0, 0);
|
||||
Hash_SetHashCompare (opcode_table, opcode_get_hash, opcode_compare);
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ RUA_Init (progs_t *pr, int secure)
|
|||
{
|
||||
size_t i;
|
||||
|
||||
PR_Resources_Init (pr);
|
||||
for (i = 0; i < sizeof (init_funcs) / sizeof (init_funcs[0]); i++)
|
||||
init_funcs[i] (pr, secure);
|
||||
}
|
||||
|
|
|
@ -896,14 +896,9 @@ Host_Init (void)
|
|||
|
||||
Game_Init ();
|
||||
|
||||
PR_Init_Cvars ();
|
||||
SV_Progs_Init_Cvars ();
|
||||
|
||||
if (!isDedicated)
|
||||
CL_InitCvars ();
|
||||
|
||||
PR_Init ();
|
||||
|
||||
if (isDedicated) {
|
||||
PI_RegisterPlugins (server_plugin_list);
|
||||
Con_Init ("server");
|
||||
|
|
|
@ -521,6 +521,8 @@ SV_LoadProgs (void)
|
|||
void
|
||||
SV_Progs_Init (void)
|
||||
{
|
||||
SV_Progs_Init_Cvars ();
|
||||
|
||||
pr_gametype = "netquake";
|
||||
sv_pr_state.edicts = &sv.edicts;
|
||||
sv_pr_state.num_edicts = &sv.num_edicts;
|
||||
|
@ -531,6 +533,8 @@ SV_Progs_Init (void)
|
|||
sv_pr_state.bi_map = bi_map;
|
||||
sv_pr_state.resolve = resolve;
|
||||
|
||||
PR_Init (&sv_pr_state);
|
||||
|
||||
SV_PR_Cmds_Init ();
|
||||
|
||||
Cmd_AddCommand ("edict", ED_PrintEdict_f, "Report information on a given "
|
||||
|
@ -548,6 +552,7 @@ SV_Progs_Init (void)
|
|||
void
|
||||
SV_Progs_Init_Cvars (void)
|
||||
{
|
||||
PR_Init_Cvars ();
|
||||
sv_progs = Cvar_Get ("sv_progs", "", CVAR_NONE, NULL,
|
||||
"Override the default game progs.");
|
||||
sv_progs_zone = Cvar_Get ("sv_progs_zone", "256", CVAR_NONE, NULL,
|
||||
|
|
|
@ -1804,12 +1804,10 @@ Host_Init (void)
|
|||
|
||||
Netchan_Init_Cvars ();
|
||||
|
||||
PR_Init_Cvars ();
|
||||
PR_Init_Cvars (); // FIXME location
|
||||
|
||||
CL_Init_Cvars ();
|
||||
|
||||
PR_Init ();
|
||||
|
||||
CL_Chat_Init ();
|
||||
|
||||
CL_Cmd_Init ();
|
||||
|
|
|
@ -2523,8 +2523,6 @@ SV_Init (void)
|
|||
Mod_Init_Cvars ();
|
||||
Netchan_Init_Cvars ();
|
||||
Pmove_Init_Cvars ();
|
||||
SV_Progs_Init_Cvars ();
|
||||
PR_Init_Cvars ();
|
||||
|
||||
// and now reprocess the cmdline's sets for overrides
|
||||
Cmd_StuffCmds (sv_cbuf);
|
||||
|
@ -2534,7 +2532,6 @@ SV_Init (void)
|
|||
|
||||
Game_Init ();
|
||||
|
||||
PR_Init ();
|
||||
SV_Progs_Init ();
|
||||
Mod_Init ();
|
||||
|
||||
|
|
|
@ -544,6 +544,8 @@ SV_LoadProgs (void)
|
|||
void
|
||||
SV_Progs_Init (void)
|
||||
{
|
||||
SV_Progs_Init_Cvars ();
|
||||
|
||||
pr_gametype = "quakeworld";
|
||||
sv_pr_state.edicts = &sv.edicts;
|
||||
sv_pr_state.num_edicts = &sv.num_edicts;
|
||||
|
@ -556,6 +558,8 @@ SV_Progs_Init (void)
|
|||
sv_pr_state.bi_map = bi_map;
|
||||
sv_pr_state.resolve = resolve;
|
||||
|
||||
PR_Init (&sv_pr_state);
|
||||
|
||||
SV_PR_Cmds_Init ();
|
||||
SV_PR_QWE_Init (&sv_pr_state);
|
||||
SV_PR_CPQW_Init (&sv_pr_state);
|
||||
|
@ -575,6 +579,8 @@ SV_Progs_Init (void)
|
|||
void
|
||||
SV_Progs_Init_Cvars (void)
|
||||
{
|
||||
PR_Init_Cvars ();
|
||||
|
||||
r_skyname = Cvar_Get ("r_skyname", "", CVAR_NONE, NULL,
|
||||
"Default name of skybox if none given by map");
|
||||
sv_progs = Cvar_Get ("sv_progs", "", CVAR_NONE, NULL,
|
||||
|
|
|
@ -236,7 +236,6 @@ init_qf (void)
|
|||
Cvar_Get ("pr_debug", va ("%d", 1+verbosity), 0, 0, "");
|
||||
Cvar_Get ("pr_source_path", source_path, 0, 0, "");
|
||||
PR_Init_Cvars ();
|
||||
PR_Init ();
|
||||
|
||||
pr.edicts = &edicts;
|
||||
pr.num_edicts = &num_edicts;
|
||||
|
@ -246,6 +245,8 @@ init_qf (void)
|
|||
pr.allocate_progs_mem = allocate_progs_mem;
|
||||
pr.free_progs_mem = free_progs_mem;
|
||||
|
||||
PR_Init (&pr);
|
||||
|
||||
func_tab = Hash_NewTable (1021, 0, 0, 0);
|
||||
Hash_SetHashCompare (func_tab, func_hash, func_compare);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ init_qf (void)
|
|||
pr.pr_trace = options.trace;
|
||||
|
||||
PR_Init_Cvars ();
|
||||
PR_Init ();
|
||||
PR_Init (&pr);
|
||||
RUA_Init (&pr, 0);
|
||||
PR_Cmds_Init(&pr);
|
||||
BI_Init (&pr);
|
||||
|
|
|
@ -117,7 +117,7 @@ init_qf (void)
|
|||
pr.no_exec_limit = 1;
|
||||
|
||||
PR_Init_Cvars ();
|
||||
PR_Init ();
|
||||
PR_Init (&pr);
|
||||
RUA_Init (&pr, 0);
|
||||
PR_Cmds_Init(&pr);
|
||||
BI_Init (&pr);
|
||||
|
|
|
@ -128,7 +128,7 @@ init_qf (void)
|
|||
pr.no_exec_limit = 1;
|
||||
|
||||
PR_Init_Cvars ();
|
||||
PR_Init ();
|
||||
PR_Init (&pr);
|
||||
RUA_Init (&pr, 0);
|
||||
PR_Cmds_Init (&pr);
|
||||
BI_Init (&pr);
|
||||
|
|
Loading…
Reference in a new issue