| 465 | } |
| 466 | |
| 467 | bool PlayerData::preload(bool server, String &errorStr) |
| 468 | { |
| 469 | if(!Parent::preload(server, errorStr)) |
| 470 | return false; |
| 471 | if (!server) { |
| 472 | for (U32 i = 0; i < MaxSounds; ++i) |
| 473 | { |
| 474 | _setPlayerSound(getPlayerSound(i), i); |
| 475 | if (getPlayerSound(i) != StringTable->EmptyString()) |
| 476 | { |
| 477 | if (!getPlayerSoundProfile(i)) |
| 478 | Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]); |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | // |
| 483 | runSurfaceCos = mCos(mDegToRad(runSurfaceAngle)); |
| 484 | jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle)); |
| 485 | if (minJumpEnergy < jumpEnergyDrain) |
| 486 | minJumpEnergy = jumpEnergyDrain; |
| 487 | |
| 488 | // Jetting |
| 489 | if (jetMinJumpEnergy < jetJumpEnergyDrain) |
| 490 | jetMinJumpEnergy = jetJumpEnergyDrain; |
| 491 | |
| 492 | // Validate some of the data |
| 493 | if (fallingSpeedThreshold > 0.0f) |
| 494 | Con::printf("PlayerData:: Falling speed threshold should be downwards (negative)"); |
| 495 | |
| 496 | if (recoverDelay > (1 << RecoverDelayBits) - 1) { |
| 497 | recoverDelay = (1 << RecoverDelayBits) - 1; |
| 498 | Con::printf("PlayerData:: Recover delay exceeds range (0-%d)",recoverDelay); |
| 499 | } |
| 500 | if (jumpDelay > (1 << JumpDelayBits) - 1) { |
| 501 | jumpDelay = (1 << JumpDelayBits) - 1; |
| 502 | Con::printf("PlayerData:: Jump delay exceeds range (0-%d)",jumpDelay); |
| 503 | } |
| 504 | |
| 505 | // If we don't have a shape don't crash out trying to |
| 506 | // setup animations and sequences. |
| 507 | if ( mShape ) |
| 508 | { |
| 509 | // Go ahead a pre-load the player shape |
| 510 | TSShapeInstance* si = new TSShapeInstance(mShape, false); |
| 511 | TSThread* thread = si->addThread(); |
| 512 | |
| 513 | // Extract ground transform velocity from animations |
| 514 | // Get the named ones first so they can be indexed directly. |
| 515 | ActionAnimation *dp = &actionList[0]; |
| 516 | for (S32 i = 0; i < NumTableActionAnims; i++,dp++) |
| 517 | { |
| 518 | ActionAnimationDef *sp = &ActionAnimationList[i]; |
| 519 | dp->name = sp->name; |
| 520 | dp->dir.set(sp->dir.x,sp->dir.y,sp->dir.z); |
| 521 | dp->sequence = mShape->findSequence(sp->name); |
| 522 | |
| 523 | // If this is a sprint action and is missing a sequence, attempt to use |
| 524 | // the standard run ones. |
nothing calls this directly
no test coverage detected