-------------------------------------------------------------------------------- Description: add the hull locators to the new ship --------------------------------------------------------------------------------
| 2927 | // add the hull locators to the new ship |
| 2928 | // -------------------------------------------------------------------------------- |
| 2929 | void EveSOF::SetupLocators( EveSpaceObject2Ptr obj, const EveSOFDNAPtr dna ) const |
| 2930 | { |
| 2931 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 2932 | |
| 2933 | // cycle over all hulls in the multi-hull list |
| 2934 | Vector3 hullOffset( 0.f, 0.f, 0.f ); |
| 2935 | for( size_t hullIdx = 0; hullIdx < dna->GetMultiHullCount(); ++hullIdx ) |
| 2936 | { |
| 2937 | // turret locators |
| 2938 | const std::vector<EveSOFDataMgr::LocatorData>& turretLocators = dna->GetHullTurretLocators( hullIdx ); |
| 2939 | for( auto tlit = turretLocators.begin(); tlit != turretLocators.end(); ++tlit ) |
| 2940 | { |
| 2941 | // create a new locator |
| 2942 | EveLocator2Ptr loc; |
| 2943 | loc.CreateInstance(); |
| 2944 | |
| 2945 | // set it up |
| 2946 | loc->SetName( tlit->name ); |
| 2947 | |
| 2948 | Matrix m; |
| 2949 | TriMatrixTranslate( &m, &tlit->transform, &hullOffset ); |
| 2950 | loc->SetTransform( m ); |
| 2951 | |
| 2952 | // add it to the new ship |
| 2953 | obj->AddLocator( loc ); |
| 2954 | } |
| 2955 | |
| 2956 | // audio locator |
| 2957 | const Vector3* pos = dna->GetHullAudioPosition( hullIdx ); |
| 2958 | if( pos ) |
| 2959 | { |
| 2960 | EveLocator2Ptr loc; |
| 2961 | loc.CreateInstance(); |
| 2962 | loc->SetName( "locator_audio_booster" ); |
| 2963 | loc->SetTransform( Matrix( 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, pos->x + hullOffset.x, pos->y + hullOffset.y, pos->z + hullOffset.z, 1.f ) ); |
| 2964 | |
| 2965 | // add it to the new ship |
| 2966 | obj->AddLocator( loc ); |
| 2967 | } |
| 2968 | |
| 2969 | // next hull needs offset update from hull's locator |
| 2970 | const Vector3* nextSubsystemOffset = dna->GetHullNextSubsystemOffset( hullIdx ); |
| 2971 | if( nextSubsystemOffset ) |
| 2972 | { |
| 2973 | hullOffset += *nextSubsystemOffset; |
| 2974 | } |
| 2975 | } |
| 2976 | } |
| 2977 | |
| 2978 | |
| 2979 | // -------------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected