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_EVENTPAGE_H
13 #define LCF_RPG_EVENTPAGE_H
14 
15 // Headers
16 #include <stdint.h>
17 #include <vector>
18 #include "lcf/dbstring.h"
19 #include "lcf/enum_tags.h"
20 #include "lcf/rpg/eventcommand.h"
21 #include "lcf/rpg/eventpagecondition.h"
22 #include "lcf/rpg/moveroute.h"
23 #include "lcf/context.h"
24 #include <ostream>
25 #include <type_traits>
26 
27 /**
28  * rpg::EventPage class.
29  */
30 namespace lcf {
31 namespace rpg {
32 	class EventPage {
33 	public:
34 		enum Direction {
35 			Direction_up = 0,
36 			Direction_right = 1,
37 			Direction_down = 2,
38 			Direction_left = 3
39 		};
40 		static constexpr auto kDirectionTags = lcf::makeEnumTags<Direction>(
41 			"up",
42 			"right",
43 			"down",
44 			"left"
45 		);
46 		enum Frame {
47 			Frame_left = 0,
48 			Frame_middle = 1,
49 			Frame_right = 2,
50 			Frame_middle2 = 3
51 		};
52 		static constexpr auto kFrameTags = lcf::makeEnumTags<Frame>(
53 			"left",
54 			"middle",
55 			"right",
56 			"middle2"
57 		);
58 		enum MoveType {
59 			MoveType_stationary = 0,
60 			MoveType_random = 1,
61 			MoveType_vertical = 2,
62 			MoveType_horizontal = 3,
63 			MoveType_toward = 4,
64 			MoveType_away = 5,
65 			MoveType_custom = 6
66 		};
67 		static constexpr auto kMoveTypeTags = lcf::makeEnumTags<MoveType>(
68 			"stationary",
69 			"random",
70 			"vertical",
71 			"horizontal",
72 			"toward",
73 			"away",
74 			"custom"
75 		);
76 		enum Trigger {
77 			Trigger_action = 0,
78 			Trigger_touched = 1,
79 			Trigger_collision = 2,
80 			Trigger_auto_start = 3,
81 			Trigger_parallel = 4
82 		};
83 		static constexpr auto kTriggerTags = lcf::makeEnumTags<Trigger>(
84 			"action",
85 			"touched",
86 			"collision",
87 			"auto_start",
88 			"parallel"
89 		);
90 		enum Layers {
91 			Layers_below = 0,
92 			Layers_same = 1,
93 			Layers_above = 2
94 		};
95 		static constexpr auto kLayersTags = lcf::makeEnumTags<Layers>(
96 			"below",
97 			"same",
98 			"above"
99 		);
100 		enum AnimType {
101 			AnimType_non_continuous = 0,
102 			AnimType_continuous = 1,
103 			AnimType_fixed_non_continuous = 2,
104 			AnimType_fixed_continuous = 3,
105 			AnimType_fixed_graphic = 4,
106 			AnimType_spin = 5,
107 			AnimType_step_frame_fix = 6
108 		};
109 		static constexpr auto kAnimTypeTags = lcf::makeEnumTags<AnimType>(
110 			"non_continuous",
111 			"continuous",
112 			"fixed_non_continuous",
113 			"fixed_continuous",
114 			"fixed_graphic",
115 			"spin",
116 			"step_frame_fix"
117 		);
118 		enum MoveSpeed {
119 			MoveSpeed_eighth = 1,
120 			MoveSpeed_quarter = 2,
121 			MoveSpeed_half = 3,
122 			MoveSpeed_normal = 4,
123 			MoveSpeed_double = 5,
124 			MoveSpeed_fourfold = 6
125 		};
126 		enum ManiacEventInfo {
127 			ManiacEventInfo_action = 0,
128 			ManiacEventInfo_touched = 1,
129 			ManiacEventInfo_collision = 2,
130 			ManiacEventInfo_auto_start = 3,
131 			ManiacEventInfo_parallel = 4,
132 			ManiacEventInfo_called = 5,
133 			ManiacEventInfo_battle_start = 6,
134 			ManiacEventInfo_battle_parallel = 7,
135 			ManiacEventInfo_map_event = 16,
136 			ManiacEventInfo_common_event = 32,
137 			ManiacEventInfo_battle_event = 64
138 		};
139 
140 		int ID = 0;
141 		EventPageCondition condition;
142 		DBString character_name;
143 		int32_t character_index = 0;
144 		int32_t character_direction = 2;
145 		int32_t character_pattern = 1;
146 		bool translucent = false;
147 		int32_t move_type = 1;
148 		int32_t move_frequency = 3;
149 		int32_t trigger = 0;
150 		int32_t layer = 0;
151 		bool overlap_forbidden = false;
152 		int32_t animation_type = 0;
153 		int32_t move_speed = 3;
154 		MoveRoute move_route;
155 		std::vector<EventCommand> event_commands;
156 	};
157 	inline std::ostream& operator<<(std::ostream& os, EventPage::Direction code) {
158 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
159 		return os;
160 	}
161 	inline std::ostream& operator<<(std::ostream& os, EventPage::Frame code) {
162 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
163 		return os;
164 	}
165 	inline std::ostream& operator<<(std::ostream& os, EventPage::MoveType code) {
166 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
167 		return os;
168 	}
169 	inline std::ostream& operator<<(std::ostream& os, EventPage::Trigger code) {
170 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
171 		return os;
172 	}
173 	inline std::ostream& operator<<(std::ostream& os, EventPage::Layers code) {
174 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
175 		return os;
176 	}
177 	inline std::ostream& operator<<(std::ostream& os, EventPage::AnimType code) {
178 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
179 		return os;
180 	}
181 	inline std::ostream& operator<<(std::ostream& os, EventPage::MoveSpeed code) {
182 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
183 		return os;
184 	}
185 	inline std::ostream& operator<<(std::ostream& os, EventPage::ManiacEventInfo code) {
186 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
187 		return os;
188 	}
189 
190 	inline bool operator==(const EventPage& l, const EventPage& r) {
191 		return l.condition == r.condition
192 		&& l.character_name == r.character_name
193 		&& l.character_index == r.character_index
194 		&& l.character_direction == r.character_direction
195 		&& l.character_pattern == r.character_pattern
196 		&& l.translucent == r.translucent
197 		&& l.move_type == r.move_type
198 		&& l.move_frequency == r.move_frequency
199 		&& l.trigger == r.trigger
200 		&& l.layer == r.layer
201 		&& l.overlap_forbidden == r.overlap_forbidden
202 		&& l.animation_type == r.animation_type
203 		&& l.move_speed == r.move_speed
204 		&& l.move_route == r.move_route
205 		&& l.event_commands == r.event_commands;
206 	}
207 
208 	inline bool operator!=(const EventPage& l, const EventPage& r) {
209 		return !(l == r);
210 	}
211 
212 	std::ostream& operator<<(std::ostream& os, const EventPage& obj);
213 
214 	template <typename F, typename ParentCtx = Context<void,void>>
215 	void ForEachString(EventPage& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
216 		const auto ctx1 = Context<EventPage, ParentCtx>{ "condition", -1, &obj, parent_ctx };
217 		ForEachString(obj.condition, f, &ctx1);
218 		const auto ctx2 = Context<EventPage, ParentCtx>{ "character_name", -1, &obj, parent_ctx };
219 		f(obj.character_name, ctx2);
220 		const auto ctx14 = Context<EventPage, ParentCtx>{ "move_route", -1, &obj, parent_ctx };
221 		ForEachString(obj.move_route, f, &ctx14);
222 		for (int i = 0; i < static_cast<int>(obj.event_commands.size()); ++i) {
223 			const auto ctx15 = Context<EventPage, ParentCtx>{ "event_commands", i, &obj, parent_ctx };
224 			ForEachString(obj.event_commands[i], f, &ctx15);
225 		}
226 		(void)obj;
227 		(void)f;
228 		(void)parent_ctx;
229 	}
230 
231 } // namespace rpg
232 } // namespace lcf
233 
234 #endif
235