Curation round 23 (code only): the Mods menu and HUD pieces, Dogma and the Beast, Visage, Hornfel and other bosses, enemies and Entity_NPC branches, player revivals and missing methods, the player's frame, familiars, lasers, weapons and bombs, shared constants folded (115 duplicates, 385 gaps)

This commit is contained in:
shweet committed 2026-11-23 00:41:14 -05:00
1 parent b9405bfb31
commit 11c71fe041
208 files changed
+20487 -5741

No files matched your search

+154 -3
View File
@@ -123,9 +123,30 @@ bool Entity_Player::TryHoldTrinket(int trinketId)
return false;
}
// Mom's Toenail dropped in a room still fighting: Mom stomps the cell it landed on (the top left corner when off the
// grid), once per multiplier, a second apart.
static void moms_toenail_stomp(Vector position, int stomps)
{
constexpr int STOMP_DELAY_STEP = 30;
Room& room = *g_game->room;
Vector cell = room.GetGridPosition(room.GetGridIndex(position));
for (int i = 0; i < stomps; i++)
{
uint32_t seed = Random();
auto* stomp = static_cast<Entity_Effect*>(g_game->Spawn({.position = cell,
.subType = i * STOMP_DELAY_STEP,
.type = ENTITY_EFFECT,
.variant = EFFECT_MOM_FOOT_STOMP,
.seed = seed}));
stomp->targetPosition = cell;
stomp->Update();
}
}
// 00771800 Drops the first trinket that may go (the Tick only to a trinket that burns it, with a sizzle), the next
// slot moving up: it lands as a pickup at the position for a main player, its pickup effect undone and its costume
// off unless its effect wears it. Butter plays its sound. The stats are evaluated. The dropped pickup, if any.
// off unless its effect wears it. Butter plays its sound, and Mom's Toenail brings Mom's stomps in a fight. The stats
// are evaluated. The dropped pickup, if any.
Entity_Pickup* Entity_Player::DropTrinket(Vector position, bool isReplaceTick)
{
FlushQueueItem();
@@ -180,8 +201,8 @@ Entity_Pickup* Entity_Player::DropTrinket(Vector position, bool isReplaceTick)
if (!isEffectWorn) RemoveCostume(trinket);
}
if (id == TRINKET_BUTTER) sound_play(SOUND_BUTTER_DROP);
else if (id == TRINKET_MOMS_TOENAIL && !(g_game->room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_CLEAR) && stomps > 0)
reconstruction_missing("Entity_Player::DropTrinket 00771800 (Mom's Toenail's stomps)");
else if (id == TRINKET_MOMS_TOENAIL && !(g_game->room->descriptor->flags & ROOM_DESCRIPTOR_FLAG_CLEAR) && pickup)
moms_toenail_stomp(pickup->pos, stomps);
if (cacheFlags) EvaluateItems();
return pickup;
}
@@ -1041,3 +1062,133 @@ void coin_trinkets_collect(Entity_Pickup& pickup, Entity_Player& player, int val
if (player.HasTrinket(TRINKET_ROTTEN_PENNY))
player.AddBlueFlies(std::min(std::max(player.GetTrinketMultiplier(TRINKET_ROTTEN_PENNY), 1), 3), player.pos, nullptr);
}
constexpr int GLYPH_PICKUP_FEW = 1;
constexpr int GLYPH_PICKUP_MANY = 5;
constexpr int GLYPH_COINS_MANY = 15;
constexpr int GLYPH_CHARGE_MANY = 12;
constexpr int GLYPH_SOUL_HEARTS_FEW = 4;
constexpr int GLYPH_HEARTS_ENOUGH = 12;
// Glyph of Balance's drop as a pickup variant and subtype, kept as it is when it is already of the chosen variant (a
// soul heart also keeps a black heart).
struct GlyphDrop
{
int* variant = nullptr;
int* subType = nullptr;
void set(int newVariant, int newSubType)
{
if (*variant == newVariant) return;
*variant = newVariant;
*subType = newSubType;
}
void soul_heart_set()
{
if (*variant == PICKUP_HEART && (*subType == HEART_SOUL || *subType == HEART_BLACK)) return;
*variant = PICKUP_HEART;
*subType = HEART_SOUL;
}
};
// Whether the player keeps its bombs (Tainted ???'s poop) for Glyph of Balance, at least a count of them.
static bool is_glyph_bombs_short(Entity_Player& player, int count)
{
return player.playerType == PLAYER_BLUEBABY_B ? player.poopMana < count : player.numBombs < count;
}
// The charge Bethany's or Tainted Bethany's heart drop needs: a soul heart or a red heart when short of it.
static bool glyph_charge_drop(Entity_Player& player, GlyphDrop& drop, int count)
{
if (player.playerType == PLAYER_BETHANY && player.effectiveSoulCharge < count) drop.soul_heart_set();
else if (player.playerType == PLAYER_BETHANY_B && player.effectiveBloodCharge < count) drop.set(PICKUP_HEART, HEART_FULL);
else return false;
return true;
}
// 007d12c0 The pickup Glyph of Balance drops for the player, in order of need: a red heart when low on red health, a
// soul heart without containers, a key, a bomb (poop for Tainted ???), Bethany's charge, red hearts to fill the
// containers, coins, a trinket with enough of everything and none held or lying about, then more coins, keys, bombs
// and charge, and soul hearts until twelve hearts are held. Else the drop is left as it is.
void Entity_Player::GetGlyphOfBalanceDrop(int* variant, int* subType)
{
GlyphDrop drop = {variant, subType};
HealthType health = GetHealthType();
bool isRedHealth = (health == HEALTH_DEFAULT || health == HEALTH_BONE) && playerType != PLAYER_BETHANY;
bool isBoneless = health == HEALTH_SOUL || health == HEALTH_NO_HEALTH;
int containers = isBoneless ? maxHearts : maxHearts + boneHearts * 2;
if (redHearts < 2 && containers >= 2 && (health == HEALTH_DEFAULT || health == HEALTH_BONE))
return drop.set(PICKUP_HEART, HEART_FULL);
if (containers == 0 && soulHearts < GLYPH_SOUL_HEARTS_FEW && isRedHealth) return drop.soul_heart_set();
if (numKeys < GLYPH_PICKUP_FEW) return drop.set(PICKUP_KEY, 0);
if (playerType == PLAYER_BLUEBABY_B && poopMana < GLYPH_PICKUP_FEW) return drop.set(PICKUP_POOP, POOP_BIG);
if (playerType != PLAYER_BLUEBABY_B && numBombs < GLYPH_PICKUP_FEW) return drop.set(PICKUP_BOMB, 0);
if (glyph_charge_drop(*this, drop, GLYPH_PICKUP_FEW)) return;
if (redHearts < GetEffectiveMaxHearts() && GetEffectiveMaxHearts() >= 0 && GetHealthType() != HEALTH_COIN)
return drop.set(PICKUP_HEART, HEART_FULL);
if (numCoins < GLYPH_PICKUP_MANY) return drop.set(PICKUP_COIN, 0);
bool isBombsKept = playerType == PLAYER_BLUEBABY_B ? poopMana != 0 : numBombs >= GLYPH_PICKUP_MANY;
if (isBombsKept && numKeys >= GLYPH_PICKUP_MANY && trinkets[0] == 0 && entity_query(ENTITY_PICKUP, PICKUP_TRINKET).empty())
return drop.set(PICKUP_TRINKET, 0);
if (numCoins < GLYPH_COINS_MANY) return drop.set(PICKUP_COIN, 0);
if (numKeys < GLYPH_PICKUP_MANY) return drop.set(PICKUP_KEY, 0);
if (is_glyph_bombs_short(*this, GLYPH_PICKUP_MANY))
return drop.set(playerType == PLAYER_BLUEBABY_B ? PICKUP_POOP : PICKUP_BOMB, playerType == PLAYER_BLUEBABY_B ? POOP_BIG : 0);
if (glyph_charge_drop(*this, drop, GLYPH_CHARGE_MANY)) return;
if (GetEffectiveMaxHearts() + soulHearts < std::min(GetHeartLimit(false), GLYPH_HEARTS_ENOUGH) && isRedHealth)
drop.soul_heart_set();
}
// 00772530 Turns a golden Store Credit back into a plain one: the one held over the head, else each held (its costume
// and effects swapped), else each smelted one in the history. True when the held over one was changed.
bool Entity_Player::replace_trinket()
{
bool isMainPlayer = variant == PLAYER_VARIANT_PLAYER && !isCoopGhost;
ItemConfig_Item* storeCredit = g_manager->itemConfig.GetTrinket(TRINKET_STORE_CREDIT);
uint32_t golden = TRINKET_STORE_CREDIT | TRINKET_GOLDEN_FLAG;
if (isMainPlayer) InvalidateCoPlayerItems();
if (queuedItem.item && queuedItem.item == storeCredit && (queuedItem.flags & QUEUED_GOLDEN))
{
queuedItem.flags &= ~QUEUED_GOLDEN;
return true;
}
int slots = HasCollectible(COLLECTIBLE_MOMS_PURSE) || HasCollectible(COLLECTIBLE_BELLY_BUTTON) ? 2 : 1;
for (int slot = 0; slot < slots; slot++)
{
if (trinkets[slot] != golden) continue;
trinkets[slot] = TRINKET_STORE_CREDIT;
log_printf(LOG_INFO, "Replacing trinket %d (%s) from player %d (%s) with trinket %d (%s)\n", golden,
storeCredit->GetLocalizedName().c_str(), playerIndex, name.c_str(), TRINKET_STORE_CREDIT,
storeCredit->GetLocalizedName().c_str());
TriggerTrinketRemoved(golden);
if (storeCredit->isAddCostumeOnPickup || !temporaryEffects.HasTrinketEffect(golden)) RemoveCostume(storeCredit);
TriggerTrinketAdded(TRINKET_STORE_CREDIT, false);
if (storeCredit->isAddCostumeOnPickup) AddCostume(storeCredit, false);
}
if (!isMainPlayer) return false;
for (HistoryItem& item : history.historyItems)
{
if (!item.isTrinket || (uint32_t)item.id != golden) continue;
item.id = TRINKET_STORE_CREDIT;
SmeltedTrinket& smelted = smeltedTrinkets[storeCredit->id];
if (smelted.goldenCount > 0)
{
smelted.goldenCount--;
TriggerTrinketRemoved(golden);
if (smelted.count < 1 && smelted.goldenCount < 1) TryRemoveTrinketCostume(golden);
smelted.count++;
TriggerTrinketAdded(TRINKET_STORE_CREDIT, false);
if (storeCredit->isAddCostumeOnPickup) AddCostume(storeCredit, false);
}
log_printf(LOG_INFO, "Replacing smelted trinket %d (%s) from player %d (%s) with trinket %d (%s)\n", golden,
storeCredit->GetLocalizedName().c_str(), playerIndex, name.c_str(), TRINKET_STORE_CREDIT,
storeCredit->GetLocalizedName().c_str());
g_game->hud.mark_all_slots_dirty(HISTORY_KEEP_ICONS, HISTORY_KEEP_ITEMS);
}
return false;
}