engine: client: add support for parsing GoldSrc svc_temp_entity

This commit is contained in:
Alibek Omarov 2024-10-07 20:38:43 +03:00
parent ba7c789ec9
commit d98361f782
4 changed files with 293 additions and 286 deletions

View file

@ -2382,7 +2382,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
CL_ParseBaseline( msg, false ); CL_ParseBaseline( msg, false );
break; break;
case svc_temp_entity: case svc_temp_entity:
CL_ParseTempEntity( msg ); CL_ParseTempEntity( msg, PROTO_CURRENT );
cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_setpause: case svc_setpause:

View file

@ -485,7 +485,7 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg )
CL_ParseBaseline( msg, true ); CL_ParseBaseline( msg, true );
break; break;
case svc_temp_entity: case svc_temp_entity:
CL_ParseTempEntity( msg ); CL_ParseTempEntity( msg, PROTO_LEGACY );
cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_setpause: case svc_setpause:

View file

@ -1892,13 +1892,13 @@ CL_ParseTempEntity
handle temp-entity messages handle temp-entity messages
============== ==============
*/ */
void CL_ParseTempEntity( sizebuf_t *msg ) void CL_ParseTempEntity( sizebuf_t *msg, connprotocol_t proto )
{ {
sizebuf_t buf; sizebuf_t buf, *pbuf;
byte pbuf[2048]; byte msg_data[2048];
int iSize; int iSize;
int type, color, count, flags; int type, color, count, flags;
int decalIndex, modelIndex, entityIndex; int decalIndex = 0, modelIndex = 0, entityIndex = 0;
float scale, life, frameRate, vel, random; float scale, life, frameRate, vel, random;
float brightness, r, g, b; float brightness, r, g, b;
vec3_t pos, pos2, ang; vec3_t pos, pos2, ang;
@ -1909,12 +1909,12 @@ void CL_ParseTempEntity( sizebuf_t *msg )
sound_t hSound; sound_t hSound;
const char *name; const char *name;
if( cls.legacymode ) if( proto != PROTO_GOLDSRC )
{
if( proto == PROTO_LEGACY )
iSize = MSG_ReadByte( msg ); iSize = MSG_ReadByte( msg );
else iSize = MSG_ReadWord( msg ); else iSize = MSG_ReadWord( msg );
decalIndex = modelIndex = entityIndex = 0;
// this will probably be fatal anyway // this will probably be fatal anyway
if( iSize > sizeof( pbuf )) if( iSize > sizeof( pbuf ))
Con_Printf( S_ERROR "%s: Temp buffer overflow!\n", __func__ ); Con_Printf( S_ERROR "%s: Temp buffer overflow!\n", __func__ );
@ -1923,9 +1923,16 @@ void CL_ParseTempEntity( sizebuf_t *msg )
MSG_ReadBytes( msg, pbuf, iSize ); MSG_ReadBytes( msg, pbuf, iSize );
// init a safe tempbuffer // init a safe tempbuffer
MSG_Init( &buf, "TempEntity", pbuf, iSize ); MSG_Init( pbuf, "TempEntity", pbuf, iSize );
type = MSG_ReadByte( &buf ); pbuf = pbuf;
}
else
{
pbuf = msg;
}
type = MSG_ReadByte( pbuf );
switch( type ) switch( type )
{ {
@ -1942,29 +1949,29 @@ void CL_ParseTempEntity( sizebuf_t *msg )
case TE_BEAMRING: case TE_BEAMRING:
case TE_BEAMHOSE: case TE_BEAMHOSE:
case TE_KILLBEAM: case TE_KILLBEAM:
CL_ParseViewBeam( &buf, type ); CL_ParseViewBeam( pbuf, type );
break; break;
case TE_GUNSHOT: case TE_GUNSHOT:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
R_RicochetSound( pos ); R_RicochetSound( pos );
R_RunParticleEffect( pos, vec3_origin, 0, 20 ); R_RunParticleEffect( pos, vec3_origin, 0, 20 );
break; break;
case TE_EXPLOSION: case TE_EXPLOSION:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
scale = (float)(MSG_ReadByte( &buf ) * 0.1f); scale = (float)(MSG_ReadByte( pbuf ) * 0.1f);
frameRate = MSG_ReadByte( &buf ); frameRate = MSG_ReadByte( pbuf );
flags = MSG_ReadByte( &buf ); flags = MSG_ReadByte( pbuf );
R_Explosion( pos, modelIndex, scale, frameRate, flags ); R_Explosion( pos, modelIndex, scale, frameRate, flags );
break; break;
case TE_TAREXPLOSION: case TE_TAREXPLOSION:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
R_BlobExplosion( pos ); R_BlobExplosion( pos );
if(( name = SoundList_Get( Explode, 0 ))) if(( name = SoundList_Get( Explode, 0 )))
@ -1974,48 +1981,48 @@ void CL_ParseTempEntity( sizebuf_t *msg )
} }
break; break;
case TE_SMOKE: case TE_SMOKE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
scale = (float)(MSG_ReadByte( &buf ) * 0.1f); scale = (float)(MSG_ReadByte( pbuf ) * 0.1f);
frameRate = MSG_ReadByte( &buf ); frameRate = MSG_ReadByte( pbuf );
pTemp = R_DefaultSprite( pos, modelIndex, frameRate ); pTemp = R_DefaultSprite( pos, modelIndex, frameRate );
R_Sprite_Smoke( pTemp, scale ); R_Sprite_Smoke( pTemp, scale );
break; break;
case TE_TRACER: case TE_TRACER:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
R_TracerEffect( pos, pos2 ); R_TracerEffect( pos, pos2 );
break; break;
case TE_SPARKS: case TE_SPARKS:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
R_SparkShower( pos ); R_SparkShower( pos );
break; break;
case TE_LAVASPLASH: case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
R_LavaSplash( pos ); R_LavaSplash( pos );
break; break;
case TE_TELEPORT: case TE_TELEPORT:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
R_TeleportSplash( pos ); R_TeleportSplash( pos );
break; break;
case TE_EXPLOSION2: case TE_EXPLOSION2:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
R_ParticleExplosion2( pos, color, count ); R_ParticleExplosion2( pos, color, count );
dl = CL_AllocDlight( 0 ); dl = CL_AllocDlight( 0 );
@ -2035,25 +2042,25 @@ void CL_ParseTempEntity( sizebuf_t *msg )
case TE_WORLDDECAL: case TE_WORLDDECAL:
case TE_WORLDDECALHIGH: case TE_WORLDDECALHIGH:
case TE_DECALHIGH: case TE_DECALHIGH:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
if( type == TE_BSPDECAL ) if( type == TE_BSPDECAL )
{ {
decalIndex = MSG_ReadShort( &buf ); decalIndex = MSG_ReadShort( pbuf );
entityIndex = MSG_ReadShort( &buf ); entityIndex = MSG_ReadShort( pbuf );
if( entityIndex ) if( entityIndex )
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
else modelIndex = 0; else modelIndex = 0;
} }
else else
{ {
decalIndex = MSG_ReadByte( &buf ); decalIndex = MSG_ReadByte( pbuf );
if( type == TE_DECALHIGH || type == TE_WORLDDECALHIGH ) if( type == TE_DECALHIGH || type == TE_WORLDDECALHIGH )
decalIndex += 256; decalIndex += 256;
if( type == TE_DECALHIGH || type == TE_DECAL ) if( type == TE_DECALHIGH || type == TE_DECAL )
entityIndex = MSG_ReadShort( &buf ); entityIndex = MSG_ReadShort( pbuf );
else entityIndex = 0; else entityIndex = 0;
pEnt = CL_GetEntityByIndex( entityIndex ); pEnt = CL_GetEntityByIndex( entityIndex );
@ -2062,197 +2069,197 @@ void CL_ParseTempEntity( sizebuf_t *msg )
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, type == TE_BSPDECAL ? FDECAL_PERMANENT : 0 ); CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, type == TE_BSPDECAL ? FDECAL_PERMANENT : 0 );
break; break;
case TE_IMPLOSION: case TE_IMPLOSION:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
scale = MSG_ReadByte( &buf ); scale = MSG_ReadByte( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_Implosion( pos, scale, count, life ); R_Implosion( pos, scale, count, life );
break; break;
case TE_SPRITETRAIL: case TE_SPRITETRAIL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
life = (float)MSG_ReadByte( &buf ) * 0.1f; life = (float)MSG_ReadByte( pbuf ) * 0.1f;
scale = (float)MSG_ReadByte( &buf ); scale = (float)MSG_ReadByte( pbuf );
if( !scale ) scale = 1.0f; if( !scale ) scale = 1.0f;
else scale *= 0.1f; else scale *= 0.1f;
vel = (float)MSG_ReadByte( &buf ) * 10; vel = (float)MSG_ReadByte( pbuf ) * 10;
random = (float)MSG_ReadByte( &buf ) * 10; random = (float)MSG_ReadByte( pbuf ) * 10;
R_Sprite_Trail( type, pos, pos2, modelIndex, count, life, scale, random, 255, vel ); R_Sprite_Trail( type, pos, pos2, modelIndex, count, life, scale, random, 255, vel );
break; break;
case TE_SPRITE: case TE_SPRITE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
scale = (float)MSG_ReadByte( &buf ) * 0.1f; scale = (float)MSG_ReadByte( pbuf ) * 0.1f;
brightness = (float)MSG_ReadByte( &buf ) / 255.0f; brightness = (float)MSG_ReadByte( pbuf ) / 255.0f;
R_TempSprite( pos, vec3_origin, scale, modelIndex, R_TempSprite( pos, vec3_origin, scale, modelIndex,
kRenderTransAdd, kRenderFxNone, brightness, 0.0, FTENT_SPRANIMATE ); kRenderTransAdd, kRenderFxNone, brightness, 0.0, FTENT_SPRANIMATE );
break; break;
case TE_GLOWSPRITE: case TE_GLOWSPRITE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
life = (float)MSG_ReadByte( &buf ) * 0.1f; life = (float)MSG_ReadByte( pbuf ) * 0.1f;
scale = (float)MSG_ReadByte( &buf ) * 0.1f; scale = (float)MSG_ReadByte( pbuf ) * 0.1f;
brightness = (float)MSG_ReadByte( &buf ) / 255.0f; brightness = (float)MSG_ReadByte( pbuf ) / 255.0f;
R_TempSprite( pos, vec3_origin, scale, modelIndex, R_TempSprite( pos, vec3_origin, scale, modelIndex,
kRenderGlow, kRenderFxNoDissipation, brightness, life, FTENT_FADEOUT ); kRenderGlow, kRenderFxNoDissipation, brightness, life, FTENT_FADEOUT );
break; break;
case TE_STREAK_SPLASH: case TE_STREAK_SPLASH:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
count = MSG_ReadShort( &buf ); count = MSG_ReadShort( pbuf );
vel = (float)MSG_ReadShort( &buf ); vel = (float)MSG_ReadShort( pbuf );
random = (float)MSG_ReadShort( &buf ); random = (float)MSG_ReadShort( pbuf );
R_StreakSplash( pos, pos2, color, count, vel, -random, random ); R_StreakSplash( pos, pos2, color, count, vel, -random, random );
break; break;
case TE_DLIGHT: case TE_DLIGHT:
dl = CL_AllocDlight( 0 ); dl = CL_AllocDlight( 0 );
dl->origin[0] = MSG_ReadCoord( &buf ); dl->origin[0] = MSG_ReadCoord( pbuf );
dl->origin[1] = MSG_ReadCoord( &buf ); dl->origin[1] = MSG_ReadCoord( pbuf );
dl->origin[2] = MSG_ReadCoord( &buf ); dl->origin[2] = MSG_ReadCoord( pbuf );
dl->radius = (float)(MSG_ReadByte( &buf ) * 10.0f); dl->radius = (float)(MSG_ReadByte( pbuf ) * 10.0f);
dl->color.r = MSG_ReadByte( &buf ); dl->color.r = MSG_ReadByte( pbuf );
dl->color.g = MSG_ReadByte( &buf ); dl->color.g = MSG_ReadByte( pbuf );
dl->color.b = MSG_ReadByte( &buf ); dl->color.b = MSG_ReadByte( pbuf );
dl->die = cl.time + (float)(MSG_ReadByte( &buf ) * 0.1f); dl->die = cl.time + (float)(MSG_ReadByte( pbuf ) * 0.1f);
dl->decay = (float)(MSG_ReadByte( &buf ) * 10.0f); dl->decay = (float)(MSG_ReadByte( pbuf ) * 10.0f);
break; break;
case TE_ELIGHT: case TE_ELIGHT:
dl = CL_AllocElight( MSG_ReadShort( &buf )); dl = CL_AllocElight( MSG_ReadShort( pbuf ));
dl->origin[0] = MSG_ReadCoord( &buf ); dl->origin[0] = MSG_ReadCoord( pbuf );
dl->origin[1] = MSG_ReadCoord( &buf ); dl->origin[1] = MSG_ReadCoord( pbuf );
dl->origin[2] = MSG_ReadCoord( &buf ); dl->origin[2] = MSG_ReadCoord( pbuf );
dl->radius = MSG_ReadCoord( &buf ); dl->radius = MSG_ReadCoord( pbuf );
dl->color.r = MSG_ReadByte( &buf ); dl->color.r = MSG_ReadByte( pbuf );
dl->color.g = MSG_ReadByte( &buf ); dl->color.g = MSG_ReadByte( pbuf );
dl->color.b = MSG_ReadByte( &buf ); dl->color.b = MSG_ReadByte( pbuf );
life = (float)MSG_ReadByte( &buf ) * 0.1f; life = (float)MSG_ReadByte( pbuf ) * 0.1f;
dl->die = cl.time + life; dl->die = cl.time + life;
dl->decay = MSG_ReadCoord( &buf ); dl->decay = MSG_ReadCoord( pbuf );
if( life != 0 ) dl->decay /= life; if( life != 0 ) dl->decay /= life;
break; break;
case TE_TEXTMESSAGE: case TE_TEXTMESSAGE:
CL_ParseTextMessage( &buf ); CL_ParseTextMessage( pbuf );
break; break;
case TE_LINE: case TE_LINE:
case TE_BOX: case TE_BOX:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
life = (float)(MSG_ReadShort( &buf ) * 0.1f); life = (float)(MSG_ReadShort( pbuf ) * 0.1f);
r = MSG_ReadByte( &buf ); r = MSG_ReadByte( pbuf );
g = MSG_ReadByte( &buf ); g = MSG_ReadByte( pbuf );
b = MSG_ReadByte( &buf ); b = MSG_ReadByte( pbuf );
if( type == TE_LINE ) R_ParticleLine( pos, pos2, r, g, b, life ); if( type == TE_LINE ) R_ParticleLine( pos, pos2, r, g, b, life );
else R_ParticleBox( pos, pos2, r, g, b, life ); else R_ParticleBox( pos, pos2, r, g, b, life );
break; break;
case TE_LARGEFUNNEL: case TE_LARGEFUNNEL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
flags = MSG_ReadShort( &buf ); flags = MSG_ReadShort( pbuf );
R_LargeFunnel( pos, flags ); R_LargeFunnel( pos, flags );
R_FunnelSprite( pos, modelIndex, flags ); R_FunnelSprite( pos, modelIndex, flags );
break; break;
case TE_BLOODSTREAM: case TE_BLOODSTREAM:
case TE_BLOOD: case TE_BLOOD:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
if( type == TE_BLOOD ) R_Blood( pos, pos2, color, count ); if( type == TE_BLOOD ) R_Blood( pos, pos2, color, count );
else R_BloodStream( pos, pos2, color, count ); else R_BloodStream( pos, pos2, color, count );
break; break;
case TE_SHOWLINE: case TE_SHOWLINE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
R_ShowLine( pos, pos2 ); R_ShowLine( pos, pos2 );
break; break;
case TE_FIZZ: case TE_FIZZ:
entityIndex = MSG_ReadShort( &buf ); entityIndex = MSG_ReadShort( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
scale = MSG_ReadByte( &buf ); // same as density scale = MSG_ReadByte( pbuf ); // same as density
pEnt = CL_GetEntityByIndex( entityIndex ); pEnt = CL_GetEntityByIndex( entityIndex );
R_FizzEffect( pEnt, modelIndex, scale ); R_FizzEffect( pEnt, modelIndex, scale );
break; break;
case TE_MODEL: case TE_MODEL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
ang[0] = 0.0f; ang[0] = 0.0f;
ang[1] = MSG_ReadAngle( &buf ); // yaw angle ang[1] = MSG_ReadAngle( pbuf ); // yaw angle
ang[2] = 0.0f; ang[2] = 0.0f;
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
flags = MSG_ReadByte( &buf ); // sound flags flags = MSG_ReadByte( pbuf ); // sound flags
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_TempModel( pos, pos2, ang, life, modelIndex, flags ); R_TempModel( pos, pos2, ang, life, modelIndex, flags );
break; break;
case TE_EXPLODEMODEL: case TE_EXPLODEMODEL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
vel = MSG_ReadCoord( &buf ); vel = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadShort( &buf ); count = MSG_ReadShort( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_TempSphereModel( pos, vel, life, count, modelIndex ); R_TempSphereModel( pos, vel, life, count, modelIndex );
break; break;
case TE_BREAKMODEL: case TE_BREAKMODEL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
ang[0] = MSG_ReadCoord( &buf ); ang[0] = MSG_ReadCoord( pbuf );
ang[1] = MSG_ReadCoord( &buf ); ang[1] = MSG_ReadCoord( pbuf );
ang[2] = MSG_ReadCoord( &buf ); ang[2] = MSG_ReadCoord( pbuf );
random = (float)MSG_ReadByte( &buf ) * 10.0f; random = (float)MSG_ReadByte( pbuf ) * 10.0f;
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
flags = MSG_ReadByte( &buf ); flags = MSG_ReadByte( pbuf );
R_BreakModel( pos, pos2, ang, random, life, count, modelIndex, (char)flags ); R_BreakModel( pos, pos2, ang, random, life, count, modelIndex, (char)flags );
break; break;
case TE_GUNSHOTDECAL: case TE_GUNSHOTDECAL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
entityIndex = MSG_ReadShort( &buf ); entityIndex = MSG_ReadShort( pbuf );
decalIndex = MSG_ReadByte( &buf ); decalIndex = MSG_ReadByte( pbuf );
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 ); CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
R_BulletImpactParticles( pos ); R_BulletImpactParticles( pos );
flags = COM_RandomLong( 0, 0x7fff ); flags = COM_RandomLong( 0, 0x7fff );
@ -2261,139 +2268,139 @@ void CL_ParseTempEntity( sizebuf_t *msg )
break; break;
case TE_SPRAY: case TE_SPRAY:
case TE_SPRITE_SPRAY: case TE_SPRITE_SPRAY:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
vel = (float)MSG_ReadByte( &buf ); vel = (float)MSG_ReadByte( pbuf );
random = (float)MSG_ReadByte( &buf ); random = (float)MSG_ReadByte( pbuf );
if( type == TE_SPRAY ) if( type == TE_SPRAY )
{ {
flags = MSG_ReadByte( &buf ); // rendermode flags = MSG_ReadByte( pbuf ); // rendermode
R_Spray( pos, pos2, modelIndex, count, vel, random, flags ); R_Spray( pos, pos2, modelIndex, count, vel, random, flags );
} }
else R_Sprite_Spray( pos, pos2, modelIndex, count, vel * 2.0f, random ); else R_Sprite_Spray( pos, pos2, modelIndex, count, vel * 2.0f, random );
break; break;
case TE_ARMOR_RICOCHET: case TE_ARMOR_RICOCHET:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
scale = (float)(MSG_ReadByte( &buf ) * 0.1f); scale = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_RicochetSprite( pos, cl_sprite_ricochet, 0.1f, scale ); R_RicochetSprite( pos, cl_sprite_ricochet, 0.1f, scale );
R_RicochetSound( pos ); R_RicochetSound( pos );
break; break;
case TE_PLAYERDECAL: case TE_PLAYERDECAL:
color = MSG_ReadByte( &buf ) - 1; // playernum color = MSG_ReadByte( pbuf ) - 1; // playernum
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
entityIndex = MSG_ReadShort( &buf ); entityIndex = MSG_ReadShort( pbuf );
decalIndex = MSG_ReadByte( &buf ); decalIndex = MSG_ReadByte( pbuf );
CL_PlayerDecal( color, decalIndex, entityIndex, pos ); CL_PlayerDecal( color, decalIndex, entityIndex, pos );
break; break;
case TE_BUBBLES: case TE_BUBBLES:
case TE_BUBBLETRAIL: case TE_BUBBLETRAIL:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
scale = MSG_ReadCoord( &buf ); // water height scale = MSG_ReadCoord( pbuf ); // water height
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
vel = MSG_ReadCoord( &buf ); vel = MSG_ReadCoord( pbuf );
if( type == TE_BUBBLES ) R_Bubbles( pos, pos2, scale, modelIndex, count, vel ); if( type == TE_BUBBLES ) R_Bubbles( pos, pos2, scale, modelIndex, count, vel );
else R_BubbleTrail( pos, pos2, scale, modelIndex, count, vel ); else R_BubbleTrail( pos, pos2, scale, modelIndex, count, vel );
break; break;
case TE_BLOODSPRITE: case TE_BLOODSPRITE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); // sprite #1 modelIndex = MSG_ReadShort( pbuf ); // sprite #1
decalIndex = MSG_ReadShort( &buf ); // sprite #2 decalIndex = MSG_ReadShort( pbuf ); // sprite #2
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
scale = (float)MSG_ReadByte( &buf ); scale = (float)MSG_ReadByte( pbuf );
R_BloodSprite( pos, color, modelIndex, decalIndex, scale ); R_BloodSprite( pos, color, modelIndex, decalIndex, scale );
break; break;
case TE_PROJECTILE: case TE_PROJECTILE:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
life = MSG_ReadByte( &buf ); life = MSG_ReadByte( pbuf );
color = MSG_ReadByte( &buf ); // playernum color = MSG_ReadByte( pbuf ); // playernum
R_Projectile( pos, pos2, modelIndex, life, color, NULL ); R_Projectile( pos, pos2, modelIndex, life, color, NULL );
break; break;
case TE_PLAYERSPRITES: case TE_PLAYERSPRITES:
color = MSG_ReadShort( &buf ); // entitynum color = MSG_ReadShort( pbuf ); // entitynum
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
random = (float)MSG_ReadByte( &buf ); random = (float)MSG_ReadByte( pbuf );
R_PlayerSprites( color, modelIndex, count, random ); R_PlayerSprites( color, modelIndex, count, random );
break; break;
case TE_PARTICLEBURST: case TE_PARTICLEBURST:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
scale = (float)MSG_ReadShort( &buf ); scale = (float)MSG_ReadShort( pbuf );
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_ParticleBurst( pos, scale, color, life ); R_ParticleBurst( pos, scale, color, life );
break; break;
case TE_FIREFIELD: case TE_FIREFIELD:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
scale = (float)MSG_ReadShort( &buf ); scale = (float)MSG_ReadShort( pbuf );
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
flags = MSG_ReadByte( &buf ); flags = MSG_ReadByte( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_FireField( pos, scale, modelIndex, count, flags, life ); R_FireField( pos, scale, modelIndex, count, flags, life );
break; break;
case TE_PLAYERATTACHMENT: case TE_PLAYERATTACHMENT:
color = MSG_ReadByte( &buf ); // playernum color = MSG_ReadByte( pbuf ); // playernum
scale = MSG_ReadCoord( &buf ); // height scale = MSG_ReadCoord( pbuf ); // height
modelIndex = MSG_ReadShort( &buf ); modelIndex = MSG_ReadShort( pbuf );
life = (float)(MSG_ReadShort( &buf ) * 0.1f); life = (float)(MSG_ReadShort( pbuf ) * 0.1f);
R_AttachTentToPlayer( color, modelIndex, scale, life ); R_AttachTentToPlayer( color, modelIndex, scale, life );
break; break;
case TE_KILLPLAYERATTACHMENTS: case TE_KILLPLAYERATTACHMENTS:
color = MSG_ReadByte( &buf ); // playernum color = MSG_ReadByte( pbuf ); // playernum
R_KillAttachedTents( color ); R_KillAttachedTents( color );
break; break;
case TE_MULTIGUNSHOT: case TE_MULTIGUNSHOT:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ) * 0.1f; pos2[0] = MSG_ReadCoord( pbuf ) * 0.1f;
pos2[1] = MSG_ReadCoord( &buf ) * 0.1f; pos2[1] = MSG_ReadCoord( pbuf ) * 0.1f;
pos2[2] = MSG_ReadCoord( &buf ) * 0.1f; pos2[2] = MSG_ReadCoord( pbuf ) * 0.1f;
ang[0] = MSG_ReadCoord( &buf ) * 0.01f; ang[0] = MSG_ReadCoord( pbuf ) * 0.01f;
ang[1] = MSG_ReadCoord( &buf ) * 0.01f; ang[1] = MSG_ReadCoord( pbuf ) * 0.01f;
ang[2] = 0.0f; ang[2] = 0.0f;
count = MSG_ReadByte( &buf ); count = MSG_ReadByte( pbuf );
decalIndices[0] = MSG_ReadByte( &buf ); decalIndices[0] = MSG_ReadByte( pbuf );
R_MultiGunshot( pos, pos2, ang, count, 1, decalIndices ); R_MultiGunshot( pos, pos2, ang, count, 1, decalIndices );
break; break;
case TE_USERTRACER: case TE_USERTRACER:
pos[0] = MSG_ReadCoord( &buf ); pos[0] = MSG_ReadCoord( pbuf );
pos[1] = MSG_ReadCoord( &buf ); pos[1] = MSG_ReadCoord( pbuf );
pos[2] = MSG_ReadCoord( &buf ); pos[2] = MSG_ReadCoord( pbuf );
pos2[0] = MSG_ReadCoord( &buf ); pos2[0] = MSG_ReadCoord( pbuf );
pos2[1] = MSG_ReadCoord( &buf ); pos2[1] = MSG_ReadCoord( pbuf );
pos2[2] = MSG_ReadCoord( &buf ); pos2[2] = MSG_ReadCoord( pbuf );
life = (float)(MSG_ReadByte( &buf ) * 0.1f); life = (float)(MSG_ReadByte( pbuf ) * 0.1f);
color = MSG_ReadByte( &buf ); color = MSG_ReadByte( pbuf );
scale = (float)(MSG_ReadByte( &buf ) * 0.1f); scale = (float)(MSG_ReadByte( pbuf ) * 0.1f);
R_UserTracerParticle( pos, pos2, life, color, scale, 0, NULL ); R_UserTracerParticle( pos, pos2, life, color, scale, 0, NULL );
break; break;
default: default:
@ -2402,7 +2409,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
} }
// throw warning // throw warning
if( MSG_CheckOverflow( &buf )) if( MSG_CheckOverflow( pbuf ))
Con_DPrintf( S_WARN "%s: overflow TE message %i\n", __func__, type ); Con_DPrintf( S_WARN "%s: overflow TE message %i\n", __func__, type );
} }

View file

@ -885,7 +885,7 @@ void CL_ParseDirector( sizebuf_t *msg );
void CL_ParseResLocation( sizebuf_t *msg ); void CL_ParseResLocation( sizebuf_t *msg );
void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t proto ); void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t proto );
void CL_ParseServerMessage( sizebuf_t *msg ); void CL_ParseServerMessage( sizebuf_t *msg );
void CL_ParseTempEntity( sizebuf_t *msg ); void CL_ParseTempEntity( sizebuf_t *msg, connprotocol_t proto );
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf ); qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
qboolean CL_RequestMissingResources( void ); qboolean CL_RequestMissingResources( void );
void CL_RegisterResources ( sizebuf_t *msg ); void CL_RegisterResources ( sizebuf_t *msg );