void CDamageManager::reload (LPCSTR section,CInifile* ini) { m_default_hit_factor = 1.f; m_default_wound_factor = 1.f; bool section_exist = ini && ini->section_exist(section); // прочитать дефолтные параметры if (section_exist) { string32 buffer; if (ini->line_exist(section,"default")) { LPCSTR value = ini->r_string(section,"default"); m_default_hit_factor = (float)atof(_GetItem(value,0,buffer)); m_default_wound_factor = (float)atof(_GetItem(value,2,buffer)); } } //инициализировать default параметрами init_bones (section,ini); // записать поверху прописанные параметры if (section_exist) { load_section (section,ini); } }
void imotion_position::state_start( ) { VERIFY( shell ); inherited::state_start( ); IKinematics *K = shell->PKinematics(); saved_visual_callback = K->GetUpdateCallback(); K->SetUpdateCallback( 0 ); IKinematicsAnimated *KA = smart_cast<IKinematicsAnimated*>( shell->PKinematics() ); VERIFY( KA ); KA->SetUpdateTracksCalback( &update_callback ); update_callback.motion = this; struct get_controled_blend: public IterateBlendsCallback, private boost::noncopyable { CBlend *blend; const PlayCallback cb; get_controled_blend(const PlayCallback _cb):blend( 0 ),cb(_cb){} virtual void operator () ( CBlend &B ) { if( cb == B.Callback && B.bone_or_part == 0 ) blend = &B; } } get_blend(anim_callback); KA->LL_IterateBlends( get_blend ); #ifdef DEBUG if(!get_blend.blend) { Msg( "bad animation params : %p", anim_callback ); KA->LL_DumpBlends_dbg(); NODEFAULT; } #endif VERIFY( get_blend.blend ); const CBlend &B = *get_blend.blend; blend = get_blend.blend; VERIFY2( B.stop_at_end, make_string( "can not use cyclic anim in death animth motion: %s", KA->LL_MotionDefName_dbg( B.motionID ).first ) ); time_to_end = B.timeTotal - (SAMPLE_SPF+EPS) - B.timeCurrent; time_to_end/=B.speed; shell->add_ObjectContactCallback( get_depth ); /* collide(); if( flags.test( fl_switch_dm_toragdoll ) ) { flags.assign( 0 ); shell->remove_ObjectContactCallback( get_depth ); return; } */ if( !is_enabled( ) ) return; CPhysicsShellHolder *obj= static_cast<CPhysicsShellHolder*>( shell->get_ElementByStoreOrder( 0 )->PhysicsRefObject() ); VERIFY( obj ); obj->processing_activate(); shell->Disable( ); //K->LL_SetBoneRoot( 0 ); shell->EnabledCallbacks( FALSE ); init_bones(); shell->mXFORM.set( obj->XFORM() ); disable_update( true ); disable_bone_calculation( *K, true ); //K->CalculateBones_Invalidate(); collide_not_move( *KA ); if(flags.test(fl_switch_dm_toragdoll)) { interactive_motion_diagnostic("stoped immediately"); switch_to_free ( ); flags.set(fl_not_played,TRUE); return; } move( float( Device.dwTimeDelta )/1000, *KA ); if(flags.test(fl_switch_dm_toragdoll)) switch_to_free ( ); //K->CalculateBones_Invalidate(); }