Eliminat tots els options.console
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#include "animatedsprite.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath, bool verbose)
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "movingsprite.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void Director::initInput()
|
||||
#ifdef VERBOSE
|
||||
input->setVerbose(true);
|
||||
#else
|
||||
input->setVerbose(options.console);
|
||||
input->setVerbose(false);
|
||||
#endif
|
||||
// Busca si hay mandos conectados
|
||||
input->discoverGameControllers();
|
||||
@@ -216,10 +216,9 @@ bool Director::initSDL()
|
||||
// Inicializa SDL
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
@@ -227,9 +226,8 @@ bool Director::initSDL()
|
||||
// Inicia el generador de numeros aleatorios
|
||||
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
|
||||
|
||||
#ifdef VERBOSE
|
||||
// Muestra información de la pantalla
|
||||
if (options.console)
|
||||
{
|
||||
/*std::cout << "\nDisplay modes list:" << std::endl;
|
||||
for (int i = 0; i < SDL_GetNumDisplayModes(0); ++i)
|
||||
{
|
||||
@@ -242,33 +240,30 @@ bool Director::initSDL()
|
||||
SDL_GetCurrentDisplayMode(0, &DM);
|
||||
std::cout << "\nCurrent display mode: " + std::to_string(DM.w) + "x" + std::to_string(DM.h) + " @ " + std::to_string(DM.refresh_rate) + "Hz" << std::endl;
|
||||
std::cout << "Window resolution : " + std::to_string(param.game.width) + "x" + std::to_string(param.game.height) + " x" + std::to_string(options.video.window.size) << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Establece el filtro de la textura
|
||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options.video.filter).c_str()))
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Warning: texture filtering not enabled!\n";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifndef NO_SHADERS
|
||||
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Warning: opengl not enabled!\n";
|
||||
#endif // VERBOSE
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // NO_SHADERS
|
||||
// Crea la ventana
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN);
|
||||
if (window == nullptr)
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
@@ -287,10 +282,9 @@ bool Director::initSDL()
|
||||
|
||||
if (renderer == nullptr)
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
@@ -307,10 +301,9 @@ bool Director::initSDL()
|
||||
}
|
||||
}
|
||||
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl;
|
||||
}
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -479,11 +472,6 @@ void Director::checkProgramArguments(int argc, char *argv[])
|
||||
// Comprueba el resto de parametros
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (strcmp(argv[i], "--console") == 0)
|
||||
{
|
||||
options.console = true;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--320x240") == 0)
|
||||
{
|
||||
paramFileArgument = argv[i];
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Writing file " << filename.c_str() << std::endl;
|
||||
}
|
||||
#endif // VERBOSE
|
||||
|
||||
// Cerramos el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
|
||||
#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);
|
||||
|
||||
@@ -13,13 +13,6 @@ bool setOptions(std::string var, std::string value);
|
||||
// Inicializa las opciones del programa
|
||||
void initOptions()
|
||||
{
|
||||
// Opciones varias
|
||||
#ifdef VERBOSE
|
||||
options.console = true;
|
||||
#else
|
||||
options.console = false;
|
||||
#endif
|
||||
|
||||
// Opciones de video
|
||||
#ifdef ANBERNIC
|
||||
options.video.mode = 0;
|
||||
@@ -101,10 +94,9 @@ bool loadOptionsFile(std::string filePath)
|
||||
if (file.good())
|
||||
{
|
||||
// Procesa el fichero linea a linea
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Reading file: " << fileName << std::endl;
|
||||
}
|
||||
#endif
|
||||
std::string line;
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
@@ -116,11 +108,10 @@ bool loadOptionsFile(std::string filePath)
|
||||
// Procesa las dos subcadenas
|
||||
if (!setOptions(line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Warning: file " << fileName << std::endl;
|
||||
std::cout << "Unknown parameter " << line.substr(0, pos).c_str() << std::endl;
|
||||
}
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@@ -166,17 +157,15 @@ bool saveOptionsFile(std::string filePath)
|
||||
|
||||
if (!file.good())
|
||||
{
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << fileName << " can't be opened" << std::endl;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.console)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Writing file: " << fileName << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Opciones de video
|
||||
file << "## VIDEO\n";
|
||||
|
||||
@@ -60,8 +60,8 @@ void loadParamsFromFile(std::string filePath)
|
||||
initParam();
|
||||
|
||||
// Variables para manejar el fichero
|
||||
std::string line;
|
||||
std::ifstream file(filePath);
|
||||
std::string line;
|
||||
std::string param1;
|
||||
std::string param2;
|
||||
|
||||
|
||||
@@ -164,7 +164,6 @@ struct op_notification_t
|
||||
// Estructura con todas las opciones de configuración del programa
|
||||
struct options_t
|
||||
{
|
||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||
op_game_t game; // Opciones para el propio juego
|
||||
op_video_t video; // Opciones relativas a la clase screen
|
||||
op_audio_t audio; // Opciones para el audio
|
||||
|
||||
Reference in New Issue
Block a user