diff --git a/data/credits/shine.ani b/data/credits/shine.ani index 614409f..929fe81 100644 --- a/data/credits/shine.ani +++ b/data/credits/shine.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=8 +frame_width=8 +frame_height=8 [animation] name=default diff --git a/data/enemies/abad.ani b/data/enemies/abad.ani index 52da744..fa53cc6 100644 --- a/data/enemies/abad.ani +++ b/data/enemies/abad.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/abad_bell.ani b/data/enemies/abad_bell.ani index 9aa9d80..bb352f8 100644 --- a/data/enemies/abad_bell.ani +++ b/data/enemies/abad_bell.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/amstrad_cs.ani b/data/enemies/amstrad_cs.ani index 59e9721..55cbfe9 100644 --- a/data/enemies/amstrad_cs.ani +++ b/data/enemies/amstrad_cs.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=8 +frame_width=8 +frame_height=8 [animation] name=default diff --git a/data/enemies/arounders_door.ani b/data/enemies/arounders_door.ani index 46d34fa..f710a7b 100644 --- a/data/enemies/arounders_door.ani +++ b/data/enemies/arounders_door.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/arounders_machine.ani b/data/enemies/arounders_machine.ani index 838fad8..479efdc 100644 --- a/data/enemies/arounders_machine.ani +++ b/data/enemies/arounders_machine.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/bat.ani b/data/enemies/bat.ani index 22355c1..d3c96f3 100644 --- a/data/enemies/bat.ani +++ b/data/enemies/bat.ani @@ -1,5 +1,5 @@ -frameWidth=9 -frameHeight=7 +frame_width=9 +frame_height=7 [animation] name=default diff --git a/data/enemies/batman.ani b/data/enemies/batman.ani index b5e817c..be54581 100644 --- a/data/enemies/batman.ani +++ b/data/enemies/batman.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/batman_bell.ani b/data/enemies/batman_bell.ani index ab38cf6..3943028 100644 --- a/data/enemies/batman_bell.ani +++ b/data/enemies/batman_bell.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/batman_fire.ani b/data/enemies/batman_fire.ani index 838fad8..479efdc 100644 --- a/data/enemies/batman_fire.ani +++ b/data/enemies/batman_fire.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/bell.ani b/data/enemies/bell.ani index 06fc9a4..248d852 100644 --- a/data/enemies/bell.ani +++ b/data/enemies/bell.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/bin.ani b/data/enemies/bin.ani index faee11c..0a89f16 100644 --- a/data/enemies/bin.ani +++ b/data/enemies/bin.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=8 +frame_width=16 +frame_height=8 [animation] name=default diff --git a/data/enemies/bird.ani b/data/enemies/bird.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/bird.ani +++ b/data/enemies/bird.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/breakout.ani b/data/enemies/breakout.ani index 2f61c4e..11575b0 100644 --- a/data/enemies/breakout.ani +++ b/data/enemies/breakout.ani @@ -1,5 +1,5 @@ -frameWidth=24 -frameHeight=32 +frame_width=24 +frame_height=32 [animation] name=default diff --git a/data/enemies/bry.ani b/data/enemies/bry.ani index 7d64c84..85c7f35 100644 --- a/data/enemies/bry.ani +++ b/data/enemies/bry.ani @@ -1,5 +1,5 @@ -frameWidth=10 -frameHeight=16 +frame_width=10 +frame_height=16 [animation] name=default diff --git a/data/enemies/chip.ani b/data/enemies/chip.ani index b5e817c..be54581 100644 --- a/data/enemies/chip.ani +++ b/data/enemies/chip.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/code.ani b/data/enemies/code.ani index 1facc66..b9b444e 100644 --- a/data/enemies/code.ani +++ b/data/enemies/code.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/congo.ani b/data/enemies/congo.ani index 065fd45..9f12975 100644 --- a/data/enemies/congo.ani +++ b/data/enemies/congo.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/crosshair.ani b/data/enemies/crosshair.ani index 1facc66..b9b444e 100644 --- a/data/enemies/crosshair.ani +++ b/data/enemies/crosshair.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/demon.ani b/data/enemies/demon.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/demon.ani +++ b/data/enemies/demon.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/dimallas.ani b/data/enemies/dimallas.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/dimallas.ani +++ b/data/enemies/dimallas.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/dong.ani b/data/enemies/dong.ani index d7d8f1c..cffe618 100644 --- a/data/enemies/dong.ani +++ b/data/enemies/dong.ani @@ -1,5 +1,5 @@ -frameWidth=22 -frameHeight=16 +frame_width=22 +frame_height=16 [animation] name=default diff --git a/data/enemies/elsa.ani b/data/enemies/elsa.ani index ab38cf6..3943028 100644 --- a/data/enemies/elsa.ani +++ b/data/enemies/elsa.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/floppy.ani b/data/enemies/floppy.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/floppy.ani +++ b/data/enemies/floppy.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/flying_arounder.ani b/data/enemies/flying_arounder.ani index 612d03d..2a3169b 100644 --- a/data/enemies/flying_arounder.ani +++ b/data/enemies/flying_arounder.ani @@ -1,5 +1,5 @@ -frameWidth=7 -frameHeight=7 +frame_width=7 +frame_height=7 [animation] name=default diff --git a/data/enemies/guitar.ani b/data/enemies/guitar.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/guitar.ani +++ b/data/enemies/guitar.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/heavy.ani b/data/enemies/heavy.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/heavy.ani +++ b/data/enemies/heavy.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/jailbattle_alien.ani b/data/enemies/jailbattle_alien.ani index fbf85e6..c041cb9 100644 --- a/data/enemies/jailbattle_alien.ani +++ b/data/enemies/jailbattle_alien.ani @@ -1,5 +1,5 @@ -frameWidth=13 -frameHeight=15 +frame_width=13 +frame_height=15 [animation] name=default diff --git a/data/enemies/jailbattle_human.ani b/data/enemies/jailbattle_human.ani index 674b262..b94b22c 100644 --- a/data/enemies/jailbattle_human.ani +++ b/data/enemies/jailbattle_human.ani @@ -1,5 +1,5 @@ -frameWidth=11 -frameHeight=13 +frame_width=11 +frame_height=13 [animation] name=default diff --git a/data/enemies/jailer_#1.ani b/data/enemies/jailer_#1.ani index 838fad8..479efdc 100644 --- a/data/enemies/jailer_#1.ani +++ b/data/enemies/jailer_#1.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/jailer_#2.ani b/data/enemies/jailer_#2.ani index ec80bbc..a9126cb 100644 --- a/data/enemies/jailer_#2.ani +++ b/data/enemies/jailer_#2.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/jailer_#3.ani b/data/enemies/jailer_#3.ani index 838fad8..479efdc 100644 --- a/data/enemies/jailer_#3.ani +++ b/data/enemies/jailer_#3.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/jeannine.ani b/data/enemies/jeannine.ani index 065fd45..9f12975 100644 --- a/data/enemies/jeannine.ani +++ b/data/enemies/jeannine.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/lamp.ani b/data/enemies/lamp.ani index 01d177d..30d65ec 100644 --- a/data/enemies/lamp.ani +++ b/data/enemies/lamp.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/lord_abad.ani b/data/enemies/lord_abad.ani index 1facc66..b9b444e 100644 --- a/data/enemies/lord_abad.ani +++ b/data/enemies/lord_abad.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/matatunos.ani b/data/enemies/matatunos.ani index 39710e0..3580193 100644 --- a/data/enemies/matatunos.ani +++ b/data/enemies/matatunos.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/mummy.ani b/data/enemies/mummy.ani index 8a1282a..7b6c871 100644 --- a/data/enemies/mummy.ani +++ b/data/enemies/mummy.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/paco.ani b/data/enemies/paco.ani index 53f4d16..211f348 100644 --- a/data/enemies/paco.ani +++ b/data/enemies/paco.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/qvoid.ani b/data/enemies/qvoid.ani index 5458bde..2e937a7 100644 --- a/data/enemies/qvoid.ani +++ b/data/enemies/qvoid.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/robot.ani b/data/enemies/robot.ani index 31b837f..b3b7358 100644 --- a/data/enemies/robot.ani +++ b/data/enemies/robot.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=32 +frame_width=16 +frame_height=32 [animation] name=default diff --git a/data/enemies/sam.ani b/data/enemies/sam.ani index fd52e28..3bcbf0a 100644 --- a/data/enemies/sam.ani +++ b/data/enemies/sam.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/shock.ani b/data/enemies/shock.ani index 4de06c4..bce7872 100644 --- a/data/enemies/shock.ani +++ b/data/enemies/shock.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=8 +frame_width=8 +frame_height=8 [animation] name=default diff --git a/data/enemies/sigmasua.ani b/data/enemies/sigmasua.ani index 2f2df91..5990e7d 100644 --- a/data/enemies/sigmasua.ani +++ b/data/enemies/sigmasua.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/spark.ani b/data/enemies/spark.ani index 065fd45..9f12975 100644 --- a/data/enemies/spark.ani +++ b/data/enemies/spark.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/special/aerojailer.ani b/data/enemies/special/aerojailer.ani index 2b1e26a..1e84f52 100644 --- a/data/enemies/special/aerojailer.ani +++ b/data/enemies/special/aerojailer.ani @@ -1,5 +1,5 @@ -frameWidth=43 -frameHeight=44 +frame_width=43 +frame_height=44 [animation] name=default diff --git a/data/enemies/special/arounder.ani b/data/enemies/special/arounder.ani index 207c825..b75f10f 100644 --- a/data/enemies/special/arounder.ani +++ b/data/enemies/special/arounder.ani @@ -1,5 +1,5 @@ -frameWidth=79 -frameHeight=90 +frame_width=79 +frame_height=90 [animation] name=default diff --git a/data/enemies/special/pepe_rosita_job.ani b/data/enemies/special/pepe_rosita_job.ani index 30599fe..10e342d 100644 --- a/data/enemies/special/pepe_rosita_job.ani +++ b/data/enemies/special/pepe_rosita_job.ani @@ -1,5 +1,5 @@ -frameWidth=62 -frameHeight=47 +frame_width=62 +frame_height=47 [animation] name=default diff --git a/data/enemies/special/shooting_star.ani b/data/enemies/special/shooting_star.ani index aea4e3e..0517c42 100644 --- a/data/enemies/special/shooting_star.ani +++ b/data/enemies/special/shooting_star.ani @@ -1,5 +1,5 @@ -frameWidth=64 -frameHeight=64 +frame_width=64 +frame_height=64 [animation] name=default diff --git a/data/enemies/spider.ani b/data/enemies/spider.ani index 83547c7..c9aae9a 100644 --- a/data/enemies/spider.ani +++ b/data/enemies/spider.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=8 +frame_width=8 +frame_height=8 [animation] name=default diff --git a/data/enemies/stopped_arounder.ani b/data/enemies/stopped_arounder.ani index 9e831d8..d8df7b9 100644 --- a/data/enemies/stopped_arounder.ani +++ b/data/enemies/stopped_arounder.ani @@ -1,5 +1,5 @@ -frameWidth=7 -frameHeight=8 +frame_width=7 +frame_height=8 [animation] name=default diff --git a/data/enemies/tree_thing.ani b/data/enemies/tree_thing.ani index 1e61f47..0ed7fa0 100644 --- a/data/enemies/tree_thing.ani +++ b/data/enemies/tree_thing.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/tuno.ani b/data/enemies/tuno.ani index 2622298..e040a56 100644 --- a/data/enemies/tuno.ani +++ b/data/enemies/tuno.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=16 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/enemies/tv.ani b/data/enemies/tv.ani index f6397e1..2ef318e 100644 --- a/data/enemies/tv.ani +++ b/data/enemies/tv.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=18 +frame_width=16 +frame_height=18 [animation] name=default diff --git a/data/enemies/tv_panel.ani b/data/enemies/tv_panel.ani index b9ec4ed..79ecc46 100644 --- a/data/enemies/tv_panel.ani +++ b/data/enemies/tv_panel.ani @@ -1,5 +1,5 @@ -frameWidth=24 -frameHeight=16 +frame_width=24 +frame_height=16 [animation] name=default diff --git a/data/enemies/upv_student.ani b/data/enemies/upv_student.ani index b5e817c..be54581 100644 --- a/data/enemies/upv_student.ani +++ b/data/enemies/upv_student.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=default diff --git a/data/enemies/walking_arounder.ani b/data/enemies/walking_arounder.ani index 7227ab1..a5f9838 100644 --- a/data/enemies/walking_arounder.ani +++ b/data/enemies/walking_arounder.ani @@ -1,5 +1,5 @@ -frameWidth=5 -frameHeight=8 +frame_width=5 +frame_height=8 [animation] name=default diff --git a/data/enemies/wave.ani b/data/enemies/wave.ani index 9701816..6b0d280 100644 --- a/data/enemies/wave.ani +++ b/data/enemies/wave.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=8 +frame_width=8 +frame_height=8 [animation] name=default diff --git a/data/enemies/z80.ani b/data/enemies/z80.ani index 830ed70..1c1b842 100644 --- a/data/enemies/z80.ani +++ b/data/enemies/z80.ani @@ -1,5 +1,5 @@ -frameWidth=16 -frameHeight=32 +frame_width=16 +frame_height=32 [animation] name=default diff --git a/data/player/player.ani b/data/player/player.ani index 289d09b..09ff274 100644 --- a/data/player/player.ani +++ b/data/player/player.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=stand diff --git a/data/player/player2.ani b/data/player/player2.ani index b6bce37..3eba37a 100644 --- a/data/player/player2.ani +++ b/data/player/player2.ani @@ -1,5 +1,5 @@ -frameWidth=8 -frameHeight=16 +frame_width=8 +frame_height=16 [animation] name=stand diff --git a/data/player/player_game_over.ani b/data/player/player_game_over.ani index 417dc3a..a975b75 100644 --- a/data/player/player_game_over.ani +++ b/data/player/player_game_over.ani @@ -1,5 +1,5 @@ -frameWidth=19 -frameHeight=18 +frame_width=19 +frame_height=18 [animation] name=default diff --git a/source/cheevos.cpp b/source/cheevos.cpp index 4783686..3977f15 100644 --- a/source/cheevos.cpp +++ b/source/cheevos.cpp @@ -1,11 +1,11 @@ #include "cheevos.h" -#include // for SDL_GetError -#include // for SDL_RWFromFile, SDL_RWclose, SDL_RWwrite -#include // for NULL -#include // for basic_ostream, operator<<, basic_ofstream -#include // for cout, cerr -#include "notifier.h" // for Notifier -#include "options.h" // for Options, options +#include // for SDL_GetError +#include // for SDL_RWFromFile, SDL_RWclose, SDL_RWwrite +#include // for NULL +#include // for basic_ostream, operator<<, basic_ofstream +#include // for cout, cerr +#include "notifier.h" // for Notifier +#include "options.h" // for Options, options // [SINGLETON] Cheevos *Cheevos::cheevos_ = nullptr; @@ -108,24 +108,24 @@ void Cheevos::invalidate(int id) // Carga el estado de los logros desde un fichero void Cheevos::loadFromFile() { - std::ifstream file(this->file_, std::ios::binary); + std::ifstream file(file_, std::ios::binary); // El fichero no existe if (!file) { if (options.console) { - std::cout << "Warning: Unable to open file! Creating new file..." << std::endl; + std::cout << "Warning: Unable to open " << file_ << "! Creating new file..." << std::endl; } // Crea el fichero en modo escritura (binario) - std::ofstream newFile(this->file_, std::ios::binary); + std::ofstream newFile(file_, std::ios::binary); if (newFile) { if (options.console) { - std::cout << "New file created!" << std::endl; + std::cout << "New " << file_ << " created!" << std::endl; } // Guarda la información @@ -138,7 +138,7 @@ void Cheevos::loadFromFile() { if (options.console) { - std::cerr << "Error: Unable to create file!" << std::endl; + std::cerr << "Error: Unable to create " << file_ << "!" << std::endl; } } } @@ -147,7 +147,7 @@ void Cheevos::loadFromFile() { if (options.console) { - std::cout << "Reading file...!" << std::endl; + std::cout << "Reading " << file_ << std::endl; } // Carga los datos diff --git a/source/director.cpp b/source/director.cpp index 721eb1f..7d21097 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -1,42 +1,42 @@ #include "director.h" -#include // for SDL_Init, SDL_Quit, SDL_INIT_EV... -#include // for AUDIO_S16 -#include // for SDL_BLENDMODE_BLEND -#include // for SDL_GetError -#include // for SDL_CONTROLLER_BUTTON_B, SDL_CO... -#include // for SDL_SetHint, SDL_HINT_RENDER_DR... -#include // for SDL_SCANCODE_A, SDL_SCANCODE_ES... -#include // for Uint32 -#include // for SDL_GetTicks -#include // for errno, EEXIST, EACCES, ENAMETOO... -#include // for printf, perror -#include // for strcmp -#include // for mkdir, stat, S_IRWXU -#include // for getuid -#include // for exit, EXIT_FAILURE, srand -#include // for basic_ostream, operator<<, cout -#include // for make_unique, unique_ptr -#include // for operator+, allocator, char_traits -#include "asset.h" // for Asset, AssetType -#include "cheevos.h" // for Cheevos -#include "credits.h" // for Credits -#include "debug.h" // for Debug -#include "defines.h" // for WINDOW_CAPTION, borderColor -#include "demo.h" // for Demo -#include "ending.h" // for Ending -#include "ending2.h" // for Ending2 -#include "game.h" // for Game -#include "game_over.h" // for GameOver -#include "input.h" // for Input, inputs_e -#include "jail_audio.h" // for JA_GetMusicState, JA_DeleteMusic -#include "loading_screen.h" // for LoadingScreen -#include "logo.h" // for Logo -#include "notifier.h" // for Notifier -#include "options.h" // for Options, options, Section, Cheat -#include "resource.h" // for Resource -#include "screen.h" // for Screen -#include "title.h" // for Title -#include "utils.h" // for Color +#include // for SDL_Init, SDL_Quit, SDL_INIT_EV... +#include // for AUDIO_S16 +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_GetError +#include // for SDL_CONTROLLER_BUTTON_B, SDL_CO... +#include // for SDL_SetHint, SDL_HINT_RENDER_DR... +#include // for SDL_SCANCODE_A, SDL_SCANCODE_ES... +#include // for Uint32 +#include // for SDL_GetTicks +#include // for errno, EEXIST, EACCES, ENAMETOO... +#include // for printf, perror +#include // for strcmp +#include // for mkdir, stat, S_IRWXU +#include // for getuid +#include // for exit, EXIT_FAILURE, srand +#include // for basic_ostream, operator<<, cout +#include // for make_unique, unique_ptr +#include // for operator+, allocator, char_traits +#include "asset.h" // for Asset, AssetType +#include "cheevos.h" // for Cheevos +#include "credits.h" // for Credits +#include "debug.h" // for Debug +#include "defines.h" // for WINDOW_CAPTION, borderColor +#include "demo.h" // for Demo +#include "ending.h" // for Ending +#include "ending2.h" // for Ending2 +#include "game.h" // for Game +#include "game_over.h" // for GameOver +#include "input.h" // for Input, inputs_e +#include "jail_audio.h" // for JA_GetMusicState, JA_DeleteMusic +#include "loading_screen.h" // for LoadingScreen +#include "logo.h" // for Logo +#include "notifier.h" // for Notifier +#include "options.h" // for Options, options, Section, Cheat +#include "resource.h" // for Resource +#include "screen.h" // for Screen +#include "title.h" // for Title +#include "utils.h" // for Color #ifndef _WIN32 #include @@ -321,7 +321,7 @@ bool Director::initSDL() const auto window_width = options.video.border.enabled ? options.game.width + options.video.border.width * 2 : options.game.width; const auto window_height = options.video.border.enabled ? options.game.height + options.video.border.height * 2 : options.game.height; - window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, SDL_WINDOW_HIDDEN); + window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width * options.window.zoom, window_height * options.window.zoom, SDL_WINDOW_HIDDEN); if (window_ == nullptr) { if (options.console) diff --git a/source/options.cpp b/source/options.cpp index c74ebfd..aa4012d 100644 --- a/source/options.cpp +++ b/source/options.cpp @@ -1,10 +1,13 @@ #include "options.h" -#include // for SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSC... -#include // for basic_ostream, operator<<, basic_ofstream -#include // for function -#include // for cout, cerr -#include // for unordered_map, operator==, _Node_const_i... -#include // for pair +#include // for SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSC... +#include // for basic_ostream, operator<<, basic_ofstream +#include // for function +#include // for cout, cerr +#include // for unordered_map, operator==, _Node_const_i... +#include // for pair +#include +#include +#include // Variables Options options; @@ -42,25 +45,35 @@ bool loadOptionsFromFile(const std::string &file_path) // Si el fichero se puede abrir if (file.good()) { - // Procesa el fichero linea a linea + // Procesa el fichero línea a línea 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) != "#") + // Elimina espacios en blanco iniciales y finales + line = std::string(std::find_if(line.begin(), line.end(), [](int ch) { return !std::isspace(ch); }), line.end()); + line.erase(std::find_if(line.rbegin(), line.rend(), [](int ch) { return !std::isspace(ch); }).base(), line.end()); + + // Ignora líneas vacías o comentarios + if (line.empty() || line[0] == '#') { - // Encuentra la posición del caracter '=' - int pos = line.find("="); - // Procesa las dos subcadenas - if (!setOptions(line.substr(0, pos), line.substr(pos + 1, line.length()))) + continue; + } + + // Usa un stringstream para dividir la línea en dos partes + std::istringstream iss(line); + std::string key, value; + + if (iss >> key >> value) + { + if (!setOptions(key, value)) { if (options.console) { std::cout << "Warning: file config.txt\n"; - std::cout << "unknown parameter " << line.substr(0, pos).c_str() << std::endl; + std::cout << "unknown parameter " << key << std::endl; } success = false; } @@ -74,8 +87,6 @@ bool loadOptionsFromFile(const std::string &file_path) } file.close(); } - - // El fichero no existe else { // Crea el fichero con los valores por defecto @@ -87,19 +98,16 @@ bool loadOptionsFromFile(const std::string &file_path) { initOptions(); saveOptionsToFile(file_path); - } - - // Normaliza los valores - if (options.video.mode != 0 && - options.video.mode != SDL_WINDOW_FULLSCREEN && - options.video.mode != SDL_WINDOW_FULLSCREEN_DESKTOP) - { - options.video.mode = 0; + if (options.console) + { + std::cout << "Wrong config file: initializing options.\n\n"; + } } return success; } + // Guarda las opciones en un fichero bool saveOptionsToFile(const std::string &file_path) { @@ -122,25 +130,38 @@ bool saveOptionsToFile(const std::string &file_path) } // Escribe en el fichero - file << "version=" << options.version << "\n"; + file << "# Versión de la configuración\n"; + file << "version " << options.version << "\n"; file << "\n## CONTROL\n"; - file << "keys=" << static_cast(options.keys) << "\n"; + file << "# Esquema de control: 0 = Cursores, 1 = OPQ, 2 = WAD\n"; + file << "keys " << static_cast(options.keys) << "\n"; file << "\n## WINDOW\n"; - file << "window.zoom=" << options.window.zoom << "\n"; + file << "# Zoom de la ventana: 1 = Normal, 2 = Doble, 3 = Triple, ...\n"; + file << "window.zoom " << options.window.zoom << "\n"; file << "\n## VIDEO\n"; - file << "video.mode=" << options.video.mode << "\n"; - file << "video.filter=" << static_cast(options.video.filter) << "\n"; - file << "video.shaders=" << boolToString(options.video.shaders) << "\n"; - file << "video.vertical_sync=" << boolToString(options.video.vertical_sync) << "\n"; - file << "video.integer_scale=" << boolToString(options.video.integer_scale) << "\n"; - file << "video.keep_aspect=" << boolToString(options.video.keep_aspect) << "\n"; - file << "video.border.enabled=" << boolToString(options.video.border.enabled) << "\n"; - file << "video.border.width=" << options.video.border.width << "\n"; - file << "video.border.height=" << options.video.border.height << "\n"; - file << "video.palette=" << static_cast(options.video.palette) << "\n"; + file << "# Modo de video: 0 = Ventana, 1 = Pantalla completa, 2 = Pantalla completa (escritorio)\n"; + file << "video.mode " << options.video.mode << "\n"; + file << "# Filtro de pantalla: 0 = Nearest, 1 = Linear\n"; + file << "video.filter " << static_cast(options.video.filter) << "\n"; + file << "# Shaders: 1 = Activado, 0 = Desactivado\n"; + file << "video.shaders " << boolToString(options.video.shaders) << "\n"; + file << "# Sincronización vertical: 1 = Activado, 0 = Desactivado\n"; + file << "video.vertical_sync " << boolToString(options.video.vertical_sync) << "\n"; + file << "# Escalado entero: 1 = Activado, 0 = Desactivado\n"; + file << "video.integer_scale " << boolToString(options.video.integer_scale) << "\n"; + file << "# Mantener aspecto: 1 = Activado, 0 = Desactivado\n"; + file << "video.keep_aspect " << boolToString(options.video.keep_aspect) << "\n"; + file << "# Borde: 1 = Activado, 0 = Desactivado\n"; + file << "video.border.enabled " << boolToString(options.video.border.enabled) << "\n"; + file << "# Ancho del borde\n"; + file << "video.border.width " << options.video.border.width << "\n"; + file << "# Alto del borde\n"; + file << "video.border.height " << options.video.border.height << "\n"; + file << "# Paleta: 0 = ZX Spectrum, 1 = ZX Arne\n"; + file << "video.palette " << static_cast(options.video.palette) << "\n"; // Cierra el fichero file.close(); @@ -156,10 +177,12 @@ bool setOptions(const std::string &var, const std::string &value) { options.version = v; }}, {"keys", [](std::string v) { options.keys = static_cast(safeStoi(v, static_cast(ControlScheme::CURSOR))); }}, - {"video.mode", [](std::string v) - { options.video.mode = safeStoi(v, 0); }}, {"window.zoom", [](std::string v) { options.window.zoom = safeStoi(v, 1); }}, + {"video.mode", [](std::string v) + { options.video.mode = safeStoi(v, 0); }}, + {"video.filter", [](std::string v) + { options.video.filter = static_cast(safeStoi(v, static_cast(DEFAULT_VIDEO_FILTER))); }}, {"video.shaders", [](std::string v) { options.video.shaders = stringToBool(v); }}, {"video.vertical_sync", [](std::string v) diff --git a/source/options.h b/source/options.h index b5683e0..59cbc40 100644 --- a/source/options.h +++ b/source/options.h @@ -72,7 +72,7 @@ constexpr NotificationPosition DEFAULT_NOTIFICATION_POSITION = NotificationPosit constexpr bool DEFAULT_NOTIFICATION_SOUND = true; // Sonido de las notificaciones por defecto const Color DEFAULT_NOTIFICATION_COLOR = Color(48, 48, 48); // Color de las notificaciones por defecto constexpr bool DEFAULT_CONSOLE = false; // Consola desactivada por defecto -constexpr std::string DEFAULT_VERSION = "v1.09"; // Versión por defecto +constexpr std::string DEFAULT_VERSION = "1.09"; // Versión por defecto // Estructura para las opciones de las notificaciones struct OptionsNotification diff --git a/source/player.cpp b/source/player.cpp index 5f437b4..cda3bdf 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -563,7 +563,7 @@ void Player::move() setState(s_standing); #ifdef DEBUG debugColor = {255, 255, 0}; - debugPoint = {(int)x + (w / 2), p}; + debugPoint = {(int)x_ + (w_ / 2), p}; #endif } else @@ -631,7 +631,7 @@ void Player::playJumpSound() } #ifdef DEBUG - debug_->add("JUMP: " + std::to_string(jumpCounter / 4)); + debug_->add("JUMP: " + std::to_string(jumping_counter_ / 4)); #endif } @@ -644,7 +644,7 @@ void Player::playFallSound() } #ifdef DEBUG - debug_->add("FALL: " + std::to_string(fallCounter / 4)); + debug_->add("FALL: " + std::to_string(falling_counter_ / 4)); #endif } diff --git a/source/resource.cpp b/source/resource.cpp index d528900..8910b50 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -57,6 +57,8 @@ void Resource::load() loadTextures(); loadTextFiles(); loadAnimations(); + loadTileMaps(); + loadRooms(); createText(); std::cout << "\n** RESOURCES LOADED" << std::endl; } @@ -277,6 +279,7 @@ void Resource::loadTileMaps() { auto name = getFileName(l); tile_maps_.emplace_back(ResourceTileMap(name, loadRoomTileFile(l))); + printWithDots("TileMap : ", name, "[ LOADED ]"); } } @@ -291,6 +294,7 @@ void Resource::loadRooms() { auto name = getFileName(l); rooms_.emplace_back(ResourceRoom(name, std::make_shared(loadRoomFile(l)))); + printWithDots("Room : ", name, "[ LOADED ]"); } }