06 Aug 2010
This commit is contained in:
parent
621d270b4b
commit
dbcf0695fe
|
@ -1103,6 +1103,13 @@ int AddToFullPack( entity_state_t *state, edict_t *pView, edict_t *pHost, edict_
|
|||
return 0;
|
||||
}
|
||||
|
||||
// FIXME: temporary hack
|
||||
if( pEdict->v.flags & FL_CUSTOMENTITY )
|
||||
{
|
||||
pEntity->m_iClassType = ED_BEAM;
|
||||
state->ed_type = ED_BEAM;
|
||||
}
|
||||
|
||||
// quick reject by type
|
||||
switch( pEntity->m_iClassType )
|
||||
{
|
||||
|
@ -1289,16 +1296,6 @@ addEntity:
|
|||
// this is conveyor - send speed to render for right texture scrolling
|
||||
state->framerate = pEntity->pev->speed;
|
||||
}
|
||||
else if( state->ed_type == ED_BEAM )
|
||||
{
|
||||
state->gaitsequence = pEntity->pev->frags; // beam type
|
||||
|
||||
// translate StartBeamEntity
|
||||
if( pEntity->pev->owner )
|
||||
state->owner = ENTINDEX( pEntity->pev->owner );
|
||||
else state->owner = 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1311,6 +1308,12 @@ Creates baselines used for network encoding, especially for player data since pl
|
|||
*/
|
||||
void CreateBaseline( entity_state_t *baseline, edict_t *entity, int playermodelindex )
|
||||
{
|
||||
// FIXME: temporary hack
|
||||
if( entity->v.flags & FL_CUSTOMENTITY )
|
||||
{
|
||||
baseline->ed_type = ED_BEAM;
|
||||
}
|
||||
|
||||
// always set nodelta's for baseline
|
||||
baseline->ed_flags |= ESF_NODELTA;
|
||||
|
||||
|
@ -1476,23 +1479,23 @@ void Player_Encode( struct delta_s *pFields, const unsigned char *from, const un
|
|||
localplayer = ( t->number - 1 ) == ENGINE_CURRENT_PLAYER();
|
||||
if ( localplayer )
|
||||
{
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
}
|
||||
|
||||
if ( ( t->movetype == MOVETYPE_FOLLOW ) &&
|
||||
( t->aiment != 0 ) )
|
||||
{
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_UNSETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
}
|
||||
else if ( t->aiment != f->aiment )
|
||||
{
|
||||
DELTA_SETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_SETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_SETBYINDEX( pFields, entity_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
DELTA_SETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN0 ].field );
|
||||
DELTA_SETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN1 ].field );
|
||||
DELTA_SETBYINDEX( pFields, player_field_alias[ FIELD_ORIGIN2 ].field );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -169,17 +169,33 @@ void CBeam::Spawn( void )
|
|||
Precache( );
|
||||
}
|
||||
|
||||
void CBeam::Precache( void )
|
||||
{
|
||||
if ( pev->owner )
|
||||
SetStartEntity( ENTINDEX( pev->owner ) );
|
||||
if ( pev->aiment )
|
||||
SetEndEntity( ENTINDEX( pev->aiment ) );
|
||||
}
|
||||
|
||||
void CBeam::SetStartEntity( int entityIndex )
|
||||
{
|
||||
pev->sequence = (entityIndex & 0x0FFF) | ((pev->sequence&0xF000)<<12);
|
||||
pev->owner = g_engfuncs.pfnPEntityOfEntIndex( entityIndex );
|
||||
}
|
||||
|
||||
void CBeam::SetEndEntity( int entityIndex )
|
||||
{
|
||||
pev->skin = (entityIndex & 0x0FFF) | ((pev->skin&0xF000)<<12);
|
||||
pev->aiment = g_engfuncs.pfnPEntityOfEntIndex( entityIndex );
|
||||
}
|
||||
|
||||
// These don't take attachments into account
|
||||
const Vector &CBeam::GetStartPos( void )
|
||||
{
|
||||
int type = GetType();
|
||||
|
||||
if( type == BEAM_ENTS )
|
||||
if ( GetType() == BEAM_ENTS )
|
||||
{
|
||||
edict_t *pent = GetStartEntity();
|
||||
|
||||
if ( pent )
|
||||
return pent->v.origin;
|
||||
edict_t *pent = g_engfuncs.pfnPEntityOfEntIndex( GetStartEntity() );
|
||||
return pent->v.origin;
|
||||
}
|
||||
return pev->origin;
|
||||
}
|
||||
|
@ -187,16 +203,16 @@ const Vector &CBeam::GetStartPos( void )
|
|||
|
||||
const Vector &CBeam::GetEndPos( void )
|
||||
{
|
||||
int type = GetType();
|
||||
|
||||
if( type == BEAM_ENTS || type == BEAM_ENTPOINT )
|
||||
int type = GetType();
|
||||
if ( type == BEAM_POINTS || type == BEAM_HOSE )
|
||||
{
|
||||
edict_t *pent = GetEndEntity();
|
||||
return pev->oldorigin;
|
||||
}
|
||||
|
||||
if ( pent )
|
||||
return pent->v.angles;
|
||||
}
|
||||
return pev->angles;
|
||||
edict_t *pent = g_engfuncs.pfnPEntityOfEntIndex( GetEndEntity() );
|
||||
if ( pent )
|
||||
return pent->v.origin;
|
||||
return pev->oldorigin;
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,6 +232,7 @@ void CBeam::BeamInit( const char *pSpriteName, int width )
|
|||
{
|
||||
SetObjectClass( ED_BEAM );
|
||||
|
||||
pev->flags |= FL_CUSTOMENTITY;
|
||||
SetColor( 255, 255, 255 );
|
||||
SetBrightness( 255 );
|
||||
SetNoise( 0 );
|
||||
|
@ -252,27 +269,26 @@ void CBeam::HoseInit( const Vector &start, const Vector &direction )
|
|||
}
|
||||
|
||||
|
||||
void CBeam::PointEntInit( const Vector &start, edict_t *pEnt )
|
||||
void CBeam::PointEntInit( const Vector &start, int endIndex )
|
||||
{
|
||||
SetType( BEAM_ENTPOINT );
|
||||
SetStartPos( start );
|
||||
SetEndEntity( pEnt );
|
||||
SetEndEntity( endIndex );
|
||||
SetStartAttachment( 0 );
|
||||
SetEndAttachment( 0 );
|
||||
RelinkBeam();
|
||||
}
|
||||
|
||||
void CBeam::EntsInit( edict_t *pStart, edict_t *pEnd )
|
||||
void CBeam::EntsInit( int startIndex, int endIndex )
|
||||
{
|
||||
SetType( BEAM_ENTS );
|
||||
SetStartEntity( pStart );
|
||||
SetEndEntity( pEnd );
|
||||
SetStartEntity( startIndex );
|
||||
SetEndEntity( endIndex );
|
||||
SetStartAttachment( 0 );
|
||||
SetEndAttachment( 0 );
|
||||
RelinkBeam();
|
||||
}
|
||||
|
||||
|
||||
void CBeam::RelinkBeam( void )
|
||||
{
|
||||
const Vector &startPos = GetStartPos(), &endPos = GetEndPos();
|
||||
|
@ -875,6 +891,7 @@ void CLightning::BeamUpdateVars( void )
|
|||
pev->skin = 0;
|
||||
pev->sequence = 0;
|
||||
pev->rendermode = 0;
|
||||
pev->flags |= FL_CUSTOMENTITY;
|
||||
pev->model = m_iszSpriteName;
|
||||
SetTexture( m_spriteTexture );
|
||||
|
||||
|
@ -905,12 +922,12 @@ void CLightning::BeamUpdateVars( void )
|
|||
if ( beamType == BEAM_POINTS || beamType == BEAM_HOSE )
|
||||
SetEndPos( pEnd->v.origin );
|
||||
else
|
||||
SetEndEntity( pEnd );
|
||||
SetEndEntity( ENTINDEX(pEnd) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStartEntity( pStart );
|
||||
SetEndEntity( pEnd );
|
||||
SetStartEntity( ENTINDEX(pStart) );
|
||||
SetEndEntity( ENTINDEX(pEnd) );
|
||||
}
|
||||
|
||||
RelinkBeam();
|
||||
|
@ -950,6 +967,7 @@ void CLaser::Spawn( void )
|
|||
Precache( );
|
||||
|
||||
SetThink( StrikeThink );
|
||||
pev->flags |= FL_CUSTOMENTITY;
|
||||
|
||||
PointsInit( pev->origin, pev->origin );
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ class CBeam : public CBaseEntity
|
|||
{
|
||||
public:
|
||||
void Spawn( void );
|
||||
void Precache( void );
|
||||
int ObjectCaps( void )
|
||||
{
|
||||
int flags = 0;
|
||||
|
@ -116,15 +117,15 @@ public:
|
|||
|
||||
// These functions are here to show the way beams are encoded as entities.
|
||||
// Encoding beams as entities simplifies their management in the client/server architecture
|
||||
inline void SetType( int type ) { pev->rendermode = type; }
|
||||
inline void SetFlags( int flags ) { pev->renderfx |= flags; }
|
||||
inline void SetType( int type ) { pev->rendermode = (pev->rendermode & 0xF0) | (type&0x0F); }
|
||||
inline void SetFlags( int flags ) { pev->rendermode = (pev->rendermode & 0x0F) | (flags&0xF0); }
|
||||
inline void SetStartPos( const Vector& pos ) { pev->origin = pos; }
|
||||
inline void SetEndPos( const Vector& pos ) { pev->oldorigin = pos; }
|
||||
inline void SetStartEntity( edict_t *pEnt ) { pev->aiment = pEnt; }
|
||||
inline void SetEndEntity( edict_t *pEnt ) { pev->owner = pEnt; }
|
||||
inline void SetEndPos( const Vector& pos ) { pev->angles = pos; }
|
||||
void SetStartEntity( int entityIndex );
|
||||
void SetEndEntity( int entityIndex );
|
||||
|
||||
inline void SetStartAttachment( int attachment ) { pev->colormap = (pev->colormap & 0xFF00)>>8 | attachment; }
|
||||
inline void SetEndAttachment( int attachment ) { pev->colormap = (pev->colormap & 0xFF) | (attachment<<8); }
|
||||
inline void SetStartAttachment( int attachment ) { pev->sequence = (pev->sequence & 0x0FFF) | ((attachment&0xF)<<12); }
|
||||
inline void SetEndAttachment( int attachment ) { pev->skin = (pev->skin & 0x0FFF) | ((attachment&0xF)<<12); }
|
||||
|
||||
inline void SetTexture( int spriteIndex ) { pev->modelindex = spriteIndex; }
|
||||
inline void SetWidth( int width ) { pev->scale = width; }
|
||||
|
@ -134,10 +135,10 @@ public:
|
|||
inline void SetFrame( float frame ) { pev->frame = frame; }
|
||||
inline void SetScrollRate( int speed ) { pev->animtime = speed; }
|
||||
|
||||
inline int GetType( void ) { return pev->rendermode; }
|
||||
inline int GetFlags( void ) { return pev->renderfx; }
|
||||
inline edict_t *GetStartEntity( void ) { return pev->owner; }
|
||||
inline edict_t *GetEndEntity( void ) { return pev->aiment; }
|
||||
inline int GetType( void ) { return pev->rendermode & 0x0F; }
|
||||
inline int GetFlags( void ) { return pev->rendermode & 0xF0; }
|
||||
inline int GetStartEntity( void ) { return pev->sequence & 0xFFF; }
|
||||
inline int GetEndEntity( void ) { return pev->skin & 0xFFF; }
|
||||
|
||||
const Vector &GetStartPos( void );
|
||||
const Vector &GetEndPos( void );
|
||||
|
@ -162,8 +163,8 @@ public:
|
|||
// Init after BeamCreate()
|
||||
void BeamInit( const char *pSpriteName, int width );
|
||||
void PointsInit( const Vector &start, const Vector &end );
|
||||
void PointEntInit( const Vector &start, edict_t *pEnt );
|
||||
void EntsInit( edict_t *pStart, edict_t *pEnd );
|
||||
void PointEntInit( const Vector &start, int endIndex );
|
||||
void EntsInit( int startIndex, int endIndex );
|
||||
void HoseInit( const Vector &start, const Vector &direction );
|
||||
|
||||
static CBeam *BeamCreate( const char *pSpriteName, int width );
|
||||
|
|
|
@ -493,13 +493,13 @@ void CEgon::CreateEffect( void )
|
|||
DestroyEffect();
|
||||
|
||||
m_pBeam = CBeam::BeamCreate( EGON_BEAM_SPRITE, 40 );
|
||||
m_pBeam->PointEntInit( pev->origin, m_pPlayer->edict() );
|
||||
m_pBeam->PointEntInit( pev->origin, m_pPlayer->entindex() );
|
||||
m_pBeam->SetFlags( FBEAM_SINENOISE );
|
||||
m_pBeam->SetEndAttachment( 1 );
|
||||
m_pBeam->pev->spawnflags |= SF_BEAM_TEMPORARY; // Flag these to be destroyed on save/restore or level transition
|
||||
|
||||
m_pNoise = CBeam::BeamCreate( EGON_BEAM_SPRITE, 55 );
|
||||
m_pNoise->PointEntInit( pev->origin, m_pPlayer->edict() );
|
||||
m_pNoise->PointEntInit( pev->origin, m_pPlayer->entindex() );
|
||||
m_pNoise->SetScrollRate( 25 );
|
||||
m_pNoise->SetBrightness( 100 );
|
||||
m_pNoise->SetEndAttachment( 1 );
|
||||
|
|
|
@ -511,7 +511,7 @@ void CGargantua :: FlameCreate( void )
|
|||
Vector vecEnd = (gpGlobals->v_forward * GARG_FLAME_LENGTH) + posGun;
|
||||
UTIL_TraceLine( posGun, vecEnd, dont_ignore_monsters, edict(), &trace );
|
||||
|
||||
m_pFlame[i]->PointEntInit( trace.vecEndPos, edict() );
|
||||
m_pFlame[i]->PointEntInit( trace.vecEndPos, entindex() );
|
||||
if ( i < 2 )
|
||||
m_pFlame[i]->SetColor( 255, 130, 90 );
|
||||
else
|
||||
|
|
|
@ -2419,7 +2419,7 @@ void CHGruntRepel::RepelUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE
|
|||
pGrunt->m_vecLastPosition = tr.vecEndPos;
|
||||
|
||||
CBeam *pBeam = CBeam::BeamCreate( "sprites/rope.spr", 10 );
|
||||
pBeam->PointEntInit( pev->origin + Vector(0,0,112), pGrunt->edict() );
|
||||
pBeam->PointEntInit( pev->origin + Vector(0,0,112), pGrunt->entindex() );
|
||||
pBeam->SetFlags( FBEAM_SOLID );
|
||||
pBeam->SetColor( 255, 255, 255 );
|
||||
pBeam->SetThink( SUB_Remove );
|
||||
|
|
|
@ -753,7 +753,7 @@ void CISlave :: ArmBeam( int side )
|
|||
if (!m_pBeam[m_iBeams])
|
||||
return;
|
||||
|
||||
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, edict( ) );
|
||||
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex( ) );
|
||||
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
|
||||
// m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
|
||||
m_pBeam[m_iBeams]->SetColor( 96, 128, 16 );
|
||||
|
@ -800,7 +800,7 @@ void CISlave :: WackBeam( int side, CBaseEntity *pEntity )
|
|||
if (!m_pBeam[m_iBeams])
|
||||
return;
|
||||
|
||||
m_pBeam[m_iBeams]->PointEntInit( pEntity->Center(), edict( ) );
|
||||
m_pBeam[m_iBeams]->PointEntInit( pEntity->Center(), entindex( ) );
|
||||
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
|
||||
m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
|
||||
m_pBeam[m_iBeams]->SetBrightness( 255 );
|
||||
|
@ -830,7 +830,7 @@ void CISlave :: ZapBeam( int side )
|
|||
if (!m_pBeam[m_iBeams])
|
||||
return;
|
||||
|
||||
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, edict( ) );
|
||||
m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex( ) );
|
||||
m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
|
||||
m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
|
||||
m_pBeam[m_iBeams]->SetBrightness( 255 );
|
||||
|
|
|
@ -304,7 +304,7 @@ CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc )
|
|||
pGrunt->SetActivity( ACT_GLIDE );
|
||||
|
||||
CBeam *pBeam = CBeam::BeamCreate( "sprites/rope.spr", 10 );
|
||||
pBeam->PointEntInit( vecSrc + Vector(0,0,112), pGrunt->edict() );
|
||||
pBeam->PointEntInit( vecSrc + Vector(0,0,112), pGrunt->entindex() );
|
||||
pBeam->SetFlags( FBEAM_SOLID );
|
||||
pBeam->SetColor( 255, 255, 255 );
|
||||
pBeam->SetThink( SUB_Remove );
|
||||
|
|
|
@ -254,7 +254,7 @@ void CTripmineGrenade :: MakeBeam( void )
|
|||
Vector vecTmpEnd = pev->origin + m_vecDir * 2048 * m_flBeamLength;
|
||||
|
||||
m_pBeam = CBeam::BeamCreate( g_pModelNameLaser, 10 );
|
||||
m_pBeam->PointEntInit( vecTmpEnd, edict() );
|
||||
m_pBeam->PointEntInit( vecTmpEnd, entindex() );
|
||||
m_pBeam->SetColor( 0, 214, 198 );
|
||||
m_pBeam->SetScrollRate( 255 );
|
||||
m_pBeam->SetBrightness( 64 );
|
||||
|
|
|
@ -251,6 +251,11 @@ void HUD_UpdateEntityVars( edict_t *ent, const entity_state_t *state, const enti
|
|||
{
|
||||
ent->v.angles = LerpAngle( prev->angles, state->angles, m_fLerp );
|
||||
ent->v.basevelocity = LerpPoint( prev->basevelocity, state->basevelocity, m_fLerp );
|
||||
|
||||
if( ent != GetLocalPlayer( ))
|
||||
{
|
||||
ent->v.origin = LerpPoint( prev->origin, state->origin, m_fLerp );
|
||||
}
|
||||
}
|
||||
|
||||
// interpolate scale, renderamount etc
|
||||
|
@ -310,11 +315,8 @@ void HUD_UpdateEntityVars( edict_t *ent, const entity_state_t *state, const enti
|
|||
}
|
||||
break;
|
||||
case ED_BEAM:
|
||||
ent->v.oldorigin = state->oldorigin; // beam endpoint
|
||||
ent->v.frags = state->gaitsequence;
|
||||
if( state->owner )
|
||||
ent->v.owner = GetEntityByIndex( state->owner );
|
||||
else ent->v.owner = NULL;
|
||||
ent->v.origin = state->origin;
|
||||
ent->v.angles = state->angles; // beam endpoint
|
||||
|
||||
// add server beam now
|
||||
g_pViewRenderBeams->AddServerBeam( ent );
|
||||
|
|
|
@ -59,8 +59,7 @@ static bool ComputeBeamEntPosition( edict_t *pEnt, int nAttachment, Vector& pt )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !GET_ATTACHMENT( pEnt, nAttachment, pt, NULL ))
|
||||
return false;
|
||||
GET_ATTACHMENT( pEnt, nAttachment, pt, NULL );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1676,23 +1675,23 @@ void CViewRenderBeams::DrawBeam( edict_t *pbeam )
|
|||
Beam_t beam;
|
||||
|
||||
// NOTE: beam settings stored in various entavrs_t fields
|
||||
// see server/basebeams.h for details
|
||||
// see effects.h for details
|
||||
|
||||
// Set up the beam.
|
||||
int beamType = pbeam->v.rendermode;
|
||||
int beamType = ( pbeam->v.rendermode & 0x0F );
|
||||
|
||||
BeamInfo_t beamInfo;
|
||||
beamInfo.m_vecStart = pbeam->v.origin;
|
||||
beamInfo.m_vecEnd = pbeam->v.oldorigin;
|
||||
beamInfo.m_vecEnd = pbeam->v.angles;
|
||||
beamInfo.m_pStartEnt = beamInfo.m_pEndEnt = NULL;
|
||||
beamInfo.m_nModelIndex = pbeam->v.modelindex;
|
||||
beamInfo.m_flLife = 0;
|
||||
beamInfo.m_flWidth = (float)(pbeam->v.scale * 0.1f);
|
||||
beamInfo.m_flWidth = pbeam->v.scale;
|
||||
beamInfo.m_flEndWidth = beamInfo.m_flWidth;
|
||||
beamInfo.m_flFadeLength = 0.0f; // will be set on first call UpdateBeam
|
||||
beamInfo.m_flAmplitude = (float)(pbeam->v.body * 0.1f);
|
||||
beamInfo.m_flBrightness = pbeam->v.renderamt;
|
||||
beamInfo.m_flSpeed = (float)(pbeam->v.animtime * 0.1f);
|
||||
beamInfo.m_flSpeed = pbeam->v.animtime;
|
||||
|
||||
SetupBeam( &beam, beamInfo );
|
||||
|
||||
|
@ -1710,28 +1709,28 @@ void CViewRenderBeams::DrawBeam( edict_t *pbeam )
|
|||
case BEAM_ENTS:
|
||||
beam.type = TE_BEAMPOINTS;
|
||||
beam.flags = FBEAM_STARTENTITY|FBEAM_ENDENTITY;
|
||||
beam.entity[0] = LinkWithViewModel( pbeam->v.aiment );
|
||||
beam.attachmentIndex[0] = pbeam->v.colormap & 0xFF;
|
||||
beam.entity[1] = LinkWithViewModel( pbeam->v.owner );
|
||||
beam.attachmentIndex[1] = ((pbeam->v.colormap & 0xFF00)>>8);
|
||||
beam.numAttachments = (pbeam->v.owner) ? ((pbeam->v.aiment) ? 2 : 1) : 0;
|
||||
beam.entity[0] = LinkWithViewModel( GetEntityByIndex( pbeam->v.sequence & 0xFFF ));
|
||||
beam.attachmentIndex[0] = BEAMENT_ATTACHMENT( pbeam->v.sequence );
|
||||
beam.entity[1] = LinkWithViewModel( GetEntityByIndex( pbeam->v.skin & 0xFFF ) );
|
||||
beam.attachmentIndex[1] = BEAMENT_ATTACHMENT( pbeam->v.skin );
|
||||
beam.numAttachments = (beam.entity[0]) ? ((beam.entity[1]) ? 2 : 1) : 0;
|
||||
break;
|
||||
case BEAM_HOSE:
|
||||
beam.type = TE_BEAMHOSE;
|
||||
beam.flags = FBEAM_STARTENTITY|FBEAM_ENDENTITY;
|
||||
beam.entity[0] = LinkWithViewModel( pbeam->v.aiment );
|
||||
beam.attachmentIndex[0] = pbeam->v.colormap & 0xFF;
|
||||
beam.entity[1] = LinkWithViewModel( pbeam->v.owner );
|
||||
beam.attachmentIndex[1] = ((pbeam->v.colormap & 0xFF00)>>8);
|
||||
beam.numAttachments = (pbeam->v.owner) ? ((pbeam->v.aiment) ? 2 : 1) : 0;
|
||||
beam.entity[0] = LinkWithViewModel( GetEntityByIndex( pbeam->v.sequence & 0xFFF ) );
|
||||
beam.attachmentIndex[0] = BEAMENT_ATTACHMENT( pbeam->v.sequence );
|
||||
beam.entity[1] = LinkWithViewModel( GetEntityByIndex( pbeam->v.skin & 0xFFF ) );
|
||||
beam.attachmentIndex[1] = BEAMENT_ATTACHMENT( pbeam->v.skin );
|
||||
beam.numAttachments = (beam.entity[0]) ? ((beam.entity[1]) ? 2 : 1) : 0;
|
||||
break;
|
||||
case BEAM_ENTPOINT:
|
||||
beam.type = TE_BEAMPOINTS;
|
||||
beam.flags = 0;
|
||||
beam.entity[0] = LinkWithViewModel( pbeam->v.aiment );
|
||||
beam.attachmentIndex[0] = pbeam->v.colormap & 0xFF;
|
||||
beam.entity[1] = LinkWithViewModel( pbeam->v.owner );
|
||||
beam.attachmentIndex[1] = ((pbeam->v.colormap & 0xFF00)>>8);
|
||||
beam.entity[0] = LinkWithViewModel( GetEntityByIndex( pbeam->v.sequence & 0xFFF ) );
|
||||
beam.attachmentIndex[0] = BEAMENT_ATTACHMENT( pbeam->v.sequence );
|
||||
beam.entity[1] = LinkWithViewModel( GetEntityByIndex( pbeam->v.skin & 0xFFF ) );
|
||||
beam.attachmentIndex[1] = BEAMENT_ATTACHMENT( pbeam->v.skin );
|
||||
beam.numAttachments = 0;
|
||||
beam.flags = 0;
|
||||
if ( beam.entity[0] )
|
||||
|
@ -1750,7 +1749,7 @@ void CViewRenderBeams::DrawBeam( edict_t *pbeam )
|
|||
break;
|
||||
}
|
||||
|
||||
beam.flags |= pbeam->v.renderfx & (FBEAM_SINENOISE|FBEAM_SOLID|FBEAM_SHADEIN|FBEAM_SHADEOUT);
|
||||
beam.flags |= ( pbeam->v.rendermode & 0xF0 ) & (FBEAM_SINENOISE|FBEAM_SOLID|FBEAM_SHADEIN|FBEAM_SHADEOUT);
|
||||
|
||||
// draw it
|
||||
UpdateBeam( &beam, gpGlobals->frametime );
|
||||
|
|
|
@ -116,9 +116,11 @@
|
|||
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
|
||||
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
|
||||
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
|
||||
|
||||
#define FL_PHS_FILTER (1<<27) // This entity requested phs bitvector in AddToFullPack calls
|
||||
#define FL_PROJECTILE (1<<28) // This is a projectile entity
|
||||
#define FL_TEAMSLAVE (1<<29) // Not first on the team ( engine 'moves with' spec)
|
||||
|
||||
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
|
||||
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
||||
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
|
||||
|
||||
|
|
|
@ -1559,7 +1559,7 @@ pfnPhysInfo_ValueForKey
|
|||
*/
|
||||
static const char* pfnPhysInfo_ValueForKey( const char *key )
|
||||
{
|
||||
return Info_ValueForKey( cl.physinfo, key );
|
||||
return Info_ValueForKey( cl.frame.cd.physinfo, key );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -150,13 +150,10 @@ void Cmd_ForwardToServer( void )
|
|||
}
|
||||
|
||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
BF_WriteString( &cls.netchan.message, cmd );
|
||||
|
||||
if( Cmd_Argc() > 1 )
|
||||
{
|
||||
BF_WriteString( &cls.netchan.message, " " );
|
||||
BF_WriteString( &cls.netchan.message, Cmd_Args( ));
|
||||
}
|
||||
BF_WriteString( &cls.netchan.message, va( "%s %s", cmd, Cmd_Args( )));
|
||||
else BF_WriteString( &cls.netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -732,9 +729,6 @@ void CL_ConnectionlessPacket( netadr_t from, bitbuf_t *msg )
|
|||
BF_WriteString( &cls.netchan.message, "new" );
|
||||
cls.state = ca_connected;
|
||||
UI_SetActiveMenu( false );
|
||||
|
||||
// FIXME!!! properly send tables to client
|
||||
Delta_Init ();
|
||||
}
|
||||
else if( !com.strcmp( c, "info" ))
|
||||
{
|
||||
|
@ -890,7 +884,7 @@ CL_Physinfo_f
|
|||
void CL_Physinfo_f( void )
|
||||
{
|
||||
Msg( "Phys info settings:\n" );
|
||||
Info_Print( cl.physinfo );
|
||||
Info_Print( cl.frame.cd.physinfo );
|
||||
}
|
||||
|
||||
int precache_check; // for autodownload of precache items
|
||||
|
|
|
@ -487,7 +487,7 @@ void CL_RunCmd( edict_t *clent, usercmd_t *ucmd )
|
|||
if( ucmd->impulse ) clent->v.impulse = ucmd->impulse;
|
||||
|
||||
// setup playermove state
|
||||
PM_SetupMove( clgame.pmove, clent, ucmd, cl.physinfo );
|
||||
PM_SetupMove( clgame.pmove, clent, ucmd, cl.frame.cd.physinfo );
|
||||
|
||||
// motor!
|
||||
clgame.dllFuncs.pfnPM_Move( clgame.pmove, false );
|
||||
|
|
|
@ -27,7 +27,7 @@ char *svc_strings[256] =
|
|||
"svc_spawnbaseline",
|
||||
"svc_download",
|
||||
"svc_changing",
|
||||
"svc_physinfo",
|
||||
"svc_deltatable",
|
||||
"svc_usermessage",
|
||||
"svc_packetentities",
|
||||
"svc_frame",
|
||||
|
@ -907,6 +907,9 @@ void CL_ParseServerMessage( bitbuf_t *msg )
|
|||
case svc_spawnbaseline:
|
||||
CL_ParseBaseline( msg );
|
||||
break;
|
||||
case svc_deltatable:
|
||||
Delta_ParseTableField( msg );
|
||||
break;
|
||||
case svc_download:
|
||||
CL_ParseDownload( msg );
|
||||
break;
|
||||
|
@ -928,9 +931,6 @@ void CL_ParseServerMessage( bitbuf_t *msg )
|
|||
case svc_crosshairangle:
|
||||
CL_ParseCrosshairAngle( msg );
|
||||
break;
|
||||
case svc_physinfo:
|
||||
com.strncpy( cl.physinfo, BF_ReadString( msg ), sizeof( cl.physinfo ));
|
||||
break;
|
||||
case svc_print:
|
||||
i = BF_ReadByte( msg );
|
||||
if( i == PRINT_CHAT ) // chat
|
||||
|
|
|
@ -97,8 +97,6 @@ typedef struct
|
|||
int movemessages;
|
||||
int serverframetime; // server frametime
|
||||
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
|
||||
char physinfo[MAX_INFO_STRING]; // physics info string
|
||||
|
||||
entity_state_t entity_curstates[MAX_PARSE_ENTITIES]; // FIXME: this is must match with max_edicts ?
|
||||
|
||||
// locally derived information from server state
|
||||
|
|
|
@ -31,6 +31,13 @@
|
|||
#define MAX_ENTNUMBER 99999 // for server and client parsing
|
||||
#define MAX_HEARTBEAT -99999 // connection time
|
||||
|
||||
#ifdef _DEBUG
|
||||
void DBG_AssertFunction( BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage );
|
||||
#define Assert( f ) DBG_AssertFunction( f, #f, __FILE__, __LINE__, NULL )
|
||||
#else
|
||||
#define Assert( f )
|
||||
#endif
|
||||
|
||||
extern cvar_t *scr_width;
|
||||
extern cvar_t *scr_height;
|
||||
extern cvar_t *allow_download;
|
||||
|
|
|
@ -9,6 +9,17 @@
|
|||
#include "const.h"
|
||||
#include "bspfile.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
void DBG_AssertFunction( BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage )
|
||||
{
|
||||
if( fExpr ) return;
|
||||
|
||||
if( szMessage != NULL )
|
||||
MsgDev( at_error, "ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage );
|
||||
else MsgDev( at_error, "ASSERT FAILED:\n %s \n(%s@%d)\n", szExpr, szFile, szLine );
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
/*
|
||||
=======================================================================
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ void BF_InitExt( bitbuf_t *bf, const char *pDebugName, void *pData, int nBytes,
|
|||
void BF_StartWriting( bitbuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// make sure it's dword aligned and padded.
|
||||
// ASSERT(( nBytes % 4 ) == 0 );
|
||||
ASSERT(((dword)pData & 3 ) == 0 );
|
||||
// Assert(( nBytes % 4 ) == 0 );
|
||||
Assert(((dword)pData & 3 ) == 0 );
|
||||
|
||||
bf->pData = (byte *)pData;
|
||||
bf->nDataBytes = nBytes;
|
||||
|
@ -55,7 +55,7 @@ void BF_StartWriting( bitbuf_t *bf, void *pData, int nBytes, int iStartBit, int
|
|||
}
|
||||
else
|
||||
{
|
||||
ASSERT( nBits <= nBytes * 8 );
|
||||
Assert( nBits <= nBytes * 8 );
|
||||
bf->nDataBits = nBits;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void BF_WriteUBitLongExt( bitbuf_t *bf, uint curData, int numbits, bool bCheckRa
|
|||
if( curData >= (unsigned long)BIT( numbits ))
|
||||
MsgDev( D_ERROR, "Msg %s: out of range value!\n", bf->pDebugName );
|
||||
}
|
||||
ASSERT( numbits >= 0 && numbits <= 32 );
|
||||
Assert( numbits >= 0 && numbits <= 32 );
|
||||
#endif
|
||||
|
||||
// bounds checking..
|
||||
|
@ -141,7 +141,7 @@ void BF_WriteUBitLongExt( bitbuf_t *bf, uint curData, int numbits, bool bCheckRa
|
|||
dword iCurBitMasked;
|
||||
int nBitsWritten;
|
||||
|
||||
ASSERT(( iDWord * 4 + sizeof( long )) <= (uint)bf->nDataBytes );
|
||||
Assert(( iDWord * 4 + sizeof( long )) <= (uint)bf->nDataBytes );
|
||||
|
||||
iCurBitMasked = iCurBit & 31;
|
||||
((dword *)bf->pData)[iDWord] &= BitWriteMasks[iCurBitMasked][nBitsLeft];
|
||||
|
@ -174,7 +174,7 @@ sign bit comes first
|
|||
void BF_WriteSBitLong( bitbuf_t *bf, int data, int numbits )
|
||||
{
|
||||
// do we have a valid # of bits to encode with?
|
||||
ASSERT( numbits >= 1 );
|
||||
Assert( numbits >= 1 );
|
||||
|
||||
// NOTE: it does this wierdness here so it's bit-compatible with regular integer data in the buffer.
|
||||
// (Some old code writes direct integers right into the buffer).
|
||||
|
@ -186,11 +186,11 @@ void BF_WriteSBitLong( bitbuf_t *bf, int data, int numbits )
|
|||
// Make sure it doesn't overflow.
|
||||
if( data < 0 )
|
||||
{
|
||||
ASSERT( data >= -BIT( numbits - 1 ));
|
||||
Assert( data >= -BIT( numbits - 1 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT( data < BIT( numbits - 1 ));
|
||||
Assert( data < BIT( numbits - 1 ));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -107,7 +107,7 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport )
|
|||
chan->last_received = Sys_Milliseconds ();
|
||||
chan->incoming_sequence = 0;
|
||||
chan->outgoing_sequence = 1;
|
||||
chan->compress = false;
|
||||
chan->compress = true;
|
||||
|
||||
BF_Init( &chan->message, "NetData", chan->message_buf, sizeof( chan->message_buf ));
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ void Netchan_TransmitBits( netchan_t *chan, int lengthInBits, byte *data )
|
|||
}
|
||||
|
||||
size1 = BF_GetNumBytesWritten( &send );
|
||||
if( chan->compress ) Huff_CompressPacket( &send, (chan->sock == NS_CLIENT) ? 10 : 8 );
|
||||
if( chan->compress ) Huff_CompressPacket( &send, ( chan->sock == NS_CLIENT ) ? 10 : 8 );
|
||||
size2 = BF_GetNumBytesWritten( &send );
|
||||
|
||||
chan->total_sended += size2;
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include "common.h"
|
||||
#include "byteorder.h"
|
||||
#include "mathlib.h"
|
||||
#include "protocol.h"
|
||||
#include "net_encode.h"
|
||||
#include "weaponinfo.h"
|
||||
|
||||
#define DELTA_PATH "delta.lst"
|
||||
static bool delta_init = false;
|
||||
|
@ -33,6 +35,27 @@ static const delta_field_t cmd_fields[] =
|
|||
{ NULL },
|
||||
};
|
||||
|
||||
static const delta_field_t pm_fields[] =
|
||||
{
|
||||
{ PHYS_DEF( gravity ) },
|
||||
{ PHYS_DEF( stopspeed ) },
|
||||
{ PHYS_DEF( maxspeed ) },
|
||||
{ PHYS_DEF( spectatormaxspeed ) },
|
||||
{ PHYS_DEF( accelerate ) },
|
||||
{ PHYS_DEF( airaccelerate ) },
|
||||
{ PHYS_DEF( wateraccelerate ) },
|
||||
{ PHYS_DEF( friction ) },
|
||||
{ PHYS_DEF( edgefriction ) },
|
||||
{ PHYS_DEF( waterfriction ) },
|
||||
{ PHYS_DEF( bounce ) },
|
||||
{ PHYS_DEF( stepsize ) },
|
||||
{ PHYS_DEF( maxvelocity ) },
|
||||
{ PHYS_DEF( footsteps ) },
|
||||
{ PHYS_DEF( rollangle ) },
|
||||
{ PHYS_DEF( rollspeed ) },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
static const delta_field_t ev_fields[] =
|
||||
{
|
||||
{ EVNT_DEF( flags ) },
|
||||
|
@ -56,6 +79,33 @@ static const delta_field_t ev_fields[] =
|
|||
{ NULL },
|
||||
};
|
||||
|
||||
static const delta_field_t wd_fields[] =
|
||||
{
|
||||
{ WPDT_DEF( m_iId ) },
|
||||
{ WPDT_DEF( m_iClip ) },
|
||||
{ WPDT_DEF( m_flNextPrimaryAttack ) },
|
||||
{ WPDT_DEF( m_flNextSecondaryAttack ) },
|
||||
{ WPDT_DEF( m_flTimeWeaponIdle ) },
|
||||
{ WPDT_DEF( m_fInReload ) },
|
||||
{ WPDT_DEF( m_fInSpecialReload ) },
|
||||
{ WPDT_DEF( m_flNextReload ) },
|
||||
{ WPDT_DEF( m_flPumpTime ) },
|
||||
{ WPDT_DEF( m_fReloadTime ) },
|
||||
{ WPDT_DEF( m_fAimedDamage ) },
|
||||
{ WPDT_DEF( m_fNextAimBonus ) },
|
||||
{ WPDT_DEF( m_fInZoom ) },
|
||||
{ WPDT_DEF( m_iWeaponState ) },
|
||||
{ WPDT_DEF( iuser1 ) },
|
||||
{ WPDT_DEF( iuser2 ) },
|
||||
{ WPDT_DEF( iuser3 ) },
|
||||
{ WPDT_DEF( iuser4 ) },
|
||||
{ WPDT_DEF( fuser1 ) },
|
||||
{ WPDT_DEF( fuser2 ) },
|
||||
{ WPDT_DEF( fuser3 ) },
|
||||
{ WPDT_DEF( fuser4 ) },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
static const delta_field_t cd_fields[] =
|
||||
{
|
||||
{ CLDT_DEF( origin[0] ) },
|
||||
|
@ -120,6 +170,7 @@ static const delta_field_t cd_fields[] =
|
|||
static const delta_field_t ent_fields[] =
|
||||
{
|
||||
{ ENTS_DEF( classname ) },
|
||||
{ ENTS_DEF( ed_type ) },
|
||||
{ ENTS_DEF( ed_flags ) },
|
||||
{ ENTS_DEF( origin[0] ) },
|
||||
{ ENTS_DEF( origin[1] ) },
|
||||
|
@ -228,8 +279,10 @@ static const delta_field_t ent_fields[] =
|
|||
static delta_info_t dt_info[] =
|
||||
{
|
||||
{ "event_t", ev_fields, NUM_FIELDS( ev_fields ) },
|
||||
{ "movevars_t", pm_fields, NUM_FIELDS( pm_fields ) },
|
||||
{ "usercmd_t", cmd_fields, NUM_FIELDS( cmd_fields ) },
|
||||
{ "clientdata_t", cd_fields, NUM_FIELDS( cd_fields ) },
|
||||
{ "weapon_data_t", wd_fields, NUM_FIELDS( wd_fields ) },
|
||||
{ "entity_state_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
{ "entity_state_player_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
{ "custom_entity_state_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
|
@ -255,6 +308,66 @@ delta_info_t *Delta_FindStruct( const char *name )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int Delta_NumTables( void )
|
||||
{
|
||||
return NUM_FIELDS( dt_info );
|
||||
}
|
||||
|
||||
delta_info_t *Delta_FindStructByIndex( int index )
|
||||
{
|
||||
if( index < 0 || index >= NUM_FIELDS( dt_info ))
|
||||
return NULL;
|
||||
|
||||
return &dt_info[index];
|
||||
}
|
||||
|
||||
delta_info_t *Delta_FindStructByEncoder( const char *encoderName )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !encoderName || !encoderName[0] )
|
||||
return NULL;
|
||||
|
||||
for( i = 0; i < NUM_FIELDS( dt_info ); i++ )
|
||||
{
|
||||
if( !com.stricmp( dt_info[i].funcName, encoderName ))
|
||||
return &dt_info[i];
|
||||
}
|
||||
// found nothing
|
||||
return NULL;
|
||||
}
|
||||
|
||||
delta_info_t *Delta_FindStructByDelta( const delta_t *pFields )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !pFields ) return NULL;
|
||||
|
||||
for( i = 0; i < NUM_FIELDS( dt_info ); i++ )
|
||||
{
|
||||
if( dt_info[i].pFields == pFields )
|
||||
return &dt_info[i];
|
||||
}
|
||||
// found nothing
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Delta_CustomEncode( delta_info_t *dt, const void *from, const void *to )
|
||||
{
|
||||
int i;
|
||||
|
||||
ASSERT( dt != NULL );
|
||||
|
||||
// set all fields is active by default
|
||||
for( i = 0; i < dt->numFields; i++ )
|
||||
dt->pFields[i].bInactive = false;
|
||||
|
||||
if( dt->userCallback )
|
||||
{
|
||||
dt->userCallback( dt->pFields, from, to );
|
||||
}
|
||||
}
|
||||
|
||||
delta_field_t *Delta_FindFieldInfo( const delta_field_t *pInfo, const char *fieldName )
|
||||
{
|
||||
if( !fieldName || !*fieldName )
|
||||
|
@ -268,7 +381,22 @@ delta_field_t *Delta_FindFieldInfo( const delta_field_t *pInfo, const char *fiel
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool Delta_AddField( const char *pStructName, const char *pName, int flags, int bits, float multiplier )
|
||||
int Delta_IndexForFieldInfo( const delta_field_t *pInfo, const char *fieldName )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !fieldName || !*fieldName )
|
||||
return -1;
|
||||
|
||||
for( i = 0; pInfo->name; i++, pInfo++ )
|
||||
{
|
||||
if( !com.strcmp( pInfo->name, fieldName ))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool Delta_AddField( const char *pStructName, const char *pName, int flags, int bits, float mul, float post_mul )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
delta_field_t *pFieldInfo;
|
||||
|
@ -284,7 +412,7 @@ bool Delta_AddField( const char *pStructName, const char *pName, int flags, int
|
|||
{
|
||||
if( !com.strcmp( pField->name, pName ))
|
||||
{
|
||||
MsgDev( D_ERROR, "Delta_Add: %s->%s alread existing\n", pStructName, pName );
|
||||
MsgDev( D_ERROR, "Delta_Add: %s->%s already existing\n", pStructName, pName );
|
||||
return false; // field already exist
|
||||
}
|
||||
}
|
||||
|
@ -310,14 +438,90 @@ bool Delta_AddField( const char *pStructName, const char *pName, int flags, int
|
|||
// copy info to new field
|
||||
pField->name = pFieldInfo->name;
|
||||
pField->offset = pFieldInfo->offset;
|
||||
pField->size = pFieldInfo->size;
|
||||
pField->flags = flags;
|
||||
pField->bits = bits;
|
||||
pField->multiplier = multiplier;
|
||||
pField->multiplier = mul;
|
||||
pField->post_multiplier = post_mul;
|
||||
dt->numFields++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Delta_WriteTableField( bitbuf_t *msg, int tableIndex, const delta_t *pField )
|
||||
{
|
||||
int nameIndex;
|
||||
delta_info_t *dt;
|
||||
|
||||
ASSERT( pField );
|
||||
|
||||
if( !pField->name || !*pField->name )
|
||||
return; // not initialized ?
|
||||
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
ASSERT( dt && dt->bInitialized );
|
||||
|
||||
nameIndex = Delta_IndexForFieldInfo( dt->pInfo, pField->name );
|
||||
ASSERT( nameIndex >= 0 && nameIndex < dt->maxFields );
|
||||
|
||||
BF_WriteByte( msg, svc_deltatable );
|
||||
BF_WriteUBitLong( msg, tableIndex, 4 ); // assume we support 16 network tables
|
||||
BF_WriteUBitLong( msg, nameIndex, 8 ); // 255 fields by struct should be enough
|
||||
BF_WriteUBitLong( msg, pField->flags, 8 ); // flags is full, expand to 10 bits ?
|
||||
BF_WriteUBitLong( msg, pField->bits - 1, 5 ); // max received value is 32 (32 bit)
|
||||
|
||||
// multipliers is null-compressed
|
||||
if( pField->multiplier != 1.0f )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteFloat( msg, pField->multiplier );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
|
||||
if( pField->post_multiplier != 1.0f )
|
||||
{
|
||||
BF_WriteOneBit( msg, 1 );
|
||||
BF_WriteFloat( msg, pField->post_multiplier );
|
||||
}
|
||||
else BF_WriteOneBit( msg, 0 );
|
||||
}
|
||||
|
||||
void Delta_ParseTableField( bitbuf_t *msg )
|
||||
{
|
||||
int tableIndex, nameIndex;
|
||||
float mul = 1.0f, post_mul = 1.0f;
|
||||
int flags, bits;
|
||||
const char *pName;
|
||||
delta_info_t *dt;
|
||||
|
||||
tableIndex = BF_ReadUBitLong( msg, 4 );
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
|
||||
ASSERT( dt != NULL );
|
||||
|
||||
nameIndex = BF_ReadUBitLong( msg, 8 ); // read field name index
|
||||
ASSERT( nameIndex >= 0 && nameIndex < dt->maxFields );
|
||||
pName = dt->pInfo[nameIndex].name;
|
||||
flags = BF_ReadUBitLong( msg, 8 );
|
||||
bits = BF_ReadUBitLong( msg, 5 ) + 1;
|
||||
|
||||
// read the multipliers
|
||||
if( BF_ReadOneBit( msg ))
|
||||
mul = BF_ReadFloat( msg );
|
||||
|
||||
if( BF_ReadOneBit( msg ))
|
||||
post_mul = BF_ReadFloat( msg );
|
||||
|
||||
// delta encoders it's already initialized on this machine
|
||||
if( delta_init ) return;
|
||||
|
||||
// initalize client table
|
||||
if( !dt->bInitialized ) dt->bInitialized = true;
|
||||
|
||||
// add field to table
|
||||
Delta_AddField( dt->pName, pName, flags, bits, mul, post_mul );
|
||||
}
|
||||
|
||||
bool Delta_ParseField( script_t *delta_script, const delta_field_t *pInfo, delta_t *pField, bool bPost )
|
||||
{
|
||||
token_t token;
|
||||
|
@ -354,6 +558,7 @@ bool Delta_ParseField( script_t *delta_script, const delta_field_t *pInfo, delta
|
|||
// copy base info to new field
|
||||
pField->name = pFieldInfo->name;
|
||||
pField->offset = pFieldInfo->offset;
|
||||
pField->size = pFieldInfo->size;
|
||||
pField->flags = 0;
|
||||
|
||||
// read delta-flags
|
||||
|
@ -535,7 +740,7 @@ void Delta_InitFields( void )
|
|||
Com_CloseScript( delta_script );
|
||||
|
||||
// adding some requrid fields fields that use may forget or don't know how to specified
|
||||
Delta_AddField( "event_t", "flags", DT_INTEGER, 8, 1.0f );
|
||||
Delta_AddField( "event_t", "flags", DT_INTEGER, 8, 1.0f, 1.0f );
|
||||
|
||||
delta_init = true;
|
||||
}
|
||||
|
@ -547,6 +752,16 @@ void Delta_Init( void )
|
|||
|
||||
void Delta_Shutdown( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < NUM_FIELDS( dt_info ); i++ )
|
||||
{
|
||||
if( dt_info[i].pFields )
|
||||
{
|
||||
Z_Free( dt_info[i].pFields );
|
||||
dt_info[i].pFields = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -565,6 +780,9 @@ bool Delta_CompareField( delta_t *pField, void *from, void *to )
|
|||
ASSERT( from );
|
||||
ASSERT( to );
|
||||
|
||||
if( pField->bInactive )
|
||||
return true;
|
||||
|
||||
fromF = toF = 0;
|
||||
|
||||
if( pField->flags & DT_BYTE )
|
||||
|
@ -635,9 +853,10 @@ assume from and to is valid
|
|||
*/
|
||||
bool Delta_WriteField( bitbuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
|
||||
{
|
||||
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
|
||||
float flValue, flAngle, flTime;
|
||||
uint iValue;
|
||||
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
|
||||
float flValue, flAngle, flTime;
|
||||
uint iValue;
|
||||
const char *pStr;
|
||||
|
||||
if( Delta_CompareField( pField, from, to ))
|
||||
{
|
||||
|
@ -687,8 +906,11 @@ bool Delta_WriteField( bitbuf_t *msg, delta_t *pField, void *from, void *to, flo
|
|||
|
||||
BF_WriteBitLong( msg, iValue, pField->bits, bSigned );
|
||||
}
|
||||
|
||||
// FIXME: implement support for DT_STRING
|
||||
else if( pField->flags & DT_STRING )
|
||||
{
|
||||
pStr = (char *)((byte *)to + pField->offset );
|
||||
BF_WriteString( msg, pStr );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -702,11 +924,13 @@ assume from and to is valid
|
|||
*/
|
||||
bool Delta_ReadField( bitbuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
|
||||
{
|
||||
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
|
||||
float flValue, flAngle, flTime;
|
||||
bool bChanged;
|
||||
uint iValue;
|
||||
|
||||
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
|
||||
float flValue, flAngle, flTime;
|
||||
bool bChanged;
|
||||
uint iValue;
|
||||
const char *pStr;
|
||||
char *pOut;
|
||||
|
||||
bChanged = BF_ReadOneBit( msg );
|
||||
|
||||
ASSERT( pField->multiplier != 0.0f );
|
||||
|
@ -756,6 +980,7 @@ bool Delta_ReadField( bitbuf_t *msg, delta_t *pField, void *from, void *to, floa
|
|||
{
|
||||
iValue = BF_ReadBitLong( msg, pField->bits, bSigned );
|
||||
flValue = (int)iValue * ( 1.0f / pField->multiplier );
|
||||
flValue = flValue * pField->post_multiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -789,9 +1014,20 @@ bool Delta_ReadField( bitbuf_t *msg, delta_t *pField, void *from, void *to, floa
|
|||
}
|
||||
*(float *)((byte *)to + pField->offset ) = flTime;
|
||||
}
|
||||
else if( pField->flags & DT_STRING )
|
||||
{
|
||||
if( bChanged )
|
||||
{
|
||||
pStr = BF_ReadString( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
pStr = (char *)((byte *)from + pField->offset );
|
||||
}
|
||||
|
||||
// FIXME: implement support for DT_STRING
|
||||
// FIXME: implement post_multiplier
|
||||
pOut = (char *)((byte *)to + pField->offset );
|
||||
com.strncpy( pOut, pStr, pField->size );
|
||||
}
|
||||
return bChanged;
|
||||
}
|
||||
|
||||
|
@ -819,6 +1055,9 @@ void MSG_WriteDeltaUsercmd( bitbuf_t *msg, usercmd_t *from, usercmd_t *to )
|
|||
pField = dt->pFields;
|
||||
ASSERT( pField );
|
||||
|
||||
// activate fields and call custom encode func
|
||||
Delta_CustomEncode( dt, from, to );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
|
@ -876,6 +1115,9 @@ void MSG_WriteDeltaEvent( bitbuf_t *msg, event_args_t *from, event_args_t *to )
|
|||
pField = dt->pFields;
|
||||
ASSERT( pField );
|
||||
|
||||
// activate fields and call custom encode func
|
||||
Delta_CustomEncode( dt, from, to );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
|
@ -937,6 +1179,9 @@ void MSG_WriteClientData( bitbuf_t *msg, clientdata_t *from, clientdata_t *to, i
|
|||
pField = dt->pFields;
|
||||
ASSERT( pField );
|
||||
|
||||
// activate fields and call custom encode func
|
||||
Delta_CustomEncode( dt, from, to );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
|
@ -1029,6 +1274,9 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, bitbuf_t *m
|
|||
case ED_CLIENT:
|
||||
dt = Delta_FindStruct( "entity_state_player_t" );
|
||||
break;
|
||||
case ED_BEAM:
|
||||
dt = Delta_FindStruct( "custom_entity_state_t" );
|
||||
break;
|
||||
default:
|
||||
dt = Delta_FindStruct( "entity_state_t" );
|
||||
break;
|
||||
|
@ -1039,6 +1287,9 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, bitbuf_t *m
|
|||
pField = dt->pFields;
|
||||
ASSERT( pField );
|
||||
|
||||
// activate fields and call custom encode func
|
||||
Delta_CustomEncode( dt, from, to );
|
||||
|
||||
// process fields
|
||||
for( i = 0; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
|
@ -1090,6 +1341,9 @@ void MSG_ReadDeltaEntity( bitbuf_t *msg, entity_state_t *from, entity_state_t *t
|
|||
case ED_CLIENT:
|
||||
dt = Delta_FindStruct( "entity_state_player_t" );
|
||||
break;
|
||||
case ED_BEAM:
|
||||
dt = Delta_FindStruct( "custom_entity_state_t" );
|
||||
break;
|
||||
default:
|
||||
dt = Delta_FindStruct( "entity_state_t" );
|
||||
break;
|
||||
|
@ -1107,29 +1361,104 @@ void MSG_ReadDeltaEntity( bitbuf_t *msg, entity_state_t *from, entity_state_t *t
|
|||
}
|
||||
}
|
||||
|
||||
// UNDER CONSTRUCTION!!!
|
||||
|
||||
void MSG_DeltaAddEncoder( char *name, pfnDeltaEncode encodeFunc )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
|
||||
dt = Delta_FindStructByEncoder( name );
|
||||
|
||||
if( !dt || !dt->bInitialized )
|
||||
{
|
||||
MsgDev( D_ERROR, "Delta_AddEncoder: couldn't find delta with specified custom encode %s\n", name );
|
||||
return;
|
||||
}
|
||||
|
||||
if( dt->customEncode == CUSTOM_NONE )
|
||||
{
|
||||
MsgDev( D_ERROR, "Delta_AddEncoder: %s not supposed for custom encoding\n", dt->pName );
|
||||
return;
|
||||
}
|
||||
|
||||
// register new encode func
|
||||
dt->userCallback = encodeFunc;
|
||||
}
|
||||
|
||||
int MSG_DeltaFindField( delta_t *pFields, const char *fieldname )
|
||||
{
|
||||
return 0;
|
||||
delta_info_t *dt;
|
||||
delta_t *pField;
|
||||
int i;
|
||||
|
||||
dt = Delta_FindStructByDelta( pFields );
|
||||
if( dt == NULL || !fieldname || !fieldname[0] )
|
||||
return -1;
|
||||
|
||||
for( i = 0, pField = dt->pFields; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
if( !com.strcmp( pField->name, fieldname ))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MSG_DeltaSetField( delta_t *pFields, const char *fieldname )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
delta_t *pField;
|
||||
int i;
|
||||
|
||||
dt = Delta_FindStructByDelta( pFields );
|
||||
if( dt == NULL || !fieldname || !fieldname[0] )
|
||||
return;
|
||||
|
||||
for( i = 0, pField = dt->pFields; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
if( !com.strcmp( pField->name, fieldname ))
|
||||
{
|
||||
pField->bInactive = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_DeltaUnsetField( delta_t *pFields, const char *fieldname )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
delta_t *pField;
|
||||
int i;
|
||||
|
||||
dt = Delta_FindStructByDelta( pFields );
|
||||
if( dt == NULL || !fieldname || !fieldname[0] )
|
||||
return;
|
||||
|
||||
for( i = 0, pField = dt->pFields; i < dt->numFields; i++, pField++ )
|
||||
{
|
||||
if( !com.strcmp( pField->name, fieldname ))
|
||||
{
|
||||
pField->bInactive = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MSG_DeltaSetFieldByIndex( struct delta_s *pFields, int fieldNumber )
|
||||
void MSG_DeltaSetFieldByIndex( delta_t *pFields, int fieldNumber )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
|
||||
dt = Delta_FindStructByDelta( pFields );
|
||||
if( dt == NULL || fieldNumber < 0 || fieldNumber >= dt->numFields )
|
||||
return;
|
||||
|
||||
dt->pFields[fieldNumber].bInactive = false;
|
||||
}
|
||||
|
||||
void MSG_DeltaUnsetFieldByIndex( struct delta_s *pFields, int fieldNumber )
|
||||
void MSG_DeltaUnsetFieldByIndex( delta_t *pFields, int fieldNumber )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
|
||||
dt = Delta_FindStructByDelta( pFields );
|
||||
if( dt == NULL || fieldNumber < 0 || fieldNumber >= dt->numFields )
|
||||
return;
|
||||
|
||||
dt->pFields[fieldNumber].bInactive = true;
|
||||
}
|
|
@ -45,10 +45,12 @@ typedef struct delta_s
|
|||
{
|
||||
const char *name;
|
||||
int offset; // in bytes
|
||||
int size; // used for bounds checking in DT_STRING
|
||||
int flags; // DT_INTEGER, DT_FLOAT etc
|
||||
float multiplier;
|
||||
float post_multiplier; // for DEFINE_DELTA_POST
|
||||
int bits; // how many bits we send\receive
|
||||
bool bInactive; // unsetted by user request
|
||||
} delta_t;
|
||||
|
||||
typedef void (*pfnDeltaEncode)( delta_t *pFields, const byte *from, const byte *to );
|
||||
|
@ -74,6 +76,8 @@ typedef struct
|
|||
void Delta_Init( void );
|
||||
void Delta_Shutdown( void );
|
||||
void Delta_InitFields( void );
|
||||
int Delta_NumTables( void );
|
||||
delta_info_t *Delta_FindStructByIndex( int index );
|
||||
void MSG_DeltaAddEncoder( char *name, pfnDeltaEncode encodeFunc );
|
||||
int MSG_DeltaFindField( delta_t *pFields, const char *fieldname );
|
||||
void MSG_DeltaSetField( delta_t *pFields, const char *fieldname );
|
||||
|
@ -81,6 +85,11 @@ void MSG_DeltaUnsetField( delta_t *pFields, const char *fieldname );
|
|||
void MSG_DeltaSetFieldByIndex( struct delta_s *pFields, int fieldNumber );
|
||||
void MSG_DeltaUnsetFieldByIndex( struct delta_s *pFields, int fieldNumber );
|
||||
|
||||
// send table over network
|
||||
void Delta_WriteTableField( bitbuf_t *msg, int tableIndex, const delta_t *pField );
|
||||
void Delta_ParseTableField( bitbuf_t *msg );
|
||||
|
||||
|
||||
// encode routines
|
||||
void MSG_WriteDeltaUsercmd( bitbuf_t *msg, usercmd_t *from, usercmd_t *to );
|
||||
void MSG_ReadDeltaUsercmd( bitbuf_t *msg, usercmd_t *from, usercmd_t *to );
|
||||
|
|
|
@ -525,9 +525,8 @@ void Huff_CompressPacket( bitbuf_t *msg, int offset )
|
|||
}
|
||||
|
||||
outLen = (huffBitPos >> 3) + 1;
|
||||
msg->iCurBit = ( offset + outLen ) << 3;
|
||||
msg->iCurBit = (offset + outLen) << 3;
|
||||
Mem_Copy( data, buffer, outLen );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -553,15 +552,15 @@ void Huff_DecompressPacket( bitbuf_t *msg, int offset )
|
|||
|
||||
Huff_PrepareTree( tree );
|
||||
|
||||
outLen = (data[0] << 8) + data[1];
|
||||
outLen = ( data[0] << 8 ) + data[1];
|
||||
huffBitPos = 16;
|
||||
|
||||
if( outLen > BF_GetMaxBytes( msg ) - offset )
|
||||
outLen = BF_GetMaxBytes( msg ) - offset;
|
||||
if( outLen > MAX_MSGLEN - offset )
|
||||
outLen = MAX_MSGLEN - offset;
|
||||
|
||||
for( i = 0; i < outLen; i++ )
|
||||
{
|
||||
if((huffBitPos >> 3) > inLen )
|
||||
if(( huffBitPos >> 3 ) > inLen )
|
||||
{
|
||||
buffer[i] = 0;
|
||||
break;
|
||||
|
|
|
@ -55,7 +55,6 @@ void MSG_Init( sizebuf_t *buf, byte *data, size_t length )
|
|||
Mem_Set( buf, 0, sizeof(*buf));
|
||||
buf->data = data;
|
||||
buf->maxsize = length;
|
||||
Huff_Init();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define svc_spawnbaseline 207 // valid only at spawn
|
||||
#define svc_download 208 // [short] size [size bytes]
|
||||
#define svc_changing 209 // changelevel by server request
|
||||
#define svc_physinfo 210 // [physinfo string]
|
||||
#define svc_deltatable 210 // [table header][...]
|
||||
#define svc_usermessage 211 // [string][byte] REG_USER_MSG stuff
|
||||
#define svc_packetentities 212 // [...]
|
||||
#define svc_frame 213 // begin a new server frame
|
||||
|
|
|
@ -99,7 +99,6 @@ typedef struct sv_client_s
|
|||
|
||||
char userinfo[MAX_INFO_STRING]; // name, etc (received from client)
|
||||
char physinfo[MAX_INFO_STRING]; // set on server (transmit to client)
|
||||
bool physinfo_modified; // transmit at next opportunity
|
||||
bool send_message;
|
||||
bool sendmovevars;
|
||||
bool sendinfo;
|
||||
|
|
|
@ -837,6 +837,65 @@ void SV_Configstrings_f( sv_client_t *cl )
|
|||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_DeltaInfo_f
|
||||
==================
|
||||
*/
|
||||
void SV_DeltaInfo_f( sv_client_t *cl )
|
||||
{
|
||||
delta_info_t *dt;
|
||||
string cmd;
|
||||
int tableIndex;
|
||||
int fieldIndex;
|
||||
|
||||
if( cl->state != cs_connected )
|
||||
{
|
||||
MsgDev( D_INFO, "deltainfo is not valid from the console\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// handle the case of a level changing while a client was connecting
|
||||
if( com.atoi( Cmd_Argv( 1 )) != svs.spawncount )
|
||||
{
|
||||
MsgDev( D_INFO, "deltainfo from different level\n" );
|
||||
SV_New_f( cl );
|
||||
return;
|
||||
}
|
||||
|
||||
tableIndex = com.atoi( Cmd_Argv( 2 ));
|
||||
fieldIndex = com.atoi( Cmd_Argv( 2 ));
|
||||
|
||||
// write a packet full of data
|
||||
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( MAX_MSGLEN / 2 ) && tableIndex < Delta_NumTables( ))
|
||||
{
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
|
||||
for( ; fieldIndex < dt->numFields; fieldIndex++ )
|
||||
{
|
||||
Delta_WriteTableField( &cl->netchan.message, tableIndex, &dt->pFields[fieldIndex] );
|
||||
|
||||
// it's time to send another portion
|
||||
if( BF_GetNumBytesWritten( &cl->netchan.message ) >= ( MAX_MSGLEN / 2 ))
|
||||
break;
|
||||
}
|
||||
|
||||
if( fieldIndex == dt->numFields )
|
||||
{
|
||||
// go to the next table
|
||||
fieldIndex = 0;
|
||||
tableIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
if( tableIndex == Delta_NumTables() ) com.snprintf( cmd, MAX_STRING, "cmd baselines %i %i\n", svs.spawncount, 0 );
|
||||
else com.snprintf( cmd, MAX_STRING, "cmd deltainfo %i %i %i\n", svs.spawncount, tableIndex, fieldIndex );
|
||||
|
||||
// send next command
|
||||
BF_WriteByte( &cl->netchan.message, svc_stufftext );
|
||||
BF_WriteString( &cl->netchan.message, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_UserMessages_f
|
||||
|
@ -878,7 +937,7 @@ void SV_UserMessages_f( sv_client_t *cl )
|
|||
start++;
|
||||
}
|
||||
|
||||
if( start == MAX_USER_MESSAGES ) com.snprintf( cmd, MAX_STRING, "cmd baselines %i %i\n", svs.spawncount, 0 );
|
||||
if( start == MAX_USER_MESSAGES ) com.snprintf( cmd, MAX_STRING, "cmd deltainfo %i 0 0\n", svs.spawncount );
|
||||
else com.snprintf( cmd, MAX_STRING, "cmd usermsgs %i %i\n", svs.spawncount, start );
|
||||
|
||||
// send next command
|
||||
|
@ -1151,6 +1210,7 @@ ucmd_t ucmds[] =
|
|||
{ "begin", SV_Begin_f },
|
||||
{ "pause", SV_Pause_f },
|
||||
{ "baselines", SV_Baselines_f },
|
||||
{ "deltainfo", SV_DeltaInfo_f },
|
||||
{ "info", SV_ShowServerinfo_f },
|
||||
{ "nextdl", SV_NextDownload_f },
|
||||
{ "disconnect", SV_Disconnect_f },
|
||||
|
|
|
@ -316,14 +316,6 @@ void SV_WriteFrameToClient( sv_client_t *cl, bitbuf_t *msg )
|
|||
}
|
||||
}
|
||||
|
||||
// refresh physinfo if needs
|
||||
if( cl->physinfo_modified )
|
||||
{
|
||||
cl->physinfo_modified = false;
|
||||
BF_WriteByte( msg, svc_physinfo );
|
||||
BF_WriteString( msg, cl->physinfo );
|
||||
}
|
||||
|
||||
// delta encode the events
|
||||
SV_EmitEvents( cl, frame, msg );
|
||||
|
||||
|
|
|
@ -668,8 +668,7 @@ void SV_SetClientMaxspeed( sv_client_t *cl, float fNewMaxspeed )
|
|||
fNewMaxspeed = bound( -svgame.movevars.maxspeed, fNewMaxspeed, svgame.movevars.maxspeed );
|
||||
|
||||
cl->edict->v.maxspeed = fNewMaxspeed;
|
||||
if( Info_SetValueForKey( cl->physinfo, "maxspd", va( "%.f", fNewMaxspeed )))
|
||||
cl->physinfo_modified = true;
|
||||
Info_SetValueForKey( cl->physinfo, "maxspd", va( "%.f", fNewMaxspeed ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2898,9 +2897,7 @@ void pfnSetPhysicsKeyValue( const edict_t *pClient, const char *key, const char
|
|||
MsgDev( D_ERROR, "SV_SetClientPhysinfo: client is not connected!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Info_SetValueForKey( cl->physinfo, key, value ))
|
||||
cl->physinfo_modified = true;
|
||||
Info_SetValueForKey( cl->physinfo, key, value );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3837,6 +3834,9 @@ bool SV_LoadProgs( const char *name )
|
|||
|
||||
Delta_Init ();
|
||||
|
||||
// register custom encoders
|
||||
svgame.dllFuncs.pfnRegisterEncoders();
|
||||
|
||||
// fire once
|
||||
MsgDev( D_INFO, "Dll loaded for mod %s\n", svgame.dllFuncs.pfnGetGameDescription() );
|
||||
|
||||
|
|
|
@ -229,9 +229,9 @@ const Vector &CBeam::GetEndPos( void )
|
|||
edict_t *pent = GetEndEntity();
|
||||
|
||||
if ( pent )
|
||||
return pent->v.oldorigin;
|
||||
return pent->v.angles;
|
||||
}
|
||||
return pev->oldorigin;
|
||||
return pev->angles;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1722,7 +1722,7 @@ void CEnvModel :: Spawn( void )
|
|||
SET_MODEL( ENT(pev), STRING(pev->model) );
|
||||
UTIL_SetOrigin(this, pev->origin);
|
||||
|
||||
// UTIL_AssignOrigin(this, pev->oldorigin); //AJH - WTF is this here for?
|
||||
// UTIL_AssignOrigin(this, pev->angles); //AJH - WTF is this here for?
|
||||
|
||||
if (pev->spawnflags & SF_ENVMODEL_SOLID)
|
||||
{
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
inline void SetType( int type ) { pev->rendermode = type; }
|
||||
inline void SetFlags( int flags ) { pev->renderfx |= flags; }
|
||||
inline void SetStartPos( const Vector& pos ) { pev->origin = pos; }
|
||||
inline void SetEndPos( const Vector& pos ) { pev->oldorigin = pos; }
|
||||
inline void SetEndPos( const Vector& pos ) { pev->angles = pos; }
|
||||
inline void SetStartEntity( edict_t *pEnt ) { pev->aiment = pEnt; }
|
||||
inline void SetEndEntity( edict_t *pEnt ) { pev->owner = pEnt; }
|
||||
|
||||
|
|
Reference in New Issue