| 611 | } |
| 612 | |
| 613 | static S32 CheckPickupAgainstPlayer(xEnt* cbent, void*) |
| 614 | { |
| 615 | if (cbent->baseType != eBaseTypePickup) |
| 616 | { |
| 617 | return 1; |
| 618 | } |
| 619 | |
| 620 | zEntPickup* ent = (zEntPickup*)cbent; |
| 621 | |
| 622 | if ((ent->state & 0x40) && 0.0f == ent->timer && !(ent->state & 0x8) && !(ent->state & 0x4) && |
| 623 | !(ent->state & 0x20) && globals.player.Health != 0) |
| 624 | { |
| 625 | ent->fx_scale = 1.0f; |
| 626 | |
| 627 | if (ent->pickupFlags & 0x1) |
| 628 | { |
| 629 | ent->baseFlags &= 0x7f; |
| 630 | } |
| 631 | |
| 632 | F32 distance; |
| 633 | zEnt* plent = &globals.player.ent; |
| 634 | F32 distsqr; |
| 635 | F32 dx__ = plent->bound.sph.center.x - ent->model->Mat->pos.x; |
| 636 | F32 dy__ = plent->bound.sph.center.y - ent->model->Mat->pos.y; |
| 637 | F32 dz__ = plent->bound.sph.center.z - ent->model->Mat->pos.z; |
| 638 | F32 chkdist = 4.0f * plent->bound.sph.r; |
| 639 | |
| 640 | distance = SQR(dx__) + SQR(dy__) + SQR(dz__); |
| 641 | |
| 642 | if (distance <= SQR(chkdist)) |
| 643 | { |
| 644 | if (ent->pickupFlags & 0x2) |
| 645 | { |
| 646 | if (ent->p->pickupType == PICKUP_TYPE_SHINY) |
| 647 | { |
| 648 | zEntPickup_DoPickup(ent); |
| 649 | } |
| 650 | |
| 651 | if (ent->p->pickupType == PICKUP_TYPE_1) |
| 652 | { |
| 653 | switch (ent->p->pickupIndex) |
| 654 | { |
| 655 | case PICKUP_UNDERWEAR: |
| 656 | { |
| 657 | if (globals.player.Health < globals.player.MaxHealth) |
| 658 | { |
| 659 | zEntPickup_DoPickup(ent); |
| 660 | } |
| 661 | |
| 662 | break; |
| 663 | } |
| 664 | case PICKUP_SOCK: |
| 665 | { |
| 666 | for (S32 i = 0; i < 5; i++) |
| 667 | { |
| 668 | xFXFireworksLaunch(0.5f + xurand(), (xVec3*)&ent->model->Mat->pos, |
| 669 | 0.5f * xurand() + 0.1f); |
| 670 | } |
nothing calls this directly
no test coverage detected