1 #include "g_local.h"
2 /*
3 ==================
4 Painberry's Commands
5 
6 ==================
7 */
8 //PainBerry
Cmd_Leg_f(edict_t * ent)9 void Cmd_Leg_f (edict_t *ent)
10 {
11 	Decide_attack (ent);
12 }
13 
Cmd_Jump_f(edict_t * ent)14 void Cmd_Jump_f (edict_t *ent)
15 {
16 	if (ent->groundentity)
17 	{
18 		if (ent->waterlevel == 0)
19 			ent->velocity[2] += 375;
20 		if (ent->waterlevel == 1)
21 			ent->velocity[2] += 200;
22 		if (ent->waterlevel == 2)
23 			ent->velocity[2] += 150;
24 		if (ent->waterlevel == 3)
25 			ent->velocity[2] += 100;
26 	}
27 }
28 
29 
Cmd_BuyHealth_f(edict_t * ent)30 void Cmd_BuyHealth_f (edict_t *ent)
31 {
32 	if(ent->client->ps.stats[STAT_SPECTATOR])
33 	{
34 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
35 		return;
36 	}
37 	if (ent->healthlevel + ent->staminalevel + ent->damagelevel >= sv_maxlevel->value)
38 	{
39 		gi.cprintf (ent, PRINT_HIGH, "You have maximum upgrade levels\n");
40 		return;
41 	}
42 	if (ent->stamina < 150)
43 	{
44 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
45 		return;
46 	}
47 
48 	ent->stamina -= 150;
49 	if(ent->damagelevel + ent->staminalevel + ent->healthlevel < sv_maxlevel->value)
50 	ent->health = ent->client->pers.max_health + 50;//full health so that you can SEE you have higher health.
51 													//but only if u upgrade
52 	ent->healthlevel++;
53 
54 	gi.bprintf (PRINT_HIGH, "%s upgraded\n", ent->client->pers.netname);
55 	gi.WriteByte (svc_temp_entity);
56 	gi.WriteByte (TE_NUKEBLAST);
57 	gi.WritePosition (ent->s.origin);
58 	gi.multicast (ent->s.origin, MULTICAST_ALL);
59 
60 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
61 
62 }
63 
Cmd_BuyStamina_f(edict_t * ent)64 void Cmd_BuyStamina_f (edict_t *ent)
65 {
66 	if(ent->client->ps.stats[STAT_SPECTATOR])
67 	{
68 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
69 		return;
70 	}
71 	if (ent->stamina < 150)
72 	{
73 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
74 		return;
75 	}
76 	if (ent->healthlevel + ent->staminalevel + ent->damagelevel >= sv_maxlevel->value)
77 	{
78 		gi.cprintf (ent, PRINT_HIGH, "You have maximum upgrade levels\n");
79 		return;
80 	}
81 
82 	ent->stamina -= 150;//50;
83 	ent->staminalevel++;
84 	gi.bprintf (PRINT_HIGH, "%s upgraded\n", ent->client->pers.netname);
85 	gi.WriteByte (svc_temp_entity);
86 	gi.WriteByte (TE_NUKEBLAST);
87 	gi.WritePosition (ent->s.origin);
88 	gi.multicast (ent->s.origin, MULTICAST_ALL);
89 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
90 }
91 
Cmd_BuyDamage_f(edict_t * ent)92 void Cmd_BuyDamage_f (edict_t *ent)
93 {
94 	if(ent->client->ps.stats[STAT_SPECTATOR])
95 	{
96 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
97 		return;
98 	}
99 	if (ent->stamina < 150)
100 	{
101 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
102 		return;
103 	}
104 	if ( ent->healthlevel + ent->staminalevel + ent->damagelevel >= sv_maxlevel->value)
105 	{
106 		gi.cprintf (ent, PRINT_HIGH, "You have maximum upgrade levels\n");
107 		return;
108 	}
109 
110 	ent->stamina -= 150;
111 	ent->damagelevel++;
112 	gi.bprintf (PRINT_HIGH, "%s upgraded\n", ent->client->pers.netname);
113 	gi.WriteByte (svc_temp_entity);
114 	gi.WriteByte (TE_NUKEBLAST);
115 	gi.WritePosition (ent->s.origin);
116 	gi.multicast (ent->s.origin, MULTICAST_ALL);
117 
118 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
119 
120 }
121 
Cmd_BuySpeed_f(edict_t * ent)122 void Cmd_BuySpeed_f (edict_t *ent)		//this is now a spell. i couldn't see much point of it being a level.
123 {
124 	if(ent->client->ps.stats[STAT_SPECTATOR])
125 	{
126 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
127 		return;
128 	}
129 	if(strcmp(ent->client->pers.weapon->classname, "weapon_knives") == 0 ||
130 		strcmp(ent->client->pers.weapon->classname, "weapon_fists") == 0)
131 	{
132 	if (ent->client->speed_framenum > level.framenum - 100)
133 	{
134 		gi.cprintf (ent, PRINT_HIGH, "You can't buy until recharge is complete:%f seconds\n", (ent->client->speed_framenum - level.framenum + 100)/10);
135 		return;
136 	}
137 	if (SpellFull(ent))
138 	{
139 		gi.cprintf (ent, PRINT_HIGH, "You can only have 2 spells at a time\n");
140 		return;
141 	}
142 	if ( ent->stamina < 100)
143 	{
144 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
145 		return;
146 	}
147 
148 	ent->stamina -= 100;
149 	gi.bprintf (PRINT_HIGH, "%s goes into REDICULOUS SPEEEED (TM)\n", ent->client->pers.netname);
150 	if (ent->client->speed_framenum > level.framenum)
151 		ent->client->speed_framenum += 150;
152 	else
153 		ent->client->speed_framenum = level.framenum + 150;
154 
155 	if(ent->client->speed_framenum - level.framenum > 150)
156 		ent->client->speed_framenum = level.framenum + 150;
157 
158 	gi.sound (ent, CHAN_VOICE, gi.soundindex ("thingon.wav"), 1, ATTN_NORM, 0);
159 	//gi.sound (ent, CHAN_VOICE, gi.soundindex ("thingoff.wav"), 1, ATTN_NORM, 0);
160 
161 	MatrixSpeed(ent);
162 	}
163 	else
164 		gi.cprintf (ent, PRINT_HIGH, "You can't buy speed while using guns.\n", (ent->client->speed_framenum - level.framenum + 100)/10);
165 
166 }
167 
Cmd_Infrared_f(edict_t * ent)168 void Cmd_Infrared_f (edict_t *ent) // PSY: IR Goggles
169 {
170 	if(ent->client->ps.stats[STAT_SPECTATOR])
171 	{
172 		gi.cprintf (ent, PRINT_HIGH, "Infra red is the only spell available in spectator mode.\n");
173 	}
174 	if (ent->client->ir_framenum > level.framenum - 100)
175 	{
176 		gi.cprintf (ent, PRINT_HIGH, "You can't buy until recharge is complete:%f seconds\n", (ent->client->speed_framenum - level.framenum + 100)/10);
177 		return;
178 	}
179 	if (ent->stamina < 75)
180 	{
181 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
182 		return;
183 	}
184 	if (SpellFull(ent))
185 	{
186 		gi.cprintf (ent, PRINT_HIGH, "You can only have 2 spells at a time\n");
187 		return;
188 	}
189 	if (ent->client->ir_framenum > level.framenum)
190 		ent->client->ir_framenum += 600;
191 	else
192 		ent->client->ir_framenum = level.framenum + 600;
193 
194 
195 	ent->stamina -= 75;
196 
197 	gi.bprintf (PRINT_HIGH, "%s has nightvision\n", ent->client->pers.netname);
198 	gi.sound(ent, CHAN_ITEM, gi.soundindex("ir_on.wav"), 1, ATTN_NORM, 0);
199 		ent->client->goggles = 1;
200 		ent->client->ps.rdflags |= RDF_IRGOGGLES;
201 
202 
203 }
204 
Cmd_Cloak_f(edict_t * ent)205 void Cmd_Cloak_f (edict_t *ent)
206 {
207 	if(ent->client->ps.stats[STAT_SPECTATOR])
208 	{
209 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
210 		return;
211 	}
212 	if (ent->client->cloak_framenum > level.framenum - 100)
213 	{
214 		gi.cprintf (ent, PRINT_HIGH, "You can't buy until recharge is complete:%f seconds\n", (ent->client->speed_framenum - level.framenum + 100)/10);
215 		return;
216 	}
217 	if (SpellFull(ent))
218 	{
219 		gi.cprintf (ent, PRINT_HIGH, "You can only have 2 spells at a time\n");
220 		return;
221 	}
222 	if (ent->stamina < 100)
223 	{
224 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
225 		return;
226 	}
227 
228 	if (ent->client->cloak_framenum > level.framenum + 100)
229 		ent->client->cloak_framenum += 600;
230 	else
231 		ent->client->cloak_framenum = level.framenum + 600;
232 
233 	ent->stamina -= 100;
234 
235 	gi.bprintf (PRINT_HIGH, "%s's body becomes translucent.\n", ent->client->pers.netname);
236 	gi.WriteByte (svc_temp_entity);
237 	gi.WriteByte (TE_BOSSTPORT);
238 	gi.WritePosition (ent->s.origin);
239 	gi.multicast (ent->s.origin, MULTICAST_ALL);
240 	ent->s.modelindex2 = 0;
241 	gi.sound(ent, CHAN_ITEM, gi.soundindex("cloak.wav"), 1, ATTN_NORM, 0);
242 }
243 
244 /*
245 ===================
246 Fear's Commands
247 ===================
248 *//*
249 void Cmd_JoinTeam_f (edict_t *ent)
250 {
251 	char *s = gi.argv(1);
252 
253 	if (!teamplay->value)
254 	{
255 		JoinTeam(ent, TEAM_FREE);
256 		return;
257 	}
258 	if (Q_stricmp(s, redteamname->string)==0)
259 		JoinTeam(ent, TEAM_RED);
260 	else if (Q_stricmp(s, blueteamname->string)==0)
261 		JoinTeam(ent, TEAM_BLUE);
262 	else if ((Q_stricmp(s, "none")==0) || (Q_stricmp(s, "leave")==0))
263 	{
264 		ent->client->resp.spectator = true;
265 		ent->client->resp.team = 0;
266 		spectator_respawn(ent);
267 	}
268 	else
269 		gi.cprintf(ent,PRINT_HIGH, "You are on the %s team\n", TeamName(ent->client->resp.team));
270 
271 }
272 void Cmd_Ready_f (edict_t *ent)
273 {
274 	if (ent->client->resp.ready)
275 		ent->client->resp.ready = false;
276 	else
277 		ent->client->resp.ready = true;
278 	gi.bprintf (PRINT_HIGH, "%s is%sready\n", ent->client->pers.netname, ent->client->resp.ready ? " ":" not ");
279 	MatrixWhosReady();
280 }
281 */
282 
Cmd_StopBullets_f(edict_t * ent)283 void Cmd_StopBullets_f (edict_t *ent)
284 {
285 
286 	if(ent->client->ps.stats[STAT_SPECTATOR])
287 	{
288 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
289 		return;
290 	}
291 	if(strcmp(ent->client->pers.weapon->classname, "weapon_knives") == 0 ||
292 		strcmp(ent->client->pers.weapon->classname, "weapon_fists") == 0)
293 	{
294 
295 
296 
297 	if (ent->bullet_framenum > level.framenum - 100)
298 	{
299 		gi.cprintf (ent, PRINT_HIGH, "You can't buy until recharge is complete:%f seconds\n", (ent->client->speed_framenum - level.framenum + 100)/10);
300 		return;
301 	}
302 	if (SpellFull(ent))
303 	{
304 		gi.cprintf (ent, PRINT_HIGH, "You can only have 2 spells at a time\n");
305 		return;
306 	}
307 	if (ent->stamina < 75)
308 	{
309 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
310 		return;
311 	}
312 	ent->stamina -= 75;
313 
314 	if (ent->bullet_framenum > level.framenum + 100)
315 		ent->bullet_framenum += 300;
316 	else
317 		ent->bullet_framenum = level.framenum + 300;
318 
319 
320 	gi.bprintf (PRINT_HIGH, "%s defends himself from projectiles\n", ent->client->pers.netname);
321 	gi.WriteByte (svc_temp_entity);
322 	gi.WriteByte (TE_NUKEBLAST);
323 	gi.WritePosition (ent->s.origin);
324 	gi.multicast (ent->s.origin, MULTICAST_ALL);
325 	gi.sound (ent, CHAN_VOICE, gi.soundindex ("laugh3.wav"), 1, ATTN_NORM, 0);
326 
327 	}
328 	else
329 		gi.cprintf (ent, PRINT_HIGH, "You can't buy bullet stopping while using guns.\n", (ent->client->speed_framenum - level.framenum + 100)/10);
330 
331 }
332 
333 
Cmd_Lights_f(edict_t * ent)334 void Cmd_Lights_f (edict_t *ent)
335 {
336 	if(ent->client->ps.stats[STAT_SPECTATOR])
337 	{
338 		gi.cprintf (ent, PRINT_HIGH, "You can't buy spells in Spectator Mode\n");
339 		return;
340 	}
341 	if (matrix.lightsout_framenum > level.framenum)
342 	{
343 		gi.cprintf (ent, PRINT_HIGH, "You can't buy until the effect has worn off\n");
344 		return;
345 	}
346 	if (SpellFull(ent))
347 	{
348 		gi.cprintf (ent, PRINT_HIGH, "You can only have 2 spells at a time\n");
349 		return;
350 	}
351 	if (ent->stamina < 200)
352 	{
353 		gi.cprintf (ent, PRINT_HIGH, "You dont have enough energy stored\n");
354 		return;
355 	}
356 	ent->stamina -= 200;
357 
358 	if (matrix.lightsout_framenum > level.framenum)
359 		matrix.lightsout_framenum += 300;
360 	else
361 		matrix.lightsout_framenum = level.framenum + 300;
362 
363 	if(matrix.lightsout_framenum - level.framenum > 300)
364 		matrix.lightsout_framenum = level.framenum + 300;
365 	matrix.triggerent = ent;
366 
367 	matrix.lightsout = true;
368 	gi.bprintf (PRINT_HIGH, "%s explodes an emp device!!\n", ent->client->pers.netname);
369 	gi.WriteByte (svc_temp_entity);
370 	gi.WriteByte (TE_NUKEBLAST);
371 	gi.WritePosition (ent->s.origin);
372 	gi.multicast (ent->s.origin, MULTICAST_ALL);
373 
374 
375 
376 	// 0 normal
377 	gi.configstring(CS_LIGHTS+0, "bbbbaaaaaaaaaabbbbccdccbbbbbaaaaaaaaaaabcbbbaaaaamaaazoie");
378 
379 }
380 
381 
Cmd_ScreenTilt_f(edict_t * ent)382 void Cmd_ScreenTilt_f (edict_t *ent)
383 {
384 	if(ent->screentilt)
385 	{
386 		gi.cprintf (ent, PRINT_HIGH, "Screen tilting off\n");
387 		ent->screentilt = false;
388 	}
389 	else
390 	{
391 		ent->screentilt = true;
392 		gi.cprintf (ent, PRINT_HIGH, "Screen tilting on\n");
393 	}
394 }
395 
396