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>
200 lines
7.7 KiB
C++
200 lines
7.7 KiB
C++
#include "classes.h"
|
|
|
|
// 009f9b60
|
|
void Weapon_Bombs::Fire(Vector *param_1, uint8_t param_2, uint8_t param_3)
|
|
{
|
|
Vector shotDirection;
|
|
uint8_t isAxisAligned;
|
|
Vector *vecResult;
|
|
uint32_t rngResult;
|
|
Entity_Bomb *firedBomb;
|
|
Weapon *in_ECX;
|
|
int unusedArg;
|
|
Entity_Bomb *oldLink;
|
|
uint32_t randomShotsLeft;
|
|
int bomb;
|
|
Entity_Bomb *linkSlot;
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
float shotSpeed;
|
|
Vector local_80;
|
|
Vector local_78;
|
|
uint32_t isLudovico;
|
|
Weapon *weapon;
|
|
Vector aimDirection;
|
|
Vector spawnPos;
|
|
Vector scratchVec;
|
|
Vector multiShotOffset;
|
|
Vector multiShotVelocity;
|
|
uint32_t multiShotParams;
|
|
float fStack_3c;
|
|
float fStack_38;
|
|
float fStack_34;
|
|
float local_30;
|
|
int iStack_2c;
|
|
float fStack_28;
|
|
uint32_t uStack_24;
|
|
uint32_t local_20;
|
|
|
|
weapon = in_ECX;
|
|
Weapon::Fire(in_ECX,param_1,param_2,param_3);
|
|
bomb = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0x4))));
|
|
isLudovico = GHIDRA_UINT(in_ECX->_modifiers) >> 4 & 0xffffff01;
|
|
if (bomb == 0) {
|
|
spawnPos.x = g_vectorZero.x;
|
|
spawnPos.y = g_vectorZero.y;
|
|
}
|
|
else {
|
|
spawnPos.x = *GHIDRA_CAST<float *>((bomb + 0x33c));
|
|
spawnPos.y = *GHIDRA_CAST<float *>((bomb + 0x340));
|
|
if ((*GHIDRA_CAST<int *>((bomb + 0x28)) == 1) ||
|
|
((*GHIDRA_CAST<int *>((bomb + 0x28)) == 3 && (bomb = *GHIDRA_CAST<int *>((bomb + 0x410)), bomb != 0)))) {
|
|
shotSpeed = *GHIDRA_CAST<float *>((bomb + 0x1464));
|
|
goto LAB_009f9c09;
|
|
}
|
|
}
|
|
shotSpeed = 1.0;
|
|
LAB_009f9c09:
|
|
if ((param_2 == 0) || (0.0 < *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0xc)))) || *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0xc)))) == 0.0))
|
|
{
|
|
if ((char)isLudovico == '\0') {
|
|
return;
|
|
}
|
|
}
|
|
else if (((char)isLudovico == '\0') || (*GHIDRA_CAST<int *>((in_ECX + 1)) == 0)) {
|
|
if (param_3 != 0) {
|
|
return;
|
|
}
|
|
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0xc)))) = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0x10))));
|
|
Weapon::SetBlinkTime(in_ECX,7 - GHIDRA_INT((*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((in_ECX)) + 0x10)))) * -0.45)),bomb);
|
|
aimDirection.x = param_1->x;
|
|
aimDirection.y = param_1->y;
|
|
isAxisAligned = Weapon::IsAxisAligned(in_ECX);
|
|
if (isAxisAligned == 0) {
|
|
fVar2 = sqrtf(aimDirection.x * aimDirection.x + aimDirection.y * aimDirection.y);
|
|
if (0.0 < fVar2) {
|
|
aimDirection.x = aimDirection.x * (1.0 / fVar2);
|
|
aimDirection.y = aimDirection.y * (1.0 / fVar2);
|
|
}
|
|
}
|
|
else {
|
|
vecResult = Vector::ToCardinal(&scratchVec,&aimDirection);
|
|
aimDirection.x = vecResult->x;
|
|
aimDirection.y = vecResult->y;
|
|
}
|
|
Weapon::TriggerTearEffects(in_ECX,&aimDirection,1);
|
|
fVar2 = aimDirection.x * 12.0;
|
|
fVar3 = aimDirection.y * 12.0;
|
|
vecResult = Weapon::get_tear_movement_inheritance(in_ECX,&scratchVec,&g_vectorZero);
|
|
fVar2 = fVar2 + vecResult->x;
|
|
fVar3 = fVar3 + vecResult->y;
|
|
Weapon::GetMultiShotParams(in_ECX,&multiShotParams,unusedArg);
|
|
local_78.x = -fVar3;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(uStack_24)) + 0x1))) != '\0') {
|
|
local_80.x = -fVar2 * shotSpeed;
|
|
local_80.y = local_78.x * shotSpeed;
|
|
Weapon::fire_bomb(in_ECX,&spawnPos,&local_80);
|
|
}
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(uStack_24)) + 0x2))) != '\0') {
|
|
local_78.x = local_78.x * shotSpeed;
|
|
local_78.y = fVar2 * shotSpeed;
|
|
Weapon::fire_bomb(in_ECX,&spawnPos,&local_78);
|
|
local_78.x = fVar3 * shotSpeed;
|
|
local_78.y = -fVar2 * shotSpeed;
|
|
Weapon::fire_bomb(in_ECX,&spawnPos,&local_78);
|
|
}
|
|
for (randomShotsLeft = local_20 & 0xffff; randomShotsLeft != 0;
|
|
randomShotsLeft = randomShotsLeft - 1) {
|
|
rngResult = Random();
|
|
local_78.x = (float)((double)GHIDRA_INT(rngResult) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 360.0
|
|
* 0.017453292;
|
|
local_80.x = cos(local_78.x);
|
|
fVar1 = sin(local_78.x);
|
|
scratchVec.x = (local_80.x * fVar2 - fVar1 * fVar3) * shotSpeed;
|
|
scratchVec.y = (fVar1 * fVar2 + local_80.x * fVar3) * shotSpeed;
|
|
Weapon::fire_bomb(in_ECX,&spawnPos,&scratchVec);
|
|
}
|
|
local_80.x = 0.0;
|
|
local_78.x = 0.0;
|
|
if ((short)multiShotParams < 1) {
|
|
return;
|
|
}
|
|
do {
|
|
shotDirection.y = fVar3;
|
|
shotDirection.x = fVar2;
|
|
Entity_Player::GetMultiShotPositionVelocity
|
|
(&multiShotOffset,GHIDRA_INT(local_78.x),5,shotDirection,shotSpeed,(short)multiShotParams,
|
|
fStack_3c,fStack_38,fStack_34,local_30,iStack_2c,fStack_28,(uint8_t)uStack_24,
|
|
(short)local_20);
|
|
scratchVec.x = spawnPos.x + multiShotOffset.x;
|
|
scratchVec.y = spawnPos.y + multiShotOffset.y;
|
|
firedBomb = Weapon::fire_bomb(in_ECX,&scratchVec,&multiShotVelocity);
|
|
if ((char)isLudovico != '\0') {
|
|
if (GHIDRA_CAST<Entity_Bomb *>(local_80.x) == GHIDRA_CAST<Entity_Bomb *>(0x0)) {
|
|
oldLink = *GHIDRA_CAST<Entity_Bomb **>((in_ECX + 1));
|
|
linkSlot = GHIDRA_CAST<Entity_Bomb *>((in_ECX + 1));
|
|
if (oldLink != firedBomb) goto LAB_009f9fda;
|
|
}
|
|
else {
|
|
oldLink = *GHIDRA_CAST<Entity_Bomb **>((GHIDRA_CAST<char *>(local_80.x) + 0x3c0));
|
|
linkSlot = GHIDRA_CAST<Entity_Bomb *>((GHIDRA_INT(local_80.x) + 0x3c0));
|
|
LAB_009f9fda:
|
|
if (oldLink != GHIDRA_CAST<Entity_Bomb *>(0x0)) {
|
|
local_80.x = (float)linkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_80);
|
|
}
|
|
*GHIDRA_CAST<Entity_Bomb **>(linkSlot) = firedBomb;
|
|
if (firedBomb != GHIDRA_CAST<Entity_Bomb *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(linkSlot);
|
|
}
|
|
}
|
|
in_ECX = weapon;
|
|
local_80.x = (float)firedBomb;
|
|
}
|
|
local_78.x = (float)(GHIDRA_INT(local_78.x) + 1);
|
|
if (GHIDRA_INT((short)multiShotParams) <= GHIDRA_INT(local_78.x)) {
|
|
return;
|
|
}
|
|
} while( true );
|
|
}
|
|
bomb = *GHIDRA_CAST<int *>((in_ECX + 1));
|
|
if ((bomb != 0) && (param_2 != 0)) {
|
|
aimDirection.x = param_1->x;
|
|
aimDirection.y = param_1->y;
|
|
if (1.0 < aimDirection.x * aimDirection.x + aimDirection.y * aimDirection.y) {
|
|
(GHIDRA_CAST<Vector *>((&aimDirection)))->Vector::Normalize();
|
|
}
|
|
fVar2 = *GHIDRA_CAST<float *>((bomb + 0x36c));
|
|
fVar3 = aimDirection.x * shotSpeed * 1.2 * 0.5;
|
|
fVar1 = aimDirection.y * shotSpeed * 1.2 * 0.5;
|
|
if (fVar2 != 0.0) {
|
|
*GHIDRA_CAST<float *>((bomb + 0x360)) =
|
|
(fVar3 * *GHIDRA_CAST<float *>((bomb + 0x39c))) / fVar2 + *GHIDRA_CAST<float *>((bomb + 0x360));
|
|
*GHIDRA_CAST<float *>((bomb + 0x364)) =
|
|
(fVar1 * *GHIDRA_CAST<float *>((bomb + 0x39c))) / fVar2 + *GHIDRA_CAST<float *>((bomb + 0x364));
|
|
bomb = *GHIDRA_CAST<int *>((in_ECX + 1));
|
|
}
|
|
for (bomb = *GHIDRA_CAST<int *>((bomb + 0x3c0)); bomb != 0; bomb = *GHIDRA_CAST<int *>((bomb + 0x3c0))) {
|
|
fVar2 = *GHIDRA_CAST<float *>((bomb + 0x36c));
|
|
if (fVar2 != 0.0) {
|
|
*GHIDRA_CAST<float *>((bomb + 0x360)) =
|
|
(*GHIDRA_CAST<float *>((bomb + 0x39c)) * fVar3) / fVar2 + *GHIDRA_CAST<float *>((bomb + 0x360));
|
|
*GHIDRA_CAST<float *>((bomb + 0x364)) =
|
|
(fVar1 * *GHIDRA_CAST<float *>((bomb + 0x39c))) / fVar2 + *GHIDRA_CAST<float *>((bomb + 0x364));
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 009fa190
|
|
Entity * Weapon_Bombs::GetFocusEntity()
|
|
{
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x34)) >> 4 & 1) == 0) {
|
|
return GHIDRA_CAST<Entity *>(0x0);
|
|
}
|
|
return *GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this) + 0x44));
|
|
}
|