Move entity_state_t into client/entities.h

Also, start working on the shared entity manager.
This commit is contained in:
Bill Currie 2012-06-28 19:18:14 +09:00
parent b65c41efcb
commit dea2f48477
4 changed files with 85 additions and 43 deletions

View file

@ -33,6 +33,40 @@
#include "QF/qtypes.h"
// entity_state_t is the information conveyed from the server
// in an update message
typedef struct entity_state_s {
int number; // edict index
unsigned flags; // nolerp, etc
vec3_t origin;
vec3_t angles;
unsigned short modelindex;
unsigned short frame;
int effects;
byte colormap;
byte skinnum;
// QSG 2
byte alpha;
byte scale;
byte glow_size;
byte glow_color;
byte colormod;
struct skin_s *skin; //FIXME this should not be here, but better state
//change tracking in the client is needed for this
//to be moved
} entity_state_t;
typedef struct {
entity_state_t * const baseline;
entity_state_t * const * const frame;
} entstates_t;
extern entstates_t nq_entstates;
extern entstates_t qw_entstates;
extern vec3_t ent_colormod[256];
#endif//__client_entities_h

View file

@ -300,31 +300,7 @@
// must be power of two
#define UPDATE_MASK (UPDATE_BACKUP-1)
// entity_state_t is the information conveyed from the server
// in an update message
typedef struct entity_state_s {
int number; // edict index
unsigned flags; // nolerp, etc
vec3_t origin;
vec3_t angles;
unsigned short modelindex;
unsigned short frame;
int effects;
byte colormap;
byte skinnum;
// QSG 2
byte alpha;
byte scale;
byte glow_size;
byte glow_color;
byte colormod;
struct skin_s *skin; //FIXME this should not be here, but better state
//change tracking in the client is needed for this
//to be moved
} entity_state_t;
#include "client/entities.h" // for entity_state_t
#define MAX_PACKET_ENTITIES 64 // doesn't count nails
#define MAX_DEMO_PACKET_ENTITIES 196 // doesn't count nails

View file

@ -33,6 +33,55 @@
#include "client/entities.h"
/* QW has a max of 512 entities and wants 64 frames of data per entity, plus
the baseline data (512 * (64 + 1) = 33280), but NQ has a max of 32000
entities and wants 2 frames of data per entity, plus the baseline data
(32000 * (2 + 1) = 96000)
*/
#define NUM_ENTITY_STATES 96000
static entity_state_t entity_states[NUM_ENTITY_STATES];
static entity_state_t * const nq_frames[2] = {
&entity_states[32000 * 1],
&entity_states[32000 * 2],
};
static entity_state_t * const qw_frames[64] = {
&entity_states[512 * 1], &entity_states[512 * 2],
&entity_states[512 * 3], &entity_states[512 * 4],
&entity_states[512 * 5], &entity_states[512 * 6],
&entity_states[512 * 7], &entity_states[512 * 8],
&entity_states[512 * 9], &entity_states[512 * 10],
&entity_states[512 * 11], &entity_states[512 * 12],
&entity_states[512 * 13], &entity_states[512 * 14],
&entity_states[512 * 15], &entity_states[512 * 16],
&entity_states[512 * 17], &entity_states[512 * 18],
&entity_states[512 * 19], &entity_states[512 * 20],
&entity_states[512 * 21], &entity_states[512 * 22],
&entity_states[512 * 23], &entity_states[512 * 24],
&entity_states[512 * 25], &entity_states[512 * 26],
&entity_states[512 * 27], &entity_states[512 * 28],
&entity_states[512 * 29], &entity_states[512 * 30],
&entity_states[512 * 31], &entity_states[512 * 32],
&entity_states[512 * 33], &entity_states[512 * 34],
&entity_states[512 * 35], &entity_states[512 * 36],
&entity_states[512 * 37], &entity_states[512 * 38],
&entity_states[512 * 39], &entity_states[512 * 40],
&entity_states[512 * 41], &entity_states[512 * 42],
&entity_states[512 * 43], &entity_states[512 * 44],
&entity_states[512 * 45], &entity_states[512 * 46],
&entity_states[512 * 47], &entity_states[512 * 48],
&entity_states[512 * 49], &entity_states[512 * 50],
&entity_states[512 * 51], &entity_states[512 * 52],
&entity_states[512 * 53], &entity_states[512 * 54],
&entity_states[512 * 55], &entity_states[512 * 56],
&entity_states[512 * 57], &entity_states[512 * 58],
&entity_states[512 * 59], &entity_states[512 * 60],
&entity_states[512 * 61], &entity_states[512 * 62],
&entity_states[512 * 63], &entity_states[512 * 64],
};
entstates_t nq_entstates = {&entity_states[0], nq_frames};
entstates_t qw_entstates = {&entity_states[0], qw_frames};
vec3_t ent_colormod[256] = {
{0, 0, 0},
{0, 0, 0.333333},

View file

@ -223,23 +223,6 @@
#define MAX_CLIENTS 16
// entity_state_t is the information conveyed from the server
// in an update message
typedef struct entity_state_s {
vec3_t origin;
vec3_t angles;
unsigned short modelindex;
unsigned short frame;
int effects;
byte colormap;
byte skinnum;
// QSG 2
byte alpha;
byte scale;
byte glow_size;
byte glow_color;
byte colormod;
} entity_state_t;
#include "client/entities.h" // for entity_state_t
#endif // __protocol_h