/* ============== CL_ParseStudioDecal Studio Decal message. Used by engine in case we need save\restore decals ============== */ void CL_ParseStudioDecal( sizebuf_t *msg ) { modelstate_t state; vec3_t start, pos; int decalIndex, entityIndex; int modelIndex = 0; int flags; pos[0] = BF_ReadCoord( msg ); pos[1] = BF_ReadCoord( msg ); pos[2] = BF_ReadCoord( msg ); start[0] = BF_ReadCoord( msg ); start[1] = BF_ReadCoord( msg ); start[2] = BF_ReadCoord( msg ); decalIndex = BF_ReadShort( msg ); entityIndex = BF_ReadShort( msg ); flags = BF_ReadByte( msg ); state.sequence = BF_ReadShort( msg ); state.frame = BF_ReadShort( msg ); state.blending[0] = BF_ReadByte( msg ); state.blending[1] = BF_ReadByte( msg ); state.controller[0] = BF_ReadByte( msg ); state.controller[1] = BF_ReadByte( msg ); state.controller[2] = BF_ReadByte( msg ); state.controller[3] = BF_ReadByte( msg ); if( cls.state == ca_connected ) { // this message came on restore. // read modelindex in case client models are not linked with entities // because first client frame has not yet received modelIndex = BF_ReadShort( msg ); } if( clgame.drawFuncs.R_StudioDecalShoot ) { int decalTexture = CL_DecalIndex( decalIndex ); cl_entity_t *ent = CL_GetEntityByIndex( entityIndex ); if( ent && !ent->model && modelIndex != 0 ) ent->model = Mod_Handle( modelIndex ); clgame.drawFuncs.R_StudioDecalShoot( decalTexture, ent, start, pos, flags, &state ); } }
/* ================== CL_ParseStaticEntity static client entity ================== */ void CL_ParseStaticEntity( sizebuf_t *msg ) { entity_state_t state; cl_entity_t *ent; int i; Q_memset( &state, 0, sizeof( state )); state.modelindex = BF_ReadShort( msg ); state.sequence = BF_ReadByte( msg ); state.frame = BF_ReadByte( msg ); state.colormap = BF_ReadWord( msg ); state.skin = BF_ReadByte( msg ); for( i = 0; i < 3; i++ ) { state.origin[i] = BF_ReadCoord( msg ); state.angles[i] = BF_ReadBitAngle( msg, 16 ); } state.rendermode = BF_ReadByte( msg ); if( state.rendermode != kRenderNormal ) { state.renderamt = BF_ReadByte( msg ); state.rendercolor.r = BF_ReadByte( msg ); state.rendercolor.g = BF_ReadByte( msg ); state.rendercolor.b = BF_ReadByte( msg ); state.renderfx = BF_ReadByte( msg ); } i = clgame.numStatics; if( i >= MAX_STATIC_ENTITIES ) { MsgDev( D_ERROR, "CL_ParseStaticEntity: static entities limit exceeded!\n" ); return; } ent = &clgame.static_entities[i]; clgame.numStatics++; ent->index = 0; // ??? ent->baseline = state; ent->curstate = state; ent->prevstate = state; // statics may be respawned in game e.g. for demo recording if( cls.state == ca_connected ) ent->trivial_accept = INVALID_HANDLE; // setup the new static entity CL_UpdateEntityFields( ent ); if( Mod_GetType( state.modelindex ) == mod_studio ) { CL_UpdateStudioVars( ent, &state, true ); // animate studio model ent->curstate.animtime = cl.time; ent->curstate.framerate = 1.0f; ent->latched.prevframe = 0.0f; } R_AddEfrags( ent ); // add link }