]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamec/cl_impulse.c
added last weapon impulse (impulse 11)
[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 void ImpulseCommands (void)
21 {
22         local float imp;
23         imp = self.impulse;
24         if (!imp)
25                 return;
26         self.impulse = 0;
27         if (imp >= 1 && imp <= 12)
28         {
29                 // weapon switching impulses
30                 // FIXME: why a g_minstagib check?  doesn't that have only one weapon?
31                 if (!cvar("g_minstagib"))
32                 {
33                         if (imp <= 9)
34                                 W_SwitchWeapon (imp);
35                         else if (imp == 10)
36                                 W_NextWeapon ();
37                         else if (imp == 12)
38                                 W_PreviousWeapon ();
39                         else if (imp == 11) // last weapon
40                                 W_SwitchWeapon (self.cnt);
41                 }
42         }
43         else if (imp >= 13 && imp <= 16)
44         {
45                 if (cvar("sv_cheats"))
46                 {
47                         if (imp == 13)
48                         {
49                                 makevectors (self.v_angle);
50                                 self.velocity = self.velocity + v_forward * 300;
51                                 CopyBody(1);
52                                 self.velocity = self.velocity - v_forward * 300;
53                         }
54                         else if (imp == 14)
55                                 CopyBody(0);
56                         else if (imp == 15)
57                         {
58                                 sprint(self, strcat("origin = ", vtos(self.origin), "\n"));
59                                 sprint(self, strcat("angles = ", vtos(self.angles), "\n"));
60                         }
61                         else if (imp == 16)
62                         {
63                                 float i;
64                                 string s;
65                                 i=1;
66                                 while(i <= 10)
67                                 {
68                                         s = ftos(i);
69                                         sprint(self, strcat(s, ": ^", s, "color\n"));
70                                         i = i + 1;
71                                 }
72                                 sprint(self, strcat("origin = ", vtos(self.origin), "\n"));
73                         }
74                 }
75         }
76         // throw weapon
77         else if (imp == 17)
78         {
79                 if (self.weapon != WEP_LASER
80                         && !cvar("g_minstagib") && !cvar("g_instagib")
81                         && !cvar("g_rocketarena") && !cvar("g_lms") && cvar("g_pickup_items"))
82                         W_ThrowWeapon();
83         }
84         else if(imp == 18)
85                 PrintWelcomeMessage(self);
86         else if (imp == 99)
87         {
88                 if (cvar("sv_cheats"))
89                 {
90                         self.items = IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER;
91                         self.ammo_shells = 999;
92                         self.ammo_nails = 999;
93                         self.ammo_rockets = 999;
94                         self.ammo_cells = 999;
95                 }
96         }
97         //TetrisImpulses();
98 }