Curation round 24 (code only): pickups and slots, level generation with the Ascent and the Death Certificate return, rooms and grid entities, Game and Entity core with Polty, Clutch, Matriarch, Chimera, Bumbino and other bosses, the player's remaining branches, familiars and weapons, HUD and engine stubs, 004b6a90 renamed push_back, shared constants folded (66 duplicates, 38 main gaps)

This commit is contained in:
shweet committed 2026-11-23 03:27:24 -05:00
1 parent 11c71fe041
commit 534339a496
232 files changed
+14610 -3185

No files matched your search

+88 -23
View File
@@ -67,7 +67,6 @@ constexpr std::array<int, 7> STATIC_OBSTACLE_TYPES = {292, 245, 302, 42, 201, 20
constexpr int STATIC_OBSTACLE_EXTRA = 202;
// The items, trinkets and player kinds the combat code reads (Lua's ids).
constexpr int COLLECTIBLE_MOMS_HEELS = 30;
constexpr int COLLECTIBLE_ARIES = 300;
constexpr int NULLITEM_TOOTH_AND_NAIL = 59;
constexpr int PLAYER_FORM_COUNT_NEEDED = 3;
@@ -115,7 +114,6 @@ constexpr uint32_t TEAR_BOUNCE_PIERCE_MASK = 3;
constexpr int INFAMY_CHANCE = 2;
constexpr int INFAMY_CHANCE_VERSUS = 4;
constexpr int INFAMY_FLASH_FRAMES = 15;
constexpr int COLOR_PRIORITY_TOP = 255;
constexpr float MULLIGAN_FLY_CHANCE = 0.166f;
constexpr float GUPPY_FLY_CHANCE = 0.66f;
constexpr float LASTING_BEAM_FLY_SCALE = 0.1f;
@@ -123,6 +121,17 @@ constexpr float LASTING_BEAM_FLY_SCALE = 0.1f;
// Entity_Player::HandleCollision: the contact damage the items deal.
constexpr int CONTACT_COUNTDOWN = 15;
constexpr int SUPLEX_STATE_PASSING = 3;
// Mega Mush's stomp (weaker in versus) and the suplex grab: the fireplace it snuffs, its aim's time and its scamper's
// pitch. Breath of Life's burst: its damage, more per floor deep, and its size.
constexpr float MEGA_MUSH_STOMP = 80;
constexpr float MEGA_MUSH_STOMP_VERSUS = 10;
constexpr float SUPLEX_FIREPLACE_DAMAGE = 1000;
constexpr int SUPLEX_GRAB_AIM_FRAMES = 60;
constexpr float SUPLEX_GRAB_PITCH_MIN = 0.9f;
constexpr float SUPLEX_GRAB_PITCH_RANGE = 0.2f;
constexpr float BREATH_BURST_DAMAGE = 15;
constexpr float BREATH_BURST_DAMAGE_PER_STAGE = 2.1f;
constexpr float BREATH_BURST_SIZE = 80;
constexpr float HEELS_DAMAGE = 12;
constexpr float HEELS_DAMAGE_VERSUS = 2;
constexpr float VIRUS_DAMAGE = 12;
@@ -171,8 +180,6 @@ constexpr float GIB_SPEED_MIN = 2;
constexpr float GIB_SPEED_RANGE = 4;
constexpr float GIB_LIFT = 0.5f;
constexpr float GIB_WORM_HEIGHT = -40;
constexpr float DUST_SPEED = 5;
constexpr float DUST_RADIUS = 20;
constexpr float DUST_ALPHA_MIN = 0.2f;
constexpr float DUST_ALPHA_RANGE = 0.5f;
constexpr float DROP_SPEED = 10;
@@ -421,7 +428,7 @@ static void burst_drops_spawn(Entity& entity, int gibsAmount)
drop->rotation = (random_unit() * DROP_SPIN_RANGE + DROP_SPIN_MIN) * side;
float alpha = (random_unit() * DROP_ALPHA_RANGE + DROP_ALPHA_MIN) * blood._alpha;
drop->SetColor({{blood._red, blood._green, blood._blue, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1,
COLOR_PRIORITY_TOP, false, true);
COLOR_PRIORITY_DEFAULT, false, true);
if (!isHuge) drop->SetTimeout((int)(Random() % GIB_TIMEOUT_RANGE) + GIB_TIMEOUT_MIN);
else
{
@@ -484,7 +491,7 @@ void Entity::BloodExplode()
if (type == ENTITY_BOMB || type == ENTITY_PICKUP || HasEntityFlags(FLAG_NO_BLOOD_SPLASH)) return;
Entity_Effect* splat = effect_spawn(EFFECT_BLOOD_SPLAT, 0, pos, {}, nullptr, Random());
splat->SetColor(splatColor, -1, COLOR_PRIORITY_TOP, false, true);
splat->SetColor(splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
if (g_game->seedEffects.HasSeedEffect(SEED_EXTRA_BLOOD))
splat->sprite.scale = vector_make(EXTRA_BLOOD_SPLAT_SCALE, EXTRA_BLOOD_SPLAT_SCALE);
splat->Update();
@@ -530,7 +537,7 @@ static void gib_dust_spawn(const GibSpawn& gibs, int half)
dust->rotation = (random_unit() * DROP_SPIN_RANGE + DROP_SPIN_MIN) * spin_side(*dust, gibs.position, velocity);
dust->SetTimeout((int)(Random() % GIB_TIMEOUT_RANGE) + GIB_TIMEOUT_MIN);
float alpha = random_unit() * DUST_ALPHA_RANGE + DUST_ALPHA_MIN;
dust->SetColor({{1, 1, 1, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1, COLOR_PRIORITY_TOP, false, true);
dust->SetColor({{1, 1, 1, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1, COLOR_PRIORITY_DEFAULT, false, true);
dust->Update();
}
}
@@ -570,14 +577,14 @@ static Entity_Effect* gib_blood_spawn(const GibSpawn& gibs, int kind, uint32_t s
Entity_Effect* gib = gib_fling(gibs, EFFECT_BLOOD_PARTICLE, kind, seed, speed);
if (!gibs.spawner || !gibs.spawner->HasEntityFlags(FLAG_POISON))
{
gib->SetColor(gibs.color, -1, COLOR_PRIORITY_TOP, false, true);
gib->SetColor(gibs.color, -1, COLOR_PRIORITY_DEFAULT, false, true);
gib->splatColor = gibs.color;
}
else
{
ColorMod tinted = gibs.color;
color_multiply(tinted, POISON_GIB_TINT);
gib->SetColor(kind == 0 ? tinted : gibs.color, -1, COLOR_PRIORITY_TOP, false, true);
gib->SetColor(kind == 0 ? tinted : gibs.color, -1, COLOR_PRIORITY_DEFAULT, false, true);
gib->splatColor = tinted;
}
if (kind == GIB_KIND_BONE) gib->AddEntityFlags(FLAG_NO_BLOOD_SPLASH);
@@ -618,7 +625,7 @@ static Entity_Effect* gib_spawn(const GibSpawn& gibs, int kind)
if (kind == GIB_KIND_ROCK_SMALL)
{
Entity_Effect* tooth = gib_scatter(gibs, EFFECT_TOOTH_PARTICLE, draw);
tooth->SetColor(TOOTH_COLOR, -1, COLOR_PRIORITY_TOP, false, true);
tooth->SetColor(TOOTH_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
return tooth;
}
if (kind == GIB_KIND_CHAIN) return gib_scatter(gibs, EFFECT_CHAIN_GIB, draw);
@@ -733,7 +740,7 @@ static TearContact tear_player_contact(Entity_Tear& tear, Entity_Player& player)
int infamyChance = g_game->deathmatchManager.is_active() ? INFAMY_CHANCE_VERSUS : INFAMY_CHANCE;
if (!player.HasCollectible(COLLECTIBLE_INFAMY) || random_below(infamyChance) != 0) return TEAR_CONTACT_HIT;
player.SetColor(INFAMY_COLOR, INFAMY_FLASH_FRAMES, COLOR_PRIORITY_TOP, true, true);
player.SetColor(INFAMY_COLOR, INFAMY_FLASH_FRAMES, COLOR_PRIORITY_DEFAULT, true, true);
tear.Kill(EntityRef(&player));
return TEAR_CONTACT_PASS;
}
@@ -994,10 +1001,10 @@ bool Entity_Tear::HandleCollision(Entity* collider, bool isLow)
tear_hit_push(*this, *collider, owner);
}
ApplyTearFlagEffects(collider, pos, tearFlags, this, collisionDamage);
if (variant == TEAR_ERASER && collider->IsVulnerableEnemy(nullptr) && (!collider->IsBoss() || collider->HasMortalDamage()))
reconstruction_missing("Entity_Tear::HandleCollision 00673660: the Eraser erasing an enemy");
bool isErasable = collider->IsVulnerableEnemy(nullptr) && (!collider->IsBoss() || collider->HasMortalDamage());
if (variant == TEAR_ERASER && isErasable && enemy_erase(*collider)) npc_sound_play(SOUND_ERASER_HIT, 1, 2, 1);
if (tearFlags[TEAR_TELEPORT] && collider->IsVulnerableEnemy(nullptr) && !collider->IsBoss())
reconstruction_missing("Entity_Tear::HandleCollision 00673660: a teleporting tear's reroll");
tear_hit_teleport(*collider);
if (isExplosive)
{
@@ -1124,9 +1131,44 @@ static float player_contact_damage(Entity_Player& player, Entity& collider, bool
return damage;
}
// Part of 0078e1f0: the player's ways of touching: shoving an iced enemy, Tainted Magdalene's hug, and those not
// written yet: Mega Mush's stomp, Tainted Soul grabbing her body and the suplex grab.
static void player_contact_missing_check(Entity_Player& player, Entity& collider)
// Part of 0078e1f0: Mega Mush's stomp crushes what the giant touches once each: an enemy (unless friendly), a slot or a
// pickup, the last two blown up as well.
static void mega_mush_stomp(Entity_Player& player, Entity& collider)
{
bool isEnemy = collider.IsEnemy() && !collider.HasEntityFlags(FLAG_FRIENDLY);
if (!isEnemy && !collider.is_slot() && !collider.is_pickup()) return;
if (EntityList::HitListContains(player.contactHitList, collider)) return;
hit_list_insert(player.contactHitList, collider);
float damage = isEnemy && g_game->deathmatchManager.is_active() ? MEGA_MUSH_STOMP_VERSUS : MEGA_MUSH_STOMP;
uint64_t flags = isEnemy ? DAMAGE_CRUSH : DAMAGE_CRUSH | DAMAGE_EXPLOSION;
collider.TakeDamage(damage, flags, EntityRef(&player), HIT_COUNTDOWN);
}
// Part of 0078e1f0: Suplex!'s dash grabs what it runs into: shots pass, a fireplace is snuffed out, and an enemy or a
// bomb is lifted for the aim. Whether the collision is ignored for good.
static bool suplex_grab(Entity_Player& player, Entity& collider)
{
if (collider.type == ENTITY_PROJECTILE) return true;
if (!collider.IsEnemy() && !collider.is_bomb()) return false;
if (collider.type == ENTITY_FIREPLACE)
{
collider.TakeDamage(SUPLEX_FIREPLACE_DAMAGE, 0, EntityRef(&player), HIT_COUNTDOWN);
return false;
}
if (!player.TryHoldEntity(&collider)) return false;
player.itemState = COLLECTIBLE_SUPLEX;
player.suplexAimCountdown = SUPLEX_GRAB_AIM_FRAMES;
player.suplexState = SUPLEX_AIMING;
npc_sound_play(SOUND_SUPLEX_GRAB, 1, 2, 1);
npc_sound_play(SOUND_SCAMPER, 1, 2, random_unit() * SUPLEX_GRAB_PITCH_RANGE + SUPLEX_GRAB_PITCH_MIN);
return true;
}
// Part of 0078e1f0: the player's ways of touching before it hurts anything: shoving an iced enemy, Tainted Magdalene's
// hug and Mega Mush's stomp.
static void player_contact_touch(Entity_Player& player, Entity& collider)
{
bool isEnemyLike = Entity::is_enemy_type(collider.type) ||
(g_game->deathmatchManager.is_active() && collider.type == ENTITY_PLAYER);
@@ -1139,9 +1181,7 @@ static void player_contact_missing_check(Entity_Player& player, Entity& collider
collider.AddKnockback(EntityRef(&player), vector_scale(push, ICE_SHOVE_SPEED), ICE_SHOVE_FRAMES, true);
}
tainted_magdalene_hug(player, collider);
if (player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH))
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Mega Mush's stomp");
if (player.suplexState == 1) reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the suplex grab");
if (player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH)) mega_mush_stomp(player, collider);
}
// Part of 0078e1f0: The Virus and Serpent's Kiss poison an enemy touched for 60 frames at 2 plus a twentieth of the
@@ -1163,6 +1203,25 @@ static void virus_poison_apply(Entity_Player& player, Entity& collider)
false);
}
// Part of 0078e1f0: Breath of Life's holy burst where the player's edge meets the enemy it hurt, stronger deeper down
// (none while the player keeps Judas' Book of Belial), and a short spell unhurt.
static void breath_of_life_burst(Entity_Player& player, Entity& collider)
{
float damage = (float)g_game->stage_depth_get() * BREATH_BURST_DAMAGE_PER_STAGE + BREATH_BURST_DAMAGE;
Vector edge = vector_add(player.pos, vector_resized(vector_sub(collider.pos, player.pos), player.size));
if (!player.HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE))
{
Entity* burst = g_game->Spawn({.position = edge, .spawner = &player, .type = ENTITY_EFFECT,
.variant = EFFECT_CRACK_THE_SKY, .seed = Random()});
burst->parent = &player;
burst->SetCollisionDamage(damage);
burst->SetSize(BREATH_BURST_SIZE, vector_make(-1, -1), -1);
burst->subtype = 1;
}
if (player.damageCooldown < 1) player.AddEntityFlags(FLAG_NO_DAMAGE_BLINK);
player.damageCooldown = std::max(player.damageCooldown, CONTACT_COUNTDOWN);
}
// 0078e1f0 Touches another entity, after a mod's MC_PRE_PLAYER_COLLISION: mid-suplex it passes enemies and shots,
// it hurts a vulnerable enemy by its items' contact damage, poisons with The Virus or Serpent's Kiss, and a thrown
// Tainted Forgotten slows on enemies. Tainted Forgotten's soul picks the body up. Whether the collision is ignored, which a pony's dash makes it.
@@ -1172,7 +1231,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
if (lua == LUA_RESULT_TRUE) return true;
if (lua == LUA_RESULT_FALSE) return false;
player_contact_missing_check(*this, *collider);
player_contact_touch(*this, *collider);
if (playerType == PLAYER_THESOUL_B && collider->type == ENTITY_PLAYER &&
static_cast<Entity_Player*>(collider)->playerType == PLAYER_THEFORGOTTEN_B)
{
@@ -1182,6 +1241,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
return true;
TryHoldEntity(collider);
}
if (suplexState == SUPLEX_DASHING && suplex_grab(*this, *collider)) return true;
if (suplexState >= SUPLEX_STATE_PASSING && (collider->IsEnemy() || collider->type == ENTITY_PROJECTILE)) return true;
bool isIgnored = false;
@@ -1191,7 +1251,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
bool isBreath = false;
float damage = player_contact_damage(*this, *collider, isBreath);
if (damage > 0 && collider->TakeDamage(damage, DAMAGE_COUNTDOWN, EntityRef(this), CONTACT_COUNTDOWN) && isBreath)
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Breath of Life's burst");
breath_of_life_burst(*this, *collider);
}
bool isPoisoning = HasCollectible(COLLECTIBLE_VIRUS) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_VIRUS) ||
HasCollectible(COLLECTIBLE_SERPENTS_KISS);
@@ -1202,6 +1262,11 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
!collider->IsFriendly())
velocity = vector_scale(velocity, SLOW_ON_CONTACT);
if (collider->IsEnemy() && !collider->HasEntityFlags(FLAG_CHARM) && temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MARS))
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Mars' dash impact");
{
temporaryEffects.RemoveCollectibleEffect(COLLECTIBLE_MARS, -1);
velocity = vector_scale(vector_normalized(vector_sub(pos, collider->pos)), vector_length(velocity));
marsDashDirection = -1;
dash_impact();
}
return isIgnored;
}