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_MAP_H
13 #define LCF_RPG_MAP_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/event.h"
21 #include "lcf/context.h"
22 #include <ostream>
23 #include <type_traits>
24 
25 /**
26  * rpg::Map class.
27  */
28 namespace lcf {
29 namespace rpg {
30 	class Map {
31 	public:
32 		std::string lmu_header;
33 		enum ScrollType {
34 			ScrollType_none = 0,
35 			ScrollType_vertical = 1,
36 			ScrollType_horizontal = 2,
37 			ScrollType_both = 3
38 		};
39 		static constexpr auto kScrollTypeTags = lcf::makeEnumTags<ScrollType>(
40 			"none",
41 			"vertical",
42 			"horizontal",
43 			"both"
44 		);
45 		enum GeneratorMode {
46 			GeneratorMode_single_passage = 0,
47 			GeneratorMode_linked_rooms = 1,
48 			GeneratorMode_maze_passage = 2,
49 			GeneratorMode_open_room = 3
50 		};
51 		static constexpr auto kGeneratorModeTags = lcf::makeEnumTags<GeneratorMode>(
52 			"single_passage",
53 			"linked_rooms",
54 			"maze_passage",
55 			"open_room"
56 		);
57 		enum GeneratorTiles {
58 			GeneratorTiles_one = 0,
59 			GeneratorTiles_two = 1
60 		};
61 		static constexpr auto kGeneratorTilesTags = lcf::makeEnumTags<GeneratorTiles>(
62 			"one",
63 			"two"
64 		);
65 
66 		int32_t chipset_id = 1;
67 		int32_t width = 20;
68 		int32_t height = 15;
69 		int32_t scroll_type = 0;
70 		bool parallax_flag = false;
71 		DBString parallax_name;
72 		bool parallax_loop_x = false;
73 		bool parallax_loop_y = false;
74 		bool parallax_auto_loop_x = false;
75 		int32_t parallax_sx = 0;
76 		bool parallax_auto_loop_y = false;
77 		int32_t parallax_sy = 0;
78 		bool generator_flag = false;
79 		int32_t generator_mode = 0;
80 		bool top_level = false;
81 		int32_t generator_tiles = 0;
82 		int32_t generator_width = 4;
83 		int32_t generator_height = 1;
84 		bool generator_surround = true;
85 		bool generator_upper_wall = true;
86 		bool generator_floor_b = true;
87 		bool generator_floor_c = true;
88 		bool generator_extra_b = true;
89 		bool generator_extra_c = true;
90 		std::vector<uint32_t> generator_x;
91 		std::vector<uint32_t> generator_y;
92 		std::vector<int16_t> generator_tile_ids;
93 		std::vector<int16_t> lower_layer;
94 		std::vector<int16_t> upper_layer;
95 		std::vector<Event> events;
96 		int32_t save_count_2k3e = 0;
97 		int32_t save_count = 0;
98 	};
99 	inline std::ostream& operator<<(std::ostream& os, Map::ScrollType code) {
100 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
101 		return os;
102 	}
103 	inline std::ostream& operator<<(std::ostream& os, Map::GeneratorMode code) {
104 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
105 		return os;
106 	}
107 	inline std::ostream& operator<<(std::ostream& os, Map::GeneratorTiles code) {
108 		os << static_cast<std::underlying_type_t<decltype(code)>>(code);
109 		return os;
110 	}
111 
112 	inline bool operator==(const Map& l, const Map& r) {
113 		return l.chipset_id == r.chipset_id
114 		&& l.width == r.width
115 		&& l.height == r.height
116 		&& l.scroll_type == r.scroll_type
117 		&& l.parallax_flag == r.parallax_flag
118 		&& l.parallax_name == r.parallax_name
119 		&& l.parallax_loop_x == r.parallax_loop_x
120 		&& l.parallax_loop_y == r.parallax_loop_y
121 		&& l.parallax_auto_loop_x == r.parallax_auto_loop_x
122 		&& l.parallax_sx == r.parallax_sx
123 		&& l.parallax_auto_loop_y == r.parallax_auto_loop_y
124 		&& l.parallax_sy == r.parallax_sy
125 		&& l.generator_flag == r.generator_flag
126 		&& l.generator_mode == r.generator_mode
127 		&& l.top_level == r.top_level
128 		&& l.generator_tiles == r.generator_tiles
129 		&& l.generator_width == r.generator_width
130 		&& l.generator_height == r.generator_height
131 		&& l.generator_surround == r.generator_surround
132 		&& l.generator_upper_wall == r.generator_upper_wall
133 		&& l.generator_floor_b == r.generator_floor_b
134 		&& l.generator_floor_c == r.generator_floor_c
135 		&& l.generator_extra_b == r.generator_extra_b
136 		&& l.generator_extra_c == r.generator_extra_c
137 		&& l.generator_x == r.generator_x
138 		&& l.generator_y == r.generator_y
139 		&& l.generator_tile_ids == r.generator_tile_ids
140 		&& l.lower_layer == r.lower_layer
141 		&& l.upper_layer == r.upper_layer
142 		&& l.events == r.events
143 		&& l.save_count_2k3e == r.save_count_2k3e
144 		&& l.save_count == r.save_count;
145 	}
146 
147 	inline bool operator!=(const Map& l, const Map& r) {
148 		return !(l == r);
149 	}
150 
151 	std::ostream& operator<<(std::ostream& os, const Map& obj);
152 
153 	template <typename F, typename ParentCtx = Context<void,void>>
154 	void ForEachString(Map& obj, const F& f, const ParentCtx* parent_ctx = nullptr) {
155 		const auto ctx6 = Context<Map, ParentCtx>{ "parallax_name", -1, &obj, parent_ctx };
156 		f(obj.parallax_name, ctx6);
157 		for (int i = 0; i < static_cast<int>(obj.events.size()); ++i) {
158 			const auto ctx30 = Context<Map, ParentCtx>{ "events", i, &obj, parent_ctx };
159 			ForEachString(obj.events[i], f, &ctx30);
160 		}
161 		(void)obj;
162 		(void)f;
163 		(void)parent_ctx;
164 	}
165 
166 } // namespace rpg
167 } // namespace lcf
168 
169 #endif
170