Debian Codegraph @

code/game/bg_misc.c

raw ◀ ▶
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 #ifdef HAVE_MISSIONPACK_ITEMLIST
659 /*QUAKED holdable_kamikaze (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
660 */
661 {
662 "holdable_kamikaze",
663 "sound/items/holdable.wav",
664 { "models/powerups/kamikazi.md3",
665 NULL, NULL, NULL},
666 /* icon */ "icons/kamikaze",
667 /* pickup */ "Kamikaze",
668 60,
669 IT_HOLDABLE,
670 HI_KAMIKAZE,
671 /* precache */ "",
672 /* sounds */ "sound/items/kamikazerespawn.wav"
673 },
674
675 /*QUAKED holdable_portal (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
676 */
677 {
678 "holdable_portal",
679 "sound/items/holdable.wav",
680 { "models/powerups/holdable/porter.md3",
681 NULL, NULL, NULL},
682 /* icon */ "icons/portal",
683 /* pickup */ "Portal",
684 60,
685 IT_HOLDABLE,
686 HI_PORTAL,
687 /* precache */ "",
688 /* sounds */ ""
689 },
690
691 /*QUAKED holdable_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
692 */
693 {
694 "holdable_invulnerability",
695 "sound/items/holdable.wav",
696 { "models/powerups/holdable/invulnerability.md3",
697 NULL, NULL, NULL},
698 /* icon */ "icons/invulnerability",
699 /* pickup */ "Invulnerability",
700 60,
701 IT_HOLDABLE,
702 HI_INVULNERABILITY,
703 /* precache */ "",
704 /* sounds */ ""
705 },
•706 #endif
707
708 /*QUAKED ammo_nails (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
709 */
710 {
711 "ammo_nails",
712 "sound/misc/am_pkup.wav",
713 { "models/powerups/ammo/nailgunam.md3",
714 NULL, NULL, NULL},
715 /* icon */ "icons/icona_nailgun",
716 /* pickup */ "Nails",
717 20,
718 IT_AMMO,
719 WP_NAILGUN,
720 /* precache */ "",
721 /* sounds */ ""
722 },
723
724 /*QUAKED ammo_mines (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
725 */
726 {
727 "ammo_mines",
728 "sound/misc/am_pkup.wav",
729 { "models/powerups/ammo/proxmineam.md3",
730 NULL, NULL, NULL},
731 /* icon */ "icons/icona_proxlauncher",
732 /* pickup */ "Proximity Mines",
733 10,
734 IT_AMMO,
735 WP_PROX_LAUNCHER,
736 /* precache */ "",
737 /* sounds */ ""
738 },
739
740 /*QUAKED ammo_belt (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
741 */
742 {
743 "ammo_belt",
744 "sound/misc/am_pkup.wav",
745 { "models/powerups/ammo/chaingunam.md3",
746 NULL, NULL, NULL},
747 /* icon */ "icons/icona_chaingun",
748 /* pickup */ "Chaingun Belt",
749 100,
750 IT_AMMO,
751 WP_CHAINGUN,
752 /* precache */ "",
753 /* sounds */ ""
754 },
755
•756 #ifdef HAVE_MISSIONPACK_ITEMLIST
757 //
758 // PERSISTANT POWERUP ITEMS
759 //
760 /*QUAKED item_scout (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
761 */
762 {
763 "item_scout",
764 "sound/items/scout.wav",
765 { "models/powerups/scout.md3",
766 NULL, NULL, NULL },
767 /* icon */ "icons/scout",
768 /* pickup */ "Scout",
769 30,
770 IT_PERSISTANT_POWERUP,
771 PW_SCOUT,
772 /* precache */ "",
773 /* sounds */ ""
774 },
775
776 /*QUAKED item_guard (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
777 */
778 {
779 "item_guard",
780 "sound/items/guard.wav",
781 { "models/powerups/guard.md3",
782 NULL, NULL, NULL },
783 /* icon */ "icons/guard",
784 /* pickup */ "Guard",
785 30,
786 IT_PERSISTANT_POWERUP,
787 PW_GUARD,
788 /* precache */ "",
789 /* sounds */ ""
790 },
791
792 /*QUAKED item_doubler (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
793 */
794 {
795 "item_doubler",
796 "sound/items/doubler.wav",
797 { "models/powerups/doubler.md3",
798 NULL, NULL, NULL },
799 /* icon */ "icons/doubler",
800 /* pickup */ "Doubler",
801 30,
802 IT_PERSISTANT_POWERUP,
803 PW_DOUBLER,
804 /* precache */ "",
805 /* sounds */ ""
806 },
807
808 /*QUAKED item_doubler (.3 .3 1) (-16 -16 -16) (16 16 16) suspended redTeam blueTeam
809 */
810 {
811 "item_ammoregen",
812 "sound/items/ammoregen.wav",
813 { "models/powerups/ammo.md3",
814 NULL, NULL, NULL },
815 /* icon */ "icons/ammo_regen",
816 /* pickup */ "Ammo Regen",
817 30,
818 IT_PERSISTANT_POWERUP,
819 PW_AMMOREGEN,
820 /* precache */ "",
821 /* sounds */ ""
822 },
•823 #endif
824
825
826 /*QUAKED team_CTF_neutralflag (0 0 1) (-16 -16 -16) (16 16 16)
827 Only in One Flag CTF games
828 */
829 {
830 "team_CTF_neutralflag",
831 NULL,
832 { "models/flags/n_flag.md3",
833 NULL, NULL, NULL },
834 /* icon */ "icons/iconf_neutral1",
835 /* pickup */ "Neutral Flag",
836 0,
837 IT_TEAM,
838 PW_NEUTRALFLAG,
839 /* precache */ "",
840 /* sounds */ ""
841 },
842
843 {
844 "item_redcube",
845 "sound/misc/am_pkup.wav",
846 { "models/powerups/orb/r_orb.md3",
847 NULL, NULL, NULL },
848 /* icon */ "icons/iconh_rorb",
849 /* pickup */ "Red Cube",
850 0,
851 IT_TEAM,
852 0,
853 /* precache */ "",
854 /* sounds */ ""
855 },
856
857 {
858 "item_bluecube",
859 "sound/misc/am_pkup.wav",
860 { "models/powerups/orb/b_orb.md3",
861 NULL, NULL, NULL },
862 /* icon */ "icons/iconh_borb",
863 /* pickup */ "Blue Cube",
864 0,
865 IT_TEAM,
866 0,
867 /* precache */ "",
868 /* sounds */ ""
869 },
870 /*QUAKED weapon_nailgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
871 */
872 {
873 "weapon_nailgun",
874 "sound/misc/w_pkup.wav",
875 { "models/weapons/nailgun/nailgun.md3",
876 NULL, NULL, NULL},
877 /* icon */ "icons/iconw_nailgun",
878 /* pickup */ "Nailgun",
879 10,
880 IT_WEAPON,
881 WP_NAILGUN,
882 /* precache */ "",
883 /* sounds */ ""
884 },
885
886 /*QUAKED weapon_prox_launcher (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
887 */
888 {
889 "weapon_prox_launcher",
890 "sound/misc/w_pkup.wav",
891 { "models/weapons/proxmine/proxmine.md3",
892 NULL, NULL, NULL},
893 /* icon */ "icons/iconw_proxlauncher",
894 /* pickup */ "Prox Launcher",
895 5,
896 IT_WEAPON,
897 WP_PROX_LAUNCHER,
898 /* precache */ "",
899 /* sounds */ "sound/weapons/proxmine/wstbtick.wav "
900 "sound/weapons/proxmine/wstbactv.wav "
901 "sound/weapons/proxmine/wstbimpl.wav "
902 "sound/weapons/proxmine/wstbimpm.wav "
903 "sound/weapons/proxmine/wstbimpd.wav "
904 "sound/weapons/proxmine/wstbactv.wav"
905 },
906
907 /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
908 */
909 {
910 "weapon_chaingun",
911 "sound/misc/w_pkup.wav",
912 { "models/weapons/vulcan/vulcan.md3",
913 NULL, NULL, NULL},
914 /* icon */ "icons/iconw_chaingun",
915 /* pickup */ "Chaingun",
916 80,
917 IT_WEAPON,
918 WP_CHAINGUN,
919 /* precache */ "",
920 /* sounds */ "sound/weapons/vulcan/wvulwind.wav"
921 },
922 //#endif
923
924 /*QUAKED team_DD_point
925 Only in DD games
926 */
927 {
928 "team_DD_pointAblue",
929 NULL,
930 { "models/dpoints/a_blue.md3",
931 NULL, NULL, NULL },
932 /* icon */ "icons/icona_blue",
933 /* pickup */ "Point A (Blue)",
934 0,
935 IT_TEAM,
936 DD_POINTABLUE,
937 /* precache */ "",
938 /* sounds */ ""
939 },
940
941 /*QUAKED team_DD_point
942 Only in DD games
943 */
944 {
945 "team_DD_pointBblue",
946 NULL,
947 { "models/dpoints/b_blue.md3",
948 NULL, NULL, NULL },
949 /* icon */ "icons/iconb_blue",
950 /* pickup */ "Point B (Blue)",
951 0,
952 IT_TEAM,
953 DD_POINTBBLUE,
954 /* precache */ "",
955 /* sounds */ ""
956 },
957
958 /*QUAKED team_DD_point
959 Only in DD games
960 */
961 {
962 "team_DD_pointAred",
963 NULL,
964 { "models/dpoints/a_red.md3",
965 NULL, NULL, NULL },
966 /* icon */ "icons/icona_red",
967 /* pickup */ "Point A (Red)",
968 0,
969 IT_TEAM,
970 DD_POINTARED,
971 /* precache */ "",
972 /* sounds */ ""
973 },
974
975 /*QUAKED team_DD_point
976 Only in DD games
977 */
978 {
979 "team_DD_pointBred",
980 NULL,
981 { "models/dpoints/b_red.md3",
982 NULL, NULL, NULL },
983 /* icon */ "icons/iconb_red",
984 /* pickup */ "Point B (Red)",
985 0,
986 IT_TEAM,
987 DD_POINTBRED,
988 /* precache */ "",
989 /* sounds */ ""
990 },
991
992 /*QUAKED team_DD_point
993 Only in DD games
994 */
995 {
996 "team_DD_pointAwhite",
997 NULL,
998 { "models/dpoints/a_white.md3",
999 NULL, NULL, NULL },
1000 /* icon */ "icons/icona_white",
1001 /* pickup */ "Point A (White)",
1002 0,
1003 IT_TEAM,
1004 DD_POINTAWHITE,
1005 /* precache */ "",
1006 /* sounds */ ""
1007 },
1008
1009 /*QUAKED team_DD_point
1010 Only in DD games
1011 */
1012 {
1013 "team_DD_pointBwhite",
1014 NULL,
1015 { "models/dpoints/b_white.md3",
1016 NULL, NULL, NULL },
1017 /* icon */ "icons/iconb_white",
1018 /* pickup */ "Point B (White)",
1019 0,
1020 IT_TEAM,
1021 DD_POINTBWHITE,
1022 /* precache */ "",
1023 /* sounds */ ""
1024 },
1025
1026 //Now things for standard domination:
1027
1028
1029 /*QUAKED
1030 Only in Domination games
1031 */
1032 {
1033 "team_dom_pointWhite",
1034 NULL,
1035 { "models/flags/n_flag.md3",
1036 NULL, NULL, NULL },
1037 /* icon */ "icons/iconf_neutral1",
1038 /* pickup */ "Neutral domination point",
1039 0,
1040 IT_TEAM,
1041 DOM_POINTWHITE,
1042 /* precache */ "",
1043 /* sounds */ ""
1044 },
1045
1046 /*QUAKED
1047 Only in Domination games
1048 */
1049 {
1050 "team_dom_pointRed",
1051 NULL,
1052 { "models/flags/r_flag.md3",
1053 NULL, NULL, NULL },
1054 /* icon */ "icons/iconf_red1",
1055 /* pickup */ "Red domination point",
1056 0,
1057 IT_TEAM,
1058 DOM_POINTRED,
1059 /* precache */ "",
1060 /* sounds */ ""
1061 },
1062
1063 /*QUAKED
1064 Only in Domination games
1065 */
1066 {
1067 "team_dom_pointBlue",
1068 NULL,
1069 { "models/flags/b_flag.md3",
1070 NULL, NULL, NULL },
1071 /* icon */ "icons/iconf_blu1",
1072 /* pickup */ "Blue domination point",
1073 0,
1074 IT_TEAM,
1075 DOM_POINTBLUE,
1076 /* precache */ "",
1077 /* sounds */ ""
1078 },
1079
1080 // end of list marker
1081 {NULL}
1082 };
1083
1084 int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
1085
1086
1087 /*
1088 ==============
1089 BG_FindItemForPowerup
1090 ==============
1091 */
1092 gitem_t *BG_FindItemForPowerup( powerup_t pw ) {
1093 int i;
1094
1095 for ( i = 0 ; i < bg_numItems ; i++ ) {
1096 if ( (bg_itemlist[i].giType == IT_POWERUP ||
1097 bg_itemlist[i].giType == IT_TEAM ||
1098 bg_itemlist[i].giType == IT_PERSISTANT_POWERUP) &&
1099 bg_itemlist[i].giTag == pw ) {
1100 return &bg_itemlist[i];
1101 }
1102 }
1103
1104 return NULL;
1105 }
1106
1107
1108 /*
1109 ==============
1110 BG_FindItemForHoldable
1111 ==============
1112 */
1113 gitem_t *BG_FindItemForHoldable( holdable_t pw ) {
1114 int i;
1115
1116 for ( i = 0 ; i < bg_numItems ; i++ ) {
1117 if ( bg_itemlist[i].giType == IT_HOLDABLE && bg_itemlist[i].giTag == pw ) {
1118 return &bg_itemlist[i];
1119 }
1120 }
1121
1122 Com_Error( ERR_DROP, "HoldableItem not found" );
1123
1124 return NULL;
1125 }
1126
1127
1128 /*
1129 ===============
1130 BG_FindItemForWeapon
1131
1132 ===============
1133 */
1134 gitem_t *BG_FindItemForWeapon( weapon_t weapon ) {
1135 gitem_t *it;
1136
1137 for ( it = bg_itemlist + 1 ; it->classname ; it++) {
1138 if ( it->giType == IT_WEAPON && it->giTag == weapon ) {
1139 return it;
1140 }
1141 }
1142
1143 Com_Error( ERR_DROP, "Couldn't find item for weapon %i", weapon);
1144 return NULL;
1145 }
1146
1147 /*
1148 ===============
1149 BG_FindItem
1150
1151 ===============
1152 */
1153 gitem_t *BG_FindItem( const char *pickupName ) {
1154 gitem_t *it;
1155
1156 for ( it = bg_itemlist + 1 ; it->classname ; it++ ) {
1157 if ( !Q_stricmp( it->pickup_name, pickupName ) )
1158 return it;
1159 }
1160
1161 return NULL;
1162 }
1163
1164 /*
1165 ============
1166 BG_PlayerTouchesItem
1167
1168 Items can be picked up without actually touching their physical bounds to make
1169 grabbing them easier
1170 ============
1171 */
1172 qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime ) {
1173 vec3_t origin;
1174
1175 BG_EvaluateTrajectory( &item->pos, atTime, origin );
1176
1177 // we are ignoring ducked differences here
1178 if ( ps->origin[0] - origin[0] > 44
1179 || ps->origin[0] - origin[0] < -50
1180 || ps->origin[1] - origin[1] > 36
1181 || ps->origin[1] - origin[1] < -36
1182 || ps->origin[2] - origin[2] > 36
1183 || ps->origin[2] - origin[2] < -36 ) {
1184 return qfalse;
1185 }
1186
1187 return qtrue;
1188 }
1189
1190
1191
1192 /*
1193 ================
1194 BG_CanItemBeGrabbed
1195
1196 Returns false if the item should not be picked up.
1197 This needs to be the same for client side prediction and server use.
1198 ================
1199 */
1200 qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const playerState_t *ps ) {
1201 gitem_t *item;
1202 int upperBound;
1203
1204 if ( ent->modelindex < 1 || ent->modelindex >= bg_numItems ) {
1205 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: index out of range" );
1206 }
1207
1208 item = &bg_itemlist[ent->modelindex];
1209
1210 switch( item->giType ) {
1211 case IT_WEAPON:
1212 return qtrue; // weapons are always picked up
1213
1214 case IT_AMMO:
1215 if ( ps->ammo[ item->giTag ] >= 200 ) {
1216 return qfalse; // can't hold any more
1217 }
1218 return qtrue;
1219
1220 case IT_ARMOR:
•1221 upperBound = ps->stats[STAT_MAX_HEALTH] * 2;
1222
1223 #ifdef HAVE_STAT_PERSISTANT_POWERUP
1224 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_SCOUT ) {
1225 return qfalse;
1226 }
1227
1228 // we also clamp armor to the maxhealth for handicapping
1229 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) {
1230 upperBound = ps->stats[STAT_MAX_HEALTH];
1231 }
•1232 #endif
1233
1234 if ( ps->stats[STAT_ARMOR] >= upperBound ) {
1235 return qfalse;
1236 }
1237 return qtrue;
1238
1239 case IT_HEALTH:
•1240 #ifdef HAVE_STAT_PERSISTANT_POWERUP
1241 // small and mega healths will go over the max, otherwise
1242 // don't pick up if already at max
1243 if( bg_itemlist[ps->stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) {
1244 upperBound = ps->stats[STAT_MAX_HEALTH];
1245 }
1246 else
•1247 #endif
1248 if ( item->quantity == 5 || item->quantity == 100 ) {
1249 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] * 2 ) {
1250 return qfalse;
1251 }
1252 return qtrue;
1253 }
1254
1255 if ( ps->stats[STAT_HEALTH] >= ps->stats[STAT_MAX_HEALTH] ) {
1256 return qfalse;
1257 }
1258 return qtrue;
1259
1260 case IT_POWERUP:
1261 return qtrue; // powerups are always picked up
1262
•1263 #ifdef HAVE_STAT_PERSISTANT_POWERUP
1264 case IT_PERSISTANT_POWERUP:
1265
1266 //In Double D we don't want persistant Powerups (or maybe, can be discussed)
1267 if(gametype == GT_DOUBLE_D)
1268 return qfalse;
1269
1270 // can only hold one item at a time
1271 if ( ps->stats[STAT_PERSISTANT_POWERUP] ) {
1272 return qfalse;
1273 }
1274
1275 // check team only
1276 if( ( ent->generic1 & 2 ) && ( ps->persistant[PERS_TEAM] != TEAM_RED ) ) {
1277 return qfalse;
1278 }
1279 if( ( ent->generic1 & 4 ) && ( ps->persistant[PERS_TEAM] != TEAM_BLUE ) ) {
1280 return qfalse;
1281 }
1282
1283 return qtrue;
•1284 #endif
1285
1286 case IT_TEAM: // team items, such as flags
1287 if( gametype == GT_1FCTF ) {
1288 // neutral flag can always be picked up
1289 if( item->giTag == PW_NEUTRALFLAG ) {
1290 return qtrue;
1291 }
1292 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1293 if (item->giTag == PW_BLUEFLAG && ps->powerups[PW_NEUTRALFLAG] ) {
1294 return qtrue;
1295 }
1296 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1297 if (item->giTag == PW_REDFLAG && ps->powerups[PW_NEUTRALFLAG] ) {
1298 return qtrue;
1299 }
1300 }
1301 }
1302 if( gametype == GT_CTF || gametype == GT_CTF_ELIMINATION) {
1303 // ent->modelindex2 is non-zero on items if they are dropped
1304 // we need to know this because we can pick up our dropped flag (and return it)
1305 // but we can't pick up our flag at base
1306 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1307 if (item->giTag == PW_BLUEFLAG ||
1308 (item->giTag == PW_REDFLAG && ent->modelindex2) ||
1309 (item->giTag == PW_REDFLAG && ps->powerups[PW_BLUEFLAG]) )
1310 return qtrue;
1311 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1312 if (item->giTag == PW_REDFLAG ||
1313 (item->giTag == PW_BLUEFLAG && ent->modelindex2) ||
1314 (item->giTag == PW_BLUEFLAG && ps->powerups[PW_REDFLAG]) )
1315 return qtrue;
1316 }
1317 }
1318
1319 if( gametype == GT_DOUBLE_D) {
1320 //We can touch both flags
1321 if(item->giTag == PW_BLUEFLAG || item->giTag == PW_REDFLAG)
1322 return qtrue;
1323 }
1324
1325 if( gametype == GT_DOMINATION ) {
1326 if(item->giTag == DOM_POINTWHITE)
1327 return qtrue;
1328 if (ps->persistant[PERS_TEAM] == TEAM_RED) {
1329 if(item->giTag == DOM_POINTBLUE)
1330 return qtrue;
1331 } else if (ps->persistant[PERS_TEAM] == TEAM_BLUE) {
1332 if(item->giTag == DOM_POINTRED)
1333 return qtrue;
1334 }
1335 }
1336
1337 if( gametype == GT_HARVESTER ) {
1338 return qtrue;
1339 }
1340 return qfalse;
1341
1342 case IT_HOLDABLE:
1343 // can only hold one item at a time
1344 if ( ps->stats[STAT_HOLDABLE_ITEM] ) {
1345 return qfalse;
1346 }
1347 return qtrue;
1348
1349 case IT_BAD:
1350 Com_Error( ERR_DROP, "BG_CanItemBeGrabbed: IT_BAD" );
1351 default:
1352 #ifndef Q3_VM
1353 #ifndef NDEBUG // bk0001204
1354 Com_Printf("BG_CanItemBeGrabbed: unknown enum %d\n", item->giType );
1355 #endif
1356 #endif
1357 break;
1358 }
1359
1360 return qfalse;
1361 }
1362
1363 //======================================================================
1364
1365 /*
1366 ================
1367 BG_EvaluateTrajectory
1368
1369 ================
1370 */
1371 void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ) {
1372 float deltaTime;
1373 float phase;
1374
1375 switch( tr->trType ) {
1376 case TR_STATIONARY:
1377 case TR_INTERPOLATE:
1378 VectorCopy( tr->trBase, result );
1379 break;
1380 case TR_LINEAR:
1381 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1382 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1383 break;
1384 case TR_SINE:
1385 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
1386 phase = sin( deltaTime * M_PI * 2 );
1387 VectorMA( tr->trBase, phase, tr->trDelta, result );
1388 break;
1389 case TR_LINEAR_STOP:
1390 if ( atTime > tr->trTime + tr->trDuration ) {
1391 atTime = tr->trTime + tr->trDuration;
1392 }
1393 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1394 if ( deltaTime < 0 ) {
1395 deltaTime = 0;
1396 }
1397 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1398 break;
1399 case TR_GRAVITY:
1400 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1401 VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
1402 result[2] -= 0.5 * DEFAULT_GRAVITY * deltaTime * deltaTime; // FIXME: local gravity...
1403 break;
1404 default:
1405 Com_Error( ERR_DROP, "BG_EvaluateTrajectory: unknown trType: %i", tr->trTime );
1406 break;
1407 }
1408 }
1409
1410 /*
1411 ================
1412 BG_EvaluateTrajectoryDelta
1413
1414 For determining velocity at a given time
1415 ================
1416 */
1417 void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result ) {
1418 float deltaTime;
1419 float phase;
1420
1421 switch( tr->trType ) {
1422 case TR_STATIONARY:
1423 case TR_INTERPOLATE:
1424 VectorClear( result );
1425 break;
1426 case TR_LINEAR:
1427 VectorCopy( tr->trDelta, result );
1428 break;
1429 case TR_SINE:
1430 deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
1431 phase = cos( deltaTime * M_PI * 2 ); // derivative of sin = cos
1432 phase *= 0.5;
1433 VectorScale( tr->trDelta, phase, result );
1434 break;
1435 case TR_LINEAR_STOP:
1436 if ( atTime > tr->trTime + tr->trDuration ) {
1437 VectorClear( result );
1438 return;
1439 }
1440 VectorCopy( tr->trDelta, result );
1441 break;
1442 case TR_GRAVITY:
1443 deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
1444 VectorCopy( tr->trDelta, result );
1445 result[2] -= DEFAULT_GRAVITY * deltaTime; // FIXME: local gravity...
1446 break;
1447 default:
1448 Com_Error( ERR_DROP, "BG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trTime );
1449 break;
1450 }
1451 }
1452
1453 char *eventnames[] = {
1454 "EV_NONE",
1455
1456 "EV_FOOTSTEP",
1457 "EV_FOOTSTEP_METAL",
1458 "EV_FOOTSPLASH",
1459 "EV_FOOTWADE",
1460 "EV_SWIM",
1461
1462 "EV_STEP_4",
1463 "EV_STEP_8",
1464 "EV_STEP_12",
1465 "EV_STEP_16",
1466
1467 "EV_FALL_SHORT",
1468 "EV_FALL_MEDIUM",
1469 "EV_FALL_FAR",
1470
1471 "EV_JUMP_PAD", // boing sound at origin", jump sound on player
1472
1473 "EV_JUMP",
1474 "EV_WATER_TOUCH", // foot touches
1475 "EV_WATER_LEAVE", // foot leaves
1476 "EV_WATER_UNDER", // head touches
1477 "EV_WATER_CLEAR", // head leaves
1478
1479 "EV_ITEM_PICKUP", // normal item pickups are predictable
1480 "EV_GLOBAL_ITEM_PICKUP", // powerup / team sounds are broadcast to everyone
1481
1482 "EV_NOAMMO",
1483 "EV_CHANGE_WEAPON",
1484 "EV_FIRE_WEAPON",
1485
1486 "EV_USE_ITEM0",
1487 "EV_USE_ITEM1",
1488 "EV_USE_ITEM2",
1489 "EV_USE_ITEM3",
1490 "EV_USE_ITEM4",
1491 "EV_USE_ITEM5",
1492 "EV_USE_ITEM6",
1493 "EV_USE_ITEM7",
1494 "EV_USE_ITEM8",
1495 "EV_USE_ITEM9",
1496 "EV_USE_ITEM10",
1497 "EV_USE_ITEM11",
1498 "EV_USE_ITEM12",
1499 "EV_USE_ITEM13",
1500 "EV_USE_ITEM14",
1501 "EV_USE_ITEM15",
1502
1503 "EV_ITEM_RESPAWN",
1504 "EV_ITEM_POP",
1505 "EV_PLAYER_TELEPORT_IN",
1506 "EV_PLAYER_TELEPORT_OUT",
1507
1508 "EV_GRENADE_BOUNCE", // eventParm will be the soundindex
1509
1510 "EV_GENERAL_SOUND",
1511 "EV_GLOBAL_SOUND", // no attenuation
1512 "EV_GLOBAL_TEAM_SOUND",
1513
1514 "EV_BULLET_HIT_FLESH",
1515 "EV_BULLET_HIT_WALL",
1516
1517 "EV_MISSILE_HIT",
1518 "EV_MISSILE_MISS",
1519 "EV_MISSILE_MISS_METAL",
1520 "EV_RAILTRAIL",
1521 "EV_SHOTGUN",
1522 "EV_BULLET", // otherEntity is the shooter
1523
1524 "EV_PAIN",
1525 "EV_DEATH1",
1526 "EV_DEATH2",
1527 "EV_DEATH3",
1528 "EV_OBITUARY",
1529
1530 "EV_POWERUP_QUAD",
1531 "EV_POWERUP_BATTLESUIT",
1532 "EV_POWERUP_REGEN",
1533
1534 "EV_GIB_PLAYER", // gib a previously living player
1535 "EV_SCOREPLUM", // score plum
1536
1537 //Not all of these are used in baseoa but we keep them to gurantie event numbers between version
1538 "EV_PROXIMITY_MINE_STICK",
1539 "EV_PROXIMITY_MINE_TRIGGER",
1540 "EV_KAMIKAZE", // kamikaze explodes
1541 "EV_OBELISKEXPLODE", // obelisk explodes
1542 "EV_INVUL_IMPACT", // invulnerability sphere impact
1543 "EV_JUICED", // invulnerability juiced effect
1544 "EV_LIGHTNINGBOLT", // lightning bolt bounced of invulnerability sphere
1545
1546
1547 "EV_DEBUG_LINE",
1548 "EV_STOPLOOPINGSOUND",
1549 "EV_TAUNT"
1550
1551 };
1552
1553 /*
1554 ===============
1555 BG_AddPredictableEventToPlayerstate
1556
1557 Handles the sequence numbers
1558 ===============
1559 */
1560
1561 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
1562
1563 void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps ) {
1564
1565 #ifdef _DEBUG
1566 {
1567 char buf[256];
1568 trap_Cvar_VariableStringBuffer("showevents", buf, sizeof(buf));
1569 if ( atof(buf) != 0 ) {
1570 #ifdef QAGAME
1571 Com_Printf(" game event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
1572 #else
1573 Com_Printf("Cgame event svt %5d -> %5d: num = %20s parm %d\n", ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[newEvent], eventParm);
1574 #endif
1575 }
1576 }
1577 #endif
1578 ps->events[ps->eventSequence & (MAX_PS_EVENTS-1)] = newEvent;
1579 ps->eventParms[ps->eventSequence & (MAX_PS_EVENTS-1)] = eventParm;
1580 ps->eventSequence++;
1581 }
1582
1583 /*
1584 ========================
1585 BG_TouchJumpPad
1586 ========================
1587 */
1588 void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad ) {
1589 vec3_t angles;
1590 float p;
1591 int effectNum;
1592
1593 // spectators don't use jump pads
1594 if ( ps->pm_type != PM_NORMAL ) {
1595 return;
1596 }
1597
1598 // flying characters don't hit bounce pads
1599 if ( ps->powerups[PW_FLIGHT] ) {
1600 return;
1601 }
1602
1603 // if we didn't hit this same jumppad the previous frame
1604 // then don't play the event sound again if we are in a fat trigger
1605 if ( ps->jumppad_ent != jumppad->number ) {
1606
1607 vectoangles( jumppad->origin2, angles);
1608 p = fabs( AngleNormalize180( angles[PITCH] ) );
1609 if( p < 45 ) {
1610 effectNum = 0;
1611 } else {
1612 effectNum = 1;
1613 }
1614 BG_AddPredictableEventToPlayerstate( EV_JUMP_PAD, effectNum, ps );
1615 }
1616 // remember hitting this jumppad this frame
1617 ps->jumppad_ent = jumppad->number;
1618 ps->jumppad_frame = ps->pmove_framecount;
1619 // give the player the velocity from the jumppad
1620 VectorCopy( jumppad->origin2, ps->velocity );
1621 }
1622
1623 /*
1624 ========================
1625 BG_PlayerStateToEntityState
1626
1627 This is done after each set of usercmd_t on the server,
1628 and after local prediction on the client
1629 ========================
1630 */
1631 void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap ) {
1632 int i;
1633
1634 if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR ) {
1635 s->eType = ET_INVISIBLE;
1636 } else if ( ps->stats[STAT_HEALTH] <= GIB_HEALTH ) {
1637 s->eType = ET_INVISIBLE;
1638 } else {
1639 s->eType = ET_PLAYER;
1640 }
1641
1642 s->number = ps->clientNum;
1643
1644 s->pos.trType = TR_INTERPOLATE;
1645 VectorCopy( ps->origin, s->pos.trBase );
1646 if ( snap ) {
1647 SnapVector( s->pos.trBase );
1648 }
1649 // set the trDelta for flag direction
1650 VectorCopy( ps->velocity, s->pos.trDelta );
1651
1652 s->apos.trType = TR_INTERPOLATE;
1653 VectorCopy( ps->viewangles, s->apos.trBase );
1654 if ( snap ) {
1655 SnapVector( s->apos.trBase );
1656 }
1657
1658 s->angles2[YAW] = ps->movementDir;
1659 s->legsAnim = ps->legsAnim;
1660 s->torsoAnim = ps->torsoAnim;
1661 s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
1662 // so corpses can also reference the proper config
1663 s->eFlags = ps->eFlags;
1664 if ( ps->stats[STAT_HEALTH] <= 0 ) {
1665 s->eFlags |= EF_DEAD;
1666 } else {
1667 s->eFlags &= ~EF_DEAD;
1668 }
1669
1670 if ( ps->externalEvent ) {
1671 s->event = ps->externalEvent;
1672 s->eventParm = ps->externalEventParm;
1673 } else if ( ps->entityEventSequence < ps->eventSequence ) {
1674 int seq;
1675
1676 if ( ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
1677 ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
1678 }
1679 seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
1680 s->event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
1681 s->eventParm = ps->eventParms[ seq ];
1682 ps->entityEventSequence++;
1683 }
1684
1685 s->weapon = ps->weapon;
1686 s->groundEntityNum = ps->groundEntityNum;
1687
1688 s->powerups = 0;
1689 for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {
1690 if ( ps->powerups[ i ] ) {
1691 s->powerups |= 1 << i;
1692 }
1693 }
1694
1695 s->loopSound = ps->loopSound;
1696 s->generic1 = ps->generic1;
1697 }
1698
1699 /*
1700 ========================
1701 BG_PlayerStateToEntityStateExtraPolate
1702
1703 This is done after each set of usercmd_t on the server,
1704 and after local prediction on the client
1705 ========================
1706 */
1707 void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap ) {
1708 int i;
1709
1710 if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPECTATOR ) {
1711 s->eType = ET_INVISIBLE;
1712 } else if ( ps->stats[STAT_HEALTH] <= GIB_HEALTH ) {
1713 s->eType = ET_INVISIBLE;
1714 } else {
1715 s->eType = ET_PLAYER;
1716 }
1717
1718 s->number = ps->clientNum;
1719
1720 s->pos.trType = TR_LINEAR_STOP;
1721 VectorCopy( ps->origin, s->pos.trBase );
1722 if ( snap ) {
1723 SnapVector( s->pos.trBase );
1724 }
1725 // set the trDelta for flag direction and linear prediction
1726 VectorCopy( ps->velocity, s->pos.trDelta );
1727 // set the time for linear prediction
1728 s->pos.trTime = time;
1729 // set maximum extra polation time
1730 s->pos.trDuration = 50; // 1000 / sv_fps (default = 20)
1731
1732 s->apos.trType = TR_INTERPOLATE;
1733 VectorCopy( ps->viewangles, s->apos.trBase );
1734 if ( snap ) {
1735 SnapVector( s->apos.trBase );
1736 }
1737
1738 s->angles2[YAW] = ps->movementDir;
1739 s->legsAnim = ps->legsAnim;
1740 s->torsoAnim = ps->torsoAnim;
1741 s->clientNum = ps->clientNum; // ET_PLAYER looks here instead of at number
1742 // so corpses can also reference the proper config
1743 s->eFlags = ps->eFlags;
1744 if ( ps->stats[STAT_HEALTH] <= 0 ) {
1745 s->eFlags |= EF_DEAD;
1746 } else {
1747 s->eFlags &= ~EF_DEAD;
1748 }
1749
1750 if ( ps->externalEvent ) {
1751 s->event = ps->externalEvent;
1752 s->eventParm = ps->externalEventParm;
1753 } else if ( ps->entityEventSequence < ps->eventSequence ) {
1754 int seq;
1755
1756 if ( ps->entityEventSequence < ps->eventSequence - MAX_PS_EVENTS) {
1757 ps->entityEventSequence = ps->eventSequence - MAX_PS_EVENTS;
1758 }
1759 seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
1760 s->event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
1761 s->eventParm = ps->eventParms[ seq ];
1762 ps->entityEventSequence++;
1763 }
1764
1765 s->weapon = ps->weapon;
1766 s->groundEntityNum = ps->groundEntityNum;
1767
1768 s->powerups = 0;
1769 for ( i = 0 ; i < MAX_POWERUPS ; i++ ) {
1770 if ( ps->powerups[ i ] ) {
1771 s->powerups |= 1 << i;
1772 }
1773 }
1774
1775 s->loopSound = ps->loopSound;
1776 s->generic1 = ps->generic1;
1777 }
1778
1779 /*
1780 ============
1781 BG_TeamName
1782 KK-OAX Copied from Tremulous
1783 ============
1784 */
1785 char *BG_TeamName( team_t team )
1786 {
1787 if( team == TEAM_NONE )
1788 return "spectator";
1789 if( team == TEAM_RED )
1790 return "Red";
1791 if( team == TEAM_BLUE )
1792 return "Blue";
1793 if( team == TEAM_FREE )
1794 return "Free For All";
1795 return "<team>";
1796 }