////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
| 15 | /////////////////////////////////////////////////////////////////////////////////// |
| 16 | /////////////////////////////////////////////////////////////////////////////////// |
| 17 | CPHCapture::CPHCapture(CPHCharacter* a_character, CPhysicsShellHolder* a_taget_object, LPCSTR capture_bone, bool hard_mode) |
| 18 | { |
| 19 | CPHUpdateObject::Activate(); |
| 20 | |
| 21 | m_joint = NULL; |
| 22 | m_ajoint = NULL; |
| 23 | m_body = NULL; |
| 24 | m_taget_object = NULL; |
| 25 | m_character = NULL; |
| 26 | b_failed = false; |
| 27 | b_disabled = false; |
| 28 | b_character_feedback = false; |
| 29 | e_state = cstPulling; |
| 30 | m_hard_mode = hard_mode; |
| 31 | |
| 32 | if (!a_taget_object || !a_taget_object->m_pPhysicsShell || !a_taget_object->m_pPhysicsShell->isActive() || smart_cast<CInventoryItem*>(a_taget_object)) |
| 33 | { |
| 34 | m_taget_object = NULL; |
| 35 | b_failed = true; |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | if (!a_character || !a_character->b_exist) |
| 40 | { |
| 41 | m_taget_object = NULL; |
| 42 | b_failed = true; |
| 43 | return; |
| 44 | } |
| 45 | m_taget_object = a_taget_object; |
| 46 | m_character = a_character; |
| 47 | |
| 48 | CObject* capturer_object = smart_cast<CObject*>(m_character->PhysicsRefObject()); |
| 49 | |
| 50 | if (!capturer_object) |
| 51 | { |
| 52 | m_taget_object = NULL; |
| 53 | b_failed = true; |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | IKinematics* p_kinematics = smart_cast<IKinematics*>(capturer_object->Visual()); |
| 58 | |
| 59 | if (!p_kinematics) |
| 60 | { |
| 61 | m_taget_object = NULL; |
| 62 | b_failed = true; |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | CInifile* ini = nullptr; |
| 67 | if (smart_cast<CActor*>(m_character->PhysicsRefObject()) && pSettings->section_exist("actor_capture")) |
| 68 | { |
| 69 | ini = pSettings; |
| 70 | m_capture_section = "actor_capture"; |
| 71 | } |
| 72 | else if (smart_cast<CAI_Stalker*>(m_character->PhysicsRefObject()) && pSettings->section_exist("stalker_capture")) |
| 73 | { |
| 74 | ini = pSettings; |
nothing calls this directly
no test coverage detected