i hope your hapy
[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
14 struct ent_spawn{
15 mdl_transform transform;
16 u32 pstr_name;
17 };
18
19 enum light_type{
20 k_light_type_point = 0,
21 k_light_type_spot = 1
22 };
23
24 struct ent_light{
25 mdl_transform transform;
26 u32 daytime,
27 type;
28
29 v4f colour;
30 float angle,
31 range;
32
33 m4x3f inverse_world;
34 v2f angle_sin_cos;
35 };
36
37 enum gate_type{
38 k_gate_type_unlinked = 0,
39 k_gate_type_teleport = 1,
40 k_gate_type_nonlocal = 2
41 };
42
43 struct ent_gate{
44 u32 type,
45 target;
46
47 /* TODO: World index */
48
49 v3f dimensions,
50 co[2];
51
52 v4f q[2];
53
54 /* runtime */
55 m4x3f to_world, transport;
56
57 union{
58 u32 timing_version;
59
60 struct{
61 u8 ref_count, ref_total;
62 };
63 };
64
65 double timing_time;
66 u16 routes[4]; /* routes that pass through this gate */
67 };
68
69 struct ent_route_node{
70 v3f co;
71 u8 ref_count, ref_total;
72 };
73
74 struct ent_path_index{
75 u16 index;
76 };
77
78 struct ent_checkpoint{
79 u16 gate_index,
80 path_start,
81 path_count;
82 };
83
84 struct ent_route{
85 mdl_transform transform;
86 u32 pstr_name;
87 u16 checkpoints_start,
88 checkpoints_count;
89
90 v4f colour;
91
92 /* runtime */
93 u32 active_checkpoint;
94 float factive;
95 m4x3f board_transform;
96 mdl_submesh sm;
97 double latest_pass;
98 };
99
100 #endif /* ENTITY_H */