4 * 0 reserved (no input)
5 * 1 to 9, 14: weapon shortcuts
6 * 10: next weapon according to linear list
7 * 11: most recently used weapon
8 * 12: previous weapon according to linear list
9 * 13: best weapon according to priority list
10 * 15: next weapon according to priority list
11 * 16: previous weapon according to priority list
13 * 18: next weapon according to sbar_hudselector 1 list
14 * 19: previous weapon according to sbar_hudselector 1 list
15 * 20: reload if needed
17 * 30 to 39: create waypoints
18 * 47: clear personal waypoints
19 * 48: clear team waypoints
26 * 143: emergency teleport
27 * 148: unfairly eliminate
30 * 200 to 209: prev weapon shortcuts
31 * 210 to 219: best weapon shortcuts
32 * 220 to 229: next weapon shortcuts
33 * 230 to 253: individual weapons (up to 24)
36 void ImpulseCommands (void)
49 if (timeoutStatus == 2) //don't allow any impulses while the game is paused
55 else if (imp >= 1 && imp <= 9)
57 // weapon switching impulses
58 if(self.deadflag == DEAD_NO)
59 W_NextWeaponOnImpulse(imp);
61 self.impulse = imp; // retry in next frame
63 else if(imp >= 10 && imp <= 20)
65 if(self.deadflag == DEAD_NO)
73 W_SwitchWeapon (self.cnt); // previously used
79 W_SwitchWeapon (w_getbestweapon(self));
82 W_NextWeaponOnImpulse(0);
92 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
106 self.impulse = imp; // retry in next frame
108 else if(imp >= 200 && imp <= 229)
110 if(self.deadflag == DEAD_NO)
112 // custom order weapon cycling
114 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
115 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
118 self.impulse = imp; // retry in next frame
120 else if(imp >= 230 && imp <= 253)
122 if(self.deadflag == DEAD_NO)
123 W_SwitchWeapon (imp - 230 + WEP_FIRST);
125 self.impulse = imp; // retry in next frame
128 else if (imp >= 30 && imp <= 49)
134 wp = WaypointSprite_DeployPersonal("waypoint", self.origin);
137 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
138 WaypointSprite_Ping(wp);
140 sprint(self, "personal waypoint spawned at location\n");
143 wp = WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
146 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
147 WaypointSprite_Ping(wp);
149 sprint(self, "personal waypoint spawned at crosshair\n");
152 if(vlen(self.death_origin))
154 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin);
157 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
158 WaypointSprite_Ping(wp);
160 sprint(self, "personal waypoint spawned at death location\n");
164 if(self.deadflag == DEAD_NO && teams_matter)
166 wp = WaypointSprite_Attach("helpme", TRUE);
168 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color
170 wp = self.waypointsprite_attachedforcarrier; // flag sprite?
172 WaypointSprite_Ping(wp);
173 sprint(self, "HELP ME attached\n");
177 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin);
180 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
181 WaypointSprite_Ping(wp);
183 sprint(self, "HERE spawned at location\n");
186 wp = WaypointSprite_DeployFixed("here", FALSE, self.cursor_trace_endpos);
189 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
190 WaypointSprite_Ping(wp);
192 sprint(self, "HERE spawned at crosshair\n");
195 if(vlen(self.death_origin))
197 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
200 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
201 WaypointSprite_Ping(wp);
203 sprint(self, "HERE spawned at death location\n");
207 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin);
210 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
211 WaypointSprite_Ping(wp);
213 sprint(self, "DANGER spawned at location\n");
216 wp = WaypointSprite_DeployFixed("danger", FALSE, self.cursor_trace_endpos);
219 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
220 WaypointSprite_Ping(wp);
222 sprint(self, "DANGER spawned at crosshair\n");
225 if(vlen(self.death_origin))
227 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
230 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
231 WaypointSprite_Ping(wp);
233 sprint(self, "DANGER spawned at death location\n");
237 WaypointSprite_ClearPersonal();
240 remove(self.personal);
241 self.personal = world;
243 sprint(self, "personal waypoint cleared\n");
246 WaypointSprite_ClearOwned();
249 remove(self.personal);
250 self.personal = world;
252 sprint(self, "all waypoints cleared\n");
256 else if(imp >= 103 && imp <= 107)
258 if(cvar("g_waypointeditor"))
263 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
264 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
267 e = navigation_findnearestwaypoint(self, FALSE);
269 if not(e.wpflags & WAYPOINTFLAG_GENERATED)
271 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
276 waypoint_schedulerelinkall();
282 for(e = findchain(classname, "waypoint"); e; e = e.chain)
285 e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE;
287 e2 = navigation_findnearestwaypoint(self, FALSE);
288 navigation_markroutes(e2);
291 for(e = findchain(classname, "waypoint"); e; e = e.chain)
293 if(e.wpcost >= 10000000)
295 print("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
297 e.effects |= EF_NODEPTHTEST | EF_BLUE;
303 print(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
304 navigation_markroutes_inverted(e2);
306 for(e = findchain(classname, "waypoint"); e; e = e.chain)
308 if(e.wpcost >= 10000000)
310 print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
312 if not(e.effects & EF_NODEPTHTEST) // not already reported before
314 e.effects |= EF_NODEPTHTEST | EF_RED;
319 print(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
321 print(ftos(m), " waypoints have been marked total\n");
323 for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
326 tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
327 setorigin(e, trace_endpos);
328 if(navigation_findnearestwaypoint(e, FALSE))
331 e.effects &~= EF_NODEPTHTEST;
337 print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
338 e.effects |= EF_NODEPTHTEST;
339 setmodel(e, self.model);
340 e.frame = self.frame;
342 setsize(e, '0 0 0', '0 0 0');
347 print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");