Clean up MAPTILE definition, and slash 56 bits off each tile to save memory.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9618 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
7432b844b7
commit
53c3107fd1
21
src/map.c
21
src/map.c
|
@ -808,21 +808,24 @@ static BOOL hasRockiesDecal(UDWORD i, UDWORD j)
|
|||
static BOOL mapSetGroundTypes(void)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (i=0;i<mapWidth;i++)
|
||||
{
|
||||
for (j=0;j<mapHeight;j++)
|
||||
{
|
||||
mapTile(i,j)->ground = determineGroundType(i,j,tileset);
|
||||
mapTile(i,j)->decal = false;
|
||||
if (strcmp(tileset, "texpages/tertilesc1hw") == 0)
|
||||
MAPTILE *psTile = mapTile(i, j);
|
||||
|
||||
psTile->ground = determineGroundType(i,j,tileset);
|
||||
|
||||
if ((strcmp(tileset, "texpages/tertilesc1hw") == 0 && hasArizonaDecal(i, j))
|
||||
|| (strcmp(tileset, "texpages/tertilesc2hw") == 0 && hasUrbanDecal(i, j))
|
||||
|| (strcmp(tileset, "texpages/tertilesc3hw") == 0 && hasRockiesDecal(i, j)))
|
||||
{
|
||||
mapTile(i,j)->decal = hasArizonaDecal(i,j);
|
||||
} else if (strcmp(tileset, "texpages/tertilesc2hw") == 0)
|
||||
SET_TILE_DECAL(psTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
mapTile(i,j)->decal = hasUrbanDecal(i,j);
|
||||
} else if (strcmp(tileset, "texpages/tertilesc3hw") == 0)
|
||||
{
|
||||
mapTile(i,j)->decal = hasRockiesDecal(i,j);
|
||||
CLEAR_TILE_DECAL(psTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
26
src/map.h
26
src/map.h
|
@ -85,6 +85,7 @@ static inline unsigned short TileNumber_texture(unsigned short tilenumber)
|
|||
}
|
||||
|
||||
#define BITS_NOTBLOCKING 0x01 ///< Units can drive on this even if there is a structure or feature on it
|
||||
#define BITS_DECAL 0x02 ///< Does this tile has a decal? If so, the tile from "texture" is drawn on top of the terrain.
|
||||
#define BITS_FPATHBLOCK 0x10 ///< Bit set temporarily by find path to mark a blocking tile
|
||||
#define BITS_ON_FIRE 0x20 ///< Cache whether tile is burning
|
||||
#define BITS_GATEWAY 0x40 ///< Bit set to show a gateway on the tile
|
||||
|
@ -103,21 +104,18 @@ typedef struct _maptile
|
|||
uint8_t tileVisBits; // COMPRESSED - bit per player
|
||||
uint8_t tileExploredBits;
|
||||
uint8_t sensorBits; // bit per player, who can see tile with sensor
|
||||
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 watchers[MAX_PLAYERS]; // player sees through fog of war here with this many objects
|
||||
uint8_t height; // The height at the top left of the tile
|
||||
uint8_t illumination; // How bright is this tile?
|
||||
uint16_t texture; // Which graphics texture is on this tile
|
||||
uint8_t watchers[MAX_PLAYERS]; // player sees through fog of war here with this many objects
|
||||
float level;
|
||||
BASE_OBJECT *psObject; // Any object sitting on the location (e.g. building)
|
||||
PIELIGHT colour;
|
||||
short limitedContinent; /** For land or sea limited propulsion types */
|
||||
short hoverContinent; /** For hover type propulsions */
|
||||
|
||||
int ground; ///< The ground type used for the terrain renderer
|
||||
BOOL decal; ///< Does this tile has a decal? If so, the tile from "texture" is drawn on top of the terrain.
|
||||
float height_new; // FIXME: replace height with a float and remove this one
|
||||
float waterLevel; ///< At what height is the water for this tile
|
||||
// TYPE_OF_TERRAIN type; // The terrain type for the tile
|
||||
uint16_t limitedContinent; ///< For land or sea limited propulsion types
|
||||
uint16_t hoverContinent; ///< For hover type propulsions
|
||||
uint8_t ground; ///< The ground type used for the terrain renderer
|
||||
float height_new; // FIXME: replace height with a float and remove this one
|
||||
float waterLevel; ///< At what height is the water for this tile
|
||||
} MAPTILE;
|
||||
|
||||
|
||||
|
@ -192,6 +190,10 @@ static inline bool TileHasSmallStructure(const MAPTILE* tile)
|
|||
#define SET_TILE_NOTBLOCKING(x) ((x)->tileInfoBits |= BITS_NOTBLOCKING)
|
||||
#define CLEAR_TILE_NOTBLOCKING(x) ((x)->tileInfoBits &= ~BITS_NOTBLOCKING)
|
||||
|
||||
#define SET_TILE_DECAL(x) ((x)->tileInfoBits |= BITS_DECAL)
|
||||
#define CLEAR_TILE_DECAL(x) ((x)->tileInfoBits &= ~BITS_DECAL)
|
||||
#define TILE_HAS_DECAL(x) ((x)->tileInfoBits & BITS_DECAL)
|
||||
|
||||
#define SET_TILE_HIGHLIGHT(x) ((x)->texture |= TILE_HILIGHT)
|
||||
#define CLEAR_TILE_HIGHLIGHT(x) ((x)->texture &= ~TILE_HILIGHT)
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ static void setSectorDecals(int x, int y,
|
|||
{
|
||||
continue;
|
||||
}
|
||||
if (mapTile(i,j)->decal)
|
||||
if (TILE_HAS_DECAL(mapTile(i, j)))
|
||||
{
|
||||
getTileTexCoords(*uv, mapTile(i,j)->texture);
|
||||
averageUV(¢er, *uv);
|
||||
|
|
Loading…
Reference in New Issue