fase 5 de zones
This commit is contained in:
@@ -80,7 +80,6 @@ assets:
|
|||||||
# TILESETS
|
# TILESETS
|
||||||
tilesets:
|
tilesets:
|
||||||
BITMAP:
|
BITMAP:
|
||||||
- ${PREFIX}/data/tilesets/standard.gif
|
|
||||||
- ${PREFIX}/data/tilesets/neighborhood.gif
|
- ${PREFIX}/data/tilesets/neighborhood.gif
|
||||||
- ${PREFIX}/data/tilesets/cave.gif
|
- ${PREFIX}/data/tilesets/cave.gif
|
||||||
- ${PREFIX}/data/tilesets/collision.gif
|
- ${PREFIX}/data/tilesets/collision.gif
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
@@ -338,8 +338,11 @@ namespace Resource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconfigura el color transparente de algunas surfaces
|
// Reconfigura el color transparente de las surfaces de tilesets de zona.
|
||||||
getSurface("standard.gif")->setTransparentColor(16);
|
// Los tilesets del juego usan el índice 16 como transparente (las surfaces
|
||||||
|
// arrancan con 0 por defecto; los tilesets lo marcan a 16).
|
||||||
|
getSurface("neighborhood.gif")->setTransparentColor(16);
|
||||||
|
getSurface("cave.gif")->setTransparentColor(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carga las paletas
|
// Carga las paletas
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include "game/gameplay/item_manager.hpp" // Para ItemManager
|
#include "game/gameplay/item_manager.hpp" // Para ItemManager
|
||||||
#include "game/gameplay/platform_manager.hpp" // Para PlatformManager
|
#include "game/gameplay/platform_manager.hpp" // Para PlatformManager
|
||||||
#include "game/gameplay/room.hpp" // Para Room
|
#include "game/gameplay/room.hpp" // Para Room
|
||||||
|
#include "game/gameplay/zone.hpp" // Para Zone::Data
|
||||||
|
#include "game/gameplay/zone_manager.hpp" // Para ZoneManager
|
||||||
#include "game/options.hpp" // Para Options
|
#include "game/options.hpp" // Para Options
|
||||||
#include "game/ui/console.hpp" // Para Console
|
#include "game/ui/console.hpp" // Para Console
|
||||||
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea
|
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea
|
||||||
@@ -1214,7 +1216,9 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv
|
|||||||
conv = "right";
|
conv = "right";
|
||||||
}
|
}
|
||||||
|
|
||||||
line2 = "zone:" + room_data_.zone + " conv:" + conv;
|
std::string ts_marker = room_data_.tile_set_overridden ? " (ts*)" : "";
|
||||||
|
std::string mu_marker = room_data_.music_overridden ? " (mu*)" : "";
|
||||||
|
line2 = "zone:" + room_data_.zone + ts_marker + mu_marker + " conv:" + conv;
|
||||||
line3 = "u:" + conn(room_data_.upper_room) + " d:" + conn(room_data_.lower_room) +
|
line3 = "u:" + conn(room_data_.upper_room) + " d:" + conn(room_data_.lower_room) +
|
||||||
" l:" + conn(room_data_.left_room) + " r:" + conn(room_data_.right_room) +
|
" l:" + conn(room_data_.left_room) + " r:" + conn(room_data_.right_room) +
|
||||||
" itm:" + std::to_string(room_data_.item_color1) + "/" + std::to_string(room_data_.item_color2);
|
" itm:" + std::to_string(room_data_.item_color1) + "/" + std::to_string(room_data_.item_color2);
|
||||||
@@ -1460,15 +1464,64 @@ auto MapEditor::setRoomProperty(const std::string& property, const std::string&
|
|||||||
return "conveyor: " + val;
|
return "conveyor: " + val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property == "ZONE") {
|
||||||
|
const Zone::Data* zone = ZoneManager::get()->getZone(val);
|
||||||
|
if (zone == nullptr) { return "Unknown zone: " + val; }
|
||||||
|
room_data_.zone = val;
|
||||||
|
// Si no hay overrides, propagar el tileset y la música de la nueva zona
|
||||||
|
if (!room_data_.tile_set_overridden) {
|
||||||
|
room_data_.tile_set_file = zone->tile_set_file;
|
||||||
|
room_->setTileSet(zone->tile_set_file);
|
||||||
|
}
|
||||||
|
if (!room_data_.music_overridden) {
|
||||||
|
room_data_.music = zone->music;
|
||||||
|
}
|
||||||
|
autosave();
|
||||||
|
return "zone: " + val;
|
||||||
|
}
|
||||||
|
|
||||||
if (property == "TILESET") {
|
if (property == "TILESET") {
|
||||||
|
// "reset" / "none" limpia el override y vuelve a heredar de la zona
|
||||||
|
if (val == "reset" || val == "none") {
|
||||||
|
room_data_.tile_set_overridden = false;
|
||||||
|
const Zone::Data* zone = ZoneManager::get()->getZone(room_data_.zone);
|
||||||
|
if (zone != nullptr) {
|
||||||
|
room_data_.tile_set_file = zone->tile_set_file;
|
||||||
|
room_->setTileSet(zone->tile_set_file);
|
||||||
|
}
|
||||||
|
autosave();
|
||||||
|
return "tileset: (inherit from zone)";
|
||||||
|
}
|
||||||
std::string tileset = val;
|
std::string tileset = val;
|
||||||
if (tileset.find('.') == std::string::npos) { tileset += ".gif"; }
|
if (tileset.find('.') == std::string::npos) { tileset += ".gif"; }
|
||||||
room_data_.tile_set_file = tileset;
|
room_data_.tile_set_file = tileset;
|
||||||
|
room_data_.tile_set_overridden = true;
|
||||||
room_->setTileSet(tileset);
|
room_->setTileSet(tileset);
|
||||||
autosave();
|
autosave();
|
||||||
return "tileset: " + tileset;
|
return "tileset: " + tileset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property == "MUSIC") {
|
||||||
|
// "reset" / "none" limpia el override y vuelve a heredar de la zona
|
||||||
|
if (val == "reset" || val == "none") {
|
||||||
|
room_data_.music_overridden = false;
|
||||||
|
const Zone::Data* zone = ZoneManager::get()->getZone(room_data_.zone);
|
||||||
|
if (zone != nullptr) {
|
||||||
|
room_data_.music = zone->music;
|
||||||
|
}
|
||||||
|
autosave();
|
||||||
|
return "music: (inherit from zone)";
|
||||||
|
}
|
||||||
|
// Nota: el valor se guarda tal cual (case-sensitive). val ya está en lower.
|
||||||
|
// Usamos el value original para respetar mayúsculas del nombre del fichero.
|
||||||
|
std::string music = value;
|
||||||
|
if (music.find('.') == std::string::npos) { music += ".ogg"; }
|
||||||
|
room_data_.music = music;
|
||||||
|
room_data_.music_overridden = true;
|
||||||
|
autosave();
|
||||||
|
return "music: " + music;
|
||||||
|
}
|
||||||
|
|
||||||
// Conexiones: UP, DOWN, LEFT, RIGHT
|
// Conexiones: UP, DOWN, LEFT, RIGHT
|
||||||
if (property == "UP" || property == "DOWN" || property == "LEFT" || property == "RIGHT") {
|
if (property == "UP" || property == "DOWN" || property == "LEFT" || property == "RIGHT") {
|
||||||
std::string connection = "0";
|
std::string connection = "0";
|
||||||
@@ -1567,7 +1620,7 @@ auto MapEditor::setRoomProperty(const std::string& property, const std::string&
|
|||||||
return toLower(property) + ": " + connection;
|
return toLower(property) + ": " + connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown property: " + property + " (use: itemcolor1, itemcolor2, conveyor, tileset, up, down, left, right)";
|
return "Unknown property: " + property + " (use: zone, itemcolor1, itemcolor2, conveyor, tileset, music, up, down, left, right)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea una nueva habitación
|
// Crea una nueva habitación
|
||||||
|
|||||||
@@ -43,8 +43,19 @@ auto RoomSaver::buildYAML(const fkyaml::node& original_yaml, const Room::Data& r
|
|||||||
// --- Sección room ---
|
// --- Sección room ---
|
||||||
out << "room:\n";
|
out << "room:\n";
|
||||||
|
|
||||||
|
// zone es siempre obligatoria
|
||||||
|
out << " zone: " << room_data.zone << "\n";
|
||||||
|
|
||||||
// bgColor ya no se escribe en el YAML
|
// bgColor ya no se escribe en el YAML
|
||||||
out << " tileSetFile: " << room_data.tile_set_file << "\n";
|
// tileSetFile solo si es override explícito del valor heredado de la zona
|
||||||
|
if (room_data.tile_set_overridden) {
|
||||||
|
out << " tileSetFile: " << room_data.tile_set_file << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// music solo si es override explícito del valor heredado de la zona
|
||||||
|
if (room_data.music_overridden) {
|
||||||
|
out << " music: " << room_data.music << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Conexiones
|
// Conexiones
|
||||||
out << "\n";
|
out << "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user