ddef_t *ED_FieldAtOfs (int ofs);
qboolean ED_ParseEpair (void *base, ddef_t *key, char *s);
-cvar_t nomonsters = {"nomonsters", "0"};
-cvar_t gamecfg = {"gamecfg", "0"};
-cvar_t scratch1 = {"scratch1", "0"};
-cvar_t scratch2 = {"scratch2", "0"};
-cvar_t scratch3 = {"scratch3", "0"};
-cvar_t scratch4 = {"scratch4", "0"};
-cvar_t savedgamecfg = {"savedgamecfg", "0", true};
-cvar_t saved1 = {"saved1", "0", true};
-cvar_t saved2 = {"saved2", "0", true};
-cvar_t saved3 = {"saved3", "0", true};
-cvar_t saved4 = {"saved4", "0", true};
-cvar_t decors = {"decors", "0"};
-cvar_t nehx00 = {"nehx00", "0"};cvar_t nehx01 = {"nehx01", "0"};
-cvar_t nehx02 = {"nehx02", "0"};cvar_t nehx03 = {"nehx03", "0"};
-cvar_t nehx04 = {"nehx04", "0"};cvar_t nehx05 = {"nehx05", "0"};
-cvar_t nehx06 = {"nehx06", "0"};cvar_t nehx07 = {"nehx07", "0"};
-cvar_t nehx08 = {"nehx08", "0"};cvar_t nehx09 = {"nehx09", "0"};
-cvar_t nehx10 = {"nehx10", "0"};cvar_t nehx11 = {"nehx11", "0"};
-cvar_t nehx12 = {"nehx12", "0"};cvar_t nehx13 = {"nehx13", "0"};
-cvar_t nehx14 = {"nehx14", "0"};cvar_t nehx15 = {"nehx15", "0"};
-cvar_t nehx16 = {"nehx16", "0"};cvar_t nehx17 = {"nehx17", "0"};
-cvar_t nehx18 = {"nehx18", "0"};cvar_t nehx19 = {"nehx19", "0"};
-cvar_t cutscene = {"cutscene", "1"};
+cvar_t pr_checkextension = {0, "pr_checkextension", "1"};
+cvar_t nomonsters = {0, "nomonsters", "0"};
+cvar_t gamecfg = {0, "gamecfg", "0"};
+cvar_t scratch1 = {0, "scratch1", "0"};
+cvar_t scratch2 = {0,"scratch2", "0"};
+cvar_t scratch3 = {0, "scratch3", "0"};
+cvar_t scratch4 = {0, "scratch4", "0"};
+cvar_t savedgamecfg = {CVAR_SAVE, "savedgamecfg", "0"};
+cvar_t saved1 = {CVAR_SAVE, "saved1", "0"};
+cvar_t saved2 = {CVAR_SAVE, "saved2", "0"};
+cvar_t saved3 = {CVAR_SAVE, "saved3", "0"};
+cvar_t saved4 = {CVAR_SAVE, "saved4", "0"};
+cvar_t decors = {0, "decors", "0"};
+cvar_t nehx00 = {0, "nehx00", "0"};cvar_t nehx01 = {0, "nehx01", "0"};
+cvar_t nehx02 = {0, "nehx02", "0"};cvar_t nehx03 = {0, "nehx03", "0"};
+cvar_t nehx04 = {0, "nehx04", "0"};cvar_t nehx05 = {0, "nehx05", "0"};
+cvar_t nehx06 = {0, "nehx06", "0"};cvar_t nehx07 = {0, "nehx07", "0"};
+cvar_t nehx08 = {0, "nehx08", "0"};cvar_t nehx09 = {0, "nehx09", "0"};
+cvar_t nehx10 = {0, "nehx10", "0"};cvar_t nehx11 = {0, "nehx11", "0"};
+cvar_t nehx12 = {0, "nehx12", "0"};cvar_t nehx13 = {0, "nehx13", "0"};
+cvar_t nehx14 = {0, "nehx14", "0"};cvar_t nehx15 = {0, "nehx15", "0"};
+cvar_t nehx16 = {0, "nehx16", "0"};cvar_t nehx17 = {0, "nehx17", "0"};
+cvar_t nehx18 = {0, "nehx18", "0"};cvar_t nehx19 = {0, "nehx19", "0"};
+cvar_t cutscene = {0, "cutscene", "1"};
// LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
-cvar_t pr_boundscheck = {"pr_boundscheck", "1"};
+cvar_t pr_boundscheck = {0, "pr_boundscheck", "1"};
#define MAX_FIELD_LEN 64
#define GEFV_CACHESIZE 2
int eval_scale;
int eval_alpha;
int eval_renderamt; // HalfLife support
-int eval_rendertype; // HalfLife support
+int eval_rendermode; // HalfLife support
int eval_fullbright;
int eval_ammo_shells1;
int eval_ammo_nails1;
int eval_pitch_speed;
int eval_viewmodelforclient;
int eval_nodrawtoclient;
+int eval_exteriormodeltoclient;
int eval_drawonlytoclient;
int eval_colormod;
int eval_ping;
int eval_movement;
int eval_pmodel;
+int eval_punchvector;
dfunction_t *SV_PlayerPhysicsQC;
dfunction_t *EndFrameQC;
return d->ofs*4;
}
-void FindEdictFieldOffsets()
+void FindEdictFieldOffsets(void)
{
eval_gravity = FindFieldOffset("gravity");
eval_button3 = FindFieldOffset("button3");
eval_scale = FindFieldOffset("scale");
eval_alpha = FindFieldOffset("alpha");
eval_renderamt = FindFieldOffset("renderamt"); // HalfLife support
- eval_rendertype = FindFieldOffset("rendertype"); // HalfLife support
+ eval_rendermode = FindFieldOffset("rendermode"); // HalfLife support
eval_fullbright = FindFieldOffset("fullbright");
eval_ammo_shells1 = FindFieldOffset("ammo_shells1");
eval_ammo_nails1 = FindFieldOffset("ammo_nails1");
eval_pitch_speed = FindFieldOffset("pitch_speed");
eval_viewmodelforclient = FindFieldOffset("viewmodelforclient");
eval_nodrawtoclient = FindFieldOffset("nodrawtoclient");
+ eval_exteriormodeltoclient = FindFieldOffset("exteriormodeltoclient");
eval_drawonlytoclient = FindFieldOffset("drawonlytoclient");
eval_colormod = FindFieldOffset("colormod");
eval_ping = FindFieldOffset("ping");
eval_movement = FindFieldOffset("movement");
eval_pmodel = FindFieldOffset("pmodel");
+ eval_punchvector = FindFieldOffset("punchvector");
// LordHavoc: allowing QuakeC to override the player movement code
SV_PlayerPhysicsQC = ED_FindFunction ("SV_PlayerPhysics");
}
if (i == MAX_EDICTS)
- Sys_Error ("ED_Alloc: no free edicts");
+ Host_Error ("ED_Alloc: no free edicts");
sv.num_edicts++;
e = EDICT_NUM(i);
ed->v.colormap = 0;
ed->v.skin = 0;
ed->v.frame = 0;
- VectorCopy (vec3_origin, ed->v.origin);
- VectorCopy (vec3_origin, ed->v.angles);
+ VectorClear(ed->v.origin);
+ VectorClear(ed->v.angles);
ed->v.nextthink = -1;
ed->v.solid = 0;
return NULL;
}
-
/*
============
ED_FindGlobal
*/
char *PR_ValueString (etype_t type, eval_t *val)
{
- static char line[256];
+ static char line[1024]; // LordHavoc: enlarged a bit (was 256)
ddef_t *def;
dfunction_t *f;
sprintf (line, "void");
break;
case ev_float:
- sprintf (line, "%5.1f", val->_float);
+ // LordHavoc: changed from %5.1f to %10.4f
+ sprintf (line, "%10.4f", val->_float);
break;
case ev_vector:
- sprintf (line, "'%5.1f %5.1f %5.1f'", val->vector[0], val->vector[1], val->vector[2]);
+ // LordHavoc: changed from %5.1f to %10.4f
+ sprintf (line, "'%10.4f %10.4f %10.4f'", val->vector[0], val->vector[1], val->vector[2]);
break;
case ev_pointer:
sprintf (line, "pointer");
For debugging
=============
*/
-// LordHavoc: optimized this to print out much more quickly
+// LordHavoc: optimized this to print out much more quickly (tempstring)
void ED_Print (edict_t *ed)
{
int l;
continue;
strcat(tempstring, name);
- l = strlen (name);
- while (l++ < 15)
+ for (l = strlen(name);l < 14;l++)
strcat(tempstring, " ");
+ strcat(tempstring, " ");
strcat(tempstring, PR_ValueString(d->type, (eval_t *)v));
strcat(tempstring, "\n");
For savegames
=============
*/
-void ED_Write (FILE *f, edict_t *ed)
+void ED_Write (QFile *f, edict_t *ed)
{
ddef_t *d;
int *v;
char *name;
int type;
- fprintf (f, "{\n");
+ Qprintf (f, "{\n");
if (ed->free)
{
- fprintf (f, "}\n");
+ Qprintf (f, "}\n");
return;
}
if (j == type_size[type])
continue;
- fprintf (f,"\"%s\" ",name);
- fprintf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v));
+ Qprintf (f,"\"%s\" ",name);
+ Qprintf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v));
}
- fprintf (f, "}\n");
+ Qprintf (f, "}\n");
}
void ED_PrintNum (int ent)
ED_WriteGlobals
=============
*/
-void ED_WriteGlobals (FILE *f)
+void ED_WriteGlobals (QFile *f)
{
ddef_t *def;
int i;
char *name;
int type;
- fprintf (f,"{\n");
+ Qprintf (f,"{\n");
for (i=0 ; i<progs->numglobaldefs ; i++)
{
def = &pr_globaldefs[i];
continue;
type &= ~DEF_SAVEGLOBAL;
- if (type != ev_string
- && type != ev_float
- && type != ev_entity)
+ if (type != ev_string && type != ev_float && type != ev_entity)
continue;
name = pr_strings + def->s_name;
- fprintf (f,"\"%s\" ", name);
- fprintf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs]));
+ Qprintf (f,"\"%s\" ", name);
+ Qprintf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs]));
}
- fprintf (f,"}\n");
+ Qprintf (f,"}\n");
}
/*
*/
void ED_ParseGlobals (char *data)
{
- char keyname[64];
+ char keyname[1024]; // LordHavoc: good idea? bad idea? was 64
ddef_t *key;
while (1)
int i,l;
l = strlen(string) + 1;
- new = Hunk_Alloc (l);
+ new = Hunk_AllocName (l, "edict string");
new_p = new;
for (i=0 ; i< l ; i++)
if (!def)
{
// LordHavoc: don't warn about worldspawn sky/fog fields because they don't require mod support
- if (strcmp(s, "sky") && strncmp(s, "fog_", 4) && strcmp(s, "skyboxsize"))
+ if (strcmp(s, "sky") && strcmp(s, "fog") && strncmp(s, "fog_", 4) && strcmp(s, "farclip"))
Con_DPrintf ("Can't find field %s\n", s);
return false;
}
if (!data)
break;
if (com_token[0] != '{')
- Sys_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
+ Host_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
if (!ent)
ent = EDICT_NUM(0);
}
pr_global_struct->self = EDICT_TO_PROG(ent);
- PR_ExecuteProgram (func - pr_functions);
+ PR_ExecuteProgram (func - pr_functions, "");
}
Con_DPrintf ("%i entities inhibited\n", inhibit);
}
+void PR_Fields_f (void)
+{
+ int i;
+ if (!sv.active)
+ {
+ Con_Printf("no progs loaded\n");
+ return;
+ }
+ for (i = 0;i < progs->numfielddefs;i++)
+ Con_Printf("%s\n", (pr_strings + pr_fielddefs[i].s_name));
+ Con_Printf("%i entity fields, totalling %i bytes per edict, %i edicts, %i bytes total spent on edict fields\n", progs->entityfields, progs->entityfields * 4, MAX_EDICTS, progs->entityfields * 4 * MAX_EDICTS);
+}
+
+void PR_Globals_f (void)
+{
+ int i;
+ if (!sv.active)
+ {
+ Con_Printf("no progs loaded\n");
+ return;
+ }
+ for (i = 0;i < progs->numglobaldefs;i++)
+ Con_Printf("%s\n", (pr_strings + pr_globaldefs[i].s_name));
+ Con_Printf("%i global variables, totalling %i bytes\n", progs->numglobals, progs->numglobals * 4);
+}
+
/*
===============
PR_Init
Cmd_AddCommand ("edicts", ED_PrintEdicts);
Cmd_AddCommand ("edictcount", ED_Count);
Cmd_AddCommand ("profile", PR_Profile_f);
+ Cmd_AddCommand ("pr_fields", PR_Fields_f);
+ Cmd_AddCommand ("pr_globals", PR_Globals_f);
+ Cvar_RegisterVariable (&pr_checkextension);
Cvar_RegisterVariable (&nomonsters);
Cvar_RegisterVariable (&gamecfg);
Cvar_RegisterVariable (&scratch1);
// LordHavoc: turned EDICT_NUM into a #define for speed reasons
edict_t *EDICT_NUM_ERROR(int n)
{
- Sys_Error ("EDICT_NUM: bad number %i", n);
+ Host_Error ("EDICT_NUM: bad number %i", n);
return NULL;
}
/*
b = b / pr_edict_size;
if (b < 0 || b >= sv.num_edicts)
- Sys_Error ("NUM_FOR_EDICT: bad pointer");
+ Host_Error ("NUM_FOR_EDICT: bad pointer");
return b;
}