granera con sarna no pica

This commit is contained in:
2026-04-08 11:07:50 +02:00
parent d70edb29e7
commit 87cc58b5dd
29 changed files with 104 additions and 244 deletions

View File

@@ -204,7 +204,6 @@ void MapEditor::enter(std::shared_ptr<Room> room, std::shared_ptr<Player> player
// Forzar invencibilidad
Options::cheats.invincible = Options::Cheat::State::ENABLED;
player_->setColor();
// Aplicar el setting de render_info del editor
if (settings_.show_render_info != RenderInfo::get()->isActive()) {
@@ -246,7 +245,6 @@ void MapEditor::exit() {
if (!reenter_) {
// Solo restaurar en el exit final (no en cambio de room)
Options::cheats.invincible = invincible_before_editor_;
player_->setColor();
if (RenderInfo::get()->isActive() != render_info_before_editor_) {
RenderInfo::get()->toggle();
@@ -969,7 +967,7 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv
auto dot = anim.rfind('.');
if (dot != std::string::npos) { anim = anim.substr(0, dot); }
line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim + " c:" + std::to_string(e.color);
line2 = "enemy " + std::to_string(selected_enemy_) + ": " + anim;
line3 = "vx:" + std::to_string(static_cast<int>(e.vx)) +
" vy:" + std::to_string(static_cast<int>(e.vy));
if (e.flip) { line3 += " flip"; }
@@ -1032,7 +1030,7 @@ auto MapEditor::getSetCompletions() const -> std::vector<std::string> {
return {"TILE", "COUNTER"};
}
// Room
return {"BGCOLOR", "ITEMCOLOR1", "ITEMCOLOR2", "CONVEYOR", "TILESET", "UP", "DOWN", "LEFT", "RIGHT"};
return {"ITEMCOLOR1", "ITEMCOLOR2", "CONVEYOR", "TILESET", "UP", "DOWN", "LEFT", "RIGHT"};
}
// Modifica una propiedad del enemigo seleccionado
@@ -1062,21 +1060,7 @@ auto MapEditor::setEnemyProperty(const std::string& property, const std::string&
}
if (property == "COLOR") {
auto color = static_cast<Uint8>(safeStoi(value, 14));
// Intentar recrear el enemigo con el nuevo color
Uint8 old_color = enemy.color;
enemy.color = color;
try {
auto* enemy_mgr = room_->getEnemyManager();
enemy_mgr->getEnemy(selected_enemy_) = std::make_shared<Enemy>(enemy);
} catch (const std::exception& e) {
enemy.color = old_color;
return std::string("Error: ") + e.what();
}
autosave();
return "color: " + std::to_string(color);
return "color property removed (legacy)";
}
if (property == "VX") {
@@ -1154,7 +1138,6 @@ auto MapEditor::addEnemy() -> std::string {
new_enemy.y1 = static_cast<int>(CENTER_Y);
new_enemy.x2 = static_cast<int>(CENTER_X + ROUTE_HALF);
new_enemy.y2 = static_cast<int>(CENTER_Y);
new_enemy.color = 14;
new_enemy.flip = true;
new_enemy.frame = -1;