Arreglos en la estructura i format del codi

This commit is contained in:
2025-03-01 17:01:50 +01:00
parent 3562b139c3
commit 31cded15cc
35 changed files with 496 additions and 755 deletions

View File

@@ -24,10 +24,10 @@ Demo::Demo()
resource_(Resource::get()),
asset_(Asset::get()),
input_(Input::get()),
debug_(Debug::get())
debug_(Debug::get()),
board_(std::make_shared<ScoreboardData>())
{
// Inicia algunas variables
board_ = std::make_shared<ScoreboardData>();
board_->ini_clock = SDL_GetTicks();
rooms_.push_back("04.room");
rooms_.push_back("54.room");
@@ -44,7 +44,7 @@ Demo::Demo()
// Crea los objetos
ItemTracker::init();
scoreboard_ = std::make_shared<Scoreboard>(board_);
room_ = std::make_shared<Room>(resource_->getRoom(current_room_), board_);
room_ = std::make_shared<Room>(current_room_, board_);
text_ = resource_->getText("smb2");
// Inicializa el resto de variables
@@ -145,49 +145,17 @@ void Demo::renderRoomName()
text_->writeDX(TEXT_CENTER | TEXT_COLOR, GAMECANVAS_CENTER_X, 16 * 8 + 4, room_->getName(), 1, room_->getBGColor());
}
// Recarga todas las texturas
void Demo::reLoadTextures()
{
if (options.console)
{
std::cout << "** RELOAD REQUESTED" << std::endl;
}
room_->reLoadTexture();
scoreboard_->reLoadTexture();
text_->reLoadTexture();
}
// Cambia la paleta
void Demo::switchPalette()
{
// Modifica la variable
if (options.video.palette == Palette::ZXSPECTRUM)
{
options.video.palette = Palette::ZXARNE;
}
else
{
options.video.palette = Palette::ZXSPECTRUM;
}
room_->reLoadPalette();
scoreboard_->reLoadPalette();
// Pone el color del marcador en función del color del borde de la habitación
setScoreBoardColor();
}
// Cambia de habitación
bool Demo::changeRoom(std::string file)
bool Demo::changeRoom(const std::string &room_path)
{
// En las habitaciones los limites tienen la cadena del fichero o un 0 en caso de no limitar con nada
if (file != "0")
if (room_path != "0")
{
// Verifica que exista el fichero que se va a cargar
if (asset_->get(file) != "")
if (asset_->get(room_path) != "")
{
// Crea un objeto habitación a partir del fichero
room_ = std::make_shared<Room>(resource_->getRoom(file), board_);
room_ = std::make_shared<Room>(room_path, board_);
// Pone el color del marcador en función del color del borde de la habitación
setScoreBoardColor();