mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
fix the silly OP_STATE bug. also erradicate pr_offs.c and its contents (the
source of the bug)
This commit is contained in:
parent
ffc5838599
commit
6c9de8061b
9 changed files with 86 additions and 151 deletions
|
@ -98,6 +98,7 @@ void ED_ParseGlobals (progs_t *pr, char *data);
|
||||||
void ED_LoadFromFile (progs_t *pr, char *data);
|
void ED_LoadFromFile (progs_t *pr, char *data);
|
||||||
|
|
||||||
ddef_t *ED_FindField (progs_t *pr, char *name);
|
ddef_t *ED_FindField (progs_t *pr, char *name);
|
||||||
|
int ED_GetFieldIndex (progs_t *pr, char *name);
|
||||||
dfunction_t *ED_FindFunction (progs_t *pr, char *name);
|
dfunction_t *ED_FindFunction (progs_t *pr, char *name);
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,9 +141,7 @@ extern builtin_t *pr_builtins;
|
||||||
extern int pr_numbuiltins;
|
extern int pr_numbuiltins;
|
||||||
|
|
||||||
ddef_t *PR_FindGlobal (progs_t *pr, const char *name);
|
ddef_t *PR_FindGlobal (progs_t *pr, const char *name);
|
||||||
int FindFieldOffset (progs_t *pr, char *field);
|
eval_t *PR_GetGlobalPointer (progs_t *pr, const char *name);
|
||||||
eval_t *GETEDICTFIELDVALUE (edict_t *ed, int fieldoffset);
|
|
||||||
|
|
||||||
extern func_t EndFrame; // 2000-01-02 EndFrame function by Maddes/FrikaC
|
extern func_t EndFrame; // 2000-01-02 EndFrame function by Maddes/FrikaC
|
||||||
|
|
||||||
extern func_t SpectatorConnect;
|
extern func_t SpectatorConnect;
|
||||||
|
@ -174,8 +173,6 @@ int PR_SetString(progs_t *pr, char *s);
|
||||||
|
|
||||||
int ED_Parse_Extra_Fields (progs_t *pr, char *key, char *value);
|
int ED_Parse_Extra_Fields (progs_t *pr, char *key, char *value);
|
||||||
int ED_Prune_Edict (progs_t *pr, edict_t *ent);
|
int ED_Prune_Edict (progs_t *pr, edict_t *ent);
|
||||||
void FindEdictFieldOffsets (progs_t *pr);
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
noinst_LIBRARIES = libqfgamecode.a
|
noinst_LIBRARIES = libqfgamecode.a
|
||||||
|
|
||||||
libqfgamecode_a_SOURCES = pr_edict.c pr_exec.c pr_offs.c
|
libqfgamecode_a_SOURCES = pr_edict.c pr_exec.c
|
||||||
|
|
||||||
all-local: ../libqfgamecode.a
|
all-local: ../libqfgamecode.a
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ static gefv_cache gefvCache[GEFV_CACHESIZE] = { {NULL, ""}, {NULL, ""} };
|
||||||
void
|
void
|
||||||
ED_ClearEdict (progs_t * pr, edict_t *e)
|
ED_ClearEdict (progs_t * pr, edict_t *e)
|
||||||
{
|
{
|
||||||
|
if (NUM_FOR_EDICT(pr,e)<*pr->reserved_edicts)
|
||||||
|
printf("clearing reserved edict %d\n", NUM_FOR_EDICT(pr,e));
|
||||||
memset (&e->v, 0, pr->progs->entityfields * 4);
|
memset (&e->v, 0, pr->progs->entityfields * 4);
|
||||||
e->free = false;
|
e->free = false;
|
||||||
}
|
}
|
||||||
|
@ -196,6 +198,16 @@ ED_FindField (progs_t * pr, char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ED_GetFieldIndex (progs_t *pr, char *name)
|
||||||
|
{
|
||||||
|
ddef_t *def;
|
||||||
|
|
||||||
|
def = ED_FindField (pr, name);
|
||||||
|
if (def)
|
||||||
|
return def->ofs;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PR_FindGlobal
|
PR_FindGlobal
|
||||||
|
@ -214,6 +226,17 @@ PR_FindGlobal (progs_t * pr, const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval_t *
|
||||||
|
PR_GetGlobalPointer (progs_t *pr, const char *name)
|
||||||
|
{
|
||||||
|
ddef_t *def;
|
||||||
|
|
||||||
|
def = PR_FindGlobal (pr, name);
|
||||||
|
if (def)
|
||||||
|
return (eval_t*)&pr->pr_globals[def->ofs];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ED_FindFunction
|
ED_FindFunction
|
||||||
|
@ -267,7 +290,7 @@ GetEdictFieldValue (progs_t * pr, edict_t *ed, char *field)
|
||||||
Returns a string describing *data in a type specific manner
|
Returns a string describing *data in a type specific manner
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
PR_ValueString (progs_t * pr, etype_t type, eval_t *val)
|
PR_ValueString (progs_t * pr, etype_t type, pr_type_t *val)
|
||||||
{
|
{
|
||||||
static char line[256];
|
static char line[256];
|
||||||
ddef_t *def;
|
ddef_t *def;
|
||||||
|
@ -278,19 +301,19 @@ PR_ValueString (progs_t * pr, etype_t type, eval_t *val)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ev_string:
|
case ev_string:
|
||||||
snprintf (line, sizeof (line), "%s",
|
snprintf (line, sizeof (line), "%s",
|
||||||
PR_GetString (pr, val->string));
|
PR_GetString (pr, val->string_var));
|
||||||
break;
|
break;
|
||||||
case ev_entity:
|
case ev_entity:
|
||||||
snprintf (line, sizeof (line), "entity %i",
|
snprintf (line, sizeof (line), "entity %i",
|
||||||
NUM_FOR_EDICT (pr, PROG_TO_EDICT (pr, val->edict)));
|
NUM_FOR_EDICT (pr, PROG_TO_EDICT (pr, val->entity_var)));
|
||||||
break;
|
break;
|
||||||
case ev_func:
|
case ev_func:
|
||||||
f = pr->pr_functions + val->function;
|
f = pr->pr_functions + val->func_var;
|
||||||
snprintf (line, sizeof (line), "%s()",
|
snprintf (line, sizeof (line), "%s()",
|
||||||
PR_GetString (pr, f->s_name));
|
PR_GetString (pr, f->s_name));
|
||||||
break;
|
break;
|
||||||
case ev_field:
|
case ev_field:
|
||||||
def = ED_FieldAtOfs (pr, val->_int);
|
def = ED_FieldAtOfs (pr, val->int_var);
|
||||||
snprintf (line, sizeof (line), ".%s",
|
snprintf (line, sizeof (line), ".%s",
|
||||||
PR_GetString (pr, def->s_name));
|
PR_GetString (pr, def->s_name));
|
||||||
break;
|
break;
|
||||||
|
@ -298,11 +321,11 @@ PR_ValueString (progs_t * pr, etype_t type, eval_t *val)
|
||||||
strcpy (line, "void");
|
strcpy (line, "void");
|
||||||
break;
|
break;
|
||||||
case ev_float:
|
case ev_float:
|
||||||
snprintf (line, sizeof (line), "%5.1f", val->_float);
|
snprintf (line, sizeof (line), "%5.1f", val->float_var);
|
||||||
break;
|
break;
|
||||||
case ev_vector:
|
case ev_vector:
|
||||||
snprintf (line, sizeof (line), "'%5.1f %5.1f %5.1f'",
|
snprintf (line, sizeof (line), "'%5.1f %5.1f %5.1f'",
|
||||||
val->vector[0], val->vector[1], val->vector[2]);
|
val->vector_var[0], val->vector_var[1], val->vector_var[2]);
|
||||||
break;
|
break;
|
||||||
case ev_pointer:
|
case ev_pointer:
|
||||||
strcpy (line, "pointer");
|
strcpy (line, "pointer");
|
||||||
|
@ -432,7 +455,7 @@ ED_Print (progs_t * pr, edict_t *ed)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
ddef_t *d;
|
ddef_t *d;
|
||||||
int *v;
|
pr_type_t *v;
|
||||||
int i, j;
|
int i, j;
|
||||||
char *name;
|
char *name;
|
||||||
int type;
|
int type;
|
||||||
|
@ -449,13 +472,13 @@ ED_Print (progs_t * pr, edict_t *ed)
|
||||||
if (name[strlen (name) - 2] == '_')
|
if (name[strlen (name) - 2] == '_')
|
||||||
continue; // skip _x, _y, _z vars
|
continue; // skip _x, _y, _z vars
|
||||||
|
|
||||||
v = (int *) ((char *) &ed->v + d->ofs * 4);
|
v = ed->v + d->ofs;
|
||||||
|
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
type = d->type & ~DEF_SAVEGLOBAL;
|
type = d->type & ~DEF_SAVEGLOBAL;
|
||||||
|
|
||||||
for (j = 0; j < type_size[type]; j++)
|
for (j = 0; j < type_size[type]; j++)
|
||||||
if (v[j])
|
if (((char*)v)[j])
|
||||||
break;
|
break;
|
||||||
if (j == type_size[type])
|
if (j == type_size[type])
|
||||||
continue;
|
continue;
|
||||||
|
@ -465,7 +488,7 @@ ED_Print (progs_t * pr, edict_t *ed)
|
||||||
while (l++ < 15)
|
while (l++ < 15)
|
||||||
Con_Printf (" ");
|
Con_Printf (" ");
|
||||||
|
|
||||||
Con_Printf ("%s\n", PR_ValueString (pr, d->type, (eval_t *) v));
|
Con_Printf ("%s\n", PR_ValueString (pr, d->type, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,7 +947,6 @@ PR_LoadProgs (progs_t * pr, char *progsname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
dstatement_t *st;
|
dstatement_t *st;
|
||||||
ddef_t *def;
|
|
||||||
|
|
||||||
// flush the non-C variable lookup cache
|
// flush the non-C variable lookup cache
|
||||||
for (i = 0; i < GEFV_CACHESIZE; i++)
|
for (i = 0; i < GEFV_CACHESIZE; i++)
|
||||||
|
@ -967,7 +989,6 @@ PR_LoadProgs (progs_t * pr, char *progsname)
|
||||||
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (pr_type_t);
|
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (pr_type_t);
|
||||||
|
|
||||||
pr->pr_edictareasize = 0;
|
pr->pr_edictareasize = 0;
|
||||||
Con_Printf("pr_edict_size: %d\n", pr->pr_edict_size);
|
|
||||||
|
|
||||||
// byte swap the lumps
|
// byte swap the lumps
|
||||||
for (i = 0; i < pr->progs->numstatements; i++) {
|
for (i = 0; i < pr->progs->numstatements; i++) {
|
||||||
|
@ -1006,24 +1027,17 @@ Con_Printf("pr_edict_size: %d\n", pr->pr_edict_size);
|
||||||
for (i = 0; i < pr->progs->numglobals; i++)
|
for (i = 0; i < pr->progs->numglobals; i++)
|
||||||
((int *) pr->pr_globals)[i] = LittleLong (((int *) pr->pr_globals)[i]);
|
((int *) pr->pr_globals)[i] = LittleLong (((int *) pr->pr_globals)[i]);
|
||||||
|
|
||||||
def = PR_FindGlobal (pr, "time");
|
if (!(pr->globals.time = (float*)PR_GetGlobalPointer (pr, "time")))
|
||||||
if (!def)
|
|
||||||
PR_Error (pr, "%s: undefined symbol: time", progsname);
|
PR_Error (pr, "%s: undefined symbol: time", progsname);
|
||||||
pr->globals.time = &pr->pr_globals[def->ofs].float_var;
|
if (!(pr->globals.self = (int*)PR_GetGlobalPointer (pr, "self")))
|
||||||
def = PR_FindGlobal (pr, "self");
|
|
||||||
if (!def)
|
|
||||||
PR_Error (pr, "%s: undefined symbol: self", progsname);
|
PR_Error (pr, "%s: undefined symbol: self", progsname);
|
||||||
pr->globals.self = &pr->pr_globals[def->ofs].entity_var;
|
if ((pr->fields.nextthink = ED_GetFieldIndex (pr, "nextthink")) == -1)
|
||||||
if (!(pr->fields.nextthink = FindFieldOffset (pr, "nextthink")))
|
|
||||||
PR_Error (pr, "%s: undefined field: nextthink", progsname);
|
PR_Error (pr, "%s: undefined field: nextthink", progsname);
|
||||||
if (!(pr->fields.frame = FindFieldOffset (pr, "frame")))
|
if ((pr->fields.frame = ED_GetFieldIndex (pr, "frame")) == -1)
|
||||||
PR_Error (pr, "%s: undefined field: frame", progsname);
|
PR_Error (pr, "%s: undefined field: frame", progsname);
|
||||||
if (!(pr->fields.think = FindFieldOffset (pr, "think")))
|
if ((pr->fields.think = ED_GetFieldIndex (pr, "think")) == -1)
|
||||||
PR_Error (pr, "%s: undefined field: think", progsname);
|
PR_Error (pr, "%s: undefined field: think", progsname);
|
||||||
|
|
||||||
// LordHavoc: Ender added this
|
|
||||||
FindEdictFieldOffsets (pr);
|
|
||||||
|
|
||||||
// LordHavoc: bounds check anything static
|
// LordHavoc: bounds check anything static
|
||||||
for (i = 0, st = pr->pr_statements; i < pr->progs->numstatements; i++, st++) {
|
for (i = 0, st = pr->pr_statements; i < pr->progs->numstatements; i++, st++) {
|
||||||
switch (st->op) {
|
switch (st->op) {
|
||||||
|
@ -1138,9 +1152,6 @@ Con_Printf("pr_edict_size: %d\n", pr->pr_edict_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FindEdictFieldOffsets (pr); // LordHavoc: update field offset
|
|
||||||
// list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -681,7 +681,6 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
||||||
ed->v[pr->fields.nextthink].float_var = *pr->globals.time + 0.1;
|
ed->v[pr->fields.nextthink].float_var = *pr->globals.time + 0.1;
|
||||||
ed->v[pr->fields.frame].float_var = E_OPA->_float;
|
ed->v[pr->fields.frame].float_var = E_OPA->_float;
|
||||||
ed->v[pr->fields.think].func_var = E_OPB->function;
|
ed->v[pr->fields.think].func_var = E_OPB->function;
|
||||||
printf ("STATE: %d %f %d %s\n", *pr->globals.self, ed->v[pr->fields.nextthink].float_var, (int)ed->v[pr->fields.frame].float_var, PR_GetString(pr,pr->pr_functions[ed->v[pr->fields.think].func_var].s_name));
|
|
||||||
break;
|
break;
|
||||||
// LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
|
// LordHavoc: to be enabled when Progs version 7 (or whatever it will be numbered) is finalized
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
pr_offs.c
|
|
||||||
|
|
||||||
Quick QuakeC offset access
|
|
||||||
|
|
||||||
Copyright (C) 1996-1997 Id Software, Inc.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to:
|
|
||||||
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
59 Temple Place - Suite 330
|
|
||||||
Boston, MA 02111-1307, USA
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "progs.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
FindFieldOffset (progs_t *pr, char *field)
|
|
||||||
{
|
|
||||||
ddef_t *d;
|
|
||||||
|
|
||||||
d = ED_FindField (pr, field);
|
|
||||||
if (!d)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return d->ofs * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
eval_t *
|
|
||||||
GETEDICTFIELDVALUE (edict_t *ed, int fieldoffset)
|
|
||||||
{
|
|
||||||
if (!fieldoffset)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return (eval_t *) ((char *) &ed->v + fieldoffset);
|
|
||||||
}
|
|
|
@ -147,6 +147,12 @@ typedef struct
|
||||||
int owner; //int
|
int owner; //int
|
||||||
int message; //string_t
|
int message; //string_t
|
||||||
int sounds; //float
|
int sounds; //float
|
||||||
|
|
||||||
|
int alpha;
|
||||||
|
int scale;
|
||||||
|
int glowsize;
|
||||||
|
int glowcolor;
|
||||||
|
int colormod;
|
||||||
} sv_fields_t;
|
} sv_fields_t;
|
||||||
|
|
||||||
extern sv_fields_t sv_fields;
|
extern sv_fields_t sv_fields;
|
||||||
|
|
|
@ -42,12 +42,6 @@
|
||||||
#include "sv_progs.h"
|
#include "sv_progs.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
// LordHavoc: added and removed certain eval_ items
|
|
||||||
// Ender Extends (QSG - Begin)
|
|
||||||
extern int eval_alpha, eval_scale, eval_glowsize, eval_glowcolor,
|
|
||||||
|
|
||||||
eval_colormod;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The PVS must include a small area around the client to allow head
|
The PVS must include a small area around the client to allow head
|
||||||
bobbing or other small motion on the client side. Otherwise, a bob
|
bobbing or other small motion on the client side. Otherwise, a bob
|
||||||
|
@ -571,37 +565,32 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
// and implemented missing effects
|
// and implemented missing effects
|
||||||
// Ender: EXTEND (QSG - Begin)
|
// Ender: EXTEND (QSG - Begin)
|
||||||
{
|
{
|
||||||
eval_t *val;
|
|
||||||
|
|
||||||
state->alpha = 255;
|
state->alpha = 255;
|
||||||
state->scale = 16;
|
state->scale = 16;
|
||||||
state->glowsize = 0;
|
state->glowsize = 0;
|
||||||
state->glowcolor = 254;
|
state->glowcolor = 254;
|
||||||
state->colormod = 255;
|
state->colormod = 255;
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE (ent, eval_alpha))
|
if (sv_fields.alpha != -1 && SVFIELD (ent, alpha, float))
|
||||||
&& val->_float != 0)
|
state->alpha = bound (0, SVFIELD (ent, alpha, float), 1) * 255.0;
|
||||||
state->alpha = bound (0, val->_float, 1) * 255.0;
|
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE (ent, eval_scale))
|
if (sv_fields.scale != -1 && SVFIELD (ent, scale, float))
|
||||||
&& val->_float != 0)
|
state->scale = bound (0, SVFIELD (ent, scale, float), 15.9375) * 16.0;
|
||||||
state->scale = bound (0, val->_float, 15.9375) * 16.0;
|
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE (ent, eval_glowsize))
|
if (sv_fields.glowsize != -1 && SVFIELD (ent, glowsize, float))
|
||||||
&& val->_float != 0)
|
state->glowsize = bound (-1024, (int) SVFIELD (ent, glowsize, float), 1016) >> 3;
|
||||||
state->glowsize = bound (-1024, (int) val->_float, 1016) >> 3;
|
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE (ent, eval_glowcolor))
|
if (sv_fields.glowcolor != -1 && SVFIELD (ent, glowcolor, float))
|
||||||
&& val->_float != 0)
|
state->glowcolor = (int) SVFIELD (ent, glowcolor, float);
|
||||||
state->glowcolor = (int) val->_float;
|
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE (ent, eval_colormod))
|
if (sv_fields.colormod != -1
|
||||||
&& (val->vector[0] != 0 || val->vector[1] != 0
|
&& SVFIELD (ent, colormod, vector)[0]
|
||||||
|| val->vector[2] != 0))
|
&& SVFIELD (ent, colormod, vector)[1]
|
||||||
|
&& SVFIELD (ent, colormod, vector)[2])
|
||||||
state->colormod =
|
state->colormod =
|
||||||
((int) (bound (0, val->vector[0], 1) * 7.0) << 5) |
|
((int) (bound (0, SVFIELD (ent, colormod, vector)[0], 1) * 7.0) << 5) |
|
||||||
((int) (bound (0, val->vector[1], 1) * 7.0) << 2) |
|
((int) (bound (0, SVFIELD (ent, colormod, vector)[1], 1) * 7.0) << 2) |
|
||||||
(int) (bound (0, val->vector[2], 1) * 3.0);
|
(int) (bound (0, SVFIELD (ent, colormod, vector)[2], 1) * 3.0);
|
||||||
}
|
}
|
||||||
// Ender: EXTEND (QSG - End)
|
// Ender: EXTEND (QSG - End)
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,6 @@ SV_RunThink (edict_t *ent)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
thinktime = SVFIELD (ent, nextthink, float);
|
thinktime = SVFIELD (ent, nextthink, float);
|
||||||
Con_Printf("thinktime: %f\n", thinktime);
|
|
||||||
if (thinktime <= 0)
|
if (thinktime <= 0)
|
||||||
return true;
|
return true;
|
||||||
if (thinktime > sv.time + sv_frametime)
|
if (thinktime > sv.time + sv_frametime)
|
||||||
|
|
|
@ -47,12 +47,6 @@ sv_globals_t sv_globals;
|
||||||
sv_funcs_t sv_funcs;
|
sv_funcs_t sv_funcs;
|
||||||
sv_fields_t sv_fields;
|
sv_fields_t sv_fields;
|
||||||
|
|
||||||
int eval_alpha;
|
|
||||||
int eval_scale;
|
|
||||||
int eval_glowsize;
|
|
||||||
int eval_glowcolor;
|
|
||||||
int eval_colormod;
|
|
||||||
|
|
||||||
progs_t sv_pr_state;
|
progs_t sv_pr_state;
|
||||||
cvar_t *r_skyname;
|
cvar_t *r_skyname;
|
||||||
cvar_t *sv_progs;
|
cvar_t *sv_progs;
|
||||||
|
@ -64,35 +58,6 @@ func_t SpectatorThink;
|
||||||
|
|
||||||
static int reserved_edicts = MAX_CLIENTS;
|
static int reserved_edicts = MAX_CLIENTS;
|
||||||
|
|
||||||
void
|
|
||||||
FindEdictFieldOffsets (progs_t *pr)
|
|
||||||
{
|
|
||||||
dfunction_t *f;
|
|
||||||
|
|
||||||
if (pr == &sv_pr_state) {
|
|
||||||
// Zoid, find the spectator functions
|
|
||||||
SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0;
|
|
||||||
|
|
||||||
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorConnect")) != NULL)
|
|
||||||
SpectatorConnect = (func_t) (f - sv_pr_state.pr_functions);
|
|
||||||
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorThink")) != NULL)
|
|
||||||
SpectatorThink = (func_t) (f - sv_pr_state.pr_functions);
|
|
||||||
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorDisconnect")) != NULL)
|
|
||||||
SpectatorDisconnect = (func_t) (f - sv_pr_state.pr_functions);
|
|
||||||
|
|
||||||
// 2000-01-02 EndFrame function by Maddes/FrikaC
|
|
||||||
EndFrame = 0;
|
|
||||||
if ((f = ED_FindFunction (&sv_pr_state, "EndFrame")) != NULL)
|
|
||||||
EndFrame = (func_t) (f - sv_pr_state.pr_functions);
|
|
||||||
|
|
||||||
eval_alpha = FindFieldOffset (&sv_pr_state, "alpha");
|
|
||||||
eval_scale = FindFieldOffset (&sv_pr_state, "scale");
|
|
||||||
eval_glowsize = FindFieldOffset (&sv_pr_state, "glow_size");
|
|
||||||
eval_glowcolor = FindFieldOffset (&sv_pr_state, "glow_color");
|
|
||||||
eval_colormod = FindFieldOffset (&sv_pr_state, "colormod");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ED_Prune_Edict (progs_t *pr, edict_t *ent)
|
ED_Prune_Edict (progs_t *pr, edict_t *ent)
|
||||||
{
|
{
|
||||||
|
@ -155,6 +120,8 @@ ED_Parse_Extra_Fields (progs_t *pr, char *key, char *value)
|
||||||
void
|
void
|
||||||
SV_LoadProgs (void)
|
SV_LoadProgs (void)
|
||||||
{
|
{
|
||||||
|
dfunction_t *f;
|
||||||
|
|
||||||
PR_LoadProgs (&sv_pr_state, sv_progs->string);
|
PR_LoadProgs (&sv_pr_state, sv_progs->string);
|
||||||
if (!sv_pr_state.progs)
|
if (!sv_pr_state.progs)
|
||||||
SV_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string);
|
SV_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string);
|
||||||
|
@ -300,6 +267,27 @@ SV_LoadProgs (void)
|
||||||
sv_fields.owner = ED_FindField (&sv_pr_state, "owner")->ofs;
|
sv_fields.owner = ED_FindField (&sv_pr_state, "owner")->ofs;
|
||||||
sv_fields.message = ED_FindField (&sv_pr_state, "message")->ofs;
|
sv_fields.message = ED_FindField (&sv_pr_state, "message")->ofs;
|
||||||
sv_fields.sounds = ED_FindField (&sv_pr_state, "sounds")->ofs;
|
sv_fields.sounds = ED_FindField (&sv_pr_state, "sounds")->ofs;
|
||||||
|
|
||||||
|
// Zoid, find the spectator functions
|
||||||
|
SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0;
|
||||||
|
|
||||||
|
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorConnect")) != NULL)
|
||||||
|
SpectatorConnect = (func_t) (f - sv_pr_state.pr_functions);
|
||||||
|
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorThink")) != NULL)
|
||||||
|
SpectatorThink = (func_t) (f - sv_pr_state.pr_functions);
|
||||||
|
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorDisconnect")) != NULL)
|
||||||
|
SpectatorDisconnect = (func_t) (f - sv_pr_state.pr_functions);
|
||||||
|
|
||||||
|
// 2000-01-02 EndFrame function by Maddes/FrikaC
|
||||||
|
EndFrame = 0;
|
||||||
|
if ((f = ED_FindFunction (&sv_pr_state, "EndFrame")) != NULL)
|
||||||
|
EndFrame = (func_t) (f - sv_pr_state.pr_functions);
|
||||||
|
|
||||||
|
sv_fields.alpha = ED_GetFieldIndex (&sv_pr_state, "alpha");
|
||||||
|
sv_fields.scale = ED_GetFieldIndex (&sv_pr_state, "scale");
|
||||||
|
sv_fields.glowsize = ED_GetFieldIndex (&sv_pr_state, "glow_size");
|
||||||
|
sv_fields.glowcolor = ED_GetFieldIndex (&sv_pr_state, "glow_color");
|
||||||
|
sv_fields.colormod = ED_GetFieldIndex (&sv_pr_state, "colormod");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue