JA VA! Nomes s'havia de fer les coses be i no ser un ansias

This commit is contained in:
2025-02-22 00:30:32 +01:00
parent f6098a479b
commit e361d295c1
39 changed files with 1053 additions and 1098 deletions

View File

@@ -37,6 +37,7 @@
#include "screen.h" // Para Screen, FILTER_NEAREST, FILTER...
#include "utils.h" // Para options_t, section_t, op_notif...
#include "notifier.h"
#include "options.h"
#ifndef _WIN32
#include <pwd.h>
@@ -47,13 +48,6 @@ Director::Director(int argc, const char *argv[])
{
std::cout << "Game start" << std::endl;
section = new section_t();
section->name = SECTION_LOGO;
section->subsection = SUBSECTION_LOGO_TO_INTRO;
#ifdef DEBUG
section->name = SECTION_TITLE;
#endif
// Crea e inicializa las opciones del programa
initOptions();
@@ -62,7 +56,7 @@ Director::Director(int argc, const char *argv[])
// Crea el objeto que controla los ficheros de recursos
Asset::init(executable_path_);
Asset::get()->setVerbose(options->console);
Asset::get()->setVerbose(options.console);
// Crea la carpeta del sistema donde guardar datos
createSystemFolder("jailgames");
@@ -78,8 +72,8 @@ Director::Director(int argc, const char *argv[])
exit(EXIT_FAILURE);
}
// Inicializa variables desde el fichero de configuración
loadConfig();
// Carga las opciones desde un fichero
loadOptionsFromFile(Asset::get()->get("config.txt"));
// Inicializa SDL
initSDL();
@@ -90,8 +84,8 @@ Director::Director(int argc, const char *argv[])
// Crea los objetos
Screen::init(window_, renderer_);
Screen::get()->setBorderColor(borderColor);
Notifier::init(Asset::get()->get("notify.png"), Asset::get()->get("smb2.png"), Asset::get()->get("smb2.txt"), Asset::get()->get("notify.wav"), options);
resource_ = new Resource(options);
Notifier::init(Asset::get()->get("notify.png"), Asset::get()->get("smb2.png"), Asset::get()->get("smb2.txt"), Asset::get()->get("notify.wav"));
resource_ = new Resource();
Input::init(Asset::get()->get("gamecontrollerdb.txt"));
initInput();
debug_ = new Debug();
@@ -100,16 +94,14 @@ Director::Director(int argc, const char *argv[])
Director::~Director()
{
// Guarda las opciones de configuración
saveConfig();
// Guarda las opciones a un fichero
saveOptionsFromFile(Asset::get()->get("config.txt"));
// Libera la memoria
Asset::destroy();
Input::destroy();
Screen::destroy();
Notifier::destroy();
delete section;
delete options;
delete debug_;
delete resource_;
JA_DeleteMusic(title_music_);
@@ -121,56 +113,6 @@ Director::~Director()
std::cout << "\nBye!" << std::endl;
}
// Crea e inicializa las opciones del programa
void Director::initOptions()
{
// Crea el puntero a la estructura de opciones
options = new options_t;
// Version del archivo de configuración
options->configVersion = "v1.06.1";
// Opciones de control
options->keys = ctrl_cursor;
// Opciones de video
options->gameWidth = GAMECANVAS_WIDTH;
options->gameHeight = GAMECANVAS_HEIGHT;
options->videoMode = 0;
options->windowSize = 3;
options->filter = FILTER_NEAREST;
options->shaders = false;
options->vSync = true;
options->integerScale = true;
options->keepAspect = true;
options->borderEnabled = true;
options->borderWidth = 32;
options->borderHeight = 24;
options->palette = p_zxspectrum;
#ifdef GAME_CONSOLE
options->windowSize = 2;
#endif
// Estos valores no se guardan en el fichero de configuraci´ón
options->console = false;
#ifdef DEBUG
options->console = true;
#endif
options->cheat.infiniteLives = false;
options->cheat.invincible = false;
options->cheat.jailEnabled = false;
options->cheat.altSkin = false;
options->stats.rooms = 0;
options->stats.items = 0;
// Opciones de las notificaciones
options->notifications.posV = pos_top;
options->notifications.posH = pos_left;
options->notifications.sound = true;
options->notifications.color = {48, 48, 48};
}
// Comprueba los parametros del programa
void Director::checkProgramArguments(int argc, const char *argv[])
{
@@ -182,236 +124,31 @@ void Director::checkProgramArguments(int argc, const char *argv[])
{
if (strcmp(argv[i], "--console") == 0)
{
options->console = true;
options.console = true;
}
else if (strcmp(argv[i], "--infiniteLives") == 0)
{
options->cheat.infiniteLives = true;
options.cheat.infiniteLives = true;
}
else if (strcmp(argv[i], "--invincible") == 0)
{
options->cheat.invincible = true;
options.cheat.invincible = true;
}
else if (strcmp(argv[i], "--jailEnabled") == 0)
{
options->cheat.jailEnabled = true;
options.cheat.jailEnabled = true;
}
else if (strcmp(argv[i], "--altSkin") == 0)
{
options->cheat.altSkin = true;
options.cheat.altSkin = true;
}
}
}
// Carga el fichero de configuración
bool Director::loadConfig()
{
// Indicador de éxito en la carga
bool success = true;
// Versión actual del fichero
const std::string configVersion = options->configVersion;
options->configVersion = "";
// Variables para manejar el fichero
std::string line;
std::ifstream file(Asset::get()->get("config.txt"));
// Si el fichero se puede abrir
if (file.good())
{
// Procesa el fichero linea a linea
if (options->console)
{
std::cout << "Reading file config.txt\n";
}
while (std::getline(file, line))
{
// Comprueba que la linea no sea un comentario
if (line.substr(0, 1) != "#")
{
// Encuentra la posición del caracter '='
int pos = line.find("=");
// Procesa las dos subcadenas
if (!setOptions(options, line.substr(0, pos), line.substr(pos + 1, line.length())))
{
if (options->console)
{
std::cout << "Warning: file config.txt\n";
std::cout << "unknown parameter " << line.substr(0, pos).c_str() << std::endl;
}
success = false;
}
}
}
// Cierra el fichero
if (options->console)
{
std::cout << "Closing file config.txt\n\n";
}
file.close();
}
// El fichero no existe
else
{ // Crea el fichero con los valores por defecto
saveConfig();
}
// Si la versión de fichero no coincide, crea un fichero nuevo con los valores por defecto
if (configVersion != options->configVersion)
{
initOptions();
saveConfig();
}
// Normaliza los valores
const bool a = options->videoMode == 0;
const bool b = options->videoMode == SDL_WINDOW_FULLSCREEN;
const bool c = options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP;
if (!(a || b || c))
{
options->videoMode = 0;
}
if (options->windowSize < 1 || options->windowSize > 4)
{
options->windowSize = 3;
}
// Aplica opciones
// if (options->borderEnabled)
//{
// const int incWidth = GAMECANVAS_WIDTH * options->borderSize;
// const int incHeight = GAMECANVAS_HEIGHT * options->borderSize;
// options->gameWidth = GAMECANVAS_WIDTH + incWidth;
// options->gameHeight = GAMECANVAS_HEIGHT + incHeight;
//}
// else
//{
// options->gameWidth = GAMECANVAS_WIDTH;
// options->gameHeight = GAMECANVAS_HEIGHT;
//}
return success;
}
// Guarda el fichero de configuración
bool Director::saveConfig()
{
bool success = true;
// Crea y abre el fichero de texto
std::ofstream file(Asset::get()->get("config.txt"));
if (file.good())
{
if (options->console)
{
std::cout << Asset::get()->get("config.txt") << " open for writing" << std::endl;
}
}
else
{
if (options->console)
{
std::cout << Asset::get()->get("config.txt") << " can't be opened" << std::endl;
}
}
// Escribe en el fichero
file << "## VERSION\n";
file << "configVersion=" + options->configVersion + "\n";
file << "\n## CONTROL OPTIONS\n";
file << "## keys = CURSOR | OPQA | WASD\n";
if (options->keys == ctrl_cursor)
{
file << "keys=CURSOR\n";
}
else if (options->keys == ctrl_opqa)
{
file << "keys=OPQA\n";
}
else if (options->keys == ctrl_wasd)
{
file << "keys=WASD\n";
}
file << "\n## VISUAL OPTIONS\n";
if (options->videoMode == 0)
{
file << "videoMode=0\n";
}
else if (options->videoMode == SDL_WINDOW_FULLSCREEN)
{
file << "videoMode=SDL_WINDOW_FULLSCREEN\n";
}
else if (options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
{
file << "videoMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
}
file << "windowSize=" + std::to_string(options->windowSize) + "\n";
if (options->filter == FILTER_NEAREST)
{
file << "filter=FILTER_NEAREST\n";
}
else
{
file << "filter=FILTER_LINEAR\n";
}
file << "shaders=" + boolToString(options->shaders) + "\n";
file << "vSync=" + boolToString(options->vSync) + "\n";
file << "integerScale=" + boolToString(options->integerScale) + "\n";
file << "keepAspect=" + boolToString(options->keepAspect) + "\n";
file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n";
file << "borderWidth=" + std::to_string(options->borderWidth) + "\n";
file << "borderHeight=" + std::to_string(options->borderHeight) + "\n";
file << "palette=" + std::to_string(options->palette) + "\n";
file << "\n## NOTIFICATION OPTIONS\n";
file << "## notifications.posV = pos_top | pos_bottom\n";
if (options->notifications.posV == pos_top)
{
file << "notifications.posV=pos_top\n";
}
else
{
file << "notifications.posV=pos_bottom\n";
}
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
if (options->notifications.posH == pos_left)
{
file << "notifications.posH=pos_left\n";
}
else if (options->notifications.posH == pos_middle)
{
file << "notifications.posH=pos_middle\n";
}
else
{
file << "notifications.posH=pos_right\n";
}
file << "notifications.sound=" + boolToString(options->notifications.sound) + "\n";
// Cierra el fichero
file.close();
return success;
}
// Crea la carpeta del sistema donde guardar datos
void Director::createSystemFolder(const std::string &folder)
{
@@ -473,14 +210,14 @@ void Director::createSystemFolder(const std::string &folder)
}
// Carga los recursos
void Director::loadResources(section_t *section)
void Director::loadResources(section_t section)
{
if (options->console)
if (options.console)
{
std::cout << "** LOAD RESOURCES" << std::endl;
}
if (section->name == SECTION_LOGO)
if (options.section.name == SECTION_LOGO)
{
std::vector<std::string> textureList;
textureList.push_back("jailgames.png");
@@ -489,7 +226,7 @@ void Director::loadResources(section_t *section)
resource_->loadTextures(textureList);
}
else if (section->name == SECTION_LOADING_SCREEN)
else if (options.section.name == SECTION_LOADING_SCREEN)
{
std::vector<std::string> textureList;
textureList.push_back("loading_screen_bn.png");
@@ -500,7 +237,7 @@ void Director::loadResources(section_t *section)
resource_->loadTextures(textureList);
}
else if (section->name == SECTION_TITLE)
else if (options.section.name == SECTION_TITLE)
{
std::vector<std::string> textureList;
textureList.push_back("loading_screen_color.png");
@@ -520,7 +257,7 @@ void Director::loadResources(section_t *section)
resource_->loadOffsets(offsetsList);
}
else if (section->name == SECTION_CREDITS)
else if (options.section.name == SECTION_CREDITS)
{
// Texturas
std::vector<std::string> textureList;
@@ -542,7 +279,7 @@ void Director::loadResources(section_t *section)
resource_->loadOffsets(offsetsList);
}
else if (section->name == SECTION_ENDING)
else if (options.section.name == SECTION_ENDING)
{
// Texturas
std::vector<std::string> textureList;
@@ -567,7 +304,7 @@ void Director::loadResources(section_t *section)
resource_->loadOffsets(offsetsList);
}
else if (section->name == SECTION_ENDING2)
else if (options.section.name == SECTION_ENDING2)
{
// Texturas
std::vector<std::string> textureList;
@@ -705,7 +442,7 @@ void Director::loadResources(section_t *section)
resource_->loadOffsets(offsetsList);
}
else if (section->name == SECTION_GAME_OVER)
else if (options.section.name == SECTION_GAME_OVER)
{
// Texturas
std::vector<std::string> textureList;
@@ -729,13 +466,13 @@ void Director::loadResources(section_t *section)
resource_->loadOffsets(offsetsList);
}
else if (section->name == SECTION_GAME || section->name == SECTION_DEMO)
else if (options.section.name == SECTION_GAME || options.section.name == SECTION_DEMO)
{
// Texturas
std::vector<std::string> textureList;
// Jugador
if (options->cheat.altSkin)
if (options.cheat.altSkin)
{
textureList.push_back("player2.png");
}
@@ -820,7 +557,7 @@ void Director::loadResources(section_t *section)
std::vector<std::string> animationList;
// Jugador
if (options->cheat.altSkin)
if (options.cheat.altSkin)
{
animationList.push_back("player2.ani");
}
@@ -1028,182 +765,23 @@ void Director::loadResources(section_t *section)
resource_->loadRooms(roomList);
}
if (options->console)
if (options.console)
{
std::cout << "** RESOURCES LOADED" << std::endl;
}
}
// Asigna variables a partir de dos cadenas
bool Director::setOptions(options_t *options, std::string var, std::string value)
{
// Indicador de éxito en la asignación
bool success = true;
if (var == "configVersion")
{
options->configVersion = value;
}
else if (var == "keys")
{
if (value == "OPQA")
{
options->keys = ctrl_opqa;
}
else if (value == "WASD")
{
options->keys = ctrl_wasd;
}
else
{
options->keys = ctrl_cursor;
}
}
else if (var == "videoMode")
{
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
{
options->videoMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else if (value == "SDL_WINDOW_FULLSCREEN")
{
options->videoMode = SDL_WINDOW_FULLSCREEN;
}
else
{
options->videoMode = 0;
}
}
else if (var == "windowSize")
{
options->windowSize = std::stoi(value);
if ((options->windowSize < 1) || (options->windowSize > 4))
{
options->windowSize = 3;
}
}
else if (var == "filter")
{
if (value == "FILTER_LINEAR")
{
options->filter = FILTER_LINEAR;
}
else
{
options->filter = FILTER_NEAREST;
}
}
else if (var == "shaders")
{
options->shaders = stringToBool(value);
}
else if (var == "vSync")
{
options->vSync = stringToBool(value);
}
else if (var == "integerScale")
{
options->integerScale = stringToBool(value);
}
else if (var == "keepAspect")
{
options->keepAspect = stringToBool(value);
}
else if (var == "borderEnabled")
{
options->borderEnabled = stringToBool(value);
}
else if (var == "borderWidth")
{
options->borderWidth = std::stoi(value);
}
else if (var == "borderHeight")
{
options->borderHeight = std::stoi(value);
}
else if (var == "palette")
{
const int pal = std::stoi(value);
if (pal == 0)
{
options->palette = p_zxspectrum;
}
else if (pal == 1)
{
options->palette = p_zxarne;
}
}
else if (var == "notifications.posH")
{
if (value == "pos_left")
{
options->notifications.posH = pos_left;
}
else if (value == "pos_middle")
{
options->notifications.posH = pos_middle;
}
else
{
options->notifications.posH = pos_right;
}
}
else if (var == "notifications.posV")
{
if (value == "pos_top")
{
options->notifications.posV = pos_top;
}
else
{
options->notifications.posV = pos_bottom;
}
}
else if (var == "notifications.sound")
{
options->notifications.sound = stringToBool(value);
}
else if (var == "" || var.substr(0, 1) == "#")
{
}
else
{
success = false;
}
return success;
}
// Inicia las variables necesarias para arrancar el programa
void Director::initInput()
{
// Establece si ha de mostrar mensajes
Input::get()->setVerbose(options->console);
Input::get()->setVerbose(options.console);
// Busca si hay un mando conectado
Input::get()->discoverGameController();
// Teclado - Movimiento
if (options->keys == ctrl_cursor)
if (options.keys == ctrl_cursor)
{
Input::get()->bindKey(input_jump, SDL_SCANCODE_UP);
Input::get()->bindKey(input_left, SDL_SCANCODE_LEFT);
@@ -1211,7 +789,7 @@ void Director::initInput()
Input::get()->bindKey(input_up, SDL_SCANCODE_UP);
Input::get()->bindKey(input_down, SDL_SCANCODE_DOWN);
}
else if (options->keys == ctrl_opqa)
else if (options.keys == ctrl_opqa)
{
Input::get()->bindKey(input_jump, SDL_SCANCODE_Q);
Input::get()->bindKey(input_left, SDL_SCANCODE_O);
@@ -1219,7 +797,7 @@ void Director::initInput()
Input::get()->bindKey(input_up, SDL_SCANCODE_Q);
Input::get()->bindKey(input_down, SDL_SCANCODE_A);
}
else if (options->keys == ctrl_wasd)
else if (options.keys == ctrl_wasd)
{
Input::get()->bindKey(input_jump, SDL_SCANCODE_W);
Input::get()->bindKey(input_left, SDL_SCANCODE_A);
@@ -1276,7 +854,7 @@ bool Director::initSDL()
// Inicializa SDL
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
if (options->console)
if (options.console)
{
std::cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << std::endl;
}
@@ -1288,9 +866,9 @@ bool Director::initSDL()
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
// Establece el filtro de la textura a nearest
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->filter).c_str()))
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options.filter).c_str()))
{
if (options->console)
if (options.console)
{
std::cout << "Warning: Nearest texture filtering not enabled!\n";
}
@@ -1305,16 +883,16 @@ bool Director::initSDL()
// Crea la ventana
int incW = 0;
int incH = 0;
if (options->borderEnabled)
if (options.borderEnabled)
{
incW = options->borderWidth * 2;
incH = options->borderHeight * 2;
incW = options.borderWidth * 2;
incH = options.borderHeight * 2;
}
window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->gameWidth + incW) * options->windowSize, (options->gameHeight + incH) * options->windowSize, SDL_WINDOW_HIDDEN);
window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options.gameWidth + incW) * options.windowSize, (options.gameHeight + incH) * options.windowSize, SDL_WINDOW_HIDDEN);
if (window_ == nullptr)
{
if (options->console)
if (options.console)
{
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
}
@@ -1324,7 +902,7 @@ bool Director::initSDL()
{
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
Uint32 flags = 0;
if (options->vSync)
if (options.vSync)
{
flags = flags | SDL_RENDERER_PRESENTVSYNC;
}
@@ -1332,7 +910,7 @@ bool Director::initSDL()
if (renderer_ == nullptr)
{
if (options->console)
if (options.console)
{
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
}
@@ -1344,7 +922,7 @@ bool Director::initSDL()
SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF);
// Establece el tamaño del buffer de renderizado
SDL_RenderSetLogicalSize(renderer_, options->gameWidth, options->gameHeight);
SDL_RenderSetLogicalSize(renderer_, options.gameWidth, options.gameHeight);
// Establece el modo de mezcla
SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
@@ -1352,7 +930,7 @@ bool Director::initSDL()
}
}
if (options->console)
if (options.console)
{
std::cout << std::endl;
}
@@ -1722,12 +1300,12 @@ bool Director::setFileList()
// Ejecuta la seccion de juego con el logo
void Director::runLogo()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: LOGO" << std::endl;
}
loadResources(section);
auto logo = std::make_unique<Logo>(resource_, options, section);
loadResources(options.section);
auto logo = std::make_unique<Logo>(resource_);
logo->run();
resource_->free();
}
@@ -1735,12 +1313,12 @@ void Director::runLogo()
// Ejecuta la seccion de juego de la pantalla de carga
void Director::runLoadingScreen()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: INTRO" << std::endl;
}
loadResources(section);
auto loadingScreen = std::make_unique<LoadingScreen>(resource_, options, section);
loadResources(options.section);
auto loadingScreen = std::make_unique<LoadingScreen>(resource_);
loadingScreen->run();
resource_->free();
}
@@ -1748,7 +1326,7 @@ void Director::runLoadingScreen()
// Ejecuta la seccion de juego con el titulo y los menus
void Director::runTitle()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: TITLE" << std::endl;
}
@@ -1756,8 +1334,8 @@ void Director::runTitle()
{
JA_PlayMusic(title_music_);
}
loadResources(section);
auto title = std::make_unique<Title>(resource_, options, section);
loadResources(options.section);
auto title = std::make_unique<Title>(resource_);
title->run();
resource_->free();
}
@@ -1765,12 +1343,12 @@ void Director::runTitle()
// Ejecuta la seccion de los creditos del juego
void Director::runCredits()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: CREDITS" << std::endl;
}
loadResources(section);
auto credits = std::make_unique<Credits>(resource_, options, section);
loadResources(options.section);
auto credits = std::make_unique<Credits>(resource_);
credits->run();
resource_->free();
}
@@ -1778,12 +1356,12 @@ void Director::runCredits()
// Ejecuta la seccion de la demo, donde se ven pantallas del juego
void Director::runDemo()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: DEMO" << std::endl;
}
loadResources(section);
auto demo = std::make_unique<Demo>(resource_, options, section, debug_);
loadResources(options.section);
auto demo = std::make_unique<Demo>(resource_, debug_);
demo->run();
resource_->free();
}
@@ -1791,12 +1369,12 @@ void Director::runDemo()
// Ejecuta la seccion del final del juego
void Director::runEnding()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: ENDING" << std::endl;
}
loadResources(section);
auto ending = std::make_unique<Ending>(resource_, options, section);
loadResources(options.section);
auto ending = std::make_unique<Ending>(resource_);
ending->run();
resource_->free();
}
@@ -1804,12 +1382,12 @@ void Director::runEnding()
// Ejecuta la seccion del final del juego
void Director::runEnding2()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: ENDING2" << std::endl;
}
loadResources(section);
auto ending2 = std::make_unique<Ending2>(resource_, options, section);
loadResources(options.section);
auto ending2 = std::make_unique<Ending2>(resource_);
ending2->run();
resource_->free();
}
@@ -1817,12 +1395,12 @@ void Director::runEnding2()
// Ejecuta la seccion del final de la partida
void Director::runGameOver()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: GAME OVER" << std::endl;
}
loadResources(section);
auto gameOver = std::make_unique<GameOver>(resource_, options, section);
loadResources(options.section);
auto gameOver = std::make_unique<GameOver>(resource_);
gameOver->run();
resource_->free();
}
@@ -1830,13 +1408,13 @@ void Director::runGameOver()
// Ejecuta la seccion de juego donde se juega
void Director::runGame()
{
if (options->console)
if (options.console)
{
std::cout << "\n* SECTION: GAME" << std::endl;
}
JA_StopMusic();
loadResources(section);
auto game = std::make_unique<Game>(resource_, options, section, debug_);
loadResources(options.section);
auto game = std::make_unique<Game>(resource_, debug_);
game->run();
resource_->free();
}
@@ -1844,9 +1422,9 @@ void Director::runGame()
int Director::run()
{
// Bucle principal
while (section->name != SECTION_QUIT)
while (options.section.name != SECTION_QUIT)
{
switch (section->name)
switch (options.section.name)
{
case SECTION_LOGO:
runLogo();