MCPcopy Create free account
hub / github.com/carbonengine/trinity / UpdateSyncronous

Method UpdateSyncronous

trinity/Eve/SpaceObject/EveMobile.cpp:154–200  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Override base ::UpdateSyncronous() function, so we can update the turrets and their positions (if they are attached to animated bones!) --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

152// their positions (if they are attached to animated bones!)
153// --------------------------------------------------------------------------------
154void EveMobile::UpdateSyncronous( const EveUpdateContext& updateContext )
155{
156 EveSpaceObject2::UpdateSyncronous( updateContext );
157
158 Be::Time time = updateContext.GetTime();
159 float deltaT = updateContext.GetDeltaT();
160
161 // turret update
162 unsigned int locatorInfoIdx = 0;
163 unsigned int activeTurretCount = 0;
164 for( auto it = m_turretSets.begin(); it != m_turretSets.end(); ++it )
165 {
166 // If the turretSet is in aggressive mode then update active turret counter
167 if( ( *it )->GetState() > EveTurretSet::STATE_TARGETING )
168 {
169 activeTurretCount++;
170 }
171
172 // if the turretset is of locatortype JOINT, it means it is attached to an
173 // animated bone, sowe must update the positions of all turrets in the set
174 if( locatorInfoIdx < m_turretSetsLocatorInfo.size() )
175 {
176 const TurretSetLocatorInfo* locInfo = &m_turretSetsLocatorInfo[locatorInfoIdx];
177 // only animated if is of type JOINT!
178 if( locInfo->type == ELT_JOINT )
179 {
180 for( unsigned int turretIdx = 0; turretIdx < locInfo->locatorIndices.size(); ++turretIdx )
181 {
182 // this ship knows position
183 const Matrix* localMatrix = GetLocatorTransform( locInfo->type, locInfo->locatorIndices[turretIdx] );
184 // set it
185 if( localMatrix )
186 {
187 ( *it )->SetLocalTransform( turretIdx, localMatrix );
188 ( *it )->UpdateTurretTransforms( GetTurretTransform( ( *it )->GetSwarmID() ) );
189 }
190 }
191 }
192 }
193 // call standard update function
194 ( *it )->UpdateSyncronous( updateContext, GetTurretTransform( ( *it )->GetSwarmID() ) );
195
196 // next!
197 ++locatorInfoIdx;
198 }
199 m_activeTurretCount = activeTurretCount;
200}
201
202// --------------------------------------------------------------------------------
203// Description:

Callers

nothing calls this directly

Calls 8

GetDeltaTMethod · 0.80
sizeMethod · 0.80
SetLocalTransformMethod · 0.80
GetTimeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected