yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
object_layer_semantics.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_OBJECT_LAYER_SEMANTICS_H_
2#define YAZE_ZELDA3_DUNGEON_OBJECT_LAYER_SEMANTICS_H_
3
4#include <cstdint>
5
9
10namespace yaze {
11namespace zelda3 {
12
13enum class EffectiveBgLayer {
14 kBg1,
15 kBg2,
17};
18
20 int routine_id = -1;
21 // Compatibility field for the legacy all_bgs_/routine-metadata decision.
22 // Object-ID-specific routing (for example auto and straight stairs) is
23 // represented by render_routing instead.
24 bool draws_to_both_bgs = false;
27};
28
29inline bool UsesRoomObjectStream(const RoomObject& object) {
30 const auto options = object.options();
31 return (options & ObjectOption::Torch) == ObjectOption::Nothing &&
33}
34
35inline bool UsesSpecialLayerSelector(const RoomObject& object) {
36 return !UsesRoomObjectStream(object);
37}
38
39// Reports built-in routine routing. A project custom-object override can
40// preempt the built-in routine and use stored placement instead.
43
45 const bool routine_both =
46 (out.routine_id >= 0) &&
48 out.draws_to_both_bgs = object.all_bgs_ || routine_both;
49
50 if (out.draws_to_both_bgs) {
53 return out;
54 }
55
60 return out;
61 }
62
69 return out;
70 }
71
76 return out;
77 }
78
83 return out;
84 }
85
88 return out;
89 }
90
91 out.effective_bg_layer = (object.layer_ == RoomObject::LayerType::BG2)
94 return out;
95}
96
97inline const char* EffectiveBgLayerLabel(EffectiveBgLayer layer) {
98 switch (layer) {
100 return "BG1";
102 return "BG2";
104 return "Both BGs";
105 }
106 return "Unknown";
107}
108
110 switch (routing) {
112 return "Stored placement";
114 return "BG1 (fixed)";
116 return "BG2 (fixed)";
118 return "Both BGs (full)";
120 return "Mixed BG1/BG2";
121 }
122 return "Unknown";
123}
124
126 const ObjectLayerSemantics& semantics) {
129 }
131 ? "BG2 (stored placement)"
132 : "BG1 (stored placement)";
133}
134
136 switch (routing) {
138 return "stored";
140 return "fixed_bg1";
142 return "fixed_bg2";
144 return "full_both";
146 return "mixed";
147 }
148 return "unknown";
149}
150
151} // namespace zelda3
152} // namespace yaze
153
154#endif // YAZE_ZELDA3_DUNGEON_OBJECT_LAYER_SEMANTICS_H_
bool RoutineDrawsToBothBGs(int routine_id) const
int GetRoutineIdForObject(int16_t object_id) const
static DrawRoutineRegistry & Get()
constexpr bool IsFullBothAutoStairsObject(int object_id)
constexpr bool IsMixedStraightInterroomObject(int object_id)
ObjectLayerSemantics GetObjectLayerSemantics(const RoomObject &object)
const char * ObjectRenderRoutingLabel(ObjectRenderRouting routing)
const char * ObjectRenderRoutingToken(ObjectRenderRouting routing)
const char * ObjectRenderRoutingDisplayLabel(const ObjectLayerSemantics &semantics)
bool UsesRoomObjectStream(const RoomObject &object)
bool UsesSpecialLayerSelector(const RoomObject &object)
const char * EffectiveBgLayerLabel(EffectiveBgLayer layer)