fix: errors de renombrat de variables

This commit is contained in:
2025-10-29 11:56:34 +01:00
parent ead3265bfc
commit 95b82e5f62
6 changed files with 32 additions and 32 deletions

View File

@@ -870,21 +870,21 @@ auto Room::setEnemy(Enemy::Data* enemy, const std::string& key, const std::strin
} else if (key == "height") {
enemy->h = std::stoi(value);
} else if (key == "x") {
enemy->x = std::stof(value) * BLOCK;
enemy->x = std::stof(value) * TILE_SIZE;
} else if (key == "y") {
enemy->y = std::stof(value) * BLOCK;
enemy->y = std::stof(value) * TILE_SIZE;
} else if (key == "vx") {
enemy->vx = std::stof(value);
} else if (key == "vy") {
enemy->vy = std::stof(value);
} else if (key == "x1") {
enemy->x1 = std::stoi(value) * BLOCK;
enemy->x1 = std::stoi(value) * TILE_SIZE;
} else if (key == "x2") {
enemy->x2 = std::stoi(value) * BLOCK;
enemy->x2 = std::stoi(value) * TILE_SIZE;
} else if (key == "y1") {
enemy->y1 = std::stoi(value) * BLOCK;
enemy->y1 = std::stoi(value) * TILE_SIZE;
} else if (key == "y2") {
enemy->y2 = std::stoi(value) * BLOCK;
enemy->y2 = std::stoi(value) * TILE_SIZE;
} else if (key == "flip") {
enemy->flip = stringToBool(value);
} else if (key == "mirror") {
@@ -917,9 +917,9 @@ auto Room::setItem(Item::Data* item, const std::string& key, const std::string&
} else if (key == "counter") {
item->counter = std::stoi(value);
} else if (key == "x") {
item->x = std::stof(value) * BLOCK;
item->x = std::stof(value) * TILE_SIZE;
} else if (key == "y") {
item->y = std::stof(value) * BLOCK;
item->y = std::stof(value) * TILE_SIZE;
} else if (key == "tile") {
item->tile = std::stof(value);
} else if (key == "[/item]") {

View File

@@ -18,7 +18,7 @@ Scoreboard::Scoreboard(std::shared_ptr<ScoreboardData> data)
: item_surface_(Resource::get()->getSurface("items.gif")),
data_(std::move(std::move(data))) {
const float SURFACE_WIDTH = Options::game.width;
constexpr float SURFACE_HEIGHT = 6.0F * BLOCK;
constexpr float SURFACE_HEIGHT = 6.0F * TILE_SIZE;
// Reserva memoria para los objetos
auto player_texture = Resource::get()->getSurface(Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.gif" : "player.gif");
@@ -125,8 +125,8 @@ void Scoreboard::fillTexture() {
surface_->clear(stringToColor("black"));
// Anclas
constexpr int LINE1 = BLOCK;
constexpr int LINE2 = 3 * BLOCK;
constexpr int LINE1 = TILE_SIZE;
constexpr int LINE2 = 3 * TILE_SIZE;
// Dibuja las vidas
const int DESP = (counter_ / 40) % 8;
@@ -143,21 +143,21 @@ void Scoreboard::fillTexture() {
if (data_->music) {
const Uint8 C = data_->color;
SDL_FRect clip = {0, 8, 8, 8};
item_surface_->renderWithColorReplace(20 * BLOCK, LINE2, 1, C, &clip);
item_surface_->renderWithColorReplace(20 * TILE_SIZE, LINE2, 1, C, &clip);
}
// Escribe los textos
auto text = Resource::get()->getText("smb2");
const std::string TIME_TEXT = std::to_string((clock_.minutes % 100) / 10) + std::to_string(clock_.minutes % 10) + clock_.separator + std::to_string((clock_.seconds % 60) / 10) + std::to_string(clock_.seconds % 10);
const std::string ITEMS_TEXT = std::to_string(data_->items / 100) + std::to_string((data_->items % 100) / 10) + std::to_string(data_->items % 10);
text->writeColored(BLOCK, LINE1, "Items collected ", data_->color);
text->writeColored(17 * BLOCK, LINE1, ITEMS_TEXT, items_color_);
text->writeColored(20 * BLOCK, LINE1, " Time ", data_->color);
text->writeColored(26 * BLOCK, LINE1, TIME_TEXT, stringToColor("white"));
text->writeColored(TILE_SIZE, LINE1, "Items collected ", data_->color);
text->writeColored(17 * TILE_SIZE, LINE1, ITEMS_TEXT, items_color_);
text->writeColored(20 * TILE_SIZE, LINE1, " Time ", data_->color);
text->writeColored(26 * TILE_SIZE, LINE1, TIME_TEXT, stringToColor("white"));
const std::string ROOMS_TEXT = std::to_string(data_->rooms / 100) + std::to_string((data_->rooms % 100) / 10) + std::to_string(data_->rooms % 10);
text->writeColored(22 * BLOCK, LINE2, "Rooms", stringToColor("white"));
text->writeColored(28 * BLOCK, LINE2, ROOMS_TEXT, stringToColor("white"));
text->writeColored(22 * TILE_SIZE, LINE2, "Rooms", stringToColor("white"));
text->writeColored(28 * TILE_SIZE, LINE2, ROOMS_TEXT, stringToColor("white"));
// Deja el renderizador como estaba
Screen::get()->setRendererSurface(previuos_renderer);