| 16 | std::array<SplashEffect, SPLASH_EFFECT_COUNT_MAX> SplashEffects; |
| 17 | |
| 18 | void SetupSplash(const SplashEffectSetup* const setup, int room) |
| 19 | { |
| 20 | constexpr auto SETUP_COUNT_MAX = 3; |
| 21 | |
| 22 | int splashSetupCount = 0; |
| 23 | float splashVel = 0.0f; |
| 24 | |
| 25 | for (auto& splash : SplashEffects) |
| 26 | { |
| 27 | if (splash.isActive) |
| 28 | continue; |
| 29 | |
| 30 | if (splashSetupCount == 0) |
| 31 | { |
| 32 | float splashPower = std::min(256.0f, setup->SplashPower); |
| 33 | |
| 34 | splash.isActive = true; |
| 35 | splash.Position = setup->Position; |
| 36 | splash.life = 62; |
| 37 | splash.isRipple = false; |
| 38 | splash.InnerRadius = setup->InnerRadius; |
| 39 | splashVel = splashPower / 16; |
| 40 | splash.InnerRadialVel = splashVel; |
| 41 | splash.HeightSpeed = splashPower * 1.2f; |
| 42 | splash.height = 0; |
| 43 | splash.HeightVel = -16; |
| 44 | splash.OuterRadius = setup->InnerRadius / 3; |
| 45 | splash.outerRadialVel = splashVel * 1.5f; |
| 46 | splash.SpriteSeqStart = 8; // Splash texture. |
| 47 | splashSetupCount++; |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | float thickness = Random::GenerateFloat(64, 128); |
| 52 | |
| 53 | splash.isActive = true; |
| 54 | splash.Position = setup->Position; |
| 55 | splash.isRipple = true; |
| 56 | float vel = 0.0f; |
| 57 | |
| 58 | if (splashSetupCount == 2) |
| 59 | { |
| 60 | vel = (splashVel / 16) + Random::GenerateFloat(2, 4); |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | vel = (splashVel / 7) + Random::GenerateFloat(3, 7); |
| 65 | } |
| 66 | |
| 67 | splash.InnerRadius = 0.0f; |
| 68 | splash.InnerRadialVel = vel * 1.3f; |
| 69 | splash.OuterRadius = thickness; |
| 70 | splash.outerRadialVel = vel * 2.3f; |
| 71 | splash.HeightSpeed = 128; |
| 72 | splash.height = 0; |
| 73 | splash.HeightVel = -16; |
| 74 | |
| 75 | float alpha = (vel / (splashVel / 2)) + 16; |
no test coverage detected