6 changes: 4 additions & 2 deletions src/keybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@ void kf_ToggleDebugMappings( void )
void kf_ToggleGodMode( void )
{
const char* cmsg;
static bool pastReveal = true;

#ifndef DEBUG
// Bail out if we're running a _true_ multiplayer game (to prevent MP cheating)
Expand All @@ -1273,7 +1274,7 @@ void kf_ToggleGodMode( void )
int player;

godMode = false;
setRevealStatus(game.fog);
setRevealStatus(pastReveal);
// now hide the features
while (psFeat)
{
Expand Down Expand Up @@ -1302,7 +1303,8 @@ void kf_ToggleGodMode( void )
{
godMode = true; // view all structures and droids
revealAll(selectedPlayer);
setRevealStatus(false); // view the entire map
pastReveal = getRevealStatus();
setRevealStatus(true); // view the entire map
}

sasprintf((char**)&cmsg, _("(Player %u) is using cheat :%s"),
Expand Down
10 changes: 0 additions & 10 deletions src/loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,6 @@ GAMECODE gameLoop(void)
intAddInGamePopup();
}

if (!war_GetFog())
{
PIELIGHT black;

// set the fog color to black (RGB)
// the fogbox will get this color
black.rgba = 0;
black.byte.a = 255;
pie_SetFogColour(black);
}
if(getDrawShadows())
{
clearMode |= CLEAR_SHADOW;
Expand Down
59 changes: 4 additions & 55 deletions src/multiint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,22 +1569,8 @@ static void addGameOptions()
widgSetButtonState(psWScreen, MULTIOP_PNAME_ICON, WBUT_DISABLE);
}

// Fog type
addBlueForm(MULTIOP_OPTIONS,MULTIOP_FOG,_("Fog"),MCOL0,MROW6,MULTIOP_BLUEFORMW,27);

addMultiBut(psWScreen,MULTIOP_FOG,MULTIOP_FOG_ON ,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH, _("Fog Of War"), IMAGE_FOG_OFF, IMAGE_FOG_OFF_HI,true);//black stuff
addMultiBut(psWScreen,MULTIOP_FOG,MULTIOP_FOG_OFF,MCOL2,2,MULTIOP_BUTW,MULTIOP_BUTH, _("Distance Fog"),IMAGE_FOG_ON,IMAGE_FOG_ON_HI,true);
if(game.fog)
{
widgSetButtonState(psWScreen, MULTIOP_FOG_ON,WBUT_LOCK);
}
else
{
widgSetButtonState(psWScreen, MULTIOP_FOG_OFF,WBUT_LOCK);
}

// alliances
addBlueForm(MULTIOP_OPTIONS, MULTIOP_ALLIANCES, _("Alliances"), MCOL0, MROW7, MULTIOP_BLUEFORMW, 27);
addBlueForm(MULTIOP_OPTIONS, MULTIOP_ALLIANCES, _("Alliances"), MCOL0, MROW6, MULTIOP_BLUEFORMW, 27);

addMultiBut(psWScreen,MULTIOP_ALLIANCES,MULTIOP_ALLIANCE_N,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("No Alliances"),IMAGE_NOALLI,IMAGE_NOALLI_HI,true);
Expand Down Expand Up @@ -1617,7 +1603,7 @@ static void addGameOptions()
break;
}

addBlueForm(MULTIOP_OPTIONS, MULTIOP_POWER, _("Power"), MCOL0, MROW8, MULTIOP_BLUEFORMW, 27);
addBlueForm(MULTIOP_OPTIONS, MULTIOP_POWER, _("Power"), MCOL0, MROW7, MULTIOP_BLUEFORMW, 27);
addMultiBut(psWScreen,MULTIOP_POWER,MULTIOP_POWLEV_LOW,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("Low Power Levels"),IMAGE_POWLO,IMAGE_POWLO_HI,true);
addMultiBut(psWScreen,MULTIOP_POWER,MULTIOP_POWLEV_MED,MCOL2,2,MULTIOP_BUTW,MULTIOP_BUTH,
Expand Down Expand Up @@ -1655,7 +1641,7 @@ static void addGameOptions()
}
}

