Skip to content

Commit ee9841b

Browse files
committed
bugfix(radar): No longer show hero radar icons in shroud (#1569)
1 parent b4d1013 commit ee9841b

File tree

2 files changed

+24
-50
lines changed
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System
  • Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System

2 files changed

+24
-50
lines changed

Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -661,28 +661,19 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
661661
// get object
662662
const Object *obj = rObj->friend_getObject();
663663

664-
// cache hero objects for drawing in icon layer
665-
if( calcHero && obj->isHero() )
666-
{
667-
m_cachedHeroObjectList.push_back(obj);
668-
}
669-
Bool skip = FALSE;
670-
671664
// check for shrouded status
672665
if (obj->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
673-
skip = TRUE; //object is fogged or shrouded, don't render it.
666+
continue; //object is fogged or shrouded, don't render it.
674667

675668
//
676669
// objects with a local only unit priority will only appear on the radar if they
677670
// are controlled by the local player, or if the local player is an observer (cause
678671
// they are godlike and can see everything)
679672
//
680-
681-
682673
if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY &&
683-
obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() &&
684-
ThePlayerList->getLocalPlayer()->isPlayerActive() )
685-
skip = TRUE;
674+
obj->getControllingPlayer() != player &&
675+
player->isPlayerActive() )
676+
continue;
686677

687678
// get object position
688679
const Coord3D *pos = obj->getPosition();
@@ -691,19 +682,15 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
691682
radarPoint.x = pos->x / (m_mapExtent.width() / RADAR_CELL_WIDTH);
692683
radarPoint.y = pos->y / (m_mapExtent.height() / RADAR_CELL_HEIGHT);
693684

694-
695-
if ( skip )
696-
continue;
697-
698685
// get the color we're going to draw in
699686
Color c = rObj->getColor();
700687

701688

702689

703690
// adjust the alpha for stealth units so they "fade/blink" on the radar for the controller
704691
// if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY )
705-
// ML-- What the heck is this? local-only and neutral-observier-viewed units are stealthy?? Since when?
706-
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed
692+
// ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
693+
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
707694
if( obj->testStatus( OBJECT_STATUS_STEALTHED ) )
708695
{
709696
StealthUpdate* stealth = obj->getStealth();
@@ -712,17 +699,14 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
712699

713700
if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES )
714701
if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() )
715-
skip = TRUE;
702+
continue;
716703

717704
UnsignedByte r, g, b, a;
718705
GameGetColorComponents( c, &r, &g, &b, &a );
719706

720707
const UnsignedInt framesForTransition = LOGICFRAMES_PER_SECOND;
721708
const UnsignedByte minAlpha = 32;
722709

723-
if (skip)
724-
continue;
725-
726710
Real alphaScale = INT_TO_REAL(TheGameLogic->getFrame() % framesForTransition) / (framesForTransition / 2.0f);
727711
if( alphaScale > 0.0f )
728712
a = REAL_TO_UNSIGNEDBYTE( ((alphaScale - 1.0f) * (255.0f - minAlpha)) + minAlpha );
@@ -732,8 +716,11 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
732716

733717
}
734718

735-
736-
719+
// cache hero objects for drawing in icon layer
720+
if( calcHero && obj->isHero() )
721+
{
722+
m_cachedHeroObjectList.push_back(obj);
723+
}
737724

738725
// draw the blip, but make sure the points are legal
739726
if( legalRadarPoint( radarPoint.x, radarPoint.y ) )

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -659,28 +659,19 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
659659
// get object
660660
const Object *obj = rObj->friend_getObject();
661661

662-
// cache hero objects for drawing in icon layer
663-
if( calcHero && obj->isHero() )
664-
{
665-
m_cachedHeroObjectList.push_back(obj);
666-
}
667-
Bool skip = FALSE;
668-
669662
// check for shrouded status
670663
if (obj->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
671-
skip = TRUE; //object is fogged or shrouded, don't render it.
664+
continue; //object is fogged or shrouded, don't render it.
672665

673666
//
674667
// objects with a local only unit priority will only appear on the radar if they
675668
// are controlled by the local player, or if the local player is an observer (cause
676669
// they are godlike and can see everything)
677670
//
678-
679-
680671
if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY &&
681-
obj->getControllingPlayer() != ThePlayerList->getLocalPlayer() &&
682-
ThePlayerList->getLocalPlayer()->isPlayerActive() )
683-
skip = TRUE;
672+
obj->getControllingPlayer() != player &&
673+
player->isPlayerActive() )
674+
continue;
684675

685676
// get object position
686677
const Coord3D *pos = obj->getPosition();
@@ -689,34 +680,27 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
689680
radarPoint.x = pos->x / (m_mapExtent.width() / RADAR_CELL_WIDTH);
690681
radarPoint.y = pos->y / (m_mapExtent.height() / RADAR_CELL_HEIGHT);
691682

692-
693-
if ( skip )
694-
continue;
695-
696683
// get the color we're going to draw in
697684
Color c = rObj->getColor();
698685

699686

700687

701688
// adjust the alpha for stealth units so they "fade/blink" on the radar for the controller
702689
// if( obj->getRadarPriority() == RADAR_PRIORITY_LOCAL_UNIT_ONLY )
703-
// ML-- What the heck is this? local-only and neutral-observier-viewed units are stealthy?? Since when?
704-
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observier-viewed
690+
// ML-- What the heck is this? local-only and neutral-observer-viewed units are stealthy?? Since when?
691+
// Now it twinkles for any stealthed object, whether locally controlled or neutral-observer-viewed
705692
if( obj->testStatus( OBJECT_STATUS_STEALTHED ) )
706693
{
707694
if ( TheControlBar->getCurrentlyViewedPlayerRelationship(obj->getTeam()) == ENEMIES )
708695
if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) )
709-
skip = TRUE;
696+
continue;
710697

711698
UnsignedByte r, g, b, a;
712699
GameGetColorComponents( c, &r, &g, &b, &a );
713700

714701
const UnsignedInt framesForTransition = LOGICFRAMES_PER_SECOND;
715702
const UnsignedByte minAlpha = 32;
716703

717-
if (skip)
718-
continue;
719-
720704
Real alphaScale = INT_TO_REAL(TheGameLogic->getFrame() % framesForTransition) / (framesForTransition / 2.0f);
721705
if( alphaScale > 0.0f )
722706
a = REAL_TO_UNSIGNEDBYTE( ((alphaScale - 1.0f) * (255.0f - minAlpha)) + minAlpha );
@@ -726,8 +710,11 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text
726710

727711
}
728712

729-
730-
713+
// cache hero objects for drawing in icon layer
714+
if( calcHero && obj->isHero() )
715+
{
716+
m_cachedHeroObjectList.push_back(obj);
717+
}
731718

732719
// draw the blip, but make sure the points are legal
733720
if( legalRadarPoint( radarPoint.x, radarPoint.y ) )

0 commit comments

Comments
 (0)