MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / preload

Method preload

Engine/source/T3D/rigidShape.cpp:294–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292
293
294bool RigidShapeData::preload(bool server, String &errorStr)
295{
296 if (!Parent::preload(server, errorStr))
297 return false;
298
299 // RigidShape objects must define a collision detail
300 if (!collisionDetails.size() || collisionDetails[0] == -1)
301 {
302 Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
303 errorStr = String::ToString("RigidShapeData: Couldn't load shape \"%s\"",shapeName);
304 return false;
305 }
306
307 // Resolve objects transmitted from server
308 if (!server) {
309 for (S32 i = 0; i < Body::MaxSounds; i++)
310 sfxResolve( &body.sound[ i ], errorStr );
311 }
312
313 if( !dustEmitter && dustID != 0 )
314 {
315 if( !Sim::findObject( dustID, dustEmitter ) )
316 {
317 Con::errorf( ConsoleLogEntry::General, "RigidShapeData::preload Invalid packet, bad datablockId(dustEmitter): 0x%x", dustID );
318 }
319 }
320
321 U32 i;
322 for( i=0; i<VC_NUM_SPLASH_EMITTERS; i++ )
323 {
324 if( !splashEmitterList[i] && splashEmitterIDList[i] != 0 )
325 {
326 if( !Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) )
327 {
328 Con::errorf( ConsoleLogEntry::General, "RigidShapeData::preload Invalid packet, bad datablockId(splashEmitter): 0x%x", splashEmitterIDList[i] );
329 }
330 }
331 }
332
333 if (dragForce <= 0.01f)
334 {
335 Con::warnf("RigidShapeData::preload: dragForce must be at least 0.01");
336 dragForce = 0.01f;
337 }
338
339 if (vertFactor < 0.0f || vertFactor > 1.0f)
340 {
341 Con::warnf("RigidShapeData::preload: vert factor must be [0, 1]");
342 vertFactor = vertFactor < 0.0f ? 0.0f : 1.0f;
343 }
344
345 if( !dustTrailEmitter && dustTrailID != 0 )
346 {
347 if( !Sim::findObject( dustTrailID, dustTrailEmitter ) )
348 {
349 Con::errorf( ConsoleLogEntry::General, "RigidShapeData::preload Invalid packet, bad datablockId(dustTrailEmitter): 0x%x", dustTrailID );
350 }
351 }

Callers

nothing calls this directly

Calls 5

errorfFunction · 0.85
sfxResolveFunction · 0.85
warnfFunction · 0.85
findObjectFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected