Files
isaac-port/generated-src/weapon_fetus.cpp
T
shweetandClaude Opus 5.5 69a354f843 Curation round 8: the first room plays: Isaac walks and shoots tears
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>
2026-11-20 06:43:01 -05:00

414 lines
16 KiB
C++

#include "classes.h"
// 00a036e0
void Weapon_Fetus::Fire(Vector *direction, uint8_t isShooting, uint8_t isInterpolated)
{
void *player = this;
Entity *source;
Vector shotDirection;
uint8_t bVar1;
uint32_t uVar2;
Entity_Player *owner;
int ownerPlayer;
float *pfVar3;
ANM2 *pAVar4;
Vector *pVVar5;
Entity_Tear *tear;
uint8_t *animName;
Vector *newAimDirection;
Entity_Player *player;
int extraout_ECX;
int unusedArg;
int extraout_ECX_00;
ANM2 *this_00;
ANM2 *extraout_ECX_01;
void *pvVar6;
ANM2 *extraout_ECX_02;
int unusedCollectibleId;
int extraout_ECX_03;
ANM2 *extraout_ECX_04;
int extraout_ECX_05;
int extraout_ECX_06;
Entity_Player *ownerAsPlayer;
long double fVar7;
float fVar8;
uint8_t *puVar9;
int iVar10;
short multiShotParams [2];
float fStack_a0;
float fStack_9c;
float fStack_98;
float fStack_94;
int iStack_90;
float fStack_8c;
char isShootingBackwards;
char isShootingSideways;
uint32_t uStack_88;
uint32_t numRandomDirTears;
Weapon *weapon;
float spreadAngle;
Vector scratchVec;
Vector local_70;
Vector firePos;
Vector aimDirection;
Vector local_58;
Vector *directionLocal;
float local_4c;
char isMarked;
float local_44;
float local_40;
uint64_t subAnimName;
float local_34;
float local_30;
Vector local_2c;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
puStack_20 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(register0x00000010) + -4));
local_14 = (void *)0xffffffff;
puStack_18 = &LAB_00b107dd;
local_1c = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
ExceptionList = &local_1c;
directionLocal = direction;
weapon = player;
local_24 = uVar2;
Weapon::Fire(player,direction,isShooting,isInterpolated);
owner = *GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(player) + 4));
ownerAsPlayer = owner;
if (owner == GHIDRA_CAST<Entity_Player *>(0x0)) {
LAB_00a03762:
player = GHIDRA_CAST<Entity_Player *>(0x0);
if ((owner == GHIDRA_CAST<Entity_Player *>(0x0)) || (owner->_type != 1)) {
LAB_00a03770:
if ((owner == GHIDRA_CAST<Entity_Player *>(0x0)) ||
((ownerAsPlayer = GHIDRA_CAST<Entity_Player *>(0x0), owner->_type != 1 &&
((owner->_type != 3 ||
(owner = *GHIDRA_CAST<Entity_Player **>(&owner->_isControlsEnabled), owner == GHIDRA_CAST<Entity_Player *>(0x0)))))
)) {
local_70.y = 1.0;
ownerAsPlayer = GHIDRA_CAST<Entity_Player *>(0x0);
goto LAB_00a037a2;
}
}
local_70.y = owner->_shotspeed;
}
else {
if (owner->_type != 1) {
if (owner->_type != 3) goto LAB_00a03762;
player = *GHIDRA_CAST<Entity_Player **>(&owner->_isControlsEnabled);
goto LAB_00a03770;
}
local_70.y = owner->_shotspeed;
player = owner;
}
LAB_00a037a2:
local_70.y = local_70.y * 1.25;
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) {
LAB_00a037c7:
isMarked = '\0';
}
else {
bVar1 = Entity_Player::HasCollectible(player,0x18a,0);
isMarked = '\x01';
if (bVar1 == 0) goto LAB_00a037c7;
}
local_40 = (float)(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(player) + 0x34)) >> 7 & 0xffffff01);
fVar7 = (long double)(**(code **)(*GHIDRA_CAST<int *>(player) + 0x18))(uVar2);
iVar10 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(player) + 4));
fVar8 = (float)fVar7;
local_44 = fVar8;
if (iVar10 == 0) {
LAB_00a0382d:
firePos.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x28));
firePos.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x2c));
}
else {
if (*GHIDRA_CAST<int *>((iVar10 + 0x28)) == 1) {
ownerPlayer = iVar10;
}
else if ((*GHIDRA_CAST<int *>((iVar10 + 0x28)) != 3) ||
(ownerPlayer = *GHIDRA_CAST<int *>((iVar10 + 0x410)), ownerPlayer == 0)) goto LAB_00a0382d;
ownerPlayer = *GHIDRA_CAST<int *>((ownerPlayer + 0x140c));
if ((ownerPlayer == 0) || (isMarked == '\0')) goto LAB_00a0382d;
firePos.x = *GHIDRA_CAST<float *>((ownerPlayer + 0x33c));
firePos.y = *GHIDRA_CAST<float *>((ownerPlayer + 0x340));
}
bVar1 = (firePos.x == g_vectorZero.x) << 6 | (NAN(firePos.x) || NAN(g_vectorZero.x)) << 2 | 2U |
firePos.x < g_vectorZero.x;
if (firePos.x == g_vectorZero.x) {
bVar1 = (firePos.y == g_vectorZero.y) << 6 | (NAN(firePos.y) || NAN(g_vectorZero.y)) << 2 | 2U |
firePos.y < g_vectorZero.y;
}
local_4c = (float)CONCAT31(CONCAT21((short)(GHIDRA_UINT(&firePos) >> 0x10),bVar1),isShooting);
if (((iVar10 != 0) && (*GHIDRA_CAST<int *>((iVar10 + 0x28)) == 1)) && (0 < *GHIDRA_CAST<int *>((iVar10 + 0x18f8)))) {
local_40 = 1.0;
pfVar3 = &local_40;
if (1.0 <= fVar8) {
pfVar3 = &local_44;
}
fVar8 = *pfVar3;
}
if ((-1000.0 < fVar8) &&
(local_4c = (float)GHIDRA_UINT(isShooting), fVar8 <= *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x14)))) {
local_4c = 0.0;
}
aimDirection.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x20));
aimDirection.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x24));
bVar1 = Weapon::IsAxisAligned(player);
if (bVar1 == 0) {
fVar8 = sqrtf(aimDirection.y * aimDirection.y + aimDirection.x * aimDirection.x);
iVar10 = extraout_ECX_00;
if (0.0 < fVar8) {
aimDirection.x = (1.0 / fVar8) * aimDirection.x;
aimDirection.y = (float)(aimDirection.y * (1.0 / fVar8));
}
}
else {
puVar9 = GHIDRA_CAST<uint8_t *>(0x0);
if (ABS(aimDirection.x) <= ABS(aimDirection.y)) {
aimDirection.x = 0.0;
if (0.0 <= aimDirection.y) {
puVar9 = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
else {
puVar9 = &DAT_bf800000;
}
}
else if (0.0 <= aimDirection.x) {
aimDirection.x = 1.0;
}
else {
aimDirection.x = (float)&DAT_bf800000;
}
iVar10 = extraout_ECX;
aimDirection.y = (float)puVar9;
}
fVar8 = 1.0;
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x0))) == '\0') {
if (isInterpolated == 0) {
this_00 = GHIDRA_CAST<ANM2 *>(&local_44);
local_40 = 1.0;
pAVar4 = GHIDRA_CAST<ANM2 *>(&local_40);
if (1.0 <= local_44) {
pAVar4 = this_00;
}
if (*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x14)) < *GHIDRA_CAST<float *>((pAVar4->_filename)._buf)) {
LAB_00a03e32:
pVVar5 = directionLocal;
}
else {
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0xc)) = local_44 / 3.0;
if (ownerAsPlayer == GHIDRA_CAST<Entity_Player *>(0x0)) {
ownerPlayer = 7 - GHIDRA_INT((local_44 * -0.15));
iVar10 = 0xb;
if (0xb < ownerPlayer) {
iVar10 = ownerPlayer;
}
Weapon::SetBlinkTime(player,iVar10,ownerPlayer);
}
Weapon::TriggerTearEffects(player,&aimDirection,1);
Weapon::get_owner_position(player,&firePos);
local_4c = aimDirection.x * 10.0;
local_44 = aimDirection.y * 10.0;
pVVar5 = Weapon::get_tear_movement_inheritance(player,&scratchVec,&aimDirection);
local_4c = local_4c + pVVar5->x;
local_44 = local_44 + pVVar5->y;
iVar10 = unusedArg;
Weapon::GetMultiShotParams(player,multiShotParams,unusedArg);
local_40 = -local_44;
if (isShootingBackwards != '\0') {
local_58.x = -local_4c * local_70.y;
local_58.y = local_40 * local_70.y;
tear = fire_fetus_tear(player,&firePos,&local_58,0,*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(player) + 4)),1.0,iVar10);
iVar10 = 0xa03a92;
(**(code **)(*GHIDRA_CAST<int *>(tear) + 0xc))();
}
if (isShootingSideways != '\0') {
local_58.x = local_4c * local_70.y;
local_58.y = local_40 * local_70.y;
tear = fire_fetus_tear(player,&firePos,&local_58,0,*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(player) + 4)),1.0,iVar10);
iVar10 = 0xa03adf;
(**(code **)(*GHIDRA_CAST<int *>(tear) + 0xc))();
local_58.x = -local_4c * local_70.y;
local_58.y = local_44 * local_70.y;
tear = fire_fetus_tear(player,&firePos,&local_58,0,*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(player) + 4)),1.0,iVar10);
(**(code **)(*GHIDRA_CAST<int *>(tear) + 0xc))();
}
local_40 = (float)(numRandomDirTears & 0xffff);
if (local_40 != 0.0) {
do {
source = *GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(player) + 4));
uVar2 = Random();
spreadAngle = ((float)((double)GHIDRA_INT(uVar2) +
__uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10 *
50.0 - 25.0) * 0.017453292;
local_58.y = cos(spreadAngle);
iVar10 = 0xa03b99;
fVar8 = sin(spreadAngle);
scratchVec.x = (local_4c * local_58.y - local_44 * fVar8) * local_70.y;
scratchVec.y = (local_4c * fVar8 + local_44 * local_58.y) * local_70.y;
tear = fire_fetus_tear(player,&firePos,&scratchVec,0,source,1.0,iVar10);
(**(code **)(*GHIDRA_CAST<int *>(tear) + 0xc))();
local_40 = (float)(GHIDRA_INT(local_40) - 1);
} while (local_40 != 0.0);
local_40 = 0.0;
}
iVar10 = 0;
if (0 < multiShotParams[0]) {
local_58.x = local_4c;
local_58.y = local_44;
do {
shotDirection.y = local_58.y;
shotDirection.x = local_58.x;
uVar2 = numRandomDirTears;
Entity_Player::GetMultiShotPositionVelocity
(&local_34,iVar10,9,shotDirection,local_70.y,multiShotParams[0],fStack_a0,
fStack_9c,fStack_98,fStack_94,iStack_90,fStack_8c,(uint8_t)uStack_88,
(short)numRandomDirTears);
scratchVec.x = firePos.x + local_34;
scratchVec.y = local_30 + firePos.y;
tear = fire_fetus_tear(player,&scratchVec,&local_2c,0,*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(player) + 4)),1.0,
uVar2);
(**(code **)(*GHIDRA_CAST<int *>(tear) + 0xc))();
iVar10 = iVar10 + 1;
} while (iVar10 < multiShotParams[0]);
}
pVVar5 = directionLocal;
this_00 = *GHIDRA_CAST<ANM2 **>((GHIDRA_CAST<char *>(player) + 4));
local_58.y = (float)this_00;
if ((this_00 != GHIDRA_CAST<ANM2 *>(0x0)) && ((this_00->_animDefaultName)._size == 1)) {
fVar8 = 2.10195e-44;
local_2c.y = 2.10195e-44;
local_14 = (void *)0x0;
local_34 = (float)0x6f6f6853;
local_2c.x = 1.82169e-44;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x0))) = 'S';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x1))) = 'u';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x2))) = 'b';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x3))) = 'A';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x4))) = 'n';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x5))) = 'i';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x6))) = 'm';
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(subAnimName)) + 0x7))) = '_';
local_30 = (float)CONCAT22((*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(local_30)) + 0x2))),0x74);
pvVar6 = (g_manager->_itemConfig)._collectibles._begin;
if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar6) >> 2 < 0x2a7) {
local_40 = 0.0;
}
else {
local_40 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar6) + 0xa98));
}
pfVar3 = this_00[0x10]._championColor._colorize + 2;
iVar10 = 0xf;
do {
if ((-1 < GHIDRA_INT(*pfVar3)) && (*GHIDRA_CAST<char *>((pfVar3 + 3)) != '\0')) {
this_00 = GHIDRA_CAST<ANM2 *>((GHIDRA_INT(*pfVar3) * 0x130 +
GHIDRA_INT(((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(local_58.y) + 0x1140)))->_championColor)._tint[3])
));
if (*GHIDRA_CAST<float *>(this_00[1]._filename._buf) == local_40) {
animName = GHIDRA_CAST<uint8_t *>(&subAnimName);
if (0xf < GHIDRA_UINT(fVar8)) {
animName = GHIDRA_CAST<uint8_t *>(subAnimName);
}
ANM2::PlayOverlay(this_00,animName,1);
this_00 = extraout_ECX_01;
fVar8 = local_2c.y;
}
}
player = weapon;
pfVar3 = pfVar3 + 4;
iVar10 = iVar10 + -1;
} while (iVar10 != 0);
local_14 = (void *)0xffffffff;
if (0xf < GHIDRA_UINT(fVar8)) {
uVar2 = GHIDRA_INT(fVar8) + 1;
pvVar6 = GHIDRA_CAST<uint8_t *>(subAnimName);
if (0xfff < uVar2) {
pvVar6 = *(void **)(GHIDRA_INT(GHIDRA_CAST<uint8_t *>(subAnimName)) + -4);
uVar2 = GHIDRA_INT(fVar8) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(GHIDRA_CAST<uint8_t *>(subAnimName)) + (-4 - GHIDRA_INT(pvVar6))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar6,uVar2);
this_00 = extraout_ECX_02;
}
goto LAB_00a03e32;
}
Weapon::UpdateHeadChargeAnimation(player,0x2a6,2,directionLocal,-1.0);
this_00 = extraout_ECX_04;
}
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Weapon *>(player)))) + 0x14)))) = 0;
bVar1 = Weapon::is_c_section_anim_finished(player,GHIDRA_INT(this_00));
iVar10 = unusedCollectibleId;
if (bVar1 != 0) {
Weapon::update_c_section_charge_anim(player,unusedCollectibleId,0,pVVar5,0.0);
iVar10 = extraout_ECX_03;
}
}
else {
pVVar5 = directionLocal;
}
bVar1 = Weapon::is_c_section_anim_finished(player,iVar10);
if (bVar1 == 0) {
ExceptionList = local_1c;
return;
}
goto LAB_00a03f31;
}
local_40 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x14));
if (local_44 <= local_40) {
puVar9 = &DAT_bf800000;
ownerPlayer = 1;
LAB_00a03f02:
pVVar5 = directionLocal;
Weapon::update_c_section_charge_anim(player,iVar10,ownerPlayer,directionLocal,(float)puVar9);
iVar10 = extraout_ECX_06;
}
else {
if (isInterpolated == 0) {
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(player) + 4)) != 0) {
fVar8 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(player) + 4)) + 0x39c));
}
local_40 = local_40 + fVar8;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x14)) = local_40;
}
bVar1 = Weapon::is_c_section_anim_finished(player,iVar10);
iVar10 = extraout_ECX_05;
pVVar5 = directionLocal;
if (bVar1 != 0) {
puVar9 = GHIDRA_CAST<uint8_t *>(((local_40 / local_44) * 18.0));
ownerPlayer = 0;
goto LAB_00a03f02;
}
}
if (isInterpolated == 0) {
Weapon::SetBlinkTime(player,1,iVar10);
newAimDirection = Weapon::get_aim_direction(player,&local_70,pVVar5);
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x20)) = newAimDirection->x;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(player) + 0x24)) = newAimDirection->y;
}
LAB_00a03f31:
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Weapon *>(player)))) + 0x3c)))) = pVVar5->x;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Weapon *>(player)))) + 0x40)))) = pVVar5->y;
ExceptionList = local_1c;
return;
}
// 00a03f60
float Weapon_Fetus::GetMaxCharge()
{
float maxCharge;
maxCharge = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)) * 3.0;
if (maxCharge <= 0.001) {
maxCharge = 0.001;
}
return maxCharge;
}