Revert "skins: SkinManager + hot-swap (F7), classic/nes a data/skins/"

This reverts commit ebfcad6f22.
This commit is contained in:
2026-05-18 16:39:59 +02:00
parent ebfcad6f22
commit a8c0386355
125 changed files with 76 additions and 962 deletions
+53 -72
View File
@@ -26,7 +26,6 @@
#include "core/resources/asset.h" // for Asset, Asset::Type
#include "core/resources/resource.h"
#include "core/resources/resource_helper.h"
#include "core/resources/skin_manager.hpp"
#include "game/defaults.hpp" // for SECTION_PROG_LOGO, GAMECANVAS_H...
#include "game/game.h" // for Game
#include "game/options.hpp" // for Options::init, loadFromFile...
@@ -107,22 +106,6 @@ Director::Director(int argc, const char *argv[]) {
Asset::init(executable_path_);
Asset::get()->setVerbose(Options::settings.console);
// Inicialitza el gestor de skins ANTES de registrar assets: setFileList
// composa els paths gfx via SkinManager::gfxPath(). Si la skin del config
// no existeix, caiem a "classic".
#ifdef MACOS_BUNDLE
SkinManager::init(executable_path_, "/../Resources");
#else
SkinManager::init(executable_path_, "");
#endif
if (!SkinManager::get()->exists(Options::settings.skin)) {
if (Options::settings.console) {
std::cout << "Skin '" << Options::settings.skin << "' not found, falling back to 'classic'.\n";
}
Options::settings.skin = "classic";
}
SkinManager::get()->setCurrent(Options::settings.skin);
// Si falta algún fichero no inicia el programa
if (!setFileList()) {
exit(EXIT_FAILURE);
@@ -201,7 +184,6 @@ Director::~Director() {
Resource::destroy();
Asset::destroy();
SkinManager::destroy();
Input::destroy();
Lang::destroy();
delete section_;
@@ -249,7 +231,6 @@ void Director::initInput() {
Input::get()->bindKey(Input::Action::TOGGLE_SHADER, SDL_SCANCODE_F4);
Input::get()->bindKey(Input::Action::TOGGLE_SHADER_TYPE, SDL_SCANCODE_F5);
Input::get()->bindKey(Input::Action::NEXT_SHADER_PRESET, SDL_SCANCODE_F6);
Input::get()->bindKey(Input::Action::NEXT_SKIN, SDL_SCANCODE_F7);
// Mando - Movimiento del jugador
Input::get()->bindGameControllerButton(Input::Action::UP, SDL_GAMEPAD_BUTTON_DPAD_UP);
@@ -382,66 +363,66 @@ auto Director::setFileList() -> bool {
Asset::get()->add(PREFIX + "/data/sound/clock.wav", Asset::Type::SOUND);
Asset::get()->add(PREFIX + "/data/sound/powerball.wav", Asset::Type::SOUND);
// Texturas (skin-aware: viuen sota data/skins/<skin>/gfx/)
Asset::get()->addSkinAware("balloon1.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("balloon1.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("balloon2.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("balloon2.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("balloon3.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("balloon3.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("balloon4.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("balloon4.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("bullet.png", Asset::Type::BITMAP);
// Texturas
Asset::get()->add(PREFIX + "/data/gfx/balloon1.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/balloon1.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/balloon2.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/balloon2.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/balloon3.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/balloon3.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/balloon4.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/balloon4.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/bullet.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_buildings.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_clouds.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_grass.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_power_meter.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_sky_colors.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("game_text.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_buildings.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_clouds.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_grass.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_power_meter.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_sky_colors.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/game_text.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("intro.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("logo.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("menu_game_over.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("menu_game_over_end.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/intro.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/logo.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/menu_game_over.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/menu_game_over_end.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_points1_disk.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_points1_disk.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("item_points2_gavina.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_points2_gavina.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("item_points3_pacmar.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_points3_pacmar.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("item_clock.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_clock.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("item_coffee.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_coffee.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("item_coffee_machine.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("item_coffee_machine.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_points1_disk.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_points1_disk.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_points2_gavina.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_points2_gavina.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_points3_pacmar.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_points3_pacmar.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_clock.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_clock.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_coffee.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_coffee.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/item_coffee_machine.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/item_coffee_machine.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("title_bg_tile.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("title_coffee.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("title_crisis.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("title_dust.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("title_dust.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("title_gradient.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/title_bg_tile.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/title_coffee.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/title_crisis.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/title_dust.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/title_dust.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/title_gradient.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_head.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("player_body.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("player_legs.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("player_death.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("player_fire.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/player_head.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/player_body.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/player_legs.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/player_death.ani", Asset::Type::DATA);
Asset::get()->add(PREFIX + "/data/gfx/player_fire.ani", Asset::Type::DATA);
Asset::get()->addSkinAware("player_bal1_head.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_bal1_body.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_bal1_legs.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_bal1_death.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_bal1_fire.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_bal1_head.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_bal1_body.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_bal1_legs.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_bal1_death.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_bal1_fire.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_arounder_head.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_arounder_body.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_arounder_legs.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_arounder_death.png", Asset::Type::BITMAP);
Asset::get()->addSkinAware("player_arounder_fire.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_arounder_head.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_arounder_body.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_arounder_legs.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_arounder_death.png", Asset::Type::BITMAP);
Asset::get()->add(PREFIX + "/data/gfx/player_arounder_fire.png", Asset::Type::BITMAP);
// Fuentes
Asset::get()->add(PREFIX + "/data/font/8bithud.png", Asset::Type::FONT);