addBlueForm(MULTIOP_OPTIONS, MULTIOP_BASETYPE, _("Base"), MCOL0, MROW9, MULTIOP_BLUEFORMW, 27);
addBlueForm(MULTIOP_OPTIONS, MULTIOP_BASETYPE, _("Base"), MCOL0, MROW8, MULTIOP_BLUEFORMW, 27);
addMultiBut(psWScreen,MULTIOP_BASETYPE,MULTIOP_CLEAN,MCOL1,2,MULTIOP_BUTW,MULTIOP_BUTH,
_("Start with No Bases"), IMAGE_NOBASE,IMAGE_NOBASE_HI,true);
addMultiBut(psWScreen,MULTIOP_BASETYPE,MULTIOP_BASE,MCOL2,2,MULTIOP_BUTW,MULTIOP_BUTH,
Expand Down Expand Up @@ -1693,7 +1679,7 @@ static void addGameOptions()
break;
}

addBlueForm(MULTIOP_OPTIONS, MULTIOP_MAP_PREVIEW, _("Map Preview"), MCOL0, MROW10, MULTIOP_BLUEFORMW, 27);
addBlueForm(MULTIOP_OPTIONS, MULTIOP_MAP_PREVIEW, _("Map Preview"), MCOL0, MROW9, MULTIOP_BLUEFORMW, 27);
addMultiBut(psWScreen,MULTIOP_MAP_PREVIEW, MULTIOP_MAP_BUT, MCOL2, 2, MULTIOP_BUTW, MULTIOP_BUTH,
_("Click to see Map"), IMAGE_FOG_OFF, IMAGE_FOG_OFF_HI, true);
widgSetButtonState(psWScreen, MULTIOP_MAP_BUT,0); //1 = OFF 0=ON
Expand Down Expand Up @@ -2643,9 +2629,6 @@ static void disableMultiButs(void)

if (!NetPlay.isHost)
{
if( game.fog) widgSetButtonState(psWScreen,MULTIOP_FOG_OFF ,WBUT_DISABLE); //fog
if(!game.fog) widgSetButtonState(psWScreen,MULTIOP_FOG_ON ,WBUT_DISABLE);

if(game.base != CAMP_CLEAN) widgSetButtonState(psWScreen,MULTIOP_CLEAN ,WBUT_DISABLE); // camapign subtype.
if(game.base != CAMP_BASE) widgSetButtonState(psWScreen,MULTIOP_BASE ,WBUT_DISABLE);
if(game.base != CAMP_WALLS) widgSetButtonState(psWScreen,MULTIOP_DEFENCE,WBUT_DISABLE);
Expand Down Expand Up @@ -2824,32 +2807,6 @@ static void processMultiopWidgets(UDWORD id)
}
break;

case MULTIOP_FOG_ON:
widgSetButtonState(psWScreen, MULTIOP_FOG_ON,WBUT_LOCK);
widgSetButtonState(psWScreen, MULTIOP_FOG_OFF,0);
game.fog = true;

resetReadyStatus(false);

if(bHosted)
{
sendOptions();
}
break;

case MULTIOP_FOG_OFF:
widgSetButtonState(psWScreen, MULTIOP_FOG_ON,0);
widgSetButtonState(psWScreen, MULTIOP_FOG_OFF,WBUT_LOCK);
game.fog = false;

resetReadyStatus(false);

if(bHosted)
{
sendOptions();
}
break;

case MULTIOP_CLEAN:
game.base = CAMP_CLEAN;
addGameOptions();
Expand Down Expand Up @@ -3283,10 +3240,6 @@ void startMultiplayerGame(void)
SendFireUp(); //bcast a fireup message
}

// set the fog correctly..
setRevealStatus(game.fog);
war_SetFog(!game.fog);

debug(LOG_NET, "title mode STARTGAME is set--Starting Game!");
changeTitleMode(STARTGAME);

