Old map conversion fix 1: water fix, water no longer climbs cliffs.

master
haonoq 2012-08-09 13:15:04 +04:00 committed by Per Inge Mathisen
parent 014cc2c666
commit 8e83aee47e
4 changed files with 8 additions and 14 deletions

View File

@ -83,7 +83,7 @@ bool bridgeValid(int startX, int startY, int endX, int endY)
{
for (i = minY + 1; i < maxY - 1; i++)
{
if (mapTile(startX, i)->ground != waterGroundType)
if (terrainType(mapTile(startX, i)) != TER_WATER)
{
debug(LOG_ERROR, "Bridge cannot cross !water - X");
return false;
@ -94,7 +94,7 @@ bool bridgeValid(int startX, int startY, int endX, int endY)
{
for (i = minX + 1; i < maxX - 1; i++)
{
if (mapTile(i, startY)->ground != waterGroundType)
if (terrainType(mapTile(i, startY)) != TER_WATER)
{
debug(LOG_ERROR, "Bridge cannot cross !water - Y");
return false;

View File

@ -118,7 +118,6 @@ static void init_tileNames(int type);
/// The different ground types
GROUND_TYPE *psGroundTypes;
int numGroundTypes;
int waterGroundType;
int cliffGroundType;
char *tileset = NULL;
static int numTile_names;
@ -356,7 +355,6 @@ fallback:
psGroundTypes[getTextureType(textureType)].textureSize = textureSize ;
}
waterGroundType = getTextureType("a_water");
cliffGroundType = getTextureType("a_cliff");
SetGroundForTile("tileset/arizonaground.txt", "arizona_ground");
@ -398,7 +396,6 @@ fallback:
psGroundTypes[getTextureType(textureType)].textureSize = textureSize;
}
waterGroundType = getTextureType("u_water");
cliffGroundType = getTextureType("u_cliff");
SetGroundForTile("tileset/urbanground.txt", "urban_ground");
@ -440,7 +437,6 @@ fallback:
psGroundTypes[getTextureType(textureType)].textureSize = textureSize;
}
waterGroundType = getTextureType("r_water");
cliffGroundType = getTextureType("r_cliff");
SetGroundForTile("tileset/rockieground.txt", "rockie_ground");
@ -881,7 +877,7 @@ bool mapLoad(char *filename, bool preview)
// FIXME: magic number
mapTile(i, j)->waterLevel = mapTile(i, j)->height - world_coord(1) / 3;
// lower riverbed
if (mapTile(i, j)->ground == waterGroundType)
if (terrainType(mapTile(i, j)) == TER_WATER && terrainType(mapTile(i-1, j)) == TER_WATER && terrainType(mapTile(i, j-1)) == TER_WATER && terrainType(mapTile(i-1, j-1)) == TER_WATER)
{
mapTile(i, j)->height -= WATER_MIN_DEPTH - mt.u32()%(WATER_MAX_DEPTH + 1 - WATER_MIN_DEPTH);
}
@ -994,7 +990,7 @@ bool mapSave(char **ppFileData, UDWORD *pFileSize)
for (int i = 0; i < mapWidth*mapHeight; i++)
{
psTileData->texture = psTile->texture;
if (psTile->ground == waterGroundType)
if (terrainType(psTile) == TER_WATER)
{
psTileData->height = (psTile->waterLevel + world_coord(1) / 3) / ELEVATION_SCALE;
}

View File

@ -118,7 +118,6 @@ extern MAPTILE *psMapTiles;
extern float waterLevel;
extern GROUND_TYPE *psGroundTypes;
extern int numGroundTypes;
extern int waterGroundType;
extern int cliffGroundType;
extern char *tileset;
@ -346,7 +345,6 @@ extern MAPTILE *psMapTiles;
extern GROUND_TYPE *psGroundTypes;
extern int numGroundTypes;
extern int waterGroundType;
extern int cliffGroundType;
extern char *tileset;

View File

@ -338,10 +338,10 @@ static void averagePos(Vector3i *center, Vector3i *a, Vector3i *b, Vector3i *c,
static bool isWater(int x, int y)
{
bool result = false;
result = result || (tileOnMap(x ,y ) && mapTile(x ,y )->ground == waterGroundType);
result = result || (tileOnMap(x+1,y ) && mapTile(x+1,y )->ground == waterGroundType);
result = result || (tileOnMap(x ,y+1) && mapTile(x ,y+1)->ground == waterGroundType);
result = result || (tileOnMap(x+1,y+1) && mapTile(x+1,y+1)->ground == waterGroundType);
result = result || (tileOnMap(x ,y ) && terrainType(mapTile(x ,y )) == TER_WATER);
result = result || (tileOnMap(x-1,y ) && terrainType(mapTile(x-1,y )) == TER_WATER);
result = result || (tileOnMap(x ,y-1) && terrainType(mapTile(x ,y-1)) == TER_WATER);
result = result || (tileOnMap(x-1,y-1) && terrainType(mapTile(x-1,y-1)) == TER_WATER);
return result;
}