Eliminat tots els options.console

This commit is contained in:
2024-09-28 18:02:09 +02:00
parent 4febe8b7c0
commit ac3340c39f
7 changed files with 83 additions and 114 deletions

View File

@@ -1,6 +1,7 @@
#include "game.h"
#include "param.h"
#include "options.h"
#include <fstream>
#define GAME_OVER_COUNTER 350
@@ -327,11 +328,10 @@ void Game::init(int playerID)
// Carga los recursos necesarios para la sección 'Game'
void Game::loadMedia()
{
if (options.console)
{
std::cout << std::endl
<< "** LOADING RESOURCES FOR GAME SECTION" << std::endl;
}
#ifdef VERBOSE
std::cout << std::endl
<< "** LOADING RESOURCES FOR GAME SECTION" << std::endl;
#endif
playerAnimations.clear();
balloonAnimations.clear();
@@ -520,11 +520,10 @@ void Game::loadMedia()
stageChangeSound = JA_LoadSound(asset->get("stage_change.wav").c_str());
coffeeMachineSound = JA_LoadSound(asset->get("title.wav").c_str());
if (options.console)
{
std::cout << "** RESOURCES FOR GAME SECTION LOADED" << std::endl
<< std::endl;
}
#ifdef VERBOSE
std::cout << "** RESOURCES FOR GAME SECTION LOADED" << std::endl
<< std::endl;
#endif
}
// Libera los recursos previamente cargados
@@ -650,10 +649,9 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
SDL_RWops *file = SDL_RWFromFile(filePath.c_str(), "r+b");
if (file == nullptr)
{ // El fichero no existe
if (options.console)
{
std::cout << "Warning: Unable to open " << fileName.c_str() << " file" << std::endl;
}
#ifdef VERBOSE
std::cout << "Warning: Unable to open " << fileName.c_str() << " file" << std::endl;
#endif
// Creamos el fichero para escritura
file = SDL_RWFromFile(filePath.c_str(), "w+b");
@@ -661,10 +659,9 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
// Si ha creado el fichero
if (file != nullptr)
{
if (options.console)
{
std::cout << "New file (" << fileName.c_str() << ") created!" << std::endl;
}
#ifdef VERBOSE
std::cout << "New file (" << fileName.c_str() << ") created!" << std::endl;
#endif
// Inicializas los datos y los guarda en el fichero
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
@@ -685,21 +682,19 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
}
else
{ // Si no puede crear el fichero
if (options.console)
{
std::cout << "Error: Unable to create file " << fileName.c_str() << std::endl;
}
#ifdef VERBOSE
std::cout << "Error: Unable to create file " << fileName.c_str() << std::endl;
#endif
success = false;
}
}
// El fichero existe
else
{
// Mensaje de proceder a la carga de los datos
if (options.console)
{
std::cout << "Reading file: " << fileName.c_str() << std::endl;
}
// Mensaje de proceder a la carga de los datos
#ifdef VERBOSE
std::cout << "Reading file: " << fileName.c_str() << std::endl;
#endif
// Lee todos los datos del fichero y los deja en el destino
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
@@ -732,25 +727,23 @@ bool Game::saveDemoFile(std::string filePath)
SDL_RWwrite(file, &demo.dataFile[0][i], sizeof(demoKeys_t), 1);
}
if (options.console)
{
std::cout << "Writing file " << filename.c_str() << std::endl;
}
#ifdef VERBOSE
std::cout << "Writing file " << filename.c_str() << std::endl;
#endif // VERBOSE
// Cerramos el fichero
SDL_RWclose(file);
}
else
{
if (options.console)
{
std::cout << "Error: Unable to save " << filename.c_str() << " file! " << SDL_GetError() << std::endl;
}
#ifdef VERBOSE
std::cout << "Error: Unable to save " << filename.c_str() << " file! " << SDL_GetError() << std::endl;
#endif // VERBOSE
}
return success;
}
#endif
#endif // RECORDING
// Crea una formación de enemigos
void Game::deployEnemyFormation()
@@ -2653,10 +2646,10 @@ void Game::loadAnimations(std::string filePath, std::vector<std::string> *buffer
if (file)
{
if (options.console)
{
std::cout << "Animation loaded: " << filePath.substr(filePath.find_last_of("\\/") + 1).c_str() << std::endl;
}
#ifdef VERBOSE
std::cout << "Animation loaded: " << filePath.substr(filePath.find_last_of("\\/") + 1).c_str() << std::endl;
#endif
while (std::getline(file, line))
{
buffer->push_back(line);