diff --git a/include/client/entities.h b/include/client/entities.h index 1dba394d6..45420cbb7 100644 --- a/include/client/entities.h +++ b/include/client/entities.h @@ -40,9 +40,11 @@ typedef struct entity_state_s { unsigned flags; // nolerp, etc vec3_t origin; + vec3_t velocity; vec3_t angles; - unsigned short modelindex; - unsigned short frame; + uint16_t modelindex; + uint16_t frame; + int weaponframe; int effects; byte colormap; byte skinnum; diff --git a/include/qw/protocol.h b/include/qw/protocol.h index 76f2c625d..9fb818d37 100644 --- a/include/qw/protocol.h +++ b/include/qw/protocol.h @@ -320,26 +320,9 @@ typedef struct usercmd_s { } usercmd_t; typedef struct plent_state_s { - int number; - - unsigned int flags; - vec3_t origin; + entity_state_t es; usercmd_t cmd; - vec3_t velocity; - int modelindex; - int frame; - int skinnum; - int effects; - int weaponframe; - byte msec; - - // QSG 2 - byte alpha; - byte scale; - byte glow_size; - byte glow_color; - byte colormod; } plent_state_t; typedef struct { diff --git a/qtv/source/client.c b/qtv/source/client.c index c55e57bd2..6da363953 100644 --- a/qtv/source/client.c +++ b/qtv/source/client.c @@ -446,9 +446,9 @@ spectator_move (client_t *cl, usercmd_t *ucmd) AngleVectors (cl->state.cmd.angles, forward, right, up); - speed = DotProduct (cl->state.velocity, cl->state.velocity); + speed = DotProduct (cl->state.es.velocity, cl->state.es.velocity); if (speed < 1) { - VectorZero (cl->state.velocity); + VectorZero (cl->state.es.velocity); } else { speed = sqrt (speed); drop = 0; @@ -462,7 +462,7 @@ spectator_move (client_t *cl, usercmd_t *ucmd) newspeed = 0; newspeed /= speed; - VectorScale (cl->state.velocity, newspeed, cl->state.velocity); + VectorScale (cl->state.es.velocity, newspeed, cl->state.es.velocity); } fmove = ucmd->forwardmove; @@ -484,7 +484,7 @@ spectator_move (client_t *cl, usercmd_t *ucmd) wishspeed = sv->movevars.spectatormaxspeed; } - currentspeed = DotProduct (cl->state.velocity, wishdir); + currentspeed = DotProduct (cl->state.es.velocity, wishdir); addspeed = wishspeed - currentspeed; if (addspeed <= 0) return; @@ -492,10 +492,10 @@ spectator_move (client_t *cl, usercmd_t *ucmd) if (accelspeed > addspeed) accelspeed = addspeed; - VectorMultAdd (cl->state.velocity, accelspeed, wishdir, - cl->state.velocity); - VectorMultAdd (cl->state.origin, frametime, cl->state.velocity, - cl->state.origin); + VectorMultAdd (cl->state.es.velocity, accelspeed, wishdir, + cl->state.es.velocity); + VectorMultAdd (cl->state.es.origin, frametime, cl->state.es.velocity, + cl->state.es.origin); } static void @@ -612,7 +612,7 @@ client_parse_message (client_t *cl) break; case clc_tmove: MSG_ReadCoordV (net_message, o); - VectorCopy (o, cl->state.origin); + VectorCopy (o, cl->state.es.origin); break; case clc_upload: size = MSG_ReadShort (net_message); @@ -627,18 +627,18 @@ static void write_player (int num, plent_state_t *pl, server_t *sv, sizebuf_t *msg) { int i; - int pflags = (pl->flags & (PF_GIB | PF_DEAD)) + int pflags = (pl->es.flags & (PF_GIB | PF_DEAD)) | PF_MSEC | PF_COMMAND; int qf_bits = 0; - if (pl->modelindex != sv->playermodel) + if (pl->es.modelindex != sv->playermodel) pflags |= PF_MODEL; for (i = 0; i < 3; i++) - if (pl->velocity[i]) + if (pl->es.velocity[i]) pflags |= PF_VELOCITY1 << i; - if (pl->effects & 0xff) + if (pl->es.effects & 0xff) pflags |= PF_EFFECTS; - if (pl->skinnum) + if (pl->es.skinnum) pflags |= PF_SKINNUM; qf_bits = 0; @@ -670,21 +670,21 @@ write_player (int num, plent_state_t *pl, server_t *sv, sizebuf_t *msg) // } else if (ent == clent) { // // don't send a lot of data on personal entity // pflags &= ~(PF_MSEC | PF_COMMAND); -// if (pl->weaponframe) +// if (pl->es.weaponframe) // pflags |= PF_WEAPONFRAME; // } // if (client->spec_track && client->spec_track - 1 == j -// && pl->weaponframe) +// && pl->es.weaponframe) // pflags |= PF_WEAPONFRAME; MSG_WriteByte (msg, svc_playerinfo); MSG_WriteByte (msg, num); MSG_WriteShort (msg, pflags); - MSG_WriteCoordV (msg, pl->origin); + MSG_WriteCoordV (msg, pl->es.origin); - MSG_WriteByte (msg, pl->frame); + MSG_WriteByte (msg, pl->es.frame); if (pflags & PF_MSEC) { //msec = 1000 * (sv.time - cl->localtime); @@ -699,36 +699,36 @@ write_player (int num, plent_state_t *pl, server_t *sv, sizebuf_t *msg) for (i = 0; i < 3; i++) if (pflags & (PF_VELOCITY1 << i)) - MSG_WriteShort (msg, pl->velocity[i]); + MSG_WriteShort (msg, pl->es.velocity[i]); if (pflags & PF_MODEL) - MSG_WriteByte (msg, pl->modelindex); + MSG_WriteByte (msg, pl->es.modelindex); if (pflags & PF_SKINNUM) - MSG_WriteByte (msg, pl->skinnum); + MSG_WriteByte (msg, pl->es.skinnum); if (pflags & PF_EFFECTS) - MSG_WriteByte (msg, pl->effects); + MSG_WriteByte (msg, pl->es.effects); if (pflags & PF_WEAPONFRAME) - MSG_WriteByte (msg, pl->weaponframe); + MSG_WriteByte (msg, pl->es.weaponframe); if (pflags & PF_QF) { MSG_WriteByte (msg, qf_bits); if (qf_bits & PF_ALPHA) - MSG_WriteByte (msg, pl->alpha); + MSG_WriteByte (msg, pl->es.alpha); if (qf_bits & PF_SCALE) - MSG_WriteByte (msg, pl->scale); + MSG_WriteByte (msg, pl->es.scale); if (qf_bits & PF_EFFECTS2) - MSG_WriteByte (msg, pl->effects >> 8); + MSG_WriteByte (msg, pl->es.effects >> 8); if (qf_bits & PF_GLOWSIZE) - MSG_WriteByte (msg, pl->scale); + MSG_WriteByte (msg, pl->es.glow_size); if (qf_bits & PF_GLOWCOLOR) - MSG_WriteByte (msg, pl->glow_color); + MSG_WriteByte (msg, pl->es.glow_color); if (qf_bits & PF_COLORMOD) - MSG_WriteByte (msg, pl->colormod); + MSG_WriteByte (msg, pl->es.colormod); if (qf_bits & PF_FRAME2) - MSG_WriteByte (msg, pl->frame >> 8); + MSG_WriteByte (msg, pl->es.frame >> 8); } } #if 0 diff --git a/qtv/source/sv_parse.c b/qtv/source/sv_parse.c index 493aa613a..268e9999d 100644 --- a/qtv/source/sv_parse.c +++ b/qtv/source/sv_parse.c @@ -514,9 +514,9 @@ parse_player_delta (qmsg_t *msg, plent_state_t *from, plent_state_t *to) int i; int flags; - flags = to->flags = MSG_ReadShort (msg); - MSG_ReadCoordV (msg, to->origin); - to->frame = (to->frame & 0xff00) | MSG_ReadByte (msg); + flags = to->es.flags = MSG_ReadShort (msg); + MSG_ReadCoordV (msg, to->es.origin); + to->es.frame = (to->es.frame & 0xff00) | MSG_ReadByte (msg); if (flags & PF_MSEC) to->msec = MSG_ReadByte (msg); // qtv_printf ("%02x\n", msg->message->data[msg->readcount]); @@ -524,36 +524,36 @@ parse_player_delta (qmsg_t *msg, plent_state_t *from, plent_state_t *to) MSG_ReadDeltaUsercmd (msg, &from->cmd, &to->cmd); for (i = 0; i < 3; i++) { if (flags & (PF_VELOCITY1 << i)) - to->velocity[i] = (short) MSG_ReadShort (msg); + to->es.velocity[i] = (short) MSG_ReadShort (msg); } if (flags & PF_MODEL) - to->modelindex = MSG_ReadByte (msg); + to->es.modelindex = MSG_ReadByte (msg); if (flags & PF_SKINNUM) - to->skinnum = MSG_ReadByte (msg); + to->es.skinnum = MSG_ReadByte (msg); if (flags & PF_EFFECTS) - to->effects = (to->effects & 0xff00) | MSG_ReadByte (msg); + to->es.effects = (to->es.effects & 0xff00) | MSG_ReadByte (msg); if (flags & PF_WEAPONFRAME) - to->weaponframe = MSG_ReadByte (msg); + to->es.weaponframe = MSG_ReadByte (msg); if (flags & PF_QF) { int bits; bits = MSG_ReadByte (msg); if (bits & PF_ALPHA) - to->alpha = MSG_ReadByte (msg); + to->es.alpha = MSG_ReadByte (msg); if (bits & PF_SCALE) - to->scale = MSG_ReadByte (msg); + to->es.scale = MSG_ReadByte (msg); if (bits & PF_EFFECTS2) - to->effects = (to->effects & 0x00ff) - | (MSG_ReadByte (msg) << 8); + to->es.effects = (to->es.effects & 0x00ff) + | (MSG_ReadByte (msg) << 8); if (bits & PF_GLOWSIZE) - to->glow_size = MSG_ReadByte (msg); + to->es.glow_size = MSG_ReadByte (msg); if (bits & PF_GLOWCOLOR) - to->glow_color = MSG_ReadByte (msg); + to->es.glow_color = MSG_ReadByte (msg); if (bits & PF_COLORMOD) - to->colormod = MSG_ReadByte (msg); + to->es.colormod = MSG_ReadByte (msg); if (bits & PF_FRAME2) - to->frame = (to->frame & 0xff) - | (MSG_ReadByte (msg) << 8); + to->es.frame = (to->es.frame & 0xff) + | (MSG_ReadByte (msg) << 8); } } @@ -567,12 +567,12 @@ sv_playerinfo (server_t *sv, qmsg_t *msg) int fromind, toind; static plent_state_t null_player_state; - if (!null_player_state.alpha) { - null_player_state.alpha = 255; - null_player_state.scale = 16; - null_player_state.glow_size = 0; - null_player_state.glow_color = 254; - null_player_state.colormod = 255; + if (!null_player_state.es.alpha) { + null_player_state.es.alpha = 255; + null_player_state.es.scale = 16; + null_player_state.es.glow_size = 0; + null_player_state.es.glow_color = 254; + null_player_state.es.colormod = 255; } fromind = MSG_ReadByte (msg); toind = sv->netchan.incoming_sequence & UPDATE_MASK; diff --git a/qw/source/cl_cam.c b/qw/source/cl_cam.c index 5a7f0d486..91e7a44eb 100644 --- a/qw/source/cl_cam.c +++ b/qw/source/cl_cam.c @@ -218,23 +218,23 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec, vectoangles (vec, v); VectorCopy (v, pmove.angles); VectorNormalize (vec); - VectorMultAdd (player->pls.origin, 800, vec, v); + VectorMultAdd (player->pls.es.origin, 800, vec, v); // v is endpos // fake a player move - trace = Cam_DoTrace (player->pls.origin, v); + trace = Cam_DoTrace (player->pls.es.origin, v); if ( /* trace.inopen || */ trace.inwater) return 9999; VectorCopy (trace.endpos, vec); - len = VectorDistance (trace.endpos, player->pls.origin); + len = VectorDistance (trace.endpos, player->pls.es.origin); if (len < 32 || len > 800) return 9999; if (checkvis) { - trace = Cam_DoTrace (self->pls.origin, vec); + trace = Cam_DoTrace (self->pls.es.origin, vec); if (trace.fraction != 1 || trace.inwater) return 9999; - len = VectorDistance (trace.endpos, self->pls.origin); + len = VectorDistance (trace.endpos, self->pls.es.origin); } return len; @@ -248,11 +248,11 @@ Cam_IsVisible (player_state_t * player, vec3_t vec) trace_t trace; vec3_t v; - trace = Cam_DoTrace (player->pls.origin, vec); + trace = Cam_DoTrace (player->pls.es.origin, vec); if (trace.fraction != 1 || /* trace.inopen || */ trace.inwater) return false; // check distance, don't let the player get too far away or too close - VectorSubtract (player->pls.origin, vec, v); + VectorSubtract (player->pls.es.origin, vec, v); d = VectorLength (v); return (d > 16.0); @@ -440,22 +440,22 @@ Cam_Track (usercmd_t *cmd) cmd->forwardmove = cmd->sidemove = cmd->upmove = 0; VectorCopy (player->viewangles, cl.viewangles); - VectorCopy (player->pls.origin, desired_position); - if (memcmp (&desired_position, &self->pls.origin, + VectorCopy (player->pls.es.origin, desired_position); + if (memcmp (&desired_position, &self->pls.es.origin, sizeof (desired_position)) != 0) { if (!cls.demoplayback) { MSG_WriteByte (&cls.netchan.message, clc_tmove); MSG_WriteCoordV (&cls.netchan.message, desired_position); } // move there locally immediately - VectorCopy (desired_position, self->pls.origin); + VectorCopy (desired_position, self->pls.es.origin); } - self->pls.weaponframe = player->pls.weaponframe; + self->pls.es.weaponframe = player->pls.es.weaponframe; } else { // Ok, move to our desired position and set our angles to view // the player - VectorSubtract (desired_position, self->pls.origin, vec); + VectorSubtract (desired_position, self->pls.es.origin, vec); len = VectorLength (vec); cmd->forwardmove = cmd->sidemove = cmd->upmove = 0; if (len > 16) { // close enough? @@ -465,9 +465,9 @@ Cam_Track (usercmd_t *cmd) } } // move there locally immediately - VectorCopy (desired_position, self->pls.origin); + VectorCopy (desired_position, self->pls.es.origin); - VectorSubtract (player->pls.origin, desired_position, vec); + VectorSubtract (player->pls.es.origin, desired_position, vec); vectoangles (vec, cl.viewangles); cl.viewangles[0] = -cl.viewangles[0]; } @@ -520,7 +520,7 @@ Cam_SetView (void) player = frame->playerstate + spec_track; self = frame->playerstate + cl.playernum; - VectorSubtract (player->pls.origin, cl.simorg, vec); + VectorSubtract (player->pls.es.origin, cl.simorg, vec); if (cam_forceview) { cam_forceview = false; vectoangles (vec, cam_viewangles); @@ -560,7 +560,7 @@ Cam_FinishMove (usercmd_t *cmd) player = frame->playerstate + spec_track; self = frame->playerstate + cl.playernum; - VectorSubtract (player->pls.origin, self->pls.origin, vec); + VectorSubtract (player->pls.es.origin, self->pls.es.origin, vec); if (cam_forceview) { cam_forceview = false; vectoangles (vec, cam_viewangles); diff --git a/qw/source/cl_entparse.c b/qw/source/cl_entparse.c index ac7f0ae21..b1b5d3386 100644 --- a/qw/source/cl_entparse.c +++ b/qw/source/cl_entparse.c @@ -360,7 +360,7 @@ CL_ParseDemoPlayerinfo (int num) info = &cl.players[num]; state = &cl.frames[parsecountmod].playerstate[num]; - state->pls.number = num; + state->pls.es.number = num; if (info->prevcount > cl.parsecount || !cl.parsecount) { prevstate = &dummy; @@ -383,25 +383,25 @@ CL_ParseDemoPlayerinfo (int num) memcpy (state, prevstate, sizeof (player_state_t)); flags = MSG_ReadShort (net_message); - state->pls.flags = TranslateFlags (flags); + state->pls.es.flags = TranslateFlags (flags); state->messagenum = cl.parsecount; state->pls.cmd.msec = 0; - state->pls.frame = MSG_ReadByte (net_message); + state->pls.es.frame = MSG_ReadByte (net_message); state->state_time = parsecounttime; for (i=0; i <3; i++) if (flags & (DF_ORIGIN << i)) - state->pls.origin[i] = MSG_ReadCoord (net_message); + state->pls.es.origin[i] = MSG_ReadCoord (net_message); for (i=0; i <3; i++) if (flags & (DF_ANGLES << i)) state->pls.cmd.angles[i] = MSG_ReadAngle16 (net_message); if (flags & DF_MODEL) - state->pls.modelindex = MSG_ReadByte (net_message); + state->pls.es.modelindex = MSG_ReadByte (net_message); if (flags & DF_SKINNUM) - state->pls.skinnum = MSG_ReadByte (net_message); + state->pls.es.skinnum = MSG_ReadByte (net_message); if (flags & DF_EFFECTS) - state->pls.effects = MSG_ReadByte (net_message); + state->pls.es.effects = MSG_ReadByte (net_message); if (flags & DF_WEAPONFRAME) - state->pls.weaponframe = MSG_ReadByte (net_message); + state->pls.es.weaponframe = MSG_ReadByte (net_message); VectorCopy (state->pls.cmd.angles, state->viewangles); } @@ -422,14 +422,14 @@ CL_ParsePlayerinfo (void) state = &cl.frames[parsecountmod].playerstate[num]; - state->pls.number = num; + state->pls.es.number = num; - flags = state->pls.flags = MSG_ReadShort (net_message); + flags = state->pls.es.flags = MSG_ReadShort (net_message); state->messagenum = cl.parsecount; - MSG_ReadCoordV (net_message, state->pls.origin); + MSG_ReadCoordV (net_message, state->pls.es.origin); - state->pls.frame = MSG_ReadByte (net_message); + state->pls.es.frame = MSG_ReadByte (net_message); // the other player's last move was likely some time // before the packet was sent out, so accurately track @@ -445,30 +445,30 @@ CL_ParsePlayerinfo (void) for (i = 0; i < 3; i++) { if (flags & (PF_VELOCITY1 << i)) - state->pls.velocity[i] = (short) MSG_ReadShort (net_message); + state->pls.es.velocity[i] = (short) MSG_ReadShort (net_message); else - state->pls.velocity[i] = 0; + state->pls.es.velocity[i] = 0; } if (flags & PF_MODEL) i = MSG_ReadByte (net_message); else i = cl_playerindex; - state->pls.modelindex = i; + state->pls.es.modelindex = i; if (flags & PF_SKINNUM) - state->pls.skinnum = MSG_ReadByte (net_message); + state->pls.es.skinnum = MSG_ReadByte (net_message); else - state->pls.skinnum = 0; + state->pls.es.skinnum = 0; if (flags & PF_EFFECTS) - state->pls.effects = MSG_ReadByte (net_message); + state->pls.es.effects = MSG_ReadByte (net_message); else - state->pls.effects = 0; + state->pls.es.effects = 0; if (flags & PF_WEAPONFRAME) - state->pls.weaponframe = MSG_ReadByte (net_message); + state->pls.es.weaponframe = MSG_ReadByte (net_message); else - state->pls.weaponframe = 0; + state->pls.es.weaponframe = 0; VectorCopy (state->pls.cmd.angles, state->viewangles); @@ -489,13 +489,13 @@ CL_ParsePlayerinfo (void) ent->scale = val / 16.0; } if (bits & PF_EFFECTS2) { - state->pls.effects |= MSG_ReadByte (net_message) << 8; + state->pls.es.effects |= MSG_ReadByte (net_message) << 8; } if (bits & PF_GLOWSIZE) { - state->pls.glow_size = MSG_ReadByte (net_message); + state->pls.es.glow_size = MSG_ReadByte (net_message); } if (bits & PF_GLOWCOLOR) { - state->pls.glow_color = MSG_ReadByte (net_message); + state->pls.es.glow_color = MSG_ReadByte (net_message); } if (bits & PF_COLORMOD) { float r = 1.0, g = 1.0, b = 1.0; @@ -508,7 +508,7 @@ CL_ParsePlayerinfo (void) VectorSet (r, g, b, ent->renderer.colormod); } if (bits & PF_FRAME2) { - state->pls.frame |= MSG_ReadByte (net_message) << 8; + state->pls.es.frame |= MSG_ReadByte (net_message) << 8; } } } @@ -599,22 +599,23 @@ CL_SetUpPlayerPrediction (qboolean dopred) if (state->messagenum != cl.parsecount) continue; // not present this frame - if (!state->pls.modelindex) + if (!state->pls.es.modelindex) continue; pplayer->active = true; - pplayer->flags = state->pls.flags; + pplayer->flags = state->pls.es.flags; // note that the local player is special, since he moves locally // we use his last predicted postition if (j == cl.playernum) { VectorCopy (cl.frames[cls.netchan.outgoing_sequence & UPDATE_MASK]. - playerstate[cl.playernum].pls.origin, pplayer->origin); + playerstate[cl.playernum].pls.es.origin, + pplayer->origin); } else { // predict only half the move to minimize overruns msec = 500 * (playertime - state->state_time); if (msec <= 0 || !dopred) { - VectorCopy (state->pls.origin, pplayer->origin); + VectorCopy (state->pls.es.origin, pplayer->origin); // Sys_MaskPrintf (SYS_DEV, "nopredict\n"); } else { // predict players movement @@ -622,7 +623,7 @@ CL_SetUpPlayerPrediction (qboolean dopred) // Sys_MaskPrintf (SYS_DEV, "predict: %i\n", msec); CL_PredictUsercmd (state, &exact, &state->pls.cmd, false); - VectorCopy (exact.pls.origin, pplayer->origin); + VectorCopy (exact.pls.es.origin, pplayer->origin); } } } diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index 757cc7e56..1e8ab80d9 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -349,7 +349,7 @@ static void CL_LinkPlayers (void) { double playertime; - int msec, oldphysent, i, j; + int msec, oldphysent, j; entity_t *ent; frame_t *frame; player_info_t *info; @@ -381,7 +381,7 @@ CL_LinkPlayers (void) r_data->player_entity = &cl_player_ents[j]; clientplayer = true; } else { - VectorCopy (state->pls.origin, org); + VectorCopy (state->pls.es.origin, org); clientplayer = false; } if (info->chat && info->chat->value[0] != '0') { @@ -391,28 +391,28 @@ CL_LinkPlayers (void) dl->die = cl.time + 0.1; QuatSet (0.0, 1.0, 0.0, 1.0, dl->color); } else { - CL_NewDlight (j + 1, org, state->pls.effects, state->pls.glow_size, - state->pls.glow_color, cl.time); + CL_NewDlight (j + 1, org, state->pls.es.effects, + state->pls.es.glow_size, state->pls.es.glow_color, + cl.time); } // Draw player? if (!Cam_DrawPlayer (j)) continue; - if (!state->pls.modelindex) + if (!state->pls.es.modelindex) continue; // Hack hack hack if (cl_deadbodyfilter->int_val - && state->pls.modelindex == cl_playerindex - && ((i = state->pls.frame) == 49 || i == 60 || i == 69 || i == 84 - || i == 93 || i == 102)) + && state->pls.es.modelindex == cl_playerindex + && is_dead_body (&state->pls.es)) continue; // predict only half the move to minimize overruns msec = 500 * (playertime - state->state_time); if (msec <= 0 || (!cl_predict_players->int_val) || cls.demoplayback2) { - VectorCopy (state->pls.origin, ent->origin); + VectorCopy (state->pls.es.origin, ent->origin); } else { // predict players movement state->pls.cmd.msec = msec = min (msec, 255); @@ -420,7 +420,7 @@ CL_LinkPlayers (void) CL_SetSolidPlayers (j); CL_PredictUsercmd (state, &exact, &state->pls.cmd, clientplayer); pmove.numphysent = oldphysent; - VectorCopy (exact.pls.origin, ent->origin); + VectorCopy (exact.pls.es.origin, ent->origin); } // angles @@ -432,18 +432,18 @@ CL_LinkPlayers (void) ang[PITCH] = -state->viewangles[PITCH] / 3.0; ang[YAW] = state->viewangles[YAW]; } - ang[ROLL] = V_CalcRoll (ang, state->pls.velocity) * 4.0; + ang[ROLL] = V_CalcRoll (ang, state->pls.es.velocity) * 4.0; - ent->renderer.model = cl.model_precache[state->pls.modelindex]; - ent->animation.frame = state->pls.frame; - ent->renderer.skinnum = state->pls.skinnum; + ent->renderer.model = cl.model_precache[state->pls.es.modelindex]; + ent->animation.frame = state->pls.es.frame; + ent->renderer.skinnum = state->pls.es.skinnum; CL_TransformEntity (ent, ang); ent->renderer.min_light = 0; ent->renderer.fullbright = 0; - if (state->pls.modelindex == cl_playerindex) { //XXX + if (state->pls.es.modelindex == cl_playerindex) { //XXX // use custom skin ent->renderer.skin = info->skin; @@ -460,9 +460,9 @@ CL_LinkPlayers (void) // stuff entity in map r_funcs->R_AddEfrags (&cl.worldmodel->brush, ent); - if (state->pls.effects & EF_FLAG1) + if (state->pls.es.effects & EF_FLAG1) CL_AddFlagModels (ent, 0, j); - else if (state->pls.effects & EF_FLAG2) + else if (state->pls.es.effects & EF_FLAG2) CL_AddFlagModels (ent, 1, j); } } diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 656d6eb57..ea143c9ae 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1631,8 +1631,8 @@ Host_Frame (float time) oldself = &cl.frames[(cls.netchan.outgoing_sequence - 1) & UPDATE_MASK].playerstate[cl.playernum]; self->messagenum = cl.parsecount; - VectorCopy (oldself->pls.origin, self->pls.origin); - VectorCopy (oldself->pls.velocity, self->pls.velocity); + VectorCopy (oldself->pls.es.origin, self->pls.es.origin); + VectorCopy (oldself->pls.es.velocity, self->pls.es.velocity); VectorCopy (oldself->viewangles, self->viewangles); CL_ParseClientdata (); diff --git a/qw/source/cl_pred.c b/qw/source/cl_pred.c index 1ac6e5ca1..1fe115949 100644 --- a/qw/source/cl_pred.c +++ b/qw/source/cl_pred.c @@ -51,10 +51,10 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u, qboolean clientplayer) { if (!clientplayer) { - if (VectorIsZero (from->pls.velocity)) { - VectorCopy (from->pls.origin, to->pls.origin); + if (VectorIsZero (from->pls.es.velocity)) { + VectorCopy (from->pls.es.origin, to->pls.es.origin); VectorCopy (u->angles, to->viewangles); - VectorCopy (from->pls.velocity, to->pls.velocity); + VectorCopy (from->pls.es.velocity, to->pls.es.velocity); return; } } @@ -72,9 +72,9 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u, return; } - VectorCopy (from->pls.origin, pmove.origin); + VectorCopy (from->pls.es.origin, pmove.origin); VectorCopy (u->angles, pmove.angles); - VectorCopy (from->pls.velocity, pmove.velocity); + VectorCopy (from->pls.es.velocity, pmove.velocity); pmove.oldbuttons = from->oldbuttons; pmove.oldonground = from->oldonground; @@ -92,11 +92,11 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u, to->waterjumptime = pmove.waterjumptime; to->oldbuttons = pmove.oldbuttons; // Tonik to->oldonground = pmove.oldonground; - VectorCopy (pmove.origin, to->pls.origin); + VectorCopy (pmove.origin, to->pls.es.origin); VectorCopy (pmove.angles, to->viewangles); - VectorCopy (pmove.velocity, to->pls.velocity); + VectorCopy (pmove.velocity, to->pls.es.velocity); to->onground = onground; - to->pls.weaponframe = from->pls.weaponframe; + to->pls.es.weaponframe = from->pls.es.weaponframe; } void @@ -137,8 +137,8 @@ CL_PredictMove (void) from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK]; if (!cl_predict->int_val) { - VectorCopy (from->playerstate[cl.playernum].pls.velocity, cl.simvel); - VectorCopy (from->playerstate[cl.playernum].pls.origin, cl.simorg); + VectorCopy (from->playerstate[cl.playernum].pls.es.velocity, cl.simvel); + VectorCopy (from->playerstate[cl.playernum].pls.es.origin, cl.simorg); return; } @@ -175,21 +175,22 @@ CL_PredictMove (void) } for (i = 0; i < 3; i++) - if (fabs (from->playerstate[cl.playernum].pls.origin[i] - - to->playerstate[cl.playernum].pls.origin[i]) > 128) { + if (fabs (from->playerstate[cl.playernum].pls.es.origin[i] - + to->playerstate[cl.playernum].pls.es.origin[i]) > 128) { // teleported, so don't lerp - VectorCopy (to->playerstate[cl.playernum].pls.velocity, cl.simvel); - VectorCopy (to->playerstate[cl.playernum].pls.origin, cl.simorg); + VectorCopy (to->playerstate[cl.playernum].pls.es.velocity, + cl.simvel); + VectorCopy (to->playerstate[cl.playernum].pls.es.origin, cl.simorg); return; } for (i = 0; i < 3; i++) { - cl.simorg[i] = from->playerstate[cl.playernum].pls.origin[i] + - f * (to->playerstate[cl.playernum].pls.origin[i] - - from->playerstate[cl.playernum].pls.origin[i]); - cl.simvel[i] = from->playerstate[cl.playernum].pls.velocity[i] + - f * (to->playerstate[cl.playernum].pls.velocity[i] - - from->playerstate[cl.playernum].pls.velocity[i]); + cl.simorg[i] = from->playerstate[cl.playernum].pls.es.origin[i] + + f * (to->playerstate[cl.playernum].pls.es.origin[i] - + from->playerstate[cl.playernum].pls.es.origin[i]); + cl.simvel[i] = from->playerstate[cl.playernum].pls.es.velocity[i] + + f * (to->playerstate[cl.playernum].pls.es.velocity[i] - + from->playerstate[cl.playernum].pls.es.velocity[i]); } } diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index 763de6767..3b1ca0688 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -600,7 +600,7 @@ V_CalcViewRoll (void) v_dmg_time -= host_frametime; } - if (view_state->pls.flags & PF_DEAD) // PF_GIB will also set PF_DEAD + if (view_state->pls.es.flags & PF_DEAD) // PF_GIB will also set PF_DEAD r_data->refdef->viewangles[ROLL] = 80; // dead view angle } @@ -700,12 +700,12 @@ V_CalcRefdef (void) else if (r_data->scr_viewsize->int_val == 80) view->origin[2] += 0.5; - if (view_state->pls.flags & (PF_GIB | PF_DEAD)) { + if (view_state->pls.es.flags & (PF_GIB | PF_DEAD)) { view->renderer.model = NULL; } else { view->renderer.model = cl.model_precache[cl.stats[STAT_WEAPON]]; } - view->animation.frame = view_state->pls.weaponframe; + view->animation.frame = view_state->pls.es.weaponframe; view->renderer.skin = 0; // set up the refresh position @@ -757,9 +757,9 @@ V_RenderView (void) view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK]; view_state = &view_frame->playerstate[cl.playernum]; - if (view_state->pls.flags & PF_GIB) + if (view_state->pls.es.flags & PF_GIB) cl.viewheight = 8; // gib view height - else if (view_state->pls.flags & PF_DEAD) + else if (view_state->pls.es.flags & PF_DEAD) cl.viewheight = -16; // corpse view height else { cl.viewheight = DEFAULT_VIEWHEIGHT; // view height diff --git a/qw/source/sv_ents.c b/qw/source/sv_ents.c index a5d6b4db9..50c7a3d97 100644 --- a/qw/source/sv_ents.c +++ b/qw/source/sv_ents.c @@ -400,7 +400,7 @@ write_demoplayer (delta_t *delta, plent_state_t *from, plent_state_t *to, int flags; int j; - flags = to->flags >> 1; // convert PF_(GIB|DEAD) to DF_(GIB|DEAD) + flags = to->es.flags >> 1; // convert PF_(GIB|DEAD) to DF_(GIB|DEAD) flags &= DF_GIB | DF_DEAD; // PF_MSEC and PF_COMMAND aren't wanted if (full) { flags |= DF_ORIGIN | (DF_ORIGIN << 1) | (DF_ORIGIN << 2) @@ -408,55 +408,55 @@ write_demoplayer (delta_t *delta, plent_state_t *from, plent_state_t *to, | DF_EFFECTS | DF_SKINNUM | DF_WEAPONFRAME | DF_MODEL; } else { for (j = 0; j < 3; j++) - if (from->origin[j] != to->origin[j]) + if (from->es.origin[j] != to->es.origin[j]) flags |= DF_ORIGIN << j; for (j = 0; j < 3; j++) if (from->cmd.angles[j] != to->cmd.angles[j]) flags |= DF_ANGLES << j; - if (from->modelindex != to->modelindex) + if (from->es.modelindex != to->es.modelindex) flags |= DF_MODEL; - if ((from->effects & 0xff) != (to->effects & 0xff)) + if ((from->es.effects & 0xff) != (to->es.effects & 0xff)) flags |= DF_EFFECTS; - if (from->skinnum != to->skinnum) + if (from->es.skinnum != to->es.skinnum) flags |= DF_SKINNUM; - if (from->weaponframe != to->weaponframe) + if (from->es.weaponframe != to->es.weaponframe) flags |= DF_WEAPONFRAME; } MSG_WriteByte (msg, svc_playerinfo); - MSG_WriteByte (msg, to->number); + MSG_WriteByte (msg, to->es.number); MSG_WriteShort (msg, flags); - MSG_WriteByte (msg, to->frame); + MSG_WriteByte (msg, to->es.frame); for (j = 0; j < 3; j++) if (flags & (DF_ORIGIN << j)) - MSG_WriteCoord (msg, to->origin[j]); + MSG_WriteCoord (msg, to->es.origin[j]); for (j = 0; j < 3; j++) if (flags & (DF_ANGLES << j)) MSG_WriteAngle16 (msg, to->cmd.angles[j]); if (flags & DF_MODEL) - MSG_WriteByte (msg, to->modelindex); + MSG_WriteByte (msg, to->es.modelindex); if (flags & DF_SKINNUM) - MSG_WriteByte (msg, to->skinnum); + MSG_WriteByte (msg, to->es.skinnum); if (flags & DF_EFFECTS) - MSG_WriteByte (msg, to->effects); + MSG_WriteByte (msg, to->es.effects); if (flags & DF_WEAPONFRAME) - MSG_WriteByte (msg, to->weaponframe); + MSG_WriteByte (msg, to->es.weaponframe); } static void write_player (delta_t *delta, plent_state_t *from, plent_state_t *to, sizebuf_t *msg, int mask, int full) { - int flags = to->flags; + int flags = to->es.flags; int qf_bits = 0; int i; int ds = delta->delta_sequence & 0x7f; @@ -472,30 +472,30 @@ write_player (delta_t *delta, plent_state_t *from, plent_state_t *to, ds = -1; } else { for (i = 0; i < 3; i++) - if (from->velocity[i] != to->velocity[i]) + if (from->es.velocity[i] != to->es.velocity[i]) flags |= PF_VELOCITY1 << i; - if (from->modelindex != to->modelindex) + if (from->es.modelindex != to->es.modelindex) flags |= PF_MODEL; - if (from->skinnum != to->skinnum) + if (from->es.skinnum != to->es.skinnum) flags |= PF_SKINNUM; - if ((from->effects & 0xff) != (to->effects &0xff)) + if ((from->es.effects & 0xff) != (to->es.effects &0xff)) flags |= PF_EFFECTS; - if (from->weaponframe != to->weaponframe) + if (from->es.weaponframe != to->es.weaponframe) flags |= PF_WEAPONFRAME; - if (from->alpha != to->alpha) + if (from->es.alpha != to->es.alpha) qf_bits |= PF_ALPHA; - if (from->scale != to->scale) + if (from->es.scale != to->es.scale) qf_bits |= PF_SCALE; - if ((from->effects & 0xff00) != (to->effects & 0xff00)) + if ((from->es.effects & 0xff00) != (to->es.effects & 0xff00)) qf_bits |= PF_EFFECTS2; - if (from->glow_size != to->glow_size) + if (from->es.glow_size != to->es.glow_size) qf_bits |= PF_GLOWSIZE; - if (from->glow_color != to->glow_color) + if (from->es.glow_color != to->es.glow_color) qf_bits |= PF_GLOWCOLOR; - if (from->colormod != to->colormod) + if (from->es.colormod != to->es.colormod) qf_bits |= PF_COLORMOD; - if ((from->frame & 0xff00) != (to->frame & 0xff00)) + if ((from->es.frame & 0xff00) != (to->es.frame & 0xff00)) qf_bits |= PF_FRAME2; if (qf_bits) flags |= PF_QF; @@ -506,12 +506,12 @@ write_player (delta_t *delta, plent_state_t *from, plent_state_t *to, MSG_WriteByte (msg, svc_playerinfo); if (delta->type == dt_tp_qtv) MSG_WriteByte (msg, ds); - MSG_WriteByte (msg, to->number); + MSG_WriteByte (msg, to->es.number); MSG_WriteShort (msg, flags); - MSG_WriteCoordV (msg, to->origin); + MSG_WriteCoordV (msg, to->es.origin); - MSG_WriteByte (msg, to->frame); + MSG_WriteByte (msg, to->es.frame); if (flags & PF_MSEC) MSG_WriteByte (msg, to->msec); @@ -519,32 +519,32 @@ write_player (delta_t *delta, plent_state_t *from, plent_state_t *to, MSG_WriteDeltaUsercmd (msg, &from->cmd, &to->cmd); for (i = 0; i < 3; i++) if (flags & (PF_VELOCITY1 << i)) - MSG_WriteShort (msg, to->velocity[i]); + MSG_WriteShort (msg, to->es.velocity[i]); if (flags & PF_MODEL) - MSG_WriteByte (msg, to->modelindex); + MSG_WriteByte (msg, to->es.modelindex); if (flags & PF_SKINNUM) - MSG_WriteByte (msg, to->skinnum); + MSG_WriteByte (msg, to->es.skinnum); if (flags & PF_EFFECTS) - MSG_WriteByte (msg, to->effects); + MSG_WriteByte (msg, to->es.effects); if (flags & PF_WEAPONFRAME) - MSG_WriteByte (msg, to->weaponframe); + MSG_WriteByte (msg, to->es.weaponframe); if (flags & PF_QF) { MSG_WriteByte (msg, qf_bits); if (qf_bits & PF_ALPHA) - MSG_WriteByte (msg, to->alpha); + MSG_WriteByte (msg, to->es.alpha); if (qf_bits & PF_SCALE) - MSG_WriteByte (msg, to->scale); + MSG_WriteByte (msg, to->es.scale); if (qf_bits & PF_EFFECTS2) - MSG_WriteByte (msg, to->effects >> 8); + MSG_WriteByte (msg, to->es.effects >> 8); if (qf_bits & PF_GLOWSIZE) - MSG_WriteByte (msg, to->glow_size); + MSG_WriteByte (msg, to->es.glow_size); if (qf_bits & PF_GLOWCOLOR) - MSG_WriteByte (msg, to->glow_color); + MSG_WriteByte (msg, to->es.glow_color); if (qf_bits & PF_COLORMOD) - MSG_WriteByte (msg, to->colormod); + MSG_WriteByte (msg, to->es.colormod); if (qf_bits & PF_FRAME2) - MSG_WriteByte (msg, to->frame); + MSG_WriteByte (msg, to->es.frame); } } @@ -566,19 +566,19 @@ SV_WritePlayersToClient (delta_t *delta, byte *pvs, sizebuf_t *msg) void (*write) (delta_t *, plent_state_t *, plent_state_t *, sizebuf_t *, int, int); - if (!null_player_state.alpha) { - null_player_state.alpha = 255; - null_player_state.scale = 16; - null_player_state.glow_size = 0; - null_player_state.glow_color = 254; - null_player_state.colormod = 255; + if (!null_player_state.es.alpha) { + null_player_state.es.alpha = 255; + null_player_state.es.scale = 16; + null_player_state.es.glow_size = 0; + null_player_state.es.glow_color = 254; + null_player_state.es.colormod = 255; } - null_player_state.modelindex = 0; + null_player_state.es.modelindex = 0; if (delta->client) { clent = delta->client->edict; spec_track = delta->client->spec_track; - null_player_state.modelindex = sv_playermodel; + null_player_state.es.modelindex = sv_playermodel; full = 0; // normal qw clients don't get real deltas on players } @@ -625,9 +625,9 @@ SV_WritePlayersToClient (delta_t *delta, byte *pvs, sizebuf_t *msg) state = &pack->players[pack->num_players]; pack->num_players++; - state->number = j; - state->flags = 0; - VectorCopy (SVvector (ent, origin), state->origin); + state->es.number = j; + state->es.flags = 0; + VectorCopy (SVvector (ent, origin), state->es.origin); state->msec = min (255, 1000 * (sv.time - cl->localtime)); @@ -639,44 +639,44 @@ SV_WritePlayersToClient (delta_t *delta, byte *pvs, sizebuf_t *msg) state->cmd.angles[0] = 0; } - VectorCopy (SVvector (ent, velocity), state->velocity); - state->modelindex = SVfloat (ent, modelindex); - state->frame = SVfloat (ent, frame); - state->skinnum = SVfloat (ent, skin); - state->effects = SVfloat (ent, effects); - state->weaponframe = SVfloat (ent, weaponframe); + VectorCopy (SVvector (ent, velocity), state->es.velocity); + state->es.modelindex = SVfloat (ent, modelindex); + state->es.frame = SVfloat (ent, frame); + state->es.skinnum = SVfloat (ent, skin); + state->es.effects = SVfloat (ent, effects); + state->es.weaponframe = SVfloat (ent, weaponframe); if (SVfloat (ent, health) <= 0) - state->flags |= PF_DEAD; + state->es.flags |= PF_DEAD; if (SVvector (ent, mins)[2] != -24) - state->flags |= PF_GIB; - state->flags |= PF_MSEC | PF_COMMAND; + state->es.flags |= PF_GIB; + state->es.flags |= PF_MSEC | PF_COMMAND; - state->alpha = 255; - state->scale = 16; - state->glow_size = 0; - state->glow_color = 254; - state->colormod = 255; + state->es.alpha = 255; + state->es.scale = 16; + state->es.glow_size = 0; + state->es.glow_color = 254; + state->es.colormod = 255; if (sv_fields.alpha != -1 && SVfloat (ent, alpha)) { float alpha = SVfloat (ent, alpha); - state->alpha = bound (0, alpha, 1) * 255.0; + state->es.alpha = bound (0, alpha, 1) * 255.0; } if (sv_fields.scale != -1 && SVfloat (ent, scale)) { float scale = SVfloat (ent, scale); - state->scale = bound (0, scale, 15.9375) * 16; + state->es.scale = bound (0, scale, 15.9375) * 16; } if (sv_fields.glow_size != -1 && SVfloat (ent, glow_size)) { int glow_size = SVfloat (ent, glow_size); - state->glow_size = bound (-1024, glow_size, 1016) >> 3; + state->es.glow_size = bound (-1024, glow_size, 1016) >> 3; } if (sv_fields.glow_color != -1 && SVfloat (ent, glow_color)) - state->glow_color = SVfloat (ent, glow_color); + state->es.glow_color = SVfloat (ent, glow_color); if (sv_fields.colormod != -1 && !VectorIsZero (SVvector (ent, colormod))) { float *colormod= SVvector (ent, colormod); - state->colormod = ((int) (bound (0, colormod[0], 1) * 7) << 5) | - ((int) (bound (0, colormod[1], 1) * 7) << 2) | - (int) (bound (0, colormod[2], 1) * 3); + state->es.colormod = ((int) (bound (0, colormod[0], 1) * 7) << 5) | + ((int) (bound (0, colormod[1], 1) * 7) << 2) | + (int) (bound (0, colormod[2], 1) * 3); } if (cl->spectator) { @@ -693,10 +693,10 @@ SV_WritePlayersToClient (delta_t *delta, byte *pvs, sizebuf_t *msg) if (from_pack && from_pack->players) { while (k < from_pack->num_players - && from_pack->players[k].number < state->number) + && from_pack->players[k].es.number < state->es.number) k++; if (k < from_pack->num_players - && from_pack->players[k].number == state->number) { + && from_pack->players[k].es.number == state->es.number) { write (delta, &from_pack->players[k], state, msg, mask, full); continue; }