Curation round 18: tears and four weapons, passive item and trinket sweeps, pills and most cards, alt path and main path enemies, Hush and the Blue Womb, Mega Satan, the Void, Tainted ???, Forgotten, Lilith and Eden, wisps

This commit is contained in:
shweet committed 2026-11-21 10:34:58 -05:00
1 parent 024cb12016
commit 9dfc09518c
157 files changed
+24212 -6106

No files matched your search

+136 -63
View File
@@ -23,25 +23,26 @@
#include "room_grid.h"
#include "sfx_manager.h"
#include "mines.h"
#include "npc_alt.h"
#include <algorithm>
#include <cmath>
#include <filesystem>
// The frames of a controlled NPC's charge bar, empty to full.
constexpr int CHARGE_BAR_FRAMES = 100;
constexpr float POOP_THROW_HEIGHT = -20;
constexpr float POOP_THROW_LOUD_SPEED = 5;
constexpr int ENTITY_FEAR_IMMUNE = 205;
constexpr int ENTITY_NO_DECOY_TYPE = 213;
constexpr int ENTITY_MOMS_HEART_PLAYER_PICK = 53;
constexpr uint32_t DOPLE_PICK_SHIFT = 11;
constexpr int ENTITY_UNREACHABLE_EXEMPT = 886;
constexpr int ENTITY_FLICKER_TYPE = 252;
constexpr int ENTITY_DEATH_SPARK_TYPE = 882;
constexpr int ENTITY_SHADOW_OVERLAY_TYPE = 886;
constexpr int ENTITY_DAMAGE_NUMBERS_TYPE = 964;
constexpr int ENTITY_ERASE_EXEMPT = 950;
constexpr int APPEAR_OVERLAY_KEPT_TYPE = 266;
constexpr int APPEAR_SOUND_TYPE_A = 401;
constexpr int APPEAR_SOUND_TYPE_B = 403;
constexpr float BIG_HORN_APPEAR_VOLUME = 2;
constexpr std::array<int, 4> APPEAR_EVENT_TYPES = {404, 912, 913, 917};
constexpr std::array<int, 9> FLUSH_TYPES = {217, 220, 223, 261, 402, 870, 871, 872, 914};
constexpr int FLUSH_PROP_TYPE = 237;
@@ -75,7 +76,7 @@ constexpr int DEATH_NO_BURST_FIRST = 74;
constexpr int DEATH_NO_BURST_LAST = 76;
constexpr int MULLIGAN_VARIANT_FLEEING = 2;
constexpr int CHALLENGE_KILL_CHARGE = 33;
constexpr std::string_view BIG_HORN_SPIT_EVENT = "Item";
constexpr std::string_view BIG_HORN_SPLASH_EVENT = "Poof";
constexpr std::string_view DIRT_LAYER = "dirt";
constexpr std::string_view HOLE_LAYER = "Hole";
constexpr std::string_view HOLE2_LAYER = "Hole2";
@@ -157,6 +158,7 @@ constexpr int TRINKET_TICK_ID = 53;
constexpr int TRINKET_SUPER_MAGNET_ID = 68;
constexpr int TRINKET_LIGHTER_ID = 135;
constexpr int TRINKET_ICE_CUBE_ID = 188;
constexpr int ROOM_TRINKET_STATUS_FRAMES = -90;
constexpr int NULLITEM_DAMOCLES_WEAKNESS = 64;
constexpr int CHALLENGE_BEANS = 30;
@@ -223,6 +225,9 @@ constexpr float RIPPLE_SCALE = 0.05f;
constexpr float RIPPLE_DEPTH = -10;
constexpr float RIPPLE_SPEED = 0.5f;
constexpr int RIPPLE_FRAMES = 7;
constexpr float POOF02_SCALE = 0.3f;
constexpr float POOF02_DEPTH = 10;
constexpr ColorMod POOF02_COLOR = {{1, 1, 1, 0.5f}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float SLOW_FRICTION = 0.92f;
constexpr int WEAKNESS_FRAMES = 2;
constexpr int STATUS_REFRESH = -2;
@@ -1469,8 +1474,13 @@ void Entity_NPC::appear_update()
int sound = isDeathSoundAlt ? SOUND_SUMMON_WAVE : SOUND_SUMMON_POOF;
g_manager->sfxManager.Stop(sound);
PlaySound(sound, 1, 2, false, 1);
if (type == APPEAR_SOUND_TYPE_A || type == APPEAR_SOUND_TYPE_B || (type == ENTITY_BIG_HORN && variant == 0))
reconstruction_missing("Entity_NPC::Update 006c4b30: a Repentance boss's appear sounds");
if (type == ENTITY_STAIN)
{
npc_sound_play(SOUND_MAGGOT_BURST_OUT, 1, 2, 1);
PlaySound(SOUND_THE_STAIN_BURST, 1, 2, false, 1);
}
else if (type == ENTITY_FORSAKEN) PlaySound(SOUND_FORSAKEN_LAUGH, 1, 2, false, 1);
else if (type == ENTITY_BIG_HORN && variant == 0) PlaySound(SOUND_BOSS_LITE_ROAR, BIG_HORN_APPEAR_VOLUME, 2, false, 1);
}
else if (appearFrames == APPEAR_SHOW_FRAME)
{
@@ -1557,7 +1567,7 @@ static void death_events_update(Entity_NPC& npc)
return npc.FireProjectiles(npc.pos, vector_make(PLUM_RING_SPEED, PLUM_RING_SHOTS), PROJECTILES_RING, params);
}
case ENTITY_GIDEON:
return NpcHelper::gideon_update_death(&npc);
return gideon_death_update(npc);
case ENTITY_REAP_CREEP:
if (npc.sprite.overlayAnimState.animData) npc.sprite.RemoveOverlay();
return;
@@ -1567,9 +1577,7 @@ static void death_events_update(Entity_NPC& npc)
.radiusMultiplier = SINGE_BLAST_REACH});
return;
case ENTITY_MIN_MIN:
if (npc.sprite.IsEventTriggered("Shoot") && npc.sprite.GetNullFrame("BloodGuide"))
reconstruction_missing("Entity_NPC::Update 006c4b30: Min-Min's death bursts");
return;
return min_min_death_update(npc);
case ENTITY_MOTHER:
if (npc.variant != MOTHER_SLAM_VARIANT || !npc.sprite.IsEventTriggered("Shoot")) return;
game_shake_screen(MOTHER_SLAM_SHAKE);
@@ -1625,8 +1633,7 @@ void Entity_NPC::death_animation_start()
if (sprite.GetAnimationData("Death"))
{
if (type == ENTITY_BIG_HORN)
return reconstruction_missing("Entity_NPC::Update 006c4b30: Big Horn's death animations");
if (type == ENTITY_BIG_HORN) return big_horn_death_play(*this);
if (type == ENTITY_RAG_MAN) death_head_layer_keep(sprite);
sprite.Play("Death");
return;
@@ -1834,18 +1841,44 @@ void Entity_NPC::toxic_shock_creep_spawn()
creep->Update();
}
// Part of 006c4b30: the items whose aura works on enemies near a player (The Soul, Super Magnet, Salvation).
// Part of 006c4b30: the items whose aura works on enemies near a player: Super Magnet's nearest holder pulls the
// enemy in one frame in three. The Soul's push and Salvation's beam stop the game until reached.
void Entity_NPC::player_aura_update()
{
constexpr float SUPER_MAGNET_REACH_SQUARED = 1e9f;
constexpr float SUPER_MAGNET_PULL = 0.5f;
constexpr int SUPER_MAGNET_ODDS = 3;
if (state == NPC_STATE_DEATH || state == NPC_STATE_UNIQUE_DEATH || IsFriendly() || !IsVulnerableEnemy(nullptr))
return;
Entity_Player* magnet = nullptr;
float magnetDistance = SUPER_MAGNET_REACH_SQUARED;
for (Entity_Player* player : g_game->playerManager.playerList)
{
bool isAura = player->HasCollectible(COLLECTIBLE_SOUL_ID) || player->HasTrinket(TRINKET_SUPER_MAGNET_ID) ||
player->HasCollectible(COLLECTIBLE_SALVATION_ID);
if (isAura)
reconstruction_missing("Entity_NPC::Update 006c4b30: The Soul's, Super Magnet's and Salvation's pull");
if (player->HasCollectible(COLLECTIBLE_SOUL_ID) || player->HasCollectible(COLLECTIBLE_SALVATION_ID))
reconstruction_missing("Entity_NPC::Update 006c4b30: The Soul's push and Salvation's beam");
if (!player->HasTrinket(TRINKET_SUPER_MAGNET_ID)) continue;
Vector away = vector_sub(player->pos, pos);
float distance = away.x * away.x + away.y * away.y;
if (distance >= magnetDistance) continue;
magnet = player;
magnetDistance = distance;
}
if (magnet && random_below(SUPER_MAGNET_ODDS) == 0) velocity = vector_add(velocity, vector_resized(vector_sub(magnet->pos, pos), SUPER_MAGNET_PULL));
}
// Whether Lighter or Ice Cube catches an enemy entering the room: a fifth, a third or a half by strength, more with
// the owner's luck, rolled on the enemy's seed.
static bool is_room_trinket_struck(Entity_NPC& npc, Entity_Player& owner, int trinket)
{
constexpr float CHANCES[] = {0.2f, 0.33f, 0.5f};
constexpr float LUCK_CHANCE = 0.02f;
constexpr uint32_t STATUS_SHIFT_INDEX = 5;
int multiplier = owner.GetTrinketMultiplier(trinket);
float chance = CHANCES[multiplier == 2 ? 1 : multiplier == 3 ? 2 : 0];
RNG rng;
rng.SetSeed(npc.initSeed, STATUS_SHIFT_INDEX);
return rng.RandomFloat() < owner.luck * LUCK_CHANCE + chance;
}
// Part of 006c4b30: what the players' items do to enemies each frame: Toxic Shock's poison, Lighter's burn and Ice
@@ -1858,8 +1891,15 @@ void Entity_NPC::item_effects_update()
{
if (Entity_Player* owner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK_ID, LAZARUS_SHARE_IGNORE))
AddPoison(EntityRef(owner), TOXIC_SHOCK_POISON, 0, false);
if (players.FirstTrinketOwner(TRINKET_LIGHTER_ID) || players.FirstTrinketOwner(TRINKET_ICE_CUBE_ID))
reconstruction_missing("Entity_NPC::Update 006c4b30: Lighter's burn and Ice Cube's freeze");
Entity_Player* toxicOwner = players.FirstCollectibleOwner(COLLECTIBLE_TOXIC_SHOCK_ID, LAZARUS_SHARE_IGNORE);
if (Entity_Player* lighter = players.FirstTrinketOwner(TRINKET_LIGHTER_ID); lighter && is_room_trinket_struck(*this, *lighter, TRINKET_LIGHTER_ID))
AddBurn(EntityRef(lighter), ROOM_TRINKET_STATUS_FRAMES, 0, false);
// The original freezes from the Toxic Shock owner's reference, usually none.
if (Entity_Player* ice = players.FirstTrinketOwner(TRINKET_ICE_CUBE_ID); ice && is_room_trinket_struck(*this, *ice, TRINKET_ICE_CUBE_ID))
{
AddFreeze(EntityRef(toxicOwner), ROOM_TRINKET_STATUS_FRAMES, false);
AddIce(EntityRef(toxicOwner), ROOM_TRINKET_STATUS_FRAMES);
}
}
Entity_Player* targetPlayer = GetPlayerTarget()->ToPlayer();
@@ -1888,10 +1928,18 @@ static float timescale_factor(float factor, float timeScale)
return timeScale == 1 ? factor : factor / ((factor + timeScale) - factor * timeScale);
}
// Part of 006c4b30: a poof02 event puffs smoke from the null of that name.
// Part of 006c4b30: a poof02 event puffs half-faded smoke at the NPC, placed and sized (a third) by the null of that
// name. The original reads the null unchecked. Here a sprite without one puffs nothing.
void Entity_NPC::poof02_spawn()
{
reconstruction_missing("Entity_NPC::Update 006c4b30: the poof02 event's smoke");
const NullFrame* null = sprite.GetNullFrame("poof02");
if (!null) return;
Entity* poof = g_game->Spawn({.position = pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF02, .seed = Random()});
poof->sprite.offset = null->pos;
poof->sprite.scale = vector_scale(null->scale, POOF02_SCALE);
poof->renderDepthOffset = POOF02_DEPTH;
poof->SetColor(POOF02_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
}
// Part of 006c4b30: a grounded enemy walking through water leaves a ripple every 7 frames.
@@ -2035,12 +2083,11 @@ void Entity_NPC::seed_effects_update()
}
// Part of 006c4b30: the few enemies with their own per-frame step: Hornfel, Gideon's camera, the Heart's partner and
// Big Horn's spit.
// Big Horn's splash.
void Entity_NPC::type_update()
{
if (type == ENTITY_HORNFEL) Hornfel_UpdateFrame();
if (type == ENTITY_GIDEON && state == NPC_STATE_APPEAR)
reconstruction_missing("Entity_NPC::Update 006c4b30: Gideon's camera");
if (type == ENTITY_GIDEON && state == NPC_STATE_APPEAR) g_game->room->camera->SetFocusPosition(pos);
if (type == ENTITY_HEART)
{
targetPosition = {};
@@ -2051,8 +2098,7 @@ void Entity_NPC::type_update()
partner->targetPosition = vector_scale(targetPosition, -1);
}
}
if (type == ENTITY_BIG_HORN && sprite.IsEventTriggered(BIG_HORN_SPIT_EVENT))
reconstruction_missing("Entity_NPC::Update 006c4b30: Big Horn's spit");
if (type == ENTITY_BIG_HORN && sprite.IsEventTriggered(BIG_HORN_SPLASH_EVENT)) big_horn_splash(*this);
}
// Part of 006c4b30: a forced target runs out, and a boss then waits 150 frames before taking another.
@@ -2140,9 +2186,14 @@ void Entity_NPC::Kill(const EntityRef& source)
// 006b8f30 Lets go of everything it points at, Gideon's chain and Mother's sounds included.
void Entity_NPC::ClearReferences()
{
if (type == ENTITY_SIREN_HELPER || type == ENTITY_GIDEON ||
(type == ENTITY_MOTHER && (variant == 0 || variant == 10)))
reconstruction_missing("Entity_NPC::ClearReferences 006b8f30: Siren's helper, Gideon's and Mother's links");
auto* charmed = dynamic_cast<Entity_Familiar*>(target.get());
if (type == ENTITY_SIREN_HELPER && charmed && charmed->HasEntityFlags(FLAG_CHARM)) charmed->RemoveFromPlayer();
if (type == ENTITY_GIDEON) gideon_chain_unlink(*this);
if (type == ENTITY_MOTHER && (variant == 0 || variant == 10))
{
g_manager->sfxManager.Stop(SOUND_MOTHER_SUCTION);
g_manager->sfxManager.Stop(SOUND_ULTRA_GREED_SPINNING);
}
pickupGhostsEntity = nullptr;
unknownF54 = nullptr;
salvationTarget = nullptr;
@@ -2261,12 +2312,43 @@ int Entity_NPC::death_burst_get()
}
}
// Part of 006be840: a Dople keeps its player, else picks one by its seed among the players no other Dople copies (a
// controlled one, its controller's). With none left it dies, mimicking the first player.
static Entity* dople_player_pick(Entity_NPC& npc)
{
if (npc.target) return npc.target.get();
std::vector<Entity*> doples = entity_query(ENTITY_DOPLE, -1);
std::vector<Entity_Player*> candidates;
for (Entity_Player* player : g_game->playerManager.playerList)
{
bool isFree = npc.controllerID != -1 ? player->controllerIndex == npc.controllerID
: std::ranges::none_of(doples, [&](Entity* dople) {
return dople != &npc && static_cast<Entity_NPC*>(dople)->target.get() == player;
});
if (isFree) candidates.push_back(player);
}
Entity* picked = nullptr;
if (!candidates.empty())
{
RNG pick = rng_make(npc.initSeed, DOPLE_PICK_SHIFT);
picked = candidates[pick.RandomInt((int)candidates.size())];
}
else
{
npc.Kill(EntityRef());
picked = g_game->GetPlayer(0);
}
npc.target = picked;
return npc.target.get();
}
// 006be840 What it goes after: a charmed enemy picks the nearest enemy, a Dople (type 53) its own player,
// the rest the nearest target player (Game::GetNearestTargetPlayer), else the first player.
Entity* Entity_NPC::GetPlayerTarget()
{
if (type == ENTITY_MOMS_HEART_PLAYER_PICK)
reconstruction_missing("Entity_NPC::GetPlayerTarget 006be840: the shared player choice of its kind");
if (type == ENTITY_DOPLE) return dople_player_pick(*this);
bool isRetargeting = IsFrame(TARGET_REFRESH_FRAMES, (int)index) || !target;
if (HasEntityFlags(FLAG_CHARM) && !g_game->room->isPacifist && isRetargeting)
@@ -2563,14 +2645,6 @@ void Entity_NPC::status_overlay_render(const Vector& offset)
statusEffectSprite.Render(SpriteDraw{at, {}, {}});
}
// 006d4840 Draws its shadow layer (Entity::RenderShadowLayer), a few with their links' shadows first.
bool Entity_NPC::RenderShadowLayer(const Vector& offset)
{
if (type == ENTITY_SHADOW_OVERLAY_TYPE || (type == ENTITY_LARRYJR && variant == 3))
reconstruction_missing("Entity_NPC::RenderShadowLayer 006d4840: a linked enemy's shadow");
return Entity::RenderShadowLayer(offset);
}
// 006d90e0 Moves the effect a controlled enemy aims with along the controller's input and keeps it in reach.
void Entity_NPC::UpdateChildEffectPosition(bool)
{
@@ -2759,10 +2833,24 @@ void Entity_NPC::UpdateControllerMovement(bool)
// The rest of Entity_NPC is not reconstructed yet.
// 006d9440
bool Entity_NPC::TryThrow(const EntityRef&, const Vector&, float)
// 006d9440 Thrown: a poop pile flies at the throw's velocity from 20 pixels up at the throw's height, stops being kept
// across rooms, gets the thrown flag (colliding with everything when a player threw it) and splats when fast. Other
// NPCs are thrown only while held.
bool Entity_NPC::TryThrow(const EntityRef& source, const Vector& throwVelocity, float height)
{
reconstruction_missing("Entity_NPC::TryThrow 006d9440");
if (type != ENTITY_POOP) return HasEntityFlags(FLAG_HELD);
v1 = vector_make(POOP_THROW_HEIGHT, -height);
velocity = throwVelocity;
flags = (flags & ~FLAG_PERSISTENT) | FLAG_THROWN;
if (source.type == ENTITY_PLAYER) entityCollisionClass = ENTCOLL_ALL;
if (vector_length_squared(throwVelocity) > POOP_THROW_LOUD_SPEED * POOP_THROW_LOUD_SPEED)
{
int sound = SOUND_POOPITEM_THROW;
seed_fart_sound_override(&sound);
g_manager->sfxManager.Play(sound);
}
return true;
}
// 004b92e0
@@ -2777,24 +2865,6 @@ void Entity_NPC::Hornfel_UpdateFrame()
reconstruction_missing("Entity_NPC::Hornfel_UpdateFrame 004bb0e0");
}
// 004e8fa0
void Entity_NPC::UpdateCordChain(bool)
{
reconstruction_missing("Entity_NPC::UpdateCordChain 004e8fa0");
}
// 004e9b10
void Entity_NPC::render_overlay(const Vector&, bool)
{
reconstruction_missing("Entity_NPC::render_overlay 004e9b10");
}
// 0059bed0
void Entity_NPC::RenderSegmentLink(const Vector&, bool)
{
reconstruction_missing("Entity_NPC::RenderSegmentLink 0059bed0");
}
// 0059e390
void Entity_NPC::CreateBling()
{
@@ -2871,10 +2941,13 @@ void* Entity_NPC::fireplace_get_loot(void*, bool)
reconstruction_missing("Entity_NPC::fireplace_get_loot 006d1580");
}
// 006d4db0
// 006d4db0 Whether a reroll may turn it into another enemy: not when its tags forbid it, for a Lil Haunt still tied
// to the Haunt, or for a boss.
bool Entity_NPC::CanReroll()
{
reconstruction_missing("Entity_NPC::CanReroll 006d4db0");
if ((config->tags & ENTITY_TAG_NOREROLL) || (type == ENTITY_THE_HAUNT && variant == HAUNT_LIL_VARIANT && parent))
return false;
return !IsBoss() && !config->isBoss;
}
// 006d88b0