Impulses: migration pathway
[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) LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse" #imp)
36 X(1, 1)
37 X(2, 2)
38 X(3, 3)
39 X(4, 4)
40 X(5, 5)
41 X(6, 6)
42 X(7, 7)
43 X(8, 8)
44 X(9, 9)
45 X(0, 14)
46 #undef X
47
48 REGISTER_IMPULSE(weapon_next_byid, 10)
49 LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
50
51 REGISTER_IMPULSE(weapon_prev_byid, 12)
52 LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
53
54 REGISTER_IMPULSE(weapon_next_bygroup, 18)
55 LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
56
57 REGISTER_IMPULSE(weapon_prev_bygroup, 19)
58 LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
59
60 REGISTER_IMPULSE(weapon_next_bypriority, 15)
61 LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
62
63 REGISTER_IMPULSE(weapon_prev_bypriority, 16)
64 LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
65
66 REGISTER_IMPULSE(weapon_last, 11)
67 LEGACY_IMPULSE(weaplast, 11, "weapon_last")
68
69 REGISTER_IMPULSE(weapon_best, 13)
70 LEGACY_IMPULSE(weapbest, 13, "weapon_best")
71
72 REGISTER_IMPULSE(weapon_drop, 17)
73 LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
74
75 REGISTER_IMPULSE(weapon_reload, 20)
76 LEGACY_IMPULSE(reload, 20, "weapon_reload")
77
78 REGISTER_IMPULSE(use, 21)
79 LEGACY_IMPULSE(use, 21, "use")
80
81 REGISTER_IMPULSE(waypoint_personal_here, 30)
82 LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
83
84 REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
85 LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
86
87 REGISTER_IMPULSE(waypoint_personal_death, 32)
88 LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
89
90 REGISTER_IMPULSE(waypoint_here_follow, 33)
91 LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
92
93 REGISTER_IMPULSE(waypoint_here_here, 34)
94 LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
95
96 REGISTER_IMPULSE(waypoint_here_crosshair, 35)
97 LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
98
99 REGISTER_IMPULSE(waypoint_here_death, 36)
100 LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
101
102 REGISTER_IMPULSE(waypoint_danger_here, 37)
103 LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
104
105 REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
106 LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
107
108 REGISTER_IMPULSE(waypoint_danger_death, 39)
109 LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
110
111 REGISTER_IMPULSE(waypoint_clear_personal, 47)
112 LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
113
114 REGISTER_IMPULSE(waypoint_clear, 48)
115 LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
116
117 REGISTER_IMPULSE(navwaypoint_spawn, 103)
118 LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn")
119
120 REGISTER_IMPULSE(navwaypoint_remove, 104)
121 LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove")
122
123 REGISTER_IMPULSE(navwaypoint_relink, 105)
124 LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink")
125
126 REGISTER_IMPULSE(navwaypoint_save, 106)
127 LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save")
128
129 REGISTER_IMPULSE(navwaypoint_unreachable, 107)
130 LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable")
131
132 #define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
133 #define _CHIMPULSE(id, n) \
134         REGISTER(IMPULSES, id, m_id, new(Impulse)) \
135         { \
136                 make_pure(this); \
137                 this.impulse = n; \
138         }
139
140 CHIMPULSE(SPEEDRUN_INIT, 30)
141 CHIMPULSE(GIVE_ALL, 99)
142 CHIMPULSE(CLONE_MOVING, 140)
143 CHIMPULSE(SPEEDRUN, 141)
144 CHIMPULSE(CLONE_STANDING, 142)
145 CHIMPULSE(TELEPORT, 143)
146 CHIMPULSE(R00T, 148)
147
148 #endif