mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
Make nq and qw use the new entity state struct.
This isn't really the best solution, but it does get things being shared with the minimum of fuss.
This commit is contained in:
parent
dea2f48477
commit
80bc0e9fb8
11 changed files with 30 additions and 28 deletions
|
@ -62,6 +62,8 @@ typedef struct entity_state_s {
|
|||
typedef struct {
|
||||
entity_state_t * const baseline;
|
||||
entity_state_t * const * const frame;
|
||||
const int num_frames;
|
||||
const int num_entities;
|
||||
} entstates_t;
|
||||
|
||||
extern entstates_t nq_entstates;
|
||||
|
|
|
@ -79,8 +79,8 @@ static entity_state_t * const qw_frames[64] = {
|
|||
&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};
|
||||
entstates_t nq_entstates = {&entity_states[0], nq_frames, 2, 32000};
|
||||
entstates_t qw_entstates = {&entity_states[0], qw_frames, 64, 512};
|
||||
|
||||
vec3_t ent_colormod[256] = {
|
||||
{0, 0, 0},
|
||||
|
|
|
@ -275,7 +275,6 @@ extern client_state_t cl;
|
|||
|
||||
// FIXME, allocate dynamically
|
||||
extern entity_t cl_entities[MAX_EDICTS];
|
||||
extern entity_state_t cl_entity_states[3][MAX_EDICTS];
|
||||
extern double cl_msgtime[MAX_EDICTS];
|
||||
extern byte cl_forcelink[MAX_EDICTS];
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include "server.h"
|
||||
|
||||
entity_t cl_entities[MAX_EDICTS];
|
||||
entity_state_t cl_entity_states[3][MAX_EDICTS];
|
||||
double cl_msgtime[MAX_EDICTS];
|
||||
byte cl_forcelink[MAX_EDICTS];
|
||||
|
||||
|
@ -63,7 +62,8 @@ CL_ClearEnts (void)
|
|||
|
||||
// clear other arrays
|
||||
memset (cl_entities, 0, sizeof (cl_entities));
|
||||
memset (cl_entity_states, 0, sizeof (cl_entity_states));
|
||||
i = nq_entstates.num_frames * nq_entstates.num_entities;
|
||||
memset (nq_entstates.frame[0], 0, i * sizeof (entity_state_t));
|
||||
memset (cl_msgtime, 0, sizeof (cl_msgtime));
|
||||
memset (cl_forcelink, 0, sizeof (cl_forcelink));
|
||||
|
||||
|
@ -320,8 +320,8 @@ CL_RelinkEntities (void)
|
|||
|
||||
// start on the entity after the world
|
||||
for (i = 1; i < cl.num_entities; i++) {
|
||||
new = &cl_entity_states[1 + cl.mindex][i];
|
||||
old = &cl_entity_states[2 - cl.mindex][i];
|
||||
new = &nq_entstates.frame[0 + cl.mindex][i];
|
||||
old = &nq_entstates.frame[1 - cl.mindex][i];
|
||||
ent = &cl_entities[i];
|
||||
// if the object wasn't included in the last packet, remove it
|
||||
if (cl_msgtime[i] != cl.mtime[0] || !new->modelindex) {
|
||||
|
|
|
@ -152,7 +152,7 @@ CL_EntityNum (int num)
|
|||
if (num >= cl.num_entities)
|
||||
cl.num_entities = num + 1;
|
||||
|
||||
return &cl_entity_states[0][num];
|
||||
return &nq_entstates.baseline[num];
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -486,7 +486,7 @@ CL_ParseUpdate (int bits)
|
|||
num = MSG_ReadByte (net_message);
|
||||
|
||||
baseline = CL_EntityNum (num);
|
||||
state = &cl_entity_states[1 + cl.mindex][num];
|
||||
state = &nq_entstates.frame[0 + cl.mindex][num];
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if (bits & (1 << i))
|
||||
|
|
|
@ -338,9 +338,8 @@ extern struct cvar_s *cl_fb_players;
|
|||
|
||||
extern client_state_t cl;
|
||||
|
||||
// FIXME, allocate dynamically
|
||||
extern entity_state_t cl_baselines[MAX_EDICTS];
|
||||
extern entity_t *cl_static_entities;
|
||||
extern entity_t cl_entities[512];
|
||||
|
||||
extern qboolean nomaster;
|
||||
extern char *server_version; // version of server we connected to
|
||||
|
|
|
@ -783,7 +783,7 @@ demo_start_recording (int track)
|
|||
// baselines
|
||||
memset (&blankes, 0, sizeof (blankes));
|
||||
for (i = 0; i < MAX_EDICTS; i++) {
|
||||
es = cl_baselines + i;
|
||||
es = qw_entstates.baseline + i;
|
||||
|
||||
if (memcmp (es, &blankes, sizeof (blankes))) {
|
||||
MSG_WriteByte (&buf, svc_spawnbaseline);
|
||||
|
|
|
@ -289,7 +289,8 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
if (newindex >= MAX_DEMO_PACKET_ENTITIES)
|
||||
Host_Error ("CL_ParsePacketEntities: newindex == "
|
||||
"MAX_DEMO_PACKET_ENTITIES");
|
||||
CL_ParseDelta (&cl_baselines[newnum], &newp->entities[newindex],
|
||||
CL_ParseDelta (&qw_entstates.baseline[newnum],
|
||||
&newp->entities[newindex],
|
||||
word);
|
||||
newindex++;
|
||||
continue;
|
||||
|
@ -301,7 +302,7 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
Sys_Printf ("WARNING: delta on full update");
|
||||
}
|
||||
if (word & U_REMOVE) { // Clear the entity
|
||||
entity_t *ent = &cl_packet_ents[newnum];
|
||||
entity_t *ent = &cl_entities[newnum];
|
||||
if (ent->efrag)
|
||||
r_funcs->R_RemoveEfrags (ent);
|
||||
memset (ent, 0, sizeof (entity_t));
|
||||
|
|
|
@ -59,15 +59,17 @@
|
|||
|
||||
entity_t cl_player_ents[MAX_CLIENTS];
|
||||
entity_t cl_flag_ents[MAX_CLIENTS];
|
||||
entity_t cl_packet_ents[512]; // FIXME: magic number
|
||||
entity_t cl_entities[512]; // FIXME: magic number
|
||||
|
||||
void
|
||||
CL_ClearEnts (void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof (cl_packet_ents) / sizeof (cl_packet_ents[0]); i++)
|
||||
CL_Init_Entity (&cl_packet_ents[i]);
|
||||
i = qw_entstates.num_frames * qw_entstates.num_entities;
|
||||
memset (qw_entstates.frame[0], 0, i * sizeof (entity_state_t));
|
||||
for (i = 0; i < sizeof (cl_entities) / sizeof (cl_entities[0]); i++)
|
||||
CL_Init_Entity (&cl_entities[i]);
|
||||
for (i = 0; i < sizeof (cl_flag_ents) / sizeof (cl_flag_ents[0]); i++)
|
||||
CL_Init_Entity (&cl_flag_ents[i]);
|
||||
for (i = 0; i < sizeof (cl_player_ents) / sizeof (cl_player_ents[0]); i++)
|
||||
|
@ -248,7 +250,7 @@ CL_LinkPacketEntities (void)
|
|||
CL_NewDlight (s1->number, s1->origin, s1->effects, s1->glow_size,
|
||||
s1->glow_color);
|
||||
|
||||
ent = &cl_packet_ents[s1->number];
|
||||
ent = &cl_entities[s1->number];
|
||||
|
||||
// if set to invisible, skip
|
||||
if (!s1->modelindex
|
||||
|
|
|
@ -186,7 +186,6 @@ static int cl_usleep_cache;
|
|||
|
||||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
entity_state_t cl_entities[UPDATE_BACKUP][MAX_DEMO_PACKET_ENTITIES];
|
||||
|
||||
entity_state_t cl_baselines[MAX_EDICTS];
|
||||
|
||||
|
@ -404,8 +403,7 @@ CL_ClearState (void)
|
|||
cl.fbskins = FBSKINS_DEFAULT;
|
||||
|
||||
for (i = 0; i < UPDATE_BACKUP; i++)
|
||||
cl.frames[i].packet_entities.entities = cl_entities[i];
|
||||
memset (cl_entities, 0, sizeof (cl_entities));
|
||||
cl.frames[i].packet_entities.entities = qw_entstates.frame[i];
|
||||
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
|
||||
|
||||
CL_Init_Entity (&cl.viewent);
|
||||
|
|
|
@ -752,13 +752,14 @@ CL_ClearBaselines (void)
|
|||
{
|
||||
int i;
|
||||
|
||||
memset (cl_baselines, 0, sizeof (cl_baselines));
|
||||
i = qw_entstates.num_entities;
|
||||
memset (qw_entstates.baseline, 0, i * sizeof (entity_state_t));
|
||||
for (i = 0; i < MAX_EDICTS; i++) {
|
||||
cl_baselines[i].colormod = 255;
|
||||
cl_baselines[i].alpha = 255;
|
||||
cl_baselines[i].scale = 16;
|
||||
cl_baselines[i].glow_size = 0;
|
||||
cl_baselines[i].glow_color = 254;
|
||||
qw_entstates.baseline[i].colormod = 255;
|
||||
qw_entstates.baseline[i].alpha = 255;
|
||||
qw_entstates.baseline[i].scale = 16;
|
||||
qw_entstates.baseline[i].glow_size = 0;
|
||||
qw_entstates.baseline[i].glow_color = 254;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1495,7 +1496,7 @@ CL_ParseServerMessage (void)
|
|||
|
||||
case svc_spawnbaseline:
|
||||
i = MSG_ReadShort (net_message);
|
||||
CL_ParseBaseline (&cl_baselines[i]);
|
||||
CL_ParseBaseline (&qw_entstates.baseline[i]);
|
||||
break;
|
||||
|
||||
case svc_temp_entity:
|
||||
|
|
Loading…
Reference in a new issue