entities zones
[carveJwlIkooP6JGAAIwe30JlM.git] / entity.h
1 #ifndef ENTITY_H
2 #define ENTITY_H
3
4 #include "model.h"
5
6 typedef struct ent_spawn ent_spawn;
7 typedef struct ent_light ent_light;
8 typedef struct ent_gate ent_gate;
9 typedef struct ent_route_node ent_route_node;
10 typedef struct ent_path_index ent_path_index;
11 typedef struct ent_checkpoint ent_checkpoint;
12 typedef struct ent_route ent_route;
13 typedef struct ent_water ent_water;
14 typedef struct ent_audio_clip ent_audio_clip;
15 typedef struct volume_particles volume_particles;
16 typedef struct volume_trigger volume_trigger;
17 typedef struct ent_volume ent_volume;
18 typedef struct ent_audio ent_audio;
19 typedef struct ent_index ent_index;
20
21 enum entity_alias{
22 k_ent_gate = 1,
23 k_ent_spawn = 2,
24 k_ent_route_node = 3,
25 k_ent_route = 4,
26 k_ent_water = 5,
27 k_ent_volume = 6,
28 k_ent_audio = 7
29 };
30
31 struct ent_index{
32 u32 type,
33 index;
34 };
35
36 enum entity_function{
37 k_ent_function_trigger,
38 k_ent_function_particle_spawn
39 };
40
41 struct ent_spawn{
42 mdl_transform transform;
43 u32 pstr_name;
44 };
45
46 enum light_type{
47 k_light_type_point = 0,
48 k_light_type_spot = 1
49 };
50
51 struct ent_light{
52 mdl_transform transform;
53 u32 daytime,
54 type;
55
56 v4f colour;
57 float angle,
58 range;
59
60 m4x3f inverse_world;
61 v2f angle_sin_cos;
62 };
63
64 enum gate_type{
65 k_gate_type_unlinked = 0,
66 k_gate_type_teleport = 1,
67 k_gate_type_nonlocal = 2
68 };
69
70 struct ent_gate{
71 u32 type,
72 target;
73
74 /* TODO: World index */
75
76 v3f dimensions,
77 co[2];
78
79 v4f q[2];
80
81 /* runtime */
82 m4x3f to_world, transport;
83
84 union{
85 u32 timing_version;
86
87 struct{
88 u8 ref_count, ref_total;
89 };
90 };
91
92 double timing_time;
93 u16 routes[4]; /* routes that pass through this gate */
94 };
95
96 struct ent_route_node{
97 v3f co;
98 u8 ref_count, ref_total;
99 };
100
101 struct ent_path_index{
102 u16 index;
103 };
104
105 struct ent_checkpoint{
106 u16 gate_index,
107 path_start,
108 path_count;
109 };
110
111 struct ent_route{
112
113 union{
114 mdl_transform transform;
115 u32 official_track_id;
116 };
117
118 u32 pstr_name;
119 u16 checkpoints_start,
120 checkpoints_count;
121
122 v4f colour;
123
124 /* runtime */
125 u32 active_checkpoint;
126 float factive;
127 m4x3f board_transform;
128 mdl_submesh sm;
129 double latest_pass;
130 };
131
132 struct ent_water{
133 mdl_transform transform;
134 float max_dist;
135 u32 reserved0, reserved1;
136 };
137
138 struct ent_audio_clip{
139 union{
140 mdl_file file;
141 audio_clip clip;
142 };
143
144 float probability;
145 };
146
147 struct volume_particles{
148 u32 blank, blank2;
149 };
150
151 struct volume_trigger{
152 u32 event, blank;
153 };
154
155 enum volume_subtype{
156 k_volume_subtype_trigger,
157 k_volume_subtype_particle
158 };
159
160 struct ent_volume{
161 mdl_transform transform;
162 m4x3f to_world, to_local;
163 u32 type;
164
165 ent_index target;
166
167 union{
168 volume_trigger trigger;
169 volume_particles particles;
170 };
171 };
172
173 struct ent_audio{
174 mdl_transform transform;
175 u32 flags,
176 clip_start,
177 clip_count;
178 float volume, crossfade;
179 u32 channel_behaviour,
180 group,
181 probability_curve,
182 max_channels;
183 };
184
185 #endif /* ENTITY_H */