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