Dynamical Effects in Resonant X-Ray Diffraction.