]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/impulses/all.qh
Impulses: register priority lists
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / impulses / all.qh
1 #ifndef IMPULSES_ALL_H
2 #define IMPULSES_ALL_H
3
4 REGISTRY(IMPULSES, 255)
5 REGISTER_REGISTRY(IMPULSES)
6 REGISTRY_SORT(IMPULSES)
7 STATIC_INIT(IMPULSES_renumber)
8 {
9         FOREACH(IMPULSES, true, LAMBDA(it.m_id = i));
10 }
11 REGISTRY_CHECK(IMPULSES)
12
13 .void(entity this) impulse_handle;
14
15 #if defined(CSQC)
16 #define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"" id "\"\n")
17 #else
18 #define IMPULSE_ALIAS(alias, id)
19 #endif
20
21 #define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
22 #define _REGISTER_IMPULSE(id, alias, n) \
23         REGISTER(IMPULSES, id, m_id, new(Impulse)) \
24         { \
25                 make_pure(this); \
26                 this.impulse = n; \
27                 IMPULSE_ALIAS(alias, "impulse " #n); \
28         }
29
30 #define LEGACY_IMPULSE(alias, id, new) \
31         STATIC_INIT(legacy_##alias) { IMPULSE_ALIAS(alias, new); } \
32         SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
33
34 #define X(slot, imp) \
35         REGISTER_IMPULSE(weapon_group_##slot, imp) \
36         LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
37 X(1, 1)
38 X(2, 2)
39 X(3, 3)
40 X(4, 4)
41 X(5, 5)
42 X(6, 6)
43 X(7, 7)
44 X(8, 8)
45 X(9, 9)
46 X(0, 14)
47 #undef X
48
49 #define X(slot, dir, imp) \
50         REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
51         LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
52 X(0, prev, 200)
53 X(1, prev, 201)
54 X(2, prev, 202)
55 X(3, prev, 203)
56 X(4, prev, 204)
57 X(5, prev, 205)
58 X(6, prev, 206)
59 X(7, prev, 207)
60 X(8, prev, 208)
61 X(9, prev, 209)
62
63 X(0, best, 210)
64 X(1, best, 211)
65 X(2, best, 212)
66 X(3, best, 213)
67 X(4, best, 214)
68 X(5, best, 215)
69 X(6, best, 216)
70 X(7, best, 217)
71 X(8, best, 218)
72 X(9, best, 219)
73
74 X(0, next, 220)
75 X(1, next, 221)
76 X(2, next, 222)
77 X(3, next, 223)
78 X(4, next, 224)
79 X(5, next, 225)
80 X(6, next, 226)
81 X(7, next, 227)
82 X(8, next, 228)
83 X(9, next, 229)
84 #undef X
85
86 REGISTER_IMPULSE(weapon_next_byid, 10)
87 LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
88
89 REGISTER_IMPULSE(weapon_prev_byid, 12)
90 LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
91
92 REGISTER_IMPULSE(weapon_next_bygroup, 18)
93 LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
94
95 REGISTER_IMPULSE(weapon_prev_bygroup, 19)
96 LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
97
98 REGISTER_IMPULSE(weapon_next_bypriority, 15)
99 LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
100
101 REGISTER_IMPULSE(weapon_prev_bypriority, 16)
102 LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
103
104 REGISTER_IMPULSE(weapon_last, 11)
105 LEGACY_IMPULSE(weaplast, 11, "weapon_last")
106
107 REGISTER_IMPULSE(weapon_best, 13)
108 LEGACY_IMPULSE(weapbest, 13, "weapon_best")
109
110 REGISTER_IMPULSE(weapon_drop, 17)
111 LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
112
113 REGISTER_IMPULSE(weapon_reload, 20)
114 LEGACY_IMPULSE(reload, 20, "weapon_reload")
115
116 REGISTER_IMPULSE(use, 21)
117 LEGACY_IMPULSE(use, 21, "use")
118
119 REGISTER_IMPULSE(waypoint_personal_here, 30)
120 LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
121
122 REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
123 LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
124
125 REGISTER_IMPULSE(waypoint_personal_death, 32)
126 LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
127
128 REGISTER_IMPULSE(waypoint_here_follow, 33)
129 LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
130
131 REGISTER_IMPULSE(waypoint_here_here, 34)
132 LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
133
134 REGISTER_IMPULSE(waypoint_here_crosshair, 35)
135 LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
136
137 REGISTER_IMPULSE(waypoint_here_death, 36)
138 LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
139
140 REGISTER_IMPULSE(waypoint_danger_here, 37)
141 LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
142
143 REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
144 LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
145
146 REGISTER_IMPULSE(waypoint_danger_death, 39)
147 LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
148
149 REGISTER_IMPULSE(waypoint_clear_personal, 47)
150 LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
151
152 REGISTER_IMPULSE(waypoint_clear, 48)
153 LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
154
155 REGISTER_IMPULSE(navwaypoint_spawn, 103)
156 LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn")
157
158 REGISTER_IMPULSE(navwaypoint_remove, 104)
159 LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove")
160
161 REGISTER_IMPULSE(navwaypoint_relink, 105)
162 LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink")
163
164 REGISTER_IMPULSE(navwaypoint_save, 106)
165 LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save")
166
167 REGISTER_IMPULSE(navwaypoint_unreachable, 107)
168 LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable")
169
170 #define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
171 #define _CHIMPULSE(id, n) \
172         REGISTER(IMPULSES, id, m_id, new(Impulse)) \
173         { \
174                 make_pure(this); \
175                 this.impulse = n; \
176         }
177
178 CHIMPULSE(SPEEDRUN_INIT, 30)
179 CHIMPULSE(GIVE_ALL, 99)
180 CHIMPULSE(CLONE_MOVING, 140)
181 CHIMPULSE(SPEEDRUN, 141)
182 CHIMPULSE(CLONE_STANDING, 142)
183 CHIMPULSE(TELEPORT, 143)
184 CHIMPULSE(R00T, 148)
185
186 #endif