Expand Down Expand Up @@ -3446,10 +3399,6 @@ void frontendMultiMessages(void)
resetDataHash();
decideWRF();

// set the fog correctly..
setRevealStatus(game.fog);
war_SetFog(!game.fog);

bMultiPlayer = true;
bMultiMessages = true;
changeTitleMode(STARTGAME);
Expand Down
4 changes: 0 additions & 4 deletions src/multiint.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,10 @@ void loadMapPreview(bool hideInterface);
#define MULTIOP_BASETYPE 10300
#define MULTIOP_TECHLEVEL 10302
#define MULTIOP_COMPUTER 10304
#define MULTIOP_FOG 10306

#define MULTIOP_COMPUTER_Y 10308
#define MULTIOP_COMPUTER_N 10309

#define MULTIOP_FOG_ON 10310
#define MULTIOP_FOG_OFF 10311

#define MULTIOP_SKSLIDE 102842 //10313
#define MULTIOP_SKSLIDE_END 102873 //10320

Expand Down
6 changes: 4 additions & 2 deletions src/multiopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extern char buildTime[8];
// send complete game info set!
void sendOptions()
{
bool dummy = true;
unsigned int i;

NETbeginEncode(NETbroadcastQueue(), NET_OPTIONS);
Expand All @@ -76,7 +77,7 @@ void sendOptions()
NETstring(game.map, 128);
NETuint8_t(&game.maxPlayers);
NETstring(game.name, 128);
NETbool(&game.fog);
NETbool(&dummy);
NETuint32_t(&game.power);
NETuint8_t(&game.base);
NETuint8_t(&game.alliance);
Expand Down Expand Up @@ -143,6 +144,7 @@ static bool checkGameWdg(const char *nm)
void recvOptions(NETQUEUE queue)
{
unsigned int i;
bool dummy = true;

debug(LOG_NET, "Receiving options from host");
NETbeginDecode(queue, NET_OPTIONS);
Expand All @@ -152,7 +154,7 @@ void recvOptions(NETQUEUE queue)
NETstring(game.map, 128);
NETuint8_t(&game.maxPlayers);
NETstring(game.name, 128);
NETbool(&game.fog);
NETbool(&dummy);
NETuint32_t(&game.power);
NETuint8_t(&game.base);
NETuint8_t(&game.alliance);
Expand Down
1 change: 0 additions & 1 deletion src/multiplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct MULTIPLAYERGAME
char map[128]; // name of multiplayer map being used.
uint8_t maxPlayers; // max players to allow
char name[128]; // game name (to be used)
bool fog;
uint32_t power; // power level for arena game
uint8_t base; // clean/base/base&defence
uint8_t alliance; // no/yes/AIs vs Humans
Expand Down
8 changes: 7 additions & 1 deletion src/radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ 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))
if ((!getRevealStatus() || radarDrawMode == RADAR_MODE_TERRAIN_SEEN) && !TEST_TILE_VISIBLE(selectedPlayer, WTile))
{
return WZCOL_RADAR_BACKGROUND;
}
Expand Down Expand Up @@ -362,6 +362,12 @@ static PIELIGHT appliedRadarColour(RADAR_DRAW_MODE radarDrawMode, MAPTILE *WTile
col.byte.b /= 2;
col.byte.g /= 2;
}
if (!TEST_TILE_VISIBLE(selectedPlayer, WTile))
{
col.byte.r /= 2;
col.byte.b /= 2;
col.byte.g /= 2;
}
WScr = col;
}
break;
Expand Down
63 changes: 8 additions & 55 deletions src/scriptfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3802,26 +3802,7 @@ bool scrSetBackgroundFog(void)
return false;
}

//jps 17 feb 99 just set the status let other code worry about fogEnable/reveal
if (bState)//true, so go to false
{
//restart fog if it was off
if ((fogStatus == 0) && war_GetFog() && !(bMultiPlayer && game.fog))
{
pie_EnableFog(true);
}
fogStatus |= FOG_BACKGROUND;//set lowest bit of 3
}
else
{
fogStatus &= FOG_FLAGS-FOG_BACKGROUND;//clear middle bit of 3
//disable fog if it longer used
if (fogStatus == 0)
{
pie_SetFogStatus(false);
pie_EnableFog(false);
}
}
// no-op

