From d69c8013aaaa7cb7810378961e7d01706aee2c3b Mon Sep 17 00:00:00 2001 From: Adam Olsen Date: Sat, 20 Oct 2001 11:59:42 +0000 Subject: [PATCH] - convert svc_spawnbaseline and svc_spawnstatic Only notable ones left now are packetentities and deltapackentities :) --- qw/include/net_svc.h | 24 ++++++++++++++++++++++++ qw/source/cl_parse.c | 41 ++++++++++++++++++++++------------------- qw/source/net_svc.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 19 deletions(-) diff --git a/qw/include/net_svc.h b/qw/include/net_svc.h index 41ecc4398..09e4e1434 100644 --- a/qw/include/net_svc.h +++ b/qw/include/net_svc.h @@ -69,6 +69,27 @@ typedef struct net_svc_sound_s int entity; } net_svc_sound_t; +typedef struct net_svc_spawnbaseline_s +{ + short num; + byte modelindex; + byte frame; + byte colormap; + byte skinnum; + vec3_t origin; + vec3_t angles; +} net_svc_spawnbaseline_t; + +typedef struct net_svc_spawnstatic_s +{ + byte modelindex; + byte frame; + byte colormap; + byte skinnum; + vec3_t origin; + vec3_t angles; +} net_svc_spawnstatic_t; + typedef struct net_svc_tempentity_s { byte type; @@ -158,6 +179,9 @@ qboolean NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg); qboolean NET_SVC_Damage_Parse (net_svc_damage_t *block, msg_t *msg); qboolean NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg); qboolean NET_SVC_Sound_Parse (net_svc_sound_t *block, msg_t *msg); +qboolean NET_SVC_SpawnBaseline_Parse (net_svc_spawnbaseline_t *block, + msg_t *msg); +qboolean NET_SVC_SpawnStatic_Parse (net_svc_spawnstatic_t *block, msg_t *msg); qboolean NET_SVC_TempEntity_Parse (net_svc_tempentity_t *block, msg_t *msg); qboolean NET_SVC_SpawnStaticSound_Parse (net_svc_spawnstaticsound_t *block, msg_t *msg); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index dcd5433fb..7e8d87ded 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -827,18 +827,22 @@ CL_ParseModellist (void) } void -CL_ParseBaseline (entity_state_t *es) +CL_ParseSpawnBaseline () { - int i; + entity_state_t *es; + net_svc_spawnbaseline_t block; + + NET_SVC_SpawnBaseline_Parse (&block, net_message); + + es = &cl_baselines[block.num]; + + es->modelindex = block.modelindex; + es->frame = block.frame; + es->colormap = block.colormap; + es->skinnum = block.skinnum; + VectorCopy (block.origin, es->origin); + VectorCopy (block.angles, es->angles); - es->modelindex = MSG_ReadByte (net_message); - es->frame = MSG_ReadByte (net_message); - es->colormap = MSG_ReadByte (net_message); - es->skinnum = MSG_ReadByte (net_message); - for (i = 0; i < 3; i++) { - es->origin[i] = MSG_ReadCoord (net_message); - es->angles[i] = MSG_ReadAngle (net_message); - } // LordHavoc: set up the baseline to account for new effects (alpha, // colormod, etc) es->alpha = 255; @@ -858,9 +862,9 @@ void CL_ParseStatic (void) { entity_t *ent; - entity_state_t es; + net_svc_spawnstatic_t block; - CL_ParseBaseline (&es); + NET_SVC_SpawnStatic_Parse (&block, net_message); if (cl.num_statics >= MAX_STATIC_ENTITIES) Host_EndGame ("Too many static entities"); @@ -868,12 +872,12 @@ CL_ParseStatic (void) CL_Init_Entity (ent); // copy it to the current state - ent->model = cl.model_precache[es.modelindex]; - ent->frame = es.frame; - ent->skinnum = es.skinnum; + ent->model = cl.model_precache[block.modelindex]; + ent->frame = block.frame; + ent->skinnum = block.skinnum; - VectorCopy (es.origin, ent->origin); - VectorCopy (es.angles, ent->angles); + VectorCopy (block.origin, ent->origin); + VectorCopy (block.angles, ent->angles); R_AddEfrags (ent); } @@ -1233,8 +1237,7 @@ CL_ParseServerMessage (void) break; case svc_spawnbaseline: - i = MSG_ReadShort (net_message); - CL_ParseBaseline (&cl_baselines[i]); + CL_ParseSpawnBaseline (); break; case svc_spawnstatic: CL_ParseStatic (); diff --git a/qw/source/net_svc.c b/qw/source/net_svc.c index eac367f1c..80ac374f3 100644 --- a/qw/source/net_svc.c +++ b/qw/source/net_svc.c @@ -128,6 +128,45 @@ NET_SVC_Sound_Parse (net_svc_sound_t *block, msg_t *msg) return msg->badread; } +qboolean +NET_SVC_SpawnBaseline_Parse (net_svc_spawnbaseline_t *block, msg_t *msg) +{ + int i; + + block->num = MSG_ReadShort (msg); + block->modelindex = MSG_ReadByte (msg); + block->frame = MSG_ReadByte (msg); + block->colormap = MSG_ReadByte (msg); + block->skinnum = MSG_ReadByte (msg); + + // these are interlaced? bad drugs... + for (i = 0; i < 3; i ++) { + block->origin[i] = MSG_ReadCoord (msg); + block->angles[i] = MSG_ReadAngle (msg); + } + + return msg->badread; +} + +qboolean +NET_SVC_SpawnStatic_Parse (net_svc_spawnstatic_t *block, msg_t *msg) +{ + int i; + + block->modelindex = MSG_ReadByte (msg); + block->frame = MSG_ReadByte (msg); + block->colormap = MSG_ReadByte (msg); + block->skinnum = MSG_ReadByte (msg); + + // these are interlaced? bad drugs... + for (i = 0; i < 3; i ++) { + block->origin[i] = MSG_ReadCoord (msg); + block->angles[i] = MSG_ReadAngle (msg); + } + + return msg->badread; +} + qboolean NET_SVC_TempEntity_Parse (net_svc_tempentity_t *block, msg_t *msg) {