Helper function to get the current parallax parameters. If the default * parallax for the current map was overridden by a "Change Parallax BG" * command, the result is filled out from those values in the SaveMapInfo. * Otherwise, the result is filled out from the default for the current map. */
| 2019 | * Otherwise, the result is filled out from the default for the current map. |
| 2020 | */ |
| 2021 | static Game_Map::Parallax::Params GetParallaxParams() { |
| 2022 | Game_Map::Parallax::Params params = {}; |
| 2023 | |
| 2024 | if (!map_info.parallax_name.empty()) { |
| 2025 | params.name = map_info.parallax_name; |
| 2026 | params.scroll_horz = map_info.parallax_horz; |
| 2027 | params.scroll_horz_auto = map_info.parallax_horz_auto; |
| 2028 | params.scroll_horz_speed = map_info.parallax_horz_speed; |
| 2029 | params.scroll_vert = map_info.parallax_vert; |
| 2030 | params.scroll_vert_auto = map_info.parallax_vert_auto; |
| 2031 | params.scroll_vert_speed = map_info.parallax_vert_speed; |
| 2032 | } else if (map->parallax_flag) { |
| 2033 | // Default case when map parallax hasn't been overwritten. |
| 2034 | params.name = ToString(map->parallax_name); |
| 2035 | params.scroll_horz = map->parallax_loop_x; |
| 2036 | params.scroll_horz_auto = map->parallax_auto_loop_x; |
| 2037 | params.scroll_horz_speed = map->parallax_sx; |
| 2038 | params.scroll_vert = map->parallax_loop_y; |
| 2039 | params.scroll_vert_auto = map->parallax_auto_loop_y; |
| 2040 | params.scroll_vert_speed = map->parallax_sy; |
| 2041 | } else { |
| 2042 | // No BG; use default-constructed Param |
| 2043 | } |
| 2044 | |
| 2045 | return params; |
| 2046 | } |
| 2047 | |
| 2048 | std::string Game_Map::Parallax::GetName() { |
| 2049 | return GetParallaxParams().name; |
no test coverage detected