#pragma once #include "classes.h" #include // How a run ended (REPENTOGON's Ending), which picks the boss bonus of its score. enum RunEnding : int { RUN_ENDING_NONE, RUN_ENDING_DIE, RUN_ENDING_EPILOGUE, RUN_ENDING_CREDITS, RUN_ENDING_SATAN, RUN_ENDING_ISAAC, RUN_ENDING_LAMB, RUN_ENDING_BLUE_BABY, RUN_ENDING_MEGA_SATAN, RUN_ENDING_ULTRA_GREED, RUN_ENDING_HUSH, RUN_ENDING_DELIRIUM, RUN_ENDING_ULTRA_GREEDIER, RUN_ENDING_MOTHER, RUN_ENDING_BEAST }; // A room the score counts: its type, whether it is a red room, and how much the floor still scores. struct RoomScore { float multiplier = 0; int type = 0; bool isRedRoom = false; }; // A room cleared, as Room tells the score sheet: its type, shape and clear count, and whether it is a red room. struct RoomClear { int clearCount = 0; int shape = 0; int type = 0; bool isRedRoom = false; }; // A floor by stage and type, and whether it was played on the Ascent. struct StageVisit { int stage = 0; int stageType = 0; bool isAscent = false; }; // What a run's score is computed from, which a saved game state keeps (store_state and restore_state copy it whole). struct ScoreRecord { std::vector clearedRooms; std::vector visitedRooms; std::vector finishedStages; std::vector replayedStages; RunEnding runEnding = RUN_ENDING_NONE; int angelsKilled = 0; int bossChallengesCleared = 0; int enemyPoints = 0; int pickupPoints = 0; int runTime = 0; int runTimeLevel = 0; int runTimeLevelType = 0; }; // The version a score is submitted with: 1.9, build 460. constexpr int BUILD_ID = 1 << 24 | 9 << 16 | 460; // Construction (009e5300) is the default, as is everything else std members make unnecessary. // The run's score (g_game->scoreSheet, and one per leaderboard row): what the run did, and the bonuses and penalties // Calculate turns it into. class ScoreSheet : public ScoreRecord { public: int beastBonus = 0; int blueBabyBonus = 0; int damagePenalty = 0; int deliriumBonus = 0; int explorationBonus = 0; int itemPenalty = 0; int lambBonus = 0; int megaSatanBonus = 0; int motherBonus = 0; int rushBonus = 0; int schwagBonus = 0; int stageBonus = 0; int timePenalty = 0; int totalScore = 0; int buildId = BUILD_ID; bool isRedRoomBonusCapped = false; void Reset(); void store_state(ScoreRecord& state); void restore_state(const ScoreRecord& state); void add_cleared_room(const RoomClear& clear); void add_pickup_points(int variant, int subType, Vector position); void AddKilledEnemy(Entity& npc); void AddFinishedStage(const StageVisit& visit, int time); void Calculate(); void calculate_room_score(); float stage_multiplier_get(const StageVisit& visit); }; // What a room type scores entered and cleared. struct RoomPoints { int cleared = 0; int visited = 0; }; RoomPoints room_points_get(int roomType); int room_shape_weight_get(int shape);