]> icculus.org git repositories - divverent/nexuiz.git/blob - TeamNexuiz/game/gamec/cl_impulse.c
Added a Game C folder
[divverent/nexuiz.git] / TeamNexuiz / game / gamec / cl_impulse.c
1 void CopyBody(float keepvelocity);\r
2 \r
3 // changes by LordHavoc on 03/30/04\r
4 // cleaned up dummy code\r
5 // dummies are now removed eventually after being gibbed (norespawn = TRUE)\r
6 // dummy impulse now checks sv_cheats to prevent players from overwhelming server with dummies\r
7 // dummies now use player code where possible\r
8 \r
9 void player_anim (void);\r
10 void DummyThink(void)\r
11 {\r
12         self.think = DummyThink;\r
13         self.nextthink = time;\r
14         SV_PlayerPhysics();\r
15         PlayerPreThink();\r
16         //player_anim();\r
17         PlayerPostThink();\r
18 }\r
19 \r
20 void CopyBody2(float keepvelocity, float testbody);\r
21 void ImpulseCommands (void)\r
22 {\r
23         local float swpn;\r
24 \r
25         if (self.team_no < 1)           // Bring up choose team menu if not on team\r
26         {\r
27                 stuffcmd(self, "menu_showteamselect\n");\r
28 \r
29         }\r
30 \r
31         if (self.impulse == 71)\r
32         {\r
33                 local string whee;\r
34                 whee = ftos (self.maxammo_rockets);\r
35                 sprint(self, whee);\r
36                 sprint(self, "\n");\r
37         }\r
38 \r
39         if (self.impulse == 70) {               // reload impulse\r
40                 swpn = self.weapon;\r
41                         if(self.class == CLASS_SOLDIER)\r
42                         {\r
43                                 if (swpn == WEP4)\r
44                                         DoReload (3, (CLIP_MAX_ROCKETS - self.clip_rockets));   // weapon type 3 is RL, and reload X rockets.\r
45                         }\r
46                         else if(self.class == CLASS_PYRO)\r
47                         {\r
48                                 if (swpn == WEP1)\r
49                                         DoReload (4, (CLIP_MAX_PIPEGRENADES - self.clip_pipegrenades));\r
50                         }\r
51                         else if(self.class == CLASS_SCOUT || self.class == CLASS_ENGINEER)\r
52                         {\r
53                                 if (swpn == WEP4)\r
54                                         DoReload (2, (CLIP_MAX_CRYLINK - self.clip_crylink));\r
55                         }\r
56         }\r
57         if (self.impulse == 69) {\r
58                 local entity isneardoor;\r
59                 local string st;\r
60                 isneardoor = findradius (self.origin, 200);\r
61                 while (isneardoor)\r
62                 {\r
63                         if ((isneardoor.classname == "door"))\r
64                         {\r
65 //                              st = stos(isneardoor.model);\r
66                                 sprint (self, isneardoor.model);\r
67                                 sprint (self, "\n");\r
68                                 dremove(newmis);\r
69                                 return;\r
70                         }\r
71                         isneardoor = isneardoor.chain;\r
72                 }\r
73         }\r
74         if (self.impulse == 8) {\r
75         TeamFortress_ThrowGrenade(); }\r
76         if ((self.impulse == 150))              // GREN TYPE 1\r
77         {\r
78                 TeamFortress_PrimeGrenade();\r
79         }\r
80 /*      if ((self.impulse == 151))              // GREN TYPE 2\r
81         {\r
82                 TeamFortress_PrimeGrenade();\r
83         }*/\r
84         if ((self.impulse == 152))\r
85         {\r
86                 TeamFortress_ThrowGrenade();\r
87         }\r
88 \r
89         if (self.impulse >= 1 && self.impulse <= 5)\r
90         {\r
91                 if(self.buttonuse)\r
92                 {\r
93                         if(self.impulse == 5 && self.wpn5.weapon)\r
94                         {\r
95                                 weapon_action(self.weapon, WR_DROP);\r
96                                 SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.wpn5.weapon);\r
97                                 self.weapon = 0;\r
98                                 ResetExtraWeapon();\r
99                                 self.switchweapon = w_getbestweapon(self);\r
100                                 if(self.switchweapon == WEP5)\r
101                                         self.switchweapon = WEP1;\r
102                         }\r
103                 }\r
104                 else\r
105                         if (self.reload_time < time) { \r
106                                 W_SwitchWeapon (self.impulse); }\r
107         }\r
108         else if (self.impulse == 10)\r
109                 if (self.reload_time < time) { \r
110                         W_NextWeapon (); }\r
111         else if (self.impulse == 12)\r
112                 if (self.reload_time < time) { \r
113                         W_PreviousWeapon (); }\r
114         else if (self.impulse == 13 && cvar("sv_cheats"))\r
115         {\r
116                 makevectors (self.v_angle);\r
117                 self.velocity = self.velocity + v_forward * 300;\r
118                 CopyBody2(1, TRUE);\r
119                 self.velocity = self.velocity - v_forward * 300;\r
120         }\r
121         else if (self.impulse == 14 && cvar("sv_cheats"))\r
122                 CopyBody2(0, TRUE);\r
123         else if (self.impulse == 99 && cvar("sv_cheats"))\r
124         {\r
125                 self.items = IT_WEP1 | IT_WEP2 | IT_WEP3 | IT_WEP4 | IT_WEP5;\r
126                 self.ammo_shells = 999;\r
127                 self.ammo_nails = 999;\r
128                 self.ammo_rockets = 999;\r
129                 self.ammo_cells = 999;\r
130         }\r
131 \r
132         if(self.impulse == 20)\r
133         {\r
134                 ClassSpecial();\r
135         }\r
136 \r
137         if(self.impulse == 30)\r
138         {\r
139                 ClassGrenade(WR_GRENADE1);\r
140         }\r
141         if(self.impulse == 31)\r
142         {\r
143                 ClassGrenade(WR_GRENADE2);\r
144         }\r
145 \r
146         // model/class test\r
147         if(self.impulse == 57)\r
148         {\r
149                 //self.class = GetPlayerClass();\r
150                 sprint(self, "Current class: ");\r
151                 sprint(self, NameOfClass(self.class));\r
152                 sprint(self, ", model: ");\r
153                 sprint(self, self.playermodel);\r
154                 sprint(self, "\n");\r
155         }\r
156         if(self.impulse == 211)         // XavioR test impulse\r
157         {\r
158                 local string woottest;\r
159                 woottest = ftos(self.team_no);\r
160                 sprint (self, woottest);\r
161                 sprint (self, "\n");\r
162         }\r
163         //TetrisImpulses();\r
164         self.impulse = 0;\r
165 }