@@ -625,6 +625,54 @@ 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+ {
634+ return false ;
635+ }
636+
637+ const Int playerIndex = localPlayer->getPlayerIndex ();
638+ const Object *obj = rObj->friend_getObject ();
639+
640+ //
641+ // check for shrouded status
642+ // if object is fogged or shrouded, don't render it
643+ //
644+ if (obj->getShroudedStatus (playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
645+ {
646+ return false ;
647+ }
648+
649+ //
650+ // objects with a local only unit priority will only appear on the radar if they
651+ // are controlled by the local player, or if the local player is an observer (cause
652+ // they are godlike and can see everything)
653+ //
654+ if (obj->getRadarPriority () == RADAR_PRIORITY_LOCAL_UNIT_ONLY &&
655+ obj->getControllingPlayer () != localPlayer &&
656+ localPlayer->isPlayerActive () )
657+ {
658+ return false ;
659+ }
660+
661+ //
662+ // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
663+ // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
664+ //
665+ if (TheControlBar->getCurrentlyViewedPlayerRelationship (obj->getTeam ()) == ENEMIES &&
666+ obj->testStatus ( OBJECT_STATUS_STEALTHED ) &&
667+ !obj->testStatus ( OBJECT_STATUS_DETECTED ) &&
668+ !obj->testStatus ( OBJECT_STATUS_DISGUISED ) )
669+ {
670+ return false ;
671+ }
672+
673+ return true ;
674+ }
675+
628676// -------------------------------------------------------------------------------------------------
629677/* * Render an object list into the texture passed in */
630678// -------------------------------------------------------------------------------------------------
@@ -642,7 +690,6 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
642690 ICoord2D radarPoint;
643691
644692 Player *player = rts::getObservedOrLocalPlayer ();
645- const Int playerIndex = player->getPlayerIndex ();
646693
647694 if ( calcHero )
648695 {
@@ -652,49 +699,26 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
652699
653700 for ( const RadarObject *rObj = listHead; rObj; rObj = rObj->friend_getNext () )
654701 {
655-
656- if (rObj->isTemporarilyHidden ())
702+ if (!canRenderObject (rObj, player))
657703 continue ;
658704
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-
676705 // get object position
706+ const Object *obj = rObj->friend_getObject ();
677707 const Coord3D *pos = obj->getPosition ();
678708
679709 // compute object position as a radar blip
680710 radarPoint.x = pos->x / (m_mapExtent.width () / RADAR_CELL_WIDTH);
681711 radarPoint.y = pos->y / (m_mapExtent.height () / RADAR_CELL_HEIGHT);
682712
683- // get the color we're going to draw in
713+ // get the color we're going to draw in
684714 Color c = rObj->getColor ();
685715
686-
687-
688716 // adjust the alpha for stealth units so they "fade/blink" on the radar for the controller
689717 // if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY )
690718 // ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
691719 // Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
692720 if ( obj->testStatus ( OBJECT_STATUS_STEALTHED ) )
693721 {
694- if ( TheControlBar->getCurrentlyViewedPlayerRelationship (obj->getTeam ()) == ENEMIES )
695- if ( !obj->testStatus ( OBJECT_STATUS_DETECTED ) && !obj->testStatus ( OBJECT_STATUS_DISGUISED ) )
696- continue ;
697-
698722 UnsignedByte r, g, b, a;
699723 GameGetColorComponents ( c, &r, &g, &b, &a );
700724
0 commit comments