diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2007-01-18 00:44:48 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2007-01-18 00:44:48 +0000 |
commit | c189fc0b579352c34285fcf03db4b5bca5cd3804 (patch) | |
tree | ba32536c8bf3b23f311e7ae77aa69f9cbaec4582 /indra/newview | |
parent | 73f0b5029aa247a563862fc39152ce58baa407aa (diff) |
Result of svn merge -r56700:56797 svn+ssh://svn/svn/linden/branches/more-random into release.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llagent.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llcloud.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llhudeffectbeam.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerpartsim.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerpartsource.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvograss.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llvopartgroup.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llvotreenew.h | 6 |
11 files changed, 45 insertions, 47 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5a08f94b71..ef4daf7fad 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2096,11 +2096,11 @@ void LLAgent::updateWanderTarget() F32 rand_x; F32 rand_y; - if (mWanderTimer.checkExpirationAndReset(frand(MAX_WANDER_TIME))) + if (mWanderTimer.checkExpirationAndReset(ll_frand(MAX_WANDER_TIME))) { // Pick a random spot to wander towards num_regions = gWorldPointer->mActiveRegionList.getLength(); - S32 region_num = llround(frand(1.f) * num_regions); + S32 region_num = llround(ll_frand() * num_regions); rand_region = gWorldPointer->mActiveRegionList.getFirstData(); S32 i = 0; while (i < region_num) @@ -2108,8 +2108,8 @@ void LLAgent::updateWanderTarget() rand_region = gWorldPointer->mActiveRegionList.getNextData(); i++; } - rand_x = frand(rand_region->getWidth()); - rand_y = frand(rand_region->getWidth()); + rand_x = ll_frand(rand_region->getWidth()); + rand_y = ll_frand(rand_region->getWidth()); stopAutoPilot(); startAutoPilotGlobal(rand_region->getPosGlobalFromRegion(LLVector3(rand_x, rand_y, 0.f))); @@ -5668,7 +5668,7 @@ void LLAgent::fidget() // pick a random fidget anim here S32 oldFidget = mCurrentFidget; - mCurrentFidget = gLindenLabRandomNumber.llrand(NUM_AGENT_STAND_ANIMS); + mCurrentFidget = ll_rand(NUM_AGENT_STAND_ANIMS); if (mCurrentFidget != oldFidget) { @@ -5700,7 +5700,7 @@ void LLAgent::fidget() } // calculate next fidget time - mNextFidgetTime = curTime + gLindenLabRandomNumber.llfrand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME; + mNextFidgetTime = curTime + ll_frand(MAX_FIDGET_TIME - MIN_FIDGET_TIME) + MIN_FIDGET_TIME; } } } diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index c7e69a043f..cdba49c40d 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -174,9 +174,9 @@ void LLCloudGroup::updatePuffCount() for (i = current_puff_count; i < target_puff_count; i++) { puff_pos_global = mVOCloudsp->getPositionGlobal(); - F32 x = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; - F32 y = frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; - F32 z = frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; + F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; + F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; + F32 z = ll_frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; puff_pos_global += LLVector3d(x, y, z); mCloudPuffs[i].mPositionGlobal = puff_pos_global; mCloudPuffs[i].mAlpha = 0.01f; diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index 069986eb77..2b9b07a9e3 100644 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -350,9 +350,9 @@ void LLHUDEffectBeam::setupParticle(const S32 i) // Generate a random offset for the target point. const F32 SCALE = 0.5f; F32 x, y, z; - x = frand(SCALE) - 0.5f*SCALE; - y = frand(SCALE) - 0.5f*SCALE; - z = frand(SCALE) - 0.5f*SCALE; + x = ll_frand(SCALE) - 0.5f*SCALE; + y = ll_frand(SCALE) - 0.5f*SCALE; + z = ll_frand(SCALE) - 0.5f*SCALE; LLVector3d target_pos_global(mTargetPos); target_pos_global += LLVector3d(x, y, z); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index eabc81994f..dff2a6c9e0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1980,7 +1980,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) && chatter != gAgent.getAvatarObject()) { gAgent.heardChat(chat); - if (gLindenLabRandomNumber.llrand(2) == 0) + if (ll_rand(2) == 0) { gAgent.setLookAt(LOOKAT_TARGET_AUTO_LISTEN, chatter, LLVector3::zero); } diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index b67062e0a9..db18b74d1f 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -399,7 +399,7 @@ BOOL LLViewerPartSim::shouldAddPart() F32 frac = (F32)sParticleCount/(F32)sMaxParticleCount; frac -= 0.75; frac *= 3.f; - if (frand(1.f) < frac) + if (ll_frand() < frac) { // Skip... return FALSE; @@ -530,9 +530,9 @@ void LLViewerPartSim::updateSimulation() // pain. S32 i; S32 count = mViewerPartSources.count(); - S32 start = (S32)frand((F32)count); + S32 start = (S32)ll_frand((F32)count); S32 dir = 1; - if (frand(1.0) > 0.5f) + if (ll_frand() > 0.5f) { dir = -1; } diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index e73f77e463..981c5531c9 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -194,9 +194,9 @@ void LLViewerPartSourceScript::update(const F32 dt) F32 mvs; do { - part_dir_vector.mV[VX] = frand(2.f) - 1.f; - part_dir_vector.mV[VY] = frand(2.f) - 1.f; - part_dir_vector.mV[VZ] = frand(2.f) - 1.f; + part_dir_vector.mV[VX] = ll_frand(2.f) - 1.f; + part_dir_vector.mV[VY] = ll_frand(2.f) - 1.f; + part_dir_vector.mV[VZ] = ll_frand(2.f) - 1.f; mvs = part_dir_vector.magVecSquared(); } while ((mvs > 1.f) || (mvs < 0.01f)); @@ -204,7 +204,7 @@ void LLViewerPartSourceScript::update(const F32 dt) part_dir_vector.normVec(); part.mPosAgent += mPartSysData.mBurstRadius*part_dir_vector; part.mVelocity = part_dir_vector; - F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); + F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); part.mVelocity *= speed; } else if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE @@ -223,10 +223,10 @@ void LLViewerPartSourceScript::update(const F32 dt) F32 outerAngle = mPartSysData.mOuterAngle; // generate a random angle within the given space... - F32 angle = innerAngle + frand(outerAngle - innerAngle); + F32 angle = innerAngle + ll_frand(outerAngle - innerAngle); // split which side it will go on randomly... - if (frand(1.0) < 0.5) + if (ll_frand() < 0.5) { angle = -angle; } @@ -237,7 +237,7 @@ void LLViewerPartSourceScript::update(const F32 dt) // If this is a cone pattern, rotate again to create the cone. if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE) { - part_dir_vector.rotVec(frand(4*F_PI), 0.0, 0.0, 1.0); + part_dir_vector.rotVec(ll_frand(4*F_PI), 0.0, 0.0, 1.0); } // Only apply this rotation if using the deprecated angles. @@ -257,7 +257,7 @@ void LLViewerPartSourceScript::update(const F32 dt) part.mVelocity = part_dir_vector; - F32 speed = mPartSysData.mBurstSpeedMin + frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); + F32 speed = mPartSysData.mBurstSpeedMin + ll_frand(mPartSysData.mBurstSpeedMax - mPartSysData.mBurstSpeedMin); part.mVelocity *= speed; } else @@ -440,7 +440,7 @@ void LLViewerPartSourceSpiral::update(const F32 dt) part.mLastUpdateTime = 0.f; part.mScale.mV[0] = 0.25f; part.mScale.mV[1] = 0.25f; - part.mParameter = frand(F_TWO_PI); + part.mParameter = ll_frand(F_TWO_PI); gWorldPointer->mPartSim.addPart(part); } @@ -701,7 +701,7 @@ void LLViewerPartSourceChat::update(const F32 dt) part.mLastUpdateTime = 0.f; part.mScale.mV[0] = 0.25f; part.mScale.mV[1] = 0.25f; - part.mParameter = frand(F_TWO_PI); + part.mParameter = ll_frand(F_TWO_PI); gWorldPointer->mPartSim.addPart(part); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d1bcacb5c4..b60e19ac93 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2363,7 +2363,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) static const F32 UPDATE_TIME = .5f; if (mUpdateLODTimer.hasExpired()) { - mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + frand(0.5f))); + mUpdateLODTimer.setTimerExpirySec(UPDATE_TIME * (.75f + ll_frand(0.5f))); updateJointLODs(); } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index a1bfe31f1e..692b757d9e 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -210,26 +210,26 @@ void LLVOGrass::initClass() { if (1) //(i%2 == 0) Uncomment for X blading { - F32 u = sqrt(-2.0f * log(frand(1.0))); - F32 v = 2.0f * F_PI * frand(1.0); + F32 u = sqrt(-2.0f * log(ll_frand())); + F32 v = 2.0f * F_PI * ll_frand(); x = u * sin(v) * GRASS_DISTRIBUTION_SD; y = u * cos(v) * GRASS_DISTRIBUTION_SD; - rot = frand(F_PI); + rot = ll_frand(F_PI); } else { - rot += (F_PI*0.4f + frand(0.2f*F_PI)); + rot += (F_PI*0.4f + ll_frand(0.2f*F_PI)); } exp_x[i] = x; exp_y[i] = y; rot_x[i] = sin(rot); rot_y[i] = cos(rot); - dz_x[i] = frand(GRASS_BLADE_BASE * 0.25f); - dz_y[i] = frand(GRASS_BLADE_BASE * 0.25f); - w_mod[i] = 0.5f + frand(1.f); // Degree to which blade is moved by wind + dz_x[i] = ll_frand(GRASS_BLADE_BASE * 0.25f); + dz_y[i] = ll_frand(GRASS_BLADE_BASE * 0.25f); + w_mod[i] = 0.5f + ll_frand(); // Degree to which blade is moved by wind } } diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index caba9e3aef..38db15c0c7 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -34,7 +34,7 @@ LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegi setNumTEs(1); setTETexture(0, LLUUID::null); mbCanSelect = FALSE; // users can't select particle systems - mDebugColor = LLColor4(frand(1.f), frand(1.f), frand(1.f), 1.f); + mDebugColor = LLColor4(ll_frand(), ll_frand(), ll_frand(), 1.f); } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 5c76dc5a87..2f580ba5f7 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -645,20 +645,18 @@ void LLVOSky::restoreGL() void LLVOSky::updateHaze() { - time_t timer; - time(&timer); - static LLRand WeatherRandomNumber(gmtime(&timer)->tm_mday); + static LLRandLagFib607 weather_generator(LLUUID::getRandomSeed()); if (gSavedSettings.getBOOL("FixedWeather")) { - WeatherRandomNumber.seed(8008135); + weather_generator.seed(8008135); } const F32 fo_upper_bound = 5; const F32 sca_upper_bound = 6; - const F32 fo = 1 + WeatherRandomNumber.llfrand(fo_upper_bound - 1); + const F32 fo = 1 + (F32)weather_generator() *(fo_upper_bound - 1); const static F32 upper = 0.5f / gFastLn.ln(fo_upper_bound); mHaze.setFalloff(fo); - mHaze.setG(WeatherRandomNumber.llfrand(0.0f + upper * gFastLn.ln(fo))); + mHaze.setG((F32)weather_generator() * (0.0f + upper * gFastLn.ln(fo))); LLColor3 sca; const F32 cd = mCloudDensity * 3; F32 min_r = cd - 1; @@ -672,7 +670,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[0] = min_r + WeatherRandomNumber.llfrand(max_r - min_r);//frand(6); + sca.mV[0] = min_r + (F32)weather_generator() * (max_r - min_r); min_r = sca.mV[0] - 0.1f; if (min_r < 0) @@ -685,7 +683,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[1] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); + sca.mV[1] = min_r + (F32)weather_generator() * (max_r - min_r); min_r = sca.mV[1]; if (min_r < 0) @@ -698,7 +696,7 @@ void LLVOSky::updateHaze() max_r = sca_upper_bound; } - sca.mV[2] = min_r + WeatherRandomNumber.llfrand(max_r - min_r); + sca.mV[2] = min_r + (F32)weather_generator() * (max_r - min_r); sca = AIR_SCA_AVG * sca; diff --git a/indra/newview/llvotreenew.h b/indra/newview/llvotreenew.h index e027c3860a..202f526acb 100644 --- a/indra/newview/llvotreenew.h +++ b/indra/newview/llvotreenew.h @@ -59,7 +59,7 @@ public: // return +- negPos static S32 llrand_signed(S32 negPos) { - return (gLindenLabRandomNumber.llrand((U32)negPos * 2) - negPos); + return (ll_rand((U32)negPos * 2) - negPos); }; static S32 llrand_signed(S32 negPos, U32 index) @@ -75,7 +75,7 @@ public: // return +- negPos static F32 llfrand_signed(F32 negPos) { - return (gLindenLabRandomNumber.llfrand(negPos * 2.0f) - negPos); + return (ll_frand(negPos * 2.0f) - negPos); }; static F32 llfrand_signed(F32 negPos, U32 index) @@ -91,7 +91,7 @@ public: // return between 0-pos static F32 llfrand_unsigned(F32 pos) { - return gLindenLabRandomNumber.llfrand(pos); + return ll_frand(pos); }; static void cleanupTextures() {}; // not needed anymore |