Eight agents took over Room::Init's pieces, RailManager, Room::Render/render_lighting/Update, the GridEntity hierarchy (walls, doors, rocks, pits, poop ...), Game::Update and interpolate_update, the run's save, update_ingame_input, Game::Spawn with the entity factory and grid collision, the player's movement and tears through Weapon/Weapon_Tears, PlayerManager's positions, the camera focus, MinimapConfig, PlayerHUD, mod shader rendering, Entity_Tear and Entity_Effect. Integration wrote Level::get_secret_exit_kind, shared the secret-exit enum (four copies merged) and fixed the generator's vtable-stub check (word boundary and namespace, not a substring). Under gdb a run reaches the first room: doors, HUD with hearts and minimap, WASD movement with acceleration, arrow-key tears that fly and splash. Floor and walls (Backdrop::RenderFloor/RenderWalls) and room transitions are next. The official build/isaac reaches the start room and stops at Entity_NPC::Redirect. 2770 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
2.6 KiB
C++
94 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "entity.h"
|
|
#include <array>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
struct EntitySpawn;
|
|
struct RoomEntry;
|
|
|
|
// Whether EntityFactory::Create overwrites an entity in use when its pool is full (SpawnEx's flag 1 keeps them).
|
|
enum PoolMode
|
|
{
|
|
POOL_OVERWRITE,
|
|
POOL_KEEP
|
|
};
|
|
|
|
// EntityFactory's pools, one per entity class.
|
|
enum PoolId
|
|
{
|
|
ENTITY_POOL_EFFECT,
|
|
ENTITY_POOL_FAMILIAR,
|
|
ENTITY_POOL_BOMB,
|
|
ENTITY_POOL_PROJECTILE,
|
|
ENTITY_POOL_TEAR,
|
|
ENTITY_POOL_LASER,
|
|
ENTITY_POOL_PICKUP,
|
|
ENTITY_POOL_SLOT,
|
|
ENTITY_POOL_NPC,
|
|
ENTITY_POOL_TEXT,
|
|
ENTITY_POOL_KNIFE,
|
|
ENTITY_POOL_COUNT
|
|
};
|
|
|
|
// A pool's class, its size, and its name in the pool full warning.
|
|
struct PoolDesc
|
|
{
|
|
std::unique_ptr<Entity> (*make)() = nullptr;
|
|
const char* name = "";
|
|
uint32_t size = 0;
|
|
};
|
|
|
|
// One class's entities. A slot is made the first time Create reaches it and reused once its entity leaves the room.
|
|
// Create cycles from the slot it handed out last.
|
|
struct EntityPool
|
|
{
|
|
std::vector<std::unique_ptr<Entity>> slots;
|
|
const PoolDesc* desc = nullptr;
|
|
uint32_t cursor = 0;
|
|
|
|
Entity* Create(PoolMode mode);
|
|
|
|
private:
|
|
Entity& slot_get();
|
|
Entity& slot_next();
|
|
};
|
|
|
|
// The entity pools of a run (Game::entityFactory): every entity but the players lives in one, so spawning never
|
|
// allocates once a slot exists. The original built all its pools in its constructor (006f2a10) and freed them in Game's
|
|
// destructor. Slots are made on first use instead, which a new entity cannot tell apart. Its pool of plain Entity_Dummy
|
|
// objects was never handed out, so it is gone.
|
|
struct EntityFactory
|
|
{
|
|
std::array<EntityPool, ENTITY_POOL_COUNT> pools;
|
|
|
|
EntityFactory();
|
|
Entity* Create(int type, PoolMode mode);
|
|
};
|
|
|
|
// How Room::SpawnEntry places a layout entry, as when the room is entered or when its enemies respawn.
|
|
enum EntryMode
|
|
{
|
|
ENTRY_SPAWN,
|
|
ENTRY_RESPAWN
|
|
};
|
|
|
|
// A layout entry spawned on a cell, and where to hand back the entity it made.
|
|
struct RoomEntrySpawn
|
|
{
|
|
Entity** outEntity = nullptr;
|
|
int gridIndex = 0;
|
|
uint32_t seed = 0;
|
|
EntryMode mode = ENTRY_SPAWN;
|
|
};
|
|
|
|
Entity* game_spawn(const EntitySpawn& spawn, PoolMode mode);
|
|
bool entity_is_erased(Entity& entity);
|
|
void erased_enemy_id_fix(int& type, int& variant, int& subType);
|
|
bool room_entry_spawn(Room& room, RoomEntry entry, const RoomEntrySpawn& spawn);
|
|
void room_entry_transform(Room& room, RoomEntry& entry, int gridIndex, uint32_t seed);
|
|
bool room_entity_is_persistent(int type, int variant);
|
|
void room_trigger_output_index_add(Room& room, int group, int gridIndex);
|
|
void room_trigger_output_cell_add(Room& room, int group, int column, int row);
|