Curation round 10: combat, pathfinding, death and game over, items and stats, room state, Continue, Lua callbacks
Seven agents took over tear and contact collision, NPC death with blood and gibs, champions, PathFinder, the Gaper's kin, the player's death with the game over screen, item pedestals with collectible pickup, AddCollectible and EvaluateItems, room state save and restore, GameState::read, pressure plates, fireplaces, entity lights, ambient sounds, and one Lua callback enum with gated runners. Integration reconstructed Room::Update's loot preview and Entity_NPC::UpdatePickupGhosts and replaced a leftover Sacred Orb stub that stopped every pedestal roll. Under gdb: Gapers die with blood and gibs, a cleared room opens its doors, the treasure room's item is taken (banner, costume, stats: a Magic Mushroom gives damage 3.5 -> 6.12 and a heart), death leads to the game over diary, and a saved run is read back on the next boot with Continue offered. 3028 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
48933cd312
commit
d8385e6c64
64 files changed
+8665
-3059
No files matched your search
+12
-31
@@ -22,10 +22,6 @@
|
||||
|
||||
constexpr uint64_t NS_PER_MS = 1000000;
|
||||
|
||||
// The Lua callbacks a spawn runs (ModCallbacks ids), which wait for their bindings.
|
||||
constexpr int MC_PRE_ENTITY_SPAWN = 24;
|
||||
constexpr int MC_PRE_ROOM_ENTITY_SPAWN = 71;
|
||||
|
||||
// An entity made by a Delirium form (by the original's use: Delirium's look and lowered thresholds), which its own
|
||||
// spawns inherit.
|
||||
constexpr uint64_t FLAG_DELIRIUM_FORM = 1ull << 60;
|
||||
@@ -79,22 +75,8 @@ constexpr int ENTITY_DOGMA = 950;
|
||||
constexpr int EFFECT_CRAWLSPACE_LADDER = 192;
|
||||
constexpr int BOSS_SATAN = 24;
|
||||
|
||||
constexpr int PICKUP_HEART = 10;
|
||||
constexpr int CARD_SPECIAL_CHANCE = 25;
|
||||
constexpr int CARD_RUNE_CHANCE = 10;
|
||||
constexpr int PICKUP_COIN = 20;
|
||||
constexpr int PICKUP_KEY = 30;
|
||||
constexpr int PICKUP_BOMB = 40;
|
||||
constexpr int PICKUP_CHEST = 50;
|
||||
constexpr int PICKUP_MIMIC_CHEST = 56;
|
||||
constexpr int PICKUP_WOODEN_CHEST = 57;
|
||||
constexpr int PICKUP_HAUNTED_CHEST = 58;
|
||||
constexpr int PICKUP_LOCKED_CHEST = 60;
|
||||
constexpr int PICKUP_GRAB_BAG = 69;
|
||||
constexpr int PICKUP_LIL_BATTERY = 90;
|
||||
constexpr int PICKUP_COLLECTIBLE = 100;
|
||||
constexpr int PICKUP_SHOP_ITEM = 150;
|
||||
constexpr int PICKUP_TAROT_CARD = 300;
|
||||
constexpr int PICKUP_RANDOM_CARD = 301;
|
||||
constexpr int COLLECTIBLE_DIRTY_MIND = 576;
|
||||
constexpr int COLLECTIBLE_KNIFE_PIECE_1 = 626;
|
||||
@@ -436,11 +418,11 @@ Entity* Game::Spawn(const EntitySpawn& spawn)
|
||||
|
||||
// 006fe410 Game::SpawnEx: takes an entity from its pool, places and inits it, and adds it to the room. A spawn of an
|
||||
// active enemy inherits from it, an erased enemy vanishes in a poof, and a TMTRAINER item may react.
|
||||
Entity* game_spawn(const EntitySpawn& spawn, PoolMode mode)
|
||||
Entity* game_spawn(const EntitySpawn& request, PoolMode mode)
|
||||
{
|
||||
Game& game = *g_game;
|
||||
if (static_cast<LuaEngine*>(g_luaEngine)->enabledCallbacks[MC_PRE_ENTITY_SPAWN])
|
||||
reconstruction_missing("lua_callback_run_pre_entity_spawn 008646e0");
|
||||
EntitySpawn spawn = request;
|
||||
lua_engine_get().Callback_PreEntitySpawn(spawn);
|
||||
if (game.deathmatchManager.state >= DEATHMATCH_INTRO)
|
||||
reconstruction_missing("Game::SpawnEx 006fe410: a versus match's "
|
||||
"blacklisted pickups (0042b560)");
|
||||
@@ -565,9 +547,9 @@ constexpr std::array<LockedEntry, 18> LOCKED_ENTRIES = {{
|
||||
{ENTITY_PICKUP, PICKUP_KEY, 4, ACHIEVEMENT_KEY_CHARGED, -1, 0},
|
||||
{ENTITY_PICKUP, PICKUP_GRAB_BAG, 2, ACHIEVEMENT_GRAB_BAG_BLACK, -1, 0},
|
||||
{ENTITY_PICKUP, PICKUP_LIL_BATTERY, 4, ACHIEVEMENT_LIL_BATTERY_GOLDEN, -1, 0},
|
||||
{ENTITY_PICKUP, PICKUP_MIMIC_CHEST, -1, ACHIEVEMENT_MIMIC_CHEST, PICKUP_CHEST, -1},
|
||||
{ENTITY_PICKUP, PICKUP_HAUNTED_CHEST, -1, ACHIEVEMENT_HAUNTED_CHEST, PICKUP_CHEST, -1},
|
||||
{ENTITY_PICKUP, PICKUP_WOODEN_CHEST, -1, ACHIEVEMENT_WOODEN_CHEST, PICKUP_LOCKED_CHEST, -1},
|
||||
{ENTITY_PICKUP, PICKUP_WOODENCHEST, -1, ACHIEVEMENT_MIMIC_CHEST, PICKUP_CHEST, -1},
|
||||
{ENTITY_PICKUP, PICKUP_HAUNTEDCHEST, -1, ACHIEVEMENT_HAUNTED_CHEST, PICKUP_CHEST, -1},
|
||||
{ENTITY_PICKUP, PICKUP_MEGACHEST, -1, ACHIEVEMENT_WOODEN_CHEST, PICKUP_LOCKEDCHEST, -1},
|
||||
{ENTITY_SLOT, SLOT_HELL_GAME, -1, ACHIEVEMENT_HELL_GAME, SLOT_DEVIL_BEGGAR, -1},
|
||||
{ENTITY_SLOT, SLOT_ROTTEN_BEGGAR, -1, ACHIEVEMENT_ROTTEN_BEGGAR, SLOT_KEY_MASTER, -1},
|
||||
{ENTITY_SLOT, SLOT_CRANE_GAME, -1, ACHIEVEMENT_CRANE_GAME, SLOT_MACHINE, -1},
|
||||
@@ -583,7 +565,7 @@ static void entry_card_replace(RoomEntry& entry, uint32_t seed)
|
||||
|
||||
int card = ItemPool::GetCardEx((int)seed, CARD_SPECIAL_CHANCE, CARD_RUNE_CHANCE, CARD_RUNE_CHANCE, true);
|
||||
RNG cardRng = {seed, ENTRY_RNG._shift1, ENTRY_RNG._shift2, ENTRY_RNG._shift3};
|
||||
entry.subtype = lua_callback_run_get_card(&cardRng, card, true, true, false);
|
||||
entry.subtype = lua_engine_get().GetCard({.rng = &cardRng, .card = card, .isPlaying = true, .isRunes = true});
|
||||
}
|
||||
|
||||
// A pickup or slot a layout names that is not unlocked yet becomes its basic kind. The Confessional is a soul heart
|
||||
@@ -593,7 +575,7 @@ static void entry_locked_replace(RoomEntry& entry, RNG& rng)
|
||||
if (entry.type == ENTITY_PICKUP)
|
||||
{
|
||||
uint32_t cardSeed = rng.Next();
|
||||
if (entry.variant == PICKUP_TAROT_CARD) return entry_card_replace(entry, cardSeed);
|
||||
if (entry.variant == PICKUP_TAROTCARD) return entry_card_replace(entry, cardSeed);
|
||||
}
|
||||
else if (entry.type == ENTITY_SLOT && entry.variant == SLOT_CONFESSIONAL)
|
||||
{
|
||||
@@ -815,15 +797,14 @@ void room_entry_transform(Room& room, RoomEntry& entry, int gridIndex, uint32_t
|
||||
entry.variant = entry.type == ENTRY_FIREPLACE_RED || rng.Next() % FIREPLACE_RED_ODDS == 0;
|
||||
entry.type = ENTITY_FIREPLACE;
|
||||
}
|
||||
if (static_cast<LuaEngine*>(g_luaEngine)->enabledCallbacks[MC_PRE_ROOM_ENTITY_SPAWN])
|
||||
reconstruction_missing("LuaEngine::Callback_PreEntitySpawn 00866490");
|
||||
lua_callback_check(MC_PRE_ROOM_ENTITY_SPAWN, "LuaEngine::PreRoomEntitySpawn 00866490");
|
||||
if (entry.type == ENTITY_PICKUP && entry.variant == PICKUP_RANDOM_CARD)
|
||||
{
|
||||
entry.variant = PICKUP_TAROT_CARD;
|
||||
entry.variant = PICKUP_TAROTCARD;
|
||||
uint32_t cardSeed = rng.Next();
|
||||
int card = ItemPool::GetCardEx((int)cardSeed, 0, 1, 0, true);
|
||||
RNG cardRng = {cardSeed, ENTRY_RNG._shift1, ENTRY_RNG._shift2, ENTRY_RNG._shift3};
|
||||
entry.subtype = lua_callback_run_get_card(&cardRng, card, false, true, true);
|
||||
entry.subtype = lua_engine_get().GetCard({.rng = &cardRng, .card = card, .isOnlyRunes = true, .isRunes = true});
|
||||
}
|
||||
entry_locked_replace(entry, rng);
|
||||
|
||||
@@ -833,7 +814,7 @@ void room_entry_transform(Room& room, RoomEntry& entry, int gridIndex, uint32_t
|
||||
bool isDevilTreasure = room.descriptor->flags & ROOM_DESCRIPTOR_FLAG_DEVIL_TREASURE;
|
||||
if (room.roomType == ROOM_TREASURE && isDevilTreasure && entry.type == ENTITY_PICKUP &&
|
||||
entry.variant == PICKUP_COLLECTIBLE && entry.subtype == 0)
|
||||
entry.variant = PICKUP_SHOP_ITEM;
|
||||
entry.variant = PICKUP_SHOPITEM;
|
||||
if (entry.type == ENTITY_SLOT)
|
||||
{
|
||||
RNG slotRng = {seed, SLOT_RNG._shift1, SLOT_RNG._shift2, SLOT_RNG._shift3};
|
||||
|
||||
Reference in new issue
Block a user