Debian Codegraph @

code/game/bg_misc.c

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Open Arena source code.
6 Portions copied from Tremulous under GPL version 2 including any later version.
7
8 Open Arena source code is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the License,
11 or (at your option) any later version.
12
13 Open Arena source code is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Open Arena source code; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 ===========================================================================
22 */
23 //
24 // bg_misc.c -- both games misc functions, all completely stateless
25
26 #include "../qcommon/q_shared.h"
27 #include "bg_public.h"
28
29 /*QUAKED item_***** ( 0 0 0 ) (-16 -16 -16) (16 16 16) suspended
30 DO NOT USE THIS CLASS, IT JUST HOLDS GENERAL INFORMATION.
31 The suspended flag will allow items to hang in the air, otherwise they are dropped to the next surface.
32
33 If an item is the target of another entity, it will not spawn in until fired.
34
35 An item fires all of its targets when it is picked up. If the toucher can't carry it, the targets won't be fired.
36
37 "notfree" if set to 1, don't spawn in free for all games
38 "notteam" if set to 1, don't spawn in team games
39 "notsingle" if set to 1, don't spawn in single player games
40 "wait" override the default wait before respawning. -1 = never respawn automatically, which can be used with targeted spawning.
41 "random" random number of plus or minus seconds varied from the respawn time
42 "count" override quantity or duration on most items.
43 */
44
45 gitem_t bg_itemlist[] =
46 {
47 {
48 NULL,
49 NULL,
50 { NULL,
51 NULL,
52 NULL, NULL} ,
53 /* icon */ NULL,
54 /* pickup */ NULL,
55 0,
56 0,
57 0,
58 /* precache */ "",
59 /* sounds */ ""
60 }, // leave index 0 alone
61
62 //
63 // ARMOR
64 //
65
66 /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
67 */
68 {
69 "item_armor_shard",
70 "sound/misc/ar1_pkup.wav",
71 { "models/powerups/armor/shard.md3",
72 "models/powerups/armor/shard_sphere.md3",
73 NULL, NULL} ,
74 /* icon */ "icons/iconr_shard",
75 /* pickup */ "Armor Shard",
76 5,
77 IT_ARMOR,
78 0,
79 /* precache */ "",
80 /* sounds */ ""
81 },
82
83 /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
84 */
85 {
86 "item_armor_combat",
87 "sound/misc/ar2_pkup.wav",
88 { "models/powerups/armor/armor_yel.md3",
89 NULL, NULL, NULL},
90 /* icon */ "icons/iconr_yellow",
91 /* pickup */ "Armor",
92 50,
93 IT_ARMOR,
94 0,
95 /* precache */ "",
96 /* sounds */ ""
97 },
98
99 /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
100 */
101 {
102 "item_armor_body",
103 "sound/misc/ar2_pkup.wav",
104 { "models/powerups/armor/armor_red.md3",
105 NULL, NULL, NULL},
106 /* icon */ "icons/iconr_red",
107 /* pickup */ "Heavy Armor",
108 100,
109 IT_ARMOR,
110 0,
111 /* precache */ "",
112 /* sounds */ ""
113 },
114
115 //
116 // health
117 //
118 /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
119 */
120 {
121 "item_health_small",
122 "sound/items/s_health.wav",
123 { "models/powerups/health/small_cross.md3",
124 "models/powerups/health/small_sphere.md3",
125 NULL, NULL },
126 /* icon */ "icons/iconh_green",
127 /* pickup */ "5 Health",
128 5,
129 IT_HEALTH,
130 0,
131 /* precache */ "",
132 /* sounds */ ""
133 },
134
135 /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
136 */
137 {
138 "item_health",
139 "sound/items/n_health.wav",
140 { "models/powerups/health/medium_cross.md3",
141 "models/powerups/health/medium_sphere.md3",
142 NULL, NULL },
143 /* icon */ "icons/iconh_yellow",
144 /* pickup */ "25 Health",
145 25,
146 IT_HEALTH,
147 0,
148 /* precache */ "",
149 /* sounds */ ""
150 },
151
152 /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
153 */
154 {
155 "item_health_large",
156 "sound/items/l_health.wav",
157 { "models/powerups/health/large_cross.md3",
158 "models/powerups/health/large_sphere.md3",
159 NULL, NULL },
160 /* icon */ "icons/iconh_red",
161 /* pickup */ "50 Health",
162 50,
163 IT_HEALTH,
164 0,
165 /* precache */ "",
166 /* sounds */ ""
167 },
168
169 /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
170 */
171 {
172 "item_health_mega",
173 "sound/items/m_health.wav",
174 { "models/powerups/health/mega_cross.md3",
175 "models/powerups/health/mega_sphere.md3",
176 NULL, NULL },
177 /* icon */ "icons/iconh_mega",
178 /* pickup */ "Mega Health",
179 100,
180 IT_HEALTH,
181 0,
182 /* precache */ "",
183 /* sounds */ ""
184 },
185
186
187 //
188 // WEAPONS
189 //
190
191 /*QUAKED weapon_gauntlet (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
192 */
193 {
194 "weapon_gauntlet",
195 "sound/misc/w_pkup.wav",
196 { "models/weapons2/gauntlet/gauntlet.md3",
197 NULL, NULL, NULL},
198 /* icon */ "icons/iconw_gauntlet",
199 /* pickup */ "Gauntlet",
200 0,
201 IT_WEAPON,
202 WP_GAUNTLET,
203 /* precache */ "",
204 /* sounds */ ""
205 },
206
207 /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
208 */
209 {
210 "weapon_shotgun",
211 "sound/misc/w_pkup.wav",
212 { "models/weapons2/shotgun/shotgun.md3",
213 NULL, NULL, NULL},
214 /* icon */ "icons/iconw_shotgun",
215 /* pickup */ "Shotgun",
216 10,
217 IT_WEAPON,
218 WP_SHOTGUN,
219 /* precache */ "",
220 /* sounds */ ""
221 },
222
223 /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
224 */
225 {
226 "weapon_machinegun",
227 "sound/misc/w_pkup.wav",
228 { "models/weapons2/machinegun/machinegun.md3",
229 NULL, NULL, NULL},
230 /* icon */ "icons/iconw_machinegun",
231 /* pickup */ "Machinegun",
232 40,
233 IT_WEAPON,
234 WP_MACHINEGUN,
235 /* precache */ "",
236 /* sounds */ ""
237 },
238
239 /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
240 */
241 {
242 "weapon_grenadelauncher",
243 "sound/misc/w_pkup.wav",
244 { "models/weapons2/grenadel/grenadel.md3",
245 NULL, NULL, NULL},
246 /* icon */ "icons/iconw_grenade",
247 /* pickup */ "Grenade Launcher",
248 10,
249 IT_WEAPON,
250 WP_GRENADE_LAUNCHER,
251 /* precache */ "",
252 /* sounds */ "sound/weapons/grenade/hgrenb1a.wav sound/weapons/grenade/hgrenb2a.wav"
253 },
254
255 /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
256 */
257 {
258 "weapon_rocketlauncher",
259 "sound/misc/w_pkup.wav",
260 { "models/weapons2/rocketl/rocketl.md3",
261 NULL, NULL, NULL},
262 /* icon */ "icons/iconw_rocket",
263 /* pickup */ "Rocket Launcher",
264 10,
265 IT_WEAPON,
266 WP_ROCKET_LAUNCHER,
267 /* precache */ "",
268 /* sounds */ ""
269 },
270
271 /*QUAKED weapon_lightning (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
272 */
273 {
274 "weapon_lightning",
275 "sound/misc/w_pkup.wav",
276 { "models/weapons2/lightning/lightning.md3",
277 NULL, NULL, NULL},
278 /* icon */ "icons/iconw_lightning",
279 /* pickup */ "Lightning Gun",
280 100,
281 IT_WEAPON,
282 WP_LIGHTNING,
283 /* precache */ "",
284 /* sounds */ ""
285 },
286
287 /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
288 */
289 {
290 "weapon_railgun",
291 "sound/misc/w_pkup.wav",
292 { "models/weapons2/railgun/railgun.md3",
293 NULL, NULL, NULL},
294 /* icon */ "icons/iconw_railgun",
295 /* pickup */ "Railgun",
296 10,
297 IT_WEAPON,
298 WP_RAILGUN,
299 /* precache */ "",
300 /* sounds */ ""
301 },
302
303 /*QUAKED weapon_plasmagun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
304 */
305 {
306 "weapon_plasmagun",
307 "sound/misc/w_pkup.wav",
308 { "models/weapons2/plasma/plasma.md3",
309 NULL, NULL, NULL},
310 /* icon */ "icons/iconw_plasma",
311 /* pickup */ "Plasma Gun",
312 50,
313 IT_WEAPON,
314 WP_PLASMAGUN,
315 /* precache */ "",
316 /* sounds */ ""
317 },
318
319 /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
320 */
321 {
322 "weapon_bfg",
323 "sound/misc/w_pkup.wav",
324 { "models/weapons2/bfg/bfg.md3",
325 NULL, NULL, NULL},
326 /* icon */ "icons/iconw_bfg",
327 /* pickup */ "BFG10K",
328 20,
329 IT_WEAPON,
330 WP_BFG,
331 /* precache */ "",
332 /* sounds */ ""
333 },
334
335 /*QUAKED weapon_grapplinghook (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
336 */
337 {
338 "weapon_grapplinghook",
339 "sound/misc/w_pkup.wav",
340 { "models/weapons2/grapple/grapple.md3",
341 NULL, NULL, NULL},
342 /* icon */ "icons/iconw_grapple",
343 /* pickup */ "Grappling Hook",
344 0,
345 IT_WEAPON,
346 WP_GRAPPLING_HOOK,
347 /* precache */ "",
348 /* sounds */ ""
349 },
350
351 //
352 // AMMO ITEMS
353 //
354
355 /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
356 */
357 {
358 "ammo_shells",
359 "sound/misc/am_pkup.wav",
360 { "models/powerups/ammo/shotgunam.md3",
361 NULL, NULL, NULL},
362 /* icon */ "icons/icona_shotgun",
363 /* pickup */ "Shells",
364 10,
365 IT_AMMO,
366 WP_SHOTGUN,
367 /* precache */ "",
368 /* sounds */ ""
369 },
370
371 /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
372 */
373 {
374 "ammo_bullets",
375 "sound/misc/am_pkup.wav",
376 { "models/powerups/ammo/machinegunam.md3",
377 NULL, NULL, NULL},
378 /* icon */ "icons/icona_machinegun",
379 /* pickup */ "Bullets",
380 50,
381 IT_AMMO,
382 WP_MACHINEGUN,
383 /* precache */ "",
384 /* sounds */ ""
385 },
386
387 /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
388 */
389 {
390 "ammo_grenades",
391 "sound/misc/am_pkup.wav",
392 { "models/powerups/ammo/grenadeam.md3",
393 NULL, NULL, NULL},
394 /* icon */ "icons/icona_grenade",
395 /* pickup */ "Grenades",
396 5,
397 IT_AMMO,
398 WP_GRENADE_LAUNCHER,
399 /* precache */ "",
400 /* sounds */ ""
401 },
402
403 /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
404 */
405 {
406 "ammo_cells",
407 "sound/misc/am_pkup.wav",
408 { "models/powerups/ammo/plasmaam.md3",
409 NULL, NULL, NULL},
410 /* icon */ "icons/icona_plasma",
411 /* pickup */ "Cells",
412 30,
413 IT_AMMO,
414 WP_PLASMAGUN,
415 /* precache */ "",
416 /* sounds */ ""
417 },
418
419 /*QUAKED ammo_lightning (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
420 */
421 {
422 "ammo_lightning",
423 "sound/misc/am_pkup.wav",
424 { "models/powerups/ammo/lightningam.md3",
425 NULL, NULL, NULL},
426 /* icon */ "icons/icona_lightning",
427 /* pickup */ "Lightning",
428 60,
429 IT_AMMO,
430 WP_LIGHTNING,
431 /* precache */ "",
432 /* sounds */ ""
433 },
434
435 /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
436 */
437 {
438 "ammo_rockets",
439 "sound/misc/am_pkup.wav",
440 { "models/powerups/ammo/rocketam.md3",
441 NULL, NULL, NULL},
442 /* icon */ "icons/icona_rocket",
443 /* pickup */ "Rockets",
444 5,
445 IT_AMMO,
446 WP_ROCKET_LAUNCHER,
447 /* precache */ "",
448 /* sounds */ ""
449 },
450
451 /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
452 */
453 {
454 "ammo_slugs",
455 "sound/misc/am_pkup.wav",
456 { "models/powerups/ammo/railgunam.md3",
457 NULL, NULL, NULL},
458 /* icon */ "icons/icona_railgun",
459 /* pickup */ "Slugs",
460 10,
461 IT_AMMO,
462 WP_RAILGUN,
463 /* precache */ "",
464 /* sounds */ ""
465 },
466
467 /*QUAKED ammo_bfg (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
468 */
469 {
470 "ammo_bfg",
471 "sound/misc/am_pkup.wav",
472 { "models/powerups/ammo/bfgam.md3",
473 NULL, NULL, NULL},
474 /* icon */ "icons/icona_bfg",
475 /* pickup */ "Bfg Ammo",
476 15,
477 IT_AMMO,
478 WP_BFG,
479 /* precache */ "",
480 /* sounds */ ""
481 },
482
483 //
484 // HOLDABLE ITEMS
485 //
486 /*QUAKED holdable_teleporter (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
487 */
488 {
489 "holdable_teleporter",
490 "sound/items/holdable.wav",
491 { "models/powerups/holdable/teleporter.md3",
492 NULL, NULL, NULL},
493 /* icon */ "icons/teleporter",
494 /* pickup */ "Personal Teleporter",
495 60,
496 IT_HOLDABLE,
497 HI_TELEPORTER,
498 /* precache */ "",
499 /* sounds */ ""
500 },
501 /*QUAKED holdable_medkit (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
502 */
503 {
504 "holdable_medkit",
505 "sound/items/holdable.wav",
506 {
507 "models/powerups/holdable/medkit.md3",
508 "models/powerups/holdable/medkit_sphere.md3",
509 NULL, NULL},
510 /* icon */ "icons/medkit",
511 /* pickup */ "Medkit",
512 60,
513 IT_HOLDABLE,
514 HI_MEDKIT,
515 /* precache */ "",
516 /* sounds */ "sound/items/use_medkit.wav"
517 },
518
519 //
520 // POWERUP ITEMS
521 //
522 /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
523 */
524 {
525 "item_quad",
526 "sound/items/quaddamage.wav",
527 { "models/powerups/instant/quad.md3",
528 "models/powerups/instant/quad_ring.md3",
529 NULL, NULL },
530 /* icon */ "icons/quad",
531 /* pickup */ "Quad Damage",
532 30,
533 IT_POWERUP,
534 PW_QUAD,
535 /* precache */ "",
536 /* sounds */ "sound/items/damage2.wav sound/items/damage3.wav"
537 },
538
539 /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
540 */
541 {
542 "item_enviro",
543 "sound/items/protect.wav",
544 { "models/powerups/instant/enviro.md3",
545 "models/powerups/instant/enviro_ring.md3",
546 NULL, NULL },
547 /* icon */ "icons/envirosuit",
548 /* pickup */ "Battle Suit",
549 30,
550 IT_POWERUP,
551 PW_BATTLESUIT,
552 /* precache */ "",
553 /* sounds */ "sound/items/airout.wav sound/items/protect3.wav"
554 },
555
556 /*QUAKED item_haste (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
557 */
558 {
559 "item_haste",
560 "sound/items/haste.wav",
561 { "models/powerups/instant/haste.md3",
562 "models/powerups/instant/haste_ring.md3",
563 NULL, NULL },
564 /* icon */ "icons/haste",
565 /* pickup */ "Speed",
566 30,
567 IT_POWERUP,
568 PW_HASTE,
569 /* precache */ "",
570 /* sounds */ ""
571 },
572
573 /*QUAKED item_invis (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
574 */
575 {
576 "item_invis",
577 "sound/items/invisibility.wav",
578 { "models/powerups/instant/invis.md3",
579 "models/powerups/instant/invis_ring.md3",
580 NULL, NULL },
581 /* icon */ "icons/invis",
582 /* pickup */ "Invisibility",
583 30,
584 IT_POWERUP,
585 PW_INVIS,
586 /* precache */ "",
587 /* sounds */ ""
588 },
589
590 /*QUAKED item_regen (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
591 */
592 {
593 "item_regen",
594 "sound/items/regeneration.wav",
595 { "models/powerups/instant/regen.md3",
596 "models/powerups/instant/regen_ring.md3",
597 NULL, NULL },
598 /* icon */ "icons/regen",
599 /* pickup */ "Regeneration",
600 30,
601 IT_POWERUP,
602 PW_REGEN,
603 /* precache */ "",
604 /* sounds */ "sound/items/regen.wav"
605 },
606
607 /*QUAKED item_flight (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
608 */
609 {
610 "item_flight",
611 "sound/items/flight.wav",
612 { "models/powerups/instant/flight.md3",
613 "models/powerups/instant/flight_ring.md3",
614 NULL, NULL },
615 /* icon */ "icons/flight",
616 /* pickup */ "Flight",
617 60,
618 IT_POWERUP,
619 PW_FLIGHT,
620 /* precache */ "",
621 /* sounds */ "sound/items/flight.wav"
622 },
623
624 /*QUAKED team_CTF_redflag (1 0 0) (-16 -16 -16) (16 16 16)
625 Only in CTF games
626 */
627 {
628 "team_CTF_redflag",
629 NULL,
630 { "models/flags/r_flag.md3",
631 NULL, NULL, NULL },
632 /* icon */ "icons/iconf_red1",
633 /* pickup */ "Red Flag",
634 0,
635 IT_TEAM,
636 PW_REDFLAG,
637 /* precache */ "",
638 /* sounds */ ""
639 },
640
641 /*QUAKED team_CTF_blueflag (0 0 1) (-16 -16 -16) (16 16 16)
642 Only in CTF games
643 */
644 {
645 "team_CTF_blueflag",
646 NULL,
647 { "models/flags/b_flag.md3",
648 NULL, NULL, NULL },
649 /* icon */ "icons/iconf_blu1",
650 /* pickup */ "Blue Flag",
651 0,
652 IT_TEAM,
653 PW_BLUEFLAG,
654 /* precache */ "",
655 /* sounds */ ""
656 },
657
658 /*QUAKED holdable_kamikaze (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
659 */
660 {
661 "holdable_kamikaze",
662 "sound/items/holdable.wav",
663 { "models/powerups/kamikazi.md3",
664 NULL, NULL, NULL},
665 /* icon */ "icons/kamikaze",
666 /* pickup */ "Kamikaze",
667 60,
668 IT_HOLDABLE,
669 HI_KAMIKAZE,
670 /* precache */ "",
671 /* sounds */ "sound/items/kamikazerespawn.wav"
672 },
673
674 /*QUAKED holdable_portal (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
675 */
676 {
677 "holdable_portal",
678 "sound/items/holdable.wav",
679 { "models/powerups/holdable/porter.md3",
680 NULL, NULL, NULL},
681 /* icon */ "icons/portal",
682 /* pickup */ "Portal",
683 60,
684 IT_HOLDABLE,
685 HI_PORTAL,
686 /* precache */ "",
687 /* sounds */ ""
688 },
689
690 /*QUAKED holdable_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
691 */
692 {
693 "holdable_invulnerability",
694 "sound/items/holdable.wav",
695 { "models/powerups/holdable/invulnerability.md3",
696 NULL, NULL, NULL},
697 /* icon */ "icons/invulnerability",
698 /* pickup */ "Invulnerability",
699 60,
700 IT_HOLDABLE,
701 HI_INVULNERABILITY,
702 /* precache */ "",
703 /* sounds */ ""
704 },
705
706 /*QUAKED ammo_nails (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
707 */
708 {
709 "ammo_nails",
710 "sound/misc/am_pkup.wav",
711 { "models/powerups/ammo/nailgunam.md3",
712 NULL, NULL, NULL},
713 /* icon */ "icons/icona_nailgun",
714 /* pickup */ "Nails",
715 20,
716 IT_AMMO,
717 WP_NAILGUN,
718 /* precache */ "",
719 /* sounds */ ""
720 },
721
722 /*QUAKED ammo_mines (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
723 */
724 {
725 "ammo_mines",
726 "sound/misc/am_pkup.wav",
727 { "models/powerups/ammo/proxmineam.md3",
728 NULL, NULL, NULL},
729 /* icon */ "icons/icona_proxlauncher",
730 /* pickup */ "Proximity Mines",
731 10,
732 IT_AMMO,
733 WP_PROX_LAUNCHER,
734 /* precache */ "",
735 /* sounds */ ""
736 },
737
738 /*QUAKED ammo_belt (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
739 */
740 {
741 "ammo_belt",
742 "sound/misc/am_pkup.wav",
743 { "models/powerups/ammo/chaingunam.md3",
744 NULL, NULL, NULL},
745 /* icon */ "icons/icona_chaingun",
746 /* pickup */ "Chaingun Belt",
747 100,
748 IT_AMMO,
749 WP_CHAINGUN,
750 /* precache */ "",
751 /* sounds */ ""
752 },
753
754 //
755 // PERSISTANT POWERUP ITEMS
756 //
757 /*QUAKED item_scout (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
758 */
759 {
760 "item_scout",
761 "sound/items/scout.wav",
762 { "models/powerups/scout.md3",
763 NULL, NULL, NULL },
764 /* icon */ "icons/scout",
765 /* pickup */ "Scout",
766 30,
767 IT_PERSISTANT_POWERUP,
768 PW_SCOUT,
769 /* precache */ "",
770 /* sounds */ ""
771 },
772
773 /*QUAKED item_guard (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
774 */
775 {
776 "item_guard",
777 "sound/items/guard.wav",
778 { "models/powerups/guard.md3",
779 NULL, NULL, NULL },
780 /* icon */ "icons/guard",
781 /* pickup */ "Guard",
782 30,
783 IT_PERSISTANT_POWERUP,
784 PW_GUARD,
785 /* precache */ "",
786 /* sounds */ ""
787 },
788
789 /*QUAKED item_doubler (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
790 */
791 {
792 "item_doubler",
793 "sound/items/doubler.wav",
794 { "models/powerups/doubler.md3",
795 NULL, NULL, NULL },
796 /* icon */ "icons/doubler",
797 /* pickup */ "Doubler",
798 30,
799 IT_PERSISTANT_POWERUP,
800 PW_DOUBLER,
801 /* precache */ "",
802 /* sounds */ ""
803 },
804
805 /*QUAKED item_doubler (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
806 */
807 {
808 "item_ammoregen",
809 "sound/items/ammoregen.wav",
810 { "models/powerups/ammo.md3",
811 NULL, NULL, NULL },
812 /* icon */ "icons/ammo_regen",
813 /* pickup */ "Ammo Regen",
814 30,
815 IT_PERSISTANT_POWERUP,
816 PW_AMMOREGEN,
817 /* precache */ "",
818 /* sounds */ ""
819 },
820
821
822 /*QUAKED team_CTF_neutralflag (0 0 1) (-16 -16 -16) (16 16 16)
823 Only in One Flag CTF games
824 */
825 {
826 "team_CTF_neutralflag",
827 NULL,
828 { "models/flags/n_flag.md3",
829 NULL, NULL, NULL },
830 /* icon */ "icons/iconf_neutral1",
831 /* pickup */ "Neutral Flag",
832 0,
833 IT_TEAM,
834 PW_NEUTRALFLAG,
835 /* precache */ "",
836 /* sounds */ ""
837 },
838
839 {
840 "item_redcube",
841 "sound/misc/am_pkup.wav",
842 { "models/powerups/orb/r_orb.md3",
843 NULL, NULL, NULL },
844 /* icon */ "icons/iconh_rorb",
845 /* pickup */ "Red Cube",
846 0,
847 IT_TEAM,
848 0,
849 /* precache */ "",
850 /* sounds */ ""
851 },
852
853 {
854 "item_bluecube",
855 "sound/misc/am_pkup.wav",
856 { "models/powerups/orb/b_orb.md3",
857 NULL, NULL, NULL },
858 /* icon */ "icons/iconh_borb",
859 /* pickup */ "Blue Cube",
860 0,
861 IT_TEAM,
862 0,
863 /* precache */ "",
864 /* sounds */ ""
865 },
866 /*QUAKED weapon_nailgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
867 */
868 {
869 "weapon_nailgun",
870 "sound/misc/w_pkup.wav",
871 { "models/weapons/nailgun/nailgun.md3",
872 NULL, NULL, NULL},
873 /* icon */ "icons/iconw_nailgun",
874 /* pickup */ "Nailgun",
875 10,
876 IT_WEAPON,
877 WP_NAILGUN,
878 /* precache */ "",
879 /* sounds */ ""
880 },
881
882 /*QUAKED weapon_prox_launcher (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
883 */
884 {
885 "weapon_prox_launcher",
886 "sound/misc/w_pkup.wav",
887 { "models/weapons/proxmine/proxmine.md3",
888 NULL, NULL, NULL},
889 /* icon */ "icons/iconw_proxlauncher",
890 /* pickup */ "Prox Launcher",
891 5,
892 IT_WEAPON,
893 WP_PROX_LAUNCHER,
894 /* precache */ "",
895 /* sounds */ "sound/weapons/proxmine/wstbtick.wav "
896 "sound/weapons/proxmine/wstbactv.wav "
897 "sound/weapons/proxmine/wstbimpl.wav "
898 "sound/weapons/proxmine/wstbimpm.wav "
899 "sound/weapons/proxmine/wstbimpd.wav "
900 "sound/weapons/proxmine/wstbactv.wav"
901 },
902
903 /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
904 */
905 {
906 "weapon_chaingun",
907 "sound/misc/w_pkup.wav",
908 { "models/weapons/vulcan/vulcan.md3",
909 NULL, NULL, NULL},
910 /* icon */ "icons/iconw_chaingun",
911 /* pickup */ "Chaingun",
912 80,
913 IT_WEAPON,
914 WP_CHAINGUN,
915 /* precache */ "",
916 /* sounds */ "sound/weapons/vulcan/wvulwind.wav"
917 },
918 //#endif
919
920 /*QUAKED team_DD_point
921 Only in DD games
922 */
923 {
924 "team_DD_pointAblue",
925 NULL,
926 { "models/dpoints/a_blue.md3",
927 NULL, NULL, NULL },
928 /* icon */ "icons/icona_blue",
929 /* pickup */ "Point A (Blue)",
930 0,
931 IT_TEAM,
932 DD_POINTABLUE,
933 /* precache */ "",
934 /* sounds */ ""
935 },
936
937 /*QUAKED team_DD_point
938 Only in DD games
939 */
940 {
941 "team_DD_pointBblue",
942 NULL,
943 { "models/dpoints/b_blue.md3",
944 NULL, NULL, NULL },
945 /* icon */ "icons/iconb_blue",
946 /* pickup */ "Point B (Blue)",
947 0,
948 IT_TEAM,
949 DD_POINTBBLUE,
950 /* precache */ "",
951 /* sounds */ ""
952 },
953
954 /*QUAKED team_DD_point
955 Only in DD games
956 */
957 {
958 "team_DD_pointAred",
959 NULL,
960 { "models/dpoints/a_red.md3",
961 NULL, NULL, NULL },
962 /* icon */ "icons/icona_red",
963 /* pickup */ "Point A (Red)",
964 0,
965 IT_TEAM,
966 DD_POINTARED,
967 /* precache */ "",
968 /* sounds */ ""
969 },
970
971 /*QUAKED team_DD_point
972 Only in DD games
973 */
974 {
975 "team_DD_pointBred",
976 NULL,
977 { "models/dpoints/b_red.md3",
978 NULL, NULL, NULL },
979 /* icon */ "icons/iconb_red",
980 /* pickup */ "Point B (Red)",
981 0,
982 IT_TEAM,
983 DD_POINTBRED,
984 /* precache */ "",
985 /* sounds */ ""
986 },
987
988 /*QUAKED team_DD_point
989 Only in DD games
990 */
991 {
992 "team_DD_pointAwhite",
993 NULL,
994 { "models/dpoints/a_white.md3",
995 NULL, NULL, NULL },
996 /* icon */ "icons/icona_white",
997 /* pickup */ "Point A (White)",
998 0,
999 IT_TEAM,
1000 DD_POINTAWHITE,
1001 /* precache */ "",
1002 /* sounds */ ""
1003 },
1004
1005 /*QUAKED team_DD_point
1006 Only in DD games
1007 */
1008 {
1009 "team_DD_pointBwhite",
1010 NULL,
1011 { "models/dpoints/b_white.md3",
1012 NULL, NULL, NULL },
1013 /* icon */ "icons/iconb_white",
1014 /* pickup */ "Point B (White)",
1015 0,
1016 IT_TEAM,
1017 DD_POINTBWHITE,
1018 /* precache */ "",
1019 /* sounds */ ""
1020 },
1021
1022 //Now things for standard domination:
1023
1024
1025 /*QUAKED
1026 Only in Domination games
1027 */
1028 {
1029 "team_dom_pointWhite",
1030 NULL,
1031 { "models/flags/n_flag.md3",
1032 NULL, NULL, NULL },
1033 /* icon */ "icons/iconf_neutral1",
1034 /* pickup */ "Neutral domination point",
1035 0,
1036 IT_TEAM,
1037 DOM_POINTWHITE,
1038 /* precache */ "",
1039 /* sounds */ ""
1040 },
1041
1042 /*QUAKED
1043 Only in Domination games
1044 */
1045 {
1046 "team_dom_pointRed",
1047 NULL,
1048 { "models/flags/r_flag.md3",
1049 NULL, NULL, NULL },
1050 /* icon */ "icons/iconf_red1",
1051 /* pickup */ "Red domination point",
1052 0,
1053 IT_TEAM,
1054 DOM_POINTRED,
1055 /* precache */ "",
1056 /* sounds */ ""
1057 },
1058
1059 /*QUAKED
1060 Only in Domination games
1061 */
1062 {
1063 "team_dom_pointBlue",
1064 NULL,
1065 { "models/flags/b_flag.md3",
1066 NULL, NULL, NULL },
1067 /* icon */ "icons/iconf_blu1",
1068 /* pickup */ "Blue domination point",
1069 0,
1070 IT_TEAM,
1071 DOM_POINTBLUE,
1072 /* precache */ "",
1073 /* sounds */ ""
1074 },
1075
1076 // end of list marker
1077 {NULL}
1078 };
1079
1080 int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
1081
1082
1083 /*
1084 ==============
1085 BG_FindItemForPowerup
1086 ==============
1087 */
1088 gitem_t *BG_FindItemForPowerup( powerup_t pw ) {
1089 int i;
1090
1091 for ( i = 0 ; i < bg_numItems ; i++ ) {
1092 if ( (bg_itemlist[i].giType == IT_POWERUP ||
1093 bg_itemlist[i].giType == IT_TEAM ||
1094 bg_itemlist[i].giType == IT_PERSISTANT_POWERUP) &&
1095 bg_itemlist[i].giTag == pw ) {
1096 return &bg_itemlist[i];
1097 }
1098 }
1099
1100 return NULL;
1101 }
1102
1103
1104 /*
1105 ==============
1106 BG_FindItemForHoldable
1107 ==============
1108 */
1109 gitem_t *BG_FindItemForHoldable( holdable_t pw ) {
1110 int i;
1111
1112 for ( i = 0 ; i < bg_numItems ; i++ ) {
1113 if ( bg_itemlist[i].giType == IT_HOLDABLE && bg_itemlist[i].giTag == pw ) {
1114 return &bg_itemlist[i];
1115 }
1116 }
1117
1118 Com_Error( ERR_DROP, "HoldableItem not found" );
1119
1120 return NULL;
1121 }
1122
1123
1124 /*
1125 ===============
1126 BG_FindItemForWeapon
1127
1128 ===============
1129 */
1130 gitem_t *BG_FindItemForWeapon( weapon_t weapon ) {
1131 gitem_t *it;
1132
1133 for ( it = bg_itemlist + 1 ; it->classname ; it++) {
1134 if ( it->giType == IT_WEAPON && it->giTag == weapon ) {
1135 return it;
1136 }
1137 }
1138
1139 Com_Error( ERR_DROP, "Couldn't find item for weapon %i", weapon);
1140 return NULL;
1141 }
1142
1143 /*
1144 ===============
1145 BG_FindItem
1146
1147 ===============
1148 */
1149 gitem_t *BG_FindItem( const char *pickupName ) {
1150 gitem_t *it;
1151
1152 for ( it = bg_itemlist + 1 ; it->classname ; it++ ) {
1153 if ( !Q_stricmp( it->pickup_name, pickupName ) )
1154 return it;
1155 }
1156
1157 return NULL;
1158 }
1159
1160 /*
1161 ============
1162 BG_PlayerTouchesItem
1163
1164 Items can be picked up without actually touching their physical bounds to make
1165 grabbing them easier
1166 ============
1167 */
1168 qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime ) {
1169 vec3_t origin;
1170
1171 BG_EvaluateTrajectory( &item->pos, atTime, origin );
1172
1173 // we are ignoring ducked differences here
1174 if ( ps->origin[0] - origin[0] > 44
1175 || ps->origin[0] - origin[0] < -50
1176 || ps->origin[1] - origin[1] > 36
1177 || ps->origin[1] - origin[1] < -36
1178 || ps->origin[2] - origin[2] > 36
1179 || ps->origin[2] - origin[2] < -36 ) {
1180 return qfalse;
1181 }
1182
1183 return qtrue;
1184 }
1185
1186
1187
1188 /*
1189 ================
1190 BG_CanItemBeGrabbed
1191
1192 Returns false if the item should not be picked up.
1193 This needs to be the same for client side prediction and server use.
1194 ================
1195 */
1196 qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const playerState_t *ps ) {
1197 gitem_t *item;
1198 int upperBound;
1199
1200 if ( ent->modelindex < 1 || ent->modelindex >= bg_numItems ) {
1201 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: index out of range" );
1202 }
1203
1204 item = &bg_itemlist[ent->modelindex];
1205
1206 switch( item->giType ) {
1207 case IT_WEAPON:
1208 return qtrue; // weapons are always picked up
1209
1210 case IT_AMMO:
1211 if ( ps->ammo[ item->giTag ] >= 200 ) {
1212 return qfalse; // can't hold any more
1213 }
1214 return qtrue;
1215
1216 case IT_ARMOR:
1217 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_SCOUT ) {
1218 return qfalse;
1219 }
1220
1221 // we also clamp armor to the maxhealth for handicapping
1222 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) {
1223 upperBound = ps->stats[STAT_MAX_HEALTH];
1224 }
1225 else {
1226 upperBound = ps->stats[STAT_MAX_HEALTH] * 2;
1227 }
1228
1229 if ( ps->stats[STAT_ARMOR] >= upperBound ) {
1230 return qfalse;
1231 }
1232 return qtrue;
1233
1234 case IT_HEALTH:
1235 // small and mega healths will go over the max, otherwise
1236 // don't pick up if already at max
1237 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) {
1238 upperBound = ps->stats[STAT_MAX_HEALTH];
1239 }
1240 else
1241 if ( item->quantity == 5 || item->quantity == 100 ) {
1242 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] * 2 ) {
1243 return qfalse;
1244 }
1245 return qtrue;
1246 }
1247
1248 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] ) {
1249 return qfalse;
1250 }
1251 return qtrue;
1252
1253 case IT_POWERUP:
1254 return qtrue; // powerups are always picked up
1255
1256 case IT_PERSISTANT_POWERUP:
1257
1258 //In Double D we don't want persistant Powerups (or maybe, can be discussed)
1259 if(gametype == GT_DOUBLE_D)
1260 return qfalse;
1261
1262 // can only hold one item at a time
1263 if ( ps->stats[STAT_PERSISTANT_POWERUP] ) {
1264 return qfalse;
1265 }
1266
1267 // check team only
1268 if( ( ent->generic1 & 2 ) && ( ps->persistant[PERS_TEAM] != TEAM_RED ) ) {
1269 return qfalse;
1270 }
1271 if( ( ent->generic1 & 4 ) && ( ps->persistant[PERS_TEAM] != TEAM_BLUE ) ) {
1272 return qfalse;
1273 }
1274
1275 return qtrue;
1276
1277 case IT_TEAM: // team items, such as flags
1278 if( gametype == GT_1FCTF ) {
1279 // neutral flag can always be picked up
1280 if( item->giTag == PW_NEUTRALFLAG ) {
1281 return qtrue;
1282 }
1283 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1284 if (item->giTag == PW_BLUEFLAG && ps->powerups[PW_NEUTRALFLAG] ) {
1285 return qtrue;
1286 }
1287 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1288 if (item->giTag == PW_REDFLAG && ps->powerups[PW_NEUTRALFLAG] ) {
1289 return qtrue;
1290 }
1291 }
1292 }
1293 if( gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) {
1294 // ent->modelindex2 is non-zero on items if they are dropped
1295 // we need to know this because we can pick up our dropped flag (and return it)
1296 // but we can't pick up our flag at base
1297 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1298 if (item->giTag == PW_BLUEFLAG ||
1299 (item->giTag == PW_REDFLAG && ent->modelindex2) ||
1300 (item->giTag == PW_REDFLAG && ps->powerups[PW_BLUEFLAG]) )
1301 return qtrue;
1302 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1303 if (item->giTag == PW_REDFLAG ||
1304 (item->giTag == PW_BLUEFLAG && ent->modelindex2) ||
1305 (item->giTag == PW_BLUEFLAG && ps->powerups[PW_REDFLAG]) )
1306 return qtrue;
1307 }
1308 }
1309
1310 if( gametype == GT_DOUBLE_D) {
1311 //We can touch both flags
1312 if(item->giTag == PW_BLUEFLAG || item->giTag == PW_REDFLAG)
1313 return qtrue;
1314 }
1315
1316 if( gametype == GT_DOMINATION ) {
1317 if(item->giTag == DOM_POINTWHITE)
1318 return qtrue;
1319 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1320 if(item->giTag == DOM_POINTBLUE)
1321 return qtrue;
1322 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1323 if(item->giTag == DOM_POINTRED)
1324 return qtrue;
1325 }
1326 }
1327
1328 if( gametype == GT_HARVESTER ) {
1329 return qtrue;
1330 }
1331 return qfalse;
1332
1333 case IT_HOLDABLE:
1334 // can only hold one item at a time
1335 if ( ps->stats[STAT_HOLDABLE_ITEM] ) {
1336 return qfalse;
1337 }
1338 return qtrue;
1339
1340 case IT_BAD:
1341 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
1342 default:
1343 #ifndef Q3_VM
1344 #ifndef NDEBUG // bk0001204
1345 Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
1346 #endif
1347 #endif
1348 break;
1349 }
1350
1351 return qfalse;
1352 }
1353
1354 //======================================================================
1355
1356 /*
1357 ================
1358 BG_EvaluateTrajectory
1359
1360 ================
1361 */
1362 void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ) {
1363 float deltaTime;
1364 float phase;
1365
1366 switch( tr->trType ) {
1367 case TR_STATIONARY:
1368 case TR_INTERPOLATE:
1369 VectorCopy( tr->trBase, result );
1370 break;
1371 case TR_LINEAR:
1372 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1373 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1374 break;
1375 case TR_SINE:
1376 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
1377 phase = sin( deltaTime * M_PI * 2 );
1378 VectorMA( tr->trBase, phase, tr->trDelta, result );
1379 break;
1380 case TR_LINEAR_STOP:
1381 if ( atTime > tr->trTime + tr->trDuration ) {
1382 atTime = tr->trTime + tr->trDuration;
1383 }
1384 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1385 if ( deltaTime < 0 ) {
1386 deltaTime = 0;
1387 }
1388 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1389 break;
1390 case TR_GRAVITY:
1391 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1392 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1393 result[2] -= 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
1394 break;
1395 default:
1396 Com_Error( ERR_DROP, "BG_EvaluateTrajectory: unknown trType: %i", tr->trTime );
1397 break;
1398 }
1399 }
1400
1401 /*
1402 ================
1403 BG_EvaluateTrajectoryDelta
1404
1405 For determining velocity at a given time
1406 ================
1407 */
1408 void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result ) {
1409 float deltaTime;
1410 float phase;
1411
1412 switch( tr->trType ) {
1413 case TR_STATIONARY:
1414 case TR_INTERPOLATE:
1415 VectorClear( result );
1416 break;
1417 case TR_LINEAR:
1418 VectorCopy( tr->trDelta, result );
1419 break;
1420 case TR_SINE:
1421 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
1422 phase = cos( deltaTime * M_PI * 2 ); // derivative of sin = cos
1423 phase *= 0.5;
1424 VectorScale( tr->trDelta, phase, result );
1425 break;
1426 case TR_LINEAR_STOP:
1427 if ( atTime > tr->trTime + tr->trDuration ) {
1428 VectorClear( result );
1429 return;
1430 }
1431 VectorCopy( tr->trDelta, result );
1432 break;
1433 case TR_GRAVITY:
1434 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1435 VectorCopy( tr->trDelta, result );
1436 result[2] -= DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
1437 break;
1438 default:
1439 Com_Error( ERR_DROP, "BG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trTime );
1440 break;
1441 }
1442 }
1443
1444 char *eventnames[] = {
1445 "EV_NONE",
1446
1447 "EV_FOOTSTEP",
1448 "EV_FOOTSTEP_METAL",
1449 "EV_FOOTSPLASH",
1450 "EV_FOOTWADE",
1451 "EV_SWIM",
1452
1453 "EV_STEP_4",
1454 "EV_STEP_8",
1455 "EV_STEP_12",
1456 "EV_STEP_16",
1457
1458 "EV_FALL_SHORT",
1459 "EV_FALL_MEDIUM",
1460 "EV_FALL_FAR",
1461
1462 "EV_JUMP_PAD", // boing sound at origin", jump sound on player
1463
1464 "EV_JUMP",
1465 "EV_WATER_TOUCH", // foot touches
1466 "EV_WATER_LEAVE", // foot leaves
1467 "EV_WATER_UNDER", // head touches
1468 "EV_WATER_CLEAR", // head leaves
1469
1470 "EV_ITEM_PICKUP", // normal item pickups are predictable
1471 "EV_GLOBAL_ITEM_PICKUP", // powerup / team sounds are broadcast to everyone
1472
1473 "EV_NOAMMO",
1474 "EV_CHANGE_WEAPON",
1475 "EV_FIRE_WEAPON",
1476
1477 "EV_USE_ITEM0",
1478 "EV_USE_ITEM1",
1479 "EV_USE_ITEM2",
1480 "EV_USE_ITEM3",
1481 "EV_USE_ITEM4",
1482 "EV_USE_ITEM5",
1483 "EV_USE_ITEM6",
1484 "EV_USE_ITEM7",
1485 "EV_USE_ITEM8",
1486 "EV_USE_ITEM9",
1487 "EV_USE_ITEM10",
1488 "EV_USE_ITEM11",
1489 "EV_USE_ITEM12",
1490 "EV_USE_ITEM13",
1491 "EV_USE_ITEM14",
1492 "EV_USE_ITEM15",
1493
1494 "EV_ITEM_RESPAWN",
1495 "EV_ITEM_POP",
1496 "EV_PLAYER_TELEPORT_IN",
1497 "EV_PLAYER_TELEPORT_OUT",
1498
1499 "EV_GRENADE_BOUNCE", // eventParm will be the soundindex
1500
1501 "EV_GENERAL_SOUND",
1502 "EV_GLOBAL_SOUND", // no attenuation
1503 "EV_GLOBAL_TEAM_SOUND",
1504
1505 "EV_BULLET_HIT_FLESH",
1506 "EV_BULLET_HIT_WALL",
1507
1508 "EV_MISSILE_HIT",
1509 "EV_MISSILE_MISS",
1510 "EV_MISSILE_MISS_METAL",
1511 "EV_RAILTRAIL",
1512 "EV_SHOTGUN",
1513 "EV_BULLET", // otherEntity is the shooter
1514
1515 "EV_PAIN",
1516 "EV_DEATH1",
1517 "EV_DEATH2",
1518 "EV_DEATH3",
1519 "EV_OBITUARY",
1520
1521 "EV_POWERUP_QUAD",
1522 "EV_POWERUP_BATTLESUIT",
1523 "EV_POWERUP_REGEN",
1524
1525 "EV_GIB_PLAYER", // gib a previously living player
1526 "EV_SCOREPLUM", // score plum
1527
1528 //Not all of these are used in baseoa but we keep them to gurantie event numbers between version
1529 "EV_PROXIMITY_MINE_STICK",
1530 "EV_PROXIMITY_MINE_TRIGGER",
1531 "EV_KAMIKAZE", // kamikaze explodes
1532 "EV_OBELISKEXPLODE", // obelisk explodes
1533 "EV_INVUL_IMPACT", // invulnerability sphere impact
1534 "EV_JUICED", // invulnerability juiced effect
1535 "EV_LIGHTNINGBOLT", // lightning bolt bounced of invulnerability sphere
1536
1537
1538 "EV_DEBUG_LINE",
1539 "EV_STOPLOOPINGSOUND",
1540 "EV_TAUNT"
1541
1542 };
1543
1544 /*
1545 ===============
1546 BG_AddPredictableEventToPlayerstate
1547
1548 Handles the sequence numbers
1549 ===============
1550 */
1551
1552 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
1553
1554 void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps ) {
1555
1556 #ifdef _DEBUG
1557 {
1558 char buf[256];
1559 trap_Cvar_VariableStringBuffer("showevents", buf, sizeof(buf));
1560 if ( atof(buf) != 0 ) {
1561 #ifdef QAGAME
1562 Com_Printf(" game event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
1563 #else
1564 Com_Printf("Cgame event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
1565 #endif
1566 }
1567 }
1568 #endif
1569 ps->events[ps->eventSequence & (MAX_PS_EVENTS-1)] = newEvent;
1570 ps->eventParms[ps->eventSequence & (MAX_PS_EVENTS-1)] = eventParm;
1571 ps->eventSequence++;
1572 }
1573
1574 /*
1575 ========================
1576 BG_TouchJumpPad
1577 ========================
1578 */
1579 void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad ) {
1580 vec3_t angles;
1581 float p;
1582 int effectNum;
1583
1584 // spectators don't use jump pads
1585 if ( ps->pm_type != PM_NORMAL ) {
1586 return;
1587 }
1588
1589 // flying characters don't hit bounce pads
1590 if ( ps->powerups[PW_FLIGHT] ) {
1591 return;
1592 }
1593
1594 // if we didn't hit this same jumppad the previous frame
1595 // then don't play the event sound again if we are in a fat trigger
1596 if ( ps->jumppad_ent != jumppad->number ) {
1597
1598 vectoangles( jumppad->origin2, angles);
1599 p = fabs( AngleNormalize180( angles[PITCH] ) );
1600 if( p < 45 ) {
1601 effectNum = 0;
1602 } else {
1603 effectNum = 1;
1604 }
1605 BG_AddPredictableEventToPlayerstate( EV_JUMP_PAD, effectNum, ps );
1606 }
1607 // remember hitting this jumppad this frame
1608 ps->jumppad_ent = jumppad->number;
1609 ps->jumppad_frame = ps->pmove_framecount;
1610 // give the player the velocity from the jumppad
1611 VectorCopy( jumppad->origin2, ps->velocity );
1612 }
1613
1614 /*
1615 ========================
1616 BG_PlayerStateToEntityState
1617
1618 This is done after each set of usercmd_t on the server,
1619 and after local prediction on the client
1620 ========================
1621 */
1622 void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap ) {
1623 int i;
1624
1625 if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR ) {
1626 s->eType = ET_INVISIBLE;
1627 } else if ( ps->stats[STAT_HEALTH] <= GIB_HEALTH ) {
1628 s->eType = ET_INVISIBLE;
1629 } else {
1630 s->eType = ET_PLAYER;
1631 }
1632
1633 s->number = ps->clientNum;
1634
1635 s->pos.trType = TR_INTERPOLATE;
1636 VectorCopy( ps->origin, s->pos.trBase );
1637 if ( snap ) {
1638 SnapVector( s->pos.trBase );
1639 }
1640 // set the trDelta for flag direction
1641 VectorCopy( ps->velocity, s->pos.trDelta );
1642
1643 s->apos.trType = TR_INTERPOLATE;
1644 VectorCopy( ps->viewangles, s->apos.trBase );
1645 if ( snap ) {
1646 SnapVector( s->apos.trBase );
1647 }
1648
1649 s->angles2[YAW] = ps->movementDir;
1650 s->legsAnim = ps->legsAnim;
1651 s->torsoAnim = ps->torsoAnim;
1652 s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
1653 // so corpses can also reference the proper config
1654 s->eFlags = ps->eFlags;
1655 if ( ps->stats[STAT_HEALTH] <= 0 ) {
1656 s->eFlags |= EF_DEAD;
1657 } else {
1658 s->eFlags &= ~EF_DEAD;
1659 }
1660
1661 if ( ps->externalEvent ) {
1662 s->event = ps->externalEvent;
1663 s->eventParm = ps->externalEventParm;
1664 } else if ( ps->entityEventSequence < ps->eventSequence ) {
1665 int seq;
1666
1667 if ( ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
1668 ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
1669 }
1670 seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
1671 s->event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
1672 s->eventParm = ps->eventParms[ seq ];
1673 ps->entityEventSequence++;
1674 }
1675
1676 s->weapon = ps->weapon;
1677 s->groundEntityNum = ps->groundEntityNum;
1678
1679 s->powerups = 0;
1680 for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {
1681 if ( ps->powerups[ i ] ) {
1682 s->powerups |= 1 << i;
1683 }
1684 }
1685
1686 s->loopSound = ps->loopSound;
1687 s->generic1 = ps->generic1;
1688 }
1689
1690 /*
1691 ========================
1692 BG_PlayerStateToEntityStateExtraPolate
1693
1694 This is done after each set of usercmd_t on the server,
1695 and after local prediction on the client
1696 ========================
1697 */
1698 void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap ) {
1699 int i;
1700
1701 if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR ) {
1702 s->eType = ET_INVISIBLE;
1703 } else if ( ps->stats[STAT_HEALTH] <= GIB_HEALTH ) {
1704 s->eType = ET_INVISIBLE;
1705 } else {
1706 s->eType = ET_PLAYER;
1707 }
1708
1709 s->number = ps->clientNum;
1710
1711 s->pos.trType = TR_LINEAR_STOP;
1712 VectorCopy( ps->origin, s->pos.trBase );
1713 if ( snap ) {
1714 SnapVector( s->pos.trBase );
1715 }
1716 // set the trDelta for flag direction and linear prediction
1717 VectorCopy( ps->velocity, s->pos.trDelta );
1718 // set the time for linear prediction
1719 s->pos.trTime = time;
1720 // set maximum extra polation time
1721 s->pos.trDuration = 50; // 1000 / sv_fps (default = 20)
1722
1723 s->apos.trType = TR_INTERPOLATE;
1724 VectorCopy( ps->viewangles, s->apos.trBase );
1725 if ( snap ) {
1726 SnapVector( s->apos.trBase );
1727 }
1728
1729 s->angles2[YAW] = ps->movementDir;
1730 s->legsAnim = ps->legsAnim;
1731 s->torsoAnim = ps->torsoAnim;
1732 s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
1733 // so corpses can also reference the proper config
1734 s->eFlags = ps->eFlags;
1735 if ( ps->stats[STAT_HEALTH] <= 0 ) {
1736 s->eFlags |= EF_DEAD;
1737 } else {
1738 s->eFlags &= ~EF_DEAD;
1739 }
1740
1741 if ( ps->externalEvent ) {
1742 s->event = ps->externalEvent;
1743 s->eventParm = ps->externalEventParm;
1744 } else if ( ps->entityEventSequence < ps->eventSequence ) {
1745 int seq;
1746
1747 if ( ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
1748 ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
1749 }
1750 seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
1751 s->event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
1752 s->eventParm = ps->eventParms[ seq ];
1753 ps->entityEventSequence++;
1754 }
1755
1756 s->weapon = ps->weapon;
1757 s->groundEntityNum = ps->groundEntityNum;
1758
1759 s->powerups = 0;
1760 for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {
1761 if ( ps->powerups[ i ] ) {
1762 s->powerups |= 1 << i;
1763 }
1764 }
1765
1766 s->loopSound = ps->loopSound;
1767 s->generic1 = ps->generic1;
1768 }
1769
1770 /*
1771 ============
1772 BG_TeamName
1773 KK-OAX Copied from Tremulous
1774 ============
1775 */
1776 char *BG_TeamName( team_t team )
1777 {
1778 if( team == TEAM_NONE )
1779 return "spectator";
1780 if( team == TEAM_RED )
1781 return "Red";
1782 if( team == TEAM_BLUE )
1783 return "Blue";
1784 if( team == TEAM_FREE )
1785 return "Free For All";
1786 return "<team>";
1787 }