void CPHSkeleton::UnsplitSingle(CPHSkeleton* SO) { //Msg("%o,received has %d,",this,m_unsplited_shels.size()); if (0==m_unsplited_shels.size()) return; //. hack CPhysicsShellHolder* obj = PPhysicsShellHolder(); CPhysicsShellHolder* O =SO->PPhysicsShellHolder(); VERIFY2(m_unsplited_shels.size(),"NO_SHELLS !!"); VERIFY2(!O->m_pPhysicsShell,"this has shell already!!!"); CPhysicsShell* newPhysicsShell=m_unsplited_shels.front().first; O->m_pPhysicsShell=newPhysicsShell; VERIFY(_valid(newPhysicsShell->mXFORM)); IKinematics *newKinematics=smart_cast<IKinematics*>(O->Visual()); IKinematics *pKinematics =smart_cast<IKinematics*>(obj->Visual()); Flags64 mask0,mask1; u16 split_bone=m_unsplited_shels.front().second; mask1.assign(pKinematics->LL_GetBonesVisible());//source bones mask pKinematics->LL_SetBoneVisible(split_bone,FALSE,TRUE); pKinematics->CalculateBones_Invalidate (); pKinematics->CalculateBones (TRUE); mask0.assign(pKinematics->LL_GetBonesVisible());//first part mask VERIFY2(mask0.flags,"mask0 -Zero"); mask0.invert(); mask1.and(mask0.flags);//second part mask newKinematics->LL_SetBoneRoot (split_bone); VERIFY2(mask1.flags,"mask1 -Zero"); newKinematics->LL_SetBonesVisible (mask1.flags); newKinematics->CalculateBones_Invalidate (); newKinematics->CalculateBones (TRUE); newPhysicsShell->set_Kinematics(newKinematics); VERIFY(_valid(newPhysicsShell->mXFORM)); newPhysicsShell->ResetCallbacks(split_bone,mask1); VERIFY(_valid(newPhysicsShell->mXFORM)); newPhysicsShell->ObjectInRoot().identity(); if(!newPhysicsShell->isEnabled())O->processing_deactivate(); newPhysicsShell->set_PhysicsRefObject(O); m_unsplited_shels.erase(m_unsplited_shels.begin()); O->setVisible(TRUE); O->setEnabled(TRUE); SO->CopySpawnInit (); CopySpawnInit (); VERIFY3(CheckObjectSize(pKinematics),*(O->cNameVisual()),"Object unsplit whith no size"); VERIFY3(CheckObjectSize(newKinematics),*(O->cNameVisual()),"Object unsplit whith no size"); }
void CActor::ActorUse() { if (m_holder) { CGameObject* GO = smart_cast<CGameObject*>(m_holder); NET_Packet P; CGameObject::u_EventGen (P, GEG_PLAYER_DETACH_HOLDER, ID()); P.w_u16 (GO->ID()); CGameObject::u_EventSend (P); return; } if(character_physics_support()->movement()->PHCapture()) character_physics_support()->movement()->PHReleaseObject(); if(m_pUsableObject && NULL==m_pObjectWeLookingAt->cast_inventory_item()) { m_pUsableObject->use(this); } if ( m_pInvBoxWeLookingAt && m_pInvBoxWeLookingAt->nonscript_usable() ) { CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI()); if ( pGameSP ) //single { if ( !m_pInvBoxWeLookingAt->closed() ) { pGameSP->StartCarBody( this, m_pInvBoxWeLookingAt ); } } return; } if(!m_pUsableObject||m_pUsableObject->nonscript_usable()) { if(m_pPersonWeLookingAt) { CEntityAlive* pEntityAliveWeLookingAt = smart_cast<CEntityAlive*>(m_pPersonWeLookingAt); VERIFY(pEntityAliveWeLookingAt); if (IsGameTypeSingle()) { if(pEntityAliveWeLookingAt->g_Alive()) { TryToTalk(); }else { //только если находимся в режиме single CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(CurrentGameUI()); if ( pGameSP ) { if ( !m_pPersonWeLookingAt->deadbody_closed_status() ) { if(pEntityAliveWeLookingAt->AlreadyDie() && pEntityAliveWeLookingAt->GetLevelDeathTime()+3000 < Device.dwTimeGlobal) // 99.9% dead pGameSP->StartCarBody(this, m_pPersonWeLookingAt ); } } } } } collide::rq_result& RQ = HUD().GetCurrentRayQuery(); CPhysicsShellHolder* object = smart_cast<CPhysicsShellHolder*>(RQ.O); u16 element = BI_NONE; if(object) element = (u16)RQ.element; if(object && Level().IR_GetKeyState(DIK_LSHIFT)) { bool b_allow = !!pSettings->line_exist("ph_capture_visuals",object->cNameVisual()); if(b_allow && !character_physics_support()->movement()->PHCapture()) { character_physics_support()->movement()->PHCaptureObject( object, element ); } } else { if (object && smart_cast<CHolderCustom*>(object)) { NET_Packet P; CGameObject::u_EventGen (P, GEG_PLAYER_ATTACH_HOLDER, ID()); P.w_u16 (object->ID()); CGameObject::u_EventSend (P); return; } } } }
static void interactive_motion_diag( LPCSTR message, const CBlend &b, CPhysicsShell *s, float time_left ) { #ifdef DEBUG if(!death_anim_debug) return; const MotionID & m = b.motionID; VERIFY( m.valid() ); VERIFY( s ); IKinematicsAnimated* KA = smart_cast<IKinematicsAnimated*>( s->PKinematics( ) ); VERIFY( KA ); CPhysicsShellHolder* O = smart_cast<CPhysicsShellHolder*>(s->get_ElementByStoreOrder( 0 )->PhysicsRefObject()); VERIFY( O ); LPCSTR motion_name = KA->LL_MotionDefName_dbg( m ).first; Msg( "death anims - interactive_motion:- %s, motion: %s, blend time %f , total blend time %f , time left: %f , obj: %s, model: %s ", message, motion_name, b.timeCurrent, b.timeTotal, time_left, O->cName().c_str(), O->cNameVisual().c_str()); #endif }
void CActor::ActorUse() { //mstate_real = 0; PickupModeOn(); if (m_holder) { CGameObject* GO = smart_cast<CGameObject*>(m_holder); NET_Packet P; CGameObject::u_EventGen (P, GEG_PLAYER_DETACH_HOLDER, ID()); P.w_u32 (GO->ID()); CGameObject::u_EventSend (P); return; } if(character_physics_support()->movement()->PHCapture()) character_physics_support()->movement()->PHReleaseObject(); if(m_pUsableObject)m_pUsableObject->use(this); if(m_pInvBoxWeLookingAt && m_pInvBoxWeLookingAt->nonscript_usable()) { CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame()); if(pGameSP) pGameSP->StartCarBody(this, m_pInvBoxWeLookingAt ); return; } if(!m_pUsableObject||m_pUsableObject->nonscript_usable()) { if(m_pPersonWeLookingAt) { CEntityAlive* pEntityAliveWeLookingAt = smart_cast<CEntityAlive*>(m_pPersonWeLookingAt); VERIFY(pEntityAliveWeLookingAt); if (GameID()==GAME_SINGLE) { if(pEntityAliveWeLookingAt->g_Alive()) { TryToTalk(); } //обыск трупа else if(!Level().IR_GetKeyState(DIK_LSHIFT)) { //только если находимся в режиме single CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame()); if(pGameSP)pGameSP->StartCarBody(this, m_pPersonWeLookingAt ); } } } collide::rq_result& RQ = HUD().GetCurrentRayQuery(); CPhysicsShellHolder* object = smart_cast<CPhysicsShellHolder*>(RQ.O); u16 element = BI_NONE; if(object) element = (u16)RQ.element; if(object && Level().IR_GetKeyState(DIK_LSHIFT)) { bool b_allow = !!pSettings->line_exist("ph_capture_visuals",object->cNameVisual()); if(b_allow && !character_physics_support()->movement()->PHCapture()) { character_physics_support()->movement()->PHCaptureObject(object,element); } } else { if (object && smart_cast<CHolderCustom*>(object)) { NET_Packet P; CGameObject::u_EventGen (P, GEG_PLAYER_ATTACH_HOLDER, ID()); P.w_u32 (object->ID()); CGameObject::u_EventSend (P); return; } } } }