Advertisement
Dimitri_UA

CPed__initWeaponClump

Apr 23rd, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void __thiscall CPed__initWeaponClump(CPed *ped, int modelID)
  2. {
  3.   CPed *_ped;
  4.   CBaseModelInfo *weaponModel;
  5.   int weapClump;
  6.   int pedtype;
  7.   int weapSlotOffset;
  8.   CWeaponSlot *weapSlot;
  9.   int hAnimHier;
  10.   int boneIndex;
  11.   int pMatrices;
  12.   int molotovParticle;
  13.   RwV3D pos;
  14.  
  15.   _ped = ped;
  16.   if ( modelID != -1 )
  17.   {
  18.     if ( !ped->weaponSlots[ped->m_bActiveWeapon].field_15 )
  19.     {
  20.       weaponModel = modelPtrs[modelID];
  21.       if ( ped->WeaponClump )
  22.         CPed__removeWeaponModel(ped, -1);
  23.       weapClump = (*(weaponModel->__vmt + 0x2C))(weaponModel); // CModelBase::createInstance
  24.       _ped->WeaponClump = weapClump;
  25.       if ( weapClump )
  26.         _ped->WeaponGunflashClump = findObjectByNodeName(weapClump, "gunflash");
  27.       else
  28.         _ped->WeaponGunflashClump = 0;
  29.       CModelBase__addRef(weaponModel);
  30.       pedtype = _ped->pedType;
  31.       _ped->field_740 = modelID;
  32.       if ( !pedtype || pedtype == 1 )
  33.       {
  34.         weapSlotOffset = 28 * _ped->m_bActiveWeapon;
  35.         weapSlot = (_ped->weaponSlots + weapSlotOffset);
  36.         if ( weapSlot->type == WEAPON_MOLOTOV )
  37.         {
  38.           if ( modelID == MODEL_MOLOTOV )
  39.           {
  40.             if ( !*(&_ped->weaponSlots[0].particle + weapSlotOffset) )
  41.             {
  42.               hAnimHier = clumpGetFirstSkinAtomicHAnimHierarchy(_ped->__parent.__parent.m_pRWObject);
  43.               boneIndex = RpHAnimIDGetIndex(hAnimHier, BONE_RIGHTWRIST);
  44.               pMatrices = RpHAnimHierarchyGetMatrixArray(hAnimHier);
  45.               LODWORD(pos.x) = 0;
  46.               LODWORD(pos.y) = 0;
  47.               LODWORD(pos.z) = 0;
  48.               molotovParticle = createParticle("molotov_flame", &pos, ((boneIndex * 64) + pMatrices), 0);
  49.               weapSlot->particle = molotovParticle;
  50.               if ( molotovParticle )
  51.               {
  52.                 sub_4AA910(1);
  53.                 dummy_4AA890(weapSlot->particle);
  54.                 CParticle__init(weapSlot->particle);
  55.               }
  56.             }
  57.           }
  58.         }
  59.       }
  60.     }
  61.   }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement