commit de acabar la jornada laboral
This commit is contained in:
@@ -300,9 +300,7 @@ void Game::init(int player_id)
|
||||
// Carga los recursos necesarios para la sección 'Game'
|
||||
void Game::loadMedia()
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "\n** LOADING RESOURCES FOR GAME SECTION" << std::endl;
|
||||
#endif
|
||||
|
||||
// Limpia
|
||||
{
|
||||
@@ -492,10 +490,8 @@ void Game::loadMedia()
|
||||
coffee_machine_sound_ = JA_LoadSound(asset_->get("title.wav").c_str());
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "** RESOURCES FOR GAME SECTION LOADED\n"
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Libera los recursos previamente cargados
|
||||
@@ -537,15 +533,11 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
{
|
||||
// Indicador de éxito en la carga
|
||||
auto success = true;
|
||||
#ifdef VERBOSE
|
||||
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
#endif
|
||||
auto file = SDL_RWFromFile(file_path.c_str(), "r+b");
|
||||
if (!file)
|
||||
{ // El fichero no existe
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Warning: Unable to open " << file_name.c_str() << " file" << std::endl;
|
||||
#endif
|
||||
|
||||
// Creamos el fichero para escritura
|
||||
file = SDL_RWFromFile(file_path.c_str(), "w+b");
|
||||
@@ -553,9 +545,7 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
// Si ha creado el fichero
|
||||
if (file)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "New file (" << file_name.c_str() << ") created!" << std::endl;
|
||||
#endif
|
||||
|
||||
// Inicializas los datos y los guarda en el fichero
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
@@ -576,9 +566,7 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
}
|
||||
else
|
||||
{ // Si no puede crear el fichero
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Error: Unable to create file " << file_name.c_str() << std::endl;
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@@ -586,9 +574,7 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
else
|
||||
{
|
||||
// Mensaje de proceder a la carga de los datos
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Reading file: " << file_name.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)
|
||||
@@ -610,9 +596,7 @@ bool Game::loadDemoFile(const std::string &file_path, DemoKeys (*data_file)[TOTA
|
||||
bool Game::saveDemoFile(const std::string &file_path)
|
||||
{
|
||||
auto success = true;
|
||||
#ifdef VERBOSE
|
||||
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
#endif // VERBOSE
|
||||
|
||||
auto file = SDL_RWFromFile(file_path.c_str(), "w+b");
|
||||
if (file)
|
||||
@@ -623,18 +607,14 @@ bool Game::saveDemoFile(const std::string &file_path)
|
||||
SDL_RWwrite(file, &demo.dataFile[0][i], sizeof(DemoKeys), 1);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Writing file " << file_name.c_str() << std::endl;
|
||||
#endif // VERBOSE
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Error: Unable to save " << file_name.c_str() << " file! " << SDL_GetError() << std::endl;
|
||||
#endif // VERBOSE
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -1420,7 +1400,7 @@ void Game::createItemScoreSprite(int x, int y, std::shared_ptr<Texture> texture)
|
||||
|
||||
// Inicializa
|
||||
smart_sprites_.back()->setPos({0, 0, texture->getWidth(), texture->getHeight()});
|
||||
smart_sprites_.back()->setSpriteClip(smart_sprites_.back()->getPos());
|
||||
smart_sprites_.back()->setSpriteClip(smart_sprites_.back()->getPosition());
|
||||
smart_sprites_.back()->setPosX(x);
|
||||
smart_sprites_.back()->setPosY(y);
|
||||
smart_sprites_.back()->setDestX(x);
|
||||
@@ -2439,9 +2419,7 @@ void Game::loadAnimations(std::string filePath, std::vector<std::string> *buffer
|
||||
if (file)
|
||||
{
|
||||
|
||||
#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);
|
||||
|
||||
Reference in New Issue
Block a user