Debian Codegraph @

code/game/bg_misc.c

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