diff --git a/nq/source/host.c b/nq/source/host.c index ebe25d199..8f2a9d2d2 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -910,8 +910,6 @@ Host_Init (void) CL_Init_Memory (); - pr_gametype = "netquake"; - mp = Game_Init (); QFS_Init (mp); PI_Init (); diff --git a/nq/source/sv_progs.c b/nq/source/sv_progs.c index 0d9134f0e..244c33680 100644 --- a/nq/source/sv_progs.c +++ b/nq/source/sv_progs.c @@ -32,10 +32,10 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H -# include "string.h" +# include #endif #ifdef HAVE_STRINGS_H -# include "strings.h" +# include #endif #include "QF/cmd.h" @@ -119,9 +119,9 @@ ED_PrintEdicts_f (void) } /* - ED_PrintEdict_f + ED_PrintEdict_f - For debugging, prints a single edicy + For debugging, prints a single edict */ static void ED_PrintEdict_f (void) @@ -149,6 +149,18 @@ PR_Profile_f (void) PR_Profile (&sv_pr_state); } +static void +watch_f (void) +{ + PR_Debug_Watch (&sv_pr_state, Cmd_Argc () < 2 ? 0 : Cmd_Args (1)); +} + +static void +print_f (void) +{ + PR_Debug_Print (&sv_pr_state, Cmd_Argc () < 2 ? 0 : Cmd_Args (1)); +} + static int parse_field (progs_t *pr, const char *key, const char *value) { @@ -309,6 +321,8 @@ static sv_def_t nq_opt_funcs[] = { }; static sv_def_t nq_opt_fields[] = { + {ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, + {ev_float, 0, "gravity", &sv_fields.gravity}, // Quake 2 fields? {ev_float, 0, "dmg", &sv_fields.dmg}, {ev_float, 0, "dmgtime", &sv_fields.dmgtime}, @@ -323,9 +337,6 @@ static sv_def_t nq_opt_fields[] = { {ev_float, 0, "items2", &sv_fields.items2}, {ev_float, 0, "pitch_speed", &sv_fields.pitch_speed}, {ev_float, 0, "lastruntime", &sv_fields.lastruntime}, - - {ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, - {ev_float, 0, "gravity", &sv_fields.gravity}, {ev_void, 0, 0}, }; @@ -465,11 +476,6 @@ SV_LoadProgs (void) const char *progs_name = "progs.dat"; const char *range; - if (qfs_gamedir->gamecode && *qfs_gamedir->gamecode) - progs_name = qfs_gamedir->gamecode; - if (*sv_progs->string) - progs_name = sv_progs->string; - if (strequal (sv_progs_ext->string, "qf")) { sv_range = PR_RANGE_QF; range = "QF"; @@ -482,6 +488,14 @@ SV_LoadProgs (void) } Sys_DPrintf ("Using %s builtin extention mapping\n", range); + memset (&sv_globals, 0, sizeof (sv_funcs)); + memset (&sv_funcs, 0, sizeof (sv_funcs)); + + if (qfs_gamedir->gamecode && *qfs_gamedir->gamecode) + progs_name = qfs_gamedir->gamecode; + if (*sv_progs->string) + progs_name = sv_progs->string; + PR_LoadProgs (&sv_pr_state, progs_name, sv.max_edicts, sv_progs_zone->int_val * 1024); if (!sv_pr_state.progs) @@ -491,6 +505,7 @@ SV_LoadProgs (void) void SV_Progs_Init (void) { + pr_gametype = "netquake"; sv_pr_state.edicts = &sv.edicts; sv_pr_state.num_edicts = &sv.num_edicts; sv_pr_state.reserved_edicts = &svs.maxclients; @@ -508,8 +523,10 @@ SV_Progs_Init (void) "Display information on all edicts in the game."); Cmd_AddCommand ("edictcount", ED_Count_f, "Display summary information on the edicts in the game."); - Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information " - "about QuakeC Stuff (\?\?\?) No Description"); + Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information about " + "QuakeC Stuff (\?\?\?) No Description"); + Cmd_AddCommand ("watch", watch_f, "set watchpoint"); + Cmd_AddCommand ("print", print_f, "print value at location"); } void diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index 94a432318..5519c9996 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -25,7 +25,7 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #ifdef HAVE_STRING_H # include @@ -47,11 +47,11 @@ #include "sv_pr_qwe.h" #include "world.h" +progs_t sv_pr_state; sv_globals_t sv_globals; sv_funcs_t sv_funcs; sv_fields_t sv_fields; -progs_t sv_pr_state; cvar_t *r_skyname; cvar_t *sv_progs; cvar_t *sv_progs_zone; @@ -154,6 +154,10 @@ ED_Count_f (void) static void PR_Profile_f (void) { + if (!sv_pr_state.progs) { + Sys_Printf ("no progs loaded\n"); + return; + } PR_Profile (&sv_pr_state); } @@ -329,15 +333,15 @@ static sv_def_t qw_opt_funcs[] = { }; static sv_def_t qw_opt_fields[] = { - {ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, - {ev_float, 0, "alpha", &sv_fields.alpha}, - {ev_float, 0, "scale", &sv_fields.scale}, - {ev_float, 0, "glow_size", &sv_fields.glow_size}, - {ev_float, 0, "glow_color", &sv_fields.glow_color}, - {ev_vector, 0, "colormod", &sv_fields.colormod}, + {ev_integer, 0, "rotated_bbox", &sv_fields.rotated_bbox}, + {ev_float, 0, "alpha", &sv_fields.alpha}, + {ev_float, 0, "scale", &sv_fields.scale}, + {ev_float, 0, "glow_size", &sv_fields.glow_size}, + {ev_float, 0, "glow_color", &sv_fields.glow_color}, + {ev_vector, 0, "colormod", &sv_fields.colormod}, - {ev_float, 0, "gravity", &sv_fields.gravity}, - {ev_float, 0, "maxspeed", &sv_fields.maxspeed}, + {ev_float, 0, "gravity", &sv_fields.gravity}, + {ev_float, 0, "maxspeed", &sv_fields.maxspeed}, {ev_void, 0, 0}, }; @@ -477,12 +481,6 @@ SV_LoadProgs (void) const char *progs_name = "qwprogs.dat"; const char *range; - memset (&sv_globals, 0, sizeof (sv_funcs)); - memset (&sv_funcs, 0, sizeof (sv_funcs)); - - sv_cbuf->unknown_command = 0; - ucmd_unknown = 0; - if (strequal (sv_progs_ext->string, "qf")) { sv_range = PR_RANGE_QF; range = "QF"; @@ -502,6 +500,12 @@ SV_LoadProgs (void) } Sys_DPrintf ("Using %s builtin extention mapping\n", range); + memset (&sv_globals, 0, sizeof (sv_funcs)); + memset (&sv_funcs, 0, sizeof (sv_funcs)); + + sv_cbuf->unknown_command = 0; + ucmd_unknown = 0; + if (qfs_gamedir->gamecode && *qfs_gamedir->gamecode) progs_name = qfs_gamedir->gamecode; if (*sv_progs->string)