mirror of
https://github.com/Relintai/world_generator.git
synced 2025-04-17 21:36:38 +02:00
Clang format everything.
This commit is contained in:
parent
459538d6b9
commit
e5f5d205f8
@ -281,21 +281,20 @@ void BiomeData::set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces)
|
||||
#endif
|
||||
|
||||
BiomeData::BiomeData() {
|
||||
|
||||
}
|
||||
BiomeData::~BiomeData() {
|
||||
_dungeon_datas.clear();
|
||||
_prop_datas.clear();
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void BiomeData::_bind_methods() {
|
||||
@ -341,7 +340,7 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_datas", "prop_datas"), &BiomeData::set_prop_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:WorldGeneratorPropData", PROPERTY_USAGE_DEFAULT, "WorldGeneratorPropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &BiomeData::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &BiomeData::set_entity_data);
|
||||
@ -352,9 +351,9 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &BiomeData::get_entity_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_datas", "entity_datas"), &BiomeData::set_entity_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &BiomeData::get_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &BiomeData::set_environment_data);
|
||||
@ -387,5 +386,5 @@ void BiomeData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &BiomeData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &BiomeData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
#ifndef dungeon_data_H
|
||||
#define dungeon_data_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/resource.h"
|
||||
#include "core/script_language.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../main/biome.h"
|
||||
#include "dungeon_data.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxel_surface.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
class BiomeData : public Resource {
|
||||
GDCLASS(BiomeData, Resource);
|
||||
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
@ -60,7 +60,7 @@ public:
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
@ -70,9 +70,9 @@ public:
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
void set_entity_datas(const Vector<Variant> &entity_datas);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
@ -102,7 +102,7 @@ public:
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
BiomeData();
|
||||
~BiomeData();
|
||||
@ -122,15 +122,15 @@ private:
|
||||
Vector<Ref<DungeonData> > _dungeon_datas;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,6 @@ DungeonCorridorData::DungeonCorridorData() {
|
||||
_max_connections = 2;
|
||||
}
|
||||
DungeonCorridorData::~DungeonCorridorData() {
|
||||
|
||||
}
|
||||
|
||||
void DungeonCorridorData::_bind_methods() {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class DungeonCorridorData : public DungeonRoomData {
|
||||
GDCLASS(DungeonCorridorData, DungeonRoomData);
|
||||
|
||||
|
||||
public:
|
||||
int get_max_connections();
|
||||
void set_max_connections(int value);
|
||||
|
@ -412,24 +412,24 @@ DungeonData::DungeonData() {
|
||||
_max_room_count = 0;
|
||||
}
|
||||
DungeonData::~DungeonData() {
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_dungeon_room_datas.clear();
|
||||
_dungeon_start_room_datas.clear();
|
||||
_dungeon_end_room_datas.clear();
|
||||
_dungeon_corridor_datas.clear();
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_entity_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DungeonData::_bind_methods() {
|
||||
@ -524,7 +524,7 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_dungeon_corridor_datas", "dungeon_corridor_datas"), &DungeonData::set_dungeon_corridor_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "dungeon_corridor_datas", PROPERTY_HINT_NONE, "17/17:DungeonCorridorData", PROPERTY_USAGE_DEFAULT, "DungeonCorridorData"), "set_dungeon_corridor_datas", "get_dungeon_corridor_datas");
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &DungeonData::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonData::set_entity_data);
|
||||
@ -535,9 +535,9 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &DungeonData::get_entity_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_datas", "entity_datas"), &DungeonData::set_entity_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &DungeonData::get_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &DungeonData::set_environment_data);
|
||||
@ -570,5 +570,5 @@ void DungeonData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -2,17 +2,17 @@
|
||||
#define DUNGEON_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../main/dungeon.h"
|
||||
#include "dungeon_room_data.h"
|
||||
#include "dungeon_corridor_data.h"
|
||||
#include "dungeon_room_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxel_surface.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
class DungeonData : public Resource {
|
||||
GDCLASS(DungeonData, Resource);
|
||||
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
@ -59,7 +59,7 @@ public:
|
||||
int get_max_room_count();
|
||||
void set_max_room_count(int value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
@ -69,7 +69,7 @@ public:
|
||||
|
||||
Vector<Variant> get_environment_datas();
|
||||
void set_environment_datas(const Vector<Variant> &environment_datas);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Rooms
|
||||
Ref<DungeonRoomData> get_dungeon_room_data(const int index) const;
|
||||
@ -111,7 +111,7 @@ public:
|
||||
Vector<Variant> get_dungeon_corridor_datas();
|
||||
void set_dungeon_corridor_datas(const Vector<Variant> &dungeon_corridor_datas);
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
@ -121,9 +121,9 @@ public:
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
void set_entity_datas(const Vector<Variant> &entity_datas);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Surfaces
|
||||
Ref<VoxelSurface> get_voxel_surface(const int index) const;
|
||||
void set_voxel_surface(const int index, const Ref<VoxelSurface> voxel_surface);
|
||||
@ -143,7 +143,7 @@ public:
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DungeonData();
|
||||
~DungeonData();
|
||||
@ -168,23 +168,23 @@ private:
|
||||
int _min_room_count;
|
||||
int _max_room_count;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_room_datas;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_start_room_datas;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_end_room_datas;
|
||||
Vector<Ref<DungeonRoomData> > _dungeon_corridor_datas;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -279,15 +279,15 @@ DungeonRoomData::DungeonRoomData() {
|
||||
DungeonRoomData::~DungeonRoomData() {
|
||||
_prop_datas.clear();
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DungeonRoomData::_bind_methods() {
|
||||
@ -340,7 +340,7 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_prop_datas", "prop_datas"), &DungeonRoomData::set_prop_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "prop_datas", PROPERTY_HINT_NONE, "17/17:WorldGeneratorPropData", PROPERTY_USAGE_DEFAULT, "WorldGeneratorPropData"), "set_prop_datas", "get_prop_datas");
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &DungeonRoomData::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonRoomData::set_entity_data);
|
||||
@ -351,9 +351,9 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_datas"), &DungeonRoomData::get_entity_datas);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_datas", "entity_datas"), &DungeonRoomData::set_entity_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "entity_datas", PROPERTY_HINT_NONE, "17/17:EntityData", PROPERTY_USAGE_DEFAULT, "EntityData"), "set_entity_datas", "get_entity_datas");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &DungeonRoomData::get_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &DungeonRoomData::set_environment_data);
|
||||
@ -386,5 +386,5 @@ void DungeonRoomData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &DungeonRoomData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &DungeonRoomData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define DUNGEON_ROOM_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "../main/dungeon_room.h"
|
||||
#include "world_generator_prop_data.h"
|
||||
@ -13,13 +13,13 @@
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxel_surface.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#endif
|
||||
|
||||
class DungeonRoomData : public Resource {
|
||||
GDCLASS(DungeonRoomData, Resource);
|
||||
|
||||
|
||||
public:
|
||||
String get_target_class_name();
|
||||
void set_target_class_name(String name);
|
||||
@ -60,7 +60,7 @@ public:
|
||||
Vector<Variant> get_prop_datas();
|
||||
void set_prop_datas(const Vector<Variant> &prop_datas);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//TOO: Environments are useful for every game, this should be decoupled from voxelman.
|
||||
|
||||
//Environments
|
||||
@ -92,11 +92,11 @@ public:
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
#else
|
||||
//TODO Create generic binds
|
||||
#endif
|
||||
#else
|
||||
//TODO Create generic binds
|
||||
#endif
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
@ -106,7 +106,7 @@ public:
|
||||
|
||||
Vector<Variant> get_entity_datas();
|
||||
void set_entity_datas(const Vector<Variant> &entity_datas);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DungeonRoomData();
|
||||
~DungeonRoomData();
|
||||
@ -130,15 +130,15 @@ private:
|
||||
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -121,7 +121,6 @@ void PlanetData::set_environment_datas(const Vector<Variant> &environment_datas)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// Surfaces ////
|
||||
Ref<VoxelSurface> PlanetData::get_voxel_surface(const int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _voxel_surfaces.size(), Ref<VoxelSurface>());
|
||||
@ -210,11 +209,11 @@ PlanetData::~PlanetData() {
|
||||
|
||||
_biome_datas.clear();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment_datas.clear();
|
||||
_voxel_surfaces.clear();
|
||||
_liquid_voxel_surfaces.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlanetData::_bind_methods() {
|
||||
@ -253,7 +252,7 @@ void PlanetData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_biome_datas", "biome_datas"), &PlanetData::set_biome_datas);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "biome_datas", PROPERTY_HINT_NONE, "17/17:BiomeData", PROPERTY_USAGE_DEFAULT, "BiomeData"), "set_biome_datas", "get_biome_datas");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
ClassDB::bind_method(D_METHOD("get_environment_data", "index"), &PlanetData::get_environment_data);
|
||||
ClassDB::bind_method(D_METHOD("set_environment_data", "index", "data"), &PlanetData::set_environment_data);
|
||||
@ -286,5 +285,5 @@ void PlanetData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surfaces"), &PlanetData::get_liquid_voxel_surfaces);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surfaces", "voxel_surfaces"), &PlanetData::set_liquid_voxel_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "liquid_voxel_surfaces", PROPERTY_HINT_NONE, "17/17:VoxelSurface", PROPERTY_USAGE_DEFAULT, "VoxelSurface"), "set_liquid_voxel_surfaces", "get_liquid_voxel_surfaces");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -2,22 +2,22 @@
|
||||
#define biome_data_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/script_language.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "../../fastnoise/fastnoise_noise_params.h"
|
||||
|
||||
#include "../main/planet.h"
|
||||
#include "../data/biome_data.h"
|
||||
#include "../main/planet.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxel_surface.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#endif
|
||||
|
||||
class PlanetData : public Resource {
|
||||
GDCLASS(PlanetData, Resource);
|
||||
|
||||
|
||||
public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
@ -47,7 +47,7 @@ public:
|
||||
Vector<Variant> get_biome_datas();
|
||||
void set_biome_datas(const Vector<Variant> &biome_datas);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environments
|
||||
Ref<EnvironmentData> get_environment_data(const int index) const;
|
||||
void set_environment_data(const int index, const Ref<EnvironmentData> environment_data);
|
||||
@ -77,7 +77,7 @@ public:
|
||||
|
||||
Vector<Variant> get_liquid_voxel_surfaces();
|
||||
void set_liquid_voxel_surfaces(const Vector<Variant> &voxel_surfaces);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PlanetData();
|
||||
~PlanetData();
|
||||
@ -97,11 +97,11 @@ private:
|
||||
Ref<FastnoiseNoiseParams> _temperature_noise_params;
|
||||
Vector<Ref<BiomeData> > _biome_datas;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Vector<Ref<EnvironmentData> > _environment_datas;
|
||||
Vector<Ref<VoxelSurface> > _voxel_surfaces;
|
||||
Vector<Ref<VoxelSurface> > _liquid_voxel_surfaces;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,20 +27,18 @@ Ref<Resource> WorldGeneratorPropData::get_prop(int seed) {
|
||||
#endif
|
||||
|
||||
WorldGeneratorPropData::WorldGeneratorPropData() {
|
||||
|
||||
}
|
||||
WorldGeneratorPropData::~WorldGeneratorPropData() {
|
||||
|
||||
}
|
||||
|
||||
void WorldGeneratorPropData::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "can"), "_can_spawn", PropertyInfo(Variant::INT, "seed")));
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "_get_prop", PropertyInfo(Variant::INT, "seed")));
|
||||
#else
|
||||
#else
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), "_get_prop", PropertyInfo(Variant::INT, "seed")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("can_spawn", "seed"), &WorldGeneratorPropData::can_spawn);
|
||||
ClassDB::bind_method(D_METHOD("get_prop", "seed"), &WorldGeneratorPropData::get_prop);
|
||||
|
@ -9,23 +9,21 @@
|
||||
|
||||
class WorldGeneratorPropData : public Resource {
|
||||
GDCLASS(WorldGeneratorPropData, Resource);
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
bool can_spawn(int seed);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Ref<PropData> get_prop(int seed);
|
||||
#else
|
||||
#else
|
||||
Ref<Resource> get_prop(int seed);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
WorldGeneratorPropData();
|
||||
~WorldGeneratorPropData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -184,43 +184,43 @@ Biome::Biome() {
|
||||
_current_seed = 0;
|
||||
}
|
||||
Biome::~Biome() {
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment.unref();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_data.unref();
|
||||
_prop_datas.clear();
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_dungeons.clear();
|
||||
}
|
||||
|
||||
void Biome::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_stack", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "z"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#else
|
||||
#else
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Biome::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Biome::setup_library);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Biome::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_stack", "chunk", "x", "z", "spawn_mobs"), &Biome::generate_stack_bind);
|
||||
#else
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Biome::generate_chunk);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Biome::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Biome::set_current_seed);
|
||||
@ -230,11 +230,11 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &Biome::set_level_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "level_range"), "set_level_range", "get_level_range");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Biome::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Biome::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Biome::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Biome::set_data);
|
||||
@ -247,14 +247,14 @@ void Biome::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &Biome::remove_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &Biome::get_prop_data_count);
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &Biome::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &Biome::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &Biome::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &Biome::remove_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &Biome::get_entity_data_count);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Dungeons
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon", "index"), &Biome::get_dungeon);
|
||||
|
26
main/biome.h
26
main/biome.h
@ -9,8 +9,8 @@
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#endif
|
||||
|
||||
@ -22,7 +22,7 @@ class BiomeData;
|
||||
|
||||
class Biome : public Reference {
|
||||
GDCLASS(Biome, Reference);
|
||||
|
||||
|
||||
public:
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
@ -30,11 +30,11 @@ public:
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<BiomeData> get_data();
|
||||
void set_data(Ref<BiomeData> value);
|
||||
@ -47,14 +47,14 @@ public:
|
||||
|
||||
int get_prop_data_count() const;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
int get_entity_data_count() const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Dungeons
|
||||
Ref<Dungeon> get_dungeon(const int index) const;
|
||||
@ -65,7 +65,7 @@ public:
|
||||
|
||||
void setup();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_stack(VoxelChunk *chunk, int x, int z, bool spawn_mobs);
|
||||
@ -73,11 +73,11 @@ public:
|
||||
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
#else
|
||||
#else
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
|
||||
void setup_library(Ref<Resource> library);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Biome();
|
||||
~Biome();
|
||||
@ -90,16 +90,16 @@ private:
|
||||
|
||||
Vector2 _level_range;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Ref<EnvironmentData> _environment;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<BiomeData> _data;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Vector<Ref<Dungeon> > _dungeons;
|
||||
};
|
||||
|
@ -295,9 +295,9 @@ Dungeon::Dungeon() {
|
||||
_room_count = 0;
|
||||
}
|
||||
Dungeon::~Dungeon() {
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment.unref();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_data.unref();
|
||||
_dungeon_rooms.clear();
|
||||
@ -305,35 +305,35 @@ Dungeon::~Dungeon() {
|
||||
_dungeon_end_rooms.clear();
|
||||
_dungeon_corridors.clear();
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Dungeon::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_structure", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#else
|
||||
#else
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Dungeon::setup);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Dungeon::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Dungeon::_setup_library);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Dungeon::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_structure", "structure", "spawn_mobs"), &Dungeon::generate_structure);
|
||||
#else
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Dungeon::setup_library);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &Dungeon::generate_chunk);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Dungeon::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Dungeon::set_current_seed);
|
||||
@ -374,12 +374,12 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_room_count", "value"), &Dungeon::set_room_count);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "room_count"), "set_room_count", "get_room_count");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environment
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Dungeon::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Dungeon::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Dungeon::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Dungeon::set_data);
|
||||
@ -415,14 +415,14 @@ void Dungeon::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("remove_dungeon_corridor", "index"), &Dungeon::remove_dungeon_corridor);
|
||||
ClassDB::bind_method(D_METHOD("get_dungeon_corridor_count"), &Dungeon::get_dungeon_corridor_count);
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &Dungeon::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &Dungeon::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &Dungeon::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &Dungeon::remove_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &Dungeon::get_entity_data_count);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "_generate_map"));
|
||||
|
||||
|
@ -3,16 +3,16 @@
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "dungeon_room.h"
|
||||
#include "dungeon_corridor.h"
|
||||
#include "dungeon_room.h"
|
||||
|
||||
#include "../data/dungeon_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#else
|
||||
#include "scene/main/node.h"
|
||||
#endif
|
||||
@ -25,7 +25,7 @@ class DungeonData;
|
||||
|
||||
class Dungeon : public Reference {
|
||||
GDCLASS(Dungeon, Reference);
|
||||
|
||||
|
||||
public:
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
@ -57,11 +57,11 @@ public:
|
||||
int get_room_count();
|
||||
void set_room_count(int value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<DungeonData> get_data();
|
||||
void set_data(Ref<DungeonData> value);
|
||||
@ -94,28 +94,28 @@ public:
|
||||
void remove_dungeon_corridor(const int index);
|
||||
int get_dungeon_corridor_count() const;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_datas);
|
||||
void add_entity_data(const Ref<EntityData> entity_datas);
|
||||
void remove_entity_data(const int index);
|
||||
int get_entity_data_count() const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void setup();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_structure(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
#else
|
||||
#else
|
||||
void setup_library(Ref<Resource> library);
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<Image> generate_map();
|
||||
|
||||
@ -140,9 +140,9 @@ private:
|
||||
|
||||
int _room_count;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Ref<EnvironmentData> _environment;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<DungeonData> _data;
|
||||
Vector<Ref<DungeonRoom> > _dungeon_rooms;
|
||||
@ -150,9 +150,9 @@ private:
|
||||
Vector<Ref<DungeonRoom> > _dungeon_end_rooms;
|
||||
Vector<Ref<DungeonCorridor> > _dungeon_corridors;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,6 @@ int DungeonCorridor::get_dungeon_room_count() const {
|
||||
return _dungeon_rooms.size();
|
||||
}
|
||||
|
||||
|
||||
DungeonCorridor::DungeonCorridor() {
|
||||
_max_connections = 2;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
class DungeonCorridor : public DungeonRoom {
|
||||
GDCLASS(DungeonCorridor, DungeonRoom);
|
||||
|
||||
|
||||
public:
|
||||
int get_max_connections();
|
||||
void set_max_connections(int value);
|
||||
|
@ -223,41 +223,41 @@ DungeonRoom::~DungeonRoom() {
|
||||
_data.unref();
|
||||
_prop_datas.clear();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment.unref();
|
||||
_structure.unref();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
_entity_datas.clear();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DungeonRoom::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_room", PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#else
|
||||
#else
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &DungeonRoom::setup);
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &DungeonRoom::setup_library);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &DungeonRoom::_setup_library);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_room", "structure", "spawn_mobs"), &DungeonRoom::generate_room);
|
||||
#else
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk", "spawn_mobs"), &DungeonRoom::generate_chunk);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &DungeonRoom::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &DungeonRoom::set_current_seed);
|
||||
@ -293,21 +293,21 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sizez", "value"), &DungeonRoom::set_sizez);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sizez"), "set_sizez", "get_sizez");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &DungeonRoom::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &DungeonRoom::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &DungeonRoom::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &DungeonRoom::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "PlanetData"), "set_data", "get_data");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_structure"), &DungeonRoom::get_structure);
|
||||
ClassDB::bind_method(D_METHOD("set_structure", "value"), &DungeonRoom::set_structure);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "structure", PROPERTY_HINT_RESOURCE_TYPE, "VoxelStructure"), "set_structure", "get_structure");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Props
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data", "index"), &DungeonRoom::get_prop_data);
|
||||
@ -316,12 +316,12 @@ void DungeonRoom::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("remove_prop_data", "index"), &DungeonRoom::remove_prop_data);
|
||||
ClassDB::bind_method(D_METHOD("get_prop_data_count"), &DungeonRoom::get_prop_data_count);
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data", "index"), &DungeonRoom::get_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_data", "index", "data"), &DungeonRoom::set_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("add_entity_data", "entity_data"), &DungeonRoom::add_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("remove_entity_data", "index"), &DungeonRoom::remove_entity_data);
|
||||
ClassDB::bind_method(D_METHOD("get_entity_data_count"), &DungeonRoom::get_entity_data_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
#include "../data/dungeon_room_data.h"
|
||||
#include "../data/world_generator_prop_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/voxel_structure.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#else
|
||||
#include "scene/main/node.h"
|
||||
#endif
|
||||
@ -24,7 +24,7 @@ class DungeonRoomData;
|
||||
|
||||
class DungeonRoom : public Reference {
|
||||
GDCLASS(DungeonRoom, Reference);
|
||||
|
||||
|
||||
public:
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
@ -52,20 +52,20 @@ public:
|
||||
int get_sizez();
|
||||
void set_sizez(int value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<DungeonRoomData> get_data();
|
||||
void set_data(Ref<DungeonRoomData> value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Structure
|
||||
Ref<VoxelStructure> get_structure();
|
||||
void set_structure(Ref<VoxelStructure> structure);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Props
|
||||
Ref<WorldGeneratorPropData> get_prop_data(const int index) const;
|
||||
@ -74,28 +74,28 @@ public:
|
||||
void remove_prop_data(const int index);
|
||||
int get_prop_data_count() const;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
#ifdef ESS_PRESENT
|
||||
//Entities
|
||||
Ref<EntityData> get_entity_data(const int index) const;
|
||||
void set_entity_data(const int index, const Ref<EntityData> entity_data);
|
||||
void add_entity_data(const Ref<EntityData> entity_data);
|
||||
void remove_entity_data(const int index);
|
||||
int get_entity_data_count() const;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void setup();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
void generate_room(Ref<VoxelStructure> structure, bool spawn_mobs);
|
||||
#else
|
||||
#else
|
||||
void setup_library(Ref<Resource> library);
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DungeonRoom();
|
||||
~DungeonRoom();
|
||||
@ -116,17 +116,17 @@ private:
|
||||
int _sizey;
|
||||
int _sizez;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Ref<EnvironmentData> _environment;
|
||||
Ref<VoxelStructure> _structure;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<DungeonRoomData> _data;
|
||||
Vector<Ref<WorldGeneratorPropData> > _prop_datas;
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
|
||||
#ifdef ESS_PRESENT
|
||||
Vector<Ref<EntityData> > _entity_datas;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -155,9 +155,9 @@ Planet::Planet() {
|
||||
_current_seed = 0;
|
||||
}
|
||||
Planet::~Planet() {
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
_environment.unref();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_data.unref();
|
||||
_biomes.clear();
|
||||
@ -167,25 +167,25 @@ Planet::~Planet() {
|
||||
void Planet::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup"));
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#else
|
||||
#else
|
||||
BIND_VMETHOD(MethodInfo("_setup_library", PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::BOOL, "spawn_mobs")));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup"), &Planet::setup);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("_setup_library", "library"), &Planet::_setup_library);
|
||||
#else
|
||||
#else
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &Planet::generate_chunk);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("setup_library", "library"), &Planet::setup_library);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_current_seed"), &Planet::get_current_seed);
|
||||
ClassDB::bind_method(D_METHOD("set_current_seed", "value"), &Planet::set_current_seed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_seed"), "set_current_seed", "get_current_seed");
|
||||
@ -194,11 +194,11 @@ void Planet::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_level_range", "value"), &Planet::set_level_range);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "level_range"), "set_level_range", "get_level_range");
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &Planet::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "value"), &Planet::set_environment);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "EnvironmentData"), "set_environment", "get_environment");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Planet::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &Planet::set_data);
|
||||
|
@ -1,9 +1,8 @@
|
||||
#ifndef PLANET_H
|
||||
#define PLANET_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/image.h"
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "biome.h"
|
||||
#include "dungeon.h"
|
||||
@ -11,17 +10,17 @@
|
||||
#include "../data/planet_data.h"
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/library/voxel_surface.h"
|
||||
#include "../../voxelman/library/voxelman_library.h"
|
||||
#include "../../voxelman/world/environment_data.h"
|
||||
#include "../../voxelman/world/voxel_chunk.h"
|
||||
#endif
|
||||
|
||||
class PlanetData;
|
||||
|
||||
class Planet : public Reference {
|
||||
GDCLASS(Planet, Reference);
|
||||
|
||||
|
||||
public:
|
||||
int get_current_seed();
|
||||
void set_current_seed(int value);
|
||||
@ -29,12 +28,12 @@ public:
|
||||
Vector2 get_level_range();
|
||||
void set_level_range(Vector2 value);
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
//Environment
|
||||
Ref<EnvironmentData> get_environment();
|
||||
void set_environment(Ref<EnvironmentData> value);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Ref<PlanetData> get_data();
|
||||
void set_data(Ref<PlanetData> value);
|
||||
|
||||
@ -54,16 +53,16 @@ public:
|
||||
|
||||
void setup();
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
void setup_library(Ref<VoxelmanLibrary> library);
|
||||
void _setup_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
void generate_chunk(VoxelChunk *chunk, bool spawn_mobs);
|
||||
void generate_chunk_bind(Node *chunk, bool spawn_mobs);
|
||||
#else
|
||||
#else
|
||||
void generate_chunk(Node *chunk, bool spawn_mobs);
|
||||
void setup_library(Ref<Resource> library);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<Image> generate_map();
|
||||
|
||||
@ -77,9 +76,9 @@ private:
|
||||
int _current_seed;
|
||||
Vector2 _level_range;
|
||||
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
#ifdef VOXELMAN_PRESENT
|
||||
Ref<EnvironmentData> _environment;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<PlanetData> _data;
|
||||
Vector<Ref<Biome> > _biomes;
|
||||
|
@ -1,101 +1,81 @@
|
||||
#include "DungeonCorridor.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonRoom* DungeonCorridor::getStartRoom(){
|
||||
return this->startRoom;
|
||||
}
|
||||
void DungeonCorridor::setStartRoom(DungeonRoom* value)
|
||||
{
|
||||
this->startRoom = value;
|
||||
}
|
||||
DungeonRoom* DungeonCorridor::getEndRoom()
|
||||
{
|
||||
return this->endRoom;
|
||||
}
|
||||
void DungeonCorridor::setEndRoom(DungeonRoom* value)
|
||||
{
|
||||
this->endRoom = value;
|
||||
}
|
||||
DungeonCorridor::DungeonCorridor(int size, DungeonRoom* startRoom, DungeonRoom* endRoom)
|
||||
{
|
||||
size = 4;
|
||||
this->size = size;
|
||||
this->setStartRoom(startRoom);
|
||||
this->setEndRoom(endRoom);
|
||||
}
|
||||
void DungeonCorridor::GenerateCorridor(ArrayND<char, 2>* dungeon)
|
||||
{
|
||||
int num = this->getStartRoom()->X + Mathf::RoundToInt((float)(this->getStartRoom()->Width) / (float)2);
|
||||
int num2 = this->getStartRoom()->Y + Mathf::RoundToInt((float)(this->getStartRoom()->Height) / (float)2);
|
||||
int num3 = this->getEndRoom()->X + Mathf::RoundToInt((float)(this->getEndRoom()->Width) / (float)2);
|
||||
int num4 = this->getEndRoom()->Y + Mathf::RoundToInt((float)(this->getEndRoom()->Height) / (float)2);
|
||||
if ((num <= num3) && (num2 <= num4)) {
|
||||
this->widthir = new IntRect(num, num2, num3 - num, this->size);
|
||||
this->heightir = new IntRect((this->widthir->X + this->widthir->Width) - this->size, num2, this->size, num4 - num2);
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonRoom *DungeonCorridor::getStartRoom() {
|
||||
return this->startRoom;
|
||||
}
|
||||
void DungeonCorridor::setStartRoom(DungeonRoom *value) {
|
||||
this->startRoom = value;
|
||||
}
|
||||
DungeonRoom *DungeonCorridor::getEndRoom() {
|
||||
return this->endRoom;
|
||||
}
|
||||
void DungeonCorridor::setEndRoom(DungeonRoom *value) {
|
||||
this->endRoom = value;
|
||||
}
|
||||
DungeonCorridor::DungeonCorridor(int size, DungeonRoom *startRoom, DungeonRoom *endRoom) {
|
||||
size = 4;
|
||||
this->size = size;
|
||||
this->setStartRoom(startRoom);
|
||||
this->setEndRoom(endRoom);
|
||||
}
|
||||
void DungeonCorridor::GenerateCorridor(ArrayND<char, 2> *dungeon) {
|
||||
int num = this->getStartRoom()->X + Mathf::RoundToInt((float)(this->getStartRoom()->Width) / (float)2);
|
||||
int num2 = this->getStartRoom()->Y + Mathf::RoundToInt((float)(this->getStartRoom()->Height) / (float)2);
|
||||
int num3 = this->getEndRoom()->X + Mathf::RoundToInt((float)(this->getEndRoom()->Width) / (float)2);
|
||||
int num4 = this->getEndRoom()->Y + Mathf::RoundToInt((float)(this->getEndRoom()->Height) / (float)2);
|
||||
if ((num <= num3) && (num2 <= num4)) {
|
||||
this->widthir = new IntRect(num, num2, num3 - num, this->size);
|
||||
this->heightir = new IntRect((this->widthir->X + this->widthir->Width) - this->size, num2, this->size, num4 - num2);
|
||||
} else {
|
||||
if ((num > num3) && (num2 <= num4)) {
|
||||
this->widthir = new IntRect(num3, num2, num - num3, this->size);
|
||||
this->heightir = new IntRect(this->widthir->X, num2, this->size, num4 - num2);
|
||||
} else {
|
||||
if ((num <= num3) && (num2 > num4)) {
|
||||
this->widthir = new IntRect(num, num4, num3 - num, this->size);
|
||||
this->heightir = new IntRect(num, num4, this->size, num2 - num4);
|
||||
} else {
|
||||
if ((num > num3) && (num2 > num4)) {
|
||||
this->widthir = new IntRect(num3 - this->size, num2 - this->size, num - num3, this->size);
|
||||
this->heightir = new IntRect(this->widthir->X, num4, this->size, num2 - num4);
|
||||
}
|
||||
else {
|
||||
if ((num > num3) && (num2 <= num4)) {
|
||||
this->widthir = new IntRect(num3, num2, num - num3, this->size);
|
||||
this->heightir = new IntRect(this->widthir->X, num2, this->size, num4 - num2);
|
||||
}
|
||||
else {
|
||||
if ((num <= num3) && (num2 > num4)) {
|
||||
this->widthir = new IntRect(num, num4, num3 - num, this->size);
|
||||
this->heightir = new IntRect(num, num4, this->size, num2 - num4);
|
||||
}
|
||||
else {
|
||||
if ((num > num3) && (num2 > num4)) {
|
||||
this->widthir = new IntRect(num3 - this->size, num2 - this->size, num - num3, this->size);
|
||||
this->heightir = new IntRect(this->widthir->X, num4, this->size, num2 - num4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->Write(dungeon, this->widthir);
|
||||
this->Write(dungeon, this->heightir);
|
||||
}
|
||||
void DungeonCorridor::Write(ArrayND<char, 2>* dungeon, IntRect* rect)
|
||||
{
|
||||
for (int i = rect->getY(); i < (rect->getY() + rect->getHeight()); i += 1) {
|
||||
for (int j = rect->getX(); j < (rect->getX() + rect->getWidth()); j += 1) {
|
||||
if (((*(dungeon->GetData(j, i)) != 1) && (*(dungeon->GetData(j, i)) != 2)) && (*(dungeon->GetData(j, i)) != 20)) {
|
||||
if ((j == rect->getX()) && (i == rect->getY())) {
|
||||
}
|
||||
}
|
||||
this->Write(dungeon, this->widthir);
|
||||
this->Write(dungeon, this->heightir);
|
||||
}
|
||||
void DungeonCorridor::Write(ArrayND<char, 2> *dungeon, IntRect *rect) {
|
||||
for (int i = rect->getY(); i < (rect->getY() + rect->getHeight()); i += 1) {
|
||||
for (int j = rect->getX(); j < (rect->getX() + rect->getWidth()); j += 1) {
|
||||
if (((*(dungeon->GetData(j, i)) != 1) && (*(dungeon->GetData(j, i)) != 2)) && (*(dungeon->GetData(j, i)) != 20)) {
|
||||
if ((j == rect->getX()) && (i == rect->getY())) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
} else {
|
||||
if ((j == rect->getX()) && (i == ((rect->getY() + rect->getHeight()) - 1))) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
} else {
|
||||
if ((j == ((rect->getX() + rect->getWidth()) - 1)) && (i == rect->getY())) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
} else {
|
||||
if ((j == ((rect->getX() + rect->getWidth()) - 1)) && (i == ((rect->getY() + rect->getHeight()) - 1))) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
}
|
||||
else {
|
||||
if ((j == rect->getX()) && (i == ((rect->getY() + rect->getHeight()) - 1))) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
}
|
||||
else {
|
||||
if ((j == ((rect->getX() + rect->getWidth()) - 1)) && (i == rect->getY())) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
}
|
||||
else {
|
||||
if ((j == ((rect->getX() + rect->getWidth()) - 1)) && (i == ((rect->getY() + rect->getHeight()) - 1))) {
|
||||
} else {
|
||||
if (j == rect->getX()) {
|
||||
dungeon->SetData(j, i, 14);
|
||||
} else {
|
||||
if (j == ((rect->getX() + rect->getWidth()) - 1)) {
|
||||
dungeon->SetData(j, i, 12);
|
||||
} else {
|
||||
if (i == rect->getY()) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
}
|
||||
else {
|
||||
if (j == rect->getX()) {
|
||||
dungeon->SetData(j, i, 14);
|
||||
}
|
||||
else {
|
||||
if (j == ((rect->getX() + rect->getWidth()) - 1)) {
|
||||
dungeon->SetData(j, i, 12);
|
||||
}
|
||||
else {
|
||||
if (i == rect->getY()) {
|
||||
dungeon->SetData(j, i, 13);
|
||||
}
|
||||
else {
|
||||
if (i == ((rect->getY() + rect->getHeight()) - 1)) {
|
||||
dungeon->SetData(j, i, 11);
|
||||
}
|
||||
else {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i == ((rect->getY() + rect->getHeight()) - 1)) {
|
||||
dungeon->SetData(j, i, 11);
|
||||
} else {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,21 +85,22 @@ namespace BS {
|
||||
}
|
||||
}
|
||||
}
|
||||
void DungeonCorridor::GenerateAIPlayers(int level)
|
||||
{
|
||||
this->GenerateAIPlayers(level, this->widthir);
|
||||
this->GenerateAIPlayers(level, this->heightir);
|
||||
}
|
||||
void DungeonCorridor::GenerateAIPlayers(int level, IntRect* rect)
|
||||
{
|
||||
int num = UnityEngine::Random::Range(0, 3);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
int num2 = rect->getX() + UnityEngine::Random::Range(1, rect->getWidth() - 2);
|
||||
int num3 = rect->getY() + UnityEngine::Random::Range(1, rect->getHeight() - 2);
|
||||
new Vector3(((float)(num2) * Voxelizzer::world->voxelScale) * (float)2, Voxelizzer::world->voxelScale, ((float)(num3) * Voxelizzer::world->voxelScale) * (float)2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void DungeonCorridor::GenerateAIPlayers(int level) {
|
||||
this->GenerateAIPlayers(level, this->widthir);
|
||||
this->GenerateAIPlayers(level, this->heightir);
|
||||
}
|
||||
void DungeonCorridor::GenerateAIPlayers(int level, IntRect *rect) {
|
||||
int num = UnityEngine::Random::Range(0, 3);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
int num2 = rect->getX() + UnityEngine::Random::Range(1, rect->getWidth() - 2);
|
||||
int num3 = rect->getY() + UnityEngine::Random::Range(1, rect->getHeight() - 2);
|
||||
new Vector3(((float)(num2)*Voxelizzer::world->voxelScale) * (float)2, Voxelizzer::world->voxelScale, ((float)(num3)*Voxelizzer::world->voxelScale) * (float)2);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,49 +1,61 @@
|
||||
#pragma once
|
||||
#include <System/System.h>
|
||||
#include "DungeonRoom.h"
|
||||
#include "IntRect.h"
|
||||
#include "Mathf.h"
|
||||
#include "UnityEngine.h"
|
||||
#include "Vector3.h"
|
||||
#include "Voxelizzer.h"
|
||||
#include <System/System.h>
|
||||
|
||||
using namespace UnityEngine;
|
||||
using namespace VoxelToolbox;
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonCorridor : public virtual Object
|
||||
{
|
||||
private:
|
||||
DungeonRoom* startRoom;
|
||||
private:
|
||||
DungeonRoom* endRoom;
|
||||
public:
|
||||
int size;
|
||||
private:
|
||||
IntRect* widthir;
|
||||
private:
|
||||
IntRect* heightir;
|
||||
public:
|
||||
DungeonRoom* getStartRoom();
|
||||
public:
|
||||
void setStartRoom(DungeonRoom* value);
|
||||
public:
|
||||
DungeonRoom* getEndRoom();
|
||||
public:
|
||||
void setEndRoom(DungeonRoom* value);
|
||||
public:
|
||||
DungeonCorridor(int size, DungeonRoom* startRoom, DungeonRoom* endRoom);
|
||||
public:
|
||||
void GenerateCorridor(ArrayND<char, 2>* dungeon);
|
||||
private:
|
||||
void Write(ArrayND<char, 2>* dungeon, IntRect* rect);
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
private:
|
||||
void GenerateAIPlayers(int level, IntRect* rect);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonCorridor : public virtual Object {
|
||||
private:
|
||||
DungeonRoom *startRoom;
|
||||
|
||||
private:
|
||||
DungeonRoom *endRoom;
|
||||
|
||||
public:
|
||||
int size;
|
||||
|
||||
private:
|
||||
IntRect *widthir;
|
||||
|
||||
private:
|
||||
IntRect *heightir;
|
||||
|
||||
public:
|
||||
DungeonRoom *getStartRoom();
|
||||
|
||||
public:
|
||||
void setStartRoom(DungeonRoom *value);
|
||||
|
||||
public:
|
||||
DungeonRoom *getEndRoom();
|
||||
|
||||
public:
|
||||
void setEndRoom(DungeonRoom *value);
|
||||
|
||||
public:
|
||||
DungeonCorridor(int size, DungeonRoom *startRoom, DungeonRoom *endRoom);
|
||||
|
||||
public:
|
||||
void GenerateCorridor(ArrayND<char, 2> *dungeon);
|
||||
|
||||
private:
|
||||
void Write(ArrayND<char, 2> *dungeon, IntRect *rect);
|
||||
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
|
||||
private:
|
||||
void GenerateAIPlayers(int level, IntRect *rect);
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,37 +1,37 @@
|
||||
#include "DungeonEndRoom.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonEndRoom::DungeonEndRoom(int x, int y, int width, int height) : DungeonRoom(x, y, width, height){
|
||||
}
|
||||
void DungeonEndRoom::WriteRoom(ArrayND<char, 2>* dungeon)
|
||||
{
|
||||
for (int i = DungeonRoom::getY(); i < (DungeonRoom::getY() + DungeonRoom::getHeight()); i += 1) {
|
||||
for (int j = DungeonRoom::getX(); j < (DungeonRoom::getX() + DungeonRoom::getWidth()); j += 1) {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = DungeonRoom::getX() + 1; k < ((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1); k += 1) {
|
||||
dungeon->SetData(k, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 11);
|
||||
}
|
||||
for (int l = DungeonRoom::getX() + 1; l < ((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1); l += 1) {
|
||||
dungeon->SetData(l, DungeonRoom::getY(), 13);
|
||||
}
|
||||
for (int m = DungeonRoom::getY() + 1; m < ((DungeonRoom::getY() + DungeonRoom::getHeight()) - 1); m += 1) {
|
||||
dungeon->SetData(DungeonRoom::getX(), m, 14);
|
||||
}
|
||||
for (int n = DungeonRoom::getY() + 1; n < ((DungeonRoom::getY() + DungeonRoom::getHeight()) - 1); n += 1) {
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, n, 12);
|
||||
}
|
||||
dungeon->SetData(DungeonRoom::getX(), DungeonRoom::getY(), 13);
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, DungeonRoom::getY(), 13);
|
||||
dungeon->SetData(DungeonRoom::getX(), (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 13);
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 13);
|
||||
int num = UnityEngine::Random::Range(DungeonRoom::getX() + 1, (DungeonRoom::getX() + DungeonRoom::getWidth()) - 1);
|
||||
int num2 = UnityEngine::Random::Range(DungeonRoom::getY() + 1, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1);
|
||||
dungeon->SetData(num, num2, 20);
|
||||
}
|
||||
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonEndRoom::DungeonEndRoom(int x, int y, int width, int height) :
|
||||
DungeonRoom(x, y, width, height) {
|
||||
}
|
||||
void DungeonEndRoom::WriteRoom(ArrayND<char, 2> *dungeon) {
|
||||
for (int i = DungeonRoom::getY(); i < (DungeonRoom::getY() + DungeonRoom::getHeight()); i += 1) {
|
||||
for (int j = DungeonRoom::getX(); j < (DungeonRoom::getX() + DungeonRoom::getWidth()); j += 1) {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = DungeonRoom::getX() + 1; k < ((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1); k += 1) {
|
||||
dungeon->SetData(k, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 11);
|
||||
}
|
||||
for (int l = DungeonRoom::getX() + 1; l < ((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1); l += 1) {
|
||||
dungeon->SetData(l, DungeonRoom::getY(), 13);
|
||||
}
|
||||
for (int m = DungeonRoom::getY() + 1; m < ((DungeonRoom::getY() + DungeonRoom::getHeight()) - 1); m += 1) {
|
||||
dungeon->SetData(DungeonRoom::getX(), m, 14);
|
||||
}
|
||||
for (int n = DungeonRoom::getY() + 1; n < ((DungeonRoom::getY() + DungeonRoom::getHeight()) - 1); n += 1) {
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, n, 12);
|
||||
}
|
||||
dungeon->SetData(DungeonRoom::getX(), DungeonRoom::getY(), 13);
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, DungeonRoom::getY(), 13);
|
||||
dungeon->SetData(DungeonRoom::getX(), (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 13);
|
||||
dungeon->SetData((DungeonRoom::getX() + DungeonRoom::getWidth()) - 1, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1, 13);
|
||||
int num = UnityEngine::Random::Range(DungeonRoom::getX() + 1, (DungeonRoom::getX() + DungeonRoom::getWidth()) - 1);
|
||||
int num2 = UnityEngine::Random::Range(DungeonRoom::getY() + 1, (DungeonRoom::getY() + DungeonRoom::getHeight()) - 1);
|
||||
dungeon->SetData(num, num2, 20);
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,19 +1,19 @@
|
||||
#pragma once
|
||||
#include <System/System.h>
|
||||
#include "DungeonRoom.h"
|
||||
#include "UnityEngine.h"
|
||||
#include <System/System.h>
|
||||
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonEndRoom : public virtual DungeonRoom, public virtual Object
|
||||
{
|
||||
public:
|
||||
DungeonEndRoom(int x, int y, int width, int height);
|
||||
public:
|
||||
virtual void WriteRoom(ArrayND<char, 2>* dungeon);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonEndRoom : public virtual DungeonRoom, public virtual Object {
|
||||
public:
|
||||
DungeonEndRoom(int x, int y, int width, int height);
|
||||
|
||||
public:
|
||||
virtual void WriteRoom(ArrayND<char, 2> *dungeon);
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,205 +1,187 @@
|
||||
#include "DungeonGenerator.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
ArrayND<char, 2>* DungeonGenerator::getDungeon(){
|
||||
return this->dungeon;
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
ArrayND<char, 2> *DungeonGenerator::getDungeon() {
|
||||
return this->dungeon;
|
||||
}
|
||||
void DungeonGenerator::Awake() {
|
||||
this->rooms = new List_T<DungeonRoom>();
|
||||
this->corridors = new List_T<DungeonCorridor>();
|
||||
this->dungeon = new ArrayND<char>(this->DUNGEON_Size_X, this->DUNGEON_Size_Y);
|
||||
}
|
||||
void DungeonGenerator::Generate(int level) {
|
||||
UnityEngine::Random::InitState(BrokenSeals::Game->Seed);
|
||||
if (!CxNet::IsServer) {
|
||||
this->SpawnMobs = false;
|
||||
}
|
||||
this->GenerateDungeon();
|
||||
this->GenerateCorridors();
|
||||
this->PreprocessDungeonSimple();
|
||||
this->GeneratePlayers(level);
|
||||
}
|
||||
void DungeonGenerator::GenerateDungeon() {
|
||||
for (int i = 0; i < this->ROOM_PLACEMENT_TRIES; i += 1) {
|
||||
int x = UnityEngine::Random::Range(0, this->DUNGEON_Size_X - this->ROOM_MAX_SIZE);
|
||||
int y = UnityEngine::Random::Range(0, this->DUNGEON_Size_Y - this->ROOM_MAX_SIZE);
|
||||
int width = UnityEngine::Random::Range(this->ROOM_MIN_SIZE, this->ROOM_MAX_SIZE);
|
||||
int height = UnityEngine::Random::Range(this->ROOM_MIN_SIZE, this->ROOM_MAX_SIZE);
|
||||
if (this->CanPlaceRoom(x, y, width, height)) {
|
||||
if (this->rooms->Count > 0) {
|
||||
DungeonRoom *dungeonRoom = new DungeonRoom(x, y, width, height);
|
||||
dungeonRoom->WriteRoom(this->dungeon);
|
||||
this->corridors->Add(new DungeonCorridor(this->CORRIDOR_SIZE, this->rooms->GetData(this->rooms->Count - 1), dungeonRoom));
|
||||
this->rooms->Add(dungeonRoom);
|
||||
} else {
|
||||
DungeonStartRoom *dungeonStartRoom = new DungeonStartRoom(x, y, width, height);
|
||||
dungeonStartRoom->WriteRoom(this->dungeon);
|
||||
dungeonStartRoom->GenerateSpawnPoint(this->startPositionPrefab);
|
||||
this->rooms->Add(dungeonStartRoom);
|
||||
}
|
||||
void DungeonGenerator::Awake()
|
||||
{
|
||||
this->rooms = new List_T<DungeonRoom>();
|
||||
this->corridors = new List_T<DungeonCorridor>();
|
||||
this->dungeon = new ArrayND<char>(this->DUNGEON_Size_X, this->DUNGEON_Size_Y);
|
||||
}
|
||||
void DungeonGenerator::Generate(int level)
|
||||
{
|
||||
UnityEngine::Random::InitState(BrokenSeals::Game->Seed);
|
||||
if (!CxNet::IsServer) {
|
||||
this->SpawnMobs = false;
|
||||
}
|
||||
this->GenerateDungeon();
|
||||
this->GenerateCorridors();
|
||||
this->PreprocessDungeonSimple();
|
||||
this->GeneratePlayers(level);
|
||||
}
|
||||
void DungeonGenerator::GenerateDungeon()
|
||||
{
|
||||
for (int i = 0; i < this->ROOM_PLACEMENT_TRIES; i += 1) {
|
||||
int x = UnityEngine::Random::Range(0, this->DUNGEON_Size_X - this->ROOM_MAX_SIZE);
|
||||
int y = UnityEngine::Random::Range(0, this->DUNGEON_Size_Y - this->ROOM_MAX_SIZE);
|
||||
int width = UnityEngine::Random::Range(this->ROOM_MIN_SIZE, this->ROOM_MAX_SIZE);
|
||||
int height = UnityEngine::Random::Range(this->ROOM_MIN_SIZE, this->ROOM_MAX_SIZE);
|
||||
if (this->CanPlaceRoom(x, y, width, height)) {
|
||||
if (this->rooms->Count > 0) {
|
||||
DungeonRoom* dungeonRoom = new DungeonRoom(x, y, width, height);
|
||||
dungeonRoom->WriteRoom(this->dungeon);
|
||||
this->corridors->Add(new DungeonCorridor(this->CORRIDOR_SIZE, this->rooms->GetData(this->rooms->Count - 1), dungeonRoom));
|
||||
this->rooms->Add(dungeonRoom);
|
||||
}
|
||||
else {
|
||||
DungeonStartRoom* dungeonStartRoom = new DungeonStartRoom(x, y, width, height);
|
||||
dungeonStartRoom->WriteRoom(this->dungeon);
|
||||
dungeonStartRoom->GenerateSpawnPoint(this->startPositionPrefab);
|
||||
this->rooms->Add(dungeonStartRoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
DungeonRoom* dungeonRoom2 = this->rooms->GetData(this->rooms->Count - 1);
|
||||
this->rooms->Remove(dungeonRoom2);
|
||||
this->corridors->RemoveAt(this->corridors->Count - 1);
|
||||
DungeonEndRoom* dungeonEndRoom = new DungeonEndRoom(dungeonRoom2->getX(), dungeonRoom2->getY(), dungeonRoom2->getWidth(), dungeonRoom2->getHeight());
|
||||
this->corridors->Add(new DungeonCorridor(this->CORRIDOR_SIZE, this->rooms->GetData(this->rooms->Count - 1), dungeonEndRoom));
|
||||
this->rooms->Add(dungeonEndRoom);
|
||||
dungeonEndRoom->WriteRoom(this->dungeon);
|
||||
}
|
||||
void DungeonGenerator::GenerateCorridors()
|
||||
{
|
||||
for (int i = 0; i < this->corridors->Count; i += 1) {
|
||||
this->corridors->GetData(i)->GenerateCorridor(this->dungeon);
|
||||
}
|
||||
}
|
||||
DungeonRoom *dungeonRoom2 = this->rooms->GetData(this->rooms->Count - 1);
|
||||
this->rooms->Remove(dungeonRoom2);
|
||||
this->corridors->RemoveAt(this->corridors->Count - 1);
|
||||
DungeonEndRoom *dungeonEndRoom = new DungeonEndRoom(dungeonRoom2->getX(), dungeonRoom2->getY(), dungeonRoom2->getWidth(), dungeonRoom2->getHeight());
|
||||
this->corridors->Add(new DungeonCorridor(this->CORRIDOR_SIZE, this->rooms->GetData(this->rooms->Count - 1), dungeonEndRoom));
|
||||
this->rooms->Add(dungeonEndRoom);
|
||||
dungeonEndRoom->WriteRoom(this->dungeon);
|
||||
}
|
||||
void DungeonGenerator::GenerateCorridors() {
|
||||
for (int i = 0; i < this->corridors->Count; i += 1) {
|
||||
this->corridors->GetData(i)->GenerateCorridor(this->dungeon);
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::GeneratePlayers(int level) {
|
||||
if (!this->SpawnMobs) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < this->rooms->Count; i += 1) {
|
||||
this->rooms->GetData(i)->GenerateAIPlayers(level);
|
||||
}
|
||||
for (int j = 0; j < this->corridors->Count; j += 1) {
|
||||
this->corridors->GetData(j)->GenerateAIPlayers(level);
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::PreprocessDungeonSimple() {
|
||||
for (int i = 1; i < this->DUNGEON_Size_X; i += 1) {
|
||||
for (int j = 1; j < this->DUNGEON_Size_Y; j += 1) {
|
||||
this->dungeon->GetData(i, j);
|
||||
if (TileConsts::isWall(this->dungeon->GetData(i, j))) {
|
||||
bool arg_68_0 = *(this->dungeon->GetData(i, j - 1)) == 0;
|
||||
bool flag = *(this->dungeon->GetData(i - 1, j)) == 0;
|
||||
bool flag2 = *(this->dungeon->GetData(i - 1, j - 1)) == 0;
|
||||
if ((arg_68_0 | flag) | flag2) {
|
||||
this->dungeon->SetData(i, j, 12);
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::GeneratePlayers(int level)
|
||||
{
|
||||
if (!this->SpawnMobs) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < this->rooms->Count; i += 1) {
|
||||
this->rooms->GetData(i)->GenerateAIPlayers(level);
|
||||
}
|
||||
for (int j = 0; j < this->corridors->Count; j += 1) {
|
||||
this->corridors->GetData(j)->GenerateAIPlayers(level);
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::PreprocessDungeonSimple()
|
||||
{
|
||||
for (int i = 1; i < this->DUNGEON_Size_X; i += 1) {
|
||||
for (int j = 1; j < this->DUNGEON_Size_Y; j += 1) {
|
||||
this->dungeon->GetData(i, j);
|
||||
if (TileConsts::isWall(this->dungeon->GetData(i, j))) {
|
||||
bool arg_68_0 = *(this->dungeon->GetData(i, j - 1)) == 0;
|
||||
bool flag = *(this->dungeon->GetData(i - 1, j)) == 0;
|
||||
bool flag2 = *(this->dungeon->GetData(i - 1, j - 1)) == 0;
|
||||
if ((arg_68_0 | flag) | flag2) {
|
||||
this->dungeon->SetData(i, j, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::PreprocessDungeon()
|
||||
{
|
||||
for (int i = 1; i < this->DUNGEON_Size_X; i += 1) {
|
||||
for (int j = 1; j < this->DUNGEON_Size_Y; j += 1) {
|
||||
char b = this->dungeon->GetData(i, j);
|
||||
if (((b != 0) && (b != 1)) && (b != 20)) {
|
||||
bool flag = TileConsts::isWall(this->dungeon->GetData(i, j + 1));
|
||||
bool flag2 = TileConsts::isWall(this->dungeon->GetData(i, j - 1));
|
||||
bool flag3 = TileConsts::isWall(this->dungeon->GetData(i - 1, j));
|
||||
bool flag4 = TileConsts::isWall(this->dungeon->GetData(i + 1, j));
|
||||
bool flag5 = TileConsts::isWall(this->dungeon->GetData(i + 1, j + 1));
|
||||
bool flag6 = TileConsts::isWall(this->dungeon->GetData(i - 1, j + 1));
|
||||
bool flag7 = TileConsts::isWall(this->dungeon->GetData(i + 1, j - 1));
|
||||
bool flag8 = TileConsts::isWall(this->dungeon->GetData(i - 1, j - 1));
|
||||
if (!flag & flag2) {
|
||||
if (((!flag4 & flag) & flag3) && !flag2) {
|
||||
this->dungeon->SetData(i, j, 17);
|
||||
}
|
||||
else {
|
||||
if (((!flag4 && !flag) & flag3) & flag2) {
|
||||
this->dungeon->SetData(i, j, 18);
|
||||
}
|
||||
else {
|
||||
if (((!flag3 && !flag) & flag4) & flag2) {
|
||||
this->dungeon->SetData(i, j, 17);
|
||||
}
|
||||
else {
|
||||
if (((((((flag3 && !flag8) && !flag2) && !flag7) && !flag4) && !flag5) & flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 23);
|
||||
}
|
||||
else {
|
||||
if ((!flag3 & flag) & flag4) {
|
||||
}
|
||||
if (((((((flag3 && !flag8) & flag2) && !flag7) && !flag4) && !flag5) && !flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 22);
|
||||
}
|
||||
else {
|
||||
if (((((((!flag3 && !flag8) && !flag2) && !flag7) & flag4) && !flag5) & flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 21);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String* DungeonGenerator::StringifyDungeon()
|
||||
{
|
||||
this->sb = new StringBuilder();
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
if (*(this->dungeon->GetData(j, i)) != 0) {
|
||||
this->sb->Append(j);
|
||||
this->sb->Append(new String(";"));
|
||||
this->sb->Append(i);
|
||||
this->sb->Append(new String(";"));
|
||||
this->sb->Append(this->dungeon->GetData(j, i));
|
||||
this->sb->Append(new String("|"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this->sb->ToString();
|
||||
}
|
||||
void DungeonGenerator::GenerateDebugDungeon()
|
||||
{
|
||||
this->dungeon = new ArrayND<char>(this->DUNGEON_Size_X, this->DUNGEON_Size_Y);
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
this->dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < 300; k += 1) {
|
||||
this->dungeon->SetData(UnityEngine::Random::Range(0, this->DUNGEON_Size_X), UnityEngine::Random::Range(0, this->DUNGEON_Size_Y), 2);
|
||||
}
|
||||
}
|
||||
bool DungeonGenerator::CanPlaceRoom(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = y; i < (y + height); i += 1) {
|
||||
for (int j = x; j < (x + width); j += 1) {
|
||||
if (*(this->dungeon->GetData(j, i)) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void DungeonGenerator::Reset()
|
||||
{
|
||||
if (this->rooms == null) {
|
||||
return;
|
||||
}
|
||||
this->rooms->Clear();
|
||||
this->corridors->Clear();
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
this->dungeon->SetData(j, i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
DungeonGenerator::DungeonGenerator()
|
||||
{
|
||||
SpawnMobs = true;
|
||||
DUNGEON_Size_X = 200;
|
||||
DUNGEON_Size_Y = 200;
|
||||
ROOM_MIN_SIZE = 20;
|
||||
ROOM_MAX_SIZE = 26;
|
||||
ROOM_PLACEMENT_TRIES = 100;
|
||||
CORRIDOR_SIZE = 4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void DungeonGenerator::PreprocessDungeon() {
|
||||
for (int i = 1; i < this->DUNGEON_Size_X; i += 1) {
|
||||
for (int j = 1; j < this->DUNGEON_Size_Y; j += 1) {
|
||||
char b = this->dungeon->GetData(i, j);
|
||||
if (((b != 0) && (b != 1)) && (b != 20)) {
|
||||
bool flag = TileConsts::isWall(this->dungeon->GetData(i, j + 1));
|
||||
bool flag2 = TileConsts::isWall(this->dungeon->GetData(i, j - 1));
|
||||
bool flag3 = TileConsts::isWall(this->dungeon->GetData(i - 1, j));
|
||||
bool flag4 = TileConsts::isWall(this->dungeon->GetData(i + 1, j));
|
||||
bool flag5 = TileConsts::isWall(this->dungeon->GetData(i + 1, j + 1));
|
||||
bool flag6 = TileConsts::isWall(this->dungeon->GetData(i - 1, j + 1));
|
||||
bool flag7 = TileConsts::isWall(this->dungeon->GetData(i + 1, j - 1));
|
||||
bool flag8 = TileConsts::isWall(this->dungeon->GetData(i - 1, j - 1));
|
||||
if (!flag & flag2) {
|
||||
if (((!flag4 & flag) & flag3) && !flag2) {
|
||||
this->dungeon->SetData(i, j, 17);
|
||||
} else {
|
||||
if (((!flag4 && !flag) & flag3) & flag2) {
|
||||
this->dungeon->SetData(i, j, 18);
|
||||
} else {
|
||||
if (((!flag3 && !flag) & flag4) & flag2) {
|
||||
this->dungeon->SetData(i, j, 17);
|
||||
} else {
|
||||
if (((((((flag3 && !flag8) && !flag2) && !flag7) && !flag4) && !flag5) & flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 23);
|
||||
} else {
|
||||
if ((!flag3 & flag) & flag4) {
|
||||
}
|
||||
if (((((((flag3 && !flag8) & flag2) && !flag7) && !flag4) && !flag5) && !flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 22);
|
||||
} else {
|
||||
if (((((((!flag3 && !flag8) && !flag2) && !flag7) & flag4) && !flag5) & flag) && !flag6) {
|
||||
this->dungeon->SetData(i, j, 21);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String *DungeonGenerator::StringifyDungeon() {
|
||||
this->sb = new StringBuilder();
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
if (*(this->dungeon->GetData(j, i)) != 0) {
|
||||
this->sb->Append(j);
|
||||
this->sb->Append(new String(";"));
|
||||
this->sb->Append(i);
|
||||
this->sb->Append(new String(";"));
|
||||
this->sb->Append(this->dungeon->GetData(j, i));
|
||||
this->sb->Append(new String("|"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this->sb->ToString();
|
||||
}
|
||||
void DungeonGenerator::GenerateDebugDungeon() {
|
||||
this->dungeon = new ArrayND<char>(this->DUNGEON_Size_X, this->DUNGEON_Size_Y);
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
this->dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < 300; k += 1) {
|
||||
this->dungeon->SetData(UnityEngine::Random::Range(0, this->DUNGEON_Size_X), UnityEngine::Random::Range(0, this->DUNGEON_Size_Y), 2);
|
||||
}
|
||||
}
|
||||
bool DungeonGenerator::CanPlaceRoom(int x, int y, int width, int height) {
|
||||
for (int i = y; i < (y + height); i += 1) {
|
||||
for (int j = x; j < (x + width); j += 1) {
|
||||
if (*(this->dungeon->GetData(j, i)) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void DungeonGenerator::Reset() {
|
||||
if (this->rooms == null) {
|
||||
return;
|
||||
}
|
||||
this->rooms->Clear();
|
||||
this->corridors->Clear();
|
||||
for (int i = 0; i < this->DUNGEON_Size_Y; i += 1) {
|
||||
for (int j = 0; j < this->DUNGEON_Size_X; j += 1) {
|
||||
this->dungeon->SetData(j, i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
DungeonGenerator::DungeonGenerator() {
|
||||
SpawnMobs = true;
|
||||
DUNGEON_Size_X = 200;
|
||||
DUNGEON_Size_Y = 200;
|
||||
ROOM_MIN_SIZE = 20;
|
||||
ROOM_MAX_SIZE = 26;
|
||||
ROOM_PLACEMENT_TRIES = 100;
|
||||
CORRIDOR_SIZE = 4;
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
#include <System/System.h>
|
||||
#include "MonoBehaviour.h"
|
||||
#include "GameObject.h"
|
||||
#include "DungeonRoom.h"
|
||||
#include <System/Collections/Generic/List.h>
|
||||
#include "DungeonCorridor.h"
|
||||
#include <System/Text/StringBuilder.h>
|
||||
#include "UnityEngine.h"
|
||||
#include "BrokenSeals.h"
|
||||
#include "CxNet.h"
|
||||
#include "DungeonStartRoom.h"
|
||||
#include "DungeonCorridor.h"
|
||||
#include "DungeonEndRoom.h"
|
||||
#include "DungeonRoom.h"
|
||||
#include "DungeonStartRoom.h"
|
||||
#include "GameObject.h"
|
||||
#include "MonoBehaviour.h"
|
||||
#include "TileConsts.h"
|
||||
#include "UnityEngine.h"
|
||||
#include <System/Collections/Generic/List.h>
|
||||
#include <System/System.h>
|
||||
#include <System/Text/StringBuilder.h>
|
||||
|
||||
using namespace UnityEngine;
|
||||
using namespace System::Collections::Generic;
|
||||
@ -19,65 +19,87 @@ using namespace System::Text;
|
||||
using namespace CxNetworking;
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonGenerator : public virtual MonoBehaviour, public virtual Object
|
||||
{
|
||||
public:
|
||||
int Seed;
|
||||
public:
|
||||
bool SpawnMobs;
|
||||
public:
|
||||
int DUNGEON_Size_X;
|
||||
public:
|
||||
int DUNGEON_Size_Y;
|
||||
public:
|
||||
int ROOM_MIN_SIZE;
|
||||
public:
|
||||
int ROOM_MAX_SIZE;
|
||||
public:
|
||||
int ROOM_PLACEMENT_TRIES;
|
||||
public:
|
||||
int CORRIDOR_SIZE;
|
||||
//Attribute: SerializeField*
|
||||
private:
|
||||
GameObject* startPositionPrefab;
|
||||
private:
|
||||
ArrayND<char, 2>* dungeon;
|
||||
private:
|
||||
List_T<DungeonRoom>* rooms;
|
||||
private:
|
||||
List_T<DungeonCorridor>* corridors;
|
||||
private:
|
||||
StringBuilder* sb;
|
||||
public:
|
||||
ArrayND<char, 2>* getDungeon();
|
||||
//Ignored empty method declaration
|
||||
private:
|
||||
void Awake();
|
||||
public:
|
||||
void Generate(int level);
|
||||
public:
|
||||
void GenerateDungeon();
|
||||
public:
|
||||
void GenerateCorridors();
|
||||
public:
|
||||
void GeneratePlayers(int level);
|
||||
public:
|
||||
void PreprocessDungeonSimple();
|
||||
public:
|
||||
void PreprocessDungeon();
|
||||
public:
|
||||
String* StringifyDungeon();
|
||||
private:
|
||||
void GenerateDebugDungeon();
|
||||
private:
|
||||
bool CanPlaceRoom(int x, int y, int width, int height);
|
||||
public:
|
||||
void Reset();
|
||||
public:
|
||||
DungeonGenerator();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonGenerator : public virtual MonoBehaviour, public virtual Object {
|
||||
public:
|
||||
int Seed;
|
||||
|
||||
public:
|
||||
bool SpawnMobs;
|
||||
|
||||
public:
|
||||
int DUNGEON_Size_X;
|
||||
|
||||
public:
|
||||
int DUNGEON_Size_Y;
|
||||
|
||||
public:
|
||||
int ROOM_MIN_SIZE;
|
||||
|
||||
public:
|
||||
int ROOM_MAX_SIZE;
|
||||
|
||||
public:
|
||||
int ROOM_PLACEMENT_TRIES;
|
||||
|
||||
public:
|
||||
int CORRIDOR_SIZE;
|
||||
//Attribute: SerializeField*
|
||||
private:
|
||||
GameObject *startPositionPrefab;
|
||||
|
||||
private:
|
||||
ArrayND<char, 2> *dungeon;
|
||||
|
||||
private:
|
||||
List_T<DungeonRoom> *rooms;
|
||||
|
||||
private:
|
||||
List_T<DungeonCorridor> *corridors;
|
||||
|
||||
private:
|
||||
StringBuilder *sb;
|
||||
|
||||
public:
|
||||
ArrayND<char, 2> *getDungeon();
|
||||
//Ignored empty method declaration
|
||||
private:
|
||||
void Awake();
|
||||
|
||||
public:
|
||||
void Generate(int level);
|
||||
|
||||
public:
|
||||
void GenerateDungeon();
|
||||
|
||||
public:
|
||||
void GenerateCorridors();
|
||||
|
||||
public:
|
||||
void GeneratePlayers(int level);
|
||||
|
||||
public:
|
||||
void PreprocessDungeonSimple();
|
||||
|
||||
public:
|
||||
void PreprocessDungeon();
|
||||
|
||||
public:
|
||||
String *StringifyDungeon();
|
||||
|
||||
private:
|
||||
void GenerateDebugDungeon();
|
||||
|
||||
private:
|
||||
bool CanPlaceRoom(int x, int y, int width, int height);
|
||||
|
||||
public:
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
DungeonGenerator();
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,161 +1,148 @@
|
||||
#include "DungeonRoom.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
Array<String>* DungeonRoom::biga;
|
||||
Array<String>* DungeonRoom::bigb;
|
||||
Array<String>* DungeonRoom::smalla;
|
||||
Array<String>* DungeonRoom::smallb;
|
||||
int DungeonRoom::getX(){
|
||||
return this->x;
|
||||
}
|
||||
void DungeonRoom::setX(int value)
|
||||
{
|
||||
this->x = value;
|
||||
}
|
||||
int DungeonRoom::getY()
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
void DungeonRoom::setY(int value)
|
||||
{
|
||||
this->y = value;
|
||||
}
|
||||
int DungeonRoom::getWidth()
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
void DungeonRoom::setWidth(int value)
|
||||
{
|
||||
this->width = value;
|
||||
}
|
||||
int DungeonRoom::getHeight()
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
void DungeonRoom::setHeight(int value)
|
||||
{
|
||||
this->height = value;
|
||||
}
|
||||
DungeonRoom::DungeonRoom(int x, int y, int width, int height)
|
||||
{
|
||||
this->setX(x);
|
||||
this->setY(y);
|
||||
this->setWidth(width);
|
||||
this->setHeight(height);
|
||||
}
|
||||
void DungeonRoom::WriteRoom(ArrayND<char, 2>* dungeon)
|
||||
{
|
||||
for (int i = this->getY(); i < (this->getY() + this->getHeight()); i += 1) {
|
||||
for (int j = this->getX(); j < (this->getX() + this->getWidth()); j += 1) {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = this->getX() + 1; k < ((this->getX() + this->getWidth()) - 1); k += 1) {
|
||||
dungeon->SetData(k, (this->getY() + this->getHeight()) - 1, 11);
|
||||
}
|
||||
for (int l = this->getX() + 1; l < ((this->getX() + this->getWidth()) - 1); l += 1) {
|
||||
dungeon->SetData(l, this->getY(), 13);
|
||||
}
|
||||
for (int m = this->getY() + 1; m < ((this->getY() + this->getHeight()) - 1); m += 1) {
|
||||
dungeon->SetData(this->getX(), m, 14);
|
||||
}
|
||||
for (int n = this->getY() + 1; n < ((this->getY() + this->getHeight()) - 1); n += 1) {
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, n, 12);
|
||||
}
|
||||
dungeon->SetData(this->getX(), this->getY(), 13);
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, this->getY(), 13);
|
||||
dungeon->SetData(this->getX(), (this->getY() + this->getHeight()) - 1, 13);
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, (this->getY() + this->getHeight()) - 1, 13);
|
||||
}
|
||||
void DungeonRoom::GenerateAIPlayers(int level)
|
||||
{
|
||||
int num = UnityEngine::Random::Range(3, 5);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
int num2 = this->getX() + UnityEngine::Random::Range(1, this->getWidth() - 2);
|
||||
int num3 = this->getY() + UnityEngine::Random::Range(1, this->getHeight() - 2);
|
||||
Vector3* position = new Vector3((float)(num2) * Voxelizzer::world->voxelScale, Voxelizzer::world->voxelScale, (float)(num3) * Voxelizzer::world->voxelScale);
|
||||
Entity::SSpawn(EntityType::Mob, UnityEngine::Random::Range(10000, 10005), level, this->GenerateName(), 0u, null, false, position, );
|
||||
}
|
||||
}
|
||||
String* DungeonRoom::GenerateName()
|
||||
{
|
||||
UnityEngine::Random::State* state = UnityEngine::Random::state;
|
||||
String* text = DungeonRoom::biga->GetData(UnityEngine::Random::Range(0, DungeonRoom::biga->Length));
|
||||
bool flag = false;
|
||||
int num = UnityEngine::Random::Range(3, 7);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
if (flag) {
|
||||
*text += DungeonRoom::smallb->GetData(UnityEngine::Random::Range(0, DungeonRoom::smallb->Length));
|
||||
}
|
||||
else {
|
||||
*text += DungeonRoom::smalla->GetData(UnityEngine::Random::Range(0, DungeonRoom::smalla->Length));
|
||||
}
|
||||
flag = !flag;
|
||||
}
|
||||
UnityEngine::Random::state = state;
|
||||
return text;
|
||||
}
|
||||
DungeonRoom::DungeonRoom()
|
||||
{
|
||||
Array<String>* expr_06 = new Array<String>(5);
|
||||
expr_06->SetData(0, new String("A"));
|
||||
expr_06->SetData(1, new String("E"));
|
||||
expr_06->SetData(2, new String("I"));
|
||||
expr_06->SetData(3, new String("O"));
|
||||
expr_06->SetData(4, new String("U"));
|
||||
DungeonRoom::biga = expr_06;
|
||||
Array<String>* expr_3A = new Array<String>(19);
|
||||
expr_3A->SetData(0, new String("B"));
|
||||
expr_3A->SetData(1, new String("C"));
|
||||
expr_3A->SetData(2, new String("D"));
|
||||
expr_3A->SetData(3, new String("E"));
|
||||
expr_3A->SetData(4, new String("F"));
|
||||
expr_3A->SetData(5, new String("G"));
|
||||
expr_3A->SetData(6, new String("H"));
|
||||
expr_3A->SetData(7, new String("J"));
|
||||
expr_3A->SetData(8, new String("K"));
|
||||
expr_3A->SetData(9, new String("L"));
|
||||
expr_3A->SetData(10, new String("M"));
|
||||
expr_3A->SetData(11, new String("N"));
|
||||
expr_3A->SetData(12, new String("P"));
|
||||
expr_3A->SetData(13, new String("Q"));
|
||||
expr_3A->SetData(14, new String("R"));
|
||||
expr_3A->SetData(15, new String("V"));
|
||||
expr_3A->SetData(16, new String("X"));
|
||||
expr_3A->SetData(17, new String("Y"));
|
||||
expr_3A->SetData(18, new String("Z"));
|
||||
DungeonRoom::bigb = expr_3A;
|
||||
Array<String>* expr_E7 = new Array<String>(5);
|
||||
expr_E7->SetData(0, new String("a"));
|
||||
expr_E7->SetData(1, new String("e"));
|
||||
expr_E7->SetData(2, new String("i"));
|
||||
expr_E7->SetData(3, new String("o"));
|
||||
expr_E7->SetData(4, new String("u"));
|
||||
DungeonRoom::smalla = expr_E7;
|
||||
Array<String>* expr_11B = new Array<String>(19);
|
||||
expr_11B->SetData(0, new String("b"));
|
||||
expr_11B->SetData(1, new String("c"));
|
||||
expr_11B->SetData(2, new String("d"));
|
||||
expr_11B->SetData(3, new String("e"));
|
||||
expr_11B->SetData(4, new String("f"));
|
||||
expr_11B->SetData(5, new String("g"));
|
||||
expr_11B->SetData(6, new String("h"));
|
||||
expr_11B->SetData(7, new String("j"));
|
||||
expr_11B->SetData(8, new String("k"));
|
||||
expr_11B->SetData(9, new String("l"));
|
||||
expr_11B->SetData(10, new String("m"));
|
||||
expr_11B->SetData(11, new String("n"));
|
||||
expr_11B->SetData(12, new String("p"));
|
||||
expr_11B->SetData(13, new String("q"));
|
||||
expr_11B->SetData(14, new String("r"));
|
||||
expr_11B->SetData(15, new String("v"));
|
||||
expr_11B->SetData(16, new String("x"));
|
||||
expr_11B->SetData(17, new String("y"));
|
||||
expr_11B->SetData(18, new String("z"));
|
||||
DungeonRoom::smallb = expr_11B;
|
||||
}
|
||||
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
Array<String> *DungeonRoom::biga;
|
||||
Array<String> *DungeonRoom::bigb;
|
||||
Array<String> *DungeonRoom::smalla;
|
||||
Array<String> *DungeonRoom::smallb;
|
||||
int DungeonRoom::getX() {
|
||||
return this->x;
|
||||
}
|
||||
void DungeonRoom::setX(int value) {
|
||||
this->x = value;
|
||||
}
|
||||
int DungeonRoom::getY() {
|
||||
return this->y;
|
||||
}
|
||||
void DungeonRoom::setY(int value) {
|
||||
this->y = value;
|
||||
}
|
||||
int DungeonRoom::getWidth() {
|
||||
return this->width;
|
||||
}
|
||||
void DungeonRoom::setWidth(int value) {
|
||||
this->width = value;
|
||||
}
|
||||
int DungeonRoom::getHeight() {
|
||||
return this->height;
|
||||
}
|
||||
void DungeonRoom::setHeight(int value) {
|
||||
this->height = value;
|
||||
}
|
||||
DungeonRoom::DungeonRoom(int x, int y, int width, int height) {
|
||||
this->setX(x);
|
||||
this->setY(y);
|
||||
this->setWidth(width);
|
||||
this->setHeight(height);
|
||||
}
|
||||
void DungeonRoom::WriteRoom(ArrayND<char, 2> *dungeon) {
|
||||
for (int i = this->getY(); i < (this->getY() + this->getHeight()); i += 1) {
|
||||
for (int j = this->getX(); j < (this->getX() + this->getWidth()); j += 1) {
|
||||
dungeon->SetData(j, i, 1);
|
||||
}
|
||||
}
|
||||
for (int k = this->getX() + 1; k < ((this->getX() + this->getWidth()) - 1); k += 1) {
|
||||
dungeon->SetData(k, (this->getY() + this->getHeight()) - 1, 11);
|
||||
}
|
||||
for (int l = this->getX() + 1; l < ((this->getX() + this->getWidth()) - 1); l += 1) {
|
||||
dungeon->SetData(l, this->getY(), 13);
|
||||
}
|
||||
for (int m = this->getY() + 1; m < ((this->getY() + this->getHeight()) - 1); m += 1) {
|
||||
dungeon->SetData(this->getX(), m, 14);
|
||||
}
|
||||
for (int n = this->getY() + 1; n < ((this->getY() + this->getHeight()) - 1); n += 1) {
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, n, 12);
|
||||
}
|
||||
dungeon->SetData(this->getX(), this->getY(), 13);
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, this->getY(), 13);
|
||||
dungeon->SetData(this->getX(), (this->getY() + this->getHeight()) - 1, 13);
|
||||
dungeon->SetData((this->getX() + this->getWidth()) - 1, (this->getY() + this->getHeight()) - 1, 13);
|
||||
}
|
||||
void DungeonRoom::GenerateAIPlayers(int level) {
|
||||
int num = UnityEngine::Random::Range(3, 5);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
int num2 = this->getX() + UnityEngine::Random::Range(1, this->getWidth() - 2);
|
||||
int num3 = this->getY() + UnityEngine::Random::Range(1, this->getHeight() - 2);
|
||||
Vector3 *position = new Vector3((float)(num2)*Voxelizzer::world->voxelScale, Voxelizzer::world->voxelScale, (float)(num3)*Voxelizzer::world->voxelScale);
|
||||
Entity::SSpawn(EntityType::Mob, UnityEngine::Random::Range(10000, 10005), level, this->GenerateName(), 0u, null, false, position, );
|
||||
}
|
||||
}
|
||||
String *DungeonRoom::GenerateName() {
|
||||
UnityEngine::Random::State *state = UnityEngine::Random::state;
|
||||
String *text = DungeonRoom::biga->GetData(UnityEngine::Random::Range(0, DungeonRoom::biga->Length));
|
||||
bool flag = false;
|
||||
int num = UnityEngine::Random::Range(3, 7);
|
||||
for (int i = 0; i < num; i += 1) {
|
||||
if (flag) {
|
||||
*text += DungeonRoom::smallb->GetData(UnityEngine::Random::Range(0, DungeonRoom::smallb->Length));
|
||||
} else {
|
||||
*text += DungeonRoom::smalla->GetData(UnityEngine::Random::Range(0, DungeonRoom::smalla->Length));
|
||||
}
|
||||
flag = !flag;
|
||||
}
|
||||
UnityEngine::Random::state = state;
|
||||
return text;
|
||||
}
|
||||
DungeonRoom::DungeonRoom() {
|
||||
Array<String> *expr_06 = new Array<String>(5);
|
||||
expr_06->SetData(0, new String("A"));
|
||||
expr_06->SetData(1, new String("E"));
|
||||
expr_06->SetData(2, new String("I"));
|
||||
expr_06->SetData(3, new String("O"));
|
||||
expr_06->SetData(4, new String("U"));
|
||||
DungeonRoom::biga = expr_06;
|
||||
Array<String> *expr_3A = new Array<String>(19);
|
||||
expr_3A->SetData(0, new String("B"));
|
||||
expr_3A->SetData(1, new String("C"));
|
||||
expr_3A->SetData(2, new String("D"));
|
||||
expr_3A->SetData(3, new String("E"));
|
||||
expr_3A->SetData(4, new String("F"));
|
||||
expr_3A->SetData(5, new String("G"));
|
||||
expr_3A->SetData(6, new String("H"));
|
||||
expr_3A->SetData(7, new String("J"));
|
||||
expr_3A->SetData(8, new String("K"));
|
||||
expr_3A->SetData(9, new String("L"));
|
||||
expr_3A->SetData(10, new String("M"));
|
||||
expr_3A->SetData(11, new String("N"));
|
||||
expr_3A->SetData(12, new String("P"));
|
||||
expr_3A->SetData(13, new String("Q"));
|
||||
expr_3A->SetData(14, new String("R"));
|
||||
expr_3A->SetData(15, new String("V"));
|
||||
expr_3A->SetData(16, new String("X"));
|
||||
expr_3A->SetData(17, new String("Y"));
|
||||
expr_3A->SetData(18, new String("Z"));
|
||||
DungeonRoom::bigb = expr_3A;
|
||||
Array<String> *expr_E7 = new Array<String>(5);
|
||||
expr_E7->SetData(0, new String("a"));
|
||||
expr_E7->SetData(1, new String("e"));
|
||||
expr_E7->SetData(2, new String("i"));
|
||||
expr_E7->SetData(3, new String("o"));
|
||||
expr_E7->SetData(4, new String("u"));
|
||||
DungeonRoom::smalla = expr_E7;
|
||||
Array<String> *expr_11B = new Array<String>(19);
|
||||
expr_11B->SetData(0, new String("b"));
|
||||
expr_11B->SetData(1, new String("c"));
|
||||
expr_11B->SetData(2, new String("d"));
|
||||
expr_11B->SetData(3, new String("e"));
|
||||
expr_11B->SetData(4, new String("f"));
|
||||
expr_11B->SetData(5, new String("g"));
|
||||
expr_11B->SetData(6, new String("h"));
|
||||
expr_11B->SetData(7, new String("j"));
|
||||
expr_11B->SetData(8, new String("k"));
|
||||
expr_11B->SetData(9, new String("l"));
|
||||
expr_11B->SetData(10, new String("m"));
|
||||
expr_11B->SetData(11, new String("n"));
|
||||
expr_11B->SetData(12, new String("p"));
|
||||
expr_11B->SetData(13, new String("q"));
|
||||
expr_11B->SetData(14, new String("r"));
|
||||
expr_11B->SetData(15, new String("v"));
|
||||
expr_11B->SetData(16, new String("x"));
|
||||
expr_11B->SetData(17, new String("y"));
|
||||
expr_11B->SetData(18, new String("z"));
|
||||
DungeonRoom::smallb = expr_11B;
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,64 +1,81 @@
|
||||
#pragma once
|
||||
#include <System/System.h>
|
||||
#include "UnityEngine.h"
|
||||
#include "Vector3.h"
|
||||
#include "Voxelizzer.h"
|
||||
#include "Entity.h"
|
||||
#include "EntityType.h"
|
||||
#include "Quaternion.h"
|
||||
#include "UnityEngine.h"
|
||||
#include "Vector3.h"
|
||||
#include "Voxelizzer.h"
|
||||
#include <System/System.h>
|
||||
|
||||
using namespace UnityEngine;
|
||||
using namespace VoxelToolbox;
|
||||
using namespace BS::Player;
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonRoom : public virtual Object
|
||||
{
|
||||
private:
|
||||
static Array<String>* biga;
|
||||
private:
|
||||
static Array<String>* bigb;
|
||||
private:
|
||||
static Array<String>* smalla;
|
||||
private:
|
||||
static Array<String>* smallb;
|
||||
private:
|
||||
int x;
|
||||
private:
|
||||
int y;
|
||||
private:
|
||||
int width;
|
||||
private:
|
||||
int height;
|
||||
public:
|
||||
int getX();
|
||||
public:
|
||||
void setX(int value);
|
||||
public:
|
||||
int getY();
|
||||
public:
|
||||
void setY(int value);
|
||||
public:
|
||||
int getWidth();
|
||||
public:
|
||||
void setWidth(int value);
|
||||
public:
|
||||
int getHeight();
|
||||
public:
|
||||
void setHeight(int value);
|
||||
public:
|
||||
DungeonRoom(int x, int y, int width, int height);
|
||||
public:
|
||||
virtual void WriteRoom(ArrayND<char, 2>* dungeon);
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
public:
|
||||
String* GenerateName();
|
||||
static:
|
||||
DungeonRoom();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonRoom : public virtual Object {
|
||||
private:
|
||||
static Array<String> *biga;
|
||||
|
||||
private:
|
||||
static Array<String> *bigb;
|
||||
|
||||
private:
|
||||
static Array<String> *smalla;
|
||||
|
||||
private:
|
||||
static Array<String> *smallb;
|
||||
|
||||
private:
|
||||
int x;
|
||||
|
||||
private:
|
||||
int y;
|
||||
|
||||
private:
|
||||
int width;
|
||||
|
||||
private:
|
||||
int height;
|
||||
|
||||
public:
|
||||
int getX();
|
||||
|
||||
public:
|
||||
void setX(int value);
|
||||
|
||||
public:
|
||||
int getY();
|
||||
|
||||
public:
|
||||
void setY(int value);
|
||||
|
||||
public:
|
||||
int getWidth();
|
||||
|
||||
public:
|
||||
void setWidth(int value);
|
||||
|
||||
public:
|
||||
int getHeight();
|
||||
|
||||
public:
|
||||
void setHeight(int value);
|
||||
|
||||
public:
|
||||
DungeonRoom(int x, int y, int width, int height);
|
||||
|
||||
public:
|
||||
virtual void WriteRoom(ArrayND<char, 2> *dungeon);
|
||||
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
|
||||
public:
|
||||
String *GenerateName();
|
||||
static : DungeonRoom();
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,23 +1,22 @@
|
||||
#include "DungeonStartRoom.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonStartRoom::DungeonStartRoom(int x, int y, int width, int height) : DungeonRoom(x, y, 8, 8){
|
||||
}
|
||||
void DungeonStartRoom::GenerateSpawnPoint(GameObject* startPositionPrefab)
|
||||
{
|
||||
bool flag = false;
|
||||
while (!flag) {
|
||||
int num = DungeonRoom::getX() + UnityEngine::Random::Range(1, DungeonRoom::getWidth() - 2);
|
||||
int num2 = DungeonRoom::getY() + UnityEngine::Random::Range(1, DungeonRoom::getHeight() - 2);
|
||||
flag = true;
|
||||
UnityEngine::Object::Instantiate<GameObject>(startPositionPrefab, Vector3::zero, Quaternion::identity)->transform->position = new Vector3((float)(num) * Voxelizzer::world->voxelScale, Voxelizzer::world->voxelScale, (float)(num2) * Voxelizzer::world->voxelScale);
|
||||
}
|
||||
}
|
||||
void DungeonStartRoom::GenerateAIPlayers(int level)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
DungeonStartRoom::DungeonStartRoom(int x, int y, int width, int height) :
|
||||
DungeonRoom(x, y, 8, 8) {
|
||||
}
|
||||
void DungeonStartRoom::GenerateSpawnPoint(GameObject *startPositionPrefab) {
|
||||
bool flag = false;
|
||||
while (!flag) {
|
||||
int num = DungeonRoom::getX() + UnityEngine::Random::Range(1, DungeonRoom::getWidth() - 2);
|
||||
int num2 = DungeonRoom::getY() + UnityEngine::Random::Range(1, DungeonRoom::getHeight() - 2);
|
||||
flag = true;
|
||||
UnityEngine::Object::Instantiate<GameObject>(startPositionPrefab, Vector3::zero, Quaternion::identity)->transform->position = new Vector3((float)(num)*Voxelizzer::world->voxelScale, Voxelizzer::world->voxelScale, (float)(num2)*Voxelizzer::world->voxelScale);
|
||||
}
|
||||
}
|
||||
void DungeonStartRoom::GenerateAIPlayers(int level) {
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,27 +1,28 @@
|
||||
#pragma once
|
||||
#include <System/System.h>
|
||||
#include "DungeonRoom.h"
|
||||
#include "GameObject.h"
|
||||
#include "Quaternion.h"
|
||||
#include "UnityEngine.h"
|
||||
#include "Vector3.h"
|
||||
#include "Voxelizzer.h"
|
||||
#include "Quaternion.h"
|
||||
#include <System/System.h>
|
||||
|
||||
using namespace UnityEngine;
|
||||
using namespace VoxelToolbox;
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonStartRoom : public virtual DungeonRoom, public virtual Object
|
||||
{
|
||||
public:
|
||||
DungeonStartRoom(int x, int y, int width, int height);
|
||||
public:
|
||||
void GenerateSpawnPoint(GameObject* startPositionPrefab);
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class DungeonStartRoom : public virtual DungeonRoom, public virtual Object {
|
||||
public:
|
||||
DungeonStartRoom(int x, int y, int width, int height);
|
||||
|
||||
public:
|
||||
void GenerateSpawnPoint(GameObject *startPositionPrefab);
|
||||
|
||||
public:
|
||||
virtual void GenerateAIPlayers(int level);
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,46 +1,38 @@
|
||||
#include "IntRect.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
int IntRect::getX(){
|
||||
return this->x;
|
||||
}
|
||||
void IntRect::setX(int value)
|
||||
{
|
||||
this->x = value;
|
||||
}
|
||||
int IntRect::getY()
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
void IntRect::setY(int value)
|
||||
{
|
||||
this->y = value;
|
||||
}
|
||||
int IntRect::getWidth()
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
void IntRect::setWidth(int value)
|
||||
{
|
||||
this->width = value;
|
||||
}
|
||||
int IntRect::getHeight()
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
void IntRect::setHeight(int value)
|
||||
{
|
||||
this->height = value;
|
||||
}
|
||||
IntRect::IntRect(int x, int y, int width, int height)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
int IntRect::getX() {
|
||||
return this->x;
|
||||
}
|
||||
void IntRect::setX(int value) {
|
||||
this->x = value;
|
||||
}
|
||||
int IntRect::getY() {
|
||||
return this->y;
|
||||
}
|
||||
void IntRect::setY(int value) {
|
||||
this->y = value;
|
||||
}
|
||||
int IntRect::getWidth() {
|
||||
return this->width;
|
||||
}
|
||||
void IntRect::setWidth(int value) {
|
||||
this->width = value;
|
||||
}
|
||||
int IntRect::getHeight() {
|
||||
return this->height;
|
||||
}
|
||||
void IntRect::setHeight(int value) {
|
||||
this->height = value;
|
||||
}
|
||||
IntRect::IntRect(int x, int y, int width, int height) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -3,37 +3,48 @@
|
||||
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class IntRect : public virtual Object
|
||||
{
|
||||
private:
|
||||
int x;
|
||||
private:
|
||||
int y;
|
||||
private:
|
||||
int width;
|
||||
private:
|
||||
int height;
|
||||
public:
|
||||
int getX();
|
||||
public:
|
||||
void setX(int value);
|
||||
public:
|
||||
int getY();
|
||||
public:
|
||||
void setY(int value);
|
||||
public:
|
||||
int getWidth();
|
||||
public:
|
||||
void setWidth(int value);
|
||||
public:
|
||||
int getHeight();
|
||||
public:
|
||||
void setHeight(int value);
|
||||
public:
|
||||
IntRect(int x, int y, int width, int height);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class IntRect : public virtual Object {
|
||||
private:
|
||||
int x;
|
||||
|
||||
private:
|
||||
int y;
|
||||
|
||||
private:
|
||||
int width;
|
||||
|
||||
private:
|
||||
int height;
|
||||
|
||||
public:
|
||||
int getX();
|
||||
|
||||
public:
|
||||
void setX(int value);
|
||||
|
||||
public:
|
||||
int getY();
|
||||
|
||||
public:
|
||||
void setY(int value);
|
||||
|
||||
public:
|
||||
int getWidth();
|
||||
|
||||
public:
|
||||
void setWidth(int value);
|
||||
|
||||
public:
|
||||
int getHeight();
|
||||
|
||||
public:
|
||||
void setHeight(int value);
|
||||
|
||||
public:
|
||||
IntRect(int x, int y, int width, int height);
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,71 +1,70 @@
|
||||
#include "TileConsts.h"
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
bool TileConsts::isWall(char tile){
|
||||
switch (tile){
|
||||
case 11:
|
||||
return true;
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
bool TileConsts::isWall(char tile) {
|
||||
switch (tile) {
|
||||
case 11:
|
||||
return true;
|
||||
|
||||
case 12:
|
||||
return true;
|
||||
case 12:
|
||||
return true;
|
||||
|
||||
case 13:
|
||||
return true;
|
||||
case 13:
|
||||
return true;
|
||||
|
||||
case 14:
|
||||
return true;
|
||||
case 14:
|
||||
return true;
|
||||
|
||||
case 15:
|
||||
return true;
|
||||
case 15:
|
||||
return true;
|
||||
|
||||
case 16:
|
||||
return true;
|
||||
case 16:
|
||||
return true;
|
||||
|
||||
case 17:
|
||||
return true;
|
||||
case 17:
|
||||
return true;
|
||||
|
||||
case 18:
|
||||
return true;
|
||||
case 18:
|
||||
return true;
|
||||
|
||||
case 21:
|
||||
return true;
|
||||
case 21:
|
||||
return true;
|
||||
|
||||
case 22:
|
||||
return true;
|
||||
case 22:
|
||||
return true;
|
||||
|
||||
case 23:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TileConsts::TileConsts()
|
||||
{
|
||||
Floor = 1;
|
||||
Floor_Var1 = 2;
|
||||
Floor_Up = 3;
|
||||
Floor_Left = 4;
|
||||
Floor_Down = 5;
|
||||
Floor_Right = 6;
|
||||
Floor_UpRight = 7;
|
||||
Floor_UpLeft = 8;
|
||||
Floor_DownLeft = 9;
|
||||
Floor_DownRight = 10;
|
||||
Wall_Up = 11;
|
||||
Wall_Right = 12;
|
||||
Wall_Down = 13;
|
||||
Wall_Left = 14;
|
||||
Wall_Corner_TopRight = 15;
|
||||
Wall_Corner_TopLeft = 16;
|
||||
Wall_Corner_BottomRight = 17;
|
||||
Wall_Corner_BottomRight_Outside = 23;
|
||||
Wall_Corner_BottomLeft = 18;
|
||||
Wall_Corner_BottomLeft_Outside = 21;
|
||||
Wall_Corner_BottomLeft_Half_Outside = 22;
|
||||
Roof_Wood_Single = 19;
|
||||
Stair_Down = 20;
|
||||
}
|
||||
|
||||
}
|
||||
case 23:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TileConsts::TileConsts() {
|
||||
Floor = 1;
|
||||
Floor_Var1 = 2;
|
||||
Floor_Up = 3;
|
||||
Floor_Left = 4;
|
||||
Floor_Down = 5;
|
||||
Floor_Right = 6;
|
||||
Floor_UpRight = 7;
|
||||
Floor_UpLeft = 8;
|
||||
Floor_DownLeft = 9;
|
||||
Floor_DownRight = 10;
|
||||
Wall_Up = 11;
|
||||
Wall_Right = 12;
|
||||
Wall_Down = 13;
|
||||
Wall_Left = 14;
|
||||
Wall_Corner_TopRight = 15;
|
||||
Wall_Corner_TopLeft = 16;
|
||||
Wall_Corner_BottomRight = 17;
|
||||
Wall_Corner_BottomRight_Outside = 23;
|
||||
Wall_Corner_BottomLeft = 18;
|
||||
Wall_Corner_BottomLeft_Outside = 21;
|
||||
Wall_Corner_BottomLeft_Half_Outside = 22;
|
||||
Roof_Wood_Single = 19;
|
||||
Stair_Down = 20;
|
||||
}
|
||||
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -3,61 +3,84 @@
|
||||
|
||||
using namespace System;
|
||||
namespace BS {
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class TileConsts : public virtual Object
|
||||
{
|
||||
public:
|
||||
char Floor;
|
||||
public:
|
||||
char Floor_Var1;
|
||||
public:
|
||||
char Floor_Up;
|
||||
public:
|
||||
char Floor_Left;
|
||||
public:
|
||||
char Floor_Down;
|
||||
public:
|
||||
char Floor_Right;
|
||||
public:
|
||||
char Floor_UpRight;
|
||||
public:
|
||||
char Floor_UpLeft;
|
||||
public:
|
||||
char Floor_DownLeft;
|
||||
public:
|
||||
char Floor_DownRight;
|
||||
public:
|
||||
char Wall_Up;
|
||||
public:
|
||||
char Wall_Right;
|
||||
public:
|
||||
char Wall_Down;
|
||||
public:
|
||||
char Wall_Left;
|
||||
public:
|
||||
char Wall_Corner_TopRight;
|
||||
public:
|
||||
char Wall_Corner_TopLeft;
|
||||
public:
|
||||
char Wall_Corner_BottomRight;
|
||||
public:
|
||||
char Wall_Corner_BottomRight_Outside;
|
||||
public:
|
||||
char Wall_Corner_BottomLeft;
|
||||
public:
|
||||
char Wall_Corner_BottomLeft_Outside;
|
||||
public:
|
||||
char Wall_Corner_BottomLeft_Half_Outside;
|
||||
public:
|
||||
char Roof_Wood_Single;
|
||||
public:
|
||||
char Stair_Down;
|
||||
public:
|
||||
static bool isWall(char tile);
|
||||
public:
|
||||
TileConsts();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Levels {
|
||||
namespace Generator {
|
||||
class TileConsts : public virtual Object {
|
||||
public:
|
||||
char Floor;
|
||||
|
||||
public:
|
||||
char Floor_Var1;
|
||||
|
||||
public:
|
||||
char Floor_Up;
|
||||
|
||||
public:
|
||||
char Floor_Left;
|
||||
|
||||
public:
|
||||
char Floor_Down;
|
||||
|
||||
public:
|
||||
char Floor_Right;
|
||||
|
||||
public:
|
||||
char Floor_UpRight;
|
||||
|
||||
public:
|
||||
char Floor_UpLeft;
|
||||
|
||||
public:
|
||||
char Floor_DownLeft;
|
||||
|
||||
public:
|
||||
char Floor_DownRight;
|
||||
|
||||
public:
|
||||
char Wall_Up;
|
||||
|
||||
public:
|
||||
char Wall_Right;
|
||||
|
||||
public:
|
||||
char Wall_Down;
|
||||
|
||||
public:
|
||||
char Wall_Left;
|
||||
|
||||
public:
|
||||
char Wall_Corner_TopRight;
|
||||
|
||||
public:
|
||||
char Wall_Corner_TopLeft;
|
||||
|
||||
public:
|
||||
char Wall_Corner_BottomRight;
|
||||
|
||||
public:
|
||||
char Wall_Corner_BottomRight_Outside;
|
||||
|
||||
public:
|
||||
char Wall_Corner_BottomLeft;
|
||||
|
||||
public:
|
||||
char Wall_Corner_BottomLeft_Outside;
|
||||
|
||||
public:
|
||||
char Wall_Corner_BottomLeft_Half_Outside;
|
||||
|
||||
public:
|
||||
char Roof_Wood_Single;
|
||||
|
||||
public:
|
||||
char Stair_Down;
|
||||
|
||||
public:
|
||||
static bool isWall(char tile);
|
||||
|
||||
public:
|
||||
TileConsts();
|
||||
};
|
||||
} // namespace Generator
|
||||
} // namespace Levels
|
||||
} // namespace BS
|
||||
|
@ -1,16 +1,16 @@
|
||||
#include "register_types.h"
|
||||
|
||||
#include "data/dungeon_room_data.h"
|
||||
#include "data/biome_data.h"
|
||||
#include "data/dungeon_corridor_data.h"
|
||||
#include "data/dungeon_data.h"
|
||||
#include "data/biome_data.h"
|
||||
#include "data/dungeon_room_data.h"
|
||||
#include "data/planet_data.h"
|
||||
#include "data/world_generator_prop_data.h"
|
||||
|
||||
#include "main/dungeon_room.h"
|
||||
#include "main/dungeon_corridor.h"
|
||||
#include "main/dungeon.h"
|
||||
#include "main/biome.h"
|
||||
#include "main/dungeon.h"
|
||||
#include "main/dungeon_corridor.h"
|
||||
#include "main/dungeon_room.h"
|
||||
#include "main/planet.h"
|
||||
|
||||
#include "world_generator.h"
|
||||
@ -30,9 +30,7 @@ void register_world_generator_types() {
|
||||
ClassDB::register_class<Planet>();
|
||||
|
||||
ClassDB::register_class<WorldGenerator>();
|
||||
}
|
||||
|
||||
void unregister_world_generator_types() {
|
||||
|
||||
}
|
||||
|
||||
void unregister_world_generator_types() {
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ Ref<Planet> WorldGenerator::setup_planet(int seed) {
|
||||
}
|
||||
|
||||
WorldGenerator::WorldGenerator() {
|
||||
|
||||
}
|
||||
WorldGenerator::~WorldGenerator() {
|
||||
_planet_datas.clear();
|
||||
|
@ -8,10 +8,9 @@
|
||||
|
||||
#include "main/planet.h"
|
||||
|
||||
|
||||
class WorldGenerator : public Resource {
|
||||
GDCLASS(WorldGenerator, Resource);
|
||||
|
||||
|
||||
public:
|
||||
Ref<PlanetData> get_planet_data(const int index) const;
|
||||
void set_planet_data(const int index, const Ref<PlanetData> planet_data);
|
||||
@ -32,7 +31,6 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Vector<Ref<PlanetData> > _planet_datas;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user