DIE Engine
Loading...
Searching...
No Matches
mapobjects_eq.h
Go to the documentation of this file.
1
11
12#ifndef MAPOBJECTS_EQ_H
13#define MAPOBJECTS_EQ_H
14
15#include "mapobjects.h"
16#include <cstring>
17
18/*****************************************************************************/
19static constexpr uint16_t DOOR_FLAGS_RUNTIME = DOOR_FLAG_OPENING
22
23static constexpr uint16_t LIFT_FLAGS_RUNTIME = LIFT_FLAG_GOING
26
27static constexpr uint16_t SPEAKER_FLAGS_RUNTIME = SPEAKER_FLAG_PLAYING;
28
29/*****************************************************************************/
30inline bool operator==(const Surface& a, const Surface& b)
31{
32 return a.id == b.id &&
33 a.scaleX == b.scaleX && a.scaleY == b.scaleY &&
34 a.shiftX == b.shiftX && a.shiftY == b.shiftY &&
35 a.flags == b.flags;
36}
37
38inline bool operator==(const Node& a, const Node& b)
39{
40 return a.pos == b.pos &&
41 a.flags == b.flags &&
42 a.tag == b.tag &&
43 a.metaA == b.metaA &&
44 a.metaB == b.metaB &&
45 a.metaC == b.metaC;
46}
47
48inline bool operator==(const Wall& a, const Wall& b)
49{
50 if (a.nodeID1 != b.nodeID1 || a.nodeID2 != b.nodeID2) return false;
51 if (a.height != b.height || a.flags != b.flags) return false;
52 for (int i = 0; i < WALL_SURFACES_COUNT; ++i)
53 if (!(a.surfaces[i] == b.surfaces[i])) return false;
54 return true;
55}
56
57inline bool operator==(const Submap& a, const Submap& b)
58{
59 /* selected excluded — editor-only */
60 return a.nodeID == b.nodeID &&
61 a.pan == b.pan &&
62 a.scale == b.scale &&
63 a.tag == b.tag &&
64 a.flags == b.flags &&
65 strcmp(a.name, b.name) == 0 &&
66 strcmp(a.path, b.path) == 0;
67}
68
69inline bool operator==(const Door& a, const Door& b)
70{
71 if (a.nodeID != b.nodeID || a.mode != b.mode || a.easing != b.easing) return false;
72 if (a.width != b.width || a.height != b.height || a.thick != b.thick) return false;
73 if (a.angle != b.angle || a.swing != b.swing || a.time != b.time) return false;
74 if (a.pan != b.pan || a.shake != b.shake || a.tag != b.tag) return false;
75 if ((a.flags & ~DOOR_FLAGS_RUNTIME) != (b.flags & ~DOOR_FLAGS_RUNTIME)) return false;
76 if (strcmp(a.name, b.name) != 0) return false;
77 for (int i = 0; i < DOOR_SURFACES_COUNT; ++i)
78 if (!(a.surfaces[i] == b.surfaces[i])) return false;
79 return true;
80}
81
82inline bool operator==(const Lift& a, const Lift& b)
83{
84 if (a.nodeID != b.nodeID || a.mode != b.mode || a.easing != b.easing) return false;
85 if (a.width != b.width || a.length != b.length || a.thick != b.thick) return false;
86 if (a.travel != b.travel || a.time != b.time || a.pan != b.pan) return false;
87 if (a.tag != b.tag) return false;
88 if ((a.flags & ~LIFT_FLAGS_RUNTIME) != (b.flags & ~LIFT_FLAGS_RUNTIME)) return false;
89 if (strcmp(a.name, b.name) != 0) return false;
90 for (int i = 0; i < LIFT_SURFACES_COUNT; ++i)
91 if (!(a.surfaces[i] == b.surfaces[i])) return false;
92 return true;
93}
94
95inline bool operator==(const Sprite& a, const Sprite& b)
96{
97 return a.nodeID == b.nodeID &&
98 a.width == b.width &&
99 a.height == b.height &&
100 a.pan == b.pan &&
101 a.surface == b.surface &&
102 a.tag == b.tag &&
103 a.flags == b.flags &&
104 strcmp(a.name, b.name) == 0;
105}
106
107inline bool operator==(const Staircase& a, const Staircase& b)
108{
109 if (a.nodeID != b.nodeID || a.pan != b.pan || a.height != b.height) return false;
110 if (a.width != b.width || a.length != b.length || a.steps != b.steps) return false;
111 if (a.flags != b.flags) return false;
112 for (int i = 0; i < STAIRCASE_SURFACES_COUNT; ++i)
113 if (!(a.surfaces[i] == b.surfaces[i])) return false;
114 return true;
115}
116
117inline bool operator==(const Light& a, const Light& b)
118{
119 return a.nodeID == b.nodeID &&
120 a.colorA == b.colorA &&
121 a.colorB == b.colorB &&
122 a.strength == b.strength &&
123 a.speed == b.speed &&
124 a.anim == b.anim &&
125 a.tag == b.tag &&
126 a.flags == b.flags;
127}
128
129inline bool operator==(const Speaker& a, const Speaker& b)
130{
131 return a.nodeID == b.nodeID &&
132 a.volume == b.volume &&
133 a.size == b.size &&
134 a.pan == b.pan &&
135 a.tag == b.tag &&
136 (a.flags & ~SPEAKER_FLAGS_RUNTIME) == (b.flags & ~SPEAKER_FLAGS_RUNTIME) &&
137 strcmp(a.name, b.name) == 0 &&
138 strcmp(a.path, b.path) == 0;
139}
140
141inline bool operator==(const Path& a, const Path& b)
142{
143 if (a.nodesCount != b.nodesCount) return false;
144 if (a.pan != b.pan) return false;
145 if (a.tag != b.tag) return false;
146 if (a.flags != b.flags) return false;
147 if (strcmp(a.name, b.name) != 0) return false;
148 for (uint16_t i = 0; i < a.nodesCount; ++i)
149 if (a.nodes[i] != b.nodes[i]) return false;
150 return true;
151}
152
153#endif // MAPOBJECTS_EQ_H
@ STAIRCASE_SURFACES_COUNT
Definition mapobjects.h:249
@ LIFT_FLAG_HALTED
Definition mapobjects.h:187
@ LIFT_FLAG_GOING
Definition mapobjects.h:185
@ LIFT_FLAG_RETURNING
Definition mapobjects.h:186
@ DOOR_FLAG_OPENING
Definition mapobjects.h:131
@ DOOR_FLAG_CLOSING
Definition mapobjects.h:132
@ DOOR_FLAG_SHAKING
Definition mapobjects.h:133
@ LIFT_SURFACES_COUNT
Definition mapobjects.h:176
@ DOOR_SURFACES_COUNT
Definition mapobjects.h:125
@ SPEAKER_FLAG_PLAYING
Definition mapobjects.h:312
@ WALL_SURFACES_COUNT
Definition mapobjects.h:61
bool operator==(const Surface &a, const Surface &b)
Definition mapobjects_eq.h:30
Animated door (pivot, lateral or vertical).
Definition mapobjects.h:140
float time
Definition mapobjects.h:149
float thick
Definition mapobjects.h:146
uint16_t flags
Definition mapobjects.h:158
float height
Definition mapobjects.h:145
uint16_t tag
Definition mapobjects.h:157
float pan
animation state (0.0 closed .. 1.0 open)
Definition mapobjects.h:153
float shake
animation state
Definition mapobjects.h:154
uint16_t easing
one of EASING_TYPES
Definition mapobjects.h:151
uint16_t nodeID
Definition mapobjects.h:141
float angle
Definition mapobjects.h:147
Surface surfaces[DOOR_SURFACES_COUNT]
Definition mapobjects.h:156
float swing
Definition mapobjects.h:148
float width
Definition mapobjects.h:144
uint16_t mode
one of DOOR_MODES
Definition mapobjects.h:150
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:142
Animated moving platform.
Definition mapobjects.h:194
uint16_t tag
Definition mapobjects.h:209
Surface surfaces[LIFT_SURFACES_COUNT]
Definition mapobjects.h:208
float thick
Definition mapobjects.h:200
uint16_t nodeID
Definition mapobjects.h:195
float pan
animation state (0.0 .. 1.0 along the travel)
Definition mapobjects.h:206
float time
Definition mapobjects.h:202
float length
Definition mapobjects.h:199
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:196
uint16_t easing
one of EASING_TYPES
Definition mapobjects.h:204
float width
Definition mapobjects.h:198
uint16_t mode
one of LIFT_MODES
Definition mapobjects.h:203
float travel
Definition mapobjects.h:201
uint16_t flags
Definition mapobjects.h:210
Animated point light bound to a node.
Definition mapobjects.h:287
uint32_t colorA
Definition mapobjects.h:290
uint16_t flags
Definition mapobjects.h:300
uint16_t tag
Definition mapobjects.h:299
float speed
Definition mapobjects.h:293
uint16_t nodeID
Definition mapobjects.h:288
uint16_t anim
one of LIGHT_ANIMS
Definition mapobjects.h:294
uint32_t colorB
Definition mapobjects.h:291
float strength
Definition mapobjects.h:292
Map node: a 3D position shared by the map objects.
Definition mapobjects.h:32
QVector3D pos
Definition mapobjects.h:33
uint16_t flags
Definition mapobjects.h:34
float metaB
generic per-node metadata
Definition mapobjects.h:37
float metaC
generic per-node metadata
Definition mapobjects.h:38
uint16_t tag
Definition mapobjects.h:35
float metaA
generic per-node metadata
Definition mapobjects.h:36
Sequence of nodes used as waypoints.
Definition mapobjects.h:336
uint16_t nodesCount
Definition mapobjects.h:338
uint16_t tag
Definition mapobjects.h:344
float pan
Definition mapobjects.h:342
uint16_t nodes[PATH_NODES_MAX]
Definition mapobjects.h:337
uint16_t flags
Definition mapobjects.h:345
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:340
Spatial sound source bound to a node.
Definition mapobjects.h:318
uint16_t flags
Definition mapobjects.h:328
uint16_t nodeID
Definition mapobjects.h:319
float pan
Definition mapobjects.h:325
uint16_t tag
Definition mapobjects.h:327
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:320
float volume
Definition mapobjects.h:323
float size
Definition mapobjects.h:324
char path[OBJECT_PATH_MAX+1]
Definition mapobjects.h:321
Textured quad standing at a node.
Definition mapobjects.h:226
float width
Definition mapobjects.h:230
uint16_t tag
Definition mapobjects.h:235
uint16_t nodeID
Definition mapobjects.h:227
float pan
Definition mapobjects.h:232
uint16_t flags
Definition mapobjects.h:236
float height
Definition mapobjects.h:231
Surface surface
Definition mapobjects.h:233
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:228
Flight of steps.
Definition mapobjects.h:255
float width
Definition mapobjects.h:260
Surface surfaces[STAIRCASE_SURFACES_COUNT]
Definition mapobjects.h:263
float pan
Definition mapobjects.h:258
float height
Definition mapobjects.h:259
uint16_t flags
Definition mapobjects.h:265
uint16_t nodeID
Definition mapobjects.h:256
float length
Definition mapobjects.h:261
uint16_t steps
Definition mapobjects.h:262
Nested map instance, loaded from a separate file.
Definition mapobjects.h:98
uint16_t flags
Definition mapobjects.h:107
uint16_t nodeID
Definition mapobjects.h:99
char name[OBJECT_NAME_MAX+1]
Definition mapobjects.h:100
char path[OBJECT_PATH_MAX+1]
Definition mapobjects.h:101
uint16_t tag
Definition mapobjects.h:106
float pan
Definition mapobjects.h:103
float scale
Definition mapobjects.h:104
Texture mapping of one face of a map object.
Definition mapobjects.h:46
float scaleY
Definition mapobjects.h:49
float shiftY
Definition mapobjects.h:51
float shiftX
Definition mapobjects.h:50
uint16_t flags
Definition mapobjects.h:52
uint16_t id
Definition mapobjects.h:47
float scaleX
Definition mapobjects.h:48
Vertical wall between two nodes, with floor / ceiling extensions.
Definition mapobjects.h:80
Surface surfaces[WALL_SURFACES_COUNT]
Definition mapobjects.h:89
float height
Definition mapobjects.h:83
uint16_t nodeID1
Definition mapobjects.h:81
uint16_t nodeID2
Definition mapobjects.h:82
uint16_t flags
Definition mapobjects.h:90