re-think edict_t. this is going to massivly break things for a while, but

tough, progs should never have known about entity_state_t in the first place.
Nor should it have been mod spefic.
This commit is contained in:
Bill Currie 2001-02-28 01:59:31 +00:00
parent e5543eb0a6
commit 9f2dacd2e1
5 changed files with 8 additions and 66 deletions

View file

@ -30,6 +30,7 @@
#define _PROGS_H
#include "link.h"
#include "pr_comp.h"
typedef union eval_s
{
@ -57,14 +58,8 @@ typedef struct edict_s
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
entity_state_t baseline;
float freetime; // sv.time when the object was freed
union {
entvars_t v; // C exported fields from progs
pr_type_t vv[1];
} v;
// other fields from progs come immediately after
pr_type_t v[1]; // fields from progs
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
@ -192,7 +187,6 @@ struct progs_s {
ddef_t *pr_globaldefs;
ddef_t *pr_fielddefs;
dstatement_t *pr_statements;
globalvars_t *pr_global_struct;
pr_type_t *pr_globals; // same as pr_global_struct
int pr_edict_size; // in bytes
@ -215,6 +209,7 @@ struct progs_s {
edict_t **edicts;
int *num_edicts;
int *max_edicts;
double *time;
int null_bad;

View file

@ -44,8 +44,8 @@
#include "qdefs.h"
#include "qendian.h"
#include "quakefs.h"
#include "server.h"
#include "world.h"
#include "zone.h"
#include "va.h"
cvar_t *pr_boundscheck;
@ -136,18 +136,8 @@ ED_Free (progs_t *pr, edict_t *ed)
if (pr->unlink)
pr->unlink (ed); // unlink from world bsp
ED_ClearEdict (pr, ed);
ed->free = true;
ed->v.v.model = 0;
ed->v.v.takedamage = 0;
ed->v.v.modelindex = 0;
ed->v.v.colormap = 0;
ed->v.v.skin = 0;
ed->v.v.frame = 0;
VectorCopy (vec3_origin, ed->v.v.origin);
VectorCopy (vec3_origin, ed->v.v.angles);
ed->v.v.nextthink = -1;
ed->v.v.solid = 0;
ed->freetime = *(pr)->time;
}
@ -952,12 +942,11 @@ PR_LoadProgs (progs_t *pr, char *progsname)
pr->num_prstr = 0;
pr->pr_global_struct = (globalvars_t *) ((byte *) pr->progs + pr->progs->ofs_globals);
pr->pr_globals = (pr_type_t *) pr->pr_global_struct;
pr->pr_globals = (pr_type_t *) ((byte *) pr->progs + pr->progs->ofs_globals);
pr->pr_edict_size =
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (entvars_t);
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (pr_type_t);
pr->pr_edictareasize = pr->pr_edict_size * MAX_EDICTS;

View file

@ -1,42 +0,0 @@
/*
va.h
Definitions common to client and server.
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 2000 Marcus Sundberg <mackan@stacken.kth.se>
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$
*/
#ifndef __va_h
#define __va_h
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "gcc_attr.h"
char *va(char *format, ...) __attribute__((format(printf,1,2)));
// does a varargs printf into a temp buffer
#endif // __va_h