]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/impulses/all.qh
6780ac16d0fa1ddd83c766319d05f2d9289b2c01
[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, 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_pure(Impulse)) \
24         { \
25                 this.impulse = n; \
26                 IMPULSE_ALIAS(alias, "impulse " #n); \
27         }
28
29 #define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse))
30
31 #define LEGACY_IMPULSE(alias, id, new) \
32         STATIC_INIT(legacy_##alias) { \
33                 string s = new; \
34                 if (s == #alias) LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s); \
35                 IMPULSE_ALIAS(alias, s); \
36         } \
37         SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
38
39 #define X(slot, imp) \
40         REGISTER_IMPULSE(weapon_group_##slot, imp) \
41         LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
42 X(1, 1)
43 X(2, 2)
44 X(3, 3)
45 X(4, 4)
46 X(5, 5)
47 X(6, 6)
48 X(7, 7)
49 X(8, 8)
50 X(9, 9)
51 X(0, 14)
52 #undef X
53
54 #define X(slot, dir, imp) \
55         REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
56         LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
57 X(0, prev, 200)
58 X(1, prev, 201)
59 X(2, prev, 202)
60 X(3, prev, 203)
61 X(4, prev, 204)
62 X(5, prev, 205)
63 X(6, prev, 206)
64 X(7, prev, 207)
65 X(8, prev, 208)
66 X(9, prev, 209)
67
68 X(0, best, 210)
69 X(1, best, 211)
70 X(2, best, 212)
71 X(3, best, 213)
72 X(4, best, 214)
73 X(5, best, 215)
74 X(6, best, 216)
75 X(7, best, 217)
76 X(8, best, 218)
77 X(9, best, 219)
78
79 X(0, next, 220)
80 X(1, next, 221)
81 X(2, next, 222)
82 X(3, next, 223)
83 X(4, next, 224)
84 X(5, next, 225)
85 X(6, next, 226)
86 X(7, next, 227)
87 X(8, next, 228)
88 X(9, next, 229)
89 #undef X
90
91 // direct weapons
92
93 #define X(i, imp) \
94         REGISTER_IMPULSE(weapon_byid_##i, imp)
95 X(0, 230)
96 X(1, 231)
97 X(2, 232)
98 X(3, 233)
99 X(4, 234)
100 X(5, 235)
101 X(6, 236)
102 X(7, 237)
103 X(8, 238)
104 X(9, 239)
105 X(10, 240)
106 X(11, 241)
107 X(12, 242)
108 X(13, 243)
109 X(14, 244)
110 X(15, 245)
111 X(16, 246)
112 X(17, 247)
113 X(18, 248)
114 X(19, 249)
115 X(20, 250)
116 X(21, 251)
117 X(22, 252)
118 X(23, 253)
119 #undef X
120
121 REGISTER_IMPULSE(weapon_next_byid, 10)
122 LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
123
124 REGISTER_IMPULSE(weapon_prev_byid, 12)
125 LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
126
127 REGISTER_IMPULSE(weapon_next_bygroup, 18)
128 LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
129
130 REGISTER_IMPULSE(weapon_prev_bygroup, 19)
131 LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
132
133 REGISTER_IMPULSE(weapon_next_bypriority, 15)
134 LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
135
136 REGISTER_IMPULSE(weapon_prev_bypriority, 16)
137 LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
138
139 REGISTER_IMPULSE(weapon_last, 11)
140 LEGACY_IMPULSE(weaplast, 11, "weapon_last")
141
142 REGISTER_IMPULSE(weapon_best, 13)
143 LEGACY_IMPULSE(weapbest, 13, "weapon_best")
144
145 REGISTER_IMPULSE(weapon_drop, 17)
146 LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
147
148 REGISTER_IMPULSE(weapon_reload, 20)
149 LEGACY_IMPULSE(reload, 20, "weapon_reload")
150
151 REGISTER_IMPULSE(use, 21)
152 LEGACY_IMPULSE_ID(use, 21)
153
154 REGISTER_IMPULSE(waypoint_personal_here, 30)
155 LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
156
157 REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
158 LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
159
160 REGISTER_IMPULSE(waypoint_personal_death, 32)
161 LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
162
163 REGISTER_IMPULSE(waypoint_here_follow, 33)
164 LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
165
166 REGISTER_IMPULSE(waypoint_here_here, 34)
167 LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
168
169 REGISTER_IMPULSE(waypoint_here_crosshair, 35)
170 LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
171
172 REGISTER_IMPULSE(waypoint_here_death, 36)
173 LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
174
175 REGISTER_IMPULSE(waypoint_danger_here, 37)
176 LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
177
178 REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
179 LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
180
181 REGISTER_IMPULSE(waypoint_danger_death, 39)
182 LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
183
184 REGISTER_IMPULSE(waypoint_clear_personal, 47)
185 LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
186
187 REGISTER_IMPULSE(waypoint_clear, 48)
188 LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
189
190 REGISTER_IMPULSE(navwaypoint_spawn, 103)
191 LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn")
192
193 REGISTER_IMPULSE(navwaypoint_remove, 104)
194 LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove")
195
196 REGISTER_IMPULSE(navwaypoint_relink, 105)
197 LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink")
198
199 REGISTER_IMPULSE(navwaypoint_save, 106)
200 LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save")
201
202 REGISTER_IMPULSE(navwaypoint_unreachable, 107)
203 LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable")
204
205 #define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
206 #define _CHIMPULSE(id, n) \
207         REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
208         { \
209                 this.impulse = n; \
210         }
211
212 CHIMPULSE(SPEEDRUN_INIT, 30)
213 CHIMPULSE(GIVE_ALL, 99)
214 CHIMPULSE(CLONE_MOVING, 140)
215 CHIMPULSE(SPEEDRUN, 141)
216 CHIMPULSE(CLONE_STANDING, 142)
217 CHIMPULSE(TELEPORT, 143)
218 CHIMPULSE(R00T, 148)
219
220 #endif