Curation round 15: restart and mods, Brimstone and Tech X, room gaps, eight bosses, the Womb and Mom's Heart, the Forgotten and tainted starts, alt path enemies and exits

This commit is contained in:
shweet committed 2026-11-20 20:54:59 -05:00
1 parent 6e3da161fc
commit 78a2680134
128 files changed
+13196 -2933

No files matched your search

+89 -39
View File
@@ -21,6 +21,7 @@
#include "room_descriptor.h"
#include "room_grid.h"
#include "sfx_manager.h"
#include "mines.h"
#include <algorithm>
#include <cmath>
#include <filesystem>
@@ -256,6 +257,52 @@ static Entity* spawn_at(int type, int variant, int subType, const Vector& positi
.seed = Random()});
}
// Whether an entity may be the nearest enemy (Game::GetNearestEnemy): a living, targetable, collidable enemy past its
// first frame that is not friendly, nor a fireplace, shopkeeper, TNT, poop, prop, minecart or the blood cultist's
// spawn. In a versus match the other players count too.
static bool is_nearest_enemy_candidate(Entity& entity, bool isVersusPlayer)
{
constexpr int CULTIST_BLOOD_SPAWN = 10;
int type = entity.type;
if (g_game->frameCount - entity.spawnFrame <= 1) return false;
if (!isVersusPlayer && (type < ENTITY_FIRST_ENEMY || type > ENTITY_LAST_ENEMY)) return false;
if (entity.entityCollisionClass == ENTCOLL_NONE || entity.entityCollisionClass == ENTCOLL_PLAYERONLY) return false;
if (entity.isInvincible || entity.isDead || entity.HasEntityFlags(FLAG_NO_TARGET | FLAG_FRIENDLY)) return false;
if (isVersusPlayer) return true;
if (type == ENTITY_CULTIST) return entity.variant != CULTIST_BLOOD_SPAWN;
return type != ENTITY_FIREPLACE && type != ENTITY_SHOPKEEPER && type != ENTITY_MOVABLE_TNT && type != ENTITY_POOP &&
type != ENTITY_GENERIC_PROP && type != ENTITY_MINECART;
}
// 00707370 Game::GetNearestEnemy: the enemy nearest a position within a radius that a source may target, a charmed
// one counted 400 farther. A friendly source passes over the players it may not hurt, and in a versus match over its
// own ancestors. The original's optional distance function is left out, as no caller here passes one.
Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius)
{
constexpr float CHARMED_DISTANCE_SQUARED = 160000;
bool isVersus = g_game->deathmatchManager.is_active();
Entity* nearest = nullptr;
float best = radius * radius;
for (Entity* entity : g_game->room->entityList.updateEL)
{
bool isPlayer = entity->type == ENTITY_PLAYER;
if (isPlayer && source && source->HasEntityFlags(FLAG_FRIENDLY) &&
source->IsDamageSourceFriendly(EntityRef(entity)))
continue;
if (source && ((isVersus && source->IsDescendantOf(entity)) || !source->IsValidTarget(entity))) continue;
if (!is_nearest_enemy_candidate(*entity, isVersus && isPlayer)) continue;
float distance = vector_length_squared(vector_sub(position, entity->pos));
if (entity->HasEntityFlags(FLAG_CHARM)) distance += CHARMED_DISTANCE_SQUARED;
if (distance >= best) continue;
best = distance;
nearest = entity;
}
return nearest;
}
// 00703950 The player nearest a position, the first on ties.
Entity_Player* game_nearest_player(const Vector& position)
{
@@ -2128,7 +2175,7 @@ int Entity_NPC::death_burst_get()
}
}
// 006be840 What it goes after: a charmed enemy picks the nearest enemy, Mom's Heart's (type 53) its own player,
// 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()
{
@@ -2137,7 +2184,7 @@ Entity* Entity_NPC::GetPlayerTarget()
bool isRetargeting = IsFrame(TARGET_REFRESH_FRAMES, (int)index) || !target;
if (HasEntityFlags(FLAG_CHARM) && !g_game->room->isPacifist && isRetargeting)
reconstruction_missing("Entity_NPC::GetPlayerTarget 006be840: a charmed enemy's prey (Game::GetNearestEnemy)");
target = game_nearest_enemy(pos, this, TARGET_RANGE);
if (target) return target;
bool isTargetDecoys = type != ENTITY_NO_DECOY_TYPE && decoyTargetTimer >= 0;
@@ -2414,9 +2461,8 @@ constexpr std::array<int, 21> RENDER_SPECIAL_TYPES = {273, 411, 807, 810, 815, 8
void Entity_NPC::Interpolate()
{
if (pauseTimer != 0) return;
if (type == ENTITY_MINECART) reconstruction_missing("Entity_NPC::Interpolate 006d2b50: a minecart's half step");
Entity::Interpolate();
if (type == ENTITY_MINECART) minecart_interpolate(*this);
else Entity::Interpolate();
if (aiCallFlags & AI_CALL_INTERPOLATE) ai_call(AI_PHASE_INTERPOLATE);
UpdateChildEffectPosition(true);
@@ -2558,7 +2604,7 @@ void Entity_NPC::update_damage_history()
void Entity_NPC::trigger_kill_item_effects()
{
if (isBoss) g_game->room->TriggerBossDeath(*this);
else if (isChampion) reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: NpcHelper::ChampionDrop");
else if (isChampion) champion_drop();
if (type == ENTITY_ROTGUT && variant == 1)
reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: Rotgut's death");
if (HasEntityFlags(FLAG_SPAWN_STICKY_SPIDERS))
@@ -2746,36 +2792,6 @@ void Entity_NPC::Hornfel_UpdateFrame()
reconstruction_missing("Entity_NPC::Hornfel_UpdateFrame 004bb0e0");
}
// 004cde30
void Entity_NPC::update_physics()
{
reconstruction_missing("Entity_NPC::update_physics 004cde30");
}
// 004ce120
void Entity_NPC::apply_velocity(char)
{
reconstruction_missing("Entity_NPC::apply_velocity 004ce120");
}
// 004ce6d0
void Entity_NPC::update_move_direction_anim()
{
reconstruction_missing("Entity_NPC::update_move_direction_anim 004ce6d0");
}
// 004cf030
void Entity_NPC::SetMinecartPosVel(const Vector&, const Vector&)
{
reconstruction_missing("Entity_NPC::SetMinecartPosVel 004cf030");
}
// 004cf120
void Entity_NPC::MinecartUpdateChild(Entity*)
{
reconstruction_missing("Entity_NPC::MinecartUpdateChild 004cf120");
}
// 004e8fa0
void Entity_NPC::UpdateCordChain(bool)
{
@@ -2830,10 +2846,44 @@ void Entity_NPC::KillUnique()
reconstruction_missing("Entity_NPC::KillUnique 006be760");
}
// 006c2750
Entity_NPC* Entity_NPC::ThrowSpider(const Vector&, Entity*, Vector, bool, float)
// A thrown spider: a free landing spot within 100 when none is given, a Strider instead over Downpour's and Dross's
// water, the path cost its landing cell is kept clear with, its first hop's rise and its step toward the spot.
constexpr float SPIDER_LANDING_SEARCH = 100;
constexpr float SPIDER_STRIDER_WATER = 0.1f;
constexpr int SPIDER_LANDING_PATH = 900;
constexpr int SPIDER_LANDING_PATH_LIMIT = 950;
constexpr float SPIDER_THROW_RISE = -8;
constexpr float SPIDER_THROW_STEP = 0.04f;
// 006c2750 Throws a spider (or a big one) from position to land at targetPos, marking its landing cell in the room's
// paths so others steer clear.
Entity_NPC* Entity_NPC::ThrowSpider(const Vector& position, Entity* spawner, Vector targetPos, bool isBig,
float yOffset)
{
reconstruction_missing("Entity_NPC::ThrowSpider 006c2750");
if (vector_is_zero(targetPos))
targetPos = room_free_pickup_position_find({.position = position, .step = SPIDER_LANDING_SEARCH});
int stageId = g_game->GetStageID();
Room& room = *g_game->room;
if ((stageId == STAGE_ID_DOWNPOUR || stageId == STAGE_ID_DROSS) && room.waterAmount > SPIDER_STRIDER_WATER)
return ThrowStrider(position, spawner, targetPos);
int gridIndex = room.GetGridIndex(targetPos);
if (gridIndex >= 0 && gridIndex < ROOM_GRID_CELLS && room.gridPaths[gridIndex] <= SPIDER_LANDING_PATH_LIMIT)
room.gridPaths[gridIndex] = SPIDER_LANDING_PATH;
auto* spider = static_cast<Entity_NPC*>(g_game->Spawn({.position = position,
.spawner = spawner,
.type = isBig ? ENTITY_BIG_SPIDER : ENTITY_SPIDER,
.seed = Random()}));
spider->state = NPC_STATE_JUMP;
spider->targetPosition = targetPos;
spider->v2.y = SPIDER_THROW_RISE;
spider->entityCollisionClass = ENTCOLL_NONE;
spider->velocity = vector_scale(vector_sub(targetPos, spider->pos), SPIDER_THROW_STEP);
spider->v1 = spider->velocity;
spider->posOffset.y = yOffset;
return spider;
}
// 006ca930