diff --git a/src/badguy/crusher.cpp b/src/badguy/crusher.cpp index 50ea42f3cb3..69828762cdf 100644 --- a/src/badguy/crusher.cpp +++ b/src/badguy/crusher.cpp @@ -653,18 +653,24 @@ Crusher::eye_position(bool right) const break; case RECOVERING: { + // Amplitude dependent on size. auto amplitude = static_cast(m_sprite->get_width()) / 64.0f * 2.0f; + + //Phase factor due to cooldown timer. + auto cooldown_phase_factor = (m_ic_size == NORMAL ? RECOVER_SPEED_NORMAL : RECOVER_SPEED_LARGE) + m_cooldown_timer * 13.0f; + + // Phase factor due to y position. + auto y_position_phase_factor = !m_sideways ? get_pos().y / 13 : get_pos().x / 13; + + auto phase_factor = y_position_phase_factor - cooldown_phase_factor; + // Eyes spin while crusher is recovering, giving a dazed impression. return Vector(sinf((right ? 1 : -1) * // X motion of each eye is opposite of the other. - ((!m_sideways ? get_pos().y / 13 : get_pos().x / 13) - // Phase factor due to y position. - (m_ic_size == NORMAL ? RECOVER_SPEED_NORMAL : RECOVER_SPEED_LARGE) + m_cooldown_timer * 13.0f)) * //Phase factor due to cooldown timer. - amplitude - (right ? 1 : -1) * // Amplitude dependent on size. + phase_factor) * amplitude - (right ? 1 : -1) * amplitude, // Offset to keep eyes visible. cosf((right ? 3.1415f : 0.0f) + // Eyes spin out of phase of eachother. - (!m_sideways ? get_pos().y / 13 : get_pos().x / 13) - // Phase factor due to y position. - (m_ic_size == NORMAL ? RECOVER_SPEED_NORMAL : RECOVER_SPEED_LARGE) + m_cooldown_timer * 13.0f) * //Phase factor due to cooldown timer. - amplitude - // Amplitude dependent on size. + phase_factor) * amplitude - amplitude); // Offset to keep eyes visible. } default: