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 WarpZone_crosshair_trace(self);
144 wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos);
147 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
148 WaypointSprite_Ping(wp);
150 sprint(self, "personal waypoint spawned at crosshair\n");
153 if(vlen(self.death_origin))
155 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin);
158 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
159 WaypointSprite_Ping(wp);
161 sprint(self, "personal waypoint spawned at death location\n");
165 if(self.deadflag == DEAD_NO && teams_matter)
167 wp = WaypointSprite_Attach("helpme", TRUE);
169 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color
171 wp = self.waypointsprite_attachedforcarrier; // flag sprite?
173 WaypointSprite_Ping(wp);
174 sprint(self, "HELP ME attached\n");
178 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin);
181 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
182 WaypointSprite_Ping(wp);
184 sprint(self, "HERE spawned at location\n");
187 WarpZone_crosshair_trace(self);
188 wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos);
191 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
192 WaypointSprite_Ping(wp);
194 sprint(self, "HERE spawned at crosshair\n");
197 if(vlen(self.death_origin))
199 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
202 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
203 WaypointSprite_Ping(wp);
205 sprint(self, "HERE spawned at death location\n");
209 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin);
212 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
213 WaypointSprite_Ping(wp);
215 sprint(self, "DANGER spawned at location\n");
218 WarpZone_crosshair_trace(self);
219 wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos);
222 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
223 WaypointSprite_Ping(wp);
225 sprint(self, "DANGER spawned at crosshair\n");
228 if(vlen(self.death_origin))
230 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
233 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
234 WaypointSprite_Ping(wp);
236 sprint(self, "DANGER spawned at death location\n");
240 WaypointSprite_ClearPersonal();
243 remove(self.personal);
244 self.personal = world;
246 sprint(self, "personal waypoint cleared\n");
249 WaypointSprite_ClearOwned();
252 remove(self.personal);
253 self.personal = world;
255 sprint(self, "all waypoints cleared\n");
259 else if(imp >= 103 && imp <= 107)
261 if(cvar("g_waypointeditor"))
266 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
267 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
270 e = navigation_findnearestwaypoint(self, FALSE);
272 if not(e.wpflags & WAYPOINTFLAG_GENERATED)
274 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
279 waypoint_schedulerelinkall();
285 for(e = findchain(classname, "waypoint"); e; e = e.chain)
288 e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE;
290 e2 = navigation_findnearestwaypoint(self, FALSE);
291 navigation_markroutes(e2);
294 for(e = findchain(classname, "waypoint"); e; e = e.chain)
296 if(e.wpcost >= 10000000)
298 print("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
300 e.effects |= EF_NODEPTHTEST | EF_BLUE;
306 print(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
307 navigation_markroutes_inverted(e2);
309 for(e = findchain(classname, "waypoint"); e; e = e.chain)
311 if(e.wpcost >= 10000000)
313 print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
315 if not(e.effects & EF_NODEPTHTEST) // not already reported before
317 e.effects |= EF_NODEPTHTEST | EF_RED;
322 print(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
324 print(ftos(m), " waypoints have been marked total\n");
326 for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
329 tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
330 setorigin(e, trace_endpos);
331 if(navigation_findnearestwaypoint(e, FALSE))
334 e.effects &~= EF_NODEPTHTEST;
340 print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
341 e.effects |= EF_NODEPTHTEST;
342 setmodel(e, self.model);
343 e.frame = self.frame;
345 setsize(e, '0 0 0', '0 0 0');
350 print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");