treballant en sistema de portes i claus
This commit is contained in:
@@ -11,24 +11,24 @@
|
||||
#include <iostream> // Para cout
|
||||
#include <set> // Para set
|
||||
|
||||
#include "core/input/mouse.hpp" // Para Mouse
|
||||
#include "core/rendering/render_info.hpp" // Para RenderInfo
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List
|
||||
#include "core/resources/resource_types.hpp" // Para RoomResource
|
||||
#include "game/editor/editor_statusbar.hpp" // Para EditorStatusBar
|
||||
#include "game/editor/room_saver.hpp" // Para RoomSaver
|
||||
#include "game/entities/player.hpp" // Para Player
|
||||
#include "game/game_control.hpp" // Para GameControl
|
||||
#include "game/gameplay/enemy_manager.hpp" // Para EnemyManager
|
||||
#include "game/gameplay/item_manager.hpp" // Para ItemManager
|
||||
#include "game/gameplay/platform_manager.hpp" // Para PlatformManager
|
||||
#include "game/gameplay/room.hpp" // Para Room
|
||||
#include "game/options.hpp" // Para Options
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea
|
||||
#include "core/input/mouse.hpp" // Para Mouse
|
||||
#include "core/rendering/render_info.hpp" // Para RenderInfo
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List
|
||||
#include "core/resources/resource_types.hpp" // Para RoomResource
|
||||
#include "game/editor/editor_statusbar.hpp" // Para EditorStatusBar
|
||||
#include "game/editor/room_saver.hpp" // Para RoomSaver
|
||||
#include "game/entities/player.hpp" // Para Player
|
||||
#include "game/game_control.hpp" // Para GameControl
|
||||
#include "game/gameplay/enemy_manager.hpp" // Para EnemyManager
|
||||
#include "game/gameplay/item_manager.hpp" // Para ItemManager
|
||||
#include "game/gameplay/platform_manager.hpp" // Para PlatformManager
|
||||
#include "game/gameplay/room.hpp" // Para Room
|
||||
#include "game/options.hpp" // Para Options
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Singleton
|
||||
@@ -912,19 +912,27 @@ auto MapEditor::pointInRect(float px, float py, const SDL_FRect& rect) -> bool {
|
||||
|
||||
auto MapEditor::entityCount(EntityType type) const -> int {
|
||||
switch (type) {
|
||||
case EntityType::ENEMY: return room_->getEnemyManager()->getCount();
|
||||
case EntityType::ITEM: return room_->getItemManager()->getCount();
|
||||
case EntityType::PLATFORM: return room_->getPlatformManager()->getCount();
|
||||
default: return 0;
|
||||
case EntityType::ENEMY:
|
||||
return room_->getEnemyManager()->getCount();
|
||||
case EntityType::ITEM:
|
||||
return room_->getItemManager()->getCount();
|
||||
case EntityType::PLATFORM:
|
||||
return room_->getPlatformManager()->getCount();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
auto MapEditor::entityRect(EntityType type, int index) -> SDL_FRect {
|
||||
switch (type) {
|
||||
case EntityType::ENEMY: return room_->getEnemyManager()->getEnemy(index)->getRect();
|
||||
case EntityType::ITEM: return room_->getItemManager()->getItem(index)->getCollider();
|
||||
case EntityType::PLATFORM: return room_->getPlatformManager()->getPlatform(index)->getRect();
|
||||
default: return {};
|
||||
case EntityType::ENEMY:
|
||||
return room_->getEnemyManager()->getEnemy(index)->getRect();
|
||||
case EntityType::ITEM:
|
||||
return room_->getItemManager()->getItem(index)->getCollider();
|
||||
case EntityType::PLATFORM:
|
||||
return room_->getPlatformManager()->getPlatform(index)->getRect();
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,37 +946,49 @@ auto MapEditor::entityBoundaries(EntityType type, int index) const -> BoundaryDa
|
||||
const auto& e = room_data_.enemies[index];
|
||||
return {e.x1, e.y1, e.x2, e.y2};
|
||||
}
|
||||
default: return {};
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
auto MapEditor::entityPosition(EntityType type, int index) const -> std::pair<float, float> {
|
||||
switch (type) {
|
||||
case EntityType::ENEMY: return {room_data_.enemies[index].x, room_data_.enemies[index].y};
|
||||
case EntityType::ITEM: return {room_data_.items[index].x, room_data_.items[index].y};
|
||||
case EntityType::ENEMY:
|
||||
return {room_data_.enemies[index].x, room_data_.enemies[index].y};
|
||||
case EntityType::ITEM:
|
||||
return {room_data_.items[index].x, room_data_.items[index].y};
|
||||
case EntityType::PLATFORM: {
|
||||
const auto& path = room_data_.platforms[index].path;
|
||||
return path.empty() ? std::pair{0.0F, 0.0F} : std::pair{path[0].x, path[0].y};
|
||||
}
|
||||
default: return {0.0F, 0.0F};
|
||||
default:
|
||||
return {0.0F, 0.0F};
|
||||
}
|
||||
}
|
||||
|
||||
auto MapEditor::entityDataCount(EntityType type) const -> int {
|
||||
switch (type) {
|
||||
case EntityType::ENEMY: return static_cast<int>(room_data_.enemies.size());
|
||||
case EntityType::ITEM: return static_cast<int>(room_data_.items.size());
|
||||
case EntityType::PLATFORM: return static_cast<int>(room_data_.platforms.size());
|
||||
default: return 0;
|
||||
case EntityType::ENEMY:
|
||||
return static_cast<int>(room_data_.enemies.size());
|
||||
case EntityType::ITEM:
|
||||
return static_cast<int>(room_data_.items.size());
|
||||
case EntityType::PLATFORM:
|
||||
return static_cast<int>(room_data_.platforms.size());
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
auto MapEditor::entityLabel(EntityType type) -> const char* {
|
||||
switch (type) {
|
||||
case EntityType::ENEMY: return "enemy";
|
||||
case EntityType::ITEM: return "item";
|
||||
case EntityType::PLATFORM: return "platform";
|
||||
default: return "none";
|
||||
case EntityType::ENEMY:
|
||||
return "enemy";
|
||||
case EntityType::ITEM:
|
||||
return "item";
|
||||
case EntityType::PLATFORM:
|
||||
return "platform";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1226,10 +1246,14 @@ void MapEditor::updateStatusBarInfo() { // NOLINT(readability-function-cognitiv
|
||||
// Devuelve las propiedades válidas de SET según la selección actual
|
||||
auto MapEditor::getSetCompletions() const -> std::vector<std::string> {
|
||||
switch (selection_.type) {
|
||||
case EntityType::ENEMY: return {"ANIMATION", "VX", "VY", "FLIP", "MIRROR"};
|
||||
case EntityType::ITEM: return {"TILE", "COUNTER"};
|
||||
case EntityType::PLATFORM: return {"ANIMATION", "SPEED", "LOOP", "EASING"};
|
||||
default: return {"ITEMCOLOR1", "ITEMCOLOR2", "CONVEYOR", "TILESET", "UP", "DOWN", "LEFT", "RIGHT"};
|
||||
case EntityType::ENEMY:
|
||||
return {"ANIMATION", "VX", "VY", "FLIP", "MIRROR"};
|
||||
case EntityType::ITEM:
|
||||
return {"TILE", "COUNTER"};
|
||||
case EntityType::PLATFORM:
|
||||
return {"ANIMATION", "SPEED", "LOOP", "EASING"};
|
||||
default:
|
||||
return {"ITEMCOLOR1", "ITEMCOLOR2", "CONVEYOR", "TILESET", "UP", "DOWN", "LEFT", "RIGHT"};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1935,8 +1959,7 @@ auto MapEditor::addPlatform() -> std::string {
|
||||
constexpr float ROUTE_HALF = 2.0F * Tile::SIZE;
|
||||
new_platform.path = {
|
||||
{CENTER_X - ROUTE_HALF, CENTER_Y, 0.0F},
|
||||
{CENTER_X + ROUTE_HALF, CENTER_Y, 0.0F}
|
||||
};
|
||||
{CENTER_X + ROUTE_HALF, CENTER_Y, 0.0F}};
|
||||
|
||||
room_data_.platforms.push_back(new_platform);
|
||||
room_->getPlatformManager()->addPlatform(std::make_shared<MovingPlatform>(new_platform));
|
||||
|
||||
Reference in New Issue
Block a user