param normalizedUpdateFrequency : value [0:1] on how freqeuntly the controller should be updating
| 229 | |
| 230 | // param normalizedUpdateFrequency : value [0:1] on how freqeuntly the controller should be updating |
| 231 | void Tr2Controller::Update( float normalizedUpdateFrequency ) |
| 232 | { |
| 233 | if( !m_isActive ) |
| 234 | { |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | if( EveThrottleable::ShouldSkipUpdate( normalizedUpdateFrequency ) ) |
| 239 | { |
| 240 | return; |
| 241 | } |
| 242 | |
| 243 | |
| 244 | auto currentTime = BeOS->GetActualTime(); |
| 245 | |
| 246 | { |
| 247 | CCP_STATS_INC( controllerUpdateCount ); |
| 248 | CCP_STATS_SCOPED_TIME( controllerUpdateTime ); |
| 249 | |
| 250 | auto dirtyVariables = m_dirtyVariables; |
| 251 | m_dirtyVariables = 0; |
| 252 | |
| 253 | for( auto it = begin( m_stateMachines ); it != end( m_stateMachines ); ++it ) |
| 254 | { |
| 255 | ( *it )->Update( dirtyVariables ); |
| 256 | } |
| 257 | if( !m_updateables.empty() ) |
| 258 | { |
| 259 | CCP_STATS_SCOPED_TIME( controllerUpdateablesTime ); |
| 260 | |
| 261 | auto simTime = BeOS->GetCurrentFrameTime(); |
| 262 | |
| 263 | for( auto& u : m_updateables ) |
| 264 | { |
| 265 | ContinueOnMainThread( [updatable = ITr2UpdateablePtr( u ), currentTime, simTime]() { |
| 266 | updatable->Update( currentTime, simTime ); |
| 267 | } ); |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | void Tr2Controller::SetVariable( const char* name, float value ) |
| 274 | { |
nothing calls this directly
no test coverage detected