#pragma once #include "anm2.h" #include "score_sheet.h" #include // What the leaderboard shows: a daily run's score breakdown, then the boards. enum LeaderboardMode : int { LEADERBOARD_BREAKDOWN, LEADERBOARD_BOARDS }; // Where the leaderboard's sheet is: hidden, coming in, loading, shown or going out. enum LeaderboardDisplay : int { LEADERBOARD_HIDDEN, LEADERBOARD_APPEARING, LEADERBOARD_LOADING, LEADERBOARD_SHOWN, LEADERBOARD_CLOSING }; // The daily boards (REPENTOGON's RankingState), named by leaderboard_name_format. enum LeaderboardKind : int { BOARD_SCORES_SOLO, BOARD_TIMES_SOLO, BOARD_SCORES_COOP, BOARD_TIMES_COOP, BOARD_KIND_COUNT }; // Which rows of a board are listed (REPENTOGON's LiveSelectionState). enum LeaderboardScope : int { SCOPE_GLOBAL, SCOPE_FRIENDS, SCOPE_AROUND_PLAYER }; // The daily run leaderboard (Leaderboard), in Game after a daily run and in the daily run menu: the run's score // breakdown with its ranks, then the day's boards a page at a time, by kind, scope and day. // The boards are online. Offline every search for one fails at once, so none is ever found and no rows come. // Construction and destruction (00856f70, 00857050) are the defaults. class Leaderboard { public: ScoreSheet scoreSheet; DailyChallenge dailyChallenge{}; std::array boards{}; ANM2 leaderboardSprite; ANM2 scoreSprite; LeaderboardMode mode = LEADERBOARD_BREAKDOWN; LeaderboardDisplay displayState = LEADERBOARD_HIDDEN; LeaderboardKind rankingState = BOARD_SCORES_SOLO; LeaderboardScope liveSelectionState = SCOPE_GLOBAL; uint32_t runDate = 0; uint32_t shownDate = 0; int entryCount = -1; int rowOffset = -1; int scoreRank = 0; int timeRank = 0; bool isClosed = false; bool isEntriesDownloaded = false; bool isScoreSubmitted = false; bool isTimeSubmitted = false; void LoadAnm2(); void Update(); void update_input(); void Render(); void Show(uint32_t date, const ScoreSheet& sheet, bool isSubmitScore, bool isCoop); void get_leaderboard(LeaderboardKind kind, LeaderboardScope scope); void download_entries(LeaderboardKind kind, LeaderboardScope scope); void render_daily_score_breakdown(); void render_scores(); private: uint32_t board_get(); int row_offset_max_get(); void close(ANM2& sprite, std::string_view animation); };