| 44 | } |
| 45 | |
| 46 | void SpawnSplashDrips(const Vector3& pos, int roomNumber, unsigned int count, bool isSmallSplash) |
| 47 | { |
| 48 | constexpr auto LIFE_MAX = 4.0f; |
| 49 | constexpr auto VELOCITY_BASE = 16.0f; |
| 50 | constexpr auto VERTICAL_VELOCITY_HIGH_MAX = 64.0f; |
| 51 | constexpr auto VERTICAL_VELOCITY_HIGH_MIN = 32.0f; |
| 52 | constexpr auto VERTICAL_VELOCITY_LOW_MAX = 24.0f; |
| 53 | constexpr auto VERTICAL_VELOCITY_LOW_MIN = 16.0f; |
| 54 | constexpr auto SPAWN_RADIUS_LARGE = BLOCK(1 / 8.0f); |
| 55 | constexpr auto SPAWN_RADIUS_SMALL = BLOCK(1 / 64.0f); |
| 56 | |
| 57 | // TODO: Can spawn beneath water surface. |
| 58 | auto sphere = BoundingSphere(pos, isSmallSplash ? SPAWN_RADIUS_SMALL : SPAWN_RADIUS_LARGE); |
| 59 | |
| 60 | for (int i = 0; i < count; i++) |
| 61 | { |
| 62 | auto dripPos = Random::GeneratePointInSphere(sphere); |
| 63 | auto direction = dripPos - pos; |
| 64 | direction.Normalize(); |
| 65 | |
| 66 | float verticalVel = isSmallSplash ? |
| 67 | Random::GenerateFloat(VERTICAL_VELOCITY_LOW_MIN, VERTICAL_VELOCITY_LOW_MAX) : |
| 68 | Random::GenerateFloat(VERTICAL_VELOCITY_HIGH_MIN, VERTICAL_VELOCITY_HIGH_MAX); |
| 69 | auto vel = (direction * VELOCITY_BASE) + Vector3(0.0f, -verticalVel, 0.0f); |
| 70 | |
| 71 | float systemGravity = g_GameFlow->GetSettings()->Physics.Gravity; |
| 72 | |
| 73 | float gravity = isSmallSplash ? |
| 74 | Random::GenerateFloat(systemGravity / 3, systemGravity / 2) : |
| 75 | Random::GenerateFloat(systemGravity / 2, systemGravity); |
| 76 | |
| 77 | SpawnDrip(dripPos, roomNumber, vel, LIFE_MAX, gravity); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | void SpawnWetnessDrip(const Vector3& pos, int roomNumber) |
| 82 | { |