Trabajando en la recarga de recursos
This commit is contained in:
@@ -402,7 +402,7 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o
|
||||
autoSurfaceDirection = room->autoSurfaceDirection;
|
||||
textureA = room->textureA;
|
||||
textureB = room->textureB;
|
||||
tileMap = room->tileMap;
|
||||
tileMap = *room->tileMap;
|
||||
texture = (options->palette == p_zxspectrum) ? textureA : textureB;
|
||||
this->jailEnabled = jailEnabled;
|
||||
|
||||
@@ -533,13 +533,13 @@ void Room::fillMapTexture()
|
||||
// Al cargar el mapa en memoria, se resta uno, por tanto los tiles vacios son -1
|
||||
// Tampoco hay que dibujar los tiles animados que estan en la fila 19 (indices)
|
||||
const int index = (y * mapWidth) + x;
|
||||
const bool a = (tileMap->at(index) >= 18 * tileSetWidth) && (tileMap->at(index) < 19 * tileSetWidth);
|
||||
const bool b = tileMap->at(index) > -1;
|
||||
const bool a = (tileMap.at(index) >= 18 * tileSetWidth) && (tileMap.at(index) < 19 * tileSetWidth);
|
||||
const bool b = tileMap.at(index) > -1;
|
||||
|
||||
if (b && !a)
|
||||
{
|
||||
clip.x = (tileMap->at(index) % tileSetWidth) * tileSize;
|
||||
clip.y = (tileMap->at(index) / tileSetWidth) * tileSize;
|
||||
clip.x = (tileMap.at(index) % tileSetWidth) * tileSize;
|
||||
clip.y = (tileMap.at(index) / tileSetWidth) * tileSize;
|
||||
texture->render(renderer, x * tileSize, y * tileSize, &clip);
|
||||
|
||||
// ****
|
||||
@@ -739,37 +739,37 @@ tile_e Room::getTile(int index)
|
||||
if (index < maxTile)
|
||||
{
|
||||
// Las filas 0-8 son de tiles t_wall
|
||||
if ((tileMap->at(index) >= 0) && (tileMap->at(index) < 9 * tileSetWidth))
|
||||
if ((tileMap.at(index) >= 0) && (tileMap.at(index) < 9 * tileSetWidth))
|
||||
{
|
||||
return t_wall;
|
||||
}
|
||||
|
||||
// Las filas 9-17 son de tiles t_passable
|
||||
else if ((tileMap->at(index) >= 9 * tileSetWidth) && (tileMap->at(index) < 18 * tileSetWidth))
|
||||
else if ((tileMap.at(index) >= 9 * tileSetWidth) && (tileMap.at(index) < 18 * tileSetWidth))
|
||||
{
|
||||
return t_passable;
|
||||
}
|
||||
|
||||
// Las filas 18-20 es de tiles t_animated
|
||||
else if ((tileMap->at(index) >= 18 * tileSetWidth) && (tileMap->at(index) < 21 * tileSetWidth))
|
||||
else if ((tileMap.at(index) >= 18 * tileSetWidth) && (tileMap.at(index) < 21 * tileSetWidth))
|
||||
{
|
||||
return t_animated;
|
||||
}
|
||||
|
||||
// La fila 21 es de tiles t_slope_r
|
||||
else if ((tileMap->at(index) >= 21 * tileSetWidth) && (tileMap->at(index) < 22 * tileSetWidth))
|
||||
else if ((tileMap.at(index) >= 21 * tileSetWidth) && (tileMap.at(index) < 22 * tileSetWidth))
|
||||
{
|
||||
return t_slope_r;
|
||||
}
|
||||
|
||||
// La fila 22 es de tiles t_slope_l
|
||||
else if ((tileMap->at(index) >= 22 * tileSetWidth) && (tileMap->at(index) < 23 * tileSetWidth))
|
||||
else if ((tileMap.at(index) >= 22 * tileSetWidth) && (tileMap.at(index) < 23 * tileSetWidth))
|
||||
{
|
||||
return t_slope_l;
|
||||
}
|
||||
|
||||
// La fila 23 es de tiles t_kill
|
||||
else if ((tileMap->at(index) >= 23 * tileSetWidth) && (tileMap->at(index) < 24 * tileSetWidth))
|
||||
else if ((tileMap.at(index) >= 23 * tileSetWidth) && (tileMap.at(index) < 24 * tileSetWidth))
|
||||
{
|
||||
return t_kill;
|
||||
}
|
||||
@@ -897,7 +897,7 @@ void Room::setBottomSurfaces()
|
||||
|
||||
// Busca todos los tiles de tipo muro que no tengan debajo otro muro
|
||||
// Hay que recorrer la habitación por filas (excepto los de la última fila)
|
||||
for (int i = 0; i < (int)tileMap->size() - mapWidth; ++i)
|
||||
for (int i = 0; i < (int)tileMap.size() - mapWidth; ++i)
|
||||
{
|
||||
if (getTile(i) == t_wall && getTile(i + mapWidth) != t_wall)
|
||||
{
|
||||
@@ -960,7 +960,7 @@ void Room::setTopSurfaces()
|
||||
|
||||
// Busca todos los tiles de tipo muro o pasable que no tengan encima un muro
|
||||
// Hay que recorrer la habitación por filas (excepto los de la primera fila)
|
||||
for (int i = mapWidth; i < (int)tileMap->size(); ++i)
|
||||
for (int i = mapWidth; i < (int)tileMap.size(); ++i)
|
||||
{
|
||||
if ((getTile(i) == t_wall || getTile(i) == t_passable) && getTile(i - mapWidth) != t_wall)
|
||||
{
|
||||
@@ -1117,7 +1117,7 @@ void Room::setLeftSlopes()
|
||||
{
|
||||
// Recorre la habitación entera por filas buscando tiles de tipo t_slope_l
|
||||
std::vector<int> found;
|
||||
for (int i = 0; i < (int)tileMap->size(); ++i)
|
||||
for (int i = 0; i < (int)tileMap.size(); ++i)
|
||||
{
|
||||
if (getTile(i) == t_slope_l)
|
||||
{
|
||||
@@ -1158,7 +1158,7 @@ void Room::setRightSlopes()
|
||||
{
|
||||
// Recorre la habitación entera por filas buscando tiles de tipo t_slope_r
|
||||
std::vector<int> found;
|
||||
for (int i = 0; i < (int)tileMap->size(); ++i)
|
||||
for (int i = 0; i < (int)tileMap.size(); ++i)
|
||||
{
|
||||
if (getTile(i) == t_slope_r)
|
||||
{
|
||||
@@ -1201,7 +1201,7 @@ void Room::setAutoSurfaces()
|
||||
|
||||
// Busca todos los tiles de tipo animado
|
||||
// Hay que recorrer la habitación por filas (excepto los de la primera fila)
|
||||
for (int i = mapWidth; i < (int)tileMap->size(); ++i)
|
||||
for (int i = mapWidth; i < (int)tileMap.size(); ++i)
|
||||
{
|
||||
if (getTile(i) == t_animated)
|
||||
{
|
||||
@@ -1258,7 +1258,7 @@ void Room::setAutoSurfaces()
|
||||
void Room::setAnimatedTiles()
|
||||
{
|
||||
// Recorre la habitación entera por filas buscando tiles de tipo t_animated
|
||||
for (int i = 0; i < (int)tileMap->size(); ++i)
|
||||
for (int i = 0; i < (int)tileMap.size(); ++i)
|
||||
{
|
||||
if (getTile(i) == t_animated)
|
||||
{
|
||||
@@ -1266,9 +1266,9 @@ void Room::setAnimatedTiles()
|
||||
const int x = (i % mapWidth) * tileSize;
|
||||
const int y = (i / mapWidth) * tileSize;
|
||||
|
||||
// TileMap->at(i) es el tile a poner
|
||||
const int xc = (tileMap->at(i) % tileSetWidth) * tileSize;
|
||||
const int yc = (tileMap->at(i) / tileSetWidth) * tileSize;
|
||||
// TileMap.at(i) es el tile a poner
|
||||
const int xc = (tileMap.at(i) % tileSetWidth) * tileSize;
|
||||
const int yc = (tileMap.at(i) / tileSetWidth) * tileSize;
|
||||
|
||||
aTile_t at;
|
||||
at.sprite = new Sprite(x, y, 8, 8, texture, renderer);
|
||||
@@ -1499,7 +1499,7 @@ void Room::openTheJail()
|
||||
// Abre las puertas
|
||||
const int tileA = 16 + (13 * 32);
|
||||
const int tileB = 16 + (14 * 32);
|
||||
tileMap->at(tileA) = -1;
|
||||
tileMap->at(tileB) = -1;
|
||||
tileMap.at(tileA) = -1;
|
||||
tileMap.at(tileB) = -1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user