MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / InitializeItem

Function InitializeItem

TombEngine/Game/items.cpp:650–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void 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 }

Callers 15

LoadItemsFunction · 0.85
CreateSkidooGunFunction · 0.85
TribesmanShotDartFunction · 0.85
BigGunFireFunction · 0.85
SpawnSkateboardFunction · 0.85
ControlDartEmitterFunction · 0.85
SubmarineAttackFunction · 0.85
SpawnShieldFunction · 0.85
SpawnShockwaveExplosionFunction · 0.85
EnemyJeepLaunchGrenadeFunction · 0.85
SasFireGrenadeFunction · 0.85
UseClockworkBeetleFunction · 0.85

Calls 7

SetAnimationFunction · 0.85
AddActiveItemFunction · 0.85
GetSectorFunction · 0.85
GetSurfaceHeightMethod · 0.80
ResetModelToDefaultMethod · 0.80
emptyMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected