| 127 | } |
| 128 | |
| 129 | void Game_Player::MoveTo(int map_id, int x, int y) { |
| 130 | const auto map_changed = (GetMapId() != map_id); |
| 131 | |
| 132 | Game_Character::MoveTo(map_id, x, y); |
| 133 | SetTotalEncounterRate(0); |
| 134 | SetMenuCalling(false); |
| 135 | |
| 136 | auto* vehicle = GetVehicle(); |
| 137 | if (vehicle) { |
| 138 | // RPG_RT doesn't check the aboard flag for this one |
| 139 | vehicle->MoveTo(map_id, x, y); |
| 140 | } |
| 141 | |
| 142 | if (map_changed) { |
| 143 | // FIXME: Assert map pre-loaded in cache. |
| 144 | |
| 145 | // pan_state does not reset when you change maps. |
| 146 | data()->pan_speed = lcf::rpg::SavePartyLocation::kPanSpeedDefault; |
| 147 | data()->pan_finish_x = GetDefaultPanX(); |
| 148 | data()->pan_finish_y = GetDefaultPanY(); |
| 149 | data()->pan_current_x = GetDefaultPanX(); |
| 150 | data()->pan_current_y = GetDefaultPanY(); |
| 151 | maniac_pan_current_x = static_cast<double>(GetDefaultPanX()); |
| 152 | maniac_pan_current_y = static_cast<double>(GetDefaultPanY()); |
| 153 | |
| 154 | ResetAnimation(); |
| 155 | |
| 156 | auto map = Game_Map::LoadMapFile(GetMapId()); |
| 157 | |
| 158 | Game_Map::Setup(std::move(map)); |
| 159 | Game_Map::PlayBgm(); |
| 160 | |
| 161 | // This Fixes an RPG_RT bug where the jumping flag doesn't get reset |
| 162 | // if you change maps during a jump |
| 163 | SetJumping(false); |
| 164 | } else { |
| 165 | Game_Map::SetPositionX(GetSpriteX() - GetPanX()); |
| 166 | Game_Map::SetPositionY(GetSpriteY() - GetPanY()); |
| 167 | } |
| 168 | |
| 169 | ResetGraphic(); |
| 170 | } |
| 171 | |
| 172 | bool Game_Player::MakeWay(int from_x, int from_y, int to_x, int to_y) { |
| 173 | if (IsAboard()) { |
no test coverage detected