Changeset 8874 for code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc
- Timestamp:
- Sep 4, 2011, 3:15:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc
r7880 r8874 64 64 this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png"; 65 65 this->shapeMaterials_[RadarViewable::Square] = "RadarSquare.png"; 66 66 this->setDetectionLimit( 10000.0f ); 67 67 this->owner_ = 0; 68 68 } … … 94 94 if (object == dynamic_cast<RadarViewable*>(this->owner_)) 95 95 return; 96 if( showObject(object) == false ) //do not show objects that are "invisible" or "radar invisible" 97 return; 96 98 97 99 // Make sure the object hasn't been added yet … … 123 125 void HUDRadar::objectChanged( RadarViewable* rv ) 124 126 { 125 if (rv == dynamic_cast<RadarViewable*>(this->owner_)) 126 return; 127 if(rv == dynamic_cast<RadarViewable*>(this->owner_)) //case: player changed 128 return; 129 if( showObject(rv) == false ) //case: (radar) invisible object changed 130 return; 131 if( this->radarObjects_.find(rv) == this->radarObjects_.end() ) // if (radar) invisibility becomes (radar) visible 132 this->addObject(rv); 127 133 assert( this->radarObjects_.find(rv) != this->radarObjects_.end() ); 128 134 Ogre::PanelOverlayElement* panel = this->radarObjects_[rv]; … … 172 178 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 173 179 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 174 it->second->show(); 180 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 181 it->second->show(); 182 else 183 it->second->hide(); 175 184 176 185 // if this object is in focus, then set the focus marker … … 184 193 } 185 194 195 bool HUDRadar::showObject(RadarViewable* rv) 196 { 197 if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) ) 198 return false; 199 assert( rv->getWorldEntity() ); 200 if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false ) 201 return false; 202 return true; 203 } 204 205 186 206 void HUDRadar::changedOwner() 187 207 {
Note: See TracChangeset
for help on using the changeset viewer.