Curation round 19: EvaluateItems and charged shots, actives split into Rebirth and Repentance dispatches, cards and runes, champions and death effects, War, Death, Uriel and the boss sweep, Delirium, T. Lilith's Gello and familiars, effects, price sprites and the devil room

This commit is contained in:
shweet committed 2026-11-21 15:05:20 -05:00
1 parent 9dfc09518c
commit ee863e70e6
105 files changed
+14201 -2331

No files matched your search

+226 -10
View File
@@ -4,6 +4,7 @@
#include "entity_effect.h"
#include "entity_effect_combat.h"
#include "entity_familiar.h"
#include "entity_knife.h"
#include "entity_pickup.h"
#include "entity_player.h"
#include "game.h"
@@ -48,9 +49,46 @@ constexpr uint64_t CHANGE_BOTH_FLAGS =
constexpr uint64_t BURST3_CHILD_CLEARED = PROJECTILE_CURVE_LEFT | PROJECTILE_CURVE_RIGHT | PROJECTILE_SINE_VELOCITY;
// The flags whose effects belong to the late bosses and items, and are not reconstructed.
constexpr uint64_t UNRECONSTRUCTED_FLAGS = PROJECTILE_CONTINUUM | PROJECTILE_STASIS | PROJECTILE_FIRE_WAVE |
PROJECTILE_FIRE_WAVE_X | PROJECTILE_FIRE_SPAWN | PROJECTILE_BLUE_FIRE_SPAWN |
PROJECTILE_LASER_SHOT | PROJECTILE_BROCCOLI | PROJECTILE_SIDE_WAVE;
constexpr uint64_t UNRECONSTRUCTED_FLAGS =
PROJECTILE_STASIS | PROJECTILE_LASER_SHOT | PROJECTILE_BROCCOLI | PROJECTILE_SIDE_WAVE;
constexpr uint64_t FIRE_FLAGS = PROJECTILE_FIRE_WAVE | PROJECTILE_FIRE_WAVE_X | PROJECTILE_FIRE_SPAWN;
// The glow a fiery, Heretic's, blue fire or side wave shot carries.
constexpr KColor GLOW_FIRE = kcolor_rgba(1, 0.2f, 0, 1);
constexpr KColor GLOW_HERETIC = kcolor_rgba(0.8f, 0.2f, 1, 1);
constexpr KColor GLOW_BLUE_FIRE = kcolor_rgba(0.1f, 0.8f, 1, 1);
constexpr KColor GLOW_SIDE_WAVE = kcolor_rgba(1, 0, 0, 1);
constexpr float GLOW_SCALE = 0.75f;
constexpr int GLOW_FADE_FRAMES = 10;
// The glowing trails: a particle every other tick, its offset a random 0.3 to 1 of its hue.
constexpr float TRAIL_TICKS = 2;
constexpr float TRAIL_GLOW_MIN = 0.3f;
constexpr float TRAIL_GLOW_RANGE = 0.7f;
constexpr float TRAIL_CYAN_GREEN = 0.7f;
constexpr float TRAIL_PURPLE_RED = 0.4f;
constexpr float TRAIL_PURPLE_GREEN = 0.3f;
constexpr float TRAIL_PURPLE_BLUE = 0.7f;
constexpr float TRAIL_PURPLE_SCALE = 0.66f;
constexpr float TRAIL_DEPTH_OFFSET = -5;
// The fires shots leave: four waves 90 apart, a jet, and fireplaces or flames of a random share of their health
// or size.
constexpr int FIRE_WAVE_COUNT = 4;
constexpr int FIRE_WAVE_SOUND_DELAY = 45;
constexpr float FIRE_WAVE_DIAGONAL = 45;
constexpr int FIRE_LEAVE_ODDS = 10;
constexpr float FIRE_SHARE_RANGE = 0.2f;
constexpr float FIRE_SHARE = 0.4f;
constexpr float BLUE_FIRE_SHARE = 0.6f;
constexpr float BLUE_FLAME_DAMAGE = 6;
constexpr float RED_FLAME_DAMAGE = 12;
constexpr int BLUE_FLAME_TIMEOUT = 150;
constexpr int RED_FLAME_TIMEOUT_MIN = 300;
constexpr int RED_FLAME_TIMEOUT_RANGE = 120;
constexpr int FIREPLACE_RED_MOVING = 10;
constexpr int FIREPLACE_BLUE_MOVING = 12;
constexpr ColorMod BLUE_FIRE_POOF_COLOR = {{1, 1, 1, 1}, {0, 0, 0, 0}, {0, 0.4f, 0.6f}};
// Time: the share a slowed shot keeps, the near stop of a held or paused one, and the Hourglass's fade.
constexpr float SLOW_SCALE = 0.5f;
@@ -274,7 +312,21 @@ constexpr float WEAK_SHOT_SCALE = 0.8f;
constexpr int COLOR_PRIORITY = 255;
constexpr int COLOR_PRIORITY_NONE = -1;
constexpr int ENTITY_MR_FRED = 270;
// A Continuum shot wraps 100 past the edges, its colorize stepping every other frame through nine, black at the
// sixth.
constexpr float CONTINUUM_WRAP_MARGIN = -100;
constexpr int CONTINUUM_COLORS = 9;
constexpr int CONTINUUM_DARK_STEP = 5;
constexpr std::array<std::array<float, 3>, CONTINUUM_COLORS> CONTINUUM_COLORIZES = {{{1, 0.33f, 1},
{1, 0.66f, 1},
{1, 1, 1},
{0.66f, 0.66f, 0.66f},
{0.33f, 0.33f, 0.33f},
{0, 0, 0},
{0.33f, 0, 0.33f},
{0.66f, 0, 0.66f},
{1, 0, 1}}};
constexpr int ENTITY_TARBOY = 307;
constexpr int ENTITY_NECRO = 828;
constexpr int ENTITY_SHADY = 888;
@@ -398,6 +450,15 @@ static Entity_Effect* effect_spawn(int variant, const Vector& position, Entity*
return static_cast<Entity_Effect*>(effect);
}
// Spawns a moving effect at a position.
static Entity_Effect* effect_spawn_moving(int variant, const Vector& position, const Vector& velocity, Entity* spawner)
{
uint32_t seed = Random();
Entity* effect = g_game->Spawn({.position = position, .velocity = velocity, .spawner = spawner,
.type = ENTITY_EFFECT, .variant = variant, .seed = seed});
return static_cast<Entity_Effect*>(effect);
}
// Spawns a shot from a shot, taking on its spawner type and variant as the splits do.
static Entity_Projectile* child_spawn(Entity_Projectile& source, const EntitySpawn& spawn)
{
@@ -681,11 +742,21 @@ void Entity_Projectile::animation_update()
}
}
// Its first frame after the base update: a Godhead shot takes its aura.
// Its first frame after the base update: a fiery shot glows orange, the Heretic's exploding one purple, a blue fire
// spawning one blue and a side wave one red, and a Godhead shot without a glow takes its aura.
void Entity_Projectile::first_frame_update()
{
if ((projectileFlags & PROJECTILE_EXPLODE) && spawnerType == ENTITY_HERETIC)
reconstruction_missing("Entity_Projectile::Update 00653070: the Heretic's glowing shot");
KColor glow{};
if (projectileFlags & FIRE_FLAGS) glow = GLOW_FIRE;
else if ((projectileFlags & PROJECTILE_EXPLODE) && spawnerType == ENTITY_HERETIC) glow = GLOW_HERETIC;
else if (projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) glow = GLOW_BLUE_FIRE;
else if (projectileFlags & PROJECTILE_SIDE_WAVE) glow = GLOW_SIDE_WAVE;
if (glow._alpha > 0)
{
effect_light_create(
{.color = glow, .position = pos, .parent = this, .scale = GLOW_SCALE, .fadeFrames = GLOW_FADE_FRAMES});
return;
}
if (!(projectileFlags & PROJECTILE_GODHEAD)) return;
uint32_t seed = Random();
@@ -806,14 +877,44 @@ void Entity_Projectile::head_splash()
.amount = HEAD_GIBS, .gibFlags = HEAD_GIB_FLAGS});
}
// The trails the late bosses' shots leave, which are not reconstructed.
// A glowing additive trail particle every other tick: cyan behind a blue fire spawning shot, purple and smaller
// behind a Necro's bone.
void Entity_Projectile::glow_trail_spawn(bool isPurple)
{
Entity_Effect* particle = effect_spawn_moving(EFFECT_HAEMO_TRAIL, pos, vector_scale(velocity, HALF), this);
layer_additive_set(particle->sprite, 0);
particle->posOffset = vector_add(posOffset, vector_make(0, fallingSpeed * HALF));
float glow = random_unit() * TRAIL_GLOW_RANGE + TRAIL_GLOW_MIN;
ColorMod color = tint_color_make(0, 0, 0, 1);
if (isPurple)
{
color._offset[0] = glow * TRAIL_PURPLE_RED;
color._offset[1] = glow * TRAIL_PURPLE_GREEN;
color._offset[2] = glow * TRAIL_PURPLE_BLUE;
particle->sprite.scale = vector_make(TRAIL_PURPLE_SCALE, TRAIL_PURPLE_SCALE);
}
else
{
color._offset[1] = glow * TRAIL_CYAN_GREEN;
color._offset[2] = glow;
}
particle->SetColor(color, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
particle->renderDepthOffset = TRAIL_DEPTH_OFFSET;
particle->Update();
}
// The trails shots leave: a blue fire spawning shot's and a Necro bone's glow. The Beast's and Mother's are not
// reconstructed.
void Entity_Projectile::trails_update()
{
bool isNecroBone = spawnerType == ENTITY_NECRO && variant == PROJECTILE_BONE;
if ((projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) && GetIntervalTicks(TRAIL_TICKS, 0)) glow_trail_spawn(false);
else if (spawnerType == ENTITY_NECRO && variant == PROJECTILE_BONE && GetIntervalTicks(TRAIL_TICKS, 0))
glow_trail_spawn(true);
bool isBeastFire = (projectileFlags & PROJECTILE_EXPLODE) && spawnerType == ENTITY_BEAST &&
spawnerVariant == BEAST_FIRE_BALL;
bool isMotherShot = spawnerType == ENTITY_MOTHER && spawnerVariant == 0 && subtype == 1;
if (isNecroBone || isBeastFire || isMotherShot)
if (isBeastFire || isMotherShot)
reconstruction_missing("Entity_Projectile::Update 00653070: a late boss's shot trail");
}
@@ -826,11 +927,97 @@ void Entity_Projectile::death_update()
death_poof_spawn();
death_flags_apply();
death_bursts_spawn();
if (projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) blue_fire_spawn();
if (projectileFlags & PROJECTILE_FIRE_SPAWN) fire_spawn();
if (variant == PROJECTILE_HEAD) head_splash();
Remove();
if (variant == PROJECTILE_FIRE && spawnerType == ENTITY_BEAST) npc_sound_play(SOUND_BEAST_FIRE, 1, 2, 1);
}
// Part of 00653070: whether the shot is on the players' side, which its fires take.
bool Entity_Projectile::is_friendly_fire()
{
return HasEntityFlags(FLAG_FRIENDLY) || (projectileFlags & PROJECTILE_CANT_HIT_PLAYER);
}
// Part of 00653070: four fire waves from where a fire wave shot landed, along the axes (FIRE_WAVE_X: the diagonals,
// keeping the shot's spawner kind).
void Entity_Projectile::fire_waves_spawn(FireWaveShape shape)
{
npc_sound_play(SOUND_FLAME_BURST, 1, FIRE_WAVE_SOUND_DELAY, 1);
for (int i = 0; i < FIRE_WAVE_COUNT; i++)
{
Entity_Effect* wave = effect_spawn(EFFECT_FIRE_WAVE, pos, spawnerEntity);
wave->parent = this;
if (shape == FIRE_WAVE_CROSS)
{
wave->spawnerType = spawnerType;
wave->spawnerVariant = spawnerVariant;
}
wave->rotation = (float)i * RIGHT_ANGLE_DEGREES + (shape == FIRE_WAVE_CROSS ? FIRE_WAVE_DIAGONAL : 0);
if (is_friendly_fire()) wave->AddEntityFlags(FLAG_FRIENDLY);
}
}
// Part of 00653070: a fire a shot leaves inside the room: a moving fireplace for an enemy's shot, a player's flame
// (with a timeout) for a friendly one, its health or size a random share.
void Entity_Projectile::fire_leave(const LeftFire& fire)
{
if (!is_friendly_fire())
{
Entity* place = g_game->Spawn({.position = pos, .spawner = this, .type = ENTITY_FIREPLACE,
.variant = fire.fireplaceVariant, .seed = Random()});
place->targetPosition = pos;
place->health = place->health * (random_unit() * FIRE_SHARE_RANGE + fire.share);
return;
}
Entity_Effect* flame = effect_spawn(fire.flameVariant, pos, this);
if (fire.flameVariant == EFFECT_BLUE_FLAME)
{
flame->spawnerType = ENTITY_PLAYER;
flame->spawnerVariant = 0;
}
flame->scale = random_unit() * FIRE_SHARE_RANGE + fire.share;
flame->SetCollisionDamage(fire.flameDamage);
flame->SetTimeout(fire.timeoutRange > 0 ? random_below(fire.timeoutRange) + fire.timeoutMin
: fire.timeoutMin);
}
// Part of 00653070: a blue fire spawning shot (a bone one with a crack) lands in a blue poof and leaves a blue fire.
void Entity_Projectile::blue_fire_spawn()
{
if (variant == PROJECTILE_BONE) npc_sound_play(SOUND_FORTUNE_COOKIE, 1, 2, 1);
if (!g_game->room->IsPositionInRoom(pos, 0)) return;
Entity* poof = effect_spawn(EFFECT_POOF01, pos, spawnerEntity);
poof->SetColor(BLUE_FIRE_POOF_COLOR, COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
poof->Update();
fire_leave({.flameDamage = BLUE_FLAME_DAMAGE,
.share = BLUE_FIRE_SHARE,
.fireplaceVariant = FIREPLACE_BLUE_MOVING,
.flameVariant = EFFECT_BLUE_FLAME,
.timeoutMin = BLUE_FLAME_TIMEOUT});
npc_sound_play(SOUND_CANDLE_LIGHT, 1, 2, 1);
}
// Part of 00653070: a fire spawning shot bursts in a fire jet, and one in ten inside the room leaves a fire.
void Entity_Projectile::fire_spawn()
{
Entity* jet = effect_spawn(EFFECT_FIRE_JET, pos, spawnerEntity);
jet->spawnerType = spawnerType;
jet->spawnerVariant = variant;
if (is_friendly_fire()) jet->AddEntityFlags(FLAG_FRIENDLY);
if (random_below(FIRE_LEAVE_ODDS) != 0 || !g_game->room->IsPositionInRoom(pos, 0)) return;
fire_leave({.flameDamage = RED_FLAME_DAMAGE,
.share = FIRE_SHARE,
.fireplaceVariant = FIREPLACE_RED_MOVING,
.flameVariant = EFFECT_RED_CANDLE_FLAME,
.timeoutMin = RED_FLAME_TIMEOUT_MIN,
.timeoutRange = RED_FLAME_TIMEOUT_RANGE});
}
// The poof of a dead shot by its variant, or the explosion of an exploding one, tinted its color.
void Entity_Projectile::death_poof_spawn()
{
@@ -1033,6 +1220,9 @@ void Entity_Projectile::death_bursts_spawn()
}
}
if (projectileFlags & PROJECTILE_FIRE_WAVE) fire_waves_spawn(FIRE_WAVE_PLUS);
if (projectileFlags & PROJECTILE_FIRE_WAVE_X) fire_waves_spawn(FIRE_WAVE_CROSS);
if (projectileFlags & PROJECTILE_BURST8)
{
pos = vector_sub(pos, vector_scale(gridCollisionVelocity, 2));
@@ -1164,6 +1354,7 @@ void Entity_Projectile::steering_update()
creep->SetTimeout(BROWN_CREEP_TIMEOUT);
}
}
if (projectileFlags & PROJECTILE_CONTINUUM) continuum_update();
orbit_update();
if (projectileFlags & (PROJECTILE_CURVE_LEFT | PROJECTILE_CURVE_RIGHT))
@@ -1211,6 +1402,31 @@ void Entity_Projectile::steering_update()
velocity = vector_scale(direction, speed);
}
// Part of 00653070: a Continuum shot wraps around the screen's edges, cycling every other frame through a colorize
// of the nine its age picks (pink to white to grey, black, then purple).
void Entity_Projectile::continuum_update()
{
pos = room_screen_wrap(pos, CONTINUUM_WRAP_MARGIN);
if (!IsFrame(2, (int)index)) return;
SetColor(continuum_tint_get((int)(updateTime * HALF)), COLOR_PRIORITY_NONE, COLOR_PRIORITY, false, true);
}
// The tint a Continuum shot or tear takes at a step of its cycle: a colorize of the nine, or black.
ColorMod continuum_tint_get(int step)
{
ColorMod tint = COLOR_DEFAULT;
step %= CONTINUUM_COLORS;
if (step == CONTINUUM_DARK_STEP)
{
tint._tint[0] = tint._tint[1] = tint._tint[2] = 0;
return tint;
}
for (int i = 0; i < 3; i++) tint._colorize[i] = CONTINUUM_COLORIZES[step][i];
tint._colorize[3] = 1;
return tint;
}
// The orbits: it circles its target position (or its parent with ORBIT_PARENT, moving along with it), pulled to its
// orbit distance.
void Entity_Projectile::orbit_update()