int Game_Map::RoundY(int y) { if ( LoopVertical() ) { return (y + GetHeight()) % GetHeight(); } else { return y; } }
int Game_Map::RoundY(int y) { if (LoopVertical()) { return Utils::PositiveModulo(y, GetHeight()); } else { return y; } }
void Game_Map::AddScreenY(int& screen_y, int& inc) { int map_height = GetHeight() * SCREEN_TILE_SIZE; if (LoopVertical()) { screen_y = Utils::PositiveModulo(screen_y + inc, map_height); } else { ClampingAdd(0, map_height - SCREEN_HEIGHT, screen_y, inc); } }
void Game_Map::SetPositionY(int y) { const int map_height = GetHeight() * SCREEN_TILE_SIZE; if (LoopVertical()) { y = Utils::PositiveModulo(y, map_height); } else { y = std::max(0, std::min(map_height - SCREEN_HEIGHT, y)); } map_info.position_y = y; Parallax::ResetPositionY(); }