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

View file

@ -3521,7 +3521,7 @@ void CL_UpdateBeams (void)
for (j = 0; j < cl.splitclients; j++) for (j = 0; j < cl.splitclients; j++)
{ {
playerview_t *pv = &cl.playerview[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; // player_state_t *pl;
// VectorSubtract(cl.simorg, b->start, org); // 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); Con_Printf("%s: IQM has mismatched joints (%i vs %i).\n", mod->name, h->num_joints, h->num_poses);
return NULL; 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; return NULL;
} }
if (h->num_frames && !h->num_poses) 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; galiasevent_t *oevent, **link;
extsize /= sizeof(*fteevents); extsize /= sizeof(*fteevents);
oevent = ZG_Malloc(&mod->memgroup, sizeof(*oevent)*extsize); 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->timestamp = fteevents->timestamp;
oevent->code = fteevents->evcode; 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 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_precache 54 // [short] precacheindex [string] filename, precacheindex is + 0 for modelindex and +32768 for soundindex
#define svcdp_spawnbaseline2 55 #define svcdp_spawnbaseline2 55
#define svcdp_spawnstatic2 56
#define svcdp_entities 57 #define svcdp_entities 57
#define svcdp_csqcentities 58 #define svcdp_csqcentities 58
#define svcdp_spawnstaticsound2 59 // [coord3] [short] samp [byte] vol [byte] aten #define svcdp_spawnstaticsound2 59 // [coord3] [short] samp [byte] vol [byte] aten

View file

@ -2750,7 +2750,7 @@ int i, eff;
float miss; float miss;
unsigned int bits=0; unsigned int bits=0;
int glowsize=0, glowcolor=0, colourmod=0; int glowsize=0, glowcolour=0, colourmod=0;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
@ -2811,35 +2811,35 @@ int glowsize=0, glowcolor=0, colourmod=0;
} }
else if (host_client->protocol == SCP_BJP3) 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 0
if (baseline.trans != ent->xv->alpha) else if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
if (!(baseline.trans == 1 && !ent->xv->alpha)) {
bits |= DPU_ALPHA; if (baseline->trans != ent->trans)
if (baseline.scale != ent->xv->scale) 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; 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; bits |= DPU_MODEL2;
if ((baseline.effects&0xff00) != ((int)eff & 0xff00)) if ((baseline->effects&0xff00) != ((int)eff & 0xff00))
bits |= DPU_EFFECTS2; bits |= DPU_EFFECTS2;
if (ent->xv->exteriormodeltoclient == EDICT_TO_PROG(svprogfuncs, host_client->edict)) if (ent->dpflags & RENDER_EXTERIORMODEL)
bits |= DPU_EXTERIORMODEL; bits |= DPU_EXTERIORMODEL;
if (ent->xv->viewmodelforclient == EDICT_TO_PROG(svprogfuncs, host_client->edict)) if (ent->dpflags & RENDER_VIEWMODEL)
bits |= DPU_VIEWMODEL; bits |= DPU_VIEWMODEL;
glowsize = ent->xv->glow_size*0.25f; glowsize = ent->glowsize;
glowcolor = ent->xv->glow_color; 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) if (0 != glowsize)
bits |= DPU_GLOWSIZE; bits |= DPU_GLOWSIZE;
@ -2848,8 +2848,8 @@ int glowsize=0, glowcolor=0, colourmod=0;
if (0 != colourmod) if (0 != colourmod)
bits |= DPU_COLORMOD; bits |= DPU_COLORMOD;
#endif
} }
#endif
else else
{ {
if (ent->modelindex >= 256) //as much as protocols can handle 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 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_ALPHA) MSG_WriteByte(msg, ent->trans);
if (bits & DPU_SCALE) MSG_WriteByte(msg, ent->scale); 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.name);
f->putlil(ext.num_data); f->putlil(ext.num_data);
f->putlil(ext.ofs_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) if (ext_meshes_fte) loopv(meshes_fte)