implement missing svcdp_spawnstatic2, try to clean up various different 'spawnstatic2' svcs from different protocols.

try to fix lightning beam positions (which was a problem with nq+svc_setview)
fix iqm events.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5041 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-01-16 08:13:51 +00:00
parent f546a188c4
commit f71f6260b1
6 changed files with 42 additions and 44 deletions

View File

@ -4281,7 +4281,7 @@ void CL_ParseBaseline (entity_state_t *es, int baselinetype2)
es->trans = (bits & FITZ_B_ALPHA) ? MSG_ReadByte() : 255;
es->scale = (bits & RMQFITZ_B_SCALE) ? MSG_ReadByte() : 16;
}
void CL_ParseBaseline2 (void)
void CL_ParseBaselineDelta (void)
{
entity_state_t es;
@ -4290,7 +4290,7 @@ void CL_ParseBaseline2 (void)
else
CLQW_ParseDelta(&nullentitystate, &es, (unsigned short)MSG_ReadShort());
if (!CL_CheckBaselines(es.number))
Host_EndGame("CL_ParseBaseline2: check baselines failed with size %i", es.number);
Host_EndGame("CL_ParseBaselineDelta: check baselines failed with size %i", es.number);
memcpy(cl_baselines + es.number, &es, sizeof(es));
}
@ -4345,27 +4345,20 @@ like torches
=====================
*/
void R_StaticEntityToRTLight(int i);
void CL_ParseStatic (int version)
void CL_ParseStaticProt (int baselinetype)
{
entity_t *ent;
int i;
entity_state_t es;
vec3_t mins,maxs;
if (version == 3)
if (baselinetype)
{
CL_ParseBaseline(&es, CPNQ_FITZ666);
CL_ParseBaseline(&es, baselinetype);
i = cl.num_statics;
cl.num_statics++;
}
else if (version == 1)
{
//old nq/qw style
CL_ParseBaseline (&es, CPNQ_ID);
i = cl.num_statics;
cl.num_statics++;
}
else if (version == 2)
else
{
//new deltaed style ('full' extension support)
if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)
@ -4390,8 +4383,6 @@ void CL_ParseStatic (int version)
cl.num_statics++;
}
}
else
return;
if (i == cl_max_static_entities)
{
@ -6774,13 +6765,13 @@ void CLQW_ParseServerMessage (void)
CL_ParseBaseline (cl_baselines + i, CPNQ_ID);
break;
case svcfte_spawnbaseline2:
CL_ParseBaseline2 ();
CL_ParseBaselineDelta ();
break;
case svc_spawnstatic:
CL_ParseStatic (1);
CL_ParseStaticProt (CPNQ_ID);
break;
case svcfte_spawnstatic2:
CL_ParseStatic (2);
CL_ParseStaticProt (0);
break;
case svc_temp_entity:
#ifdef NQPROT
@ -7630,7 +7621,7 @@ void CLNQ_ParseServerMessage (void)
break;
case svc_spawnstatic:
CL_ParseStatic (1);
CL_ParseStaticProt (CPNQ_ID);
break;
case svc_spawnbaseline:
@ -7650,10 +7641,10 @@ void CLNQ_ParseServerMessage (void)
CLFTE_ParseEntities();
break;
case svcfte_spawnstatic2:
CL_ParseStatic (2);
CL_ParseStaticProt (0);
break;
case svcfte_spawnbaseline2:
CL_ParseBaseline2 ();
CL_ParseBaselineDelta ();
break;
case svcfte_cgamepacket:
@ -7912,7 +7903,7 @@ void CLNQ_ParseServerMessage (void)
CL_ParseBaseline (cl_baselines + i, CPNQ_FITZ666);
break;
case svcfitz_spawnstatic2:
CL_ParseStatic (3);
CL_ParseStaticProt (CPNQ_FITZ666);
break;
case svcfitz_spawnstaticsound2:
CL_ParseStaticSound(true);
@ -7942,6 +7933,9 @@ void CLNQ_ParseServerMessage (void)
CL_ParseBaseline (cl_baselines + i, CPNQ_DP5);
break;
case svcdp_spawnstatic2:
CL_ParseStaticProt (CPNQ_DP5);
break;
case svcdp_spawnstaticsound2:
CL_ParseStaticSound(true);
break;

View File

@ -3521,7 +3521,7 @@ void CL_UpdateBeams (void)
for (j = 0; j < cl.splitclients; j++)
{
playerview_t *pv = &cl.playerview[j];
if (b->entity == ((pv->cam_state == CAM_EYECAM)?pv->cam_spec_track+1:(pv->playernum+1)))
if (b->entity == pv->viewentity)
{
// player_state_t *pl;
// VectorSubtract(cl.simorg, b->start, org);

View File

@ -6978,9 +6978,9 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, const char *buffer, size_t fsi
Con_Printf("%s: IQM has mismatched joints (%i vs %i).\n", mod->name, h->num_joints, h->num_poses);
return NULL;
}
if (h->num_meshes && !h->num_joints)
if (h->num_meshes && !noweights && !h->num_joints)
{
Con_Printf("%s: mesh IQM has no poses.\n", mod->name);
Con_Printf("%s: mesh IQM has no joints.\n", mod->name);
return NULL;
}
if (h->num_frames && !h->num_poses)
@ -7211,7 +7211,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, const char *buffer, size_t fsi
galiasevent_t *oevent, **link;
extsize /= sizeof(*fteevents);
oevent = ZG_Malloc(&mod->memgroup, sizeof(*oevent)*extsize);
for (extsize /= sizeof(*fteevents); extsize>0; extsize--, fteevents++,oevent++)
for (; extsize>0; extsize--, fteevents++,oevent++)
{
oevent->timestamp = fteevents->timestamp;
oevent->code = fteevents->evcode;

View File

@ -312,6 +312,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcnq_effect2 53 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
#define svcdp_precache 54 // [short] precacheindex [string] filename, precacheindex is + 0 for modelindex and +32768 for soundindex
#define svcdp_spawnbaseline2 55
#define svcdp_spawnstatic2 56
#define svcdp_entities 57
#define svcdp_csqcentities 58
#define svcdp_spawnstaticsound2 59 // [coord3] [short] samp [byte] vol [byte] aten

View File

@ -2750,7 +2750,7 @@ int i, eff;
float miss;
unsigned int bits=0;
int glowsize=0, glowcolor=0, colourmod=0;
int glowsize=0, glowcolour=0, colourmod=0;
for (i=0 ; i<3 ; i++)
{
@ -2811,35 +2811,35 @@ int glowsize=0, glowcolor=0, colourmod=0;
}
else if (host_client->protocol == SCP_BJP3)
{
//should be nehahra here, but that'll screw up DP, so don't generate anything.
}
else if (0)
{
#if 0
if (baseline.trans != ent->xv->alpha)
if (!(baseline.trans == 1 && !ent->xv->alpha))
bits |= DPU_ALPHA;
if (baseline.scale != ent->xv->scale)
else if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
{
if (baseline->trans != ent->trans)
bits |= DPU_ALPHA;
if (baseline->scale != ent->scale)
{
if (ent->xv->scale != 0 || ent->baseline.scale != 1)
if (ent->scale != 0 || baseline->scale != 1)
bits |= DPU_SCALE;
}
if (ent->v->modelindex >= 256) //as much as protocols can handle
if (ent->modelindex >= 256) //as much as protocols can handle
bits |= DPU_MODEL2;
if ((baseline.effects&0xff00) != ((int)eff & 0xff00))
if ((baseline->effects&0xff00) != ((int)eff & 0xff00))
bits |= DPU_EFFECTS2;
if (ent->xv->exteriormodeltoclient == EDICT_TO_PROG(svprogfuncs, host_client->edict))
if (ent->dpflags & RENDER_EXTERIORMODEL)
bits |= DPU_EXTERIORMODEL;
if (ent->xv->viewmodelforclient == EDICT_TO_PROG(svprogfuncs, host_client->edict))
if (ent->dpflags & RENDER_VIEWMODEL)
bits |= DPU_VIEWMODEL;
glowsize = ent->xv->glow_size*0.25f;
glowcolor = ent->xv->glow_color;
glowsize = ent->glowsize;
glowcolor = ent->glowcolour;
colourmod = ((int)bound(0, ent->xv->colormod[0] * (7.0f / 32.0f), 7) << 5) | ((int)bound(0, ent->xv->colormod[1] * (7.0f / 32.0f), 7) << 2) | ((int)bound(0, ent->xv->colormod[2] * (3.0f / 32.0f), 3) << 0);
colourmod = ((int)bound(0, ent->colormod[0] * (7.0f / 32.0f), 7) << 5) | ((int)bound(0, ent->colormod[1] * (7.0f / 32.0f), 7) << 2) | ((int)bound(0, ent->colormod[2] * (3.0f / 32.0f), 3) << 0);
if (0 != glowsize)
bits |= DPU_GLOWSIZE;
@ -2848,8 +2848,8 @@ int glowsize=0, glowcolor=0, colourmod=0;
if (0 != colourmod)
bits |= DPU_COLORMOD;
#endif
}
#endif
else
{
if (ent->modelindex >= 256) //as much as protocols can handle
@ -2910,7 +2910,7 @@ int glowsize=0, glowcolor=0, colourmod=0;
else if (host_client->protocol == SCP_BJP3)
{
}
else
else if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
{
if (bits & DPU_ALPHA) MSG_WriteByte(msg, ent->trans);
if (bits & DPU_SCALE) MSG_WriteByte(msg, ent->scale);

View File

@ -4251,7 +4251,10 @@ bool writeiqm(const char *filename)
f->putlil(ext.name);
f->putlil(ext.num_data);
f->putlil(ext.ofs_data);
f->putlil((uint)sizeof(ext));
if (i == extensions.length()-1)
f->putlil(0);
else
f->putlil((uint)(hdr.ofs_extensions + (i+1)*sizeof(ext)));
}
if (ext_meshes_fte) loopv(meshes_fte)