MCPcopy Create free account
hub / github.com/EasyRPG/Player / ResetPositionY

Method ResetPositionY

src/game_map.cpp:2148–2179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2146}
2147
2148void Game_Map::Parallax::ResetPositionY() {
2149 Params params = GetParallaxParams();
2150
2151 if (params.name.empty()) {
2152 return;
2153 }
2154
2155 parallax_fake_y = false;
2156
2157 if (!params.scroll_vert && !Game_Map::LoopVertical()) {
2158 int pan_screen_height = Player::screen_height;
2159 if (Player::game_config.fake_resolution.Get()) {
2160 pan_screen_height = SCREEN_TARGET_HEIGHT;
2161 }
2162
2163 int tiles_per_screen = pan_screen_height / TILE_SIZE;
2164 if (pan_screen_height % TILE_SIZE != 0) {
2165 ++tiles_per_screen;
2166 }
2167
2168 if (GetTilesY() > tiles_per_screen && parallax_height > pan_screen_height) {
2169 const int h = (GetTilesY() - tiles_per_screen) * TILE_SIZE;
2170 const int pv = 2 * std::min(h, parallax_height - pan_screen_height) * map_info.position_y / h;
2171 SetPositionY(pv);
2172 } else {
2173 panorama.pan_y = 0;
2174 parallax_fake_y = true;
2175 }
2176 } else {
2177 parallax_fake_y = true;
2178 }
2179}
2180
2181void Game_Map::Parallax::ScrollRight(int distance) {
2182 if (!distance) {

Callers

nothing calls this directly

Calls 4

GetParallaxParamsFunction · 0.85
minFunction · 0.85
emptyMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected