Añadidos mas ifdef DEBUG para quitar código sobrante de la versión final

This commit is contained in:
2022-11-16 20:24:49 +01:00
parent eed3f9d7d1
commit c6a1f4aab0
6 changed files with 91 additions and 79 deletions

View File

@@ -554,6 +554,7 @@ void Room::fillMapTexture()
clip.y = (tileMap.at(index) / tileSetWidth) * tileSize;
texture->render(renderer, x * tileSize, y * tileSize, &clip);
#ifdef DEBUG
// ****
if (debug->getEnabled())
{
@@ -565,10 +566,12 @@ void Room::fillMapTexture()
SDL_RenderFillRect(renderer, &clip);
}
}
// ****
// ****
#endif
}
}
#ifdef DEBUG
// ****
if (debug->getEnabled())
{
@@ -649,6 +652,7 @@ void Room::fillMapTexture()
}
}
// ****
#endif
SDL_SetRenderTarget(renderer, nullptr);
}
@@ -659,11 +663,15 @@ void Room::renderMap()
// Dibuja la textura con el mapa en pantalla
SDL_RenderCopy(renderer, mapTexture, nullptr, nullptr);
// Dibuja los tiles animados
// Dibuja los tiles animados
#ifdef DEBUG
if (!debug->getEnabled())
{
renderAnimatedTiles();
}
#else
renderAnimatedTiles();
#endif
}
// Dibuja los enemigos en pantalla
@@ -882,22 +890,30 @@ int Room::getSlopeHeight(SDL_Point p, tile_e slope)
{
// Calcula la base del tile
int base = ((p.y / tileSize) * tileSize) + tileSize;
#ifdef DEBUG
debug->add("BASE = " + std::to_string(base));
#endif
// Calcula cuanto se ha entrado en el tile horizontalmente
const int pos = (p.x % tileSize); // Esto da un valor entre 0 y 7
#ifdef DEBUG
debug->add("POS = " + std::to_string(pos));
#endif
// Se resta a la base la cantidad de pixeles pos en funcion de la rampa
if (slope == t_slope_r)
{
base -= pos + 1;
#ifdef DEBUG
debug->add("BASE_R = " + std::to_string(base));
#endif
}
else
{
base -= (tileSize - pos);
#ifdef DEBUG
debug->add("BASE_L = " + std::to_string(base));
#endif
}
return base;