mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 11:34:46 +00:00
fix before merge (develop => map_generator)
This commit is contained in:
+26
-29
@@ -7,100 +7,97 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include <algorithm>
|
||||
#include <Component/Renderer/Drawable3DComponent.hpp>
|
||||
#include <System/Renderer/Renderer3DSystem.hpp>
|
||||
#include <Scene/Scene.hpp>
|
||||
#include <Component/Component.hpp>
|
||||
//#include "Component/Collider/ColliderComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "System/Renderer/Renderer3DSystem.hpp"
|
||||
#include "Scene/Scene.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
#include "Component/Component.hpp"
|
||||
#include "Component/Position/PositionComponent.hpp"
|
||||
#include "Component/Movable/MovableComponent.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
|
||||
class Map
|
||||
class MapGenerator
|
||||
{
|
||||
private:
|
||||
using MapElem = void (Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
//! @brief Enum of the block available.
|
||||
enum BlockType {
|
||||
NOTHING,
|
||||
BREAKABLE,
|
||||
UNBREAKABLE,
|
||||
HOLE,
|
||||
BUMPER,
|
||||
STAIRS,
|
||||
SPAWNER,
|
||||
END
|
||||
UNBREAKABLE
|
||||
};
|
||||
|
||||
//! @param seed seed to generate random block type
|
||||
//! @param blockCreated block created since the beginning
|
||||
//! @brief Generate random block type
|
||||
static BlockType getRandomBlockType(int seed, int blockCreated);
|
||||
static BlockType getRandomBlockType();
|
||||
|
||||
//! @param map ASCII map
|
||||
//! @param x x index on the block
|
||||
//! @param y y index on the block
|
||||
//! @param z z index on the block
|
||||
//! @param blockType blockType to compare with position
|
||||
static bool isBlockCloseToBlockType(std::map<std::tuple<int, int>, BlockType> map, int x, int y, BlockType blockType);
|
||||
|
||||
static bool isCloseToBlockType(std::map<std::tuple<int, int>, BlockType> map, int x, int z, BlockType blockType);
|
||||
|
||||
//! @param width Width of the map
|
||||
//! @param height Height of the map
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Generate the unbreakable block of the map
|
||||
static void generateUnbreakableBlock(int width, int height, std::shared_ptr<WAL::Scene> scene);
|
||||
//! @param width Width of the map
|
||||
//! @param height Height of the map
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Generate the wall of the map
|
||||
static void generateWall(int width, int height, std::shared_ptr<WAL::Scene> scene);
|
||||
static void generateWall(int width, int height, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param width Width of the map
|
||||
//! @param height Height of the map
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Generate the floor of the map
|
||||
static void generateFloor(int width, int height, std::shared_ptr<WAL::Scene> scene);
|
||||
static void generateFloor(int width, int height, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create element of the map
|
||||
static void createElement(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene, BlockType blockType);
|
||||
static void createElement(Vector3f coords, std::shared_ptr<WAL::Scene> scene, BlockType blockType);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create breakable of the map
|
||||
static void createBreakable(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene);
|
||||
static void createBreakable(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create unbreakable of the map
|
||||
static void createUnbreakable(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene);
|
||||
static void createUnbreakable(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create hole of the map
|
||||
static void createHole(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene);
|
||||
static void createHole(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create bumper of the map
|
||||
static void createBumper(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene);
|
||||
static void createBumper(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
//! @param coords coords of the element
|
||||
//! @param size size of the element
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Create stair of the map
|
||||
static void createStairs(Vector3f coords, Vector3f size, std::shared_ptr<WAL::Scene> scene);
|
||||
static void createStairs(Vector3f coords, std::shared_ptr<WAL::Scene> scene);
|
||||
public:
|
||||
//! @param width Width of the map
|
||||
//! @param height Height of the map
|
||||
//! @param scene Scene where the map is instanced
|
||||
//! @brief Generate the map
|
||||
static void generateMap(int width, int height, int seed, std::shared_ptr<WAL::Scene> scene);
|
||||
static void generateMap(int width, int height, int seed, std::shared_ptr<WAL::Scene> scene);
|
||||
|
||||
};
|
||||
} // namespace BBM
|
||||
Reference in New Issue
Block a user