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

Function GetParallaxParams

src/game_map.cpp:2021–2046  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

2019 * Otherwise, the result is filled out from the default for the current map.
2020 */
2021static 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
2048std::string Game_Map::Parallax::GetName() {
2049 return GetParallaxParams().name;

Callers 7

SetupFromSaveMethod · 0.85
GetNameMethod · 0.85
ResetPositionXMethod · 0.85
ResetPositionYMethod · 0.85
ScrollRightMethod · 0.85
ScrollDownMethod · 0.85
UpdateMethod · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected