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>
136 lines
4.0 KiB
C++
136 lines
4.0 KiB
C++
#pragma once
|
|
|
|
#include "anm2.h"
|
|
#include "classes.h"
|
|
#include "entity.h"
|
|
#include "sfx_manager.h"
|
|
#include <cstdint>
|
|
|
|
// The grid entity types (Lua's GridEntityType). The last, which Lua leaves unnamed, makes spikes.
|
|
enum GridEntityType : int
|
|
{
|
|
GRID_NULL,
|
|
GRID_DECORATION,
|
|
GRID_ROCK,
|
|
GRID_ROCKB,
|
|
GRID_ROCKT,
|
|
GRID_ROCK_BOMB,
|
|
GRID_ROCK_ALT,
|
|
GRID_PIT,
|
|
GRID_SPIKES,
|
|
GRID_SPIKES_ONOFF,
|
|
GRID_SPIDERWEB,
|
|
GRID_LOCK,
|
|
GRID_TNT,
|
|
GRID_FIREPLACE,
|
|
GRID_POOP,
|
|
GRID_WALL,
|
|
GRID_DOOR,
|
|
GRID_TRAPDOOR,
|
|
GRID_STAIRS,
|
|
GRID_GRAVITY,
|
|
GRID_PRESSURE_PLATE,
|
|
GRID_STATUE,
|
|
GRID_ROCK_SS,
|
|
GRID_TELEPORTER,
|
|
GRID_PILLAR,
|
|
GRID_ROCK_SPIKED,
|
|
GRID_ROCK_ALT2,
|
|
GRID_ROCK_GOLD,
|
|
GRID_SPIKES_ALT
|
|
};
|
|
|
|
// What a grid entity blocks (Lua's GridCollisionClass).
|
|
enum GridCollision : int
|
|
{
|
|
COLLISION_NONE,
|
|
COLLISION_PIT,
|
|
COLLISION_OBJECT,
|
|
COLLISION_SOLID,
|
|
COLLISION_WALL,
|
|
COLLISION_WALL_EXCEPT_PLAYER
|
|
};
|
|
|
|
// The room's grid path a grid entity claims for its cell: freed when it breaks, solid while it stands.
|
|
constexpr int GRID_PATH_FREED = 900;
|
|
constexpr int GRID_PATH_SOLID = 1000;
|
|
|
|
// The seeds and RNG a grid entity holds before Init seeds it.
|
|
constexpr uint32_t GRID_SEED_DEFAULT = 0x16a9de81;
|
|
constexpr RNG GRID_RNG_DEFAULT = {0xaa17414f, 5, 9, 7};
|
|
|
|
// How water clips around a grid entity (REPENTOGON's WaterClipInfo): which sides, and how far.
|
|
struct WaterClipInfo
|
|
{
|
|
uint32_t flags = 0;
|
|
float value = 0;
|
|
};
|
|
|
|
// The water clips the grid entities use.
|
|
constexpr uint32_t WATER_CLIP_SOLID = 0x39;
|
|
constexpr uint32_t WATER_CLIP_FLAT = 0x26;
|
|
constexpr uint32_t WATER_CLIP_RAISED = 0x19;
|
|
|
|
// What hurt_func and hurt_surroundings deal to the entities near a grid entity.
|
|
struct GridHurt
|
|
{
|
|
uint64_t damageFlags = 0;
|
|
float damage = 0;
|
|
float distance = 0;
|
|
float playerDistance = 0;
|
|
int playerDamage = 0;
|
|
bool isIgnoreGridCollisionClass = false;
|
|
};
|
|
|
|
// Construction, destruction and the deleting destructors (00709c40, 00709cb0, 00709d40) are the defaults. The field
|
|
// accessors (004073c0, 00428930, 0043eec0, 004e4830, 0067efc0, 00709c00, 00738140, 0085dda0) are the public fields.
|
|
// Lua's Hurt, Destroy, PostInit and Update (0085ddb0, 0085de20, 008c5cd9, 008c5ce8, 008c5cfc) are the virtual calls,
|
|
// with a default EntityRef for the source. An obstacle on one cell of the room's grid (Lua's GridEntity): rocks, pits,
|
|
// poop, spikes, doors, walls and the rest. Its type, variant, state and seeds are the GridEntityDesc a room saves for
|
|
// the cell.
|
|
struct GridEntity
|
|
{
|
|
ANM2 sprite;
|
|
RNG rng = GRID_RNG_DEFAULT;
|
|
GridEntityType type = GRID_NULL;
|
|
GridCollision collisionClass = COLLISION_NONE;
|
|
int gridIndex = 0;
|
|
int spawnCount = 0;
|
|
int spawnFrame = 0;
|
|
int state = 0;
|
|
int varData = 0;
|
|
int variant = 0;
|
|
uint32_t spawnSeed = GRID_SEED_DEFAULT;
|
|
uint32_t variableSeed = GRID_SEED_DEFAULT;
|
|
bool isInitialized = false;
|
|
|
|
virtual ~GridEntity() = default;
|
|
virtual void PostInit()
|
|
{}
|
|
virtual void Update() = 0;
|
|
virtual void Render(const Vector& offset);
|
|
virtual bool Hurt(int damage, const EntityRef& source);
|
|
virtual bool Destroy(bool isImmediate, const EntityRef& source);
|
|
virtual WaterClipInfo GetWaterClipInfo();
|
|
virtual bool CanTakeDamageFromTearEffects();
|
|
// Slot 8, which the decompile calls BeginBatches: what a type sets up before its first update.
|
|
virtual void subclass_init() = 0;
|
|
|
|
void Init(uint32_t seed);
|
|
GridEntityDesc desc_save();
|
|
void desc_load(const GridEntityDesc& desc);
|
|
Vector Position();
|
|
Vector get_render_position();
|
|
void sprite_render(const Vector& offset);
|
|
void path_set(int value);
|
|
bool IsBreakableRock();
|
|
bool IsEasyCrushableOrWalkable();
|
|
bool IsDangerousCrushableOrWalkable();
|
|
void hurt_func(Entity& entity, const GridHurt& hurt);
|
|
void hurt_surroundings(const GridHurt& hurt);
|
|
void trigger_output();
|
|
};
|
|
|
|
GridEntity* CreateGridEntity(GridEntityType type, int gridIndex);
|
|
void grid_sound_play(int sound, SoundPlay play = {});
|