| 2108 | } |
| 2109 | |
| 2110 | void Game_Map::Parallax::ResetPositionX() { |
| 2111 | Params params = GetParallaxParams(); |
| 2112 | |
| 2113 | if (params.name.empty()) { |
| 2114 | return; |
| 2115 | } |
| 2116 | |
| 2117 | parallax_fake_x = false; |
| 2118 | |
| 2119 | if (!params.scroll_horz && !LoopHorizontal()) { |
| 2120 | int pan_screen_width = Player::screen_width; |
| 2121 | if (Player::game_config.fake_resolution.Get()) { |
| 2122 | pan_screen_width = SCREEN_TARGET_WIDTH; |
| 2123 | } |
| 2124 | |
| 2125 | int tiles_per_screen = pan_screen_width / TILE_SIZE; |
| 2126 | if (pan_screen_width % TILE_SIZE != 0) { |
| 2127 | ++tiles_per_screen; |
| 2128 | } |
| 2129 | |
| 2130 | if (GetTilesX() > tiles_per_screen && parallax_width > pan_screen_width) { |
| 2131 | const int w = (GetTilesX() - tiles_per_screen) * TILE_SIZE; |
| 2132 | const int ph = 2 * std::min(w, parallax_width - pan_screen_width) * map_info.position_x / w; |
| 2133 | if (Player::IsRPG2k()) { |
| 2134 | SetPositionX(ph); |
| 2135 | } else { |
| 2136 | // 2k3 does not do the (% parallax_width * TILE_SIZE * 2) here |
| 2137 | panorama.pan_x = ph; |
| 2138 | } |
| 2139 | } else { |
| 2140 | panorama.pan_x = 0; |
| 2141 | parallax_fake_x = true; |
| 2142 | } |
| 2143 | } else { |
| 2144 | parallax_fake_x = true; |
| 2145 | } |
| 2146 | } |
| 2147 | |
| 2148 | void Game_Map::Parallax::ResetPositionY() { |
| 2149 | Params params = GetParallaxParams(); |
nothing calls this directly
no test coverage detected