remove E_ functions

master
an 2019-12-02 10:37:05 -05:00
parent 39ceff0005
commit 7b2975f5ba
3 changed files with 76 additions and 83 deletions

View File

@ -1016,7 +1016,7 @@ static void PF_vtos(void)
G_INT(OFS_RETURN) = PR_SetEngineString(s);
}
static void PF_Spawn(void)
static void PF_spawn(void)
{
edict_t *ed;
@ -1025,7 +1025,7 @@ static void PF_Spawn(void)
RETURN_EDICT(ed);
}
static void PF_Remove(void)
static void PF_remove(void)
{
edict_t *ed;
@ -1035,7 +1035,7 @@ static void PF_Remove(void)
// entity (entity start, .string field, string match) find = #5;
static void PF_Find(void)
static void PF_find(void)
{
int32_t e;
int32_t f;
@ -1046,14 +1046,14 @@ static void PF_Find(void)
f = G_INT(OFS_PARM1);
s = G_STRING(OFS_PARM2);
if(!s)
PR_RunError("PF_Find: bad search string");
PR_RunError("PF_find: bad search string");
for(e++ ; e < sv.num_edicts ; e++)
{
ed = EDICT_NUM(e);
if(ed->free)
continue;
t = E_STRING(ed, f);
t = PR_GetString(((string_t *)&ed->v)[f]);
if(!t)
continue;
if(!strcmp(t, s))
@ -1668,7 +1668,7 @@ static void PF_changelevel(void)
Cbuf_AddText(va("changelevel %s\n", s));
}
static void PF_Fixme(void)
static void PF_fixme(void)
{
PR_RunError("unimplemented builtin");
}
@ -1676,12 +1676,12 @@ static void PF_Fixme(void)
static builtin_t pr_builtin[] =
{
PF_Fixme,
PF_fixme,
PF_makevectors, // void(entity e) makevectors = #1
PF_setorigin, // void(entity e, vector o) setorigin = #2
PF_setmodel, // void(entity e, string m) setmodel = #3
PF_setsize, // void(entity e, vector min, vector max) setsize = #4
PF_Fixme, // void(entity e, vector min, vector max) setabssize = #5
PF_fixme, // void(entity e, vector min, vector max) setabssize = #5
PF_break, // void() break = #6
PF_random, // float() random = #7
PF_sound, // void(entity e, float chan, string samp) sound = #8
@ -1690,11 +1690,11 @@ static builtin_t pr_builtin[] =
PF_objerror, // void(string e) objerror = #11
PF_vlen, // float(vector v) vlen = #12
PF_vectoyaw, // float(vector v) vectoyaw = #13
PF_Spawn, // entity() spawn = #14
PF_Remove, // void(entity e) remove = #15
PF_spawn, // entity() spawn = #14
PF_remove, // void(entity e) remove = #15
PF_traceline, // float(vector v1, vector v2, float tryents) traceline = #16
PF_checkclient, // entity() clientlist = #17
PF_Find, // entity(entity start, .string fld, string match) find = #18
PF_find, // entity(entity start, .string fld, string match) find = #18
PF_precache_sound, // void(string s) precache_sound = #19
PF_precache_model, // void(string s) precache_model = #20
PF_stuffcmd, // void(entity client, string s)stuffcmd = #21
@ -1709,16 +1709,16 @@ static builtin_t pr_builtin[] =
PF_traceoff,
PF_eprint, // void(entity e) debug print an entire entity
PF_walkmove, // float(float yaw, float dist) walkmove
PF_Fixme, // float(float yaw, float dist) walkmove
PF_fixme, // float(float yaw, float dist) walkmove
PF_droptofloor,
PF_lightstyle,
PF_rint,
PF_floor,
PF_ceil,
PF_Fixme,
PF_fixme,
PF_checkbottom,
PF_pointcontents,
PF_Fixme,
PF_fixme,
PF_fabs,
PF_aim,
PF_cvar,
@ -1726,7 +1726,7 @@ static builtin_t pr_builtin[] =
PF_nextent,
PF_particle,
PF_changeyaw,
PF_Fixme,
PF_fixme,
PF_vectoangles,
PF_WriteByte,
@ -1738,20 +1738,20 @@ static builtin_t pr_builtin[] =
PF_WriteString,
PF_WriteEntity,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_fixme,
PF_fixme,
PF_fixme,
PF_fixme,
PF_fixme,
PF_fixme,
PF_fixme,
SV_MoveToGoal,
PF_precache_file,
PF_makestatic,
PF_changelevel,
PF_Fixme,
PF_fixme,
PF_cvar_set,
PF_centerprint,

View File

@ -42,7 +42,7 @@ typedef enum
#define OFS_NULL 0
#define OFS_RETURN 1
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
#define OFS_PARM0 4 // leave 3 ofs for each parm to hold vectors
#define OFS_PARM1 7
#define OFS_PARM2 10
#define OFS_PARM3 13
@ -133,63 +133,61 @@ enum
typedef struct statement_s
{
uint16_t op;
int16_t a, b, c;
uint16_t op;
int16_t a, b, c;
} dstatement_t;
typedef struct
{
uint16_t type; // if DEF_SAVEGLOBAL bit is set
// the variable needs to be saved in savegames
uint16_t ofs;
int32_t s_name;
uint16_t type; /* if DEF_SAVEGLOBAL bit is set the variable needs to be saved in savegames */
uint16_t ofs;
int32_t s_name;
} ddef_t;
#define DEF_SAVEGLOBAL (1<<15)
#define DEF_SAVEGLOBAL (1 << 15)
#define MAX_PARMS 8
#define MAX_PARMS 8
typedef struct
{
int32_t first_statement; // negative numbers are builtins
int32_t parm_start;
int32_t locals; // total ints of parms + locals
int32_t first_statement; // negative numbers are builtins
int32_t parm_start;
int32_t locals; // total ints of parms + locals
int32_t profile; // runtime
int32_t profile; // runtime
int32_t s_name;
int32_t s_file; // source file defined in
int32_t s_name;
int32_t s_file; // source file defined in
int32_t numparms;
int32_t numparms;
byte parm_size[MAX_PARMS];
} dfunction_t;
#define PROG_VERSION 6
typedef struct
{
int32_t version;
int32_t crc; // check of header file
int32_t version;
int32_t crc; // check of header file
int32_t ofs_statements;
int32_t numstatements; // statement 0 is an error
int32_t ofs_statements;
int32_t numstatements; // statement 0 is an error
int32_t ofs_globaldefs;
int32_t numglobaldefs;
int32_t ofs_globaldefs;
int32_t numglobaldefs;
int32_t ofs_fielddefs;
int32_t numfielddefs;
int32_t ofs_fielddefs;
int32_t numfielddefs;
int32_t ofs_functions;
int32_t numfunctions; // function 0 is an empty
int32_t ofs_functions;
int32_t numfunctions; // function 0 is an empty
int32_t ofs_strings;
int32_t numstrings; // first string is a null string
int32_t ofs_strings;
int32_t numstrings; // first string is a null string
int32_t ofs_globals;
int32_t numglobals;
int32_t ofs_globals;
int32_t numglobals;
int32_t entityfields;
int32_t entityfields;
} dprograms_t;
#endif

View File

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef spingle__progs_h
#define spingle__progs_h
#include "pr_comp.h" /* defs shared with qcc */
#include "progdefs.h" /* generated by program cdefs */
#include "pr_comp.h" /* defs shared with qcc */
#include "progdefs.h" /* generated by program cdefs */
typedef union eval_s
{
@ -36,23 +36,23 @@ typedef union eval_s
int32_t edict;
} eval_t;
#define MAX_ENT_LEAFS 32
#define MAX_ENT_LEAFS 32
typedef struct edict_s
{
bool free;
link_t area; /* linked to a division node or leaf */
bool free;
link_t area; /* linked to a division node or leaf */
int32_t num_leafs;
int32_t leafnums[MAX_ENT_LEAFS];
int32_t num_leafs;
int32_t leafnums[MAX_ENT_LEAFS];
entity_state_t baseline;
uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
bool sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
entity_state_t baseline;
uint8_t alpha; /* johnfitz -- hack to support alpha since it's not part of entvars_t */
bool sendinterval; /* johnfitz -- send time until nextthink to client for better lerp timing */
float freetime; /* sv.time when the object was freed */
entvars_t v; /* C exported fields from progs */
float freetime; /* sv.time when the object was freed */
entvars_t v; /* C exported fields from progs */
/* other fields from progs come immediately after */
byte fields[];
} edict_t;
#define EDICT_FROM_AREA(l) (edict_t *)((byte *)l - offsetof(edict_t, area))
@ -98,23 +98,18 @@ void ED_LoadFromFile(const char *data);
edict_t *EDICT_NUM(int32_t n);
int32_t NUM_FOR_EDICT(edict_t *e);
#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size))
#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size))
#define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts)
#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
#define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts)
#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int32_t *)&pr_globals[o])
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
#define E_FLOAT(e,o) (((float*)&e->v)[o])
#define E_INT(e,o) (*(int32_t *)&((float*)&e->v)[o])
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int32_t *)&pr_globals[o])
#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int32_t *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
extern int32_t type_size[8];