MCPcopy Create free account
hub / github.com/EasyRPG/Player / DrawParticles

Method DrawParticles

src/weather.cpp:198–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198void 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
229void Weather::DrawFog(Bitmap& dst) {
230 if (!fog_bitmap) {

Callers

nothing calls this directly

Calls 10

minFunction · 0.85
GetWeatherStrengthMethod · 0.80
GetRectMethod · 0.80
EdgeMirrorBlitMethod · 0.80
GetShakeOffsetXMethod · 0.80
GetShakeOffsetYMethod · 0.80
GetScreenEffectsRectMethod · 0.80
TiledBlitMethod · 0.80
ClearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected