4 * 0 reserved (no input)
\r
5 * 1 to 9, 14: weapon shortcuts
\r
6 * 10: next weapon according to linear list
\r
7 * 11: most recently used weapon
\r
8 * 12: previous weapon according to linear list
\r
9 * 13: best weapon according to priority list
\r
10 * 15: next weapon according to priority list
\r
11 * 16: previous weapon according to priority list
\r
13 * 18: next weapon according to sbar_hudselector 1 list
\r
14 * 19: previous weapon according to sbar_hudselector 1 list
\r
15 * 20: reload if needed
\r
17 * 30 to 39: create waypoints
\r
18 * 47: clear personal waypoints
\r
19 * 48: clear team waypoints
\r
26 * 143: emergency teleport
\r
27 * 148: unfairly eliminate
\r
30 * 200 to 209: prev weapon shortcuts
\r
31 * 210 to 219: best weapon shortcuts
\r
32 * 220 to 229: next weapon shortcuts
\r
33 * 230 to 253: individual weapons (up to 24)
\r
36 void ImpulseCommands (void)
\r
45 if (!imp || gameover)
\r
49 if (timeoutStatus == 2) //don't allow any impulses while the game is paused
\r
52 if(CheatImpulse(imp))
\r
55 else if (imp >= 1 && imp <= 9)
\r
57 // weapon switching impulses
\r
58 if(self.deadflag == DEAD_NO)
\r
59 W_NextWeaponOnImpulse(imp);
\r
61 self.impulse = imp; // retry in next frame
\r
63 else if(imp >= 10 && imp <= 20)
\r
65 if(self.deadflag == DEAD_NO)
\r
73 W_SwitchWeapon (self.cnt); // previously used
\r
76 W_PreviousWeapon (0);
\r
79 W_SwitchWeapon (w_getbestweapon(self));
\r
82 W_NextWeaponOnImpulse(0);
\r
88 W_PreviousWeapon (2);
\r
91 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
\r
97 W_PreviousWeapon (1);
\r
100 W_TriggerReload ();
\r
105 self.impulse = imp; // retry in next frame
\r
107 else if(imp >= 200 && imp <= 229)
\r
109 if(self.deadflag == DEAD_NO)
\r
111 // custom order weapon cycling
\r
113 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
\r
114 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
\r
117 self.impulse = imp; // retry in next frame
\r
119 else if(imp >= 230 && imp <= 253)
\r
121 if(self.deadflag == DEAD_NO)
\r
122 W_SwitchWeapon (imp - 230 + WEP_FIRST);
\r
124 self.impulse = imp; // retry in next frame
\r
126 // deploy waypoints
\r
127 else if (imp >= 30 && imp <= 49)
\r
133 wp = WaypointSprite_DeployPersonal("waypoint", self.origin);
\r
136 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
\r
137 WaypointSprite_Ping(wp);
\r
139 sprint(self, "personal waypoint spawned at location\n");
\r
142 WarpZone_crosshair_trace(self);
\r
143 wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos);
\r
146 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
\r
147 WaypointSprite_Ping(wp);
\r
149 sprint(self, "personal waypoint spawned at crosshair\n");
\r
152 if(vlen(self.death_origin))
\r
154 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin);
\r
157 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
\r
158 WaypointSprite_Ping(wp);
\r
160 sprint(self, "personal waypoint spawned at death location\n");
\r
164 if(self.deadflag == DEAD_NO && teams_matter)
\r
166 wp = WaypointSprite_Attach("helpme", TRUE);
\r
168 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color
\r
170 wp = self.waypointsprite_attachedforcarrier; // flag sprite?
\r
172 WaypointSprite_Ping(wp);
\r
173 sprint(self, "HELP ME attached\n");
\r
177 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin);
\r
180 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
\r
181 WaypointSprite_Ping(wp);
\r
183 sprint(self, "HERE spawned at location\n");
\r
186 WarpZone_crosshair_trace(self);
\r
187 wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos);
\r
190 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
\r
191 WaypointSprite_Ping(wp);
\r
193 sprint(self, "HERE spawned at crosshair\n");
\r
196 if(vlen(self.death_origin))
\r
198 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
\r
201 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
\r
202 WaypointSprite_Ping(wp);
\r
204 sprint(self, "HERE spawned at death location\n");
\r
208 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin);
\r
211 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
\r
212 WaypointSprite_Ping(wp);
\r
214 sprint(self, "DANGER spawned at location\n");
\r
217 WarpZone_crosshair_trace(self);
\r
218 wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos);
\r
221 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
\r
222 WaypointSprite_Ping(wp);
\r
224 sprint(self, "DANGER spawned at crosshair\n");
\r
227 if(vlen(self.death_origin))
\r
229 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
\r
232 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
\r
233 WaypointSprite_Ping(wp);
\r
235 sprint(self, "DANGER spawned at death location\n");
\r
239 WaypointSprite_ClearPersonal();
\r
242 remove(self.personal);
\r
243 self.personal = world;
\r
245 sprint(self, "personal waypoint cleared\n");
\r
248 WaypointSprite_ClearOwned();
\r
251 remove(self.personal);
\r
252 self.personal = world;
\r
254 sprint(self, "all waypoints cleared\n");
\r
258 else if(imp >= 103 && imp <= 107)
\r
260 if(cvar("g_waypointeditor"))
\r
265 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
\r
266 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
\r
269 e = navigation_findnearestwaypoint(self, FALSE);
\r
271 if not(e.wpflags & WAYPOINTFLAG_GENERATED)
\r
273 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
\r
274 waypoint_remove(e);
\r
278 waypoint_schedulerelinkall();
\r
281 waypoint_saveall();
\r
284 for(e = findchain(classname, "waypoint"); e; e = e.chain)
\r
287 e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE;
\r
289 e2 = navigation_findnearestwaypoint(self, FALSE);
\r
290 navigation_markroutes(e2);
\r
293 for(e = findchain(classname, "waypoint"); e; e = e.chain)
\r
295 if(e.wpcost >= 10000000)
\r
297 print("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
\r
298 e.colormod_x = 0.1;
\r
299 e.effects |= EF_NODEPTHTEST | EF_BLUE;
\r
305 print(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
\r
306 navigation_markroutes_inverted(e2);
\r
308 for(e = findchain(classname, "waypoint"); e; e = e.chain)
\r
310 if(e.wpcost >= 10000000)
\r
312 print("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
\r
313 e.colormod_x = 0.1;
\r
314 if not(e.effects & EF_NODEPTHTEST) // not already reported before
\r
316 e.effects |= EF_NODEPTHTEST | EF_RED;
\r
321 print(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
\r
323 print(ftos(m), " waypoints have been marked total\n");
\r
325 for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
\r
328 tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
\r
329 setorigin(e, trace_endpos);
\r
330 if(navigation_findnearestwaypoint(e, FALSE))
\r
333 e.effects &~= EF_NODEPTHTEST;
\r
339 print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
\r
340 e.effects |= EF_NODEPTHTEST;
\r
341 setmodel(e, self.model);
\r
342 e.frame = self.frame;
\r
343 e.skin = self.skin;
\r
344 setsize(e, '0 0 0', '0 0 0');
\r
349 print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");
\r
355 else if(imp == 100)
\r