Player animations now load dynamically from configuration files.
This commit is contained in:
parent
023c6f9005
commit
cbfcb2793f
@ -5,6 +5,7 @@
|
||||
|
||||
INCLUDE_game
|
||||
INCLUDE_ANIMATION_DATA
|
||||
INCLUDE_DATA
|
||||
|
||||
void sig::Animation::InitializeAnimations(){
|
||||
|
||||
@ -208,54 +209,14 @@ void sig::Animation::InitializeAnimations(){
|
||||
}
|
||||
|
||||
void sig::Animation::SetupPlayerAnimations(){
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_WALK_N");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_WALK_E");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_WALK_S");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_WALK_W");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_N");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_E");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_S");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_W");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_E");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_S");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_N");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_W");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_E");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_S");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_N");
|
||||
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_W");
|
||||
game->GetPlayer()->AddAnimation("RANGER_WALK_N");
|
||||
game->GetPlayer()->AddAnimation("RANGER_WALK_E");
|
||||
game->GetPlayer()->AddAnimation("RANGER_WALK_S");
|
||||
game->GetPlayer()->AddAnimation("RANGER_WALK_W");
|
||||
game->GetPlayer()->AddAnimation("RANGER_IDLE_N");
|
||||
game->GetPlayer()->AddAnimation("RANGER_IDLE_E");
|
||||
game->GetPlayer()->AddAnimation("RANGER_IDLE_S");
|
||||
game->GetPlayer()->AddAnimation("RANGER_IDLE_W");
|
||||
game->GetPlayer()->AddAnimation("RANGER_SHOOT_S");
|
||||
game->GetPlayer()->AddAnimation("RANGER_SHOOT_N");
|
||||
game->GetPlayer()->AddAnimation("RANGER_SHOOT_W");
|
||||
game->GetPlayer()->AddAnimation("RANGER_SHOOT_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_WALK_N");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_WALK_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_WALK_S");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_WALK_W");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_N");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_S");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_W");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_N");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_S");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_W");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_N");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_S");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_W");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_CAST_N");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_CAST_E");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_CAST_S");
|
||||
game->GetPlayer()->AddAnimation("WIZARD_CAST_W");
|
||||
int counter=0;
|
||||
while("Player"_A.HasProperty("PLAYER_ANIMATION["+std::to_string(counter)+"]")){
|
||||
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_N");
|
||||
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_E");
|
||||
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_S");
|
||||
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_W");
|
||||
counter++;
|
||||
}
|
||||
|
||||
ANIMATION_DATA.SetInitialized();
|
||||
}
|
@ -1173,7 +1173,6 @@ datafiledoubledata Crawler::GetDoubleList(std::string key){
|
||||
return {DATA,key};
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
char*testArr = new char[5000];
|
||||
@ -1254,3 +1253,10 @@ double operator ""_D(const char*key,std::size_t len){
|
||||
}
|
||||
return DATA.GetProperty(std::string(key,len)).GetReal();
|
||||
}
|
||||
|
||||
datafile operator ""_A(const char*key,std::size_t len){
|
||||
if(utils::datafile::DEBUG_ACCESS_OPTIONS){
|
||||
std::cout<<std::string(key,len)<<std::endl;
|
||||
}
|
||||
return DATA.GetProperty(std::string(key,len));
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 1020
|
||||
#define VERSION_BUILD 1025
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -22,8 +22,9 @@ Monsters
|
||||
ShootAnimation = 10, 0.1, OneShot
|
||||
DeathAnimation = 10, 0.1, OneShot
|
||||
|
||||
#Additional custom animations go down below. Start with ANIMATION[0]
|
||||
#ANIMATION[0] = MY_NEW_ANIMATION
|
||||
#Additional custom animations go down below. Start with ANIMATION[0]. Order is:
|
||||
# Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse)
|
||||
#ANIMATION[0] = 6, 0.1, Repeat
|
||||
}
|
||||
1
|
||||
{
|
||||
|
@ -11,4 +11,17 @@ Player
|
||||
|
||||
# How much speed the player loses while no momentum is being added.
|
||||
Friction = 400
|
||||
|
||||
# Each attack will have _N,_E,_S,_W appended to them once read in-game.
|
||||
PLAYER_ANIMATION[0] = WARRIOR_WALK
|
||||
PLAYER_ANIMATION[1] = WARRIOR_IDLE
|
||||
PLAYER_ANIMATION[2] = WARRIOR_SWINGSWORD
|
||||
PLAYER_ANIMATION[3] = WARRIOR_SWINGSONICSWORD
|
||||
PLAYER_ANIMATION[4] = RANGER_WALK
|
||||
PLAYER_ANIMATION[5] = RANGER_IDLE
|
||||
PLAYER_ANIMATION[6] = RANGER_SHOOT
|
||||
PLAYER_ANIMATION[7] = WIZARD_WALK
|
||||
PLAYER_ANIMATION[8] = WIZARD_IDLE_ATTACK
|
||||
PLAYER_ANIMATION[9] = WIZARD_ATTACK
|
||||
PLAYER_ANIMATION[10] = WIZARD_CAST
|
||||
}
|
@ -19,6 +19,8 @@ int operator ""_I(const char*key,std::size_t len);
|
||||
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);
|
||||
//Read a datafile indexed property from the config.
|
||||
utils::datafile operator ""_A(const char*key,std::size_t len);
|
||||
|
||||
Pixel operator ""_Pixel(const char*key,std::size_t len);
|
||||
float operator ""_FRange(const char*key,std::size_t len);
|
Loading…
x
Reference in New Issue
Block a user