From fec77767456a999e6559ddb390e922651fc205b3 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 12 Mar 2013 22:36:18 +0000 Subject: [PATCH] ------------------------------------------------------------------------ r4176 | acceptthis | 2013-01-27 01:55:26 +0000 (Sun, 27 Jan 2013) | 3 lines replacementdeltas+vw_index now works. not quite how I'd originally intended it though. need to test for nq. Fix fitz666 svc_clientdata clientside issue. The judderyness is not my imagination! Thanks sock! :) ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4174 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_ents.c | 34 ++++++++++-- engine/client/cl_parse.c | 111 ++++++++++++++------------------------- engine/common/protocol.h | 55 +++++++++++++++++++ engine/server/pr_cmds.c | 2 +- engine/server/sv_ents.c | 3 ++ engine/server/sv_send.c | 43 +++------------ 6 files changed, 134 insertions(+), 114 deletions(-) diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 803b04989..5c8fa6733 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -2746,7 +2746,6 @@ static void CL_TransitionPacketEntities(int newsequence, packet_entities_t *newp sold = &oldpack->entities[oldpnum]; if (sold->number >= snew->number) { - oldpnum++; if (sold->number > snew->number) sold = NULL; //woo, it's a new entity. break; @@ -3043,7 +3042,7 @@ void CL_LinkPacketEntities (void) packet_entities_t *pack; entity_state_t *state; lerpents_t *le; - model_t *model; + model_t *model, *model2; vec3_t old_origin; float autorotate; int i; @@ -3191,6 +3190,21 @@ void CL_LinkPacketEntities (void) continue; } + if (cl.model_precache_vwep[0]) + { + if (state->modelindex == cl_playerindex) + { + model = cl.model_precache_vwep[0]; + model2 = cl.model_precache_vwep[state->modelindex2]; + } + else + model2 = NULL; + } + else if (state->modelindex2) + model2 = cl.model_precache[state->modelindex2]; + else + model2 = NULL; + cl_numvisedicts++; ent->externalmodelview = 0; @@ -3319,6 +3333,9 @@ void CL_LinkPacketEntities (void) rag_updatedeltaent(ent, le); #endif + if (model2) + CL_AddVWeapModel (ent, model2); + // add automatic particle trails if (!model || (!(model->flags&~MF_ROTATE) && model->particletrail<0 && model->particleeffect<0 && state->u.q1.traileffectnum==0)) continue; @@ -4099,6 +4116,7 @@ void CL_LinkPlayers (void) static int flickertime; static int flicker; float predictmsmult = 1000*cl_predict_players_frac.value; + int modelindex2; if (!cl.worldmodel || cl.worldmodel->needload) return; @@ -4138,10 +4156,16 @@ void CL_LinkPlayers (void) continue; //the extra modelindex check is to stop lame mods from using vweps with rings - if (state->command.impulse && cl.model_precache_vwep[0] && state->modelindex == cl_playerindex) + if (state->command.impulse && cl.model_precache_vwep[0] && cl.model_precache_vwep[0]->type != mod_dummy && state->modelindex == cl_playerindex) + { model = cl.model_precache_vwep[0]; + modelindex2 = state->command.impulse; + } else + { model = cl.model_precache[state->modelindex]; + modelindex2 = 0; + } // spawn light flashes, even ones coming from invisible objects if (r_powerupglow.value && !(r_powerupglow.value == 2 && j == cl.playernum[0]) @@ -4333,8 +4357,8 @@ void CL_LinkPlayers (void) CL_AddFlagModels (ent, 0); else if (state->effects & QWEF_FLAG2) CL_AddFlagModels (ent, 1); - if (state->command.impulse) - CL_AddVWeapModel (ent, cl.model_precache_vwep[state->command.impulse]); + if (modelindex2) + CL_AddVWeapModel (ent, cl.model_precache_vwep[modelindex2]); CLQ1_AddShadow(ent); CLQ1_AddPowerupShell(ent, false, state->effects); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 03edd08f4..815341f2e 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3004,43 +3004,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); } } -#define SU_VIEWHEIGHT (1<<0) -#define SU_IDEALPITCH (1<<1) -#define SU_PUNCH1 (1<<2) -#define SU_PUNCH2 (1<<3) -#define SU_PUNCH3 (1<<4) -#define SU_VELOCITY1 (1<<5) -#define SU_VELOCITY2 (1<<6) -#define SU_VELOCITY3 (1<<7) -//define SU_AIMENT (1<<8) AVAILABLE BIT -#define SU_ITEMS (1<<9) -#define SU_ONGROUND (1<<10) // no data follows, the bit is it -#define SU_INWATER (1<<11) // no data follows, the bit is it -#define SU_WEAPONFRAME (1<<12) -#define SU_ARMOR (1<<13) -#define SU_WEAPON (1<<14) - -#define DPSU_EXTEND1 (1<<15) -// first extend byte -#define DPSU_PUNCHVEC1 (1<<16) -#define DPSU_PUNCHVEC2 (1<<17) -#define DPSU_PUNCHVEC3 (1<<18) -#define DPSU_VIEWZOOM (1<<19) // byte factor (0 = 0.0 (not valid), 255 = 1.0) -#define DPSU_UNUSED20 (1<<20) -#define DPSU_UNUSED21 (1<<21) -#define DPSU_UNUSED22 (1<<22) -#define DPSU_EXTEND2 (1<<23) // another byte to follow, future expansion -// second extend byte -#define DPSU_UNUSED24 (1<<24) -#define DPSU_UNUSED25 (1<<25) -#define DPSU_UNUSED26 (1<<26) -#define DPSU_UNUSED27 (1<<27) -#define DPSU_UNUSED28 (1<<28) -#define DPSU_UNUSED29 (1<<29) -#define DPSU_UNUSED30 (1<<30) -#define DPSU_EXTEND3 (1<<31) // another byte to follow, future expansion - - #define DEFAULT_VIEWHEIGHT 22 void CLNQ_ParseClientdata (void) { @@ -3050,9 +3013,9 @@ void CLNQ_ParseClientdata (void) bits = (unsigned short)MSG_ReadShort(); - if (bits & DPSU_EXTEND1) + if (bits & SU_EXTEND1) bits |= (MSG_ReadByte() << 16); - if (bits & DPSU_EXTEND2) + if (bits & SU_EXTEND2) bits |= (MSG_ReadByte() << 24); if (bits & SU_VIEWHEIGHT) @@ -3073,7 +3036,7 @@ void CLNQ_ParseClientdata (void) // else // cl.punchangle[i] = 0; - if (bits & (DPSU_PUNCHVEC1<u.q1.traileffectnum != from->u.q1.traileffectnum) bits |= UF_TRAILEFFECT; + if (to->modelindex2 != from->modelindex2) + bits |= UF_MODELINDEX2; + if (to->u.q1.gravitydir[0] != from->u.q1.gravitydir[0] || to->u.q1.gravitydir[1] != from->u.q1.gravitydir[1]) bits |= UF_GRAVITYDIR; diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index c39248fb2..b12997691 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -1235,40 +1235,6 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg) bits = 0; -#define SU_VIEWHEIGHT (1<<0) -#define SU_IDEALPITCH (1<<1) -#define SU_PUNCH1 (1<<2) -#define SU_PUNCH2 (1<<3) -#define SU_PUNCH3 (1<<4) -#define SU_VELOCITY1 (1<<5) -#define SU_VELOCITY2 (1<<6) -#define SU_VELOCITY3 (1<<7) -//define SU_AIMENT (1<<8) AVAILABLE BIT -#define SU_ITEMS (1<<9) -#define SU_ONGROUND (1<<10) // no data follows, the bit is it -#define SU_INWATER (1<<11) // no data follows, the bit is it -#define SU_WEAPONFRAME (1<<12) -#define SU_ARMOR (1<<13) -#define SU_WEAPONMODEL (1<<14) -#define SU_EXTEND1 (1<<15) - -#define FITZSU_WEAPONMODEL2 (1<<16) // 1 byte, this is .weaponmodel & 0xFF00 (second byte) -#define FITZSU_ARMOR2 (1<<17) // 1 byte, this is .armorvalue & 0xFF00 (second byte) -#define FITZSU_AMMO2 (1<<18) // 1 byte, this is .currentammo & 0xFF00 (second byte) -#define FITZSU_SHELLS2 (1<<19) // 1 byte, this is .ammo_shells & 0xFF00 (second byte) -#define FITZSU_NAILS2 (1<<20) // 1 byte, this is .ammo_nails & 0xFF00 (second byte) -#define FITZSU_ROCKETS2 (1<<21) // 1 byte, this is .ammo_rockets & 0xFF00 (second byte) -#define FITZSU_CELLS2 (1<<22) // 1 byte, this is .ammo_cells & 0xFF00 (second byte) -#define FITZSU_EXTEND2 (1<<23) // another byte to follow - -#define FITZSU_WEAPONFRAME2 (1<<24) // 1 byte, this is .weaponframe & 0xFF00 (second byte) -#define FITZSU_WEAPONALPHA (1<<25) // 1 byte, this is alpha for weaponmodel, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT -#define FITZSU_UNUSED26 (1<<26) -#define FITZSU_UNUSED27 (1<<27) -#define FITZSU_UNUSED28 (1<<28) -#define FITZSU_UNUSED29 (1<<29) -#define FITZSU_UNUSED30 (1<<30) -#define FITZSU_EXTEND3 (1<<31) // another byte to follow, future expansion if (ent->v->view_ofs[2] != DEFAULT_VIEWHEIGHT) bits |= SU_VIEWHEIGHT; @@ -1348,15 +1314,20 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg) if (bits >= (1u<<16)) bits |= SU_EXTEND1; if (bits >= (1u<<24)) - bits |= FITZSU_EXTEND2; + bits |= SU_EXTEND2; if (bits >= (1ull<<32)) - bits |= FITZSU_EXTEND3; + bits |= SU_EXTEND3; // send the data MSG_WriteByte (msg, svc_clientdata); MSG_WriteShort (msg, bits); + if (bits & SU_EXTEND1) + MSG_WriteByte(msg, bits>>16); + if (bits & SU_EXTEND2) + MSG_WriteByte(msg, bits>>24); + if (bits & SU_VIEWHEIGHT) MSG_WriteChar (msg, ent->v->view_ofs[2]);