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 * 148: 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)
95 void spawnfunc_racer();
96 //void spawnfunc_hov();
97 //void spawnfunc_vehicle_hoover();
99 void ImpulseCommands (void)
109 if (!imp || gameover)
113 if (timeoutStatus == 2) //don't allow any impulses while the game is paused
118 if(imp >= 21 && imp <= 29)
128 setorigin(r,os.origin + v_forward * 256);
137 setorigin(r,os.origin + v_forward * 256);
145 setorigin(r,os.origin + v_forward * 256);
146 spawnfunc_vehicle_hoover();
153 if (imp >= 1 && imp <= 9)
155 // weapon switching impulses
156 if(self.deadflag == DEAD_NO)
157 W_NextWeaponOnImpulse(imp);
159 self.impulse = imp; // retry in next frame
161 else if(imp >= 10 && imp <= 20)
163 if(self.deadflag == DEAD_NO)
171 W_SwitchWeapon (self.cnt); // previously used
174 W_PreviousWeapon (0);
177 W_SwitchWeapon (w_getbestweapon(self));
180 W_NextWeaponOnImpulse(0);
186 W_PreviousWeapon (2);
190 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
196 W_PreviousWeapon (1);
204 self.impulse = imp; // retry in next frame
206 else if(imp >= 200 && imp <= 229)
208 if(self.deadflag == DEAD_NO)
210 // custom order weapon cycling
212 m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
213 W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
216 self.impulse = imp; // retry in next frame
218 else if(imp >= 230 && imp <= 253)
220 if(self.deadflag == DEAD_NO)
221 W_SwitchWeapon (imp - 230 + WEP_FIRST);
223 self.impulse = imp; // retry in next frame
226 else if (imp >= 30 && imp <= 49)
232 wp = WaypointSprite_DeployPersonal("waypoint", self.origin);
235 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
236 WaypointSprite_Ping(wp);
238 self.personal_v_angle = self.v_angle;
239 self.personal_velocity = self.velocity;
240 sprint(self, "personal waypoint spawned at location\n");
243 wp = WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
246 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
247 WaypointSprite_Ping(wp);
249 self.personal_v_angle = self.v_angle;
250 self.personal_velocity = '0 0 0';
251 sprint(self, "personal waypoint spawned at crosshair\n");
254 if(vlen(self.death_origin))
256 wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin);
259 WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1');
260 WaypointSprite_Ping(wp);
262 self.personal_v_angle = self.v_angle;
263 self.personal_velocity = '0 0 0';
264 sprint(self, "personal waypoint spawned at death location\n");
268 if(self.deadflag == DEAD_NO && teams_matter)
270 wp = WaypointSprite_Attach("helpme", TRUE);
272 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color
274 wp = self.waypointsprite_attachedforcarrier; // flag sprite?
276 WaypointSprite_Ping(wp);
277 sprint(self, "HELP ME attached\n");
281 wp = WaypointSprite_DeployFixed("here", FALSE, self.origin);
284 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
285 WaypointSprite_Ping(wp);
287 sprint(self, "HERE spawned at location\n");
290 wp = WaypointSprite_DeployFixed("here", FALSE, self.cursor_trace_endpos);
293 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
294 WaypointSprite_Ping(wp);
296 sprint(self, "HERE spawned at crosshair\n");
299 if(vlen(self.death_origin))
301 wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
304 WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0');
305 WaypointSprite_Ping(wp);
307 sprint(self, "HERE spawned at death location\n");
311 wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin);
314 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
315 WaypointSprite_Ping(wp);
317 sprint(self, "DANGER spawned at location\n");
320 wp = WaypointSprite_DeployFixed("danger", FALSE, self.cursor_trace_endpos);
323 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
324 WaypointSprite_Ping(wp);
326 sprint(self, "DANGER spawned at crosshair\n");
329 if(vlen(self.death_origin))
331 wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
334 WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0');
335 WaypointSprite_Ping(wp);
337 sprint(self, "DANGER spawned at death location\n");
341 WaypointSprite_ClearPersonal();
342 sprint(self, "personal waypoint cleared\n");
345 WaypointSprite_ClearOwned();
346 sprint(self, "all waypoints cleared\n");
350 else if(imp >= 140 && imp <= 149 || imp == 99) // 10 cheats ought to be enough for anyone
352 if(self.deadflag == DEAD_NO)
354 if(sv_cheats || (self.lip < sv_clones))
359 makevectors (self.v_angle);
360 self.velocity = self.velocity + v_forward * 300;
363 self.velocity = self.velocity - v_forward * 300;
377 self.weapons |= WEPBIT_ALL;
378 self.items |= IT_UNLIMITED_AMMO;
379 self.ammo_shells = g_pickup_shells_max;
380 self.ammo_nails = g_pickup_nails_max;
381 self.ammo_rockets = g_pickup_rockets_max;
382 self.ammo_cells = g_pickup_cells_max;
383 self.ammo_fuel = g_pickup_fuel_max;
384 self.health = g_pickup_healthsmall_max;
385 self.armorvalue = g_pickup_armorsmall_max;
386 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
387 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
388 self.pauserotfuel_finished = time + cvar("g_balance_pause_fuel_rot_spawn");
389 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
390 // precache weapon models/sounds
392 while (wep <= WEP_LAST)
394 weapon_action(wep, WR_PRECACHE);
399 if(self.waypointsprite_deployed_personal)
401 self.speedrunning = TRUE;
402 tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
405 sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
409 // Abort speedrun, teleport back
410 setorigin(self, self.waypointsprite_deployed_personal.origin);
411 self.oldvelocity = self.velocity = self.personal_velocity;
412 self.angles = self.personal_v_angle;
413 self.fixangle = TRUE;
416 bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
417 ReturnFlag(self.flagcarried);
420 self.ammo_rockets = 999;
421 self.ammo_nails = 999;
422 self.ammo_cells = 999;
423 self.ammo_shells = 999;
424 self.ammo_fuel = 999;
425 self.health = start_health;
426 self.armorvalue = start_armorvalue;
427 self.weapons |= weaponsInMap;
428 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
429 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
430 self.pauserotfuel_finished = time + cvar("g_balance_pause_fuel_rot_spawn");
431 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
433 else if(self.deadflag != DEAD_NO)
434 sprint(self, "UR DEAD AHAHAH))\n");
436 sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
439 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))
441 self.angles_x = -self.angles_x;
442 self.fixangle = TRUE;
443 self.velocity = '0 0 0';
446 sprint(self, "Emergency teleport could not find a good location, forget it!\n");
449 makevectors(self.v_angle);
450 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
451 if (trace_fraction < 1)
452 printsurfaceinfo(trace_ent, trace_endpos);
455 makevectors(self.v_angle);
456 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
457 sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
460 makevectors(self.v_angle);
461 i = self.dphitcontentsmask;
462 self.dphitcontentsmask = DPCONTENTS_OPAQUE;
463 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
464 self.dphitcontentsmask = i;
465 sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
466 pointparticles(particleeffectnum("fire_big"), trace_endpos, '0 0 0', 10);
471 if( e.playermodel == "models/player/jeandarc.zym"
472 || e.playermodel == "models/player/pyria.zym"
473 || e.playermodel == "models/player/skadi.zym"
474 || (e.playermodel == "models/player/specop.zym" && random() < 0.5) // you never know
475 || e.playermodel == "models/player/visitant.zym")
477 makevectors(e.angles);
478 traceline(e.origin, e.origin + v_right * 256, MOVE_NORMAL, e);
485 org = normalize(org);
486 traceline(e.origin, e.origin + org * 256, MOVE_NORMAL, e); // random direction
489 org = findbetterlocation(trace_endpos, 12);
493 pointparticles(particleeffectnum("rocket_explode"), org, '0 0 0', 1);
494 sound(e2, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
495 RadiusDamage(e2, e, 1000, 0, 128, e, 500, DEATH_CHEAT, world);
498 print("404 Sportsmanship not found.\n");
504 else if(imp >= 103 && imp <= 106)
506 if(cvar("g_waypointeditor"))
511 waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
512 bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
515 e = navigation_findnearestwaypoint(self, FALSE);
517 if not(e.wpflags & WAYPOINTFLAG_GENERATED)
519 bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
524 waypoint_schedulerelinkall();
533 //TetrisImpulses(imp);