| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef WEATHER_H |
| 20 | #define WEATHER_H |
| 21 | |
| 22 | #define WEATHER_FLAGS_RAIN 1 |
| 23 | #define WEATHER_FLAGS_LIGHTNING 2 |
| 24 | #define WEATHER_FLAGS_SNOW 4 |
| 25 | |
| 26 | #define MAX_RAIN_INTENSITY 50 |
| 27 | #define MAX_SNOW_INTENSITY 200 |
| 28 | |
| 29 | struct weather { |
| 30 | int flags; // see weather flags, above |
| 31 | |
| 32 | float snow_intensity_scalar; // how hard it is snowing |
| 33 | float rain_intensity_scalar; // how hard its raining |
| 34 | int rain_color; // the color of the rain |
| 35 | int lightning_color; // the color of the lightning |
| 36 | int sky_flash_color; // the color of the sky when lightning occurs |
| 37 | |
| 38 | uint8_t lightning_sequence; |
| 39 | |
| 40 | float last_lightning_evaluation_time; |
| 41 | float lightning_interval_time; |
| 42 | int lightning_rand_value; |
| 43 | |
| 44 | int snowflakes_to_create; |
| 45 | |
| 46 | }; |
| 47 | |
| 48 | extern weather Weather; |
| 49 | |
| 50 | // resets the weather so there is nothing happening |
| 51 | void ResetWeather(); |
| 52 | |
| 53 | // Makes droplets appear on the windshield, plus makes rain fall in the distance |
| 54 | void DoRainEffect(); |
| 55 | |
| 56 | // does all the weather stuff that is going to be done for this frame |
| 57 | void DoWeatherForFrame(); |
| 58 | |
| 59 | // Sets the state of the rain to on or off, plus sets the intensity of the rain (0 to 1) |
| 60 | void SetRainState(int on, float intensity); |
| 61 | |
| 62 | // Sets the state of lightning to on or off, plus allows the setting of how often to check |
| 63 | // for lightning and the randomness at which lightning happens |
| 64 | void SetLightningState(int on, float interval_time, int randval); |
| 65 | |
| 66 | // Sets the state of the snow to on or off, plus sets the intensity of the snow (0 to 1) |
| 67 | void SetSnowState(int on, float intensity); |
| 68 | |
| 69 | #endif |