@@ -625,6 +625,52 @@ void W3DRadar::updateObjectTexture(TextureClass *texture)
625625 renderObjectList ( getLocalObjectList (), texture, TRUE );
626626}
627627
628+ // -------------------------------------------------------------------------------------------------
629+ // -------------------------------------------------------------------------------------------------
630+ Bool W3DRadar::canRenderObject ( const RadarObject *rObj, const Player *localPlayer )
631+ {
632+ if (rObj->isTemporarilyHidden ())
633+ return false ;
634+
635+ const Int playerIndex = localPlayer->getPlayerIndex ();
636+ const Object *obj = rObj->friend_getObject ();
637+
638+ //
639+ // check for shrouded status
640+ // if object is fogged or shrouded, don't render it
641+ //
642+ if (obj->getShroudedStatus (playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
643+ {
644+ return false ;
645+ }
646+
647+ //
648+ // objects with a local only unit priority will only appear on the radar if they
649+ // are controlled by the local player, or if the local player is an observer (cause
650+ // they are godlike and can see everything)
651+ //
652+ if (obj->getRadarPriority () == RADAR_PRIORITY_LOCAL_UNIT_ONLY &&
653+ obj->getControllingPlayer () != localPlayer &&
654+ localPlayer->isPlayerActive () )
655+ {
656+ return false ;
657+ }
658+
659+ //
660+ // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
661+ // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
662+ //
663+ if (TheControlBar->getCurrentlyViewedPlayerRelationship (obj->getTeam ()) == ENEMIES &&
664+ obj->testStatus ( OBJECT_STATUS_STEALTHED ) &&
665+ !obj->testStatus ( OBJECT_STATUS_DETECTED ) &&
666+ !obj->testStatus ( OBJECT_STATUS_DISGUISED ) )
667+ {
668+ return false ;
669+ }
670+
671+ return true ;
672+ }
673+
628674// -------------------------------------------------------------------------------------------------
629675/* * Render an object list into the texture passed in */
630676// -------------------------------------------------------------------------------------------------
@@ -642,7 +688,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
642688 ICoord2D radarPoint;
643689
644690 Player *player = rts::getObservedOrLocalPlayer ();
645- const Int playerIndex = player->getPlayerIndex ();
646691
647692 if ( calcHero )
648693 {
@@ -652,49 +697,26 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
652697
653698 for ( const RadarObject *rObj = listHead; rObj; rObj = rObj->friend_getNext () )
654699 {
655-
656- if (rObj->isTemporarilyHidden ())
700+ if (!canRenderObject (rObj, player))
657701 continue ;
658702
659- // get object
660- const Object *obj = rObj->friend_getObject ();
661-
662- // check for shrouded status
663- if (obj->getShroudedStatus (playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
664- continue ; // object is fogged or shrouded, don't render it.
665-
666- //
667- // objects with a local only unit priority will only appear on the radar if they
668- // are controlled by the local player, or if the local player is an observer (cause
669- // they are godlike and can see everything)
670- //
671- if ( obj->getRadarPriority () == RADAR_PRIORITY_LOCAL_UNIT_ONLY &&
672- obj->getControllingPlayer () != player &&
673- player->isPlayerActive () )
674- continue ;
675-
676703 // get object position
704+ const Object *obj = rObj->friend_getObject ();
677705 const Coord3D *pos = obj->getPosition ();
678706
679707 // compute object position as a radar blip
680708 radarPoint.x = pos->x / (m_mapExtent.width () / RADAR_CELL_WIDTH);
681709 radarPoint.y = pos->y / (m_mapExtent.height () / RADAR_CELL_HEIGHT);
682710
683- // get the color we're going to draw in
711+ // get the color we're going to draw in
684712 Color c = rObj->getColor ();
685713
686-
687-
688714 // adjust the alpha for stealth units so they "fade/blink" on the radar for the controller
689715 // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY )
690716 // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
691717 // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
692718 if ( obj->testStatus ( OBJECT_STATUS_STEALTHED ) )
693719 {
694- if ( TheControlBar->getCurrentlyViewedPlayerRelationship (obj->getTeam ()) == ENEMIES )
695- if ( !obj->testStatus ( OBJECT_STATUS_DETECTED ) && !obj->testStatus ( OBJECT_STATUS_DISGUISED ) )
696- continue ;
697-
698720 UnsignedByte r, g, b, a;
699721 GameGetColorComponents ( c, &r, &g, &b, &a );
700722
0 commit comments