Pressing the 'z' key (default keymap) will darken the terrain in areas where
you have no sensor coverage, and therefore cannot see enemy units moving. Patch #876 by me and cybersphinx. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3004 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
d37d94aaed
commit
259902ba34
|
@ -155,7 +155,6 @@ static void drawTerrainWaterTile(UDWORD i, UDWORD j);
|
|||
// Should be cleaned up properly and be put in structures.
|
||||
|
||||
BOOL bRender3DOnly;
|
||||
static BOOL bSensorDisplay = TRUE;
|
||||
static BOOL bRangeDisplay = FALSE;
|
||||
static SDWORD rangeCenterX,rangeCenterY,rangeRadius;
|
||||
static BOOL bDrawBlips=TRUE;
|
||||
|
@ -428,10 +427,7 @@ void draw3DScene( void )
|
|||
|
||||
structureEffects(); // add fancy effects to structures
|
||||
|
||||
if(bSensorDisplay)
|
||||
{
|
||||
showDroidSensorRanges(); //shows sensor data for units/droids/whatever...-Q 5-10-05
|
||||
}
|
||||
showDroidSensorRanges(); //shows sensor data for units/droids/whatever...-Q 5-10-05
|
||||
|
||||
//visualize radius if needed
|
||||
if(bRangeDisplay)
|
||||
|
@ -543,6 +539,11 @@ static void drawTiles(iView *camera, iView *player)
|
|||
int shiftVal = 0;
|
||||
static float angle = 0.0f;
|
||||
|
||||
if (bDisplaySensorRange)
|
||||
{
|
||||
updateSensorDisplay();
|
||||
}
|
||||
|
||||
// Animate the water texture, just cycles the V coordinate through half the tiles height.
|
||||
if(!gamePaused())
|
||||
{
|
||||
|
@ -625,10 +626,9 @@ static void drawTiles(iView *camera, iView *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
BOOL bEdgeTile;
|
||||
|
||||
/* Get a pointer to the tile at this location */
|
||||
BOOL bEdgeTile;
|
||||
MAPTILE *psTile = mapTile(playerXTile + j, playerZTile + i);
|
||||
|
||||
if (terrainType(psTile) == TER_WATER)
|
||||
{
|
||||
tileScreenInfo[i][j].bWater = TRUE;
|
||||
|
@ -653,10 +653,6 @@ static void drawTiles(iView *camera, iView *player)
|
|||
TileIllum = (psTile->level == UBYTE_MAX ? 1 : psTile->level); // avGetTileLevel(realX,realY);
|
||||
}
|
||||
}
|
||||
else if(bDisplaySensorRange)
|
||||
{
|
||||
TileIllum = psTile->inRange;
|
||||
}
|
||||
else
|
||||
{
|
||||
TileIllum = psTile->illumination;
|
||||
|
@ -664,6 +660,25 @@ static void drawTiles(iView *camera, iView *player)
|
|||
|
||||
tileScreenInfo[i][j].light.argb = lightDoFogAndIllumination(TileIllum, rx - tileScreenInfo[i][j].pos.x, rz - world_coord(i - terrainMidY), &tileScreenInfo[i][j].specular.argb);
|
||||
|
||||
// Real fog of war - darken where we cannot see enemy units moving around
|
||||
if (bDisplaySensorRange && psTile && !psTile->activeSensor)
|
||||
{
|
||||
const int f = 2;
|
||||
|
||||
tileScreenInfo[i+0][j+0].light.byte.r = tileScreenInfo[i+0][j+0].light.byte.r / f;
|
||||
tileScreenInfo[i+0][j+1].light.byte.r = tileScreenInfo[i+0][j+1].light.byte.r / f;
|
||||
tileScreenInfo[i+1][j+1].light.byte.r = tileScreenInfo[i+1][j+1].light.byte.r / f;
|
||||
tileScreenInfo[i+1][j+0].light.byte.r = tileScreenInfo[i+1][j+0].light.byte.r / f;
|
||||
tileScreenInfo[i+0][j+0].light.byte.g = tileScreenInfo[i+0][j+0].light.byte.g / f;
|
||||
tileScreenInfo[i+0][j+1].light.byte.g = tileScreenInfo[i+0][j+1].light.byte.g / f;
|
||||
tileScreenInfo[i+1][j+1].light.byte.g = tileScreenInfo[i+1][j+1].light.byte.g / f;
|
||||
tileScreenInfo[i+1][j+0].light.byte.g = tileScreenInfo[i+1][j+0].light.byte.g / f;
|
||||
tileScreenInfo[i+0][j+0].light.byte.b = tileScreenInfo[i+0][j+0].light.byte.b / f;
|
||||
tileScreenInfo[i+0][j+1].light.byte.b = tileScreenInfo[i+0][j+1].light.byte.b / f;
|
||||
tileScreenInfo[i+1][j+1].light.byte.b = tileScreenInfo[i+1][j+1].light.byte.b / f;
|
||||
tileScreenInfo[i+1][j+0].light.byte.b = tileScreenInfo[i+1][j+0].light.byte.b / f;
|
||||
}
|
||||
|
||||
if ( playerXTile+j <= 1 ||
|
||||
playerZTile+i <= 1 ||
|
||||
playerXTile+j >= mapWidth-2 ||
|
||||
|
@ -4608,18 +4623,6 @@ static void drawRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius)
|
|||
}
|
||||
}
|
||||
|
||||
void debugToggleSensorDisplay( void )
|
||||
{
|
||||
if(bSensorDisplay)
|
||||
{
|
||||
bSensorDisplay = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bSensorDisplay = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw some effects at certain position to visualize the radius,
|
||||
* negative radius turns this off
|
||||
*/
|
||||
|
|
|
@ -1334,13 +1334,12 @@ void kf_ToggleOverlays( void )
|
|||
|
||||
void kf_SensorDisplayOn( void )
|
||||
{
|
||||
// debugToggleSensorDisplay();
|
||||
startSensorDisplay();
|
||||
bDisplaySensorRange = TRUE;
|
||||
}
|
||||
|
||||
void kf_SensorDisplayOff( void )
|
||||
{
|
||||
stopSensorDisplay();
|
||||
bDisplaySensorRange = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -128,9 +128,9 @@ typedef struct _maptile
|
|||
UBYTE height; // The height at the top left of the tile
|
||||
UBYTE illumination; // How bright is this tile?
|
||||
UWORD texture; // Which graphics texture is on this tile
|
||||
UBYTE bMaxed;
|
||||
bool bMaxed;
|
||||
bool activeSensor; // selected player can see through fog of war here
|
||||
UBYTE level;
|
||||
UBYTE inRange; // sensor range display.
|
||||
BASE_OBJECT *psObject; // Any object sitting on the location (e.g. building)
|
||||
PIELIGHT colour;
|
||||
|
||||
|
|
|
@ -153,10 +153,6 @@ static BOOL rayTerrainCallback(SDWORD x, SDWORD y, SDWORD dist)
|
|||
currG = newG;
|
||||
|
||||
SET_TILE_VISIBLE(rayPlayer, psTile);
|
||||
if(rayPlayer == selectedPlayer && !bDisplaySensorRange)
|
||||
{
|
||||
psTile->inRange = UBYTE_MAX;
|
||||
}
|
||||
|
||||
if (selectedPlayer != rayPlayer && bMultiPlayer && game.alliance == ALLIANCES_TEAMS
|
||||
&& aiCheckAlliances(selectedPlayer, rayPlayer))
|
||||
|
@ -174,9 +170,9 @@ static BOOL rayTerrainCallback(SDWORD x, SDWORD y, SDWORD dist)
|
|||
{
|
||||
// can see opponent moving
|
||||
avInformOfChange(map_coord(x), map_coord(y)); //reveal map
|
||||
psTile->activeSensor = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -790,21 +786,18 @@ MAPTILE *psTile;
|
|||
}
|
||||
}
|
||||
|
||||
void startSensorDisplay(void)
|
||||
void updateSensorDisplay()
|
||||
{
|
||||
MAPTILE *psTile;
|
||||
UDWORD x;
|
||||
MAPTILE *psTile = psMapTiles;
|
||||
int x;
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStruct;
|
||||
// SDWORD range;
|
||||
// SDWORD ray;
|
||||
|
||||
// clear each sensor bit.
|
||||
psTile = psMapTiles;
|
||||
for(x=0; x<(SDWORD)(mapWidth*mapHeight); x+= 1)
|
||||
// clear sensor info
|
||||
for (x = 0; x < mapWidth * mapHeight; x++)
|
||||
{
|
||||
psTile->inRange = 0;
|
||||
psTile += 1;
|
||||
psTile->activeSensor = FALSE;
|
||||
psTile++;
|
||||
}
|
||||
|
||||
// process the sensor range of all droids/structs.
|
||||
|
@ -812,32 +805,16 @@ void startSensorDisplay(void)
|
|||
// units.
|
||||
for(psDroid = apsDroidLists[selectedPlayer];psDroid;psDroid=psDroid->psNext)
|
||||
{
|
||||
// range = psDroid->sensorRange;
|
||||
// for(ray=0; ray < NUM_RAYS; ray += NUM_RAYS/80)
|
||||
// {
|
||||
// startH = psDroid->z + visObjHeight((BASE_OBJECT*)psDroid);// initialise the callback variables //rayTerrainCallback
|
||||
// currG = -UBYTE_MAX * GRAD_MUL; // Cast the rays from the viewer
|
||||
visTilesUpdate((BASE_OBJECT*)psDroid);
|
||||
// rayCast(psDroid->x,psDroid->y,ray, range, rayTerrainCallback);
|
||||
// }
|
||||
|
||||
visTilesUpdate((BASE_OBJECT*)psDroid);
|
||||
}
|
||||
|
||||
// structs.
|
||||
for(psStruct = apsStructLists[selectedPlayer];psStruct;psStruct=psStruct->psNext)
|
||||
{
|
||||
if( psStruct->pStructureType->type != REF_WALL
|
||||
&& psStruct->pStructureType->type != REF_WALLCORNER)
|
||||
if (psStruct->pStructureType->type != REF_WALL
|
||||
&& psStruct->pStructureType->type != REF_WALLCORNER)
|
||||
{
|
||||
visTilesUpdate((BASE_OBJECT*)psStruct);
|
||||
}
|
||||
}
|
||||
|
||||
// set the display flag for the tiledraw er.
|
||||
bDisplaySensorRange = TRUE;
|
||||
}
|
||||
|
||||
void stopSensorDisplay(void)
|
||||
{
|
||||
// set the display flag off.
|
||||
bDisplaySensorRange = FALSE;
|
||||
}
|
||||
|
|
|
@ -60,14 +60,9 @@ extern void visUpdateLevel(void);
|
|||
|
||||
extern void setUnderTilesVis(BASE_OBJECT *psObj, UDWORD player);
|
||||
|
||||
|
||||
// sensorrangedisplay.
|
||||
// sensor range display
|
||||
extern BOOL bDisplaySensorRange;
|
||||
extern void stopSensorDisplay(void);
|
||||
extern void startSensorDisplay(void);
|
||||
|
||||
|
||||
|
||||
extern void updateSensorDisplay(void);
|
||||
|
||||
// fast test for whether obj2 is in range of obj1
|
||||
static inline BOOL visObjInRange(BASE_OBJECT *psObj1, BASE_OBJECT *psObj2, SDWORD range)
|
||||
|
|
Loading…
Reference in New Issue