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>
298 lines
11 KiB
C++
298 lines
11 KiB
C++
#include "classes.h"
|
|
|
|
// 00a0d9c0
|
|
void Weapon_TechX::Fire(Vector *direction, uint8_t isShooting, uint8_t isInterpolated)
|
|
{
|
|
Vector shotDirection;
|
|
bool bVar1;
|
|
bool bVar2;
|
|
uint8_t bVar3;
|
|
uint8_t isAxisAligned;
|
|
int ownerPlayer;
|
|
Vector *pVVar4;
|
|
Entity_Laser *laser;
|
|
uint32_t rngResult;
|
|
Entity_Player *pEVar5;
|
|
int extraout_ECX;
|
|
int unusedArg;
|
|
Entity_Player *player;
|
|
int extraout_ECX_00;
|
|
int extraout_ECX_01;
|
|
uint32_t randomLasersLeft;
|
|
float fVar6;
|
|
float fVar7;
|
|
float cosAngle;
|
|
float fVar8;
|
|
float fVar9;
|
|
float fVar10;
|
|
float fVar11;
|
|
float releaseCharge;
|
|
Vector local_70;
|
|
Vector aimDirection;
|
|
Vector local_60;
|
|
Vector scratchVec;
|
|
float fStack_50;
|
|
float fStack_4c;
|
|
Vector VStack_48;
|
|
uint32_t local_40;
|
|
float fStack_3c;
|
|
float fStack_38;
|
|
float fStack_34;
|
|
float fStack_30;
|
|
int iStack_2c;
|
|
float fStack_28;
|
|
uint32_t uStack_24;
|
|
uint32_t uStack_20;
|
|
int ownerEntity;
|
|
|
|
Weapon::Fire(this,direction,isShooting,isInterpolated);
|
|
if (isInterpolated != 0) {
|
|
return;
|
|
}
|
|
pEVar5 = *GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(this) + 4));
|
|
if (pEVar5 == GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
LAB_00a0da10:
|
|
player = GHIDRA_CAST<Entity_Player *>(0x0);
|
|
if (pEVar5 != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
if (pEVar5->_type == 1) goto LAB_00a0da2f;
|
|
if (pEVar5->_type == 3) goto LAB_00a0da23;
|
|
}
|
|
LAB_00a0da39:
|
|
fVar6 = 1.0;
|
|
}
|
|
else if (pEVar5->_type == 1) {
|
|
fVar6 = pEVar5->_shotspeed;
|
|
player = pEVar5;
|
|
}
|
|
else {
|
|
if (pEVar5->_type != 3) goto LAB_00a0da10;
|
|
player = *GHIDRA_CAST<Entity_Player **>(&pEVar5->_isControlsEnabled);
|
|
LAB_00a0da23:
|
|
pEVar5 = *GHIDRA_CAST<Entity_Player **>(&pEVar5->_isControlsEnabled);
|
|
if (pEVar5 == GHIDRA_CAST<Entity_Player *>(0x0)) goto LAB_00a0da39;
|
|
LAB_00a0da2f:
|
|
fVar6 = pEVar5->_shotspeed;
|
|
}
|
|
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
LAB_00a0da62:
|
|
bVar1 = false;
|
|
}
|
|
else {
|
|
bVar3 = Entity_Player::HasCollectible(player,0x18a,0);
|
|
bVar1 = true;
|
|
if (bVar3 == 0) goto LAB_00a0da62;
|
|
}
|
|
if (((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x34)) >> 7 & 1) != 0) ||
|
|
(bVar2 = false, *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)) <= 0.0)) {
|
|
bVar2 = true;
|
|
}
|
|
ownerEntity = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4));
|
|
releaseCharge = -1000.0;
|
|
if (ownerEntity == 0) {
|
|
LAB_00a0dae1:
|
|
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x28));
|
|
fVar8 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x2c));
|
|
}
|
|
else {
|
|
if (*GHIDRA_CAST<int *>((ownerEntity + 0x28)) == 1) {
|
|
ownerPlayer = ownerEntity;
|
|
}
|
|
else if ((*GHIDRA_CAST<int *>((ownerEntity + 0x28)) != 3) ||
|
|
(ownerPlayer = *GHIDRA_CAST<int *>((ownerEntity + 0x410)), ownerPlayer == 0)) goto LAB_00a0dae1;
|
|
ownerPlayer = *GHIDRA_CAST<int *>((ownerPlayer + 0x140c));
|
|
if ((ownerPlayer == 0) || (!bVar1)) goto LAB_00a0dae1;
|
|
fVar11 = *GHIDRA_CAST<float *>((ownerPlayer + 0x33c));
|
|
fVar8 = *GHIDRA_CAST<float *>((ownerPlayer + 0x340));
|
|
}
|
|
if ((fVar11 == g_vectorZero.x) && (fVar8 == g_vectorZero.y)) {
|
|
bVar1 = false;
|
|
}
|
|
else {
|
|
bVar1 = true;
|
|
}
|
|
local_60.x = fVar11;
|
|
local_60.y = fVar8;
|
|
if (isShooting != 0) {
|
|
if (bVar2) {
|
|
releaseCharge = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)) * 3.0;
|
|
}
|
|
else if (bVar1) {
|
|
pVVar4 = Weapon::get_owner_position(this,&scratchVec);
|
|
fVar8 = fVar8 - pVVar4->y;
|
|
fVar11 = fVar11 - pVVar4->x;
|
|
fVar11 = sqrtf(fVar8 * fVar8 + fVar11 * fVar11);
|
|
releaseCharge = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10));
|
|
fVar11 = (fVar11 - 50.0) / 250.0;
|
|
if (fVar11 <= 0.0) {
|
|
fVar11 = 0.0;
|
|
}
|
|
if (1.0 <= fVar11) {
|
|
fVar11 = 1.0;
|
|
}
|
|
releaseCharge = (releaseCharge * 3.0 - releaseCharge) * fVar11 + releaseCharge;
|
|
}
|
|
}
|
|
if ((((ownerEntity != 0) && (*GHIDRA_CAST<int *>((ownerEntity + 0x28)) == 1)) &&
|
|
(0 < *GHIDRA_CAST<int *>((ownerEntity + 0x18f8)))) &&
|
|
(releaseCharge = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)), releaseCharge < 1.0)) {
|
|
releaseCharge = 1.0;
|
|
}
|
|
bVar3 = isShooting;
|
|
if ((-1000.0 < releaseCharge) && (releaseCharge <= *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14)))) {
|
|
bVar3 = 0;
|
|
}
|
|
aimDirection.x = direction->x;
|
|
aimDirection.y = direction->y;
|
|
if (isShooting == 0) {
|
|
aimDirection.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x20));
|
|
aimDirection.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24));
|
|
}
|
|
isAxisAligned = Weapon::IsAxisAligned(this);
|
|
if (isAxisAligned == 0) {
|
|
fVar11 = sqrtf(aimDirection.x * aimDirection.x + aimDirection.y * aimDirection.y);
|
|
ownerEntity = extraout_ECX_00;
|
|
if (0.0 < fVar11) {
|
|
aimDirection.x = (1.0 / fVar11) * aimDirection.x;
|
|
aimDirection.y = aimDirection.y * (1.0 / fVar11);
|
|
}
|
|
}
|
|
else {
|
|
pVVar4 = Vector::ToCardinal(&scratchVec,&aimDirection);
|
|
aimDirection.x = pVVar4->x;
|
|
aimDirection.y = pVVar4->y;
|
|
ownerEntity = extraout_ECX;
|
|
}
|
|
fVar9 = 1.0;
|
|
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10));
|
|
fVar8 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14));
|
|
if (bVar3 == 0) {
|
|
if (fVar11 < 1.0) {
|
|
fVar9 = 1.0;
|
|
}
|
|
else {
|
|
fVar9 = fVar11;
|
|
}
|
|
if ((fVar9 <= fVar8) || ((-1000.0 < releaseCharge && (releaseCharge <= fVar8)))) {
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0xc)) = fVar11;
|
|
ownerPlayer = 7 - GHIDRA_INT((fVar11 * -0.45));
|
|
ownerEntity = 0xb;
|
|
if (0xb < ownerPlayer) {
|
|
ownerEntity = ownerPlayer;
|
|
}
|
|
Weapon::SetBlinkTime(this,ownerEntity,ownerPlayer);
|
|
Weapon::TriggerTearEffects(this,&aimDirection,1);
|
|
Weapon::get_owner_position(this,&local_60);
|
|
fVar8 = aimDirection.x * 10.0;
|
|
fVar9 = aimDirection.y * 10.0;
|
|
pVVar4 = Weapon::get_tear_movement_inheritance(this,&scratchVec,&aimDirection);
|
|
fVar10 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)) + 1.0;
|
|
fVar8 = fVar8 + pVVar4->x;
|
|
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14)) + 1.0;
|
|
fVar9 = fVar9 + pVVar4->y;
|
|
if (fVar10 * 3.0 <= fVar11) {
|
|
fVar11 = fVar10 * 3.0;
|
|
}
|
|
fVar10 = (fVar11 - fVar10) / (fVar10 + fVar10);
|
|
fVar11 = fVar10 * 45.0 + 15.0;
|
|
Weapon::GetMultiShotParams(this,&local_40,unusedArg);
|
|
fVar10 = fVar10 * 0.75 + 0.25;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(uStack_24)) + 0x1))) != '\0') {
|
|
local_70.x = -fVar8 * fVar6;
|
|
local_70.y = -fVar9 * fVar6;
|
|
laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10);
|
|
(**(code **)(*GHIDRA_CAST<int *>(laser) + 0xc))();
|
|
}
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(uStack_24)) + 0x2))) != '\0') {
|
|
local_70.x = fVar8 * fVar6;
|
|
local_70.y = fVar6 * -fVar9;
|
|
laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10);
|
|
(**(code **)(*GHIDRA_CAST<int *>(laser) + 0xc))();
|
|
local_70.x = -fVar8 * fVar6;
|
|
local_70.y = fVar9 * fVar6;
|
|
laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10);
|
|
(**(code **)(*GHIDRA_CAST<int *>(laser) + 0xc))();
|
|
}
|
|
for (randomLasersLeft = uStack_20 & 0xffff; randomLasersLeft != 0;
|
|
randomLasersLeft = randomLasersLeft - 1) {
|
|
rngResult = Random();
|
|
local_70.x = (float)((double)GHIDRA_INT(rngResult) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.5
|
|
+ 0.5;
|
|
rngResult = Random();
|
|
fVar7 = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)])
|
|
* 2.3283064e-10 * 50.0 - 25.0) * 0.017453292;
|
|
cosAngle = cos(fVar7);
|
|
fVar7 = sin(fVar7);
|
|
scratchVec.x = (fVar8 * cosAngle - fVar9 * fVar7) * fVar6;
|
|
scratchVec.y = (fVar9 * cosAngle + fVar8 * fVar7) * fVar6;
|
|
laser = Weapon::fire_tech_x_laser
|
|
(this,&local_60,&scratchVec,local_70.x * fVar11,local_70.x * fVar10);
|
|
(**(code **)(*GHIDRA_CAST<int *>(laser) + 0xc))();
|
|
}
|
|
ownerEntity = 0;
|
|
if (0 < (short)local_40) {
|
|
local_70.x = fVar8;
|
|
local_70.y = fVar9;
|
|
do {
|
|
shotDirection.y = local_70.y;
|
|
shotDirection.x = local_70.x;
|
|
Entity_Player::GetMultiShotPositionVelocity
|
|
(&fStack_50,ownerEntity,9,shotDirection,fVar6,(short)local_40,fStack_3c,
|
|
fStack_38,fStack_34,fStack_30,iStack_2c,fStack_28,(uint8_t)uStack_24,
|
|
(short)uStack_20);
|
|
scratchVec.x = local_60.x + fStack_50;
|
|
scratchVec.y = fStack_4c + local_60.y;
|
|
laser = Weapon::fire_tech_x_laser(this,&scratchVec,&VStack_48,fVar11,fVar10);
|
|
(**(code **)(*GHIDRA_CAST<int *>(laser) + 0xc))();
|
|
ownerEntity = ownerEntity + 1;
|
|
} while (ownerEntity < (short)local_40);
|
|
}
|
|
pEVar5 = *GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(this) + 4));
|
|
if ((((pEVar5 == GHIDRA_CAST<Entity_Player *>(0x0)) || (player = pEVar5, pEVar5->_type != 1)) &&
|
|
(player = GHIDRA_CAST<Entity_Player *>(0x0), pEVar5 != GHIDRA_CAST<Entity_Player *>(0x0))) && (pEVar5->_type == 3))
|
|
{
|
|
pEVar5->_chargeBarSprites[5]._numEvents = 0;
|
|
}
|
|
else if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
Entity_Player::stop_costume_item_anims(player);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0;
|
|
goto LAB_00a0e1fe;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0;
|
|
}
|
|
else {
|
|
if (fVar11 * 3.0 <= fVar8) {
|
|
Weapon::UpdateHeadChargeAnimation(this,0x18b,1,direction,-1.0);
|
|
ownerEntity = extraout_ECX_01;
|
|
}
|
|
else {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
|
|
fVar9 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 0x39c));
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14)) = fVar8 + fVar9;
|
|
}
|
|
Weapon::SetBlinkTime(this,1,ownerEntity);
|
|
}
|
|
LAB_00a0e1fe:
|
|
if (isShooting != 0) {
|
|
bVar3 = Weapon::IsAxisAligned(this);
|
|
if (bVar3 != 0) {
|
|
fVar6 = direction->y;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x20)) = direction->x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24)) = fVar6;
|
|
return;
|
|
}
|
|
pVVar4 = Weapon::get_aim_direction(this,&local_60,direction);
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x20)) = pVVar4->x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24)) = pVVar4->y;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00a0e260
|
|
float Weapon_TechX::GetMaxCharge()
|
|
{
|
|
return *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x10)) * 3.0;
|
|
}
|