Curation round 11: effects, room clears, items, Continue, bombs, active items, the boss and Basement II

This commit is contained in:
shweet committed 2026-11-20 11:54:27 -05:00
1 parent d8385e6c64
commit 698eeb74e9
74 files changed
+13965 -2078

No files matched your search

+71 -29
View File
@@ -17,6 +17,7 @@
#include <bitset>
#include <cmath>
#include <iterator>
#include <utility>
// Where GetEnterPosition puts the players: a crawlspace's ladder down and its ladder back up, the Black Market's
// stairs, and the spots of the secret shop and the two off-map rooms between it and the Black Market.
@@ -2661,40 +2662,93 @@ void Level::DEBUG_goto_room(RoomConfig_Room*)
reconstruction_missing("Level::DEBUG_goto_room 0073fa20");
}
// 00748860 Reveals the map.
// The floor's state flags the map effects keep, by bit, so they apply again.
enum MapEffectFlag : int
{
MAP_EFFECT_COMPASS = 7,
MAP_EFFECT_MAP = 8,
MAP_EFFECT_BLUE_MAP = 9,
MAP_EFFECT_FULL_MAP = 10,
MAP_EFFECT_BOSS_ROOM = 18,
MAP_EFFECT_SECRET_ROOM = 20
};
// Marks the floor's rooms whose type a map effect shows with display flags, redraws the map and keeps the effect in a
// floor state flag (none for -1).
// The original reads the config of a room without one after logging it. Here that room is skipped.
template <class Shows>
static void map_effect_apply(Level& level, uint32_t display, Shows isShown, int stateFlag)
{
for (int i = 0; i < level.nbRooms; i++)
{
RoomDescriptor& room = level.roomList[i];
if (!room.data) log_printf(LOG_ERROR, "[error] Room %d is not initialized\n", i);
else if (isShown(room.data->type)) room.displayFlags |= display;
}
g_game->minimap.Refresh();
if (stateFlag >= 0) level.levelStateFlags |= 1u << stateFlag;
}
// Whether a room type is one of the secret rooms.
static bool is_secret_type(int type)
{
return type == ROOM_SECRET || type == ROOM_SUPERSECRET || type == ROOM_ULTRASECRET;
}
// 00748860 The map: every room but the secret ones shows its outline.
void Level::ApplyMapEffect()
{
reconstruction_missing("Level::ApplyMapEffect 00748860");
map_effect_apply(*this, ROOM_DISPLAY_BOX, [](int type) { return !is_secret_type(type); }, MAP_EFFECT_MAP);
}
// 007488d0 Reveals the secret rooms.
// 007488d0 The Blue Map: the secret and super secret rooms show their icons.
void Level::ApplyBlueMapEffect()
{
reconstruction_missing("Level::ApplyBlueMapEffect 007488d0");
auto isShown = [](int type) { return type == ROOM_SECRET || type == ROOM_SUPERSECRET; };
map_effect_apply(*this, ROOM_DISPLAY_ICON, isShown, MAP_EFFECT_BLUE_MAP);
}
// 00748940 Reveals the special rooms.
void Level::ApplyCompassEffect(bool)
// 00748940 The Compass: the special rooms (not the normal or secret ones) show their icons, kept for the floor when
// persistent.
void Level::ApplyCompassEffect(bool isPersistent)
{
reconstruction_missing("Level::ApplyCompassEffect 00748940");
auto isShown = [](int type) { return type != ROOM_DEFAULT && !is_secret_type(type); };
map_effect_apply(*this, ROOM_DISPLAY_ICON, isShown, isPersistent ? MAP_EFFECT_COMPASS : -1);
}
// 00748ae0 Hides the special rooms again.
void Level::RemoveCompassEffect()
{
reconstruction_missing("Level::RemoveCompassEffect 00748ae0");
}
// 007489c0 Reveals every room.
// 007489c0 The whole map: every room but the super and ultra secret ones shows its outline and icon.
void Level::ShowMap()
{
reconstruction_missing("Level::ShowMap 007489c0");
auto isShown = [](int type) { return type != ROOM_SUPERSECRET && type != ROOM_ULTRASECRET; };
map_effect_apply(*this, ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON, isShown, MAP_EFFECT_FULL_MAP);
}
// 00748a70 Reveals the secret room.
// 00748a70 Luna's reveal: the first secret room shows its icon.
void Level::reveal_secret_room()
{
reconstruction_missing("Level::reveal_secret_room 00748a70");
bool isRevealed = false;
auto isShown = [&](int type) { return type == ROOM_SECRET && !std::exchange(isRevealed, true); };
map_effect_apply(*this, ROOM_DISPLAY_ICON, isShown, MAP_EFFECT_SECRET_ROOM);
}
// 00748ae0 Hides the rooms only a temporary compass showed, then applies again the map effects the floor keeps: the
// map, the Blue Map, the Compass, the whole map, the boss room's icon and the secret room's.
void Level::RemoveCompassEffect()
{
for (int i = 0; i < nbRooms; i++)
if (roomList[i].displayFlags == ROOM_DISPLAY_ICON) roomList[i].displayFlags = 0;
if (levelStateFlags & 1u << MAP_EFFECT_MAP) ApplyMapEffect();
if (levelStateFlags & 1u << MAP_EFFECT_BLUE_MAP) ApplyBlueMapEffect();
if (levelStateFlags & 1u << MAP_EFFECT_COMPASS) ApplyCompassEffect(true);
if (levelStateFlags & 1u << MAP_EFFECT_FULL_MAP) ShowMap();
if (levelStateFlags & 1u << MAP_EFFECT_BOSS_ROOM)
{
if (lastBossRoomListIdx >= 0) roomList[lastBossRoomListIdx].displayFlags |= ROOM_DISPLAY_ICON;
g_game->minimap.Refresh();
}
if (levelStateFlags & 1u << MAP_EFFECT_SECRET_ROOM) reveal_secret_room();
g_game->minimap.Refresh();
}
// 00740860 A random room index.
@@ -3088,15 +3142,3 @@ void Level::ShowName(bool isSticky)
}
g_game->hud.messageMain.Show(name.c_str(), curse.c_str(), !isSticky, !curse.empty());
}
// 007475b0 Restores the floor from a save.
void Level::RestoreGameState(GameState&)
{
reconstruction_missing("Level::RestoreGameState 007475b0");
}
// 007474a0 The room config a saved id names.
RoomConfig_Room* Level::get_room_config_from_saved_id(uint32_t*, void*)
{
reconstruction_missing("Level::get_room_config_from_saved_id 007474a0");
}