Setup class config file directory structure

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/28/head
Nic0Nic0Nii 1 year ago
parent 1e08589403
commit 3cb8c43da1
  1. 18
      Crawler/Crawler.cpp
  2. 19
      Crawler/Crawler.h
  3. 6
      Crawler/Player.h
  4. 32
      Crawler/Ranger.cpp
  5. 32
      Crawler/Thief.cpp
  6. 32
      Crawler/Trapper.cpp
  7. 32
      Crawler/Warrior.cpp
  8. 32
      Crawler/Witch.cpp
  9. 32
      Crawler/Wizard.cpp
  10. 4
      Crawler/assets/config/classes/Ranger.txt
  11. 4
      Crawler/assets/config/classes/Thief.txt
  12. 4
      Crawler/assets/config/classes/Trapper.txt
  13. 9
      Crawler/assets/config/classes/Warrior.txt
  14. 4
      Crawler/assets/config/classes/Witch.txt
  15. 4
      Crawler/assets/config/classes/Wizard.txt
  16. 8
      Crawler/assets/config/configuration.txt
  17. 20
      Crawler/config.h

@ -14,6 +14,7 @@
#include <set>
#include <queue>
#include "Emitter.h"
#include "config.h"
INCLUDE_EMITTER_LIST
@ -50,6 +51,13 @@ Crawler::Crawler()
std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S;
utils::datafile::Read(DATA,MAP_CONFIG);
for(std::string&cl:DATA.GetProperty("class_list").GetValues()){
std::cout<<cl<<std::endl;
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
}
std::cout<<"Warrior.Right Click Ability.testNumber"_I<<std::endl;
}
bool Crawler::OnUserCreate(){
@ -115,7 +123,7 @@ bool Crawler::OnUserCreate(){
view=TileTransformedView{GetScreenSize(),{1,1}};
LoadLevel(CAMPAIGN_1_1);
InitializeClassAbilities();
InitializeClasses();
ChangePlayerClass(WARRIOR);
Warrior::ability4=Ranger::ability1; //Class ability swapping demonstration.
@ -1098,7 +1106,13 @@ void Crawler::ChangePlayerClass(Class cl){
GetPlayer()->UpdateIdleAnimation(DOWN);
}
void Crawler::InitializeClassAbilities(){
void Crawler::InitializeClasses(){
Warrior::Initialize();
Thief::Initialize();
Ranger::Initialize();
Trapper::Initialize();
Wizard::Initialize();
Witch::Initialize();
Warrior::InitializeClassAbilities();
Thief::InitializeClassAbilities();
Ranger::InitializeClassAbilities();

@ -51,7 +51,7 @@ private:
std::vector<TileGroup>upperForegroundTileGroups;
int bridgeLayerIndex=-1;
float bridgeFadeFactor=0.f;
void InitializeClassAbilities();
void InitializeClasses();
public:
Crawler();
bool OnUserCreate() override;
@ -108,20 +108,3 @@ public:
double GetDouble(std::string key);
datafiledoubledata GetDoubleList(std::string key);
};
//Read a string array from the config.
datafilestringdata operator ""_s(const char*key,std::size_t len);
//Read an int array from the config.
datafileintdata operator ""_i(const char*key,std::size_t len);
//Read a float array from the config.
datafilefloatdata operator ""_f(const char*key,std::size_t len);
//Read a double array from the config.
datafiledoubledata operator ""_d(const char*key,std::size_t len);
//Read a string key from the config.
std::string operator ""_S(const char*key,std::size_t len);
//Read an integer key from the config.
int operator ""_I(const char*key,std::size_t len);
//Read a float key from the config.
float operator ""_F(const char*key,std::size_t len);
//Read a double key from the config.
double operator ""_D(const char*key,std::size_t len);

@ -166,6 +166,7 @@ struct Warrior:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Warrior();
Warrior(Player*player);
Class GetClass()override;
@ -194,6 +195,7 @@ struct Thief:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Thief();
Thief(Player*player);
Class GetClass()override;
@ -222,6 +224,7 @@ struct Ranger:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Ranger();
Ranger(Player*player);
Class GetClass()override;
@ -250,6 +253,7 @@ struct Trapper:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Trapper();
Trapper(Player*player);
Class GetClass()override;
@ -278,6 +282,7 @@ struct Wizard:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Wizard();
Wizard(Player*player);
Class GetClass()override;
@ -306,6 +311,7 @@ struct Witch:Player{
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Witch();
Witch(Player*player);
Class GetClass()override;

@ -11,21 +11,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Ranger::name="Ranger";
Class Ranger::cl=RANGER;
Ability Ranger::rightClickAbility=Ability("Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE);
Ability Ranger::ability1=Ability("Rapid Fire",12,35);
Ability Ranger::ability2=Ability("Charged Shot",15,40,VERY_DARK_RED,DARK_RED,PrecastData(0.3));
Ability Ranger::ability3=Ability("Multishot",25,50);
Ability Ranger::ability4=Ability("???",0,0);
AnimationState Ranger::idle_n=RANGER_IDLE_N;
AnimationState Ranger::idle_e=RANGER_IDLE_E;
AnimationState Ranger::idle_s=RANGER_IDLE_S;
AnimationState Ranger::idle_w=RANGER_IDLE_W;
AnimationState Ranger::walk_n=RANGER_WALK_N;
AnimationState Ranger::walk_e=RANGER_WALK_E;
AnimationState Ranger::walk_s=RANGER_WALK_S;
AnimationState Ranger::walk_w=RANGER_WALK_W;
void Ranger::Initialize(){
Ranger::name="Ranger";
Ranger::cl=RANGER;
Ranger::rightClickAbility=Ability("Retreat",7,0,VERY_DARK_BLUE,DARK_BLUE);
Ranger::ability1=Ability("Rapid Fire",12,35);
Ranger::ability2=Ability("Charged Shot",15,40,VERY_DARK_RED,DARK_RED,PrecastData(0.3));
Ranger::ability3=Ability("Multishot",25,50);
Ranger::ability4=Ability("???",0,0);
Ranger::idle_n=RANGER_IDLE_N;
Ranger::idle_e=RANGER_IDLE_E;
Ranger::idle_s=RANGER_IDLE_S;
Ranger::idle_w=RANGER_IDLE_W;
Ranger::walk_n=RANGER_WALK_N;
Ranger::walk_e=RANGER_WALK_E;
Ranger::walk_s=RANGER_WALK_S;
Ranger::walk_w=RANGER_WALK_W;
}
SETUP_CLASS(Ranger)

@ -9,21 +9,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Thief::name="Thief";
Class Thief::cl=THIEF;
Ability Thief::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Ability Thief::ability1={"???",12,40};
Ability Thief::ability2={"???",15,50};
Ability Thief::ability3={"???",40,60};
Ability Thief::ability4={"???",0,0};
AnimationState Thief::idle_n=WARRIOR_IDLE_N;
AnimationState Thief::idle_e=WARRIOR_IDLE_E;
AnimationState Thief::idle_s=WARRIOR_IDLE_S;
AnimationState Thief::idle_w=WARRIOR_IDLE_W;
AnimationState Thief::walk_n=WARRIOR_WALK_N;
AnimationState Thief::walk_e=WARRIOR_WALK_E;
AnimationState Thief::walk_s=WARRIOR_WALK_S;
AnimationState Thief::walk_w=WARRIOR_WALK_W;
void Thief::Initialize(){
Thief::name="Thief";
Thief::cl=THIEF;
Thief::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Thief::ability1={"???",12,40};
Thief::ability2={"???",15,50};
Thief::ability3={"???",40,60};
Thief::ability4={"???",0,0};
Thief::idle_n=WARRIOR_IDLE_N;
Thief::idle_e=WARRIOR_IDLE_E;
Thief::idle_s=WARRIOR_IDLE_S;
Thief::idle_w=WARRIOR_IDLE_W;
Thief::walk_n=WARRIOR_WALK_N;
Thief::walk_e=WARRIOR_WALK_E;
Thief::walk_s=WARRIOR_WALK_S;
Thief::walk_w=WARRIOR_WALK_W;
}
SETUP_CLASS(Thief)

@ -9,21 +9,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Trapper::name="Trapper";
Class Trapper::cl=TRAPPER;
Ability Trapper::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Ability Trapper::ability1={"???",12,40};
Ability Trapper::ability2={"???",15,50};
Ability Trapper::ability3={"???",40,60};
Ability Trapper::ability4={"???",0,0};
AnimationState Trapper::idle_n=WARRIOR_IDLE_N;
AnimationState Trapper::idle_e=WARRIOR_IDLE_E;
AnimationState Trapper::idle_s=WARRIOR_IDLE_S;
AnimationState Trapper::idle_w=WARRIOR_IDLE_W;
AnimationState Trapper::walk_n=WARRIOR_WALK_N;
AnimationState Trapper::walk_e=WARRIOR_WALK_E;
AnimationState Trapper::walk_s=WARRIOR_WALK_S;
AnimationState Trapper::walk_w=WARRIOR_WALK_W;
void Trapper::Initialize(){
Trapper::name="Trapper";
Trapper::cl=TRAPPER;
Trapper::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Trapper::ability1={"???",12,40};
Trapper::ability2={"???",15,50};
Trapper::ability3={"???",40,60};
Trapper::ability4={"???",0,0};
Trapper::idle_n=WARRIOR_IDLE_N;
Trapper::idle_e=WARRIOR_IDLE_E;
Trapper::idle_s=WARRIOR_IDLE_S;
Trapper::idle_w=WARRIOR_IDLE_W;
Trapper::walk_n=WARRIOR_WALK_N;
Trapper::walk_e=WARRIOR_WALK_E;
Trapper::walk_s=WARRIOR_WALK_S;
Trapper::walk_w=WARRIOR_WALK_W;
}
SETUP_CLASS(Trapper)

@ -9,21 +9,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Warrior::name="Warrior";
Class Warrior::cl=WARRIOR;
Ability Warrior::rightClickAbility={"Block",15,0,VERY_DARK_BLUE,DARK_BLUE};
Ability Warrior::ability1={"Battlecry",12,40};
Ability Warrior::ability2={"Ground Slam",15,50};
Ability Warrior::ability3={"Sonic Slash",40,60};
Ability Warrior::ability4={"???",0,0};
AnimationState Warrior::idle_n=WARRIOR_IDLE_N;
AnimationState Warrior::idle_e=WARRIOR_IDLE_E;
AnimationState Warrior::idle_s=WARRIOR_IDLE_S;
AnimationState Warrior::idle_w=WARRIOR_IDLE_W;
AnimationState Warrior::walk_n=WARRIOR_WALK_N;
AnimationState Warrior::walk_e=WARRIOR_WALK_E;
AnimationState Warrior::walk_s=WARRIOR_WALK_S;
AnimationState Warrior::walk_w=WARRIOR_WALK_W;
void Warrior::Initialize(){
Warrior::name="Warrior";
Warrior::cl=WARRIOR;
Warrior::rightClickAbility={"Block",15,0,VERY_DARK_BLUE,DARK_BLUE};
Warrior::ability1={"Battlecry",12,40};
Warrior::ability2={"Ground Slam",15,50};
Warrior::ability3={"Sonic Slash",40,60};
Warrior::ability4={"???",0,0};
Warrior::idle_n=WARRIOR_IDLE_N;
Warrior::idle_e=WARRIOR_IDLE_E;
Warrior::idle_s=WARRIOR_IDLE_S;
Warrior::idle_w=WARRIOR_IDLE_W;
Warrior::walk_n=WARRIOR_WALK_N;
Warrior::walk_e=WARRIOR_WALK_E;
Warrior::walk_s=WARRIOR_WALK_S;
Warrior::walk_w=WARRIOR_WALK_W;
}
SETUP_CLASS(Warrior)

@ -9,21 +9,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Witch::name="Witch";
Class Witch::cl=WITCH;
Ability Witch::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Ability Witch::ability1={"???",12,40};
Ability Witch::ability2={"???",15,50};
Ability Witch::ability3={"???",40,60};
Ability Witch::ability4={"???",0,0};
AnimationState Witch::idle_n=WARRIOR_IDLE_N;
AnimationState Witch::idle_e=WARRIOR_IDLE_E;
AnimationState Witch::idle_s=WARRIOR_IDLE_S;
AnimationState Witch::idle_w=WARRIOR_IDLE_W;
AnimationState Witch::walk_n=WARRIOR_WALK_N;
AnimationState Witch::walk_e=WARRIOR_WALK_E;
AnimationState Witch::walk_s=WARRIOR_WALK_S;
AnimationState Witch::walk_w=WARRIOR_WALK_W;
void Witch::Initialize(){
Witch::name="Witch";
Witch::cl=WITCH;
Witch::rightClickAbility={"???",15,0,VERY_DARK_BLUE,DARK_BLUE};
Witch::ability1={"???",12,40};
Witch::ability2={"???",15,50};
Witch::ability3={"???",40,60};
Witch::ability4={"???",0,0};
Witch::idle_n=WARRIOR_IDLE_N;
Witch::idle_e=WARRIOR_IDLE_E;
Witch::idle_s=WARRIOR_IDLE_S;
Witch::idle_w=WARRIOR_IDLE_W;
Witch::walk_n=WARRIOR_WALK_N;
Witch::walk_e=WARRIOR_WALK_E;
Witch::walk_s=WARRIOR_WALK_S;
Witch::walk_w=WARRIOR_WALK_W;
}
SETUP_CLASS(Witch)

@ -10,21 +10,23 @@ INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
INCLUDE_game
std::string Wizard::name="Wizard";
Class Wizard::cl=WIZARD;
Ability Wizard::rightClickAbility={"Teleport",8,5,VERY_DARK_BLUE,DARK_BLUE};
Ability Wizard::ability1={"Firebolt",6,30};
Ability Wizard::ability2={"Lightning Bolt",6,25};
Ability Wizard::ability3={"Meteor",40,75,VERY_DARK_RED,VERY_DARK_RED,PrecastData(1.5,9*24,4*24)};
Ability Wizard::ability4={"???",0,0};
AnimationState Wizard::idle_n=WIZARD_IDLE_N;
AnimationState Wizard::idle_e=WIZARD_IDLE_E;
AnimationState Wizard::idle_s=WIZARD_IDLE_S;
AnimationState Wizard::idle_w=WIZARD_IDLE_W;
AnimationState Wizard::walk_n=WIZARD_WALK_N;
AnimationState Wizard::walk_e=WIZARD_WALK_E;
AnimationState Wizard::walk_s=WIZARD_WALK_S;
AnimationState Wizard::walk_w=WIZARD_WALK_W;
void Wizard::Initialize(){
Wizard::name="Wizard";
Wizard::cl=WIZARD;
Wizard::rightClickAbility={"Teleport",8,5,VERY_DARK_BLUE,DARK_BLUE};
Wizard::ability1={"Firebolt",6,30};
Wizard::ability2={"Lightning Bolt",6,25};
Wizard::ability3={"Meteor",40,75,VERY_DARK_RED,VERY_DARK_RED,PrecastData(1.5,9*24,4*24)};
Wizard::ability4={"???",0,0};
Wizard::idle_n=WIZARD_IDLE_N;
Wizard::idle_e=WIZARD_IDLE_E;
Wizard::idle_s=WIZARD_IDLE_S;
Wizard::idle_w=WIZARD_IDLE_W;
Wizard::walk_n=WIZARD_WALK_N;
Wizard::walk_e=WIZARD_WALK_E;
Wizard::walk_s=WIZARD_WALK_S;
Wizard::walk_w=WIZARD_WALK_W;
}
SETUP_CLASS(Wizard)

@ -0,0 +1,9 @@
Warrior
{
ClassName = Warrior
Right Click Ability
{
testNumber = 1
}
}

@ -7,4 +7,10 @@ WINDOW_SIZE = 360,240
gfx_config = gfx/gfx.txt
# Map Files Loading Config
map_config = levels.txt
map_config = levels.txt
# Path to class configuration files
class_directory = classes/
# Class list to be loaded into the game.
class_list = Warrior, Thief, Ranger, Trapper, Wizard, Witch

@ -0,0 +1,20 @@
#include "olcUTIL_DataFile.h"
using namespace olc;
//Read a string array from the config.
utils::datafilestringdata operator ""_s(const char*key,std::size_t len);
//Read an int array from the config.
utils::datafileintdata operator ""_i(const char*key,std::size_t len);
//Read a float array from the config.
utils::datafilefloatdata operator ""_f(const char*key,std::size_t len);
//Read a double array from the config.
utils::datafiledoubledata operator ""_d(const char*key,std::size_t len);
//Read a string key from the config.
std::string operator ""_S(const char*key,std::size_t len);
//Read an integer key from the config.
int operator ""_I(const char*key,std::size_t len);
//Read a float key from the config.
float operator ""_F(const char*key,std::size_t len);
//Read a double key from the config.
double operator ""_D(const char*key,std::size_t len);
Loading…
Cancel
Save