Porytiles
Loading...
Searching...
No Matches
metatile_attribute.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <string>
6
9
10namespace porytiles {
11
12namespace attr {
13
14constexpr std::size_t bytes_per_attr_emerald = 2;
15constexpr std::size_t bytes_per_attr_firered = 4;
16
17} // namespace attr
18
31 public:
32 MetatileAttribute() = default;
33
40 MetatileAttribute(LayerType layer_type, std::uint16_t behavior) : layer_type_{layer_type}, behavior_{behavior} {}
41
47 std::uint16_t behavior,
48 std::uint8_t terrain,
49 std::uint8_t encounter_type,
50 std::uint8_t attribute_2,
51 std::uint8_t attribute_3,
52 std::uint8_t attribute_5,
53 bool attribute_7)
54 : layer_type_{layer_type}, behavior_{behavior}, terrain_{terrain}, encounter_type_{encounter_type},
55 attribute_2_{attribute_2}, attribute_3_{attribute_3}, attribute_5_{attribute_5}, attribute_7_{attribute_7}
56 {
57 }
58
59 [[nodiscard]] LayerType layer_type() const
60 {
61 return layer_type_;
62 }
63
65 {
66 layer_type_ = layer_type;
67 }
68
69 [[nodiscard]] std::uint16_t behavior() const
70 {
71 return behavior_;
72 }
73
74 void behavior(std::uint16_t behavior)
75 {
76 behavior_ = behavior;
77 }
78
79 [[nodiscard]] std::uint8_t terrain() const
80 {
81 return terrain_;
82 }
83
84 void terrain(std::uint8_t terrain)
85 {
86 terrain_ = terrain;
87 }
88
89 [[nodiscard]] std::uint8_t encounter_type() const
90 {
91 return encounter_type_;
92 }
93
94 void encounter_type(std::uint8_t encounter_type)
95 {
96 encounter_type_ = encounter_type;
97 }
98
99 [[nodiscard]] std::uint8_t attribute_2() const
100 {
101 return attribute_2_;
102 }
103
104 void attribute_2(std::uint8_t attribute_2)
105 {
106 attribute_2_ = attribute_2;
107 }
108
109 [[nodiscard]] std::uint8_t attribute_3() const
110 {
111 return attribute_3_;
112 }
113
114 void attribute_3(std::uint8_t attribute_3)
115 {
116 attribute_3_ = attribute_3;
117 }
118
119 [[nodiscard]] std::uint8_t attribute_5() const
120 {
121 return attribute_5_;
122 }
123
124 void attribute_5(std::uint8_t attribute_5)
125 {
126 attribute_5_ = attribute_5;
127 }
128
129 [[nodiscard]] bool attribute_7() const
130 {
131 return attribute_7_;
132 }
133
135 {
136 attribute_7_ = attribute_7;
137 }
138
139 private:
140 LayerType layer_type_{};
141 std::uint16_t behavior_{};
142 std::uint8_t terrain_{};
143 std::uint8_t encounter_type_{};
144 std::uint8_t attribute_2_{};
145 std::uint8_t attribute_3_{};
146 std::uint8_t attribute_5_{};
147 bool attribute_7_{};
148};
149
150} // namespace porytiles
Represents the attributes of a single metatile.
void attribute_7(bool attribute_7)
void attribute_5(std::uint8_t attribute_5)
MetatileAttribute(LayerType layer_type, std::uint16_t behavior, std::uint8_t terrain, std::uint8_t encounter_type, std::uint8_t attribute_2, std::uint8_t attribute_3, std::uint8_t attribute_5, bool attribute_7)
Constructs a FireRed-format metatile attribute with all fields.
std::uint8_t encounter_type() const
void encounter_type(std::uint8_t encounter_type)
MetatileAttribute(LayerType layer_type, std::uint16_t behavior)
Constructs an Emerald-format metatile attribute.
void attribute_3(std::uint8_t attribute_3)
void behavior(std::uint16_t behavior)
void layer_type(LayerType layer_type)
void attribute_2(std::uint8_t attribute_2)
void terrain(std::uint8_t terrain)
constexpr std::size_t bytes_per_attr_emerald
constexpr std::size_t bytes_per_attr_firered
LayerType
Specifies which layers of a metatile are used for rendering.
Definition layer.hpp:97