| 61 | } |
| 62 | |
| 63 | void Sprite_Timer::Draw(Bitmap& dst) { |
| 64 | if (!Main_Data::game_party->GetTimerVisible(which, Game_Battle::IsBattleRunning())) { |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | // RPG_RT never displays timers if there is no system graphic. |
| 69 | BitmapRef system = Cache::System(); |
| 70 | if (!system) { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | const int all_secs = Main_Data::game_party->GetTimerSeconds(which); |
| 75 | |
| 76 | int mins = all_secs / 60; |
| 77 | int secs = all_secs % 60; |
| 78 | |
| 79 | int mins_1 = mins % 10; |
| 80 | int mins_10 = mins / 10; |
| 81 | |
| 82 | int secs_1 = secs % 10; |
| 83 | int secs_10 = secs / 10; |
| 84 | |
| 85 | digits[0].x = 32 + 8 * mins_10; |
| 86 | digits[1].x = 32 + 8 * mins_1; |
| 87 | digits[3].x = 32 + 8 * secs_10; |
| 88 | digits[4].x = 32 + 8 * secs_1; |
| 89 | |
| 90 | if (Game_Battle::IsBattleRunning()) { |
| 91 | SetY((Player::screen_height / 3 * 2) - 20); |
| 92 | } |
| 93 | else if (Game_Message::IsMessageActive() && Game_Message::GetRealPosition() == 0) { |
| 94 | SetY(Player::screen_height - 20 - Player::menu_offset_y); |
| 95 | } |
| 96 | else { |
| 97 | SetY(Player::menu_offset_y + 4); |
| 98 | } |
| 99 | |
| 100 | GetBitmap()->Clear(); |
| 101 | for (int i = 0; i < 5; ++i) { |
| 102 | if (i == 2) { // : |
| 103 | int frames = Main_Data::game_party->GetTimerFrames(which); |
| 104 | if (frames % DEFAULT_FPS < DEFAULT_FPS / 2) { |
| 105 | continue; |
| 106 | } |
| 107 | } |
| 108 | GetBitmap()->Blit(i * 8, 0, *system, digits[i], Opacity()); |
| 109 | } |
| 110 | |
| 111 | Sprite::Draw(dst); |
| 112 | } |
| 113 |
nothing calls this directly
no test coverage detected