| 109 | } |
| 110 | |
| 111 | void Tr2Controller::Link( IRoot& owner ) |
| 112 | { |
| 113 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 114 | { |
| 115 | |
| 116 | CCP_STATS_INC( controllerLinkCount ); |
| 117 | CCP_STATS_SCOPED_TIME( controllerLinkTime ); |
| 118 | |
| 119 | Unlink(); |
| 120 | |
| 121 | |
| 122 | CcpParser::OffsetType offset = 0; |
| 123 | m_variableView.clear(); |
| 124 | for( auto& var : m_variables ) |
| 125 | { |
| 126 | m_variableView.push_back( { var->GetName().c_str(), 0, offset } ); |
| 127 | offset += sizeof( float ); |
| 128 | } |
| 129 | m_variableData.resize( "", offset ); |
| 130 | offset = 0; |
| 131 | uint32_t index = 0; |
| 132 | for( auto& var : m_variables ) |
| 133 | { |
| 134 | var->SetDestinationBuffer( reinterpret_cast<float*>( m_variableData.get() + offset ) ); |
| 135 | offset += sizeof( float ); |
| 136 | if( index < 64 ) |
| 137 | { |
| 138 | var->SetDirtyMask( &m_dirtyVariables, 1ull << index++ ); |
| 139 | } |
| 140 | else |
| 141 | { |
| 142 | var->SetDirtyMask( nullptr, 0 ); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | m_owner = &owner; |
| 147 | for( auto it = begin( m_stateMachines ); it != end( m_stateMachines ); ++it ) |
| 148 | { |
| 149 | ( *it )->Link( *this ); |
| 150 | } |
| 151 | for( auto it = begin( m_eventHandlers ); it != end( m_eventHandlers ); ++it ) |
| 152 | { |
| 153 | ( *it )->Link( *this ); |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void Tr2Controller::Unlink( UnlinkReason reason ) |
| 159 | { |
no test coverage detected