#pragma once #include "classes.h" #include "level_generator.h" #include #include #include #include constexpr int ROOM_GRID_CELLS = 448; constexpr uint32_t GRID_SAVE_SEED_DEFAULT = 0x16a9de81; // What a room descriptor records about its room (Lua's RoomDescriptor.FLAG_*), by bit. enum RoomDescriptorFlag : uint32_t { ROOM_DESCRIPTOR_FLAG_CLEAR = 1 << 0, ROOM_DESCRIPTOR_FLAG_PRESSURE_PLATES_TRIGGERED = 1 << 1, ROOM_DESCRIPTOR_FLAG_SACRIFICE_DONE = 1 << 2, ROOM_DESCRIPTOR_FLAG_CHALLENGE_DONE = 1 << 3, ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS = 1 << 4, ROOM_DESCRIPTOR_FLAG_HAS_WATER = 1 << 5, ROOM_DESCRIPTOR_FLAG_NO_REWARD = 1 << 7, ROOM_DESCRIPTOR_FLAG_RED_ROOM = 1 << 10, ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE = 1 << 11, ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP = 1 << 12 }; // How the minimap shows a room (Lua's RoomDescriptor.DISPLAY_*), by bit. enum RoomDisplayFlag : uint32_t { ROOM_DISPLAY_BOX = 1 << 0, ROOM_DISPLAY_LOCK = 1 << 1, ROOM_DISPLAY_ICON = 1 << 2 }; // A blank saved grid cell, as a new room descriptor holds 448 of them. constexpr GridEntityDesc GRID_SAVE_EMPTY = {0, 0, 0, 0, GRID_SAVE_SEED_DEFAULT, 0, false, {}, GRID_SAVE_SEED_DEFAULT}; // A room of the floor: where it sits on the map and its config (or the one Greed's takeover swaps in), its doors // (the neighbouring cells by slot, the ones open as a mask), the minimap's view of it, what happened in it, its seeds, // and the grid cells, entities and effects saved when the players leave it. // The flag getters (00436010, 00456560, 00505c30, 005cd640, 0070c550, 00738180, 007e9190) are flags tested against // RoomDescriptorFlag. // Construction (006ef590), destruction (006ef9c0), copies (00749040) and moves (007387d0, 00752e80) are the defaults. // The original's reserve of 16 entities and 32 effects is left out. Its words at 0x94..0xab are only ever copied. struct RoomDescriptor { std::array doors = {-1, -1, -1, -1, -1, -1, -1, -1}; std::set restrictedGridIndexes; std::vector savedGridEntities = std::vector(ROOM_GRID_CELLS, GRID_SAVE_EMPTY); std::vector savedEffects; std::vector savedEntities; RoomConfig_Room* data = nullptr; RoomConfig_Room* overrideData = nullptr; int deliriumDistance = 0; int dimension = 0; int greedSubType = 0; int gridIndex = -1; int group = -1; int listIndex = -1; int pitsCount = 0; int safeGridIndex = -1; int visitedCount = 0; int16_t clearCount = 0; int16_t poopCount = 0; int16_t shopItemDiscountIdx = -1; int16_t shopItemIdx = -1; int16_t tKeeperCoinSpawns = 0; int16_t totalMoneySpent = 0; uint32_t allowedDoors = 0; uint32_t awardSeed = 0; uint32_t bossDeathSeed = 0; uint32_t decorationSeed = 0; uint32_t displayFlags = 0; uint32_t flags = 0; uint32_t spawnSeed = 0; void InitSeeds(RNG& rng); };