| 648 | } |
| 649 | |
| 650 | void InitializeItem(short itemNumber) |
| 651 | { |
| 652 | auto* item = &g_Level.Items[itemNumber]; |
| 653 | const auto& object = Objects[item->ObjectNumber]; |
| 654 | |
| 655 | if (!object.Animations.empty()) |
| 656 | SetAnimation(item, 0); |
| 657 | |
| 658 | item->Animation.RequiredState = NO_VALUE; |
| 659 | item->Animation.Velocity = Vector3::Zero; |
| 660 | item->Animation.AnimObjectID = item->ObjectNumber; |
| 661 | |
| 662 | for (int i = 0; i < ITEM_FLAG_COUNT; i++) |
| 663 | item->ItemFlags[i] = 0; |
| 664 | |
| 665 | item->Active = false; |
| 666 | item->Status = ITEM_NOT_ACTIVE; |
| 667 | item->Animation.IsAirborne = false; |
| 668 | item->HitStatus = false; |
| 669 | item->Collidable = true; |
| 670 | item->LookedAt = false; |
| 671 | item->Timer = 0; |
| 672 | item->HitPoints = object.HitPoints; |
| 673 | |
| 674 | item->Effect = {}; |
| 675 | |
| 676 | if (item->ObjectNumber == ID_HK_ITEM || |
| 677 | item->ObjectNumber == ID_HK_AMMO_ITEM || |
| 678 | item->ObjectNumber == ID_CROSSBOW_ITEM || |
| 679 | item->ObjectNumber == ID_REVOLVER_ITEM) |
| 680 | { |
| 681 | item->MeshBits = 1 << 0; |
| 682 | } |
| 683 | else |
| 684 | { |
| 685 | item->MeshBits = ALL_JOINT_BITS; |
| 686 | } |
| 687 | |
| 688 | item->TouchBits = NO_JOINT_BITS; |
| 689 | item->AfterDeath = 0; |
| 690 | |
| 691 | if (item->Flags & IFLAG_INVISIBLE) |
| 692 | { |
| 693 | item->Flags &= ~IFLAG_INVISIBLE; |
| 694 | item->Status = ITEM_INVISIBLE; |
| 695 | } |
| 696 | else if (object.intelligent) |
| 697 | { |
| 698 | item->Status = ITEM_INVISIBLE; |
| 699 | } |
| 700 | |
| 701 | if ((item->Flags & IFLAG_ACTIVATION_MASK) == IFLAG_ACTIVATION_MASK) |
| 702 | { |
| 703 | item->Flags &= ~IFLAG_ACTIVATION_MASK; |
| 704 | item->Flags |= IFLAG_REVERSE; |
| 705 | AddActiveItem(itemNumber); |
| 706 | item->Status = ITEM_ACTIVE; |
| 707 | } |
no test coverage detected