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