| 196 | } |
| 197 | |
| 198 | void Weather::DrawParticles(Bitmap& dst, const Bitmap& particle, const Rect rect, int abase, int tmax) { |
| 199 | auto* bitmap = ApplyToneEffect(particle, rect); |
| 200 | |
| 201 | const auto strength = Main_Data::game_screen->GetWeatherStrength(); |
| 202 | const auto& particles = Main_Data::game_screen->GetParticles(); |
| 203 | |
| 204 | const int num_particles = num_rain_or_snow_particles[Utils::Clamp(strength, 0, num_strength - 1)]; |
| 205 | const auto ainc = abase + strength; |
| 206 | |
| 207 | auto surface_rect = weather_surface->GetRect(); |
| 208 | weather_surface->Clear(); |
| 209 | |
| 210 | assert(num_particles <= static_cast<int>(particles.size())); |
| 211 | |
| 212 | for (int i = 0; i < num_particles; ++i) { |
| 213 | auto& p = particles[i]; |
| 214 | if (p.t > tmax) { |
| 215 | continue; |
| 216 | } |
| 217 | |
| 218 | auto alpha = std::min(ainc * p.t, 255); |
| 219 | |
| 220 | weather_surface->EdgeMirrorBlit(p.x, p.y, *bitmap, rect, true, true, alpha); |
| 221 | } |
| 222 | |
| 223 | const auto shake_x = Main_Data::game_screen->GetShakeOffsetX(); |
| 224 | const auto shake_y = Main_Data::game_screen->GetShakeOffsetY(); |
| 225 | auto pan_rect = Main_Data::game_screen->GetScreenEffectsRect(); |
| 226 | dst.TiledBlit(-pan_rect.x + shake_x, -pan_rect.y + shake_y, surface_rect, *weather_surface, dst.GetRect(), Opacity::Opaque()); |
| 227 | } |
| 228 | |
| 229 | void Weather::DrawFog(Bitmap& dst) { |
| 230 | if (!fog_bitmap) { |
nothing calls this directly
no test coverage detected