does all the weather stuff that is going to be done for this frame
| 229 | |
| 230 | // does all the weather stuff that is going to be done for this frame |
| 231 | void DoWeatherForFrame() { |
| 232 | int i; |
| 233 | int hear_thunder = 0; |
| 234 | |
| 235 | if (OBJECT_OUTSIDE(Player_object)) |
| 236 | hear_thunder = 1; |
| 237 | else { |
| 238 | int roomnum = Player_object->roomnum; |
| 239 | room *rp = &Rooms[roomnum]; |
| 240 | |
| 241 | for (i = 0; i < rp->num_portals && hear_thunder == 0; i++) { |
| 242 | if (rp->portals[i].croom == -1) |
| 243 | hear_thunder = 1; |
| 244 | else if (Rooms[rp->portals[i].croom].flags & RF_EXTERNAL) |
| 245 | hear_thunder = 1; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | if (Weather.flags & WEATHER_FLAGS_RAIN) |
| 250 | DoRainEffect(); |
| 251 | |
| 252 | if (Weather.flags & WEATHER_FLAGS_SNOW) |
| 253 | DoSnowEffect(); |
| 254 | |
| 255 | if (Weather.flags & WEATHER_FLAGS_LIGHTNING) { |
| 256 | if ((Gametime - Weather.last_lightning_evaluation_time) > Weather.lightning_interval_time) { |
| 257 | // Check to see if we should draw some lightning |
| 258 | Weather.last_lightning_evaluation_time = Gametime; |
| 259 | ASSERT(Weather.lightning_rand_value > 0); |
| 260 | if (ps_rand() <= Weather.lightning_rand_value) { |
| 261 | // Start the lightning sequence |
| 262 | Weather.lightning_sequence = 1; |
| 263 | |
| 264 | if ((ps_rand() % 7) == 0 && hear_thunder) |
| 265 | Sound_system.Play2dSound(SOUND_LIGHTNING); |
| 266 | } |
| 267 | |
| 268 | if (hear_thunder && (ps_rand() % (Weather.lightning_rand_value * 3)) == 0) { |
| 269 | if (ThunderA_sound_handle == -1) |
| 270 | ThunderA_sound_handle = FindSoundName("ThunderA"); |
| 271 | if (ThunderB_sound_handle == -1) |
| 272 | ThunderB_sound_handle = FindSoundName("ThunderB"); |
| 273 | |
| 274 | if (ps_rand() % 2) |
| 275 | Sound_system.Play2dSound(ThunderA_sound_handle); |
| 276 | else |
| 277 | Sound_system.Play2dSound(ThunderB_sound_handle); |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // Sets the state of the rain to on or off, plus sets the intensity of the rain (0 to 1) |
| 284 | void SetRainState(int on, float intensity) { |
no test coverage detected