I've made a little experiment, and came up with this:
for(int x3=0; x3 < layer_width; ++x3)
{
for(int y3=0; y3 < layer_height; ++y3)
{
if(Layer2->GetTileId(x3, y3) != 0 && Layer2->GetTileId(x3, y3) != 29)
{
int currentTile3 = Layer2->GetTileId(x3, y3);
int tx3 = currentTile3 % horizontalTiles;
int ty3 = currentTile3 / horizontalTiles;
Array2.append(sf::Vertex(sf::Vector2f((x3 + 0) * tile_x, (y3 + 0) * tile_y), sf::Vector2f((tx3 + 0) * tile_x, (ty3 + 0) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 0) * tile_x, (y3 + 1) * tile_y), sf::Vector2f((tx3 + 0) * tile_x, (ty3 + 1) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 1) * tile_x, (y3 + 1) * tile_y), sf::Vector2f((tx3 + 1) * tile_x, (ty3 + 1) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 1) * tile_x, (y3 + 0) * tile_y), sf::Vector2f((tx3 + 1) * tile_x, (ty3 + 0) * tile_y)));
}
else if (Layer2->GetTileId(x3, y3) == 29)
{
int currentTile4 = currentFrame;
int tx3 = currentTile4 % horizontalTiles;
int ty3 = currentTile4 / horizontalTiles;
Array2.append(sf::Vertex(sf::Vector2f((x3 + 0) * tile_x, (y3 + 0) * tile_y), sf::Vector2f((tx3 + 0) * tile_x, (ty3 + 0) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 0) * tile_x, (y3 + 1) * tile_y), sf::Vector2f((tx3 + 0) * tile_x, (ty3 + 1) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 1) * tile_x, (y3 + 1) * tile_y), sf::Vector2f((tx3 + 1) * tile_x, (ty3 + 1) * tile_y)));
Array2.append(sf::Vertex(sf::Vector2f((x3 + 1) * tile_x, (y3 + 0) * tile_y), sf::Vector2f((tx3 + 1) * tile_x, (ty3 + 0) * tile_y)));
}
}
}
(Just like last time, GetTileId(X, Y) returns the ID of the tile at position XY, Layer2 is the tile layer that is being parsed, and Array2 is sf::VertexArray Array2(sf::Quads).)
It kinda works, if the tile ID is zero or 29 , the quad is not being created. But at the next step, if the tile ID is 29, the quads are being created after the base layout has been parsed. Then, I can manipulate currentTile4 to change the texture coordinates. But I'm a bit concerned: won't this mess up the vertex array? (It's hard to examine how these quads look like withouth having a wireframe/point rendering mode, and my computer is fast enought to not to lag when something's wrong while rendering this few polygons.)