return true;
}
Expand All @@ -3836,25 +3817,8 @@ bool scrSetDepthFog(void)
{
return false;
}
if (bState)//true, so go to false
{
//restart fog if it was off
if ((fogStatus == 0) && war_GetFog() )
{
pie_EnableFog(true);
}
fogStatus |= FOG_DISTANCE;//set lowest bit of 3
}
else
{
fogStatus &= FOG_FLAGS-FOG_DISTANCE;//clear middle bit of 3
//disable fog if it longer used
if (fogStatus == 0)
{
pie_SetFogStatus(false);
pie_EnableFog(false);
}
}

// no-op

return true;
}
Expand All @@ -3871,15 +3835,11 @@ bool scrSetFogColour(void)
return false;
}

if (war_GetFog())
{
scrFogColour.byte.r = red;
scrFogColour.byte.g = green;
scrFogColour.byte.b = blue;
scrFogColour.byte.a = 255;

pie_SetFogColour(scrFogColour);
}
scrFogColour.byte.r = red;
scrFogColour.byte.g = green;
scrFogColour.byte.b = blue;
scrFogColour.byte.a = 255;
pie_SetFogColour(scrFogColour);

return true;
}
Expand Down Expand Up @@ -7178,22 +7138,15 @@ bool scrFogTileInRange(void)
//closer than last one?
if(wDist < wBestDist)
{
//tmpX = i;
//tmpY = j;
//if(pickATileGen(&tmpX, &tmpY, 4,zonedPAT)) //can reach (don't need many passes)
if(zonedPAT(i,j)) //Can reach this tile
{
//if((tmpX == i) && (tmpY == j)) //can't allow to change coords, otherwise might send to the same unrevealed tile next time
//and units will stuck forever
//{
if((threadRange <= 0) || (!ThreatInRange(player, threadRange, world_coord(i), world_coord(j), false)))
{
wBestDist = wDist;
tBestX = i;
tBestY = j;
ok = true;
}
//}
}
}
}
Expand Down
28 changes: 0 additions & 28 deletions src/warzoneconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
struct WARZONE_GLOBALS
{
FMV_MODE FMVmode;
bool bFog;
SWORD effectsLevel;
bool Fullscreen;
bool soundEnabled;
Expand Down Expand Up @@ -83,7 +82,6 @@ static WARZONE_GLOBALS warGlobs;//STATIC use or write an access function if you
void war_SetDefaultStates(void)//Sets all states
{
//set those here and reset in clParse or loadConfig
war_SetFog(false);
war_setFSAA(0);
war_setSoundEnabled( true );
war_SetPauseOnFocusLoss(false);
Expand Down Expand Up @@ -166,32 +164,6 @@ UDWORD war_GetHeight(void)
return warGlobs.height;
}

/***************************************************************************/
/***************************************************************************/
void war_SetFog(bool val)
{
debug(LOG_FOG, "Visual fog turned %s", val ? "ON" : "OFF");

if (warGlobs.bFog != val)
{
warGlobs.bFog = val;
}
if (warGlobs.bFog)
{
setRevealStatus(false);
}
else
{
setRevealStatus(true);
pie_SetFogColour(WZCOL_BLACK);
}
}

bool war_GetFog(void)
{
return warGlobs.bFog;
}

/***************************************************************************/
/***************************************************************************/
void war_SetFMVmode(FMV_MODE mode)
Expand Down
2 changes: 0 additions & 2 deletions src/warzoneconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ enum FSAA_LEVEL
*/
/***************************************************************************/
extern void war_SetDefaultStates(void);
extern void war_SetFog(bool val);
extern bool war_GetFog(void);
extern void war_SetFMVmode(FMV_MODE mode);
extern FMV_MODE war_GetFMVmode(void);
extern void war_SetAllowSubtitles(bool);
Expand Down