| 1204 | } |
| 1205 | |
| 1206 | void World::SimulateLandscape(float deltaT) |
| 1207 | { |
| 1208 | LightSun* sun = _scene.MainLight(); |
| 1209 | float timeD = deltaT * OneSecond; |
| 1210 | auto& input = InputSubsystem::Instance(); |
| 1211 | |
| 1212 | if (!IsSimulationEnabled()) |
| 1213 | { |
| 1214 | timeD = 0; |
| 1215 | } |
| 1216 | #if _ENABLE_CHEATS |
| 1217 | { |
| 1218 | timeD += deltaT * OneHour * input.GetCheat1(SDL_SCANCODE_T); |
| 1219 | timeD -= deltaT * OneHour * input.GetCheat1(SDL_SCANCODE_Y); |
| 1220 | } |
| 1221 | if (input.GetCheat1ToDo(SDL_SCANCODE_G)) |
| 1222 | timeD += OneDay; |
| 1223 | if (input.GetCheat1ToDo(SDL_SCANCODE_H)) |
| 1224 | timeD -= OneDay; |
| 1225 | #endif |
| 1226 | |
| 1227 | timeD += _timeToSkip; |
| 1228 | _timeToSkip = 0; |
| 1229 | // |
| 1230 | if (Glob.clock.AdvanceTime(timeD)) |
| 1231 | { |
| 1232 | sun->Recalculate(this); |
| 1233 | } |
| 1234 | float scaledTime = timeD * (1 / OneSecond); |
| 1235 | GLOB_LAND->Simulate(scaledTime); |
| 1236 | _scene.MainLightChanged(); |
| 1237 | |
| 1238 | #if _ENABLE_CHEATS |
| 1239 | if (_mode != GModeNetware) |
| 1240 | { |
| 1241 | if (input.GetCheat1ToDo(SDL_SCANCODE_MINUS)) |
| 1242 | { |
| 1243 | GLandscape->ResampleTerrain(+1); |
| 1244 | Foundation::GlobalShowMessage(1000, "Terrain subdivision %d", TerrainRangeLog - LandRangeLog); |
| 1245 | } |
| 1246 | if (input.GetCheat1ToDo(SDL_SCANCODE_EQUALS)) |
| 1247 | { |
| 1248 | GLandscape->SubdivideTerrain(+1); |
| 1249 | Foundation::GlobalShowMessage(1000, "Terrain subdivision %d", TerrainRangeLog - LandRangeLog); |
| 1250 | } |
| 1251 | } |
| 1252 | #endif |
| 1253 | |
| 1254 | if (scaledTime > 0) |
| 1255 | { |
| 1256 | saturate(_wantedOvercast, 0, 1); |
| 1257 | saturate(_wantedFog, 0, 1); |
| 1258 | float diffOvercast = _wantedOvercast - _actualOvercast; |
| 1259 | float diffFog = _wantedFog - _actualFog; |
| 1260 | saturate(diffOvercast, -_speedOvercast * scaledTime, +_speedOvercast * scaledTime); |
| 1261 | saturate(diffFog, -_speedFog * scaledTime, +_speedFog * scaledTime); |
| 1262 | _actualOvercast += diffOvercast; |
| 1263 | _actualFog += diffFog; |
nothing calls this directly
no test coverage detected