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(entity e, vector v) printsurfaceinfo =
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));
59 void ImpulseCommands (void)
66 if (imp >= 1 && imp <= 12)
68 // weapon switching impulses
69 if(self.deadflag == DEAD_NO)
77 else if (imp == 11) // last weapon
78 W_SwitchWeapon (self.cnt);
81 self.impulse = imp; // retry in next frame
86 if(self.deadflag == DEAD_NO)
88 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
91 else if (imp >= 30 && imp <= 49)
95 WaypointSprite_DeployPersonal("waypoint", self.origin);
96 self.personal_v_angle = self.v_angle;
97 self.personal_velocity = self.velocity;
98 sprint(self, "personal waypoint spawned at location\n");
102 WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
103 self.personal_v_angle = self.v_angle;
104 self.personal_velocity = '0 0 0';
105 sprint(self, "personal waypoint spawned at crosshair\n");
107 else if(imp == 32 && vlen(self.death_origin))
109 WaypointSprite_DeployPersonal("waypoint", self.death_origin);
110 self.personal_v_angle = self.v_angle;
111 self.personal_velocity = '0 0 0';
112 sprint(self, "personal waypoint spawned at death location\n");
114 else if(imp == 33 && self.deadflag == DEAD_NO && teams_matter)
116 WaypointSprite_Attach("helpme", TRUE);
117 sprint(self, "HELP ME attached\n");
121 WaypointSprite_DeployFixed("here", FALSE, self.origin);
122 sprint(self, "HERE spawned at location\n");
126 WaypointSprite_DeployFixed("here", FALSE, self.cursor_trace_endpos);
127 sprint(self, "HERE spawned at crosshair\n");
129 else if(imp == 36 && vlen(self.death_origin))
131 WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
132 sprint(self, "HERE spawned at death location\n");
136 WaypointSprite_DeployFixed("danger", FALSE, self.origin);
137 sprint(self, "DANGER spawned at location\n");
141 WaypointSprite_DeployFixed("danger", FALSE, self.cursor_trace_endpos);
142 sprint(self, "DANGER spawned at crosshair\n");
144 else if(imp == 39 && vlen(self.death_origin))
146 WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
147 sprint(self, "DANGER spawned at death location\n");
151 WaypointSprite_ClearPersonal();
152 sprint(self, "personal waypoint cleared\n");
156 WaypointSprite_ClearOwned();
157 sprint(self, "all waypoints cleared\n");
161 self.cvar_cl_hidewaypoints = !(self.cvar_cl_hidewaypoints);
162 sprint(self, "fixed waypoints now ");
163 if(self.cvar_cl_hidewaypoints)
164 sprint(self, "OFF\n");
166 sprint(self, "ON\n");
175 makevectors(self.v_angle);
176 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
177 if (trace_fraction < 1)
178 printsurfaceinfo(trace_ent, trace_endpos);
182 makevectors(self.v_angle);
183 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
184 sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
186 else if(self.deadflag == DEAD_NO)
190 if(self.waypointsprite_deployed_personal)
192 self.speedrunning = TRUE;
193 tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
196 sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
200 // Abort speedrun, teleport back
201 setorigin(self, self.waypointsprite_deployed_personal.origin);
202 self.oldvelocity = self.velocity = self.personal_velocity;
203 self.angles = self.personal_v_angle;
204 self.fixangle = TRUE;
207 bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
208 ReturnFlag(self.flagcarried);
211 self.ammo_rockets = 999;
212 self.ammo_nails = 999;
213 self.ammo_cells = 999;
214 self.ammo_shells = 999;
215 self.health = start_health;
216 self.armorvalue = start_armorvalue;
217 self.items |= itemsInMap & (IT_LASER | IT_SHOTGUN | IT_UZI | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER);
218 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
219 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
220 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
223 sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
227 self.items |= (IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER);
228 self.ammo_shells = g_pickup_shells_max;
229 self.ammo_nails = g_pickup_nails_max;
230 self.ammo_rockets = g_pickup_rockets_max;
231 self.ammo_cells = g_pickup_cells_max;
232 self.health = g_pickup_healthsmall_max;
233 self.armorvalue = g_pickup_armorsmall_max;
234 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
235 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
236 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
237 // precache weapon models/sounds
240 while (wep <= WEP_LAST)
242 weapon_action(wep, WR_PRECACHE);
248 makevectors (self.v_angle);
249 self.velocity = self.velocity + v_forward * 300;
251 self.velocity = self.velocity - v_forward * 300;
259 if (cvar("g_waypointeditor"))
262 if (imp == 103) waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
263 else if (imp == 104) {e = navigation_findnearestwaypoint(self, FALSE);if (e) waypoint_remove(e);}
264 else if (imp == 105) waypoint_schedulerelinkall();
265 else if (imp == 106) waypoint_saveall();
268 //TetrisImpulses(imp);