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; // debug the entity hierarchy message size // if ( mapEntity.mUser3 == AVH_USER3_COMMANDER_STATION ) { // for (int i=0; i<200; i++ ) { // mEntityList[100+i] = mapEntity; // } // } } } }
void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType& inBaseEntityList) { this->Clear(); int mc=0, sc=0, dc=0; if (inTeam->GetTeamType() == AVH_CLASS_TYPE_MARINE || inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN) { // 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 = (theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber())) || GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_SIGHTED); bool theEntityIsDetected = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_DETECTED); bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex); if ( theEntityIsUnderAttack ) { int a=0; } // Don't send ammo, health, weapons, or scans bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan)); if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN && theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber()) ) { AvHBuildable *theBuildable=dynamic_cast<AvHBuildable *>(theBaseEntity); if ( theBuildable && theBuildable->GetHasBeenBuilt() ) { if ( theBaseEntity->pev->iuser3 == AVH_USER3_MOVEMENT_CHAMBER ) { mc++; } if ( theBaseEntity->pev->iuser3 == AVH_USER3_SENSORY_CHAMBER ) { sc++; } if ( theBaseEntity->pev->iuser3 == AVH_USER3_DEFENSE_CHAMBER ) { dc++; } } } MapEntity mapEntity; mapEntity.mX = theBaseEntity->pev->origin.x; mapEntity.mY = theBaseEntity->pev->origin.y; mapEntity.mUser3 = (AvHUser3)(theBaseEntity->pev->iuser3); // Don't draw detected blips as their real selves if(!theEntityIsVisible && theEntityIsDetected) mapEntity.mUser3 = AVH_USER3_UNKNOWN; 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 || theEntityIsDetected) && !(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; } } if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN ) { sc=min(3, sc); dc=min(3,dc); mc=min(3,mc); if ( this->mNumSensory != sc || this->mNumDefence != dc || this->mNumMovement != mc ) { this->mNumSensory=sc; this->mNumDefence=dc; this->mNumMovement=mc; } } } }