| 574 | } |
| 575 | |
| 576 | void Game_Party::UpdateTimers() { |
| 577 | const bool battle = Game_Battle::IsBattleRunning(); |
| 578 | bool seconds_changed = false; |
| 579 | |
| 580 | if (data.timer1_active && (data.timer1_battle || !battle) && data.timer1_frames > 0) { |
| 581 | data.timer1_frames = data.timer1_frames - 1; |
| 582 | |
| 583 | const int seconds = data.timer1_frames / DEFAULT_FPS; |
| 584 | const int mod_frames = data.timer1_frames % DEFAULT_FPS; |
| 585 | seconds_changed |= (mod_frames == (DEFAULT_FPS - 1)); |
| 586 | |
| 587 | if (seconds == 0) { |
| 588 | StopTimer(Timer1); |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | if (data.timer2_active && (data.timer2_battle || !battle) && data.timer2_frames > 0) { |
| 593 | data.timer2_frames = data.timer2_frames - 1; |
| 594 | |
| 595 | const int seconds = data.timer2_frames / DEFAULT_FPS; |
| 596 | const int mod_frames = data.timer2_frames % DEFAULT_FPS; |
| 597 | seconds_changed |= (mod_frames == (DEFAULT_FPS - 1)); |
| 598 | |
| 599 | if (seconds == 0) { |
| 600 | StopTimer(Timer2); |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | if (seconds_changed) { |
| 605 | Game_Map::SetNeedRefresh(true); |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | int Game_Party::GetTimerSeconds(int which) { |
| 610 | return GetTimerFrames(which) / DEFAULT_FPS; |