Added a bund of skeleton-related new classes. They aren't finished yet. Renamed the spells folder to infos.

This commit is contained in:
Relintai 2019-07-23 02:21:06 +02:00
parent ae3aa70f45
commit 1e0daf2e73
19 changed files with 233 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include "../entity_enums.h"
#include "../meshes/mesh_data_resource.h"
#include "../skeleton/entity_texture_layer.h"
class CharacterSkeletonVisualEntry : public Resource {
GDCLASS(CharacterSkeletonVisualEntry, Resource);
@ -16,6 +17,11 @@ class CharacterSkeletonVisualEntry : public Resource {
public:
static const String BINDING_STRING_BONE_ATTACHMENT_TYPES;
enum {
MAX_TEXTURE_LAYERS = 5
};
//not needed, delete
enum CharacterSkeletonVisualEntryType {
BONE_ATTACHMENT_TYPE_NONE = 0,
BONE_ATTACHMENT_TYPE_MESH = 1,
@ -50,6 +56,8 @@ private:
EntityEnums::CharacterSkeletonPoints _target_bone;
Ref<PackedScene> _effect;
Ref<MeshDataResource> _mesh;
//apply these from to to bottom, with color index 0, if index not present. store color index in item instance. Use the same index for all of them at once.
Ref<EntityTextureLayer> _texture_layers[MAX_TEXTURE_LAYERS];
};
VARIANT_ENUM_CAST(CharacterSkeletonVisualEntry::CharacterSkeletonVisualEntryType);

View File

@ -0,0 +1,13 @@
#include "character_spawn_info.h"
CharacterSpawnInfo::CharacterSpawnInfo() {
}
CharacterSpawnInfo::~CharacterSpawnInfo() {
}
void CharacterSpawnInfo::_bind_methods() {
}

24
infos/entity_spawn_info.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef ENTITY_SPAWN_INFO_H
#define ENTITY_SPAWN_INFO_H
#include "../entities/entity.h"
#include "core/reference.h"
class EntitySpawnInfo : public Reference {
GDCLASS(EntitySpawnInfo, Reference);
public:
CharacterSpawnInfo();
~CharacterSpawnInfo();
protected:
static void _bind_methods();
private:
int _class_id;
int _race;
int _visual_set_id;
};
#endif

View File

@ -0,0 +1,13 @@
#include "character_spawn_info.h"
CharacterSpawnInfo::CharacterSpawnInfo() {
}
CharacterSpawnInfo::~CharacterSpawnInfo() {
}
void CharacterSpawnInfo::_bind_methods() {
}

27
infos/player_spawn_info.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef ENTITY_SPAWN_INFO_H
#define ENTITY_SPAWN_INFO_H
#include "../entities/entity.h"
#include "core/reference.h"
class EntitySpawnInfo : public Reference {
GDCLASS(EntitySpawnInfo, Reference);
public:
CharacterSpawnInfo();
~CharacterSpawnInfo();
protected:
static void _bind_methods();
private:
int _class_id;
int _race;
int _skin_color_index;
int _item_ids[20];
int _item_color_indexes[20];
};
#endif

View File

View File

@ -0,0 +1,22 @@
#ifndef ENTITY_EQUIPSET_H
#define ENTITY_EQUIPSET_H
#include "core/resource.h"
#include "core/ustring.h"
class EntityEquipSet : public Resource {
GDCLASS(EntityEquipSet, Resource);
public:
protected:
static void _bind_methods();
enum {
MAX_ENTRIES = 20
};
private:
Ref<CharacterSkeletonVisualEntry> _entries[MAX_ENTRIES];
};
#endif

8
skeleton/entity_race.cpp Normal file
View File

@ -0,0 +1,8 @@
#include "entity_race.h"
void EntityRace::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::STRING, "_generate_name", PropertyInfo(Variant::INT, "seed")));
BIND_CONSTANT(MAX_SKIN_COLORS);
}

42
skeleton/entity_race.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef ENTITY_RACE_H
#define ENTITY_RACE_H
#include "core/resource.h"
#include "core/ustring.h"
class Spell;
class Aura;
class EntityRace : public Resource {
GDCLASS(EntityRace, Resource);
public:
enum {
MAX_SKIN_COLORS = 10,
MAX_SPELLS = 10,
MAX_AURAS = 10
};
enum EntityRaceType {
ENTITY_RACE_TYPE_NONE,
ENTITY_RACE_TYPE_HUMANOID,
ENTITY_RACE_TYPE_BEAST
};
String generate_name(int seed);
protected:
static void _bind_methods();
private:
String _name;
String _description;
//Ref<SkeletonData> _skeleton_data;
Color _preset_skin_colors[MAX_SKIN_COLORS];
Ref<Spell> _spells[MAX_SPELLS];
Ref<Aura> _auras[MAX_AURAS];
EntityRaceType _type;
};
#endif

View File

View File

@ -0,0 +1,30 @@
#ifndef ENTITY_SKELETON_DATA_H
#define ENTITY_SKELETON_DATA_H
#include "core/resource.h"
#include "core/ustring.h"
class EntitySkeletonData : public Resource {
GDCLASS(EntitySkeletonData, Resource);
public:
protected:
static void _bind_methods();
enum {
MAX_ENTRIES = 20
};
struct ESDataEntry {
Ref<CharacterSkeletonVisualEntry> entry;
Vector3 offset;
Vector3 rotation;
Vector3 scale;
};
private:
ESDataEntry _entries[MAX_ENTRIES];
};
#endif

View File

View File

@ -0,0 +1,45 @@
#ifndef ENTITY_TEXTURE_LAYER_H
#define ENTITY_TEXTURE_LAYER_H
#include "core/resource.h"
#include "core/ustring.h"
class EntityTextureLayer : public Resource {
GDCLASS(EntityTextureLayer, Resource);
public:
enum {
MAX_COLORS = 6
};
enum EntityTextureLayerLayers {
ENTITY_TEXTURE_LAYER_NONE = 0,
ENTITY_TEXTURE_LAYER_SKIN = 1,
ENTITY_TEXTURE_LAYER_UNDERWEAR = 2,
ENTITY_TEXTURE_LAYER_SHIRT = 3,
ENTITY_TEXTURE_LAYER_CLOTHES_BASE = 4,
ENTITY_TEXTURE_LAYER_BELT = 5,
ENTITY_TEXTURE_LAYER_TABARD = 6,
ENTITY_TEXTURE_LAYER_OVERLAY = 7
};
enum EntityTextureLayerRectId {
ENTITY_TEXTURE_LAYER_RECT_ID_FULL = 0,
ENTITY_TEXTURE_LAYER_RECT_ID_HEAD = 1,
ENTITY_TEXTURE_LAYER_RECT_ID_FOOT = 2,
//etc
};
Ref<Texture> get_texture();
void set_texture(Ref<Texture> texture);
protected:
static void _bind_methods();
private:
Ref<Texture> _texture;
int _layer;
Color _colors[MAX_COLORS];
};
#endif