1 #include "g_local.h"
2 
3 
4 qboolean	Pickup_Weapon (edict_t *ent, edict_t *other);
5 void		Use_Weapon (edict_t *ent, gitem_t *inv);
6 void		Use_Weapon2 (edict_t *ent, gitem_t *inv);
7 void		Drop_Weapon (edict_t *ent, gitem_t *inv);
8 
9 void Weapon_Blaster (edict_t *ent);
10 void Weapon_Shotgun (edict_t *ent);
11 void Weapon_SuperShotgun (edict_t *ent);
12 void Weapon_Machinegun (edict_t *ent);
13 void Weapon_Chaingun (edict_t *ent);
14 void Weapon_HyperBlaster (edict_t *ent);
15 void Weapon_RocketLauncher (edict_t *ent);
16 void Weapon_Grenade (edict_t *ent);
17 void Weapon_GrenadeLauncher (edict_t *ent);
18 void Weapon_Railgun (edict_t *ent);
19 void Weapon_BFG (edict_t *ent);
20 // RAFAEL
21 void Weapon_Ionripper (edict_t *ent);
22 void Weapon_Phalanx (edict_t *ent);
23 void Weapon_Trap (edict_t *ent);
24 
25 gitem_armor_t jacketarmor_info	= { 25,  50, .30, .00, ARMOR_JACKET};
26 gitem_armor_t combatarmor_info	= { 50, 100, .60, .30, ARMOR_COMBAT};
27 gitem_armor_t bodyarmor_info	= {100, 200, .80, .60, ARMOR_BODY};
28 
29 int	jacket_armor_index;
30 int	combat_armor_index;
31 int	body_armor_index;
32 static int	power_screen_index;
33 static int	power_shield_index;
34 
35 #define HEALTH_IGNORE_MAX	1
36 #define HEALTH_TIMED		2
37 
38 void Use_Quad (edict_t *ent, gitem_t *item);
39 // RAFAEL
40 void Use_QuadFire (edict_t *ent, gitem_t *item);
41 
42 static int	quad_drop_timeout_hack;
43 // RAFAEL
44 static int	quad_fire_drop_timeout_hack;
45 
46 //======================================================================
47 
48 /*
49 ===============
50 GetItemByIndex
51 ===============
52 */
GetItemByIndex(int index)53 gitem_t	*GetItemByIndex (int index)
54 {
55 	if (index == 0 || index >= game.num_items)
56 		return NULL;
57 
58 	return &itemlist[index];
59 }
60 
61 
62 /*
63 ===============
64 FindItemByClassname
65 
66 ===============
67 */
FindItemByClassname(char * classname)68 gitem_t	*FindItemByClassname (char *classname)
69 {
70 	int		i;
71 	gitem_t	*it;
72 
73 	it = itemlist;
74 	for (i=0 ; i<game.num_items ; i++, it++)
75 	{
76 		if (!it->classname)
77 			continue;
78 		if (!Q_stricmp(it->classname, classname))
79 			return it;
80 	}
81 
82 	return NULL;
83 }
84 
85 /*
86 ===============
87 FindItem
88 
89 ===============
90 */
FindItem(char * pickup_name)91 gitem_t	*FindItem (char *pickup_name)
92 {
93 	int		i;
94 	gitem_t	*it;
95 
96 	it = itemlist;
97 	for (i=0 ; i<game.num_items ; i++, it++)
98 	{
99 		if (!it->pickup_name)
100 			continue;
101 		if (!Q_stricmp(it->pickup_name, pickup_name))
102 			return it;
103 	}
104 
105 	return NULL;
106 }
107 
108 //======================================================================
109 
DoRespawn(edict_t * ent)110 void DoRespawn (edict_t *ent)
111 {
112 	if (ent->team)
113 	{
114 		edict_t	*master;
115 		int	count;
116 		int choice;
117 
118 		master = ent->teammaster;
119 
120 		for (count = 0, ent = master; ent; ent = ent->chain, count++)
121 			;
122 
123 		choice = rand() % count;
124 
125 		for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
126 			;
127 	}
128 
129 	ent->svflags &= ~SVF_NOCLIENT;
130 	ent->solid = SOLID_TRIGGER;
131 	gi.linkentity (ent);
132 
133 	// send an effect
134 	ent->s.event = EV_ITEM_RESPAWN;
135 }
136 
SetRespawn(edict_t * ent,float delay)137 void SetRespawn (edict_t *ent, float delay)
138 {
139 	ent->flags |= FL_RESPAWN;
140 	ent->svflags |= SVF_NOCLIENT;
141 	ent->solid = SOLID_NOT;
142 	ent->nextthink = level.time + delay;
143 	ent->think = DoRespawn;
144 	gi.linkentity (ent);
145 }
146 
147 
148 //======================================================================
149 
Pickup_Powerup(edict_t * ent,edict_t * other)150 qboolean Pickup_Powerup (edict_t *ent, edict_t *other)
151 {
152 	int		quantity;
153 
154 	quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
155 	if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
156 		return false;
157 
158 	if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
159 		return false;
160 
161 	other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
162 
163 	if (deathmatch->value)
164 	{
165 		if (!(ent->spawnflags & DROPPED_ITEM) )
166 			SetRespawn (ent, ent->item->quantity);
167 		if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
168 		{
169 			if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
170 				quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
171 			ent->item->use (other, ent->item);
172 		}
173 		// RAFAEL
174 		else if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_QuadFire) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
175 		{
176 			if ((ent->item->use == Use_QuadFire) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
177 				quad_fire_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
178 			ent->item->use (other, ent->item);
179 		}
180 	}
181 
182 	return true;
183 }
184 
Drop_General(edict_t * ent,gitem_t * item)185 void Drop_General (edict_t *ent, gitem_t *item)
186 {
187 	Drop_Item (ent, item);
188 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
189 	ValidateSelectedItem (ent);
190 }
191 
192 
193 //======================================================================
194 
Pickup_Adrenaline(edict_t * ent,edict_t * other)195 qboolean Pickup_Adrenaline (edict_t *ent, edict_t *other)
196 {
197 	if (!deathmatch->value)
198 		other->max_health += 1;
199 
200 	if (other->health < other->max_health)
201 		other->health = other->max_health;
202 
203 	if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
204 		SetRespawn (ent, ent->item->quantity);
205 
206 	return true;
207 }
208 
Pickup_AncientHead(edict_t * ent,edict_t * other)209 qboolean Pickup_AncientHead (edict_t *ent, edict_t *other)
210 {
211 	other->max_health += 2;
212 
213 	if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
214 		SetRespawn (ent, ent->item->quantity);
215 
216 	return true;
217 }
218 
Pickup_Bandolier(edict_t * ent,edict_t * other)219 qboolean Pickup_Bandolier (edict_t *ent, edict_t *other)
220 {
221 	gitem_t	*item;
222 	int		index;
223 
224 	if (other->client->pers.max_bullets < 250)
225 		other->client->pers.max_bullets = 250;
226 	if (other->client->pers.max_shells < 150)
227 		other->client->pers.max_shells = 150;
228 	if (other->client->pers.max_cells < 250)
229 		other->client->pers.max_cells = 250;
230 	if (other->client->pers.max_slugs < 75)
231 		other->client->pers.max_slugs = 75;
232 	// RAFAEL
233 	if (other->client->pers.max_magslug < 75)
234 		other->client->pers.max_magslug = 75;
235 
236 	item = FindItem("Bullets");
237 	if (item)
238 	{
239 		index = ITEM_INDEX(item);
240 		other->client->pers.inventory[index] += item->quantity;
241 		if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
242 			other->client->pers.inventory[index] = other->client->pers.max_bullets;
243 	}
244 
245 	item = FindItem("Shells");
246 	if (item)
247 	{
248 		index = ITEM_INDEX(item);
249 		other->client->pers.inventory[index] += item->quantity;
250 		if (other->client->pers.inventory[index] > other->client->pers.max_shells)
251 			other->client->pers.inventory[index] = other->client->pers.max_shells;
252 	}
253 
254 	if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
255 		SetRespawn (ent, ent->item->quantity);
256 
257 	return true;
258 }
259 
Pickup_Pack(edict_t * ent,edict_t * other)260 qboolean Pickup_Pack (edict_t *ent, edict_t *other)
261 {
262 	gitem_t	*item;
263 	int		index;
264 
265 	if (other->client->pers.max_bullets < 300)
266 		other->client->pers.max_bullets = 300;
267 	if (other->client->pers.max_shells < 200)
268 		other->client->pers.max_shells = 200;
269 	if (other->client->pers.max_rockets < 100)
270 		other->client->pers.max_rockets = 100;
271 	if (other->client->pers.max_grenades < 100)
272 		other->client->pers.max_grenades = 100;
273 	if (other->client->pers.max_cells < 300)
274 		other->client->pers.max_cells = 300;
275 	if (other->client->pers.max_slugs < 100)
276 		other->client->pers.max_slugs = 100;
277 	// RAFAEL
278 	if (other->client->pers.max_magslug < 100)
279 		other->client->pers.max_magslug = 100;
280 
281 	item = FindItem("Bullets");
282 	if (item)
283 	{
284 		index = ITEM_INDEX(item);
285 		other->client->pers.inventory[index] += item->quantity;
286 		if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
287 			other->client->pers.inventory[index] = other->client->pers.max_bullets;
288 	}
289 
290 	item = FindItem("Shells");
291 	if (item)
292 	{
293 		index = ITEM_INDEX(item);
294 		other->client->pers.inventory[index] += item->quantity;
295 		if (other->client->pers.inventory[index] > other->client->pers.max_shells)
296 			other->client->pers.inventory[index] = other->client->pers.max_shells;
297 	}
298 
299 	item = FindItem("Cells");
300 	if (item)
301 	{
302 		index = ITEM_INDEX(item);
303 		other->client->pers.inventory[index] += item->quantity;
304 		if (other->client->pers.inventory[index] > other->client->pers.max_cells)
305 			other->client->pers.inventory[index] = other->client->pers.max_cells;
306 	}
307 
308 	item = FindItem("Grenades");
309 	if (item)
310 	{
311 		index = ITEM_INDEX(item);
312 		other->client->pers.inventory[index] += item->quantity;
313 		if (other->client->pers.inventory[index] > other->client->pers.max_grenades)
314 			other->client->pers.inventory[index] = other->client->pers.max_grenades;
315 	}
316 
317 	item = FindItem("Rockets");
318 	if (item)
319 	{
320 		index = ITEM_INDEX(item);
321 		other->client->pers.inventory[index] += item->quantity;
322 		if (other->client->pers.inventory[index] > other->client->pers.max_rockets)
323 			other->client->pers.inventory[index] = other->client->pers.max_rockets;
324 	}
325 
326 	item = FindItem("Slugs");
327 	if (item)
328 	{
329 		index = ITEM_INDEX(item);
330 		other->client->pers.inventory[index] += item->quantity;
331 		if (other->client->pers.inventory[index] > other->client->pers.max_slugs)
332 			other->client->pers.inventory[index] = other->client->pers.max_slugs;
333 	}
334 
335 	// RAFAEL
336 	item = FindItem ("Mag Slug");
337 	if (item)
338 	{
339 		index = ITEM_INDEX(item);
340 		other->client->pers.inventory[index] += item->quantity;
341 		if (other->client->pers.inventory[index] > other->client->pers.max_magslug)
342 			other->client->pers.inventory[index] = other->client->pers.max_magslug;
343 	}
344 
345 	if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
346 		SetRespawn (ent, ent->item->quantity);
347 
348 	return true;
349 }
350 
351 //======================================================================
352 
Use_Quad(edict_t * ent,gitem_t * item)353 void Use_Quad (edict_t *ent, gitem_t *item)
354 {
355 	int		timeout;
356 
357 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
358 	ValidateSelectedItem (ent);
359 
360 	if (quad_drop_timeout_hack)
361 	{
362 		timeout = quad_drop_timeout_hack;
363 		quad_drop_timeout_hack = 0;
364 	}
365 	else
366 	{
367 		timeout = 300;
368 	}
369 
370 	if (ent->client->quad_framenum > level.framenum)
371 		ent->client->quad_framenum += timeout;
372 	else
373 		ent->client->quad_framenum = level.framenum + timeout;
374 
375 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
376 }
377 
378 
379 // =====================================================================
380 
381 // RAFAEL
Use_QuadFire(edict_t * ent,gitem_t * item)382 void Use_QuadFire (edict_t *ent, gitem_t *item)
383 {
384 	int		timeout;
385 
386 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
387 	ValidateSelectedItem (ent);
388 
389 	if (quad_fire_drop_timeout_hack)
390 	{
391 		timeout = quad_fire_drop_timeout_hack;
392 		quad_fire_drop_timeout_hack = 0;
393 	}
394 	else
395 	{
396 		timeout = 300;
397 	}
398 
399 	if (ent->client->quadfire_framenum > level.framenum)
400 		ent->client->quadfire_framenum += timeout;
401 	else
402 		ent->client->quadfire_framenum = level.framenum + timeout;
403 
404 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire1.wav"), 1, ATTN_NORM, 0);
405 }
406 
407 
408 //======================================================================
409 
Use_Breather(edict_t * ent,gitem_t * item)410 void Use_Breather (edict_t *ent, gitem_t *item)
411 {
412 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
413 	ValidateSelectedItem (ent);
414 
415 	if (ent->client->breather_framenum > level.framenum)
416 		ent->client->breather_framenum += 300;
417 	else
418 		ent->client->breather_framenum = level.framenum + 300;
419 
420 //	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
421 }
422 
423 //======================================================================
424 
Use_Envirosuit(edict_t * ent,gitem_t * item)425 void Use_Envirosuit (edict_t *ent, gitem_t *item)
426 {
427 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
428 	ValidateSelectedItem (ent);
429 
430 	if (ent->client->enviro_framenum > level.framenum)
431 		ent->client->enviro_framenum += 300;
432 	else
433 		ent->client->enviro_framenum = level.framenum + 300;
434 
435 //	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
436 }
437 
438 //======================================================================
439 
Use_Invulnerability(edict_t * ent,gitem_t * item)440 void	Use_Invulnerability (edict_t *ent, gitem_t *item)
441 {
442 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
443 	ValidateSelectedItem (ent);
444 
445 	if (ent->client->invincible_framenum > level.framenum)
446 		ent->client->invincible_framenum += 300;
447 	else
448 		ent->client->invincible_framenum = level.framenum + 300;
449 
450 	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
451 }
452 
453 //======================================================================
454 
Use_Silencer(edict_t * ent,gitem_t * item)455 void	Use_Silencer (edict_t *ent, gitem_t *item)
456 {
457 	ent->client->pers.inventory[ITEM_INDEX(item)]--;
458 	ValidateSelectedItem (ent);
459 	ent->client->silencer_shots += 30;
460 
461 //	gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
462 }
463 
464 //======================================================================
465 
Pickup_Key(edict_t * ent,edict_t * other)466 qboolean Pickup_Key (edict_t *ent, edict_t *other)
467 {
468 	if (coop->value)
469 	{
470 		if (strcmp(ent->classname, "key_power_cube") == 0)
471 		{
472 			if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
473 				return false;
474 			other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
475 			other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
476 		}
477 		else
478 		{
479 			if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
480 				return false;
481 			other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
482 		}
483 		return true;
484 	}
485 	other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
486 	return true;
487 }
488 
489 //======================================================================
490 
Add_Ammo(edict_t * ent,gitem_t * item,int count)491 qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count)
492 {
493 	int			index;
494 	int			max;
495 
496 	if (!ent->client)
497 		return false;
498 
499 	if (item->tag == AMMO_BULLETS)
500 		max = ent->client->pers.max_bullets;
501 	else if (item->tag == AMMO_SHELLS)
502 		max = ent->client->pers.max_shells;
503 	else if (item->tag == AMMO_ROCKETS)
504 		max = ent->client->pers.max_rockets;
505 	else if (item->tag == AMMO_GRENADES)
506 		max = ent->client->pers.max_grenades;
507 	else if (item->tag == AMMO_CELLS)
508 		max = ent->client->pers.max_cells;
509 	else if (item->tag == AMMO_SLUGS)
510 		max = ent->client->pers.max_slugs;
511 	// RAFAEL
512 	else if (item->tag == AMMO_MAGSLUG)
513 		max = ent->client->pers.max_magslug;
514 	// RAFAEL
515 	else if (item->tag == AMMO_TRAP)
516 		max = ent->client->pers.max_trap;
517 	else
518 		return false;
519 
520 	index = ITEM_INDEX(item);
521 
522 	if (ent->client->pers.inventory[index] == max)
523 		return false;
524 
525 	ent->client->pers.inventory[index] += count;
526 
527 	if (ent->client->pers.inventory[index] > max)
528 		ent->client->pers.inventory[index] = max;
529 
530 	return true;
531 }
532 
Pickup_Ammo(edict_t * ent,edict_t * other)533 qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
534 {
535 	int			oldcount;
536 	int			count;
537 	qboolean	weapon;
538 
539 	weapon = (ent->item->flags & IT_WEAPON);
540 	if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
541 		count = 1000;
542 	else if (ent->count)
543 		count = ent->count;
544 	else
545 		count = ent->item->quantity;
546 
547 	oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
548 
549 	if (!Add_Ammo (other, ent->item, count))
550 		return false;
551 
552 	if (weapon && !oldcount)
553 	{
554 		if (other->client->pers.weapon != ent->item && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
555 			other->client->newweapon = ent->item;
556 	}
557 
558 	if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
559 		SetRespawn (ent, 30);
560 	return true;
561 }
562 
Drop_Ammo(edict_t * ent,gitem_t * item)563 void Drop_Ammo (edict_t *ent, gitem_t *item)
564 {
565 	edict_t	*dropped;
566 	int		index;
567 
568 	index = ITEM_INDEX(item);
569 	dropped = Drop_Item (ent, item);
570 	if (ent->client->pers.inventory[index] >= item->quantity)
571 		dropped->count = item->quantity;
572 	else
573 		dropped->count = ent->client->pers.inventory[index];
574 
575 	if (ent->client->pers.weapon &&
576 		ent->client->pers.weapon->tag == AMMO_GRENADES &&
577 		item->tag == AMMO_GRENADES &&
578 		ent->client->pers.inventory[index] - dropped->count <= 0) {
579 #ifdef WITH_ACEBOT
580 		safe_cprintf
581 #else
582 		gi.cprintf
583 #endif
584 		 (ent, PRINT_HIGH, "Can't drop current weapon\n");
585 		G_FreeEdict(dropped);
586 		return;
587 	}
588 
589 	ent->client->pers.inventory[index] -= dropped->count;
590 	ValidateSelectedItem (ent);
591 }
592 
593 
594 //======================================================================
595 
MegaHealth_think(edict_t * self)596 void MegaHealth_think (edict_t *self)
597 {
598 	if (self->owner->health > self->owner->max_health)
599 	{
600 		self->nextthink = level.time + 1;
601 		self->owner->health -= 1;
602 		return;
603 	}
604 
605 	if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
606 		SetRespawn (self, 20);
607 	else
608 		G_FreeEdict (self);
609 }
610 
Pickup_Health(edict_t * ent,edict_t * other)611 qboolean Pickup_Health (edict_t *ent, edict_t *other)
612 {
613 	if (!(ent->style & HEALTH_IGNORE_MAX))
614 		if (other->health >= other->max_health)
615 			return false;
616 
617 	other->health += ent->count;
618 
619 	if (!(ent->style & HEALTH_IGNORE_MAX))
620 	{
621 		if (other->health > other->max_health)
622 			other->health = other->max_health;
623 	}
624 
625 	if (ent->style & HEALTH_TIMED)
626 	{
627 		ent->think = MegaHealth_think;
628 		ent->nextthink = level.time + 5;
629 		ent->owner = other;
630 		ent->flags |= FL_RESPAWN;
631 		ent->svflags |= SVF_NOCLIENT;
632 		ent->solid = SOLID_NOT;
633 	}
634 	else
635 	{
636 		if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
637 			SetRespawn (ent, 30);
638 	}
639 
640 	return true;
641 }
642 
643 //======================================================================
644 
ArmorIndex(edict_t * ent)645 int ArmorIndex (edict_t *ent)
646 {
647 	if (!ent->client)
648 		return 0;
649 
650 	if (ent->client->pers.inventory[jacket_armor_index] > 0)
651 		return jacket_armor_index;
652 
653 	if (ent->client->pers.inventory[combat_armor_index] > 0)
654 		return combat_armor_index;
655 
656 	if (ent->client->pers.inventory[body_armor_index] > 0)
657 		return body_armor_index;
658 
659 	return 0;
660 }
661 
Pickup_Armor(edict_t * ent,edict_t * other)662 qboolean Pickup_Armor (edict_t *ent, edict_t *other)
663 {
664 	int				old_armor_index;
665 	gitem_armor_t	*oldinfo;
666 	gitem_armor_t	*newinfo;
667 	int				newcount;
668 	float			salvage;
669 	int				salvagecount;
670 
671 	// get info on new armor
672 	newinfo = (gitem_armor_t *)ent->item->info;
673 
674 	old_armor_index = ArmorIndex (other);
675 
676 	// handle armor shards specially
677 	if (ent->item->tag == ARMOR_SHARD)
678 	{
679 		if (!old_armor_index)
680 			other->client->pers.inventory[jacket_armor_index] = 2;
681 		else
682 			other->client->pers.inventory[old_armor_index] += 2;
683 	}
684 
685 	// if player has no armor, just use it
686 	else if (!old_armor_index)
687 	{
688 		other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count;
689 	}
690 
691 	// use the better armor
692 	else
693 	{
694 		// get info on old armor
695 		if (old_armor_index == jacket_armor_index)
696 			oldinfo = &jacketarmor_info;
697 		else if (old_armor_index == combat_armor_index)
698 			oldinfo = &combatarmor_info;
699 		else // (old_armor_index == body_armor_index)
700 			oldinfo = &bodyarmor_info;
701 
702 		if (newinfo->normal_protection > oldinfo->normal_protection)
703 		{
704 			// calc new armor values
705 			salvage = oldinfo->normal_protection / newinfo->normal_protection;
706 			salvagecount = salvage * other->client->pers.inventory[old_armor_index];
707 			newcount = newinfo->base_count + salvagecount;
708 			if (newcount > newinfo->max_count)
709 				newcount = newinfo->max_count;
710 
711 			// zero count of old armor so it goes away
712 			other->client->pers.inventory[old_armor_index] = 0;
713 
714 			// change armor to new item with computed value
715 			other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount;
716 		}
717 		else
718 		{
719 			// calc new armor values
720 			salvage = newinfo->normal_protection / oldinfo->normal_protection;
721 			salvagecount = salvage * newinfo->base_count;
722 			newcount = other->client->pers.inventory[old_armor_index] + salvagecount;
723 			if (newcount > oldinfo->max_count)
724 				newcount = oldinfo->max_count;
725 
726 			// if we're already maxed out then we don't need the new armor
727 			if (other->client->pers.inventory[old_armor_index] >= newcount)
728 				return false;
729 
730 			// update current armor value
731 			other->client->pers.inventory[old_armor_index] = newcount;
732 		}
733 	}
734 
735 	if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
736 		SetRespawn (ent, 20);
737 
738 	return true;
739 }
740 
741 //======================================================================
742 
PowerArmorType(edict_t * ent)743 int PowerArmorType (edict_t *ent)
744 {
745 	if (!ent->client)
746 		return POWER_ARMOR_NONE;
747 
748 	if (!(ent->flags & FL_POWER_ARMOR))
749 		return POWER_ARMOR_NONE;
750 
751 	if (ent->client->pers.inventory[power_shield_index] > 0)
752 		return POWER_ARMOR_SHIELD;
753 
754 	if (ent->client->pers.inventory[power_screen_index] > 0)
755 		return POWER_ARMOR_SCREEN;
756 
757 	return POWER_ARMOR_NONE;
758 }
759 
Use_PowerArmor(edict_t * ent,gitem_t * item)760 void Use_PowerArmor (edict_t *ent, gitem_t *item)
761 {
762 	int		index;
763 
764 	if (ent->flags & FL_POWER_ARMOR)
765 	{
766 		ent->flags &= ~FL_POWER_ARMOR;
767 		gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
768 	}
769 	else
770 	{
771 		index = ITEM_INDEX(FindItem("cells"));
772 		if (!ent->client->pers.inventory[index])
773 		{
774 #ifdef WITH_ACEBOT
775 		safe_cprintf
776 #else
777 		gi.cprintf
778 #endif
779 			 (ent, PRINT_HIGH, "No cells for power armor.\n");
780 			return;
781 		}
782 		ent->flags |= FL_POWER_ARMOR;
783 		gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
784 	}
785 }
786 
Pickup_PowerArmor(edict_t * ent,edict_t * other)787 qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
788 {
789 	int		quantity;
790 
791 	quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
792 
793 	other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
794 
795 	if (deathmatch->value)
796 	{
797 		if (!(ent->spawnflags & DROPPED_ITEM) )
798 			SetRespawn (ent, ent->item->quantity);
799 		// auto-use for DM only if we didn't already have one
800 		if (!quantity)
801 			ent->item->use (other, ent->item);
802 	}
803 
804 	return true;
805 }
806 
Drop_PowerArmor(edict_t * ent,gitem_t * item)807 void Drop_PowerArmor (edict_t *ent, gitem_t *item)
808 {
809 	if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
810 		Use_PowerArmor (ent, item);
811 	Drop_General (ent, item);
812 }
813 
814 //======================================================================
815 
816 /*
817 ===============
818 Touch_Item
819 ===============
820 */
Touch_Item(edict_t * ent,edict_t * other,cplane_t * plane,csurface_t * surf)821 void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
822 {
823 	qboolean	taken;
824 
825 	if (!other->client)
826 		return;
827 	if (other->health < 1)
828 		return;		// dead people can't pickup
829 	if (!ent->item->pickup)
830 		return;		// not a grabbable item?
831 
832 	taken = ent->item->pickup(ent, other);
833 
834 	if (taken)
835 	{
836 		// flash the screen
837 		other->client->bonus_alpha = 0.25;
838 
839 		// show icon and name on status bar
840 		other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
841 		other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
842 		other->client->pickup_msg_time = level.time + 3.0;
843 
844 		// change selected item
845 		if (ent->item->use)
846 			other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
847 
848 		if (ent->item->pickup == Pickup_Health)
849 		{
850 			if (ent->count == 2)
851 				gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
852 			else if (ent->count == 10)
853 				gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
854 			else if (ent->count == 25)
855 				gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
856 			else // (ent->count == 100)
857 				gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
858 		}
859 		else if (ent->item->pickup_sound)
860 		{
861 			gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
862 		}
863 	}
864 
865 	if (!(ent->spawnflags & ITEM_TARGETS_USED))
866 	{
867 		G_UseTargets (ent, other);
868 		ent->spawnflags |= ITEM_TARGETS_USED;
869 	}
870 
871 	if (!taken)
872 		return;
873 
874 	if (!((coop->value) &&  (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
875 	{
876 		if (ent->flags & FL_RESPAWN)
877 			ent->flags &= ~FL_RESPAWN;
878 		else
879 			G_FreeEdict (ent);
880 	}
881 }
882 
883 //======================================================================
884 
drop_temp_touch(edict_t * ent,edict_t * other,cplane_t * plane,csurface_t * surf)885 static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
886 {
887 	if (other == ent->owner)
888 		return;
889 
890 	Touch_Item (ent, other, plane, surf);
891 }
892 
drop_make_touchable(edict_t * ent)893 static void drop_make_touchable (edict_t *ent)
894 {
895 	ent->touch = Touch_Item;
896 	if (deathmatch->value)
897 	{
898 		ent->nextthink = level.time + 29;
899 		ent->think = G_FreeEdict;
900 	}
901 }
902 
Drop_Item(edict_t * ent,gitem_t * item)903 edict_t *Drop_Item (edict_t *ent, gitem_t *item)
904 {
905 	edict_t	*dropped;
906 	vec3_t	forward, right;
907 	vec3_t	offset;
908 
909 	dropped = G_Spawn();
910 
911 	dropped->classname = item->classname;
912 	dropped->item = item;
913 	dropped->spawnflags = DROPPED_ITEM;
914 	dropped->s.effects = item->world_model_flags;
915 	dropped->s.renderfx = RF_GLOW;
916 	VectorSet (dropped->mins, -15, -15, -15);
917 	VectorSet (dropped->maxs, 15, 15, 15);
918 	gi.setmodel (dropped, dropped->item->world_model);
919 	dropped->solid = SOLID_TRIGGER;
920 	dropped->movetype = MOVETYPE_TOSS;
921 	dropped->touch = drop_temp_touch;
922 	dropped->owner = ent;
923 
924 	if (ent->client)
925 	{
926 		trace_t	trace;
927 
928 		AngleVectors (ent->client->v_angle, forward, right, NULL);
929 		VectorSet(offset, 24, 0, -16);
930 		G_ProjectSource (ent->s.origin, offset, forward, right, dropped->s.origin);
931 		trace = gi.trace (ent->s.origin, dropped->mins, dropped->maxs,
932 			dropped->s.origin, ent, CONTENTS_SOLID);
933 		VectorCopy (trace.endpos, dropped->s.origin);
934 	}
935 	else
936 	{
937 		AngleVectors (ent->s.angles, forward, right, NULL);
938 		VectorCopy (ent->s.origin, dropped->s.origin);
939 	}
940 
941 	VectorScale (forward, 100, dropped->velocity);
942 	dropped->velocity[2] = 300;
943 
944 	dropped->think = drop_make_touchable;
945 	dropped->nextthink = level.time + 1;
946 
947 	gi.linkentity (dropped);
948 
949 	return dropped;
950 }
951 
Use_Item(edict_t * ent,edict_t * other,edict_t * activator)952 void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
953 {
954 	ent->svflags &= ~SVF_NOCLIENT;
955 	ent->use = NULL;
956 
957 	if (ent->spawnflags & ITEM_NO_TOUCH)
958 	{
959 		ent->solid = SOLID_BBOX;
960 		ent->touch = NULL;
961 	}
962 	else
963 	{
964 		ent->solid = SOLID_TRIGGER;
965 		ent->touch = Touch_Item;
966 	}
967 
968 	gi.linkentity (ent);
969 }
970 
971 //======================================================================
972 
973 /*
974 ================
975 droptofloor
976 ================
977 */
droptofloor(edict_t * ent)978 void droptofloor (edict_t *ent)
979 {
980 	trace_t		tr;
981 	vec3_t		dest;
982 	float		*v;
983 
984 	v = tv(-15,-15,-15);
985 	VectorCopy (v, ent->mins);
986 	v = tv(15,15,15);
987 	VectorCopy (v, ent->maxs);
988 
989 	if (ent->model)
990 		gi.setmodel (ent, ent->model);
991 	else
992 		gi.setmodel (ent, ent->item->world_model);
993 	ent->solid = SOLID_TRIGGER;
994 	ent->movetype = MOVETYPE_TOSS;
995 	ent->touch = Touch_Item;
996 
997 	v = tv(0,0,-128);
998 	VectorAdd (ent->s.origin, v, dest);
999 
1000 	tr = gi.trace (ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID);
1001 	if (tr.startsolid)
1002 	{
1003 		// RAFAEL
1004 		if (strcmp (ent->classname, "foodcube") == 0)
1005 		{
1006 			VectorCopy (ent->s.origin, tr.endpos);
1007 			ent->velocity[2] = 0;
1008 		}
1009 		else
1010 		{
1011 			gi.dprintf ("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
1012 			G_FreeEdict (ent);
1013 			return;
1014 		}
1015 	}
1016 
1017 	VectorCopy (tr.endpos, ent->s.origin);
1018 
1019 	if (ent->team)
1020 	{
1021 		ent->flags &= ~FL_TEAMSLAVE;
1022 		ent->chain = ent->teamchain;
1023 		ent->teamchain = NULL;
1024 
1025 		ent->svflags |= SVF_NOCLIENT;
1026 		ent->solid = SOLID_NOT;
1027 		if (ent == ent->teammaster)
1028 		{
1029 			ent->nextthink = level.time + FRAMETIME;
1030 			ent->think = DoRespawn;
1031 		}
1032 	}
1033 
1034 	if (ent->spawnflags & ITEM_NO_TOUCH)
1035 	{
1036 		ent->solid = SOLID_BBOX;
1037 		ent->touch = NULL;
1038 		ent->s.effects &= ~EF_ROTATE;
1039 		ent->s.renderfx &= ~RF_GLOW;
1040 	}
1041 
1042 	if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
1043 	{
1044 		ent->svflags |= SVF_NOCLIENT;
1045 		ent->solid = SOLID_NOT;
1046 		ent->use = Use_Item;
1047 	}
1048 
1049 	gi.linkentity (ent);
1050 }
1051 
1052 
1053 /*
1054 ===============
1055 PrecacheItem
1056 
1057 Precaches all data needed for a given item.
1058 This will be called for each item spawned in a level,
1059 and for each item in each client's inventory.
1060 ===============
1061 */
PrecacheItem(gitem_t * it)1062 void PrecacheItem (gitem_t *it)
1063 {
1064 	char	*s, *start;
1065 	char	data[MAX_QPATH];
1066 	int		len;
1067 	gitem_t	*ammo;
1068 
1069 	if (!it)
1070 		return;
1071 
1072 	if (it->pickup_sound)
1073 		gi.soundindex (it->pickup_sound);
1074 	if (it->world_model)
1075 		gi.modelindex (it->world_model);
1076 	if (it->view_model)
1077 		gi.modelindex (it->view_model);
1078 	if (it->icon)
1079 		gi.imageindex (it->icon);
1080 
1081 	// parse everything for its ammo
1082 	if (it->ammo && it->ammo[0])
1083 	{
1084 		ammo = FindItem (it->ammo);
1085 		if (ammo != it)
1086 			PrecacheItem (ammo);
1087 	}
1088 
1089 	// parse the space seperated precache string for other items
1090 	s = it->precaches;
1091 	if (!s || !s[0])
1092 		return;
1093 
1094 	while (*s)
1095 	{
1096 		start = s;
1097 		while (*s && *s != ' ')
1098 			s++;
1099 
1100 		len = s-start;
1101 		if (len >= MAX_QPATH || len < 5)
1102 			gi.error ("PrecacheItem: %s has bad precache string", it->classname);
1103 		memcpy (data, start, len);
1104 		data[len] = 0;
1105 		if (*s)
1106 			s++;
1107 
1108 		// determine type based on extension
1109 		if (!strcmp(data+len-3, "md2"))
1110 			gi.modelindex (data);
1111 		else if (!strcmp(data+len-3, "sp2"))
1112 			gi.modelindex (data);
1113 		else if (!strcmp(data+len-3, "wav"))
1114 			gi.soundindex (data);
1115 		if (!strcmp(data+len-3, "pcx"))
1116 			gi.imageindex (data);
1117 	}
1118 }
1119 
1120 /*
1121 ============
1122 SpawnItem
1123 
1124 Sets the clipping size and plants the object on the floor.
1125 
1126 Items can't be immediately dropped to floor, because they might
1127 be on an entity that hasn't spawned yet.
1128 ============
1129 */
SpawnItem(edict_t * ent,gitem_t * item)1130 void SpawnItem (edict_t *ent, gitem_t *item)
1131 {
1132 	PrecacheItem (item);
1133 
1134 	if (ent->spawnflags)
1135 	{
1136 		if (strcmp(ent->classname, "key_power_cube") != 0)
1137 		{
1138 			ent->spawnflags = 0;
1139 			gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin));
1140 		}
1141 	}
1142 
1143 	// some items will be prevented in deathmatch
1144 	if (deathmatch->value)
1145 	{
1146 		if ( (int)dmflags->value & DF_NO_ARMOR )
1147 		{
1148 			if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
1149 			{
1150 				G_FreeEdict (ent);
1151 				return;
1152 			}
1153 		}
1154 		if ( (int)dmflags->value & DF_NO_ITEMS )
1155 		{
1156 			if (item->pickup == Pickup_Powerup)
1157 			{
1158 				G_FreeEdict (ent);
1159 				return;
1160 			}
1161 		}
1162 		if ( (int)dmflags->value & DF_NO_HEALTH )
1163 		{
1164 			if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
1165 			{
1166 				G_FreeEdict (ent);
1167 				return;
1168 			}
1169 		}
1170 		if ( (int)dmflags->value & DF_INFINITE_AMMO )
1171 		{
1172 			if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
1173 			{
1174 				G_FreeEdict (ent);
1175 				return;
1176 			}
1177 		}
1178 	}
1179 
1180 	if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
1181 	{
1182 		ent->spawnflags |= (1 << (8 + level.power_cubes));
1183 		level.power_cubes++;
1184 	}
1185 
1186 	// don't let them drop items that stay in a coop game
1187 	if ((coop->value) && (item->flags & IT_STAY_COOP))
1188 	{
1189 		item->drop = NULL;
1190 	}
1191 
1192 	ent->item = item;
1193 	ent->nextthink = level.time + 2 * FRAMETIME;    // items start after other solids
1194 	ent->think = droptofloor;
1195 	ent->s.effects = item->world_model_flags;
1196 	ent->s.renderfx = RF_GLOW;
1197 #ifdef GAME_MOD
1198 	//Weapons Shell in game
1199 	if (weap_shell->value)
1200 	{
1201 		if (strcmp(ent->classname, "weapon_shotgun") == 0)
1202 		{
1203  			ent->s.effects |= EF_COLOR_SHELL;
1204  			ent->s.renderfx |= RF_SHELL_GREEN;
1205  		}
1206  		if (strcmp(ent->classname, "weapon_supershotgun") == 0)
1207 		{
1208  			ent->s.effects |= EF_COLOR_SHELL;
1209  			ent->s.renderfx |= RF_SHELL_RED;
1210  		}
1211  		if (strcmp(ent->classname, "weapon_machinegun") == 0)
1212 		{
1213  			ent->s.effects |= EF_COLOR_SHELL;
1214  			ent->s.renderfx |= RF_SHELL_BLUE;
1215  		}
1216  		if (strcmp(ent->classname, "weapon_chaingun") == 0)
1217 		{
1218  			ent->s.effects |= EF_COLOR_SHELL;
1219  			ent->s.renderfx |= RF_SHELL_GREEN;
1220  		}
1221  		if (strcmp(ent->classname, "weapon_hyperblaster") == 0)
1222 		{
1223  			ent->s.effects |= EF_COLOR_SHELL;
1224  			ent->s.renderfx |= RF_SHELL_RED;
1225  		}
1226  		if (strcmp(ent->classname, "weapon_rocketlauncher") == 0)
1227 		{
1228  			ent->s.effects |= EF_COLOR_SHELL;
1229  			ent->s.renderfx |= RF_SHELL_RED;
1230  		}
1231  		if (strcmp(ent->classname, "weapon_grenade") == 0)
1232 		{
1233  			ent->s.effects |= EF_COLOR_SHELL;
1234  			ent->s.renderfx |= RF_SHELL_GREEN;
1235  		}
1236  		if (strcmp(ent->classname, "weapon_grenadelauncher") == 0)
1237 		{
1238  			ent->s.effects |= EF_COLOR_SHELL;
1239  			ent->s.renderfx |= RF_SHELL_RED;
1240  		}
1241  		if (strcmp(ent->classname, "weapon_railgun") == 0)
1242 		{
1243  			ent->s.effects |= EF_COLOR_SHELL;
1244  			ent->s.renderfx |= RF_SHELL_BLUE;
1245  		}
1246  		if (strcmp(ent->classname, "weapon_boomer") == 0)
1247 		{
1248  			ent->s.effects |= EF_COLOR_SHELL;
1249  			ent->s.renderfx |= RF_SHELL_RED;
1250  		}
1251  		if (strcmp(ent->classname, "weapon_phalanx") == 0)
1252 		{
1253  			ent->s.effects |= EF_COLOR_SHELL;
1254  			ent->s.renderfx |= RF_SHELL_GREEN;
1255  		}
1256  		if (strcmp(ent->classname, "weapon_bfg") == 0)
1257 		{
1258  			ent->s.effects |= EF_COLOR_SHELL;
1259  			ent->s.renderfx |= RF_SHELL_GREEN;
1260  		}
1261 	}
1262 #endif
1263 	if (ent->model)
1264 		gi.modelindex (ent->model);
1265 }
1266 
1267 //======================================================================
1268 
1269 gitem_t	itemlist[] =
1270 {
1271 	{
1272 		NULL
1273 	},	// leave index 0 alone
1274 
1275 	//
1276 	// ARMOR
1277 	//
1278 
1279 /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16)
1280 */
1281 	{
1282 		"item_armor_body",
1283 		Pickup_Armor,
1284 		NULL,
1285 		NULL,
1286 		NULL,
1287 		"misc/ar1_pkup.wav",
1288 		"models/items/armor/body/tris.md2", EF_ROTATE,
1289 		NULL,
1290 /* icon */		"i_bodyarmor",
1291 /* pickup */	"Body Armor",
1292 /* width */		3,
1293 		0,
1294 		NULL,
1295 		IT_ARMOR,
1296 		0,
1297 		&bodyarmor_info,
1298 		ARMOR_BODY,
1299 /* precache */ ""
1300 	},
1301 
1302 /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16)
1303 */
1304 	{
1305 		"item_armor_combat",
1306 		Pickup_Armor,
1307 		NULL,
1308 		NULL,
1309 		NULL,
1310 		"misc/ar1_pkup.wav",
1311 		"models/items/armor/combat/tris.md2", EF_ROTATE,
1312 		NULL,
1313 /* icon */		"i_combatarmor",
1314 /* pickup */	"Combat Armor",
1315 /* width */		3,
1316 		0,
1317 		NULL,
1318 		IT_ARMOR,
1319 		0,
1320 		&combatarmor_info,
1321 		ARMOR_COMBAT,
1322 /* precache */ ""
1323 	},
1324 
1325 /*QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16)
1326 */
1327 	{
1328 		"item_armor_jacket",
1329 		Pickup_Armor,
1330 		NULL,
1331 		NULL,
1332 		NULL,
1333 		"misc/ar1_pkup.wav",
1334 		"models/items/armor/jacket/tris.md2", EF_ROTATE,
1335 		NULL,
1336 /* icon */		"i_jacketarmor",
1337 /* pickup */	"Jacket Armor",
1338 /* width */		3,
1339 		0,
1340 		NULL,
1341 		IT_ARMOR,
1342 		0,
1343 		&jacketarmor_info,
1344 		ARMOR_JACKET,
1345 /* precache */ ""
1346 	},
1347 
1348 /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16)
1349 */
1350 	{
1351 		"item_armor_shard",
1352 		Pickup_Armor,
1353 		NULL,
1354 		NULL,
1355 		NULL,
1356 		"misc/ar2_pkup.wav",
1357 		"models/items/armor/shard/tris.md2", EF_ROTATE,
1358 		NULL,
1359 /* icon */		"i_jacketarmor",
1360 /* pickup */	"Armor Shard",
1361 /* width */		3,
1362 		0,
1363 		NULL,
1364 		IT_ARMOR,
1365 		0,
1366 		NULL,
1367 		ARMOR_SHARD,
1368 /* precache */ ""
1369 	},
1370 
1371 
1372 /*QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16)
1373 */
1374 	{
1375 		"item_power_screen",
1376 		Pickup_PowerArmor,
1377 		Use_PowerArmor,
1378 		Drop_PowerArmor,
1379 		NULL,
1380 		"misc/ar3_pkup.wav",
1381 		"models/items/armor/screen/tris.md2", EF_ROTATE,
1382 		NULL,
1383 /* icon */		"i_powerscreen",
1384 /* pickup */	"Power Screen",
1385 /* width */		0,
1386 		60,
1387 		NULL,
1388 		IT_ARMOR,
1389 		0,
1390 		NULL,
1391 		0,
1392 /* precache */ ""
1393 	},
1394 
1395 /*QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16)
1396 */
1397 	{
1398 		"item_power_shield",
1399 		Pickup_PowerArmor,
1400 		Use_PowerArmor,
1401 		Drop_PowerArmor,
1402 		NULL,
1403 		"misc/ar3_pkup.wav",
1404 		"models/items/armor/shield/tris.md2", EF_ROTATE,
1405 		NULL,
1406 /* icon */		"i_powershield",
1407 /* pickup */	"Power Shield",
1408 /* width */		0,
1409 		60,
1410 		NULL,
1411 		IT_ARMOR,
1412 		0,
1413 		NULL,
1414 		0,
1415 /* precache */ "misc/power2.wav misc/power1.wav"
1416 	},
1417 
1418 
1419 	//
1420 	// WEAPONS
1421 	//
1422 
1423 /* weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
1424 always owned, never in the world
1425 */
1426 	{
1427 		"weapon_blaster",
1428 		NULL,
1429 		Use_Weapon,
1430 		NULL,
1431 		Weapon_Blaster,
1432 		"misc/w_pkup.wav",
1433 		NULL, 0,
1434 		"models/weapons/v_blast/tris.md2",
1435 /* icon */		"w_blaster",
1436 /* pickup */	"Blaster",
1437 		0,
1438 		0,
1439 		NULL,
1440 		IT_WEAPON|IT_STAY_COOP,
1441 		WEAP_BLASTER,
1442 		NULL,
1443 		0,
1444 /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"
1445 	},
1446 
1447 /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
1448 */
1449 	{
1450 		"weapon_shotgun",
1451 		Pickup_Weapon,
1452 		Use_Weapon,
1453 		Drop_Weapon,
1454 		Weapon_Shotgun,
1455 		"misc/w_pkup.wav",
1456 		"models/weapons/g_shotg/tris.md2", EF_ROTATE,
1457 		"models/weapons/v_shotg/tris.md2",
1458 /* icon */		"w_shotgun",
1459 /* pickup */	"Shotgun",
1460 		0,
1461 		1,
1462 		"Shells",
1463 		IT_WEAPON|IT_STAY_COOP,
1464 		WEAP_SHOTGUN,
1465 		NULL,
1466 		0,
1467 /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
1468 	},
1469 
1470 /*QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
1471 */
1472 	{
1473 		"weapon_supershotgun",
1474 		Pickup_Weapon,
1475 		Use_Weapon,
1476 		Drop_Weapon,
1477 		Weapon_SuperShotgun,
1478 		"misc/w_pkup.wav",
1479 		"models/weapons/g_shotg2/tris.md2", EF_ROTATE,
1480 		"models/weapons/v_shotg2/tris.md2",
1481 /* icon */		"w_sshotgun",
1482 /* pickup */	"Super Shotgun",
1483 		0,
1484 		2,
1485 		"Shells",
1486 		IT_WEAPON|IT_STAY_COOP,
1487 		WEAP_SUPERSHOTGUN,
1488 		NULL,
1489 		0,
1490 /* precache */ "weapons/sshotf1b.wav"
1491 	},
1492 
1493 /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16)
1494 */
1495 	{
1496 		"weapon_machinegun",
1497 		Pickup_Weapon,
1498 		Use_Weapon,
1499 		Drop_Weapon,
1500 		Weapon_Machinegun,
1501 		"misc/w_pkup.wav",
1502 		"models/weapons/g_machn/tris.md2", EF_ROTATE,
1503 		"models/weapons/v_machn/tris.md2",
1504 /* icon */		"w_machinegun",
1505 /* pickup */	"Machinegun",
1506 		0,
1507 		1,
1508 		"Bullets",
1509 		IT_WEAPON|IT_STAY_COOP,
1510 		WEAP_MACHINEGUN,
1511 		NULL,
1512 		0,
1513 /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"
1514 	},
1515 
1516 /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16)
1517 */
1518 	{
1519 		"weapon_chaingun",
1520 		Pickup_Weapon,
1521 		Use_Weapon,
1522 		Drop_Weapon,
1523 		Weapon_Chaingun,
1524 		"misc/w_pkup.wav",
1525 		"models/weapons/g_chain/tris.md2", EF_ROTATE,
1526 		"models/weapons/v_chain/tris.md2",
1527 /* icon */		"w_chaingun",
1528 /* pickup */	"Chaingun",
1529 		0,
1530 		1,
1531 		"Bullets",
1532 		IT_WEAPON|IT_STAY_COOP,
1533 		WEAP_CHAINGUN,
1534 		NULL,
1535 		0,
1536 /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"
1537 	},
1538 
1539 /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16)
1540 */
1541 	{
1542 		"ammo_grenades",
1543 		Pickup_Ammo,
1544 		Use_Weapon,
1545 		Drop_Ammo,
1546 		Weapon_Grenade,
1547 		"misc/am_pkup.wav",
1548 		"models/items/ammo/grenades/medium/tris.md2", 0,
1549 		"models/weapons/v_handgr/tris.md2",
1550 /* icon */		"a_grenades",
1551 /* pickup */	"Grenades",
1552 /* width */		3,
1553 		5,
1554 		"grenades",
1555 		IT_AMMO|IT_WEAPON,
1556 		WEAP_GRENADES,
1557 		NULL,
1558 		AMMO_GRENADES,
1559 /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
1560 	},
1561 
1562 /*QUAKED ammo_trap (.3 .3 1) (-16 -16 -16) (16 16 16)
1563 */
1564 	{
1565 		"ammo_trap",
1566 		Pickup_Ammo,
1567 		Use_Weapon,
1568 		Drop_Ammo,
1569 		Weapon_Trap,
1570 		"misc/am_pkup.wav",
1571 		"models/weapons/g_trap/tris.md2", EF_ROTATE,
1572 		"models/weapons/v_trap/tris.md2",
1573 /* icon */		"a_trap",
1574 /* pickup */	"Trap",
1575 /* width */		3,
1576 		1,
1577 		"trap",
1578 		IT_AMMO|IT_WEAPON,
1579 		0,
1580 		NULL,
1581 		AMMO_TRAP,
1582 /* precache */ "weapons/trapcock.wav weapons/traploop.wav weapons/trapsuck.wav weapons/trapdown.wav"
1583 // "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
1584 	},
1585 
1586 
1587 /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
1588 */
1589 	{
1590 		"weapon_grenadelauncher",
1591 		Pickup_Weapon,
1592 		Use_Weapon,
1593 		Drop_Weapon,
1594 		Weapon_GrenadeLauncher,
1595 		"misc/w_pkup.wav",
1596 		"models/weapons/g_launch/tris.md2", EF_ROTATE,
1597 		"models/weapons/v_launch/tris.md2",
1598 /* icon */		"w_glauncher",
1599 /* pickup */	"Grenade Launcher",
1600 		0,
1601 		1,
1602 		"Grenades",
1603 		IT_WEAPON|IT_STAY_COOP,
1604 		WEAP_GRENADELAUNCHER,
1605 		NULL,
1606 		0,
1607 /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"
1608 	},
1609 
1610 /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
1611 */
1612 	{
1613 		"weapon_rocketlauncher",
1614 		Pickup_Weapon,
1615 		Use_Weapon,
1616 		Drop_Weapon,
1617 		Weapon_RocketLauncher,
1618 		"misc/w_pkup.wav",
1619 		"models/weapons/g_rocket/tris.md2", EF_ROTATE,
1620 		"models/weapons/v_rocket/tris.md2",
1621 /* icon */		"w_rlauncher",
1622 /* pickup */	"Rocket Launcher",
1623 		0,
1624 		1,
1625 		"Rockets",
1626 		IT_WEAPON|IT_STAY_COOP,
1627 		WEAP_ROCKETLAUNCHER,
1628 		NULL,
1629 		0,
1630 /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"
1631 	},
1632 
1633 /*QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16)
1634 */
1635 	{
1636 		"weapon_hyperblaster",
1637 		Pickup_Weapon,
1638 		// RAFAEL
1639 		Use_Weapon2,
1640 		Drop_Weapon,
1641 		Weapon_HyperBlaster,
1642 		"misc/w_pkup.wav",
1643 		"models/weapons/g_hyperb/tris.md2", EF_ROTATE,
1644 		"models/weapons/v_hyperb/tris.md2",
1645 /* icon */		"w_hyperblaster",
1646 /* pickup */	"HyperBlaster",
1647 		0,
1648 		1,
1649 		"Cells",
1650 		IT_WEAPON|IT_STAY_COOP,
1651 		WEAP_HYPERBLASTER,
1652 		NULL,
1653 		0,
1654 /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"
1655 	},
1656 
1657 /*QUAKED weapon_boomer (.3 .3 1) (-16 -16 -16) (16 16 16)
1658 */
1659 
1660 	{
1661 		"weapon_boomer",
1662 		Pickup_Weapon,
1663 		Use_Weapon,
1664 		Drop_Weapon,
1665 		Weapon_Ionripper,
1666 		"misc/w_pkup.wav",
1667 		"models/weapons/g_boom/tris.md2", EF_ROTATE,
1668 		"models/weapons/v_boomer/tris.md2",
1669 /* icon */	"w_ripper",
1670 /* pickup */ "Ionripper",
1671 		0,
1672 		2,
1673 		"Cells",
1674 		IT_WEAPON,
1675 		WEAP_BOOMER,
1676 		NULL,
1677 		0,
1678 /* precache */ "weapons/rg_hum.wav weapons/rippfire.wav"
1679 	},
1680 // END 14-APR-98
1681 
1682 
1683 /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16)
1684 */
1685 	{
1686 		"weapon_railgun",
1687 		Pickup_Weapon,
1688 		// RAFAEL
1689 		Use_Weapon2,
1690 		Drop_Weapon,
1691 		Weapon_Railgun,
1692 		"misc/w_pkup.wav",
1693 		"models/weapons/g_rail/tris.md2", EF_ROTATE,
1694 		"models/weapons/v_rail/tris.md2",
1695 /* icon */		"w_railgun",
1696 /* pickup */	"Railgun",
1697 		0,
1698 		1,
1699 		"Slugs",
1700 		IT_WEAPON|IT_STAY_COOP,
1701 		WEAP_RAILGUN,
1702 		NULL,
1703 		0,
1704 /* precache */ "weapons/rg_hum.wav"
1705 	},
1706 
1707 // RAFAEL 14-APR-98
1708 /*QUAKED weapon_phalanx (.3 .3 1) (-16 -16 -16) (16 16 16)
1709 */
1710 
1711 	{
1712 		"weapon_phalanx",
1713 		Pickup_Weapon,
1714 		Use_Weapon,
1715 		Drop_Weapon,
1716 		Weapon_Phalanx,
1717 		"misc/w_pkup.wav",
1718 		"models/weapons/g_shotx/tris.md2", EF_ROTATE,
1719 		"models/weapons/v_shotx/tris.md2",
1720 /* icon */	"w_phallanx",
1721 /* pickup */ "Phalanx",
1722 		0,
1723 		1,
1724 		"Mag Slug",
1725 		IT_WEAPON,
1726 		WEAP_PHALANX,
1727 		NULL,
1728 		0,
1729 /* precache */ "weapons/plasshot.wav"
1730 	},
1731 
1732 
1733 
1734 /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16)
1735 */
1736 	{
1737 		"weapon_bfg",
1738 		Pickup_Weapon,
1739 		Use_Weapon,
1740 		Drop_Weapon,
1741 		Weapon_BFG,
1742 		"misc/w_pkup.wav",
1743 		"models/weapons/g_bfg/tris.md2", EF_ROTATE,
1744 		"models/weapons/v_bfg/tris.md2",
1745 /* icon */		"w_bfg",
1746 /* pickup */	"BFG10K",
1747 		0,
1748 		50,
1749 		"Cells",
1750 		IT_WEAPON|IT_STAY_COOP,
1751 		WEAP_BFG,
1752 		NULL,
1753 		0,
1754 /* precache */ "sprites/s_bfg1.sp2 sprites/s_bfg2.sp2 sprites/s_bfg3.sp2 weapons/bfg__f1y.wav weapons/bfg__l1a.wav weapons/bfg__x1b.wav weapons/bfg_hum.wav"
1755 	},
1756 
1757 	//
1758 	// AMMO ITEMS
1759 	//
1760 
1761 /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16)
1762 */
1763 	{
1764 		"ammo_shells",
1765 		Pickup_Ammo,
1766 		NULL,
1767 		Drop_Ammo,
1768 		NULL,
1769 		"misc/am_pkup.wav",
1770 		"models/items/ammo/shells/medium/tris.md2", 0,
1771 		NULL,
1772 /* icon */		"a_shells",
1773 /* pickup */	"Shells",
1774 /* width */		3,
1775 		10,
1776 		NULL,
1777 		IT_AMMO,
1778 		0,
1779 		NULL,
1780 		AMMO_SHELLS,
1781 /* precache */ ""
1782 	},
1783 
1784 /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16)
1785 */
1786 	{
1787 		"ammo_bullets",
1788 		Pickup_Ammo,
1789 		NULL,
1790 		Drop_Ammo,
1791 		NULL,
1792 		"misc/am_pkup.wav",
1793 		"models/items/ammo/bullets/medium/tris.md2", 0,
1794 		NULL,
1795 /* icon */		"a_bullets",
1796 /* pickup */	"Bullets",
1797 /* width */		3,
1798 		50,
1799 		NULL,
1800 		IT_AMMO,
1801 		0,
1802 		NULL,
1803 		AMMO_BULLETS,
1804 /* precache */ ""
1805 	},
1806 
1807 /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16)
1808 */
1809 	{
1810 		"ammo_cells",
1811 		Pickup_Ammo,
1812 		NULL,
1813 		Drop_Ammo,
1814 		NULL,
1815 		"misc/am_pkup.wav",
1816 		"models/items/ammo/cells/medium/tris.md2", 0,
1817 		NULL,
1818 /* icon */		"a_cells",
1819 /* pickup */	"Cells",
1820 /* width */		3,
1821 		50,
1822 		NULL,
1823 		IT_AMMO,
1824 		0,
1825 		NULL,
1826 		AMMO_CELLS,
1827 /* precache */ ""
1828 	},
1829 
1830 /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16)
1831 */
1832 	{
1833 		"ammo_rockets",
1834 		Pickup_Ammo,
1835 		NULL,
1836 		Drop_Ammo,
1837 		NULL,
1838 		"misc/am_pkup.wav",
1839 		"models/items/ammo/rockets/medium/tris.md2", 0,
1840 		NULL,
1841 /* icon */		"a_rockets",
1842 /* pickup */	"Rockets",
1843 /* width */		3,
1844 		5,
1845 		NULL,
1846 		IT_AMMO,
1847 		0,
1848 		NULL,
1849 		AMMO_ROCKETS,
1850 /* precache */ ""
1851 	},
1852 
1853 /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16)
1854 */
1855 	{
1856 		"ammo_slugs",
1857 		Pickup_Ammo,
1858 		NULL,
1859 		Drop_Ammo,
1860 		NULL,
1861 		"misc/am_pkup.wav",
1862 		"models/items/ammo/slugs/medium/tris.md2", 0,
1863 		NULL,
1864 /* icon */		"a_slugs",
1865 /* pickup */	"Slugs",
1866 /* width */		3,
1867 		10,
1868 		NULL,
1869 		IT_AMMO,
1870 		0,
1871 		NULL,
1872 		AMMO_SLUGS,
1873 /* precache */ ""
1874 	},
1875 
1876 
1877 /*QUAKED ammo_magslug (.3 .3 1) (-16 -16 -16) (16 16 16)
1878 */
1879 	{
1880 		"ammo_magslug",
1881 		Pickup_Ammo,
1882 		NULL,
1883 		Drop_Ammo,
1884 		NULL,
1885 		"misc/am_pkup.wav",
1886 		"models/objects/ammo/tris.md2", 0,
1887 		NULL,
1888 /* icon */		"a_mslugs",
1889 /* pickup */	"Mag Slug",
1890 /* width */		3,
1891 		10,
1892 		NULL,
1893 		IT_AMMO,
1894 		0,
1895 		NULL,
1896 		AMMO_MAGSLUG,
1897 /* precache */ ""
1898 	},
1899 
1900 	//
1901 	// POWERUP ITEMS
1902 	//
1903 /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16)
1904 */
1905 	{
1906 		"item_quad",
1907 		Pickup_Powerup,
1908 		Use_Quad,
1909 		Drop_General,
1910 		NULL,
1911 		"items/pkup.wav",
1912 		"models/items/quaddama/tris.md2", EF_ROTATE,
1913 		NULL,
1914 /* icon */		"p_quad",
1915 /* pickup */	"Quad Damage",
1916 /* width */		2,
1917 		60,
1918 		NULL,
1919 		IT_POWERUP,
1920 		0,
1921 		NULL,
1922 		0,
1923 /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"
1924 	},
1925 
1926 /*QUAKED item_quadfire (.3 .3 1) (-16 -16 -16) (16 16 16)
1927 */
1928 	{
1929 		"item_quadfire",
1930 		Pickup_Powerup,
1931 		Use_QuadFire,
1932 		Drop_General,
1933 		NULL,
1934 		"items/pkup.wav",
1935 		"models/items/quadfire/tris.md2", EF_ROTATE,
1936 		NULL,
1937 /* icon */		"p_quadfire",
1938 
1939 /* pickup */	"DualFire Damage",
1940 /* width */		2,
1941 		60,
1942 		NULL,
1943 		IT_POWERUP,
1944 		0,
1945 		NULL,
1946 		0,
1947 /* precache */ "items/quadfire1.wav items/quadfire2.wav items/quadfire3.wav"
1948 	},
1949 
1950 
1951 /*QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16)
1952 */
1953 	{
1954 		"item_invulnerability",
1955 		Pickup_Powerup,
1956 		Use_Invulnerability,
1957 		Drop_General,
1958 		NULL,
1959 		"items/pkup.wav",
1960 		"models/items/invulner/tris.md2", EF_ROTATE,
1961 		NULL,
1962 /* icon */		"p_invulnerability",
1963 /* pickup */	"Invulnerability",
1964 /* width */		2,
1965 		300,
1966 		NULL,
1967 		IT_POWERUP,
1968 		0,
1969 		NULL,
1970 		0,
1971 /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"
1972 	},
1973 
1974 /*QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16)
1975 */
1976 	{
1977 		"item_silencer",
1978 		Pickup_Powerup,
1979 		Use_Silencer,
1980 		Drop_General,
1981 		NULL,
1982 		"items/pkup.wav",
1983 		"models/items/silencer/tris.md2", EF_ROTATE,
1984 		NULL,
1985 /* icon */		"p_silencer",
1986 /* pickup */	"Silencer",
1987 /* width */		2,
1988 		60,
1989 		NULL,
1990 		IT_POWERUP,
1991 		0,
1992 		NULL,
1993 		0,
1994 /* precache */ ""
1995 	},
1996 
1997 /*QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16)
1998 */
1999 	{
2000 		"item_breather",
2001 		Pickup_Powerup,
2002 		Use_Breather,
2003 		Drop_General,
2004 		NULL,
2005 		"items/pkup.wav",
2006 		"models/items/breather/tris.md2", EF_ROTATE,
2007 		NULL,
2008 /* icon */		"p_rebreather",
2009 /* pickup */	"Rebreather",
2010 /* width */		2,
2011 		60,
2012 		NULL,
2013 		IT_STAY_COOP|IT_POWERUP,
2014 		0,
2015 		NULL,
2016 		0,
2017 /* precache */ "items/airout.wav"
2018 	},
2019 
2020 /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16)
2021 */
2022 	{
2023 		"item_enviro",
2024 		Pickup_Powerup,
2025 		Use_Envirosuit,
2026 		Drop_General,
2027 		NULL,
2028 		"items/pkup.wav",
2029 		"models/items/enviro/tris.md2", EF_ROTATE,
2030 		NULL,
2031 /* icon */		"p_envirosuit",
2032 /* pickup */	"Environment Suit",
2033 /* width */		2,
2034 		60,
2035 		NULL,
2036 		IT_STAY_COOP|IT_POWERUP,
2037 		0,
2038 		NULL,
2039 		0,
2040 /* precache */ "items/airout.wav"
2041 	},
2042 
2043 /*QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16)
2044 Special item that gives +2 to maximum health
2045 */
2046 	{
2047 		"item_ancient_head",
2048 		Pickup_AncientHead,
2049 		NULL,
2050 		NULL,
2051 		NULL,
2052 		"items/pkup.wav",
2053 		"models/items/c_head/tris.md2", EF_ROTATE,
2054 		NULL,
2055 /* icon */		"i_fixme",
2056 /* pickup */	"Ancient Head",
2057 /* width */		2,
2058 		60,
2059 		NULL,
2060 		0,
2061 		0,
2062 		NULL,
2063 		0,
2064 /* precache */ ""
2065 	},
2066 
2067 /*QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16)
2068 gives +1 to maximum health
2069 */
2070 	{
2071 		"item_adrenaline",
2072 		Pickup_Adrenaline,
2073 		NULL,
2074 		NULL,
2075 		NULL,
2076 		"items/pkup.wav",
2077 		"models/items/adrenal/tris.md2", EF_ROTATE,
2078 		NULL,
2079 /* icon */		"p_adrenaline",
2080 /* pickup */	"Adrenaline",
2081 /* width */		2,
2082 		60,
2083 		NULL,
2084 		0,
2085 		0,
2086 		NULL,
2087 		0,
2088 /* precache */ ""
2089 	},
2090 
2091 /*QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16)
2092 */
2093 	{
2094 		"item_bandolier",
2095 		Pickup_Bandolier,
2096 		NULL,
2097 		NULL,
2098 		NULL,
2099 		"items/pkup.wav",
2100 		"models/items/band/tris.md2", EF_ROTATE,
2101 		NULL,
2102 /* icon */		"p_bandolier",
2103 /* pickup */	"Bandolier",
2104 /* width */		2,
2105 		60,
2106 		NULL,
2107 		0,
2108 		0,
2109 		NULL,
2110 		0,
2111 /* precache */ ""
2112 	},
2113 
2114 /*QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16)
2115 */
2116 	{
2117 		"item_pack",
2118 		Pickup_Pack,
2119 		NULL,
2120 		NULL,
2121 		NULL,
2122 		"items/pkup.wav",
2123 		"models/items/pack/tris.md2", EF_ROTATE,
2124 		NULL,
2125 /* icon */		"i_pack",
2126 /* pickup */	"Ammo Pack",
2127 /* width */		2,
2128 		180,
2129 		NULL,
2130 		0,
2131 		0,
2132 		NULL,
2133 		0,
2134 /* precache */ ""
2135 	},
2136 
2137 	//
2138 	// KEYS
2139 	//
2140 /*QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16)
2141 key for computer centers
2142 */
2143 	{
2144 		"key_data_cd",
2145 		Pickup_Key,
2146 		NULL,
2147 		Drop_General,
2148 		NULL,
2149 		"items/pkup.wav",
2150 		"models/items/keys/data_cd/tris.md2", EF_ROTATE,
2151 		NULL,
2152 		"k_datacd",
2153 		"Data CD",
2154 		2,
2155 		0,
2156 		NULL,
2157 		IT_STAY_COOP|IT_KEY,
2158 		0,
2159 		NULL,
2160 		0,
2161 /* precache */ ""
2162 	},
2163 
2164 /*QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH
2165 warehouse circuits
2166 */
2167 	{
2168 		"key_power_cube",
2169 		Pickup_Key,
2170 		NULL,
2171 		Drop_General,
2172 		NULL,
2173 		"items/pkup.wav",
2174 		"models/items/keys/power/tris.md2", EF_ROTATE,
2175 		NULL,
2176 		"k_powercube",
2177 		"Power Cube",
2178 		2,
2179 		0,
2180 		NULL,
2181 		IT_STAY_COOP|IT_KEY,
2182 		0,
2183 		NULL,
2184 		0,
2185 /* precache */ ""
2186 	},
2187 
2188 /*QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16)
2189 key for the entrance of jail3
2190 */
2191 	{
2192 		"key_pyramid",
2193 		Pickup_Key,
2194 		NULL,
2195 		Drop_General,
2196 		NULL,
2197 		"items/pkup.wav",
2198 		"models/items/keys/pyramid/tris.md2", EF_ROTATE,
2199 		NULL,
2200 		"k_pyramid",
2201 		"Pyramid Key",
2202 		2,
2203 		0,
2204 		NULL,
2205 		IT_STAY_COOP|IT_KEY,
2206 		0,
2207 		NULL,
2208 		0,
2209 /* precache */ ""
2210 	},
2211 
2212 /*QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16)
2213 key for the city computer
2214 */
2215 	{
2216 		"key_data_spinner",
2217 		Pickup_Key,
2218 		NULL,
2219 		Drop_General,
2220 		NULL,
2221 		"items/pkup.wav",
2222 		"models/items/keys/spinner/tris.md2", EF_ROTATE,
2223 		NULL,
2224 		"k_dataspin",
2225 		"Data Spinner",
2226 		2,
2227 		0,
2228 		NULL,
2229 		IT_STAY_COOP|IT_KEY,
2230 		0,
2231 		NULL,
2232 		0,
2233 /* precache */ ""
2234 	},
2235 
2236 /*QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16)
2237 security pass for the security level
2238 */
2239 	{
2240 		"key_pass",
2241 		Pickup_Key,
2242 		NULL,
2243 		Drop_General,
2244 		NULL,
2245 		"items/pkup.wav",
2246 		"models/items/keys/pass/tris.md2", EF_ROTATE,
2247 		NULL,
2248 		"k_security",
2249 		"Security Pass",
2250 		2,
2251 		0,
2252 		NULL,
2253 		IT_STAY_COOP|IT_KEY,
2254 		0,
2255 		NULL,
2256 		0,
2257 /* precache */ ""
2258 	},
2259 
2260 /*QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16)
2261 normal door key - blue
2262 */
2263 	{
2264 		"key_blue_key",
2265 		Pickup_Key,
2266 		NULL,
2267 		Drop_General,
2268 		NULL,
2269 		"items/pkup.wav",
2270 		"models/items/keys/key/tris.md2", EF_ROTATE,
2271 		NULL,
2272 		"k_bluekey",
2273 		"Blue Key",
2274 		2,
2275 		0,
2276 		NULL,
2277 		IT_STAY_COOP|IT_KEY,
2278 		0,
2279 		NULL,
2280 		0,
2281 /* precache */ ""
2282 	},
2283 
2284 /*QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16)
2285 normal door key - red
2286 */
2287 	{
2288 		"key_red_key",
2289 		Pickup_Key,
2290 		NULL,
2291 		Drop_General,
2292 		NULL,
2293 		"items/pkup.wav",
2294 		"models/items/keys/red_key/tris.md2", EF_ROTATE,
2295 		NULL,
2296 		"k_redkey",
2297 		"Red Key",
2298 		2,
2299 		0,
2300 		NULL,
2301 		IT_STAY_COOP|IT_KEY,
2302 		0,
2303 		NULL,
2304 		0,
2305 /* precache */ ""
2306 	},
2307 
2308 
2309 // RAFAEL
2310 /*QUAKED key_green_key (0 .5 .8) (-16 -16 -16) (16 16 16)
2311 normal door key - blue
2312 */
2313 	{
2314 		"key_green_key",
2315 		Pickup_Key,
2316 		NULL,
2317 		Drop_General,
2318 		NULL,
2319 		"items/pkup.wav",
2320 		"models/items/keys/green_key/tris.md2", EF_ROTATE,
2321 		NULL,
2322 		"k_green",
2323 		"Green Key",
2324 		2,
2325 		0,
2326 		NULL,
2327 		IT_STAY_COOP|IT_KEY,
2328 		0,
2329 		NULL,
2330 		0,
2331 /* precache */ ""
2332 	},
2333 
2334 /*QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16)
2335 tank commander's head
2336 */
2337 	{
2338 		"key_commander_head",
2339 		Pickup_Key,
2340 		NULL,
2341 		Drop_General,
2342 		NULL,
2343 		"items/pkup.wav",
2344 		"models/monsters/commandr/head/tris.md2", EF_GIB,
2345 		NULL,
2346 /* icon */		"k_comhead",
2347 /* pickup */	"Commander's Head",
2348 /* width */		2,
2349 		0,
2350 		NULL,
2351 		IT_STAY_COOP|IT_KEY,
2352 		0,
2353 		NULL,
2354 		0,
2355 /* precache */ ""
2356 	},
2357 
2358 /*QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16)
2359 tank commander's head
2360 */
2361 	{
2362 		"key_airstrike_target",
2363 		Pickup_Key,
2364 		NULL,
2365 		Drop_General,
2366 		NULL,
2367 		"items/pkup.wav",
2368 		"models/items/keys/target/tris.md2", EF_ROTATE,
2369 		NULL,
2370 /* icon */		"i_airstrike",
2371 /* pickup */	"Airstrike Marker",
2372 /* width */		2,
2373 		0,
2374 		NULL,
2375 		IT_STAY_COOP|IT_KEY,
2376 		0,
2377 		NULL,
2378 		0,
2379 /* precache */ ""
2380 	},
2381 
2382 	{
2383 		NULL,
2384 		Pickup_Health,
2385 		NULL,
2386 		NULL,
2387 		NULL,
2388 		"items/pkup.wav",
2389 		NULL, 0,
2390 		NULL,
2391 /* icon */		"i_health",
2392 /* pickup */	"Health",
2393 /* width */		3,
2394 		0,
2395 		NULL,
2396 		0,
2397 		0,
2398 		NULL,
2399 		0,
2400 /* precache */ "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav"
2401 	},
2402 
2403 	// end of list marker
2404 	{NULL}
2405 };
2406 
2407 
2408 /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16)
2409 */
SP_item_health(edict_t * self)2410 void SP_item_health (edict_t *self)
2411 {
2412 	if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
2413 	{
2414 		G_FreeEdict (self);
2415 		return;
2416 	}
2417 
2418 	self->model = "models/items/healing/medium/tris.md2";
2419 	self->count = 10;
2420 	SpawnItem (self, FindItem ("Health"));
2421 	gi.soundindex ("items/n_health.wav");
2422 }
2423 
2424 /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16)
2425 */
SP_item_health_small(edict_t * self)2426 void SP_item_health_small (edict_t *self)
2427 {
2428 	if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
2429 	{
2430 		G_FreeEdict (self);
2431 		return;
2432 	}
2433 
2434 	self->model = "models/items/healing/stimpack/tris.md2";
2435 	self->count = 2;
2436 	SpawnItem (self, FindItem ("Health"));
2437 	self->style = HEALTH_IGNORE_MAX;
2438 	gi.soundindex ("items/s_health.wav");
2439 }
2440 
2441 /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16)
2442 */
SP_item_health_large(edict_t * self)2443 void SP_item_health_large (edict_t *self)
2444 {
2445 	if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
2446 	{
2447 		G_FreeEdict (self);
2448 		return;
2449 	}
2450 
2451 	self->model = "models/items/healing/large/tris.md2";
2452 	self->count = 25;
2453 	SpawnItem (self, FindItem ("Health"));
2454 	gi.soundindex ("items/l_health.wav");
2455 }
2456 
2457 /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16)
2458 */
SP_item_health_mega(edict_t * self)2459 void SP_item_health_mega (edict_t *self)
2460 {
2461 	if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
2462 	{
2463 		G_FreeEdict (self);
2464 		return;
2465 	}
2466 
2467 	self->model = "models/items/mega_h/tris.md2";
2468 	self->count = 100;
2469 	SpawnItem (self, FindItem ("Health"));
2470 	gi.soundindex ("items/m_health.wav");
2471 	self->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
2472 }
2473 
2474 // RAFAEL
SP_item_foodcube(edict_t * self)2475 void SP_item_foodcube (edict_t *self)
2476 {
2477 	if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
2478 	{
2479 		G_FreeEdict (self);
2480 		return;
2481 	}
2482 
2483 	self->model = "models/objects/trapfx/tris.md2";
2484 	SpawnItem (self, FindItem ("Health"));
2485 	self->spawnflags |= DROPPED_ITEM;
2486 	self->style = HEALTH_IGNORE_MAX;
2487 	gi.soundindex ("items/s_health.wav");
2488 	self->classname = "foodcube";
2489 }
2490 
2491 
InitItems(void)2492 void InitItems (void)
2493 {
2494 	game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1;
2495 }
2496 
2497 
2498 
2499 /*
2500 ===============
2501 SetItemNames
2502 
2503 Called by worldspawn
2504 ===============
2505 */
SetItemNames(void)2506 void SetItemNames (void)
2507 {
2508 	int		i;
2509 	gitem_t	*it;
2510 
2511 	for (i=0 ; i<game.num_items ; i++)
2512 	{
2513 		it = &itemlist[i];
2514 		gi.configstring (CS_ITEMS+i, it->pickup_name);
2515 	}
2516 
2517 	jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor"));
2518 	combat_armor_index = ITEM_INDEX(FindItem("Combat Armor"));
2519 	body_armor_index   = ITEM_INDEX(FindItem("Body Armor"));
2520 	power_screen_index = ITEM_INDEX(FindItem("Power Screen"));
2521 	power_shield_index = ITEM_INDEX(FindItem("Power Shield"));
2522 }
2523