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