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

@@ -180,7 +180,7 @@ void Player::checkState(float delta_time) {
void Player::switchBorders() {
switch (border_) {
case Room::Border::TOP:
y_ = PLAY_AREA_BOTTOM - HEIGHT - BLOCK;
y_ = PLAY_AREA_BOTTOM - HEIGHT - TILE_SIZE;
setState(State::STANDING);
break;

View File

@@ -84,7 +84,7 @@ class Player {
// --- Constantes ---
static constexpr int WIDTH = 8; // Ancho del jugador
static constexpr int HEIGHT = 16; // ALto del jugador
static constexpr int MAX_FALLING_HEIGHT = BLOCK * 4; // Altura maxima permitida de caída en pixels
static constexpr int MAX_FALLING_HEIGHT = TILE_SIZE * 4; // Altura maxima permitida de caída en pixels
// --- Constantes de física (per-second values) ---
static constexpr float HORIZONTAL_VELOCITY = 40.0F; // Velocidad horizontal en pixels/segundo (0.6 * 66.67fps)

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);

View File

@@ -24,7 +24,7 @@
#include "game/options.hpp" // Para Options, options, Cheat, SectionState
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO...
#include "utils/defines.hpp" // Para BLOCK, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
#include "utils/defines.hpp" // Para TILE_SIZE, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
// Constructor
@@ -36,10 +36,10 @@ Game::Game(Mode mode)
mode_(mode),
#ifdef _DEBUG
current_room_("03.room"),
spawn_data_(Player::SpawnData(25 * BLOCK, 13 * BLOCK, 0, 0, 0, Player::State::STANDING, SDL_FLIP_HORIZONTAL))
spawn_data_(Player::SpawnData(25 * TILE_SIZE, 13 * TILE_SIZE, 0, 0, 0, Player::State::STANDING, SDL_FLIP_HORIZONTAL))
#else
current_room_("03.room"),
spawn_point_(PlayerSpawn(25 * BLOCK, 13 * BLOCK, 0, 0, 0, PlayerState::STANDING, SDL_FLIP_HORIZONTAL))
spawn_data_(Player::SpawnData(25 * TILE_SIZE, 13 * TILE_SIZE, 0, 0, 0, Player::State::STANDING, SDL_FLIP_HORIZONTAL))
#endif
{
#ifdef _DEBUG
@@ -192,7 +192,7 @@ void Game::renderDebugInfo() {
auto surface = Screen::get()->getRendererSurface();
// Borra el marcador
SDL_FRect rect = {0, 18 * BLOCK, PLAY_AREA_WIDTH, GAMECANVAS_HEIGHT - PLAY_AREA_HEIGHT};
SDL_FRect rect = {0, 18 * TILE_SIZE, PLAY_AREA_WIDTH, GAMECANVAS_HEIGHT - PLAY_AREA_HEIGHT};
surface->fillRect(&rect, static_cast<Uint8>(PaletteColor::BLACK));
// Pinta la rejilla

View File

@@ -15,18 +15,18 @@ constexpr const char* VERSION = "1.10";
constexpr Uint32 GAME_SPEED = 15;
// Tamaño de bloque
constexpr int BLOCK = 8;
constexpr int HALF_BLOCK = 4;
constexpr int TILE_SIZE = 8;
constexpr int HALF_TILE = TILE_SIZE / 2;
// Tamaño de la pantalla virtual
constexpr int GAMECANVAS_WIDTH = 256;
constexpr int GAMECANVAS_HEIGHT = 192;
// Zona de juego
constexpr int PLAY_AREA_TOP = (0 * BLOCK);
constexpr int PLAY_AREA_BOTTOM = (16 * BLOCK);
constexpr int PLAY_AREA_LEFT = (0 * BLOCK);
constexpr int PLAY_AREA_RIGHT = (32 * BLOCK);
constexpr int PLAY_AREA_TOP = (0 * TILE_SIZE);
constexpr int PLAY_AREA_BOTTOM = (16 * TILE_SIZE);
constexpr int PLAY_AREA_LEFT = (0 * TILE_SIZE);
constexpr int PLAY_AREA_RIGHT = (32 * TILE_SIZE);
constexpr int PLAY_AREA_WIDTH = PLAY_AREA_RIGHT - PLAY_AREA_LEFT;
constexpr int PLAY_AREA_HEIGHT = PLAY_AREA_BOTTOM - PLAY_AREA_TOP;
constexpr int PLAY_AREA_CENTER_X = PLAY_AREA_LEFT + (PLAY_AREA_WIDTH / 2);