This commit is contained in:
parent
5e3ed8913f
commit
9a7a162642
3 changed files with 97 additions and 22 deletions
|
@ -129,11 +129,24 @@ global void MapFixSeenRockTile(int x, int y)
|
|||
tile = TheMap.Tileset->RockTable[tile];
|
||||
}
|
||||
|
||||
//Test if we have top rock, or bottom rock, they are special
|
||||
if ((ttdown & 0x10) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1)* 1;
|
||||
tile |= ((ttright & 0x09) && 1) * 2;
|
||||
}
|
||||
|
||||
if ((ttup & 0x20) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1) * 8;
|
||||
tile |= ((ttright & 0x09) && 1) * 4;
|
||||
}
|
||||
|
||||
mf = TheMap.Fields + x + y * TheMap.Width;
|
||||
if (tile == -1) { // No valid rock remove it.
|
||||
mf->SeenTile = TheMap.Tileset->RemovedRock;
|
||||
MapFixSeenRockNeighbors(x, y);
|
||||
} else if (mf->SeenTile == tile) {
|
||||
} else if (TheMap.Tileset->MixedLookupTable[mf->SeenTile] ==
|
||||
TheMap.Tileset->MixedLookupTable[tile]) {
|
||||
//Tiles are the same edge
|
||||
return;
|
||||
} else {
|
||||
mf->SeenTile = tile;
|
||||
|
@ -163,6 +176,28 @@ global void MapFixSeenRockNeighbors(int x, int y)
|
|||
MapFixSeenRockTile(x - 1, y);
|
||||
MapFixSeenRockTile(x, y + 1);
|
||||
MapFixSeenRockTile(x, y - 1);
|
||||
MapFixSeenRockTile(x + 1, y + 1); // side neighbors
|
||||
MapFixSeenRockTile(x - 1, y + 1);
|
||||
MapFixSeenRockTile(x - 1, y - 1);
|
||||
MapFixSeenRockTile(x + 1, y - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding real rock fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
local void MapFixRockNeighbors(int x, int y)
|
||||
{
|
||||
MapFixRockTile(x + 1, y); // side neighbors
|
||||
MapFixRockTile(x - 1, y);
|
||||
MapFixRockTile(x, y + 1);
|
||||
MapFixRockTile(x, y - 1);
|
||||
MapFixRockTile(x + 1, y + 1); // diagonal neighbors
|
||||
MapFixRockTile(x - 1, y + 1);
|
||||
MapFixRockTile(x - 1, y - 1);
|
||||
MapFixRockTile(x + 1, y - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,6 +251,17 @@ global void MapFixRockTile(int x, int y)
|
|||
tile += ((ttright & 0x01) && (ttdown & 0x04)) * 2;
|
||||
tile += ((ttleft & 0x02) && (ttdown & 0x08)) * 1;
|
||||
|
||||
//Test if we have top rock, or bottom rock, they are special
|
||||
if ((ttdown & 0x10) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1)* 1;
|
||||
tile |= ((ttright & 0x09) && 1) * 2;
|
||||
}
|
||||
|
||||
if ((ttup & 0x20) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1) * 8;
|
||||
tile |= ((ttright & 0x09) && 1) * 4;
|
||||
}
|
||||
|
||||
|
||||
tile = TheMap.Tileset->RockTable[tile];
|
||||
//If tile is -1, then we should check if we are to draw just one tree
|
||||
|
@ -229,7 +275,9 @@ global void MapFixRockTile(int x, int y)
|
|||
|
||||
if (tile == -1) { // No valid rock remove it.
|
||||
MapRemoveRock(x, y);
|
||||
} else if (mf->Tile != tile) {
|
||||
MapFixRockNeighbors(x, y);
|
||||
} else if (TheMap.Tileset->MixedLookupTable[mf->Tile] !=
|
||||
TheMap.Tileset->MixedLookupTable[tile]) {
|
||||
mf->Tile = tile;
|
||||
UpdateMinimapXY(x, y);
|
||||
#ifdef NEW_FOW
|
||||
|
@ -245,20 +293,6 @@ global void MapFixRockTile(int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Correct the surrounding real rock fields.
|
||||
**
|
||||
** @param x Map X tile-position.
|
||||
** @param y Map Y tile-position.
|
||||
*/
|
||||
local void MapFixRockNeighbors(int x, int y)
|
||||
{
|
||||
MapFixRockTile(x + 1, y); // side neighbors
|
||||
MapFixRockTile(x - 1, y);
|
||||
MapFixRockTile(x, y + 1);
|
||||
MapFixRockTile(x, y - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
** Remove rock from the map.
|
||||
**
|
||||
|
|
|
@ -119,7 +119,17 @@ global void MapFixSeenWoodTile(int x, int y)
|
|||
tile += ((ttright & 0x01) && (ttdown & 0x04)) * 2;
|
||||
tile += ((ttleft & 0x02) && (ttdown & 0x08)) * 1;
|
||||
|
||||
|
||||
//Test if we have top tree, or bottom tree, they are special
|
||||
if ((ttdown & 0x10) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1)* 1;
|
||||
tile |= ((ttright & 0x09) && 1) * 2;
|
||||
}
|
||||
|
||||
if ((ttup & 0x20) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1) * 8;
|
||||
tile |= ((ttright & 0x09) && 1) * 4;
|
||||
}
|
||||
|
||||
tile = TheMap.Tileset->WoodTable[tile];
|
||||
//If tile is -1, then we should check if we are to draw just one tree
|
||||
//Check for tile about, or below or both...
|
||||
|
@ -135,7 +145,8 @@ global void MapFixSeenWoodTile(int x, int y)
|
|||
if (tile == -1) { // No valid wood remove it.
|
||||
mf->SeenTile = TheMap.Tileset->RemovedTree;
|
||||
MapFixSeenWoodNeighbors(x, y);
|
||||
} else if( mf->SeenTile==tile ) { // Already there!
|
||||
} else if( TheMap.Tileset->MixedLookupTable[mf->SeenTile]==
|
||||
TheMap.Tileset->MixedLookupTable[tile] ) { //Same Type
|
||||
return;
|
||||
} else {
|
||||
mf->SeenTile = tile;
|
||||
|
@ -165,6 +176,10 @@ global void MapFixSeenWoodNeighbors(int x, int y)
|
|||
MapFixSeenWoodTile(x - 1, y);
|
||||
MapFixSeenWoodTile(x, y + 1);
|
||||
MapFixSeenWoodTile(x, y - 1);
|
||||
MapFixSeenWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixSeenWoodTile(x - 1, y - 1);
|
||||
MapFixSeenWoodTile(x - 1, y + 1);
|
||||
MapFixSeenWoodTile(x + 1, y + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,6 +194,10 @@ local void MapFixWoodNeighbors(int x, int y)
|
|||
MapFixWoodTile(x - 1, y);
|
||||
MapFixWoodTile(x, y + 1);
|
||||
MapFixWoodTile(x, y - 1);
|
||||
MapFixWoodTile(x + 1, y - 1); // side neighbors
|
||||
MapFixWoodTile(x - 1, y - 1);
|
||||
MapFixWoodTile(x - 1, y + 1);
|
||||
MapFixWoodTile(x + 1, y + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,7 +251,16 @@ global void MapFixWoodTile(int x, int y)
|
|||
tile += ((ttright & 0x01) && (ttdown & 0x04)) * 2;
|
||||
tile += ((ttleft & 0x02) && (ttdown & 0x08)) * 1;
|
||||
|
||||
|
||||
if ((ttdown & 0x10) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1)* 1;
|
||||
tile |= ((ttright & 0x09) && 1) * 2;
|
||||
}
|
||||
|
||||
if ((ttup & 0x20) && 1) {
|
||||
tile |= ((ttleft & 0x06) && 1) * 8;
|
||||
tile |= ((ttright & 0x09) && 1) * 4;
|
||||
}
|
||||
|
||||
tile = TheMap.Tileset->WoodTable[tile];
|
||||
//If tile is -1, then we should check if we are to draw just one tree
|
||||
//Check for tile about, or below or both...
|
||||
|
@ -245,10 +273,11 @@ global void MapFixWoodTile(int x, int y)
|
|||
|
||||
if (tile == -1) { // No valid wood remove it.
|
||||
MapRemoveWood(x, y);
|
||||
} else if (mf->Tile != tile) {
|
||||
} else if (TheMap.Tileset->MixedLookupTable[mf->Tile] !=
|
||||
TheMap.Tileset->MixedLookupTable[tile]) {
|
||||
mf->Tile = tile;
|
||||
UpdateMinimapXY(x, y);
|
||||
MapFixWoodNeighbors(x, y);
|
||||
//MapFixWoodNeighbors(x, y);
|
||||
#ifdef NEW_FOW
|
||||
if (mf->Visible[ThisPlayer->Player]>1) {
|
||||
#else
|
||||
|
|
|
@ -292,11 +292,13 @@ global void LoadTileset(void)
|
|||
TheMap.Tileset->WoodTable[19] = TheMap.Tileset->MidOneTree;
|
||||
|
||||
//Mark which corners of each tile has tree in it.
|
||||
//All corners for solid tiles.
|
||||
//All corners for solid tiles. (Same for rocks)
|
||||
//1 Bottom Left
|
||||
//2 Bottom Right
|
||||
//4 Top Right
|
||||
//8 Top Left
|
||||
//16 Bottom Tree Tile
|
||||
//32 Top Tree Tile
|
||||
for (i = solid; i < solid + 16; i++ ) {
|
||||
TheMap.Tileset->MixedLookupTable[table[i]] = 15;
|
||||
}
|
||||
|
@ -335,6 +337,12 @@ global void LoadTileset(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
//16 Bottom Tree Special
|
||||
//32 Top Tree Special
|
||||
//64 Mid tree special - differentiate with mixed tiles.
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->BotOneTree]=12+16;
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->TopOneTree]=3+32;
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->MidOneTree]=15+48;
|
||||
|
||||
//
|
||||
// Build rock removement table.
|
||||
|
@ -402,6 +410,10 @@ global void LoadTileset(void)
|
|||
}
|
||||
}
|
||||
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->BotOneRock]=12+16;
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->TopOneRock]=3+32;
|
||||
TheMap.Tileset->MixedLookupTable[TheMap.Tileset->MidOneRock]=15+48;
|
||||
|
||||
TheMap.Tileset->RockTable[ 0] = -1;
|
||||
TheMap.Tileset->RockTable[ 1] = table[mixed + 0x30];
|
||||
TheMap.Tileset->RockTable[ 2] = table[mixed + 0x70];
|
||||
|
|
Loading…
Add table
Reference in a new issue