| 97 | } |
| 98 | |
| 99 | void SpawnChaffBubble(const Vector3& pos, int roomNumber) |
| 100 | { |
| 101 | constexpr auto CHAFF_BUBBLE_SIZE_MAX = BUBBLE_SIZE_MAX / 8; |
| 102 | constexpr auto CHAFF_BUBBLE_SIZE_MIN = CHAFF_BUBBLE_SIZE_MAX / 2; |
| 103 | constexpr auto GRAVITY_MAX = 16.0f; |
| 104 | constexpr auto GRAVITY_MIN = GRAVITY_MAX / 4; |
| 105 | constexpr auto AMPLITUDE_MAX = BLOCK(1 / 16.0f); |
| 106 | constexpr auto WAVE_VELOCITY_MAX = 1 / 16.0f; |
| 107 | constexpr auto WAVE_VELOCITY_MIN = WAVE_VELOCITY_MAX / 2; |
| 108 | |
| 109 | auto& bubble = GetNewEffect(Bubbles, BUBBLE_COUNT_MAX); |
| 110 | |
| 111 | float size = Random::GenerateFloat(CHAFF_BUBBLE_SIZE_MIN, CHAFF_BUBBLE_SIZE_MAX); |
| 112 | |
| 113 | bubble.SpriteIndex = SPR_BUBBLES; |
| 114 | bubble.Position = |
| 115 | bubble.PositionBase = pos; |
| 116 | bubble.RoomNumber = roomNumber; |
| 117 | bubble.Color = BUBBLE_COLOR_WHITE; |
| 118 | |
| 119 | bubble.Size = |
| 120 | bubble.SizeMax = Vector2(size); |
| 121 | bubble.SizeMin = bubble.Size * 0.7f; |
| 122 | |
| 123 | bubble.Amplitude = Random::GenerateDirection() * AMPLITUDE_MAX; |
| 124 | bubble.WavePeriod = Vector3(Random::GenerateFloat(-PI, PI), Random::GenerateFloat(-PI, PI), Random::GenerateFloat(-PI, PI)); |
| 125 | bubble.WaveVelocity = Vector3( |
| 126 | Random::GenerateFloat(WAVE_VELOCITY_MIN, WAVE_VELOCITY_MAX), |
| 127 | Random::GenerateFloat(WAVE_VELOCITY_MIN, WAVE_VELOCITY_MAX), |
| 128 | Random::GenerateFloat(WAVE_VELOCITY_MIN, WAVE_VELOCITY_MAX)); |
| 129 | |
| 130 | bubble.Life = std::round(BUBBLE_LIFE_MAX * FPS); |
| 131 | bubble.OpacityStart = Random::GenerateFloat(BUBBLE_OPACTY_MIN, BUBBLE_OPACTY_MAX); |
| 132 | bubble.Gravity = Lerp(GRAVITY_MIN, GRAVITY_MAX, size / BUBBLE_SIZE_MAX); |
| 133 | bubble.OscillationPeriod = Random::GenerateFloat(0.0f, size); |
| 134 | bubble.OscillationVelocity = Lerp(BUBBLE_OSC_VELOCITY_MAX, BUBBLE_OSC_VELOCITY_MIN, size / CHAFF_BUBBLE_SIZE_MAX); |
| 135 | } |
| 136 | |
| 137 | void UpdateBubbles() |
| 138 | { |
no test coverage detected