1 .vector personal_v_angle; // view angles to restore on impulse 77
2 .vector personal_velocity; // velocity to restore on impulse 77
4 void CopyBody(float keepvelocity);
6 // changes by LordHavoc on 03/30/04
7 // cleaned up dummy code
8 // dummies are now removed eventually after being gibbed (norespawn = TRUE)
9 // dummy impulse now checks sv_cheats to prevent players from overwhelming server with dummies
10 // dummies now use player code where possible
12 void player_anim (void);
15 self.think = DummyThink;
16 self.nextthink = time;
24 void printsurfaceinfo(entity e, vector v)
26 local float surfnum, numpoints, vnum;
29 surfnum = getsurfacenearpoint(e, v);
32 sprint(self, "texture: ");
33 s = getsurfacetexture(e, surfnum);
35 sprint(self, " normal: ");
36 n = getsurfacenormal(e, surfnum);
37 sprint(self, vtos(n));
39 numpoints = getsurfacenumpoints(e, surfnum);
40 sprint(self, ftos(numpoints));
41 sprint(self, " verts:");
43 while (vnum < numpoints)
46 n = getsurfacepoint(e, surfnum, vnum);
47 sprint(self, vtos(n));
50 sprint(self, " point tested: ");
51 sprint(self, vtos(v));
52 sprint(self, " nearest point on surface: ");
53 n = getsurfaceclippedpoint(e, surfnum, v);
54 sprint(self, vtos(n));
62 * 0 reserved (no input)
63 * 1 to 9, 14: weapon shortcuts
64 * 10: next weapon according to linear list
65 * 11: most recently used weapon
66 * 12: previous weapon according to linear list
67 * 13: best weapon according to priority list
68 * 15: next weapon according to priority list
69 * 16: previous weapon according to priority list
71 * 18: next weapon according to sbar_hudselector 1 list
72 * 19: previous weapon according to sbar_hudselector 1 list
73 * 20: reload if needed
75 * 30 to 39: create waypoints
76 * 47: clear personal waypoints
77 * 48: clear team waypoints
84 * 143: emergency teleport
85 * 144: printsurfaceinfo
87 * 147: unfairly eliminate
90 * 200 to 209: prev weapon shortcuts
91 * 210 to 219: best weapon shortcuts
92 * 220 to 229: next weapon shortcuts
93 * 230 to 253: individual weapons (up to 24)
96 void ImpulseCommands (void)
106 if (!imp || gameover)
110 if (timeoutStatus == 2) //don't allow any impulses while the game is paused
113 if (imp >= 1 && imp <= 9)
115 // weapon switching impulses
116 if(self.deadflag == DEAD_NO)
117 W_NextWeaponOnImpulse(imp);
119 self.impulse = imp; // retry in next frame
121 else if(imp >= 10 && imp <= 20)
123 if(self.deadflag == DEAD_NO)
131 W_SwitchWeapon (self.cnt); // previously used
134 W_PreviousWeapon (0);
137 W_SwitchWeapon (w_getbestweapon(self));
140 W_NextWeaponOnImpulse(0);
146 W_PreviousWeapon (2);
150 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
156 W_PreviousWeapon (1);
164 self.impulse = imp; // retry in next frame
166 else if(imp >= 200 && imp <= 229)
168 if(self.deadflag == DEAD_NO)
170 // custom order weapon cycling
172 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
173 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
176 self.impulse = imp; // retry in next frame
178 else if(imp >= 230 && imp <= 253)
180 if(self.deadflag == DEAD_NO)
181 W_SwitchWeapon (imp - 230 + WEP_FIRST);
183 self.impulse = imp; // retry in next frame
186 else if (imp >= 30 && imp <= 49)
192 wp = WaypointSprite_DeployPersonal("waypoint", self.origin);
195 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
196 WaypointSprite_Ping(wp);
198 self.personal_v_angle = self.v_angle;
199 self.personal_velocity = self.velocity;
200 sprint(self, "personal waypoint spawned at location\n");
203 wp = WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
206 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
207 WaypointSprite_Ping(wp);
209 self.personal_v_angle = self.v_angle;
210 self.personal_velocity = '0 0 0';
211 sprint(self, "personal waypoint spawned at crosshair\n");
214 if(vlen(self.death_origin))
216 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin);
219 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
220 WaypointSprite_Ping(wp);
222 self.personal_v_angle = self.v_angle;
223 self.personal_velocity = '0 0 0';
224 sprint(self, "personal waypoint spawned at death location\n");
228 if(self.deadflag == DEAD_NO && teams_matter)
230 wp = WaypointSprite_Attach("helpme", TRUE);
232 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color
234 wp = self.waypointsprite_attachedforcarrier; // flag sprite?
236 WaypointSprite_Ping(wp);
237 sprint(self, "HELP ME attached\n");
241 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin);
244 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
245 WaypointSprite_Ping(wp);
247 sprint(self, "HERE spawned at location\n");
250 wp = WaypointSprite_DeployFixed("here", FALSE, self.cursor_trace_endpos);
253 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
254 WaypointSprite_Ping(wp);
256 sprint(self, "HERE spawned at crosshair\n");
259 if(vlen(self.death_origin))
261 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
264 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
265 WaypointSprite_Ping(wp);
267 sprint(self, "HERE spawned at death location\n");
271 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin);
274 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
275 WaypointSprite_Ping(wp);
277 sprint(self, "DANGER spawned at location\n");
280 wp = WaypointSprite_DeployFixed("danger", FALSE, self.cursor_trace_endpos);
283 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
284 WaypointSprite_Ping(wp);
286 sprint(self, "DANGER spawned at crosshair\n");
289 if(vlen(self.death_origin))
291 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
294 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
295 WaypointSprite_Ping(wp);
297 sprint(self, "DANGER spawned at death location\n");
301 WaypointSprite_ClearPersonal();
302 sprint(self, "personal waypoint cleared\n");
305 WaypointSprite_ClearOwned();
306 sprint(self, "all waypoints cleared\n");
310 else if(imp >= 140 && imp <= 149 || imp == 99) // 10 cheats ought to be enough for anyone
312 if(self.deadflag == DEAD_NO)
314 if(sv_cheats || (self.lip < sv_clones))
319 makevectors (self.v_angle);
320 self.velocity = self.velocity + v_forward * 300;
323 self.velocity = self.velocity - v_forward * 300;
337 self.weapons |= WEPBIT_ALL;
338 self.items |= IT_UNLIMITED_AMMO;
339 self.ammo_shells = g_pickup_shells_max;
340 self.ammo_nails = g_pickup_nails_max;
341 self.ammo_rockets = g_pickup_rockets_max;
342 self.ammo_cells = g_pickup_cells_max;
343 self.health = g_pickup_healthsmall_max;
344 self.armorvalue = g_pickup_armorsmall_max;
345 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
346 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
347 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
348 // precache weapon models/sounds
350 while (wep <= WEP_LAST)
352 weapon_action(wep, WR_PRECACHE);
357 if(self.waypointsprite_deployed_personal)
359 self.speedrunning = TRUE;
360 tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
363 sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
367 // Abort speedrun, teleport back
368 setorigin(self, self.waypointsprite_deployed_personal.origin);
369 self.oldvelocity = self.velocity = self.personal_velocity;
370 self.angles = self.personal_v_angle;
371 self.fixangle = TRUE;
374 bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
375 ReturnFlag(self.flagcarried);
378 self.ammo_rockets = 999;
379 self.ammo_nails = 999;
380 self.ammo_cells = 999;
381 self.ammo_shells = 999;
382 self.health = start_health;
383 self.armorvalue = start_armorvalue;
384 self.weapons |= weaponsInMap;
385 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
386 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
387 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
389 else if(self.deadflag != DEAD_NO)
390 sprint(self, "UR DEAD AHAHAH))\n");
392 sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
395 if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((sv_cheats >= 2) ? 100000 : 100), 1024, 256))
397 self.angles_x = -self.angles_x;
398 self.fixangle = TRUE;
399 self.velocity = '0 0 0';
402 sprint(self, "Emergency teleport could not find a good location, forget it!\n");
405 makevectors(self.v_angle);
406 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
407 if (trace_fraction < 1)
408 printsurfaceinfo(trace_ent, trace_endpos);
411 makevectors(self.v_angle);
412 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
413 sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
418 if(e.playermodel == "models/player/jeandarc.zym"
419 || e.playermodel == "models/player/pyria.zym"
420 || e.playermodel == "models/player/skadi.zym"
421 || e.playermodel == "models/player/visitant.zym")
423 makevectors(e.angles);
424 traceline(e.origin, e.origin + v_right * 256, MOVE_NORMAL, e);
431 org = normalize(org);
432 traceline(e.origin, e.origin + org * 256, MOVE_NORMAL, e); // random direction
435 org = findbetterlocation(trace_endpos, 12);
439 pointparticles(particleeffectnum("rocket_explode"), org, '0 0 0', 1);
440 sound(e2, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
441 RadiusDamage(e2, e, 1000, 0, 128, e, 500, DEATH_CHEAT, world);
444 print("404 Sportsmanship not found.\n");
450 else if(imp >= 103 && imp <= 106)
452 if(cvar("g_waypointeditor"))
457 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
460 e = navigation_findnearestwaypoint(self, FALSE);
465 waypoint_schedulerelinkall();
474 //TetrisImpulses(imp);