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_SYSTEM_H
13 #define LCF_RPG_SYSTEM_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/music.h"
21 #include "lcf/rpg/sound.h"
22 #include "lcf/rpg/testbattler.h"
23 #include "lcf/context.h"
24 #include <ostream>
25 #include <type_traits>
26 
27 /**
28  * rpg::System class.
29  */
30 namespace lcf {
31 namespace rpg {
32 	class System {
33 	public:
34 		enum FadeOut {
35 			FadeOut_default = 0,
36 			FadeOut_fade_out = 1,
37 			FadeOut_remove_blocks = 2,
38 			FadeOut_wipe_downward = 3,
39 			FadeOut_wipe_upward = 4,
40 			FadeOut_venetian_blinds = 5,
41 			FadeOut_vertical_blinds = 6,
42 			FadeOut_horizontal_blinds = 7,
43 			FadeOut_receding_square = 8,
44 			FadeOut_expanding_square = 9,
45 			FadeOut_screen_moves_up = 10,
46 			FadeOut_screen_moves_down = 11,
47 			FadeOut_screen_moves_left = 12,
48 			FadeOut_screen_moves_right = 13,
49 			FadeOut_vertical_div = 14,
50 			FadeOut_horizontal_div = 15,
51 			FadeOut_quadrasection = 16,
52 			FadeOut_zoom_in = 17,
53 			FadeOut_mosaic = 18,
54 			FadeOut_waver_screen = 19,
55 			FadeOut_instantaneous = 20,
56 			FadeOut_none = 21
57 		};
58 		static constexpr auto kFadeOutTags = lcf::makeEnumTags<FadeOut>(
59 			"default",
60 			"fade_out",
61 			"remove_blocks",
62 			"wipe_downward",
63 			"wipe_upward",
64 			"venetian_blinds",
65 			"vertical_blinds",
66 			"horizontal_blinds",
67 			"receding_square",
68 			"expanding_square",
69 			"screen_moves_up",
70 			"screen_moves_down",
71 			"screen_moves_left",
72 			"screen_moves_right",
73 			"vertical_div",
74 			"horizontal_div",
75 			"quadrasection",
76 			"zoom_in",
77 			"mosaic",
78 			"waver_screen",
79 			"instantaneous",
80 			"none"
81 		);
82 		enum FadeIn {
83 			FadeIn_default = 0,
84 			FadeIn_fade_in = 1,
85 			FadeIn_reconstitute_blocks = 2,
86 			FadeIn_unwipe_downward = 3,
87 			FadeIn_unwipe_upward = 4,
88 			FadeIn_venetian_blinds = 5,
89 			FadeIn_vertical_blinds = 6,
90 			FadeIn_horizontal_blinds = 7,
91 			FadeIn_receding_square = 8,
92 			FadeIn_expanding_square = 9,
93 			FadeIn_screen_moves_down = 10,
94 			FadeIn_screen_moves_up = 11,
95 			FadeIn_screen_moves_right = 12,
96 			FadeIn_screen_moves_left = 13,
97 			FadeIn_vertical_unify = 14,
98 			FadeIn_horizontal_unify = 15,
99 			FadeIn_unify_quadrants = 16,
100 			FadeIn_zoom_out = 17,
101 			FadeIn_mosaic = 18,
102 			FadeIn_waver_screen = 19,
103 			FadeIn_instantaneous = 20,
104 			FadeIn_none = 21
105 		};
106 		static constexpr auto kFadeInTags = lcf::makeEnumTags<FadeIn>(
107 			"default",
108 			"fade_in",
109 			"reconstitute_blocks",
110 			"unwipe_downward",
111 			"unwipe_upward",
112 			"venetian_blinds",
113 			"vertical_blinds",
114 			"horizontal_blinds",
115 			"receding_square",
116 			"expanding_square",
117 			"screen_moves_down",
118 			"screen_moves_up",
119 			"screen_moves_right",
120 			"screen_moves_left",
121 			"vertical_unify",
122 			"horizontal_unify",
123 			"unify_quadrants",
124 			"zoom_out",
125 			"mosaic",
126 			"waver_screen",
127 			"instantaneous",
128 			"none"
129 		);
130 		enum Stretch {
131 			Stretch_stretch = 0,
132 			Stretch_tiled = 1
133 		};
134 		static constexpr auto kStretchTags = lcf::makeEnumTags<Stretch>(
135 			"stretch",
136 			"tiled"
137 		);
138 		enum Font {
139 			Font_gothic = 0,
140 			Font_mincho = 1
141 		};
142 		static constexpr auto kFontTags = lcf::makeEnumTags<Font>(
143 			"gothic",
144 			"mincho"
145 		);
146 		enum BattleFormation {
147 			BattleFormation_terrain = 0,
148 			BattleFormation_loose = 1,
149 			BattleFormation_tight = 2
150 		};
151 		static constexpr auto kBattleFormationTags = lcf::makeEnumTags<BattleFormation>(
152 			"terrain",
153 			"loose",
154 			"tight"
155 		);
156 		enum BattleCondition {
157 			BattleCondition_none = 0,
158 			BattleCondition_initiative = 1,
159 			BattleCondition_back = 2,
160 			BattleCondition_surround = 3,
161 			BattleCondition_pincers = 4
162 		};
163 		static constexpr auto kBattleConditionTags = lcf::makeEnumTags<BattleCondition>(
164 			"none",
165 			"initiative",
166 			"back",
167 			"surround",
168 			"pincers"
169 		);
170 		enum EquipmentSetting {
171 			EquipmentSetting_actor = 0,
172 			EquipmentSetting_class = 1
173 		};
174 		static constexpr auto kEquipmentSettingTags = lcf::makeEnumTags<EquipmentSetting>(
175 			"actor",
176 			"class"
177 		);
178 
179 		int32_t ldb_id = 0;
180 		DBString boat_name;
181 		DBString ship_name;
182 		DBString airship_name;
183 		int32_t boat_index = 0;
184 		int32_t ship_index = 0;
185 		int32_t airship_index = 0;
186 		DBString title_name;
187 		DBString gameover_name;
188 		DBString system_name;
189 		DBString system2_name;
190 		std::vector<int16_t> party = {1};
191 		std::vector<int16_t> menu_commands = {1};
192 		Music title_music;
193 		Music battle_music;
194 		Music battle_end_music;
195 		Music inn_music;
196 		Music boat_music;
197 		Music ship_music;
198 		Music airship_music;
199 		Music gameover_music;
200 		Sound cursor_se;
201 		Sound decision_se;
202 		Sound cancel_se;
203 		Sound buzzer_se;
204 		Sound battle_se;
205 		Sound escape_se;
206 		Sound enemy_attack_se;
207 		Sound enemy_damaged_se;
208 		Sound actor_damaged_se;
209 		Sound dodge_se;
210 		Sound enemy_death_se;
211 		Sound item_se;
212 		int32_t transition_out = 0;
213 		int32_t transition_in = 0;
214 		int32_t battle_start_fadeout = 0;
215 		int32_t battle_start_fadein = 0;
216 		int32_t battle_end_fadeout = 0;
217 		int32_t battle_end_fadein = 0;
218 		int32_t message_stretch = 0;
219 		int32_t font_id = 0;
220 		int32_t selected_condition = 0;
221 		int32_t selected_hero = 0;
222 		DBString battletest_background;
223 		std::vector<TestBattler> battletest_data;
224 		int32_t save_count = 0;
225 		int32_t battletest_terrain = 0;
226 		int32_t battletest_formation = 0;
227 		int32_t battletest_condition = 0;
228 		int32_t equipment_setting = 0;
229 		int32_t battletest_alt_terrain = -1;
230 		bool show_frame = false;
231 		DBString frame_name;
232 		bool invert_animations = false;
233 		bool show_title = true;
234 		int32_t easyrpg_alternative_exp = 0;
235 		std::vector<int16_t> easyrpg_battle_options = {0, 1, 2};
236 		int32_t easyrpg_max_actor_hp = -1;
237 		int32_t easyrpg_max_enemy_hp = -1;
238 		int32_t easyrpg_max_damage = -1;
239 		int32_t easyrpg_max_exp = -1;
240 		int32_t easyrpg_max_level = -1;
241 		int32_t easyrpg_max_savefiles = 15;
242 		int32_t easyrpg_max_item_count = -1;
243 		int32_t easyrpg_variable_min_value = 0;
244 		int32_t easyrpg_variable_max_value = 0;
245 		int32_t easyrpg_max_actor_sp = -1;
246 		int32_t easyrpg_max_enemy_sp = -1;
247 		int32_t easyrpg_max_stat_base_value = -1;
248 		int32_t easyrpg_max_stat_battle_value = -1;
249 	};
250 	inline std::ostream& operator<<(std::ostream& os, System::FadeOut code) {
251 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
252 		return os;
253 	}
254 	inline std::ostream& operator<<(std::ostream& os, System::FadeIn code) {
255 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
256 		return os;
257 	}
258 	inline std::ostream& operator<<(std::ostream& os, System::Stretch code) {
259 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
260 		return os;
261 	}
262 	inline std::ostream& operator<<(std::ostream& os, System::Font code) {
263 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
264 		return os;
265 	}
266 	inline std::ostream& operator<<(std::ostream& os, System::BattleFormation code) {
267 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
268 		return os;
269 	}
270 	inline std::ostream& operator<<(std::ostream& os, System::BattleCondition code) {
271 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
272 		return os;
273 	}
274 	inline std::ostream& operator<<(std::ostream& os, System::EquipmentSetting code) {
275 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
276 		return os;
277 	}
278 
279 	inline bool operator==(const System& l, const System& r) {
280 		return l.ldb_id == r.ldb_id
281 		&& l.boat_name == r.boat_name
282 		&& l.ship_name == r.ship_name
283 		&& l.airship_name == r.airship_name
284 		&& l.boat_index == r.boat_index
285 		&& l.ship_index == r.ship_index
286 		&& l.airship_index == r.airship_index
287 		&& l.title_name == r.title_name
288 		&& l.gameover_name == r.gameover_name
289 		&& l.system_name == r.system_name
290 		&& l.system2_name == r.system2_name
291 		&& l.party == r.party
292 		&& l.menu_commands == r.menu_commands
293 		&& l.title_music == r.title_music
294 		&& l.battle_music == r.battle_music
295 		&& l.battle_end_music == r.battle_end_music
296 		&& l.inn_music == r.inn_music
297 		&& l.boat_music == r.boat_music
298 		&& l.ship_music == r.ship_music
299 		&& l.airship_music == r.airship_music
300 		&& l.gameover_music == r.gameover_music
301 		&& l.cursor_se == r.cursor_se
302 		&& l.decision_se == r.decision_se
303 		&& l.cancel_se == r.cancel_se
304 		&& l.buzzer_se == r.buzzer_se
305 		&& l.battle_se == r.battle_se
306 		&& l.escape_se == r.escape_se
307 		&& l.enemy_attack_se == r.enemy_attack_se
308 		&& l.enemy_damaged_se == r.enemy_damaged_se
309 		&& l.actor_damaged_se == r.actor_damaged_se
310 		&& l.dodge_se == r.dodge_se
311 		&& l.enemy_death_se == r.enemy_death_se
312 		&& l.item_se == r.item_se
313 		&& l.transition_out == r.transition_out
314 		&& l.transition_in == r.transition_in
315 		&& l.battle_start_fadeout == r.battle_start_fadeout
316 		&& l.battle_start_fadein == r.battle_start_fadein
317 		&& l.battle_end_fadeout == r.battle_end_fadeout
318 		&& l.battle_end_fadein == r.battle_end_fadein
319 		&& l.message_stretch == r.message_stretch
320 		&& l.font_id == r.font_id
321 		&& l.selected_condition == r.selected_condition
322 		&& l.selected_hero == r.selected_hero
323 		&& l.battletest_background == r.battletest_background
324 		&& l.battletest_data == r.battletest_data
325 		&& l.save_count == r.save_count
326 		&& l.battletest_terrain == r.battletest_terrain
327 		&& l.battletest_formation == r.battletest_formation
328 		&& l.battletest_condition == r.battletest_condition
329 		&& l.equipment_setting == r.equipment_setting
330 		&& l.battletest_alt_terrain == r.battletest_alt_terrain
331 		&& l.show_frame == r.show_frame
332 		&& l.frame_name == r.frame_name
333 		&& l.invert_animations == r.invert_animations
334 		&& l.show_title == r.show_title
335 		&& l.easyrpg_alternative_exp == r.easyrpg_alternative_exp
336 		&& l.easyrpg_battle_options == r.easyrpg_battle_options
337 		&& l.easyrpg_max_actor_hp == r.easyrpg_max_actor_hp
338 		&& l.easyrpg_max_enemy_hp == r.easyrpg_max_enemy_hp
339 		&& l.easyrpg_max_damage == r.easyrpg_max_damage
340 		&& l.easyrpg_max_exp == r.easyrpg_max_exp
341 		&& l.easyrpg_max_level == r.easyrpg_max_level
342 		&& l.easyrpg_max_savefiles == r.easyrpg_max_savefiles
343 		&& l.easyrpg_max_item_count == r.easyrpg_max_item_count
344 		&& l.easyrpg_variable_min_value == r.easyrpg_variable_min_value
345 		&& l.easyrpg_variable_max_value == r.easyrpg_variable_max_value
346 		&& l.easyrpg_max_actor_sp == r.easyrpg_max_actor_sp
347 		&& l.easyrpg_max_enemy_sp == r.easyrpg_max_enemy_sp
348 		&& l.easyrpg_max_stat_base_value == r.easyrpg_max_stat_base_value
349 		&& l.easyrpg_max_stat_battle_value == r.easyrpg_max_stat_battle_value;
350 	}
351 
352 	inline bool operator!=(const System& l, const System& r) {
353 		return !(l == r);
354 	}
355 
356 	std::ostream& operator<<(std::ostream& os, const System& obj);
357 
358 	template <typename F, typename ParentCtx = Context<void,void>>
359 	void ForEachString(System& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
360 		const auto ctx2 = Context<System, ParentCtx>{ "boat_name", -1, &obj, parent_ctx };
361 		f(obj.boat_name, ctx2);
362 		const auto ctx3 = Context<System, ParentCtx>{ "ship_name", -1, &obj, parent_ctx };
363 		f(obj.ship_name, ctx3);
364 		const auto ctx4 = Context<System, ParentCtx>{ "airship_name", -1, &obj, parent_ctx };
365 		f(obj.airship_name, ctx4);
366 		const auto ctx8 = Context<System, ParentCtx>{ "title_name", -1, &obj, parent_ctx };
367 		f(obj.title_name, ctx8);
368 		const auto ctx9 = Context<System, ParentCtx>{ "gameover_name", -1, &obj, parent_ctx };
369 		f(obj.gameover_name, ctx9);
370 		const auto ctx10 = Context<System, ParentCtx>{ "system_name", -1, &obj, parent_ctx };
371 		f(obj.system_name, ctx10);
372 		const auto ctx11 = Context<System, ParentCtx>{ "system2_name", -1, &obj, parent_ctx };
373 		f(obj.system2_name, ctx11);
374 		const auto ctx14 = Context<System, ParentCtx>{ "title_music", -1, &obj, parent_ctx };
375 		ForEachString(obj.title_music, f, &ctx14);
376 		const auto ctx15 = Context<System, ParentCtx>{ "battle_music", -1, &obj, parent_ctx };
377 		ForEachString(obj.battle_music, f, &ctx15);
378 		const auto ctx16 = Context<System, ParentCtx>{ "battle_end_music", -1, &obj, parent_ctx };
379 		ForEachString(obj.battle_end_music, f, &ctx16);
380 		const auto ctx17 = Context<System, ParentCtx>{ "inn_music", -1, &obj, parent_ctx };
381 		ForEachString(obj.inn_music, f, &ctx17);
382 		const auto ctx18 = Context<System, ParentCtx>{ "boat_music", -1, &obj, parent_ctx };
383 		ForEachString(obj.boat_music, f, &ctx18);
384 		const auto ctx19 = Context<System, ParentCtx>{ "ship_music", -1, &obj, parent_ctx };
385 		ForEachString(obj.ship_music, f, &ctx19);
386 		const auto ctx20 = Context<System, ParentCtx>{ "airship_music", -1, &obj, parent_ctx };
387 		ForEachString(obj.airship_music, f, &ctx20);
388 		const auto ctx21 = Context<System, ParentCtx>{ "gameover_music", -1, &obj, parent_ctx };
389 		ForEachString(obj.gameover_music, f, &ctx21);
390 		const auto ctx22 = Context<System, ParentCtx>{ "cursor_se", -1, &obj, parent_ctx };
391 		ForEachString(obj.cursor_se, f, &ctx22);
392 		const auto ctx23 = Context<System, ParentCtx>{ "decision_se", -1, &obj, parent_ctx };
393 		ForEachString(obj.decision_se, f, &ctx23);
394 		const auto ctx24 = Context<System, ParentCtx>{ "cancel_se", -1, &obj, parent_ctx };
395 		ForEachString(obj.cancel_se, f, &ctx24);
396 		const auto ctx25 = Context<System, ParentCtx>{ "buzzer_se", -1, &obj, parent_ctx };
397 		ForEachString(obj.buzzer_se, f, &ctx25);
398 		const auto ctx26 = Context<System, ParentCtx>{ "battle_se", -1, &obj, parent_ctx };
399 		ForEachString(obj.battle_se, f, &ctx26);
400 		const auto ctx27 = Context<System, ParentCtx>{ "escape_se", -1, &obj, parent_ctx };
401 		ForEachString(obj.escape_se, f, &ctx27);
402 		const auto ctx28 = Context<System, ParentCtx>{ "enemy_attack_se", -1, &obj, parent_ctx };
403 		ForEachString(obj.enemy_attack_se, f, &ctx28);
404 		const auto ctx29 = Context<System, ParentCtx>{ "enemy_damaged_se", -1, &obj, parent_ctx };
405 		ForEachString(obj.enemy_damaged_se, f, &ctx29);
406 		const auto ctx30 = Context<System, ParentCtx>{ "actor_damaged_se", -1, &obj, parent_ctx };
407 		ForEachString(obj.actor_damaged_se, f, &ctx30);
408 		const auto ctx31 = Context<System, ParentCtx>{ "dodge_se", -1, &obj, parent_ctx };
409 		ForEachString(obj.dodge_se, f, &ctx31);
410 		const auto ctx32 = Context<System, ParentCtx>{ "enemy_death_se", -1, &obj, parent_ctx };
411 		ForEachString(obj.enemy_death_se, f, &ctx32);
412 		const auto ctx33 = Context<System, ParentCtx>{ "item_se", -1, &obj, parent_ctx };
413 		ForEachString(obj.item_se, f, &ctx33);
414 		const auto ctx44 = Context<System, ParentCtx>{ "battletest_background", -1, &obj, parent_ctx };
415 		f(obj.battletest_background, ctx44);
416 		for (int i = 0; i < static_cast<int>(obj.battletest_data.size()); ++i) {
417 			const auto ctx45 = Context<System, ParentCtx>{ "battletest_data", i, &obj, parent_ctx };
418 			ForEachString(obj.battletest_data[i], f, &ctx45);
419 		}
420 		const auto ctx53 = Context<System, ParentCtx>{ "frame_name", -1, &obj, parent_ctx };
421 		f(obj.frame_name, ctx53);
422 		(void)obj;
423 		(void)f;
424 		(void)parent_ctx;
425 	}
426 
427 } // namespace rpg
428 } // namespace lcf
429 
430 #endif
431