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 // forbid impulses when not in round time
50 if(round_handler_IsActive() && !round_handler_IsRoundStarted())
53 if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
57 if(self.vehicle.deadflag == DEAD_NO)
58 if(self.vehicle.vehicles_impusle)
59 if(self.vehicle.vehicles_impusle(imp))
65 else if (imp >= 1 && imp <= 9)
67 // weapon switching impulses
68 if(self.deadflag == DEAD_NO)
69 W_NextWeaponOnImpulse(imp);
71 self.impulse = imp; // retry in next frame
73 else if(imp >= 10 && imp <= 20)
75 if(self.deadflag == DEAD_NO)
89 W_SwitchWeapon (w_getbestweapon(self));
92 W_NextWeaponOnImpulse(0);
101 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE);
107 W_PreviousWeapon (1);
115 self.impulse = imp; // retry in next frame
121 else if(imp >= 200 && imp <= 229)
123 if(self.deadflag == DEAD_NO)
125 // custom order weapon cycling
127 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
128 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
131 self.impulse = imp; // retry in next frame
133 else if(imp >= 230 && imp <= 253)
135 if(self.deadflag == DEAD_NO)
136 W_SwitchWeapon (imp - 230 + WEP_FIRST);
138 self.impulse = imp; // retry in next frame
141 else if (imp >= 30 && imp <= 49)
147 wp = WaypointSprite_DeployPersonal("waypoint", self.origin, RADARICON_WAYPOINT, '0 1 1');
149 WaypointSprite_Ping(wp);
150 sprint(self, "personal waypoint spawned at location\n");
153 WarpZone_crosshair_trace(self);
154 wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos, RADARICON_WAYPOINT, '0 1 1');
156 WaypointSprite_Ping(wp);
157 sprint(self, "personal waypoint spawned at crosshair\n");
160 if(vlen(self.death_origin))
162 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin, RADARICON_WAYPOINT, '0 1 1');
164 WaypointSprite_Ping(wp);
165 sprint(self, "personal waypoint spawned at death location\n");
169 if(self.deadflag == DEAD_NO && teamplay)
171 if not(MUTATOR_CALLHOOK(HelpMePing))
173 wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
175 WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
177 WaypointSprite_Ping(wp);
179 sprint(self, "HELP ME attached\n");
183 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin, RADARICON_HERE, '0 1 0');
185 WaypointSprite_Ping(wp);
186 sprint(self, "HERE spawned at location\n");
189 WarpZone_crosshair_trace(self);
190 wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos, RADARICON_HERE, '0 1 0');
192 WaypointSprite_Ping(wp);
193 sprint(self, "HERE spawned at crosshair\n");
196 if(vlen(self.death_origin))
198 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin, RADARICON_HERE, '0 1 0');
200 WaypointSprite_Ping(wp);
201 sprint(self, "HERE spawned at death location\n");
205 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin, RADARICON_DANGER, '1 0.5 0');
207 WaypointSprite_Ping(wp);
208 sprint(self, "DANGER spawned at location\n");
211 WarpZone_crosshair_trace(self);
212 wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos, RADARICON_DANGER, '1 0.5 0');
214 WaypointSprite_Ping(wp);
215 sprint(self, "DANGER spawned at crosshair\n");
218 if(vlen(self.death_origin))
220 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin, RADARICON_DANGER, '1 0.5 0');
222 WaypointSprite_Ping(wp);
223 sprint(self, "DANGER spawned at death location\n");
227 WaypointSprite_ClearPersonal();
230 remove(self.personal);
231 self.personal = world;
233 sprint(self, "personal waypoint cleared\n");
236 WaypointSprite_ClearOwned();
239 remove(self.personal);
240 self.personal = world;
242 sprint(self, "all waypoints cleared\n");
246 else if(imp >= 103 && imp <= 107)
248 if(autocvar_g_waypointeditor)
253 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
254 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
257 e = navigation_findnearestwaypoint(self, FALSE);
259 if not(e.wpflags & WAYPOINTFLAG_GENERATED)
261 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
266 waypoint_schedulerelinkall();
272 for(e = findchain(classname, "waypoint"); e; e = e.chain)
274 e.colormod = '0.5 0.5 0.5';
275 e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
277 e2 = navigation_findnearestwaypoint(self, FALSE);
278 navigation_markroutes(e2);
281 for(e = findchain(classname, "waypoint"); e; e = e.chain)
283 if(e.wpcost >= 10000000)
285 print("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
287 e.effects |= EF_NODEPTHTEST | EF_BLUE;
293 print(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
294 navigation_markroutes_inverted(e2);
296 for(e = findchain(classname, "waypoint"); e; e = e.chain)
298 if(e.wpcost >= 10000000)
300 print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
302 if not(e.effects & EF_NODEPTHTEST) // not already reported before
304 e.effects |= EF_NODEPTHTEST | EF_RED;
309 print(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
311 print(ftos(m), " waypoints have been marked total\n");
313 for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
316 tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
317 setorigin(e, trace_endpos);
318 if(navigation_findnearestwaypoint(e, FALSE))
321 e.effects &= ~EF_NODEPTHTEST;
327 print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
328 e.effects |= EF_NODEPTHTEST;
329 setmodel(e, self.model);
330 e.frame = self.frame;
332 e.colormod = '8 0.5 8';
333 setsize(e, '0 0 0', '0 0 0');
338 print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");
341 start = findchainflags(flags, FL_ITEM);
342 for(e = start; e; e = e.chain)
344 e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
345 e.colormod = '0.5 0.5 0.5';
347 for(e = start; e; e = e.chain)
349 if(navigation_findnearestwaypoint(e, FALSE))
354 print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
355 e.effects |= EF_NODEPTHTEST | EF_RED;
361 print(ftos(i), " items have no nearest waypoint and cannot be walked away from (marked with red light)\n");
363 for(e = start; e; e = e.chain)
366 if(navigation_findnearestwaypoint(e, TRUE))
371 print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
372 e.effects |= EF_NODEPTHTEST | EF_BLUE;
378 print(ftos(i), " items have no nearest waypoint and cannot be walked to (marked with blue light)\n");