Curation round 20: player update, costumes and render, Missing No., the last actives and cards, familiars, Pin, the Frail, Wormwood and the Heretic, Dross to Gehenna, effects and the devil room purchase, champion colours, the quit path, save fields, shared vector helpers

This commit is contained in:
shweet committed 2026-11-22 00:33:35 -05:00
1 parent ee863e70e6
commit 8dbeb1bc4a
168 files changed
+15682 -2399

No files matched your search

+85 -1
View File
@@ -1,10 +1,13 @@
#include "entity_effect.h"
#include "entity_familiar.h"
#include "entity_player.h"
#include "game.h"
#include "npc_caves.h"
#include "room.h"
#include "room_grid.h"
#include "sfx_manager.h"
#include <algorithm>
#include <array>
// A beam of light from above (Crack the Sky, Isaac's and the Holy Eye's beams): a spotlight that strikes on its Hit
// event, then hurts what stands in it every third frame its beam shows. Subtype 1 is the player's, which takes subtype
@@ -190,7 +193,7 @@ static void hush_laser_update(Entity_Effect& laser)
laser.velocity = vector_add(laser.velocity, vector_scale(pull, player.speedMultiplier));
}
laser.velocity = vector_scale(laser.velocity, npc_friction_scaled(HUSH_LASER_FRICTION, laser.speedMultiplier));
laser.velocity = vector_scale(laser.velocity, timescale_factor(HUSH_LASER_FRICTION, laser.speedMultiplier));
if (laser.IsFrame(HUSH_LASER_HIT_SPACING, (int)laser.index)) hush_laser_hit(laser);
if (!laser.IsFrame(HUSH_LASER_TRAIL_SPACING, (int)laser.index)) return;
@@ -212,12 +215,93 @@ static void hush_beam_update(Entity_Effect& beam)
hush_laser_cycle(beam);
}
// The Siren's charm on a familiar fades in over its last 15 frames and out over its first 15 from 75, follows the
// familiar, and on frame 20 (subtype 0) steals it for the Siren from its player. It fades early once its familiar or
// the Siren is gone.
constexpr int CHARM_FADE_FRAMES = 15;
constexpr int CHARM_FULL_FRAMES = 61;
constexpr float CHARM_FADE_IN_START = 75;
constexpr float CHARM_FADE_IN_END = 60;
constexpr int CHARM_STEAL_FRAME = 20;
constexpr float CHARM_DEPTH = 4;
// The familiars the Siren never charms (by variant), and those charmed only with subtype 0. Others past 900 always are.
constexpr std::array<int, 34> SIREN_IMMUNE_FAMILIARS = {12, 20, 21, 22, 23, 24, 26, 27, 28, 43, 57, 62,
64, 67, 68, 73, 109, 120, 128, 201, 202, 203, 206, 211,
213, 214, 215, 228, 236, 237, 238, 240, 243, 900};
constexpr std::array<int, 4> SIREN_SUBTYPE_ZERO_FAMILIARS = {25, 58, 59, 106};
constexpr int SIREN_INCUBUS = 80;
constexpr int SIREN_STATE_BUSY = 200;
constexpr int SIREN_STATE_IDLE = 216;
constexpr int FAMILIAR_VARIANT_LAST_PLAIN = 900;
// FUN_0060dae0 Whether the Siren may charm a familiar: not the ones that never follow her, the subtype 0 ones only
// as such, Incubus only away from Lilith, and two only in some states.
bool is_familiar_charmable(Entity_Familiar& familiar)
{
int variant = familiar.variant;
if (variant > FAMILIAR_VARIANT_LAST_PLAIN) return true;
if (std::find(SIREN_IMMUNE_FAMILIARS.begin(), SIREN_IMMUNE_FAMILIARS.end(), variant) !=
SIREN_IMMUNE_FAMILIARS.end())
return false;
if (std::find(SIREN_SUBTYPE_ZERO_FAMILIARS.begin(), SIREN_SUBTYPE_ZERO_FAMILIARS.end(), variant) !=
SIREN_SUBTYPE_ZERO_FAMILIARS.end())
return familiar.subtype == 0;
if (variant == SIREN_INCUBUS) return !familiar.player || familiar.player->playerType != PLAYER_LILITH;
if (variant == SIREN_STATE_BUSY) return familiar.state != 0;
if (variant == SIREN_STATE_IDLE) return familiar.state < 1;
return true;
}
// Part of 005cdb20 (Init's case 165) The charm glows, on the floor for subtype 1, else just in front.
static void siren_charm_init(Entity_Effect& charm)
{
layer_additive_set(*charm.sprite.GetLayer(0));
if (charm.subtype == 1) charm.sortingLayer = SORTING_BACKGROUND;
else charm.renderDepthOffset = CHARM_DEPTH;
}
// 005e0f32 (Update's case 165) The charm fades with its time, goes (without Update's shared end) from anything but a
// charmable familiar, follows it, and on its frame hands the familiar to the Siren.
static EffectUpdateEnd siren_charm_update(Entity_Effect& charm)
{
float alpha = 1;
if (charm.timeout < CHARM_FADE_FRAMES) alpha = lerp_range((float)charm.timeout, {0, CHARM_FADE_FRAMES, 0, 1});
else if (charm.timeout >= CHARM_FULL_FRAMES)
alpha = lerp_range((float)charm.timeout, {CHARM_FADE_IN_START, CHARM_FADE_IN_END, 0, 1});
charm.sprite.color._tint[3] = alpha;
Entity* target = charm.target;
if (target)
{
if (!target->IsFamiliar() || !is_familiar_charmable(static_cast<Entity_Familiar&>(*target)))
{
charm.Remove();
return EFFECT_UPDATE_RETURN;
}
charm.pos = target->pos;
charm.velocity = target->velocity;
}
if ((!target || !charm.parent || charm.parent->isDead) && charm.timeout > CHARM_FADE_FRAMES)
charm.timeout = CHARM_FADE_FRAMES;
if (charm.subtype != 0 || charm.timeout != CHARM_STEAL_FRAME || !target || !charm.parent)
return EFFECT_UPDATE_FINISH;
Entity* siren = charm.parent->to_npc_or_coop_player();
auto* familiar = static_cast<Entity_Familiar*>(target);
Entity_Player* player = charm.child ? charm.child->ToPlayer() : nullptr;
if (siren && siren->IsType(ENTITY_SIREN, 0, -1) && !familiar->HasEntityFlags(FLAG_CHARM) && player)
familiar->siren_charm(siren, player);
return EFFECT_UPDATE_FINISH;
}
// Hush's lasers and the poof of his shots have no Init case of their own.
constexpr auto BOSS_EFFECT_BEHAVIOURS = std::to_array<EffectBehaviour>({
{EFFECT_CRACK_THE_SKY, crack_init, effect_finishing<crack_update>, nullptr},
{EFFECT_HUSH_LASER, nullptr, effect_finishing<hush_laser_update>, nullptr},
{EFFECT_HUSH_LASER_UP, nullptr, effect_finishing<hush_beam_update>, nullptr},
{EFFECT_BULLET_POOF_HUSH, nullptr, effect_poof_update, nullptr},
{EFFECT_CHARM_EFFECT, siren_charm_init, siren_charm_update, nullptr},
});
std::span<const EffectBehaviour> boss_effect_behaviours()