Skip to content

Commit

Permalink
Fix radar modes bug, where old radar mode 1 would not work properly d…
Browse files Browse the repository at this point in the history
…ue to new

radar visibility rules. Also reduce darkness a bit.
  • Loading branch information
perim committed Nov 9, 2011
1 parent 2ce5cc6 commit 7861f33
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/configuration.cpp
Expand Up @@ -110,6 +110,7 @@ bool loadConfig()
}
bEnemyAllyRadarColor = ini.value("radarObjectMode").toBool();
radarDrawMode = (RADAR_DRAW_MODE)ini.value("radarTerrainMode", RADAR_MODE_DEFAULT).toInt();
radarDrawMode = (RADAR_DRAW_MODE)MIN(NUM_RADAR_MODES - 1, radarDrawMode); // restrict to allowed values
if (ini.contains("textureSize")) setTextureSize(ini.value("textureSize").toInt());
NetPlay.isUPNP = ini.value("UPnP", true).toBool();
if (ini.contains("FSAA")) war_setFSAA(ini.value("FSAA").toInt());
Expand Down
10 changes: 2 additions & 8 deletions src/keybind.cpp
Expand Up @@ -2374,10 +2374,12 @@ void kf_ToggleVisibility( void )
{
if(getRevealStatus())
{
console("Reveal OFF");
setRevealStatus(false);
}
else
{
console("Reveal ON");
setRevealStatus(true);
}
}
Expand Down Expand Up @@ -2699,11 +2701,6 @@ void kf_ToggleRadarAllyEnemy(void)
void kf_ToggleRadarTerrain(void)
{
radarDrawMode = (RADAR_DRAW_MODE)(radarDrawMode + 1);

if (radarDrawMode == RADAR_MODE_TERRAIN_SEEN && getRevealStatus())
{
radarDrawMode = (RADAR_DRAW_MODE)(radarDrawMode + 1); // skip this radar mode for fog of war mode
}
if (radarDrawMode >= NUM_RADAR_MODES)
{
radarDrawMode = (RADAR_DRAW_MODE)0;
Expand All @@ -2719,9 +2716,6 @@ void kf_ToggleRadarTerrain(void)
case RADAR_MODE_TERRAIN:
CONPRINTF(ConsoleString, (ConsoleString, _("Radar showing terrain")));
break;
case RADAR_MODE_TERRAIN_SEEN:
CONPRINTF(ConsoleString, (ConsoleString, _("Radar showing revealed terrain")));
break;
case RADAR_MODE_HEIGHT_MAP:
CONPRINTF(ConsoleString, (ConsoleString, _("Radar showing height")));
break;
Expand Down
25 changes: 15 additions & 10 deletions src/radar.cpp
Expand Up @@ -333,16 +333,15 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
{
PIELIGHT WScr = WZCOL_BLACK; // squelch warning

// draw radar terrain on/off feature
if ((!getRevealStatus() || radarDrawMode == RADAR_MODE_TERRAIN_SEEN) && !TEST_TILE_VISIBLE(selectedPlayer, WTile))
// draw radar on/off feature
if (!getRevealStatus() && !TEST_TILE_VISIBLE(selectedPlayer, WTile))
{
return WZCOL_RADAR_BACKGROUND;
}

switch(radarDrawMode)
{
case RADAR_MODE_TERRAIN:
case RADAR_MODE_TERRAIN_SEEN:
{
// draw radar terrain on/off feature
PIELIGHT col = tileColours[TileNumber_tile(WTile->texture)];
Expand All @@ -353,20 +352,20 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
if (terrainType(WTile) == TER_CLIFFFACE)
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
col.byte.b /= 2;
}
if (!hasSensorOnTile(WTile, selectedPlayer))
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
col.byte.r = col.byte.r * 2 / 3;
col.byte.g = col.byte.g * 2 / 3;
col.byte.b = col.byte.b * 2 / 3;
}
if (!TEST_TILE_VISIBLE(selectedPlayer, WTile))
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
col.byte.b /= 2;
}
WScr = col;
}
Expand All @@ -382,14 +381,20 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
if (terrainType(WTile) == TER_CLIFFFACE)
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
col.byte.b /= 2;
}
if (!hasSensorOnTile(WTile, selectedPlayer))
{
col.byte.r = col.byte.r * 2 / 3;
col.byte.g = col.byte.g * 2 / 3;
col.byte.b = col.byte.b * 2 / 3;
}
if (!TEST_TILE_VISIBLE(selectedPlayer, WTile))
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
col.byte.b /= 2;
}
WScr = col;
}
Expand Down
1 change: 0 additions & 1 deletion src/radar.h
Expand Up @@ -49,7 +49,6 @@ enum RADAR_DRAW_MODE
{
RADAR_MODE_TERRAIN, ///< Draw terrain map
RADAR_MODE_DEFAULT = RADAR_MODE_TERRAIN, ///< Default is terrain map
RADAR_MODE_TERRAIN_SEEN, ///< Terrain map, showing only explored tiles
RADAR_MODE_HEIGHT_MAP, ///< Draw height map
RADAR_MODE_COMBINED,
RADAR_MODE_NO_TERRAIN, ///< Only display objects
Expand Down

0 comments on commit 7861f33

Please sign in to comment.