| 174 | } |
| 175 | |
| 176 | void Game_Character::UpdateAnimation() { |
| 177 | const auto speed = Utils::Clamp(GetMoveSpeed(), 1, 6); |
| 178 | |
| 179 | if (IsSpinning()) { |
| 180 | const auto limit = GetSpinAnimFrames(speed); |
| 181 | |
| 182 | IncAnimCount(); |
| 183 | |
| 184 | if (GetAnimCount() >= limit) { |
| 185 | SetFacing((GetFacing() + 1) % 4); |
| 186 | SetAnimCount(0); |
| 187 | } |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | if (IsAnimPaused() || IsJumping()) { |
| 192 | ResetAnimation(); |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | if (!IsAnimated()) { |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | const auto stationary_limit = GetStationaryAnimFrames(speed); |
| 201 | const auto continuous_limit = GetContinuousAnimFrames(speed); |
| 202 | |
| 203 | if (IsContinuous() |
| 204 | || GetStopCount() == 0 |
| 205 | || data()->anim_frame == lcf::rpg::EventPage::Frame_left || data()->anim_frame == lcf::rpg::EventPage::Frame_right |
| 206 | || GetAnimCount() < stationary_limit - 1) { |
| 207 | IncAnimCount(); |
| 208 | } |
| 209 | |
| 210 | if (GetAnimCount() >= continuous_limit |
| 211 | || (GetStopCount() == 0 && GetAnimCount() >= stationary_limit)) { |
| 212 | IncAnimFrame(); |
| 213 | return; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | void Game_Character::UpdateFlash() { |
| 218 | Flash::Update(data()->flash_current_level, data()->flash_time_left); |