| 1326 | } |
| 1327 | |
| 1328 | void Precipitation::processTick(const Move *) |
| 1329 | { |
| 1330 | //nothing to do on the server |
| 1331 | if (isServerObject() || mDataBlock == NULL || isHidden()) |
| 1332 | return; |
| 1333 | |
| 1334 | const U32 currTime = Platform::getVirtualMilliseconds(); |
| 1335 | |
| 1336 | // Update the storm if necessary |
| 1337 | if (mStormData.valid) |
| 1338 | { |
| 1339 | F32 t = (currTime - mStormData.startTime) / (F32)mStormData.totalTime; |
| 1340 | if (t >= 1) |
| 1341 | { |
| 1342 | mPercentage = mStormData.endPct; |
| 1343 | mStormData.valid = false; |
| 1344 | } |
| 1345 | else |
| 1346 | mPercentage = mStormData.startPct * (1-t) + mStormData.endPct * t; |
| 1347 | |
| 1348 | fillDropList(); |
| 1349 | } |
| 1350 | |
| 1351 | // Do we need to update the turbulence? |
| 1352 | if ( mTurbulenceData.valid ) |
| 1353 | { |
| 1354 | F32 t = (currTime - mTurbulenceData.startTime) / (F32)mTurbulenceData.totalTime; |
| 1355 | if (t >= 1) |
| 1356 | { |
| 1357 | mMaxTurbulence = mTurbulenceData.endMax; |
| 1358 | mTurbulenceSpeed = mTurbulenceData.endSpeed; |
| 1359 | mTurbulenceData.valid = false; |
| 1360 | } |
| 1361 | else |
| 1362 | { |
| 1363 | mMaxTurbulence = mTurbulenceData.startMax * (1-t) + mTurbulenceData.endMax * t; |
| 1364 | mTurbulenceSpeed = mTurbulenceData.startSpeed * (1-t) + mTurbulenceData.endSpeed * t; |
| 1365 | } |
| 1366 | |
| 1367 | mUseTurbulence = mMaxTurbulence > 0; |
| 1368 | } |
| 1369 | |
| 1370 | // If we're not being seen then pause the |
| 1371 | // simulation. Precip is generally noisy |
| 1372 | // enough that no one should notice. |
| 1373 | if (mLastRenderFrame != ShapeBase::sLastRenderFrame) |
| 1374 | return; |
| 1375 | |
| 1376 | //we need to update positions and do some collision here |
| 1377 | GameConnection* conn = GameConnection::getConnectionToServer(); |
| 1378 | if (!conn) |
| 1379 | return; //need connection to server |
| 1380 | |
| 1381 | ShapeBase* camObj = dynamic_cast<ShapeBase*>(conn->getCameraObject()); |
| 1382 | if (!camObj) |
| 1383 | return; |
| 1384 | |
| 1385 | PROFILE_START(PrecipProcess); |
nothing calls this directly
no test coverage detected