#include "classes.h" // 004073c0 int GridEntity::GetType() { return (this->_desc)._type; } // 00428930 ANM2 * GridEntity::GetSprite() { return &this->_sprite; } // 0043eec0 int GridEntity::GetVariant() { return (this->_desc)._variant; } // 004e4830 int GridEntity::GetGridIndex() { return this->_gridIndex; } // 0067efc0 int GridEntity::VarData() { return (this->_desc)._varData; } // 006a80c0 undefined1 GridEntity::Hurt() { return 0; } // 00709c00 void GridEntity::SetType(undefined4 param_1) { int in_ECX; *GHIDRA_CAST((in_ECX + 4)) = param_1; return; } // 00709c10 byte GridEntity::Destroy(byte isImmediate) { byte bVar1; /* WARNING: Could not recover jumptable at 0x00709c20. Too many branches */ /* WARNING: Treating indirect jump as call */ bVar1 = this->Hurt(); return bVar1; } // 00709c30 undefined1 GridEntity::CanTakeDamageFromTearEffects() { return 1; } // 00709c40 GridEntity::GridEntity() { *GHIDRA_CAST(this) = IsaacRepentancePlus::GridEntity::vftable; (this->_desc)._type = 0; (this->_desc)._variant = 0; (this->_desc)._state = 0; (this->_desc)._spawnCount = 0; (this->_desc)._spawnSeed = 0x16a9de81; (this->_desc)._varData = 0; (this->_desc)._initialized = 0; (this->_desc)._variableSeed = 0x16a9de81; (this->_rng)._shift1 = 5; (this->_rng)._shift2 = 9; (this->_rng)._seed = -0x55e8beb1; (this->_rng)._shift3 = 7; (GHIDRA_CAST((&this->_sprite)))->ANM2::constructor(); return; } // 00709db0 void GridEntity::Init(uint Seed) { Game *game; int *spawnCount; (this->_desc)._spawnSeed = Seed; this->_collisionClass = 0; this->BeginBatches(); game = g_game; spawnCount = &(this->_desc)._spawnCount; *spawnCount = *spawnCount + 1; (this->_desc)._initialized = 1; this->_spawnFrame = game->_frameCount; return; } // 00709df0 Vector * GridEntity::Position(Vector *outPosition) { int gridIndex; int gridWidth; gridIndex = this->_gridIndex; gridWidth = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); outPosition->x = (float)(gridIndex % gridWidth) * 40.0 + 40.0; outPosition->y = (float)(gridIndex / gridWidth) * 40.0 + 120.0; return outPosition; } // 00709e50 Vector * GridEntity::get_render_position(Vector *outPosition) { float pixelScale; double dVar1; int gridIndex; int roomWidth; gridIndex = this->_gridIndex; pixelScale = g_displayPixelRatio * g_screenPointScale; roomWidth = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); dVar1 = floor((double)(((((float)(gridIndex % roomWidth) * 40.0 + 40.0) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5)); outPosition->x = (float)dVar1 / pixelScale; dVar1 = floor((double)(((((float)(gridIndex / roomWidth) * 40.0 + 120.0) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5)); outPosition->y = (float)dVar1 / pixelScale; return outPosition; } // 0070b2a0 byte GridEntity::IsBreakableRock() { int gridType; gridType = (this->_desc)._type; if ((gridType == 2) || ((gridType != 3 && (((((gridType == 4 || (gridType == 5)) || (gridType == 6)) || (gridType == 0x16)) || ((gridType != 0x18 && (((gridType == 0x19 || (gridType == 0x1a)) || (gridType == 0x1b)))))))) )) { return 1; } return 0; } // 0070ba00 GridEntity * GridEntity::InitSubclass(uint flags) { void *local_10; undefined1 *puStack_c; undefined4 local_8; puStack_c = &LAB_00afb440; local_10 = ExceptionList; ExceptionList = &local_10; local_8 = 0; (GHIDRA_CAST((GHIDRA_CAST((this[1]._sprite._championColor._colorize + 1)))))->ANM2::Reset(); (GHIDRA_CAST((GHIDRA_CAST(&this[2]._gridIndex))))->AnimationState::~AnimationState(); (GHIDRA_CAST((GHIDRA_CAST(&this[2]._desc))))->AnimationState::~AnimationState(); (GHIDRA_CAST((GHIDRA_CAST(&this[1]._sprite._flipX))))->std::string::_Tidy_deallocate(); (GHIDRA_CAST((GHIDRA_CAST((this[1]._sprite._championColor._colorize + 1)))))->std::string::_Tidy_deallocate(); FID_conflict__Tidy(this[1]._sprite._championColor._tint + 2); local_8 = 1; (GHIDRA_CAST((GHIDRA_CAST((this + 1)))))->ANM2::Reset(); (GHIDRA_CAST((GHIDRA_CAST(&this[1]._sprite._filename._size))))->AnimationState::~AnimationState(); (GHIDRA_CAST((GHIDRA_CAST(&this[1]._rng._shift1))))->AnimationState::~AnimationState(); (GHIDRA_CAST((GHIDRA_CAST(&this[1]._desc._varData))))->std::string::_Tidy_deallocate(); (GHIDRA_CAST((GHIDRA_CAST((this + 1)))))->std::string::_Tidy_deallocate(); *GHIDRA_CAST(this) = IsaacRepentancePlus::GridEntity::vftable; local_8 = 2; (GHIDRA_CAST((&this->_sprite)))->ANM2::Reset(); (GHIDRA_CAST((&(this->_sprite)._overlayAnimState)))->AnimationState::~AnimationState(); (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::~AnimationState(); (GHIDRA_CAST(((this->_sprite)._animDefaultName._buf)))->std::string::_Tidy_deallocate(); (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->std::string::_Tidy_deallocate(); if ((flags & 1) != 0) { operator_delete(this,0x390); } ExceptionList = local_10; return this; } // 0070bec0 byte GridEntity::IsEasyCrushableOrWalkable() { int gridType; if ((((((GHIDRA_UINT(this->_gridIndex) < 0x1c0) && (0 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_gridIndex * 4 + 0x76c)))) && (gridType = (this->_desc)._type, gridType != 2)) && ((gridType != 6 && (gridType != 4)))) && ((gridType != 0x16 && (gridType != 0x1a)))) && ((gridType != 0xe || ((this->_desc)._variant == 1)))) { return 0; } return 1; } // 0070bf10 byte GridEntity::IsDangerousCrushableOrWalkable() { int gridType; if (((((GHIDRA_UINT(this->_gridIndex) < 0x1c0) && (999 < *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_gridIndex * 4 + 0x76c)))) && (gridType = (this->_desc)._type, gridType != 0xc)) && ((gridType != 5 && (gridType != 8)))) && ((gridType != 9 && ((gridType != 0xe || ((this->_desc)._variant != 1)))))) { return 0; } return 1; } // 00738140 void GridEntity::SetVariant(int variant) { (this->_desc)._variant = variant; return; } // 00823150 void GridEntity::trigger_output(GridEntity *gridEntity) { int iVar1; EntityRef *source; uint seed; int soundId; Vector spawnPos; EntityRef destroySource; Manager *manager; iVar1 = (gridEntity->_desc)._type; if (iVar1 == 0xc) { if (GHIDRA_UINT((gridEntity->_desc)._state) < 4) { destroySource._position.y = g_vectorZero.y; destroySource._velocity.y = g_vectorZero.y; destroySource._type = 0; destroySource._variant = 0; destroySource._spawnerType = 0; destroySource._spawnerVariant = 0; destroySource._position.x = g_vectorZero.x; destroySource._velocity.x = g_vectorZero.x; destroySource._flags = 0; destroySource._entity = (void *)0x0; gridEntity->Destroy(1,&destroySource); return; } } else if (iVar1 == 0x14) { if ((gridEntity->_desc)._state == 0) { (GHIDRA_CAST((&gridEntity->_sprite)))->ANM2::Play(GHIDRA_CAST("Switched"),0); return; } } else if (iVar1 == 2) { if (((gridEntity->_desc)._varData != 0) && ((gridEntity->_desc)._state == 1)) { source = (GHIDRA_CAST((&destroySource)))->EntityRef::EntityRef(); gridEntity->Destroy(1,source); return; } } else if (iVar1 == 7) { if (((gridEntity->_desc)._varData != 0) && ((gridEntity->_desc)._state == 0)) { seed = Random(); iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); spawnPos.x = (float)(gridEntity->_gridIndex % iVar1) * 40.0 + 40.0; spawnPos.y = (float)(gridEntity->_gridIndex / iVar1) * 40.0 + 120.0; (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,&spawnPos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); manager = g_manager; soundId = 0x89; seed_fart_sound_override(&soundId); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); if ((gridEntity->_desc)._state == 0) { (gridEntity->_desc)._state = 2; (GHIDRA_CAST((GHIDRA_CAST(gridEntity))))->GridEntity_Pit::UpdateCollision(); return; } } } else if (iVar1 == 0x17) { if ((gridEntity->_desc)._state == 2) { (GHIDRA_CAST((&gridEntity->_sprite)))->ANM2::Play(GHIDRA_CAST("TurnOn"),0); (gridEntity->_desc)._state = 1; return; } (GHIDRA_CAST((&gridEntity->_sprite)))->ANM2::Play(GHIDRA_CAST("TurnOff"),0); (gridEntity->_desc)._state = 2; } return; } // 0085dda0 RNG * GridEntity::GetRNG() { return &this->_rng; } // 008c5cd9 void GridEntity::HurtWithSource() { int *in_ECX; /* WARNING: Could not recover jumptable at 0x008c5cdb. Too many branches */ /* WARNING: Treating indirect jump as call */ (**(code **)(*in_ECX + 0x10))(); return; } // 008c5ce8 void GridEntity::PostInit() { int *in_ECX; /* WARNING: Could not recover jumptable at 0x008c5cea. Too many branches */ /* WARNING: Treating indirect jump as call */ (**(code **)(*in_ECX + 4))(); return; }