Created
September 5, 2016 17:51
-
-
Save ShawnMcGrath/3cc49c2e4b7c754f6cdd84199ee78737 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I'm dropping this from the game in favour of a more dynamic system, but I wanted to keep this around somewhere because | |
I'll be using this 'pattern' for something similar again and didn't want to fuss with sytax. Maybe you'll find it useful | |
*/ | |
#define ANIM_LIST \ | |
/* EnumName, var_name, max */ \ | |
ALF(Invalid, invalid, 1) \ | |
ALF(Idle, idle, 4) \ | |
ALF(Spawn, spawn, 4) \ | |
ALF(Taunt, taunt, 2) \ | |
ALF(MoveSlow, move_slow, 2) \ | |
ALF(MoveNormal, move_normal, 6) \ | |
ALF(MoveFast, move_fast, 2) \ | |
ALF(Boost, boost, 1) \ | |
ALF(LowHealthMove, low_health_move, 2) \ | |
ALF(Ability0, ability0, 4) \ | |
ALF(Ability1, ability1, 4) \ | |
ALF(Ability2, ability2, 4) \ | |
ALF(Ability3, ability3, 4) \ | |
ALF(Ability4, ability4, 4) \ | |
ALF(Ability5, ability5, 4) \ | |
ALF(Ability6, ability6, 4) \ | |
ALF(Ability7, ability7, 4) \ | |
ALF(Ability8, ability8, 4) \ | |
ALF(Ability9, ability9, 4) \ | |
ALF(HurtFront, hurt_front, 4) \ | |
ALF(HurtSide, hurt_side, 4) \ | |
ALF(HurtBack, hurt_back, 4) \ | |
ALF(Death, death, 4) | |
#define ALF(name, ...) AnimSlot_##name, | |
enum AnimSlot_Enum { | |
ANIM_LIST | |
}; | |
#undef ALF | |
#define ALF(name, var_name, max, ...) static const int MAX_NUM_ANIMS_##name = max; | |
ANIM_LIST | |
#undef ALF | |
#define ALF(name, var_name, max, ...) MG_MACROSTRINGIZE(name), | |
static const char *ANIM_SLOT_NAMES[] = { | |
ANIM_LIST | |
}; | |
#undef ALF | |
struct Character { | |
# define ALF(name, var_name, max) Anim var_name[max]; | |
ANIM_LIST | |
# undef ALF | |
}; | |
struct CharInstance { | |
# define ALF(name, var_name, max) AnimControl var_name##_##control; | |
ANIM_LIST | |
# undef ALF | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment