/* ================= UpdateClientData Data sent to current client only engine sets cd to 0 before calling. ================= */ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ) { cd->flags = ent->v.flags; cd->health = ent->v.health; cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) ); cd->waterlevel = ent->v.waterlevel; cd->watertype = ent->v.watertype; cd->weapons = ent->v.weapons; // Vectors cd->origin = ent->v.origin; cd->velocity = ent->v.velocity; cd->view_ofs = ent->v.view_ofs; cd->punchangle = ent->v.punchangle; cd->bInDuck = ent->v.bInDuck; cd->flTimeStepSound = ent->v.flTimeStepSound; cd->flDuckTime = ent->v.flDuckTime; cd->flSwimTime = ent->v.flSwimTime; cd->waterjumptime = ent->v.teleport_time; strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) ); cd->maxspeed = ent->v.maxspeed; cd->fov = ent->v.fov; cd->weaponanim = ent->v.weaponanim; cd->pushmsec = ent->v.pushmsec; // Spectator cd->iuser1 = ent->v.iuser1; cd->iuser2 = ent->v.iuser2; if ( sendweapons ) { entvars_t *pev = (entvars_t *)&ent->v; CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); if ( pl ) { cd->m_flNextAttack = pl->m_flNextAttack; if ( pl->m_pActiveItem ) { CBasePlayerWeapon *gun; gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr(); if ( gun && gun->UseDecrement() ) { ItemInfo II; memset( &II, 0, sizeof( II ) ); gun->GetItemInfo( &II ); cd->m_iId = II.iId; } } } } }
/* ================= UpdateClientData Data sent to current client only engine sets cd to 0 before calling. ================= */ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ) { cd->flags = ent->v.flags; cd->health = ent->v.health; cd->viewmodel = MODEL_INDEX( STRING( ent->v.viewmodel ) ); cd->waterlevel = ent->v.waterlevel; cd->watertype = ent->v.watertype; cd->weapons = ent->v.weapons; // Vectors cd->origin = ent->v.origin; cd->velocity = ent->v.velocity; cd->view_ofs = ent->v.view_ofs; cd->punchangle = ent->v.punchangle; cd->bInDuck = ent->v.bInDuck; cd->flTimeStepSound = ent->v.flTimeStepSound; cd->flDuckTime = ent->v.flDuckTime; cd->flSwimTime = ent->v.flSwimTime; cd->waterjumptime = ent->v.teleport_time; strcpy( cd->physinfo, ENGINE_GETPHYSINFO( ent ) ); cd->maxspeed = ent->v.maxspeed; cd->fov = ent->v.fov; cd->weaponanim = ent->v.weaponanim; cd->pushmsec = ent->v.pushmsec; #if defined( CLIENT_WEAPONS ) if ( sendweapons ) { entvars_t *pev = (entvars_t *)&ent->v; CBasePlayer *pl = ( CBasePlayer *) CBasePlayer::Instance( pev ); if ( pl ) { cd->m_flNextAttack = pl->m_flNextAttack; cd->fuser2 = pl->m_flNextAmmoBurn; cd->fuser3 = pl->m_flAmmoStartCharge; cd->vuser1.x = pl->ammo_9mm; cd->vuser1.y = pl->ammo_357; cd->vuser1.z = pl->ammo_argrens; cd->ammo_nails = pl->ammo_bolts; cd->ammo_shells = pl->ammo_buckshot; cd->ammo_rockets = pl->ammo_rockets; cd->ammo_cells = pl->ammo_uranium; cd->vuser2.x = pl->ammo_hornets; if ( pl->m_pActiveItem ) { CBasePlayerWeapon *gun; gun = (CBasePlayerWeapon *)pl->m_pActiveItem->GetWeaponPtr(); if ( gun && gun->UseDecrement() ) { ItemInfo II; memset( &II, 0, sizeof( II ) ); gun->GetItemInfo( &II ); cd->m_iId = II.iId; cd->vuser3.z = gun->m_iSecondaryAmmoType; cd->vuser4.x = gun->m_iPrimaryAmmoType; cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType]; cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType]; if ( pl->m_pActiveItem->m_iId == WEAPON_RPG ) { cd->vuser2.y = ( ( CRpg * )pl->m_pActiveItem)->m_fSpotActive; cd->vuser2.z = ( ( CRpg * )pl->m_pActiveItem)->m_cActiveRockets; } } } } } #endif }