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 // allow only weapon change impulses when not in round time
50 if(round_handler_IsActive() && !round_handler_IsRoundStarted())
51 if(imp == 17 || (imp >= 20 && imp < 200) || imp > 253)
54 if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
58 if(self.vehicle.deadflag == DEAD_NO)
59 if(self.vehicle.vehicles_impulse)
60 if(self.vehicle.vehicles_impulse(imp))
66 else if (imp >= 1 && imp <= 9)
68 // weapon switching impulses
69 if(self.deadflag == DEAD_NO)
70 W_NextWeaponOnImpulse(imp);
72 // self.impulse = imp; // retry in next frame
74 else if(imp >= 10 && imp <= 20)
77 if(self.deadflag == DEAD_NO)
91 W_SwitchWeapon(w_getbestweapon(self));
94 W_NextWeaponOnImpulse(0);
103 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE);
112 if(!forbidWeaponUse(self)) { WEP_ACTION(self.weapon, WR_RELOAD); }
117 self.impulse = imp; // retry in next frame
123 else if(imp >= 200 && imp <= 229)
126 if(self.deadflag == DEAD_NO)
128 // custom order weapon cycling
130 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
131 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
134 self.impulse = imp; // retry in next frame
136 else if(imp >= 230 && imp <= 253)
139 if(self.deadflag == DEAD_NO)
140 W_SwitchWeapon (imp - 230 + WEP_FIRST);
142 self.impulse = imp; // retry in next frame
145 else if (imp >= 30 && imp <= 49)
151 wp = WaypointSprite_DeployPersonal("waypoint", self.origin, RADARICON_WAYPOINT, '0 1 1');
153 WaypointSprite_Ping(wp);
154 sprint(self, "personal waypoint spawned at location\n");
157 WarpZone_crosshair_trace(self);
158 wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos, RADARICON_WAYPOINT, '0 1 1');
160 WaypointSprite_Ping(wp);
161 sprint(self, "personal waypoint spawned at crosshair\n");
164 if(vlen(self.death_origin))
166 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin, RADARICON_WAYPOINT, '0 1 1');
168 WaypointSprite_Ping(wp);
169 sprint(self, "personal waypoint spawned at death location\n");
173 if(self.deadflag == DEAD_NO && teamplay)
175 if (!MUTATOR_CALLHOOK(HelpMePing))
177 wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
179 WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
181 WaypointSprite_Ping(wp);
183 sprint(self, "HELP ME attached\n");
187 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin, RADARICON_HERE, '0 1 0');
189 WaypointSprite_Ping(wp);
190 sprint(self, "HERE spawned at location\n");
193 WarpZone_crosshair_trace(self);
194 wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos, RADARICON_HERE, '0 1 0');
196 WaypointSprite_Ping(wp);
197 sprint(self, "HERE spawned at crosshair\n");
200 if(vlen(self.death_origin))
202 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin, RADARICON_HERE, '0 1 0');
204 WaypointSprite_Ping(wp);
205 sprint(self, "HERE spawned at death location\n");
209 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin, RADARICON_DANGER, '1 0.5 0');
211 WaypointSprite_Ping(wp);
212 sprint(self, "DANGER spawned at location\n");
215 WarpZone_crosshair_trace(self);
216 wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos, RADARICON_DANGER, '1 0.5 0');
218 WaypointSprite_Ping(wp);
219 sprint(self, "DANGER spawned at crosshair\n");
222 if(vlen(self.death_origin))
224 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin, RADARICON_DANGER, '1 0.5 0');
226 WaypointSprite_Ping(wp);
227 sprint(self, "DANGER spawned at death location\n");
231 WaypointSprite_ClearPersonal();
234 remove(self.personal);
235 self.personal = world;
237 sprint(self, "personal waypoint cleared\n");
240 WaypointSprite_ClearOwned();
243 remove(self.personal);
244 self.personal = world;
246 sprint(self, "all waypoints cleared\n");
250 else if(imp >= 103 && imp <= 107)
252 if(autocvar_g_waypointeditor)
257 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
258 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
261 e = navigation_findnearestwaypoint(self, FALSE);
263 if (!(e.wpflags & WAYPOINTFLAG_GENERATED))
265 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
270 waypoint_schedulerelinkall();
276 for(e = findchain(classname, "waypoint"); e; e = e.chain)
278 e.colormod = '0.5 0.5 0.5';
279 e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
281 e2 = navigation_findnearestwaypoint(self, FALSE);
282 navigation_markroutes(e2);
285 for(e = findchain(classname, "waypoint"); e; e = e.chain)
287 if(e.wpcost >= 10000000)
289 print("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
291 e.effects |= EF_NODEPTHTEST | EF_BLUE;
297 print(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
298 navigation_markroutes_inverted(e2);
300 for(e = findchain(classname, "waypoint"); e; e = e.chain)
302 if(e.wpcost >= 10000000)
304 print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
306 if(!(e.effects & EF_NODEPTHTEST)) // not already reported before
308 e.effects |= EF_NODEPTHTEST | EF_RED;
313 print(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
315 print(ftos(m), " waypoints have been marked total\n");
317 for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
320 tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
321 setorigin(e, trace_endpos);
322 if(navigation_findnearestwaypoint(e, FALSE))
325 e.effects &= ~EF_NODEPTHTEST;
331 print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
332 e.effects |= EF_NODEPTHTEST;
333 setmodel(e, self.model);
334 e.frame = self.frame;
336 e.colormod = '8 0.5 8';
337 setsize(e, '0 0 0', '0 0 0');
342 print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");
345 start = findchainflags(flags, FL_ITEM);
346 for(e = start; e; e = e.chain)
348 e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
349 e.colormod = '0.5 0.5 0.5';
351 for(e = start; e; e = e.chain)
353 if(navigation_findnearestwaypoint(e, FALSE))
358 print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
359 e.effects |= EF_NODEPTHTEST | EF_RED;
365 print(ftos(i), " items have no nearest waypoint and cannot be walked away from (marked with red light)\n");
367 for(e = start; e; e = e.chain)
370 if(navigation_findnearestwaypoint(e, TRUE))
375 print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
376 e.effects |= EF_NODEPTHTEST | EF_BLUE;
382 print(ftos(i), " items have no nearest waypoint and cannot be walked to (marked with blue light)\n");