mirror of
https://github.com/ENSL/NS.git
synced 2025-01-19 07:51:26 +00:00
o Show minimap sprites during HLTV
o Show particle systems during HLTV - Added support for HLTV specific enthier and particle systems. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@575 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
4b9a82d79c
commit
e9fb397db5
8 changed files with 269 additions and 83 deletions
|
@ -290,8 +290,112 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
}
|
||||
}
|
||||
|
||||
void AvHEntityHierarchy::BuildForSpec(BaseEntityListType& inBaseEntityList)
|
||||
{
|
||||
|
||||
this->Clear();
|
||||
|
||||
// Loop through all entities in the world
|
||||
for(BaseEntityListType::iterator theIter = inBaseEntityList.begin(); theIter != inBaseEntityList.end(); theIter++)
|
||||
{
|
||||
CBaseEntity* theBaseEntity = *theIter;
|
||||
|
||||
int theEntityIndex = theBaseEntity->entindex();
|
||||
bool theEntityIsVisible = false;
|
||||
if ( theBaseEntity->pev->team == TEAM_ONE || theBaseEntity->pev->team == TEAM_TWO || theBaseEntity->pev->team == TEAM_THREE || theBaseEntity->pev->team == TEAM_FOUR )
|
||||
theEntityIsVisible=true;
|
||||
bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex);
|
||||
// Don't send ammo, health, weapons, or scans
|
||||
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
|
||||
|
||||
MapEntity mapEntity;
|
||||
|
||||
mapEntity.mX = theBaseEntity->pev->origin.x;
|
||||
mapEntity.mY = theBaseEntity->pev->origin.y;
|
||||
mapEntity.mUser3 = (AvHUser3)(theBaseEntity->pev->iuser3);
|
||||
|
||||
mapEntity.mAngle = theBaseEntity->pev->angles[1];
|
||||
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
|
||||
mapEntity.mSquadNumber = 0;
|
||||
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
|
||||
|
||||
bool sendEntity = false;
|
||||
|
||||
if (mapEntity.mUser3 == AVH_USER3_HIVE)
|
||||
{
|
||||
if (!theEntityIsVisible)
|
||||
{
|
||||
mapEntity.mTeam = TEAM_IND;
|
||||
}
|
||||
sendEntity = true;
|
||||
}
|
||||
else if (mapEntity.mUser3 == AVH_USER3_WELD)
|
||||
{
|
||||
vec3_t theEntityOrigin = AvHSHUGetRealLocation(theBaseEntity->pev->origin, theBaseEntity->pev->mins, theBaseEntity->pev->maxs);
|
||||
mapEntity.mX = theEntityOrigin.x;
|
||||
mapEntity.mY = theEntityOrigin.y;
|
||||
sendEntity = true;
|
||||
}
|
||||
else if (mapEntity.mUser3 == AVH_USER3_FUNC_RESOURCE)
|
||||
{
|
||||
sendEntity = true;
|
||||
}
|
||||
else if (theEntityIsVisible && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient)
|
||||
{
|
||||
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
|
||||
|
||||
if (thePlayer)
|
||||
{
|
||||
ASSERT(theEntityIndex > 0);
|
||||
ASSERT(theEntityIndex <= 32);
|
||||
mapEntity.mSquadNumber = GetHotkeyGroupContainingPlayer(thePlayer) + 1;
|
||||
|
||||
if ((thePlayer->GetPlayMode() == PLAYMODE_PLAYING) && !thePlayer->GetIsSpectator())
|
||||
{
|
||||
|
||||
sendEntity = true;
|
||||
|
||||
// If the player has the heavy armor upgrade switch the
|
||||
// user3 to something that will let us reconstruct that later.
|
||||
|
||||
if (thePlayer->pev->iuser3 == AVH_USER3_MARINE_PLAYER &&
|
||||
GetHasUpgrade(thePlayer->pev->iuser4, MASK_UPGRADE_13))
|
||||
{
|
||||
mapEntity.mUser3 = AVH_USER3_HEAVY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mapEntity.mUser3 != AVH_USER3_HEAVY)
|
||||
{
|
||||
sendEntity = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sendEntity)
|
||||
{
|
||||
|
||||
const AvHMapExtents& theMapExtents = GetGameRules()->GetMapExtents();
|
||||
// commented this out here, commented out corresponding shift in AvHOverviewMap::Draw at line 771
|
||||
// float theMinMapX = theMapExtents.GetMinMapX();
|
||||
// float theMinMapY = theMapExtents.GetMinMapY();
|
||||
|
||||
// mapEntity.mX -= theMinMapX;
|
||||
// mapEntity.mY -= theMinMapY;
|
||||
|
||||
mEntityList[theEntityIndex] = mapEntity;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns true when something was sent
|
||||
bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer)
|
||||
bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer, bool spectating)
|
||||
{
|
||||
// Get iterators for both hierarchies
|
||||
|
||||
|
@ -340,7 +444,7 @@ bool AvHEntityHierarchy::SendToNetworkStream(AvHEntityHierarchy& inClientHierarc
|
|||
++clientIter;
|
||||
}
|
||||
|
||||
NetMsg_UpdateEntityHierarchy( inPlayer, NewItems, OldItems );
|
||||
NetMsg_UpdateEntityHierarchy( inPlayer, NewItems, OldItems, spectating );
|
||||
return (!NewItems.empty() || !OldItems.empty());
|
||||
}
|
||||
|
||||
|
@ -362,4 +466,4 @@ bool AvHEntityHierarchy::DeleteEntity( const int inIndex )
|
|||
{ return false; }
|
||||
this->mEntityList.erase(loc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,8 +95,9 @@ public:
|
|||
void Clear();
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
bool SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer);
|
||||
bool SendToNetworkStream(AvHEntityHierarchy& inClientHierarchy, entvars_t* inPlayer, bool spectating);
|
||||
void BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType& inBaseEntityList);
|
||||
void BuildForSpec(BaseEntityListType& inBaseEntityList);
|
||||
#endif
|
||||
|
||||
bool GetHasBaseLineBeenSent() const;
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
#include "util/MathUtil.h"
|
||||
#include "mod/AvHNetworkMessages.h"
|
||||
#include "mod/AvHNexusServer.h"
|
||||
#include "mod/AvHParticleTemplateClient.h"
|
||||
|
||||
// puzl: 0001073
|
||||
#ifdef USE_OLDAUTH
|
||||
|
@ -704,7 +705,18 @@ BOOL AvHGamerules::GetIsClientAuthorizedToPlay(edict_t* inEntity, bool inDisplay
|
|||
theAuthMask = GetGameRules()->GetAuthenticationMask(theAuthID);
|
||||
}
|
||||
|
||||
if(theAuthMask & theSecurityMask)
|
||||
if ( inEntity->v.flags & FL_PROXY )
|
||||
{
|
||||
if(inDisplayMessage)
|
||||
{
|
||||
char theAuthenticateString[512];
|
||||
sprintf(theAuthenticateString, "Allowing HLTV proxy to join\n");
|
||||
ALERT(at_logged, theAuthenticateString);
|
||||
}
|
||||
|
||||
theIsAuthorized = true;
|
||||
}
|
||||
else if(theAuthMask & theSecurityMask)
|
||||
{
|
||||
if(inDisplayMessage)
|
||||
{
|
||||
|
@ -858,6 +870,8 @@ void AvHGamerules::DeleteAndResetEntities()
|
|||
{
|
||||
this->mGameInReset = true;
|
||||
|
||||
mHLTVEntityHierarchy.Clear();
|
||||
|
||||
// Print reset message at console
|
||||
char theResetString[128];
|
||||
|
||||
|
@ -933,10 +947,6 @@ void AvHGamerules::DeleteAndResetEntities()
|
|||
if(GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_BUILDABLE) && (!theBuildable || !theBuildable->GetIsPersistent()))
|
||||
{
|
||||
ASSERT(theBaseEntity->pev->iuser3 != AVH_USER3_HIVE);
|
||||
if(theBaseEntity->pev->iuser3 == AVH_USER3_HIVE)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
UTIL_Remove(theBaseEntity);
|
||||
}
|
||||
END_FOR_ALL_BASEENTITIES();
|
||||
|
@ -1385,6 +1395,9 @@ AvHEntityHierarchy& AvHGamerules::GetEntityHierarchy(AvHTeamNumber inTeam)
|
|||
{
|
||||
return this->mTeamBEntityHierarchy;
|
||||
}
|
||||
else if (inTeam == TEAM_SPECT) {
|
||||
return this->mSpecEntityHierarchy;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(false);
|
||||
|
@ -2043,6 +2056,7 @@ void AvHGamerules::PostWorldPrecacheReset(bool inNewMap)
|
|||
|
||||
this->mTeamAEntityHierarchy.Clear();
|
||||
this->mTeamBEntityHierarchy.Clear();
|
||||
this->mSpecEntityHierarchy.Clear();
|
||||
|
||||
// Set up both sides
|
||||
this->mTeamA.SetTeamType(this->mGameplay.GetTeamAType());
|
||||
|
@ -2751,6 +2765,9 @@ void AvHGamerules::InternalResetGameRules()
|
|||
this->mTimeGameStarted = -1;
|
||||
this->mTimeOfLastGameTimeUpdate = -1;
|
||||
this->mTimeOfLastHLTVProxyUpdate = -1;
|
||||
this->mTimeOfForcedLastHLTVProxyUpdate = -1;
|
||||
this->mTimeOfLastHLTVParticleTemplateSending = -1;
|
||||
this->mHLTVNumParticleTemplatesSent=0;
|
||||
this->mTimeSentCountdown = 0;
|
||||
this->mTimeLastWontStartMessageSent = 0;
|
||||
this->mStartedCountdown = false;
|
||||
|
@ -2989,10 +3006,58 @@ void AvHGamerules::UpdateHLTVProxy()
|
|||
// Update proxy if connected
|
||||
if(theHLTVProxyConnected)
|
||||
{
|
||||
const float kHLTVProxyUpdateTime = 6.0f;
|
||||
|
||||
|
||||
const float kParticleTemplateRate = 0.25f;
|
||||
if(gParticleTemplateList.GetCreatedTemplates())
|
||||
{
|
||||
// Make sure client clears out all particle systems first
|
||||
int theNumberTemplates = gParticleTemplateList.GetNumberTemplates();
|
||||
if(theNumberTemplates > this->mHLTVNumParticleTemplatesSent)
|
||||
{
|
||||
if((this->mTimeOfLastHLTVParticleTemplateSending == -1) || (gpGlobals->time > this->mTimeOfLastHLTVParticleTemplateSending + kParticleTemplateRate))
|
||||
{
|
||||
AvHParticleTemplate* theTemplate = gParticleTemplateList.GetTemplateAtIndex(this->mHLTVNumParticleTemplatesSent);
|
||||
ASSERT(theTemplate);
|
||||
NetMsg_SetParticleTemplate( NULL, *theTemplate );
|
||||
this->mHLTVNumParticleTemplatesSent++;
|
||||
this->mTimeOfLastHLTVParticleTemplateSending = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->mHLTVNumParticleTemplatesSent=0;
|
||||
this->mTimeOfLastHLTVParticleTemplateSending = -1;
|
||||
}
|
||||
}
|
||||
|
||||
const float kHLTVProxyUpdateTime = 6.0f;
|
||||
const float kForcedHLTVProxyUpdateTime = 50.0f;
|
||||
|
||||
if((this->mTimeOfLastHLTVProxyUpdate == -1) || (gpGlobals->time > (this->mTimeOfLastHLTVProxyUpdate + kHLTVProxyUpdateTime)))
|
||||
{
|
||||
if((this->mTimeOfForcedLastHLTVProxyUpdate == -1) || (gpGlobals->time > (this->mTimeOfForcedLastHLTVProxyUpdate + kForcedHLTVProxyUpdateTime))) {
|
||||
mHLTVEntityHierarchy.Clear();
|
||||
this->mTimeOfForcedLastHLTVProxyUpdate=gpGlobals->time;
|
||||
// Send down map extents so players can start computing it
|
||||
// Cache this so it isn't computed every round, only the when a player connects or a new map starts?
|
||||
const char* theCStrLevelName = STRING(gpGlobals->mapname);
|
||||
const AvHMapExtents& theMapExtents = GetGameRules()->GetMapExtents();
|
||||
|
||||
// ASSERT(theCStrLevelName);
|
||||
// ASSERT(!FStrEq(theCStrLevelName, ""));
|
||||
|
||||
float mins[3] = { theMapExtents.GetMinMapX(), theMapExtents.GetMinMapY(), theMapExtents.GetMinViewHeight() };
|
||||
float maxs[3] = { theMapExtents.GetMaxMapX(), theMapExtents.GetMaxMapY(), theMapExtents.GetMaxViewHeight() };
|
||||
|
||||
NetMsg_SetupMap_Extents( NULL, string( theCStrLevelName ), mins, maxs, theMapExtents.GetDrawMapBG() );
|
||||
int theNumberTemplates = gParticleTemplateList.GetNumberTemplates();
|
||||
}
|
||||
|
||||
AvHEntityHierarchy& theEntityList = GetGameRules()->GetEntityHierarchy(TEAM_SPECT);
|
||||
if ( theEntityList.SendToNetworkStream(mHLTVEntityHierarchy, NULL, true) )
|
||||
{
|
||||
mHLTVEntityHierarchy = theEntityList;
|
||||
}
|
||||
//char theMessage[256];
|
||||
//sprintf(theMessage, "AvHGamerules::UpdateHLTVProxy...\n");
|
||||
//ALERT(at_console, theMessage);
|
||||
|
@ -3329,10 +3394,6 @@ void AvHGamerules::Think(void)
|
|||
kServerFrameRate = 0;
|
||||
kNumReturn0 = kNumReturn1 = kNumCached = kNumComputed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
this->UpdateServerCommands();
|
||||
this->UpdateGameTime();
|
||||
|
@ -3655,8 +3716,6 @@ void AvHGamerules::TriggerAlert(AvHTeamNumber inTeamNumber, AvHAlertType inAlert
|
|||
|
||||
if(theSound != HUD_SOUND_INVALID)
|
||||
{
|
||||
int a = 0;
|
||||
|
||||
// For all players on this team, play the sound
|
||||
FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*)
|
||||
if((theEntity->pev->team == inTeamNumber) || this->GetIsTesting() || (theEntity->GetIsSpectatingTeam(inTeamNumber)))
|
||||
|
|
|
@ -289,7 +289,6 @@ public:
|
|||
bool GetIsGameInReset() {return this->mGameInReset; };
|
||||
|
||||
int GetStructureLimit();
|
||||
|
||||
protected:
|
||||
void AutoAssignPlayer(AvHPlayer* inPlayer);
|
||||
void PerformMapValidityCheck();
|
||||
|
@ -351,6 +350,11 @@ private:
|
|||
float mTimeCountDownStarted;
|
||||
float mTimeGameStarted;
|
||||
float mTimeOfLastHLTVProxyUpdate;
|
||||
float mTimeOfForcedLastHLTVProxyUpdate;
|
||||
float mTimeOfLastHLTVParticleTemplateSending;
|
||||
int mHLTVNumParticleTemplatesSent;
|
||||
|
||||
AvHEntityHierarchy mHLTVEntityHierarchy;
|
||||
float mTimeOfLastGameTimeUpdate;
|
||||
float mTimeSentCountdown;
|
||||
float mTimeLastWontStartMessageSent;
|
||||
|
@ -386,6 +390,7 @@ private:
|
|||
// Potentially marines vs. marines
|
||||
AvHEntityHierarchy mTeamAEntityHierarchy;
|
||||
AvHEntityHierarchy mTeamBEntityHierarchy;
|
||||
AvHEntityHierarchy mSpecEntityHierarchy;
|
||||
|
||||
AvHGameplay mGameplay;
|
||||
|
||||
|
|
|
@ -1665,32 +1665,35 @@ union float_converter
|
|||
{
|
||||
ParticleParams gen_params, vel_params;
|
||||
PSVector gravity;
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgSetParticleTemplates, NULL, pev );
|
||||
WRITE_STRING( particle_template.GetName().c_str() );
|
||||
WRITE_LONG( particle_template.GetMaxParticles() );
|
||||
WRITE_COORD( particle_template.GetParticleSize() );
|
||||
WRITE_STRING( particle_template.GetSprite().c_str() );
|
||||
WRITE_COORD( particle_template.GetParticleSystemLifetime() );
|
||||
WRITE_COORD( particle_template.GetParticleLifetime() );
|
||||
WRITE_COORD( particle_template.GetAnimationSpeed() );
|
||||
WRITE_BYTE( particle_template.GetNumSpriteFrames() );
|
||||
WRITE_COORD( particle_template.GetParticleScaling() );
|
||||
WRITE_BYTE( particle_template.GetRenderMode() );
|
||||
WRITE_LONG( particle_template.GetGenerationRate() );
|
||||
WRITE_BYTE( particle_template.GetGenerationShape() );
|
||||
particle_template.GetGenerationParams( gen_params );
|
||||
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( gen_params[counter] ); }
|
||||
WRITE_LONG( particle_template.GetGenerationEntityIndex() );
|
||||
WRITE_COORD( particle_template.GetGenerationEntityParameter() );
|
||||
WRITE_BYTE( particle_template.GetStartingVelocityShape() );
|
||||
particle_template.GetStartingVelocityParams( vel_params );
|
||||
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( vel_params[counter] ); }
|
||||
particle_template.GetGravity( gravity );
|
||||
for( int counter = 0; counter < 3; counter++ ) { WRITE_COORD( gravity[counter] ); }
|
||||
WRITE_COORD( particle_template.GetMaxAlpha() );
|
||||
WRITE_LONG( particle_template.GetParticleSystemIndexToGenerate() );
|
||||
WRITE_LONG( particle_template.GetFlags() );
|
||||
MESSAGE_END();
|
||||
if ( pev )
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgSetParticleTemplates, NULL, pev );
|
||||
else
|
||||
MESSAGE_BEGIN( MSG_SPEC, g_msgSetParticleTemplates);
|
||||
WRITE_STRING( particle_template.GetName().c_str() );
|
||||
WRITE_LONG( particle_template.GetMaxParticles() );
|
||||
WRITE_COORD( particle_template.GetParticleSize() );
|
||||
WRITE_STRING( particle_template.GetSprite().c_str() );
|
||||
WRITE_COORD( particle_template.GetParticleSystemLifetime() );
|
||||
WRITE_COORD( particle_template.GetParticleLifetime() );
|
||||
WRITE_COORD( particle_template.GetAnimationSpeed() );
|
||||
WRITE_BYTE( particle_template.GetNumSpriteFrames() );
|
||||
WRITE_COORD( particle_template.GetParticleScaling() );
|
||||
WRITE_BYTE( particle_template.GetRenderMode() );
|
||||
WRITE_LONG( particle_template.GetGenerationRate() );
|
||||
WRITE_BYTE( particle_template.GetGenerationShape() );
|
||||
particle_template.GetGenerationParams( gen_params );
|
||||
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( gen_params[counter] ); }
|
||||
WRITE_LONG( particle_template.GetGenerationEntityIndex() );
|
||||
WRITE_COORD( particle_template.GetGenerationEntityParameter() );
|
||||
WRITE_BYTE( particle_template.GetStartingVelocityShape() );
|
||||
particle_template.GetStartingVelocityParams( vel_params );
|
||||
for( int counter = 0; counter < 8; counter++ ) { WRITE_LONG( vel_params[counter] ); }
|
||||
particle_template.GetGravity( gravity );
|
||||
for( int counter = 0; counter < 3; counter++ ) { WRITE_COORD( gravity[counter] ); }
|
||||
WRITE_COORD( particle_template.GetMaxAlpha() );
|
||||
WRITE_LONG( particle_template.GetParticleSystemIndexToGenerate() );
|
||||
WRITE_LONG( particle_template.GetFlags() );
|
||||
MESSAGE_END();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1921,17 +1924,20 @@ union float_converter
|
|||
#else
|
||||
void NetMsg_SetupMap_Extents( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents, const bool draw_background )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgSetupMap, NULL, pev );
|
||||
WRITE_BYTE( 0 );
|
||||
WRITE_STRING( name.c_str() );
|
||||
WRITE_COORD( min_extents[2] );
|
||||
WRITE_COORD( max_extents[2] );
|
||||
WRITE_COORD( min_extents[0] );
|
||||
WRITE_COORD( min_extents[1] );
|
||||
WRITE_COORD( max_extents[0] );
|
||||
WRITE_COORD( max_extents[1] );
|
||||
WRITE_BYTE( draw_background ? 1 : 0 );
|
||||
MESSAGE_END();
|
||||
if ( pev)
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgSetupMap, NULL, pev );
|
||||
else
|
||||
MESSAGE_BEGIN( MSG_SPEC, g_msgSetupMap);
|
||||
WRITE_BYTE( 0 );
|
||||
WRITE_STRING( name.c_str() );
|
||||
WRITE_COORD( min_extents[2] );
|
||||
WRITE_COORD( max_extents[2] );
|
||||
WRITE_COORD( min_extents[0] );
|
||||
WRITE_COORD( min_extents[1] );
|
||||
WRITE_COORD( max_extents[0] );
|
||||
WRITE_COORD( max_extents[1] );
|
||||
WRITE_BYTE( draw_background ? 1 : 0 );
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
void NetMsg_SetupMap_Location( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents )
|
||||
|
@ -2032,10 +2038,6 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
int index = 0;
|
||||
|
||||
ent.mUnderAttack = ((flags & kEntHierFlagUnderAttack) == kEntHierFlagUnderAttack );
|
||||
if ( ent.mUnderAttack )
|
||||
{
|
||||
int a=0;
|
||||
}
|
||||
ent.mUser3 = (AvHUser3)(long_data & kStatusMask);
|
||||
long_data >>= kNumStatusBits;
|
||||
ent.mTeam = (AvHTeamNumber)(long_data & kTeamMask);
|
||||
|
@ -2074,7 +2076,7 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
#else
|
||||
void WriteEntHier( const int index, const MapEntity& ent, bool delete_flag, int& short_data, int& long_data );
|
||||
int PackageCoord( const float coord );
|
||||
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems )
|
||||
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems, bool specMsg )
|
||||
{
|
||||
const int kMaxUpdatesPerPacket = 30;
|
||||
if( NewItems.empty() && OldItems.empty() ) { return; } //nothing to send!
|
||||
|
@ -2083,29 +2085,43 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
MapEntity temp;
|
||||
EntityListType::const_iterator old_current, old_end = OldItems.end();
|
||||
int short_data, long_data, count = 1;
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
for( new_current = NewItems.begin(); new_current != new_end; ++new_current, ++count )
|
||||
if ( specMsg ) {
|
||||
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
|
||||
}
|
||||
else {
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
}
|
||||
for( new_current = NewItems.begin(); new_current != new_end; ++new_current, ++count )
|
||||
{
|
||||
if( count % kMaxUpdatesPerPacket == 0 )
|
||||
{
|
||||
if( count % kMaxUpdatesPerPacket == 0 )
|
||||
{
|
||||
MESSAGE_END();
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
MESSAGE_END();
|
||||
if ( specMsg ) {
|
||||
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
|
||||
}
|
||||
WriteEntHier( new_current->first, new_current->second, false, short_data, long_data );
|
||||
WRITE_SHORT(short_data);
|
||||
WRITE_LONG(long_data);
|
||||
else
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
}
|
||||
for( old_current = OldItems.begin(); old_current != old_end; ++old_current, ++count )
|
||||
WriteEntHier( new_current->first, new_current->second, false, short_data, long_data );
|
||||
WRITE_SHORT(short_data);
|
||||
WRITE_LONG(long_data);
|
||||
}
|
||||
for( old_current = OldItems.begin(); old_current != old_end; ++old_current, ++count )
|
||||
{
|
||||
if( count % kMaxUpdatesPerPacket == 0 )
|
||||
{
|
||||
if( count % kMaxUpdatesPerPacket == 0 )
|
||||
{
|
||||
MESSAGE_END();
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
MESSAGE_END();
|
||||
if ( specMsg ) {
|
||||
MESSAGE_BEGIN( MSG_SPEC, g_msgUpdateEntityHierarchy);
|
||||
}
|
||||
WriteEntHier( *old_current, temp, true, short_data, long_data );
|
||||
WRITE_SHORT(short_data);
|
||||
else
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgUpdateEntityHierarchy, NULL, pev );
|
||||
}
|
||||
WriteEntHier( *old_current, temp, true, short_data, long_data );
|
||||
WRITE_SHORT(short_data);
|
||||
}
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
||||
void WriteEntHier( const int index, const MapEntity& ent, bool delete_flag, int& short_data, int& long_data )
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
void NetMsg_SetTopDown_TechSlots( entvars_t* const pev, const int tech_slots );
|
||||
void NetMsg_SetupMap_Extents( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents, const bool draw_background );
|
||||
void NetMsg_SetupMap_Location( entvars_t* const pev, const string& name, const float* const min_extents, const float* const max_extents );
|
||||
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems );
|
||||
void NetMsg_UpdateEntityHierarchy( entvars_t* const pev, const MapEntityMap& NewItems, const EntityListType& OldItems, bool specMsg);
|
||||
void NetMsg_IssueOrder(entvars_t* const pev, const int ordertype, const int ordersource, const int ordertarget);
|
||||
|
||||
//BROADCAST MESSAGE TRANSMISSION
|
||||
|
|
|
@ -10107,13 +10107,13 @@ void AvHPlayer::UpdateEntityHierarchy()
|
|||
//if((theTeam) && GetGameRules()->GetGameStarted())
|
||||
if((theTeam)) // && GetGameRules()->GetGameStarted())
|
||||
{
|
||||
if (theTeam->GetTeamType() == AVH_CLASS_TYPE_MARINE ||
|
||||
theTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN)
|
||||
if (theTeam->GetTeamType() == AVH_CLASS_TYPE_MARINE ||
|
||||
theTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN)
|
||||
{
|
||||
// Pass in previous version so it can optimize and only send diff
|
||||
AvHEntityHierarchy& theEntityList = GetGameRules()->GetEntityHierarchy(player->GetTeam());
|
||||
|
||||
if(theEntityList.SendToNetworkStream(this->mClientEntityHierarchy, this->pev))
|
||||
if(theEntityList.SendToNetworkStream(this->mClientEntityHierarchy, this->pev, false))
|
||||
{
|
||||
this->mClientEntityHierarchy = theEntityList;
|
||||
}
|
||||
|
|
|
@ -336,10 +336,10 @@ void UpdateWorldEntity(CBaseEntity* inBaseEntity)
|
|||
if(AvHSUGetInViewOfEnemy(inBaseEntity, theSightedStatus))
|
||||
{
|
||||
inBaseEntity->pev->iuser4 |= theSightedStatus;
|
||||
if(inBaseEntity->pev->classname == MAKE_STRING(kesParticlesCustom))
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
// if(inBaseEntity->pev->classname == MAKE_STRING(kesParticlesCustom))
|
||||
// {
|
||||
// int a = 0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,6 +474,7 @@ void AvHGamerules::UpdateWorldEntities()
|
|||
PROFILE_START()
|
||||
this->mTeamAEntityHierarchy.BuildFromTeam(&this->mTeamA, gBaseEntityList);
|
||||
this->mTeamBEntityHierarchy.BuildFromTeam(&this->mTeamB, gBaseEntityList);
|
||||
this->mSpecEntityHierarchy.BuildForSpec(gBaseEntityList);
|
||||
PROFILE_END(kUpdateWorldEntitiesBuildEntityHierarchies)
|
||||
|
||||
// Update blips
|
||||
|
|
Loading…
Reference in a new issue