]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamec/cl_impulse.c
sv_autoscreenshot option to force screenshot at match end on ladder servers and disab...
[divverent/nexuiz.git] / data / qcsrc / server / gamec / cl_impulse.c
1 void CopyBody(float keepvelocity);
2
3 // changes by LordHavoc on 03/30/04
4 // cleaned up dummy code
5 // dummies are now removed eventually after being gibbed (norespawn = TRUE)
6 // dummy impulse now checks sv_cheats to prevent players from overwhelming server with dummies
7 // dummies now use player code where possible
8
9 void player_anim (void);
10 void DummyThink(void)
11 {
12         self.think = DummyThink;
13         self.nextthink = time;
14         SV_PlayerPhysics();
15         PlayerPreThink();
16         //player_anim();
17         PlayerPostThink();
18 }
19
20 // from dpmod
21 void(entity e, vector v) printsurfaceinfo =
22 {
23         local float surfnum, numpoints, vnum;
24         local string s;
25         local vector n;
26         surfnum = getsurfacenearpoint(e, v);
27         if (surfnum >= 0)
28         {
29                 sprint(self, "texture: ");
30                 s = getsurfacetexture(e, surfnum);
31                 sprint(self, s);
32                 sprint(self, " normal: ");
33                 n = getsurfacenormal(e, surfnum);
34                 sprint(self, vtos(n));
35                 sprint(self, " ");
36                 numpoints = getsurfacenumpoints(e, surfnum);
37                 sprint(self, ftos(numpoints));
38                 sprint(self, " verts:");
39                 vnum = 0;
40                 while (vnum < numpoints)
41                 {
42                         sprint(self, " ");
43                         n = getsurfacepoint(e, surfnum, vnum);
44                         sprint(self, vtos(n));
45                         vnum = vnum + 1;
46                 }
47                 sprint(self, " point tested: ");
48                 sprint(self, vtos(v));
49                 sprint(self, " nearest point on surface: ");
50                 n = getsurfaceclippedpoint(e, surfnum, v);
51                 sprint(self, vtos(n));
52                 sprint(self, "\n");
53         }
54 };
55
56 void ImpulseCommands (void)
57 {
58         local float imp;
59         imp = self.impulse;
60         if (!imp || gameover)
61                 return;
62         self.impulse = 0;
63         if (imp >= 1 && imp <= 12)
64         {
65                 // weapon switching impulses
66                 if (imp <= 9)
67                         W_SwitchWeapon (imp);
68                 else if (imp == 10)
69                         W_NextWeapon ();
70                 else if (imp == 12)
71                         W_PreviousWeapon ();
72                 else if (imp == 11) // last weapon
73                         W_SwitchWeapon (self.cnt);
74         }
75         else if (imp >= 13 && imp <= 16)
76         {
77                 if (cvar("sv_cheats"))
78                 {
79                         if (imp == 13)
80                         {
81                                 makevectors (self.v_angle);
82                                 self.velocity = self.velocity + v_forward * 300;
83                                 CopyBody(1);
84                                 self.velocity = self.velocity - v_forward * 300;
85                         }
86                         else if (imp == 14)
87                                 CopyBody(0);
88                         else if (imp == 15)
89                         {
90                                 sprint(self, strcat("origin = ", vtos(self.origin), "\n"));
91                                 sprint(self, strcat("angles = ", vtos(self.angles), "\n"));
92                         }
93                         else if (imp == 16)
94                         {
95                                 float i;
96                                 string s;
97                                 i=1;
98                                 while(i <= 10)
99                                 {
100                                         s = ftos(i);
101                                         sprint(self, strcat(s, ": ^", s, "color\n"));
102                                         i = i + 1;
103                                 }
104                                 sprint(self, strcat("origin = ", vtos(self.origin), "\n"));
105                         }
106                 }
107         }
108         // throw weapon
109         else if (imp == 17)
110         {
111                 if (self.weapon != WEP_LASER
112                         && !cvar("g_minstagib") && !cvar("g_instagib")
113                         && !cvar("g_rocketarena") && !cvar("g_lms") && cvar("g_pickup_items"))
114                         W_ThrowWeapon();
115         }
116         else if(imp == 19)
117         {
118                 if (cvar("sv_cheats"))
119                 {
120                         makevectors(self.v_angle);
121                         traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 4096, FALSE, self);
122                         if (trace_fraction < 1)
123                                 printsurfaceinfo(trace_ent, trace_endpos);
124                 }
125         }
126         else if (imp == 99)
127         {
128                 if (cvar("sv_cheats"))
129                 {
130                         self.items = IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER;
131                         self.ammo_shells = 999;
132                         self.ammo_nails = 999;
133                         self.ammo_rockets = 999;
134                         self.ammo_cells = 999;
135                 }
136         }
137         //TetrisImpulses();
138 }