1 /* !!!! GENERATED FILE - DO NOT EDIT !!!!
2  * --------------------------------------
3  *
4  * This file is part of liblcf. Copyright (c) 2021 liblcf authors.
5  * https://github.com/EasyRPG/liblcf - https://easyrpg.org
6  *
7  * liblcf is Free/Libre Open Source Software, released under the MIT License.
8  * For the full copyright and license information, please view the COPYING
9  * file that was distributed with this source code.
10  */
11 
12 #ifndef LCF_RPG_BATTLERANIMATION_H
13 #define LCF_RPG_BATTLERANIMATION_H
14 
15 // Headers
16 #include <vector>
17 #include "lcf/dbstring.h"
18 #include "lcf/enum_tags.h"
19 #include "lcf/rpg/battleranimationpose.h"
20 #include "lcf/rpg/battleranimationweapon.h"
21 #include "lcf/context.h"
22 #include <ostream>
23 #include <type_traits>
24 
25 /**
26  * rpg::BattlerAnimation class.
27  */
28 namespace lcf {
29 namespace rpg {
30 	class BattlerAnimation {
31 	public:
32 		enum Speed {
33 			Speed_slow = 20,
34 			Speed_medium = 14,
35 			Speed_fast = 8
36 		};
37 		enum Pose {
38 			Pose_Idle = 0,
39 			Pose_AttackRight = 1,
40 			Pose_AttackLeft = 2,
41 			Pose_Skill = 3,
42 			Pose_Dead = 4,
43 			Pose_Damage = 5,
44 			Pose_Dazed = 6,
45 			Pose_Defend = 7,
46 			Pose_WalkLeft = 8,
47 			Pose_WalkRight = 9,
48 			Pose_Victory = 10,
49 			Pose_Item = 11
50 		};
51 		static constexpr auto kPoseTags = lcf::makeEnumTags<Pose>(
52 			"Idle",
53 			"AttackRight",
54 			"AttackLeft",
55 			"Skill",
56 			"Dead",
57 			"Damage",
58 			"Dazed",
59 			"Defend",
60 			"WalkLeft",
61 			"WalkRight",
62 			"Victory",
63 			"Item"
64 		);
65 
66 		int ID = 0;
67 		DBString name;
68 		int32_t speed = 20;
69 		std::vector<BattlerAnimationPose> poses;
70 		std::vector<BattlerAnimationWeapon> weapons;
71 	};
72 	inline std::ostream& operator<<(std::ostream& os, BattlerAnimation::Speed code) {
73 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
74 		return os;
75 	}
76 	inline std::ostream& operator<<(std::ostream& os, BattlerAnimation::Pose code) {
77 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
78 		return os;
79 	}
80 
81 	inline bool operator==(const BattlerAnimation& l, const BattlerAnimation& r) {
82 		return l.name == r.name
83 		&& l.speed == r.speed
84 		&& l.poses == r.poses
85 		&& l.weapons == r.weapons;
86 	}
87 
88 	inline bool operator!=(const BattlerAnimation& l, const BattlerAnimation& r) {
89 		return !(l == r);
90 	}
91 
92 	std::ostream& operator<<(std::ostream& os, const BattlerAnimation& obj);
93 
94 	template <typename F, typename ParentCtx = Context<void,void>>
95 	void ForEachString(BattlerAnimation& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
96 		const auto ctx1 = Context<BattlerAnimation, ParentCtx>{ "name", -1, &obj, parent_ctx };
97 		f(obj.name, ctx1);
98 		for (int i = 0; i < static_cast<int>(obj.poses.size()); ++i) {
99 			const auto ctx3 = Context<BattlerAnimation, ParentCtx>{ "poses", i, &obj, parent_ctx };
100 			ForEachString(obj.poses[i], f, &ctx3);
101 		}
102 		for (int i = 0; i < static_cast<int>(obj.weapons.size()); ++i) {
103 			const auto ctx4 = Context<BattlerAnimation, ParentCtx>{ "weapons", i, &obj, parent_ctx };
104 			ForEachString(obj.weapons[i], f, &ctx4);
105 		}
106 		(void)obj;
107 		(void)f;
108 		(void)parent_ctx;
109 	}
110 
111 } // namespace rpg
112 } // namespace lcf
113 
114 #endif
115