| 148 | } |
| 149 | |
| 150 | void BattleAnimation::ProcessAnimationTiming(const lcf::rpg::AnimationTiming& timing) { |
| 151 | // Play the SE. |
| 152 | Main_Data::game_system->SePlay(timing.se); |
| 153 | if (IsOnlySound()) { |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | // Flash. |
| 158 | ProcessAnimationFlash(timing); |
| 159 | |
| 160 | // Shake (only happens in battle). |
| 161 | if (Game_Battle::IsBattleRunning()) { |
| 162 | switch (timing.screen_shake) { |
| 163 | case lcf::rpg::AnimationTiming::ScreenShake_nothing: |
| 164 | break; |
| 165 | case lcf::rpg::AnimationTiming::ScreenShake_target: |
| 166 | // FIXME: Estimate, see below for screen shake. |
| 167 | ShakeTargets(3, 5, 32); |
| 168 | break; |
| 169 | case lcf::rpg::AnimationTiming::ScreenShake_screen: |
| 170 | Game_Screen* screen = Main_Data::game_screen.get(); |
| 171 | // FIXME: This is not proven accurate. Screen captures show that |
| 172 | // the shake effect lasts for 16 animation frames (32 real frames). |
| 173 | // The maximum offset observed was 6 or 7, which makes these numbers |
| 174 | // seem reasonable. |
| 175 | screen->ShakeOnce(3, 5, 32); |
| 176 | break; |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | static int CalculateFlashPower(int frames, int power) { |
| 182 | // This algorithm was determined numerically by measuring the flash |